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;
120 $form->{jscalendar} = $jscalendar;
122 OE->retrieve(\%myconfig, \%$form);
124 $taxincluded = $form->{taxincluded};
125 $form->{shipto} = 1 if $form->{id};
127 if ($form->{"all_$form->{vc}"}) {
128 unless ($form->{"$form->{vc}_id"}) {
129 $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
133 $cp_id = $form->{cp_id};
134 $intnotes = $form->{intnotes};
136 # get customer / vendor
137 if ($form->{type} =~ /(purchase_order|request_quotation|receive_order)/) {
138 IR->get_vendor(\%myconfig, \%$form);
140 if ($form->{type} =~ /(sales|ship)_(order|quotation)/) {
141 IS->get_customer(\%myconfig, \%$form);
143 $form->{cp_id} = $cp_id;
145 $form->{intnotes} = $intnotes;
146 ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
147 $form->{"old$form->{vc}"} =
148 qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
150 # build the popup menus
151 if (@{ $form->{"all_$form->{vc}"} }) {
152 $form->{ $form->{vc} } =
153 qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
154 map { $form->{"select$form->{vc}"} .= "<option>$_->{name}--$_->{id}\n" }
155 (@{ $form->{"all_$form->{vc}"} });
159 @curr = split /:/, $form->{currencies};
161 $form->{defaultcurrency} = $curr[0];
162 $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
164 map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
166 $form->{taxincluded} = $taxincluded if ($form->{id});
169 if (@{ $form->{all_departments} }) {
170 $form->{selectdepartment} = "<option>\n";
171 $form->{department} = "$form->{department}--$form->{department_id}";
174 $form->{selectdepartment} .=
175 "<option>$_->{description}--$_->{id}\n"
176 } (@{ $form->{all_departments} });
179 $form->{employee} = "$form->{employee}--$form->{employee_id}";
182 if (@{ $form->{all_employees} }) {
183 $form->{selectemployee} = "";
184 map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
185 (@{ $form->{all_employees} });
189 $form->{forex} = $form->{exchangerate};
191 $lxdebug->leave_sub();
195 $lxdebug->enter_sub();
196 $form->{format} = "html";
197 $form->{media} = "screen";
198 $form->{formname} = $form->{type};
202 map { $form->{$_} =~ s/\"/"/g }
203 qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact);
205 foreach $ref (@{ $form->{form_details} }) {
207 map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
208 $form->{"discount_$i"} =
209 $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
211 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
213 $decimalplaces = ($dec > 2) ? $dec : 2;
215 $form->{"sellprice_$i"} =
216 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
218 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
220 map { $form->{"${_}_$i"} =~ s/\"/"/g }
221 qw(partnumber description unit);
222 $form->{rowcount} = $i;
224 } elsif ($form->{rowcount}) {
225 for my $i (1 .. $form->{rowcount}) {
226 $form->{"discount_$i"} =
227 $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
229 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
231 $decimalplaces = ($dec > 2) ? $dec : 2;
233 $form->{"sellprice_$i"} =
234 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
236 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
238 map { $form->{"${_}_$i"} =~ s/\"/"/g }
239 qw(partnumber description unit);
243 $lxdebug->leave_sub();
247 $lxdebug->enter_sub();
249 $checkedopen = ($form->{closed}) ? "" : "checked";
250 $checkedclosed = ($form->{closed}) ? "checked" : "";
252 # use JavaScript Calendar or not
253 $form->{jsscript} = $form->{jscalendar};
256 if ($form->{jsscript}) {
258 # with JavaScript Calendar
260 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
261 <td><input type=button name=transdate id="trigger1" value=|
262 . $locale->text('button') . qq|></td>
265 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>
266 <td width="4"><input type=button name=reqdate name=reqdate id="trigger2" value=|
267 . $locale->text('button') . qq|></td>
272 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
273 "reqdate", "BL", "trigger2");
277 # without JavaScript Calendar
279 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
281 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>|;
287 <td colspan=2 align=center>
290 <th nowrap><input name=closed type=radio class=radio value=0 $checkedopen> |
291 . $locale->text('Open') . qq|</th>
292 <th nowrap><input name=closed type=radio class=radio value=1 $checkedclosed> |
293 . $locale->text('Closed') . qq|</th>
301 # set option selected
302 foreach $item ($form->{vc}, currency, department, employee, contact) {
303 $form->{"select$item"} =~ s/ selected//;
304 $form->{"select$item"} =~
305 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
309 if ($form->{all_contacts}) {
311 $form->{selectcontact} = "";
312 foreach $item (@{ $form->{all_contacts} }) {
313 if ($form->{cp_id} == $item->{cp_id}) {
314 $form->{selectcontact} .=
315 "<option selected>$item->{cp_name}--$item->{cp_id}";
317 $form->{selectcontact} .= "<option>$item->{cp_name}--$item->{cp_id}";
322 $form->{exchangerate} =
323 $form->format_amount(\%myconfig, $form->{exchangerate});
325 $form->{creditlimit} =
326 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
327 $form->{creditremaining} =
328 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
331 ($form->{selectcontact})
332 ? qq|<select name=contact>$form->{selectcontact}</select>\n<input type=hidden name="selectcontact" value="$form->{selectcontact}">|
333 : qq|<input name=contact value="$form->{contact}" size=35>|;
336 <input type=hidden name=forex value=$form->{forex}>
339 if ($form->{currency} ne $form->{defaultcurrency}) {
340 if ($form->{forex}) {
343 . $locale->text('Exchangerate')
344 . qq|</th><td>$form->{exchangerate}</td>
345 <input type=hidden name=exchangerate value=$form->{exchangerate}>
350 . $locale->text('Exchangerate')
351 . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
355 $vclabel = ucfirst $form->{vc};
356 $vclabel = $locale->text($vclabel);
360 <th align=right nowrap>| . $locale->text('Terms: Net') . qq|</th>
361 <td nowrap><input name=terms size="3" maxlength="3" value=$form->{terms}> |
362 . $locale->text('days') . qq|</td>
366 if ($form->{business}) {
369 <th align=right>| . $locale->text('Business') . qq|</th>
370 <td>$form->{business}</td>
371 <th align=right>| . $locale->text('Trade Discount') . qq|</th>
373 . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
379 if ($form->{type} !~ /_quotation$/) {
382 <th width=70% align=right nowrap>| . $locale->text('Order Number') . qq|</th>
383 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
386 <th width=70% align=right nowrap>|
387 . $locale->text('Quotation Number') . qq|</th>
388 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
391 <th width=70% align=right nowrap>|
392 . $locale->text('Customer Order Number') . qq|</th>
393 <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
396 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
401 <th align=right nowrap=true>| . $locale->text('Required by') . qq|</th>
406 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
408 $creditremaining = qq|
414 <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
415 <td>$form->{creditlimit}</td>
417 <th nowrap>| . $locale->text('Remaining') . qq|</th>
418 <td class="plus$n">$form->{creditremaining}</td>
426 ($form->{type} eq 'sales_quotation')
427 ? $locale->text('Valid until')
428 : $locale->text('Required by');
429 if ($form->{type} eq 'sales_quotation') {
432 <th width=70% align=right nowrap>|
433 . $locale->text('Quotation Number') . qq|</th>
434 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
435 <input type=hidden name=ordnumber value="$form->{ordnumber}">
441 <th width=70% align=right nowrap>| . $locale->text('RFQ Number') . qq|</th>
442 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
443 <input type=hidden name=ordnumber value="$form->{ordnumber}">
452 <th align=right nowrap>| . $locale->text('Quotation Date') . qq|</th>
456 <th align=right nowrap=true>$reqlabel</th>
464 ($form->{"select$form->{vc}"})
465 ? qq|<select name=$form->{vc}>$form->{"select$form->{vc}"}</select>\n<input type=hidden name="select$form->{vc}" value="$form->{"select$form->{vc}"}">|
466 : qq|<input name=$form->{vc} value="$form->{$form->{vc}}" size=35>|;
470 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
471 <td colspan=3><select name=department>$form->{selectdepartment}</select>
472 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
475 | if $form->{selectdepartment};
478 <input type=hidden name=employee value="$form->{employee}">
481 if ($form->{type} eq 'sales_order') {
482 if ($form->{selectemployee}) {
484 <input type=hidden name=customer_klass value=$form->{customer_klass}>
486 <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
487 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
488 <input type=hidden name=selectemployee value="$form->{selectemployee}">
495 <input type=hidden name=customer_klass value=$form->{customer_klass}>
497 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
498 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
499 <input type=hidden name=selectemployee value="$form->{selectemployee}">
510 <form method=post action=$form->{script}>
512 <input type=hidden name=id value=$form->{id}>
514 <input type=hidden name=type value=$form->{type}>
515 <input type=hidden name=formname value=$form->{formname}>
516 <input type=hidden name=media value=$form->{media}>
517 <input type=hidden name=format value=$form->{format}>
519 <input type=hidden name=queued value="$form->{queued}">
520 <input type=hidden name=printed value="$form->{printed}">
521 <input type=hidden name=emailed value="$form->{emailed}">
523 <input type=hidden name=vc value=$form->{vc}>
525 <input type=hidden name=title value="$form->{title}">
527 <input type=hidden name=discount value=$form->{discount}>
528 <input type=hidden name=creditlimit value=$form->{creditlimit}>
529 <input type=hidden name=creditremaining value=$form->{creditremaining}>
531 <input type=hidden name=tradediscount value=$form->{tradediscount}>
532 <input type=hidden name=business value=$form->{business}>
533 <input type=hidden name=webdav value=$webdav>
537 <th class=listtop>$form->{title}</th>
547 <th align=right>$vclabel</th>
548 <td colspan=3>$vc</td>
549 <input type=hidden name=$form->{vc}_id value=$form->{"$form->{vc}_id"}>
550 <input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
551 <th align=richt nowrap>|
552 . $locale->text('Contact Person') . qq|</th>
553 <td colspan=3>$contact</td>
559 <th align=right>| . $locale->text('Currency') . qq|</th>
560 <td><select name=currency>$form->{selectcurrency}</select></td>
561 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
562 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
566 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
567 <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
570 <th align=right>| . $locale->text('Ship via') . qq|</th>
571 <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
590 <!-- shipto are in hidden variables -->
592 <input type=hidden name=shiptoname value="$form->{shiptoname}">
593 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
594 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
595 <input type=hidden name=shiptocity value="$form->{shiptocity}">
596 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
597 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
598 <input type=hidden name=shiptophone value="$form->{shiptophone}">
599 <input type=hidden name=shiptofax value="$form->{shiptofax}">
600 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
602 <!-- email variables -->
603 <input type=hidden name=message value="$form->{message}">
604 <input type=hidden name=email value="$form->{email}">
605 <input type=hidden name=subject value="$form->{subject}">
606 <input type=hidden name=cc value="$form->{cc}">
607 <input type=hidden name=bcc value="$form->{bcc}">
609 <input type=hidden name=taxpart value="$form->{taxpart}">
610 <input type=hidden name=taxservice value="$form->{taxservice}">
612 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
615 foreach $item (split / /, $form->{taxaccounts}) {
617 <input type=hidden name="${item}_rate" value=$form->{"${item}_rate"}>
618 <input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
621 $lxdebug->leave_sub();
625 $lxdebug->enter_sub();
627 $form->{invtotal} = $form->{invsubtotal};
629 if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
632 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
635 $rows = ($rows > $introws) ? $rows : $introws;
637 qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
639 qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
641 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
644 if ($form->{taxaccounts}) {
646 <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
647 . $locale->text('Tax Included') . qq|</b><br><br>
651 if (!$form->{taxincluded}) {
653 foreach $item (split / /, $form->{taxaccounts}) {
654 if ($form->{"${item}_base"}) {
655 $form->{invtotal} += $form->{"${item}_total"} =
657 $form->{"${item}_base"} * $form->{"${item}_rate"},
659 $form->{"${item}_total"} =
660 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
664 <th align=right>$form->{"${item}_description"}</th>
665 <td align=right>$form->{"${item}_total"}</td>
671 $form->{invsubtotal} =
672 $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
676 <th align=right>| . $locale->text('Subtotal') . qq|</th>
677 <td align=right>$form->{invsubtotal}</td>
683 if ($form->{taxincluded}) {
684 foreach $item (split / /, $form->{taxaccounts}) {
685 if ($form->{"${item}_base"}) {
686 $form->{"${item}_total"} =
688 ($form->{"${item}_base"} * $form->{"${item}_rate"} /
689 (1 + $form->{"${item}_rate"})
692 $form->{"${item}_netto"} =
694 ($form->{"${item}_base"} - $form->{"${item}_total"}),
696 $form->{"${item}_total"} =
697 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
698 $form->{"${item}_netto"} =
699 $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
703 <th align=right>Enthaltene $form->{"${item}_description"}</th>
704 <td align=right>$form->{"${item}_total"}</td>
707 <th align=right>Nettobetrag</th>
708 <td align=right>$form->{"${item}_netto"}</td>
716 $form->{oldinvtotal} = $form->{invtotal};
718 $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
728 <th align=left>| . $locale->text('Notes') . qq|</th>
729 <th align=left>| . $locale->text('Internal Notes') . qq|</th>
737 <td align=right width=100%>
743 <th align=right>| . $locale->text('Total') . qq|</th>
744 <td align=right>$form->{invtotal}</td>
752 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
753 <input type=hidden name=oldtotalpaid value=$totalpaid>
755 <td><hr size=3 noshade></td>
763 <th class=listtop align=left>Dokumente im Webdav-Repository</th>
766 <td align=left width=30%><b>Dateiname</b></td>
767 <td align=left width=70%><b>Webdavlink</b></td>
769 foreach $file (keys %{ $form->{WEBDAV} }) {
772 <td align=left>$file</td>
773 <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
781 <td><hr size=3 noshade></td>
788 <input type=hidden name=jscalendar value=$form->{jscalendar}>
801 Bearbeiten des $form->{heading}<br>
802 <input class=submit type=submit name=action value="|
803 . $locale->text('Update') . qq|">
804 <input class=submit type=submit name=action value="|
805 . $locale->text('Ship to') . qq|">
806 <input class=submit type=submit name=action value="|
807 . $locale->text('Print') . qq|">
808 <input class=submit type=submit name=action value="|
809 . $locale->text('E-mail') . qq|">
810 <input class=submit type=submit name=action value="|
811 . $locale->text('Save') . qq|">
816 <br>Workflow $form->{heading}<br>
817 <input class=submit type=submit name=action value="|
818 . $locale->text('Save as new') . qq|">
819 <input class=submit type=submit name=action value="|
820 . $locale->text('Delete') . qq|">|;
821 if ($form->{type} =~ /quotation$/) {
823 <input class=submit type=submit name=action value="|
824 . $locale->text('Order') . qq|">|;
827 <input class=submit type=submit name=action value="|
828 . $locale->text('Invoice') . qq|">
831 if ($form->{type} =~ /sales_order$/) {
833 <br>$form->{heading} als neue Vorlage verwenden für<br>
834 <input class=submit type=submit name=action value="|
835 . $locale->text('Purchase Order') . qq|">
836 <input class=submit type=submit name=action value="|
837 . $locale->text('Quotation') . qq|">
840 } elsif ($form->{type} =~ /purchase_order$/) {
842 <br>$form->{heading} als neue Vorlage verwenden für<br>
843 <input class=submit type=submit name=action value="|
844 . $locale->text('Sales Order') . qq|">
845 <input class=submit type=submit name=action value="|
846 . $locale->text('Quotation') . qq|">
851 <br>$form->{heading} als neue Vorlage verwenden für<br>
852 <input class=submit type=submit name=action value="|
853 . $locale->text('Order') . qq|">
858 if ($form->{menubar}) {
859 require "$form->{path}/menu.pl";
865 <input type=hidden name=rowcount value=$form->{rowcount}>
867 <input name=callback type=hidden value="$form->{callback}">
869 <input type=hidden name=path value=$form->{path}>
870 <input type=hidden name=login value=$form->{login}>
871 <input type=hidden name=password value=$form->{password}>
878 $lxdebug->leave_sub();
882 $lxdebug->enter_sub();
884 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
885 qw(exchangerate creditlimit creditremaining);
887 &check_name($form->{vc});
892 $buysell = 'sell' if ($form->{vc} eq 'vendor');
893 $form->{exchangerate} = $exchangerate
897 $form->check_exchangerate(
898 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
902 $i = $form->{rowcount};
904 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
906 if ( ($form->{"partnumber_$i"} eq "")
907 && ($form->{"description_$i"} eq "")
908 && ($form->{"partsgroup_$i"} eq "")) {
910 $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
915 if ( $form->{type} eq 'purchase_order'
916 || $form->{type} eq 'request_quotation') {
917 IR->retrieve_item(\%myconfig, \%$form);
919 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
920 IS->retrieve_item(\%myconfig, \%$form);
923 my $rows = scalar @{ $form->{item_list} };
925 $form->{"discount_$i"} =
926 $form->format_amount(\%myconfig, $form->{discount} * 100);
929 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
938 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
940 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
941 qw(partnumber description unit);
942 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
943 keys %{ $form->{item_list}[0] };
945 $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
947 ($dec) = ($s =~ /\.(\d+)/);
949 $decimalplaces = ($dec > 2) ? $dec : 2;
952 $form->{"sellprice_$i"} = $sellprice;
955 $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
956 # if there is an exchange rate adjust sellprice
957 $form->{"sellprice_$i"} /= $exchangerate;
961 $form->{"sellprice_$i"} * $form->{"qty_$i"} *
962 (1 - $form->{"discount_$i"} / 100);
963 map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
964 map { $form->{"${_}_base"} += $amount }
965 (split / /, $form->{"taxaccounts_$i"});
966 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
967 split / /, $form->{taxaccounts}
968 if !$form->{taxincluded};
970 $form->{creditremaining} -= $amount;
972 $form->{"sellprice_$i"} =
973 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
976 $form->format_amount(\%myconfig, $form->{"qty_$i"});
978 # get pricegroups for parts
979 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
981 # build up html code for prices_$i
989 # ok, so this is a new part
990 # ask if it is a part or service item
992 if ( $form->{"partsgroup_$i"}
993 && ($form->{"partsnumber_$i"} eq "")
994 && ($form->{"description_$i"} eq "")) {
996 $form->{"discount_$i"} = "";
1000 $form->{"id_$i"} = 0;
1001 $form->{"unit_$i"} = $locale->text('ea');
1010 $lxdebug->leave_sub();
1014 $lxdebug->enter_sub();
1016 if ($form->{type} eq 'purchase_order') {
1017 $form->{title} = $locale->text('Purchase Orders');
1018 $form->{vc} = 'vendor';
1019 $ordlabel = $locale->text('Order Number');
1020 $ordnumber = 'ordnumber';
1021 $employee = $locale->text('Employee');
1023 if ($form->{type} eq 'request_quotation') {
1024 $form->{title} = $locale->text('Request for Quotations');
1025 $form->{vc} = 'vendor';
1026 $ordlabel = $locale->text('RFQ Number');
1027 $ordnumber = 'quonumber';
1028 $employee = $locale->text('Employee');
1030 if ($form->{type} eq 'receive_order') {
1031 $form->{title} = $locale->text('Receive Merchandise');
1032 $form->{vc} = 'vendor';
1033 $ordlabel = $locale->text('Order Number');
1034 $ordnumber = 'ordnumber';
1035 $employee = $locale->text('Employee');
1037 if ($form->{type} eq 'sales_order') {
1038 $form->{title} = $locale->text('Sales Orders');
1039 $form->{vc} = 'customer';
1040 $ordlabel = $locale->text('Order Number');
1041 $ordnumber = 'ordnumber';
1042 $employee = $locale->text('Salesperson');
1044 if ($form->{type} eq 'ship_order') {
1045 $form->{title} = $locale->text('Ship Merchandise');
1046 $form->{vc} = 'customer';
1047 $ordlabel = $locale->text('Order Number');
1048 $ordnumber = 'ordnumber';
1049 $employee = $locale->text('Salesperson');
1053 if ($form->{type} eq 'sales_quotation') {
1054 $form->{title} = $locale->text('Quotations');
1055 $form->{vc} = 'customer';
1056 $ordlabel = $locale->text('Quotation Number');
1057 $ordnumber = 'quonumber';
1058 $employee = $locale->text('Employee');
1061 if ($form->{type} =~ /(ship|receive)_order/) {
1062 OE->get_warehouses(\%myconfig, \%$form);
1065 if (@{ $form->{all_warehouses} }) {
1066 $form->{selectwarehouse} = "<option>\n";
1067 $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
1070 $form->{selectwarehouse} .=
1071 "<option>$_->{description}--$_->{id}\n"
1072 } (@{ $form->{all_warehouses} });
1076 <th align=right>| . $locale->text('Warehouse') . qq|</th>
1077 <td colspan=3><select name=warehouse>$form->{selectwarehouse}</select></td>
1078 <input type=hidden name=selectwarehouse value="$form->{selectwarehouse}">
1085 # setup vendor / customer selection
1086 $form->all_vc(\%myconfig, $form->{vc},
1087 ($form->{vc} eq 'customer') ? "AR" : "AP");
1089 map { $vc .= "<option>$_->{name}--$_->{id}\n" }
1090 @{ $form->{"all_$form->{vc}"} };
1092 $vclabel = ucfirst $form->{vc};
1093 $vclabel = $locale->text($vclabel);
1095 # $locale->text('Vendor')
1096 # $locale->text('Customer')
1100 ? qq|<select name=$form->{vc}><option>\n$vc</select>|
1101 : qq|<input name=$form->{vc} size=35>|;
1104 if (@{ $form->{all_departments} }) {
1105 $form->{selectdepartment} = "<option>\n";
1108 $form->{selectdepartment} .=
1109 "<option>$_->{description}--$_->{id}\n"
1110 } (@{ $form->{all_departments} });
1115 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1116 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1118 | if $form->{selectdepartment};
1120 if ($form->{type} !~ /(ship_order|receive_order)/) {
1123 <td><input name="open" class=checkbox type=checkbox value=1 checked> |
1124 . $locale->text('Open') . qq|</td>
1125 <td><input name="closed" class=checkbox type=checkbox value=1 $form->{closed}> |
1126 . $locale->text('Closed') . qq|</td>
1132 <input type=hidden name="open" value=1>
1136 # use JavaScript Calendar or not
1137 $form->{jsscript} = $jscalendar;
1139 if ($form->{jsscript}) {
1141 # with JavaScript Calendar
1143 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1144 <input type=button name=transdatefrom id="trigger3" value=|
1145 . $locale->text('button') . qq|></td>
1148 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1149 <input type=button name=transdateto name=transdateto id="trigger4" value=|
1150 . $locale->text('button') . qq|></td>
1155 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
1156 "transdateto", "BL", "trigger4");
1159 # without JavaScript Calendar
1161 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1163 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1171 <form method=post action=$form->{script}>
1175 <th class=listtop>$form->{title}</th>
1177 <tr height="5"></tr>
1182 <th align=right>$vclabel</th>
1183 <td colspan=3>$vc</td>
1188 <th align=right>$ordlabel</th>
1189 <td colspan=3><input name="$ordnumber" size=20></td>
1192 <th align=right>| . $locale->text('From') . qq|</th>
1194 <th align=right>| . $locale->text('Bis') . qq|</th>
1197 <input type=hidden name=sort value=transdate>
1199 <th align=right>| . $locale->text('Include in Report') . qq|</th>
1204 <td><input name="l_id" class=checkbox type=checkbox value=Y>
1205 | . $locale->text('ID') . qq|</td>
1206 <td><input name="l_$ordnumber" class=checkbox type=checkbox value=Y checked> $ordlabel</td>
1207 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
1208 . $locale->text('Date') . qq|</td>
1209 <td><input name="l_reqdate" class=checkbox type=checkbox value=Y checked> |
1210 . $locale->text('Required by') . qq|</td>
1213 <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vclabel</td>
1214 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1215 <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
1216 . $locale->text('Ship via') . qq|</td>
1219 <td><input name="l_netamount" class=checkbox type=checkbox value=Y> |
1220 . $locale->text('Amount') . qq|</td>
1221 <td><input name="l_tax" class=checkbox type=checkbox value=Y> |
1222 . $locale->text('Tax') . qq|</td>
1223 <td><input name="l_amount" class=checkbox type=checkbox value=Y checked> |
1224 . $locale->text('Total') . qq|</td>
1227 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
1228 . $locale->text('Subtotal') . qq|</td>
1236 <tr><td colspan=4><hr size=3 noshade></td></tr>
1242 <input type=hidden name=nextsub value=orders>
1243 <input type=hidden name=path value=$form->{path}>
1244 <input type=hidden name=login value=$form->{login}>
1245 <input type=hidden name=password value=$form->{password}>
1246 <input type=hidden name=vc value=$form->{vc}>
1247 <input type=hidden name=type value=$form->{type}>
1249 <input class=submit type=submit name=action value="|
1250 . $locale->text('Continue') . qq|">
1257 $lxdebug->leave_sub();
1261 $lxdebug->enter_sub();
1263 # split vendor / customer
1264 ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
1265 split(/--/, $form->{ $form->{vc} });
1267 OE->transactions(\%myconfig, \%$form);
1269 $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
1271 $number = $form->escape($form->{$ordnumber});
1272 $name = $form->escape($form->{ $form->{vc} });
1273 $department = $form->escape($form->{department});
1274 $warehouse = $form->escape($form->{warehouse});
1278 "$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";
1280 # construct callback
1281 $number = $form->escape($form->{$ordnumber}, 1);
1282 $name = $form->escape($form->{ $form->{vc} }, 1);
1283 $department = $form->escape($form->{department}, 1);
1284 $warehouse = $form->escape($form->{warehouse}, 1);
1287 "$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";
1290 $form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
1291 "name", "netamount", "tax", "amount",
1292 "curr", "employee", "shipvia", "open",
1295 $form->{l_open} = $form->{l_closed} = "Y"
1296 if ($form->{open} && $form->{closed});
1298 foreach $item (@columns) {
1299 if ($form->{"l_$item"} eq "Y") {
1300 push @column_index, $item;
1302 # add column to href and callback
1303 $callback .= "&l_$item=Y";
1304 $href .= "&l_$item=Y";
1308 if ($form->{l_subtotal} eq 'Y') {
1309 $callback .= "&l_subtotal=Y";
1310 $href .= "&l_subtotal=Y";
1313 if ($form->{vc} eq 'vendor') {
1314 if ($form->{type} eq 'receive_order') {
1315 $form->{title} = $locale->text('Receive Merchandise');
1316 } elsif ($form->{type} eq 'purchase_order') {
1317 $form->{title} = $locale->text('Purchase Orders');
1319 $form->{title} = $locale->text('Request for Quotations');
1321 $name = $locale->text('Vendor');
1322 $employee = $locale->text('Employee');
1324 if ($form->{vc} eq 'customer') {
1325 if ($form->{type} eq 'sales_order') {
1326 $form->{title} = $locale->text('Sales Orders');
1327 $employee = $locale->text('Salesperson');
1328 } elsif ($form->{type} eq 'ship_order') {
1329 $form->{title} = $locale->text('Ship Merchandise');
1330 $employee = $locale->text('Salesperson');
1332 $form->{title} = $locale->text('Quotations');
1333 $employee = $locale->text('Employee');
1335 $name = $locale->text('Customer');
1338 $column_header{id} =
1339 qq|<th><a class=listheading href=$href&sort=id>|
1340 . $locale->text('ID')
1342 $column_header{transdate} =
1343 qq|<th><a class=listheading href=$href&sort=transdate>|
1344 . $locale->text('Date')
1346 $column_header{reqdate} =
1347 qq|<th><a class=listheading href=$href&sort=reqdate>|
1348 . $locale->text('Required by')
1350 $column_header{ordnumber} =
1351 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1352 . $locale->text('Order')
1354 $column_header{quonumber} =
1355 qq|<th><a class=listheading href=$href&sort=quonumber>|
1356 . $locale->text('Quotation')
1358 $column_header{name} =
1359 qq|<th><a class=listheading href=$href&sort=name>$name</a></th>|;
1360 $column_header{netamount} =
1361 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1362 $column_header{tax} =
1363 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1364 $column_header{amount} =
1365 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1366 $column_header{curr} =
1367 qq|<th class=listheading>| . $locale->text('Curr') . qq|</th>|;
1368 $column_header{shipvia} =
1369 qq|<th><a class=listheading href=$href&sort=shipvia>|
1370 . $locale->text('Ship via')
1372 $column_header{open} =
1373 qq|<th class=listheading>| . $locale->text('O') . qq|</th>|;
1374 $column_header{closed} =
1375 qq|<th class=listheading>| . $locale->text('C') . qq|</th>|;
1377 $column_header{employee} =
1378 qq|<th><a class=listheading href=$href&sort=employee>$employee</a></th>|;
1380 if ($form->{ $form->{vc} }) {
1381 $option = $locale->text(ucfirst $form->{vc});
1382 $option .= " : $form->{$form->{vc}}";
1384 if ($form->{warehouse}) {
1385 ($warehouse) = split /--/, $form->{warehouse};
1386 $option .= "\n<br>" if ($option);
1387 $option .= $locale->text('Warehouse');
1388 $option .= " : $warehouse";
1390 if ($form->{department}) {
1391 $option .= "\n<br>" if ($option);
1392 ($department) = split /--/, $form->{department};
1393 $option .= $locale->text('Department') . " : $department";
1395 if ($form->{transdatefrom}) {
1397 . $locale->text('From') . " "
1398 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1400 if ($form->{transdateto}) {
1402 . $locale->text('Bis') . " "
1403 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1405 if ($form->{open}) {
1406 $option .= "\n<br>" if ($option);
1407 $option .= $locale->text('Open');
1409 if ($form->{closed}) {
1410 $option .= "\n<br>" if ($option);
1411 $option .= $locale->text('Closed');
1421 <th class=listtop>$form->{title}</th>
1423 <tr height="5"></tr>
1430 <tr class=listheading>|;
1432 map { print "\n$column_header{$_}" } @column_index;
1438 # add sort and escape callback
1439 $callback = $form->escape($callback . "&sort=$form->{sort}");
1441 if (@{ $form->{OE} }) {
1442 $sameitem = $form->{OE}->[0]->{ $form->{sort} };
1446 $action = "ship_receive" if ($form->{type} =~ /(ship|receive)_order/);
1448 $warehouse = $form->escape($form->{warehouse});
1450 foreach $oe (@{ $form->{OE} }) {
1452 if ($form->{l_subtotal} eq 'Y') {
1453 if ($sameitem ne $oe->{ $form->{sort} }) {
1455 $sameitem = $oe->{ $form->{sort} };
1459 map { $oe->{$_} *= $oe->{exchangerate} } (qw(netamount amount));
1461 $column_data{netamount} =
1463 . $form->format_amount(\%myconfig, $oe->{netamount}, 2, " ")
1465 $column_data{tax} = "<td align=right>"
1466 . $form->format_amount(\%myconfig, $oe->{amount} - $oe->{netamount},
1469 $column_data{amount} =
1471 . $form->format_amount(\%myconfig, $oe->{amount}, 2, " ") . "</td>";
1473 $totalnetamount += $oe->{netamount};
1474 $totalamount += $oe->{amount};
1476 $subtotalnetamount += $oe->{netamount};
1477 $subtotalamount += $oe->{amount};
1479 $column_data{id} = "<td>$oe->{id}</td>";
1480 $column_data{transdate} = "<td>$oe->{transdate} </td>";
1481 $column_data{reqdate} = "<td>$oe->{reqdate} </td>";
1483 $column_data{$ordnumber} =
1484 "<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>";
1485 $column_data{name} = "<td>$oe->{name}</td>";
1487 $column_data{employee} = "<td>$oe->{employee} </td>";
1488 $column_data{shipvia} = "<td>$oe->{shipvia} </td>";
1490 if ($oe->{closed}) {
1491 $column_data{closed} = "<td align=center>X</td>";
1492 $column_data{open} = "<td> </td>";
1494 $column_data{closed} = "<td> </td>";
1495 $column_data{open} = "<td align=center>X</td>";
1501 <tr class=listrow$i>";
1503 map { print "\n$column_data{$_}" } @column_index;
1511 if ($form->{l_subtotal} eq 'Y') {
1517 <tr class=listtotal>|;
1519 map { $column_data{$_} = "<td> </td>" } @column_index;
1521 $column_data{netamount} =
1522 "<th class=listtotal align=right>"
1523 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1524 $column_data{tax} = "<th class=listtotal align=right>"
1525 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1528 $column_data{amount} =
1529 "<th class=listtotal align=right>"
1530 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1532 map { print "\n$column_data{$_}" } @column_index;
1540 <td><hr size=3 noshade></td>
1545 <form method=post action=$form->{script}>
1547 <input name=callback type=hidden value="$form->{callback}">
1549 <input type=hidden name=type value=$form->{type}>
1550 <input type=hidden name=vc value=$form->{vc}>
1552 <input type=hidden name=path value=$form->{path}>
1553 <input type=hidden name=login value=$form->{login}>
1554 <input type=hidden name=password value=$form->{password}>
1557 if ($form->{type} !~ /(ship|receive)_order/) {
1559 <input class=submit type=submit name=action value="|
1560 . $locale->text('Add') . qq|">|;
1563 if ($form->{menubar}) {
1564 require "$form->{path}/menu.pl";
1575 $lxdebug->leave_sub();
1579 $lxdebug->enter_sub();
1581 map { $column_data{$_} = "<td> </td>" } @column_index;
1583 $column_data{netamount} =
1584 "<th class=listsubtotal align=right>"
1585 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1587 $column_data{tax} = "<td class=listsubtotal align=right>"
1588 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1591 $column_data{amount} =
1592 "<th class=listsubtotal align=right>"
1593 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1595 $subtotalnetamount = 0;
1596 $subtotalamount = 0;
1599 <tr class=listsubtotal>
1602 map { print "\n$column_data{$_}" } @column_index;
1608 $lxdebug->leave_sub();
1612 $lxdebug->enter_sub();
1614 if ($form->{type} =~ /_order$/) {
1615 $form->isblank("transdate", $locale->text('Order Date missing!'));
1617 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1620 $msg = ucfirst $form->{vc};
1621 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
1623 # $locale->text('Customer missing!');
1624 # $locale->text('Vendor missing!');
1626 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1627 if ($form->{currency} ne $form->{defaultcurrency});
1631 # if the name changed get new values
1632 if (&check_name($form->{vc})) {
1637 $form->{id} = 0 if $form->{saveasnew};
1639 # this is for the internal notes section for the [email] Subject
1640 if ($form->{type} =~ /_order$/) {
1641 if ($form->{type} eq 'sales_order') {
1642 $form->{label} = $locale->text('Sales Order');
1644 $numberfld = "sonumber";
1645 $ordnumber = "ordnumber";
1647 $form->{label} = $locale->text('Purchase Order');
1649 $numberfld = "ponumber";
1650 $ordnumber = "ordnumber";
1653 $err = $locale->text('Cannot save order!');
1656 if ($form->{type} eq 'sales_quotation') {
1657 $form->{label} = $locale->text('Quotation');
1659 $numberfld = "sqnumber";
1660 $ordnumber = "quonumber";
1662 $form->{label} = $locale->text('Request for Quotation');
1664 $numberfld = "rfqnumber";
1665 $ordnumber = "quonumber";
1668 $err = $locale->text('Cannot save quotation!');
1672 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld)
1673 unless $form->{$ordnumber};
1676 $form->{label} . " $form->{$ordnumber} " . $locale->text('saved!'))
1677 if (OE->save(\%myconfig, \%$form));
1680 $lxdebug->leave_sub();
1684 $lxdebug->enter_sub();
1688 if ($form->{type} =~ /_order$/) {
1689 $msg = $locale->text('Are you sure you want to delete Order Number');
1690 $ordnumber = 'ordnumber';
1692 $msg = $locale->text('Are you sure you want to delete Quotation Number');
1693 $ordnumber = 'quonumber';
1699 <form method=post action=$form->{script}>
1702 # delete action variable
1703 map { delete $form->{$_} } qw(action header);
1705 foreach $key (keys %$form) {
1706 $form->{$key} =~ s/\"/"/g;
1707 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1711 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
1713 <h4>$msg $form->{$ordnumber}</h4>
1715 <input name=action class=submit type=submit value="|
1716 . $locale->text('Yes') . qq|">
1723 $lxdebug->leave_sub();
1727 $lxdebug->enter_sub();
1729 if ($form->{type} =~ /_order$/) {
1730 $msg = $locale->text('Order deleted!');
1731 $err = $locale->text('Cannot delete order!');
1733 $msg = $locale->text('Quotation deleted!');
1734 $err = $locale->text('Cannot delete quotation!');
1737 $form->redirect($msg) if (OE->delete(\%myconfig, \%$form, $spool));
1740 $lxdebug->leave_sub();
1744 $lxdebug->enter_sub();
1746 if ($form->{type} =~ /_order$/) {
1747 $form->isblank("ordnumber", $locale->text('Order Number missing!'));
1748 $form->isblank("transdate", $locale->text('Order Date missing!'));
1751 $form->isblank("quonumber", $locale->text('Quotation Number missing!'));
1752 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1753 $form->{ordnumber} = "";
1756 # if the name changed get new values
1757 if (&check_name($form->{vc})) {
1762 ($null, $form->{cp_id}) = split /--/, $form->{contact};
1763 $form->{cp_id} *= 1;
1765 if ( $form->{type} =~ /_order/
1766 && $form->{currency} ne $form->{defaultcurrency}) {
1768 # check if we need a new exchangerate
1769 $buysell = ($form->{type} eq 'sales_order') ? "buy" : "sell";
1771 $orddate = $form->current_date(\%myconfig);
1773 $form->check_exchangerate(\%myconfig, $form->{currency}, $orddate,
1776 if (!$exchangerate) {
1777 &backorder_exchangerate($orddate, $buysell);
1782 # close orders/quotations
1783 $form->{closed} = 1;
1784 OE->save(\%myconfig, \%$form);
1786 $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
1788 $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
1791 $form->{closed} = 0;
1792 $form->{rowcount}--;
1793 $form->{shipto} = 1;
1795 if ($form->{type} =~ /_order$/) {
1796 $form->{exchangerate} = $exchangerate;
1800 if ( $form->{type} eq 'purchase_order'
1801 || $form->{type} eq 'request_quotation') {
1802 $form->{title} = $locale->text('Add Vendor Invoice');
1803 $form->{script} = 'ir.pl';
1807 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
1808 $form->{title} = $locale->text('Add Sales Invoice');
1809 $form->{script} = 'is.pl';
1814 # bo creates the id, reset it
1815 map { delete $form->{$_} }
1816 qw(id subject message cc bcc printed emailed queued);
1817 $form->{ $form->{vc} } =~ s/--.*//g;
1818 $form->{type} = "invoice";
1821 $locale = new Locale "$myconfig{countrycode}", "$script";
1823 require "$form->{path}/$form->{script}";
1825 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
1827 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1828 qw(creditlimit creditremaining);
1830 $currency = $form->{currency};
1833 $form->{currency} = $currency;
1834 $form->{exchangerate} = "";
1835 $form->{forex} = "";
1836 $form->{exchangerate} = $exchangerate
1840 $form->check_exchangerate(
1841 \%myconfig, $form->{currency}, $form->{invdate}, $buysell
1844 $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
1849 for $i (1 .. $form->{rowcount}) {
1850 $form->{"discount_$i"} =
1851 $form->format_amount(\%myconfig, $form->{"discount_$i"});
1853 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
1855 $decimalplaces = ($dec > 2) ? $dec : 2;
1857 $form->{"sellprice_$i"} =
1858 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
1860 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
1862 map { $form->{"${_}_$i"} =~ s/\"/"/g }
1863 qw(partnumber description unit);
1869 $lxdebug->leave_sub();
1872 sub backorder_exchangerate {
1873 $lxdebug->enter_sub();
1874 my ($orddate, $buysell) = @_;
1881 <form method=post action=$form->{script}>
1884 # delete action variable
1885 map { delete $form->{$_} } qw(action header exchangerate);
1887 foreach $key (keys %$form) {
1888 $form->{$key} =~ s/\"/"/g;
1889 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1892 $form->{title} = $locale->text('Add Exchangerate');
1896 <input type=hidden name=path value=$form->{path}>
1897 <input type=hidden name=login value=$form->{login}>
1898 <input type=hidden name=password value=$form->{password}>
1900 <input type=hidden name=exchangeratedate value=$orddate>
1901 <input type=hidden name=buysell value=$buysell>
1904 <tr><th class=listtop>$form->{title}</th></tr>
1905 <tr height="5"></tr>
1910 <th align=right>| . $locale->text('Currency') . qq|</th>
1911 <td>$form->{currency}</td>
1914 <th align=right>| . $locale->text('Date') . qq|</th>
1918 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
1919 <td><input name=exchangerate size=11></td>
1929 <input type=hidden name=nextsub value=save_exchangerate>
1931 <input name=action class=submit type=submit value="|
1932 . $locale->text('Continue') . qq|">
1940 $lxdebug->leave_sub();
1943 sub save_exchangerate {
1944 $lxdebug->enter_sub();
1946 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'));
1947 $form->{exchangerate} =
1948 $form->parse_amount(\%myconfig, $form->{exchangerate});
1949 $form->save_exchangerate(\%myconfig, $form->{currency},
1950 $form->{exchangeratedate},
1951 $form->{exchangerate}, $form->{buysell});
1955 $lxdebug->leave_sub();
1958 sub create_backorder {
1959 $lxdebug->enter_sub();
1961 $form->{shipped} = 1;
1963 # figure out if we need to create a backorder
1964 # items aren't saved if qty != 0
1966 for $i (1 .. $form->{rowcount}) {
1967 $totalqty += $qty = $form->{"qty_$i"};
1968 $totalship += $ship = $form->{"ship_$i"};
1970 $form->{"qty_$i"} = $qty - $ship;
1973 if ($totalship == 0) {
1974 map { $form->{"ship_$_"} = $form->{"qty_$_"} } (1 .. $form->{rowcount});
1975 $form->{ordtotal} = 0;
1976 $form->{shipped} = 0;
1980 if ($totalqty == $totalship) {
1981 map { $form->{"qty_$_"} = $form->{"ship_$_"} } (1 .. $form->{rowcount});
1982 $form->{ordtotal} = 0;
1987 qw(partnumber description qty ship unit sellprice discount id inventory_accno bin income_accno expense_accno listprice assembly taxaccounts partsgroup)
1990 for $i (1 .. $form->{rowcount}) {
1992 $form->{"${_}_$i"} =
1993 $form->format_amount(\%myconfig, $form->{"${_}_$i"})
1994 } qw(sellprice discount);
1997 OE->save(\%myconfig, \%$form);
1999 # rebuild rows for invoice
2003 for $i (1 .. $form->{rowcount}) {
2004 $form->{"qty_$i"} = $form->{"ship_$i"};
2006 if ($form->{"qty_$i"}) {
2009 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
2014 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
2015 $form->{rowcount} = $count;
2017 $lxdebug->leave_sub();
2021 $lxdebug->enter_sub();
2023 $form->{saveasnew} = 1;
2024 $form->{closed} = 0;
2025 map { delete $form->{$_} } qw(printed emailed queued);
2029 $lxdebug->leave_sub();
2032 sub purchase_order {
2033 $lxdebug->enter_sub();
2035 $form->{title} = $locale->text('Add Purchase Order');
2036 $form->{vc} = "vendor";
2037 $form->{type} = "purchase_order";
2041 $lxdebug->leave_sub();
2045 $lxdebug->enter_sub();
2047 if ( $form->{type} eq 'sales_quotation'
2048 || $form->{type} eq 'request_quotation') {
2049 $form->{closed} = 1;
2050 OE->save(\%myconfig, \%$form);
2053 ($null, $form->{cp_id}) = split /--/, $form->{contact};
2054 $form->{cp_id} *= 1;
2056 $form->{title} = $locale->text('Add Sales Order');
2057 $form->{vc} = "customer";
2058 $form->{type} = "sales_order";
2062 $lxdebug->leave_sub();
2066 $lxdebug->enter_sub();
2068 $form->{transdate} = $form->current_date(\%myconfig);
2069 delete $form->{duedate};
2071 $form->{closed} = 0;
2074 map { delete $form->{$_} }
2075 qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
2082 for $i (1 .. $form->{rowcount} - 1) {
2083 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2084 qw(partnumber description unit);
2087 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 0, "0") }
2088 qw(creditlimit creditremaining);
2092 $lxdebug->leave_sub();
2096 $lxdebug->enter_sub();
2102 OE->get_warehouses(\%myconfig, \%$form);
2105 if (@{ $form->{all_warehouses} }) {
2106 $form->{selectwarehouse} = "<option>\n";
2108 map { $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n" }
2109 (@{ $form->{all_warehouses} });
2111 if ($form->{warehouse}) {
2112 $form->{selectwarehouse} = "<option>$form->{warehouse}";
2116 $form->{shippingdate} = $form->current_date(\%myconfig);
2117 $form->{"$form->{vc}"} =~ s/--.*//;
2122 foreach $key (keys %$form) {
2123 if ($key =~ /_1$/) {
2129 for $i (1 .. $form->{rowcount}) {
2131 # undo formatting from prepare_order
2133 $form->{"${_}_$i"} =
2134 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
2136 $n = ($form->{"qty_$i"} -= $form->{"ship_$i"});
2138 && ($form->{"inventory_accno_$i"} || $form->{"assembly_$i"})) {
2139 $form->{"ship_$i"} = "";
2140 $form->{"serialnumber_$i"} = "";
2145 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
2150 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
2151 $form->{rowcount} = $count;
2153 &display_ship_receive;
2155 $lxdebug->leave_sub();
2158 sub display_ship_receive {
2159 $lxdebug->enter_sub();
2161 $vclabel = ucfirst $form->{vc};
2162 $vclabel = $locale->text($vclabel);
2164 $form->{rowcount}++;
2166 if ($form->{vc} eq 'customer') {
2167 $form->{title} = $locale->text('Ship Merchandise');
2168 $shipped = $locale->text('Shipping Date');
2170 $form->{title} = $locale->text('Receive Merchandise');
2171 $shipped = $locale->text('Date Received');
2174 # set option selected
2175 foreach $item (warehouse, employee) {
2176 $form->{"select$item"} =~ s/ selected//;
2177 $form->{"select$item"} =~
2178 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
2183 <th align=right>| . $locale->text('Warehouse') . qq|</th>
2184 <td><select name=warehouse>$form->{selectwarehouse}</select></td>
2185 <input type=hidden name=selectwarehouse value="$form->{selectwarehouse}">
2187 | if $form->{selectwarehouse};
2191 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
2192 <td><select name=employee>$form->{selectemployee}</select></td>
2193 <input type=hidden name=selectemployee value="$form->{selectemployee}">
2202 <form method=post action=$form->{script}>
2204 <input type=hidden name=id value=$form->{id}>
2206 <input type=hidden name=display_form value=display_ship_receive>
2208 <input type=hidden name=type value=$form->{type}>
2209 <input type=hidden name=media value=$form->{media}>
2210 <input type=hidden name=format value=$form->{format}>
2212 <input type=hidden name=queued value="$form->{queued}">
2213 <input type=hidden name=printed value="$form->{printed}">
2214 <input type=hidden name=emailed value="$form->{emailed}">
2216 <input type=hidden name=vc value=$form->{vc}>
2220 <th class=listtop>$form->{title}</th>
2222 <tr height="5"></tr>
2225 <table width="100%">
2230 <th align=right>$vclabel</th>
2231 <td colspan=3>$form->{$form->{vc}}</td>
2232 <input type=hidden name=$form->{vc} value="$form->{$form->{vc}}">
2233 <input type=hidden name="$form->{vc}_id" value=$form->{"$form->{vc}_id"}>
2237 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
2239 <input name=shippingpoint size=35 value="$form->{shippingpoint}">
2242 <th align=right>| . $locale->text('Ship via') . qq|</th>
2244 <input name=shipvia size=35 value="$form->{shipvia}">
2253 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
2254 <td>$form->{ordnumber}</td>
2255 <input type=hidden name=ordnumber value="$form->{ordnumber}">
2258 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
2259 <td>$form->{transdate}</td>
2260 <input type=hidden name=transdate value=$form->{transdate}>
2263 <th align=right nowrap>$shipped</th>
2264 <td><input name=shippingdate size=11 value=$form->{shippingdate}></td>
2273 <!-- shipto are in hidden variables -->
2275 <input type=hidden name=shiptoname value="$form->{shiptoname}">
2276 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
2277 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
2278 <input type=hidden name=shiptocity value="$form->{shiptocity}">
2279 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
2280 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
2281 <input type=hidden name=shiptophone value="$form->{shiptophone}">
2282 <input type=hidden name=shiptofax value="$form->{shiptofax}">
2283 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
2285 <!-- email variables -->
2286 <input type=hidden name=message value="$form->{message}">
2287 <input type=hidden name=email value="$form->{email}">
2288 <input type=hidden name=subject value="$form->{subject}">
2289 <input type=hidden name=cc value="$form->{cc}">
2290 <input type=hidden name=bcc value="$form->{bcc}">
2295 (partnumber, description, qty, ship, unit, bin, serialnumber);
2297 if ($form->{type} eq "ship_order") {
2298 $column_data{ship} =
2299 qq|<th class=listheading align=center width="auto">|
2300 . $locale->text('Ship')
2303 if ($form->{type} eq "receive_order") {
2304 $column_data{ship} =
2305 qq|<th class=listheading align=center width="auto">|
2306 . $locale->text('Recd')
2310 my $colspan = $#column_index + 1;
2312 $column_data{partnumber} =
2313 qq|<th class=listheading nowrap>| . $locale->text('Number') . qq|</th>|;
2314 $column_data{description} =
2315 qq|<th class=listheading nowrap>|
2316 . $locale->text('Description')
2319 qq|<th class=listheading nowrap>| . $locale->text('Qty') . qq|</th>|;
2320 $column_data{unit} =
2321 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
2323 qq|<th class=listheading nowrap>| . $locale->text('Bin') . qq|</th>|;
2324 $column_data{serialnumber} =
2325 qq|<th class=listheading nowrap>|
2326 . $locale->text('Serial No.')
2333 <tr class=listheading>|;
2335 map { print "\n$column_data{$_}" } @column_index;
2341 for $i (1 .. $form->{rowcount} - 1) {
2344 $form->{"ship_$i"} = $form->parse_amount(\%myconfig, $form->{"ship_$i"});
2346 # convert " to "
2347 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2348 qw(partnumber description unit bin serialnumber);
2350 $description = $form->{"description_$i"};
2351 $description =~ s/\n/<br>/g;
2353 $column_data{partnumber} =
2354 qq|<td>$form->{"partnumber_$i"}<input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"></td>|;
2355 $column_data{description} =
2356 qq|<td>$description<input type=hidden name="description_$i" value="$form->{"description_$i"}"></td>|;
2358 qq|<td align=right>|
2359 . $form->format_amount(\%myconfig, $form->{"qty_$i"})
2360 . qq|<input type=hidden name="qty_$i" value="$form->{"qty_$i"}"></td>|;
2361 $column_data{ship} =
2362 qq|<td align=right><input name="ship_$i" size=5 value=|
2363 . $form->format_amount(\%myconfig, $form->{"ship_$i"})
2365 $column_data{unit} =
2366 qq|<td>$form->{"unit_$i"}<input type=hidden name="unit_$i" value="$form->{"unit_$i"}"></td>|;
2368 qq|<td>$form->{"bin_$i"}<input type=hidden name="bin_$i" value="$form->{"bin_$i"}"></td>|;
2370 $column_data{serialnumber} =
2371 qq|<td><input name="serialnumber_$i" size=15 value="$form->{"serialnumber_$i"}"></td>|;
2376 map { print "\n$column_data{$_}" } @column_index;
2381 <input type=hidden name="orderitems_id_$i" value=$form->{"orderitems_id_$i"}>
2382 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
2383 <input type=hidden name="assembly_$i" value="$form->{"assembly_$i"}">
2384 <input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">
2395 <td><hr size=3 noshade></td>
2401 $form->{copies} = 1;
2410 <input class=submit type=submit name=action value="|
2411 . $locale->text('Update') . qq|">
2412 <input class=submit type=submit name=action value="|
2413 . $locale->text('Print') . qq|">
2416 if ($form->{type} eq 'ship_order') {
2418 <input class=submit type=submit name=action value="|
2419 . $locale->text('Ship to') . qq|">
2420 <input class=submit type=submit name=action value="|
2421 . $locale->text('E-mail') . qq|">
2427 <input class=submit type=submit name=action value="|
2428 . $locale->text('Done') . qq|">
2431 if ($form->{menubar}) {
2432 require "$form->{path}/menu.pl";
2438 <input type=hidden name=rowcount value=$form->{rowcount}>
2440 <input name=callback type=hidden value="$callback">
2442 <input type=hidden name=path value=$form->{path}>
2443 <input type=hidden name=login value=$form->{login}>
2444 <input type=hidden name=password value=$form->{password}>
2452 $lxdebug->leave_sub();
2456 $lxdebug->enter_sub();
2458 if ($form->{type} eq 'ship_order') {
2459 $form->isblank("shippingdate", $locale->text('Shipping Date missing!'));
2461 $form->isblank("shippingdate", $locale->text('Date received missing!'));
2466 $total += $form->{"ship_$_"} =
2467 $form->parse_amount(\%myconfig, $form->{"ship_$_"})
2468 } (1 .. $form->{rowcount} - 1);
2470 $form->error($locale->text('Nothing entered!')) unless $total;
2472 $form->redirect($locale->text('Inventory saved!'))
2473 if OE->save_inventory(\%myconfig, \%$form);
2474 $form->error($locale->text('Could not save!'));
2476 $lxdebug->leave_sub();
2479 sub search_transfer {
2480 $lxdebug->enter_sub();
2482 OE->get_warehouses(\%myconfig, \%$form);
2485 if (@{ $form->{all_warehouses} }) {
2486 $form->{selectwarehouse} = "<option>\n";
2487 $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
2489 map { $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n" }
2490 (@{ $form->{all_warehouses} });
2492 $form->error($locale->text('Nothing to transfer!'));
2495 $form->{title} = $locale->text('Transfer Inventory');
2502 <form method=post action=$form->{script}>
2506 <th class=listtop>$form->{title}</th>
2508 <tr height="5"></tr>
2513 <th align=right nowrap>| . $locale->text('Transfer to') . qq|</th>
2514 <td><select name=warehouse>$form->{selectwarehouse}</select></td>
2517 <th align="right" nowrap="true">| . $locale->text('Part Number') . qq|</th>
2518 <td><input name=partnumber size=20></td>
2521 <th align="right" nowrap="true">| . $locale->text('Description') . qq|</th>
2522 <td><input name=description size=40></td>
2525 <th align=right nowrap>| . $locale->text('Group') . qq|</th>
2526 <td><input name=partsgroup size=20></td>
2532 <td><hr size=3 noshade></td>
2537 <input type=hidden name=sort value=partnumber>
2538 <input type=hidden name=nextsub value=list_transfer>
2540 <input type=hidden name=path value=$form->{path}>
2541 <input type=hidden name=login value=$form->{login}>
2542 <input type=hidden name=password value=$form->{password}>
2544 <input class=submit type=submit name=action value="|
2545 . $locale->text('Continue') . qq|">
2552 $lxdebug->leave_sub();
2556 $lxdebug->enter_sub();
2558 OE->get_inventory(\%myconfig, \%$form);
2560 $partnumber = $form->escape($form->{partnumber});
2561 $warehouse = $form->escape($form->{warehouse});
2562 $description = $form->escape($form->{description});
2563 $partsgroup = $form->escape($form->{partsgroup});
2567 "$form->{script}?path=$form->{path}&action=list_transfer&partnumber=$partnumber&warehouse=$warehouse&description=$description&partsgroup=$partsgroup&login=$form->{login}&password=$form->{password}";
2569 # construct callback
2570 $partnumber = $form->escape($form->{partnumber}, 1);
2571 $warehouse = $form->escape($form->{warehouse}, 1);
2572 $description = $form->escape($form->{description}, 1);
2573 $partsgroup = $form->escape($form->{partsgroup}, 1);
2576 "$form->{script}?path=$form->{path}&action=list_transfer&partnumber=$partnumber&warehouse=$warehouse&description=$description&partsgroup=$partsgroup&login=$form->{login}&password=$form->{password}";
2579 $form->sort_columns(
2580 qw(partnumber description partsgroup make model warehouse qty transfer));
2582 $column_header{partnumber} =
2583 qq|<th><a class=listheading href=$href&sort=partnumber>|
2584 . $locale->text('Part Number')
2586 $column_header{description} =
2587 qq|<th><a class=listheading href=$href&sort=description>|
2588 . $locale->text('Description')
2590 $column_header{partsgroup} =
2591 qq|<th><a class=listheading href=$href&sort=partsgroup>|
2592 . $locale->text('Group')
2594 $column_header{warehouse} =
2595 qq|<th><a class=listheading href=$href&sort=warehouse>|
2596 . $locale->text('From')
2598 $column_header{qty} =
2599 qq|<th><a class=listheading>| . $locale->text('Qty') . qq|</a></th>|;
2600 $column_header{transfer} =
2601 qq|<th><a class=listheading>| . $locale->text('Transfer') . qq|</a></th>|;
2603 $option = $locale->text('Transfer to');
2605 ($warehouse, $warehouse_id) = split /--/, $form->{warehouse};
2607 if ($form->{warehouse}) {
2608 $option .= " : $warehouse";
2610 if ($form->{partnumber}) {
2611 $option .= "\n<br>" if ($option);
2612 $option .= $locale->text('Part Number') . " : $form->{partnumber}";
2614 if ($form->{description}) {
2615 $option .= "\n<br>" if ($option);
2616 $option .= $locale->text('Description') . " : $form->{description}";
2618 if ($form->{partsgroup}) {
2619 $option .= "\n<br>" if ($option);
2620 $option .= $locale->text('Group') . " : $form->{partsgroup}";
2623 $form->{title} = $locale->text('Transfer Inventory');
2630 <form method=post action=$form->{script}>
2632 <input type=hidden name=warehouse_id value=$warehouse_id>
2636 <th class=listtop>$form->{title}</th>
2638 <tr height="5"></tr>
2645 <tr class=listheading>|;
2647 map { print "\n$column_header{$_}" } @column_index;
2653 if (@{ $form->{all_inventory} }) {
2654 $sameitem = $form->{all_inventory}->[0]->{ $form->{sort} };
2658 foreach $ref (@{ $form->{all_inventory} }) {
2662 $column_data{partnumber} =
2663 qq|<td><input type=hidden name="id_$i" value=$ref->{id}>$ref->{partnumber}</td>|;
2664 $column_data{description} = "<td>$ref->{description} </td>";
2665 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
2666 $column_data{warehouse} =
2667 qq|<td><input type=hidden name="warehouse_id_$i" value=$ref->{warehouse_id}>$ref->{warehouse} </td>|;
2669 qq|<td><input type=hidden name="qty_$i" value=$ref->{qty}>|
2670 . $form->format_amount(\%myconfig, $ref->{qty})
2672 $column_data{transfer} = qq|<td><input name="transfer_$i" size=4></td>|;
2677 <tr class=listrow$j>";
2679 map { print "\n$column_data{$_}" } @column_index;
2693 <td><hr size=3 noshade></td>
2699 <input name=callback type=hidden value="$callback">
2701 <input type=hidden name=rowcount value=$i>
2703 <input type=hidden name=path value=$form->{path}>
2704 <input type=hidden name=login value=$form->{login}>
2705 <input type=hidden name=password value=$form->{password}>
2707 <input class=submit type=submit name=action value="|
2708 . $locale->text('Transfer') . qq|">|;
2710 if ($form->{menubar}) {
2711 require "$form->{path}/menu.pl";
2722 $lxdebug->leave_sub();
2726 $lxdebug->enter_sub();
2728 $form->redirect($locale->text('Inventory transferred!'))
2729 if OE->transfer(\%myconfig, \%$form);
2730 $form->error($locale->text('Could not transfer Inventory!'));
2732 $lxdebug->leave_sub();