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>|;
391 <td colspan=2 align=center>
392 <input name="closed" id="closed" type="checkbox" class="checkbox" value="1" $checkedclosed>
393 <label for="closed">| . $locale->text('Closed') . qq|</label>
396 if (($form->{"type"} eq "sales_order") ||
397 ($form->{"type"} eq "purchase_order")) {
399 <input name="delivered" id="delivered" type="checkbox" class="checkbox" value="1" $checkeddelivered>
400 <label for="delivered">| . $locale->text('Delivered') . qq|</label>
410 # set option selected
411 foreach $item ($form->{vc}, currency, department, employee) {
412 $form->{"select$item"} =~ s/ selected//;
413 $form->{"select$item"} =~
414 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
417 #quote select[customer|vendor] Bug 133
418 $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
420 #substitute \n and \r to \s (bug 543)
421 $form->{"select$form->{vc}"} =~ s/[\n\r]/ /g;
423 my @old_project_ids = ($form->{"globalproject_id"});
424 map({ push(@old_project_ids, $form->{"project_id_$_"})
425 if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
427 $form->get_lists("contacts" => "ALL_CONTACTS",
428 "shipto" => "ALL_SHIPTO",
429 "projects" => { "key" => "ALL_PROJECTS",
431 "old_id" => \@old_project_ids },
432 "employees" => "ALL_SALESMEN");
435 my @values = (undef);
436 foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
437 push(@values, $item->{"cp_id"});
438 $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
439 ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
442 NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
443 '-labels' => \%labels, '-default' => $form->{"cp_id"}));
447 foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
448 push(@values, $item->{"shipto_id"});
449 $labels{$item->{"shipto_id"}} =
450 $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
454 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
456 NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
457 '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
462 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
463 push(@values, $item->{"id"});
464 $labels{$item->{"id"}} = $item->{"projectnumber"};
466 my $globalprojectnumber =
467 NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
468 '-labels' => \%labels,
469 '-default' => $form->{"globalproject_id"}));
472 if ($form->{type} =~ /^sales_/) {
475 foreach my $item (@{ $form->{ALL_SALESMEN} }) {
476 push(@values, $item->{id});
477 $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
482 <th align="right">| . $locale->text('Salesman') . qq|</th>
484 NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
485 '-values' => \@values, '-labels' => \%labels))
490 $form->{exchangerate} =
491 $form->format_amount(\%myconfig, $form->{exchangerate});
493 if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
499 $form->{creditlimit} =
500 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
501 $form->{creditremaining} =
502 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
505 <input type=hidden name=forex value=$form->{forex}>
508 if ($form->{currency} ne $form->{defaultcurrency}) {
509 if ($form->{forex}) {
512 . $locale->text('Exchangerate')
513 . qq|</th><td>$form->{exchangerate}</td>
514 <input type=hidden name=exchangerate value=$form->{exchangerate}>
519 . $locale->text('Exchangerate')
520 . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
524 $vclabel = ucfirst $form->{vc};
525 $vclabel = $locale->text($vclabel);
529 if ($form->{business}) {
532 <th align=right>| . $locale->text('Business') . qq|</th>
533 <td>$form->{business}</td>
534 <th align=right>| . $locale->text('Trade Discount') . qq|</th>
536 . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
542 if ($form->{max_dunning_level}) {
548 <th align=right>| . $locale->text('Max. Dunning Level') . qq|:</th>
549 <td><b>$form->{max_dunning_level}</b></td>
550 <th align=right>| . $locale->text('Dunning Amount') . qq|:</th>
552 . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
561 if (@{ $form->{TAXZONE} }) {
562 $form->{selecttaxzone} = "";
563 foreach $item (@{ $form->{TAXZONE} }) {
564 if ($item->{id} == $form->{taxzone_id}) {
565 $form->{selecttaxzone} .=
566 "<option value=$item->{id} selected>" . H($item->{description}) .
569 $form->{selecttaxzone} .=
570 "<option value=$item->{id}>" . H($item->{description}) . "</option>";
575 $form->{selecttaxzone} =~ s/ selected//g;
576 if ($form->{taxzone_id} ne "") {
577 $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}>/value=$form->{taxzone_id} selected>/;
583 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
584 <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
585 <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
589 if ($form->{type} !~ /_quotation$/) {
592 <th width=70% align=right nowrap>| . $locale->text('Order Number') . qq|</th>
593 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
596 <th width=70% align=right nowrap>|
597 . $locale->text('Quotation Number') . qq|</th>
598 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
601 <th width=70% align=right nowrap>|
602 . $locale->text('Customer Order Number') . qq|</th>
603 <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
606 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
611 <th align=right nowrap=true>| . $locale->text('Required by') . qq|</th>
616 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
618 $creditremaining = qq|
624 <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
625 <td>$form->{creditlimit}</td>
627 <th nowrap>| . $locale->text('Remaining') . qq|</th>
628 <td class="plus$n" nowrap>$form->{creditremaining}</td>
637 ($form->{type} eq 'sales_quotation')
638 ? $locale->text('Valid until')
639 : $locale->text('Required by');
640 if ($form->{type} eq 'sales_quotation') {
643 <th width=70% align=right nowrap>|
644 . $locale->text('Quotation Number') . qq|</th>
645 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
646 <input type=hidden name=ordnumber value="$form->{ordnumber}">
652 <th width=70% align=right nowrap>| . $locale->text('RFQ Number') . qq|</th>
653 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
654 <input type=hidden name=ordnumber value="$form->{ordnumber}">
662 <th align=right nowrap>| . $locale->text('Quotation Date') . qq|</th>
666 <th align=right nowrap=true>$reqlabel</th>
670 $creditremaining = qq| <tr>
677 ($form->{"select$form->{vc}"})
678 ? qq|<select name="$form->{vc}"
679 onchange="document.getElementById('update_button').click();">| .
680 qq|$form->{"select$form->{vc}"}</select>\n<input type=hidden name="select$form->{vc}" value="| .
681 Q($form->{"select$form->{vc}"}) . qq|">|
682 : qq|<input name=$form->{vc} value="$form->{$form->{vc}}" size=35>|;
686 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
687 <td colspan=3><select name=department>$form->{selectdepartment}</select>
688 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
691 | if $form->{selectdepartment};
694 <input type=hidden name=employee value="$form->{employee}">
697 if ($form->{type} eq 'sales_order') {
698 if ($form->{selectemployee}) {
700 <input type=hidden name=customer_klass value=$form->{customer_klass}>
702 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
703 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
704 <input type=hidden name=selectemployee value="$form->{selectemployee}">
711 <input type=hidden name=customer_klass value=$form->{customer_klass}>
713 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
714 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
715 <input type=hidden name=selectemployee value="$form->{selectemployee}">
720 if ($form->{resubmit} && ($form->{format} eq "html")) {
722 qq|window.open('about:blank','Beleg'); document.oe.target = 'Beleg';document.oe.submit()|;
723 } elsif ($form->{resubmit}) {
724 $onload = qq|document.oe.submit()|;
729 $credittext = $locale->text('Credit Limit exceeded!!!');
730 if ($creditwarning) {
731 $onload = qq|alert('$credittext')|;
734 $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
735 # show history button js
736 $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
737 #/show history button js
741 <body onLoad="$onload">
743 <form method=post name=oe action=$form->{script}>
744 <script type="text/javascript" src="js/common.js"></script>
745 <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
746 <script type="text/javascript" src="js/vendor_selection.js"></script>
747 <script type="text/javascript" src="js/calculate_qty.js"></script>
749 <input type=hidden name=id value=$form->{id}>
750 <input type=hidden name=action value=$form->{action}>
752 <input type=hidden name=type value=$form->{type}>
753 <input type=hidden name=formname value=$form->{formname}>
754 <input type=hidden name=media value=$form->{media}>
755 <input type=hidden name=format value=$form->{format}>
756 <input type=hidden name=proforma value=$form->{proforma}>
758 <input type=hidden name=queued value="$form->{queued}">
759 <input type=hidden name=printed value="$form->{printed}">
760 <input type=hidden name=emailed value="$form->{emailed}">
762 <input type=hidden name=vc value=$form->{vc}>
764 <input type=hidden name=title value="$form->{title}">
766 <input type=hidden name=discount value=$form->{discount}>
767 <input type=hidden name=creditlimit value=$form->{creditlimit}>
768 <input type=hidden name=creditremaining value=$form->{creditremaining}>
770 <input type=hidden name=tradediscount value=$form->{tradediscount}>
771 <input type=hidden name=business value=$form->{business}>
772 <input type=hidden name=webdav value=$webdav>
776 <th class=listtop>$form->{title}</th>
786 <th align=right>$vclabel</th>
787 <td colspan=3>$vc</td>
788 <input type=hidden name=$form->{vc}_id value=$form->{"$form->{vc}_id"}>
789 <input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
790 <th align=richt nowrap>|
791 . $locale->text('Contact Person') . qq|</th>
792 <td colspan=3>$contact</td>
800 <th align=right>| . $locale->text('Currency') . qq|</th>
801 <td><select name=currency>$form->{selectcurrency}</select></td>
802 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
803 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
807 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
808 <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
811 <th align=right>| . $locale->text('Ship via') . qq|</th>
812 <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
819 # <button type="button" onclick="delivery_customer_selection_window('delivery_customer_string','delivery_customer_id')">| . $locale->text('Choose Customer') . qq|</button>
821 # <td colspan=2><input type=hidden name=delivery_customer_id value="$form->{delivery_customer_id}">
822 # <input size=45 id=delivery_customer_string name=delivery_customer_string value="$form->{delivery_customer_string}"></td>
826 # <button type="button" onclick="vendor_selection_window('delivery_vendor_string','delivery_vendor_id')">| . $locale->text('Choose Vendor') . qq|</button>
828 # <td colspan=2><input type=hidden name=delivery_vendor_id value="$form->{delivery_vendor_id}">
829 # <input size=45 id=vendor_string name=delivery_vendor_string value="$form->{delivery_vendor_string}"></td>
843 <th width="70%" align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
844 <td>$globalprojectnumber</td>
855 <!-- shipto are in hidden variables -->
857 <input type=hidden name=shiptoname value="$form->{shiptoname}">
858 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
859 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
860 <input type=hidden name=shiptocity value="$form->{shiptocity}">
861 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
862 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
863 <input type=hidden name=shiptophone value="$form->{shiptophone}">
864 <input type=hidden name=shiptofax value="$form->{shiptofax}">
865 <input type=hidden name=shiptodepartment_1 value="$form->{shiptodepartment_1}">
866 <input type=hidden name=shiptodepartment_2 value="$form->{shiptodepartment_2}">
867 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
869 <!-- email variables -->
870 <input type=hidden name=message value="$form->{message}">
871 <input type=hidden name=email value="$form->{email}">
872 <input type=hidden name=subject value="$form->{subject}">
873 <input type=hidden name=cc value="$form->{cc}">
874 <input type=hidden name=bcc value="$form->{bcc}">
876 <input type=hidden name=taxpart value="$form->{taxpart}">
877 <input type=hidden name=taxservice value="$form->{taxservice}">
879 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
882 foreach $item (split / /, $form->{taxaccounts}) {
884 <input type=hidden name="${item}_rate" value=$form->{"${item}_rate"}>
885 <input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
888 $lxdebug->leave_sub();
892 $lxdebug->enter_sub();
894 $form->{invtotal} = $form->{invsubtotal};
896 if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
899 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
902 $rows = ($rows > $introws) ? $rows : $introws;
904 qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
906 qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
908 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
911 if ($form->{taxaccounts}) {
913 <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
914 . $locale->text('Tax Included') . qq|</b><br><br>
918 if (!$form->{taxincluded}) {
920 foreach $item (split / /, $form->{taxaccounts}) {
921 if ($form->{"${item}_base"}) {
922 $form->{invtotal} += $form->{"${item}_total"} =
924 $form->{"${item}_base"} * $form->{"${item}_rate"},
926 $form->{"${item}_total"} =
927 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
931 <th align=right>$form->{"${item}_description"} |
932 . $form->{"${item}_rate"} * 100 .qq|%</th>
933 <td align=right>$form->{"${item}_total"}</td>
939 $form->{invsubtotal} =
940 $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
944 <th align=right>| . $locale->text('Subtotal') . qq|</th>
945 <td align=right>$form->{invsubtotal}</td>
951 if ($form->{taxincluded}) {
952 foreach $item (split / /, $form->{taxaccounts}) {
953 if ($form->{"${item}_base"}) {
954 $form->{"${item}_total"} =
956 ($form->{"${item}_base"} * $form->{"${item}_rate"} /
957 (1 + $form->{"${item}_rate"})
960 $form->{"${item}_netto"} =
962 ($form->{"${item}_base"} - $form->{"${item}_total"}),
964 $form->{"${item}_total"} =
965 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
966 $form->{"${item}_netto"} =
967 $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
971 <th align=right>Enthaltene $form->{"${item}_description"} |
972 . $form->{"${item}_rate"} * 100 .qq|%</th>
973 <td align=right>$form->{"${item}_total"}</td>
976 <th align=right>Nettobetrag</th>
977 <td align=right>$form->{"${item}_netto"}</td>
985 $form->{oldinvtotal} = $form->{invtotal};
987 $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
997 <th align=left>| . $locale->text('Notes') . qq|</th>
998 <th align=left>| . $locale->text('Internal Notes') . qq|</th>
1004 <th align=right>| . $locale->text('Payment Terms') . qq|</th>
1005 <td><select name=payment_id>$payment
1009 <td align=right width=100%>
1015 <th align=right>| . $locale->text('Total') . qq|</th>
1016 <td align=right>$form->{invtotal}</td>
1024 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
1025 <input type=hidden name=oldtotalpaid value=$totalpaid>
1027 <td><hr size=3 noshade></td>
1035 <th class=listtop align=left>Dokumente im Webdav-Repository</th>
1038 <td align=left width=30%><b>Dateiname</b></td>
1039 <td align=left width=70%><b>Webdavlink</b></td>
1041 foreach $file (keys %{ $form->{WEBDAV} }) {
1044 <td align=left>$file</td>
1045 <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
1053 <td><hr size=3 noshade></td>
1060 <input type=hidden name=jscalendar value=$form->{jscalendar}>
1073 | . $locale->text("Edit the $form->{type}") . qq|<br>
1074 <input class=submit type=submit name=action id=update_button value="|
1075 . $locale->text('Update') . qq|">
1076 <input class=submit type=submit name=action value="|
1077 . $locale->text('Ship to') . qq|">
1078 <input class=submit type=submit name=action value="|
1079 . $locale->text('Print') . qq|">
1080 <input class=submit type=submit name=action value="|
1081 . $locale->text('E-mail') . qq|">
1082 <input class=submit type=submit name=action value="|
1083 . $locale->text('Save') . qq|">
1084 <input class=submit type=submit name=action value="|
1085 . $locale->text('Save and Close') . qq|">
1088 if (($form->{id})) {
1090 <input type="button" class="submit" onclick="set_history_window(|
1092 . qq|);" name="history" id="history" value="|
1093 . $locale->text('history')
1096 <br>| . $locale->text("Workflow $form->{type}") . qq|<br>
1097 <input class=submit type=submit name=action value="|
1098 . $locale->text('Save as new') . qq|">
1099 <input class=submit type=submit name=action value="|
1100 . $locale->text('Delete') . qq|">|;
1101 if (($form->{type} =~ /sales_quotation$/)) {
1103 <input class=submit type=submit name=action value="|
1104 . $locale->text('Sales Order') . qq|">|;
1106 if ($form->{type} =~ /request_quotation$/) {
1108 <input class=submit type=submit name=action value="|
1109 . $locale->text('Purchase Order') . qq|">|;
1113 <input class=submit type=submit name=action value="|
1114 . $locale->text('Invoice') . qq|">
1118 if ($form->{type} =~ /sales_order$/) {
1120 <br>$form->{heading} als neue Vorlage verwenden für<br>
1121 <input class=submit type=submit name=action value="|
1122 . $locale->text('Purchase Order') . qq|">
1123 <input class=submit type=submit name=action value="|
1124 . $locale->text('Quotation') . qq|">
1127 } elsif ($form->{type} =~ /purchase_order$/) {
1129 <br>$form->{heading} als neue Vorlage verwenden für<br>
1130 <input class=submit type=submit name=action value="|
1131 . $locale->text('Sales Order') . qq|">
1132 <input class=submit type=submit name=action value="|
1133 . $locale->text('Request for Quotation') . qq|">
1138 <br>$form->{heading} als neue Vorlage verwenden für<br>
1139 <input class=submit type=submit name=action value="|
1140 . $locale->text('Order') . qq|">
1143 } elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount} && !$form->{proforma}) {
1145 <br>Workflow $form->{heading}<br>
1146 <input class=submit type=submit name=action value="|
1147 . $locale->text('Save as new') . qq|">
1148 <input class=submit type=submit name=action value="|
1149 . $locale->text('Invoice') . qq|">
1153 $form->hide_form("saved_xyznumber");
1157 <input type=hidden name=rowcount value=$form->{rowcount}>
1159 <input name=callback type=hidden value="$form->{callback}">
1161 <input type=hidden name=path value=$form->{path}>
1162 <input type=hidden name=login value=$form->{login}>
1163 <input type=hidden name=password value=$form->{password}>
1170 $lxdebug->leave_sub();
1174 $lxdebug->enter_sub();
1176 set_headings($form->{"id"} ? "edit" : "add");
1178 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1179 qw(exchangerate creditlimit creditremaining);
1180 $form->{update} = 1;
1182 &check_name($form->{vc});
1185 $buysell = 'sell' if ($form->{vc} eq 'vendor');
1186 $form->{exchangerate} = $exchangerate
1190 $form->check_exchangerate(
1191 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
1195 $i = $form->{rowcount};
1197 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
1199 if ( ($form->{"partnumber_$i"} eq "")
1200 && ($form->{"description_$i"} eq "")
1201 && ($form->{"partsgroup_$i"} eq "")) {
1203 $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
1208 if ( $form->{type} eq 'purchase_order'
1209 || $form->{type} eq 'request_quotation') {
1210 IR->retrieve_item(\%myconfig, \%$form);
1212 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
1213 IS->retrieve_item(\%myconfig, \%$form);
1216 my $rows = scalar @{ $form->{item_list} };
1218 $form->{"discount_$i"} =
1219 $form->format_amount(\%myconfig, $form->{discount} * 100);
1222 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
1231 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
1232 if ($form->{"not_discountable_$i"}) {
1233 $form->{"discount_$i"} = 0;
1235 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
1236 qw(partnumber description unit);
1237 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
1238 keys %{ $form->{item_list}[0] };
1239 if ($form->{"part_payment_id_$i"} ne "") {
1240 $form->{payment_id} = $form->{"part_payment_id_$i"};
1243 $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
1245 ($dec) = ($s =~ /\.(\d+)/);
1247 $decimalplaces = ($dec > 2) ? $dec : 2;
1250 $form->{"sellprice_$i"} = $sellprice;
1253 $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
1255 # if there is an exchange rate adjust sellprice
1256 $form->{"sellprice_$i"} /= $exchangerate;
1260 $form->{"sellprice_$i"} * $form->{"qty_$i"} *
1261 (1 - $form->{"discount_$i"} / 100);
1262 map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
1263 map { $form->{"${_}_base"} += $amount }
1264 (split / /, $form->{"taxaccounts_$i"});
1265 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
1266 split / /, $form->{taxaccounts}
1267 if !$form->{taxincluded};
1269 $form->{creditremaining} -= $amount;
1271 $form->{"sellprice_$i"} =
1272 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
1275 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
1277 # get pricegroups for parts
1278 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
1280 # build up html code for prices_$i
1281 &set_pricegroup($i);
1288 # ok, so this is a new part
1289 # ask if it is a part or service item
1291 if ( $form->{"partsgroup_$i"}
1292 && ($form->{"partsnumber_$i"} eq "")
1293 && ($form->{"description_$i"} eq "")) {
1294 $form->{rowcount}--;
1295 $form->{"discount_$i"} = "";
1299 $form->{"id_$i"} = 0;
1300 $form->{"unit_$i"} = $locale->text('ea');
1308 $lxdebug->leave_sub();
1312 $lxdebug->enter_sub();
1314 if ($form->{type} eq 'purchase_order') {
1315 $form->{title} = $locale->text('Purchase Orders');
1316 $form->{vc} = 'vendor';
1317 $ordlabel = $locale->text('Order Number');
1318 $ordnumber = 'ordnumber';
1319 $employee = $locale->text('Employee');
1322 if ($form->{type} eq 'request_quotation') {
1323 $form->{title} = $locale->text('Request for Quotations');
1324 $form->{vc} = 'vendor';
1325 $ordlabel = $locale->text('RFQ Number');
1326 $ordnumber = 'quonumber';
1327 $employee = $locale->text('Employee');
1330 if ($form->{type} eq 'sales_order') {
1331 $form->{title} = $locale->text('Sales Orders');
1332 $form->{vc} = 'customer';
1333 $ordlabel = $locale->text('Order Number');
1334 $ordnumber = 'ordnumber';
1335 $employee = $locale->text('Employee');
1338 if ($form->{type} eq 'sales_quotation') {
1339 $form->{title} = $locale->text('Quotations');
1340 $form->{vc} = 'customer';
1341 $ordlabel = $locale->text('Quotation Number');
1342 $ordnumber = 'quonumber';
1343 $employee = $locale->text('Employee');
1346 # setup vendor / customer selection
1347 $form->all_vc(\%myconfig, $form->{vc},
1348 ($form->{vc} eq 'customer') ? "AR" : "AP");
1350 map { $vc .= "<option>$_->{name}--$_->{id}</option>\n" }
1351 @{ $form->{"all_$form->{vc}"} };
1353 $vclabel = ucfirst $form->{vc};
1354 $vclabel = $locale->text($vclabel);
1356 # $locale->text('Vendor')
1357 # $locale->text('Customer')
1361 ? qq|<select name=$form->{vc}><option>\n$vc</option></select>|
1362 : qq|<input name=$form->{vc} size=35>|;
1365 if (@{ $form->{all_departments} }) {
1366 $form->{selectdepartment} = "<option>\n";
1369 $form->{selectdepartment} .=
1370 "<option>$_->{description}--$_->{id}</option>\n"
1371 } (@{ $form->{all_departments} });
1376 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1377 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1379 | if $form->{selectdepartment};
1382 if (($form->{"type"} eq "sales_order") ||
1383 ($form->{"type"} eq "purchase_order")) {
1386 <td><input name="notdelivered" id="notdelivered" class="checkbox" type="checkbox" value="1" checked>
1387 <label for="notdelivered">|. $locale->text('Not delivered') . qq|</label></td>
1388 <td><input name="delivered" id="delivered" class="checkbox" type="checkbox" value="1" checked>
1389 <label for="delivered">| . $locale->text('Delivered') . qq|</label></td>
1394 # use JavaScript Calendar or not
1395 $form->{jsscript} = $jscalendar;
1397 if ($form->{jsscript}) {
1399 # with JavaScript Calendar
1401 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1402 <input type=button name=transdatefrom id="trigger3" value=|
1403 . $locale->text('button') . qq|></td>
1406 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1407 <input type=button name=transdateto name=transdateto id="trigger4" value=|
1408 . $locale->text('button') . qq|></td>
1413 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
1414 "transdateto", "BL", "trigger4");
1417 # without JavaScript Calendar
1419 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1421 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1424 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1429 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1430 push(@values, $item->{"id"});
1431 $labels{$item->{"id"}} = $item->{"projectnumber"};
1434 NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1435 '-labels' => \%labels));
1442 <form method=post action=$form->{script}>
1446 <th class=listtop>$form->{title}</th>
1448 <tr height="5"></tr>
1453 <th align=right>$vclabel</th>
1454 <td colspan="3">$vc</td>
1458 <th align=right>$ordlabel</th>
1459 <td colspan=3><input name="$ordnumber" size=20></td>
1462 <th align="right">| . $locale->text("Project Number") . qq|</th>
1463 <td colspan="3">$projectnumber</td>
1466 <th align=right>| . $locale->text('From') . qq|</th>
1468 <th align=right>| . $locale->text('Bis') . qq|</th>
1471 <input type=hidden name=sort value=transdate>
1473 <th align=right>| . $locale->text('Include in Report') . qq|</th>
1477 <td><input type="checkbox" name="open" value="1" id="open" checked>
1478 <label for="open">| . $locale->text("Open") . qq|</td>
1479 <td><input type="checkbox" name="closed" value="1" id="closed">
1480 <label for="closed">| . $locale->text("Closed") . qq|</td>
1484 <td><input name="l_id" class=checkbox type=checkbox value=Y>
1485 | . $locale->text('ID') . qq|</td>
1486 <td><input name="l_$ordnumber" class=checkbox type=checkbox value=Y checked> $ordlabel</td>
1487 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
1488 . $locale->text('Date') . qq|</td>
1489 <td><input name="l_reqdate" class=checkbox type=checkbox value=Y checked> |
1490 . $locale->text('Required by') . qq|</td>
1493 <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vclabel</td>
1494 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1495 <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
1496 . $locale->text('Ship via') . qq|</td>
1497 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1500 <td><input name="l_netamount" class=checkbox type=checkbox value=Y> |
1501 . $locale->text('Amount') . qq|</td>
1502 <td><input name="l_tax" class=checkbox type=checkbox value=Y> |
1503 . $locale->text('Tax') . qq|</td>
1504 <td><input name="l_amount" class=checkbox type=checkbox value=Y checked> |
1505 . $locale->text('Total') . qq|</td>
1506 <td><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y> |
1507 . $locale->text('Project Number') . qq|</td>
1510 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
1511 . $locale->text('Subtotal') . qq|</td>
1519 <tr><td colspan=4><hr size=3 noshade></td></tr>
1525 <input type=hidden name=nextsub value=orders>
1526 <input type=hidden name=path value=$form->{path}>
1527 <input type=hidden name=login value=$form->{login}>
1528 <input type=hidden name=password value=$form->{password}>
1529 <input type=hidden name=vc value=$form->{vc}>
1530 <input type=hidden name=type value=$form->{type}>
1532 <input class=submit type=submit name=action value="|
1533 . $locale->text('Continue') . qq|">
1540 $lxdebug->leave_sub();
1544 $lxdebug->enter_sub();
1546 # split vendor / customer
1547 ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
1548 split(/--/, $form->{ $form->{vc} });
1550 OE->transactions(\%myconfig, \%$form);
1552 $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
1554 $number = $form->escape($form->{$ordnumber});
1555 $name = $form->escape($form->{ $form->{vc} });
1556 $department = $form->escape($form->{department});
1560 "$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";
1562 # construct callback
1563 $number = $form->escape($form->{$ordnumber}, 1);
1564 $name = $form->escape($form->{ $form->{vc} }, 1);
1565 $department = $form->escape($form->{department}, 1);
1568 "$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";
1571 $form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
1572 "name", "netamount", "tax", "amount",
1573 "curr", "employee", "shipvia", "globalprojectnumber",
1574 "open", "closed", "delivered");
1576 $form->{l_open} = $form->{l_closed} = "Y"
1577 if ($form->{open} && $form->{closed});
1579 $form->{"l_delivered"} = "Y"
1580 if ($form->{"delivered"} && $form->{"notdelivered"});
1582 foreach $item (@columns) {
1583 if ($form->{"l_$item"} eq "Y") {
1584 push @column_index, $item;
1586 # add column to href and callback
1587 $callback .= "&l_$item=Y";
1588 $href .= "&l_$item=Y";
1592 # only show checkboxes if gotten here via sales_order form.
1593 if ($form->{type} =~ /sales_order/) {
1594 unshift @column_index, "ids";
1597 if ($form->{l_subtotal} eq 'Y') {
1598 $callback .= "&l_subtotal=Y";
1599 $href .= "&l_subtotal=Y";
1602 if ($form->{vc} eq 'vendor') {
1603 if ($form->{type} eq 'purchase_order') {
1604 $form->{title} = $locale->text('Purchase Orders');
1606 $form->{title} = $locale->text('Request for Quotations');
1608 $name = $locale->text('Vendor');
1609 $employee = $locale->text('Employee');
1611 if ($form->{vc} eq 'customer') {
1612 if ($form->{type} eq 'sales_order') {
1613 $form->{title} = $locale->text('Sales Orders');
1615 $form->{title} = $locale->text('Quotations');
1617 $employee = $locale->text('Employee');
1618 $name = $locale->text('Customer');
1621 $column_header{id} =
1622 qq|<th><a class=listheading href=$href&sort=id>|
1623 . $locale->text('ID')
1625 $column_header{transdate} =
1626 qq|<th><a class=listheading href=$href&sort=transdate>|
1627 . $locale->text('Date')
1629 $column_header{reqdate} =
1630 qq|<th><a class=listheading href=$href&sort=reqdate>|
1631 . $locale->text('Required by')
1633 $column_header{ordnumber} =
1634 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1635 . $locale->text('Order')
1637 $column_header{quonumber} =
1638 qq|<th><a class=listheading href=$href&sort=quonumber>|
1639 . ($form->{"type"} eq "request_quotation" ?
1640 $locale->text('RFQ') :
1641 $locale->text('Quotation'))
1643 $column_header{name} =
1644 qq|<th><a class=listheading href=$href&sort=name>$name</a></th>|;
1645 $column_header{netamount} =
1646 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1647 $column_header{tax} =
1648 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1649 $column_header{amount} =
1650 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1651 $column_header{curr} =
1652 qq|<th class=listheading>| . $locale->text('Curr') . qq|</th>|;
1653 $column_header{shipvia} =
1654 qq|<th><a class=listheading href=$href&sort=shipvia>|
1655 . $locale->text('Ship via')
1657 $column_header{globalprojectnumber} =
1658 qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1659 $column_header{open} =
1660 qq|<th class=listheading>| . $locale->text('O') . qq|</th>|;
1661 $column_header{closed} =
1662 qq|<th class=listheading>| . $locale->text('C') . qq|</th>|;
1663 $column_header{"delivered"} =
1664 qq|<th class="listheading">| . $locale->text("Delivered") . qq|</th>|;
1666 $column_header{employee} =
1667 qq|<th><a class=listheading href=$href&sort=employee>$employee</a></th>|;
1669 $column_header{ids} = qq|<th></th>|;
1671 if ($form->{ $form->{vc} }) {
1672 $option = $locale->text(ucfirst $form->{vc});
1673 $option .= " : $form->{$form->{vc}}";
1675 if ($form->{department}) {
1676 $option .= "\n<br>" if ($option);
1677 ($department) = split /--/, $form->{department};
1678 $option .= $locale->text('Department') . " : $department";
1680 if ($form->{transdatefrom}) {
1682 . $locale->text('From') . " "
1683 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1685 if ($form->{transdateto}) {
1687 . $locale->text('Bis') . " "
1688 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1690 if ($form->{open}) {
1691 $option .= "\n<br>" if ($option);
1692 $option .= $locale->text('Open');
1694 if ($form->{closed}) {
1695 $option .= "\n<br>" if ($option);
1696 $option .= $locale->text('Closed');
1704 <form method="post" action="oe.pl">
1707 <th class=listtop>$form->{title}</th>
1709 <tr height="5"></tr>
1716 <tr class=listheading>|;
1718 map { print "\n$column_header{$_}" } @column_index;
1724 # add sort and escape callback
1725 $callback_escaped = $form->escape($callback . "&sort=$form->{sort}");
1727 if (@{ $form->{OE} }) {
1728 $sameitem = $form->{OE}->[0]->{ $form->{sort} };
1733 foreach $oe (@{ $form->{OE} }) {
1734 $form->{rowcount} = ++$j;
1736 if ($form->{l_subtotal} eq 'Y') {
1737 if ($sameitem ne $oe->{ $form->{sort} }) {
1739 $sameitem = $oe->{ $form->{sort} };
1743 map { $oe->{$_} *= $oe->{exchangerate} } (qw(netamount amount));
1745 $column_data{netamount} =
1747 . $form->format_amount(\%myconfig, $oe->{netamount}, 2, " ")
1749 $column_data{tax} = "<td align=right>"
1750 . $form->format_amount(\%myconfig, $oe->{amount} - $oe->{netamount},
1753 $column_data{amount} =
1755 . $form->format_amount(\%myconfig, $oe->{amount}, 2, " ") . "</td>";
1757 $totalnetamount += $oe->{netamount};
1758 $totalamount += $oe->{amount};
1760 $subtotalnetamount += $oe->{netamount};
1761 $subtotalamount += $oe->{amount};
1764 qq|<td><input name="multi_id_$j" class=checkbox type=checkbox><input type="hidden" name="trans_id_$j" value="$oe->{id}"></td>|;
1765 $column_data{id} = "<td>$oe->{id}</td>";
1766 $column_data{transdate} = "<td>$oe->{transdate} </td>";
1767 $column_data{reqdate} = "<td>$oe->{reqdate} </td>";
1769 $column_data{$ordnumber} =
1770 "<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>";
1771 $column_data{name} = "<td>$oe->{name}</td>";
1773 $column_data{employee} = "<td>$oe->{employee} </td>";
1774 $column_data{shipvia} = "<td>$oe->{shipvia} </td>";
1775 $column_data{globalprojectnumber} = "<td>" . H($oe->{globalprojectnumber}) . "</td>";
1777 if ($oe->{closed}) {
1778 $column_data{closed} = "<td align=center>X</td>";
1779 $column_data{open} = "<td> </td>";
1781 $column_data{closed} = "<td> </td>";
1782 $column_data{open} = "<td align=center>X</td>";
1784 $column_data{"delivered"} = "<td>" .
1785 ($oe->{"delivered"} ? $locale->text("Yes") : $locale->text("No")) .
1791 <tr class=listrow$i>";
1793 map { print "\n$column_data{$_}" } @column_index;
1801 if ($form->{l_subtotal} eq 'Y') {
1807 <tr class=listtotal>|;
1809 map { $column_data{$_} = "<td> </td>" } @column_index;
1811 $column_data{netamount} =
1812 "<th class=listtotal align=right>"
1813 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1814 $column_data{tax} = "<th class=listtotal align=right>"
1815 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1818 $column_data{amount} =
1819 "<th class=listtotal align=right>"
1820 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1822 map { print "\n$column_data{$_}" } @column_index;
1830 <td><hr size=3 noshade></td>
1834 # multiple invoice edit button only if gotten there via sales_order form.
1836 if ($form->{type} =~ /sales_order/) {
1838 <input type="hidden" name="path" value="$form->{path}">
1839 <input class"submit" type="submit" name="action" value="|
1840 . $locale->text('Continue') . qq|">
1841 <input type="hidden" name="nextsub" value="edit">
1842 <input type="hidden" name="type" value="$form->{type}">
1843 <input type="hidden" name="vc" value="$form->{vc}">
1844 <input type="hidden" name="login" value="$form->{login}">
1845 <input type="hidden" name="password" value="$form->{password}">
1846 <input type="hidden" name="callback" value="$callback">
1847 <input type="hidden" name="rowcount" value="$form->{rowcount}">|;
1854 <form method=post action=$form->{script}>
1856 <input name=callback type=hidden value="$form->{callback}">
1858 <input type=hidden name=type value=$form->{type}>
1859 <input type=hidden name=vc value=$form->{vc}>
1861 <input type=hidden name=path value=$form->{path}>
1862 <input type=hidden name=login value=$form->{login}>
1863 <input type=hidden name=password value=$form->{password}>
1871 $lxdebug->leave_sub();
1875 $lxdebug->enter_sub();
1877 map { $column_data{$_} = "<td> </td>" } @column_index;
1879 $column_data{netamount} =
1880 "<th class=listsubtotal align=right>"
1881 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1883 $column_data{tax} = "<td class=listsubtotal align=right>"
1884 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1887 $column_data{amount} =
1888 "<th class=listsubtotal align=right>"
1889 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1891 $subtotalnetamount = 0;
1892 $subtotalamount = 0;
1895 <tr class=listsubtotal>
1898 map { print "\n$column_data{$_}" } @column_index;
1904 $lxdebug->leave_sub();
1907 sub save_and_close {
1908 $lxdebug->enter_sub();
1910 if ($form->{type} =~ /_order$/) {
1911 $form->isblank("transdate", $locale->text('Order Date missing!'));
1913 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1916 $msg = ucfirst $form->{vc};
1917 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
1919 # $locale->text('Customer missing!');
1920 # $locale->text('Vendor missing!');
1922 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1923 if ($form->{currency} ne $form->{defaultcurrency});
1927 # if the name changed get new values
1928 if (&check_name($form->{vc})) {
1933 $form->{id} = 0 if $form->{saveasnew};
1935 # this is for the internal notes section for the [email] Subject
1936 if ($form->{type} =~ /_order$/) {
1937 if ($form->{type} eq 'sales_order') {
1938 $form->{label} = $locale->text('Sales Order');
1940 $numberfld = "sonumber";
1941 $ordnumber = "ordnumber";
1943 $form->{label} = $locale->text('Purchase Order');
1945 $numberfld = "ponumber";
1946 $ordnumber = "ordnumber";
1949 $err = $locale->text('Cannot save order!');
1952 if ($form->{type} eq 'sales_quotation') {
1953 $form->{label} = $locale->text('Quotation');
1955 $numberfld = "sqnumber";
1956 $ordnumber = "quonumber";
1958 $form->{label} = $locale->text('Request for Quotation');
1960 $numberfld = "rfqnumber";
1961 $ordnumber = "quonumber";
1964 $err = $locale->text('Cannot save quotation!');
1968 # get new number in sequence if no number is given or if saveasnew was requested
1969 if (!$form->{$ordnumber} || $form->{saveasnew}) {
1970 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld);
1975 $form->error($err) if (!OE->save(\%myconfig, \%$form));
1977 # saving the history
1978 if(!exists $form->{addition}) {
1979 $form->{addition} = "SAVED";
1980 $form->save_history($form->dbconnect(\%myconfig));
1982 # /saving the history
1984 $form->redirect($form->{label} . " $form->{$ordnumber} " .
1985 $locale->text('saved!'));
1987 $lxdebug->leave_sub();
1991 $lxdebug->enter_sub();
1993 if ($form->{type} =~ /_order$/) {
1994 $form->isblank("transdate", $locale->text('Order Date missing!'));
1996 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1999 $msg = ucfirst $form->{vc};
2000 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
2002 # $locale->text('Customer missing!');
2003 # $locale->text('Vendor missing!');
2005 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
2006 if ($form->{currency} ne $form->{defaultcurrency});
2010 # if the name changed get new values
2011 if (&check_name($form->{vc})) {
2016 $form->{id} = 0 if $form->{saveasnew};
2018 # this is for the internal notes section for the [email] Subject
2019 if ($form->{type} =~ /_order$/) {
2020 if ($form->{type} eq 'sales_order') {
2021 $form->{label} = $locale->text('Sales Order');
2023 $numberfld = "sonumber";
2024 $ordnumber = "ordnumber";
2026 $form->{label} = $locale->text('Purchase Order');
2028 $numberfld = "ponumber";
2029 $ordnumber = "ordnumber";
2032 $err = $locale->text('Cannot save order!');
2035 if ($form->{type} eq 'sales_quotation') {
2036 $form->{label} = $locale->text('Quotation');
2038 $numberfld = "sqnumber";
2039 $ordnumber = "quonumber";
2041 $form->{label} = $locale->text('Request for Quotation');
2043 $numberfld = "rfqnumber";
2044 $ordnumber = "quonumber";
2047 $err = $locale->text('Cannot save quotation!');
2051 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld)
2052 unless $form->{$ordnumber};
2056 OE->save(\%myconfig, \%$form);
2058 # saving the history
2059 if(!exists $form->{addition}) {
2060 $form->{addition} = "SAVED";
2061 $form->save_history($form->dbconnect(\%myconfig));
2063 # /saving the history
2065 $form->{simple_save} = 1;
2066 if(!$form->{print_and_save}) {
2067 set_headings("edit");
2071 $lxdebug->leave_sub();
2075 $lxdebug->enter_sub();
2079 if ($form->{type} =~ /_order$/) {
2080 $msg = $locale->text('Are you sure you want to delete Order Number');
2081 $ordnumber = 'ordnumber';
2083 $msg = $locale->text('Are you sure you want to delete Quotation Number');
2084 $ordnumber = 'quonumber';
2090 <form method=post action=$form->{script}>
2093 # delete action variable
2094 map { delete $form->{$_} } qw(action header);
2096 foreach $key (keys %$form) {
2097 $form->{$key} =~ s/\"/"/g;
2098 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2102 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
2104 <h4>$msg $form->{$ordnumber}</h4>
2106 <input name=action class=submit type=submit value="|
2107 . $locale->text('Yes') . qq|">
2114 $lxdebug->leave_sub();
2118 $lxdebug->enter_sub();
2120 if ($form->{type} =~ /_order$/) {
2121 $msg = $locale->text('Order deleted!');
2122 $err = $locale->text('Cannot delete order!');
2124 $msg = $locale->text('Quotation deleted!');
2125 $err = $locale->text('Cannot delete quotation!');
2127 if (OE->delete(\%myconfig, \%$form, $spool)){
2128 $form->redirect($msg);
2129 # saving the history
2130 if(!exists $form->{addition}) {
2131 $form->{addition} = "DELETED";
2132 $form->save_history($form->dbconnect(\%myconfig));
2134 # /saving the history
2138 $lxdebug->leave_sub();
2142 $lxdebug->enter_sub();
2144 if ($form->{type} =~ /_order$/) {
2146 # these checks only apply if the items don't bring their own ordnumbers/transdates.
2147 # The if clause ensures that by searching for empty ordnumber_#/transdate_# fields.
2148 $form->isblank("ordnumber", $locale->text('Order Number missing!'))
2149 if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
2150 $form->isblank("transdate", $locale->text('Order Date missing!'))
2151 if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
2153 # also copy deliverydate from the order
2154 $form->{deliverydate} = $form->{reqdate} if $form->{reqdate};
2155 $form->{orddate} = $form->{transdate};
2157 $form->isblank("quonumber", $locale->text('Quotation Number missing!'));
2158 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
2159 $form->{ordnumber} = "";
2160 $form->{quodate} = $form->{transdate};
2163 # if the name changed get new values
2164 if (&check_name($form->{vc})) {
2169 $form->{cp_id} *= 1;
2171 for $i (1 .. $form->{rowcount}) {
2172 map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
2173 $form->{"${_}_${i}"})
2174 if ($form->{"${_}_${i}"}) }
2175 qw(ship qty sellprice listprice basefactor));
2178 if ( $form->{type} =~ /_order/
2179 && $form->{currency} ne $form->{defaultcurrency}) {
2181 # check if we need a new exchangerate
2182 $buysell = ($form->{type} eq 'sales_order') ? "buy" : "sell";
2184 $orddate = $form->current_date(\%myconfig);
2186 $form->check_exchangerate(\%myconfig, $form->{currency}, $orddate,
2189 if (!$exchangerate) {
2190 &backorder_exchangerate($orddate, $buysell);
2195 # close orders/quotations
2196 $form->{closed} = 1;
2198 # save order if one ordnumber has been given
2199 # if not it's most likely a collective order, which can't be saved back
2200 # so they just have to be closed
2201 if (($form->{ordnumber} ne '') || ($form->{quonumber} ne '')) {
2202 OE->close_order(\%myconfig, \%$form);
2204 OE->close_orders(\%myconfig, \%$form);
2207 $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
2209 $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
2212 $form->{closed} = 0;
2213 $form->{rowcount}--;
2214 $form->{shipto} = 1;
2216 if ($form->{type} =~ /_order$/) {
2217 $form->{exchangerate} = $exchangerate;
2221 if ( $form->{type} eq 'purchase_order'
2222 || $form->{type} eq 'request_quotation') {
2223 $form->{title} = $locale->text('Add Vendor Invoice');
2224 $form->{script} = 'ir.pl';
2228 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
2229 $form->{title} = $locale->text('Add Sales Invoice');
2230 $form->{script} = 'is.pl';
2235 # bo creates the id, reset it
2236 map { delete $form->{$_} }
2237 qw(id subject message cc bcc printed emailed queued);
2238 $form->{ $form->{vc} } =~ s/--.*//g;
2239 $form->{type} = "invoice";
2242 $locale = new Locale "$myconfig{countrycode}", "$script";
2244 require "$form->{path}/$form->{script}";
2246 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
2248 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2249 qw(creditlimit creditremaining);
2251 $currency = $form->{currency};
2254 $form->{currency} = $currency;
2255 $form->{exchangerate} = "";
2256 $form->{forex} = "";
2257 $form->{exchangerate} = $exchangerate
2261 $form->check_exchangerate(
2262 \%myconfig, $form->{currency}, $form->{invdate}, $buysell
2265 $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
2270 for $i (1 .. $form->{rowcount}) {
2271 $form->{"discount_$i"} =
2272 $form->format_amount(\%myconfig, $form->{"discount_$i"});
2274 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
2276 $decimalplaces = ($dec > 2) ? $dec : 2;
2278 # copy delivery date from reqdate for order -> invoice conversion
2279 $form->{"deliverydate_$i"} = $form->{"reqdate_$i"}
2280 unless $form->{"deliverydate_$i"};
2282 $form->{"sellprice_$i"} =
2283 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
2286 (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
2287 $dec_qty = length $dec_qty;
2289 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
2291 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2292 qw(partnumber description unit);
2298 $lxdebug->leave_sub();
2301 sub backorder_exchangerate {
2302 $lxdebug->enter_sub();
2303 my ($orddate, $buysell) = @_;
2310 <form method=post action=$form->{script}>
2313 # delete action variable
2314 map { delete $form->{$_} } qw(action header exchangerate);
2316 foreach $key (keys %$form) {
2317 $form->{$key} =~ s/\"/"/g;
2318 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2321 $form->{title} = $locale->text('Add Exchangerate');
2325 <input type=hidden name=path value=$form->{path}>
2326 <input type=hidden name=login value=$form->{login}>
2327 <input type=hidden name=password value=$form->{password}>
2329 <input type=hidden name=exchangeratedate value=$orddate>
2330 <input type=hidden name=buysell value=$buysell>
2333 <tr><th class=listtop>$form->{title}</th></tr>
2334 <tr height="5"></tr>
2339 <th align=right>| . $locale->text('Currency') . qq|</th>
2340 <td>$form->{currency}</td>
2343 <th align=right>| . $locale->text('Date') . qq|</th>
2347 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
2348 <td><input name=exchangerate size=11></td>
2358 <input type=hidden name=nextsub value=save_exchangerate>
2360 <input name=action class=submit type=submit value="|
2361 . $locale->text('Continue') . qq|">
2369 $lxdebug->leave_sub();
2372 sub save_exchangerate {
2373 $lxdebug->enter_sub();
2375 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'));
2376 $form->{exchangerate} =
2377 $form->parse_amount(\%myconfig, $form->{exchangerate});
2378 $form->save_exchangerate(\%myconfig, $form->{currency},
2379 $form->{exchangeratedate},
2380 $form->{exchangerate}, $form->{buysell});
2384 $lxdebug->leave_sub();
2387 sub create_backorder {
2388 $lxdebug->enter_sub();
2390 $form->{shipped} = 1;
2392 # figure out if we need to create a backorder
2393 # items aren't saved if qty != 0
2395 for $i (1 .. $form->{rowcount}) {
2396 $totalqty += $qty = $form->{"qty_$i"};
2397 $totalship += $ship = $form->{"ship_$i"};
2399 $form->{"qty_$i"} = $qty - $ship;
2402 if ($totalship == 0) {
2403 map { $form->{"ship_$_"} = $form->{"qty_$_"} } (1 .. $form->{rowcount});
2404 $form->{ordtotal} = 0;
2405 $form->{shipped} = 0;
2409 if ($totalqty == $totalship) {
2410 map { $form->{"qty_$_"} = $form->{"ship_$_"} } (1 .. $form->{rowcount});
2411 $form->{ordtotal} = 0;
2416 qw(partnumber description qty ship unit sellprice discount id inventory_accno bin income_accno expense_accno listprice assembly taxaccounts partsgroup)
2419 for $i (1 .. $form->{rowcount}) {
2421 $form->{"${_}_$i"} =
2422 $form->format_amount(\%myconfig, $form->{"${_}_$i"})
2423 } qw(sellprice discount);
2428 OE->save(\%myconfig, \%$form);
2430 # rebuild rows for invoice
2434 for $i (1 .. $form->{rowcount}) {
2435 $form->{"qty_$i"} = $form->{"ship_$i"};
2437 if ($form->{"qty_$i"}) {
2440 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
2445 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
2446 $form->{rowcount} = $count;
2448 $lxdebug->leave_sub();
2452 $lxdebug->enter_sub();
2454 $form->{saveasnew} = 1;
2455 $form->{closed} = 0;
2456 map { delete $form->{$_} } qw(printed emailed queued);
2458 # Let Lx-Office assign a new order number if the user hasn't changed the
2459 # previous one. If it has been changed manually then use it as-is.
2460 my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
2461 if ($form->{saved_xyznumber} &&
2462 ($form->{saved_xyznumber} eq $form->{$idx})) {
2463 delete($form->{$idx});
2468 $lxdebug->leave_sub();
2471 sub purchase_order {
2472 $lxdebug->enter_sub();
2474 if ( $form->{type} eq 'sales_quotation'
2475 || $form->{type} eq 'request_quotation') {
2476 OE->close_order(\%myconfig, \%$form);
2479 $form->{cp_id} *= 1;
2481 $form->{title} = $locale->text('Add Purchase Order');
2482 $form->{vc} = "vendor";
2483 $form->{type} = "purchase_order";
2487 $lxdebug->leave_sub();
2491 $lxdebug->enter_sub();
2493 if ( $form->{type} eq 'sales_quotation'
2494 || $form->{type} eq 'request_quotation') {
2495 OE->close_order(\%myconfig, $form);
2498 $form->{cp_id} *= 1;
2500 $form->{title} = $locale->text('Add Sales Order');
2501 $form->{vc} = "customer";
2502 $form->{type} = "sales_order";
2506 $lxdebug->leave_sub();
2510 $lxdebug->enter_sub();
2512 $form->{transdate} = $form->current_date(\%myconfig);
2513 delete $form->{duedate};
2515 $form->{closed} = 0;
2518 map { delete $form->{$_} }
2519 qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
2521 for $i (1 .. $form->{rowcount}) {
2522 map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
2523 $form->{"${_}_${i}"})
2524 if ($form->{"${_}_${i}"}) }
2525 qw(ship qty sellprice listprice basefactor));
2533 for $i (1 .. $form->{rowcount} - 1) {
2534 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2535 qw(partnumber description unit);
2538 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 0, "0") }
2539 qw(creditlimit creditremaining);
2543 $lxdebug->leave_sub();
2547 $lxdebug->enter_sub();
2549 $form->{print_and_save} = 1;
2554 my $saved_form = save_form();
2559 map({ $saved_vars{$_} = $form->{$_}; } qw(id ordnumber quonumber));
2560 restore_form($saved_form);
2561 map({ $form->{$_} = $saved_vars{$_}; } qw(id ordnumber quonumber));
2566 $lxdebug->leave_sub();