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->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
93 #/show hhistory button
95 $form->{title} = "Edit";
100 $lxdebug->leave_sub();
104 $lxdebug->enter_sub();
109 $lxdebug->leave_sub();
113 $lxdebug->enter_sub();
115 $form->create_links("AP", \%myconfig, "vendor");
116 $taxincluded = $form->{taxincluded};
117 $duedate = $form->{duedate};
119 IR->get_vendor(\%myconfig, \%$form);
120 $form->{taxincluded} = $taxincluded;
121 $form->{duedate} = $duedate if $duedate;
122 $form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
123 $form->{rowcount} = 1;
125 # build the popup menus
126 $form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked";
130 qq|<option value=\"$_->{id}--$_->{rate}\">$_->{taxdescription} |
131 . ($_->{rate} * 100) . qq| %|
133 $form->{taxchart} = $tax;
134 $form->{selecttaxchart} = $tax;
137 @curr = split(/:/, $form->{currencies});
139 $form->{defaultcurrency} = $curr[0];
141 map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
144 if (@{ $form->{all_vendor} }) {
145 $form->{vendor} = qq|$form->{vendor}--$form->{vendor_id}|;
146 map { $form->{selectvendor} .= "<option>$_->{name}--$_->{id}\n" }
147 (@{ $form->{all_vendor} });
151 if (@{ $form->{all_departments} }) {
152 $form->{selectdepartment} = "<option>\n";
153 $form->{department} = "$form->{department}--$form->{department_id}";
156 $form->{selectdepartment} .=
157 "<option>$_->{description}--$_->{id}\n"
158 } (@{ $form->{all_departments} });
161 $form->{employee} = "$form->{employee}--$form->{employee_id}";
164 $form->{forex} = $form->{exchangerate};
165 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
167 foreach $key (keys %{ $form->{AP_links} }) {
168 foreach $ref (@{ $form->{AP_links}{$key} }) {
169 if ($key eq "AP_paid") {
170 $form->{"select$key"} .=
171 "<option value=\"$ref->{accno}\">$ref->{accno}--$ref->{description}</option>\n";
173 $form->{"select$key"} .=
174 "<option value=\"$ref->{accno}--$ref->{tax_id}\">$ref->{accno}--$ref->{description}</option>\n";
178 $form->{$key} = $form->{"select$key"};
180 # if there is a value we have an old entry
184 for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
186 if ($key eq "AP_paid") {
188 $form->{"AP_paid_$j"} =
189 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
190 $form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{amount};
191 $form->{"datepaid_$j"} =
192 $form->{acc_trans}{$key}->[$i - 1]->{transdate};
193 $form->{"source_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
194 $form->{"memo_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
196 $form->{"forex_$j"} = $form->{"exchangerate_$i"} =
197 $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
198 $form->{"AP_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}";
199 $form->{"paid_project_id_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{project_id};
200 $form->{paidaccounts}++;
206 if (($key eq "AP_tax") || ($key eq "AR_tax")) {
207 $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
208 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
209 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
211 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
214 if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
216 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
218 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
221 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
223 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
225 $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
226 $form->{"tax_$index"} =
227 $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
228 $totaltax += $form->{"tax_$index"};
232 $form->{"${akey}_$k"} =
234 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
236 if ($akey eq 'amount') {
238 $form->{"${akey}_$i"} *= -1;
239 $totalamount += $form->{"${akey}_$i"};
240 $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate};
241 $form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"} =
242 "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}";
243 $form->{"project_id_$k"} =
244 "$form->{acc_trans}{$key}->[$i-1]->{project_id}";
246 $form->{"${key}_$k"} =
247 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
248 my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description});
249 $form->{"select${key}"} =~
250 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)\">$form->{acc_trans}{$key}->[$i-1]->{accno}--${q_description}<\/option>\n/;
251 $form->{"${key}_$k"} = $1;
252 if ($akey eq 'amount') {
253 $form->{"taxchart_$k"} = $form->{taxchart};
254 $form->{"taxchart_$k"} =~
255 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{id}--[^\"]*)/;
256 $form->{"taxchart_$k"} = $1;
263 $form->{taxincluded} = $taxincluded if ($form->{id});
264 $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
266 if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
268 # add tax to amounts and invtotal
269 for $i (1 .. $form->{rowcount}) {
271 ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
272 $tax = $form->round_amount($taxamount, 2);
273 $diff += ($taxamount - $tax);
274 $form->{"amount_$i"} += $form->{"tax_$i"};
276 $form->{amount_1} += $form->round_amount($diff, 2);
279 $taxamount = $form->round_amount($taxamount, 2);
281 $form->{invtotal} = $totalamount + $totaltax;
284 ($form->datetonum($form->{transdate}, \%myconfig) <=
285 $form->datetonum($form->{closedto}, \%myconfig));
287 $form->{"APselected"} = $form->{"AP_1"};
289 $lxdebug->leave_sub();
293 $lxdebug->enter_sub();
295 $title = $form->{title};
296 $form->{title} = $locale->text("$title Accounts Payables Transaction");
298 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
300 # type=submit $locale->text('Add Accounts Payables Transaction')
301 # type=submit $locale->text('Edit Accounts Payables Transaction')
303 $form->{javascript} = qq|<script type="text/javascript">
305 function setTaxkey(accno, row) {
306 var taxkey = accno.options[accno.selectedIndex].value;
307 var reg = /--([0-9]*)/;
308 var found = reg.exec(taxkey);
309 var index = found[1];
310 index = parseInt(index);
311 var tax = 'taxchart_' + row;
312 for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
313 var reg2 = new RegExp("^"+ index, "");
314 if (reg2.exec(document.getElementById(tax).options[i].value)) {
315 document.getElementById(tax).options[i].selected = true;
323 # set option selected
324 foreach $item (qw(vendor currency department)) {
325 $form->{"select$item"} =~ s/ selected//;
326 $form->{"select$item"} =~
327 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
329 $readonly = ($form->{id}) ? "readonly" : "";
331 my $APselected_quoted = quotemeta($form->{"APselected"});
332 $form->{selectAP} = $form->{AP};
334 s/value=\"${APselected_quoted}\"/value=\"$form->{APselected}\" selected/;
337 ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
338 $readonly = ($form->{radier}) ? "" : $readonly;
339 $selectAP_amount_unquoted = $form->{selectAP_amount};
340 $taxchart = $form->{taxchart};
341 map { $form->{$_} =~ s/\"/"/g }
342 qw(AP_amount selectAP_amount AP taxchart);
345 $form->{exchangerate} =
346 $form->format_amount(\%myconfig, $form->{exchangerate});
348 $form->{creditlimit} =
349 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
350 $form->{creditremaining} =
351 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
354 <input type=hidden name=forex value=$form->{forex}>
356 if ($form->{currency} ne $form->{defaultcurrency}) {
357 if ($form->{forex}) {
360 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
361 <td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td>
366 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
367 <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
376 <td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
377 <th align=left nowrap>|
378 . $locale->text('Tax Included') . qq|</th>
382 if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) {
386 qq|<textarea name=notes rows=$rows cols=50 wrap=soft $readonly>$form->{notes}</textarea>|;
390 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
391 <td colspan=3><select name=department>$form->{selectdepartment}</select>
392 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
395 | if $form->{selectdepartment};
397 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
400 ($form->{selectvendor})
401 ? qq|<select name=vendor>$form->{selectvendor}</select>|
402 : qq|<input name=vendor value="$form->{vendor}" size=35>|;
404 my @old_project_ids = ();
405 map({ push(@old_project_ids, $form->{"project_id_$_"})
406 if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
408 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
410 "old_id" => \@old_project_ids });
412 my %project_labels = ();
413 my @project_values = ("");
414 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
415 push(@project_values, $item->{"id"});
416 $project_labels{$item->{"id"}} = $item->{"projectnumber"};
419 # use JavaScript Calendar or not
420 $form->{jsscript} = $jscalendar;
422 if ($form->{jsscript}) {
424 # with JavaScript Calendar
426 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}> $readonly</td>
427 <td><input type=button name=transdate id="trigger1" value=|
428 . $locale->text('button') . qq|></td>
431 <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}> $readonly</td>
432 <td><input type=button name=duedate id="trigger2" value=|
433 . $locale->text('button') . qq|></td></td>
438 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
439 "duedate", "BL", "trigger2");
442 # without JavaScript Calendar
444 qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}> $readonly</td>|;
446 qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}> $readonly</td>|;
454 <form method=post action=$form->{script}>
456 <input type=hidden name=id value=$form->{id}>
457 <input type=hidden name=sort value=$form->{sort}>
458 <input type=hidden name=closedto value=$form->{closedto}>
459 <input type=hidden name=locked value=$form->{locked}>
460 <input type=hidden name=title value="$title">
464 <th class=listtop>$form->{title}</th>
474 <th align=right nowrap>| . $locale->text('Vendor') . qq|</th>
475 <td colspan=3>$vendor</td>
476 <input type=hidden name=selectvendor value="$form->{selectvendor}">
477 <input type=hidden name=oldvendor value="$form->{oldvendor}">
478 <input type=hidden name=vendor_id value="$form->{vendor_id}">
479 <input type=hidden name=terms value=$form->{terms}>
486 <th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th>
487 <td>$form->{creditlimit}</td>
488 <th align=left nowrap>| . $locale->text('Remaining') . qq|</th>
489 <td class="plus$n">$form->{creditremaining}</td>
490 <input type=hidden name=creditlimit value=$form->{creditlimit}>
491 <input type=hidden name=creditremaining value=$form->{creditremaining}>
496 <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
497 <td><select name=currency>$form->{selectcurrency}</select></td>
498 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
499 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
500 <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
501 <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
511 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
512 <td><input name=invnumber size=11 value="$form->{invnumber}" $readonly></td>
515 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
516 <td><input name=ordnumber size=11 value="$form->{ordnumber}" $readonly></td>
519 <th align=right nowrap>| . $locale->text('Invoice Date') . qq|</th>
523 <th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
536 <input type=hidden name=selectAP_amount value="$form->{selectAP_amount}">
537 <input type=hidden name=AP_amount value="$form->{AP_amount}">
538 <input type=hidden name=taxchart value="$form->{taxchart}">
539 <input type=hidden name=rowcount value=$form->{rowcount}>
543 <tr class=listheading>
544 <th class=listheading style="width:15%">|
545 . $locale->text('Account') . qq|</th>
546 <th class=listheading style="width:10%">|
547 . $locale->text('Amount') . qq|</th>
548 <th class=listheading style="width:10%">|
549 . $locale->text('Tax') . qq|</th>
550 <th class=listheading style="width:5%">|
551 . $locale->text('Korrektur') . qq|</th>
552 <th class=listheading style="width:10%">|
553 . $locale->text('Taxkey') . qq|</th>
554 <th class=listheading style="width:10%">|
555 . $locale->text('Project') . qq|</th>
559 $amount = $locale->text('Amount');
560 $project = $locale->text('Project');
562 for $i (1 .. $form->{rowcount}) {
565 $form->{"amount_$i"} =
566 $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
567 $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
568 $selectAP_amount = $selectAP_amount_unquoted;
569 $re_amount = quotemeta($form->{"AP_amount_$i"});
571 s/option value=\"${re_amount}\"/option value=\"$form->{"AP_amount_$i"}\" selected/;
573 $tax_selected = $form->{"taxchart_$i"};
574 $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
576 qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
578 my $korrektur = $form->{"korrektur_$i"} ? 'checked' : '';
581 NTI($cgi->popup_menu('-name' => "project_id_$i",
582 '-values' => \@project_values,
583 '-labels' => \%project_labels,
584 '-default' => $form->{"project_id_$i"} ));
588 <td width=50%><select name="AP_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAP_amount</select></td>
589 <td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
590 <td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
591 <td><input type="checkbox" name="korrektur_$i" value="1" "$korrektur"></td>
593 <td>$projectnumber</td>
601 ($form->{taxincluded})
602 ? $locale->text('Tax Included')
603 : $locale->text('Tax');
605 $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
614 <td><select name=APselected>$form->{selectAP}</select></td>
615 <input type=hidden name=AP value="$form->{AP}">
616 <th align=left>$form->{invtotal}</th>
618 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
619 <input type=hidden name=oldtotalpaid value=$form->{oldtotalpaid}>
621 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
634 <th align=left width=1%>| . $locale->text('Notes') . qq|</th>
635 <td align=left>$notes</td>
643 <tr class=listheading>
644 <th class=listheading colspan=7>| . $locale->text('Payments') . qq|</th>
648 if ($form->{currency} eq $form->{defaultcurrency}) {
649 @column_index = qw(datepaid source memo paid AP_paid paid_project_id);
651 @column_index = qw(datepaid source memo paid exchangerate AP_paid paid_project_id);
654 $column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
655 $column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
656 $column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
657 $column_data{AP_paid} = "<th>" . $locale->text('Account') . "</th>";
658 $column_data{source} = "<th>" . $locale->text('Source') . "</th>";
659 $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
660 $column_data{paid_project_id} = "<th>" . $locale->text('Project Number') . "</th>";
665 map { print "$column_data{$_}\n" } @column_index;
671 $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
672 for $i (1 .. $form->{paidaccounts}) {
677 $form->{"selectAP_paid_$i"} = $form->{selectAP_paid};
678 $form->{"selectAP_paid_$i"} =~
679 s/option value=\"$form->{"AP_paid_$i"}\">/option value=\"$form->{"AP_paid_$i"}\" selected>/;
682 if ($form->{"paid_$i"}) {
684 $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
686 $form->{"exchangerate_$i"} =
687 $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
689 $exchangerate = qq| |;
690 if ($form->{currency} ne $form->{defaultcurrency}) {
691 if ($form->{"forex_$i"}) {
693 qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
696 qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
701 <input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
704 $column_data{"paid_$i"} =
705 qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
706 $column_data{"AP_paid_$i"} =
707 qq|<td align=center><select name="AP_paid_$i">$form->{"selectAP_paid_$i"}</select></td>|;
708 $column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
709 $column_data{"datepaid_$i"} =
710 qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value=$form->{"datepaid_$i"}>
711 <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
712 $column_data{"source_$i"} =
713 qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
714 $column_data{"memo_$i"} =
715 qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
716 $column_data{"paid_project_id_$i"} =
718 . NTI($cgi->popup_menu('-name' => "paid_project_id_$i",
719 '-values' => \@project_values,
720 '-labels' => \%project_labels,
721 '-default' => $form->{"paid_project_id_$i"} ))
724 map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
729 push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
731 map { $form->{$_} =~ s/\"/"/g } qw(selectAP_paid);
732 print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
734 <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
735 <input type=hidden name=selectAP_paid value="$form->{selectAP_paid}">
741 <td><hr size=3 noshade></td>
746 $lxdebug->leave_sub();
750 $lxdebug->enter_sub();
754 <input name=callback type=hidden value="$form->{callback}">
755 <input name="gldate" type="hidden" value="| . Q($form->{gldate}) . qq|">
757 <input type=hidden name=path value=$form->{path}>
758 <input type=hidden name=login value=$form->{login}>
759 <input type=hidden name=password value=$form->{password}>
764 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
765 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
767 print qq|<input class=submit type=submit name=action value="|
768 . $locale->text('Update') . qq|">|;
772 # print qq|<input class=submit type=submit name=action value="|.$locale->text('Update').qq|">
774 if ($form->{radier}) {
776 <input class=submit type=submit name=action value="|
777 . $locale->text('Post') . qq|">
778 <input class=submit type=submit name=action value="|
779 . $locale->text('Delete') . qq|">
784 <input class=submit type=submit name=action value="|
785 . $locale->text('Use As Template') . qq|">
786 <input class=submit type=submit name=action value="|
787 . $locale->text('Post Payment') . qq|">
789 } elsif (($transdate > $closedto) && !$form->{id}) {
791 <input class=submit type=submit name=action value="|
792 . $locale->text('Post') . qq|">|;
794 # button for saving history
795 if($form->{id} ne "") {
797 <input type=button class=submit onclick=set_history_window(|
799 . qq|); name=history id=history value=|
800 . $locale->text('history')
803 # /button for saving history
811 $lxdebug->leave_sub();
815 $lxdebug->enter_sub();
823 $form->{invtotal} = 0;
825 # $form->{selectAP_amount} = $form->{AP_amount};
826 # $form->{selectAP_amount} =~
827 # s/value=\"$form->{AP_amountselected}\"/value=\"$form->{AP_amountselected}\" selected/;
829 ($AP_amountaccno, $AP_amounttaxkey) =
830 split(/--/, $form->{AP_amountselected});
831 $form->{selecttaxchart} = $form->{taxchart};
832 $form->{selecttaxchart} =~
833 s/value=\"$AP_amounttaxkey--([^\"]*)\"/value=\"$AP_amounttaxkey--$1\" selected/;
837 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
838 qw(exchangerate creditlimit creditremaining);
840 @flds = qw(amount AP_amount projectnumber oldprojectnumber project_id);
842 for $i (1 .. $form->{rowcount}) {
843 $form->{"amount_$i"} =
844 $form->parse_amount(\%myconfig, $form->{"amount_$i"});
845 $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
846 if ($form->{"amount_$i"}) {
849 if (!$form->{"korrektur_$i"}) {
850 ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
852 if ($form->{taxincluded}) {
853 $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate;
855 $form->{"tax_$i"} = $form->{"amount_$i"} * $rate;
858 $form->{"tax_$i"} = 0;
861 $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"}, 2);
863 $totaltax += $form->{"tax_$i"};
864 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
868 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
870 map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount});
872 $form->{exchangerate} = $exchangerate
876 $form->check_exchangerate(
877 \%myconfig, $form->{currency}, $form->{transdate}, 'sell'
880 $form->{invdate} = $form->{transdate};
881 $save_AP = $form->{AP};
883 $form->{AP} = $save_AP;
885 $form->{rowcount} = $count + 1;
888 ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
890 for $i (1 .. $form->{paidaccounts}) {
891 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
894 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
895 } qw(paid exchangerate);
897 $totalpaid += $form->{"paid_$i"};
899 $form->{"exchangerate_$i"} = $exchangerate
901 $form->{"forex_$i"} = (
903 $form->check_exchangerate(
904 \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'sell'
909 $form->{creditremaining} -=
910 ($form->{invtotal} - $totalpaid + $form->{oldtotalpaid} -
911 $form->{oldinvtotal});
912 $form->{oldinvtotal} = $form->{invtotal};
913 $form->{oldtotalpaid} = $totalpaid;
917 $lxdebug->leave_sub();
922 $lxdebug->enter_sub();
923 for $i (1 .. $form->{paidaccounts}) {
924 if ($form->{"paid_$i"}) {
925 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
927 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
929 $form->error($locale->text('Cannot post payment for a closed period!'))
930 if ($datepaid <= $closedto);
932 if ($form->{currency} ne $form->{defaultcurrency}) {
933 $form->{"exchangerate_$i"} = $form->{exchangerate}
934 if ($invdate == $datepaid);
935 $form->isblank("exchangerate_$i",
936 $locale->text('Exchangerate for payment missing!'));
941 ($form->{AP}) = split /--/, $form->{AP};
942 ($form->{AP_paid}) = split /--/, $form->{AP_paid};
943 $form->redirect($locale->text(' Payment posted!'))
944 if (AP->post_payment(\%myconfig, \%$form));
945 $form->error($locale->text('Cannot post payment!'));
948 $lxdebug->leave_sub();
953 $lxdebug->enter_sub();
955 # check if there is a vendor, invoice and due date
956 $form->isblank("transdate", $locale->text("Invoice Date missing!"));
957 $form->isblank("duedate", $locale->text("Due Date missing!"));
958 $form->isblank("vendor", $locale->text('Vendor missing!'));
960 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
961 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
963 $form->error($locale->text('Cannot post transaction for a closed period!'))
964 if ($transdate <= $closedto);
966 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
967 if ($form->{currency} ne $form->{defaultcurrency});
970 for $i (1 .. $form->{paidaccounts}) {
971 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
972 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
974 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
976 $form->error($locale->text('Cannot post payment for a closed period!'))
977 if ($datepaid <= $closedto);
979 if ($form->{currency} ne $form->{defaultcurrency}) {
980 $form->{"exchangerate_$i"} = $form->{exchangerate}
981 if ($transdate == $datepaid);
982 $form->isblank("exchangerate_$i",
983 $locale->text('Exchangerate for payment missing!'));
989 # if old vendor ne vendor redo form
990 ($vendor) = split /--/, $form->{vendor};
991 if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") {
995 ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected};
996 ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
997 ($payablesaccno, $payablestaxkey) = split /--/, $form->{APselected};
998 $form->{AP}{amount_1} = $debitaccno;
999 $form->{AP}{payables} = $payablesaccno;
1000 $form->{taxkey} = $taxkey;
1002 $form->{id} = 0 if $form->{postasnew};
1003 # saving the history
1004 if(!exists $form->{addition} && $form->{id} ne "") {
1005 $form->{addition} = "POSTED";
1006 $form->save_history($form->dbconnect(\%myconfig));
1008 # /saving the history
1010 $form->redirect($locale->text('Transaction posted!'))
1011 if (AP->post_transaction(\%myconfig, \%$form));
1012 $form->error($locale->text('Cannot post transaction!'));
1014 $lxdebug->leave_sub();
1018 $lxdebug->enter_sub();
1020 $form->{postasnew} = 1;
1021 # saving the history
1022 if(!exists $form->{addition} && $form->{id} ne "") {
1023 $form->{addition} = "POSTED AS NEW";
1024 $form->save_history($form->dbconnect(\%myconfig));
1026 # /saving the history
1029 $lxdebug->leave_sub();
1032 sub use_as_template {
1033 $lxdebug->enter_sub();
1035 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);
1036 $form->{paidaccounts} = 1;
1037 $form->{rowcount}--;
1038 $form->{invdate} = $form->current_date(\%myconfig);
1041 $lxdebug->leave_sub();
1045 $lxdebug->enter_sub();
1047 $form->{title} = $locale->text('Confirm!');
1051 delete $form->{header};
1056 <form method=post action=$form->{script}>
1059 foreach $key (keys %$form) {
1060 $form->{$key} =~ s/\"/"/g;
1061 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1065 <h2 class=confirm>$form->{title}</h2>
1068 . $locale->text('Are you sure you want to delete Transaction')
1069 . qq| $form->{invnumber}</h4>
1071 <input name=action class=submit type=submit value="|
1072 . $locale->text('Yes') . qq|">
1079 $lxdebug->leave_sub();
1083 $lxdebug->enter_sub();
1084 if (AP->delete_transaction(\%myconfig, \%$form, $spool)) {
1085 # saving the history
1086 if(!exists $form->{addition}) {
1087 $form->{addition} = "DELETED";
1088 $form->save_history($form->dbconnect(\%myconfig));
1090 # /saving the history
1091 $form->redirect($locale->text('Transaction deleted!'));
1093 $form->error($locale->text('Cannot delete transaction!'));
1095 $lxdebug->leave_sub();
1099 $lxdebug->enter_sub();
1101 # setup vendor selection
1102 $form->all_vc(\%myconfig, "vendor", "AP");
1104 if (@{ $form->{all_vendor} }) {
1105 map { $vendor .= "<option>$_->{name}--$_->{id}\n" }
1106 @{ $form->{all_vendor} };
1107 $vendor = qq|<select name=vendor><option>\n$vendor\n</select>|;
1109 $vendor = qq|<input name=vendor size=35>|;
1113 if (@{ $form->{all_departments} }) {
1114 $form->{selectdepartment} = "<option>\n";
1117 $form->{selectdepartment} .=
1118 "<option>$_->{description}--$_->{id}\n"
1119 } (@{ $form->{all_departments} });
1124 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1125 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1127 | if $form->{selectdepartment};
1129 $form->{title} = $locale->text('AP Transactions');
1131 # use JavaScript Calendar or not
1132 $form->{jsscript} = $jscalendar;
1134 if ($form->{jsscript}) {
1136 # with JavaScript Calendar
1138 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1139 <input type=button name=transdatefrom id="trigger1" value=|
1140 . $locale->text('button') . qq|></td>
1143 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1144 <input type=button name=transdateto name=transdateto id="trigger2" value=|
1145 . $locale->text('button') . qq|></td>
1150 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
1151 "transdateto", "BL", "trigger2");
1154 # without JavaScript Calendar
1156 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1158 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1161 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1166 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1167 push(@values, $item->{"id"});
1168 $labels{$item->{"id"}} = $item->{"projectnumber"};
1171 NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1172 '-labels' => \%labels));
1179 <form method=post action=$form->{script}>
1183 <th class=listtop>$form->{title}</th>
1185 <tr height="5"></tr>
1190 <th align=right>| . $locale->text('Vendor') . qq|</th>
1191 <td colspan=3>$vendor</td>
1195 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
1196 <td colspan=3><input name=invnumber size=20></td>
1199 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
1200 <td colspan=3><input name=ordnumber size=20></td>
1203 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1204 <td colspan=3><input name=notes size=40></td>
1207 <th align="right">| . $locale->text("Project Number") . qq|</th>
1208 <td colspan="3">$projectnumber</td>
1211 <th align=right nowrap>| . $locale->text('From') . qq|</th>
1213 <th align=right>| . $locale->text('Bis') . qq|</th>
1216 <input type=hidden name=sort value=transdate>
1224 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
1228 <td align=right><input name=open class=checkbox type=checkbox value=Y checked></td>
1229 <td nowrap>| . $locale->text('Open') . qq|</td>
1230 <td align=right><input name=closed class=checkbox type=checkbox value=Y></td>
1231 <td nowrap>| . $locale->text('Closed') . qq|</td>
1234 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
1235 <td nowrap>| . $locale->text('ID') . qq|</td>
1236 <td align=right><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
1237 <td nowrap>| . $locale->text('Invoice Number') . qq|</td>
1238 <td align=right><input name="l_ordnumber" class=checkbox type=checkbox value=Y></td>
1239 <td nowrap>| . $locale->text('Order Number') . qq|</td>
1242 <td align=right><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
1243 <td nowrap>| . $locale->text('Vendor') . qq|</td>
1244 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
1245 <td nowrap>| . $locale->text('Invoice Date') . qq|</td>
1246 <td align=right><input name="l_netamount" class=checkbox type=checkbox value=Y></td>
1247 <td nowrap>| . $locale->text('Amount') . qq|</td>
1250 <td align=right><input name="l_tax" class=checkbox type=checkbox value=Y></td>
1251 <td nowrap>| . $locale->text('Tax') . qq|</td>
1252 <td align=right><input name="l_amount" class=checkbox type=checkbox value=Y checked></td>
1253 <td nowrap>| . $locale->text('Total') . qq|</td>
1254 <td align=right><input name="l_datepaid" class=checkbox type=checkbox value=Y></td>
1255 <td nowrap>| . $locale->text('Date Paid') . qq|</td>
1258 <td align=right><input name="l_paid" class=checkbox type=checkbox value=Y checked></td>
1259 <td nowrap>| . $locale->text('Paid') . qq|</td>
1260 <td align=right><input name="l_duedate" class=checkbox type=checkbox value=Y></td>
1261 <td nowrap>| . $locale->text('Due Date') . qq|</td>
1262 <td align=right><input name="l_due" class=checkbox type=checkbox value=Y></td>
1263 <td nowrap>| . $locale->text('Amount Due') . qq|</td>
1266 <td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
1267 <td nowrap>| . $locale->text('Notes') . qq|</td>
1268 <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
1269 <td nowrap>| . $locale->text('Employee') . qq|</td>
1272 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1273 <td nowrap>| . $locale->text('Subtotal') . qq|</td>
1274 <td align=right><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y></td>
1275 <td nowrap>| . $locale->text('Project Number') . qq|</td>
1284 <td><hr size=3 noshade></td>
1291 <input type=hidden name=nextsub value=$form->{nextsub}>
1292 <input type=hidden name=path value=$form->{path}>
1293 <input type=hidden name=login value=$form->{login}>
1294 <input type=hidden name=password value=$form->{password}>
1296 <input class=submit type=submit name=action value="|
1297 . $locale->text('Continue') . qq|">
1304 $lxdebug->leave_sub();
1307 sub ap_transactions {
1308 $lxdebug->enter_sub();
1310 $form->{vendor} = $form->unescape($form->{vendor});
1311 ($form->{vendor}, $form->{vendor_id}) = split(/--/, $form->{vendor});
1313 AP->ap_transactions(\%myconfig, \%$form);
1316 "$form->{script}?action=ap_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1319 if ($form->{vendor}) {
1320 $callback .= "&vendor=" . $form->escape($form->{vendor}, 1);
1321 $href .= "&vendor=" . $form->escape($form->{vendor});
1322 $option .= $locale->text('Vendor') . " : $form->{vendor}";
1324 if ($form->{department}) {
1325 $callback .= "&department=" . $form->escape($form->{department}, 1);
1326 $href .= "&department=" . $form->escape($form->{department});
1327 ($department) = split /--/, $form->{department};
1328 $option .= "\n<br>" if ($option);
1329 $option .= $locale->text('Department') . " : $department";
1331 if ($form->{invnumber}) {
1332 $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
1333 $href .= "&invnumber=" . $form->escape($form->{invnumber});
1334 $option .= "\n<br>" if ($option);
1335 $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
1337 if ($form->{ordnumber}) {
1338 $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
1339 $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
1340 $option .= "\n<br>" if ($option);
1341 $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
1343 if ($form->{notes}) {
1344 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
1345 $href .= "¬es=" . $form->escape($form->{notes});
1346 $option .= "\n<br>" if $option;
1347 $option .= $locale->text('Notes') . " : $form->{notes}";
1350 if ($form->{transdatefrom}) {
1351 $callback .= "&transdatefrom=$form->{transdatefrom}";
1352 $href .= "&transdatefrom=$form->{transdatefrom}";
1353 $option .= "\n<br>" if ($option);
1355 $locale->text('From') . " "
1356 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1358 if ($form->{transdateto}) {
1359 $callback .= "&transdateto=$form->{transdateto}";
1360 $href .= "&transdateto=$form->{transdateto}";
1361 $option .= "\n<br>" if ($option);
1363 $locale->text('Bis') . " "
1364 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1366 if ($form->{open}) {
1367 $callback .= "&open=$form->{open}";
1368 $href .= "&open=$form->{open}";
1369 $option .= "\n<br>" if ($option);
1370 $option .= $locale->text('Open');
1372 if ($form->{closed}) {
1373 $callback .= "&closed=$form->{closed}";
1374 $href .= "&closed=$form->{closed}";
1375 $option .= "\n<br>" if ($option);
1376 $option .= $locale->text('Closed');
1378 if ($form->{globalproject_id}) {
1379 $callback .= "&globalproject_id=" . E($form->{globalproject_id});
1380 $href .= "&globalproject_id=" . E($form->{globalproject_id});
1384 qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid
1385 due duedate notes employee globalprojectnumber);
1387 foreach $item (@columns) {
1388 if ($form->{"l_$item"} eq "Y") {
1389 push @column_index, $item;
1391 # add column to href and callback
1392 $callback .= "&l_$item=Y";
1393 $href .= "&l_$item=Y";
1397 if ($form->{l_subtotal} eq 'Y') {
1398 $callback .= "&l_subtotal=Y";
1399 $href .= "&l_subtotal=Y";
1402 $column_header{id} =
1403 qq|<th><a class=listheading href=$href&sort=id>|
1404 . $locale->text('ID')
1406 $column_header{transdate} =
1407 qq|<th><a class=listheading href=$href&sort=transdate>|
1408 . $locale->text('Date')
1410 $column_header{duedate} =
1411 qq|<th><a class=listheading href=$href&sort=duedate>|
1412 . $locale->text('Due Date')
1414 $column_header{due} =
1415 qq|<th class=listheading>| . $locale->text('Amount Due') . qq|</th>|;
1416 $column_header{invnumber} =
1417 qq|<th><a class=listheading href=$href&sort=invnumber>|
1418 . $locale->text('Invoice')
1420 $column_header{ordnumber} =
1421 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1422 . $locale->text('Order')
1424 $column_header{name} =
1425 qq|<th><a class=listheading href=$href&sort=name>|
1426 . $locale->text('Vendor')
1428 $column_header{netamount} =
1429 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1430 $column_header{tax} =
1431 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1432 $column_header{amount} =
1433 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1434 $column_header{paid} =
1435 qq|<th class=listheading>| . $locale->text('Paid') . qq|</th>|;
1436 $column_header{datepaid} =
1437 qq|<th><a class=listheading href=$href&sort=datepaid>|
1438 . $locale->text('Date Paid')
1440 $column_header{notes} =
1441 qq|<th class=listheading>| . $locale->text('Notes') . qq|</th>|;
1442 $column_header{employee} =
1443 "<th><a class=listheading href=$href&sort=employee>"
1444 . $locale->text('Employee') . "</th>";
1445 $column_header{globalprojectnumber} =
1446 qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1448 $form->{title} = $locale->text('AP Transactions');
1457 <th class=listtop>$form->{title}</th>
1459 <tr height="5"></tr>
1466 <tr class=listheading>
1469 map { print "\n$column_header{$_}" } @column_index;
1475 # add sort and escape callback
1476 $form->{callback} = "$callback&sort=$form->{sort}";
1477 $callback = $form->escape($form->{callback});
1479 if (@{ $form->{AP} }) {
1480 $sameitem = $form->{AP}->[0]->{ $form->{sort} };
1483 # sums and tax on reports by Antonio Gallardo
1485 foreach $ap (@{ $form->{AP} }) {
1487 if ($form->{l_subtotal} eq 'Y') {
1488 if ($sameitem ne $ap->{ $form->{sort} }) {
1490 $sameitem = $ap->{ $form->{sort} };
1494 $column_data{netamount} =
1496 . $form->format_amount(\%myconfig, $ap->{netamount}, 2, " ")
1498 $column_data{tax} = "<td align=right>"
1499 . $form->format_amount(\%myconfig, $ap->{amount} - $ap->{netamount},
1502 $column_data{amount} =
1504 . $form->format_amount(\%myconfig, $ap->{amount}, 2, " ") . "</td>";
1505 $column_data{paid} =
1507 . $form->format_amount(\%myconfig, $ap->{paid}, 2, " ") . "</td>";
1508 $column_data{due} = "<td align=right>"
1509 . $form->format_amount(\%myconfig, $ap->{amount} - $ap->{paid},
1513 $totalnetamount += $ap->{netamount};
1514 $totalamount += $ap->{amount};
1515 $totalpaid += $ap->{paid};
1516 $totaldue += ($ap->{amount} - $ap->{paid});
1518 $subtotalnetamount += $ap->{netamount};
1519 $subtotalamount += $ap->{amount};
1520 $subtotalpaid += $ap->{paid};
1521 $subtotaldue += ($ap->{amount} - $ap->{paid});
1523 $column_data{transdate} = "<td>$ap->{transdate} </td>";
1524 $column_data{duedate} = "<td>$ap->{duedate} </td>";
1525 $column_data{datepaid} = "<td>$ap->{datepaid} </td>";
1527 $module = ($ap->{invoice}) ? "ir.pl" : $form->{script};
1529 $column_data{invnumber} =
1530 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>|;
1531 $column_data{id} = "<td>$ap->{id}</td>";
1532 $column_data{ordnumber} = "<td>$ap->{ordnumber} </td>";
1533 $column_data{name} = "<td>$ap->{name}</td>";
1534 $ap->{notes} =~ s/\r\n/<br>/g;
1535 $column_data{notes} = "<td>$ap->{notes} </td>";
1536 $column_data{employee} = "<td>$ap->{employee} </td>";
1537 $column_data{globalprojectnumber} =
1538 "<td>" . H($ap->{globalprojectnumber}) . "</td>";
1543 <tr class=listrow$i >
1546 map { print "\n$column_data{$_}" } @column_index;
1554 if ($form->{l_subtotal} eq 'Y') {
1560 <tr class=listtotal>
1563 map { $column_data{$_} = "<td> </td>" } @column_index;
1565 $column_data{netamount} =
1566 "<th class=listtotal align=right>"
1567 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1568 $column_data{tax} = "<th class=listtotal align=right>"
1569 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1572 $column_data{amount} =
1573 "<th class=listtotal align=right>"
1574 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1575 $column_data{paid} =
1576 "<th class=listtotal align=right>"
1577 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
1579 "<th class=listtotal align=right>"
1580 . $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>";
1582 map { print "$column_data{$_}\n" } @column_index;
1590 <td><hr size=3 noshade></td>
1595 <form method=post action=$form->{script}>
1597 <input name=callback type=hidden value="$form->{callback}">
1599 <input type=hidden name=path value=$form->{path}>
1600 <input type=hidden name=login value=$form->{login}>
1601 <input type=hidden name=password value=$form->{password}>
1603 <input class=submit type=submit name=action value="|
1604 . $locale->text('AP Transaction') . qq|">
1606 <input class=submit type=submit name=action value="|
1607 . $locale->text('Vendor Invoice') . qq|">
1615 $lxdebug->leave_sub();
1619 $lxdebug->enter_sub();
1621 map { $column_data{$_} = "<td> </td>" } @column_index;
1623 $column_data{netamount} =
1624 "<th class=listsubtotal align=right>"
1625 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1627 $column_data{tax} = "<th class=listsubtotal align=right>"
1628 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1631 $column_data{amount} =
1632 "<th class=listsubtotal align=right>"
1633 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1634 $column_data{paid} =
1635 "<th class=listsubtotal align=right>"
1636 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
1638 "<th class=listsubtotal align=right>"
1639 . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
1641 $subtotalnetamount = 0;
1642 $subtotalamount = 0;
1646 print "<tr class=listsubtotal>";
1648 map { print "\n$column_data{$_}" } @column_index;
1654 $lxdebug->leave_sub();