Revision abfe327e
Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt
bin/mozilla/ar.pl | ||
---|---|---|
76 | 76 |
# $locale->text('Nov') |
77 | 77 |
# $locale->text('Dec') |
78 | 78 |
|
79 |
my $totalpaid; |
|
80 |
|
|
81 | 79 |
sub add { |
82 | 80 |
$main::lxdebug->enter_sub(); |
83 | 81 |
|
... | ... | |
705 | 703 |
"; |
706 | 704 |
|
707 | 705 |
my @triggers = (); |
708 |
my $totalpaid = 0;
|
|
706 |
$form->{totalpaid} = 0;
|
|
709 | 707 |
|
710 | 708 |
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); |
711 | 709 |
for my $i (1 .. $form->{paidaccounts}) { |
... | ... | |
720 | 718 |
'-labels' => \%AR_paid_labels, |
721 | 719 |
'-default' => $form->{"AR_paid_$i"})); |
722 | 720 |
|
723 |
$totalpaid += $form->{"paid_$i"};
|
|
721 |
$form->{totalpaid} += $form->{"paid_$i"};
|
|
724 | 722 |
|
725 | 723 |
# format amounts |
726 | 724 |
if ($form->{"paid_$i"}) { |
... | ... | |
778 | 776 |
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); |
779 | 777 |
} |
780 | 778 |
|
781 |
my $paid_missing = $form->{invtotal_unformatted} - $totalpaid;
|
|
779 |
my $paid_missing = $form->{invtotal_unformatted} - $form->{totalpaid};
|
|
782 | 780 |
|
783 | 781 |
print qq| |
784 | 782 |
<tr> |
785 | 783 |
<td></td> |
786 | 784 |
<td></td> |
787 | 785 |
<td align="center">| . $locale->text('Total') . qq|</td> |
788 |
<td align="center">| . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq|</td>
|
|
786 |
<td align="center">| . H($form->format_amount(\%myconfig, $form->{totalpaid}, 2)) . qq|</td>
|
|
789 | 787 |
</tr> |
790 | 788 |
<tr> |
791 | 789 |
<td></td> |
... | ... | |
862 | 860 |
|
863 | 861 |
# ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it |
864 | 862 |
print qq| <input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|"> | |
865 |
if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar') && (($totalpaid == 0) || ($totalpaid eq "")));
|
|
863 |
if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar') && (($form->{totalpaid} == 0) || ($form->{totalpaid} eq "")));
|
|
866 | 864 |
|
867 | 865 |
if ($form->{id}) { |
868 | 866 |
if ($form->{radier}) { |
... | ... | |
1005 | 1003 |
$form->parse_amount(\%myconfig, $form->{"${_}_$i"}) |
1006 | 1004 |
} qw(paid exchangerate); |
1007 | 1005 |
|
1008 |
$totalpaid += $form->{"paid_$i"};
|
|
1006 |
$form->{totalpaid} += $form->{"paid_$i"};
|
|
1009 | 1007 |
|
1010 | 1008 |
$form->{"forex_$i"} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'); |
1011 | 1009 |
$form->{"exchangerate_$i"} = $form->{"forex_$i"} if $form->{"forex_$i"}; |
... | ... | |
1013 | 1011 |
} |
1014 | 1012 |
|
1015 | 1013 |
$form->{creditremaining} -= |
1016 |
($form->{invtotal} - $totalpaid + $form->{oldtotalpaid} -
|
|
1014 |
($form->{invtotal} - $form->{totalpaid} + $form->{oldtotalpaid} -
|
|
1017 | 1015 |
$form->{oldinvtotal}); |
1018 | 1016 |
$form->{oldinvtotal} = $form->{invtotal}; |
1019 |
$form->{oldtotalpaid} = $totalpaid;
|
|
1017 |
$form->{oldtotalpaid} = $form->{totalpaid};
|
|
1020 | 1018 |
|
1021 | 1019 |
&display_form; |
1022 | 1020 |
|
Auch abrufbar als: Unified diff
Globale Variable umgewandelt.