1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #======================================================================
30 # Accounts Receivables
32 #======================================================================
39 require "$form->{path}/arap.pl";
40 require "bin/mozilla/common.pl";
46 # this is for our long dates
47 # $locale->text('January')
48 # $locale->text('February')
49 # $locale->text('March')
50 # $locale->text('April')
51 # $locale->text('May ')
52 # $locale->text('June')
53 # $locale->text('July')
54 # $locale->text('August')
55 # $locale->text('September')
56 # $locale->text('October')
57 # $locale->text('November')
58 # $locale->text('December')
60 # this is for our short month
61 # $locale->text('Jan')
62 # $locale->text('Feb')
63 # $locale->text('Mar')
64 # $locale->text('Apr')
65 # $locale->text('May')
66 # $locale->text('Jun')
67 # $locale->text('Jul')
68 # $locale->text('Aug')
69 # $locale->text('Sep')
70 # $locale->text('Oct')
71 # $locale->text('Nov')
72 # $locale->text('Dec')
75 $lxdebug->enter_sub();
77 $form->{title} = "Add";
79 "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
80 unless $form->{callback};
83 AR->get_transdate(\%myconfig, $form);
86 $lxdebug->leave_sub();
90 $lxdebug->enter_sub();
92 $form->{title} = "Edit";
97 $lxdebug->leave_sub();
101 $lxdebug->enter_sub();
106 $lxdebug->leave_sub();
110 $lxdebug->enter_sub();
112 $form->create_links("AR", \%myconfig, "customer");
113 $duedate = $form->{duedate};
115 $taxincluded = $form->{taxincluded};
116 my $id = $form->{id};
117 IS->get_customer(\%myconfig, \%$form);
118 $form->{taxincluded} = $taxincluded;
121 $form->{duedate} = $duedate if $duedate;
122 $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
123 $form->{rowcount} = 1;
126 @curr = split(/:/, $form->{currencies});
128 $form->{defaultcurrency} = $curr[0];
130 map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
133 if (@{ $form->{all_customer} }) {
134 $form->{customer} = "$form->{customer}--$form->{customer_id}";
135 map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}\n" }
136 (@{ $form->{all_customer} });
140 if (@{ $form->{all_departments} }) {
141 $form->{selectdepartment} = "<option>\n";
142 $form->{department} = "$form->{department}--$form->{department_id}";
145 $form->{selectdepartment} .=
146 "<option>$_->{description}--$_->{id}\n"
147 } (@{ $form->{all_departments} });
150 $form->{employee} = "$form->{employee}--$form->{employee_id}";
153 if (@{ $form->{all_employees} }) {
154 $form->{selectemployee} = "";
155 map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
156 (@{ $form->{all_employees} });
159 # build the popup menus
160 $form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked";
164 qq|<option value=\"$_->{id}--$_->{rate}\">$_->{taxdescription} |
165 . ($_->{rate} * 100) . qq| %|
167 $form->{taxchart} = $tax;
168 $form->{selecttaxchart} = $tax;
171 $form->{forex} = $form->{exchangerate};
172 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
173 foreach $key (keys %{ $form->{AR_links} }) {
175 foreach $ref (@{ $form->{AR_links}{$key} }) {
176 if ($key eq "AR_paid") {
177 $form->{"select$key"} .=
178 "<option value=\"$ref->{accno}\">$ref->{accno}--$ref->{description}</option>\n";
180 $form->{"select$key"} .=
181 "<option value=\"$ref->{accno}--$ref->{tax_id}\">$ref->{accno}--$ref->{description}</option>\n";
185 $form->{$key} = $form->{"select$key"};
187 # if there is a value we have an old entry
191 for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
192 if ($key eq "AR_paid") {
194 $form->{"AR_paid_$j"} =
195 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
198 $form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
199 $form->{"datepaid_$j"} =
200 $form->{acc_trans}{$key}->[$i - 1]->{transdate};
201 $form->{"source_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
202 $form->{"memo_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
204 $form->{"forex_$j"} = $form->{"exchangerate_$i"} =
205 $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
206 $form->{"AR_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}";
207 $form->{paidaccounts}++;
213 if ($key eq "AR_tax" || $key eq "AP_tax") {
214 $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
215 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
216 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} =
218 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
221 if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
223 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
225 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
228 $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
230 $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
232 $index = $form->{acc_trans}{$key}->[$i - 1]->{index};
233 $form->{"tax_$index"} = $form->{acc_trans}{$key}->[$i - 1]->{amount};
234 $totaltax += $form->{"tax_$index"};
238 $form->{"${akey}_$k"} =
240 $form->{acc_trans}{$key}->[$i - 1]->{amount} / $exchangerate,
242 if ($akey eq 'amount') {
244 $totalamount += $form->{"${akey}_$i"};
246 $form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"} =
247 "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}";
248 $form->{taxrate} = $form->{acc_trans}{$key}->[$i - 1]->{rate};
249 $form->{"project_id_$k"} =
250 "$form->{acc_trans}{$key}->[$i-1]->{project_id}";
252 $form->{"${key}_$k"} =
253 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
254 $form->{"${key}_$i"} =
255 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
256 my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description});
257 $form->{"select${key}"} =~
258 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)\">$form->{acc_trans}{$key}->[$i-1]->{accno}--${q_description}<\/option>\n/;
259 $form->{"${key}_$k"} = $1;
260 if ($akey eq 'amount') {
261 $form->{"taxchart_$k"} = $form->{taxchart};
262 $form->{"taxchart_$k"} =~
263 /<option value=\"($form->{acc_trans}{$key}->[$i-1]->{id}--[^\"]*)/;
264 $form->{"taxchart_$k"} = $1;
271 $form->{taxincluded} = $taxincluded if ($form->{id});
272 $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
274 if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
276 # add tax to amounts and invtotal
277 for $i (1 .. $form->{rowcount}) {
279 ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
280 $tax = $form->round_amount($taxamount, 2);
281 $diff += ($taxamount - $tax);
282 $form->{"amount_$i"} += $form->{"tax_$i"};
284 $form->{amount_1} += $form->round_amount($diff, 2);
287 $taxamount = $form->round_amount($taxamount, 2);
288 $form->{tax} = $taxamount;
290 $form->{invtotal} = $totalamount + $totaltax;
293 ($form->datetonum($form->{transdate}, \%myconfig) <=
294 $form->datetonum($form->{closedto}, \%myconfig));
296 $form->{"ARselected"} = $form->{"AR_1"};
298 $lxdebug->leave_sub();
302 $lxdebug->enter_sub();
304 $title = $form->{title};
305 $form->{title} = $locale->text("$title Accounts Receivables Transaction");
307 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
309 # $locale->text('Add Accounts Receivables Transaction')
310 # $locale->text('Edit Accounts Receivables Transaction')
311 $form->{javascript} = qq|<script type="text/javascript">
313 function setTaxkey(accno, row) {
314 var taxkey = accno.options[accno.selectedIndex].value;
315 var reg = /--([0-9]*)/;
316 var found = reg.exec(taxkey);
317 var index = found[1];
318 index = parseInt(index);
319 var tax = 'taxchart_' + row;
320 for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
321 var reg2 = new RegExp("^"+ index, "");
322 if (reg2.exec(document.getElementById(tax).options[i].value)) {
323 document.getElementById(tax).options[i].selected = true;
331 $readonly = ($form->{id}) ? "readonly" : "";
334 ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
335 $readonly = ($form->{radier}) ? "" : $readonly;
337 my $ARselected_quoted = quotemeta($form->{"ARselected"});
338 $form->{selectAR} = $form->{AR};
340 s/value=\"${ARselected_quoted}\"/value=\"$form->{ARselected}\" selected/;
342 # set option selected
343 foreach $item (qw(customer currency department employee)) {
344 $form->{"select$item"} =~ s/ selected//;
345 $form->{"select$item"} =~
346 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
348 $selectAR_amount_unquoted = $form->{selectAR_amount};
349 $taxchart = $form->{taxchart};
350 map { $form->{$_} =~ s/\"/"/g }
351 qw(AR_amount selectAR_amount AR taxchart);
354 $form->{exchangerate} =
355 $form->format_amount(\%myconfig, $form->{exchangerate});
357 $form->{creditlimit} =
358 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
359 $form->{creditremaining} =
360 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
363 <input type=hidden name=forex value=$form->{forex}>
365 if ($form->{currency} ne $form->{defaultcurrency}) {
366 if ($form->{forex}) {
368 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
369 <td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td>
373 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
374 <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
383 <td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
384 <th align=left nowrap>| . $locale->text('Tax Included') . qq|</th>
388 if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) {
392 qq|<textarea name=notes rows=$rows cols=50 wrap=soft>$form->{notes}</textarea>|;
396 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
397 <td colspan=3><select name=department>$form->{selectdepartment}</select>
398 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
401 | if $form->{selectdepartment};
403 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
406 ($form->{selectcustomer})
407 ? qq|<select name=customer>$form->{selectcustomer}</select>|
408 : qq|<input name=customer value="$form->{customer}" size=35>|;
411 <input type=hidden name=employee value="$form->{employee}">
414 if ($form->{selectemployee}) {
417 <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
418 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
419 <input type=hidden name=selectemployee value="$form->{selectemployee}">
424 my @old_project_ids = ();
425 map({ push(@old_project_ids, $form->{"project_id_$_"})
426 if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
428 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
430 "old_id" => \@old_project_ids });
432 my %project_labels = ();
433 my @project_values = ("");
434 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
435 push(@project_values, $item->{"id"});
436 $project_labels{$item->{"id"}} = $item->{"projectnumber"};
439 $form->{fokus} = "arledger.customer";
441 # use JavaScript Calendar or not
442 $form->{jsscript} = $jscalendar;
444 if ($form->{jsscript}) {
446 # with JavaScript Calendar
448 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
449 <td><input type=button name=transdate id="trigger1" value=|
450 . $locale->text('button') . qq|></td>
453 <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
454 <td><input type=button name=duedate id="trigger2" value=|
455 . $locale->text('button') . qq|></td></td>
460 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
461 "duedate", "BL", "trigger2");
464 # without JavaScript Calendar
466 qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
468 qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
474 <body onLoad="fokus()">
476 <form method=post name="arledger" action=$form->{script}>
478 <input type=hidden name=id value=$form->{id}>
479 <input type=hidden name=sort value=$form->{sort}>
480 <input type=hidden name=closedto value=$form->{closedto}>
481 <input type=hidden name=locked value=$form->{locked}>
482 <input type=hidden name=title value="$title">
486 <th class=listtop>$form->{title}</th>
496 <th align="right" nowrap>| . $locale->text('Customer') . qq|</th>
497 <td colspan=3>$customer</td>
498 <input type=hidden name=selectcustomer value="$form->{selectcustomer}">
499 <input type=hidden name=oldcustomer value="$form->{oldcustomer}">
500 <input type=hidden name=customer_id value="$form->{customer_id}">
501 <input type=hidden name=terms value=$form->{terms}>
508 <th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th>
509 <td>$form->{creditlimit}</td>
510 <th align=left nowrap>| . $locale->text('Remaining') . qq|</th>
511 <td class="plus$n">$form->{creditremaining}</td>
512 <input type=hidden name=creditlimit value=$form->{creditlimit}>
513 <input type=hidden name=creditremaining value=$form->{creditremaining}>
519 <th align=right>| . $locale->text('Currency') . qq|</th>
520 <td><select name=currency>$form->{selectcurrency}</select></td>
521 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
522 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
523 <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
524 <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
535 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
536 <td><input name=invnumber size=11 value="$form->{invnumber}"></td>
539 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
540 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
543 <th align=right nowrap>| . $locale->text('Invoice Date') . qq|</th>
547 <th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
558 <input type=hidden name=selectAR_amount value="$form->{selectAR_amount}">
559 <input type=hidden name=AR_amount value="$form->{AR_amount}">
560 <input type=hidden name=taxchart value="$form->{taxchart}">
561 <input type=hidden name=rowcount value=$form->{rowcount}>
565 <tr class=listheading>
566 <th class=listheading style="width:15%">|
567 . $locale->text('Account') . qq|</th>
568 <th class=listheading style="width:10%">|
569 . $locale->text('Amount') . qq|</th>
570 <th class=listheading style="width:10%">|
571 . $locale->text('Tax') . qq|</th>
572 <th class=listheading style="width:5%">|
573 . $locale->text('Korrektur') . qq|</th>
574 <th class=listheading style="width:10%">|
575 . $locale->text('Taxkey') . qq|</th>
576 <th class=listheading style="width:10%">|
577 . $locale->text('Project') . qq|</th>
581 $amount = $locale->text('Amount');
582 $project = $locale->text('Project');
584 for $i (1 .. $form->{rowcount}) {
587 $form->{"amount_$i"} =
588 $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
589 $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
590 $selectAR_amount = $selectAR_amount_unquoted;
592 s/option value=\"$form->{"AR_amount_$i"}\"/option value=\"$form->{"AR_amount_$i"}\" selected/;
594 $tax_selected = $form->{"taxchart_$i"};
595 $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
597 qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
598 $korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : '');
601 NTI($cgi->popup_menu('-name' => "project_id_$i",
602 '-values' => \@project_values,
603 '-labels' => \%project_labels,
604 '-default' => $form->{"project_id_$i"} ));
608 <td width=50%><select name="AR_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAR_amount</select></td>
609 <td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
610 <td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
611 <td><input type="checkbox" name="korrektur_$i" value="1" $korrektur_checked></td>
613 <td>$projectnumber</td>
620 $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
629 <td><select name=ARselected>$form->{selectAR}</select></td>
630 <input type=hidden name=AR value="$form->{AR}">
631 <th align=left>$form->{invtotal}</th>
633 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
634 <input type=hidden name=oldtotalpaid value=$form->{oldtotalpaid}>
636 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
649 <th align=left width=1%>| . $locale->text('Notes') . qq|</th>
650 <td align=left>$notes</td>
658 <tr class=listheading>
659 <th colspan=6 class=listheading>|
660 . $locale->text('Incoming Payments') . qq|</th>
664 if ($form->{currency} eq $form->{defaultcurrency}) {
665 @column_index = qw(datepaid source memo paid AR_paid);
667 @column_index = qw(datepaid source memo paid exchangerate AR_paid);
670 $column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
671 $column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
672 $column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
673 $column_data{AR_paid} = "<th>" . $locale->text('Account') . "</th>";
674 $column_data{source} = "<th>" . $locale->text('Source') . "</th>";
675 $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
680 map { print "$column_data{$_}\n" } @column_index;
686 $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
687 for $i (1 .. $form->{paidaccounts}) {
692 $form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
693 $form->{"selectAR_paid_$i"} =~
694 s/option value=\"$form->{"AR_paid_$i"}\">/option value=\"$form->{"AR_paid_$i"}\" selected>/;
697 if ($form->{"paid_$i"}) {
699 $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
701 $form->{"exchangerate_$i"} =
702 $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
704 $exchangerate = qq| |;
705 if ($form->{currency} ne $form->{defaultcurrency}) {
706 if ($form->{"forex_$i"}) {
708 qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
711 qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
716 <input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
720 qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
721 $column_data{AR_paid} =
722 qq|<td align=center><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
723 $column_data{exchangerate} = qq|<td align=center>$exchangerate</td>|;
724 $column_data{datepaid} =
725 qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 value=$form->{"datepaid_$i"}>
726 <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
727 $column_data{source} =
728 qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
730 qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
732 map { print qq|$column_data{$_}\n| } @column_index;
737 push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
739 map { $form->{$_} =~ s/\"/"/g } qw(selectAR_paid);
741 print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
743 <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
744 <input type=hidden name=selectAR_paid value="$form->{selectAR_paid}">
750 <td><hr size=3 noshade></td>
755 $lxdebug->leave_sub();
759 $lxdebug->enter_sub();
763 <input name=callback type=hidden value="$form->{callback}">
765 <input type=hidden name=path value=$form->{path}>
766 <input type=hidden name=login value=$form->{login}>
767 <input type=hidden name=password value=$form->{password}>
772 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
773 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
776 if ($form->{radier}) {
777 print qq|<input class=submit type=submit name=action value="|
778 . $locale->text('Update') . qq|">
782 <input class=submit type=submit name=action value="|
783 . $locale->text('Post') . qq|">
784 <input class=submit type=submit name=action value="|
785 . $locale->text('Delete') . qq|">
788 if ($transdate > $closedto) {
790 <input class=submit type=submit name=action value="|
791 . $locale->text('Use As Template') . qq|">
795 <input class=submit type=submit name=action value="|
796 . $locale->text('Post Payment') . qq|">
800 if ($transdate > $closedto) {
801 print qq|<input class=submit type=submit name=action value="|
802 . $locale->text('Update') . qq|">
803 <input class=submit type=submit name=action value="|
804 . $locale->text('Post') . qq|">|;
815 $lxdebug->leave_sub();
819 $lxdebug->enter_sub();
827 $form->{invtotal} = 0;
829 # $form->{selectAR_amount} = $form->{AR_amount};
830 # $form->{selectAR_amount} =~
831 # s/value=\"$form->{AR_amountselected}\"/value=\"$form->{AR_amountselected}\" selected/;
833 ($AR_amountaccno, $AR_amounttaxkey) =
834 split(/--/, $form->{AR_amountselected});
835 $form->{selecttaxchart} = $form->{taxchart};
836 $form->{selecttaxchart} =~
837 s/value=\"$AR_amounttaxkey--([^\"]*)\"/value=\"$AR_amounttaxkey--$1\" selected/;
841 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
842 qw(exchangerate creditlimit creditremaining);
844 @flds = qw(amount AR_amount projectnumber oldprojectnumber project_id);
848 for $i (1 .. $form->{rowcount}) {
849 $form->{"amount_$i"} =
850 $form->parse_amount(\%myconfig, $form->{"amount_$i"});
851 $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
852 if ($form->{"amount_$i"}) {
855 if (!$form->{"korrektur_$i"}) {
856 ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
858 if ($form->{taxincluded}) {
859 $form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate;
861 $form->{"tax_$i"} = $form->{"amount_$i"} * $rate;
864 $form->{"tax_$i"} = 0;
867 $form->{"tax_$i"} = $form->round_amount($form->{"tax_$i"}, 2);
869 $totaltax += $form->{"tax_$i"};
870 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
875 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
876 $form->{rowcount} = $count + 1;
877 map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount});
879 $form->{exchangerate} = $exchangerate
883 $form->check_exchangerate(
884 \%myconfig, $form->{currency}, $form->{transdate}, 'buy'
887 $form->{invdate} = $form->{transdate};
888 $save_AR = $form->{AR};
889 &check_name(customer);
890 $form->{AR} = $save_AR;
893 ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
895 for $i (1 .. $form->{paidaccounts}) {
896 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
899 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
900 } qw(paid exchangerate);
902 $totalpaid += $form->{"paid_$i"};
904 $form->{"exchangerate_$i"} = $exchangerate
906 $form->{"forex_$i"} = (
908 $form->check_exchangerate(
909 \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'
914 $form->{creditremaining} -=
915 ($form->{invtotal} - $totalpaid + $form->{oldtotalpaid} -
916 $form->{oldinvtotal});
917 $form->{oldinvtotal} = $form->{invtotal};
918 $form->{oldtotalpaid} = $totalpaid;
922 $lxdebug->leave_sub();
926 $lxdebug->enter_sub();
927 for $i (1 .. $form->{paidaccounts}) {
928 if ($form->{"paid_$i"}) {
929 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
931 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
933 $form->error($locale->text('Cannot post payment for a closed period!'))
934 if ($datepaid <= $closedto);
936 if ($form->{currency} ne $form->{defaultcurrency}) {
937 $form->{"exchangerate_$i"} = $form->{exchangerate}
938 if ($invdate == $datepaid);
939 $form->isblank("exchangerate_$i",
940 $locale->text('Exchangerate for payment missing!'));
945 ($form->{AR}) = split /--/, $form->{AR};
946 ($form->{AR_paid}) = split /--/, $form->{AR_paid};
947 $form->redirect($locale->text(' Payment posted!'))
948 if (AR->post_payment(\%myconfig, \%$form));
949 $form->error($locale->text('Cannot post payment!'));
952 $lxdebug->leave_sub();
956 $lxdebug->enter_sub();
958 # check if there is an invoice number, invoice and due date
959 $form->isblank("transdate", $locale->text('Invoice Date missing!'));
960 $form->isblank("duedate", $locale->text('Due Date missing!'));
961 $form->isblank("customer", $locale->text('Customer missing!'));
963 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
964 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
966 $form->error($locale->text('Cannot post transaction for a closed period!'))
967 if ($transdate <= $closedto);
969 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
970 if ($form->{currency} ne $form->{defaultcurrency});
974 for $i (1 .. $form->{paidaccounts}) {
975 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
976 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
978 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
980 $form->error($locale->text('Cannot post payment for a closed period!'))
981 if ($datepaid <= $closedto);
983 if ($form->{currency} ne $form->{defaultcurrency}) {
984 $form->{"exchangerate_$i"} = $form->{exchangerate}
985 if ($transdate == $datepaid);
986 $form->isblank("exchangerate_$i",
987 $locale->text('Exchangerate for payment missing!'));
992 # if oldcustomer ne customer redo form
993 ($customer) = split /--/, $form->{customer};
994 if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
999 ($creditaccno, $credittaxkey) = split /--/, $form->{AR_amountselected};
1000 ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
1001 ($receivablesaccno, $payablestaxkey) = split /--/, $form->{ARselected};
1002 $form->{AR}{amount_1} = $creditaccno;
1003 $form->{AR}{receivables} = $receivablesaccno;
1004 $form->{taxkey} = $taxkey;
1006 $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber")
1007 unless $form->{invnumber};
1009 $form->{id} = 0 if $form->{postasnew};
1011 $form->redirect($locale->text('Transaction posted!'))
1012 if (AR->post_transaction(\%myconfig, \%$form));
1013 $form->error($locale->text('Cannot post transaction!'));
1015 $lxdebug->leave_sub();
1019 $lxdebug->enter_sub();
1021 $form->{postasnew} = 1;
1024 $lxdebug->leave_sub();
1027 sub use_as_template {
1028 $lxdebug->enter_sub();
1030 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);
1031 $form->{paidaccounts} = 1;
1032 $form->{rowcount}--;
1033 $form->{invdate} = $form->current_date(\%myconfig);
1036 $lxdebug->leave_sub();
1040 $lxdebug->enter_sub();
1042 $form->{title} = $locale->text('Confirm!');
1046 delete $form->{header};
1051 <form method=post action=$form->{script}>
1054 foreach $key (keys %$form) {
1055 $form->{$key} =~ s/\"/"/g;
1056 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1060 <h2 class=confirm>$form->{title}</h2>
1063 . $locale->text('Are you sure you want to delete Transaction')
1064 . qq| $form->{invnumber}</h4>
1066 <input name=action class=submit type=submit value="|
1067 . $locale->text('Yes') . qq|">
1074 $lxdebug->leave_sub();
1078 $lxdebug->enter_sub();
1080 $form->redirect($locale->text('Transaction deleted!'))
1081 if (AR->delete_transaction(\%myconfig, \%$form, $spool));
1082 $form->error($locale->text('Cannot delete transaction!'));
1084 $lxdebug->leave_sub();
1088 $lxdebug->enter_sub();
1090 # setup customer selection
1091 $form->all_vc(\%myconfig, "customer", "AR");
1093 if (@{ $form->{all_customer} }) {
1094 map { $customer .= "<option>$_->{name}--$_->{id}\n" }
1095 @{ $form->{all_customer} };
1096 $customer = qq|<select name=customer><option>\n$customer</select>|;
1098 $customer = qq|<input name=customer size=35>|;
1102 if (@{ $form->{all_departments} }) {
1103 $form->{selectdepartment} = "<option>\n";
1106 $form->{selectdepartment} .=
1107 "<option>$_->{description}--$_->{id}\n"
1108 } (@{ $form->{all_departments} });
1113 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1114 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1116 | if $form->{selectdepartment};
1118 $form->{title} = $locale->text('AR Transactions');
1120 # use JavaScript Calendar or not
1121 $form->{jsscript} = $jscalendar;
1123 if ($form->{jsscript}) {
1125 # with JavaScript Calendar
1127 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1128 <input type=button name=transdatefrom id="trigger1" value=|
1129 . $locale->text('button') . qq|></td>
1132 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1133 <input type=button name=transdateto name=transdateto id="trigger2" value=|
1134 . $locale->text('button') . qq|></td>
1139 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1",
1140 "transdateto", "BL", "trigger2");
1143 # without JavaScript Calendar
1145 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1147 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1150 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1155 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1156 push(@values, $item->{"id"});
1157 $labels{$item->{"id"}} = $item->{"projectnumber"};
1160 NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1161 '-labels' => \%labels));
1163 $form->{fokus} = "search.customer";
1167 <body onLoad="fokus()">
1169 <form method=post name="search" action=$form->{script}>
1172 <tr><th class=listtop>$form->{title}</th></tr>
1173 <tr height="5"></tr>
1178 <th align=right>| . $locale->text('Customer') . qq|</th>
1179 <td colspan=3>$customer</td>
1183 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
1184 <td colspan=3><input name=invnumber size=20></td>
1187 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
1188 <td colspan=3><input name=ordnumber size=20></td>
1191 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
1192 <td colspan=3><input name=notes size=40></td>
1195 <th align="right">| . $locale->text("Project Number") . qq|</th>
1196 <td colspan="3">$projectnumber</td>
1199 <th align=right nowrap>| . $locale->text('From') . qq|</th>
1201 <th align=right>| . $locale->text('Bis') . qq|</th>
1204 <input type=hidden name=sort value=transdate>
1212 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
1216 <td align=right><input name=open class=checkbox type=checkbox value=Y checked></td>
1217 <td nowrap>| . $locale->text('Open') . qq|</td>
1218 <td align=right><input name=closed class=checkbox type=checkbox value=Y></td>
1219 <td nowrap>| . $locale->text('Closed') . qq|</td>
1222 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
1223 <td nowrap>| . $locale->text('ID') . qq|</td>
1224 <td align=right><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
1225 <td nowrap>| . $locale->text('Invoice Number') . qq|</td>
1226 <td align=right><input name="l_ordnumber" class=checkbox type=checkbox value=Y></td>
1227 <td nowrap>| . $locale->text('Order Number') . qq|</td>
1228 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
1229 <td nowrap>| . $locale->text('Invoice Date') . qq|</td>
1232 <td align=right><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
1233 <td nowrap>| . $locale->text('Customer') . qq|</td>
1234 <td align=right><input name="l_netamount" class=checkbox type=checkbox value=Y></td>
1235 <td nowrap>| . $locale->text('Amount') . qq|</td>
1236 <td align=right><input name="l_tax" class=checkbox type=checkbox value=Y></td>
1237 <td nowrap>| . $locale->text('Tax') . qq|</td>
1238 <td align=right><input name="l_amount" class=checkbox type=checkbox value=Y checked></td>
1239 <td nowrap>| . $locale->text('Total') . qq|</td>
1242 <td align=right><input name="l_datepaid" class=checkbox type=checkbox value=Y></td>
1243 <td nowrap>| . $locale->text('Date Paid') . qq|</td>
1244 <td align=right><input name="l_paid" class=checkbox type=checkbox value=Y checked></td>
1245 <td nowrap>| . $locale->text('Paid') . qq|</td>
1246 <td align=right><input name="l_duedate" class=checkbox type=checkbox value=Y></td>
1247 <td nowrap>| . $locale->text('Due Date') . qq|</td>
1248 <td align=right><input name="l_due" class=checkbox type=checkbox value=Y></td>
1249 <td nowrap>| . $locale->text('Amount Due') . qq|</td>
1252 <td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
1253 <td nowrap>| . $locale->text('Notes') . qq|</td>
1254 <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
1255 <td nowrap>| . $locale->text('Salesperson') . qq|</td>
1256 <td align=right><input name="l_shippingpoint" class=checkbox type=checkbox value=Y></td>
1257 <td nowrap>| . $locale->text('Shipping Point') . qq|</td>
1258 <td align=right><input name="l_shipvia" class=checkbox type=checkbox value=Y></td>
1259 <td nowrap>| . $locale->text('Ship via') . qq|</td>
1262 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
1263 <td nowrap>| . $locale->text('Subtotal') . qq|</td>
1264 <td align=right><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y></td>
1265 <td nowrap>| . $locale->text('Project Number') . qq|</td>
1274 <td><hr size=3 noshade></td>
1278 <input type=hidden name=nextsub value=$form->{nextsub}>
1280 <input type=hidden name=path value=$form->{path}>
1281 <input type=hidden name=login value=$form->{login}>
1282 <input type=hidden name=password value=$form->{password}>
1285 <input class=submit type=submit name=action value="|
1286 . $locale->text('Continue') . qq|">
1297 $lxdebug->leave_sub();
1300 sub ar_transactions {
1301 $lxdebug->enter_sub();
1303 $form->{customer} = $form->unescape($form->{customer});
1304 ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer});
1306 AR->ar_transactions(\%myconfig, \%$form);
1309 "$form->{script}?action=ar_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1312 if ($form->{customer}) {
1313 $callback .= "&customer=" . $form->escape($form->{customer}, 1);
1314 $href .= "&customer=" . $form->escape($form->{customer});
1315 $option = $locale->text('Customer') . " : $form->{customer}";
1317 if ($form->{department}) {
1318 $callback .= "&department=" . $form->escape($form->{department}, 1);
1319 $href .= "&department=" . $form->escape($form->{department});
1320 ($department) = split /--/, $form->{department};
1321 $option .= "\n<br>" if ($option);
1322 $option .= $locale->text('Department') . " : $department";
1324 if ($form->{invnumber}) {
1325 $callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1);
1326 $href .= "&invnumber=" . $form->escape($form->{invnumber});
1327 $option .= "\n<br>" if ($option);
1328 $option .= $locale->text('Invoice Number') . " : $form->{invnumber}";
1330 if ($form->{ordnumber}) {
1331 $callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1);
1332 $href .= "&ordnumber=" . $form->escape($form->{ordnumber});
1333 $option .= "\n<br>" if ($option);
1334 $option .= $locale->text('Order Number') . " : $form->{ordnumber}";
1336 if ($form->{notes}) {
1337 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
1338 $href .= "¬es=" . $form->escape($form->{notes});
1339 $option .= "\n<br>" if $option;
1340 $option .= $locale->text('Notes') . " : $form->{notes}";
1343 if ($form->{transdatefrom}) {
1344 $callback .= "&transdatefrom=$form->{transdatefrom}";
1345 $href .= "&transdatefrom=$form->{transdatefrom}";
1346 $option .= "\n<br>" if ($option);
1348 $locale->text('From') . " "
1349 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1351 if ($form->{transdateto}) {
1352 $callback .= "&transdateto=$form->{transdateto}";
1353 $href .= "&transdateto=$form->{transdateto}";
1354 $option .= "\n<br>" if ($option);
1356 $locale->text('Bis') . " "
1357 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1359 if ($form->{open}) {
1360 $callback .= "&open=$form->{open}";
1361 $href .= "&open=$form->{open}";
1362 $option .= "\n<br>" if ($option);
1363 $option .= $locale->text('Open');
1365 if ($form->{closed}) {
1366 $callback .= "&closed=$form->{closed}";
1367 $href .= "&closed=$form->{closed}";
1368 $option .= "\n<br>" if ($option);
1369 $option .= $locale->text('Closed');
1371 if ($form->{globalproject_id}) {
1372 $callback .= "&globalproject_id=" . E($form->{globalproject_id});
1373 $href .= "&globalproject_id=" . E($form->{globalproject_id});
1377 qw(transdate id type invnumber ordnumber name netamount tax amount paid
1378 datepaid due duedate notes employee shippingpoint shipvia
1379 globalprojectnumber);
1381 $form->{"l_type"} = "Y";
1383 foreach $item (@columns) {
1384 if ($form->{"l_$item"} eq "Y") {
1385 push @column_index, $item;
1387 # add column to href and callback
1388 $callback .= "&l_$item=Y";
1389 $href .= "&l_$item=Y";
1393 if ($form->{l_subtotal} eq 'Y') {
1394 $callback .= "&l_subtotal=Y";
1395 $href .= "&l_subtotal=Y";
1398 $column_header{id} =
1399 "<th><a class=listheading href=$href&sort=id>"
1400 . $locale->text('ID')
1402 $column_header{transdate} =
1403 "<th><a class=listheading href=$href&sort=transdate>"
1404 . $locale->text('Date')
1406 $column_header{duedate} =
1407 "<th><a class=listheading href=$href&sort=duedate>"
1408 . $locale->text('Due Date')
1410 $column_header{type} =
1411 "<th class=\"listheading\">" . $locale->text('Type') . "</th>";
1412 $column_header{invnumber} =
1413 "<th><a class=listheading href=$href&sort=invnumber>"
1414 . $locale->text('Invoice')
1416 $column_header{ordnumber} =
1417 "<th><a class=listheading href=$href&sort=ordnumber>"
1418 . $locale->text('Order')
1420 $column_header{name} =
1421 "<th><a class=listheading href=$href&sort=name>"
1422 . $locale->text('Customer')
1424 $column_header{netamount} =
1425 "<th class=listheading>" . $locale->text('Amount') . "</th>";
1426 $column_header{tax} =
1427 "<th class=listheading>" . $locale->text('Tax') . "</th>";
1428 $column_header{amount} =
1429 "<th class=listheading>" . $locale->text('Total') . "</th>";
1430 $column_header{paid} =
1431 "<th class=listheading>" . $locale->text('Paid') . "</th>";
1432 $column_header{datepaid} =
1433 "<th><a class=listheading href=$href&sort=datepaid>"
1434 . $locale->text('Date Paid')
1436 $column_header{due} =
1437 "<th class=listheading>" . $locale->text('Amount Due') . "</th>";
1438 $column_header{notes} =
1439 "<th class=listheading>" . $locale->text('Notes') . "</th>";
1440 $column_header{employee} =
1441 "<th><a class=listheading href=$href&sort=employee>"
1442 . $locale->text('Salesperson') . "</th>";
1444 $column_header{shippingpoint} =
1445 "<th><a class=listheading href=$href&sort=shippingpoint>"
1446 . $locale->text('Shipping Point')
1448 $column_header{shipvia} =
1449 "<th><a class=listheading href=$href&sort=shipvia>"
1450 . $locale->text('Ship via')
1452 $column_header{globalprojectnumber} =
1453 qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1455 $form->{title} = $locale->text('AR Transactions');
1464 <th class=listtop>$form->{title}</th>
1466 <tr height="5"></tr>
1473 <tr class=listheading>
1476 map { print "\n$column_header{$_}" } @column_index;
1482 # add sort and escape callback, this one we use for the add sub
1483 $form->{callback} = $callback .= "&sort=$form->{sort}";
1485 # escape callback for href
1486 $callback = $form->escape($callback);
1488 if (@{ $form->{AR} }) {
1489 $sameitem = $form->{AR}->[0]->{ $form->{sort} };
1492 # sums and tax on reports by Antonio Gallardo
1494 foreach $ar (@{ $form->{AR} }) {
1496 if ($form->{l_subtotal} eq 'Y') {
1497 if ($sameitem ne $ar->{ $form->{sort} }) {
1502 $column_data{netamount} =
1504 . $form->format_amount(\%myconfig, $ar->{netamount}, 2, " ")
1506 $column_data{tax} = "<td align=right>"
1507 . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{netamount},
1510 $column_data{amount} =
1512 . $form->format_amount(\%myconfig, $ar->{amount}, 2, " ") . "</td>";
1513 $column_data{paid} =
1515 . $form->format_amount(\%myconfig, $ar->{paid}, 2, " ") . "</td>";
1516 $column_data{due} = "<td align=right>"
1517 . $form->format_amount(\%myconfig, $ar->{amount} - $ar->{paid},
1521 $subtotalnetamount += $ar->{netamount};
1522 $subtotalamount += $ar->{amount};
1523 $subtotalpaid += $ar->{paid};
1524 $subtotaldue += $ar->{amount} - $ar->{paid};
1526 $totalnetamount += $ar->{netamount};
1527 $totalamount += $ar->{amount};
1528 $totalpaid += $ar->{paid};
1529 $totaldue += ($ar->{amount} - $ar->{paid});
1531 $column_data{transdate} = "<td>$ar->{transdate} </td>";
1532 $column_data{id} = "<td>$ar->{id}</td>";
1533 $column_data{datepaid} = "<td>$ar->{datepaid} </td>";
1534 $column_data{duedate} = "<td>$ar->{duedate} </td>";
1536 $module = ($ar->{invoice}) ? "is.pl" : $form->{script};
1538 $column_data{invnumber} =
1539 "<td><a href=$module?action=edit&id=$ar->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}</a></td>";
1540 $column_data{type} = "<td>" .
1541 ($ar->{storno} ? $locale->text("Storno (one letter abbreviation)") :
1543 $locale->text("Credit note (one letter abbreviation)") :
1544 $locale->text("Invoice (one letter abbreviation)")) . "</td>";
1545 $column_data{ordnumber} = "<td>$ar->{ordnumber} </td>";
1546 $column_data{name} = "<td>$ar->{name}</td>";
1547 $ar->{notes} =~ s/\r\n/<br>/g;
1548 $column_data{notes} = "<td>$ar->{notes} </td>";
1549 $column_data{shippingpoint} = "<td>$ar->{shippingpoint} </td>";
1550 $column_data{shipvia} = "<td>$ar->{shipvia} </td>";
1551 $column_data{employee} = "<td>$ar->{employee} </td>";
1552 $column_data{globalprojectnumber} =
1553 "<td>" . H($ar->{globalprojectnumber}) . "</td>";
1558 <tr class=listrow$i>
1561 map { print "\n$column_data{$_}" } @column_index;
1569 if ($form->{l_subtotal} eq 'Y') {
1575 <tr class=listtotal>
1578 map { $column_data{$_} = "<td> </td>" } @column_index;
1580 $column_data{netamount} =
1581 "<th class=listtotal align=right>"
1582 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1583 $column_data{tax} = "<th class=listtotal align=right>"
1584 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1587 $column_data{amount} =
1588 "<th class=listtotal align=right>"
1589 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1590 $column_data{paid} =
1591 "<th class=listtotal align=right>"
1592 . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>";
1594 "<th class=listtotal align=right>"
1595 . $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>";
1597 map { print "\n$column_data{$_}" } @column_index;
1605 <td><hr size=3 noshade></td>
1610 <form method=post action=$form->{script}>
1612 <input name=callback type=hidden value="$form->{callback}">
1614 <input type=hidden name=path value=$form->{path}>
1615 <input type=hidden name=login value=$form->{login}>
1616 <input type=hidden name=password value=$form->{password}>
1618 <input class=submit type=submit name=action value="|
1619 . $locale->text('AR Transaction') . qq|">
1620 <input class=submit type=submit name=action value="|
1621 . $locale->text('Sales Invoice') . qq|">
1629 $lxdebug->leave_sub();
1633 $lxdebug->enter_sub();
1635 map { $column_data{$_} = "<td> </td>" } @column_index;
1637 $column_data{tax} = "<th class=listsubtotal align=right>"
1638 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1641 $column_data{amount} =
1642 "<th class=listsubtotal align=right>"
1643 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1644 $column_data{paid} =
1645 "<th class=listsubtotal align=right>"
1646 . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>";
1648 "<th class=listsubtotal align=right>"
1649 . $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>";
1651 $subtotalnetamount = 0;
1652 $subtotalamount = 0;
1656 $sameitem = $ar->{ $form->{sort} };
1658 print "<tr class=listsubtotal>";
1660 map { print "\n$column_data{$_}" } @column_index;
1666 $lxdebug->leave_sub();