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 $lxdebug->leave_sub();
299 $lxdebug->enter_sub();
301 $title = $form->{title};
302 $form->{title} = $locale->text("$title Accounts Receivables Transaction");
304 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
306 # $locale->text('Add Accounts Receivables Transaction')
307 # $locale->text('Edit Accounts Receivables Transaction')
308 $form->{javascript} = qq|<script type="text/javascript">
310 function setTaxkey(accno, row) {
311 var taxkey = accno.options[accno.selectedIndex].value;
312 var reg = /--([0-9]*)/;
313 var found = reg.exec(taxkey);
314 var index = found[1];
315 index = parseInt(index);
316 var tax = 'taxchart_' + row;
317 for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
318 var reg2 = new RegExp("^"+ index, "");
319 if (reg2.exec(document.getElementById(tax).options[i].value)) {
320 document.getElementById(tax).options[i].selected = true;
328 $readonly = ($form->{id}) ? "readonly" : "";
331 ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
332 $readonly = ($form->{radier}) ? "" : $readonly;
334 # set option selected
335 foreach $item (qw(customer currency department employee)) {
336 $form->{"select$item"} =~ s/ selected//;
337 $form->{"select$item"} =~
338 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
340 $selectAR_amount_unquoted = $form->{selectAR_amount};
341 $taxchart = $form->{taxchart};
342 map { $form->{$_} =~ s/\"/"/g }
343 qw(AR_amount selectAR_amount AR taxchart);
346 $form->{exchangerate} =
347 $form->format_amount(\%myconfig, $form->{exchangerate});
349 $form->{creditlimit} =
350 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
351 $form->{creditremaining} =
352 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
355 <input type=hidden name=forex value=$form->{forex}>
357 if ($form->{currency} ne $form->{defaultcurrency}) {
358 if ($form->{forex}) {
360 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
361 <td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td>
365 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
366 <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
375 <td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
376 <th align=left nowrap>| . $locale->text('Tax Included') . qq|</th>
380 if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) {
384 qq|<textarea name=notes rows=$rows cols=50 wrap=soft>$form->{notes}</textarea>|;
388 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
389 <td colspan=3><select name=department>$form->{selectdepartment}</select>
390 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
393 | if $form->{selectdepartment};
395 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
398 ($form->{selectcustomer})
399 ? qq|<select name=customer>$form->{selectcustomer}</select>|
400 : qq|<input name=customer value="$form->{customer}" size=35>|;
403 <input type=hidden name=employee value="$form->{employee}">
406 if ($form->{selectemployee}) {
409 <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
410 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
411 <input type=hidden name=selectemployee value="$form->{selectemployee}">
416 $form->{fokus} = "arledger.customer";
418 # use JavaScript Calendar or not
419 $form->{jsscript} = $jscalendar;
421 if ($form->{jsscript}) {
423 # with JavaScript Calendar
425 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
426 <td><input type=button name=transdate id="trigger1" value=|
427 . $locale->text('button') . qq|></td>
430 <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
431 <td><input type=button name=duedate id="trigger2" value=|
432 . $locale->text('button') . qq|></td></td>
437 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
438 "duedate", "BL", "trigger2");
441 # without JavaScript Calendar
443 qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
445 qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
451 <body onLoad="fokus()">
453 <form method=post name="arledger" action=$form->{script}>
455 <input type=hidden name=id value=$form->{id}>
456 <input type=hidden name=sort value=$form->{sort}>
457 <input type=hidden name=closedto value=$form->{closedto}>
458 <input type=hidden name=locked value=$form->{locked}>
459 <input type=hidden name=title value="$title">
463 <th class=listtop>$form->{title}</th>
473 <th align="right" nowrap>| . $locale->text('Customer') . qq|</th>
474 <td colspan=3>$customer</td>
475 <input type=hidden name=selectcustomer value="$form->{selectcustomer}">
476 <input type=hidden name=oldcustomer value="$form->{oldcustomer}">
477 <input type=hidden name=customer_id value="$form->{customer_id}">
478 <input type=hidden name=terms value=$form->{terms}>
485 <th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th>
486 <td>$form->{creditlimit}</td>
487 <th align=left nowrap>| . $locale->text('Remaining') . qq|</th>
488 <td class="plus$n">$form->{creditremaining}</td>
489 <input type=hidden name=creditlimit value=$form->{creditlimit}>
490 <input type=hidden name=creditremaining value=$form->{creditremaining}>
496 <th align=right>| . $locale->text('Currency') . qq|</th>
497 <td><select name=currency>$form->{selectcurrency}</select></td>
498 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
499 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
500 <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
501 <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
512 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
513 <td><input name=invnumber size=11 value="$form->{invnumber}"></td>
516 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
517 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
520 <th align=right nowrap>| . $locale->text('Invoice Date') . qq|</th>
524 <th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
535 <input type=hidden name=selectAR_amount value="$form->{selectAR_amount}">
536 <input type=hidden name=AR_amount value="$form->{AR_amount}">
537 <input type=hidden name=taxchart value="$form->{taxchart}">
538 <input type=hidden name=rowcount value=$form->{rowcount}>
542 <tr class=listheading>
543 <th class=listheading style="width:15%">|
544 . $locale->text('Account') . qq|</th>
545 <th class=listheading style="width:10%">|
546 . $locale->text('Amount') . qq|</th>
547 <th class=listheading style="width:10%">|
548 . $locale->text('Tax') . qq|</th>
549 <th class=listheading style="width:5%">|
550 . $locale->text('Korrektur') . qq|</th>
551 <th class=listheading style="width:10%">|
552 . $locale->text('Taxkey') . qq|</th>
553 <th class=listheading style="width:10%">|
554 . $locale->text('Project') . qq|</th>
558 $amount = $locale->text('Amount');
559 $project = $locale->text('Project');
561 for $i (1 .. $form->{rowcount}) {
564 $form->{"amount_$i"} =
565 $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
566 $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
567 $selectAR_amount = $selectAR_amount_unquoted;
569 s/option value=\"$form->{"AR_amount_$i"}\"/option value=\"$form->{"AR_amount_$i"}\" selected/;
571 $tax_selected = $form->{"taxchart_$i"};
572 $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
574 qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
575 $korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : '');
579 <td width=50%><select name="AR_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAR_amount</select></td>
580 <td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
581 <td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
582 <td><input type="checkbox" name="korrektur_$i" value="1" $korrektur_checked></td>
584 <td><input name="projectnumber_$i" size=20 value="$form->{"projectnumber_$i"}">
585 <input type=hidden name="project_id_$i" value=$form->{"project_id_$i"}>
586 <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}"></td>
593 $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
602 <td><select name=ARselected>$form->{selectAR}</select></td>
603 <input type=hidden name=AR value="$form->{AR}">
604 <th align=left>$form->{invtotal}</th>
606 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
607 <input type=hidden name=oldtotalpaid value=$form->{oldtotalpaid}>
609 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
622 <th align=left width=1%>| . $locale->text('Notes') . qq|</th>
623 <td align=left>$notes</td>
631 <tr class=listheading>
632 <th colspan=6 class=listheading>|
633 . $locale->text('Incoming Payments') . qq|</th>
637 if ($form->{currency} eq $form->{defaultcurrency}) {
638 @column_index = qw(datepaid source memo paid AR_paid);
640 @column_index = qw(datepaid source memo paid exchangerate AR_paid);
643 $column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
644 $column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
645 $column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
646 $column_data{AR_paid} = "<th>" . $locale->text('Account') . "</th>";
647 $column_data{source} = "<th>" . $locale->text('Source') . "</th>";
648 $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
653 map { print "$column_data{$_}\n" } @column_index;
659 $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
660 for $i (1 .. $form->{paidaccounts}) {
665 $form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
666 $form->{"selectAR_paid_$i"} =~
667 s/option value=\"$form->{"AR_paid_$i"}\">/option value=\"$form->{"AR_paid_$i"}\" selected>/;
670 if ($form->{"paid_$i"}) {
672 $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
674 $form->{"exchangerate_$i"} =
675 $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
677 $exchangerate = qq| |;
678 if ($form->{currency} ne $form->{defaultcurrency}) {
679 if ($form->{"forex_$i"}) {
681 qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
684 qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
689 <input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
693 qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
694 $column_data{AR_paid} =
695 qq|<td align=center><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
696 $column_data{exchangerate} = qq|<td align=center>$exchangerate</td>|;
697 $column_data{datepaid} =
698 qq|<td align=center><input name="datepaid_$i" size=11 value=$form->{"datepaid_$i"}>
699 <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
700 $column_data{source} =
701 qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
703 qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
705 map { print qq|$column_data{$_}\n| } @column_index;
710 push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
712 map { $form->{$_} =~ s/\"/"/g } qw(selectAR_paid);
714 print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
716 <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
717 <input type=hidden name=selectAR_paid value="$form->{selectAR_paid}">
723 <td><hr size=3 noshade></td>
728 $lxdebug->leave_sub();
732 $lxdebug->enter_sub();
736 <input name=callback type=hidden value="$form->{callback}">
738 <input type=hidden name=path value=$form->{path}>
739 <input type=hidden name=login value=$form->{login}>
740 <input type=hidden name=password value=$form->{password}>
745 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
746 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
749 if ($form->{radier}) {
750 print qq|<input class=submit type=submit name=action value="|
751 . $locale->text('Update') . qq|">
755 <input class=submit type=submit name=action value="|
756 . $locale->text('Post') . qq|">
757 <input class=submit type=submit name=action value="|
758 . $locale->text('Delete') . qq|">
761 if ($transdate > $closedto) {
763 <input class=submit type=submit name=action value="|
764 . $locale->text('Use As Template') . qq|">
769 if ($transdate > $closedto) {
770 print qq|<input class=submit type=submit name=action value="|
771 . $locale->text('Update') . qq|">
772 <input class=submit type=submit name=action value="|
773 . $locale->text('Post') . qq|">|;
777 if ($form->{menubar}) {
778 require "$form->{path}/menu.pl";
789 $lxdebug->leave_sub();
793 $lxdebug->enter_sub();
801 $form->{invtotal} = 0;
803 # $form->{selectAR_amount} = $form->{AR_amount};
804 # $form->{selectAR_amount} =~
805 # s/value=\"$form->{AR_amountselected}\"/value=\"$form->{AR_amountselected}\" selected/;
807 $form->{selectAR} = $form->{AR};
810 s/value=\"$form->{ARselected}\"/value=\"$form->{ARselected}\" selected/;
812 ($AR_amountaccno, $AR_amounttaxkey) =
813 split(/--/, $form->{AR_amountselected});
814 $form->{selecttaxchart} = $form->{taxchart};
815 $form->{selecttaxchart} =~
816 s/value=\"$AR_amounttaxkey--([^\"]*)\"/value=\"$AR_amounttaxkey--$1\" selected/;
820 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
821 qw(exchangerate creditlimit creditremaining);
823 @flds = qw(amount AR_amount projectnumber oldprojectnumber project_id);
827 for $i (1 .. $form->{rowcount}) {
828 $form->{"amount_$i"} =
829 $form->parse_amount(\%myconfig, $form->{"amount_$i"});
830 $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
831 if ($form->{"amount_$i"}) {
834 if (!$form->{"korrektur_$i"}) {
835 ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
837 if ($form->{taxincluded}) {
838 $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate;
840 $form->{"tax_$i"} = $form->{"amount_$i"} * $rate;
843 $form->{"tax_$i"} = 0;
846 $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"}, 2);
848 $totaltax += $form->{"tax_$i"};
849 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
854 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
855 $form->{rowcount} = $count + 1;
856 map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount});
858 $form->{exchangerate} = $exchangerate
862 $form->check_exchangerate(
863 \%myconfig, $form->{currency}, $form->{transdate}, 'buy'
866 $form->{invdate} = $form->{transdate};
867 $save_AR = $form->{AR};
868 &check_name(customer);
869 $form->{AR} = $save_AR;
874 ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
876 for $i (1 .. $form->{paidaccounts}) {
877 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
880 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
881 } qw(paid exchangerate);
883 $totalpaid += $form->{"paid_$i"};
885 $form->{"exchangerate_$i"} = $exchangerate
887 $form->{"forex_$i"} = (
889 $form->check_exchangerate(
890 \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'
895 $form->{creditremaining} -=
896 ($form->{invtotal} - $totalpaid + $form->{oldtotalpaid} -
897 $form->{oldinvtotal});
898 $form->{oldinvtotal} = $form->{invtotal};
899 $form->{oldtotalpaid} = $totalpaid;
903 $lxdebug->leave_sub();
907 $lxdebug->enter_sub();
909 # check if there is an invoice number, invoice and due date
910 $form->isblank("transdate", $locale->text('Invoice Date missing!'));
911 $form->isblank("duedate", $locale->text('Due Date missing!'));
912 $form->isblank("customer", $locale->text('Customer missing!'));
914 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
915 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
917 $form->error($locale->text('Cannot post transaction for a closed period!'))
918 if ($transdate <= $closedto);
920 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
921 if ($form->{currency} ne $form->{defaultcurrency});
925 for $i (1 .. $form->{paidaccounts}) {
926 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
927 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
929 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
931 $form->error($locale->text('Cannot post payment for a closed period!'))
932 if ($datepaid <= $closedto);
934 if ($form->{currency} ne $form->{defaultcurrency}) {
935 $form->{"exchangerate_$i"} = $form->{exchangerate}
936 if ($transdate == $datepaid);
937 $form->isblank("exchangerate_$i",
938 $locale->text('Exchangerate for payment missing!'));
943 # if oldcustomer ne customer redo form
944 ($customer) = split /--/, $form->{customer};
945 if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
950 ($creditaccno, $credittaxkey) = split /--/, $form->{AR_amountselected};
951 ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
952 ($receivablesaccno, $payablestaxkey) = split /--/, $form->{ARselected};
953 $form->{AR}{amount_1} = $creditaccno;
954 $form->{AR}{receivables} = $receivablesaccno;
955 $form->{taxkey} = $taxkey;
957 $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber")
958 unless $form->{invnumber};
960 $form->{id} = 0 if $form->{postasnew};
962 $form->redirect($locale->text('Transaction posted!'))
963 if (AR->post_transaction(\%myconfig, \%$form));
964 $form->error($locale->text('Cannot post transaction!'));
966 $lxdebug->leave_sub();
970 $lxdebug->enter_sub();
972 $form->{postasnew} = 1;
975 $lxdebug->leave_sub();
978 sub use_as_template {
979 $lxdebug->enter_sub();
981 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);
982 $form->{paidaccounts} = 1;
984 $form->{invdate} = $form->current_date(\%myconfig);
987 $lxdebug->leave_sub();
991 $lxdebug->enter_sub();
993 $form->{title} = $locale->text('Confirm!');
997 delete $form->{header};
1002 <form method=post action=$form->{script}>
1005 foreach $key (keys %$form) {
1006 $form->{$key} =~ s/\"/"/g;
1007 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1011 <h2 class=confirm>$form->{title}</h2>
1014 . $locale->text('Are you sure you want to delete Transaction')
1015 . qq| $form->{invnumber}</h4>
1017 <input name=action class=submit type=submit value="|
1018 . $locale->text('Yes') . qq|">
1025 $lxdebug->leave_sub();
1029 $lxdebug->enter_sub();
1031 $form->redirect($locale->text('Transaction deleted!'))
1032 if (AR->delete_transaction(\%myconfig, \%$form, $spool));
1033 $form->error($locale->text('Cannot delete transaction!'));
1035 $lxdebug->leave_sub();
1039 $lxdebug->enter_sub();
1041 # setup customer selection
1042 $form->all_vc(\%myconfig, "customer", "AR");
1044 if (@{ $form->{all_customer} }) {
1045 map { $customer .= "<option>$_->{name}--$_->{id}\n" }
1046 @{ $form->{all_customer} };
1047 $customer = qq|<select name=customer><option>\n$customer</select>|;
1049 $customer = qq|<input name=customer size=35>|;
1053 if (@{ $form->{all_departments} }) {
1054 $form->{selectdepartment} = "<option>\n";
1057 $form->{selectdepartment} .=
1058 "<option>$_->{description}--$_->{id}\n"
1059 } (@{ $form->{all_departments} });
1064 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1065 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1067 | if $form->{selectdepartment};
1069 $form->{title} = $locale->text('AR Transactions');
1071 # use JavaScript Calendar or not
1072 $form->{jsscript} = $jscalendar;
1074 if ($form->{jsscript}) {
1076 # with JavaScript Calendar
1078 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1079 <input type=button name=transdatefrom id="trigger1" value=|
1080 . $locale->text('button') . qq|></td>
1083 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1084 <input type=button name=transdateto name=transdateto id="trigger2" value=|
1085 . $locale->text('button') . qq|></td>
1090 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
1091 "transdateto", "BL", "trigger2");
1094 # without JavaScript Calendar
1096 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1098 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1101 $form->{fokus} = "search.customer";
1105 <body onLoad="fokus()">
1107 <form method=post name="search" action=$form->{script}>
1110 <tr><th class=listtop>$form->{title}</th></tr>
1111 <tr height="5"></tr>
1116 <th align=right>| . $locale->text('Customer') . qq|</th>
1117 <td colspan=3>$customer</td>
1121 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
1122 <td colspan=3><input name=invnumber size=20></td>
1125 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
1126 <td colspan=3><input name=ordnumber size=20></td>
1129 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1130 <td colspan=3><input name=notes size=40></td>
1133 <th align=right nowrap>| . $locale->text('From') . qq|</th>
1135 <th align=right>| . $locale->text('Bis') . qq|</th>
1138 <input type=hidden name=sort value=transdate>
1146 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
1150 <td align=right><input name=open class=checkbox type=checkbox value=Y checked></td>
1151 <td nowrap>| . $locale->text('Open') . qq|</td>
1152 <td align=right><input name=closed class=checkbox type=checkbox value=Y></td>
1153 <td nowrap>| . $locale->text('Closed') . qq|</td>
1156 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
1157 <td nowrap>| . $locale->text('ID') . qq|</td>
1158 <td align=right><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
1159 <td nowrap>| . $locale->text('Invoice Number') . qq|</td>
1160 <td align=right><input name="l_ordnumber" class=checkbox type=checkbox value=Y></td>
1161 <td nowrap>| . $locale->text('Order Number') . qq|</td>
1162 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
1163 <td nowrap>| . $locale->text('Invoice Date') . qq|</td>
1166 <td align=right><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
1167 <td nowrap>| . $locale->text('Customer') . qq|</td>
1168 <td align=right><input name="l_netamount" class=checkbox type=checkbox value=Y></td>
1169 <td nowrap>| . $locale->text('Amount') . qq|</td>
1170 <td align=right><input name="l_tax" class=checkbox type=checkbox value=Y></td>
1171 <td nowrap>| . $locale->text('Tax') . qq|</td>
1172 <td align=right><input name="l_amount" class=checkbox type=checkbox value=Y checked></td>
1173 <td nowrap>| . $locale->text('Total') . qq|</td>
1176 <td align=right><input name="l_datepaid" class=checkbox type=checkbox value=Y></td>
1177 <td nowrap>| . $locale->text('Date Paid') . qq|</td>
1178 <td align=right><input name="l_paid" class=checkbox type=checkbox value=Y checked></td>
1179 <td nowrap>| . $locale->text('Paid') . qq|</td>
1180 <td align=right><input name="l_duedate" class=checkbox type=checkbox value=Y></td>
1181 <td nowrap>| . $locale->text('Due Date') . qq|</td>
1182 <td align=right><input name="l_due" class=checkbox type=checkbox value=Y></td>
1183 <td nowrap>| . $locale->text('Amount Due') . qq|</td>
1186 <td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
1187 <td nowrap>| . $locale->text('Notes') . qq|</td>
1188 <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
1189 <td nowrap>| . $locale->text('Salesperson') . qq|</td>
1190 <td align=right><input name="l_shippingpoint" class=checkbox type=checkbox value=Y></td>
1191 <td nowrap>| . $locale->text('Shipping Point') . qq|</td>
1192 <td align=right><input name="l_shipvia" class=checkbox type=checkbox value=Y></td>
1193 <td nowrap>| . $locale->text('Ship via') . qq|</td>
1196 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1197 <td nowrap>| . $locale->text('Subtotal') . qq|</td>
1206 <td><hr size=3 noshade></td>
1210 <input type=hidden name=nextsub value=$form->{nextsub}>
1212 <input type=hidden name=path value=$form->{path}>
1213 <input type=hidden name=login value=$form->{login}>
1214 <input type=hidden name=password value=$form->{password}>
1217 <input class=submit type=submit name=action value="|
1218 . $locale->text('Continue') . qq|">
1229 $lxdebug->leave_sub();
1232 sub ar_transactions {
1233 $lxdebug->enter_sub();
1235 $form->{customer} = $form->unescape($form->{customer});
1236 ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer});
1238 AR->ar_transactions(\%myconfig, \%$form);
1241 "$form->{script}?action=ar_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1244 if ($form->{customer}) {
1245 $callback .= "&customer=" . $form->escape($form->{customer}, 1);
1246 $href .= "&customer=" . $form->escape($form->{customer});
1247 $option = $locale->text('Customer') . " : $form->{customer}";
1249 if ($form->{department}) {
1250 $callback .= "&department=" . $form->escape($form->{department}, 1);
1251 $href .= "&department=" . $form->escape($form->{department});
1252 ($department) = split /--/, $form->{department};
1253 $option .= "\n<br>" if ($option);
1254 $option .= $locale->text('Department') . " : $department";
1256 if ($form->{invnumber}) {
1257 $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
1258 $href .= "&invnumber=" . $form->escape($form->{invnumber});
1259 $option .= "\n<br>" if ($option);
1260 $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
1262 if ($form->{ordnumber}) {
1263 $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
1264 $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
1265 $option .= "\n<br>" if ($option);
1266 $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
1268 if ($form->{notes}) {
1269 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
1270 $href .= "¬es=" . $form->escape($form->{notes});
1271 $option .= "\n<br>" if $option;
1272 $option .= $locale->text('Notes') . " : $form->{notes}";
1275 if ($form->{transdatefrom}) {
1276 $callback .= "&transdatefrom=$form->{transdatefrom}";
1277 $href .= "&transdatefrom=$form->{transdatefrom}";
1278 $option .= "\n<br>" if ($option);
1280 $locale->text('From') . " "
1281 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1283 if ($form->{transdateto}) {
1284 $callback .= "&transdateto=$form->{transdateto}";
1285 $href .= "&transdateto=$form->{transdateto}";
1286 $option .= "\n<br>" if ($option);
1288 $locale->text('Bis') . " "
1289 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1291 if ($form->{open}) {
1292 $callback .= "&open=$form->{open}";
1293 $href .= "&open=$form->{open}";
1294 $option .= "\n<br>" if ($option);
1295 $option .= $locale->text('Open');
1297 if ($form->{closed}) {
1298 $callback .= "&closed=$form->{closed}";
1299 $href .= "&closed=$form->{closed}";
1300 $option .= "\n<br>" if ($option);
1301 $option .= $locale->text('Closed');
1304 @columns = $form->sort_columns(
1305 qw(transdate id type invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee shippingpoint shipvia)
1308 $form->{"l_type"} = "Y";
1310 foreach $item (@columns) {
1311 if ($form->{"l_$item"} eq "Y") {
1312 push @column_index, $item;
1314 # add column to href and callback
1315 $callback .= "&l_$item=Y";
1316 $href .= "&l_$item=Y";
1320 if ($form->{l_subtotal} eq 'Y') {
1321 $callback .= "&l_subtotal=Y";
1322 $href .= "&l_subtotal=Y";
1325 $column_header{id} =
1326 "<th><a class=listheading href=$href&sort=id>"
1327 . $locale->text('ID')
1329 $column_header{transdate} =
1330 "<th><a class=listheading href=$href&sort=transdate>"
1331 . $locale->text('Date')
1333 $column_header{duedate} =
1334 "<th><a class=listheading href=$href&sort=duedate>"
1335 . $locale->text('Due Date')
1337 $column_header{type} =
1338 "<th class=\"listheading\">" . $locale->text('Type') . "</th>";
1339 $column_header{invnumber} =
1340 "<th><a class=listheading href=$href&sort=invnumber>"
1341 . $locale->text('Invoice')
1343 $column_header{ordnumber} =
1344 "<th><a class=listheading href=$href&sort=ordnumber>"
1345 . $locale->text('Order')
1347 $column_header{name} =
1348 "<th><a class=listheading href=$href&sort=name>"
1349 . $locale->text('Customer')
1351 $column_header{netamount} =
1352 "<th class=listheading>" . $locale->text('Amount') . "</th>";
1353 $column_header{tax} =
1354 "<th class=listheading>" . $locale->text('Tax') . "</th>";
1355 $column_header{amount} =
1356 "<th class=listheading>" . $locale->text('Total') . "</th>";
1357 $column_header{paid} =
1358 "<th class=listheading>" . $locale->text('Paid') . "</th>";
1359 $column_header{datepaid} =
1360 "<th><a class=listheading href=$href&sort=datepaid>"
1361 . $locale->text('Date Paid')
1363 $column_header{due} =
1364 "<th class=listheading>" . $locale->text('Amount Due') . "</th>";
1365 $column_header{notes} =
1366 "<th class=listheading>" . $locale->text('Notes') . "</th>";
1367 $column_header{employee} =
1368 "<th><a class=listheading href=$href&sort=employee>"
1369 . $locale->text('Salesperson') . "</th>";
1371 $column_header{shippingpoint} =
1372 "<th><a class=listheading href=$href&sort=shippingpoint>"
1373 . $locale->text('Shipping Point')
1375 $column_header{shipvia} =
1376 "<th><a class=listheading href=$href&sort=shipvia>"
1377 . $locale->text('Ship via')
1380 $form->{title} = $locale->text('AR Transactions');
1389 <th class=listtop>$form->{title}</th>
1391 <tr height="5"></tr>
1398 <tr class=listheading>
1401 map { print "\n$column_header{$_}" } @column_index;
1407 # add sort and escape callback, this one we use for the add sub
1408 $form->{callback} = $callback .= "&sort=$form->{sort}";
1410 # escape callback for href
1411 $callback = $form->escape($callback);
1413 if (@{ $form->{AR} }) {
1414 $sameitem = $form->{AR}->[0]->{ $form->{sort} };
1417 # sums and tax on reports by Antonio Gallardo
1419 foreach $ar (@{ $form->{AR} }) {
1421 if ($form->{l_subtotal} eq 'Y') {
1422 if ($sameitem ne $ar->{ $form->{sort} }) {
1427 $column_data{netamount} =
1429 . $form->format_amount(\%myconfig, $ar->{netamount}, 2, " ")
1431 $column_data{tax} = "<td align=right>"
1432 . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{netamount},
1435 $column_data{amount} =
1437 . $form->format_amount(\%myconfig, $ar->{amount}, 2, " ") . "</td>";
1438 $column_data{paid} =
1440 . $form->format_amount(\%myconfig, $ar->{paid}, 2, " ") . "</td>";
1441 $column_data{due} = "<td align=right>"
1442 . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{paid},
1446 $subtotalnetamount += $ar->{netamount};
1447 $subtotalamount += $ar->{amount};
1448 $subtotalpaid += $ar->{paid};
1449 $subtotaldue += $ar->{amount} - $ar->{paid};
1451 $totalnetamount += $ar->{netamount};
1452 $totalamount += $ar->{amount};
1453 $totalpaid += $ar->{paid};
1454 $totaldue += ($ar->{amount} - $ar->{paid});
1456 $column_data{transdate} = "<td>$ar->{transdate} </td>";
1457 $column_data{id} = "<td>$ar->{id}</td>";
1458 $column_data{datepaid} = "<td>$ar->{datepaid} </td>";
1459 $column_data{duedate} = "<td>$ar->{duedate} </td>";
1461 $module = ($ar->{invoice}) ? "is.pl" : $form->{script};
1463 $column_data{invnumber} =
1464 "<td><a href=$module?action=edit&id=$ar->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}</a></td>";
1465 $column_data{type} = "<td>" .
1466 ($ar->{storno} ? $locale->text("Storno (one letter abbreviation)") :
1468 $locale->text("Credit note (one letter abbreviation)") :
1469 $locale->text("Invoice (one letter abbreviation)")) . "</td>";
1470 $column_data{ordnumber} = "<td>$ar->{ordnumber} </td>";
1471 $column_data{name} = "<td>$ar->{name}</td>";
1472 $ar->{notes} =~ s/\r\n/<br>/g;
1473 $column_data{notes} = "<td>$ar->{notes} </td>";
1474 $column_data{shippingpoint} = "<td>$ar->{shippingpoint} </td>";
1475 $column_data{shipvia} = "<td>$ar->{shipvia} </td>";
1476 $column_data{employee} = "<td>$ar->{employee} </td>";
1481 <tr class=listrow$i>
1484 map { print "\n$column_data{$_}" } @column_index;
1492 if ($form->{l_subtotal} eq 'Y') {
1498 <tr class=listtotal>
1501 map { $column_data{$_} = "<td> </td>" } @column_index;
1503 $column_data{netamount} =
1504 "<th class=listtotal align=right>"
1505 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1506 $column_data{tax} = "<th class=listtotal align=right>"
1507 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1510 $column_data{amount} =
1511 "<th class=listtotal align=right>"
1512 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1513 $column_data{paid} =
1514 "<th class=listtotal align=right>"
1515 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
1517 "<th class=listtotal align=right>"
1518 . $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>";
1520 map { print "\n$column_data{$_}" } @column_index;
1528 <td><hr size=3 noshade></td>
1533 <form method=post action=$form->{script}>
1535 <input name=callback type=hidden value="$form->{callback}">
1537 <input type=hidden name=path value=$form->{path}>
1538 <input type=hidden name=login value=$form->{login}>
1539 <input type=hidden name=password value=$form->{password}>
1541 <input class=submit type=submit name=action value="|
1542 . $locale->text('AR Transaction') . qq|">
1543 <input class=submit type=submit name=action value="|
1544 . $locale->text('Sales Invoice') . qq|">|;
1546 if ($form->{menubar}) {
1547 require "$form->{path}/menu.pl";
1558 $lxdebug->leave_sub();
1562 $lxdebug->enter_sub();
1564 map { $column_data{$_} = "<td> </td>" } @column_index;
1566 $column_data{tax} = "<th class=listsubtotal align=right>"
1567 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1570 $column_data{amount} =
1571 "<th class=listsubtotal align=right>"
1572 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1573 $column_data{paid} =
1574 "<th class=listsubtotal align=right>"
1575 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
1577 "<th class=listsubtotal align=right>"
1578 . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
1580 $subtotalnetamount = 0;
1581 $subtotalamount = 0;
1585 $sameitem = $ar->{ $form->{sort} };
1587 print "<tr class=listsubtotal>";
1589 map { print "\n$column_data{$_}" } @column_index;
1595 $lxdebug->leave_sub();