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') . qq|></td>
247 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>
248 <td width="4"><input type=button name=reqdate name=reqdate id="trigger2" value=|
249 . $locale->text('button') . qq|></td>
254 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
255 "reqdate", "BL", "trigger2");
259 # without JavaScript Calendar
261 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
263 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>|;
269 <td colspan=2 align=center>
272 <th nowrap><input name=closed type=radio class=radio value=0 $checkedopen> |
273 . $locale->text('Open') . qq|</th>
274 <th nowrap><input name=closed type=radio class=radio value=1 $checkedclosed> |
275 . $locale->text('Closed') . qq|</th>
283 # set option selected
284 foreach $item ($form->{vc}, currency, department, employee, contact) {
285 $form->{"select$item"} =~ s/ selected//;
286 $form->{"select$item"} =~
287 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
291 if ($form->{all_contacts}) {
293 $form->{selectcontact} = "";
294 foreach $item (@{ $form->{all_contacts} }) {
295 if ($form->{cp_id} == $item->{cp_id}) {
296 $form->{selectcontact} .=
297 "<option selected>$item->{cp_name}--$item->{cp_id}";
299 $form->{selectcontact} .= "<option>$item->{cp_name}--$item->{cp_id}";
304 $form->{exchangerate} =
305 $form->format_amount(\%myconfig, $form->{exchangerate});
307 $form->{creditlimit} =
308 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
309 $form->{creditremaining} =
310 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
313 ($form->{selectcontact})
314 ? qq|<select name=contact>$form->{selectcontact}</select>\n<input type=hidden name="selectcontact" value="$form->{selectcontact}">|
315 : qq|<input name=contact value="$form->{contact}" size=35>|;
318 <input type=hidden name=forex value=$form->{forex}>
321 if ($form->{currency} ne $form->{defaultcurrency}) {
322 if ($form->{forex}) {
325 . $locale->text('Exchangerate')
326 . qq|</th><td>$form->{exchangerate}</td>
327 <input type=hidden name=exchangerate value=$form->{exchangerate}>
332 . $locale->text('Exchangerate')
333 . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
337 $vclabel = ucfirst $form->{vc};
338 $vclabel = $locale->text($vclabel);
342 <th align=right nowrap>| . $locale->text('Terms: Net') . qq|</th>
343 <td nowrap><input name=terms size="3" maxlength="3" value=$form->{terms}> |
344 . $locale->text('days') . qq|</td>
348 if ($form->{business}) {
351 <th align=right>| . $locale->text('Business') . qq|</th>
352 <td>$form->{business}</td>
353 <th align=right>| . $locale->text('Trade Discount') . qq|</th>
355 . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
361 if ($form->{type} !~ /_quotation$/) {
364 <th width=70% align=right nowrap>| . $locale->text('Order Number') . qq|</th>
365 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
368 <th width=70% align=right nowrap>|
369 . $locale->text('Quotation Number') . qq|</th>
370 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
373 <th width=70% align=right nowrap>|
374 . $locale->text('Customer Order Number') . qq|</th>
375 <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
378 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
383 <th align=right nowrap=true>| . $locale->text('Required by') . qq|</th>
388 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
390 $creditremaining = qq|
396 <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
397 <td>$form->{creditlimit}</td>
399 <th nowrap>| . $locale->text('Remaining') . qq|</th>
400 <td class="plus$n">$form->{creditremaining}</td>
408 ($form->{type} eq 'sales_quotation')
409 ? $locale->text('Valid until')
410 : $locale->text('Required by');
411 if ($form->{type} eq 'sales_quotation') {
414 <th width=70% align=right nowrap>|
415 . $locale->text('Quotation Number') . qq|</th>
416 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
417 <input type=hidden name=ordnumber value="$form->{ordnumber}">
423 <th width=70% align=right nowrap>| . $locale->text('RFQ Number') . qq|</th>
424 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
425 <input type=hidden name=ordnumber value="$form->{ordnumber}">
434 <th align=right nowrap>| . $locale->text('Quotation Date') . qq|</th>
438 <th align=right nowrap=true>$reqlabel</th>
446 ($form->{"select$form->{vc}"})
447 ? qq|<select name=$form->{vc}>$form->{"select$form->{vc}"}</select>\n<input type=hidden name="select$form->{vc}" value="$form->{"select$form->{vc}"}">|
448 : qq|<input name=$form->{vc} value="$form->{$form->{vc}}" size=35>|;
452 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
453 <td colspan=3><select name=department>$form->{selectdepartment}</select>
454 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
457 | if $form->{selectdepartment};
460 <input type=hidden name=employee value="$form->{employee}">
463 if ($form->{type} eq 'sales_order') {
464 if ($form->{selectemployee}) {
466 <input type=hidden name=customer_klass value=$form->{customer_klass}>
468 <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
469 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
470 <input type=hidden name=selectemployee value="$form->{selectemployee}">
477 <input type=hidden name=customer_klass value=$form->{customer_klass}>
479 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
480 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
481 <input type=hidden name=selectemployee value="$form->{selectemployee}">
492 <form method=post action=$form->{script}>
494 <input type=hidden name=id value=$form->{id}>
496 <input type=hidden name=type value=$form->{type}>
497 <input type=hidden name=formname value=$form->{formname}>
498 <input type=hidden name=media value=$form->{media}>
499 <input type=hidden name=format value=$form->{format}>
501 <input type=hidden name=queued value="$form->{queued}">
502 <input type=hidden name=printed value="$form->{printed}">
503 <input type=hidden name=emailed value="$form->{emailed}">
505 <input type=hidden name=vc value=$form->{vc}>
507 <input type=hidden name=title value="$form->{title}">
509 <input type=hidden name=discount value=$form->{discount}>
510 <input type=hidden name=creditlimit value=$form->{creditlimit}>
511 <input type=hidden name=creditremaining value=$form->{creditremaining}>
513 <input type=hidden name=tradediscount value=$form->{tradediscount}>
514 <input type=hidden name=business value=$form->{business}>
515 <input type=hidden name=webdav value=$webdav>
519 <th class=listtop>$form->{title}</th>
529 <th align=right>$vclabel</th>
530 <td colspan=3>$vc</td>
531 <input type=hidden name=$form->{vc}_id value=$form->{"$form->{vc}_id"}>
532 <input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
533 <th align=richt nowrap>|
534 . $locale->text('Contact Person') . qq|</th>
535 <td colspan=3>$contact</td>
541 <th align=right>| . $locale->text('Currency') . qq|</th>
542 <td><select name=currency>$form->{selectcurrency}</select></td>
543 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
544 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
548 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
549 <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
552 <th align=right>| . $locale->text('Ship via') . qq|</th>
553 <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
572 <!-- shipto are in hidden variables -->
574 <input type=hidden name=shiptoname value="$form->{shiptoname}">
575 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
576 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
577 <input type=hidden name=shiptocity value="$form->{shiptocity}">
578 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
579 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
580 <input type=hidden name=shiptophone value="$form->{shiptophone}">
581 <input type=hidden name=shiptofax value="$form->{shiptofax}">
582 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
584 <!-- email variables -->
585 <input type=hidden name=message value="$form->{message}">
586 <input type=hidden name=email value="$form->{email}">
587 <input type=hidden name=subject value="$form->{subject}">
588 <input type=hidden name=cc value="$form->{cc}">
589 <input type=hidden name=bcc value="$form->{bcc}">
591 <input type=hidden name=taxpart value="$form->{taxpart}">
592 <input type=hidden name=taxservice value="$form->{taxservice}">
594 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
597 foreach $item (split / /, $form->{taxaccounts}) {
599 <input type=hidden name="${item}_rate" value=$form->{"${item}_rate"}>
600 <input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
603 $lxdebug->leave_sub();
607 $lxdebug->enter_sub();
609 $form->{invtotal} = $form->{invsubtotal};
611 if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
614 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
617 $rows = ($rows > $introws) ? $rows : $introws;
619 qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
621 qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
623 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
626 if ($form->{taxaccounts}) {
628 <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
629 . $locale->text('Tax Included') . qq|</b><br><br>
633 if (!$form->{taxincluded}) {
635 foreach $item (split / /, $form->{taxaccounts}) {
636 if ($form->{"${item}_base"}) {
637 $form->{invtotal} += $form->{"${item}_total"} =
639 $form->{"${item}_base"} * $form->{"${item}_rate"},
641 $form->{"${item}_total"} =
642 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
646 <th align=right>$form->{"${item}_description"}</th>
647 <td align=right>$form->{"${item}_total"}</td>
653 $form->{invsubtotal} =
654 $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
658 <th align=right>| . $locale->text('Subtotal') . qq|</th>
659 <td align=right>$form->{invsubtotal}</td>
665 if ($form->{taxincluded}) {
666 foreach $item (split / /, $form->{taxaccounts}) {
667 if ($form->{"${item}_base"}) {
668 $form->{"${item}_total"} =
670 ($form->{"${item}_base"} * $form->{"${item}_rate"} /
671 (1 + $form->{"${item}_rate"})
674 $form->{"${item}_netto"} =
676 ($form->{"${item}_base"} - $form->{"${item}_total"}),
678 $form->{"${item}_total"} =
679 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
680 $form->{"${item}_netto"} =
681 $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
685 <th align=right>Enthaltene $form->{"${item}_description"}</th>
686 <td align=right>$form->{"${item}_total"}</td>
689 <th align=right>Nettobetrag</th>
690 <td align=right>$form->{"${item}_netto"}</td>
698 $form->{oldinvtotal} = $form->{invtotal};
700 $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
710 <th align=left>| . $locale->text('Notes') . qq|</th>
711 <th align=left>| . $locale->text('Internal Notes') . qq|</th>
719 <td align=right width=100%>
725 <th align=right>| . $locale->text('Total') . qq|</th>
726 <td align=right>$form->{invtotal}</td>
734 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
735 <input type=hidden name=oldtotalpaid value=$totalpaid>
737 <td><hr size=3 noshade></td>
745 <th class=listtop align=left>Dokumente im Webdav-Repository</th>
748 <td align=left width=30%><b>Dateiname</b></td>
749 <td align=left width=70%><b>Webdavlink</b></td>
751 foreach $file (keys %{ $form->{WEBDAV} }) {
754 <td align=left>$file</td>
755 <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
763 <td><hr size=3 noshade></td>
770 <input type=hidden name=jscalendar value=$form->{jscalendar}>
783 Bearbeiten des $form->{heading}<br>
784 <input class=submit type=submit name=action value="|
785 . $locale->text('Update') . qq|">
786 <input class=submit type=submit name=action value="|
787 . $locale->text('Ship to') . qq|">
788 <input class=submit type=submit name=action value="|
789 . $locale->text('Print') . qq|">
790 <input class=submit type=submit name=action value="|
791 . $locale->text('E-mail') . qq|">
792 <input class=submit type=submit name=action value="|
793 . $locale->text('Save') . qq|">
798 <br>Workflow $form->{heading}<br>
799 <input class=submit type=submit name=action value="|
800 . $locale->text('Save as new') . qq|">
801 <input class=submit type=submit name=action value="|
802 . $locale->text('Delete') . qq|">|;
803 if ($form->{type} =~ /quotation$/) {
805 <input class=submit type=submit name=action value="|
806 . $locale->text('Order') . qq|">|;
809 <input class=submit type=submit name=action value="|
810 . $locale->text('Invoice') . qq|">
813 if ($form->{type} =~ /sales_order$/) {
815 <br>$form->{heading} als neue Vorlage verwenden für<br>
816 <input class=submit type=submit name=action value="|
817 . $locale->text('Purchase Order') . qq|">
818 <input class=submit type=submit name=action value="|
819 . $locale->text('Quotation') . qq|">
822 } elsif ($form->{type} =~ /purchase_order$/) {
824 <br>$form->{heading} als neue Vorlage verwenden für<br>
825 <input class=submit type=submit name=action value="|
826 . $locale->text('Sales Order') . qq|">
827 <input class=submit type=submit name=action value="|
828 . $locale->text('Quotation') . qq|">
833 <br>$form->{heading} als neue Vorlage verwenden für<br>
834 <input class=submit type=submit name=action value="|
835 . $locale->text('Order') . qq|">
840 if ($form->{menubar}) {
841 require "$form->{path}/menu.pl";
847 <input type=hidden name=rowcount value=$form->{rowcount}>
849 <input name=callback type=hidden value="$form->{callback}">
851 <input type=hidden name=path value=$form->{path}>
852 <input type=hidden name=login value=$form->{login}>
853 <input type=hidden name=password value=$form->{password}>
860 $lxdebug->leave_sub();
864 $lxdebug->enter_sub();
866 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
867 qw(exchangerate creditlimit creditremaining);
869 &check_name($form->{vc});
874 $buysell = 'sell' if ($form->{vc} eq 'vendor');
875 $form->{exchangerate} = $exchangerate
879 $form->check_exchangerate(
880 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
884 $i = $form->{rowcount};
886 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
888 if ( ($form->{"partnumber_$i"} eq "")
889 && ($form->{"description_$i"} eq "")
890 && ($form->{"partsgroup_$i"} eq "")) {
892 $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
897 if ( $form->{type} eq 'purchase_order'
898 || $form->{type} eq 'request_quotation') {
899 IR->retrieve_item(\%myconfig, \%$form);
901 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
902 IS->retrieve_item(\%myconfig, \%$form);
905 my $rows = scalar @{ $form->{item_list} };
907 $form->{"discount_$i"} =
908 $form->format_amount(\%myconfig, $form->{discount} * 100);
911 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
920 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
922 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
923 qw(partnumber description unit);
924 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
925 keys %{ $form->{item_list}[0] };
927 $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
929 ($dec) = ($s =~ /\.(\d+)/);
931 $decimalplaces = ($dec > 2) ? $dec : 2;
934 $form->{"sellprice_$i"} = $sellprice;
937 $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
938 # if there is an exchange rate adjust sellprice
939 $form->{"sellprice_$i"} /= $exchangerate;
943 $form->{"sellprice_$i"} * $form->{"qty_$i"} *
944 (1 - $form->{"discount_$i"} / 100);
945 map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
946 map { $form->{"${_}_base"} += $amount }
947 (split / /, $form->{"taxaccounts_$i"});
948 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
949 split / /, $form->{taxaccounts}
950 if !$form->{taxincluded};
952 $form->{creditremaining} -= $amount;
954 $form->{"sellprice_$i"} =
955 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
958 $form->format_amount(\%myconfig, $form->{"qty_$i"});
960 # get pricegroups for parts
961 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
963 # build up html code for prices_$i
971 # ok, so this is a new part
972 # ask if it is a part or service item
974 if ( $form->{"partsgroup_$i"}
975 && ($form->{"partsnumber_$i"} eq "")
976 && ($form->{"description_$i"} eq "")) {
978 $form->{"discount_$i"} = "";
982 $form->{"id_$i"} = 0;
983 $form->{"unit_$i"} = $locale->text('ea');
990 $lxdebug->leave_sub();
994 $lxdebug->enter_sub();
996 if ($form->{type} eq 'purchase_order') {
997 $form->{title} = $locale->text('Purchase Orders');
998 $form->{vc} = 'vendor';
999 $ordlabel = $locale->text('Order Number');
1000 $ordnumber = 'ordnumber';
1001 $employee = $locale->text('Employee');
1003 if ($form->{type} eq 'request_quotation') {
1004 $form->{title} = $locale->text('Request for Quotations');
1005 $form->{vc} = 'vendor';
1006 $ordlabel = $locale->text('RFQ Number');
1007 $ordnumber = 'quonumber';
1008 $employee = $locale->text('Employee');
1010 if ($form->{type} eq 'receive_order') {
1011 $form->{title} = $locale->text('Receive Merchandise');
1012 $form->{vc} = 'vendor';
1013 $ordlabel = $locale->text('Order Number');
1014 $ordnumber = 'ordnumber';
1015 $employee = $locale->text('Employee');
1017 if ($form->{type} eq 'sales_order') {
1018 $form->{title} = $locale->text('Sales Orders');
1019 $form->{vc} = 'customer';
1020 $ordlabel = $locale->text('Order Number');
1021 $ordnumber = 'ordnumber';
1022 $employee = $locale->text('Salesperson');
1024 if ($form->{type} eq 'ship_order') {
1025 $form->{title} = $locale->text('Ship Merchandise');
1026 $form->{vc} = 'customer';
1027 $ordlabel = $locale->text('Order Number');
1028 $ordnumber = 'ordnumber';
1029 $employee = $locale->text('Salesperson');
1033 if ($form->{type} eq 'sales_quotation') {
1034 $form->{title} = $locale->text('Quotations');
1035 $form->{vc} = 'customer';
1036 $ordlabel = $locale->text('Quotation Number');
1037 $ordnumber = 'quonumber';
1038 $employee = $locale->text('Employee');
1041 if ($form->{type} =~ /(ship|receive)_order/) {
1042 OE->get_warehouses(\%myconfig, \%$form);
1045 if (@{ $form->{all_warehouses} }) {
1046 $form->{selectwarehouse} = "<option>\n";
1047 $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
1050 $form->{selectwarehouse} .=
1051 "<option>$_->{description}--$_->{id}\n"
1052 } (@{ $form->{all_warehouses} });
1056 <th align=right>| . $locale->text('Warehouse') . qq|</th>
1057 <td colspan=3><select name=warehouse>$form->{selectwarehouse}</select></td>
1058 <input type=hidden name=selectwarehouse value="$form->{selectwarehouse}">
1065 # setup vendor / customer selection
1066 $form->all_vc(\%myconfig, $form->{vc},
1067 ($form->{vc} eq 'customer') ? "AR" : "AP");
1069 map { $vc .= "<option>$_->{name}--$_->{id}\n" }
1070 @{ $form->{"all_$form->{vc}"} };
1072 $vclabel = ucfirst $form->{vc};
1073 $vclabel = $locale->text($vclabel);
1075 # $locale->text('Vendor')
1076 # $locale->text('Customer')
1080 ? qq|<select name=$form->{vc}><option>\n$vc</select>|
1081 : qq|<input name=$form->{vc} size=35>|;
1084 if (@{ $form->{all_departments} }) {
1085 $form->{selectdepartment} = "<option>\n";
1088 $form->{selectdepartment} .=
1089 "<option>$_->{description}--$_->{id}\n"
1090 } (@{ $form->{all_departments} });
1095 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1096 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1098 | if $form->{selectdepartment};
1100 if ($form->{type} !~ /(ship_order|receive_order)/) {
1103 <td><input name="open" class=checkbox type=checkbox value=1 checked> |
1104 . $locale->text('Open') . qq|</td>
1105 <td><input name="closed" class=checkbox type=checkbox value=1 $form->{closed}> |
1106 . $locale->text('Closed') . qq|</td>
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') . qq|></td>
1128 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1129 <input type=button name=transdateto name=transdateto id="trigger4" value=|
1130 . $locale->text('button') . qq|></td>
1135 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
1136 "transdateto", "BL", "trigger4");
1139 # without JavaScript Calendar
1141 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1143 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1151 <form method=post action=$form->{script}>
1155 <th class=listtop>$form->{title}</th>
1157 <tr height="5"></tr>
1162 <th align=right>$vclabel</th>
1163 <td colspan=3>$vc</td>
1168 <th align=right>$ordlabel</th>
1169 <td colspan=3><input name="$ordnumber" size=20></td>
1172 <th align=right>| . $locale->text('From') . qq|</th>
1174 <th align=right>| . $locale->text('Bis') . qq|</th>
1177 <input type=hidden name=sort value=transdate>
1179 <th align=right>| . $locale->text('Include in Report') . qq|</th>
1184 <td><input name="l_id" class=checkbox type=checkbox value=Y>
1185 | . $locale->text('ID') . qq|</td>
1186 <td><input name="l_$ordnumber" class=checkbox type=checkbox value=Y checked> $ordlabel</td>
1187 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
1188 . $locale->text('Date') . qq|</td>
1189 <td><input name="l_reqdate" class=checkbox type=checkbox value=Y checked> |
1190 . $locale->text('Required by') . qq|</td>
1193 <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vclabel</td>
1194 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1195 <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
1196 . $locale->text('Ship via') . qq|</td>
1199 <td><input name="l_netamount" class=checkbox type=checkbox value=Y> |
1200 . $locale->text('Amount') . qq|</td>
1201 <td><input name="l_tax" class=checkbox type=checkbox value=Y> |
1202 . $locale->text('Tax') . qq|</td>
1203 <td><input name="l_amount" class=checkbox type=checkbox value=Y checked> |
1204 . $locale->text('Total') . qq|</td>
1207 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
1208 . $locale->text('Subtotal') . qq|</td>
1216 <tr><td colspan=4><hr size=3 noshade></td></tr>
1222 <input type=hidden name=nextsub value=orders>
1223 <input type=hidden name=path value=$form->{path}>
1224 <input type=hidden name=login value=$form->{login}>
1225 <input type=hidden name=password value=$form->{password}>
1226 <input type=hidden name=vc value=$form->{vc}>
1227 <input type=hidden name=type value=$form->{type}>
1229 <input class=submit type=submit name=action value="|
1230 . $locale->text('Continue') . qq|">
1237 $lxdebug->leave_sub();
1241 $lxdebug->enter_sub();
1243 # split vendor / customer
1244 ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
1245 split(/--/, $form->{ $form->{vc} });
1247 OE->transactions(\%myconfig, \%$form);
1249 $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
1251 $number = $form->escape($form->{$ordnumber});
1252 $name = $form->escape($form->{ $form->{vc} });
1253 $department = $form->escape($form->{department});
1254 $warehouse = $form->escape($form->{warehouse});
1258 "$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";
1260 # construct callback
1261 $number = $form->escape($form->{$ordnumber}, 1);
1262 $name = $form->escape($form->{ $form->{vc} }, 1);
1263 $department = $form->escape($form->{department}, 1);
1264 $warehouse = $form->escape($form->{warehouse}, 1);
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";
1270 $form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
1271 "name", "netamount", "tax", "amount",
1272 "curr", "employee", "shipvia", "open",
1275 $form->{l_open} = $form->{l_closed} = "Y"
1276 if ($form->{open} && $form->{closed});
1278 foreach $item (@columns) {
1279 if ($form->{"l_$item"} eq "Y") {
1280 push @column_index, $item;
1282 # add column to href and callback
1283 $callback .= "&l_$item=Y";
1284 $href .= "&l_$item=Y";
1288 if ($form->{l_subtotal} eq 'Y') {
1289 $callback .= "&l_subtotal=Y";
1290 $href .= "&l_subtotal=Y";
1293 if ($form->{vc} eq 'vendor') {
1294 if ($form->{type} eq 'receive_order') {
1295 $form->{title} = $locale->text('Receive Merchandise');
1296 } elsif ($form->{type} eq 'purchase_order') {
1297 $form->{title} = $locale->text('Purchase Orders');
1299 $form->{title} = $locale->text('Request for Quotations');
1301 $name = $locale->text('Vendor');
1302 $employee = $locale->text('Employee');
1304 if ($form->{vc} eq 'customer') {
1305 if ($form->{type} eq 'sales_order') {
1306 $form->{title} = $locale->text('Sales Orders');
1307 $employee = $locale->text('Salesperson');
1308 } elsif ($form->{type} eq 'ship_order') {
1309 $form->{title} = $locale->text('Ship Merchandise');
1310 $employee = $locale->text('Salesperson');
1312 $form->{title} = $locale->text('Quotations');
1313 $employee = $locale->text('Employee');
1315 $name = $locale->text('Customer');
1318 $column_header{id} =
1319 qq|<th><a class=listheading href=$href&sort=id>|
1320 . $locale->text('ID')
1322 $column_header{transdate} =
1323 qq|<th><a class=listheading href=$href&sort=transdate>|
1324 . $locale->text('Date')
1326 $column_header{reqdate} =
1327 qq|<th><a class=listheading href=$href&sort=reqdate>|
1328 . $locale->text('Required by')
1330 $column_header{ordnumber} =
1331 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1332 . $locale->text('Order')
1334 $column_header{quonumber} =
1335 qq|<th><a class=listheading href=$href&sort=quonumber>|
1336 . $locale->text('Quotation')
1338 $column_header{name} =
1339 qq|<th><a class=listheading href=$href&sort=name>$name</a></th>|;
1340 $column_header{netamount} =
1341 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1342 $column_header{tax} =
1343 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1344 $column_header{amount} =
1345 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1346 $column_header{curr} =
1347 qq|<th class=listheading>| . $locale->text('Curr') . qq|</th>|;
1348 $column_header{shipvia} =
1349 qq|<th><a class=listheading href=$href&sort=shipvia>|
1350 . $locale->text('Ship via')
1352 $column_header{open} =
1353 qq|<th class=listheading>| . $locale->text('O') . qq|</th>|;
1354 $column_header{closed} =
1355 qq|<th class=listheading>| . $locale->text('C') . qq|</th>|;
1357 $column_header{employee} =
1358 qq|<th><a class=listheading href=$href&sort=employee>$employee</a></th>|;
1360 if ($form->{ $form->{vc} }) {
1361 $option = $locale->text(ucfirst $form->{vc});
1362 $option .= " : $form->{$form->{vc}}";
1364 if ($form->{warehouse}) {
1365 ($warehouse) = split /--/, $form->{warehouse};
1366 $option .= "\n<br>" if ($option);
1367 $option .= $locale->text('Warehouse');
1368 $option .= " : $warehouse";
1370 if ($form->{department}) {
1371 $option .= "\n<br>" if ($option);
1372 ($department) = split /--/, $form->{department};
1373 $option .= $locale->text('Department') . " : $department";
1375 if ($form->{transdatefrom}) {
1377 . $locale->text('From') . " "
1378 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1380 if ($form->{transdateto}) {
1382 . $locale->text('Bis') . " "
1383 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1385 if ($form->{open}) {
1386 $option .= "\n<br>" if ($option);
1387 $option .= $locale->text('Open');
1389 if ($form->{closed}) {
1390 $option .= "\n<br>" if ($option);
1391 $option .= $locale->text('Closed');
1401 <th class=listtop>$form->{title}</th>
1403 <tr height="5"></tr>
1410 <tr class=listheading>|;
1412 map { print "\n$column_header{$_}" } @column_index;
1418 # add sort and escape callback
1419 $callback = $form->escape($callback . "&sort=$form->{sort}");
1421 if (@{ $form->{OE} }) {
1422 $sameitem = $form->{OE}->[0]->{ $form->{sort} };
1426 $action = "ship_receive" if ($form->{type} =~ /(ship|receive)_order/);
1428 $warehouse = $form->escape($form->{warehouse});
1430 foreach $oe (@{ $form->{OE} }) {
1432 if ($form->{l_subtotal} eq 'Y') {
1433 if ($sameitem ne $oe->{ $form->{sort} }) {
1435 $sameitem = $oe->{ $form->{sort} };
1439 map { $oe->{$_} *= $oe->{exchangerate} } (qw(netamount amount));
1441 $column_data{netamount} =
1443 . $form->format_amount(\%myconfig, $oe->{netamount}, 2, " ")
1445 $column_data{tax} = "<td align=right>"
1446 . $form->format_amount(\%myconfig, $oe->{amount} - $oe->{netamount},
1449 $column_data{amount} =
1451 . $form->format_amount(\%myconfig, $oe->{amount}, 2, " ") . "</td>";
1453 $totalnetamount += $oe->{netamount};
1454 $totalamount += $oe->{amount};
1456 $subtotalnetamount += $oe->{netamount};
1457 $subtotalamount += $oe->{amount};
1459 $column_data{id} = "<td>$oe->{id}</td>";
1460 $column_data{transdate} = "<td>$oe->{transdate} </td>";
1461 $column_data{reqdate} = "<td>$oe->{reqdate} </td>";
1463 $column_data{$ordnumber} =
1464 "<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>";
1465 $column_data{name} = "<td>$oe->{name}</td>";
1467 $column_data{employee} = "<td>$oe->{employee} </td>";
1468 $column_data{shipvia} = "<td>$oe->{shipvia} </td>";
1470 if ($oe->{closed}) {
1471 $column_data{closed} = "<td align=center>X</td>";
1472 $column_data{open} = "<td> </td>";
1474 $column_data{closed} = "<td> </td>";
1475 $column_data{open} = "<td align=center>X</td>";
1481 <tr class=listrow$i>";
1483 map { print "\n$column_data{$_}" } @column_index;
1491 if ($form->{l_subtotal} eq 'Y') {
1497 <tr class=listtotal>|;
1499 map { $column_data{$_} = "<td> </td>" } @column_index;
1501 $column_data{netamount} =
1502 "<th class=listtotal align=right>"
1503 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1504 $column_data{tax} = "<th class=listtotal align=right>"
1505 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1508 $column_data{amount} =
1509 "<th class=listtotal align=right>"
1510 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1512 map { print "\n$column_data{$_}" } @column_index;
1520 <td><hr size=3 noshade></td>
1525 <form method=post action=$form->{script}>
1527 <input name=callback type=hidden value="$form->{callback}">
1529 <input type=hidden name=type value=$form->{type}>
1530 <input type=hidden name=vc value=$form->{vc}>
1532 <input type=hidden name=path value=$form->{path}>
1533 <input type=hidden name=login value=$form->{login}>
1534 <input type=hidden name=password value=$form->{password}>
1537 if ($form->{type} !~ /(ship|receive)_order/) {
1539 <input class=submit type=submit name=action value="|
1540 . $locale->text('Add') . qq|">|;
1543 if ($form->{menubar}) {
1544 require "$form->{path}/menu.pl";
1555 $lxdebug->leave_sub();
1559 $lxdebug->enter_sub();
1561 map { $column_data{$_} = "<td> </td>" } @column_index;
1563 $column_data{netamount} =
1564 "<th class=listsubtotal align=right>"
1565 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1567 $column_data{tax} = "<td class=listsubtotal align=right>"
1568 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1571 $column_data{amount} =
1572 "<th class=listsubtotal align=right>"
1573 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1575 $subtotalnetamount = 0;
1576 $subtotalamount = 0;
1579 <tr class=listsubtotal>
1582 map { print "\n$column_data{$_}" } @column_index;
1588 $lxdebug->leave_sub();
1592 $lxdebug->enter_sub();
1594 if ($form->{type} =~ /_order$/) {
1595 $form->isblank("transdate", $locale->text('Order Date missing!'));
1597 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1600 $msg = ucfirst $form->{vc};
1601 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
1603 # $locale->text('Customer missing!');
1604 # $locale->text('Vendor missing!');
1606 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1607 if ($form->{currency} ne $form->{defaultcurrency});
1611 # if the name changed get new values
1612 if (&check_name($form->{vc})) {
1617 $form->{id} = 0 if $form->{saveasnew};
1619 # this is for the internal notes section for the [email] Subject
1620 if ($form->{type} =~ /_order$/) {
1621 if ($form->{type} eq 'sales_order') {
1622 $form->{label} = $locale->text('Sales Order');
1624 $numberfld = "sonumber";
1625 $ordnumber = "ordnumber";
1627 $form->{label} = $locale->text('Purchase Order');
1629 $numberfld = "ponumber";
1630 $ordnumber = "ordnumber";
1633 $err = $locale->text('Cannot save order!');
1636 if ($form->{type} eq 'sales_quotation') {
1637 $form->{label} = $locale->text('Quotation');
1639 $numberfld = "sqnumber";
1640 $ordnumber = "quonumber";
1642 $form->{label} = $locale->text('Request for Quotation');
1644 $numberfld = "rfqnumber";
1645 $ordnumber = "quonumber";
1648 $err = $locale->text('Cannot save quotation!');
1652 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld)
1653 unless $form->{$ordnumber};
1656 $form->{label} . " $form->{$ordnumber} " . $locale->text('saved!'))
1657 if (OE->save(\%myconfig, \%$form));
1660 $lxdebug->leave_sub();
1664 $lxdebug->enter_sub();
1668 if ($form->{type} =~ /_order$/) {
1669 $msg = $locale->text('Are you sure you want to delete Order Number');
1670 $ordnumber = 'ordnumber';
1672 $msg = $locale->text('Are you sure you want to delete Quotation Number');
1673 $ordnumber = 'quonumber';
1679 <form method=post action=$form->{script}>
1682 # delete action variable
1683 map { delete $form->{$_} } qw(action header);
1685 foreach $key (keys %$form) {
1686 $form->{$key} =~ s/\"/"/g;
1687 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1691 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
1693 <h4>$msg $form->{$ordnumber}</h4>
1695 <input name=action class=submit type=submit value="|
1696 . $locale->text('Yes') . qq|">
1703 $lxdebug->leave_sub();
1707 $lxdebug->enter_sub();
1709 if ($form->{type} =~ /_order$/) {
1710 $msg = $locale->text('Order deleted!');
1711 $err = $locale->text('Cannot delete order!');
1713 $msg = $locale->text('Quotation deleted!');
1714 $err = $locale->text('Cannot delete quotation!');
1717 $form->redirect($msg) if (OE->delete(\%myconfig, \%$form, $spool));
1720 $lxdebug->leave_sub();
1724 $lxdebug->enter_sub();
1726 if ($form->{type} =~ /_order$/) {
1727 $form->isblank("ordnumber", $locale->text('Order Number missing!'));
1728 $form->isblank("transdate", $locale->text('Order Date missing!'));
1731 $form->isblank("quonumber", $locale->text('Quotation Number missing!'));
1732 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1733 $form->{ordnumber} = "";
1736 # if the name changed get new values
1737 if (&check_name($form->{vc})) {
1742 ($null, $form->{cp_id}) = split /--/, $form->{contact};
1743 $form->{cp_id} *= 1;
1745 if ( $form->{type} =~ /_order/
1746 && $form->{currency} ne $form->{defaultcurrency}) {
1748 # check if we need a new exchangerate
1749 $buysell = ($form->{type} eq 'sales_order') ? "buy" : "sell";
1751 $orddate = $form->current_date(\%myconfig);
1753 $form->check_exchangerate(\%myconfig, $form->{currency}, $orddate,
1756 if (!$exchangerate) {
1757 &backorder_exchangerate($orddate, $buysell);
1762 # close orders/quotations
1763 $form->{closed} = 1;
1764 OE->save(\%myconfig, \%$form);
1766 $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
1768 $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
1771 $form->{closed} = 0;
1772 $form->{rowcount}--;
1773 $form->{shipto} = 1;
1775 if ($form->{type} =~ /_order$/) {
1776 $form->{exchangerate} = $exchangerate;
1780 if ( $form->{type} eq 'purchase_order'
1781 || $form->{type} eq 'request_quotation') {
1782 $form->{title} = $locale->text('Add Vendor Invoice');
1783 $form->{script} = 'ir.pl';
1787 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
1788 $form->{title} = $locale->text('Add Sales Invoice');
1789 $form->{script} = 'is.pl';
1794 # bo creates the id, reset it
1795 map { delete $form->{$_} }
1796 qw(id subject message cc bcc printed emailed queued);
1797 $form->{ $form->{vc} } =~ s/--.*//g;
1798 $form->{type} = "invoice";
1801 $locale = new Locale "$myconfig{countrycode}", "$script";
1803 require "$form->{path}/$form->{script}";
1805 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
1807 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1808 qw(creditlimit creditremaining);
1810 $currency = $form->{currency};
1813 $form->{currency} = $currency;
1814 $form->{exchangerate} = "";
1815 $form->{forex} = "";
1816 $form->{exchangerate} = $exchangerate
1820 $form->check_exchangerate(
1821 \%myconfig, $form->{currency}, $form->{invdate}, $buysell
1824 $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
1829 for $i (1 .. $form->{rowcount}) {
1830 $form->{"discount_$i"} =
1831 $form->format_amount(\%myconfig, $form->{"discount_$i"});
1833 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
1835 $decimalplaces = ($dec > 2) ? $dec : 2;
1837 $form->{"sellprice_$i"} =
1838 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
1840 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
1842 map { $form->{"${_}_$i"} =~ s/\"/"/g }
1843 qw(partnumber description unit);
1849 $lxdebug->leave_sub();
1852 sub backorder_exchangerate {
1853 $lxdebug->enter_sub();
1854 my ($orddate, $buysell) = @_;
1861 <form method=post action=$form->{script}>
1864 # delete action variable
1865 map { delete $form->{$_} } qw(action header exchangerate);
1867 foreach $key (keys %$form) {
1868 $form->{$key} =~ s/\"/"/g;
1869 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1872 $form->{title} = $locale->text('Add Exchangerate');
1876 <input type=hidden name=path value=$form->{path}>
1877 <input type=hidden name=login value=$form->{login}>
1878 <input type=hidden name=password value=$form->{password}>
1880 <input type=hidden name=exchangeratedate value=$orddate>
1881 <input type=hidden name=buysell value=$buysell>
1884 <tr><th class=listtop>$form->{title}</th></tr>
1885 <tr height="5"></tr>
1890 <th align=right>| . $locale->text('Currency') . qq|</th>
1891 <td>$form->{currency}</td>
1894 <th align=right>| . $locale->text('Date') . qq|</th>
1898 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
1899 <td><input name=exchangerate size=11></td>
1909 <input type=hidden name=nextsub value=save_exchangerate>
1911 <input name=action class=submit type=submit value="|
1912 . $locale->text('Continue') . qq|">
1920 $lxdebug->leave_sub();
1923 sub save_exchangerate {
1924 $lxdebug->enter_sub();
1926 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'));
1927 $form->{exchangerate} =
1928 $form->parse_amount(\%myconfig, $form->{exchangerate});
1929 $form->save_exchangerate(\%myconfig, $form->{currency},
1930 $form->{exchangeratedate},
1931 $form->{exchangerate}, $form->{buysell});
1935 $lxdebug->leave_sub();
1938 sub create_backorder {
1939 $lxdebug->enter_sub();
1941 $form->{shipped} = 1;
1943 # figure out if we need to create a backorder
1944 # items aren't saved if qty != 0
1946 for $i (1 .. $form->{rowcount}) {
1947 $totalqty += $qty = $form->{"qty_$i"};
1948 $totalship += $ship = $form->{"ship_$i"};
1950 $form->{"qty_$i"} = $qty - $ship;
1953 if ($totalship == 0) {
1954 map { $form->{"ship_$_"} = $form->{"qty_$_"} } (1 .. $form->{rowcount});
1955 $form->{ordtotal} = 0;
1956 $form->{shipped} = 0;
1960 if ($totalqty == $totalship) {
1961 map { $form->{"qty_$_"} = $form->{"ship_$_"} } (1 .. $form->{rowcount});
1962 $form->{ordtotal} = 0;
1967 qw(partnumber description qty ship unit sellprice discount id inventory_accno bin income_accno expense_accno listprice assembly taxaccounts partsgroup)
1970 for $i (1 .. $form->{rowcount}) {
1972 $form->{"${_}_$i"} =
1973 $form->format_amount(\%myconfig, $form->{"${_}_$i"})
1974 } qw(sellprice discount);
1977 OE->save(\%myconfig, \%$form);
1979 # rebuild rows for invoice
1983 for $i (1 .. $form->{rowcount}) {
1984 $form->{"qty_$i"} = $form->{"ship_$i"};
1986 if ($form->{"qty_$i"}) {
1989 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
1994 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
1995 $form->{rowcount} = $count;
1997 $lxdebug->leave_sub();
2001 $lxdebug->enter_sub();
2003 $form->{saveasnew} = 1;
2004 $form->{closed} = 0;
2005 map { delete $form->{$_} } qw(printed emailed queued);
2009 $lxdebug->leave_sub();
2012 sub purchase_order {
2013 $lxdebug->enter_sub();
2015 $form->{title} = $locale->text('Add Purchase Order');
2016 $form->{vc} = "vendor";
2017 $form->{type} = "purchase_order";
2021 $lxdebug->leave_sub();
2025 $lxdebug->enter_sub();
2027 if ( $form->{type} eq 'sales_quotation'
2028 || $form->{type} eq 'request_quotation') {
2029 $form->{closed} = 1;
2030 OE->save(\%myconfig, \%$form);
2033 ($null, $form->{cp_id}) = split /--/, $form->{contact};
2034 $form->{cp_id} *= 1;
2036 $form->{title} = $locale->text('Add Sales Order');
2037 $form->{vc} = "customer";
2038 $form->{type} = "sales_order";
2042 $lxdebug->leave_sub();
2046 $lxdebug->enter_sub();
2048 $form->{transdate} = $form->current_date(\%myconfig);
2049 delete $form->{duedate};
2051 $form->{closed} = 0;
2054 map { delete $form->{$_} }
2055 qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
2062 for $i (1 .. $form->{rowcount} - 1) {
2063 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2064 qw(partnumber description unit);
2067 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 0, "0") }
2068 qw(creditlimit creditremaining);
2072 $lxdebug->leave_sub();
2076 $lxdebug->enter_sub();
2082 OE->get_warehouses(\%myconfig, \%$form);
2085 if (@{ $form->{all_warehouses} }) {
2086 $form->{selectwarehouse} = "<option>\n";
2088 map { $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n" }
2089 (@{ $form->{all_warehouses} });
2091 if ($form->{warehouse}) {
2092 $form->{selectwarehouse} = "<option>$form->{warehouse}";
2096 $form->{shippingdate} = $form->current_date(\%myconfig);
2097 $form->{"$form->{vc}"} =~ s/--.*//;
2102 foreach $key (keys %$form) {
2103 if ($key =~ /_1$/) {
2109 for $i (1 .. $form->{rowcount}) {
2111 # undo formatting from prepare_order
2113 $form->{"${_}_$i"} =
2114 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
2116 $n = ($form->{"qty_$i"} -= $form->{"ship_$i"});
2118 && ($form->{"inventory_accno_$i"} || $form->{"assembly_$i"})) {
2119 $form->{"ship_$i"} = "";
2120 $form->{"serialnumber_$i"} = "";
2125 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
2130 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
2131 $form->{rowcount} = $count;
2133 &display_ship_receive;
2135 $lxdebug->leave_sub();
2138 sub display_ship_receive {
2139 $lxdebug->enter_sub();
2141 $vclabel = ucfirst $form->{vc};
2142 $vclabel = $locale->text($vclabel);
2144 $form->{rowcount}++;
2146 if ($form->{vc} eq 'customer') {
2147 $form->{title} = $locale->text('Ship Merchandise');
2148 $shipped = $locale->text('Shipping Date');
2150 $form->{title} = $locale->text('Receive Merchandise');
2151 $shipped = $locale->text('Date Received');
2154 # set option selected
2155 foreach $item (warehouse, employee) {
2156 $form->{"select$item"} =~ s/ selected//;
2157 $form->{"select$item"} =~
2158 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
2163 <th align=right>| . $locale->text('Warehouse') . qq|</th>
2164 <td><select name=warehouse>$form->{selectwarehouse}</select></td>
2165 <input type=hidden name=selectwarehouse value="$form->{selectwarehouse}">
2167 | if $form->{selectwarehouse};
2171 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
2172 <td><select name=employee>$form->{selectemployee}</select></td>
2173 <input type=hidden name=selectemployee value="$form->{selectemployee}">
2182 <form method=post action=$form->{script}>
2184 <input type=hidden name=id value=$form->{id}>
2186 <input type=hidden name=display_form value=display_ship_receive>
2188 <input type=hidden name=type value=$form->{type}>
2189 <input type=hidden name=media value=$form->{media}>
2190 <input type=hidden name=format value=$form->{format}>
2192 <input type=hidden name=queued value="$form->{queued}">
2193 <input type=hidden name=printed value="$form->{printed}">
2194 <input type=hidden name=emailed value="$form->{emailed}">
2196 <input type=hidden name=vc value=$form->{vc}>
2200 <th class=listtop>$form->{title}</th>
2202 <tr height="5"></tr>
2205 <table width="100%">
2210 <th align=right>$vclabel</th>
2211 <td colspan=3>$form->{$form->{vc}}</td>
2212 <input type=hidden name=$form->{vc} value="$form->{$form->{vc}}">
2213 <input type=hidden name="$form->{vc}_id" value=$form->{"$form->{vc}_id"}>
2217 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
2219 <input name=shippingpoint size=35 value="$form->{shippingpoint}">
2222 <th align=right>| . $locale->text('Ship via') . qq|</th>
2224 <input name=shipvia size=35 value="$form->{shipvia}">
2233 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
2234 <td>$form->{ordnumber}</td>
2235 <input type=hidden name=ordnumber value="$form->{ordnumber}">
2238 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
2239 <td>$form->{transdate}</td>
2240 <input type=hidden name=transdate value=$form->{transdate}>
2243 <th align=right nowrap>$shipped</th>
2244 <td><input name=shippingdate size=11 value=$form->{shippingdate}></td>
2253 <!-- shipto are in hidden variables -->
2255 <input type=hidden name=shiptoname value="$form->{shiptoname}">
2256 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
2257 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
2258 <input type=hidden name=shiptocity value="$form->{shiptocity}">
2259 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
2260 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
2261 <input type=hidden name=shiptophone value="$form->{shiptophone}">
2262 <input type=hidden name=shiptofax value="$form->{shiptofax}">
2263 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
2265 <!-- email variables -->
2266 <input type=hidden name=message value="$form->{message}">
2267 <input type=hidden name=email value="$form->{email}">
2268 <input type=hidden name=subject value="$form->{subject}">
2269 <input type=hidden name=cc value="$form->{cc}">
2270 <input type=hidden name=bcc value="$form->{bcc}">
2275 (partnumber, description, qty, ship, unit, bin, serialnumber);
2277 if ($form->{type} eq "ship_order") {
2278 $column_data{ship} =
2279 qq|<th class=listheading align=center width="auto">|
2280 . $locale->text('Ship')
2283 if ($form->{type} eq "receive_order") {
2284 $column_data{ship} =
2285 qq|<th class=listheading align=center width="auto">|
2286 . $locale->text('Recd')
2290 my $colspan = $#column_index + 1;
2292 $column_data{partnumber} =
2293 qq|<th class=listheading nowrap>| . $locale->text('Number') . qq|</th>|;
2294 $column_data{description} =
2295 qq|<th class=listheading nowrap>|
2296 . $locale->text('Description')
2299 qq|<th class=listheading nowrap>| . $locale->text('Qty') . qq|</th>|;
2300 $column_data{unit} =
2301 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
2303 qq|<th class=listheading nowrap>| . $locale->text('Bin') . qq|</th>|;
2304 $column_data{serialnumber} =
2305 qq|<th class=listheading nowrap>|
2306 . $locale->text('Serial No.')
2313 <tr class=listheading>|;
2315 map { print "\n$column_data{$_}" } @column_index;
2321 for $i (1 .. $form->{rowcount} - 1) {
2324 $form->{"ship_$i"} = $form->parse_amount(\%myconfig, $form->{"ship_$i"});
2326 # convert " to "
2327 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2328 qw(partnumber description unit bin serialnumber);
2330 $description = $form->{"description_$i"};
2331 $description =~ s/\n/<br>/g;
2333 $column_data{partnumber} =
2334 qq|<td>$form->{"partnumber_$i"}<input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"></td>|;
2335 $column_data{description} =
2336 qq|<td>$description<input type=hidden name="description_$i" value="$form->{"description_$i"}"></td>|;
2338 qq|<td align=right>|
2339 . $form->format_amount(\%myconfig, $form->{"qty_$i"})
2340 . qq|<input type=hidden name="qty_$i" value="$form->{"qty_$i"}"></td>|;
2341 $column_data{ship} =
2342 qq|<td align=right><input name="ship_$i" size=5 value=|
2343 . $form->format_amount(\%myconfig, $form->{"ship_$i"})
2345 $column_data{unit} =
2346 qq|<td>$form->{"unit_$i"}<input type=hidden name="unit_$i" value="$form->{"unit_$i"}"></td>|;
2348 qq|<td>$form->{"bin_$i"}<input type=hidden name="bin_$i" value="$form->{"bin_$i"}"></td>|;
2350 $column_data{serialnumber} =
2351 qq|<td><input name="serialnumber_$i" size=15 value="$form->{"serialnumber_$i"}"></td>|;
2356 map { print "\n$column_data{$_}" } @column_index;
2361 <input type=hidden name="orderitems_id_$i" value=$form->{"orderitems_id_$i"}>
2362 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
2363 <input type=hidden name="assembly_$i" value="$form->{"assembly_$i"}">
2364 <input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">
2375 <td><hr size=3 noshade></td>
2381 $form->{copies} = 1;
2390 <input class=submit type=submit name=action value="|
2391 . $locale->text('Update') . qq|">
2392 <input class=submit type=submit name=action value="|
2393 . $locale->text('Print') . qq|">
2396 if ($form->{type} eq 'ship_order') {
2398 <input class=submit type=submit name=action value="|
2399 . $locale->text('Ship to') . qq|">
2400 <input class=submit type=submit name=action value="|
2401 . $locale->text('E-mail') . qq|">
2407 <input class=submit type=submit name=action value="|
2408 . $locale->text('Done') . qq|">
2411 if ($form->{menubar}) {
2412 require "$form->{path}/menu.pl";
2418 <input type=hidden name=rowcount value=$form->{rowcount}>
2420 <input name=callback type=hidden value="$callback">
2422 <input type=hidden name=path value=$form->{path}>
2423 <input type=hidden name=login value=$form->{login}>
2424 <input type=hidden name=password value=$form->{password}>
2432 $lxdebug->leave_sub();
2436 $lxdebug->enter_sub();
2438 if ($form->{type} eq 'ship_order') {
2439 $form->isblank("shippingdate", $locale->text('Shipping Date missing!'));
2441 $form->isblank("shippingdate", $locale->text('Date received missing!'));
2446 $total += $form->{"ship_$_"} =
2447 $form->parse_amount(\%myconfig, $form->{"ship_$_"})
2448 } (1 .. $form->{rowcount} - 1);
2450 $form->error($locale->text('Nothing entered!')) unless $total;
2452 $form->redirect($locale->text('Inventory saved!'))
2453 if OE->save_inventory(\%myconfig, \%$form);
2454 $form->error($locale->text('Could not save!'));
2456 $lxdebug->leave_sub();
2459 sub search_transfer {
2460 $lxdebug->enter_sub();
2462 OE->get_warehouses(\%myconfig, \%$form);
2465 if (@{ $form->{all_warehouses} }) {
2466 $form->{selectwarehouse} = "<option>\n";
2467 $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
2469 map { $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n" }
2470 (@{ $form->{all_warehouses} });
2472 $form->error($locale->text('Nothing to transfer!'));
2475 $form->{title} = $locale->text('Transfer Inventory');
2482 <form method=post action=$form->{script}>
2486 <th class=listtop>$form->{title}</th>
2488 <tr height="5"></tr>
2493 <th align=right nowrap>| . $locale->text('Transfer to') . qq|</th>
2494 <td><select name=warehouse>$form->{selectwarehouse}</select></td>
2497 <th align="right" nowrap="true">| . $locale->text('Part Number') . qq|</th>
2498 <td><input name=partnumber size=20></td>
2501 <th align="right" nowrap="true">| . $locale->text('Description') . qq|</th>
2502 <td><input name=description size=40></td>
2505 <th align=right nowrap>| . $locale->text('Group') . qq|</th>
2506 <td><input name=partsgroup size=20></td>
2512 <td><hr size=3 noshade></td>
2517 <input type=hidden name=sort value=partnumber>
2518 <input type=hidden name=nextsub value=list_transfer>
2520 <input type=hidden name=path value=$form->{path}>
2521 <input type=hidden name=login value=$form->{login}>
2522 <input type=hidden name=password value=$form->{password}>
2524 <input class=submit type=submit name=action value="|
2525 . $locale->text('Continue') . qq|">
2532 $lxdebug->leave_sub();
2536 $lxdebug->enter_sub();
2538 OE->get_inventory(\%myconfig, \%$form);
2540 $partnumber = $form->escape($form->{partnumber});
2541 $warehouse = $form->escape($form->{warehouse});
2542 $description = $form->escape($form->{description});
2543 $partsgroup = $form->escape($form->{partsgroup});
2547 "$form->{script}?path=$form->{path}&action=list_transfer&partnumber=$partnumber&warehouse=$warehouse&description=$description&partsgroup=$partsgroup&login=$form->{login}&password=$form->{password}";
2549 # construct callback
2550 $partnumber = $form->escape($form->{partnumber}, 1);
2551 $warehouse = $form->escape($form->{warehouse}, 1);
2552 $description = $form->escape($form->{description}, 1);
2553 $partsgroup = $form->escape($form->{partsgroup}, 1);
2556 "$form->{script}?path=$form->{path}&action=list_transfer&partnumber=$partnumber&warehouse=$warehouse&description=$description&partsgroup=$partsgroup&login=$form->{login}&password=$form->{password}";
2559 $form->sort_columns(
2560 qw(partnumber description partsgroup make model warehouse qty transfer));
2562 $column_header{partnumber} =
2563 qq|<th><a class=listheading href=$href&sort=partnumber>|
2564 . $locale->text('Part Number')
2566 $column_header{description} =
2567 qq|<th><a class=listheading href=$href&sort=description>|
2568 . $locale->text('Description')
2570 $column_header{partsgroup} =
2571 qq|<th><a class=listheading href=$href&sort=partsgroup>|
2572 . $locale->text('Group')
2574 $column_header{warehouse} =
2575 qq|<th><a class=listheading href=$href&sort=warehouse>|
2576 . $locale->text('From')
2578 $column_header{qty} =
2579 qq|<th><a class=listheading>| . $locale->text('Qty') . qq|</a></th>|;
2580 $column_header{transfer} =
2581 qq|<th><a class=listheading>| . $locale->text('Transfer') . qq|</a></th>|;
2583 $option = $locale->text('Transfer to');
2585 ($warehouse, $warehouse_id) = split /--/, $form->{warehouse};
2587 if ($form->{warehouse}) {
2588 $option .= " : $warehouse";
2590 if ($form->{partnumber}) {
2591 $option .= "\n<br>" if ($option);
2592 $option .= $locale->text('Part Number') . " : $form->{partnumber}";
2594 if ($form->{description}) {
2595 $option .= "\n<br>" if ($option);
2596 $option .= $locale->text('Description') . " : $form->{description}";
2598 if ($form->{partsgroup}) {
2599 $option .= "\n<br>" if ($option);
2600 $option .= $locale->text('Group') . " : $form->{partsgroup}";
2603 $form->{title} = $locale->text('Transfer Inventory');
2610 <form method=post action=$form->{script}>
2612 <input type=hidden name=warehouse_id value=$warehouse_id>
2616 <th class=listtop>$form->{title}</th>
2618 <tr height="5"></tr>
2625 <tr class=listheading>|;
2627 map { print "\n$column_header{$_}" } @column_index;
2633 if (@{ $form->{all_inventory} }) {
2634 $sameitem = $form->{all_inventory}->[0]->{ $form->{sort} };
2638 foreach $ref (@{ $form->{all_inventory} }) {
2642 $column_data{partnumber} =
2643 qq|<td><input type=hidden name="id_$i" value=$ref->{id}>$ref->{partnumber}</td>|;
2644 $column_data{description} = "<td>$ref->{description} </td>";
2645 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
2646 $column_data{warehouse} =
2647 qq|<td><input type=hidden name="warehouse_id_$i" value=$ref->{warehouse_id}>$ref->{warehouse} </td>|;
2649 qq|<td><input type=hidden name="qty_$i" value=$ref->{qty}>|
2650 . $form->format_amount(\%myconfig, $ref->{qty})
2652 $column_data{transfer} = qq|<td><input name="transfer_$i" size=4></td>|;
2657 <tr class=listrow$j>";
2659 map { print "\n$column_data{$_}" } @column_index;
2673 <td><hr size=3 noshade></td>
2679 <input name=callback type=hidden value="$callback">
2681 <input type=hidden name=rowcount value=$i>
2683 <input type=hidden name=path value=$form->{path}>
2684 <input type=hidden name=login value=$form->{login}>
2685 <input type=hidden name=password value=$form->{password}>
2687 <input class=submit type=submit name=action value="|
2688 . $locale->text('Transfer') . qq|">|;
2690 if ($form->{menubar}) {
2691 require "$form->{path}/menu.pl";
2702 $lxdebug->leave_sub();
2706 $lxdebug->enter_sub();
2708 $form->redirect($locale->text('Inventory transferred!'))
2709 if OE->transfer(\%myconfig, \%$form);
2710 $form->error($locale->text('Could not transfer Inventory!'));
2712 $lxdebug->leave_sub();