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";
40 require "bin/mozilla/common.pl";
46 # this is for our long dates
47 # $locale->text('January')
48 # $locale->text('February')
49 # $locale->text('March')
50 # $locale->text('April')
51 # $locale->text('May ')
52 # $locale->text('June')
53 # $locale->text('July')
54 # $locale->text('August')
55 # $locale->text('September')
56 # $locale->text('October')
57 # $locale->text('November')
58 # $locale->text('December')
60 # this is for our short month
61 # $locale->text('Jan')
62 # $locale->text('Feb')
63 # $locale->text('Mar')
64 # $locale->text('Apr')
65 # $locale->text('May')
66 # $locale->text('Jun')
67 # $locale->text('Jul')
68 # $locale->text('Aug')
69 # $locale->text('Sep')
70 # $locale->text('Oct')
71 # $locale->text('Nov')
72 # $locale->text('Dec')
75 $lxdebug->enter_sub();
77 $form->{title} = "Add";
79 "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
80 unless $form->{callback};
83 AR->get_transdate(\%myconfig, $form);
86 $lxdebug->leave_sub();
90 $lxdebug->enter_sub();
92 $form->{title} = "Edit";
97 $lxdebug->leave_sub();
101 $lxdebug->enter_sub();
106 $lxdebug->leave_sub();
110 $lxdebug->enter_sub();
112 $form->create_links("AR", \%myconfig, "customer");
113 $duedate = $form->{duedate};
115 $taxincluded = $form->{taxincluded};
116 my $id = $form->{id};
117 IS->get_customer(\%myconfig, \%$form);
118 $form->{taxincluded} = $taxincluded;
121 $form->{duedate} = $duedate if $duedate;
122 $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
123 $form->{rowcount} = 1;
126 @curr = split(/:/, $form->{currencies});
128 $form->{defaultcurrency} = $curr[0];
130 map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
133 if (@{ $form->{all_customer} }) {
134 $form->{customer} = "$form->{customer}--$form->{customer_id}";
135 map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}\n" }
136 (@{ $form->{all_customer} });
140 if (@{ $form->{all_departments} }) {
141 $form->{selectdepartment} = "<option>\n";
142 $form->{department} = "$form->{department}--$form->{department_id}";
145 $form->{selectdepartment} .=
146 "<option>$_->{description}--$_->{id}\n"
147 } (@{ $form->{all_departments} });
150 $form->{employee} = "$form->{employee}--$form->{employee_id}";
153 if (@{ $form->{all_employees} }) {
154 $form->{selectemployee} = "";
155 map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
156 (@{ $form->{all_employees} });
159 # build the popup menus
160 $form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked";
164 qq|<option value=\"$_->{id}--$_->{rate}\">$_->{taxdescription} |
165 . ($_->{rate} * 100) . qq| %|
167 $form->{taxchart} = $tax;
168 $form->{selecttaxchart} = $tax;
171 $form->{forex} = $form->{exchangerate};
172 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
173 foreach $key (keys %{ $form->{AR_links} }) {
175 foreach $ref (@{ $form->{AR_links}{$key} }) {
176 if ($key eq "AR_paid") {
177 $form->{"select$key"} .=
178 "<option value=\"$ref->{accno}\">$ref->{accno}--$ref->{description}</option>\n";
180 $form->{"select$key"} .=
181 "<option value=\"$ref->{accno}--$ref->{tax_id}\">$ref->{accno}--$ref->{description}</option>\n";
185 $form->{$key} = $form->{"select$key"};
187 # if there is a value we have an old entry
191 for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
192 if ($key eq "AR_paid") {
194 $form->{"AR_paid_$j"} =
195 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
198 $form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
199 $form->{"datepaid_$j"} =
200 $form->{acc_trans}{$key}->[$i - 1]->{transdate};
201 $form->{"source_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
202 $form->{"memo_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
204 $form->{"forex_$j"} = $form->{"exchangerate_$i"} =
205 $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
206 $form->{"AR_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}";
207 $form->{paidaccounts}++;
213 if ($key eq "AR_tax" || $key eq "AP_tax") {
214 $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
215 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
216 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
218 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
221 if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
223 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
225 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
228 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
230 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
232 $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
233 $form->{"tax_$index"} = $form->{acc_trans}{$key}->[$i - 1]->{amount};
234 $totaltax += $form->{"tax_$index"};
238 $form->{"${akey}_$k"} =
240 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
242 if ($akey eq 'amount') {
244 $totalamount += $form->{"${akey}_$i"};
246 $form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"} =
247 "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}";
248 $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate};
249 $form->{"project_id_$k"} =
250 "$form->{acc_trans}{$key}->[$i-1]->{project_id}";
252 $form->{"${key}_$k"} =
253 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
254 $form->{"${key}_$i"} =
255 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
256 my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description});
257 $form->{"select${key}"} =~
258 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)\">$form->{acc_trans}{$key}->[$i-1]->{accno}--${q_description}<\/option>\n/;
259 $form->{"${key}_$k"} = $1;
260 if ($akey eq 'amount') {
261 $form->{"taxchart_$k"} = $form->{taxchart};
262 $form->{"taxchart_$k"} =~
263 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{id}--[^\"]*)/;
264 $form->{"taxchart_$k"} = $1;
271 $form->{taxincluded} = $taxincluded if ($form->{id});
272 $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
274 if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
276 # add tax to amounts and invtotal
277 for $i (1 .. $form->{rowcount}) {
279 ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
280 $tax = $form->round_amount($taxamount, 2);
281 $diff += ($taxamount - $tax);
282 $form->{"amount_$i"} += $form->{"tax_$i"};
284 $form->{amount_1} += $form->round_amount($diff, 2);
287 $taxamount = $form->round_amount($taxamount, 2);
288 $form->{tax} = $taxamount;
290 $form->{invtotal} = $totalamount + $totaltax;
293 ($form->datetonum($form->{transdate}, \%myconfig) <=
294 $form->datetonum($form->{closedto}, \%myconfig));
296 $form->{"ARselected"} = $form->{"AR_1"};
298 $lxdebug->leave_sub();
302 $lxdebug->enter_sub();
304 $title = $form->{title};
305 $form->{title} = $locale->text("$title Accounts Receivables Transaction");
307 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
309 # $locale->text('Add Accounts Receivables Transaction')
310 # $locale->text('Edit Accounts Receivables Transaction')
311 $form->{javascript} = qq|<script type="text/javascript">
313 function setTaxkey(accno, row) {
314 var taxkey = accno.options[accno.selectedIndex].value;
315 var reg = /--([0-9]*)/;
316 var found = reg.exec(taxkey);
317 var index = found[1];
318 index = parseInt(index);
319 var tax = 'taxchart_' + row;
320 for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
321 var reg2 = new RegExp("^"+ index, "");
322 if (reg2.exec(document.getElementById(tax).options[i].value)) {
323 document.getElementById(tax).options[i].selected = true;
331 $readonly = ($form->{id}) ? "readonly" : "";
334 ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
335 $readonly = ($form->{radier}) ? "" : $readonly;
337 my $ARselected_quoted = quotemeta($form->{"ARselected"});
338 $form->{selectAR} = $form->{AR};
340 s/value=\"${ARselected_quoted}\"/value=\"$form->{ARselected}\" selected/;
342 # set option selected
343 foreach $item (qw(customer currency department employee)) {
344 $form->{"select$item"} =~ s/ selected//;
345 $form->{"select$item"} =~
346 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
348 $selectAR_amount_unquoted = $form->{selectAR_amount};
349 $taxchart = $form->{taxchart};
350 map { $form->{$_} =~ s/\"/"/g }
351 qw(AR_amount selectAR_amount AR taxchart);
354 $form->{exchangerate} =
355 $form->format_amount(\%myconfig, $form->{exchangerate});
357 $form->{creditlimit} =
358 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
359 $form->{creditremaining} =
360 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
363 <input type=hidden name=forex value=$form->{forex}>
365 if ($form->{currency} ne $form->{defaultcurrency}) {
366 if ($form->{forex}) {
368 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
369 <td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td>
373 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
374 <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
383 <td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
384 <th align=left nowrap>| . $locale->text('Tax Included') . qq|</th>
388 if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) {
392 qq|<textarea name=notes rows=$rows cols=50 wrap=soft>$form->{notes}</textarea>|;
396 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
397 <td colspan=3><select name=department>$form->{selectdepartment}</select>
398 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
401 | if $form->{selectdepartment};
403 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
406 ($form->{selectcustomer})
407 ? qq|<select name=customer>$form->{selectcustomer}</select>|
408 : qq|<input name=customer value="$form->{customer}" size=35>|;
411 <input type=hidden name=employee value="$form->{employee}">
414 if ($form->{selectemployee}) {
417 <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
418 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
419 <input type=hidden name=selectemployee value="$form->{selectemployee}">
424 $form->{fokus} = "arledger.customer";
426 # use JavaScript Calendar or not
427 $form->{jsscript} = $jscalendar;
429 if ($form->{jsscript}) {
431 # with JavaScript Calendar
433 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
434 <td><input type=button name=transdate id="trigger1" value=|
435 . $locale->text('button') . qq|></td>
438 <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
439 <td><input type=button name=duedate id="trigger2" value=|
440 . $locale->text('button') . qq|></td></td>
445 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
446 "duedate", "BL", "trigger2");
449 # without JavaScript Calendar
451 qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
453 qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
459 <body onLoad="fokus()">
461 <form method=post name="arledger" action=$form->{script}>
463 <input type=hidden name=id value=$form->{id}>
464 <input type=hidden name=sort value=$form->{sort}>
465 <input type=hidden name=closedto value=$form->{closedto}>
466 <input type=hidden name=locked value=$form->{locked}>
467 <input type=hidden name=title value="$title">
471 <th class=listtop>$form->{title}</th>
481 <th align="right" nowrap>| . $locale->text('Customer') . qq|</th>
482 <td colspan=3>$customer</td>
483 <input type=hidden name=selectcustomer value="$form->{selectcustomer}">
484 <input type=hidden name=oldcustomer value="$form->{oldcustomer}">
485 <input type=hidden name=customer_id value="$form->{customer_id}">
486 <input type=hidden name=terms value=$form->{terms}>
493 <th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th>
494 <td>$form->{creditlimit}</td>
495 <th align=left nowrap>| . $locale->text('Remaining') . qq|</th>
496 <td class="plus$n">$form->{creditremaining}</td>
497 <input type=hidden name=creditlimit value=$form->{creditlimit}>
498 <input type=hidden name=creditremaining value=$form->{creditremaining}>
504 <th align=right>| . $locale->text('Currency') . qq|</th>
505 <td><select name=currency>$form->{selectcurrency}</select></td>
506 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
507 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
508 <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
509 <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
520 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
521 <td><input name=invnumber size=11 value="$form->{invnumber}"></td>
524 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
525 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
528 <th align=right nowrap>| . $locale->text('Invoice Date') . qq|</th>
532 <th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
543 <input type=hidden name=selectAR_amount value="$form->{selectAR_amount}">
544 <input type=hidden name=AR_amount value="$form->{AR_amount}">
545 <input type=hidden name=taxchart value="$form->{taxchart}">
546 <input type=hidden name=rowcount value=$form->{rowcount}>
550 <tr class=listheading>
551 <th class=listheading style="width:15%">|
552 . $locale->text('Account') . qq|</th>
553 <th class=listheading style="width:10%">|
554 . $locale->text('Amount') . qq|</th>
555 <th class=listheading style="width:10%">|
556 . $locale->text('Tax') . qq|</th>
557 <th class=listheading style="width:5%">|
558 . $locale->text('Korrektur') . qq|</th>
559 <th class=listheading style="width:10%">|
560 . $locale->text('Taxkey') . qq|</th>
561 <th class=listheading style="width:10%">|
562 . $locale->text('Project') . qq|</th>
566 $amount = $locale->text('Amount');
567 $project = $locale->text('Project');
569 for $i (1 .. $form->{rowcount}) {
572 $form->{"amount_$i"} =
573 $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
574 $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
575 $selectAR_amount = $selectAR_amount_unquoted;
577 s/option value=\"$form->{"AR_amount_$i"}\"/option value=\"$form->{"AR_amount_$i"}\" selected/;
579 $tax_selected = $form->{"taxchart_$i"};
580 $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
582 qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
583 $korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : '');
587 <td width=50%><select name="AR_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAR_amount</select></td>
588 <td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
589 <td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
590 <td><input type="checkbox" name="korrektur_$i" value="1" $korrektur_checked></td>
592 <td><input name="projectnumber_$i" size=20 value="$form->{"projectnumber_$i"}">
593 <input type=hidden name="project_id_$i" value=$form->{"project_id_$i"}>
594 <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}"></td>
601 $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
610 <td><select name=ARselected>$form->{selectAR}</select></td>
611 <input type=hidden name=AR value="$form->{AR}">
612 <th align=left>$form->{invtotal}</th>
614 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
615 <input type=hidden name=oldtotalpaid value=$form->{oldtotalpaid}>
617 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
630 <th align=left width=1%>| . $locale->text('Notes') . qq|</th>
631 <td align=left>$notes</td>
639 <tr class=listheading>
640 <th colspan=6 class=listheading>|
641 . $locale->text('Incoming Payments') . qq|</th>
645 if ($form->{currency} eq $form->{defaultcurrency}) {
646 @column_index = qw(datepaid source memo paid AR_paid);
648 @column_index = qw(datepaid source memo paid exchangerate AR_paid);
651 $column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
652 $column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
653 $column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
654 $column_data{AR_paid} = "<th>" . $locale->text('Account') . "</th>";
655 $column_data{source} = "<th>" . $locale->text('Source') . "</th>";
656 $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
661 map { print "$column_data{$_}\n" } @column_index;
667 $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
668 for $i (1 .. $form->{paidaccounts}) {
673 $form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
674 $form->{"selectAR_paid_$i"} =~
675 s/option value=\"$form->{"AR_paid_$i"}\">/option value=\"$form->{"AR_paid_$i"}\" selected>/;
678 if ($form->{"paid_$i"}) {
680 $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
682 $form->{"exchangerate_$i"} =
683 $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
685 $exchangerate = qq| |;
686 if ($form->{currency} ne $form->{defaultcurrency}) {
687 if ($form->{"forex_$i"}) {
689 qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
692 qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
697 <input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
701 qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
702 $column_data{AR_paid} =
703 qq|<td align=center><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
704 $column_data{exchangerate} = qq|<td align=center>$exchangerate</td>|;
705 $column_data{datepaid} =
706 qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 value=$form->{"datepaid_$i"}>
707 <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
708 $column_data{source} =
709 qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
711 qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
713 map { print qq|$column_data{$_}\n| } @column_index;
718 push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
720 map { $form->{$_} =~ s/\"/"/g } qw(selectAR_paid);
722 print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
724 <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
725 <input type=hidden name=selectAR_paid value="$form->{selectAR_paid}">
731 <td><hr size=3 noshade></td>
736 $lxdebug->leave_sub();
740 $lxdebug->enter_sub();
744 <input name=callback type=hidden value="$form->{callback}">
746 <input type=hidden name=path value=$form->{path}>
747 <input type=hidden name=login value=$form->{login}>
748 <input type=hidden name=password value=$form->{password}>
753 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
754 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
757 if ($form->{radier}) {
758 print qq|<input class=submit type=submit name=action value="|
759 . $locale->text('Update') . qq|">
763 <input class=submit type=submit name=action value="|
764 . $locale->text('Post') . qq|">
765 <input class=submit type=submit name=action value="|
766 . $locale->text('Delete') . qq|">
769 if ($transdate > $closedto) {
771 <input class=submit type=submit name=action value="|
772 . $locale->text('Use As Template') . qq|">
776 <input class=submit type=submit name=action value="|
777 . $locale->text('Post Payment') . qq|">
781 if ($transdate > $closedto) {
782 print qq|<input class=submit type=submit name=action value="|
783 . $locale->text('Update') . qq|">
784 <input class=submit type=submit name=action value="|
785 . $locale->text('Post') . qq|">|;
796 $lxdebug->leave_sub();
800 $lxdebug->enter_sub();
808 $form->{invtotal} = 0;
810 # $form->{selectAR_amount} = $form->{AR_amount};
811 # $form->{selectAR_amount} =~
812 # s/value=\"$form->{AR_amountselected}\"/value=\"$form->{AR_amountselected}\" selected/;
814 ($AR_amountaccno, $AR_amounttaxkey) =
815 split(/--/, $form->{AR_amountselected});
816 $form->{selecttaxchart} = $form->{taxchart};
817 $form->{selecttaxchart} =~
818 s/value=\"$AR_amounttaxkey--([^\"]*)\"/value=\"$AR_amounttaxkey--$1\" selected/;
822 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
823 qw(exchangerate creditlimit creditremaining);
825 @flds = qw(amount AR_amount projectnumber oldprojectnumber project_id);
829 for $i (1 .. $form->{rowcount}) {
830 $form->{"amount_$i"} =
831 $form->parse_amount(\%myconfig, $form->{"amount_$i"});
832 $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
833 if ($form->{"amount_$i"}) {
836 if (!$form->{"korrektur_$i"}) {
837 ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
839 if ($form->{taxincluded}) {
840 $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate;
842 $form->{"tax_$i"} = $form->{"amount_$i"} * $rate;
845 $form->{"tax_$i"} = 0;
848 $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"}, 2);
850 $totaltax += $form->{"tax_$i"};
851 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
856 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
857 $form->{rowcount} = $count + 1;
858 map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount});
860 $form->{exchangerate} = $exchangerate
864 $form->check_exchangerate(
865 \%myconfig, $form->{currency}, $form->{transdate}, 'buy'
868 $form->{invdate} = $form->{transdate};
869 $save_AR = $form->{AR};
870 &check_name(customer);
871 $form->{AR} = $save_AR;
876 ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
878 for $i (1 .. $form->{paidaccounts}) {
879 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
882 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
883 } qw(paid exchangerate);
885 $totalpaid += $form->{"paid_$i"};
887 $form->{"exchangerate_$i"} = $exchangerate
889 $form->{"forex_$i"} = (
891 $form->check_exchangerate(
892 \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'
897 $form->{creditremaining} -=
898 ($form->{invtotal} - $totalpaid + $form->{oldtotalpaid} -
899 $form->{oldinvtotal});
900 $form->{oldinvtotal} = $form->{invtotal};
901 $form->{oldtotalpaid} = $totalpaid;
905 $lxdebug->leave_sub();
909 $lxdebug->enter_sub();
910 for $i (1 .. $form->{paidaccounts}) {
911 if ($form->{"paid_$i"}) {
912 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
914 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
916 $form->error($locale->text('Cannot post payment for a closed period!'))
917 if ($datepaid <= $closedto);
919 if ($form->{currency} ne $form->{defaultcurrency}) {
920 $form->{"exchangerate_$i"} = $form->{exchangerate}
921 if ($invdate == $datepaid);
922 $form->isblank("exchangerate_$i",
923 $locale->text('Exchangerate for payment missing!'));
928 ($form->{AR}) = split /--/, $form->{AR};
929 ($form->{AR_paid}) = split /--/, $form->{AR_paid};
930 $form->redirect($locale->text(' Payment posted!'))
931 if (AR->post_payment(\%myconfig, \%$form));
932 $form->error($locale->text('Cannot post payment!'));
935 $lxdebug->leave_sub();
939 $lxdebug->enter_sub();
941 # check if there is an invoice number, invoice and due date
942 $form->isblank("transdate", $locale->text('Invoice Date missing!'));
943 $form->isblank("duedate", $locale->text('Due Date missing!'));
944 $form->isblank("customer", $locale->text('Customer missing!'));
946 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
947 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
949 $form->error($locale->text('Cannot post transaction for a closed period!'))
950 if ($transdate <= $closedto);
952 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
953 if ($form->{currency} ne $form->{defaultcurrency});
957 for $i (1 .. $form->{paidaccounts}) {
958 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
959 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
961 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
963 $form->error($locale->text('Cannot post payment for a closed period!'))
964 if ($datepaid <= $closedto);
966 if ($form->{currency} ne $form->{defaultcurrency}) {
967 $form->{"exchangerate_$i"} = $form->{exchangerate}
968 if ($transdate == $datepaid);
969 $form->isblank("exchangerate_$i",
970 $locale->text('Exchangerate for payment missing!'));
975 # if oldcustomer ne customer redo form
976 ($customer) = split /--/, $form->{customer};
977 if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
982 ($creditaccno, $credittaxkey) = split /--/, $form->{AR_amountselected};
983 ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
984 ($receivablesaccno, $payablestaxkey) = split /--/, $form->{ARselected};
985 $form->{AR}{amount_1} = $creditaccno;
986 $form->{AR}{receivables} = $receivablesaccno;
987 $form->{taxkey} = $taxkey;
989 $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber")
990 unless $form->{invnumber};
992 $form->{id} = 0 if $form->{postasnew};
994 $form->redirect($locale->text('Transaction posted!'))
995 if (AR->post_transaction(\%myconfig, \%$form));
996 $form->error($locale->text('Cannot post transaction!'));
998 $lxdebug->leave_sub();
1002 $lxdebug->enter_sub();
1004 $form->{postasnew} = 1;
1007 $lxdebug->leave_sub();
1010 sub use_as_template {
1011 $lxdebug->enter_sub();
1013 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);
1014 $form->{paidaccounts} = 1;
1015 $form->{rowcount}--;
1016 $form->{invdate} = $form->current_date(\%myconfig);
1019 $lxdebug->leave_sub();
1023 $lxdebug->enter_sub();
1025 $form->{title} = $locale->text('Confirm!');
1029 delete $form->{header};
1034 <form method=post action=$form->{script}>
1037 foreach $key (keys %$form) {
1038 $form->{$key} =~ s/\"/"/g;
1039 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1043 <h2 class=confirm>$form->{title}</h2>
1046 . $locale->text('Are you sure you want to delete Transaction')
1047 . qq| $form->{invnumber}</h4>
1049 <input name=action class=submit type=submit value="|
1050 . $locale->text('Yes') . qq|">
1057 $lxdebug->leave_sub();
1061 $lxdebug->enter_sub();
1063 $form->redirect($locale->text('Transaction deleted!'))
1064 if (AR->delete_transaction(\%myconfig, \%$form, $spool));
1065 $form->error($locale->text('Cannot delete transaction!'));
1067 $lxdebug->leave_sub();
1071 $lxdebug->enter_sub();
1073 # setup customer selection
1074 $form->all_vc(\%myconfig, "customer", "AR");
1076 if (@{ $form->{all_customer} }) {
1077 map { $customer .= "<option>$_->{name}--$_->{id}\n" }
1078 @{ $form->{all_customer} };
1079 $customer = qq|<select name=customer><option>\n$customer</select>|;
1081 $customer = qq|<input name=customer size=35>|;
1085 if (@{ $form->{all_departments} }) {
1086 $form->{selectdepartment} = "<option>\n";
1089 $form->{selectdepartment} .=
1090 "<option>$_->{description}--$_->{id}\n"
1091 } (@{ $form->{all_departments} });
1096 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1097 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1099 | if $form->{selectdepartment};
1101 $form->{title} = $locale->text('AR Transactions');
1103 # use JavaScript Calendar or not
1104 $form->{jsscript} = $jscalendar;
1106 if ($form->{jsscript}) {
1108 # with JavaScript Calendar
1110 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1111 <input type=button name=transdatefrom id="trigger1" value=|
1112 . $locale->text('button') . qq|></td>
1115 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1116 <input type=button name=transdateto name=transdateto id="trigger2" value=|
1117 . $locale->text('button') . qq|></td>
1122 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
1123 "transdateto", "BL", "trigger2");
1126 # without JavaScript Calendar
1128 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1130 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1133 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1138 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1139 push(@values, $item->{"id"});
1140 $labels{$item->{"id"}} = $item->{"projectnumber"};
1143 NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1144 '-labels' => \%labels));
1146 $form->{fokus} = "search.customer";
1150 <body onLoad="fokus()">
1152 <form method=post name="search" action=$form->{script}>
1155 <tr><th class=listtop>$form->{title}</th></tr>
1156 <tr height="5"></tr>
1161 <th align=right>| . $locale->text('Customer') . qq|</th>
1162 <td colspan=3>$customer</td>
1166 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
1167 <td colspan=3><input name=invnumber size=20></td>
1170 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
1171 <td colspan=3><input name=ordnumber size=20></td>
1174 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1175 <td colspan=3><input name=notes size=40></td>
1178 <th align="right">| . $locale->text("Project Number") . qq|</th>
1179 <td colspan="3">$projectnumber</td>
1182 <th align=right nowrap>| . $locale->text('From') . qq|</th>
1184 <th align=right>| . $locale->text('Bis') . qq|</th>
1187 <input type=hidden name=sort value=transdate>
1195 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
1199 <td align=right><input name=open class=checkbox type=checkbox value=Y checked></td>
1200 <td nowrap>| . $locale->text('Open') . qq|</td>
1201 <td align=right><input name=closed class=checkbox type=checkbox value=Y></td>
1202 <td nowrap>| . $locale->text('Closed') . qq|</td>
1205 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
1206 <td nowrap>| . $locale->text('ID') . qq|</td>
1207 <td align=right><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
1208 <td nowrap>| . $locale->text('Invoice Number') . qq|</td>
1209 <td align=right><input name="l_ordnumber" class=checkbox type=checkbox value=Y></td>
1210 <td nowrap>| . $locale->text('Order Number') . qq|</td>
1211 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
1212 <td nowrap>| . $locale->text('Invoice Date') . qq|</td>
1215 <td align=right><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
1216 <td nowrap>| . $locale->text('Customer') . qq|</td>
1217 <td align=right><input name="l_netamount" class=checkbox type=checkbox value=Y></td>
1218 <td nowrap>| . $locale->text('Amount') . qq|</td>
1219 <td align=right><input name="l_tax" class=checkbox type=checkbox value=Y></td>
1220 <td nowrap>| . $locale->text('Tax') . qq|</td>
1221 <td align=right><input name="l_amount" class=checkbox type=checkbox value=Y checked></td>
1222 <td nowrap>| . $locale->text('Total') . qq|</td>
1225 <td align=right><input name="l_datepaid" class=checkbox type=checkbox value=Y></td>
1226 <td nowrap>| . $locale->text('Date Paid') . qq|</td>
1227 <td align=right><input name="l_paid" class=checkbox type=checkbox value=Y checked></td>
1228 <td nowrap>| . $locale->text('Paid') . qq|</td>
1229 <td align=right><input name="l_duedate" class=checkbox type=checkbox value=Y></td>
1230 <td nowrap>| . $locale->text('Due Date') . qq|</td>
1231 <td align=right><input name="l_due" class=checkbox type=checkbox value=Y></td>
1232 <td nowrap>| . $locale->text('Amount Due') . qq|</td>
1235 <td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
1236 <td nowrap>| . $locale->text('Notes') . qq|</td>
1237 <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
1238 <td nowrap>| . $locale->text('Salesperson') . qq|</td>
1239 <td align=right><input name="l_shippingpoint" class=checkbox type=checkbox value=Y></td>
1240 <td nowrap>| . $locale->text('Shipping Point') . qq|</td>
1241 <td align=right><input name="l_shipvia" class=checkbox type=checkbox value=Y></td>
1242 <td nowrap>| . $locale->text('Ship via') . qq|</td>
1245 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1246 <td nowrap>| . $locale->text('Subtotal') . qq|</td>
1247 <td align=right><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y></td>
1248 <td nowrap>| . $locale->text('Project Number') . qq|</td>
1257 <td><hr size=3 noshade></td>
1261 <input type=hidden name=nextsub value=$form->{nextsub}>
1263 <input type=hidden name=path value=$form->{path}>
1264 <input type=hidden name=login value=$form->{login}>
1265 <input type=hidden name=password value=$form->{password}>
1268 <input class=submit type=submit name=action value="|
1269 . $locale->text('Continue') . qq|">
1280 $lxdebug->leave_sub();
1283 sub ar_transactions {
1284 $lxdebug->enter_sub();
1286 $form->{customer} = $form->unescape($form->{customer});
1287 ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer});
1289 AR->ar_transactions(\%myconfig, \%$form);
1292 "$form->{script}?action=ar_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1295 if ($form->{customer}) {
1296 $callback .= "&customer=" . $form->escape($form->{customer}, 1);
1297 $href .= "&customer=" . $form->escape($form->{customer});
1298 $option = $locale->text('Customer') . " : $form->{customer}";
1300 if ($form->{department}) {
1301 $callback .= "&department=" . $form->escape($form->{department}, 1);
1302 $href .= "&department=" . $form->escape($form->{department});
1303 ($department) = split /--/, $form->{department};
1304 $option .= "\n<br>" if ($option);
1305 $option .= $locale->text('Department') . " : $department";
1307 if ($form->{invnumber}) {
1308 $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
1309 $href .= "&invnumber=" . $form->escape($form->{invnumber});
1310 $option .= "\n<br>" if ($option);
1311 $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
1313 if ($form->{ordnumber}) {
1314 $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
1315 $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
1316 $option .= "\n<br>" if ($option);
1317 $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
1319 if ($form->{notes}) {
1320 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
1321 $href .= "¬es=" . $form->escape($form->{notes});
1322 $option .= "\n<br>" if $option;
1323 $option .= $locale->text('Notes') . " : $form->{notes}";
1326 if ($form->{transdatefrom}) {
1327 $callback .= "&transdatefrom=$form->{transdatefrom}";
1328 $href .= "&transdatefrom=$form->{transdatefrom}";
1329 $option .= "\n<br>" if ($option);
1331 $locale->text('From') . " "
1332 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1334 if ($form->{transdateto}) {
1335 $callback .= "&transdateto=$form->{transdateto}";
1336 $href .= "&transdateto=$form->{transdateto}";
1337 $option .= "\n<br>" if ($option);
1339 $locale->text('Bis') . " "
1340 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1342 if ($form->{open}) {
1343 $callback .= "&open=$form->{open}";
1344 $href .= "&open=$form->{open}";
1345 $option .= "\n<br>" if ($option);
1346 $option .= $locale->text('Open');
1348 if ($form->{closed}) {
1349 $callback .= "&closed=$form->{closed}";
1350 $href .= "&closed=$form->{closed}";
1351 $option .= "\n<br>" if ($option);
1352 $option .= $locale->text('Closed');
1354 if ($form->{globalproject_id}) {
1355 $callback .= "&globalproject_id=" . E($form->{globalproject_id});
1356 $href .= "&globalproject_id=" . E($form->{globalproject_id});
1360 qw(transdate id type invnumber ordnumber name netamount tax amount paid
1361 datepaid due duedate notes employee shippingpoint shipvia
1362 globalprojectnumber);
1364 $form->{"l_type"} = "Y";
1366 foreach $item (@columns) {
1367 if ($form->{"l_$item"} eq "Y") {
1368 push @column_index, $item;
1370 # add column to href and callback
1371 $callback .= "&l_$item=Y";
1372 $href .= "&l_$item=Y";
1376 if ($form->{l_subtotal} eq 'Y') {
1377 $callback .= "&l_subtotal=Y";
1378 $href .= "&l_subtotal=Y";
1381 $column_header{id} =
1382 "<th><a class=listheading href=$href&sort=id>"
1383 . $locale->text('ID')
1385 $column_header{transdate} =
1386 "<th><a class=listheading href=$href&sort=transdate>"
1387 . $locale->text('Date')
1389 $column_header{duedate} =
1390 "<th><a class=listheading href=$href&sort=duedate>"
1391 . $locale->text('Due Date')
1393 $column_header{type} =
1394 "<th class=\"listheading\">" . $locale->text('Type') . "</th>";
1395 $column_header{invnumber} =
1396 "<th><a class=listheading href=$href&sort=invnumber>"
1397 . $locale->text('Invoice')
1399 $column_header{ordnumber} =
1400 "<th><a class=listheading href=$href&sort=ordnumber>"
1401 . $locale->text('Order')
1403 $column_header{name} =
1404 "<th><a class=listheading href=$href&sort=name>"
1405 . $locale->text('Customer')
1407 $column_header{netamount} =
1408 "<th class=listheading>" . $locale->text('Amount') . "</th>";
1409 $column_header{tax} =
1410 "<th class=listheading>" . $locale->text('Tax') . "</th>";
1411 $column_header{amount} =
1412 "<th class=listheading>" . $locale->text('Total') . "</th>";
1413 $column_header{paid} =
1414 "<th class=listheading>" . $locale->text('Paid') . "</th>";
1415 $column_header{datepaid} =
1416 "<th><a class=listheading href=$href&sort=datepaid>"
1417 . $locale->text('Date Paid')
1419 $column_header{due} =
1420 "<th class=listheading>" . $locale->text('Amount Due') . "</th>";
1421 $column_header{notes} =
1422 "<th class=listheading>" . $locale->text('Notes') . "</th>";
1423 $column_header{employee} =
1424 "<th><a class=listheading href=$href&sort=employee>"
1425 . $locale->text('Salesperson') . "</th>";
1427 $column_header{shippingpoint} =
1428 "<th><a class=listheading href=$href&sort=shippingpoint>"
1429 . $locale->text('Shipping Point')
1431 $column_header{shipvia} =
1432 "<th><a class=listheading href=$href&sort=shipvia>"
1433 . $locale->text('Ship via')
1435 $column_header{globalprojectnumber} =
1436 qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1438 $form->{title} = $locale->text('AR Transactions');
1447 <th class=listtop>$form->{title}</th>
1449 <tr height="5"></tr>
1456 <tr class=listheading>
1459 map { print "\n$column_header{$_}" } @column_index;
1465 # add sort and escape callback, this one we use for the add sub
1466 $form->{callback} = $callback .= "&sort=$form->{sort}";
1468 # escape callback for href
1469 $callback = $form->escape($callback);
1471 if (@{ $form->{AR} }) {
1472 $sameitem = $form->{AR}->[0]->{ $form->{sort} };
1475 # sums and tax on reports by Antonio Gallardo
1477 foreach $ar (@{ $form->{AR} }) {
1479 if ($form->{l_subtotal} eq 'Y') {
1480 if ($sameitem ne $ar->{ $form->{sort} }) {
1485 $column_data{netamount} =
1487 . $form->format_amount(\%myconfig, $ar->{netamount}, 2, " ")
1489 $column_data{tax} = "<td align=right>"
1490 . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{netamount},
1493 $column_data{amount} =
1495 . $form->format_amount(\%myconfig, $ar->{amount}, 2, " ") . "</td>";
1496 $column_data{paid} =
1498 . $form->format_amount(\%myconfig, $ar->{paid}, 2, " ") . "</td>";
1499 $column_data{due} = "<td align=right>"
1500 . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{paid},
1504 $subtotalnetamount += $ar->{netamount};
1505 $subtotalamount += $ar->{amount};
1506 $subtotalpaid += $ar->{paid};
1507 $subtotaldue += $ar->{amount} - $ar->{paid};
1509 $totalnetamount += $ar->{netamount};
1510 $totalamount += $ar->{amount};
1511 $totalpaid += $ar->{paid};
1512 $totaldue += ($ar->{amount} - $ar->{paid});
1514 $column_data{transdate} = "<td>$ar->{transdate} </td>";
1515 $column_data{id} = "<td>$ar->{id}</td>";
1516 $column_data{datepaid} = "<td>$ar->{datepaid} </td>";
1517 $column_data{duedate} = "<td>$ar->{duedate} </td>";
1519 $module = ($ar->{invoice}) ? "is.pl" : $form->{script};
1521 $column_data{invnumber} =
1522 "<td><a href=$module?action=edit&id=$ar->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}</a></td>";
1523 $column_data{type} = "<td>" .
1524 ($ar->{storno} ? $locale->text("Storno (one letter abbreviation)") :
1526 $locale->text("Credit note (one letter abbreviation)") :
1527 $locale->text("Invoice (one letter abbreviation)")) . "</td>";
1528 $column_data{ordnumber} = "<td>$ar->{ordnumber} </td>";
1529 $column_data{name} = "<td>$ar->{name}</td>";
1530 $ar->{notes} =~ s/\r\n/<br>/g;
1531 $column_data{notes} = "<td>$ar->{notes} </td>";
1532 $column_data{shippingpoint} = "<td>$ar->{shippingpoint} </td>";
1533 $column_data{shipvia} = "<td>$ar->{shipvia} </td>";
1534 $column_data{employee} = "<td>$ar->{employee} </td>";
1535 $column_data{globalprojectnumber} =
1536 "<td>" . H($ar->{globalprojectnumber}) . "</td>";
1541 <tr class=listrow$i>
1544 map { print "\n$column_data{$_}" } @column_index;
1552 if ($form->{l_subtotal} eq 'Y') {
1558 <tr class=listtotal>
1561 map { $column_data{$_} = "<td> </td>" } @column_index;
1563 $column_data{netamount} =
1564 "<th class=listtotal align=right>"
1565 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1566 $column_data{tax} = "<th class=listtotal align=right>"
1567 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1570 $column_data{amount} =
1571 "<th class=listtotal align=right>"
1572 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1573 $column_data{paid} =
1574 "<th class=listtotal align=right>"
1575 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
1577 "<th class=listtotal align=right>"
1578 . $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>";
1580 map { print "\n$column_data{$_}" } @column_index;
1588 <td><hr size=3 noshade></td>
1593 <form method=post action=$form->{script}>
1595 <input name=callback type=hidden value="$form->{callback}">
1597 <input type=hidden name=path value=$form->{path}>
1598 <input type=hidden name=login value=$form->{login}>
1599 <input type=hidden name=password value=$form->{password}>
1601 <input class=submit type=submit name=action value="|
1602 . $locale->text('AR Transaction') . qq|">
1603 <input class=submit type=submit name=action value="|
1604 . $locale->text('Sales Invoice') . qq|">
1612 $lxdebug->leave_sub();
1616 $lxdebug->enter_sub();
1618 map { $column_data{$_} = "<td> </td>" } @column_index;
1620 $column_data{tax} = "<th class=listsubtotal align=right>"
1621 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1624 $column_data{amount} =
1625 "<th class=listsubtotal align=right>"
1626 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1627 $column_data{paid} =
1628 "<th class=listsubtotal align=right>"
1629 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
1631 "<th class=listsubtotal align=right>"
1632 . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
1634 $subtotalnetamount = 0;
1635 $subtotalamount = 0;
1639 $sameitem = $ar->{ $form->{sort} };
1641 print "<tr class=listsubtotal>";
1643 map { print "\n$column_data{$_}" } @column_index;
1649 $lxdebug->leave_sub();