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}"} });
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} onBlur=\"check_right_date_format(this)\"></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} onBlur=\"check_right_date_format(this)\"></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} onBlur=\"check_right_date_format(this)\"></td>|;
385 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate} onBlur=\"check_right_date_format(this)\"></td>|;
390 if (($form->{"type"} eq "sales_order") ||
391 ($form->{"type"} eq "purchase_order")) {
393 <input name="delivered" id="delivered" type="checkbox" class="checkbox" value="1" $checkeddelivered>
394 <label for="delivered">| . $locale->text('Delivered') . qq|</label>|);
399 <input name="closed" id="closed" type="checkbox" class="checkbox" value="1" $checkedclosed>
400 <label for="closed">| . $locale->text('Closed') . qq|</label>|);
406 <td colspan=| . (2 * scalar(@tmp)) . qq| align=center>| . join("\n", @tmp) . qq|
412 # set option selected
413 foreach $item ($form->{vc}, currency, department, employee) {
414 $form->{"select$item"} =~ s/ selected//;
415 $form->{"select$item"} =~
416 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
419 #quote select[customer|vendor] Bug 133
420 $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
422 #substitute \n and \r to \s (bug 543)
423 $form->{"select$form->{vc}"} =~ s/[\n\r]/ /g;
425 my @old_project_ids = ($form->{"globalproject_id"});
426 map({ push(@old_project_ids, $form->{"project_id_$_"})
427 if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
429 $form->get_lists("contacts" => "ALL_CONTACTS",
430 "shipto" => "ALL_SHIPTO",
431 "projects" => { "key" => "ALL_PROJECTS",
433 "old_id" => \@old_project_ids },
434 "employees" => "ALL_SALESMEN",
435 "taxzones" => "ALL_TAXZONES");
438 my @values = (undef);
439 foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
440 push(@values, $item->{"cp_id"});
441 $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
442 ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
445 NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
446 '-labels' => \%labels, '-default' => $form->{"cp_id"}));
450 foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
451 push(@values, $item->{"shipto_id"});
452 $labels{$item->{"shipto_id"}} =
453 $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
457 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
459 NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
460 '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
465 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
466 push(@values, $item->{"id"});
467 $labels{$item->{"id"}} = $item->{"projectnumber"};
469 my $globalprojectnumber =
470 NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
471 '-labels' => \%labels,
472 '-default' => $form->{"globalproject_id"}));
475 if ($form->{type} =~ /^sales_/) {
478 foreach my $item (@{ $form->{ALL_SALESMEN} }) {
479 push(@values, $item->{id});
480 $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
485 <th align="right">| . $locale->text('Salesman') . qq|</th>
487 NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
488 '-values' => \@values, '-labels' => \%labels))
496 foreach my $item (@{ $form->{"ALL_TAXZONES"} }) {
497 push(@values, $item->{"id"});
498 $labels{$item->{"id"}} = $item->{"description"};
503 <th align="right">| . $locale->text('Steuersatz') . qq|</th>
505 NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
506 '-values' => \@values, '-labels' => \%labels)) . qq|
510 $form->{exchangerate} =
511 $form->format_amount(\%myconfig, $form->{exchangerate});
513 if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
519 $form->{creditlimit} =
520 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
521 $form->{creditremaining} =
522 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
525 <input type=hidden name=forex value=$form->{forex}>
528 if ($form->{currency} ne $form->{defaultcurrency}) {
529 if ($form->{forex}) {
532 . $locale->text('Exchangerate')
533 . qq|</th><td>$form->{exchangerate}</td>
534 <input type=hidden name=exchangerate value=$form->{exchangerate}>
539 . $locale->text('Exchangerate')
540 . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
544 $vclabel = ucfirst $form->{vc};
545 $vclabel = $locale->text($vclabel);
549 if ($form->{business}) {
552 <th align=right>| . $locale->text('Business') . qq|</th>
553 <td>$form->{business}</td>
554 <th align=right>| . $locale->text('Trade Discount') . qq|</th>
556 . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
562 if ($form->{max_dunning_level}) {
568 <th align=right>| . $locale->text('Max. Dunning Level') . qq|:</th>
569 <td><b>$form->{max_dunning_level}</b></td>
570 <th align=right>| . $locale->text('Dunning Amount') . qq|:</th>
572 . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
581 if ($form->{type} !~ /_quotation$/) {
584 <th width=70% align=right nowrap>| . $locale->text('Order Number') . qq|</th>
585 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
588 <th width=70% align=right nowrap>|
589 . $locale->text('Quotation Number') . qq|</th>
590 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
593 <th width=70% align=right nowrap>|
594 . $locale->text('Customer Order Number') . qq|</th>
595 <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
598 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
603 <th align=right nowrap=true>| . $locale->text('Required by') . qq|</th>
608 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
610 $creditremaining = qq|
616 <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
617 <td>$form->{creditlimit}</td>
619 <th nowrap>| . $locale->text('Remaining') . qq|</th>
620 <td class="plus$n" nowrap>$form->{creditremaining}</td>
629 ($form->{type} eq 'sales_quotation')
630 ? $locale->text('Valid until')
631 : $locale->text('Required by');
632 if ($form->{type} eq 'sales_quotation') {
635 <th width=70% align=right nowrap>|
636 . $locale->text('Quotation Number') . qq|</th>
637 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
638 <input type=hidden name=ordnumber value="$form->{ordnumber}">
644 <th width=70% align=right nowrap>| . $locale->text('RFQ Number') . qq|</th>
645 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
646 <input type=hidden name=ordnumber value="$form->{ordnumber}">
654 <th align=right nowrap>| . $locale->text('Quotation Date') . qq|</th>
658 <th align=right nowrap=true>$reqlabel</th>
662 $creditremaining = qq| <tr>
669 ($form->{"select$form->{vc}"})
670 ? qq|<select name="$form->{vc}"
671 onchange="document.getElementById('update_button').click();">| .
672 qq|$form->{"select$form->{vc}"}</select>\n<input type=hidden name="select$form->{vc}" value="| .
673 Q($form->{"select$form->{vc}"}) . qq|">|
674 : qq|<input name=$form->{vc} value="$form->{$form->{vc}}" size=35>|;
678 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
679 <td colspan=3><select name=department>$form->{selectdepartment}</select>
680 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
683 | if $form->{selectdepartment};
686 <input type=hidden name=employee value="$form->{employee}">
689 if ($form->{type} eq 'sales_order') {
690 if ($form->{selectemployee}) {
692 <input type=hidden name=customer_klass value=$form->{customer_klass}>
694 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
695 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
696 <input type=hidden name=selectemployee value="$form->{selectemployee}">
703 <input type=hidden name=customer_klass value=$form->{customer_klass}>
705 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
706 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
707 <input type=hidden name=selectemployee value="$form->{selectemployee}">
712 if ($form->{resubmit} && ($form->{format} eq "html")) {
714 qq|window.open('about:blank','Beleg'); document.oe.target = 'Beleg';document.oe.submit()|;
715 } elsif ($form->{resubmit}) {
716 $onload = qq|document.oe.submit()|;
721 $credittext = $locale->text('Credit Limit exceeded!!!');
722 if ($creditwarning) {
723 $onload = qq|alert('$credittext')|;
726 $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
727 $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
729 $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
730 # show history button js
731 $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
732 #/show history button js
736 <body onLoad="$onload">
738 <form method=post name=oe action=$form->{script}>
739 <script type="text/javascript" src="js/common.js"></script>
740 <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
741 <script type="text/javascript" src="js/vendor_selection.js"></script>
742 <script type="text/javascript" src="js/calculate_qty.js"></script>
744 <input type=hidden name=id value=$form->{id}>
745 <input type=hidden name=action value=$form->{action}>
747 <input type=hidden name=type value=$form->{type}>
748 <input type=hidden name=formname value=$form->{formname}>
749 <input type=hidden name=media value=$form->{media}>
750 <input type=hidden name=format value=$form->{format}>
751 <input type=hidden name=proforma value=$form->{proforma}>
753 <input type=hidden name=queued value="$form->{queued}">
754 <input type=hidden name=printed value="$form->{printed}">
755 <input type=hidden name=emailed value="$form->{emailed}">
757 <input type=hidden name=vc value=$form->{vc}>
759 <input type=hidden name=title value="$form->{title}">
761 <input type=hidden name=discount value=$form->{discount}>
762 <input type=hidden name=creditlimit value=$form->{creditlimit}>
763 <input type=hidden name=creditremaining value=$form->{creditremaining}>
765 <input type=hidden name=tradediscount value=$form->{tradediscount}>
766 <input type=hidden name=business value=$form->{business}>
767 <input type=hidden name=webdav value=$webdav>
771 <th class=listtop>$form->{title}</th>
781 <th align=right>$vclabel</th>
782 <td colspan=3>$vc</td>
783 <input type=hidden name=$form->{vc}_id value=$form->{"$form->{vc}_id"}>
784 <input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
785 <th align=richt nowrap>|
786 . $locale->text('Contact Person') . qq|</th>
787 <td colspan=3>$contact</td>
795 <th align=right>| . $locale->text('Currency') . qq|</th>
796 <td><select name=currency>$form->{selectcurrency}</select></td>
797 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
798 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
802 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
803 <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
806 <th align=right>| . $locale->text('Ship via') . qq|</th>
807 <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
814 # <button type="button" onclick="delivery_customer_selection_window('delivery_customer_string','delivery_customer_id')">| . $locale->text('Choose Customer') . qq|</button>
816 # <td colspan=2><input type=hidden name=delivery_customer_id value="$form->{delivery_customer_id}">
817 # <input size=45 id=delivery_customer_string name=delivery_customer_string value="$form->{delivery_customer_string}"></td>
821 # <button type="button" onclick="vendor_selection_window('delivery_vendor_string','delivery_vendor_id')">| . $locale->text('Choose Vendor') . qq|</button>
823 # <td colspan=2><input type=hidden name=delivery_vendor_id value="$form->{delivery_vendor_id}">
824 # <input size=45 id=vendor_string name=delivery_vendor_string value="$form->{delivery_vendor_string}"></td>
838 <th width="70%" align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
839 <td>$globalprojectnumber</td>
850 <!-- shipto are in hidden variables -->
852 <input type=hidden name=shiptoname value="$form->{shiptoname}">
853 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
854 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
855 <input type=hidden name=shiptocity value="$form->{shiptocity}">
856 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
857 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
858 <input type=hidden name=shiptophone value="$form->{shiptophone}">
859 <input type=hidden name=shiptofax value="$form->{shiptofax}">
860 <input type=hidden name=shiptodepartment_1 value="$form->{shiptodepartment_1}">
861 <input type=hidden name=shiptodepartment_2 value="$form->{shiptodepartment_2}">
862 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
864 <!-- email variables -->
865 <input type=hidden name=message value="$form->{message}">
866 <input type=hidden name=email value="$form->{email}">
867 <input type=hidden name=subject value="$form->{subject}">
868 <input type=hidden name=cc value="$form->{cc}">
869 <input type=hidden name=bcc value="$form->{bcc}">
871 <input type=hidden name=taxpart value="$form->{taxpart}">
872 <input type=hidden name=taxservice value="$form->{taxservice}">
874 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
877 foreach $item (split / /, $form->{taxaccounts}) {
879 <input type=hidden name="${item}_rate" value=$form->{"${item}_rate"}>
880 <input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
883 $lxdebug->leave_sub();
887 $lxdebug->enter_sub();
889 $form->{invtotal} = $form->{invsubtotal};
891 if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
894 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
897 $rows = ($rows > $introws) ? $rows : $introws;
899 qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
901 qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
903 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
906 if ($form->{taxaccounts}) {
908 <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
909 . $locale->text('Tax Included') . qq|</b><br><br>
913 if (!$form->{taxincluded}) {
915 foreach $item (split / /, $form->{taxaccounts}) {
916 if ($form->{"${item}_base"}) {
917 $form->{invtotal} += $form->{"${item}_total"} =
919 $form->{"${item}_base"} * $form->{"${item}_rate"},
921 $form->{"${item}_total"} =
922 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
926 <th align=right>$form->{"${item}_description"} |
927 . $form->{"${item}_rate"} * 100 .qq|%</th>
928 <td align=right>$form->{"${item}_total"}</td>
934 $form->{invsubtotal} =
935 $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
939 <th align=right>| . $locale->text('Subtotal') . qq|</th>
940 <td align=right>$form->{invsubtotal}</td>
946 if ($form->{taxincluded}) {
947 foreach $item (split / /, $form->{taxaccounts}) {
948 if ($form->{"${item}_base"}) {
949 $form->{"${item}_total"} =
951 ($form->{"${item}_base"} * $form->{"${item}_rate"} /
952 (1 + $form->{"${item}_rate"})
955 $form->{"${item}_netto"} =
957 ($form->{"${item}_base"} - $form->{"${item}_total"}),
959 $form->{"${item}_total"} =
960 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
961 $form->{"${item}_netto"} =
962 $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
966 <th align=right>Enthaltene $form->{"${item}_description"} |
967 . $form->{"${item}_rate"} * 100 .qq|%</th>
968 <td align=right>$form->{"${item}_total"}</td>
971 <th align=right>Nettobetrag</th>
972 <td align=right>$form->{"${item}_netto"}</td>
980 $form->{oldinvtotal} = $form->{invtotal};
982 $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
992 <th align=left>| . $locale->text('Notes') . qq|</th>
993 <th align=left>| . $locale->text('Internal Notes') . qq|</th>
999 <th align=right>| . $locale->text('Payment Terms') . qq|</th>
1000 <td><select name=payment_id>$payment
1004 <td align=right width=100%>
1010 <th align=right>| . $locale->text('Total') . qq|</th>
1011 <td align=right>$form->{invtotal}</td>
1019 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
1020 <input type=hidden name=oldtotalpaid value=$totalpaid>
1022 <td><hr size=3 noshade></td>
1030 <th class=listtop align=left>Dokumente im Webdav-Repository</th>
1033 <td align=left width=30%><b>Dateiname</b></td>
1034 <td align=left width=70%><b>Webdavlink</b></td>
1036 foreach $file (keys %{ $form->{WEBDAV} }) {
1039 <td align=left>$file</td>
1040 <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
1048 <td><hr size=3 noshade></td>
1055 <input type=hidden name=jscalendar value=$form->{jscalendar}>
1068 | . $locale->text("Edit the $form->{type}") . qq|<br>
1069 <input class=submit type=submit name=action id=update_button value="|
1070 . $locale->text('Update') . qq|">
1071 <input class=submit type=submit name=action value="|
1072 . $locale->text('Ship to') . qq|">
1073 <input class=submit type=submit name=action value="|
1074 . $locale->text('Print') . qq|">
1075 <input class=submit type=submit name=action value="|
1076 . $locale->text('E-mail') . qq|">
1077 <input class=submit type=submit name=action value="|
1078 . $locale->text('Save') . qq|">
1079 <input class=submit type=submit name=action value="|
1080 . $locale->text('Save and Close') . qq|">
1083 if (($form->{id})) {
1085 <input type="button" class="submit" onclick="set_history_window(|
1087 . qq|);" name="history" id="history" value="|
1088 . $locale->text('history')
1091 <br>| . $locale->text("Workflow $form->{type}") . qq|<br>
1092 <input class=submit type=submit name=action value="|
1093 . $locale->text('Save as new') . qq|">
1094 <input class=submit type=submit name=action value="|
1095 . $locale->text('Delete') . qq|">|;
1096 if (($form->{type} =~ /sales_quotation$/)) {
1098 <input class=submit type=submit name=action value="|
1099 . $locale->text('Sales Order') . qq|">|;
1101 if ($form->{type} =~ /request_quotation$/) {
1103 <input class=submit type=submit name=action value="|
1104 . $locale->text('Purchase Order') . qq|">|;
1108 <input class=submit type=submit name=action value="|
1109 . $locale->text('Invoice') . qq|">
1113 if ($form->{type} =~ /sales_order$/) {
1115 <br>$form->{heading} als neue Vorlage verwenden für<br>
1116 <input class=submit type=submit name=action value="|
1117 . $locale->text('Purchase Order') . qq|">
1118 <input class=submit type=submit name=action value="|
1119 . $locale->text('Quotation') . qq|">
1122 } elsif ($form->{type} =~ /purchase_order$/) {
1124 <br>$form->{heading} als neue Vorlage verwenden für<br>
1125 <input class=submit type=submit name=action value="|
1126 . $locale->text('Sales Order') . qq|">
1127 <input class=submit type=submit name=action value="|
1128 . $locale->text('Request for Quotation') . qq|">
1133 <br>$form->{heading} als neue Vorlage verwenden für<br>
1134 <input class=submit type=submit name=action value="|
1135 . $locale->text('Order') . qq|">
1138 } elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount} && !$form->{proforma}) {
1140 <br>Workflow $form->{heading}<br>
1141 <input class=submit type=submit name=action value="|
1142 . $locale->text('Save as new') . qq|">
1143 <input class=submit type=submit name=action value="|
1144 . $locale->text('Invoice') . qq|">
1148 $form->hide_form("saved_xyznumber");
1152 <input type=hidden name=rowcount value=$form->{rowcount}>
1154 <input name=callback type=hidden value="$form->{callback}">
1156 <input type=hidden name=login value=$form->{login}>
1157 <input type=hidden name=password value=$form->{password}>
1164 $lxdebug->leave_sub();
1168 $lxdebug->enter_sub();
1170 set_headings($form->{"id"} ? "edit" : "add");
1172 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1173 qw(exchangerate creditlimit creditremaining);
1174 $form->{update} = 1;
1176 &check_name($form->{vc});
1179 $buysell = 'sell' if ($form->{vc} eq 'vendor');
1180 $form->{exchangerate} = $exchangerate
1184 $form->check_exchangerate(
1185 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
1189 $i = $form->{rowcount};
1191 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
1193 if ( ($form->{"partnumber_$i"} eq "")
1194 && ($form->{"description_$i"} eq "")
1195 && ($form->{"partsgroup_$i"} eq "")) {
1197 $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
1202 if ( $form->{type} eq 'purchase_order'
1203 || $form->{type} eq 'request_quotation') {
1204 IR->retrieve_item(\%myconfig, \%$form);
1206 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
1207 IS->retrieve_item(\%myconfig, \%$form);
1210 my $rows = scalar @{ $form->{item_list} };
1212 $form->{"discount_$i"} =
1213 $form->format_amount(\%myconfig, $form->{discount} * 100);
1216 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
1225 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
1226 if ($form->{"not_discountable_$i"}) {
1227 $form->{"discount_$i"} = 0;
1229 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
1230 qw(partnumber description unit);
1231 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
1232 keys %{ $form->{item_list}[0] };
1233 if ($form->{"part_payment_id_$i"} ne "") {
1234 $form->{payment_id} = $form->{"part_payment_id_$i"};
1237 $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
1239 ($dec) = ($s =~ /\.(\d+)/);
1241 $decimalplaces = ($dec > 2) ? $dec : 2;
1244 $form->{"sellprice_$i"} = $sellprice;
1247 $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
1249 # if there is an exchange rate adjust sellprice
1250 $form->{"sellprice_$i"} /= $exchangerate;
1254 $form->{"sellprice_$i"} * $form->{"qty_$i"} *
1255 (1 - $form->{"discount_$i"} / 100);
1256 map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
1257 map { $form->{"${_}_base"} += $amount }
1258 (split / /, $form->{"taxaccounts_$i"});
1259 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
1260 split / /, $form->{taxaccounts}
1261 if !$form->{taxincluded};
1263 $form->{creditremaining} -= $amount;
1265 $form->{"sellprice_$i"} =
1266 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
1269 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
1271 # get pricegroups for parts
1272 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
1274 # build up html code for prices_$i
1275 &set_pricegroup($i);
1282 # ok, so this is a new part
1283 # ask if it is a part or service item
1285 if ( $form->{"partsgroup_$i"}
1286 && ($form->{"partsnumber_$i"} eq "")
1287 && ($form->{"description_$i"} eq "")) {
1288 $form->{rowcount}--;
1289 $form->{"discount_$i"} = "";
1293 $form->{"id_$i"} = 0;
1294 $form->{"unit_$i"} = $locale->text('ea');
1302 $lxdebug->leave_sub();
1306 $lxdebug->enter_sub();
1308 if ($form->{type} eq 'purchase_order') {
1309 $form->{title} = $locale->text('Purchase Orders');
1310 $form->{vc} = 'vendor';
1311 $ordlabel = $locale->text('Order Number');
1312 $ordnumber = 'ordnumber';
1313 $employee = $locale->text('Employee');
1316 if ($form->{type} eq 'request_quotation') {
1317 $form->{title} = $locale->text('Request for Quotations');
1318 $form->{vc} = 'vendor';
1319 $ordlabel = $locale->text('RFQ Number');
1320 $ordnumber = 'quonumber';
1321 $employee = $locale->text('Employee');
1324 if ($form->{type} eq 'sales_order') {
1325 $form->{title} = $locale->text('Sales Orders');
1326 $form->{vc} = 'customer';
1327 $ordlabel = $locale->text('Order Number');
1328 $ordnumber = 'ordnumber';
1329 $employee = $locale->text('Employee');
1332 if ($form->{type} eq 'sales_quotation') {
1333 $form->{title} = $locale->text('Quotations');
1334 $form->{vc} = 'customer';
1335 $ordlabel = $locale->text('Quotation Number');
1336 $ordnumber = 'quonumber';
1337 $employee = $locale->text('Employee');
1340 # setup vendor / customer selection
1341 $form->all_vc(\%myconfig, $form->{vc},
1342 ($form->{vc} eq 'customer') ? "AR" : "AP");
1344 map { $vc .= "<option>$_->{name}--$_->{id}</option>\n" }
1345 @{ $form->{"all_$form->{vc}"} };
1347 $vclabel = ucfirst $form->{vc};
1348 $vclabel = $locale->text($vclabel);
1350 # $locale->text('Vendor')
1351 # $locale->text('Customer')
1355 ? qq|<select name=$form->{vc}><option>\n$vc</option></select>|
1356 : qq|<input name=$form->{vc} size=35>|;
1359 if (@{ $form->{all_departments} }) {
1360 $form->{selectdepartment} = "<option>\n";
1363 $form->{selectdepartment} .=
1364 "<option>$_->{description}--$_->{id}</option>\n"
1365 } (@{ $form->{all_departments} });
1370 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1371 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1373 | if $form->{selectdepartment};
1376 if (($form->{"type"} eq "sales_order") ||
1377 ($form->{"type"} eq "purchase_order")) {
1380 <td><input name="notdelivered" id="notdelivered" class="checkbox" type="checkbox" value="1" checked>
1381 <label for="notdelivered">|. $locale->text('Not delivered') . qq|</label></td>
1382 <td><input name="delivered" id="delivered" class="checkbox" type="checkbox" value="1" checked>
1383 <label for="delivered">| . $locale->text('Delivered') . qq|</label></td>
1388 # use JavaScript Calendar or not
1389 $form->{jsscript} = $jscalendar;
1391 if ($form->{jsscript}) {
1393 # with JavaScript Calendar
1395 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
1396 <input type=button name=transdatefrom id="trigger3" value=|
1397 . $locale->text('button') . qq|></td>
1400 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">
1401 <input type=button name=transdateto name=transdateto id="trigger4" value=|
1402 . $locale->text('button') . qq|></td>
1407 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
1408 "transdateto", "BL", "trigger4");
1411 # without JavaScript Calendar
1413 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\"></td>|;
1415 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\></td>|;
1418 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1423 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1424 push(@values, $item->{"id"});
1425 $labels{$item->{"id"}} = $item->{"projectnumber"};
1428 NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
1429 '-labels' => \%labels));
1436 <form method=post action=$form->{script}>
1440 <th class=listtop>$form->{title}</th>
1442 <tr height="5"></tr>
1447 <th align=right>$vclabel</th>
1448 <td colspan="3">$vc</td>
1452 <th align=right>$ordlabel</th>
1453 <td colspan=3><input name="$ordnumber" size=20></td>
1456 <th align="right">| . $locale->text("Project Number") . qq|</th>
1457 <td colspan="3">$projectnumber</td>
1460 <th align=right>| . $locale->text('From') . qq|</th>
1462 <th align=right>| . $locale->text('Bis') . qq|</th>
1465 <input type=hidden name=sort value=transdate>
1467 <th align=right>| . $locale->text('Include in Report') . qq|</th>
1471 <td><input type="checkbox" name="open" value="1" id="open" checked>
1472 <label for="open">| . $locale->text("Open") . qq|</td>
1473 <td><input type="checkbox" name="closed" value="1" id="closed">
1474 <label for="closed">| . $locale->text("Closed") . qq|</td>
1478 <td><input name="l_id" class=checkbox type=checkbox value=Y>
1479 | . $locale->text('ID') . qq|</td>
1480 <td><input name="l_$ordnumber" class=checkbox type=checkbox value=Y checked> $ordlabel</td>
1481 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
1482 . $locale->text('Date') . qq|</td>
1483 <td><input name="l_reqdate" class=checkbox type=checkbox value=Y checked> |
1484 . $locale->text('Required by') . qq|</td>
1487 <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vclabel</td>
1488 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1489 <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
1490 . $locale->text('Ship via') . qq|</td>
1491 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1494 <td><input name="l_netamount" class=checkbox type=checkbox value=Y> |
1495 . $locale->text('Amount') . qq|</td>
1496 <td><input name="l_tax" class=checkbox type=checkbox value=Y> |
1497 . $locale->text('Tax') . qq|</td>
1498 <td><input name="l_amount" class=checkbox type=checkbox value=Y checked> |
1499 . $locale->text('Total') . qq|</td>
1500 <td><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y> |
1501 . $locale->text('Project Number') . qq|</td>
1504 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
1505 . $locale->text('Subtotal') . qq|</td>
1513 <tr><td colspan=4><hr size=3 noshade></td></tr>
1519 <input type=hidden name=nextsub value=orders>
1520 <input type=hidden name=login value=$form->{login}>
1521 <input type=hidden name=password value=$form->{password}>
1522 <input type=hidden name=vc value=$form->{vc}>
1523 <input type=hidden name=type value=$form->{type}>
1525 <input class=submit type=submit name=action value="|
1526 . $locale->text('Continue') . qq|">
1533 $lxdebug->leave_sub();
1537 $lxdebug->enter_sub();
1539 # split vendor / customer
1540 ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
1541 split(/--/, $form->{ $form->{vc} });
1543 OE->transactions(\%myconfig, \%$form);
1545 $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
1547 $number = $form->escape($form->{$ordnumber});
1548 $name = $form->escape($form->{ $form->{vc} });
1549 $department = $form->escape($form->{department});
1553 "$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";
1555 # construct callback
1556 $number = $form->escape($form->{$ordnumber}, 1);
1557 $name = $form->escape($form->{ $form->{vc} }, 1);
1558 $department = $form->escape($form->{department}, 1);
1561 "$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 $form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
1565 "name", "netamount", "tax", "amount",
1566 "curr", "employee", "shipvia", "globalprojectnumber",
1567 "open", "closed", "delivered");
1569 $form->{l_open} = $form->{l_closed} = "Y"
1570 if ($form->{open} && $form->{closed});
1572 $form->{"l_delivered"} = "Y"
1573 if ($form->{"delivered"} && $form->{"notdelivered"});
1575 foreach $item (@columns) {
1576 if ($form->{"l_$item"} eq "Y") {
1577 push @column_index, $item;
1579 # add column to href and callback
1580 $callback .= "&l_$item=Y";
1581 $href .= "&l_$item=Y";
1585 # only show checkboxes if gotten here via sales_order form.
1586 if ($form->{type} =~ /sales_order/) {
1587 unshift @column_index, "ids";
1590 if ($form->{l_subtotal} eq 'Y') {
1591 $callback .= "&l_subtotal=Y";
1592 $href .= "&l_subtotal=Y";
1595 if ($form->{vc} eq 'vendor') {
1596 if ($form->{type} eq 'purchase_order') {
1597 $form->{title} = $locale->text('Purchase Orders');
1599 $form->{title} = $locale->text('Request for Quotations');
1601 $name = $locale->text('Vendor');
1602 $employee = $locale->text('Employee');
1604 if ($form->{vc} eq 'customer') {
1605 if ($form->{type} eq 'sales_order') {
1606 $form->{title} = $locale->text('Sales Orders');
1608 $form->{title} = $locale->text('Quotations');
1610 $employee = $locale->text('Employee');
1611 $name = $locale->text('Customer');
1614 $column_header{id} =
1615 qq|<th><a class=listheading href=$href&sort=id>|
1616 . $locale->text('ID')
1618 $column_header{transdate} =
1619 qq|<th><a class=listheading href=$href&sort=transdate>|
1620 . $locale->text('Date')
1622 $column_header{reqdate} =
1623 qq|<th><a class=listheading href=$href&sort=reqdate>|
1624 . $locale->text('Required by')
1626 $column_header{ordnumber} =
1627 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1628 . $locale->text('Order')
1630 $column_header{quonumber} =
1631 qq|<th><a class=listheading href=$href&sort=quonumber>|
1632 . ($form->{"type"} eq "request_quotation" ?
1633 $locale->text('RFQ') :
1634 $locale->text('Quotation'))
1636 $column_header{name} =
1637 qq|<th><a class=listheading href=$href&sort=name>$name</a></th>|;
1638 $column_header{netamount} =
1639 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1640 $column_header{tax} =
1641 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1642 $column_header{amount} =
1643 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1644 $column_header{curr} =
1645 qq|<th class=listheading>| . $locale->text('Curr') . qq|</th>|;
1646 $column_header{shipvia} =
1647 qq|<th><a class=listheading href=$href&sort=shipvia>|
1648 . $locale->text('Ship via')
1650 $column_header{globalprojectnumber} =
1651 qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|;
1652 $column_header{open} =
1653 qq|<th class=listheading>| . $locale->text('O') . qq|</th>|;
1654 $column_header{closed} =
1655 qq|<th class=listheading>| . $locale->text('C') . qq|</th>|;
1656 $column_header{"delivered"} =
1657 qq|<th class="listheading">| . $locale->text("Delivered") . qq|</th>|;
1659 $column_header{employee} =
1660 qq|<th><a class=listheading href=$href&sort=employee>$employee</a></th>|;
1662 $column_header{ids} = qq|<th></th>|;
1664 if ($form->{ $form->{vc} }) {
1665 $option = $locale->text(ucfirst $form->{vc});
1666 $option .= " : $form->{$form->{vc}}";
1668 if ($form->{department}) {
1669 $option .= "\n<br>" if ($option);
1670 ($department) = split /--/, $form->{department};
1671 $option .= $locale->text('Department') . " : $department";
1673 if ($form->{transdatefrom}) {
1675 . $locale->text('From') . " "
1676 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1678 if ($form->{transdateto}) {
1680 . $locale->text('Bis') . " "
1681 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1683 if ($form->{open}) {
1684 $option .= "\n<br>" if ($option);
1685 $option .= $locale->text('Open');
1687 if ($form->{closed}) {
1688 $option .= "\n<br>" if ($option);
1689 $option .= $locale->text('Closed');
1697 <form method="post" action="oe.pl">
1700 <th class=listtop>$form->{title}</th>
1702 <tr height="5"></tr>
1709 <tr class=listheading>|;
1711 map { print "\n$column_header{$_}" } @column_index;
1717 # add sort and escape callback
1718 $callback_escaped = $form->escape($callback . "&sort=$form->{sort}");
1720 if (@{ $form->{OE} }) {
1721 $sameitem = $form->{OE}->[0]->{ $form->{sort} };
1726 foreach $oe (@{ $form->{OE} }) {
1727 $form->{rowcount} = ++$j;
1729 if ($form->{l_subtotal} eq 'Y') {
1730 if ($sameitem ne $oe->{ $form->{sort} }) {
1732 $sameitem = $oe->{ $form->{sort} };
1736 map { $oe->{$_} *= $oe->{exchangerate} } (qw(netamount amount));
1738 $column_data{netamount} =
1740 . $form->format_amount(\%myconfig, $oe->{netamount}, 2, " ")
1742 $column_data{tax} = "<td align=right>"
1743 . $form->format_amount(\%myconfig, $oe->{amount} - $oe->{netamount},
1746 $column_data{amount} =
1748 . $form->format_amount(\%myconfig, $oe->{amount}, 2, " ") . "</td>";
1750 $totalnetamount += $oe->{netamount};
1751 $totalamount += $oe->{amount};
1753 $subtotalnetamount += $oe->{netamount};
1754 $subtotalamount += $oe->{amount};
1757 qq|<td><input name="multi_id_$j" class=checkbox type=checkbox><input type="hidden" name="trans_id_$j" value="$oe->{id}"></td>|;
1758 $column_data{id} = "<td>$oe->{id}</td>";
1759 $column_data{transdate} = "<td>$oe->{transdate} </td>";
1760 $column_data{reqdate} = "<td>$oe->{reqdate} </td>";
1762 $column_data{$ordnumber} =
1763 "<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>";
1764 $column_data{name} = "<td>$oe->{name}</td>";
1766 $column_data{employee} = "<td>$oe->{employee} </td>";
1767 $column_data{shipvia} = "<td>$oe->{shipvia} </td>";
1768 $column_data{globalprojectnumber} = "<td>" . H($oe->{globalprojectnumber}) . "</td>";
1770 if ($oe->{closed}) {
1771 $column_data{closed} = "<td align=center>X</td>";
1772 $column_data{open} = "<td> </td>";
1774 $column_data{closed} = "<td> </td>";
1775 $column_data{open} = "<td align=center>X</td>";
1777 $column_data{"delivered"} = "<td>" .
1778 ($oe->{"delivered"} ? $locale->text("Yes") : $locale->text("No")) .
1784 <tr class=listrow$i>";
1786 map { print "\n$column_data{$_}" } @column_index;
1794 if ($form->{l_subtotal} eq 'Y') {
1800 <tr class=listtotal>|;
1802 map { $column_data{$_} = "<td> </td>" } @column_index;
1804 $column_data{netamount} =
1805 "<th class=listtotal align=right>"
1806 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1807 $column_data{tax} = "<th class=listtotal align=right>"
1808 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1811 $column_data{amount} =
1812 "<th class=listtotal align=right>"
1813 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1815 map { print "\n$column_data{$_}" } @column_index;
1823 <td><hr size=3 noshade></td>
1827 # multiple invoice edit button only if gotten there via sales_order form.
1829 if ($form->{type} =~ /sales_order/) {
1831 <input class"submit" type="submit" name="action" value="|
1832 . $locale->text('Continue') . qq|">
1833 <input type="hidden" name="nextsub" value="edit">
1834 <input type="hidden" name="type" value="$form->{type}">
1835 <input type="hidden" name="vc" value="$form->{vc}">
1836 <input type="hidden" name="login" value="$form->{login}">
1837 <input type="hidden" name="password" value="$form->{password}">
1838 <input type="hidden" name="callback" value="$callback">
1839 <input type="hidden" name="rowcount" value="$form->{rowcount}">|;
1846 <form method=post action=$form->{script}>
1848 <input name=callback type=hidden value="$form->{callback}">
1850 <input type=hidden name=type value=$form->{type}>
1851 <input type=hidden name=vc value=$form->{vc}>
1853 <input type=hidden name=login value=$form->{login}>
1854 <input type=hidden name=password value=$form->{password}>
1862 $lxdebug->leave_sub();
1866 $lxdebug->enter_sub();
1868 map { $column_data{$_} = "<td> </td>" } @column_index;
1870 $column_data{netamount} =
1871 "<th class=listsubtotal align=right>"
1872 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1874 $column_data{tax} = "<td class=listsubtotal align=right>"
1875 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1878 $column_data{amount} =
1879 "<th class=listsubtotal align=right>"
1880 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1882 $subtotalnetamount = 0;
1883 $subtotalamount = 0;
1886 <tr class=listsubtotal>
1889 map { print "\n$column_data{$_}" } @column_index;
1895 $lxdebug->leave_sub();
1898 sub save_and_close {
1899 $lxdebug->enter_sub();
1901 if ($form->{type} =~ /_order$/) {
1902 $form->isblank("transdate", $locale->text('Order Date missing!'));
1904 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1907 $msg = ucfirst $form->{vc};
1908 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
1910 # $locale->text('Customer missing!');
1911 # $locale->text('Vendor missing!');
1913 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1914 if ($form->{currency} ne $form->{defaultcurrency});
1918 # if the name changed get new values
1919 if (&check_name($form->{vc})) {
1924 $form->{id} = 0 if $form->{saveasnew};
1926 # this is for the internal notes section for the [email] Subject
1927 if ($form->{type} =~ /_order$/) {
1928 if ($form->{type} eq 'sales_order') {
1929 $form->{label} = $locale->text('Sales Order');
1931 $numberfld = "sonumber";
1932 $ordnumber = "ordnumber";
1934 $form->{label} = $locale->text('Purchase Order');
1936 $numberfld = "ponumber";
1937 $ordnumber = "ordnumber";
1940 $err = $locale->text('Cannot save order!');
1943 if ($form->{type} eq 'sales_quotation') {
1944 $form->{label} = $locale->text('Quotation');
1946 $numberfld = "sqnumber";
1947 $ordnumber = "quonumber";
1949 $form->{label} = $locale->text('Request for Quotation');
1951 $numberfld = "rfqnumber";
1952 $ordnumber = "quonumber";
1955 $err = $locale->text('Cannot save quotation!');
1959 # get new number in sequence if no number is given or if saveasnew was requested
1960 if (!$form->{$ordnumber} || $form->{saveasnew}) {
1961 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld);
1966 $form->error($err) if (!OE->save(\%myconfig, \%$form));
1968 # saving the history
1969 if(!exists $form->{addition}) {
1970 $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
1971 $form->{addition} = "SAVED";
1972 $form->save_history($form->dbconnect(\%myconfig));
1974 # /saving the history
1976 $form->redirect($form->{label} . " $form->{$ordnumber} " .
1977 $locale->text('saved!'));
1979 $lxdebug->leave_sub();
1983 $lxdebug->enter_sub();
1985 if ($form->{type} =~ /_order$/) {
1986 $form->isblank("transdate", $locale->text('Order Date missing!'));
1988 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1991 $msg = ucfirst $form->{vc};
1992 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
1994 # $locale->text('Customer missing!');
1995 # $locale->text('Vendor missing!');
1997 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1998 if ($form->{currency} ne $form->{defaultcurrency});
2002 # if the name changed get new values
2003 if (&check_name($form->{vc})) {
2008 $form->{id} = 0 if $form->{saveasnew};
2010 # this is for the internal notes section for the [email] Subject
2011 if ($form->{type} =~ /_order$/) {
2012 if ($form->{type} eq 'sales_order') {
2013 $form->{label} = $locale->text('Sales Order');
2015 $numberfld = "sonumber";
2016 $ordnumber = "ordnumber";
2018 $form->{label} = $locale->text('Purchase Order');
2020 $numberfld = "ponumber";
2021 $ordnumber = "ordnumber";
2024 $err = $locale->text('Cannot save order!');
2027 if ($form->{type} eq 'sales_quotation') {
2028 $form->{label} = $locale->text('Quotation');
2030 $numberfld = "sqnumber";
2031 $ordnumber = "quonumber";
2033 $form->{label} = $locale->text('Request for Quotation');
2035 $numberfld = "rfqnumber";
2036 $ordnumber = "quonumber";
2039 $err = $locale->text('Cannot save quotation!');
2043 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld)
2044 unless $form->{$ordnumber};
2048 OE->save(\%myconfig, \%$form);
2050 # saving the history
2051 if(!exists $form->{addition}) {
2052 $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
2053 $form->{addition} = "SAVED";
2054 $form->save_history($form->dbconnect(\%myconfig));
2056 # /saving the history
2058 $form->{simple_save} = 1;
2059 if(!$form->{print_and_save}) {
2060 set_headings("edit");
2064 $lxdebug->leave_sub();
2068 $lxdebug->enter_sub();
2072 if ($form->{type} =~ /_order$/) {
2073 $msg = $locale->text('Are you sure you want to delete Order Number');
2074 $ordnumber = 'ordnumber';
2076 $msg = $locale->text('Are you sure you want to delete Quotation Number');
2077 $ordnumber = 'quonumber';
2083 <form method=post action=$form->{script}>
2086 # delete action variable
2087 map { delete $form->{$_} } qw(action header);
2089 foreach $key (keys %$form) {
2090 $form->{$key} =~ s/\"/"/g;
2091 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2095 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
2097 <h4>$msg $form->{$ordnumber}</h4>
2099 <input name=action class=submit type=submit value="|
2100 . $locale->text('Yes') . qq|">
2107 $lxdebug->leave_sub();
2111 $lxdebug->enter_sub();
2113 if ($form->{type} =~ /_order$/) {
2114 $msg = $locale->text('Order deleted!');
2115 $err = $locale->text('Cannot delete order!');
2117 $msg = $locale->text('Quotation deleted!');
2118 $err = $locale->text('Cannot delete quotation!');
2120 if (OE->delete(\%myconfig, \%$form, $spool)){
2121 $form->redirect($msg);
2122 # saving the history
2123 if(!exists $form->{addition}) {
2124 $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
2125 $form->{addition} = "DELETED";
2126 $form->save_history($form->dbconnect(\%myconfig));
2128 # /saving the history
2132 $lxdebug->leave_sub();
2136 $lxdebug->enter_sub();
2138 if ($form->{type} =~ /_order$/) {
2140 # these checks only apply if the items don't bring their own ordnumbers/transdates.
2141 # The if clause ensures that by searching for empty ordnumber_#/transdate_# fields.
2142 $form->isblank("ordnumber", $locale->text('Order Number missing!'))
2143 if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
2144 $form->isblank("transdate", $locale->text('Order Date missing!'))
2145 if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''});
2147 # also copy deliverydate from the order
2148 $form->{deliverydate} = $form->{reqdate} if $form->{reqdate};
2149 $form->{orddate} = $form->{transdate};
2151 $form->isblank("quonumber", $locale->text('Quotation Number missing!'));
2152 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
2153 $form->{ordnumber} = "";
2154 $form->{quodate} = $form->{transdate};
2157 # if the name changed get new values
2158 if (&check_name($form->{vc})) {
2163 $form->{cp_id} *= 1;
2165 for $i (1 .. $form->{rowcount}) {
2166 map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
2167 $form->{"${_}_${i}"})
2168 if ($form->{"${_}_${i}"}) }
2169 qw(ship qty sellprice listprice basefactor));
2172 if ( $form->{type} =~ /_order/
2173 && $form->{currency} ne $form->{defaultcurrency}) {
2175 # check if we need a new exchangerate
2176 $buysell = ($form->{type} eq 'sales_order') ? "buy" : "sell";
2178 $orddate = $form->current_date(\%myconfig);
2180 $form->check_exchangerate(\%myconfig, $form->{currency}, $orddate,
2183 if (!$exchangerate) {
2184 &backorder_exchangerate($orddate, $buysell);
2189 # close orders/quotations
2190 $form->{closed} = 1;
2192 # save order if one ordnumber has been given
2193 # if not it's most likely a collective order, which can't be saved back
2194 # so they just have to be closed
2195 if (($form->{ordnumber} ne '') || ($form->{quonumber} ne '')) {
2196 OE->close_order(\%myconfig, \%$form);
2198 OE->close_orders(\%myconfig, \%$form);
2201 $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
2203 $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
2206 $form->{closed} = 0;
2207 $form->{rowcount}--;
2208 $form->{shipto} = 1;
2210 if ($form->{type} =~ /_order$/) {
2211 $form->{exchangerate} = $exchangerate;
2215 if ( $form->{type} eq 'purchase_order'
2216 || $form->{type} eq 'request_quotation') {
2217 $form->{title} = $locale->text('Add Vendor Invoice');
2218 $form->{script} = 'ir.pl';
2222 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
2223 $form->{title} = $locale->text('Add Sales Invoice');
2224 $form->{script} = 'is.pl';
2229 # bo creates the id, reset it
2230 map { delete $form->{$_} }
2231 qw(id subject message cc bcc printed emailed queued);
2232 $form->{ $form->{vc} } =~ s/--.*//g;
2233 $form->{type} = "invoice";
2236 $locale = new Locale "$myconfig{countrycode}", "$script";
2238 require "bin/mozilla/$form->{script}";
2240 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
2242 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2243 qw(creditlimit creditremaining);
2245 $currency = $form->{currency};
2248 $form->{currency} = $currency;
2249 $form->{exchangerate} = "";
2250 $form->{forex} = "";
2251 $form->{exchangerate} = $exchangerate
2255 $form->check_exchangerate(
2256 \%myconfig, $form->{currency}, $form->{invdate}, $buysell
2259 $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
2264 for $i (1 .. $form->{rowcount}) {
2265 $form->{"discount_$i"} =
2266 $form->format_amount(\%myconfig, $form->{"discount_$i"});
2268 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
2270 $decimalplaces = ($dec > 2) ? $dec : 2;
2272 # copy delivery date from reqdate for order -> invoice conversion
2273 $form->{"deliverydate_$i"} = $form->{"reqdate_$i"}
2274 unless $form->{"deliverydate_$i"};
2276 $form->{"sellprice_$i"} =
2277 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
2280 (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
2281 $dec_qty = length $dec_qty;
2283 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
2285 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2286 qw(partnumber description unit);
2292 $lxdebug->leave_sub();
2295 sub backorder_exchangerate {
2296 $lxdebug->enter_sub();
2297 my ($orddate, $buysell) = @_;
2304 <form method=post action=$form->{script}>
2307 # delete action variable
2308 map { delete $form->{$_} } qw(action header exchangerate);
2310 foreach $key (keys %$form) {
2311 $form->{$key} =~ s/\"/"/g;
2312 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2315 $form->{title} = $locale->text('Add Exchangerate');
2319 <input type=hidden name=login value=$form->{login}>
2320 <input type=hidden name=password value=$form->{password}>
2322 <input type=hidden name=exchangeratedate value=$orddate>
2323 <input type=hidden name=buysell value=$buysell>
2326 <tr><th class=listtop>$form->{title}</th></tr>
2327 <tr height="5"></tr>
2332 <th align=right>| . $locale->text('Currency') . qq|</th>
2333 <td>$form->{currency}</td>
2336 <th align=right>| . $locale->text('Date') . qq|</th>
2340 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
2341 <td><input name=exchangerate size=11></td>
2351 <input type=hidden name=nextsub value=save_exchangerate>
2353 <input name=action class=submit type=submit value="|
2354 . $locale->text('Continue') . qq|">
2362 $lxdebug->leave_sub();
2365 sub save_exchangerate {
2366 $lxdebug->enter_sub();
2368 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'));
2369 $form->{exchangerate} =
2370 $form->parse_amount(\%myconfig, $form->{exchangerate});
2371 $form->save_exchangerate(\%myconfig, $form->{currency},
2372 $form->{exchangeratedate},
2373 $form->{exchangerate}, $form->{buysell});
2377 $lxdebug->leave_sub();
2380 sub create_backorder {
2381 $lxdebug->enter_sub();
2383 $form->{shipped} = 1;
2385 # figure out if we need to create a backorder
2386 # items aren't saved if qty != 0
2388 for $i (1 .. $form->{rowcount}) {
2389 $totalqty += $qty = $form->{"qty_$i"};
2390 $totalship += $ship = $form->{"ship_$i"};
2392 $form->{"qty_$i"} = $qty - $ship;
2395 if ($totalship == 0) {
2396 map { $form->{"ship_$_"} = $form->{"qty_$_"} } (1 .. $form->{rowcount});
2397 $form->{ordtotal} = 0;
2398 $form->{shipped} = 0;
2402 if ($totalqty == $totalship) {
2403 map { $form->{"qty_$_"} = $form->{"ship_$_"} } (1 .. $form->{rowcount});
2404 $form->{ordtotal} = 0;
2409 qw(partnumber description qty ship unit sellprice discount id inventory_accno bin income_accno expense_accno listprice assembly taxaccounts partsgroup)
2412 for $i (1 .. $form->{rowcount}) {
2414 $form->{"${_}_$i"} =
2415 $form->format_amount(\%myconfig, $form->{"${_}_$i"})
2416 } qw(sellprice discount);
2421 OE->save(\%myconfig, \%$form);
2423 # rebuild rows for invoice
2427 for $i (1 .. $form->{rowcount}) {
2428 $form->{"qty_$i"} = $form->{"ship_$i"};
2430 if ($form->{"qty_$i"}) {
2433 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
2438 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
2439 $form->{rowcount} = $count;
2441 $lxdebug->leave_sub();
2445 $lxdebug->enter_sub();
2447 $form->{saveasnew} = 1;
2448 $form->{closed} = 0;
2449 map { delete $form->{$_} } qw(printed emailed queued);
2451 # Let Lx-Office assign a new order number if the user hasn't changed the
2452 # previous one. If it has been changed manually then use it as-is.
2453 my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
2454 if ($form->{saved_xyznumber} &&
2455 ($form->{saved_xyznumber} eq $form->{$idx})) {
2456 delete($form->{$idx});
2461 $lxdebug->leave_sub();
2464 sub purchase_order {
2465 $lxdebug->enter_sub();
2467 if ( $form->{type} eq 'sales_quotation'
2468 || $form->{type} eq 'request_quotation') {
2469 OE->close_order(\%myconfig, \%$form);
2472 if ($form->{type} =~ /^sales_/) {
2473 delete($form->{ordnumber});
2476 $form->{cp_id} *= 1;
2478 $form->{title} = $locale->text('Add Purchase Order');
2479 $form->{vc} = "vendor";
2480 $form->{type} = "purchase_order";
2484 $lxdebug->leave_sub();
2488 $lxdebug->enter_sub();
2490 if ( $form->{type} eq 'sales_quotation'
2491 || $form->{type} eq 'request_quotation') {
2492 OE->close_order(\%myconfig, $form);
2495 if ($form->{type} eq "purchase_order") {
2496 delete($form->{ordnumber});
2499 $form->{cp_id} *= 1;
2501 $form->{title} = $locale->text('Add Sales Order');
2502 $form->{vc} = "customer";
2503 $form->{type} = "sales_order";
2507 $lxdebug->leave_sub();
2511 $lxdebug->enter_sub();
2513 $form->{transdate} = $form->current_date(\%myconfig);
2514 delete $form->{duedate};
2516 $form->{closed} = 0;
2519 map { delete $form->{$_} }
2520 qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
2522 for $i (1 .. $form->{rowcount}) {
2523 map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
2524 $form->{"${_}_${i}"})
2525 if ($form->{"${_}_${i}"}) }
2526 qw(ship qty sellprice listprice basefactor));
2534 for $i (1 .. $form->{rowcount} - 1) {
2535 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2536 qw(partnumber description unit);
2539 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 0, "0") }
2540 qw(creditlimit creditremaining);
2544 $lxdebug->leave_sub();
2548 $lxdebug->enter_sub();
2550 $form->{print_and_save} = 1;
2555 my $saved_form = save_form();
2560 map({ $saved_vars{$_} = $form->{$_}; } qw(id ordnumber quonumber));
2561 restore_form($saved_form);
2562 map({ $form->{$_} = $saved_vars{$_}; } qw(id ordnumber quonumber));
2567 $lxdebug->leave_sub();