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->{"paid_project_id_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{project_id};
197 $form->{paidaccounts}++;
203 if (($key eq "AP_tax") || ($key eq "AR_tax")) {
204 $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
205 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
206 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
208 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
211 if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
213 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
215 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
218 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
220 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
222 $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
223 $form->{"tax_$index"} =
224 $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
225 $totaltax += $form->{"tax_$index"};
229 $form->{"${akey}_$k"} =
231 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
233 if ($akey eq 'amount') {
235 $form->{"${akey}_$i"} *= -1;
236 $totalamount += $form->{"${akey}_$i"};
237 $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate};
238 $form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"} =
239 "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}";
240 $form->{"project_id_$k"} =
241 "$form->{acc_trans}{$key}->[$i-1]->{project_id}";
243 $form->{"${key}_$k"} =
244 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
245 my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description});
246 $form->{"select${key}"} =~
247 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)\">$form->{acc_trans}{$key}->[$i-1]->{accno}--${q_description}<\/option>\n/;
248 $form->{"${key}_$k"} = $1;
249 if ($akey eq 'amount') {
250 $form->{"taxchart_$k"} = $form->{taxchart};
251 $form->{"taxchart_$k"} =~
252 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{id}--[^\"]*)/;
253 $form->{"taxchart_$k"} = $1;
260 $form->{taxincluded} = $taxincluded if ($form->{id});
261 $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
263 if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
265 # add tax to amounts and invtotal
266 for $i (1 .. $form->{rowcount}) {
268 ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
269 $tax = $form->round_amount($taxamount, 2);
270 $diff += ($taxamount - $tax);
271 $form->{"amount_$i"} += $form->{"tax_$i"};
273 $form->{amount_1} += $form->round_amount($diff, 2);
276 $taxamount = $form->round_amount($taxamount, 2);
278 $form->{invtotal} = $totalamount + $totaltax;
281 ($form->datetonum($form->{transdate}, \%myconfig) <=
282 $form->datetonum($form->{closedto}, \%myconfig));
284 $form->{"APselected"} = $form->{"AP_1"};
286 $lxdebug->leave_sub();
290 $lxdebug->enter_sub();
292 $title = $form->{title};
293 $form->{title} = $locale->text("$title Accounts Payables Transaction");
295 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
297 # type=submit $locale->text('Add Accounts Payables Transaction')
298 # type=submit $locale->text('Edit Accounts Payables Transaction')
300 $form->{javascript} = qq|<script type="text/javascript">
302 function setTaxkey(accno, row) {
303 var taxkey = accno.options[accno.selectedIndex].value;
304 var reg = /--([0-9]*)/;
305 var found = reg.exec(taxkey);
306 var index = found[1];
307 index = parseInt(index);
308 var tax = 'taxchart_' + row;
309 for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
310 var reg2 = new RegExp("^"+ index, "");
311 if (reg2.exec(document.getElementById(tax).options[i].value)) {
312 document.getElementById(tax).options[i].selected = true;
320 # set option selected
321 foreach $item (qw(vendor currency department)) {
322 $form->{"select$item"} =~ s/ selected//;
323 $form->{"select$item"} =~
324 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
326 $readonly = ($form->{id}) ? "readonly" : "";
328 my $APselected_quoted = quotemeta($form->{"APselected"});
329 $form->{selectAP} = $form->{AP};
331 s/value=\"${APselected_quoted}\"/value=\"$form->{APselected}\" selected/;
334 ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
335 $readonly = ($form->{radier}) ? "" : $readonly;
336 $selectAP_amount_unquoted = $form->{selectAP_amount};
337 $taxchart = $form->{taxchart};
338 map { $form->{$_} =~ s/\"/"/g }
339 qw(AP_amount selectAP_amount AP taxchart);
342 $form->{exchangerate} =
343 $form->format_amount(\%myconfig, $form->{exchangerate});
345 $form->{creditlimit} =
346 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
347 $form->{creditremaining} =
348 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
351 <input type=hidden name=forex value=$form->{forex}>
353 if ($form->{currency} ne $form->{defaultcurrency}) {
354 if ($form->{forex}) {
357 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
358 <td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td>
363 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
364 <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
373 <td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
374 <th align=left nowrap>|
375 . $locale->text('Tax Included') . qq|</th>
379 if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) {
383 qq|<textarea name=notes rows=$rows cols=50 wrap=soft $readonly>$form->{notes}</textarea>|;
387 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
388 <td colspan=3><select name=department>$form->{selectdepartment}</select>
389 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
392 | if $form->{selectdepartment};
394 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
397 ($form->{selectvendor})
398 ? qq|<select name=vendor>$form->{selectvendor}</select>|
399 : qq|<input name=vendor value="$form->{vendor}" size=35>|;
401 my @old_project_ids = ();
402 map({ push(@old_project_ids, $form->{"project_id_$_"})
403 if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
405 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
407 "old_id" => \@old_project_ids });
409 my %project_labels = ();
410 my @project_values = ("");
411 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
412 push(@project_values, $item->{"id"});
413 $project_labels{$item->{"id"}} = $item->{"projectnumber"};
416 # use JavaScript Calendar or not
417 $form->{jsscript} = $jscalendar;
419 if ($form->{jsscript}) {
421 # with JavaScript Calendar
423 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}> $readonly</td>
424 <td><input type=button name=transdate id="trigger1" value=|
425 . $locale->text('button') . qq|></td>
428 <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}> $readonly</td>
429 <td><input type=button name=duedate id="trigger2" value=|
430 . $locale->text('button') . qq|></td></td>
435 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
436 "duedate", "BL", "trigger2");
439 # without JavaScript Calendar
441 qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}> $readonly</td>|;
443 qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}> $readonly</td>|;
451 <form method=post action=$form->{script}>
453 <input type=hidden name=id value=$form->{id}>
454 <input type=hidden name=sort value=$form->{sort}>
455 <input type=hidden name=closedto value=$form->{closedto}>
456 <input type=hidden name=locked value=$form->{locked}>
457 <input type=hidden name=title value="$title">
461 <th class=listtop>$form->{title}</th>
471 <th align=right nowrap>| . $locale->text('Vendor') . qq|</th>
472 <td colspan=3>$vendor</td>
473 <input type=hidden name=selectvendor value="$form->{selectvendor}">
474 <input type=hidden name=oldvendor value="$form->{oldvendor}">
475 <input type=hidden name=vendor_id value="$form->{vendor_id}">
476 <input type=hidden name=terms value=$form->{terms}>
483 <th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th>
484 <td>$form->{creditlimit}</td>
485 <th align=left nowrap>| . $locale->text('Remaining') . qq|</th>
486 <td class="plus$n">$form->{creditremaining}</td>
487 <input type=hidden name=creditlimit value=$form->{creditlimit}>
488 <input type=hidden name=creditremaining value=$form->{creditremaining}>
493 <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
494 <td><select name=currency>$form->{selectcurrency}</select></td>
495 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
496 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
497 <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
498 <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
508 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
509 <td><input name=invnumber size=11 value="$form->{invnumber}" $readonly></td>
512 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
513 <td><input name=ordnumber size=11 value="$form->{ordnumber}" $readonly></td>
516 <th align=right nowrap>| . $locale->text('Invoice Date') . qq|</th>
520 <th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
533 <input type=hidden name=selectAP_amount value="$form->{selectAP_amount}">
534 <input type=hidden name=AP_amount value="$form->{AP_amount}">
535 <input type=hidden name=taxchart value="$form->{taxchart}">
536 <input type=hidden name=rowcount value=$form->{rowcount}>
540 <tr class=listheading>
541 <th class=listheading style="width:15%">|
542 . $locale->text('Account') . qq|</th>
543 <th class=listheading style="width:10%">|
544 . $locale->text('Amount') . qq|</th>
545 <th class=listheading style="width:10%">|
546 . $locale->text('Tax') . qq|</th>
547 <th class=listheading style="width:5%">|
548 . $locale->text('Korrektur') . qq|</th>
549 <th class=listheading style="width:10%">|
550 . $locale->text('Taxkey') . qq|</th>
551 <th class=listheading style="width:10%">|
552 . $locale->text('Project') . qq|</th>
556 $amount = $locale->text('Amount');
557 $project = $locale->text('Project');
559 for $i (1 .. $form->{rowcount}) {
562 $form->{"amount_$i"} =
563 $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
564 $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
565 $selectAP_amount = $selectAP_amount_unquoted;
566 $re_amount = quotemeta($form->{"AP_amount_$i"});
568 s/option value=\"${re_amount}\"/option value=\"$form->{"AP_amount_$i"}\" selected/;
570 $tax_selected = $form->{"taxchart_$i"};
571 $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
573 qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
575 my $korrektur = $form->{"korrektur_$i"} ? 'checked' : '';
578 NTI($cgi->popup_menu('-name' => "project_id_$i",
579 '-values' => \@project_values,
580 '-labels' => \%project_labels,
581 '-default' => $form->{"project_id_$i"} ));
585 <td width=50%><select name="AP_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAP_amount</select></td>
586 <td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
587 <td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
588 <td><input type="checkbox" name="korrektur_$i" value="1" "$korrektur"></td>
590 <td>$projectnumber</td>
598 ($form->{taxincluded})
599 ? $locale->text('Tax Included')
600 : $locale->text('Tax');
602 $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
611 <td><select name=APselected>$form->{selectAP}</select></td>
612 <input type=hidden name=AP value="$form->{AP}">
613 <th align=left>$form->{invtotal}</th>
615 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
616 <input type=hidden name=oldtotalpaid value=$form->{oldtotalpaid}>
618 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
631 <th align=left width=1%>| . $locale->text('Notes') . qq|</th>
632 <td align=left>$notes</td>
640 <tr class=listheading>
641 <th class=listheading colspan=7>| . $locale->text('Payments') . qq|</th>
645 if ($form->{currency} eq $form->{defaultcurrency}) {
646 @column_index = qw(datepaid source memo paid AP_paid paid_project_id);
648 @column_index = qw(datepaid source memo paid exchangerate AP_paid paid_project_id);
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{AP_paid} = "<th>" . $locale->text('Account') . "</th>";
655 $column_data{source} = "<th>" . $locale->text('Source') . "</th>";
656 $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
657 $column_data{paid_project_id} = "<th>" . $locale->text('Project Number') . "</th>";
662 map { print "$column_data{$_}\n" } @column_index;
668 $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
669 for $i (1 .. $form->{paidaccounts}) {
674 $form->{"selectAP_paid_$i"} = $form->{selectAP_paid};
675 $form->{"selectAP_paid_$i"} =~
676 s/option value=\"$form->{"AP_paid_$i"}\">/option value=\"$form->{"AP_paid_$i"}\" selected>/;
679 if ($form->{"paid_$i"}) {
681 $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
683 $form->{"exchangerate_$i"} =
684 $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
686 $exchangerate = qq| |;
687 if ($form->{currency} ne $form->{defaultcurrency}) {
688 if ($form->{"forex_$i"}) {
690 qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
693 qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
698 <input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
701 $column_data{"paid_$i"} =
702 qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
703 $column_data{"AP_paid_$i"} =
704 qq|<td align=center><select name="AP_paid_$i">$form->{"selectAP_paid_$i"}</select></td>|;
705 $column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
706 $column_data{"datepaid_$i"} =
707 qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value=$form->{"datepaid_$i"}>
708 <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
709 $column_data{"source_$i"} =
710 qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
711 $column_data{"memo_$i"} =
712 qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
713 $column_data{"paid_project_id_$i"} =
715 . NTI($cgi->popup_menu('-name' => "paid_project_id_$i",
716 '-values' => \@project_values,
717 '-labels' => \%project_labels,
718 '-default' => $form->{"paid_project_id_$i"} ))
721 map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
726 push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
728 map { $form->{$_} =~ s/\"/"/g } qw(selectAP_paid);
729 print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
731 <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
732 <input type=hidden name=selectAP_paid value="$form->{selectAP_paid}">
738 <td><hr size=3 noshade></td>
743 $lxdebug->leave_sub();
747 $lxdebug->enter_sub();
751 <input name=callback type=hidden value="$form->{callback}">
752 <input name="gldate" type="hidden" value="| . Q($form->{gldate}) . qq|">
754 <input type=hidden name=path value=$form->{path}>
755 <input type=hidden name=login value=$form->{login}>
756 <input type=hidden name=password value=$form->{password}>
761 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
762 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
764 print qq|<input class=submit type=submit name=action value="|
765 . $locale->text('Update') . qq|">|;
769 # print qq|<input class=submit type=submit name=action value="|.$locale->text('Update').qq|">
771 if ($form->{radier}) {
773 <input class=submit type=submit name=action value="|
774 . $locale->text('Post') . qq|">
775 <input class=submit type=submit name=action value="|
776 . $locale->text('Delete') . qq|">
781 <input class=submit type=submit name=action value="|
782 . $locale->text('Use As Template') . qq|">
783 <input class=submit type=submit name=action value="|
784 . $locale->text('Post Payment') . qq|">
786 } elsif (($transdate > $closedto) && !$form->{id}) {
788 <input class=submit type=submit name=action value="|
789 . $locale->text('Post') . qq|">|;
799 $lxdebug->leave_sub();
803 $lxdebug->enter_sub();
811 $form->{invtotal} = 0;
813 # $form->{selectAP_amount} = $form->{AP_amount};
814 # $form->{selectAP_amount} =~
815 # s/value=\"$form->{AP_amountselected}\"/value=\"$form->{AP_amountselected}\" selected/;
817 ($AP_amountaccno, $AP_amounttaxkey) =
818 split(/--/, $form->{AP_amountselected});
819 $form->{selecttaxchart} = $form->{taxchart};
820 $form->{selecttaxchart} =~
821 s/value=\"$AP_amounttaxkey--([^\"]*)\"/value=\"$AP_amounttaxkey--$1\" selected/;
825 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
826 qw(exchangerate creditlimit creditremaining);
828 @flds = qw(amount AP_amount projectnumber oldprojectnumber project_id);
830 for $i (1 .. $form->{rowcount}) {
831 $form->{"amount_$i"} =
832 $form->parse_amount(\%myconfig, $form->{"amount_$i"});
833 $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
834 if ($form->{"amount_$i"}) {
837 if (!$form->{"korrektur_$i"}) {
838 ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
840 if ($form->{taxincluded}) {
841 $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate;
843 $form->{"tax_$i"} = $form->{"amount_$i"} * $rate;
846 $form->{"tax_$i"} = 0;
849 $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"}, 2);
851 $totaltax += $form->{"tax_$i"};
852 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
856 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
858 map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount});
860 $form->{exchangerate} = $exchangerate
864 $form->check_exchangerate(
865 \%myconfig, $form->{currency}, $form->{transdate}, 'sell'
868 $form->{invdate} = $form->{transdate};
869 $save_AP = $form->{AP};
871 $form->{AP} = $save_AP;
873 $form->{rowcount} = $count + 1;
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"}, 'sell'
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();
910 $lxdebug->enter_sub();
911 for $i (1 .. $form->{paidaccounts}) {
912 if ($form->{"paid_$i"}) {
913 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
915 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
917 $form->error($locale->text('Cannot post payment for a closed period!'))
918 if ($datepaid <= $closedto);
920 if ($form->{currency} ne $form->{defaultcurrency}) {
921 $form->{"exchangerate_$i"} = $form->{exchangerate}
922 if ($invdate == $datepaid);
923 $form->isblank("exchangerate_$i",
924 $locale->text('Exchangerate for payment missing!'));
929 ($form->{AP}) = split /--/, $form->{AP};
930 ($form->{AP_paid}) = split /--/, $form->{AP_paid};
931 $form->redirect($locale->text(' Payment posted!'))
932 if (AP->post_payment(\%myconfig, \%$form));
933 $form->error($locale->text('Cannot post payment!'));
936 $lxdebug->leave_sub();
941 $lxdebug->enter_sub();
943 # check if there is a vendor, invoice and due date
944 $form->isblank("transdate", $locale->text("Invoice Date missing!"));
945 $form->isblank("duedate", $locale->text("Due Date missing!"));
946 $form->isblank("vendor", $locale->text('Vendor missing!'));
948 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
949 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
951 $form->error($locale->text('Cannot post transaction for a closed period!'))
952 if ($transdate <= $closedto);
954 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
955 if ($form->{currency} ne $form->{defaultcurrency});
958 for $i (1 .. $form->{paidaccounts}) {
959 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
960 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
962 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
964 $form->error($locale->text('Cannot post payment for a closed period!'))
965 if ($datepaid <= $closedto);
967 if ($form->{currency} ne $form->{defaultcurrency}) {
968 $form->{"exchangerate_$i"} = $form->{exchangerate}
969 if ($transdate == $datepaid);
970 $form->isblank("exchangerate_$i",
971 $locale->text('Exchangerate for payment missing!'));
977 # if old vendor ne vendor redo form
978 ($vendor) = split /--/, $form->{vendor};
979 if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") {
983 ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected};
984 ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
985 ($payablesaccno, $payablestaxkey) = split /--/, $form->{APselected};
986 $form->{AP}{amount_1} = $debitaccno;
987 $form->{AP}{payables} = $payablesaccno;
988 $form->{taxkey} = $taxkey;
990 $form->{id} = 0 if $form->{postasnew};
992 $form->redirect($locale->text('Transaction posted!'))
993 if (AP->post_transaction(\%myconfig, \%$form));
994 $form->error($locale->text('Cannot post transaction!'));
996 $lxdebug->leave_sub();
1000 $lxdebug->enter_sub();
1002 $form->{postasnew} = 1;
1005 $lxdebug->leave_sub();
1008 sub use_as_template {
1009 $lxdebug->enter_sub();
1011 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);
1012 $form->{paidaccounts} = 1;
1013 $form->{rowcount}--;
1014 $form->{invdate} = $form->current_date(\%myconfig);
1017 $lxdebug->leave_sub();
1021 $lxdebug->enter_sub();
1023 $form->{title} = $locale->text('Confirm!');
1027 delete $form->{header};
1032 <form method=post action=$form->{script}>
1035 foreach $key (keys %$form) {
1036 $form->{$key} =~ s/\"/"/g;
1037 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1041 <h2 class=confirm>$form->{title}</h2>
1044 . $locale->text('Are you sure you want to delete Transaction')
1045 . qq| $form->{invnumber}</h4>
1047 <input name=action class=submit type=submit value="|
1048 . $locale->text('Yes') . qq|">
1055 $lxdebug->leave_sub();
1059 $lxdebug->enter_sub();
1061 $form->redirect($locale->text('Transaction deleted!'))
1062 if (AP->delete_transaction(\%myconfig, \%$form, $spool));
1063 $form->error($locale->text('Cannot delete transaction!'));
1065 $lxdebug->leave_sub();
1069 $lxdebug->enter_sub();
1071 # setup vendor selection
1072 $form->all_vc(\%myconfig, "vendor", "AP");
1074 if (@{ $form->{all_vendor} }) {
1075 map { $vendor .= "<option>$_->{name}--$_->{id}\n" }
1076 @{ $form->{all_vendor} };
1077 $vendor = qq|<select name=vendor><option>\n$vendor\n</select>|;
1079 $vendor = qq|<input name=vendor size=35>|;
1083 if (@{ $form->{all_departments} }) {
1084 $form->{selectdepartment} = "<option>\n";
1087 $form->{selectdepartment} .=
1088 "<option>$_->{description}--$_->{id}\n"
1089 } (@{ $form->{all_departments} });
1094 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1095 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1097 | if $form->{selectdepartment};
1099 $form->{title} = $locale->text('AP Transactions');
1101 # use JavaScript Calendar or not
1102 $form->{jsscript} = $jscalendar;
1104 if ($form->{jsscript}) {
1106 # with JavaScript Calendar
1108 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1109 <input type=button name=transdatefrom id="trigger1" value=|
1110 . $locale->text('button') . qq|></td>
1113 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1114 <input type=button name=transdateto name=transdateto id="trigger2" value=|
1115 . $locale->text('button') . qq|></td>
1120 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
1121 "transdateto", "BL", "trigger2");
1124 # without JavaScript Calendar
1126 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1128 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1131 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1136 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1137 push(@values, $item->{"id"});
1138 $labels{$item->{"id"}} = $item->{"projectnumber"};
1141 NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1142 '-labels' => \%labels));
1149 <form method=post action=$form->{script}>
1153 <th class=listtop>$form->{title}</th>
1155 <tr height="5"></tr>
1160 <th align=right>| . $locale->text('Vendor') . qq|</th>
1161 <td colspan=3>$vendor</td>
1165 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
1166 <td colspan=3><input name=invnumber size=20></td>
1169 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
1170 <td colspan=3><input name=ordnumber size=20></td>
1173 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1174 <td colspan=3><input name=notes size=40></td>
1177 <th align="right">| . $locale->text("Project Number") . qq|</th>
1178 <td colspan="3">$projectnumber</td>
1181 <th align=right nowrap>| . $locale->text('From') . qq|</th>
1183 <th align=right>| . $locale->text('Bis') . qq|</th>
1186 <input type=hidden name=sort value=transdate>
1194 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
1198 <td align=right><input name=open class=checkbox type=checkbox value=Y checked></td>
1199 <td nowrap>| . $locale->text('Open') . qq|</td>
1200 <td align=right><input name=closed class=checkbox type=checkbox value=Y></td>
1201 <td nowrap>| . $locale->text('Closed') . qq|</td>
1204 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
1205 <td nowrap>| . $locale->text('ID') . qq|</td>
1206 <td align=right><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
1207 <td nowrap>| . $locale->text('Invoice Number') . qq|</td>
1208 <td align=right><input name="l_ordnumber" class=checkbox type=checkbox value=Y></td>
1209 <td nowrap>| . $locale->text('Order Number') . qq|</td>
1212 <td align=right><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
1213 <td nowrap>| . $locale->text('Vendor') . qq|</td>
1214 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
1215 <td nowrap>| . $locale->text('Invoice Date') . qq|</td>
1216 <td align=right><input name="l_netamount" class=checkbox type=checkbox value=Y></td>
1217 <td nowrap>| . $locale->text('Amount') . qq|</td>
1220 <td align=right><input name="l_tax" class=checkbox type=checkbox value=Y></td>
1221 <td nowrap>| . $locale->text('Tax') . qq|</td>
1222 <td align=right><input name="l_amount" class=checkbox type=checkbox value=Y checked></td>
1223 <td nowrap>| . $locale->text('Total') . qq|</td>
1224 <td align=right><input name="l_datepaid" class=checkbox type=checkbox value=Y></td>
1225 <td nowrap>| . $locale->text('Date Paid') . qq|</td>
1228 <td align=right><input name="l_paid" class=checkbox type=checkbox value=Y checked></td>
1229 <td nowrap>| . $locale->text('Paid') . qq|</td>
1230 <td align=right><input name="l_duedate" class=checkbox type=checkbox value=Y></td>
1231 <td nowrap>| . $locale->text('Due Date') . qq|</td>
1232 <td align=right><input name="l_due" class=checkbox type=checkbox value=Y></td>
1233 <td nowrap>| . $locale->text('Amount Due') . qq|</td>
1236 <td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
1237 <td nowrap>| . $locale->text('Notes') . qq|</td>
1238 <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
1239 <td nowrap>| . $locale->text('Employee') . qq|</td>
1242 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1243 <td nowrap>| . $locale->text('Subtotal') . qq|</td>
1244 <td align=right><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y></td>
1245 <td nowrap>| . $locale->text('Project Number') . qq|</td>
1254 <td><hr size=3 noshade></td>
1261 <input type=hidden name=nextsub value=$form->{nextsub}>
1262 <input type=hidden name=path value=$form->{path}>
1263 <input type=hidden name=login value=$form->{login}>
1264 <input type=hidden name=password value=$form->{password}>
1266 <input class=submit type=submit name=action value="|
1267 . $locale->text('Continue') . qq|">
1274 $lxdebug->leave_sub();
1277 sub ap_transactions {
1278 $lxdebug->enter_sub();
1280 $form->{vendor} = $form->unescape($form->{vendor});
1281 ($form->{vendor}, $form->{vendor_id}) = split(/--/, $form->{vendor});
1283 AP->ap_transactions(\%myconfig, \%$form);
1286 "$form->{script}?action=ap_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1289 if ($form->{vendor}) {
1290 $callback .= "&vendor=" . $form->escape($form->{vendor}, 1);
1291 $href .= "&vendor=" . $form->escape($form->{vendor});
1292 $option .= $locale->text('Vendor') . " : $form->{vendor}";
1294 if ($form->{department}) {
1295 $callback .= "&department=" . $form->escape($form->{department}, 1);
1296 $href .= "&department=" . $form->escape($form->{department});
1297 ($department) = split /--/, $form->{department};
1298 $option .= "\n<br>" if ($option);
1299 $option .= $locale->text('Department') . " : $department";
1301 if ($form->{invnumber}) {
1302 $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
1303 $href .= "&invnumber=" . $form->escape($form->{invnumber});
1304 $option .= "\n<br>" if ($option);
1305 $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
1307 if ($form->{ordnumber}) {
1308 $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
1309 $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
1310 $option .= "\n<br>" if ($option);
1311 $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
1313 if ($form->{notes}) {
1314 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
1315 $href .= "¬es=" . $form->escape($form->{notes});
1316 $option .= "\n<br>" if $option;
1317 $option .= $locale->text('Notes') . " : $form->{notes}";
1320 if ($form->{transdatefrom}) {
1321 $callback .= "&transdatefrom=$form->{transdatefrom}";
1322 $href .= "&transdatefrom=$form->{transdatefrom}";
1323 $option .= "\n<br>" if ($option);
1325 $locale->text('From') . " "
1326 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1328 if ($form->{transdateto}) {
1329 $callback .= "&transdateto=$form->{transdateto}";
1330 $href .= "&transdateto=$form->{transdateto}";
1331 $option .= "\n<br>" if ($option);
1333 $locale->text('Bis') . " "
1334 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1336 if ($form->{open}) {
1337 $callback .= "&open=$form->{open}";
1338 $href .= "&open=$form->{open}";
1339 $option .= "\n<br>" if ($option);
1340 $option .= $locale->text('Open');
1342 if ($form->{closed}) {
1343 $callback .= "&closed=$form->{closed}";
1344 $href .= "&closed=$form->{closed}";
1345 $option .= "\n<br>" if ($option);
1346 $option .= $locale->text('Closed');
1348 if ($form->{globalproject_id}) {
1349 $callback .= "&globalproject_id=" . E($form->{globalproject_id});
1350 $href .= "&globalproject_id=" . E($form->{globalproject_id});
1354 qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid
1355 due duedate notes employee globalprojectnumber);
1357 foreach $item (@columns) {
1358 if ($form->{"l_$item"} eq "Y") {
1359 push @column_index, $item;
1361 # add column to href and callback
1362 $callback .= "&l_$item=Y";
1363 $href .= "&l_$item=Y";
1367 if ($form->{l_subtotal} eq 'Y') {
1368 $callback .= "&l_subtotal=Y";
1369 $href .= "&l_subtotal=Y";
1372 $column_header{id} =
1373 qq|<th><a class=listheading href=$href&sort=id>|
1374 . $locale->text('ID')
1376 $column_header{transdate} =
1377 qq|<th><a class=listheading href=$href&sort=transdate>|
1378 . $locale->text('Date')
1380 $column_header{duedate} =
1381 qq|<th><a class=listheading href=$href&sort=duedate>|
1382 . $locale->text('Due Date')
1384 $column_header{due} =
1385 qq|<th class=listheading>| . $locale->text('Amount Due') . qq|</th>|;
1386 $column_header{invnumber} =
1387 qq|<th><a class=listheading href=$href&sort=invnumber>|
1388 . $locale->text('Invoice')
1390 $column_header{ordnumber} =
1391 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1392 . $locale->text('Order')
1394 $column_header{name} =
1395 qq|<th><a class=listheading href=$href&sort=name>|
1396 . $locale->text('Vendor')
1398 $column_header{netamount} =
1399 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1400 $column_header{tax} =
1401 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1402 $column_header{amount} =
1403 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1404 $column_header{paid} =
1405 qq|<th class=listheading>| . $locale->text('Paid') . qq|</th>|;
1406 $column_header{datepaid} =
1407 qq|<th><a class=listheading href=$href&sort=datepaid>|
1408 . $locale->text('Date Paid')
1410 $column_header{notes} =
1411 qq|<th class=listheading>| . $locale->text('Notes') . qq|</th>|;
1412 $column_header{employee} =
1413 "<th><a class=listheading href=$href&sort=employee>"
1414 . $locale->text('Employee') . "</th>";
1415 $column_header{globalprojectnumber} =
1416 qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1418 $form->{title} = $locale->text('AP Transactions');
1427 <th class=listtop>$form->{title}</th>
1429 <tr height="5"></tr>
1436 <tr class=listheading>
1439 map { print "\n$column_header{$_}" } @column_index;
1445 # add sort and escape callback
1446 $form->{callback} = "$callback&sort=$form->{sort}";
1447 $callback = $form->escape($form->{callback});
1449 if (@{ $form->{AP} }) {
1450 $sameitem = $form->{AP}->[0]->{ $form->{sort} };
1453 # sums and tax on reports by Antonio Gallardo
1455 foreach $ap (@{ $form->{AP} }) {
1457 if ($form->{l_subtotal} eq 'Y') {
1458 if ($sameitem ne $ap->{ $form->{sort} }) {
1460 $sameitem = $ap->{ $form->{sort} };
1464 $column_data{netamount} =
1466 . $form->format_amount(\%myconfig, $ap->{netamount}, 2, " ")
1468 $column_data{tax} = "<td align=right>"
1469 . $form->format_amount(\%myconfig, $ap->{amount} - $ap->{netamount},
1472 $column_data{amount} =
1474 . $form->format_amount(\%myconfig, $ap->{amount}, 2, " ") . "</td>";
1475 $column_data{paid} =
1477 . $form->format_amount(\%myconfig, $ap->{paid}, 2, " ") . "</td>";
1478 $column_data{due} = "<td align=right>"
1479 . $form->format_amount(\%myconfig, $ap->{amount} - $ap->{paid},
1483 $totalnetamount += $ap->{netamount};
1484 $totalamount += $ap->{amount};
1485 $totalpaid += $ap->{paid};
1486 $totaldue += ($ap->{amount} - $ap->{paid});
1488 $subtotalnetamount += $ap->{netamount};
1489 $subtotalamount += $ap->{amount};
1490 $subtotalpaid += $ap->{paid};
1491 $subtotaldue += ($ap->{amount} - $ap->{paid});
1493 $column_data{transdate} = "<td>$ap->{transdate} </td>";
1494 $column_data{duedate} = "<td>$ap->{duedate} </td>";
1495 $column_data{datepaid} = "<td>$ap->{datepaid} </td>";
1497 $module = ($ap->{invoice}) ? "ir.pl" : $form->{script};
1499 $column_data{invnumber} =
1500 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>|;
1501 $column_data{id} = "<td>$ap->{id}</td>";
1502 $column_data{ordnumber} = "<td>$ap->{ordnumber} </td>";
1503 $column_data{name} = "<td>$ap->{name}</td>";
1504 $ap->{notes} =~ s/\r\n/<br>/g;
1505 $column_data{notes} = "<td>$ap->{notes} </td>";
1506 $column_data{employee} = "<td>$ap->{employee} </td>";
1507 $column_data{globalprojectnumber} =
1508 "<td>" . H($ap->{globalprojectnumber}) . "</td>";
1513 <tr class=listrow$i >
1516 map { print "\n$column_data{$_}" } @column_index;
1524 if ($form->{l_subtotal} eq 'Y') {
1530 <tr class=listtotal>
1533 map { $column_data{$_} = "<td> </td>" } @column_index;
1535 $column_data{netamount} =
1536 "<th class=listtotal align=right>"
1537 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1538 $column_data{tax} = "<th class=listtotal align=right>"
1539 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1542 $column_data{amount} =
1543 "<th class=listtotal align=right>"
1544 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1545 $column_data{paid} =
1546 "<th class=listtotal align=right>"
1547 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
1549 "<th class=listtotal align=right>"
1550 . $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>";
1552 map { print "$column_data{$_}\n" } @column_index;
1560 <td><hr size=3 noshade></td>
1565 <form method=post action=$form->{script}>
1567 <input name=callback type=hidden value="$form->{callback}">
1569 <input type=hidden name=path value=$form->{path}>
1570 <input type=hidden name=login value=$form->{login}>
1571 <input type=hidden name=password value=$form->{password}>
1573 <input class=submit type=submit name=action value="|
1574 . $locale->text('AP Transaction') . qq|">
1576 <input class=submit type=submit name=action value="|
1577 . $locale->text('Vendor Invoice') . qq|">
1585 $lxdebug->leave_sub();
1589 $lxdebug->enter_sub();
1591 map { $column_data{$_} = "<td> </td>" } @column_index;
1593 $column_data{netamount} =
1594 "<th class=listsubtotal align=right>"
1595 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1597 $column_data{tax} = "<th class=listsubtotal align=right>"
1598 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1601 $column_data{amount} =
1602 "<th class=listsubtotal align=right>"
1603 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1604 $column_data{paid} =
1605 "<th class=listsubtotal align=right>"
1606 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
1608 "<th class=listsubtotal align=right>"
1609 . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
1611 $subtotalnetamount = 0;
1612 $subtotalamount = 0;
1616 print "<tr class=listsubtotal>";
1618 map { print "\n$column_data{$_}" } @column_index;
1624 $lxdebug->leave_sub();