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 #======================================================================
39 require "$form->{path}/io.pl";
40 require "$form->{path}/arap.pl";
47 $lxdebug->enter_sub();
49 if ($form->{type} eq 'purchase_order') {
50 $form->{title} = $locale->text('Add Purchase Order');
51 $form->{vc} = 'vendor';
53 if ($form->{type} eq 'sales_order') {
54 $form->{title} = $locale->text('Add Sales Order');
55 $form->{vc} = 'customer';
57 if ($form->{type} eq 'request_quotation') {
58 $form->{title} = $locale->text('Add Request for Quotation');
59 $form->{vc} = 'vendor';
61 if ($form->{type} eq 'sales_quotation') {
62 $form->{title} = $locale->text('Add Quotation');
63 $form->{vc} = 'customer';
67 "$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&path=$form->{path}&password=$form->{password}"
68 unless $form->{callback};
74 $lxdebug->leave_sub();
78 $lxdebug->enter_sub();
80 if ($form->{type} eq 'purchase_order') {
81 $form->{title} = $locale->text('Edit Purchase Order');
82 $form->{heading} = $locale->text('Purchase Order');
83 $form->{vc} = 'vendor';
85 if ($form->{type} eq 'sales_order') {
86 $form->{title} = $locale->text('Edit Sales Order');
87 $form->{heading} = $locale->text('Sales Order');
88 $form->{vc} = 'customer';
90 if ($form->{type} eq 'request_quotation') {
91 $form->{title} = $locale->text('Edit Request for Quotation');
92 $form->{heading} = $locale->text('Request for Quotation');
93 $form->{vc} = 'vendor';
95 if ($form->{type} eq 'sales_quotation') {
96 $form->{title} = $locale->text('Edit Quotation');
97 $form->{heading} = $locale->text('Quotation');
98 $form->{vc} = 'customer';
105 $lxdebug->leave_sub();
109 $lxdebug->enter_sub();
111 # get customer/vendor
112 $form->all_vc(\%myconfig, $form->{vc},
113 ($form->{vc} eq 'customer') ? "AR" : "AP");
115 # retrieve order/quotation
116 $form->{webdav} = $webdav;
119 $form->{jscalendar} = $jscalendar;
121 OE->retrieve(\%myconfig, \%$form);
123 $taxincluded = $form->{taxincluded};
124 $form->{shipto} = 1 if $form->{id};
126 if ($form->{"all_$form->{vc}"}) {
127 unless ($form->{"$form->{vc}_id"}) {
128 $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
132 $cp_id = $form->{cp_id};
133 $intnotes = $form->{intnotes};
135 # get customer / vendor
136 if ($form->{type} =~ /(purchase_order|request_quotation|receive_order)/) {
137 IR->get_vendor(\%myconfig, \%$form);
139 if ($form->{type} =~ /(sales|ship)_(order|quotation)/) {
140 IS->get_customer(\%myconfig, \%$form);
142 $form->{cp_id} = $cp_id;
144 $form->{intnotes} = $intnotes;
145 ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
146 $form->{"old$form->{vc}"} =
147 qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
149 # build the popup menus
150 if (@{ $form->{"all_$form->{vc}"} }) {
151 $form->{ $form->{vc} } =
152 qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
153 map { $form->{"select$form->{vc}"} .= "<option>$_->{name}--$_->{id}\n" }
154 (@{ $form->{"all_$form->{vc}"} });
158 @curr = split /:/, $form->{currencies};
160 $form->{defaultcurrency} = $curr[0];
161 $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
163 map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
165 $form->{taxincluded} = $taxincluded if ($form->{id});
168 if (@{ $form->{all_departments} }) {
169 $form->{selectdepartment} = "<option>\n";
170 $form->{department} = "$form->{department}--$form->{department_id}";
173 $form->{selectdepartment} .=
174 "<option>$_->{description}--$_->{id}\n"
175 } (@{ $form->{all_departments} });
178 $form->{employee} = "$form->{employee}--$form->{employee_id}";
181 if (@{ $form->{all_employees} }) {
182 $form->{selectemployee} = "";
183 map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
184 (@{ $form->{all_employees} });
188 $form->{forex} = $form->{exchangerate};
190 $lxdebug->leave_sub();
194 $lxdebug->enter_sub();
195 $form->{format} = "html";
196 $form->{media} = "screen";
197 $form->{formname} = $form->{type};
201 map { $form->{$_} =~ s/\"/"/g }
202 qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact);
204 foreach $ref (@{ $form->{form_details} }) {
206 map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
207 $form->{"discount_$i"} =
208 $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
210 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
212 $decimalplaces = ($dec > 2) ? $dec : 2;
214 $form->{"sellprice_$i"} =
215 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
217 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
219 map { $form->{"${_}_$i"} =~ s/\"/"/g }
220 qw(partnumber description unit);
221 $form->{rowcount} = $i;
225 $lxdebug->leave_sub();
229 $lxdebug->enter_sub();
231 $checkedopen = ($form->{closed}) ? "" : "checked";
232 $checkedclosed = ($form->{closed}) ? "checked" : "";
234 # use JavaScript Calendar or not
235 $form->{jsscript} = $form->{jscalendar};
238 if ($form->{jsscript}) {
240 # with JavaScript Calendar
242 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
243 <td><input type=button name=transdate id="trigger1" value=|
244 . $locale->text('button')
248 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>
249 <td width="4"><input type=button name=reqdate name=reqdate id="trigger2" value=|
250 . $locale->text('button')
256 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
257 "reqdate", "BL", "trigger2");
261 # without JavaScript Calendar
263 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
265 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>|;
271 <td colspan=2 align=center>
274 <th nowrap><input name=closed type=radio class=radio value=0 $checkedopen> |
275 . $locale->text('Open')
277 <th nowrap><input name=closed type=radio class=radio value=1 $checkedclosed> |
278 . $locale->text('Closed')
287 # set option selected
288 foreach $item ($form->{vc}, currency, department, employee, contact) {
289 $form->{"select$item"} =~ s/ selected//;
290 $form->{"select$item"} =~
291 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
295 if ($form->{all_contacts}) {
297 $form->{selectcontact} = "";
298 foreach $item (@{ $form->{all_contacts} }) {
299 if ($form->{cp_id} == $item->{cp_id}) {
300 $form->{selectcontact} .=
301 "<option selected>$item->{cp_name}--$item->{cp_id}";
303 $form->{selectcontact} .= "<option>$item->{cp_name}--$item->{cp_id}";
308 $form->{exchangerate} =
309 $form->format_amount(\%myconfig, $form->{exchangerate});
311 $form->{creditlimit} =
312 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
313 $form->{creditremaining} =
314 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
317 ($form->{selectcontact})
318 ? qq|<select name=contact>$form->{selectcontact}</select>\n<input type=hidden name="selectcontact" value="$form->{selectcontact}">|
319 : qq|<input name=contact value="$form->{contact}" size=35>|;
322 <input type=hidden name=forex value=$form->{forex}>
325 if ($form->{currency} ne $form->{defaultcurrency}) {
326 if ($form->{forex}) {
329 . $locale->text('Exchangerate')
330 . qq|</th><td>$form->{exchangerate}</td>
331 <input type=hidden name=exchangerate value=$form->{exchangerate}>
336 . $locale->text('Exchangerate')
337 . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
341 $vclabel = ucfirst $form->{vc};
342 $vclabel = $locale->text($vclabel);
346 <th align=right nowrap>| . $locale->text('Terms: Net') . qq|</th>
347 <td nowrap><input name=terms size="3" maxlength="3" value=$form->{terms}> |
348 . $locale->text('days')
353 if ($form->{business}) {
356 <th align=right>| . $locale->text('Business') . qq|</th>
357 <td>$form->{business}</td>
358 <th align=right>| . $locale->text('Trade Discount') . qq|</th>
360 . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
366 if ($form->{type} !~ /_quotation$/) {
369 <th width=70% align=right nowrap>| . $locale->text('Order Number') . qq|</th>
370 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
373 <th width=70% align=right nowrap>|
374 . $locale->text('Quotation Number')
376 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
379 <th width=70% align=right nowrap>|
380 . $locale->text('Customer Order Number')
382 <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
385 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
390 <th align=right nowrap=true>| . $locale->text('Required by') . qq|</th>
395 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
397 $creditremaining = qq|
403 <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
404 <td>$form->{creditlimit}</td>
406 <th nowrap>| . $locale->text('Remaining') . qq|</th>
407 <td class="plus$n">$form->{creditremaining}</td>
415 ($form->{type} eq 'sales_quotation')
416 ? $locale->text('Valid until')
417 : $locale->text('Required by');
418 if ($form->{type} eq 'sales_quotation') {
421 <th width=70% align=right nowrap>|
422 . $locale->text('Quotation Number')
424 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
425 <input type=hidden name=ordnumber value="$form->{ordnumber}">
431 <th width=70% align=right nowrap>| . $locale->text('RFQ Number') . qq|</th>
432 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
433 <input type=hidden name=ordnumber value="$form->{ordnumber}">
442 <th align=right nowrap>| . $locale->text('Quotation Date') . qq|</th>
446 <th align=right nowrap=true>$reqlabel</th>
454 ($form->{"select$form->{vc}"})
455 ? qq|<select name=$form->{vc}>$form->{"select$form->{vc}"}</select>\n<input type=hidden name="select$form->{vc}" value="$form->{"select$form->{vc}"}">|
456 : qq|<input name=$form->{vc} value="$form->{$form->{vc}}" size=35>|;
460 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
461 <td colspan=3><select name=department>$form->{selectdepartment}</select>
462 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
465 | if $form->{selectdepartment};
468 <input type=hidden name=employee value="$form->{employee}">
471 if ($form->{type} eq 'sales_order') {
472 if ($form->{selectemployee}) {
475 <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
476 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
477 <input type=hidden name=selectemployee value="$form->{selectemployee}">
485 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
486 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
487 <input type=hidden name=selectemployee value="$form->{selectemployee}">
498 <form method=post action=$form->{script}>
500 <input type=hidden name=id value=$form->{id}>
502 <input type=hidden name=type value=$form->{type}>
503 <input type=hidden name=formname value=$form->{formname}>
504 <input type=hidden name=media value=$form->{media}>
505 <input type=hidden name=format value=$form->{format}>
507 <input type=hidden name=queued value="$form->{queued}">
508 <input type=hidden name=printed value="$form->{printed}">
509 <input type=hidden name=emailed value="$form->{emailed}">
511 <input type=hidden name=vc value=$form->{vc}>
513 <input type=hidden name=title value="$form->{title}">
515 <input type=hidden name=discount value=$form->{discount}>
516 <input type=hidden name=creditlimit value=$form->{creditlimit}>
517 <input type=hidden name=creditremaining value=$form->{creditremaining}>
519 <input type=hidden name=tradediscount value=$form->{tradediscount}>
520 <input type=hidden name=business value=$form->{business}>
521 <input type=hidden name=webdav value=$webdav>
525 <th class=listtop>$form->{title}</th>
535 <th align=right>$vclabel</th>
536 <td colspan=3>$vc</td>
537 <input type=hidden name=$form->{vc}_id value=$form->{"$form->{vc}_id"}>
538 <input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
539 <th align=richt nowrap>|
540 . $locale->text('Contact Person')
542 <td colspan=3>$contact</td>
548 <th align=right>| . $locale->text('Currency') . qq|</th>
549 <td><select name=currency>$form->{selectcurrency}</select></td>
550 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
551 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
555 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
556 <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
559 <th align=right>| . $locale->text('Ship via') . qq|</th>
560 <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
579 <!-- shipto are in hidden variables -->
581 <input type=hidden name=shiptoname value="$form->{shiptoname}">
582 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
583 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
584 <input type=hidden name=shiptocity value="$form->{shiptocity}">
585 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
586 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
587 <input type=hidden name=shiptophone value="$form->{shiptophone}">
588 <input type=hidden name=shiptofax value="$form->{shiptofax}">
589 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
591 <!-- email variables -->
592 <input type=hidden name=message value="$form->{message}">
593 <input type=hidden name=email value="$form->{email}">
594 <input type=hidden name=subject value="$form->{subject}">
595 <input type=hidden name=cc value="$form->{cc}">
596 <input type=hidden name=bcc value="$form->{bcc}">
598 <input type=hidden name=taxpart value="$form->{taxpart}">
599 <input type=hidden name=taxservice value="$form->{taxservice}">
601 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
604 foreach $item (split / /, $form->{taxaccounts}) {
606 <input type=hidden name="${item}_rate" value=$form->{"${item}_rate"}>
607 <input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
610 $lxdebug->leave_sub();
614 $lxdebug->enter_sub();
616 $form->{invtotal} = $form->{invsubtotal};
618 if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
621 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
624 $rows = ($rows > $introws) ? $rows : $introws;
626 qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
628 qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
630 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
633 if ($form->{taxaccounts}) {
635 <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
636 . $locale->text('Tax Included')
641 if (!$form->{taxincluded}) {
643 foreach $item (split / /, $form->{taxaccounts}) {
644 if ($form->{"${item}_base"}) {
645 $form->{invtotal} += $form->{"${item}_total"} =
647 $form->{"${item}_base"} * $form->{"${item}_rate"},
649 $form->{"${item}_total"} =
650 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
654 <th align=right>$form->{"${item}_description"}</th>
655 <td align=right>$form->{"${item}_total"}</td>
661 $form->{invsubtotal} =
662 $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
666 <th align=right>| . $locale->text('Subtotal') . qq|</th>
667 <td align=right>$form->{invsubtotal}</td>
673 if ($form->{taxincluded}) {
674 foreach $item (split / /, $form->{taxaccounts}) {
675 if ($form->{"${item}_base"}) {
676 $form->{"${item}_total"} =
678 ($form->{"${item}_base"} * $form->{"${item}_rate"} /
679 (1 + $form->{"${item}_rate"})
682 $form->{"${item}_netto"} =
684 ($form->{"${item}_base"} - $form->{"${item}_total"}),
686 $form->{"${item}_total"} =
687 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
688 $form->{"${item}_netto"} =
689 $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
693 <th align=right>Enthaltene $form->{"${item}_description"}</th>
694 <td align=right>$form->{"${item}_total"}</td>
697 <th align=right>Nettobetrag</th>
698 <td align=right>$form->{"${item}_netto"}</td>
706 $form->{oldinvtotal} = $form->{invtotal};
708 $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
718 <th align=left>| . $locale->text('Notes') . qq|</th>
719 <th align=left>| . $locale->text('Internal Notes') . qq|</th>
727 <td align=right width=100%>
733 <th align=right>| . $locale->text('Total') . qq|</th>
734 <td align=right>$form->{invtotal}</td>
742 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
743 <input type=hidden name=oldtotalpaid value=$totalpaid>
745 <td><hr size=3 noshade></td>
753 <th class=listtop align=left>Dokumente im Webdav-Repository</th>
756 <td align=left width=30%><b>Dateiname</b></td>
757 <td align=left width=70%><b>Webdavlink</b></td>
759 foreach $file (keys %{ $form->{WEBDAV} }) {
762 <td align=left>$file</td>
763 <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
771 <td><hr size=3 noshade></td>
778 <input type=hidden name=jscalendar value=$form->{jscalendar}>
791 Bearbeiten des $form->{heading}<br>
792 <input class=submit type=submit name=action value="|
793 . $locale->text('Update') . qq|">
794 <input class=submit type=submit name=action value="|
795 . $locale->text('Ship to') . qq|">
796 <input class=submit type=submit name=action value="|
797 . $locale->text('Print') . qq|">
798 <input class=submit type=submit name=action value="|
799 . $locale->text('E-mail') . qq|">
800 <input class=submit type=submit name=action value="|
801 . $locale->text('Save') . qq|">
806 <br>Workflow $form->{heading}<br>
807 <input class=submit type=submit name=action value="|
808 . $locale->text('Save as new') . qq|">
809 <input class=submit type=submit name=action value="|
810 . $locale->text('Delete') . qq|">|;
811 if ($form->{type} =~ /quotation$/) {
813 <input class=submit type=submit name=action value="|
814 . $locale->text('Order') . qq|">|;
817 <input class=submit type=submit name=action value="|
818 . $locale->text('Invoice') . qq|">
821 if ($form->{type} =~ /sales_order$/) {
823 <br>$form->{heading} als neue Vorlage verwenden für<br>
824 <input class=submit type=submit name=action value="|
825 . $locale->text('Purchase Order') . qq|">
826 <input class=submit type=submit name=action value="|
827 . $locale->text('Quotation') . qq|">
830 } elsif ($form->{type} =~ /purchase_order$/) {
832 <br>$form->{heading} als neue Vorlage verwenden für<br>
833 <input class=submit type=submit name=action value="|
834 . $locale->text('Sales Order') . qq|">
835 <input class=submit type=submit name=action value="|
836 . $locale->text('Quotation') . qq|">
841 <br>$form->{heading} als neue Vorlage verwenden für<br>
842 <input class=submit type=submit name=action value="|
843 . $locale->text('Order') . qq|">
848 if ($form->{menubar}) {
849 require "$form->{path}/menu.pl";
855 <input type=hidden name=rowcount value=$form->{rowcount}>
857 <input name=callback type=hidden value="$form->{callback}">
859 <input type=hidden name=path value=$form->{path}>
860 <input type=hidden name=login value=$form->{login}>
861 <input type=hidden name=password value=$form->{password}>
868 $lxdebug->leave_sub();
872 $lxdebug->enter_sub();
874 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
875 qw(exchangerate creditlimit creditremaining);
877 &check_name($form->{vc});
882 $buysell = 'sell' if ($form->{vc} eq 'vendor');
883 $form->{exchangerate} = $exchangerate
887 $form->check_exchangerate(
888 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
891 my $i = $form->{rowcount};
892 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
894 if ( ($form->{"partnumber_$i"} eq "")
895 && ($form->{"description_$i"} eq "")
896 && ($form->{"partsgroup_$i"} eq "")) {
898 $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
903 if ( $form->{type} eq 'purchase_order'
904 || $form->{type} eq 'request_quotation') {
905 IR->retrieve_item(\%myconfig, \%$form);
907 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
908 IS->retrieve_item(\%myconfig, \%$form);
911 my $rows = scalar @{ $form->{item_list} };
913 $form->{"discount_$i"} =
914 $form->format_amount(\%myconfig, $form->{discount} * 100);
917 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
926 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
928 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
929 qw(partnumber description unit);
930 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
931 keys %{ $form->{item_list}[0] };
933 $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
935 ($dec) = ($s =~ /\.(\d+)/);
937 $decimalplaces = ($dec > 2) ? $dec : 2;
940 $form->{"sellprice_$i"} = $sellprice;
943 # if there is an exchange rate adjust sellprice
944 $form->{"sellprice_$i"} /= $exchangerate;
948 $form->{"sellprice_$i"} * $form->{"qty_$i"} *
949 (1 - $form->{"discount_$i"} / 100);
950 map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
951 map { $form->{"${_}_base"} += $amount }
952 (split / /, $form->{"taxaccounts_$i"});
953 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
954 split / /, $form->{taxaccounts}
955 if !$form->{taxincluded};
957 $form->{creditremaining} -= $amount;
959 $form->{"sellprice_$i"} =
960 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
963 $form->format_amount(\%myconfig, $form->{"qty_$i"});
970 # ok, so this is a new part
971 # ask if it is a part or service item
973 if ( $form->{"partsgroup_$i"}
974 && ($form->{"partsnumber_$i"} eq "")
975 && ($form->{"description_$i"} eq "")) {
977 $form->{"discount_$i"} = "";
981 $form->{"id_$i"} = 0;
982 $form->{"unit_$i"} = $locale->text('ea');
989 $lxdebug->leave_sub();
993 $lxdebug->enter_sub();
995 if ($form->{type} eq 'purchase_order') {
996 $form->{title} = $locale->text('Purchase Orders');
997 $form->{vc} = 'vendor';
998 $ordlabel = $locale->text('Order Number');
999 $ordnumber = 'ordnumber';
1000 $employee = $locale->text('Employee');
1002 if ($form->{type} eq 'request_quotation') {
1003 $form->{title} = $locale->text('Request for Quotations');
1004 $form->{vc} = 'vendor';
1005 $ordlabel = $locale->text('RFQ Number');
1006 $ordnumber = 'quonumber';
1007 $employee = $locale->text('Employee');
1009 if ($form->{type} eq 'receive_order') {
1010 $form->{title} = $locale->text('Receive Merchandise');
1011 $form->{vc} = 'vendor';
1012 $ordlabel = $locale->text('Order Number');
1013 $ordnumber = 'ordnumber';
1014 $employee = $locale->text('Employee');
1016 if ($form->{type} eq 'sales_order') {
1017 $form->{title} = $locale->text('Sales Orders');
1018 $form->{vc} = 'customer';
1019 $ordlabel = $locale->text('Order Number');
1020 $ordnumber = 'ordnumber';
1021 $employee = $locale->text('Salesperson');
1023 if ($form->{type} eq 'ship_order') {
1024 $form->{title} = $locale->text('Ship Merchandise');
1025 $form->{vc} = 'customer';
1026 $ordlabel = $locale->text('Order Number');
1027 $ordnumber = 'ordnumber';
1028 $employee = $locale->text('Salesperson');
1032 if ($form->{type} eq 'sales_quotation') {
1033 $form->{title} = $locale->text('Quotations');
1034 $form->{vc} = 'customer';
1035 $ordlabel = $locale->text('Quotation Number');
1036 $ordnumber = 'quonumber';
1037 $employee = $locale->text('Employee');
1040 if ($form->{type} =~ /(ship|receive)_order/) {
1041 OE->get_warehouses(\%myconfig, \%$form);
1044 if (@{ $form->{all_warehouses} }) {
1045 $form->{selectwarehouse} = "<option>\n";
1046 $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
1049 $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n"
1050 } (@{ $form->{all_warehouses} });
1054 <th align=right>| . $locale->text('Warehouse') . qq|</th>
1055 <td colspan=3><select name=warehouse>$form->{selectwarehouse}</select></td>
1056 <input type=hidden name=selectwarehouse value="$form->{selectwarehouse}">
1063 # setup vendor / customer selection
1064 $form->all_vc(\%myconfig, $form->{vc},
1065 ($form->{vc} eq 'customer') ? "AR" : "AP");
1067 map { $vc .= "<option>$_->{name}--$_->{id}\n" }
1068 @{ $form->{"all_$form->{vc}"} };
1070 $vclabel = ucfirst $form->{vc};
1071 $vclabel = $locale->text($vclabel);
1073 # $locale->text('Vendor')
1074 # $locale->text('Customer')
1078 ? qq|<select name=$form->{vc}><option>\n$vc</select>|
1079 : qq|<input name=$form->{vc} size=35>|;
1082 if (@{ $form->{all_departments} }) {
1083 $form->{selectdepartment} = "<option>\n";
1086 $form->{selectdepartment} .=
1087 "<option>$_->{description}--$_->{id}\n"
1088 } (@{ $form->{all_departments} });
1093 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1094 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1096 | if $form->{selectdepartment};
1098 if ($form->{type} !~ /(ship_order|receive_order)/) {
1101 <td><input name="open" class=checkbox type=checkbox value=1 checked> |
1102 . $locale->text('Open')
1104 <td><input name="closed" class=checkbox type=checkbox value=1 $form->{closed}> |
1105 . $locale->text('Closed')
1112 <input type=hidden name="open" value=1>
1116 # use JavaScript Calendar or not
1117 $form->{jsscript} = $jscalendar;
1119 if ($form->{jsscript}) {
1121 # with JavaScript Calendar
1123 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1124 <input type=button name=transdatefrom id="trigger3" value=|
1125 . $locale->text('button')
1129 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1130 <input type=button name=transdateto name=transdateto id="trigger4" value=|
1131 . $locale->text('button')
1137 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
1138 "transdateto", "BL", "trigger4");
1141 # without JavaScript Calendar
1143 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1145 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1153 <form method=post action=$form->{script}>
1157 <th class=listtop>$form->{title}</th>
1159 <tr height="5"></tr>
1164 <th align=right>$vclabel</th>
1165 <td colspan=3>$vc</td>
1170 <th align=right>$ordlabel</th>
1171 <td colspan=3><input name="$ordnumber" size=20></td>
1174 <th align=right>| . $locale->text('From') . qq|</th>
1176 <th align=right>| . $locale->text('Bis') . qq|</th>
1179 <input type=hidden name=sort value=transdate>
1181 <th align=right>| . $locale->text('Include in Report') . qq|</th>
1186 <td><input name="l_id" class=checkbox type=checkbox value=Y>
1187 | . $locale->text('ID') . qq|</td>
1188 <td><input name="l_$ordnumber" class=checkbox type=checkbox value=Y checked> $ordlabel</td>
1189 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
1190 . $locale->text('Date')
1192 <td><input name="l_reqdate" class=checkbox type=checkbox value=Y checked> |
1193 . $locale->text('Required by')
1197 <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vclabel</td>
1198 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1199 <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
1200 . $locale->text('Ship via')
1204 <td><input name="l_netamount" class=checkbox type=checkbox value=Y> |
1205 . $locale->text('Amount')
1207 <td><input name="l_tax" class=checkbox type=checkbox value=Y> |
1208 . $locale->text('Tax')
1210 <td><input name="l_amount" class=checkbox type=checkbox value=Y checked> |
1211 . $locale->text('Total')
1215 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
1216 . $locale->text('Subtotal')
1225 <tr><td colspan=4><hr size=3 noshade></td></tr>
1231 <input type=hidden name=nextsub value=orders>
1232 <input type=hidden name=path value=$form->{path}>
1233 <input type=hidden name=login value=$form->{login}>
1234 <input type=hidden name=password value=$form->{password}>
1235 <input type=hidden name=vc value=$form->{vc}>
1236 <input type=hidden name=type value=$form->{type}>
1238 <input class=submit type=submit name=action value="|
1239 . $locale->text('Continue') . qq|">
1246 $lxdebug->leave_sub();
1250 $lxdebug->enter_sub();
1252 # split vendor / customer
1253 ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
1254 split(/--/, $form->{ $form->{vc} });
1256 OE->transactions(\%myconfig, \%$form);
1258 $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
1260 $number = $form->escape($form->{$ordnumber});
1261 $name = $form->escape($form->{ $form->{vc} });
1262 $department = $form->escape($form->{department});
1263 $warehouse = $form->escape($form->{warehouse});
1267 "$form->{script}?path=$form->{path}&action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}&$ordnumber=$number&$form->{vc}=$name&department=$department&warehouse=$warehouse";
1269 # construct callback
1270 $number = $form->escape($form->{$ordnumber}, 1);
1271 $name = $form->escape($form->{ $form->{vc} }, 1);
1272 $department = $form->escape($form->{department}, 1);
1273 $warehouse = $form->escape($form->{warehouse}, 1);
1276 "$form->{script}?path=$form->{path}&action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}&$ordnumber=$number&$form->{vc}=$name&department=$department&warehouse=$warehouse";
1279 $form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
1280 "name", "netamount", "tax", "amount",
1281 "curr", "employee", "shipvia", "open",
1284 $form->{l_open} = $form->{l_closed} = "Y"
1285 if ($form->{open} && $form->{closed});
1287 foreach $item (@columns) {
1288 if ($form->{"l_$item"} eq "Y") {
1289 push @column_index, $item;
1291 # add column to href and callback
1292 $callback .= "&l_$item=Y";
1293 $href .= "&l_$item=Y";
1297 if ($form->{l_subtotal} eq 'Y') {
1298 $callback .= "&l_subtotal=Y";
1299 $href .= "&l_subtotal=Y";
1302 if ($form->{vc} eq 'vendor') {
1303 if ($form->{type} eq 'receive_order') {
1304 $form->{title} = $locale->text('Receive Merchandise');
1305 } elsif ($form->{type} eq 'purchase_order') {
1306 $form->{title} = $locale->text('Purchase Orders');
1308 $form->{title} = $locale->text('Request for Quotations');
1310 $name = $locale->text('Vendor');
1311 $employee = $locale->text('Employee');
1313 if ($form->{vc} eq 'customer') {
1314 if ($form->{type} eq 'sales_order') {
1315 $form->{title} = $locale->text('Sales Orders');
1316 $employee = $locale->text('Salesperson');
1317 } elsif ($form->{type} eq 'ship_order') {
1318 $form->{title} = $locale->text('Ship Merchandise');
1319 $employee = $locale->text('Salesperson');
1321 $form->{title} = $locale->text('Quotations');
1322 $employee = $locale->text('Employee');
1324 $name = $locale->text('Customer');
1327 $column_header{id} =
1328 qq|<th><a class=listheading href=$href&sort=id>|
1329 . $locale->text('ID')
1331 $column_header{transdate} =
1332 qq|<th><a class=listheading href=$href&sort=transdate>|
1333 . $locale->text('Date')
1335 $column_header{reqdate} =
1336 qq|<th><a class=listheading href=$href&sort=reqdate>|
1337 . $locale->text('Required by')
1339 $column_header{ordnumber} =
1340 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1341 . $locale->text('Order')
1343 $column_header{quonumber} =
1344 qq|<th><a class=listheading href=$href&sort=quonumber>|
1345 . $locale->text('Quotation')
1347 $column_header{name} =
1348 qq|<th><a class=listheading href=$href&sort=name>$name</a></th>|;
1349 $column_header{netamount} =
1350 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1351 $column_header{tax} =
1352 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1353 $column_header{amount} =
1354 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1355 $column_header{curr} =
1356 qq|<th class=listheading>| . $locale->text('Curr') . qq|</th>|;
1357 $column_header{shipvia} =
1358 qq|<th><a class=listheading href=$href&sort=shipvia>|
1359 . $locale->text('Ship via')
1361 $column_header{open} =
1362 qq|<th class=listheading>| . $locale->text('O') . qq|</th>|;
1363 $column_header{closed} =
1364 qq|<th class=listheading>| . $locale->text('C') . qq|</th>|;
1366 $column_header{employee} =
1367 qq|<th><a class=listheading href=$href&sort=employee>$employee</a></th>|;
1369 if ($form->{ $form->{vc} }) {
1370 $option = $locale->text(ucfirst $form->{vc});
1371 $option .= " : $form->{$form->{vc}}";
1373 if ($form->{warehouse}) {
1374 ($warehouse) = split /--/, $form->{warehouse};
1375 $option .= "\n<br>" if ($option);
1376 $option .= $locale->text('Warehouse');
1377 $option .= " : $warehouse";
1379 if ($form->{department}) {
1380 $option .= "\n<br>" if ($option);
1381 ($department) = split /--/, $form->{department};
1382 $option .= $locale->text('Department') . " : $department";
1384 if ($form->{transdatefrom}) {
1386 . $locale->text('From') . " "
1387 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1389 if ($form->{transdateto}) {
1391 . $locale->text('Bis') . " "
1392 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1394 if ($form->{open}) {
1395 $option .= "\n<br>" if ($option);
1396 $option .= $locale->text('Open');
1398 if ($form->{closed}) {
1399 $option .= "\n<br>" if ($option);
1400 $option .= $locale->text('Closed');
1410 <th class=listtop>$form->{title}</th>
1412 <tr height="5"></tr>
1419 <tr class=listheading>|;
1421 map { print "\n$column_header{$_}" } @column_index;
1427 # add sort and escape callback
1428 $callback = $form->escape($callback . "&sort=$form->{sort}");
1430 if (@{ $form->{OE} }) {
1431 $sameitem = $form->{OE}->[0]->{ $form->{sort} };
1435 $action = "ship_receive" if ($form->{type} =~ /(ship|receive)_order/);
1437 $warehouse = $form->escape($form->{warehouse});
1439 foreach $oe (@{ $form->{OE} }) {
1441 if ($form->{l_subtotal} eq 'Y') {
1442 if ($sameitem ne $oe->{ $form->{sort} }) {
1444 $sameitem = $oe->{ $form->{sort} };
1448 map { $oe->{$_} *= $oe->{exchangerate} } (qw(netamount amount));
1450 $column_data{netamount} =
1452 . $form->format_amount(\%myconfig, $oe->{netamount}, 2, " ")
1454 $column_data{tax} = "<td align=right>"
1455 . $form->format_amount(\%myconfig, $oe->{amount} - $oe->{netamount},
1458 $column_data{amount} =
1460 . $form->format_amount(\%myconfig, $oe->{amount}, 2, " ") . "</td>";
1462 $totalnetamount += $oe->{netamount};
1463 $totalamount += $oe->{amount};
1465 $subtotalnetamount += $oe->{netamount};
1466 $subtotalamount += $oe->{amount};
1468 $column_data{id} = "<td>$oe->{id}</td>";
1469 $column_data{transdate} = "<td>$oe->{transdate} </td>";
1470 $column_data{reqdate} = "<td>$oe->{reqdate} </td>";
1472 $column_data{$ordnumber} =
1473 "<td><a href=oe.pl?path=$form->{path}&action=$action&type=$form->{type}&id=$oe->{id}&warehouse=$warehouse&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&callback=$callback>$oe->{$ordnumber}</a></td>";
1474 $column_data{name} = "<td>$oe->{name}</td>";
1476 $column_data{employee} = "<td>$oe->{employee} </td>";
1477 $column_data{shipvia} = "<td>$oe->{shipvia} </td>";
1479 if ($oe->{closed}) {
1480 $column_data{closed} = "<td align=center>X</td>";
1481 $column_data{open} = "<td> </td>";
1483 $column_data{closed} = "<td> </td>";
1484 $column_data{open} = "<td align=center>X</td>";
1490 <tr class=listrow$i>";
1492 map { print "\n$column_data{$_}" } @column_index;
1500 if ($form->{l_subtotal} eq 'Y') {
1506 <tr class=listtotal>|;
1508 map { $column_data{$_} = "<td> </td>" } @column_index;
1510 $column_data{netamount} =
1511 "<th class=listtotal align=right>"
1512 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1513 $column_data{tax} = "<th class=listtotal align=right>"
1514 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1517 $column_data{amount} =
1518 "<th class=listtotal align=right>"
1519 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1521 map { print "\n$column_data{$_}" } @column_index;
1529 <td><hr size=3 noshade></td>
1534 <form method=post action=$form->{script}>
1536 <input name=callback type=hidden value="$form->{callback}">
1538 <input type=hidden name=type value=$form->{type}>
1539 <input type=hidden name=vc value=$form->{vc}>
1541 <input type=hidden name=path value=$form->{path}>
1542 <input type=hidden name=login value=$form->{login}>
1543 <input type=hidden name=password value=$form->{password}>
1546 if ($form->{type} !~ /(ship|receive)_order/) {
1548 <input class=submit type=submit name=action value="|
1549 . $locale->text('Add') . qq|">|;
1552 if ($form->{menubar}) {
1553 require "$form->{path}/menu.pl";
1564 $lxdebug->leave_sub();
1568 $lxdebug->enter_sub();
1570 map { $column_data{$_} = "<td> </td>" } @column_index;
1572 $column_data{netamount} =
1573 "<th class=listsubtotal align=right>"
1574 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1576 $column_data{tax} = "<td class=listsubtotal align=right>"
1577 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1580 $column_data{amount} =
1581 "<th class=listsubtotal align=right>"
1582 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1584 $subtotalnetamount = 0;
1585 $subtotalamount = 0;
1588 <tr class=listsubtotal>
1591 map { print "\n$column_data{$_}" } @column_index;
1597 $lxdebug->leave_sub();
1601 $lxdebug->enter_sub();
1603 if ($form->{type} =~ /_order$/) {
1604 $form->isblank("transdate", $locale->text('Order Date missing!'));
1606 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1609 $msg = ucfirst $form->{vc};
1610 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
1612 # $locale->text('Customer missing!');
1613 # $locale->text('Vendor missing!');
1615 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1616 if ($form->{currency} ne $form->{defaultcurrency});
1620 # if the name changed get new values
1621 if (&check_name($form->{vc})) {
1626 $form->{id} = 0 if $form->{saveasnew};
1628 # this is for the internal notes section for the [email] Subject
1629 if ($form->{type} =~ /_order$/) {
1630 if ($form->{type} eq 'sales_order') {
1631 $form->{label} = $locale->text('Sales Order');
1633 $numberfld = "sonumber";
1634 $ordnumber = "ordnumber";
1636 $form->{label} = $locale->text('Purchase Order');
1638 $numberfld = "ponumber";
1639 $ordnumber = "ordnumber";
1642 $err = $locale->text('Cannot save order!');
1645 if ($form->{type} eq 'sales_quotation') {
1646 $form->{label} = $locale->text('Quotation');
1648 $numberfld = "sqnumber";
1649 $ordnumber = "quonumber";
1651 $form->{label} = $locale->text('Request for Quotation');
1653 $numberfld = "rfqnumber";
1654 $ordnumber = "quonumber";
1657 $err = $locale->text('Cannot save quotation!');
1661 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld)
1662 unless $form->{$ordnumber};
1665 $form->{label} . " $form->{$ordnumber} " . $locale->text('saved!'))
1666 if (OE->save(\%myconfig, \%$form));
1669 $lxdebug->leave_sub();
1673 $lxdebug->enter_sub();
1677 if ($form->{type} =~ /_order$/) {
1678 $msg = $locale->text('Are you sure you want to delete Order Number');
1679 $ordnumber = 'ordnumber';
1681 $msg = $locale->text('Are you sure you want to delete Quotation Number');
1682 $ordnumber = 'quonumber';
1688 <form method=post action=$form->{script}>
1691 # delete action variable
1692 map { delete $form->{$_} } qw(action header);
1694 foreach $key (keys %$form) {
1695 $form->{$key} =~ s/\"/"/g;
1696 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1700 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
1702 <h4>$msg $form->{$ordnumber}</h4>
1704 <input name=action class=submit type=submit value="|
1705 . $locale->text('Yes') . qq|">
1712 $lxdebug->leave_sub();
1716 $lxdebug->enter_sub();
1718 if ($form->{type} =~ /_order$/) {
1719 $msg = $locale->text('Order deleted!');
1720 $err = $locale->text('Cannot delete order!');
1722 $msg = $locale->text('Quotation deleted!');
1723 $err = $locale->text('Cannot delete quotation!');
1726 $form->redirect($msg) if (OE->delete(\%myconfig, \%$form, $spool));
1729 $lxdebug->leave_sub();
1733 $lxdebug->enter_sub();
1735 if ($form->{type} =~ /_order$/) {
1736 $form->isblank("ordnumber", $locale->text('Order Number missing!'));
1737 $form->isblank("transdate", $locale->text('Order Date missing!'));
1740 $form->isblank("quonumber", $locale->text('Quotation Number missing!'));
1741 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1742 $form->{ordnumber} = "";
1745 # if the name changed get new values
1746 if (&check_name($form->{vc})) {
1751 ($null, $form->{cp_id}) = split /--/, $form->{contact};
1752 $form->{cp_id} *= 1;
1754 if ( $form->{type} =~ /_order/
1755 && $form->{currency} ne $form->{defaultcurrency}) {
1757 # check if we need a new exchangerate
1758 $buysell = ($form->{type} eq 'sales_order') ? "buy" : "sell";
1760 $orddate = $form->current_date(\%myconfig);
1762 $form->check_exchangerate(\%myconfig, $form->{currency}, $orddate,
1765 if (!$exchangerate) {
1766 &backorder_exchangerate($orddate, $buysell);
1771 # close orders/quotations
1772 $form->{closed} = 1;
1773 OE->save(\%myconfig, \%$form);
1775 $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
1777 $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
1780 $form->{closed} = 0;
1781 $form->{rowcount}--;
1782 $form->{shipto} = 1;
1784 if ($form->{type} =~ /_order$/) {
1785 $form->{exchangerate} = $exchangerate;
1789 if ( $form->{type} eq 'purchase_order'
1790 || $form->{type} eq 'request_quotation') {
1791 $form->{title} = $locale->text('Add Vendor Invoice');
1792 $form->{script} = 'ir.pl';
1796 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
1797 $form->{title} = $locale->text('Add Sales Invoice');
1798 $form->{script} = 'is.pl';
1803 # bo creates the id, reset it
1804 map { delete $form->{$_} }
1805 qw(id subject message cc bcc printed emailed queued);
1806 $form->{ $form->{vc} } =~ s/--.*//g;
1807 $form->{type} = "invoice";
1810 $locale = new Locale "$myconfig{countrycode}", "$script";
1812 require "$form->{path}/$form->{script}";
1814 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
1816 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1817 qw(creditlimit creditremaining);
1819 $currency = $form->{currency};
1822 $form->{currency} = $currency;
1823 $form->{exchangerate} = "";
1824 $form->{forex} = "";
1825 $form->{exchangerate} = $exchangerate
1829 $form->check_exchangerate(
1830 \%myconfig, $form->{currency}, $form->{invdate}, $buysell
1833 $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
1838 for $i (1 .. $form->{rowcount}) {
1839 $form->{"discount_$i"} =
1840 $form->format_amount(\%myconfig, $form->{"discount_$i"});
1842 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
1844 $decimalplaces = ($dec > 2) ? $dec : 2;
1846 $form->{"sellprice_$i"} =
1847 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
1849 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
1851 map { $form->{"${_}_$i"} =~ s/\"/"/g }
1852 qw(partnumber description unit);
1858 $lxdebug->leave_sub();
1861 sub backorder_exchangerate {
1862 $lxdebug->enter_sub();
1863 my ($orddate, $buysell) = @_;
1870 <form method=post action=$form->{script}>
1873 # delete action variable
1874 map { delete $form->{$_} } qw(action header exchangerate);
1876 foreach $key (keys %$form) {
1877 $form->{$key} =~ s/\"/"/g;
1878 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1881 $form->{title} = $locale->text('Add Exchangerate');
1885 <input type=hidden name=path value=$form->{path}>
1886 <input type=hidden name=login value=$form->{login}>
1887 <input type=hidden name=password value=$form->{password}>
1889 <input type=hidden name=exchangeratedate value=$orddate>
1890 <input type=hidden name=buysell value=$buysell>
1893 <tr><th class=listtop>$form->{title}</th></tr>
1894 <tr height="5"></tr>
1899 <th align=right>| . $locale->text('Currency') . qq|</th>
1900 <td>$form->{currency}</td>
1903 <th align=right>| . $locale->text('Date') . qq|</th>
1907 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
1908 <td><input name=exchangerate size=11></td>
1918 <input type=hidden name=nextsub value=save_exchangerate>
1920 <input name=action class=submit type=submit value="|
1921 . $locale->text('Continue') . qq|">
1929 $lxdebug->leave_sub();
1932 sub save_exchangerate {
1933 $lxdebug->enter_sub();
1935 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'));
1936 $form->{exchangerate} =
1937 $form->parse_amount(\%myconfig, $form->{exchangerate});
1938 $form->save_exchangerate(\%myconfig, $form->{currency},
1939 $form->{exchangeratedate},
1940 $form->{exchangerate}, $form->{buysell});
1944 $lxdebug->leave_sub();
1947 sub create_backorder {
1948 $lxdebug->enter_sub();
1950 $form->{shipped} = 1;
1952 # figure out if we need to create a backorder
1953 # items aren't saved if qty != 0
1955 for $i (1 .. $form->{rowcount}) {
1956 $totalqty += $qty = $form->{"qty_$i"};
1957 $totalship += $ship = $form->{"ship_$i"};
1959 $form->{"qty_$i"} = $qty - $ship;
1962 if ($totalship == 0) {
1963 map { $form->{"ship_$_"} = $form->{"qty_$_"} } (1 .. $form->{rowcount});
1964 $form->{ordtotal} = 0;
1965 $form->{shipped} = 0;
1969 if ($totalqty == $totalship) {
1970 map { $form->{"qty_$_"} = $form->{"ship_$_"} } (1 .. $form->{rowcount});
1971 $form->{ordtotal} = 0;
1976 qw(partnumber description qty ship unit sellprice discount id inventory_accno bin income_accno expense_accno listprice assembly taxaccounts partsgroup)
1979 for $i (1 .. $form->{rowcount}) {
1981 $form->{"${_}_$i"} =
1982 $form->format_amount(\%myconfig, $form->{"${_}_$i"})
1983 } qw(sellprice discount);
1986 OE->save(\%myconfig, \%$form);
1988 # rebuild rows for invoice
1992 for $i (1 .. $form->{rowcount}) {
1993 $form->{"qty_$i"} = $form->{"ship_$i"};
1995 if ($form->{"qty_$i"}) {
1998 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
2003 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
2004 $form->{rowcount} = $count;
2006 $lxdebug->leave_sub();
2010 $lxdebug->enter_sub();
2012 $form->{saveasnew} = 1;
2013 $form->{closed} = 0;
2014 map { delete $form->{$_} } qw(printed emailed queued);
2018 $lxdebug->leave_sub();
2021 sub purchase_order {
2022 $lxdebug->enter_sub();
2024 $form->{title} = $locale->text('Add Purchase Order');
2025 $form->{vc} = "vendor";
2026 $form->{type} = "purchase_order";
2030 $lxdebug->leave_sub();
2034 $lxdebug->enter_sub();
2036 if ( $form->{type} eq 'sales_quotation'
2037 || $form->{type} eq 'request_quotation') {
2038 $form->{closed} = 1;
2039 OE->save(\%myconfig, \%$form);
2042 ($null, $form->{cp_id}) = split /--/, $form->{contact};
2043 $form->{cp_id} *= 1;
2045 $form->{title} = $locale->text('Add Sales Order');
2046 $form->{vc} = "customer";
2047 $form->{type} = "sales_order";
2051 $lxdebug->leave_sub();
2055 $lxdebug->enter_sub();
2057 $form->{transdate} = $form->current_date(\%myconfig);
2058 delete $form->{duedate};
2060 $form->{closed} = 0;
2063 map { delete $form->{$_} }
2064 qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
2071 for $i (1 .. $form->{rowcount} - 1) {
2072 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2073 qw(partnumber description unit);
2076 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 0, "0") }
2077 qw(creditlimit creditremaining);
2081 $lxdebug->leave_sub();
2085 $lxdebug->enter_sub();
2091 OE->get_warehouses(\%myconfig, \%$form);
2094 if (@{ $form->{all_warehouses} }) {
2095 $form->{selectwarehouse} = "<option>\n";
2097 map { $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n" }
2098 (@{ $form->{all_warehouses} });
2100 if ($form->{warehouse}) {
2101 $form->{selectwarehouse} = "<option>$form->{warehouse}";
2105 $form->{shippingdate} = $form->current_date(\%myconfig);
2106 $form->{"$form->{vc}"} =~ s/--.*//;
2111 foreach $key (keys %$form) {
2112 if ($key =~ /_1$/) {
2118 for $i (1 .. $form->{rowcount}) {
2120 # undo formatting from prepare_order
2122 $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
2124 $n = ($form->{"qty_$i"} -= $form->{"ship_$i"});
2126 && ($form->{"inventory_accno_$i"} || $form->{"assembly_$i"})) {
2127 $form->{"ship_$i"} = "";
2128 $form->{"serialnumber_$i"} = "";
2133 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
2138 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
2139 $form->{rowcount} = $count;
2141 &display_ship_receive;
2143 $lxdebug->leave_sub();
2146 sub display_ship_receive {
2147 $lxdebug->enter_sub();
2149 $vclabel = ucfirst $form->{vc};
2150 $vclabel = $locale->text($vclabel);
2152 $form->{rowcount}++;
2154 if ($form->{vc} eq 'customer') {
2155 $form->{title} = $locale->text('Ship Merchandise');
2156 $shipped = $locale->text('Shipping Date');
2158 $form->{title} = $locale->text('Receive Merchandise');
2159 $shipped = $locale->text('Date Received');
2162 # set option selected
2163 foreach $item (warehouse, employee) {
2164 $form->{"select$item"} =~ s/ selected//;
2165 $form->{"select$item"} =~
2166 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
2171 <th align=right>| . $locale->text('Warehouse') . qq|</th>
2172 <td><select name=warehouse>$form->{selectwarehouse}</select></td>
2173 <input type=hidden name=selectwarehouse value="$form->{selectwarehouse}">
2175 | if $form->{selectwarehouse};
2179 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
2180 <td><select name=employee>$form->{selectemployee}</select></td>
2181 <input type=hidden name=selectemployee value="$form->{selectemployee}">
2190 <form method=post action=$form->{script}>
2192 <input type=hidden name=id value=$form->{id}>
2194 <input type=hidden name=display_form value=display_ship_receive>
2196 <input type=hidden name=type value=$form->{type}>
2197 <input type=hidden name=media value=$form->{media}>
2198 <input type=hidden name=format value=$form->{format}>
2200 <input type=hidden name=queued value="$form->{queued}">
2201 <input type=hidden name=printed value="$form->{printed}">
2202 <input type=hidden name=emailed value="$form->{emailed}">
2204 <input type=hidden name=vc value=$form->{vc}>
2208 <th class=listtop>$form->{title}</th>
2210 <tr height="5"></tr>
2213 <table width="100%">
2218 <th align=right>$vclabel</th>
2219 <td colspan=3>$form->{$form->{vc}}</td>
2220 <input type=hidden name=$form->{vc} value="$form->{$form->{vc}}">
2221 <input type=hidden name="$form->{vc}_id" value=$form->{"$form->{vc}_id"}>
2225 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
2227 <input name=shippingpoint size=35 value="$form->{shippingpoint}">
2230 <th align=right>| . $locale->text('Ship via') . qq|</th>
2232 <input name=shipvia size=35 value="$form->{shipvia}">
2241 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
2242 <td>$form->{ordnumber}</td>
2243 <input type=hidden name=ordnumber value="$form->{ordnumber}">
2246 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
2247 <td>$form->{transdate}</td>
2248 <input type=hidden name=transdate value=$form->{transdate}>
2251 <th align=right nowrap>$shipped</th>
2252 <td><input name=shippingdate size=11 value=$form->{shippingdate}></td>
2261 <!-- shipto are in hidden variables -->
2263 <input type=hidden name=shiptoname value="$form->{shiptoname}">
2264 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
2265 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
2266 <input type=hidden name=shiptocity value="$form->{shiptocity}">
2267 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
2268 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
2269 <input type=hidden name=shiptophone value="$form->{shiptophone}">
2270 <input type=hidden name=shiptofax value="$form->{shiptofax}">
2271 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
2273 <!-- email variables -->
2274 <input type=hidden name=message value="$form->{message}">
2275 <input type=hidden name=email value="$form->{email}">
2276 <input type=hidden name=subject value="$form->{subject}">
2277 <input type=hidden name=cc value="$form->{cc}">
2278 <input type=hidden name=bcc value="$form->{bcc}">
2283 (partnumber, description, qty, ship, unit, bin, serialnumber);
2285 if ($form->{type} eq "ship_order") {
2286 $column_data{ship} =
2287 qq|<th class=listheading align=center width="auto">|
2288 . $locale->text('Ship')
2291 if ($form->{type} eq "receive_order") {
2292 $column_data{ship} =
2293 qq|<th class=listheading align=center width="auto">|
2294 . $locale->text('Recd')
2298 my $colspan = $#column_index + 1;
2300 $column_data{partnumber} =
2301 qq|<th class=listheading nowrap>| . $locale->text('Number') . qq|</th>|;
2302 $column_data{description} =
2303 qq|<th class=listheading nowrap>|
2304 . $locale->text('Description')
2307 qq|<th class=listheading nowrap>| . $locale->text('Qty') . qq|</th>|;
2308 $column_data{unit} =
2309 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
2311 qq|<th class=listheading nowrap>| . $locale->text('Bin') . qq|</th>|;
2312 $column_data{serialnumber} =
2313 qq|<th class=listheading nowrap>|
2314 . $locale->text('Serial No.')
2321 <tr class=listheading>|;
2323 map { print "\n$column_data{$_}" } @column_index;
2329 for $i (1 .. $form->{rowcount} - 1) {
2332 $form->{"ship_$i"} = $form->parse_amount(\%myconfig, $form->{"ship_$i"});
2334 # convert " to "
2335 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2336 qw(partnumber description unit bin serialnumber);
2338 $description = $form->{"description_$i"};
2339 $description =~ s/\n/<br>/g;
2341 $column_data{partnumber} =
2342 qq|<td>$form->{"partnumber_$i"}<input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"></td>|;
2343 $column_data{description} =
2344 qq|<td>$description<input type=hidden name="description_$i" value="$form->{"description_$i"}"></td>|;
2346 qq|<td align=right>|
2347 . $form->format_amount(\%myconfig, $form->{"qty_$i"})
2348 . qq|<input type=hidden name="qty_$i" value="$form->{"qty_$i"}"></td>|;
2349 $column_data{ship} =
2350 qq|<td align=right><input name="ship_$i" size=5 value=|
2351 . $form->format_amount(\%myconfig, $form->{"ship_$i"})
2353 $column_data{unit} =
2354 qq|<td>$form->{"unit_$i"}<input type=hidden name="unit_$i" value="$form->{"unit_$i"}"></td>|;
2356 qq|<td>$form->{"bin_$i"}<input type=hidden name="bin_$i" value="$form->{"bin_$i"}"></td>|;
2358 $column_data{serialnumber} =
2359 qq|<td><input name="serialnumber_$i" size=15 value="$form->{"serialnumber_$i"}"></td>|;
2364 map { print "\n$column_data{$_}" } @column_index;
2369 <input type=hidden name="orderitems_id_$i" value=$form->{"orderitems_id_$i"}>
2370 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
2371 <input type=hidden name="assembly_$i" value="$form->{"assembly_$i"}">
2372 <input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">
2383 <td><hr size=3 noshade></td>
2389 $form->{copies} = 1;
2398 <input class=submit type=submit name=action value="|
2399 . $locale->text('Update') . qq|">
2400 <input class=submit type=submit name=action value="|
2401 . $locale->text('Print') . qq|">
2404 if ($form->{type} eq 'ship_order') {
2406 <input class=submit type=submit name=action value="|
2407 . $locale->text('Ship to') . qq|">
2408 <input class=submit type=submit name=action value="|
2409 . $locale->text('E-mail') . qq|">
2415 <input class=submit type=submit name=action value="|
2416 . $locale->text('Done') . qq|">
2419 if ($form->{menubar}) {
2420 require "$form->{path}/menu.pl";
2426 <input type=hidden name=rowcount value=$form->{rowcount}>
2428 <input name=callback type=hidden value="$callback">
2430 <input type=hidden name=path value=$form->{path}>
2431 <input type=hidden name=login value=$form->{login}>
2432 <input type=hidden name=password value=$form->{password}>
2440 $lxdebug->leave_sub();
2444 $lxdebug->enter_sub();
2446 if ($form->{type} eq 'ship_order') {
2447 $form->isblank("shippingdate", $locale->text('Shipping Date missing!'));
2449 $form->isblank("shippingdate", $locale->text('Date received missing!'));
2454 $total += $form->{"ship_$_"} =
2455 $form->parse_amount(\%myconfig, $form->{"ship_$_"})
2456 } (1 .. $form->{rowcount} - 1);
2458 $form->error($locale->text('Nothing entered!')) unless $total;
2460 $form->redirect($locale->text('Inventory saved!'))
2461 if OE->save_inventory(\%myconfig, \%$form);
2462 $form->error($locale->text('Could not save!'));
2464 $lxdebug->leave_sub();
2467 sub search_transfer {
2468 $lxdebug->enter_sub();
2470 OE->get_warehouses(\%myconfig, \%$form);
2473 if (@{ $form->{all_warehouses} }) {
2474 $form->{selectwarehouse} = "<option>\n";
2475 $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
2477 map { $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n" }
2478 (@{ $form->{all_warehouses} });
2480 $form->error($locale->text('Nothing to transfer!'));
2483 $form->{title} = $locale->text('Transfer Inventory');
2490 <form method=post action=$form->{script}>
2494 <th class=listtop>$form->{title}</th>
2496 <tr height="5"></tr>
2501 <th align=right nowrap>| . $locale->text('Transfer to') . qq|</th>
2502 <td><select name=warehouse>$form->{selectwarehouse}</select></td>
2505 <th align="right" nowrap="true">| . $locale->text('Part Number') . qq|</th>
2506 <td><input name=partnumber size=20></td>
2509 <th align="right" nowrap="true">| . $locale->text('Description') . qq|</th>
2510 <td><input name=description size=40></td>
2513 <th align=right nowrap>| . $locale->text('Group') . qq|</th>
2514 <td><input name=partsgroup size=20></td>
2520 <td><hr size=3 noshade></td>
2525 <input type=hidden name=sort value=partnumber>
2526 <input type=hidden name=nextsub value=list_transfer>
2528 <input type=hidden name=path value=$form->{path}>
2529 <input type=hidden name=login value=$form->{login}>
2530 <input type=hidden name=password value=$form->{password}>
2532 <input class=submit type=submit name=action value="|
2533 . $locale->text('Continue') . qq|">
2540 $lxdebug->leave_sub();
2544 $lxdebug->enter_sub();
2546 OE->get_inventory(\%myconfig, \%$form);
2548 $partnumber = $form->escape($form->{partnumber});
2549 $warehouse = $form->escape($form->{warehouse});
2550 $description = $form->escape($form->{description});
2551 $partsgroup = $form->escape($form->{partsgroup});
2555 "$form->{script}?path=$form->{path}&action=list_transfer&partnumber=$partnumber&warehouse=$warehouse&description=$description&partsgroup=$partsgroup&login=$form->{login}&password=$form->{password}";
2557 # construct callback
2558 $partnumber = $form->escape($form->{partnumber}, 1);
2559 $warehouse = $form->escape($form->{warehouse}, 1);
2560 $description = $form->escape($form->{description}, 1);
2561 $partsgroup = $form->escape($form->{partsgroup}, 1);
2564 "$form->{script}?path=$form->{path}&action=list_transfer&partnumber=$partnumber&warehouse=$warehouse&description=$description&partsgroup=$partsgroup&login=$form->{login}&password=$form->{password}";
2567 $form->sort_columns(
2568 qw(partnumber description partsgroup make model warehouse qty transfer));
2570 $column_header{partnumber} =
2571 qq|<th><a class=listheading href=$href&sort=partnumber>|
2572 . $locale->text('Part Number')
2574 $column_header{description} =
2575 qq|<th><a class=listheading href=$href&sort=description>|
2576 . $locale->text('Description')
2578 $column_header{partsgroup} =
2579 qq|<th><a class=listheading href=$href&sort=partsgroup>|
2580 . $locale->text('Group')
2582 $column_header{warehouse} =
2583 qq|<th><a class=listheading href=$href&sort=warehouse>|
2584 . $locale->text('From')
2586 $column_header{qty} =
2587 qq|<th><a class=listheading>| . $locale->text('Qty') . qq|</a></th>|;
2588 $column_header{transfer} =
2589 qq|<th><a class=listheading>| . $locale->text('Transfer') . qq|</a></th>|;
2591 $option = $locale->text('Transfer to');
2593 ($warehouse, $warehouse_id) = split /--/, $form->{warehouse};
2595 if ($form->{warehouse}) {
2596 $option .= " : $warehouse";
2598 if ($form->{partnumber}) {
2599 $option .= "\n<br>" if ($option);
2600 $option .= $locale->text('Part Number') . " : $form->{partnumber}";
2602 if ($form->{description}) {
2603 $option .= "\n<br>" if ($option);
2604 $option .= $locale->text('Description') . " : $form->{description}";
2606 if ($form->{partsgroup}) {
2607 $option .= "\n<br>" if ($option);
2608 $option .= $locale->text('Group') . " : $form->{partsgroup}";
2611 $form->{title} = $locale->text('Transfer Inventory');
2618 <form method=post action=$form->{script}>
2620 <input type=hidden name=warehouse_id value=$warehouse_id>
2624 <th class=listtop>$form->{title}</th>
2626 <tr height="5"></tr>
2633 <tr class=listheading>|;
2635 map { print "\n$column_header{$_}" } @column_index;
2641 if (@{ $form->{all_inventory} }) {
2642 $sameitem = $form->{all_inventory}->[0]->{ $form->{sort} };
2646 foreach $ref (@{ $form->{all_inventory} }) {
2650 $column_data{partnumber} =
2651 qq|<td><input type=hidden name="id_$i" value=$ref->{id}>$ref->{partnumber}</td>|;
2652 $column_data{description} = "<td>$ref->{description} </td>";
2653 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
2654 $column_data{warehouse} =
2655 qq|<td><input type=hidden name="warehouse_id_$i" value=$ref->{warehouse_id}>$ref->{warehouse} </td>|;
2657 qq|<td><input type=hidden name="qty_$i" value=$ref->{qty}>|
2658 . $form->format_amount(\%myconfig, $ref->{qty})
2660 $column_data{transfer} = qq|<td><input name="transfer_$i" size=4></td>|;
2665 <tr class=listrow$j>";
2667 map { print "\n$column_data{$_}" } @column_index;
2681 <td><hr size=3 noshade></td>
2687 <input name=callback type=hidden value="$callback">
2689 <input type=hidden name=rowcount value=$i>
2691 <input type=hidden name=path value=$form->{path}>
2692 <input type=hidden name=login value=$form->{login}>
2693 <input type=hidden name=password value=$form->{password}>
2695 <input class=submit type=submit name=action value="|
2696 . $locale->text('Transfer') . qq|">|;
2698 if ($form->{menubar}) {
2699 require "$form->{path}/menu.pl";
2710 $lxdebug->leave_sub();
2714 $lxdebug->enter_sub();
2716 $form->redirect($locale->text('Inventory transferred!'))
2717 if OE->transfer(\%myconfig, \%$form);
2718 $form->error($locale->text('Could not transfer Inventory!'));
2720 $lxdebug->leave_sub();