1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #======================================================================
30 # Accounts Receivables
32 #======================================================================
39 require "$form->{path}/arap.pl";
45 # this is for our long dates
46 # $locale->text('January')
47 # $locale->text('February')
48 # $locale->text('March')
49 # $locale->text('April')
50 # $locale->text('May ')
51 # $locale->text('June')
52 # $locale->text('July')
53 # $locale->text('August')
54 # $locale->text('September')
55 # $locale->text('October')
56 # $locale->text('November')
57 # $locale->text('December')
59 # this is for our short month
60 # $locale->text('Jan')
61 # $locale->text('Feb')
62 # $locale->text('Mar')
63 # $locale->text('Apr')
64 # $locale->text('May')
65 # $locale->text('Jun')
66 # $locale->text('Jul')
67 # $locale->text('Aug')
68 # $locale->text('Sep')
69 # $locale->text('Oct')
70 # $locale->text('Nov')
71 # $locale->text('Dec')
74 $lxdebug->enter_sub();
76 $form->{title} = "Add";
78 "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
79 unless $form->{callback};
82 AR->get_transdate(\%myconfig, $form);
85 $lxdebug->leave_sub();
89 $lxdebug->enter_sub();
91 $form->{title} = "Edit";
96 $lxdebug->leave_sub();
100 $lxdebug->enter_sub();
105 $lxdebug->leave_sub();
109 $lxdebug->enter_sub();
111 $form->create_links("AR", \%myconfig, "customer");
112 $duedate = $form->{duedate};
114 $taxincluded = $form->{taxincluded};
115 my $id = $form->{id};
116 IS->get_customer(\%myconfig, \%$form);
117 $form->{taxincluded} = $taxincluded;
120 $form->{duedate} = $duedate if $duedate;
121 $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
122 $form->{rowcount} = 1;
125 @curr = split(/:/, $form->{currencies});
127 $form->{defaultcurrency} = $curr[0];
129 map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
132 if (@{ $form->{all_customer} }) {
133 $form->{customer} = "$form->{customer}--$form->{customer_id}";
134 map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}\n" }
135 (@{ $form->{all_customer} });
139 if (@{ $form->{all_departments} }) {
140 $form->{selectdepartment} = "<option>\n";
141 $form->{department} = "$form->{department}--$form->{department_id}";
144 $form->{selectdepartment} .=
145 "<option>$_->{description}--$_->{id}\n"
146 } (@{ $form->{all_departments} });
149 $form->{employee} = "$form->{employee}--$form->{employee_id}";
152 if (@{ $form->{all_employees} }) {
153 $form->{selectemployee} = "";
154 map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
155 (@{ $form->{all_employees} });
158 # build the popup menus
159 $form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked";
163 qq|<option value=\"$_->{id}--$_->{rate}\">$_->{taxdescription} |
164 . ($_->{rate} * 100) . qq| %|
166 $form->{taxchart} = $tax;
167 $form->{selecttaxchart} = $tax;
170 $form->{forex} = $form->{exchangerate};
171 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
172 foreach $key (keys %{ $form->{AR_links} }) {
174 foreach $ref (@{ $form->{AR_links}{$key} }) {
175 if ($key eq "AR_paid") {
176 $form->{"select$key"} .=
177 "<option value=\"$ref->{accno}\">$ref->{accno}--$ref->{description}</option>\n";
179 $form->{"select$key"} .=
180 "<option value=\"$ref->{accno}--$ref->{tax_id}\">$ref->{accno}--$ref->{description}</option>\n";
184 $form->{$key} = $form->{"select$key"};
186 # if there is a value we have an old entry
190 for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
191 if ($key eq "AR_paid") {
193 $form->{"AR_paid_$j"} =
194 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
197 $form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
198 $form->{"datepaid_$j"} =
199 $form->{acc_trans}{$key}->[$i - 1]->{transdate};
200 $form->{"source_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
201 $form->{"memo_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
203 $form->{"forex_$j"} = $form->{"exchangerate_$i"} =
204 $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
205 $form->{"AR_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}";
206 $form->{paidaccounts}++;
212 if ($key eq "AR_tax" || $key eq "AP_tax") {
213 $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
214 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
215 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
217 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
220 if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
222 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
224 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
227 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
229 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
231 $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
232 $form->{"tax_$index"} = $form->{acc_trans}{$key}->[$i - 1]->{amount};
233 $totaltax += $form->{"tax_$index"};
237 $form->{"${akey}_$k"} =
239 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
241 if ($akey eq 'amount') {
243 $totalamount += $form->{"${akey}_$i"};
245 $form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"} =
246 "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}";
247 $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate};
248 $form->{"project_id_$k"} =
249 "$form->{acc_trans}{$key}->[$i-1]->{project_id}";
251 $form->{"${key}_$k"} =
252 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
253 $form->{"${key}_$i"} =
254 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
255 my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description});
256 $form->{"select${key}"} =~
257 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)\">$form->{acc_trans}{$key}->[$i-1]->{accno}--${q_description}<\/option>\n/;
258 $form->{"${key}_$k"} = $1;
259 if ($akey eq 'amount') {
260 $form->{"taxchart_$k"} = $form->{taxchart};
261 $form->{"taxchart_$k"} =~
262 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{id}--[^\"]*)/;
263 $form->{"taxchart_$k"} = $1;
270 $form->{taxincluded} = $taxincluded if ($form->{id});
271 $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
273 if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
275 # add tax to amounts and invtotal
276 for $i (1 .. $form->{rowcount}) {
278 ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
279 $tax = $form->round_amount($taxamount, 2);
280 $diff += ($taxamount - $tax);
281 $form->{"amount_$i"} += $form->{"tax_$i"};
283 $form->{amount_1} += $form->round_amount($diff, 2);
286 $taxamount = $form->round_amount($taxamount, 2);
287 $form->{tax} = $taxamount;
289 $form->{invtotal} = $totalamount + $totaltax;
292 ($form->datetonum($form->{transdate}, \%myconfig) <=
293 $form->datetonum($form->{closedto}, \%myconfig));
295 $form->{"ARselected"} = $form->{"AR_1"};
297 $lxdebug->leave_sub();
301 $lxdebug->enter_sub();
303 $title = $form->{title};
304 $form->{title} = $locale->text("$title Accounts Receivables Transaction");
306 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
308 # $locale->text('Add Accounts Receivables Transaction')
309 # $locale->text('Edit Accounts Receivables Transaction')
310 $form->{javascript} = qq|<script type="text/javascript">
312 function setTaxkey(accno, row) {
313 var taxkey = accno.options[accno.selectedIndex].value;
314 var reg = /--([0-9]*)/;
315 var found = reg.exec(taxkey);
316 var index = found[1];
317 index = parseInt(index);
318 var tax = 'taxchart_' + row;
319 for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
320 var reg2 = new RegExp("^"+ index, "");
321 if (reg2.exec(document.getElementById(tax).options[i].value)) {
322 document.getElementById(tax).options[i].selected = true;
330 $readonly = ($form->{id}) ? "readonly" : "";
333 ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
334 $readonly = ($form->{radier}) ? "" : $readonly;
336 my $ARselected_quoted = quotemeta($form->{"ARselected"});
337 $form->{selectAR} = $form->{AR};
339 s/value=\"${ARselected_quoted}\"/value=\"$form->{ARselected}\" selected/;
341 # set option selected
342 foreach $item (qw(customer currency department employee)) {
343 $form->{"select$item"} =~ s/ selected//;
344 $form->{"select$item"} =~
345 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
347 $selectAR_amount_unquoted = $form->{selectAR_amount};
348 $taxchart = $form->{taxchart};
349 map { $form->{$_} =~ s/\"/"/g }
350 qw(AR_amount selectAR_amount AR taxchart);
353 $form->{exchangerate} =
354 $form->format_amount(\%myconfig, $form->{exchangerate});
356 $form->{creditlimit} =
357 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
358 $form->{creditremaining} =
359 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
362 <input type=hidden name=forex value=$form->{forex}>
364 if ($form->{currency} ne $form->{defaultcurrency}) {
365 if ($form->{forex}) {
367 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
368 <td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td>
372 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
373 <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
382 <td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
383 <th align=left nowrap>| . $locale->text('Tax Included') . qq|</th>
387 if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) {
391 qq|<textarea name=notes rows=$rows cols=50 wrap=soft>$form->{notes}</textarea>|;
395 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
396 <td colspan=3><select name=department>$form->{selectdepartment}</select>
397 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
400 | if $form->{selectdepartment};
402 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
405 ($form->{selectcustomer})
406 ? qq|<select name=customer>$form->{selectcustomer}</select>|
407 : qq|<input name=customer value="$form->{customer}" size=35>|;
410 <input type=hidden name=employee value="$form->{employee}">
413 if ($form->{selectemployee}) {
416 <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
417 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
418 <input type=hidden name=selectemployee value="$form->{selectemployee}">
423 $form->{fokus} = "arledger.customer";
425 # use JavaScript Calendar or not
426 $form->{jsscript} = $jscalendar;
428 if ($form->{jsscript}) {
430 # with JavaScript Calendar
432 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
433 <td><input type=button name=transdate id="trigger1" value=|
434 . $locale->text('button') . qq|></td>
437 <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
438 <td><input type=button name=duedate id="trigger2" value=|
439 . $locale->text('button') . qq|></td></td>
444 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
445 "duedate", "BL", "trigger2");
448 # without JavaScript Calendar
450 qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
452 qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
458 <body onLoad="fokus()">
460 <form method=post name="arledger" action=$form->{script}>
462 <input type=hidden name=id value=$form->{id}>
463 <input type=hidden name=sort value=$form->{sort}>
464 <input type=hidden name=closedto value=$form->{closedto}>
465 <input type=hidden name=locked value=$form->{locked}>
466 <input type=hidden name=title value="$title">
470 <th class=listtop>$form->{title}</th>
480 <th align="right" nowrap>| . $locale->text('Customer') . qq|</th>
481 <td colspan=3>$customer</td>
482 <input type=hidden name=selectcustomer value="$form->{selectcustomer}">
483 <input type=hidden name=oldcustomer value="$form->{oldcustomer}">
484 <input type=hidden name=customer_id value="$form->{customer_id}">
485 <input type=hidden name=terms value=$form->{terms}>
492 <th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th>
493 <td>$form->{creditlimit}</td>
494 <th align=left nowrap>| . $locale->text('Remaining') . qq|</th>
495 <td class="plus$n">$form->{creditremaining}</td>
496 <input type=hidden name=creditlimit value=$form->{creditlimit}>
497 <input type=hidden name=creditremaining value=$form->{creditremaining}>
503 <th align=right>| . $locale->text('Currency') . qq|</th>
504 <td><select name=currency>$form->{selectcurrency}</select></td>
505 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
506 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
507 <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
508 <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
519 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
520 <td><input name=invnumber size=11 value="$form->{invnumber}"></td>
523 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
524 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
527 <th align=right nowrap>| . $locale->text('Invoice Date') . qq|</th>
531 <th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
542 <input type=hidden name=selectAR_amount value="$form->{selectAR_amount}">
543 <input type=hidden name=AR_amount value="$form->{AR_amount}">
544 <input type=hidden name=taxchart value="$form->{taxchart}">
545 <input type=hidden name=rowcount value=$form->{rowcount}>
549 <tr class=listheading>
550 <th class=listheading style="width:15%">|
551 . $locale->text('Account') . qq|</th>
552 <th class=listheading style="width:10%">|
553 . $locale->text('Amount') . qq|</th>
554 <th class=listheading style="width:10%">|
555 . $locale->text('Tax') . qq|</th>
556 <th class=listheading style="width:5%">|
557 . $locale->text('Korrektur') . qq|</th>
558 <th class=listheading style="width:10%">|
559 . $locale->text('Taxkey') . qq|</th>
560 <th class=listheading style="width:10%">|
561 . $locale->text('Project') . qq|</th>
565 $amount = $locale->text('Amount');
566 $project = $locale->text('Project');
568 for $i (1 .. $form->{rowcount}) {
571 $form->{"amount_$i"} =
572 $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
573 $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
574 $selectAR_amount = $selectAR_amount_unquoted;
576 s/option value=\"$form->{"AR_amount_$i"}\"/option value=\"$form->{"AR_amount_$i"}\" selected/;
578 $tax_selected = $form->{"taxchart_$i"};
579 $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
581 qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
582 $korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : '');
586 <td width=50%><select name="AR_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAR_amount</select></td>
587 <td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
588 <td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
589 <td><input type="checkbox" name="korrektur_$i" value="1" $korrektur_checked></td>
591 <td><input name="projectnumber_$i" size=20 value="$form->{"projectnumber_$i"}">
592 <input type=hidden name="project_id_$i" value=$form->{"project_id_$i"}>
593 <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}"></td>
600 $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
609 <td><select name=ARselected>$form->{selectAR}</select></td>
610 <input type=hidden name=AR value="$form->{AR}">
611 <th align=left>$form->{invtotal}</th>
613 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
614 <input type=hidden name=oldtotalpaid value=$form->{oldtotalpaid}>
616 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
629 <th align=left width=1%>| . $locale->text('Notes') . qq|</th>
630 <td align=left>$notes</td>
638 <tr class=listheading>
639 <th colspan=6 class=listheading>|
640 . $locale->text('Incoming Payments') . qq|</th>
644 if ($form->{currency} eq $form->{defaultcurrency}) {
645 @column_index = qw(datepaid source memo paid AR_paid);
647 @column_index = qw(datepaid source memo paid exchangerate AR_paid);
650 $column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
651 $column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
652 $column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
653 $column_data{AR_paid} = "<th>" . $locale->text('Account') . "</th>";
654 $column_data{source} = "<th>" . $locale->text('Source') . "</th>";
655 $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
660 map { print "$column_data{$_}\n" } @column_index;
666 $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
667 for $i (1 .. $form->{paidaccounts}) {
672 $form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
673 $form->{"selectAR_paid_$i"} =~
674 s/option value=\"$form->{"AR_paid_$i"}\">/option value=\"$form->{"AR_paid_$i"}\" selected>/;
677 if ($form->{"paid_$i"}) {
679 $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
681 $form->{"exchangerate_$i"} =
682 $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
684 $exchangerate = qq| |;
685 if ($form->{currency} ne $form->{defaultcurrency}) {
686 if ($form->{"forex_$i"}) {
688 qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
691 qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
696 <input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
700 qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
701 $column_data{AR_paid} =
702 qq|<td align=center><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
703 $column_data{exchangerate} = qq|<td align=center>$exchangerate</td>|;
704 $column_data{datepaid} =
705 qq|<td align=center><input name="datepaid_$i" size=11 value=$form->{"datepaid_$i"}>
706 <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
707 $column_data{source} =
708 qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
710 qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
712 map { print qq|$column_data{$_}\n| } @column_index;
717 push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
719 map { $form->{$_} =~ s/\"/"/g } qw(selectAR_paid);
721 print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
723 <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
724 <input type=hidden name=selectAR_paid value="$form->{selectAR_paid}">
730 <td><hr size=3 noshade></td>
735 $lxdebug->leave_sub();
739 $lxdebug->enter_sub();
743 <input name=callback type=hidden value="$form->{callback}">
745 <input type=hidden name=path value=$form->{path}>
746 <input type=hidden name=login value=$form->{login}>
747 <input type=hidden name=password value=$form->{password}>
752 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
753 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
756 if ($form->{radier}) {
757 print qq|<input class=submit type=submit name=action value="|
758 . $locale->text('Update') . qq|">
762 <input class=submit type=submit name=action value="|
763 . $locale->text('Post') . qq|">
764 <input class=submit type=submit name=action value="|
765 . $locale->text('Delete') . qq|">
768 if ($transdate > $closedto) {
770 <input class=submit type=submit name=action value="|
771 . $locale->text('Use As Template') . qq|">
776 if ($transdate > $closedto) {
777 print qq|<input class=submit type=submit name=action value="|
778 . $locale->text('Update') . qq|">
779 <input class=submit type=submit name=action value="|
780 . $locale->text('Post') . qq|">|;
791 $lxdebug->leave_sub();
795 $lxdebug->enter_sub();
803 $form->{invtotal} = 0;
805 # $form->{selectAR_amount} = $form->{AR_amount};
806 # $form->{selectAR_amount} =~
807 # s/value=\"$form->{AR_amountselected}\"/value=\"$form->{AR_amountselected}\" selected/;
809 ($AR_amountaccno, $AR_amounttaxkey) =
810 split(/--/, $form->{AR_amountselected});
811 $form->{selecttaxchart} = $form->{taxchart};
812 $form->{selecttaxchart} =~
813 s/value=\"$AR_amounttaxkey--([^\"]*)\"/value=\"$AR_amounttaxkey--$1\" selected/;
817 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
818 qw(exchangerate creditlimit creditremaining);
820 @flds = qw(amount AR_amount projectnumber oldprojectnumber project_id);
824 for $i (1 .. $form->{rowcount}) {
825 $form->{"amount_$i"} =
826 $form->parse_amount(\%myconfig, $form->{"amount_$i"});
827 $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
828 if ($form->{"amount_$i"}) {
831 if (!$form->{"korrektur_$i"}) {
832 ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
834 if ($form->{taxincluded}) {
835 $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate;
837 $form->{"tax_$i"} = $form->{"amount_$i"} * $rate;
840 $form->{"tax_$i"} = 0;
843 $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"}, 2);
845 $totaltax += $form->{"tax_$i"};
846 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
851 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
852 $form->{rowcount} = $count + 1;
853 map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount});
855 $form->{exchangerate} = $exchangerate
859 $form->check_exchangerate(
860 \%myconfig, $form->{currency}, $form->{transdate}, 'buy'
863 $form->{invdate} = $form->{transdate};
864 $save_AR = $form->{AR};
865 &check_name(customer);
866 $form->{AR} = $save_AR;
871 ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
873 for $i (1 .. $form->{paidaccounts}) {
874 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
877 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
878 } qw(paid exchangerate);
880 $totalpaid += $form->{"paid_$i"};
882 $form->{"exchangerate_$i"} = $exchangerate
884 $form->{"forex_$i"} = (
886 $form->check_exchangerate(
887 \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'
892 $form->{creditremaining} -=
893 ($form->{invtotal} - $totalpaid + $form->{oldtotalpaid} -
894 $form->{oldinvtotal});
895 $form->{oldinvtotal} = $form->{invtotal};
896 $form->{oldtotalpaid} = $totalpaid;
900 $lxdebug->leave_sub();
904 $lxdebug->enter_sub();
906 # check if there is an invoice number, invoice and due date
907 $form->isblank("transdate", $locale->text('Invoice Date missing!'));
908 $form->isblank("duedate", $locale->text('Due Date missing!'));
909 $form->isblank("customer", $locale->text('Customer missing!'));
911 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
912 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
914 $form->error($locale->text('Cannot post transaction for a closed period!'))
915 if ($transdate <= $closedto);
917 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
918 if ($form->{currency} ne $form->{defaultcurrency});
922 for $i (1 .. $form->{paidaccounts}) {
923 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
924 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
926 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
928 $form->error($locale->text('Cannot post payment for a closed period!'))
929 if ($datepaid <= $closedto);
931 if ($form->{currency} ne $form->{defaultcurrency}) {
932 $form->{"exchangerate_$i"} = $form->{exchangerate}
933 if ($transdate == $datepaid);
934 $form->isblank("exchangerate_$i",
935 $locale->text('Exchangerate for payment missing!'));
940 # if oldcustomer ne customer redo form
941 ($customer) = split /--/, $form->{customer};
942 if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
947 ($creditaccno, $credittaxkey) = split /--/, $form->{AR_amountselected};
948 ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
949 ($receivablesaccno, $payablestaxkey) = split /--/, $form->{ARselected};
950 $form->{AR}{amount_1} = $creditaccno;
951 $form->{AR}{receivables} = $receivablesaccno;
952 $form->{taxkey} = $taxkey;
954 $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber")
955 unless $form->{invnumber};
957 $form->{id} = 0 if $form->{postasnew};
959 $form->redirect($locale->text('Transaction posted!'))
960 if (AR->post_transaction(\%myconfig, \%$form));
961 $form->error($locale->text('Cannot post transaction!'));
963 $lxdebug->leave_sub();
967 $lxdebug->enter_sub();
969 $form->{postasnew} = 1;
972 $lxdebug->leave_sub();
975 sub use_as_template {
976 $lxdebug->enter_sub();
978 map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
979 $form->{paidaccounts} = 1;
981 $form->{invdate} = $form->current_date(\%myconfig);
984 $lxdebug->leave_sub();
988 $lxdebug->enter_sub();
990 $form->{title} = $locale->text('Confirm!');
994 delete $form->{header};
999 <form method=post action=$form->{script}>
1002 foreach $key (keys %$form) {
1003 $form->{$key} =~ s/\"/"/g;
1004 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1008 <h2 class=confirm>$form->{title}</h2>
1011 . $locale->text('Are you sure you want to delete Transaction')
1012 . qq| $form->{invnumber}</h4>
1014 <input name=action class=submit type=submit value="|
1015 . $locale->text('Yes') . qq|">
1022 $lxdebug->leave_sub();
1026 $lxdebug->enter_sub();
1028 $form->redirect($locale->text('Transaction deleted!'))
1029 if (AR->delete_transaction(\%myconfig, \%$form, $spool));
1030 $form->error($locale->text('Cannot delete transaction!'));
1032 $lxdebug->leave_sub();
1036 $lxdebug->enter_sub();
1038 # setup customer selection
1039 $form->all_vc(\%myconfig, "customer", "AR");
1041 if (@{ $form->{all_customer} }) {
1042 map { $customer .= "<option>$_->{name}--$_->{id}\n" }
1043 @{ $form->{all_customer} };
1044 $customer = qq|<select name=customer><option>\n$customer</select>|;
1046 $customer = qq|<input name=customer size=35>|;
1050 if (@{ $form->{all_departments} }) {
1051 $form->{selectdepartment} = "<option>\n";
1054 $form->{selectdepartment} .=
1055 "<option>$_->{description}--$_->{id}\n"
1056 } (@{ $form->{all_departments} });
1061 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1062 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1064 | if $form->{selectdepartment};
1066 $form->{title} = $locale->text('AR Transactions');
1068 # use JavaScript Calendar or not
1069 $form->{jsscript} = $jscalendar;
1071 if ($form->{jsscript}) {
1073 # with JavaScript Calendar
1075 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1076 <input type=button name=transdatefrom id="trigger1" value=|
1077 . $locale->text('button') . qq|></td>
1080 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1081 <input type=button name=transdateto name=transdateto id="trigger2" value=|
1082 . $locale->text('button') . qq|></td>
1087 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
1088 "transdateto", "BL", "trigger2");
1091 # without JavaScript Calendar
1093 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1095 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1098 $form->{fokus} = "search.customer";
1102 <body onLoad="fokus()">
1104 <form method=post name="search" action=$form->{script}>
1107 <tr><th class=listtop>$form->{title}</th></tr>
1108 <tr height="5"></tr>
1113 <th align=right>| . $locale->text('Customer') . qq|</th>
1114 <td colspan=3>$customer</td>
1118 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
1119 <td colspan=3><input name=invnumber size=20></td>
1122 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
1123 <td colspan=3><input name=ordnumber size=20></td>
1126 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1127 <td colspan=3><input name=notes size=40></td>
1130 <th align=right nowrap>| . $locale->text('From') . qq|</th>
1132 <th align=right>| . $locale->text('Bis') . qq|</th>
1135 <input type=hidden name=sort value=transdate>
1143 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
1147 <td align=right><input name=open class=checkbox type=checkbox value=Y checked></td>
1148 <td nowrap>| . $locale->text('Open') . qq|</td>
1149 <td align=right><input name=closed class=checkbox type=checkbox value=Y></td>
1150 <td nowrap>| . $locale->text('Closed') . qq|</td>
1153 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
1154 <td nowrap>| . $locale->text('ID') . qq|</td>
1155 <td align=right><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
1156 <td nowrap>| . $locale->text('Invoice Number') . qq|</td>
1157 <td align=right><input name="l_ordnumber" class=checkbox type=checkbox value=Y></td>
1158 <td nowrap>| . $locale->text('Order Number') . qq|</td>
1159 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
1160 <td nowrap>| . $locale->text('Invoice Date') . qq|</td>
1163 <td align=right><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
1164 <td nowrap>| . $locale->text('Customer') . qq|</td>
1165 <td align=right><input name="l_netamount" class=checkbox type=checkbox value=Y></td>
1166 <td nowrap>| . $locale->text('Amount') . qq|</td>
1167 <td align=right><input name="l_tax" class=checkbox type=checkbox value=Y></td>
1168 <td nowrap>| . $locale->text('Tax') . qq|</td>
1169 <td align=right><input name="l_amount" class=checkbox type=checkbox value=Y checked></td>
1170 <td nowrap>| . $locale->text('Total') . qq|</td>
1173 <td align=right><input name="l_datepaid" class=checkbox type=checkbox value=Y></td>
1174 <td nowrap>| . $locale->text('Date Paid') . qq|</td>
1175 <td align=right><input name="l_paid" class=checkbox type=checkbox value=Y checked></td>
1176 <td nowrap>| . $locale->text('Paid') . qq|</td>
1177 <td align=right><input name="l_duedate" class=checkbox type=checkbox value=Y></td>
1178 <td nowrap>| . $locale->text('Due Date') . qq|</td>
1179 <td align=right><input name="l_due" class=checkbox type=checkbox value=Y></td>
1180 <td nowrap>| . $locale->text('Amount Due') . qq|</td>
1183 <td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
1184 <td nowrap>| . $locale->text('Notes') . qq|</td>
1185 <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
1186 <td nowrap>| . $locale->text('Salesperson') . qq|</td>
1187 <td align=right><input name="l_shippingpoint" class=checkbox type=checkbox value=Y></td>
1188 <td nowrap>| . $locale->text('Shipping Point') . qq|</td>
1189 <td align=right><input name="l_shipvia" class=checkbox type=checkbox value=Y></td>
1190 <td nowrap>| . $locale->text('Ship via') . qq|</td>
1193 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1194 <td nowrap>| . $locale->text('Subtotal') . qq|</td>
1203 <td><hr size=3 noshade></td>
1207 <input type=hidden name=nextsub value=$form->{nextsub}>
1209 <input type=hidden name=path value=$form->{path}>
1210 <input type=hidden name=login value=$form->{login}>
1211 <input type=hidden name=password value=$form->{password}>
1214 <input class=submit type=submit name=action value="|
1215 . $locale->text('Continue') . qq|">
1226 $lxdebug->leave_sub();
1229 sub ar_transactions {
1230 $lxdebug->enter_sub();
1232 $form->{customer} = $form->unescape($form->{customer});
1233 ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer});
1235 AR->ar_transactions(\%myconfig, \%$form);
1238 "$form->{script}?action=ar_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1241 if ($form->{customer}) {
1242 $callback .= "&customer=" . $form->escape($form->{customer}, 1);
1243 $href .= "&customer=" . $form->escape($form->{customer});
1244 $option = $locale->text('Customer') . " : $form->{customer}";
1246 if ($form->{department}) {
1247 $callback .= "&department=" . $form->escape($form->{department}, 1);
1248 $href .= "&department=" . $form->escape($form->{department});
1249 ($department) = split /--/, $form->{department};
1250 $option .= "\n<br>" if ($option);
1251 $option .= $locale->text('Department') . " : $department";
1253 if ($form->{invnumber}) {
1254 $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
1255 $href .= "&invnumber=" . $form->escape($form->{invnumber});
1256 $option .= "\n<br>" if ($option);
1257 $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
1259 if ($form->{ordnumber}) {
1260 $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
1261 $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
1262 $option .= "\n<br>" if ($option);
1263 $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
1265 if ($form->{notes}) {
1266 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
1267 $href .= "¬es=" . $form->escape($form->{notes});
1268 $option .= "\n<br>" if $option;
1269 $option .= $locale->text('Notes') . " : $form->{notes}";
1272 if ($form->{transdatefrom}) {
1273 $callback .= "&transdatefrom=$form->{transdatefrom}";
1274 $href .= "&transdatefrom=$form->{transdatefrom}";
1275 $option .= "\n<br>" if ($option);
1277 $locale->text('From') . " "
1278 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1280 if ($form->{transdateto}) {
1281 $callback .= "&transdateto=$form->{transdateto}";
1282 $href .= "&transdateto=$form->{transdateto}";
1283 $option .= "\n<br>" if ($option);
1285 $locale->text('Bis') . " "
1286 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1288 if ($form->{open}) {
1289 $callback .= "&open=$form->{open}";
1290 $href .= "&open=$form->{open}";
1291 $option .= "\n<br>" if ($option);
1292 $option .= $locale->text('Open');
1294 if ($form->{closed}) {
1295 $callback .= "&closed=$form->{closed}";
1296 $href .= "&closed=$form->{closed}";
1297 $option .= "\n<br>" if ($option);
1298 $option .= $locale->text('Closed');
1301 @columns = $form->sort_columns(
1302 qw(transdate id type invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee shippingpoint shipvia)
1305 $form->{"l_type"} = "Y";
1307 foreach $item (@columns) {
1308 if ($form->{"l_$item"} eq "Y") {
1309 push @column_index, $item;
1311 # add column to href and callback
1312 $callback .= "&l_$item=Y";
1313 $href .= "&l_$item=Y";
1317 if ($form->{l_subtotal} eq 'Y') {
1318 $callback .= "&l_subtotal=Y";
1319 $href .= "&l_subtotal=Y";
1322 $column_header{id} =
1323 "<th><a class=listheading href=$href&sort=id>"
1324 . $locale->text('ID')
1326 $column_header{transdate} =
1327 "<th><a class=listheading href=$href&sort=transdate>"
1328 . $locale->text('Date')
1330 $column_header{duedate} =
1331 "<th><a class=listheading href=$href&sort=duedate>"
1332 . $locale->text('Due Date')
1334 $column_header{type} =
1335 "<th class=\"listheading\">" . $locale->text('Type') . "</th>";
1336 $column_header{invnumber} =
1337 "<th><a class=listheading href=$href&sort=invnumber>"
1338 . $locale->text('Invoice')
1340 $column_header{ordnumber} =
1341 "<th><a class=listheading href=$href&sort=ordnumber>"
1342 . $locale->text('Order')
1344 $column_header{name} =
1345 "<th><a class=listheading href=$href&sort=name>"
1346 . $locale->text('Customer')
1348 $column_header{netamount} =
1349 "<th class=listheading>" . $locale->text('Amount') . "</th>";
1350 $column_header{tax} =
1351 "<th class=listheading>" . $locale->text('Tax') . "</th>";
1352 $column_header{amount} =
1353 "<th class=listheading>" . $locale->text('Total') . "</th>";
1354 $column_header{paid} =
1355 "<th class=listheading>" . $locale->text('Paid') . "</th>";
1356 $column_header{datepaid} =
1357 "<th><a class=listheading href=$href&sort=datepaid>"
1358 . $locale->text('Date Paid')
1360 $column_header{due} =
1361 "<th class=listheading>" . $locale->text('Amount Due') . "</th>";
1362 $column_header{notes} =
1363 "<th class=listheading>" . $locale->text('Notes') . "</th>";
1364 $column_header{employee} =
1365 "<th><a class=listheading href=$href&sort=employee>"
1366 . $locale->text('Salesperson') . "</th>";
1368 $column_header{shippingpoint} =
1369 "<th><a class=listheading href=$href&sort=shippingpoint>"
1370 . $locale->text('Shipping Point')
1372 $column_header{shipvia} =
1373 "<th><a class=listheading href=$href&sort=shipvia>"
1374 . $locale->text('Ship via')
1377 $form->{title} = $locale->text('AR Transactions');
1386 <th class=listtop>$form->{title}</th>
1388 <tr height="5"></tr>
1395 <tr class=listheading>
1398 map { print "\n$column_header{$_}" } @column_index;
1404 # add sort and escape callback, this one we use for the add sub
1405 $form->{callback} = $callback .= "&sort=$form->{sort}";
1407 # escape callback for href
1408 $callback = $form->escape($callback);
1410 if (@{ $form->{AR} }) {
1411 $sameitem = $form->{AR}->[0]->{ $form->{sort} };
1414 # sums and tax on reports by Antonio Gallardo
1416 foreach $ar (@{ $form->{AR} }) {
1418 if ($form->{l_subtotal} eq 'Y') {
1419 if ($sameitem ne $ar->{ $form->{sort} }) {
1424 $column_data{netamount} =
1426 . $form->format_amount(\%myconfig, $ar->{netamount}, 2, " ")
1428 $column_data{tax} = "<td align=right>"
1429 . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{netamount},
1432 $column_data{amount} =
1434 . $form->format_amount(\%myconfig, $ar->{amount}, 2, " ") . "</td>";
1435 $column_data{paid} =
1437 . $form->format_amount(\%myconfig, $ar->{paid}, 2, " ") . "</td>";
1438 $column_data{due} = "<td align=right>"
1439 . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{paid},
1443 $subtotalnetamount += $ar->{netamount};
1444 $subtotalamount += $ar->{amount};
1445 $subtotalpaid += $ar->{paid};
1446 $subtotaldue += $ar->{amount} - $ar->{paid};
1448 $totalnetamount += $ar->{netamount};
1449 $totalamount += $ar->{amount};
1450 $totalpaid += $ar->{paid};
1451 $totaldue += ($ar->{amount} - $ar->{paid});
1453 $column_data{transdate} = "<td>$ar->{transdate} </td>";
1454 $column_data{id} = "<td>$ar->{id}</td>";
1455 $column_data{datepaid} = "<td>$ar->{datepaid} </td>";
1456 $column_data{duedate} = "<td>$ar->{duedate} </td>";
1458 $module = ($ar->{invoice}) ? "is.pl" : $form->{script};
1460 $column_data{invnumber} =
1461 "<td><a href=$module?action=edit&id=$ar->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}</a></td>";
1462 $column_data{type} = "<td>" .
1463 ($ar->{storno} ? $locale->text("Storno (one letter abbreviation)") :
1465 $locale->text("Credit note (one letter abbreviation)") :
1466 $locale->text("Invoice (one letter abbreviation)")) . "</td>";
1467 $column_data{ordnumber} = "<td>$ar->{ordnumber} </td>";
1468 $column_data{name} = "<td>$ar->{name}</td>";
1469 $ar->{notes} =~ s/\r\n/<br>/g;
1470 $column_data{notes} = "<td>$ar->{notes} </td>";
1471 $column_data{shippingpoint} = "<td>$ar->{shippingpoint} </td>";
1472 $column_data{shipvia} = "<td>$ar->{shipvia} </td>";
1473 $column_data{employee} = "<td>$ar->{employee} </td>";
1478 <tr class=listrow$i>
1481 map { print "\n$column_data{$_}" } @column_index;
1489 if ($form->{l_subtotal} eq 'Y') {
1495 <tr class=listtotal>
1498 map { $column_data{$_} = "<td> </td>" } @column_index;
1500 $column_data{netamount} =
1501 "<th class=listtotal align=right>"
1502 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1503 $column_data{tax} = "<th class=listtotal align=right>"
1504 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1507 $column_data{amount} =
1508 "<th class=listtotal align=right>"
1509 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1510 $column_data{paid} =
1511 "<th class=listtotal align=right>"
1512 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
1514 "<th class=listtotal align=right>"
1515 . $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>";
1517 map { print "\n$column_data{$_}" } @column_index;
1525 <td><hr size=3 noshade></td>
1530 <form method=post action=$form->{script}>
1532 <input name=callback type=hidden value="$form->{callback}">
1534 <input type=hidden name=path value=$form->{path}>
1535 <input type=hidden name=login value=$form->{login}>
1536 <input type=hidden name=password value=$form->{password}>
1538 <input class=submit type=submit name=action value="|
1539 . $locale->text('AR Transaction') . qq|">
1540 <input class=submit type=submit name=action value="|
1541 . $locale->text('Sales Invoice') . qq|">
1549 $lxdebug->leave_sub();
1553 $lxdebug->enter_sub();
1555 map { $column_data{$_} = "<td> </td>" } @column_index;
1557 $column_data{tax} = "<th class=listsubtotal align=right>"
1558 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1561 $column_data{amount} =
1562 "<th class=listsubtotal align=right>"
1563 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1564 $column_data{paid} =
1565 "<th class=listsubtotal align=right>"
1566 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
1568 "<th class=listsubtotal align=right>"
1569 . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
1571 $subtotalnetamount = 0;
1572 $subtotalamount = 0;
1576 $sameitem = $ar->{ $form->{sort} };
1578 print "<tr class=listsubtotal>";
1580 map { print "\n$column_data{$_}" } @column_index;
1586 $lxdebug->leave_sub();