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 "bin/mozilla/io.pl";
41 require "bin/mozilla/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}&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}"} });
257 $form->{taxincluded} = $taxincluded if ($form->{id});
260 if (@{ $form->{all_departments} }) {
261 $form->{selectdepartment} = "<option>\n";
262 $form->{department} = "$form->{department}--$form->{department_id}";
265 $form->{selectdepartment} .=
266 "<option>$_->{description}--$_->{id}</option>\n"
267 } (@{ $form->{all_departments} });
270 $form->{employee} = "$form->{employee}--$form->{employee_id}";
273 if (@{ $form->{all_employees} }) {
274 $form->{selectemployee} = "";
275 map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}</option>\n" }
276 (@{ $form->{all_employees} });
280 $form->{forex} = $form->{exchangerate};
282 $form->{salesman_id} = $salesman_id if ($editing);
284 $lxdebug->leave_sub();
288 $lxdebug->enter_sub();
289 $form->{formname} = $form->{type} unless $form->{formname};
292 foreach $ref (@{ $form->{form_details} }) {
293 $form->{rowcount} = ++$i;
295 map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
297 for my $i (1 .. $form->{rowcount}) {
299 $form->{"discount_$i"} =
300 $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
302 $form->{"discount_$i"} =
303 $form->format_amount(\%myconfig, $form->{"discount_$i"});
305 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
307 $decimalplaces = ($dec > 2) ? $dec : 2;
309 # copy reqdate from deliverydate for invoice -> order conversion
310 $form->{"reqdate_$i"} = $form->{"deliverydate_$i"}
311 unless $form->{"reqdate_$i"};
313 $form->{"sellprice_$i"} =
314 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
317 (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
318 $dec_qty = length $dec_qty;
320 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
322 map { $form->{"${_}_$i"} =~ s/\"/"/g }
323 qw(partnumber description unit);
326 $lxdebug->leave_sub();
330 $lxdebug->enter_sub();
332 my $checkedclosed = $form->{"closed"} ? "checked" : "";
333 my $checkeddelivered = $form->{"delivered"} ? "checked" : "";
335 map { $form->{$_} =~ s/\"/"/g }
336 qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname
337 shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact
338 shiptophone shiptofax shiptodepartment_1 shiptodepartment_2);
340 # use JavaScript Calendar or not
341 $form->{jsscript} = $form->{jscalendar};
344 $payment = qq|<option value=""></option>|;
345 foreach $item (@{ $form->{payment_terms} }) {
346 if ($form->{payment_id} eq $item->{id}) {
347 $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
349 $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
352 if ($form->{jsscript}) {
354 # with JavaScript Calendar
356 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\"></td>
357 <td><input type=button name=transdate id="trigger1" value=|
358 . $locale->text('button') . qq|></td>
361 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value="$form->{reqdate}" onBlur=\"check_right_date_format(this)\"></td>
362 <td width="4"><input type=button name=reqdate name=reqdate id="trigger2" value=|
363 . $locale->text('button') . qq|></td>
368 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
369 "reqdate", "BL", "trigger2");
373 # without JavaScript Calendar
375 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\"></td>|;
377 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value="$form->{reqdate}" onBlur=\"check_right_date_format(this)\"></td>|;
382 if (($form->{"type"} eq "sales_order") ||
383 ($form->{"type"} eq "purchase_order")) {
385 <input name="delivered" id="delivered" type="checkbox" class="checkbox" value="1" $checkeddelivered>
386 <label for="delivered">| . $locale->text('Delivered') . qq|</label>|);
391 <input name="closed" id="closed" type="checkbox" class="checkbox" value="1" $checkedclosed>
392 <label for="closed">| . $locale->text('Closed') . qq|</label>|);
398 <td colspan=| . (2 * scalar(@tmp)) . qq| align=center>| . join("\n", @tmp) . qq|
404 # set option selected
405 foreach $item ($form->{vc}, currency, department, employee) {
406 $form->{"select$item"} =~ s/ selected//;
407 $form->{"select$item"} =~
408 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
411 #quote select[customer|vendor] Bug 133
412 $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
414 #substitute \n and \r to \s (bug 543)
415 $form->{"select$form->{vc}"} =~ s/[\n\r]/ /g;
417 my @old_project_ids = ($form->{"globalproject_id"});
418 map({ push(@old_project_ids, $form->{"project_id_$_"})
419 if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
421 $form->get_lists("contacts" => "ALL_CONTACTS",
422 "shipto" => "ALL_SHIPTO",
423 "projects" => { "key" => "ALL_PROJECTS",
425 "old_id" => \@old_project_ids },
426 "employees" => "ALL_SALESMEN",
427 "taxzones" => "ALL_TAXZONES",
428 "currencies" => "ALL_CURRENCIES");
431 my @values = (undef);
432 foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
433 push(@values, $item->{"cp_id"});
434 $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
435 ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
438 NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
439 '-labels' => \%labels, '-default' => $form->{"cp_id"}));
443 foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
444 push(@values, $item->{"shipto_id"});
445 $labels{$item->{"shipto_id"}} =
446 $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
450 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
452 NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
453 '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
458 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
459 push(@values, $item->{"id"});
460 $labels{$item->{"id"}} = $item->{"projectnumber"};
462 my $globalprojectnumber =
463 NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
464 '-labels' => \%labels,
465 '-default' => $form->{"globalproject_id"}));
468 if ($form->{type} =~ /^sales_/) {
471 foreach my $item (@{ $form->{ALL_SALESMEN} }) {
472 push(@values, $item->{id});
473 $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
478 <th align="right">| . $locale->text('Salesman') . qq|</th>
480 NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
481 '-values' => \@values, '-labels' => \%labels))
489 foreach my $item (@{ $form->{"ALL_TAXZONES"} }) {
490 push(@values, $item->{"id"});
491 $labels{$item->{"id"}} = $item->{"description"};
496 <th align="right">| . $locale->text('Steuersatz') . qq|</th>
498 NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
499 '-values' => \@values, '-labels' => \%labels)) . qq|
506 foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) {
507 push(@values, $item);
508 $labels{$item} = $item;
511 $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
514 <th align="right">| . $locale->text('Currency') . qq|</th>
516 NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
517 '-values' => \@values, '-labels' => \%labels)) . qq|
522 $form->{exchangerate} =
523 $form->format_amount(\%myconfig, $form->{exchangerate});
525 if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
531 $form->{creditlimit} =
532 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
533 $form->{creditremaining} =
534 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
537 <input type=hidden name=forex value=$form->{forex}>
540 if ($form->{currency} ne $form->{defaultcurrency}) {
541 if ($form->{forex}) {
544 . $locale->text('Exchangerate')
545 . qq|</th><td>$form->{exchangerate}</td>
546 <input type=hidden name=exchangerate value=$form->{exchangerate}>
551 . $locale->text('Exchangerate')
552 . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
556 $vclabel = ucfirst $form->{vc};
557 $vclabel = $locale->text($vclabel);
561 if ($form->{business}) {
564 <th align=right>| . $locale->text('Business') . qq|</th>
565 <td>$form->{business}</td>
566 <th align=right>| . $locale->text('Trade Discount') . qq|</th>
568 . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
574 if ($form->{max_dunning_level}) {
580 <th align=right>| . $locale->text('Max. Dunning Level') . qq|:</th>
581 <td><b>$form->{max_dunning_level}</b></td>
582 <th align=right>| . $locale->text('Dunning Amount') . qq|:</th>
584 . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
593 if ($form->{type} !~ /_quotation$/) {
596 <th width=70% align=right nowrap>| . $locale->text('Order Number') . qq|</th>
597 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
600 <th width=70% align=right nowrap>|
601 . $locale->text('Quotation Number') . qq|</th>
602 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
605 <th width=70% align=right nowrap>|
606 . $locale->text('Customer Order Number') . qq|</th>
607 <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
610 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
615 <th align=right nowrap=true>| . $locale->text('Required by') . qq|</th>
620 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
622 $creditremaining = qq|
628 <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
629 <td>$form->{creditlimit}</td>
631 <th nowrap>| . $locale->text('Remaining') . qq|</th>
632 <td class="plus$n" nowrap>$form->{creditremaining}</td>
641 ($form->{type} eq 'sales_quotation')
642 ? $locale->text('Valid until')
643 : $locale->text('Required by');
644 if ($form->{type} eq 'sales_quotation') {
647 <th width=70% align=right nowrap>|
648 . $locale->text('Quotation Number') . qq|</th>
649 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
650 <input type=hidden name=ordnumber value="$form->{ordnumber}">
656 <th width=70% align=right nowrap>| . $locale->text('RFQ Number') . qq|</th>
657 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
658 <input type=hidden name=ordnumber value="$form->{ordnumber}">
666 <th align=right nowrap>| . $locale->text('Quotation Date') . qq|</th>
670 <th align=right nowrap=true>$reqlabel</th>
674 $creditremaining = qq| <tr>
681 ($form->{"select$form->{vc}"})
682 ? qq|<select name="$form->{vc}"
683 onchange="document.getElementById('update_button').click();">| .
684 qq|$form->{"select$form->{vc}"}</select>\n<input type=hidden name="select$form->{vc}" value="| .
685 Q($form->{"select$form->{vc}"}) . qq|">|
686 : qq|<input name=$form->{vc} value="$form->{$form->{vc}}" size=35>|;
690 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
691 <td colspan=3><select name=department>$form->{selectdepartment}</select>
692 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
695 | if $form->{selectdepartment};
698 <input type=hidden name=employee value="$form->{employee}">
701 if ($form->{type} eq 'sales_order') {
702 if ($form->{selectemployee}) {
704 <input type=hidden name=customer_klass value=$form->{customer_klass}>
706 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
707 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
708 <input type=hidden name=selectemployee value="$form->{selectemployee}">
715 <input type=hidden name=customer_klass value=$form->{customer_klass}>
717 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
718 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
719 <input type=hidden name=selectemployee value="$form->{selectemployee}">
724 if ($form->{resubmit} && ($form->{format} eq "html")) {
726 qq|window.open('about:blank','Beleg'); document.oe.target = 'Beleg';document.oe.submit()|;
727 } elsif ($form->{resubmit}) {
728 $onload = qq|document.oe.submit()|;
733 $credittext = $locale->text('Credit Limit exceeded!!!');
734 if ($creditwarning) {
735 $onload = qq|alert('$credittext')|;
738 $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
739 $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
741 $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
742 # show history button js
743 $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
744 #/show history button js
748 <body onLoad="$onload">
750 <form method=post name=oe action=$form->{script}>
751 <script type="text/javascript" src="js/common.js"></script>
752 <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
753 <script type="text/javascript" src="js/vendor_selection.js"></script>
754 <script type="text/javascript" src="js/calculate_qty.js"></script>
756 <input type=hidden name=id value=$form->{id}>
757 <input type=hidden name=action value=$form->{action}>
759 <input type=hidden name=type value=$form->{type}>
760 <input type=hidden name=formname value=$form->{formname}>
761 <input type=hidden name=media value=$form->{media}>
762 <input type=hidden name=format value=$form->{format}>
763 <input type=hidden name=proforma value=$form->{proforma}>
765 <input type=hidden name=queued value="$form->{queued}">
766 <input type=hidden name=printed value="$form->{printed}">
767 <input type=hidden name=emailed value="$form->{emailed}">
769 <input type=hidden name=vc value=$form->{vc}>
771 <input type=hidden name=title value="$form->{title}">
773 <input type=hidden name=discount value=$form->{discount}>
774 <input type=hidden name=creditlimit value=$form->{creditlimit}>
775 <input type=hidden name=creditremaining value=$form->{creditremaining}>
777 <input type=hidden name=tradediscount value=$form->{tradediscount}>
778 <input type=hidden name=business value=$form->{business}>
779 <input type=hidden name=webdav value=$webdav>
783 <th class=listtop>$form->{title}</th>
793 <th align=right>$vclabel</th>
794 <td colspan=3>$vc</td>
795 <input type=hidden name=$form->{vc}_id value=$form->{"$form->{vc}_id"}>
796 <input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
797 <th align=richt nowrap>|
798 . $locale->text('Contact Person') . qq|</th>
799 <td colspan=3>$contact</td>
811 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
812 <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
815 <th align=right>| . $locale->text('Ship via') . qq|</th>
816 <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
823 # <button type="button" onclick="delivery_customer_selection_window('delivery_customer_string','delivery_customer_id')">| . $locale->text('Choose Customer') . qq|</button>
825 # <td colspan=2><input type=hidden name=delivery_customer_id value="$form->{delivery_customer_id}">
826 # <input size=45 id=delivery_customer_string name=delivery_customer_string value="$form->{delivery_customer_string}"></td>
830 # <button type="button" onclick="vendor_selection_window('delivery_vendor_string','delivery_vendor_id')">| . $locale->text('Choose Vendor') . qq|</button>
832 # <td colspan=2><input type=hidden name=delivery_vendor_id value="$form->{delivery_vendor_id}">
833 # <input size=45 id=vendor_string name=delivery_vendor_string value="$form->{delivery_vendor_string}"></td>
847 <th width="70%" align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
848 <td>$globalprojectnumber</td>
859 <!-- shipto are in hidden variables -->
861 <input type=hidden name=shiptoname value="$form->{shiptoname}">
862 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
863 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
864 <input type=hidden name=shiptocity value="$form->{shiptocity}">
865 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
866 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
867 <input type=hidden name=shiptophone value="$form->{shiptophone}">
868 <input type=hidden name=shiptofax value="$form->{shiptofax}">
869 <input type=hidden name=shiptodepartment_1 value="$form->{shiptodepartment_1}">
870 <input type=hidden name=shiptodepartment_2 value="$form->{shiptodepartment_2}">
871 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
873 <!-- email variables -->
874 <input type=hidden name=message value="$form->{message}">
875 <input type=hidden name=email value="$form->{email}">
876 <input type=hidden name=subject value="$form->{subject}">
877 <input type=hidden name=cc value="$form->{cc}">
878 <input type=hidden name=bcc value="$form->{bcc}">
880 <input type=hidden name=taxpart value="$form->{taxpart}">
881 <input type=hidden name=taxservice value="$form->{taxservice}">
883 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
886 foreach $item (split / /, $form->{taxaccounts}) {
888 <input type=hidden name="${item}_rate" value=$form->{"${item}_rate"}>
889 <input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
892 $lxdebug->leave_sub();
896 $lxdebug->enter_sub();
898 $form->{invtotal} = $form->{invsubtotal};
900 if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
903 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
906 $rows = ($rows > $introws) ? $rows : $introws;
908 qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
910 qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
912 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
915 if ($form->{taxaccounts}) {
917 <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
918 . $locale->text('Tax Included') . qq|</b><br><br>
922 if (!$form->{taxincluded}) {
924 foreach $item (split / /, $form->{taxaccounts}) {
925 if ($form->{"${item}_base"}) {
926 $form->{invtotal} += $form->{"${item}_total"} =
928 $form->{"${item}_base"} * $form->{"${item}_rate"},
930 $form->{"${item}_total"} =
931 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
935 <th align=right>$form->{"${item}_description"} |
936 . $form->{"${item}_rate"} * 100 .qq|%</th>
937 <td align=right>$form->{"${item}_total"}</td>
943 $form->{invsubtotal} =
944 $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
948 <th align=right>| . $locale->text('Subtotal') . qq|</th>
949 <td align=right>$form->{invsubtotal}</td>
955 if ($form->{taxincluded}) {
956 foreach $item (split / /, $form->{taxaccounts}) {
957 if ($form->{"${item}_base"}) {
958 $form->{"${item}_total"} =
960 ($form->{"${item}_base"} * $form->{"${item}_rate"} /
961 (1 + $form->{"${item}_rate"})
964 $form->{"${item}_netto"} =
966 ($form->{"${item}_base"} - $form->{"${item}_total"}),
968 $form->{"${item}_total"} =
969 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
970 $form->{"${item}_netto"} =
971 $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
975 <th align=right>Enthaltene $form->{"${item}_description"} |
976 . $form->{"${item}_rate"} * 100 .qq|%</th>
977 <td align=right>$form->{"${item}_total"}</td>
980 <th align=right>Nettobetrag</th>
981 <td align=right>$form->{"${item}_netto"}</td>
989 $form->{oldinvtotal} = $form->{invtotal};
991 $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
1001 <th align=left>| . $locale->text('Notes') . qq|</th>
1002 <th align=left>| . $locale->text('Internal Notes') . qq|</th>
1008 <th align=right>| . $locale->text('Payment Terms') . qq|</th>
1009 <td><select name=payment_id>$payment
1013 <td align=right width=100%>
1019 <th align=right>| . $locale->text('Total') . qq|</th>
1020 <td align=right>$form->{invtotal}</td>
1028 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
1029 <input type=hidden name=oldtotalpaid value=$totalpaid>
1031 <td><hr size=3 noshade></td>
1039 <th class=listtop align=left>Dokumente im Webdav-Repository</th>
1042 <td align=left width=30%><b>Dateiname</b></td>
1043 <td align=left width=70%><b>Webdavlink</b></td>
1045 foreach $file (keys %{ $form->{WEBDAV} }) {
1048 <td align=left>$file</td>
1049 <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
1057 <td><hr size=3 noshade></td>
1064 <input type=hidden name=jscalendar value=$form->{jscalendar}>
1077 | . $locale->text("Edit the $form->{type}") . qq|<br>
1078 <input class=submit type=submit name=action id=update_button value="|
1079 . $locale->text('Update') . qq|">
1080 <input class=submit type=submit name=action value="|
1081 . $locale->text('Ship to') . qq|">
1082 <input class=submit type=submit name=action value="|
1083 . $locale->text('Print') . qq|">
1084 <input class=submit type=submit name=action value="|
1085 . $locale->text('E-mail') . qq|">
1086 <input class=submit type=submit name=action value="|
1087 . $locale->text('Save') . qq|">
1088 <input class=submit type=submit name=action value="|
1089 . $locale->text('Save and Close') . qq|">
1092 if (($form->{id})) {
1094 <input type="button" class="submit" onclick="set_history_window(|
1096 . qq|);" name="history" id="history" value="|
1097 . $locale->text('history')
1100 <br>| . $locale->text("Workflow $form->{type}") . qq|<br>
1101 <input class=submit type=submit name=action value="|
1102 . $locale->text('Save as new') . qq|">
1103 <input class=submit type=submit name=action value="|
1104 . $locale->text('Delete') . qq|">|;
1105 if (($form->{type} =~ /sales_quotation$/)) {
1107 <input class=submit type=submit name=action value="|
1108 . $locale->text('Sales Order') . qq|">|;
1110 if ($form->{type} =~ /request_quotation$/) {
1112 <input class=submit type=submit name=action value="|
1113 . $locale->text('Purchase Order') . qq|">|;
1117 <input class=submit type=submit name=action value="|
1118 . $locale->text('Invoice') . qq|">
1122 if ($form->{type} =~ /sales_order$/) {
1124 <br>$form->{heading} als neue Vorlage verwenden für<br>
1125 <input class=submit type=submit name=action value="|
1126 . $locale->text('Purchase Order') . qq|">
1127 <input class=submit type=submit name=action value="|
1128 . $locale->text('Quotation') . qq|">
1131 } elsif ($form->{type} =~ /purchase_order$/) {
1133 <br>$form->{heading} als neue Vorlage verwenden für<br>
1134 <input class=submit type=submit name=action value="|
1135 . $locale->text('Sales Order') . qq|">
1136 <input class=submit type=submit name=action value="|
1137 . $locale->text('Request for Quotation') . qq|">
1142 <br>$form->{heading} als neue Vorlage verwenden für<br>
1143 <input class=submit type=submit name=action value="|
1144 . $locale->text('Order') . qq|">
1147 } elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount} && !$form->{proforma}) {
1149 <br>Workflow $form->{heading}<br>
1150 <input class=submit type=submit name=action value="|
1151 . $locale->text('Save as new') . qq|">
1152 <input class=submit type=submit name=action value="|
1153 . $locale->text('Invoice') . qq|">
1157 $form->hide_form("saved_xyznumber");
1161 <input type=hidden name=rowcount value=$form->{rowcount}>
1163 <input name=callback type=hidden value="$form->{callback}">
1165 <input type=hidden name=login value=$form->{login}>
1166 <input type=hidden name=password value=$form->{password}>
1173 $lxdebug->leave_sub();
1177 $lxdebug->enter_sub();
1179 set_headings($form->{"id"} ? "edit" : "add");
1181 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1182 qw(exchangerate creditlimit creditremaining);
1183 $form->{update} = 1;
1185 &check_name($form->{vc});
1188 $buysell = 'sell' if ($form->{vc} eq 'vendor');
1189 $form->{exchangerate} = $exchangerate
1193 $form->check_exchangerate(
1194 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
1198 $i = $form->{rowcount};
1200 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
1202 if ( ($form->{"partnumber_$i"} eq "")
1203 && ($form->{"description_$i"} eq "")
1204 && ($form->{"partsgroup_$i"} eq "")) {
1206 $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
1211 if ( $form->{type} eq 'purchase_order'
1212 || $form->{type} eq 'request_quotation') {
1213 IR->retrieve_item(\%myconfig, \%$form);
1215 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
1216 IS->retrieve_item(\%myconfig, \%$form);
1219 my $rows = scalar @{ $form->{item_list} };
1221 $form->{"discount_$i"} =
1222 $form->format_amount(\%myconfig, $form->{discount} * 100);
1225 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
1234 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
1235 if ($form->{"not_discountable_$i"}) {
1236 $form->{"discount_$i"} = 0;
1238 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
1239 qw(partnumber description unit);
1240 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
1241 keys %{ $form->{item_list}[0] };
1242 if ($form->{"part_payment_id_$i"} ne "") {
1243 $form->{payment_id} = $form->{"part_payment_id_$i"};
1246 $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
1248 ($dec) = ($s =~ /\.(\d+)/);
1250 $decimalplaces = ($dec > 2) ? $dec : 2;
1253 $form->{"sellprice_$i"} = $sellprice;
1256 $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
1258 # if there is an exchange rate adjust sellprice
1259 $form->{"sellprice_$i"} /= $exchangerate;
1263 $form->{"sellprice_$i"} * $form->{"qty_$i"} *
1264 (1 - $form->{"discount_$i"} / 100);
1265 map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
1266 map { $form->{"${_}_base"} += $amount }
1267 (split / /, $form->{"taxaccounts_$i"});
1268 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
1269 split / /, $form->{taxaccounts}
1270 if !$form->{taxincluded};
1272 $form->{creditremaining} -= $amount;
1274 $form->{"sellprice_$i"} =
1275 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
1278 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
1280 # get pricegroups for parts
1281 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
1283 # build up html code for prices_$i
1284 &set_pricegroup($i);
1291 # ok, so this is a new part
1292 # ask if it is a part or service item
1294 if ( $form->{"partsgroup_$i"}
1295 && ($form->{"partsnumber_$i"} eq "")
1296 && ($form->{"description_$i"} eq "")) {
1297 $form->{rowcount}--;
1298 $form->{"discount_$i"} = "";
1302 $form->{"id_$i"} = 0;
1303 $form->{"unit_$i"} = $locale->text('ea');
1311 $lxdebug->leave_sub();
1315 $lxdebug->enter_sub();
1317 if ($form->{type} eq 'purchase_order') {
1318 $form->{title} = $locale->text('Purchase Orders');
1319 $form->{vc} = 'vendor';
1320 $ordlabel = $locale->text('Order Number');
1321 $ordnumber = 'ordnumber';
1322 $employee = $locale->text('Employee');
1325 if ($form->{type} eq 'request_quotation') {
1326 $form->{title} = $locale->text('Request for Quotations');
1327 $form->{vc} = 'vendor';
1328 $ordlabel = $locale->text('RFQ Number');
1329 $ordnumber = 'quonumber';
1330 $employee = $locale->text('Employee');
1333 if ($form->{type} eq 'sales_order') {
1334 $form->{title} = $locale->text('Sales Orders');
1335 $form->{vc} = 'customer';
1336 $ordlabel = $locale->text('Order Number');
1337 $ordnumber = 'ordnumber';
1338 $employee = $locale->text('Employee');
1341 if ($form->{type} eq 'sales_quotation') {
1342 $form->{title} = $locale->text('Quotations');
1343 $form->{vc} = 'customer';
1344 $ordlabel = $locale->text('Quotation Number');
1345 $ordnumber = 'quonumber';
1346 $employee = $locale->text('Employee');
1349 # setup vendor / customer selection
1350 $form->all_vc(\%myconfig, $form->{vc},
1351 ($form->{vc} eq 'customer') ? "AR" : "AP");
1353 map { $vc .= "<option>$_->{name}--$_->{id}</option>\n" }
1354 @{ $form->{"all_$form->{vc}"} };
1356 $vclabel = ucfirst $form->{vc};
1357 $vclabel = $locale->text($vclabel);
1359 # $locale->text('Vendor')
1360 # $locale->text('Customer')
1364 ? qq|<select name=$form->{vc}><option>\n$vc</option></select>|
1365 : qq|<input name=$form->{vc} size=35>|;
1368 if (@{ $form->{all_departments} }) {
1369 $form->{selectdepartment} = "<option>\n";
1372 $form->{selectdepartment} .=
1373 "<option>$_->{description}--$_->{id}</option>\n"
1374 } (@{ $form->{all_departments} });
1379 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1380 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1382 | if $form->{selectdepartment};
1385 if (($form->{"type"} eq "sales_order") ||
1386 ($form->{"type"} eq "purchase_order")) {
1389 <td><input name="notdelivered" id="notdelivered" class="checkbox" type="checkbox" value="1" checked>
1390 <label for="notdelivered">|. $locale->text('Not delivered') . qq|</label></td>
1391 <td><input name="delivered" id="delivered" class="checkbox" type="checkbox" value="1" checked>
1392 <label for="delivered">| . $locale->text('Delivered') . qq|</label></td>
1397 # use JavaScript Calendar or not
1398 $form->{jsscript} = $jscalendar;
1400 if ($form->{jsscript}) {
1402 # with JavaScript Calendar
1404 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
1405 <input type=button name=transdatefrom id="trigger3" value=|
1406 . $locale->text('button') . qq|></td>
1409 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
1410 <input type=button name=transdateto name=transdateto id="trigger4" value=|
1411 . $locale->text('button') . qq|></td>
1416 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
1417 "transdateto", "BL", "trigger4");
1420 # without JavaScript Calendar
1422 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
1424 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\></td>|;
1427 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1432 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1433 push(@values, $item->{"id"});
1434 $labels{$item->{"id"}} = $item->{"projectnumber"};
1437 NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1438 '-labels' => \%labels));
1445 <form method=post action=$form->{script}>
1449 <th class=listtop>$form->{title}</th>
1451 <tr height="5"></tr>
1456 <th align=right>$vclabel</th>
1457 <td colspan="3">$vc</td>
1461 <th align=right>$ordlabel</th>
1462 <td colspan=3><input name="$ordnumber" size=20></td>
1465 <th align="right">| . $locale->text("Project Number") . qq|</th>
1466 <td colspan="3">$projectnumber</td>
1469 <th align=right>| . $locale->text('From') . qq|</th>
1471 <th align=right>| . $locale->text('Bis') . qq|</th>
1474 <input type=hidden name=sort value=transdate>
1476 <th align=right>| . $locale->text('Include in Report') . qq|</th>
1480 <td><input type="checkbox" name="open" value="1" id="open" checked>
1481 <label for="open">| . $locale->text("Open") . qq|</td>
1482 <td><input type="checkbox" name="closed" value="1" id="closed">
1483 <label for="closed">| . $locale->text("Closed") . qq|</td>
1487 <td><input name="l_id" class=checkbox type=checkbox value=Y>
1488 | . $locale->text('ID') . qq|</td>
1489 <td><input name="l_$ordnumber" class=checkbox type=checkbox value=Y checked> $ordlabel</td>
1490 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
1491 . $locale->text('Date') . qq|</td>
1492 <td><input name="l_reqdate" class=checkbox type=checkbox value=Y checked> |
1493 . $locale->text('Required by') . qq|</td>
1496 <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vclabel</td>
1497 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1498 <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
1499 . $locale->text('Ship via') . qq|</td>
1500 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1503 <td><input name="l_netamount" class=checkbox type=checkbox value=Y> |
1504 . $locale->text('Amount') . qq|</td>
1505 <td><input name="l_tax" class=checkbox type=checkbox value=Y> |
1506 . $locale->text('Tax') . qq|</td>
1507 <td><input name="l_amount" class=checkbox type=checkbox value=Y checked> |
1508 . $locale->text('Total') . qq|</td>
1509 <td><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y> |
1510 . $locale->text('Project Number') . qq|</td>
1513 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
1514 . $locale->text('Subtotal') . qq|</td>
1522 <tr><td colspan=4><hr size=3 noshade></td></tr>
1528 <input type=hidden name=nextsub value=orders>
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}?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}?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?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 class"submit" type="submit" name="action" value="|
1841 . $locale->text('Continue') . qq|">
1842 <input type="hidden" name="nextsub" value="edit">
1843 <input type="hidden" name="type" value="$form->{type}">
1844 <input type="hidden" name="vc" value="$form->{vc}">
1845 <input type="hidden" name="login" value="$form->{login}">
1846 <input type="hidden" name="password" value="$form->{password}">
1847 <input type="hidden" name="callback" value="$callback">
1848 <input type="hidden" name="rowcount" value="$form->{rowcount}">|;
1855 <form method=post action=$form->{script}>
1857 <input name=callback type=hidden value="$form->{callback}">
1859 <input type=hidden name=type value=$form->{type}>
1860 <input type=hidden name=vc value=$form->{vc}>
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->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
1980 $form->{addition} = "SAVED";
1981 $form->save_history($form->dbconnect(\%myconfig));
1983 # /saving the history
1985 $form->redirect($form->{label} . " $form->{$ordnumber} " .
1986 $locale->text('saved!'));
1988 $lxdebug->leave_sub();
1992 $lxdebug->enter_sub();
1994 if ($form->{type} =~ /_order$/) {
1995 $form->isblank("transdate", $locale->text('Order Date missing!'));
1997 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
2000 $msg = ucfirst $form->{vc};
2001 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
2003 # $locale->text('Customer missing!');
2004 # $locale->text('Vendor missing!');
2006 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
2007 if ($form->{currency} ne $form->{defaultcurrency});
2011 # if the name changed get new values
2012 if (&check_name($form->{vc})) {
2017 $form->{id} = 0 if $form->{saveasnew};
2019 # this is for the internal notes section for the [email] Subject
2020 if ($form->{type} =~ /_order$/) {
2021 if ($form->{type} eq 'sales_order') {
2022 $form->{label} = $locale->text('Sales Order');
2024 $numberfld = "sonumber";
2025 $ordnumber = "ordnumber";
2027 $form->{label} = $locale->text('Purchase Order');
2029 $numberfld = "ponumber";
2030 $ordnumber = "ordnumber";
2033 $err = $locale->text('Cannot save order!');
2036 if ($form->{type} eq 'sales_quotation') {
2037 $form->{label} = $locale->text('Quotation');
2039 $numberfld = "sqnumber";
2040 $ordnumber = "quonumber";
2042 $form->{label} = $locale->text('Request for Quotation');
2044 $numberfld = "rfqnumber";
2045 $ordnumber = "quonumber";
2048 $err = $locale->text('Cannot save quotation!');
2052 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld)
2053 unless $form->{$ordnumber};
2057 OE->save(\%myconfig, \%$form);
2059 # saving the history
2060 if(!exists $form->{addition}) {
2061 $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
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->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
2134 $form->{addition} = "DELETED";
2135 $form->save_history($form->dbconnect(\%myconfig));
2137 # /saving the history
2141 $lxdebug->leave_sub();
2145 $lxdebug->enter_sub();
2147 if ($form->{type} =~ /_order$/) {
2149 # these checks only apply if the items don't bring their own ordnumbers/transdates.
2150 # The if clause ensures that by searching for empty ordnumber_#/transdate_# fields.
2151 $form->isblank("ordnumber", $locale->text('Order Number missing!'))
2152 if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
2153 $form->isblank("transdate", $locale->text('Order Date missing!'))
2154 if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
2156 # also copy deliverydate from the order
2157 $form->{deliverydate} = $form->{reqdate} if $form->{reqdate};
2158 $form->{orddate} = $form->{transdate};
2160 $form->isblank("quonumber", $locale->text('Quotation Number missing!'));
2161 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
2162 $form->{ordnumber} = "";
2163 $form->{quodate} = $form->{transdate};
2166 # if the name changed get new values
2167 if (&check_name($form->{vc})) {
2172 $form->{cp_id} *= 1;
2174 for $i (1 .. $form->{rowcount}) {
2175 map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
2176 $form->{"${_}_${i}"})
2177 if ($form->{"${_}_${i}"}) }
2178 qw(ship qty sellprice listprice basefactor));
2181 if ( $form->{type} =~ /_order/
2182 && $form->{currency} ne $form->{defaultcurrency}) {
2184 # check if we need a new exchangerate
2185 $buysell = ($form->{type} eq 'sales_order') ? "buy" : "sell";
2187 $orddate = $form->current_date(\%myconfig);
2189 $form->check_exchangerate(\%myconfig, $form->{currency}, $orddate,
2192 if (!$exchangerate) {
2193 &backorder_exchangerate($orddate, $buysell);
2198 # close orders/quotations
2199 $form->{closed} = 1;
2201 # save order if one ordnumber has been given
2202 # if not it's most likely a collective order, which can't be saved back
2203 # so they just have to be closed
2204 if (($form->{ordnumber} ne '') || ($form->{quonumber} ne '')) {
2205 OE->close_order(\%myconfig, \%$form);
2207 OE->close_orders(\%myconfig, \%$form);
2210 $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
2212 $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
2215 $form->{closed} = 0;
2216 $form->{rowcount}--;
2217 $form->{shipto} = 1;
2219 if ($form->{type} =~ /_order$/) {
2220 $form->{exchangerate} = $exchangerate;
2224 if ( $form->{type} eq 'purchase_order'
2225 || $form->{type} eq 'request_quotation') {
2226 $form->{title} = $locale->text('Add Vendor Invoice');
2227 $form->{script} = 'ir.pl';
2231 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
2232 $form->{title} = $locale->text('Add Sales Invoice');
2233 $form->{script} = 'is.pl';
2238 # bo creates the id, reset it
2239 map { delete $form->{$_} }
2240 qw(id subject message cc bcc printed emailed queued);
2241 $form->{ $form->{vc} } =~ s/--.*//g;
2242 $form->{type} = "invoice";
2245 $locale = new Locale "$myconfig{countrycode}", "$script";
2247 require "bin/mozilla/$form->{script}";
2249 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
2251 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2252 qw(creditlimit creditremaining);
2254 $currency = $form->{currency};
2257 $form->{currency} = $currency;
2258 $form->{exchangerate} = "";
2259 $form->{forex} = "";
2260 $form->{exchangerate} = $exchangerate
2264 $form->check_exchangerate(
2265 \%myconfig, $form->{currency}, $form->{invdate}, $buysell
2268 $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
2273 for $i (1 .. $form->{rowcount}) {
2274 $form->{"discount_$i"} =
2275 $form->format_amount(\%myconfig, $form->{"discount_$i"});
2277 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
2279 $decimalplaces = ($dec > 2) ? $dec : 2;
2281 # copy delivery date from reqdate for order -> invoice conversion
2282 $form->{"deliverydate_$i"} = $form->{"reqdate_$i"}
2283 unless $form->{"deliverydate_$i"};
2285 $form->{"sellprice_$i"} =
2286 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
2289 (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
2290 $dec_qty = length $dec_qty;
2292 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
2294 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2295 qw(partnumber description unit);
2301 $lxdebug->leave_sub();
2304 sub backorder_exchangerate {
2305 $lxdebug->enter_sub();
2306 my ($orddate, $buysell) = @_;
2313 <form method=post action=$form->{script}>
2316 # delete action variable
2317 map { delete $form->{$_} } qw(action header exchangerate);
2319 foreach $key (keys %$form) {
2320 $form->{$key} =~ s/\"/"/g;
2321 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2324 $form->{title} = $locale->text('Add Exchangerate');
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();