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" id="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|">
775 <input class=submit type=submit name=action value="|
776 . $locale->text('Post Payment') . qq|">
780 if ($transdate > $closedto) {
781 print qq|<input class=submit type=submit name=action value="|
782 . $locale->text('Update') . qq|">
783 <input class=submit type=submit name=action value="|
784 . $locale->text('Post') . qq|">|;
795 $lxdebug->leave_sub();
799 $lxdebug->enter_sub();
807 $form->{invtotal} = 0;
809 # $form->{selectAR_amount} = $form->{AR_amount};
810 # $form->{selectAR_amount} =~
811 # s/value=\"$form->{AR_amountselected}\"/value=\"$form->{AR_amountselected}\" selected/;
813 ($AR_amountaccno, $AR_amounttaxkey) =
814 split(/--/, $form->{AR_amountselected});
815 $form->{selecttaxchart} = $form->{taxchart};
816 $form->{selecttaxchart} =~
817 s/value=\"$AR_amounttaxkey--([^\"]*)\"/value=\"$AR_amounttaxkey--$1\" selected/;
821 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
822 qw(exchangerate creditlimit creditremaining);
824 @flds = qw(amount AR_amount projectnumber oldprojectnumber project_id);
828 for $i (1 .. $form->{rowcount}) {
829 $form->{"amount_$i"} =
830 $form->parse_amount(\%myconfig, $form->{"amount_$i"});
831 $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
832 if ($form->{"amount_$i"}) {
835 if (!$form->{"korrektur_$i"}) {
836 ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
838 if ($form->{taxincluded}) {
839 $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate;
841 $form->{"tax_$i"} = $form->{"amount_$i"} * $rate;
844 $form->{"tax_$i"} = 0;
847 $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"}, 2);
849 $totaltax += $form->{"tax_$i"};
850 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
855 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
856 $form->{rowcount} = $count + 1;
857 map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount});
859 $form->{exchangerate} = $exchangerate
863 $form->check_exchangerate(
864 \%myconfig, $form->{currency}, $form->{transdate}, 'buy'
867 $form->{invdate} = $form->{transdate};
868 $save_AR = $form->{AR};
869 &check_name(customer);
870 $form->{AR} = $save_AR;
875 ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
877 for $i (1 .. $form->{paidaccounts}) {
878 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
881 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
882 } qw(paid exchangerate);
884 $totalpaid += $form->{"paid_$i"};
886 $form->{"exchangerate_$i"} = $exchangerate
888 $form->{"forex_$i"} = (
890 $form->check_exchangerate(
891 \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'
896 $form->{creditremaining} -=
897 ($form->{invtotal} - $totalpaid + $form->{oldtotalpaid} -
898 $form->{oldinvtotal});
899 $form->{oldinvtotal} = $form->{invtotal};
900 $form->{oldtotalpaid} = $totalpaid;
904 $lxdebug->leave_sub();
908 $lxdebug->enter_sub();
909 for $i (1 .. $form->{paidaccounts}) {
910 if ($form->{"paid_$i"}) {
911 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
913 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
915 $form->error($locale->text('Cannot post payment for a closed period!'))
916 if ($datepaid <= $closedto);
918 if ($form->{currency} ne $form->{defaultcurrency}) {
919 $form->{"exchangerate_$i"} = $form->{exchangerate}
920 if ($invdate == $datepaid);
921 $form->isblank("exchangerate_$i",
922 $locale->text('Exchangerate for payment missing!'));
927 ($form->{AR}) = split /--/, $form->{AR};
928 ($form->{AR_paid}) = split /--/, $form->{AR_paid};
929 $form->redirect($locale->text(' Payment posted!'))
930 if (AR->post_payment(\%myconfig, \%$form));
931 $form->error($locale->text('Cannot post payment!'));
934 $lxdebug->leave_sub();
938 $lxdebug->enter_sub();
940 # check if there is an invoice number, invoice and due date
941 $form->isblank("transdate", $locale->text('Invoice Date missing!'));
942 $form->isblank("duedate", $locale->text('Due Date missing!'));
943 $form->isblank("customer", $locale->text('Customer missing!'));
945 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
946 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
948 $form->error($locale->text('Cannot post transaction for a closed period!'))
949 if ($transdate <= $closedto);
951 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
952 if ($form->{currency} ne $form->{defaultcurrency});
956 for $i (1 .. $form->{paidaccounts}) {
957 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
958 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
960 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
962 $form->error($locale->text('Cannot post payment for a closed period!'))
963 if ($datepaid <= $closedto);
965 if ($form->{currency} ne $form->{defaultcurrency}) {
966 $form->{"exchangerate_$i"} = $form->{exchangerate}
967 if ($transdate == $datepaid);
968 $form->isblank("exchangerate_$i",
969 $locale->text('Exchangerate for payment missing!'));
974 # if oldcustomer ne customer redo form
975 ($customer) = split /--/, $form->{customer};
976 if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
981 ($creditaccno, $credittaxkey) = split /--/, $form->{AR_amountselected};
982 ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
983 ($receivablesaccno, $payablestaxkey) = split /--/, $form->{ARselected};
984 $form->{AR}{amount_1} = $creditaccno;
985 $form->{AR}{receivables} = $receivablesaccno;
986 $form->{taxkey} = $taxkey;
988 $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber")
989 unless $form->{invnumber};
991 $form->{id} = 0 if $form->{postasnew};
993 $form->redirect($locale->text('Transaction posted!'))
994 if (AR->post_transaction(\%myconfig, \%$form));
995 $form->error($locale->text('Cannot post transaction!'));
997 $lxdebug->leave_sub();
1001 $lxdebug->enter_sub();
1003 $form->{postasnew} = 1;
1006 $lxdebug->leave_sub();
1009 sub use_as_template {
1010 $lxdebug->enter_sub();
1012 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);
1013 $form->{paidaccounts} = 1;
1014 $form->{rowcount}--;
1015 $form->{invdate} = $form->current_date(\%myconfig);
1018 $lxdebug->leave_sub();
1022 $lxdebug->enter_sub();
1024 $form->{title} = $locale->text('Confirm!');
1028 delete $form->{header};
1033 <form method=post action=$form->{script}>
1036 foreach $key (keys %$form) {
1037 $form->{$key} =~ s/\"/"/g;
1038 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1042 <h2 class=confirm>$form->{title}</h2>
1045 . $locale->text('Are you sure you want to delete Transaction')
1046 . qq| $form->{invnumber}</h4>
1048 <input name=action class=submit type=submit value="|
1049 . $locale->text('Yes') . qq|">
1056 $lxdebug->leave_sub();
1060 $lxdebug->enter_sub();
1062 $form->redirect($locale->text('Transaction deleted!'))
1063 if (AR->delete_transaction(\%myconfig, \%$form, $spool));
1064 $form->error($locale->text('Cannot delete transaction!'));
1066 $lxdebug->leave_sub();
1070 $lxdebug->enter_sub();
1072 # setup customer selection
1073 $form->all_vc(\%myconfig, "customer", "AR");
1075 if (@{ $form->{all_customer} }) {
1076 map { $customer .= "<option>$_->{name}--$_->{id}\n" }
1077 @{ $form->{all_customer} };
1078 $customer = qq|<select name=customer><option>\n$customer</select>|;
1080 $customer = qq|<input name=customer size=35>|;
1084 if (@{ $form->{all_departments} }) {
1085 $form->{selectdepartment} = "<option>\n";
1088 $form->{selectdepartment} .=
1089 "<option>$_->{description}--$_->{id}\n"
1090 } (@{ $form->{all_departments} });
1095 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1096 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1098 | if $form->{selectdepartment};
1100 $form->{title} = $locale->text('AR Transactions');
1102 # use JavaScript Calendar or not
1103 $form->{jsscript} = $jscalendar;
1105 if ($form->{jsscript}) {
1107 # with JavaScript Calendar
1109 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1110 <input type=button name=transdatefrom id="trigger1" value=|
1111 . $locale->text('button') . qq|></td>
1114 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1115 <input type=button name=transdateto name=transdateto id="trigger2" value=|
1116 . $locale->text('button') . qq|></td>
1121 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
1122 "transdateto", "BL", "trigger2");
1125 # without JavaScript Calendar
1127 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1129 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1132 $form->{fokus} = "search.customer";
1136 <body onLoad="fokus()">
1138 <form method=post name="search" action=$form->{script}>
1141 <tr><th class=listtop>$form->{title}</th></tr>
1142 <tr height="5"></tr>
1147 <th align=right>| . $locale->text('Customer') . qq|</th>
1148 <td colspan=3>$customer</td>
1152 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
1153 <td colspan=3><input name=invnumber size=20></td>
1156 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
1157 <td colspan=3><input name=ordnumber size=20></td>
1160 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1161 <td colspan=3><input name=notes size=40></td>
1164 <th align=right nowrap>| . $locale->text('From') . qq|</th>
1166 <th align=right>| . $locale->text('Bis') . qq|</th>
1169 <input type=hidden name=sort value=transdate>
1177 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
1181 <td align=right><input name=open class=checkbox type=checkbox value=Y checked></td>
1182 <td nowrap>| . $locale->text('Open') . qq|</td>
1183 <td align=right><input name=closed class=checkbox type=checkbox value=Y></td>
1184 <td nowrap>| . $locale->text('Closed') . qq|</td>
1187 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
1188 <td nowrap>| . $locale->text('ID') . qq|</td>
1189 <td align=right><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
1190 <td nowrap>| . $locale->text('Invoice Number') . qq|</td>
1191 <td align=right><input name="l_ordnumber" class=checkbox type=checkbox value=Y></td>
1192 <td nowrap>| . $locale->text('Order Number') . qq|</td>
1193 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
1194 <td nowrap>| . $locale->text('Invoice Date') . qq|</td>
1197 <td align=right><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
1198 <td nowrap>| . $locale->text('Customer') . qq|</td>
1199 <td align=right><input name="l_netamount" class=checkbox type=checkbox value=Y></td>
1200 <td nowrap>| . $locale->text('Amount') . qq|</td>
1201 <td align=right><input name="l_tax" class=checkbox type=checkbox value=Y></td>
1202 <td nowrap>| . $locale->text('Tax') . qq|</td>
1203 <td align=right><input name="l_amount" class=checkbox type=checkbox value=Y checked></td>
1204 <td nowrap>| . $locale->text('Total') . qq|</td>
1207 <td align=right><input name="l_datepaid" class=checkbox type=checkbox value=Y></td>
1208 <td nowrap>| . $locale->text('Date Paid') . qq|</td>
1209 <td align=right><input name="l_paid" class=checkbox type=checkbox value=Y checked></td>
1210 <td nowrap>| . $locale->text('Paid') . qq|</td>
1211 <td align=right><input name="l_duedate" class=checkbox type=checkbox value=Y></td>
1212 <td nowrap>| . $locale->text('Due Date') . qq|</td>
1213 <td align=right><input name="l_due" class=checkbox type=checkbox value=Y></td>
1214 <td nowrap>| . $locale->text('Amount Due') . qq|</td>
1217 <td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
1218 <td nowrap>| . $locale->text('Notes') . qq|</td>
1219 <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
1220 <td nowrap>| . $locale->text('Salesperson') . qq|</td>
1221 <td align=right><input name="l_shippingpoint" class=checkbox type=checkbox value=Y></td>
1222 <td nowrap>| . $locale->text('Shipping Point') . qq|</td>
1223 <td align=right><input name="l_shipvia" class=checkbox type=checkbox value=Y></td>
1224 <td nowrap>| . $locale->text('Ship via') . qq|</td>
1227 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1228 <td nowrap>| . $locale->text('Subtotal') . qq|</td>
1237 <td><hr size=3 noshade></td>
1241 <input type=hidden name=nextsub value=$form->{nextsub}>
1243 <input type=hidden name=path value=$form->{path}>
1244 <input type=hidden name=login value=$form->{login}>
1245 <input type=hidden name=password value=$form->{password}>
1248 <input class=submit type=submit name=action value="|
1249 . $locale->text('Continue') . qq|">
1260 $lxdebug->leave_sub();
1263 sub ar_transactions {
1264 $lxdebug->enter_sub();
1266 $form->{customer} = $form->unescape($form->{customer});
1267 ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer});
1269 AR->ar_transactions(\%myconfig, \%$form);
1272 "$form->{script}?action=ar_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1275 if ($form->{customer}) {
1276 $callback .= "&customer=" . $form->escape($form->{customer}, 1);
1277 $href .= "&customer=" . $form->escape($form->{customer});
1278 $option = $locale->text('Customer') . " : $form->{customer}";
1280 if ($form->{department}) {
1281 $callback .= "&department=" . $form->escape($form->{department}, 1);
1282 $href .= "&department=" . $form->escape($form->{department});
1283 ($department) = split /--/, $form->{department};
1284 $option .= "\n<br>" if ($option);
1285 $option .= $locale->text('Department') . " : $department";
1287 if ($form->{invnumber}) {
1288 $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
1289 $href .= "&invnumber=" . $form->escape($form->{invnumber});
1290 $option .= "\n<br>" if ($option);
1291 $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
1293 if ($form->{ordnumber}) {
1294 $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
1295 $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
1296 $option .= "\n<br>" if ($option);
1297 $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
1299 if ($form->{notes}) {
1300 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
1301 $href .= "¬es=" . $form->escape($form->{notes});
1302 $option .= "\n<br>" if $option;
1303 $option .= $locale->text('Notes') . " : $form->{notes}";
1306 if ($form->{transdatefrom}) {
1307 $callback .= "&transdatefrom=$form->{transdatefrom}";
1308 $href .= "&transdatefrom=$form->{transdatefrom}";
1309 $option .= "\n<br>" if ($option);
1311 $locale->text('From') . " "
1312 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1314 if ($form->{transdateto}) {
1315 $callback .= "&transdateto=$form->{transdateto}";
1316 $href .= "&transdateto=$form->{transdateto}";
1317 $option .= "\n<br>" if ($option);
1319 $locale->text('Bis') . " "
1320 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1322 if ($form->{open}) {
1323 $callback .= "&open=$form->{open}";
1324 $href .= "&open=$form->{open}";
1325 $option .= "\n<br>" if ($option);
1326 $option .= $locale->text('Open');
1328 if ($form->{closed}) {
1329 $callback .= "&closed=$form->{closed}";
1330 $href .= "&closed=$form->{closed}";
1331 $option .= "\n<br>" if ($option);
1332 $option .= $locale->text('Closed');
1335 @columns = $form->sort_columns(
1336 qw(transdate id type invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee shippingpoint shipvia)
1339 $form->{"l_type"} = "Y";
1341 foreach $item (@columns) {
1342 if ($form->{"l_$item"} eq "Y") {
1343 push @column_index, $item;
1345 # add column to href and callback
1346 $callback .= "&l_$item=Y";
1347 $href .= "&l_$item=Y";
1351 if ($form->{l_subtotal} eq 'Y') {
1352 $callback .= "&l_subtotal=Y";
1353 $href .= "&l_subtotal=Y";
1356 $column_header{id} =
1357 "<th><a class=listheading href=$href&sort=id>"
1358 . $locale->text('ID')
1360 $column_header{transdate} =
1361 "<th><a class=listheading href=$href&sort=transdate>"
1362 . $locale->text('Date')
1364 $column_header{duedate} =
1365 "<th><a class=listheading href=$href&sort=duedate>"
1366 . $locale->text('Due Date')
1368 $column_header{type} =
1369 "<th class=\"listheading\">" . $locale->text('Type') . "</th>";
1370 $column_header{invnumber} =
1371 "<th><a class=listheading href=$href&sort=invnumber>"
1372 . $locale->text('Invoice')
1374 $column_header{ordnumber} =
1375 "<th><a class=listheading href=$href&sort=ordnumber>"
1376 . $locale->text('Order')
1378 $column_header{name} =
1379 "<th><a class=listheading href=$href&sort=name>"
1380 . $locale->text('Customer')
1382 $column_header{netamount} =
1383 "<th class=listheading>" . $locale->text('Amount') . "</th>";
1384 $column_header{tax} =
1385 "<th class=listheading>" . $locale->text('Tax') . "</th>";
1386 $column_header{amount} =
1387 "<th class=listheading>" . $locale->text('Total') . "</th>";
1388 $column_header{paid} =
1389 "<th class=listheading>" . $locale->text('Paid') . "</th>";
1390 $column_header{datepaid} =
1391 "<th><a class=listheading href=$href&sort=datepaid>"
1392 . $locale->text('Date Paid')
1394 $column_header{due} =
1395 "<th class=listheading>" . $locale->text('Amount Due') . "</th>";
1396 $column_header{notes} =
1397 "<th class=listheading>" . $locale->text('Notes') . "</th>";
1398 $column_header{employee} =
1399 "<th><a class=listheading href=$href&sort=employee>"
1400 . $locale->text('Salesperson') . "</th>";
1402 $column_header{shippingpoint} =
1403 "<th><a class=listheading href=$href&sort=shippingpoint>"
1404 . $locale->text('Shipping Point')
1406 $column_header{shipvia} =
1407 "<th><a class=listheading href=$href&sort=shipvia>"
1408 . $locale->text('Ship via')
1411 $form->{title} = $locale->text('AR Transactions');
1420 <th class=listtop>$form->{title}</th>
1422 <tr height="5"></tr>
1429 <tr class=listheading>
1432 map { print "\n$column_header{$_}" } @column_index;
1438 # add sort and escape callback, this one we use for the add sub
1439 $form->{callback} = $callback .= "&sort=$form->{sort}";
1441 # escape callback for href
1442 $callback = $form->escape($callback);
1444 if (@{ $form->{AR} }) {
1445 $sameitem = $form->{AR}->[0]->{ $form->{sort} };
1448 # sums and tax on reports by Antonio Gallardo
1450 foreach $ar (@{ $form->{AR} }) {
1452 if ($form->{l_subtotal} eq 'Y') {
1453 if ($sameitem ne $ar->{ $form->{sort} }) {
1458 $column_data{netamount} =
1460 . $form->format_amount(\%myconfig, $ar->{netamount}, 2, " ")
1462 $column_data{tax} = "<td align=right>"
1463 . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{netamount},
1466 $column_data{amount} =
1468 . $form->format_amount(\%myconfig, $ar->{amount}, 2, " ") . "</td>";
1469 $column_data{paid} =
1471 . $form->format_amount(\%myconfig, $ar->{paid}, 2, " ") . "</td>";
1472 $column_data{due} = "<td align=right>"
1473 . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{paid},
1477 $subtotalnetamount += $ar->{netamount};
1478 $subtotalamount += $ar->{amount};
1479 $subtotalpaid += $ar->{paid};
1480 $subtotaldue += $ar->{amount} - $ar->{paid};
1482 $totalnetamount += $ar->{netamount};
1483 $totalamount += $ar->{amount};
1484 $totalpaid += $ar->{paid};
1485 $totaldue += ($ar->{amount} - $ar->{paid});
1487 $column_data{transdate} = "<td>$ar->{transdate} </td>";
1488 $column_data{id} = "<td>$ar->{id}</td>";
1489 $column_data{datepaid} = "<td>$ar->{datepaid} </td>";
1490 $column_data{duedate} = "<td>$ar->{duedate} </td>";
1492 $module = ($ar->{invoice}) ? "is.pl" : $form->{script};
1494 $column_data{invnumber} =
1495 "<td><a href=$module?action=edit&id=$ar->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}</a></td>";
1496 $column_data{type} = "<td>" .
1497 ($ar->{storno} ? $locale->text("Storno (one letter abbreviation)") :
1499 $locale->text("Credit note (one letter abbreviation)") :
1500 $locale->text("Invoice (one letter abbreviation)")) . "</td>";
1501 $column_data{ordnumber} = "<td>$ar->{ordnumber} </td>";
1502 $column_data{name} = "<td>$ar->{name}</td>";
1503 $ar->{notes} =~ s/\r\n/<br>/g;
1504 $column_data{notes} = "<td>$ar->{notes} </td>";
1505 $column_data{shippingpoint} = "<td>$ar->{shippingpoint} </td>";
1506 $column_data{shipvia} = "<td>$ar->{shipvia} </td>";
1507 $column_data{employee} = "<td>$ar->{employee} </td>";
1512 <tr class=listrow$i>
1515 map { print "\n$column_data{$_}" } @column_index;
1523 if ($form->{l_subtotal} eq 'Y') {
1529 <tr class=listtotal>
1532 map { $column_data{$_} = "<td> </td>" } @column_index;
1534 $column_data{netamount} =
1535 "<th class=listtotal align=right>"
1536 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1537 $column_data{tax} = "<th class=listtotal align=right>"
1538 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1541 $column_data{amount} =
1542 "<th class=listtotal align=right>"
1543 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1544 $column_data{paid} =
1545 "<th class=listtotal align=right>"
1546 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
1548 "<th class=listtotal align=right>"
1549 . $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>";
1551 map { print "\n$column_data{$_}" } @column_index;
1559 <td><hr size=3 noshade></td>
1564 <form method=post action=$form->{script}>
1566 <input name=callback type=hidden value="$form->{callback}">
1568 <input type=hidden name=path value=$form->{path}>
1569 <input type=hidden name=login value=$form->{login}>
1570 <input type=hidden name=password value=$form->{password}>
1572 <input class=submit type=submit name=action value="|
1573 . $locale->text('AR Transaction') . qq|">
1574 <input class=submit type=submit name=action value="|
1575 . $locale->text('Sales Invoice') . qq|">
1583 $lxdebug->leave_sub();
1587 $lxdebug->enter_sub();
1589 map { $column_data{$_} = "<td> </td>" } @column_index;
1591 $column_data{tax} = "<th class=listsubtotal align=right>"
1592 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1595 $column_data{amount} =
1596 "<th class=listsubtotal align=right>"
1597 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1598 $column_data{paid} =
1599 "<th class=listsubtotal align=right>"
1600 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
1602 "<th class=listsubtotal align=right>"
1603 . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
1605 $subtotalnetamount = 0;
1606 $subtotalamount = 0;
1610 $sameitem = $ar->{ $form->{sort} };
1612 print "<tr class=listsubtotal>";
1614 map { print "\n$column_data{$_}" } @column_index;
1620 $lxdebug->leave_sub();