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 #======================================================================
32 #======================================================================
38 require "$form->{path}/arap.pl";
39 require "bin/mozilla/common.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";
79 "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
80 unless $form->{callback};
83 AP->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("AP", \%myconfig, "vendor");
113 $taxincluded = $form->{taxincluded};
114 $duedate = $form->{duedate};
116 IR->get_vendor(\%myconfig, \%$form);
117 $form->{taxincluded} = $taxincluded;
118 $form->{duedate} = $duedate if $duedate;
119 $form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
120 $form->{rowcount} = 1;
122 # build the popup menus
123 $form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked";
127 qq|<option value=\"$_->{id}--$_->{rate}\">$_->{taxdescription} |
128 . ($_->{rate} * 100) . qq| %|
130 $form->{taxchart} = $tax;
131 $form->{selecttaxchart} = $tax;
134 @curr = split(/:/, $form->{currencies});
136 $form->{defaultcurrency} = $curr[0];
138 map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
141 if (@{ $form->{all_vendor} }) {
142 $form->{vendor} = qq|$form->{vendor}--$form->{vendor_id}|;
143 map { $form->{selectvendor} .= "<option>$_->{name}--$_->{id}\n" }
144 (@{ $form->{all_vendor} });
148 if (@{ $form->{all_departments} }) {
149 $form->{selectdepartment} = "<option>\n";
150 $form->{department} = "$form->{department}--$form->{department_id}";
153 $form->{selectdepartment} .=
154 "<option>$_->{description}--$_->{id}\n"
155 } (@{ $form->{all_departments} });
158 $form->{employee} = "$form->{employee}--$form->{employee_id}";
161 $form->{forex} = $form->{exchangerate};
162 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
164 foreach $key (keys %{ $form->{AP_links} }) {
165 foreach $ref (@{ $form->{AP_links}{$key} }) {
166 if ($key eq "AP_paid") {
167 $form->{"select$key"} .=
168 "<option value=\"$ref->{accno}\">$ref->{accno}--$ref->{description}</option>\n";
170 $form->{"select$key"} .=
171 "<option value=\"$ref->{accno}--$ref->{tax_id}\">$ref->{accno}--$ref->{description}</option>\n";
175 $form->{$key} = $form->{"select$key"};
177 # if there is a value we have an old entry
181 for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
183 if ($key eq "AP_paid") {
185 $form->{"AP_paid_$j"} =
186 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
187 $form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{amount};
188 $form->{"datepaid_$j"} =
189 $form->{acc_trans}{$key}->[$i - 1]->{transdate};
190 $form->{"source_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
191 $form->{"memo_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
193 $form->{"forex_$j"} = $form->{"exchangerate_$i"} =
194 $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
195 $form->{"AP_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}";
196 $form->{paidaccounts}++;
202 if (($key eq "AP_tax") || ($key eq "AR_tax")) {
203 $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
204 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
205 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
207 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
210 if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
212 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
214 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
217 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
219 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
221 $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
222 $form->{"tax_$index"} =
223 $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
224 $totaltax += $form->{"tax_$index"};
228 $form->{"${akey}_$k"} =
230 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
232 if ($akey eq 'amount') {
234 $form->{"${akey}_$i"} *= -1;
235 $totalamount += $form->{"${akey}_$i"};
236 $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate};
237 $form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"} =
238 "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}";
239 $form->{"project_id_$k"} =
240 "$form->{acc_trans}{$key}->[$i-1]->{project_id}";
242 $form->{"${key}_$k"} =
243 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
244 my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description});
245 $form->{"select${key}"} =~
246 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)\">$form->{acc_trans}{$key}->[$i-1]->{accno}--${q_description}<\/option>\n/;
247 $form->{"${key}_$k"} = $1;
248 if ($akey eq 'amount') {
249 $form->{"taxchart_$k"} = $form->{taxchart};
250 $form->{"taxchart_$k"} =~
251 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{id}--[^\"]*)/;
252 $form->{"taxchart_$k"} = $1;
259 $form->{taxincluded} = $taxincluded if ($form->{id});
260 $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
262 if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
264 # add tax to amounts and invtotal
265 for $i (1 .. $form->{rowcount}) {
267 ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
268 $tax = $form->round_amount($taxamount, 2);
269 $diff += ($taxamount - $tax);
270 $form->{"amount_$i"} += $form->{"tax_$i"};
272 $form->{amount_1} += $form->round_amount($diff, 2);
275 $taxamount = $form->round_amount($taxamount, 2);
277 $form->{invtotal} = $totalamount + $totaltax;
280 ($form->datetonum($form->{transdate}, \%myconfig) <=
281 $form->datetonum($form->{closedto}, \%myconfig));
283 $form->{"APselected"} = $form->{"AP_1"};
285 $lxdebug->leave_sub();
289 $lxdebug->enter_sub();
291 $title = $form->{title};
292 $form->{title} = $locale->text("$title Accounts Payables Transaction");
294 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
296 # type=submit $locale->text('Add Accounts Payables Transaction')
297 # type=submit $locale->text('Edit Accounts Payables Transaction')
299 $form->{javascript} = qq|<script type="text/javascript">
301 function setTaxkey(accno, row) {
302 var taxkey = accno.options[accno.selectedIndex].value;
303 var reg = /--([0-9]*)/;
304 var found = reg.exec(taxkey);
305 var index = found[1];
306 index = parseInt(index);
307 var tax = 'taxchart_' + row;
308 for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
309 var reg2 = new RegExp("^"+ index, "");
310 if (reg2.exec(document.getElementById(tax).options[i].value)) {
311 document.getElementById(tax).options[i].selected = true;
319 # set option selected
320 foreach $item (qw(vendor currency department)) {
321 $form->{"select$item"} =~ s/ selected//;
322 $form->{"select$item"} =~
323 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
325 $readonly = ($form->{id}) ? "readonly" : "";
327 my $APselected_quoted = quotemeta($form->{"APselected"});
328 $form->{selectAP} = $form->{AP};
330 s/value=\"${APselected_quoted}\"/value=\"$form->{APselected}\" selected/;
333 ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
334 $readonly = ($form->{radier}) ? "" : $readonly;
335 $selectAP_amount_unquoted = $form->{selectAP_amount};
336 $taxchart = $form->{taxchart};
337 map { $form->{$_} =~ s/\"/"/g }
338 qw(AP_amount selectAP_amount AP taxchart);
341 $form->{exchangerate} =
342 $form->format_amount(\%myconfig, $form->{exchangerate});
344 $form->{creditlimit} =
345 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
346 $form->{creditremaining} =
347 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
350 <input type=hidden name=forex value=$form->{forex}>
352 if ($form->{currency} ne $form->{defaultcurrency}) {
353 if ($form->{forex}) {
356 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
357 <td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td>
362 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
363 <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
372 <td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
373 <th align=left nowrap>|
374 . $locale->text('Tax Included') . qq|</th>
378 if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) {
382 qq|<textarea name=notes rows=$rows cols=50 wrap=soft $readonly>$form->{notes}</textarea>|;
386 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
387 <td colspan=3><select name=department>$form->{selectdepartment}</select>
388 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
391 | if $form->{selectdepartment};
393 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
396 ($form->{selectvendor})
397 ? qq|<select name=vendor>$form->{selectvendor}</select>|
398 : qq|<input name=vendor value="$form->{vendor}" size=35>|;
400 # use JavaScript Calendar or not
401 $form->{jsscript} = $jscalendar;
403 if ($form->{jsscript}) {
405 # with JavaScript Calendar
407 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}> $readonly</td>
408 <td><input type=button name=transdate id="trigger1" value=|
409 . $locale->text('button') . qq|></td>
412 <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}> $readonly</td>
413 <td><input type=button name=duedate id="trigger2" value=|
414 . $locale->text('button') . qq|></td></td>
419 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
420 "duedate", "BL", "trigger2");
423 # without JavaScript Calendar
425 qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}> $readonly</td>|;
427 qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}> $readonly</td>|;
435 <form method=post action=$form->{script}>
437 <input type=hidden name=id value=$form->{id}>
438 <input type=hidden name=sort value=$form->{sort}>
439 <input type=hidden name=closedto value=$form->{closedto}>
440 <input type=hidden name=locked value=$form->{locked}>
441 <input type=hidden name=title value="$title">
445 <th class=listtop>$form->{title}</th>
455 <th align=right nowrap>| . $locale->text('Vendor') . qq|</th>
456 <td colspan=3>$vendor</td>
457 <input type=hidden name=selectvendor value="$form->{selectvendor}">
458 <input type=hidden name=oldvendor value="$form->{oldvendor}">
459 <input type=hidden name=vendor_id value="$form->{vendor_id}">
460 <input type=hidden name=terms value=$form->{terms}>
467 <th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th>
468 <td>$form->{creditlimit}</td>
469 <th align=left nowrap>| . $locale->text('Remaining') . qq|</th>
470 <td class="plus$n">$form->{creditremaining}</td>
471 <input type=hidden name=creditlimit value=$form->{creditlimit}>
472 <input type=hidden name=creditremaining value=$form->{creditremaining}>
477 <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
478 <td><select name=currency>$form->{selectcurrency}</select></td>
479 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
480 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
481 <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
482 <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
492 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
493 <td><input name=invnumber size=11 value="$form->{invnumber}" $readonly></td>
496 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
497 <td><input name=ordnumber size=11 value="$form->{ordnumber}" $readonly></td>
500 <th align=right nowrap>| . $locale->text('Invoice Date') . qq|</th>
504 <th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
517 <input type=hidden name=selectAP_amount value="$form->{selectAP_amount}">
518 <input type=hidden name=AP_amount value="$form->{AP_amount}">
519 <input type=hidden name=taxchart value="$form->{taxchart}">
520 <input type=hidden name=rowcount value=$form->{rowcount}>
524 <tr class=listheading>
525 <th class=listheading style="width:15%">|
526 . $locale->text('Account') . qq|</th>
527 <th class=listheading style="width:10%">|
528 . $locale->text('Amount') . qq|</th>
529 <th class=listheading style="width:10%">|
530 . $locale->text('Tax') . qq|</th>
531 <th class=listheading style="width:5%">|
532 . $locale->text('Korrektur') . qq|</th>
533 <th class=listheading style="width:10%">|
534 . $locale->text('Taxkey') . qq|</th>
535 <th class=listheading style="width:10%">|
536 . $locale->text('Project') . qq|</th>
540 $amount = $locale->text('Amount');
541 $project = $locale->text('Project');
543 for $i (1 .. $form->{rowcount}) {
546 $form->{"amount_$i"} =
547 $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
548 $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
549 $selectAP_amount = $selectAP_amount_unquoted;
550 $re_amount = quotemeta($form->{"AP_amount_$i"});
552 s/option value=\"${re_amount}\"/option value=\"$form->{"AP_amount_$i"}\" selected/;
554 $tax_selected = $form->{"taxchart_$i"};
555 $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
557 qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
559 my $korrektur = $form->{"korrektur_$i"} ? 'checked' : '';
563 <td width=50%><select name="AP_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAP_amount</select></td>
564 <td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
565 <td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
566 <td><input type="checkbox" name="korrektur_$i" value="1" "$korrektur"></td>
568 <td><input name="projectnumber_$i" size=20 value="$form->{"projectnumber_$i"}">
569 <input type=hidden name="project_id_$i" value=$form->{"project_id_$i"}>
570 <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}"></td>
578 ($form->{taxincluded})
579 ? $locale->text('Tax Included')
580 : $locale->text('Tax');
582 $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
591 <td><select name=APselected>$form->{selectAP}</select></td>
592 <input type=hidden name=AP value="$form->{AP}">
593 <th align=left>$form->{invtotal}</th>
595 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
596 <input type=hidden name=oldtotalpaid value=$form->{oldtotalpaid}>
598 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
611 <th align=left width=1%>| . $locale->text('Notes') . qq|</th>
612 <td align=left>$notes</td>
620 <tr class=listheading>
621 <th class=listheading colspan=6>| . $locale->text('Payments') . qq|</th>
625 if ($form->{currency} eq $form->{defaultcurrency}) {
626 @column_index = qw(datepaid source memo paid AP_paid);
628 @column_index = qw(datepaid source memo paid exchangerate AP_paid);
631 $column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
632 $column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
633 $column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
634 $column_data{AP_paid} = "<th>" . $locale->text('Account') . "</th>";
635 $column_data{source} = "<th>" . $locale->text('Source') . "</th>";
636 $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
641 map { print "$column_data{$_}\n" } @column_index;
647 $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
648 for $i (1 .. $form->{paidaccounts}) {
653 $form->{"selectAP_paid_$i"} = $form->{selectAP_paid};
654 $form->{"selectAP_paid_$i"} =~
655 s/option value=\"$form->{"AP_paid_$i"}\">/option value=\"$form->{"AP_paid_$i"}\" selected>/;
658 if ($form->{"paid_$i"}) {
660 $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
662 $form->{"exchangerate_$i"} =
663 $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
665 $exchangerate = qq| |;
666 if ($form->{currency} ne $form->{defaultcurrency}) {
667 if ($form->{"forex_$i"}) {
669 qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
672 qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
677 <input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
680 $column_data{"paid_$i"} =
681 qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
682 $column_data{"AP_paid_$i"} =
683 qq|<td align=center><select name="AP_paid_$i">$form->{"selectAP_paid_$i"}</select></td>|;
684 $column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
685 $column_data{"datepaid_$i"} =
686 qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value=$form->{"datepaid_$i"}>
687 <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
688 $column_data{"source_$i"} =
689 qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
690 $column_data{"memo_$i"} =
691 qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
693 map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
698 push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
700 map { $form->{$_} =~ s/\"/"/g } qw(selectAP_paid);
701 print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
703 <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
704 <input type=hidden name=selectAP_paid value="$form->{selectAP_paid}">
710 <td><hr size=3 noshade></td>
715 $lxdebug->leave_sub();
719 $lxdebug->enter_sub();
723 <input name=callback type=hidden value="$form->{callback}">
725 <input type=hidden name=path value=$form->{path}>
726 <input type=hidden name=login value=$form->{login}>
727 <input type=hidden name=password value=$form->{password}>
732 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
733 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
737 # print qq|<input class=submit type=submit name=action value="|.$locale->text('Update').qq|">
739 if ($form->{radier}) {
741 <input class=submit type=submit name=action value="|
742 . $locale->text('Post') . qq|">
743 <input class=submit type=submit name=action value="|
744 . $locale->text('Delete') . qq|">
749 <input class=submit type=submit name=action value="|
750 . $locale->text('Use As Template') . qq|">
753 <input class=submit type=submit name=action value="|
754 . $locale->text('Post Payment') . qq|">
757 if (($transdate > $closedto) && !$form->{id}) {
758 print qq|<input class=submit type=submit name=action value="|
759 . $locale->text('Update') . qq|">
760 <input class=submit type=submit name=action value="|
761 . $locale->text('Post') . qq|">|;
772 $lxdebug->leave_sub();
776 $lxdebug->enter_sub();
784 $form->{invtotal} = 0;
786 # $form->{selectAP_amount} = $form->{AP_amount};
787 # $form->{selectAP_amount} =~
788 # s/value=\"$form->{AP_amountselected}\"/value=\"$form->{AP_amountselected}\" selected/;
790 ($AP_amountaccno, $AP_amounttaxkey) =
791 split(/--/, $form->{AP_amountselected});
792 $form->{selecttaxchart} = $form->{taxchart};
793 $form->{selecttaxchart} =~
794 s/value=\"$AP_amounttaxkey--([^\"]*)\"/value=\"$AP_amounttaxkey--$1\" selected/;
798 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
799 qw(exchangerate creditlimit creditremaining);
801 @flds = qw(amount AP_amount projectnumber oldprojectnumber project_id);
803 for $i (1 .. $form->{rowcount}) {
804 $form->{"amount_$i"} =
805 $form->parse_amount(\%myconfig, $form->{"amount_$i"});
806 $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
807 if ($form->{"amount_$i"}) {
810 if (!$form->{"korrektur_$i"}) {
811 ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
813 if ($form->{taxincluded}) {
814 $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate;
816 $form->{"tax_$i"} = $form->{"amount_$i"} * $rate;
819 $form->{"tax_$i"} = 0;
822 $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"}, 2);
824 $totaltax += $form->{"tax_$i"};
825 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
829 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
831 map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount});
833 $form->{exchangerate} = $exchangerate
837 $form->check_exchangerate(
838 \%myconfig, $form->{currency}, $form->{transdate}, 'sell'
841 $form->{invdate} = $form->{transdate};
842 $save_AP = $form->{AP};
844 $form->{AP} = $save_AP;
847 $form->{rowcount} = $count + 1;
850 ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
852 for $i (1 .. $form->{paidaccounts}) {
853 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
856 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
857 } qw(paid exchangerate);
859 $totalpaid += $form->{"paid_$i"};
861 $form->{"exchangerate_$i"} = $exchangerate
863 $form->{"forex_$i"} = (
865 $form->check_exchangerate(
866 \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'sell'
871 $form->{creditremaining} -=
872 ($form->{invtotal} - $totalpaid + $form->{oldtotalpaid} -
873 $form->{oldinvtotal});
874 $form->{oldinvtotal} = $form->{invtotal};
875 $form->{oldtotalpaid} = $totalpaid;
879 $lxdebug->leave_sub();
884 $lxdebug->enter_sub();
885 for $i (1 .. $form->{paidaccounts}) {
886 if ($form->{"paid_$i"}) {
887 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
889 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
891 $form->error($locale->text('Cannot post payment for a closed period!'))
892 if ($datepaid <= $closedto);
894 if ($form->{currency} ne $form->{defaultcurrency}) {
895 $form->{"exchangerate_$i"} = $form->{exchangerate}
896 if ($invdate == $datepaid);
897 $form->isblank("exchangerate_$i",
898 $locale->text('Exchangerate for payment missing!'));
903 ($form->{AP}) = split /--/, $form->{AP};
904 ($form->{AP_paid}) = split /--/, $form->{AP_paid};
905 $form->redirect($locale->text(' Payment posted!'))
906 if (AP->post_payment(\%myconfig, \%$form));
907 $form->error($locale->text('Cannot post payment!'));
910 $lxdebug->leave_sub();
915 $lxdebug->enter_sub();
917 # check if there is a vendor, invoice and due date
918 $form->isblank("transdate", $locale->text("Invoice Date missing!"));
919 $form->isblank("duedate", $locale->text("Due Date missing!"));
920 $form->isblank("vendor", $locale->text('Vendor missing!'));
922 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
923 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
925 $form->error($locale->text('Cannot post transaction for a closed period!'))
926 if ($transdate <= $closedto);
928 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
929 if ($form->{currency} ne $form->{defaultcurrency});
932 for $i (1 .. $form->{paidaccounts}) {
933 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
934 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
936 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
938 $form->error($locale->text('Cannot post payment for a closed period!'))
939 if ($datepaid <= $closedto);
941 if ($form->{currency} ne $form->{defaultcurrency}) {
942 $form->{"exchangerate_$i"} = $form->{exchangerate}
943 if ($transdate == $datepaid);
944 $form->isblank("exchangerate_$i",
945 $locale->text('Exchangerate for payment missing!'));
951 # if old vendor ne vendor redo form
952 ($vendor) = split /--/, $form->{vendor};
953 if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") {
957 ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected};
958 ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
959 ($payablesaccno, $payablestaxkey) = split /--/, $form->{APselected};
960 $form->{AP}{amount_1} = $debitaccno;
961 $form->{AP}{payables} = $payablesaccno;
962 $form->{taxkey} = $taxkey;
964 $form->{id} = 0 if $form->{postasnew};
966 $form->redirect($locale->text('Transaction posted!'))
967 if (AP->post_transaction(\%myconfig, \%$form));
968 $form->error($locale->text('Cannot post transaction!'));
970 $lxdebug->leave_sub();
974 $lxdebug->enter_sub();
976 $form->{postasnew} = 1;
979 $lxdebug->leave_sub();
982 sub use_as_template {
983 $lxdebug->enter_sub();
985 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);
986 $form->{paidaccounts} = 1;
988 $form->{invdate} = $form->current_date(\%myconfig);
991 $lxdebug->leave_sub();
995 $lxdebug->enter_sub();
997 $form->{title} = $locale->text('Confirm!');
1001 delete $form->{header};
1006 <form method=post action=$form->{script}>
1009 foreach $key (keys %$form) {
1010 $form->{$key} =~ s/\"/"/g;
1011 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1015 <h2 class=confirm>$form->{title}</h2>
1018 . $locale->text('Are you sure you want to delete Transaction')
1019 . qq| $form->{invnumber}</h4>
1021 <input name=action class=submit type=submit value="|
1022 . $locale->text('Yes') . qq|">
1029 $lxdebug->leave_sub();
1033 $lxdebug->enter_sub();
1035 $form->redirect($locale->text('Transaction deleted!'))
1036 if (AP->delete_transaction(\%myconfig, \%$form, $spool));
1037 $form->error($locale->text('Cannot delete transaction!'));
1039 $lxdebug->leave_sub();
1043 $lxdebug->enter_sub();
1045 # setup vendor selection
1046 $form->all_vc(\%myconfig, "vendor", "AP");
1048 if (@{ $form->{all_vendor} }) {
1049 map { $vendor .= "<option>$_->{name}--$_->{id}\n" }
1050 @{ $form->{all_vendor} };
1051 $vendor = qq|<select name=vendor><option>\n$vendor\n</select>|;
1053 $vendor = qq|<input name=vendor size=35>|;
1057 if (@{ $form->{all_departments} }) {
1058 $form->{selectdepartment} = "<option>\n";
1061 $form->{selectdepartment} .=
1062 "<option>$_->{description}--$_->{id}\n"
1063 } (@{ $form->{all_departments} });
1068 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1069 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1071 | if $form->{selectdepartment};
1073 $form->{title} = $locale->text('AP Transactions');
1075 # use JavaScript Calendar or not
1076 $form->{jsscript} = $jscalendar;
1078 if ($form->{jsscript}) {
1080 # with JavaScript Calendar
1082 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1083 <input type=button name=transdatefrom id="trigger1" value=|
1084 . $locale->text('button') . qq|></td>
1087 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1088 <input type=button name=transdateto name=transdateto id="trigger2" value=|
1089 . $locale->text('button') . qq|></td>
1094 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
1095 "transdateto", "BL", "trigger2");
1098 # without JavaScript Calendar
1100 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1102 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1105 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1110 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1111 push(@values, $item->{"id"});
1112 $labels{$item->{"id"}} = $item->{"projectnumber"};
1115 NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1116 '-labels' => \%labels));
1123 <form method=post action=$form->{script}>
1127 <th class=listtop>$form->{title}</th>
1129 <tr height="5"></tr>
1134 <th align=right>| . $locale->text('Vendor') . qq|</th>
1135 <td colspan=3>$vendor</td>
1139 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
1140 <td colspan=3><input name=invnumber size=20></td>
1143 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
1144 <td colspan=3><input name=ordnumber size=20></td>
1147 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1148 <td colspan=3><input name=notes size=40></td>
1151 <th align="right">| . $locale->text("Project Number") . qq|</th>
1152 <td colspan="3">$projectnumber</td>
1155 <th align=right nowrap>| . $locale->text('From') . qq|</th>
1157 <th align=right>| . $locale->text('Bis') . qq|</th>
1160 <input type=hidden name=sort value=transdate>
1168 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
1172 <td align=right><input name=open class=checkbox type=checkbox value=Y checked></td>
1173 <td nowrap>| . $locale->text('Open') . qq|</td>
1174 <td align=right><input name=closed class=checkbox type=checkbox value=Y></td>
1175 <td nowrap>| . $locale->text('Closed') . qq|</td>
1178 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
1179 <td nowrap>| . $locale->text('ID') . qq|</td>
1180 <td align=right><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
1181 <td nowrap>| . $locale->text('Invoice Number') . qq|</td>
1182 <td align=right><input name="l_ordnumber" class=checkbox type=checkbox value=Y></td>
1183 <td nowrap>| . $locale->text('Order Number') . qq|</td>
1186 <td align=right><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
1187 <td nowrap>| . $locale->text('Vendor') . qq|</td>
1188 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
1189 <td nowrap>| . $locale->text('Invoice Date') . qq|</td>
1190 <td align=right><input name="l_netamount" class=checkbox type=checkbox value=Y></td>
1191 <td nowrap>| . $locale->text('Amount') . qq|</td>
1194 <td align=right><input name="l_tax" class=checkbox type=checkbox value=Y></td>
1195 <td nowrap>| . $locale->text('Tax') . qq|</td>
1196 <td align=right><input name="l_amount" class=checkbox type=checkbox value=Y checked></td>
1197 <td nowrap>| . $locale->text('Total') . qq|</td>
1198 <td align=right><input name="l_datepaid" class=checkbox type=checkbox value=Y></td>
1199 <td nowrap>| . $locale->text('Date Paid') . qq|</td>
1202 <td align=right><input name="l_paid" class=checkbox type=checkbox value=Y checked></td>
1203 <td nowrap>| . $locale->text('Paid') . qq|</td>
1204 <td align=right><input name="l_duedate" class=checkbox type=checkbox value=Y></td>
1205 <td nowrap>| . $locale->text('Due Date') . qq|</td>
1206 <td align=right><input name="l_due" class=checkbox type=checkbox value=Y></td>
1207 <td nowrap>| . $locale->text('Amount Due') . qq|</td>
1210 <td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
1211 <td nowrap>| . $locale->text('Notes') . qq|</td>
1212 <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
1213 <td nowrap>| . $locale->text('Employee') . qq|</td>
1216 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1217 <td nowrap>| . $locale->text('Subtotal') . qq|</td>
1218 <td align=right><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y></td>
1219 <td nowrap>| . $locale->text('Project Number') . qq|</td>
1228 <td><hr size=3 noshade></td>
1235 <input type=hidden name=nextsub value=$form->{nextsub}>
1236 <input type=hidden name=path value=$form->{path}>
1237 <input type=hidden name=login value=$form->{login}>
1238 <input type=hidden name=password value=$form->{password}>
1240 <input class=submit type=submit name=action value="|
1241 . $locale->text('Continue') . qq|">
1248 $lxdebug->leave_sub();
1251 sub ap_transactions {
1252 $lxdebug->enter_sub();
1254 $form->{vendor} = $form->unescape($form->{vendor});
1255 ($form->{vendor}, $form->{vendor_id}) = split(/--/, $form->{vendor});
1257 AP->ap_transactions(\%myconfig, \%$form);
1260 "$form->{script}?action=ap_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1263 if ($form->{vendor}) {
1264 $callback .= "&vendor=" . $form->escape($form->{vendor}, 1);
1265 $href .= "&vendor=" . $form->escape($form->{vendor});
1266 $option .= $locale->text('Vendor') . " : $form->{vendor}";
1268 if ($form->{department}) {
1269 $callback .= "&department=" . $form->escape($form->{department}, 1);
1270 $href .= "&department=" . $form->escape($form->{department});
1271 ($department) = split /--/, $form->{department};
1272 $option .= "\n<br>" if ($option);
1273 $option .= $locale->text('Department') . " : $department";
1275 if ($form->{invnumber}) {
1276 $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
1277 $href .= "&invnumber=" . $form->escape($form->{invnumber});
1278 $option .= "\n<br>" if ($option);
1279 $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
1281 if ($form->{ordnumber}) {
1282 $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
1283 $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
1284 $option .= "\n<br>" if ($option);
1285 $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
1287 if ($form->{notes}) {
1288 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
1289 $href .= "¬es=" . $form->escape($form->{notes});
1290 $option .= "\n<br>" if $option;
1291 $option .= $locale->text('Notes') . " : $form->{notes}";
1294 if ($form->{transdatefrom}) {
1295 $callback .= "&transdatefrom=$form->{transdatefrom}";
1296 $href .= "&transdatefrom=$form->{transdatefrom}";
1297 $option .= "\n<br>" if ($option);
1299 $locale->text('From') . " "
1300 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1302 if ($form->{transdateto}) {
1303 $callback .= "&transdateto=$form->{transdateto}";
1304 $href .= "&transdateto=$form->{transdateto}";
1305 $option .= "\n<br>" if ($option);
1307 $locale->text('Bis') . " "
1308 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1310 if ($form->{open}) {
1311 $callback .= "&open=$form->{open}";
1312 $href .= "&open=$form->{open}";
1313 $option .= "\n<br>" if ($option);
1314 $option .= $locale->text('Open');
1316 if ($form->{closed}) {
1317 $callback .= "&closed=$form->{closed}";
1318 $href .= "&closed=$form->{closed}";
1319 $option .= "\n<br>" if ($option);
1320 $option .= $locale->text('Closed');
1322 if ($form->{globalproject_id}) {
1323 $callback .= "&globalproject_id=" . E($form->{globalproject_id});
1324 $href .= "&globalproject_id=" . E($form->{globalproject_id});
1328 qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid
1329 due duedate notes employee globalprojectnumber);
1331 foreach $item (@columns) {
1332 if ($form->{"l_$item"} eq "Y") {
1333 push @column_index, $item;
1335 # add column to href and callback
1336 $callback .= "&l_$item=Y";
1337 $href .= "&l_$item=Y";
1341 if ($form->{l_subtotal} eq 'Y') {
1342 $callback .= "&l_subtotal=Y";
1343 $href .= "&l_subtotal=Y";
1346 $column_header{id} =
1347 qq|<th><a class=listheading href=$href&sort=id>|
1348 . $locale->text('ID')
1350 $column_header{transdate} =
1351 qq|<th><a class=listheading href=$href&sort=transdate>|
1352 . $locale->text('Date')
1354 $column_header{duedate} =
1355 qq|<th><a class=listheading href=$href&sort=duedate>|
1356 . $locale->text('Due Date')
1358 $column_header{due} =
1359 qq|<th class=listheading>| . $locale->text('Amount Due') . qq|</th>|;
1360 $column_header{invnumber} =
1361 qq|<th><a class=listheading href=$href&sort=invnumber>|
1362 . $locale->text('Invoice')
1364 $column_header{ordnumber} =
1365 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1366 . $locale->text('Order')
1368 $column_header{name} =
1369 qq|<th><a class=listheading href=$href&sort=name>|
1370 . $locale->text('Vendor')
1372 $column_header{netamount} =
1373 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1374 $column_header{tax} =
1375 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1376 $column_header{amount} =
1377 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1378 $column_header{paid} =
1379 qq|<th class=listheading>| . $locale->text('Paid') . qq|</th>|;
1380 $column_header{datepaid} =
1381 qq|<th><a class=listheading href=$href&sort=datepaid>|
1382 . $locale->text('Date Paid')
1384 $column_header{notes} =
1385 qq|<th class=listheading>| . $locale->text('Notes') . qq|</th>|;
1386 $column_header{employee} =
1387 "<th><a class=listheading href=$href&sort=employee>"
1388 . $locale->text('Employee') . "</th>";
1389 $column_header{globalprojectnumber} =
1390 qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1392 $form->{title} = $locale->text('AP Transactions');
1401 <th class=listtop>$form->{title}</th>
1403 <tr height="5"></tr>
1410 <tr class=listheading>
1413 map { print "\n$column_header{$_}" } @column_index;
1419 # add sort and escape callback
1420 $form->{callback} = "$callback&sort=$form->{sort}";
1421 $callback = $form->escape($form->{callback});
1423 if (@{ $form->{AP} }) {
1424 $sameitem = $form->{AP}->[0]->{ $form->{sort} };
1427 # sums and tax on reports by Antonio Gallardo
1429 foreach $ap (@{ $form->{AP} }) {
1431 if ($form->{l_subtotal} eq 'Y') {
1432 if ($sameitem ne $ap->{ $form->{sort} }) {
1434 $sameitem = $ap->{ $form->{sort} };
1438 $column_data{netamount} =
1440 . $form->format_amount(\%myconfig, $ap->{netamount}, 2, " ")
1442 $column_data{tax} = "<td align=right>"
1443 . $form->format_amount(\%myconfig, $ap->{amount} - $ap->{netamount},
1446 $column_data{amount} =
1448 . $form->format_amount(\%myconfig, $ap->{amount}, 2, " ") . "</td>";
1449 $column_data{paid} =
1451 . $form->format_amount(\%myconfig, $ap->{paid}, 2, " ") . "</td>";
1452 $column_data{due} = "<td align=right>"
1453 . $form->format_amount(\%myconfig, $ap->{amount} - $ap->{paid},
1457 $totalnetamount += $ap->{netamount};
1458 $totalamount += $ap->{amount};
1459 $totalpaid += $ap->{paid};
1460 $totaldue += ($ap->{amount} - $ap->{paid});
1462 $subtotalnetamount += $ap->{netamount};
1463 $subtotalamount += $ap->{amount};
1464 $subtotalpaid += $ap->{paid};
1465 $subtotaldue += ($ap->{amount} - $ap->{paid});
1467 $column_data{transdate} = "<td>$ap->{transdate} </td>";
1468 $column_data{duedate} = "<td>$ap->{duedate} </td>";
1469 $column_data{datepaid} = "<td>$ap->{datepaid} </td>";
1471 $module = ($ap->{invoice}) ? "ir.pl" : $form->{script};
1473 $column_data{invnumber} =
1474 qq|<td><a href="$module?action=edit&path=$form->{path}&id=$ap->{id}&login=$form->{login}&password=$form->{password}&callback=$callback">$ap->{invnumber}</a></td>|;
1475 $column_data{id} = "<td>$ap->{id}</td>";
1476 $column_data{ordnumber} = "<td>$ap->{ordnumber} </td>";
1477 $column_data{name} = "<td>$ap->{name}</td>";
1478 $ap->{notes} =~ s/\r\n/<br>/g;
1479 $column_data{notes} = "<td>$ap->{notes} </td>";
1480 $column_data{employee} = "<td>$ap->{employee} </td>";
1481 $column_data{globalprojectnumber} =
1482 "<td>" . H($ap->{globalprojectnumber}) . "</td>";
1487 <tr class=listrow$i >
1490 map { print "\n$column_data{$_}" } @column_index;
1498 if ($form->{l_subtotal} eq 'Y') {
1504 <tr class=listtotal>
1507 map { $column_data{$_} = "<td> </td>" } @column_index;
1509 $column_data{netamount} =
1510 "<th class=listtotal align=right>"
1511 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1512 $column_data{tax} = "<th class=listtotal align=right>"
1513 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1516 $column_data{amount} =
1517 "<th class=listtotal align=right>"
1518 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1519 $column_data{paid} =
1520 "<th class=listtotal align=right>"
1521 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
1523 "<th class=listtotal align=right>"
1524 . $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>";
1526 map { print "$column_data{$_}\n" } @column_index;
1534 <td><hr size=3 noshade></td>
1539 <form method=post action=$form->{script}>
1541 <input name=callback type=hidden value="$form->{callback}">
1543 <input type=hidden name=path value=$form->{path}>
1544 <input type=hidden name=login value=$form->{login}>
1545 <input type=hidden name=password value=$form->{password}>
1547 <input class=submit type=submit name=action value="|
1548 . $locale->text('AP Transaction') . qq|">
1550 <input class=submit type=submit name=action value="|
1551 . $locale->text('Vendor Invoice') . qq|">
1559 $lxdebug->leave_sub();
1563 $lxdebug->enter_sub();
1565 map { $column_data{$_} = "<td> </td>" } @column_index;
1567 $column_data{netamount} =
1568 "<th class=listsubtotal align=right>"
1569 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1571 $column_data{tax} = "<th class=listsubtotal align=right>"
1572 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1575 $column_data{amount} =
1576 "<th class=listsubtotal align=right>"
1577 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1578 $column_data{paid} =
1579 "<th class=listsubtotal align=right>"
1580 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
1582 "<th class=listsubtotal align=right>"
1583 . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
1585 $subtotalnetamount = 0;
1586 $subtotalamount = 0;
1590 print "<tr class=listsubtotal>";
1592 map { print "\n$column_data{$_}" } @column_index;
1598 $lxdebug->leave_sub();