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 my @old_project_ids = ();
401 map({ push(@old_project_ids, $form->{"project_id_$_"})
402 if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
404 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
406 "old_id" => \@old_project_ids });
408 my %project_labels = ();
409 my @project_values = ("");
410 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
411 push(@project_values, $item->{"id"});
412 $project_labels{$item->{"id"}} = $item->{"projectnumber"};
415 # use JavaScript Calendar or not
416 $form->{jsscript} = $jscalendar;
418 if ($form->{jsscript}) {
420 # with JavaScript Calendar
422 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}> $readonly</td>
423 <td><input type=button name=transdate id="trigger1" value=|
424 . $locale->text('button') . qq|></td>
427 <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}> $readonly</td>
428 <td><input type=button name=duedate id="trigger2" value=|
429 . $locale->text('button') . qq|></td></td>
434 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
435 "duedate", "BL", "trigger2");
438 # without JavaScript Calendar
440 qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}> $readonly</td>|;
442 qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}> $readonly</td>|;
450 <form method=post action=$form->{script}>
452 <input type=hidden name=id value=$form->{id}>
453 <input type=hidden name=sort value=$form->{sort}>
454 <input type=hidden name=closedto value=$form->{closedto}>
455 <input type=hidden name=locked value=$form->{locked}>
456 <input type=hidden name=title value="$title">
460 <th class=listtop>$form->{title}</th>
470 <th align=right nowrap>| . $locale->text('Vendor') . qq|</th>
471 <td colspan=3>$vendor</td>
472 <input type=hidden name=selectvendor value="$form->{selectvendor}">
473 <input type=hidden name=oldvendor value="$form->{oldvendor}">
474 <input type=hidden name=vendor_id value="$form->{vendor_id}">
475 <input type=hidden name=terms value=$form->{terms}>
482 <th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th>
483 <td>$form->{creditlimit}</td>
484 <th align=left nowrap>| . $locale->text('Remaining') . qq|</th>
485 <td class="plus$n">$form->{creditremaining}</td>
486 <input type=hidden name=creditlimit value=$form->{creditlimit}>
487 <input type=hidden name=creditremaining value=$form->{creditremaining}>
492 <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
493 <td><select name=currency>$form->{selectcurrency}</select></td>
494 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
495 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
496 <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
497 <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
507 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
508 <td><input name=invnumber size=11 value="$form->{invnumber}" $readonly></td>
511 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
512 <td><input name=ordnumber size=11 value="$form->{ordnumber}" $readonly></td>
515 <th align=right nowrap>| . $locale->text('Invoice Date') . qq|</th>
519 <th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
532 <input type=hidden name=selectAP_amount value="$form->{selectAP_amount}">
533 <input type=hidden name=AP_amount value="$form->{AP_amount}">
534 <input type=hidden name=taxchart value="$form->{taxchart}">
535 <input type=hidden name=rowcount value=$form->{rowcount}>
539 <tr class=listheading>
540 <th class=listheading style="width:15%">|
541 . $locale->text('Account') . qq|</th>
542 <th class=listheading style="width:10%">|
543 . $locale->text('Amount') . qq|</th>
544 <th class=listheading style="width:10%">|
545 . $locale->text('Tax') . qq|</th>
546 <th class=listheading style="width:5%">|
547 . $locale->text('Korrektur') . qq|</th>
548 <th class=listheading style="width:10%">|
549 . $locale->text('Taxkey') . qq|</th>
550 <th class=listheading style="width:10%">|
551 . $locale->text('Project') . qq|</th>
555 $amount = $locale->text('Amount');
556 $project = $locale->text('Project');
558 for $i (1 .. $form->{rowcount}) {
561 $form->{"amount_$i"} =
562 $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
563 $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
564 $selectAP_amount = $selectAP_amount_unquoted;
565 $re_amount = quotemeta($form->{"AP_amount_$i"});
567 s/option value=\"${re_amount}\"/option value=\"$form->{"AP_amount_$i"}\" selected/;
569 $tax_selected = $form->{"taxchart_$i"};
570 $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
572 qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
574 my $korrektur = $form->{"korrektur_$i"} ? 'checked' : '';
577 NTI($cgi->popup_menu('-name' => "project_id_$i",
578 '-values' => \@project_values,
579 '-labels' => \%project_labels,
580 '-default' => $form->{"project_id_$i"} ));
584 <td width=50%><select name="AP_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAP_amount</select></td>
585 <td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
586 <td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
587 <td><input type="checkbox" name="korrektur_$i" value="1" "$korrektur"></td>
589 <td>$projectnumber</td>
597 ($form->{taxincluded})
598 ? $locale->text('Tax Included')
599 : $locale->text('Tax');
601 $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
610 <td><select name=APselected>$form->{selectAP}</select></td>
611 <input type=hidden name=AP value="$form->{AP}">
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 class=listheading colspan=6>| . $locale->text('Payments') . qq|</th>
644 if ($form->{currency} eq $form->{defaultcurrency}) {
645 @column_index = qw(datepaid source memo paid AP_paid paid_project_id);
647 @column_index = qw(datepaid source memo paid exchangerate AP_paid paid_project_id);
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{AP_paid} = "<th>" . $locale->text('Account') . "</th>";
654 $column_data{source} = "<th>" . $locale->text('Source') . "</th>";
655 $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
656 $column_data{paid_project_id} = "<th>" . $locale->text('Project Number') . "</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->{"selectAP_paid_$i"} = $form->{selectAP_paid};
674 $form->{"selectAP_paid_$i"} =~
675 s/option value=\"$form->{"AP_paid_$i"}\">/option value=\"$form->{"AP_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"}>
700 $column_data{"paid_$i"} =
701 qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
702 $column_data{"AP_paid_$i"} =
703 qq|<td align=center><select name="AP_paid_$i">$form->{"selectAP_paid_$i"}</select></td>|;
704 $column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
705 $column_data{"datepaid_$i"} =
706 qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value=$form->{"datepaid_$i"}>
707 <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
708 $column_data{"source_$i"} =
709 qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
710 $column_data{"memo_$i"} =
711 qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
712 $column_data{"paid_project_id_$i"} =
714 . NTI($cgi->popup_menu('-name' => "paid_project_id_$i",
715 '-values' => \@project_values,
716 '-labels' => \%project_labels,
717 '-default' => $form->{"paid_project_id_$i"} ))
720 map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
725 push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
727 map { $form->{$_} =~ s/\"/"/g } qw(selectAP_paid);
728 print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
730 <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
731 <input type=hidden name=selectAP_paid value="$form->{selectAP_paid}">
737 <td><hr size=3 noshade></td>
742 $lxdebug->leave_sub();
746 $lxdebug->enter_sub();
750 <input name=callback type=hidden value="$form->{callback}">
751 <input name="gldate" type="hidden" value="| . Q($form->{gldate}) . qq|">
753 <input type=hidden name=path value=$form->{path}>
754 <input type=hidden name=login value=$form->{login}>
755 <input type=hidden name=password value=$form->{password}>
760 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
761 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
763 print qq|<input class=submit type=submit name=action value="|
764 . $locale->text('Update') . qq|">|;
768 # print qq|<input class=submit type=submit name=action value="|.$locale->text('Update').qq|">
770 if ($form->{radier}) {
772 <input class=submit type=submit name=action value="|
773 . $locale->text('Post') . qq|">
774 <input class=submit type=submit name=action value="|
775 . $locale->text('Delete') . qq|">
780 <input class=submit type=submit name=action value="|
781 . $locale->text('Use As Template') . qq|">
782 <input class=submit type=submit name=action value="|
783 . $locale->text('Post Payment') . qq|">
785 } elsif (($transdate > $closedto) && !$form->{id}) {
787 <input class=submit type=submit name=action value="|
788 . $locale->text('Post') . qq|">|;
798 $lxdebug->leave_sub();
802 $lxdebug->enter_sub();
810 $form->{invtotal} = 0;
812 # $form->{selectAP_amount} = $form->{AP_amount};
813 # $form->{selectAP_amount} =~
814 # s/value=\"$form->{AP_amountselected}\"/value=\"$form->{AP_amountselected}\" selected/;
816 ($AP_amountaccno, $AP_amounttaxkey) =
817 split(/--/, $form->{AP_amountselected});
818 $form->{selecttaxchart} = $form->{taxchart};
819 $form->{selecttaxchart} =~
820 s/value=\"$AP_amounttaxkey--([^\"]*)\"/value=\"$AP_amounttaxkey--$1\" selected/;
824 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
825 qw(exchangerate creditlimit creditremaining);
827 @flds = qw(amount AP_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;
855 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
857 map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount});
859 $form->{exchangerate} = $exchangerate
863 $form->check_exchangerate(
864 \%myconfig, $form->{currency}, $form->{transdate}, 'sell'
867 $form->{invdate} = $form->{transdate};
868 $save_AP = $form->{AP};
870 $form->{AP} = $save_AP;
872 $form->{rowcount} = $count + 1;
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"}, 'sell'
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();
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->{AP}) = split /--/, $form->{AP};
929 ($form->{AP_paid}) = split /--/, $form->{AP_paid};
930 $form->redirect($locale->text(' Payment posted!'))
931 if (AP->post_payment(\%myconfig, \%$form));
932 $form->error($locale->text('Cannot post payment!'));
935 $lxdebug->leave_sub();
940 $lxdebug->enter_sub();
942 # check if there is a vendor, invoice and due date
943 $form->isblank("transdate", $locale->text("Invoice Date missing!"));
944 $form->isblank("duedate", $locale->text("Due Date missing!"));
945 $form->isblank("vendor", $locale->text('Vendor missing!'));
947 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
948 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
950 $form->error($locale->text('Cannot post transaction for a closed period!'))
951 if ($transdate <= $closedto);
953 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
954 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!'));
976 # if old vendor ne vendor redo form
977 ($vendor) = split /--/, $form->{vendor};
978 if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") {
982 ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected};
983 ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
984 ($payablesaccno, $payablestaxkey) = split /--/, $form->{APselected};
985 $form->{AP}{amount_1} = $debitaccno;
986 $form->{AP}{payables} = $payablesaccno;
987 $form->{taxkey} = $taxkey;
989 $form->{id} = 0 if $form->{postasnew};
991 $form->redirect($locale->text('Transaction posted!'))
992 if (AP->post_transaction(\%myconfig, \%$form));
993 $form->error($locale->text('Cannot post transaction!'));
995 $lxdebug->leave_sub();
999 $lxdebug->enter_sub();
1001 $form->{postasnew} = 1;
1004 $lxdebug->leave_sub();
1007 sub use_as_template {
1008 $lxdebug->enter_sub();
1010 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);
1011 $form->{paidaccounts} = 1;
1012 $form->{rowcount}--;
1013 $form->{invdate} = $form->current_date(\%myconfig);
1016 $lxdebug->leave_sub();
1020 $lxdebug->enter_sub();
1022 $form->{title} = $locale->text('Confirm!');
1026 delete $form->{header};
1031 <form method=post action=$form->{script}>
1034 foreach $key (keys %$form) {
1035 $form->{$key} =~ s/\"/"/g;
1036 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1040 <h2 class=confirm>$form->{title}</h2>
1043 . $locale->text('Are you sure you want to delete Transaction')
1044 . qq| $form->{invnumber}</h4>
1046 <input name=action class=submit type=submit value="|
1047 . $locale->text('Yes') . qq|">
1054 $lxdebug->leave_sub();
1058 $lxdebug->enter_sub();
1060 $form->redirect($locale->text('Transaction deleted!'))
1061 if (AP->delete_transaction(\%myconfig, \%$form, $spool));
1062 $form->error($locale->text('Cannot delete transaction!'));
1064 $lxdebug->leave_sub();
1068 $lxdebug->enter_sub();
1070 # setup vendor selection
1071 $form->all_vc(\%myconfig, "vendor", "AP");
1073 if (@{ $form->{all_vendor} }) {
1074 map { $vendor .= "<option>$_->{name}--$_->{id}\n" }
1075 @{ $form->{all_vendor} };
1076 $vendor = qq|<select name=vendor><option>\n$vendor\n</select>|;
1078 $vendor = qq|<input name=vendor size=35>|;
1082 if (@{ $form->{all_departments} }) {
1083 $form->{selectdepartment} = "<option>\n";
1086 $form->{selectdepartment} .=
1087 "<option>$_->{description}--$_->{id}\n"
1088 } (@{ $form->{all_departments} });
1093 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1094 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1096 | if $form->{selectdepartment};
1098 $form->{title} = $locale->text('AP Transactions');
1100 # use JavaScript Calendar or not
1101 $form->{jsscript} = $jscalendar;
1103 if ($form->{jsscript}) {
1105 # with JavaScript Calendar
1107 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1108 <input type=button name=transdatefrom id="trigger1" value=|
1109 . $locale->text('button') . qq|></td>
1112 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1113 <input type=button name=transdateto name=transdateto id="trigger2" value=|
1114 . $locale->text('button') . qq|></td>
1119 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
1120 "transdateto", "BL", "trigger2");
1123 # without JavaScript Calendar
1125 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1127 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1130 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1135 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1136 push(@values, $item->{"id"});
1137 $labels{$item->{"id"}} = $item->{"projectnumber"};
1140 NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1141 '-labels' => \%labels));
1148 <form method=post action=$form->{script}>
1152 <th class=listtop>$form->{title}</th>
1154 <tr height="5"></tr>
1159 <th align=right>| . $locale->text('Vendor') . qq|</th>
1160 <td colspan=3>$vendor</td>
1164 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
1165 <td colspan=3><input name=invnumber size=20></td>
1168 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
1169 <td colspan=3><input name=ordnumber size=20></td>
1172 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1173 <td colspan=3><input name=notes size=40></td>
1176 <th align="right">| . $locale->text("Project Number") . qq|</th>
1177 <td colspan="3">$projectnumber</td>
1180 <th align=right nowrap>| . $locale->text('From') . qq|</th>
1182 <th align=right>| . $locale->text('Bis') . qq|</th>
1185 <input type=hidden name=sort value=transdate>
1193 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
1197 <td align=right><input name=open class=checkbox type=checkbox value=Y checked></td>
1198 <td nowrap>| . $locale->text('Open') . qq|</td>
1199 <td align=right><input name=closed class=checkbox type=checkbox value=Y></td>
1200 <td nowrap>| . $locale->text('Closed') . qq|</td>
1203 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
1204 <td nowrap>| . $locale->text('ID') . qq|</td>
1205 <td align=right><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
1206 <td nowrap>| . $locale->text('Invoice Number') . qq|</td>
1207 <td align=right><input name="l_ordnumber" class=checkbox type=checkbox value=Y></td>
1208 <td nowrap>| . $locale->text('Order Number') . qq|</td>
1211 <td align=right><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
1212 <td nowrap>| . $locale->text('Vendor') . qq|</td>
1213 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
1214 <td nowrap>| . $locale->text('Invoice Date') . qq|</td>
1215 <td align=right><input name="l_netamount" class=checkbox type=checkbox value=Y></td>
1216 <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>
1223 <td align=right><input name="l_datepaid" class=checkbox type=checkbox value=Y></td>
1224 <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('Employee') . qq|</td>
1241 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1242 <td nowrap>| . $locale->text('Subtotal') . qq|</td>
1243 <td align=right><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y></td>
1244 <td nowrap>| . $locale->text('Project Number') . qq|</td>
1253 <td><hr size=3 noshade></td>
1260 <input type=hidden name=nextsub value=$form->{nextsub}>
1261 <input type=hidden name=path value=$form->{path}>
1262 <input type=hidden name=login value=$form->{login}>
1263 <input type=hidden name=password value=$form->{password}>
1265 <input class=submit type=submit name=action value="|
1266 . $locale->text('Continue') . qq|">
1273 $lxdebug->leave_sub();
1276 sub ap_transactions {
1277 $lxdebug->enter_sub();
1279 $form->{vendor} = $form->unescape($form->{vendor});
1280 ($form->{vendor}, $form->{vendor_id}) = split(/--/, $form->{vendor});
1282 AP->ap_transactions(\%myconfig, \%$form);
1285 "$form->{script}?action=ap_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1288 if ($form->{vendor}) {
1289 $callback .= "&vendor=" . $form->escape($form->{vendor}, 1);
1290 $href .= "&vendor=" . $form->escape($form->{vendor});
1291 $option .= $locale->text('Vendor') . " : $form->{vendor}";
1293 if ($form->{department}) {
1294 $callback .= "&department=" . $form->escape($form->{department}, 1);
1295 $href .= "&department=" . $form->escape($form->{department});
1296 ($department) = split /--/, $form->{department};
1297 $option .= "\n<br>" if ($option);
1298 $option .= $locale->text('Department') . " : $department";
1300 if ($form->{invnumber}) {
1301 $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
1302 $href .= "&invnumber=" . $form->escape($form->{invnumber});
1303 $option .= "\n<br>" if ($option);
1304 $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
1306 if ($form->{ordnumber}) {
1307 $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
1308 $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
1309 $option .= "\n<br>" if ($option);
1310 $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
1312 if ($form->{notes}) {
1313 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
1314 $href .= "¬es=" . $form->escape($form->{notes});
1315 $option .= "\n<br>" if $option;
1316 $option .= $locale->text('Notes') . " : $form->{notes}";
1319 if ($form->{transdatefrom}) {
1320 $callback .= "&transdatefrom=$form->{transdatefrom}";
1321 $href .= "&transdatefrom=$form->{transdatefrom}";
1322 $option .= "\n<br>" if ($option);
1324 $locale->text('From') . " "
1325 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1327 if ($form->{transdateto}) {
1328 $callback .= "&transdateto=$form->{transdateto}";
1329 $href .= "&transdateto=$form->{transdateto}";
1330 $option .= "\n<br>" if ($option);
1332 $locale->text('Bis') . " "
1333 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1335 if ($form->{open}) {
1336 $callback .= "&open=$form->{open}";
1337 $href .= "&open=$form->{open}";
1338 $option .= "\n<br>" if ($option);
1339 $option .= $locale->text('Open');
1341 if ($form->{closed}) {
1342 $callback .= "&closed=$form->{closed}";
1343 $href .= "&closed=$form->{closed}";
1344 $option .= "\n<br>" if ($option);
1345 $option .= $locale->text('Closed');
1347 if ($form->{globalproject_id}) {
1348 $callback .= "&globalproject_id=" . E($form->{globalproject_id});
1349 $href .= "&globalproject_id=" . E($form->{globalproject_id});
1353 qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid
1354 due duedate notes employee globalprojectnumber);
1356 foreach $item (@columns) {
1357 if ($form->{"l_$item"} eq "Y") {
1358 push @column_index, $item;
1360 # add column to href and callback
1361 $callback .= "&l_$item=Y";
1362 $href .= "&l_$item=Y";
1366 if ($form->{l_subtotal} eq 'Y') {
1367 $callback .= "&l_subtotal=Y";
1368 $href .= "&l_subtotal=Y";
1371 $column_header{id} =
1372 qq|<th><a class=listheading href=$href&sort=id>|
1373 . $locale->text('ID')
1375 $column_header{transdate} =
1376 qq|<th><a class=listheading href=$href&sort=transdate>|
1377 . $locale->text('Date')
1379 $column_header{duedate} =
1380 qq|<th><a class=listheading href=$href&sort=duedate>|
1381 . $locale->text('Due Date')
1383 $column_header{due} =
1384 qq|<th class=listheading>| . $locale->text('Amount Due') . qq|</th>|;
1385 $column_header{invnumber} =
1386 qq|<th><a class=listheading href=$href&sort=invnumber>|
1387 . $locale->text('Invoice')
1389 $column_header{ordnumber} =
1390 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1391 . $locale->text('Order')
1393 $column_header{name} =
1394 qq|<th><a class=listheading href=$href&sort=name>|
1395 . $locale->text('Vendor')
1397 $column_header{netamount} =
1398 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1399 $column_header{tax} =
1400 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1401 $column_header{amount} =
1402 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1403 $column_header{paid} =
1404 qq|<th class=listheading>| . $locale->text('Paid') . qq|</th>|;
1405 $column_header{datepaid} =
1406 qq|<th><a class=listheading href=$href&sort=datepaid>|
1407 . $locale->text('Date Paid')
1409 $column_header{notes} =
1410 qq|<th class=listheading>| . $locale->text('Notes') . qq|</th>|;
1411 $column_header{employee} =
1412 "<th><a class=listheading href=$href&sort=employee>"
1413 . $locale->text('Employee') . "</th>";
1414 $column_header{globalprojectnumber} =
1415 qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1417 $form->{title} = $locale->text('AP Transactions');
1426 <th class=listtop>$form->{title}</th>
1428 <tr height="5"></tr>
1435 <tr class=listheading>
1438 map { print "\n$column_header{$_}" } @column_index;
1444 # add sort and escape callback
1445 $form->{callback} = "$callback&sort=$form->{sort}";
1446 $callback = $form->escape($form->{callback});
1448 if (@{ $form->{AP} }) {
1449 $sameitem = $form->{AP}->[0]->{ $form->{sort} };
1452 # sums and tax on reports by Antonio Gallardo
1454 foreach $ap (@{ $form->{AP} }) {
1456 if ($form->{l_subtotal} eq 'Y') {
1457 if ($sameitem ne $ap->{ $form->{sort} }) {
1459 $sameitem = $ap->{ $form->{sort} };
1463 $column_data{netamount} =
1465 . $form->format_amount(\%myconfig, $ap->{netamount}, 2, " ")
1467 $column_data{tax} = "<td align=right>"
1468 . $form->format_amount(\%myconfig, $ap->{amount} - $ap->{netamount},
1471 $column_data{amount} =
1473 . $form->format_amount(\%myconfig, $ap->{amount}, 2, " ") . "</td>";
1474 $column_data{paid} =
1476 . $form->format_amount(\%myconfig, $ap->{paid}, 2, " ") . "</td>";
1477 $column_data{due} = "<td align=right>"
1478 . $form->format_amount(\%myconfig, $ap->{amount} - $ap->{paid},
1482 $totalnetamount += $ap->{netamount};
1483 $totalamount += $ap->{amount};
1484 $totalpaid += $ap->{paid};
1485 $totaldue += ($ap->{amount} - $ap->{paid});
1487 $subtotalnetamount += $ap->{netamount};
1488 $subtotalamount += $ap->{amount};
1489 $subtotalpaid += $ap->{paid};
1490 $subtotaldue += ($ap->{amount} - $ap->{paid});
1492 $column_data{transdate} = "<td>$ap->{transdate} </td>";
1493 $column_data{duedate} = "<td>$ap->{duedate} </td>";
1494 $column_data{datepaid} = "<td>$ap->{datepaid} </td>";
1496 $module = ($ap->{invoice}) ? "ir.pl" : $form->{script};
1498 $column_data{invnumber} =
1499 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>|;
1500 $column_data{id} = "<td>$ap->{id}</td>";
1501 $column_data{ordnumber} = "<td>$ap->{ordnumber} </td>";
1502 $column_data{name} = "<td>$ap->{name}</td>";
1503 $ap->{notes} =~ s/\r\n/<br>/g;
1504 $column_data{notes} = "<td>$ap->{notes} </td>";
1505 $column_data{employee} = "<td>$ap->{employee} </td>";
1506 $column_data{globalprojectnumber} =
1507 "<td>" . H($ap->{globalprojectnumber}) . "</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 "$column_data{$_}\n" } @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('AP Transaction') . qq|">
1575 <input class=submit type=submit name=action value="|
1576 . $locale->text('Vendor Invoice') . qq|">
1584 $lxdebug->leave_sub();
1588 $lxdebug->enter_sub();
1590 map { $column_data{$_} = "<td> </td>" } @column_index;
1592 $column_data{netamount} =
1593 "<th class=listsubtotal align=right>"
1594 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1596 $column_data{tax} = "<th class=listsubtotal align=right>"
1597 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1600 $column_data{amount} =
1601 "<th class=listsubtotal align=right>"
1602 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1603 $column_data{paid} =
1604 "<th class=listsubtotal align=right>"
1605 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
1607 "<th class=listsubtotal align=right>"
1608 . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
1610 $subtotalnetamount = 0;
1611 $subtotalamount = 0;
1615 print "<tr class=listsubtotal>";
1617 map { print "\n$column_data{$_}" } @column_index;
1623 $lxdebug->leave_sub();