Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7130d91e

Von Sven Schöling vor fast 15 Jahren hinzugefügt

  • ID 7130d91ec4941cad5aba49bdd39911a2d5fa9a89
  • Vorgänger b8916e5c
  • Nachfolger cb0dfa9a

form_footer 2. Version

Unterschiede anzeigen:

bin/mozilla/is.pl
397 397
  $form->{rows} = ($rows > $introws) ? $rows : $introws;
398 398

  
399 399
  my ($tax, $subtotal);
400
  if (!$form->{taxincluded}) {
400
  $form->{taxaccounts_array} = [ split / /, $form->{taxaccounts} ];
401 401

  
402
    foreach my $item (split / /, $form->{taxaccounts}) {
403
      if ($form->{"${item}_base"}) {
402
  foreach my $item (@{ $form->{taxaccounts_array} }) {
403
    if ($form->{"${item}_base"}) {
404
      if ($form->{taxincluded}) {
405
        $form->{"${item}_total"} = $form->round_amount( ($form->{"${item}_base"} * $form->{"${item}_rate"}
406
                                                                                 / (1 + $form->{"${item}_rate"})), 2);
407
        $form->{"${item}_netto"} = $form->round_amount( ($form->{"${item}_base"} - $form->{"${item}_total"}), 2);
408
      } else {
404 409
        $form->{"${item}_total"} = $form->round_amount( $form->{"${item}_base"} * $form->{"${item}_rate"}, 2);
405 410
        $form->{invtotal} += $form->{"${item}_total"};
406
        $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
407

  
408
        $tax .= qq|
409
	      <tr>
410
                <th align="right">$form->{"${item}_description"}&nbsp;| . $form->{"${item}_rate"} * 100 .qq|%</th>
411
                <td align="right">$form->{"${item}_total"}</td>
412
	      </tr> |;
413 411
      }
414 412
    }
415

  
416
#    $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
417

  
418
    $subtotal = qq|
419
	      <tr>
420
		<th align="right">| . $locale->text('Subtotal') . qq|</th>
421
		<td align="right">$form->{invsubtotal}</td>
422
	      </tr>
423
|;
424

  
425
  }
426

  
427
  if ($form->{taxincluded}) {
428
    $form->{taxaccounts_array} = [ split / /, $form->{taxaccounts} ];
429
    foreach my $item (split / /, $form->{taxaccounts}) {
430
      if ($form->{"${item}_base"}) {
431
        $form->{"${item}_total"} = $form->round_amount( ($form->{"${item}_base"} * $form->{"${item}_rate"} / (1 + $form->{"${item}_rate"})), 2);
432
        $form->{"${item}_netto"} = $form->round_amount( ($form->{"${item}_base"} - $form->{"${item}_total"}), 2);
433
        $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
434
        $form->{"${item}_netto"} = $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
435

  
436
#        $tax .= qq|
437
#	      <tr>
438
#		<th align="right">Enthaltene $form->{"${item}_description"}&nbsp;|
439
#		                    . $form->{"${item}_rate"} * 100 .qq|%</th>
440
#		<td align="right">$form->{"${item}_total"}</td>
441
#	      </tr>
442
#	      <tr>
443
#	        <th align="right">Nettobetrag</th>
444
#		<td align="right">$form->{"${item}_netto"}</td>
445
#	      </tr>
446
#|;
447
      }
448
    }
449

  
450 413
  }
451 414

  
452 415
  $form->{oldinvtotal} = $form->{invtotal};
453
#  $form->{invtotal}    = $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
454 416

  
455 417
  # unfortunately locales doesn't support extended syntax
456 418
  if ($form->{id}) {
457 419
    my $follow_ups = FU->follow_ups('trans_id' => $form->{id});
458 420
    if (@{ $follow_ups} ) {
459
      $form->{follow_ups_text} = $locale->text("There are #1 unfinished follow-ups of which #2 are due.",
460
                                               scalar @{ $follow_ups },
421
      $form->{follow_up_text} = $locale->text("There are #1 unfinished follow-ups of which #2 are due.",
422
                                               scalar(@{ $follow_ups }),
461 423
                                               sum map { $_->{due} * 1 } @{ $follow_ups });
462 424
    }
463 425
  }
464 426

  
465 427

  
428
# payments
429
  my $totalpaid = 0;
430

  
431
  $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
432
  $form->{paid_indices} = [ 1 .. $form->{paidaccounts} ];
433

  
434
  for my $i (1 .. $form->{paidaccounts}) {
435
    $form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
436
    $form->{"selectAR_paid_$i"} =~ s/option>\Q$form->{"AR_paid_$i"}\E/option selected>$form->{"AR_paid_$i"}/;
437

  
438
    # format amounts
439
    $totalpaid += $form->{"paid_$i"};
440
    if ($form->{"paid_$i"}) {
441
      $form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
442
    }
443
    $form->{"exchangerate_$i"} = $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
444
    $form->{"exchangerate_$i"} ||= "";
445
  }
446

  
447

  
448
  $form->{print_options} = print_options(inline => 1);
449

  
466 450
  print $form->parse_html_template('is/form_footer');
451
# print $form->parse_html_template('is/_payments'); # parser
452

  
453

  
467 454

  
468 455
#  print qq|
469 456
#  <tr>

Auch abrufbar als: Unified diff