1 # #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger, Accounting
9 # Copyright (c) 1998-2003
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 #======================================================================
40 require "$form->{path}/io.pl";
41 require "$form->{path}/arap.pl";
48 # $locale->text('Edit the purchase_order');
49 # $locale->text('Edit the sales_order');
50 # $locale->text('Edit the request_quotation');
51 # $locale->text('Edit the sales_quotation');
53 # $locale->text('Workflow purchase_order');
54 # $locale->text('Workflow sales_order');
55 # $locale->text('Workflow request_quotation');
56 # $locale->text('Workflow sales_quotation');
59 $lxdebug->enter_sub();
63 if ($form->{type} eq 'purchase_order') {
64 $form->{title} = $action eq "edit" ?
65 $locale->text('Edit Purchase Order') :
66 $locale->text('Add Purchase Order');
67 $form->{heading} = $locale->text('Purchase Order');
68 $form->{vc} = 'vendor';
70 if ($form->{type} eq 'sales_order') {
71 $form->{title} = $action eq "edit" ?
72 $locale->text('Edit Sales Order') :
73 $locale->text('Add Sales Order');
74 $form->{heading} = $locale->text('Sales Order');
75 $form->{vc} = 'customer';
77 if ($form->{type} eq 'request_quotation') {
78 $form->{title} = $action eq "edit" ?
79 $locale->text('Edit Request for Quotation') :
80 $locale->text('Add Request for Quotation');
81 $form->{heading} = $locale->text('Request for Quotation');
82 $form->{vc} = 'vendor';
84 if ($form->{type} eq 'sales_quotation') {
85 $form->{title} = $action eq "edit" ?
86 $locale->text('Edit Quotation') :
87 $locale->text('Add Quotation');
88 $form->{heading} = $locale->text('Quotation');
89 $form->{vc} = 'customer';
92 $lxdebug->leave_sub();
96 $lxdebug->enter_sub();
101 "$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&path=$form->{path}&password=$form->{password}"
102 unless $form->{callback};
108 $lxdebug->leave_sub();
112 $lxdebug->enter_sub();
113 # show history button
114 $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
115 #/show hhistory button
117 $form->{simple_save} = 0;
119 set_headings("edit");
121 # editing without stuff to edit? try adding it first
122 if ($form->{rowcount}) {
123 map { $id++ if $form->{"multi_id_$_"} } (1 .. $form->{rowcount});
127 undef $form->{rowcount};
129 $lxdebug->leave_sub();
132 } elsif (!$form->{id}) {
134 $lxdebug->leave_sub();
138 if ($form->{print_and_save}) {
139 $form->{action} = "print";
140 $form->{resubmit} = 1;
141 $language_id = $form->{language_id};
142 $printer_id = $form->{printer_id};
145 set_headings("edit");
149 if ($form->{print_and_save}) {
150 $form->{language_id} = $language_id;
151 $form->{printer_id} = $printer_id;
155 $lxdebug->leave_sub();
159 $lxdebug->enter_sub();
161 # get customer/vendor
162 $form->all_vc(\%myconfig, $form->{vc},
163 ($form->{vc} eq 'customer') ? "AR" : "AP");
165 # retrieve order/quotation
166 $form->{webdav} = $webdav;
168 $form->{jscalendar} = $jscalendar;
170 my $editing = $form->{id};
172 OE->retrieve(\%myconfig, \%$form);
174 if ($form->{payment_id}) {
175 $payment_id = $form->{payment_id};
177 if ($form->{language_id}) {
178 $language_id = $form->{language_id};
180 if ($form->{taxzone_id}) {
181 $taxzone_id = $form->{taxzone_id};
184 $salesman_id = $form->{salesman_id} if ($editing);
187 # if multiple rowcounts (== collective order) then check if the
188 # there were more than one customer (in that case OE::retrieve removes
189 # the content from the field)
190 if ( $form->{rowcount}
191 && $form->{type} eq 'sales_order'
192 && defined $form->{customer}
193 && $form->{customer} eq '') {
195 # $main::lxdebug->message(0, "Detected Edit order with concurrent customers");
198 'Collective Orders only work for orders from one customer!')
202 $taxincluded = $form->{taxincluded};
203 $form->{shipto} = 1 if $form->{id};
205 if ($form->{"all_$form->{vc}"}) {
206 unless ($form->{"$form->{vc}_id"}) {
207 $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
211 $cp_id = $form->{cp_id};
212 $intnotes = $form->{intnotes};
214 # get customer / vendor
215 if ($form->{type} =~ /(purchase_order|request_quotation)/) {
216 IR->get_vendor(\%myconfig, \%$form);
218 #quote all_vendor Bug 133
219 foreach $ref (@{ $form->{all_vendor} }) {
220 $ref->{name} = $form->quote($ref->{name});
224 if ($form->{type} =~ /sales_(order|quotation)/) {
225 IS->get_customer(\%myconfig, \%$form);
227 #quote all_vendor Bug 133
228 foreach $ref (@{ $form->{all_customer} }) {
229 $ref->{name} = $form->quote($ref->{name});
233 $form->{cp_id} = $cp_id;
235 $form->{payment_id} = $payment_id;
238 $form->{language_id} = $language_id;
241 $form->{taxzone_id} = $taxzone_id;
243 $form->{intnotes} = $intnotes if $intnotes;
244 ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
245 $form->{"old$form->{vc}"} =
246 qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
248 # build the popup menus
249 if (@{ $form->{"all_$form->{vc}"} }) {
250 $form->{ $form->{vc} } =
251 qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
252 map { $form->{"select$form->{vc}"} .=
253 "<option>$_->{name}--$_->{id}</option>\n" }
254 (@{ $form->{"all_$form->{vc}"} });
258 @curr = split(/:/, $form->{currencies});
260 $form->{defaultcurrency} = $curr[0];
261 $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
263 map { $form->{selectcurrency} .= "<option>$_</option>\n" } @curr;
265 $form->{taxincluded} = $taxincluded if ($form->{id});
268 if (@{ $form->{all_departments} }) {
269 $form->{selectdepartment} = "<option>\n";
270 $form->{department} = "$form->{department}--$form->{department_id}";
273 $form->{selectdepartment} .=
274 "<option>$_->{description}--$_->{id}</option>\n"
275 } (@{ $form->{all_departments} });
278 $form->{employee} = "$form->{employee}--$form->{employee_id}";
281 if (@{ $form->{all_employees} }) {
282 $form->{selectemployee} = "";
283 map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}</option>\n" }
284 (@{ $form->{all_employees} });
288 $form->{forex} = $form->{exchangerate};
290 $form->{salesman_id} = $salesman_id if ($editing);
292 $lxdebug->leave_sub();
296 $lxdebug->enter_sub();
297 $form->{formname} = $form->{type} unless $form->{formname};
300 foreach $ref (@{ $form->{form_details} }) {
301 $form->{rowcount} = ++$i;
303 map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
305 for my $i (1 .. $form->{rowcount}) {
307 $form->{"discount_$i"} =
308 $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
310 $form->{"discount_$i"} =
311 $form->format_amount(\%myconfig, $form->{"discount_$i"});
313 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
315 $decimalplaces = ($dec > 2) ? $dec : 2;
317 # copy reqdate from deliverydate for invoice -> order conversion
318 $form->{"reqdate_$i"} = $form->{"deliverydate_$i"}
319 unless $form->{"reqdate_$i"};
321 $form->{"sellprice_$i"} =
322 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
325 (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
326 $dec_qty = length $dec_qty;
328 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
330 map { $form->{"${_}_$i"} =~ s/\"/"/g }
331 qw(partnumber description unit);
334 $lxdebug->leave_sub();
338 $lxdebug->enter_sub();
340 my $checkedclosed = $form->{"closed"} ? "checked" : "";
341 my $checkeddelivered = $form->{"delivered"} ? "checked" : "";
343 map { $form->{$_} =~ s/\"/"/g }
344 qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname
345 shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact
346 shiptophone shiptofax shiptodepartment_1 shiptodepartment_2);
348 # use JavaScript Calendar or not
349 $form->{jsscript} = $form->{jscalendar};
352 $payment = qq|<option value=""></option>|;
353 foreach $item (@{ $form->{payment_terms} }) {
354 if ($form->{payment_id} eq $item->{id}) {
355 $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
357 $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
360 if ($form->{jsscript}) {
362 # with JavaScript Calendar
364 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
365 <td><input type=button name=transdate id="trigger1" value=|
366 . $locale->text('button') . qq|></td>
369 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>
370 <td width="4"><input type=button name=reqdate name=reqdate id="trigger2" value=|
371 . $locale->text('button') . qq|></td>
376 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
377 "reqdate", "BL", "trigger2");
381 # without JavaScript Calendar
383 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
385 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>|;
390 if (($form->{"type"} eq "sales_order") ||
391 ($form->{"type"} eq "purchase_order")) {
393 <input name="delivered" id="delivered" type="checkbox" class="checkbox" value="1" $checkeddelivered>
394 <label for="delivered">| . $locale->text('Delivered') . qq|</label>|);
399 <input name="closed" id="closed" type="checkbox" class="checkbox" value="1" $checkedclosed>
400 <label for="closed">| . $locale->text('Closed') . qq|</label>|);
406 <td colspan=| . (2 * scalar(@tmp)) . qq| align=center>| . join("\n", @tmp) . qq|
412 # set option selected
413 foreach $item ($form->{vc}, currency, department, employee) {
414 $form->{"select$item"} =~ s/ selected//;
415 $form->{"select$item"} =~
416 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
419 #quote select[customer|vendor] Bug 133
420 $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
422 #substitute \n and \r to \s (bug 543)
423 $form->{"select$form->{vc}"} =~ s/[\n\r]/ /g;
425 my @old_project_ids = ($form->{"globalproject_id"});
426 map({ push(@old_project_ids, $form->{"project_id_$_"})
427 if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
429 $form->get_lists("contacts" => "ALL_CONTACTS",
430 "shipto" => "ALL_SHIPTO",
431 "projects" => { "key" => "ALL_PROJECTS",
433 "old_id" => \@old_project_ids },
434 "employees" => "ALL_SALESMEN");
437 my @values = (undef);
438 foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
439 push(@values, $item->{"cp_id"});
440 $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
441 ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
444 NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
445 '-labels' => \%labels, '-default' => $form->{"cp_id"}));
449 foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
450 push(@values, $item->{"shipto_id"});
451 $labels{$item->{"shipto_id"}} =
452 $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
456 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
458 NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
459 '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
464 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
465 push(@values, $item->{"id"});
466 $labels{$item->{"id"}} = $item->{"projectnumber"};
468 my $globalprojectnumber =
469 NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
470 '-labels' => \%labels,
471 '-default' => $form->{"globalproject_id"}));
474 if ($form->{type} =~ /^sales_/) {
477 foreach my $item (@{ $form->{ALL_SALESMEN} }) {
478 push(@values, $item->{id});
479 $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
484 <th align="right">| . $locale->text('Salesman') . qq|</th>
486 NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
487 '-values' => \@values, '-labels' => \%labels))
492 $form->{exchangerate} =
493 $form->format_amount(\%myconfig, $form->{exchangerate});
495 if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
501 $form->{creditlimit} =
502 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
503 $form->{creditremaining} =
504 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
507 <input type=hidden name=forex value=$form->{forex}>
510 if ($form->{currency} ne $form->{defaultcurrency}) {
511 if ($form->{forex}) {
514 . $locale->text('Exchangerate')
515 . qq|</th><td>$form->{exchangerate}</td>
516 <input type=hidden name=exchangerate value=$form->{exchangerate}>
521 . $locale->text('Exchangerate')
522 . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
526 $vclabel = ucfirst $form->{vc};
527 $vclabel = $locale->text($vclabel);
531 if ($form->{business}) {
534 <th align=right>| . $locale->text('Business') . qq|</th>
535 <td>$form->{business}</td>
536 <th align=right>| . $locale->text('Trade Discount') . qq|</th>
538 . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
544 if ($form->{max_dunning_level}) {
550 <th align=right>| . $locale->text('Max. Dunning Level') . qq|:</th>
551 <td><b>$form->{max_dunning_level}</b></td>
552 <th align=right>| . $locale->text('Dunning Amount') . qq|:</th>
554 . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
563 if (@{ $form->{TAXZONE} }) {
564 $form->{selecttaxzone} = "";
565 foreach $item (@{ $form->{TAXZONE} }) {
566 if ($item->{id} == $form->{taxzone_id}) {
567 $form->{selecttaxzone} .=
568 "<option value=$item->{id} selected>" . H($item->{description}) .
571 $form->{selecttaxzone} .=
572 "<option value=$item->{id}>" . H($item->{description}) . "</option>";
577 $form->{selecttaxzone} =~ s/ selected//g;
578 if ($form->{taxzone_id} ne "") {
579 $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}>/value=$form->{taxzone_id} selected>/;
585 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
586 <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
587 <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
591 if ($form->{type} !~ /_quotation$/) {
594 <th width=70% align=right nowrap>| . $locale->text('Order Number') . qq|</th>
595 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
598 <th width=70% align=right nowrap>|
599 . $locale->text('Quotation Number') . qq|</th>
600 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
603 <th width=70% align=right nowrap>|
604 . $locale->text('Customer Order Number') . qq|</th>
605 <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
608 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
613 <th align=right nowrap=true>| . $locale->text('Required by') . qq|</th>
618 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
620 $creditremaining = qq|
626 <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
627 <td>$form->{creditlimit}</td>
629 <th nowrap>| . $locale->text('Remaining') . qq|</th>
630 <td class="plus$n" nowrap>$form->{creditremaining}</td>
639 ($form->{type} eq 'sales_quotation')
640 ? $locale->text('Valid until')
641 : $locale->text('Required by');
642 if ($form->{type} eq 'sales_quotation') {
645 <th width=70% align=right nowrap>|
646 . $locale->text('Quotation Number') . qq|</th>
647 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
648 <input type=hidden name=ordnumber value="$form->{ordnumber}">
654 <th width=70% align=right nowrap>| . $locale->text('RFQ Number') . qq|</th>
655 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
656 <input type=hidden name=ordnumber value="$form->{ordnumber}">
664 <th align=right nowrap>| . $locale->text('Quotation Date') . qq|</th>
668 <th align=right nowrap=true>$reqlabel</th>
672 $creditremaining = qq| <tr>
679 ($form->{"select$form->{vc}"})
680 ? qq|<select name="$form->{vc}"
681 onchange="document.getElementById('update_button').click();">| .
682 qq|$form->{"select$form->{vc}"}</select>\n<input type=hidden name="select$form->{vc}" value="| .
683 Q($form->{"select$form->{vc}"}) . qq|">|
684 : qq|<input name=$form->{vc} value="$form->{$form->{vc}}" size=35>|;
688 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
689 <td colspan=3><select name=department>$form->{selectdepartment}</select>
690 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
693 | if $form->{selectdepartment};
696 <input type=hidden name=employee value="$form->{employee}">
699 if ($form->{type} eq 'sales_order') {
700 if ($form->{selectemployee}) {
702 <input type=hidden name=customer_klass value=$form->{customer_klass}>
704 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
705 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
706 <input type=hidden name=selectemployee value="$form->{selectemployee}">
713 <input type=hidden name=customer_klass value=$form->{customer_klass}>
715 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
716 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
717 <input type=hidden name=selectemployee value="$form->{selectemployee}">
722 if ($form->{resubmit} && ($form->{format} eq "html")) {
724 qq|window.open('about:blank','Beleg'); document.oe.target = 'Beleg';document.oe.submit()|;
725 } elsif ($form->{resubmit}) {
726 $onload = qq|document.oe.submit()|;
731 $credittext = $locale->text('Credit Limit exceeded!!!');
732 if ($creditwarning) {
733 $onload = qq|alert('$credittext')|;
736 $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
737 # show history button js
738 $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
739 #/show history button js
743 <body onLoad="$onload">
745 <form method=post name=oe action=$form->{script}>
746 <script type="text/javascript" src="js/common.js"></script>
747 <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
748 <script type="text/javascript" src="js/vendor_selection.js"></script>
749 <script type="text/javascript" src="js/calculate_qty.js"></script>
751 <input type=hidden name=id value=$form->{id}>
752 <input type=hidden name=action value=$form->{action}>
754 <input type=hidden name=type value=$form->{type}>
755 <input type=hidden name=formname value=$form->{formname}>
756 <input type=hidden name=media value=$form->{media}>
757 <input type=hidden name=format value=$form->{format}>
758 <input type=hidden name=proforma value=$form->{proforma}>
760 <input type=hidden name=queued value="$form->{queued}">
761 <input type=hidden name=printed value="$form->{printed}">
762 <input type=hidden name=emailed value="$form->{emailed}">
764 <input type=hidden name=vc value=$form->{vc}>
766 <input type=hidden name=title value="$form->{title}">
768 <input type=hidden name=discount value=$form->{discount}>
769 <input type=hidden name=creditlimit value=$form->{creditlimit}>
770 <input type=hidden name=creditremaining value=$form->{creditremaining}>
772 <input type=hidden name=tradediscount value=$form->{tradediscount}>
773 <input type=hidden name=business value=$form->{business}>
774 <input type=hidden name=webdav value=$webdav>
778 <th class=listtop>$form->{title}</th>
788 <th align=right>$vclabel</th>
789 <td colspan=3>$vc</td>
790 <input type=hidden name=$form->{vc}_id value=$form->{"$form->{vc}_id"}>
791 <input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
792 <th align=richt nowrap>|
793 . $locale->text('Contact Person') . qq|</th>
794 <td colspan=3>$contact</td>
802 <th align=right>| . $locale->text('Currency') . qq|</th>
803 <td><select name=currency>$form->{selectcurrency}</select></td>
804 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
805 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
809 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
810 <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
813 <th align=right>| . $locale->text('Ship via') . qq|</th>
814 <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
821 # <button type="button" onclick="delivery_customer_selection_window('delivery_customer_string','delivery_customer_id')">| . $locale->text('Choose Customer') . qq|</button>
823 # <td colspan=2><input type=hidden name=delivery_customer_id value="$form->{delivery_customer_id}">
824 # <input size=45 id=delivery_customer_string name=delivery_customer_string value="$form->{delivery_customer_string}"></td>
828 # <button type="button" onclick="vendor_selection_window('delivery_vendor_string','delivery_vendor_id')">| . $locale->text('Choose Vendor') . qq|</button>
830 # <td colspan=2><input type=hidden name=delivery_vendor_id value="$form->{delivery_vendor_id}">
831 # <input size=45 id=vendor_string name=delivery_vendor_string value="$form->{delivery_vendor_string}"></td>
845 <th width="70%" align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
846 <td>$globalprojectnumber</td>
857 <!-- shipto are in hidden variables -->
859 <input type=hidden name=shiptoname value="$form->{shiptoname}">
860 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
861 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
862 <input type=hidden name=shiptocity value="$form->{shiptocity}">
863 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
864 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
865 <input type=hidden name=shiptophone value="$form->{shiptophone}">
866 <input type=hidden name=shiptofax value="$form->{shiptofax}">
867 <input type=hidden name=shiptodepartment_1 value="$form->{shiptodepartment_1}">
868 <input type=hidden name=shiptodepartment_2 value="$form->{shiptodepartment_2}">
869 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
871 <!-- email variables -->
872 <input type=hidden name=message value="$form->{message}">
873 <input type=hidden name=email value="$form->{email}">
874 <input type=hidden name=subject value="$form->{subject}">
875 <input type=hidden name=cc value="$form->{cc}">
876 <input type=hidden name=bcc value="$form->{bcc}">
878 <input type=hidden name=taxpart value="$form->{taxpart}">
879 <input type=hidden name=taxservice value="$form->{taxservice}">
881 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
884 foreach $item (split / /, $form->{taxaccounts}) {
886 <input type=hidden name="${item}_rate" value=$form->{"${item}_rate"}>
887 <input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
890 $lxdebug->leave_sub();
894 $lxdebug->enter_sub();
896 $form->{invtotal} = $form->{invsubtotal};
898 if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
901 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
904 $rows = ($rows > $introws) ? $rows : $introws;
906 qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
908 qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
910 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
913 if ($form->{taxaccounts}) {
915 <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
916 . $locale->text('Tax Included') . qq|</b><br><br>
920 if (!$form->{taxincluded}) {
922 foreach $item (split / /, $form->{taxaccounts}) {
923 if ($form->{"${item}_base"}) {
924 $form->{invtotal} += $form->{"${item}_total"} =
926 $form->{"${item}_base"} * $form->{"${item}_rate"},
928 $form->{"${item}_total"} =
929 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
933 <th align=right>$form->{"${item}_description"} |
934 . $form->{"${item}_rate"} * 100 .qq|%</th>
935 <td align=right>$form->{"${item}_total"}</td>
941 $form->{invsubtotal} =
942 $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
946 <th align=right>| . $locale->text('Subtotal') . qq|</th>
947 <td align=right>$form->{invsubtotal}</td>
953 if ($form->{taxincluded}) {
954 foreach $item (split / /, $form->{taxaccounts}) {
955 if ($form->{"${item}_base"}) {
956 $form->{"${item}_total"} =
958 ($form->{"${item}_base"} * $form->{"${item}_rate"} /
959 (1 + $form->{"${item}_rate"})
962 $form->{"${item}_netto"} =
964 ($form->{"${item}_base"} - $form->{"${item}_total"}),
966 $form->{"${item}_total"} =
967 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
968 $form->{"${item}_netto"} =
969 $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
973 <th align=right>Enthaltene $form->{"${item}_description"} |
974 . $form->{"${item}_rate"} * 100 .qq|%</th>
975 <td align=right>$form->{"${item}_total"}</td>
978 <th align=right>Nettobetrag</th>
979 <td align=right>$form->{"${item}_netto"}</td>
987 $form->{oldinvtotal} = $form->{invtotal};
989 $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
999 <th align=left>| . $locale->text('Notes') . qq|</th>
1000 <th align=left>| . $locale->text('Internal Notes') . qq|</th>
1006 <th align=right>| . $locale->text('Payment Terms') . qq|</th>
1007 <td><select name=payment_id>$payment
1011 <td align=right width=100%>
1017 <th align=right>| . $locale->text('Total') . qq|</th>
1018 <td align=right>$form->{invtotal}</td>
1026 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
1027 <input type=hidden name=oldtotalpaid value=$totalpaid>
1029 <td><hr size=3 noshade></td>
1037 <th class=listtop align=left>Dokumente im Webdav-Repository</th>
1040 <td align=left width=30%><b>Dateiname</b></td>
1041 <td align=left width=70%><b>Webdavlink</b></td>
1043 foreach $file (keys %{ $form->{WEBDAV} }) {
1046 <td align=left>$file</td>
1047 <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
1055 <td><hr size=3 noshade></td>
1062 <input type=hidden name=jscalendar value=$form->{jscalendar}>
1075 | . $locale->text("Edit the $form->{type}") . qq|<br>
1076 <input class=submit type=submit name=action id=update_button value="|
1077 . $locale->text('Update') . qq|">
1078 <input class=submit type=submit name=action value="|
1079 . $locale->text('Ship to') . qq|">
1080 <input class=submit type=submit name=action value="|
1081 . $locale->text('Print') . qq|">
1082 <input class=submit type=submit name=action value="|
1083 . $locale->text('E-mail') . qq|">
1084 <input class=submit type=submit name=action value="|
1085 . $locale->text('Save') . qq|">
1086 <input class=submit type=submit name=action value="|
1087 . $locale->text('Save and Close') . qq|">
1090 if (($form->{id})) {
1092 <input type="button" class="submit" onclick="set_history_window(|
1094 . qq|);" name="history" id="history" value="|
1095 . $locale->text('history')
1098 <br>| . $locale->text("Workflow $form->{type}") . qq|<br>
1099 <input class=submit type=submit name=action value="|
1100 . $locale->text('Save as new') . qq|">
1101 <input class=submit type=submit name=action value="|
1102 . $locale->text('Delete') . qq|">|;
1103 if (($form->{type} =~ /sales_quotation$/)) {
1105 <input class=submit type=submit name=action value="|
1106 . $locale->text('Sales Order') . qq|">|;
1108 if ($form->{type} =~ /request_quotation$/) {
1110 <input class=submit type=submit name=action value="|
1111 . $locale->text('Purchase Order') . qq|">|;
1115 <input class=submit type=submit name=action value="|
1116 . $locale->text('Invoice') . qq|">
1120 if ($form->{type} =~ /sales_order$/) {
1122 <br>$form->{heading} als neue Vorlage verwenden für<br>
1123 <input class=submit type=submit name=action value="|
1124 . $locale->text('Purchase Order') . qq|">
1125 <input class=submit type=submit name=action value="|
1126 . $locale->text('Quotation') . qq|">
1129 } elsif ($form->{type} =~ /purchase_order$/) {
1131 <br>$form->{heading} als neue Vorlage verwenden für<br>
1132 <input class=submit type=submit name=action value="|
1133 . $locale->text('Sales Order') . qq|">
1134 <input class=submit type=submit name=action value="|
1135 . $locale->text('Request for Quotation') . qq|">
1140 <br>$form->{heading} als neue Vorlage verwenden für<br>
1141 <input class=submit type=submit name=action value="|
1142 . $locale->text('Order') . qq|">
1145 } elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount} && !$form->{proforma}) {
1147 <br>Workflow $form->{heading}<br>
1148 <input class=submit type=submit name=action value="|
1149 . $locale->text('Save as new') . qq|">
1150 <input class=submit type=submit name=action value="|
1151 . $locale->text('Invoice') . qq|">
1155 $form->hide_form("saved_xyznumber");
1159 <input type=hidden name=rowcount value=$form->{rowcount}>
1161 <input name=callback type=hidden value="$form->{callback}">
1163 <input type=hidden name=path value=$form->{path}>
1164 <input type=hidden name=login value=$form->{login}>
1165 <input type=hidden name=password value=$form->{password}>
1172 $lxdebug->leave_sub();
1176 $lxdebug->enter_sub();
1178 set_headings($form->{"id"} ? "edit" : "add");
1180 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1181 qw(exchangerate creditlimit creditremaining);
1182 $form->{update} = 1;
1184 &check_name($form->{vc});
1187 $buysell = 'sell' if ($form->{vc} eq 'vendor');
1188 $form->{exchangerate} = $exchangerate
1192 $form->check_exchangerate(
1193 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
1197 $i = $form->{rowcount};
1199 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
1201 if ( ($form->{"partnumber_$i"} eq "")
1202 && ($form->{"description_$i"} eq "")
1203 && ($form->{"partsgroup_$i"} eq "")) {
1205 $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
1210 if ( $form->{type} eq 'purchase_order'
1211 || $form->{type} eq 'request_quotation') {
1212 IR->retrieve_item(\%myconfig, \%$form);
1214 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
1215 IS->retrieve_item(\%myconfig, \%$form);
1218 my $rows = scalar @{ $form->{item_list} };
1220 $form->{"discount_$i"} =
1221 $form->format_amount(\%myconfig, $form->{discount} * 100);
1224 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
1233 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
1234 if ($form->{"not_discountable_$i"}) {
1235 $form->{"discount_$i"} = 0;
1237 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
1238 qw(partnumber description unit);
1239 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
1240 keys %{ $form->{item_list}[0] };
1241 if ($form->{"part_payment_id_$i"} ne "") {
1242 $form->{payment_id} = $form->{"part_payment_id_$i"};
1245 $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
1247 ($dec) = ($s =~ /\.(\d+)/);
1249 $decimalplaces = ($dec > 2) ? $dec : 2;
1252 $form->{"sellprice_$i"} = $sellprice;
1255 $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
1257 # if there is an exchange rate adjust sellprice
1258 $form->{"sellprice_$i"} /= $exchangerate;
1262 $form->{"sellprice_$i"} * $form->{"qty_$i"} *
1263 (1 - $form->{"discount_$i"} / 100);
1264 map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
1265 map { $form->{"${_}_base"} += $amount }
1266 (split / /, $form->{"taxaccounts_$i"});
1267 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
1268 split / /, $form->{taxaccounts}
1269 if !$form->{taxincluded};
1271 $form->{creditremaining} -= $amount;
1273 $form->{"sellprice_$i"} =
1274 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
1277 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
1279 # get pricegroups for parts
1280 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
1282 # build up html code for prices_$i
1283 &set_pricegroup($i);
1290 # ok, so this is a new part
1291 # ask if it is a part or service item
1293 if ( $form->{"partsgroup_$i"}
1294 && ($form->{"partsnumber_$i"} eq "")
1295 && ($form->{"description_$i"} eq "")) {
1296 $form->{rowcount}--;
1297 $form->{"discount_$i"} = "";
1301 $form->{"id_$i"} = 0;
1302 $form->{"unit_$i"} = $locale->text('ea');
1310 $lxdebug->leave_sub();
1314 $lxdebug->enter_sub();
1316 if ($form->{type} eq 'purchase_order') {
1317 $form->{title} = $locale->text('Purchase Orders');
1318 $form->{vc} = 'vendor';
1319 $ordlabel = $locale->text('Order Number');
1320 $ordnumber = 'ordnumber';
1321 $employee = $locale->text('Employee');
1324 if ($form->{type} eq 'request_quotation') {
1325 $form->{title} = $locale->text('Request for Quotations');
1326 $form->{vc} = 'vendor';
1327 $ordlabel = $locale->text('RFQ Number');
1328 $ordnumber = 'quonumber';
1329 $employee = $locale->text('Employee');
1332 if ($form->{type} eq 'sales_order') {
1333 $form->{title} = $locale->text('Sales Orders');
1334 $form->{vc} = 'customer';
1335 $ordlabel = $locale->text('Order Number');
1336 $ordnumber = 'ordnumber';
1337 $employee = $locale->text('Employee');
1340 if ($form->{type} eq 'sales_quotation') {
1341 $form->{title} = $locale->text('Quotations');
1342 $form->{vc} = 'customer';
1343 $ordlabel = $locale->text('Quotation Number');
1344 $ordnumber = 'quonumber';
1345 $employee = $locale->text('Employee');
1348 # setup vendor / customer selection
1349 $form->all_vc(\%myconfig, $form->{vc},
1350 ($form->{vc} eq 'customer') ? "AR" : "AP");
1352 map { $vc .= "<option>$_->{name}--$_->{id}</option>\n" }
1353 @{ $form->{"all_$form->{vc}"} };
1355 $vclabel = ucfirst $form->{vc};
1356 $vclabel = $locale->text($vclabel);
1358 # $locale->text('Vendor')
1359 # $locale->text('Customer')
1363 ? qq|<select name=$form->{vc}><option>\n$vc</option></select>|
1364 : qq|<input name=$form->{vc} size=35>|;
1367 if (@{ $form->{all_departments} }) {
1368 $form->{selectdepartment} = "<option>\n";
1371 $form->{selectdepartment} .=
1372 "<option>$_->{description}--$_->{id}</option>\n"
1373 } (@{ $form->{all_departments} });
1378 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1379 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1381 | if $form->{selectdepartment};
1384 if (($form->{"type"} eq "sales_order") ||
1385 ($form->{"type"} eq "purchase_order")) {
1388 <td><input name="notdelivered" id="notdelivered" class="checkbox" type="checkbox" value="1" checked>
1389 <label for="notdelivered">|. $locale->text('Not delivered') . qq|</label></td>
1390 <td><input name="delivered" id="delivered" class="checkbox" type="checkbox" value="1" checked>
1391 <label for="delivered">| . $locale->text('Delivered') . qq|</label></td>
1396 # use JavaScript Calendar or not
1397 $form->{jsscript} = $jscalendar;
1399 if ($form->{jsscript}) {
1401 # with JavaScript Calendar
1403 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1404 <input type=button name=transdatefrom id="trigger3" value=|
1405 . $locale->text('button') . qq|></td>
1408 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1409 <input type=button name=transdateto name=transdateto id="trigger4" value=|
1410 . $locale->text('button') . qq|></td>
1415 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
1416 "transdateto", "BL", "trigger4");
1419 # without JavaScript Calendar
1421 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1423 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1426 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1431 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1432 push(@values, $item->{"id"});
1433 $labels{$item->{"id"}} = $item->{"projectnumber"};
1436 NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1437 '-labels' => \%labels));
1444 <form method=post action=$form->{script}>
1448 <th class=listtop>$form->{title}</th>
1450 <tr height="5"></tr>
1455 <th align=right>$vclabel</th>
1456 <td colspan="3">$vc</td>
1460 <th align=right>$ordlabel</th>
1461 <td colspan=3><input name="$ordnumber" size=20></td>
1464 <th align="right">| . $locale->text("Project Number") . qq|</th>
1465 <td colspan="3">$projectnumber</td>
1468 <th align=right>| . $locale->text('From') . qq|</th>
1470 <th align=right>| . $locale->text('Bis') . qq|</th>
1473 <input type=hidden name=sort value=transdate>
1475 <th align=right>| . $locale->text('Include in Report') . qq|</th>
1479 <td><input type="checkbox" name="open" value="1" id="open" checked>
1480 <label for="open">| . $locale->text("Open") . qq|</td>
1481 <td><input type="checkbox" name="closed" value="1" id="closed">
1482 <label for="closed">| . $locale->text("Closed") . qq|</td>
1486 <td><input name="l_id" class=checkbox type=checkbox value=Y>
1487 | . $locale->text('ID') . qq|</td>
1488 <td><input name="l_$ordnumber" class=checkbox type=checkbox value=Y checked> $ordlabel</td>
1489 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
1490 . $locale->text('Date') . qq|</td>
1491 <td><input name="l_reqdate" class=checkbox type=checkbox value=Y checked> |
1492 . $locale->text('Required by') . qq|</td>
1495 <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vclabel</td>
1496 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1497 <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
1498 . $locale->text('Ship via') . qq|</td>
1499 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1502 <td><input name="l_netamount" class=checkbox type=checkbox value=Y> |
1503 . $locale->text('Amount') . qq|</td>
1504 <td><input name="l_tax" class=checkbox type=checkbox value=Y> |
1505 . $locale->text('Tax') . qq|</td>
1506 <td><input name="l_amount" class=checkbox type=checkbox value=Y checked> |
1507 . $locale->text('Total') . qq|</td>
1508 <td><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y> |
1509 . $locale->text('Project Number') . qq|</td>
1512 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
1513 . $locale->text('Subtotal') . qq|</td>
1521 <tr><td colspan=4><hr size=3 noshade></td></tr>
1527 <input type=hidden name=nextsub value=orders>
1528 <input type=hidden name=path value=$form->{path}>
1529 <input type=hidden name=login value=$form->{login}>
1530 <input type=hidden name=password value=$form->{password}>
1531 <input type=hidden name=vc value=$form->{vc}>
1532 <input type=hidden name=type value=$form->{type}>
1534 <input class=submit type=submit name=action value="|
1535 . $locale->text('Continue') . qq|">
1542 $lxdebug->leave_sub();
1546 $lxdebug->enter_sub();
1548 # split vendor / customer
1549 ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
1550 split(/--/, $form->{ $form->{vc} });
1552 OE->transactions(\%myconfig, \%$form);
1554 $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
1556 $number = $form->escape($form->{$ordnumber});
1557 $name = $form->escape($form->{ $form->{vc} });
1558 $department = $form->escape($form->{department});
1562 "$form->{script}?path=$form->{path}&action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}¬delivered=$form->{notdelivered}&delivered=$form->{delivered}&$ordnumber=$number&$form->{vc}=$name&department=$department";
1564 # construct callback
1565 $number = $form->escape($form->{$ordnumber}, 1);
1566 $name = $form->escape($form->{ $form->{vc} }, 1);
1567 $department = $form->escape($form->{department}, 1);
1570 "$form->{script}?path=$form->{path}&action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}¬delivered=$form->{notdelivered}&delivered=$form->{delivered}&$ordnumber=$number&$form->{vc}=$name&department=$department";
1573 $form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
1574 "name", "netamount", "tax", "amount",
1575 "curr", "employee", "shipvia", "globalprojectnumber",
1576 "open", "closed", "delivered");
1578 $form->{l_open} = $form->{l_closed} = "Y"
1579 if ($form->{open} && $form->{closed});
1581 $form->{"l_delivered"} = "Y"
1582 if ($form->{"delivered"} && $form->{"notdelivered"});
1584 foreach $item (@columns) {
1585 if ($form->{"l_$item"} eq "Y") {
1586 push @column_index, $item;
1588 # add column to href and callback
1589 $callback .= "&l_$item=Y";
1590 $href .= "&l_$item=Y";
1594 # only show checkboxes if gotten here via sales_order form.
1595 if ($form->{type} =~ /sales_order/) {
1596 unshift @column_index, "ids";
1599 if ($form->{l_subtotal} eq 'Y') {
1600 $callback .= "&l_subtotal=Y";
1601 $href .= "&l_subtotal=Y";
1604 if ($form->{vc} eq 'vendor') {
1605 if ($form->{type} eq 'purchase_order') {
1606 $form->{title} = $locale->text('Purchase Orders');
1608 $form->{title} = $locale->text('Request for Quotations');
1610 $name = $locale->text('Vendor');
1611 $employee = $locale->text('Employee');
1613 if ($form->{vc} eq 'customer') {
1614 if ($form->{type} eq 'sales_order') {
1615 $form->{title} = $locale->text('Sales Orders');
1617 $form->{title} = $locale->text('Quotations');
1619 $employee = $locale->text('Employee');
1620 $name = $locale->text('Customer');
1623 $column_header{id} =
1624 qq|<th><a class=listheading href=$href&sort=id>|
1625 . $locale->text('ID')
1627 $column_header{transdate} =
1628 qq|<th><a class=listheading href=$href&sort=transdate>|
1629 . $locale->text('Date')
1631 $column_header{reqdate} =
1632 qq|<th><a class=listheading href=$href&sort=reqdate>|
1633 . $locale->text('Required by')
1635 $column_header{ordnumber} =
1636 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1637 . $locale->text('Order')
1639 $column_header{quonumber} =
1640 qq|<th><a class=listheading href=$href&sort=quonumber>|
1641 . ($form->{"type"} eq "request_quotation" ?
1642 $locale->text('RFQ') :
1643 $locale->text('Quotation'))
1645 $column_header{name} =
1646 qq|<th><a class=listheading href=$href&sort=name>$name</a></th>|;
1647 $column_header{netamount} =
1648 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1649 $column_header{tax} =
1650 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1651 $column_header{amount} =
1652 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1653 $column_header{curr} =
1654 qq|<th class=listheading>| . $locale->text('Curr') . qq|</th>|;
1655 $column_header{shipvia} =
1656 qq|<th><a class=listheading href=$href&sort=shipvia>|
1657 . $locale->text('Ship via')
1659 $column_header{globalprojectnumber} =
1660 qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1661 $column_header{open} =
1662 qq|<th class=listheading>| . $locale->text('O') . qq|</th>|;
1663 $column_header{closed} =
1664 qq|<th class=listheading>| . $locale->text('C') . qq|</th>|;
1665 $column_header{"delivered"} =
1666 qq|<th class="listheading">| . $locale->text("Delivered") . qq|</th>|;
1668 $column_header{employee} =
1669 qq|<th><a class=listheading href=$href&sort=employee>$employee</a></th>|;
1671 $column_header{ids} = qq|<th></th>|;
1673 if ($form->{ $form->{vc} }) {
1674 $option = $locale->text(ucfirst $form->{vc});
1675 $option .= " : $form->{$form->{vc}}";
1677 if ($form->{department}) {
1678 $option .= "\n<br>" if ($option);
1679 ($department) = split /--/, $form->{department};
1680 $option .= $locale->text('Department') . " : $department";
1682 if ($form->{transdatefrom}) {
1684 . $locale->text('From') . " "
1685 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1687 if ($form->{transdateto}) {
1689 . $locale->text('Bis') . " "
1690 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1692 if ($form->{open}) {
1693 $option .= "\n<br>" if ($option);
1694 $option .= $locale->text('Open');
1696 if ($form->{closed}) {
1697 $option .= "\n<br>" if ($option);
1698 $option .= $locale->text('Closed');
1706 <form method="post" action="oe.pl">
1709 <th class=listtop>$form->{title}</th>
1711 <tr height="5"></tr>
1718 <tr class=listheading>|;
1720 map { print "\n$column_header{$_}" } @column_index;
1726 # add sort and escape callback
1727 $callback_escaped = $form->escape($callback . "&sort=$form->{sort}");
1729 if (@{ $form->{OE} }) {
1730 $sameitem = $form->{OE}->[0]->{ $form->{sort} };
1735 foreach $oe (@{ $form->{OE} }) {
1736 $form->{rowcount} = ++$j;
1738 if ($form->{l_subtotal} eq 'Y') {
1739 if ($sameitem ne $oe->{ $form->{sort} }) {
1741 $sameitem = $oe->{ $form->{sort} };
1745 map { $oe->{$_} *= $oe->{exchangerate} } (qw(netamount amount));
1747 $column_data{netamount} =
1749 . $form->format_amount(\%myconfig, $oe->{netamount}, 2, " ")
1751 $column_data{tax} = "<td align=right>"
1752 . $form->format_amount(\%myconfig, $oe->{amount} - $oe->{netamount},
1755 $column_data{amount} =
1757 . $form->format_amount(\%myconfig, $oe->{amount}, 2, " ") . "</td>";
1759 $totalnetamount += $oe->{netamount};
1760 $totalamount += $oe->{amount};
1762 $subtotalnetamount += $oe->{netamount};
1763 $subtotalamount += $oe->{amount};
1766 qq|<td><input name="multi_id_$j" class=checkbox type=checkbox><input type="hidden" name="trans_id_$j" value="$oe->{id}"></td>|;
1767 $column_data{id} = "<td>$oe->{id}</td>";
1768 $column_data{transdate} = "<td>$oe->{transdate} </td>";
1769 $column_data{reqdate} = "<td>$oe->{reqdate} </td>";
1771 $column_data{$ordnumber} =
1772 "<td><a href=oe.pl?path=$form->{path}&action=$action&type=$form->{type}&id=$oe->{id}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&callback=$callback_escaped>$oe->{$ordnumber}</a></td>";
1773 $column_data{name} = "<td>$oe->{name}</td>";
1775 $column_data{employee} = "<td>$oe->{employee} </td>";
1776 $column_data{shipvia} = "<td>$oe->{shipvia} </td>";
1777 $column_data{globalprojectnumber} = "<td>" . H($oe->{globalprojectnumber}) . "</td>";
1779 if ($oe->{closed}) {
1780 $column_data{closed} = "<td align=center>X</td>";
1781 $column_data{open} = "<td> </td>";
1783 $column_data{closed} = "<td> </td>";
1784 $column_data{open} = "<td align=center>X</td>";
1786 $column_data{"delivered"} = "<td>" .
1787 ($oe->{"delivered"} ? $locale->text("Yes") : $locale->text("No")) .
1793 <tr class=listrow$i>";
1795 map { print "\n$column_data{$_}" } @column_index;
1803 if ($form->{l_subtotal} eq 'Y') {
1809 <tr class=listtotal>|;
1811 map { $column_data{$_} = "<td> </td>" } @column_index;
1813 $column_data{netamount} =
1814 "<th class=listtotal align=right>"
1815 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1816 $column_data{tax} = "<th class=listtotal align=right>"
1817 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1820 $column_data{amount} =
1821 "<th class=listtotal align=right>"
1822 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1824 map { print "\n$column_data{$_}" } @column_index;
1832 <td><hr size=3 noshade></td>
1836 # multiple invoice edit button only if gotten there via sales_order form.
1838 if ($form->{type} =~ /sales_order/) {
1840 <input type="hidden" name="path" value="$form->{path}">
1841 <input class"submit" type="submit" name="action" value="|
1842 . $locale->text('Continue') . qq|">
1843 <input type="hidden" name="nextsub" value="edit">
1844 <input type="hidden" name="type" value="$form->{type}">
1845 <input type="hidden" name="vc" value="$form->{vc}">
1846 <input type="hidden" name="login" value="$form->{login}">
1847 <input type="hidden" name="password" value="$form->{password}">
1848 <input type="hidden" name="callback" value="$callback">
1849 <input type="hidden" name="rowcount" value="$form->{rowcount}">|;
1856 <form method=post action=$form->{script}>
1858 <input name=callback type=hidden value="$form->{callback}">
1860 <input type=hidden name=type value=$form->{type}>
1861 <input type=hidden name=vc value=$form->{vc}>
1863 <input type=hidden name=path value=$form->{path}>
1864 <input type=hidden name=login value=$form->{login}>
1865 <input type=hidden name=password value=$form->{password}>
1873 $lxdebug->leave_sub();
1877 $lxdebug->enter_sub();
1879 map { $column_data{$_} = "<td> </td>" } @column_index;
1881 $column_data{netamount} =
1882 "<th class=listsubtotal align=right>"
1883 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1885 $column_data{tax} = "<td class=listsubtotal align=right>"
1886 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1889 $column_data{amount} =
1890 "<th class=listsubtotal align=right>"
1891 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1893 $subtotalnetamount = 0;
1894 $subtotalamount = 0;
1897 <tr class=listsubtotal>
1900 map { print "\n$column_data{$_}" } @column_index;
1906 $lxdebug->leave_sub();
1909 sub save_and_close {
1910 $lxdebug->enter_sub();
1912 if ($form->{type} =~ /_order$/) {
1913 $form->isblank("transdate", $locale->text('Order Date missing!'));
1915 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1918 $msg = ucfirst $form->{vc};
1919 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
1921 # $locale->text('Customer missing!');
1922 # $locale->text('Vendor missing!');
1924 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1925 if ($form->{currency} ne $form->{defaultcurrency});
1929 # if the name changed get new values
1930 if (&check_name($form->{vc})) {
1935 $form->{id} = 0 if $form->{saveasnew};
1937 # this is for the internal notes section for the [email] Subject
1938 if ($form->{type} =~ /_order$/) {
1939 if ($form->{type} eq 'sales_order') {
1940 $form->{label} = $locale->text('Sales Order');
1942 $numberfld = "sonumber";
1943 $ordnumber = "ordnumber";
1945 $form->{label} = $locale->text('Purchase Order');
1947 $numberfld = "ponumber";
1948 $ordnumber = "ordnumber";
1951 $err = $locale->text('Cannot save order!');
1954 if ($form->{type} eq 'sales_quotation') {
1955 $form->{label} = $locale->text('Quotation');
1957 $numberfld = "sqnumber";
1958 $ordnumber = "quonumber";
1960 $form->{label} = $locale->text('Request for Quotation');
1962 $numberfld = "rfqnumber";
1963 $ordnumber = "quonumber";
1966 $err = $locale->text('Cannot save quotation!');
1970 # get new number in sequence if no number is given or if saveasnew was requested
1971 if (!$form->{$ordnumber} || $form->{saveasnew}) {
1972 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld);
1977 $form->error($err) if (!OE->save(\%myconfig, \%$form));
1979 # saving the history
1980 if(!exists $form->{addition}) {
1981 $form->{addition} = "SAVED";
1982 $form->save_history($form->dbconnect(\%myconfig));
1984 # /saving the history
1986 $form->redirect($form->{label} . " $form->{$ordnumber} " .
1987 $locale->text('saved!'));
1989 $lxdebug->leave_sub();
1993 $lxdebug->enter_sub();
1995 if ($form->{type} =~ /_order$/) {
1996 $form->isblank("transdate", $locale->text('Order Date missing!'));
1998 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
2001 $msg = ucfirst $form->{vc};
2002 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
2004 # $locale->text('Customer missing!');
2005 # $locale->text('Vendor missing!');
2007 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
2008 if ($form->{currency} ne $form->{defaultcurrency});
2012 # if the name changed get new values
2013 if (&check_name($form->{vc})) {
2018 $form->{id} = 0 if $form->{saveasnew};
2020 # this is for the internal notes section for the [email] Subject
2021 if ($form->{type} =~ /_order$/) {
2022 if ($form->{type} eq 'sales_order') {
2023 $form->{label} = $locale->text('Sales Order');
2025 $numberfld = "sonumber";
2026 $ordnumber = "ordnumber";
2028 $form->{label} = $locale->text('Purchase Order');
2030 $numberfld = "ponumber";
2031 $ordnumber = "ordnumber";
2034 $err = $locale->text('Cannot save order!');
2037 if ($form->{type} eq 'sales_quotation') {
2038 $form->{label} = $locale->text('Quotation');
2040 $numberfld = "sqnumber";
2041 $ordnumber = "quonumber";
2043 $form->{label} = $locale->text('Request for Quotation');
2045 $numberfld = "rfqnumber";
2046 $ordnumber = "quonumber";
2049 $err = $locale->text('Cannot save quotation!');
2053 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld)
2054 unless $form->{$ordnumber};
2058 OE->save(\%myconfig, \%$form);
2060 # saving the history
2061 if(!exists $form->{addition}) {
2062 $form->{addition} = "SAVED";
2063 $form->save_history($form->dbconnect(\%myconfig));
2065 # /saving the history
2067 $form->{simple_save} = 1;
2068 if(!$form->{print_and_save}) {
2069 set_headings("edit");
2073 $lxdebug->leave_sub();
2077 $lxdebug->enter_sub();
2081 if ($form->{type} =~ /_order$/) {
2082 $msg = $locale->text('Are you sure you want to delete Order Number');
2083 $ordnumber = 'ordnumber';
2085 $msg = $locale->text('Are you sure you want to delete Quotation Number');
2086 $ordnumber = 'quonumber';
2092 <form method=post action=$form->{script}>
2095 # delete action variable
2096 map { delete $form->{$_} } qw(action header);
2098 foreach $key (keys %$form) {
2099 $form->{$key} =~ s/\"/"/g;
2100 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2104 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
2106 <h4>$msg $form->{$ordnumber}</h4>
2108 <input name=action class=submit type=submit value="|
2109 . $locale->text('Yes') . qq|">
2116 $lxdebug->leave_sub();
2120 $lxdebug->enter_sub();
2122 if ($form->{type} =~ /_order$/) {
2123 $msg = $locale->text('Order deleted!');
2124 $err = $locale->text('Cannot delete order!');
2126 $msg = $locale->text('Quotation deleted!');
2127 $err = $locale->text('Cannot delete quotation!');
2129 if (OE->delete(\%myconfig, \%$form, $spool)){
2130 $form->redirect($msg);
2131 # saving the history
2132 if(!exists $form->{addition}) {
2133 $form->{addition} = "DELETED";
2134 $form->save_history($form->dbconnect(\%myconfig));
2136 # /saving the history
2140 $lxdebug->leave_sub();
2144 $lxdebug->enter_sub();
2146 if ($form->{type} =~ /_order$/) {
2148 # these checks only apply if the items don't bring their own ordnumbers/transdates.
2149 # The if clause ensures that by searching for empty ordnumber_#/transdate_# fields.
2150 $form->isblank("ordnumber", $locale->text('Order Number missing!'))
2151 if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
2152 $form->isblank("transdate", $locale->text('Order Date missing!'))
2153 if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
2155 # also copy deliverydate from the order
2156 $form->{deliverydate} = $form->{reqdate} if $form->{reqdate};
2157 $form->{orddate} = $form->{transdate};
2159 $form->isblank("quonumber", $locale->text('Quotation Number missing!'));
2160 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
2161 $form->{ordnumber} = "";
2162 $form->{quodate} = $form->{transdate};
2165 # if the name changed get new values
2166 if (&check_name($form->{vc})) {
2171 $form->{cp_id} *= 1;
2173 for $i (1 .. $form->{rowcount}) {
2174 map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
2175 $form->{"${_}_${i}"})
2176 if ($form->{"${_}_${i}"}) }
2177 qw(ship qty sellprice listprice basefactor));
2180 if ( $form->{type} =~ /_order/
2181 && $form->{currency} ne $form->{defaultcurrency}) {
2183 # check if we need a new exchangerate
2184 $buysell = ($form->{type} eq 'sales_order') ? "buy" : "sell";
2186 $orddate = $form->current_date(\%myconfig);
2188 $form->check_exchangerate(\%myconfig, $form->{currency}, $orddate,
2191 if (!$exchangerate) {
2192 &backorder_exchangerate($orddate, $buysell);
2197 # close orders/quotations
2198 $form->{closed} = 1;
2200 # save order if one ordnumber has been given
2201 # if not it's most likely a collective order, which can't be saved back
2202 # so they just have to be closed
2203 if (($form->{ordnumber} ne '') || ($form->{quonumber} ne '')) {
2204 OE->close_order(\%myconfig, \%$form);
2206 OE->close_orders(\%myconfig, \%$form);
2209 $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
2211 $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
2214 $form->{closed} = 0;
2215 $form->{rowcount}--;
2216 $form->{shipto} = 1;
2218 if ($form->{type} =~ /_order$/) {
2219 $form->{exchangerate} = $exchangerate;
2223 if ( $form->{type} eq 'purchase_order'
2224 || $form->{type} eq 'request_quotation') {
2225 $form->{title} = $locale->text('Add Vendor Invoice');
2226 $form->{script} = 'ir.pl';
2230 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
2231 $form->{title} = $locale->text('Add Sales Invoice');
2232 $form->{script} = 'is.pl';
2237 # bo creates the id, reset it
2238 map { delete $form->{$_} }
2239 qw(id subject message cc bcc printed emailed queued);
2240 $form->{ $form->{vc} } =~ s/--.*//g;
2241 $form->{type} = "invoice";
2244 $locale = new Locale "$myconfig{countrycode}", "$script";
2246 require "$form->{path}/$form->{script}";
2248 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
2250 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2251 qw(creditlimit creditremaining);
2253 $currency = $form->{currency};
2256 $form->{currency} = $currency;
2257 $form->{exchangerate} = "";
2258 $form->{forex} = "";
2259 $form->{exchangerate} = $exchangerate
2263 $form->check_exchangerate(
2264 \%myconfig, $form->{currency}, $form->{invdate}, $buysell
2267 $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
2272 for $i (1 .. $form->{rowcount}) {
2273 $form->{"discount_$i"} =
2274 $form->format_amount(\%myconfig, $form->{"discount_$i"});
2276 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
2278 $decimalplaces = ($dec > 2) ? $dec : 2;
2280 # copy delivery date from reqdate for order -> invoice conversion
2281 $form->{"deliverydate_$i"} = $form->{"reqdate_$i"}
2282 unless $form->{"deliverydate_$i"};
2284 $form->{"sellprice_$i"} =
2285 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
2288 (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
2289 $dec_qty = length $dec_qty;
2291 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
2293 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2294 qw(partnumber description unit);
2300 $lxdebug->leave_sub();
2303 sub backorder_exchangerate {
2304 $lxdebug->enter_sub();
2305 my ($orddate, $buysell) = @_;
2312 <form method=post action=$form->{script}>
2315 # delete action variable
2316 map { delete $form->{$_} } qw(action header exchangerate);
2318 foreach $key (keys %$form) {
2319 $form->{$key} =~ s/\"/"/g;
2320 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2323 $form->{title} = $locale->text('Add Exchangerate');
2327 <input type=hidden name=path value=$form->{path}>
2328 <input type=hidden name=login value=$form->{login}>
2329 <input type=hidden name=password value=$form->{password}>
2331 <input type=hidden name=exchangeratedate value=$orddate>
2332 <input type=hidden name=buysell value=$buysell>
2335 <tr><th class=listtop>$form->{title}</th></tr>
2336 <tr height="5"></tr>
2341 <th align=right>| . $locale->text('Currency') . qq|</th>
2342 <td>$form->{currency}</td>
2345 <th align=right>| . $locale->text('Date') . qq|</th>
2349 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
2350 <td><input name=exchangerate size=11></td>
2360 <input type=hidden name=nextsub value=save_exchangerate>
2362 <input name=action class=submit type=submit value="|
2363 . $locale->text('Continue') . qq|">
2371 $lxdebug->leave_sub();
2374 sub save_exchangerate {
2375 $lxdebug->enter_sub();
2377 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'));
2378 $form->{exchangerate} =
2379 $form->parse_amount(\%myconfig, $form->{exchangerate});
2380 $form->save_exchangerate(\%myconfig, $form->{currency},
2381 $form->{exchangeratedate},
2382 $form->{exchangerate}, $form->{buysell});
2386 $lxdebug->leave_sub();
2389 sub create_backorder {
2390 $lxdebug->enter_sub();
2392 $form->{shipped} = 1;
2394 # figure out if we need to create a backorder
2395 # items aren't saved if qty != 0
2397 for $i (1 .. $form->{rowcount}) {
2398 $totalqty += $qty = $form->{"qty_$i"};
2399 $totalship += $ship = $form->{"ship_$i"};
2401 $form->{"qty_$i"} = $qty - $ship;
2404 if ($totalship == 0) {
2405 map { $form->{"ship_$_"} = $form->{"qty_$_"} } (1 .. $form->{rowcount});
2406 $form->{ordtotal} = 0;
2407 $form->{shipped} = 0;
2411 if ($totalqty == $totalship) {
2412 map { $form->{"qty_$_"} = $form->{"ship_$_"} } (1 .. $form->{rowcount});
2413 $form->{ordtotal} = 0;
2418 qw(partnumber description qty ship unit sellprice discount id inventory_accno bin income_accno expense_accno listprice assembly taxaccounts partsgroup)
2421 for $i (1 .. $form->{rowcount}) {
2423 $form->{"${_}_$i"} =
2424 $form->format_amount(\%myconfig, $form->{"${_}_$i"})
2425 } qw(sellprice discount);
2430 OE->save(\%myconfig, \%$form);
2432 # rebuild rows for invoice
2436 for $i (1 .. $form->{rowcount}) {
2437 $form->{"qty_$i"} = $form->{"ship_$i"};
2439 if ($form->{"qty_$i"}) {
2442 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
2447 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
2448 $form->{rowcount} = $count;
2450 $lxdebug->leave_sub();
2454 $lxdebug->enter_sub();
2456 $form->{saveasnew} = 1;
2457 $form->{closed} = 0;
2458 map { delete $form->{$_} } qw(printed emailed queued);
2460 # Let Lx-Office assign a new order number if the user hasn't changed the
2461 # previous one. If it has been changed manually then use it as-is.
2462 my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
2463 if ($form->{saved_xyznumber} &&
2464 ($form->{saved_xyznumber} eq $form->{$idx})) {
2465 delete($form->{$idx});
2470 $lxdebug->leave_sub();
2473 sub purchase_order {
2474 $lxdebug->enter_sub();
2476 if ( $form->{type} eq 'sales_quotation'
2477 || $form->{type} eq 'request_quotation') {
2478 OE->close_order(\%myconfig, \%$form);
2481 if ($form->{type} =~ /^sales_/) {
2482 delete($form->{ordnumber});
2485 $form->{cp_id} *= 1;
2487 $form->{title} = $locale->text('Add Purchase Order');
2488 $form->{vc} = "vendor";
2489 $form->{type} = "purchase_order";
2493 $lxdebug->leave_sub();
2497 $lxdebug->enter_sub();
2499 if ( $form->{type} eq 'sales_quotation'
2500 || $form->{type} eq 'request_quotation') {
2501 OE->close_order(\%myconfig, $form);
2504 if ($form->{type} eq "purchase_order") {
2505 delete($form->{ordnumber});
2508 $form->{cp_id} *= 1;
2510 $form->{title} = $locale->text('Add Sales Order');
2511 $form->{vc} = "customer";
2512 $form->{type} = "sales_order";
2516 $lxdebug->leave_sub();
2520 $lxdebug->enter_sub();
2522 $form->{transdate} = $form->current_date(\%myconfig);
2523 delete $form->{duedate};
2525 $form->{closed} = 0;
2528 map { delete $form->{$_} }
2529 qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
2531 for $i (1 .. $form->{rowcount}) {
2532 map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
2533 $form->{"${_}_${i}"})
2534 if ($form->{"${_}_${i}"}) }
2535 qw(ship qty sellprice listprice basefactor));
2543 for $i (1 .. $form->{rowcount} - 1) {
2544 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2545 qw(partnumber description unit);
2548 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 0, "0") }
2549 qw(creditlimit creditremaining);
2553 $lxdebug->leave_sub();
2557 $lxdebug->enter_sub();
2559 $form->{print_and_save} = 1;
2564 my $saved_form = save_form();
2569 map({ $saved_vars{$_} = $form->{$_}; } qw(id ordnumber quonumber));
2570 restore_form($saved_form);
2571 map({ $form->{$_} = $saved_vars{$_}; } qw(id ordnumber quonumber));
2576 $lxdebug->leave_sub();