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"},
219 (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
220 $dec_qty = length $dec_qty;
222 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
224 map { $form->{"${_}_$i"} =~ s/\"/"/g }
225 qw(partnumber description unit);
226 $form->{rowcount} = $i;
228 } elsif ($form->{rowcount}) {
229 for my $i (1 .. $form->{rowcount}) {
230 $form->{"discount_$i"} =
231 $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
233 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
235 $decimalplaces = ($dec > 2) ? $dec : 2;
237 $form->{"sellprice_$i"} =
238 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
241 (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
242 $dec_qty = length $dec_qty;
243 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
245 map { $form->{"${_}_$i"} =~ s/\"/"/g }
246 qw(partnumber description unit);
250 $lxdebug->leave_sub();
254 $lxdebug->enter_sub();
256 $checkedopen = ($form->{closed}) ? "" : "checked";
257 $checkedclosed = ($form->{closed}) ? "checked" : "";
259 # use JavaScript Calendar or not
260 $form->{jsscript} = $form->{jscalendar};
263 if ($form->{jsscript}) {
265 # with JavaScript Calendar
267 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
268 <td><input type=button name=transdate id="trigger1" value=|
269 . $locale->text('button') . qq|></td>
272 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>
273 <td width="4"><input type=button name=reqdate name=reqdate id="trigger2" value=|
274 . $locale->text('button') . qq|></td>
279 Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
280 "reqdate", "BL", "trigger2");
284 # without JavaScript Calendar
286 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
288 <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>|;
294 <td colspan=2 align=center>
297 <th nowrap><input name=closed type=radio class=radio value=0 $checkedopen> |
298 . $locale->text('Open') . qq|</th>
299 <th nowrap><input name=closed type=radio class=radio value=1 $checkedclosed> |
300 . $locale->text('Closed') . qq|</th>
308 # set option selected
309 foreach $item ($form->{vc}, currency, department, employee, contact) {
310 $form->{"select$item"} =~ s/ selected//;
311 $form->{"select$item"} =~
312 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
316 if ($form->{all_contacts}) {
318 $form->{selectcontact} = "";
319 foreach $item (@{ $form->{all_contacts} }) {
320 if ($form->{cp_id} == $item->{cp_id}) {
321 $form->{selectcontact} .=
322 "<option selected>$item->{cp_name}--$item->{cp_id}";
324 $form->{selectcontact} .= "<option>$item->{cp_name}--$item->{cp_id}";
329 $form->{exchangerate} =
330 $form->format_amount(\%myconfig, $form->{exchangerate});
332 $form->{creditlimit} =
333 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
334 $form->{creditremaining} =
335 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
338 ($form->{selectcontact})
339 ? qq|<select name=contact>$form->{selectcontact}</select>\n<input type=hidden name="selectcontact" value="$form->{selectcontact}">|
340 : qq|<input name=contact value="$form->{contact}" size=35>|;
343 <input type=hidden name=forex value=$form->{forex}>
346 if ($form->{currency} ne $form->{defaultcurrency}) {
347 if ($form->{forex}) {
350 . $locale->text('Exchangerate')
351 . qq|</th><td>$form->{exchangerate}</td>
352 <input type=hidden name=exchangerate value=$form->{exchangerate}>
357 . $locale->text('Exchangerate')
358 . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
362 $vclabel = ucfirst $form->{vc};
363 $vclabel = $locale->text($vclabel);
367 <th align=right nowrap>| . $locale->text('Terms: Net') . qq|</th>
368 <td nowrap><input name=terms size="3" maxlength="3" value=$form->{terms}> |
369 . $locale->text('days') . qq|</td>
373 if ($form->{business}) {
376 <th align=right>| . $locale->text('Business') . qq|</th>
377 <td>$form->{business}</td>
378 <th align=right>| . $locale->text('Trade Discount') . qq|</th>
380 . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
386 if ($form->{type} !~ /_quotation$/) {
389 <th width=70% align=right nowrap>| . $locale->text('Order Number') . qq|</th>
390 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
393 <th width=70% align=right nowrap>|
394 . $locale->text('Quotation Number') . qq|</th>
395 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
398 <th width=70% align=right nowrap>|
399 . $locale->text('Customer Order Number') . qq|</th>
400 <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
403 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
408 <th align=right nowrap=true>| . $locale->text('Required by') . qq|</th>
413 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
415 $creditremaining = qq|
421 <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
422 <td>$form->{creditlimit}</td>
424 <th nowrap>| . $locale->text('Remaining') . qq|</th>
425 <td class="plus$n">$form->{creditremaining}</td>
433 ($form->{type} eq 'sales_quotation')
434 ? $locale->text('Valid until')
435 : $locale->text('Required by');
436 if ($form->{type} eq 'sales_quotation') {
439 <th width=70% align=right nowrap>|
440 . $locale->text('Quotation Number') . qq|</th>
441 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
442 <input type=hidden name=ordnumber value="$form->{ordnumber}">
448 <th width=70% align=right nowrap>| . $locale->text('RFQ Number') . qq|</th>
449 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
450 <input type=hidden name=ordnumber value="$form->{ordnumber}">
459 <th align=right nowrap>| . $locale->text('Quotation Date') . qq|</th>
463 <th align=right nowrap=true>$reqlabel</th>
471 ($form->{"select$form->{vc}"})
472 ? qq|<select name=$form->{vc}>$form->{"select$form->{vc}"}</select>\n<input type=hidden name="select$form->{vc}" value="$form->{"select$form->{vc}"}">|
473 : qq|<input name=$form->{vc} value="$form->{$form->{vc}}" size=35>|;
477 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
478 <td colspan=3><select name=department>$form->{selectdepartment}</select>
479 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
482 | if $form->{selectdepartment};
485 <input type=hidden name=employee value="$form->{employee}">
488 if ($form->{type} eq 'sales_order') {
489 if ($form->{selectemployee}) {
491 <input type=hidden name=customer_klass value=$form->{customer_klass}>
493 <th align=right nowrap>| . $locale->text('Salesperson') . qq|</th>
494 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
495 <input type=hidden name=selectemployee value="$form->{selectemployee}">
502 <input type=hidden name=customer_klass value=$form->{customer_klass}>
504 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
505 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
506 <input type=hidden name=selectemployee value="$form->{selectemployee}">
517 <form method=post action=$form->{script}>
519 <input type=hidden name=id value=$form->{id}>
521 <input type=hidden name=type value=$form->{type}>
522 <input type=hidden name=formname value=$form->{formname}>
523 <input type=hidden name=media value=$form->{media}>
524 <input type=hidden name=format value=$form->{format}>
526 <input type=hidden name=queued value="$form->{queued}">
527 <input type=hidden name=printed value="$form->{printed}">
528 <input type=hidden name=emailed value="$form->{emailed}">
530 <input type=hidden name=vc value=$form->{vc}>
532 <input type=hidden name=title value="$form->{title}">
534 <input type=hidden name=discount value=$form->{discount}>
535 <input type=hidden name=creditlimit value=$form->{creditlimit}>
536 <input type=hidden name=creditremaining value=$form->{creditremaining}>
538 <input type=hidden name=tradediscount value=$form->{tradediscount}>
539 <input type=hidden name=business value=$form->{business}>
540 <input type=hidden name=webdav value=$webdav>
544 <th class=listtop>$form->{title}</th>
554 <th align=right>$vclabel</th>
555 <td colspan=3>$vc</td>
556 <input type=hidden name=$form->{vc}_id value=$form->{"$form->{vc}_id"}>
557 <input type=hidden name="old$form->{vc}" value="$form->{"old$form->{vc}"}">
558 <th align=richt nowrap>|
559 . $locale->text('Contact Person') . qq|</th>
560 <td colspan=3>$contact</td>
566 <th align=right>| . $locale->text('Currency') . qq|</th>
567 <td><select name=currency>$form->{selectcurrency}</select></td>
568 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
569 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
573 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
574 <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
577 <th align=right>| . $locale->text('Ship via') . qq|</th>
578 <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
597 <!-- shipto are in hidden variables -->
599 <input type=hidden name=shiptoname value="$form->{shiptoname}">
600 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
601 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
602 <input type=hidden name=shiptocity value="$form->{shiptocity}">
603 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
604 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
605 <input type=hidden name=shiptophone value="$form->{shiptophone}">
606 <input type=hidden name=shiptofax value="$form->{shiptofax}">
607 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
609 <!-- email variables -->
610 <input type=hidden name=message value="$form->{message}">
611 <input type=hidden name=email value="$form->{email}">
612 <input type=hidden name=subject value="$form->{subject}">
613 <input type=hidden name=cc value="$form->{cc}">
614 <input type=hidden name=bcc value="$form->{bcc}">
616 <input type=hidden name=taxpart value="$form->{taxpart}">
617 <input type=hidden name=taxservice value="$form->{taxservice}">
619 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
622 foreach $item (split / /, $form->{taxaccounts}) {
624 <input type=hidden name="${item}_rate" value=$form->{"${item}_rate"}>
625 <input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
628 $lxdebug->leave_sub();
632 $lxdebug->enter_sub();
634 $form->{invtotal} = $form->{invsubtotal};
636 if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
639 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
642 $rows = ($rows > $introws) ? $rows : $introws;
644 qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
646 qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
648 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
651 if ($form->{taxaccounts}) {
653 <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
654 . $locale->text('Tax Included') . qq|</b><br><br>
658 if (!$form->{taxincluded}) {
660 foreach $item (split / /, $form->{taxaccounts}) {
661 if ($form->{"${item}_base"}) {
662 $form->{invtotal} += $form->{"${item}_total"} =
664 $form->{"${item}_base"} * $form->{"${item}_rate"},
666 $form->{"${item}_total"} =
667 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
671 <th align=right>$form->{"${item}_description"}</th>
672 <td align=right>$form->{"${item}_total"}</td>
678 $form->{invsubtotal} =
679 $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
683 <th align=right>| . $locale->text('Subtotal') . qq|</th>
684 <td align=right>$form->{invsubtotal}</td>
690 if ($form->{taxincluded}) {
691 foreach $item (split / /, $form->{taxaccounts}) {
692 if ($form->{"${item}_base"}) {
693 $form->{"${item}_total"} =
695 ($form->{"${item}_base"} * $form->{"${item}_rate"} /
696 (1 + $form->{"${item}_rate"})
699 $form->{"${item}_netto"} =
701 ($form->{"${item}_base"} - $form->{"${item}_total"}),
703 $form->{"${item}_total"} =
704 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
705 $form->{"${item}_netto"} =
706 $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
710 <th align=right>Enthaltene $form->{"${item}_description"}</th>
711 <td align=right>$form->{"${item}_total"}</td>
714 <th align=right>Nettobetrag</th>
715 <td align=right>$form->{"${item}_netto"}</td>
723 $form->{oldinvtotal} = $form->{invtotal};
725 $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
735 <th align=left>| . $locale->text('Notes') . qq|</th>
736 <th align=left>| . $locale->text('Internal Notes') . qq|</th>
744 <td align=right width=100%>
750 <th align=right>| . $locale->text('Total') . qq|</th>
751 <td align=right>$form->{invtotal}</td>
759 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
760 <input type=hidden name=oldtotalpaid value=$totalpaid>
762 <td><hr size=3 noshade></td>
770 <th class=listtop align=left>Dokumente im Webdav-Repository</th>
773 <td align=left width=30%><b>Dateiname</b></td>
774 <td align=left width=70%><b>Webdavlink</b></td>
776 foreach $file (keys %{ $form->{WEBDAV} }) {
779 <td align=left>$file</td>
780 <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
788 <td><hr size=3 noshade></td>
795 <input type=hidden name=jscalendar value=$form->{jscalendar}>
808 Bearbeiten des $form->{heading}<br>
809 <input class=submit type=submit name=action value="|
810 . $locale->text('Update') . qq|">
811 <input class=submit type=submit name=action value="|
812 . $locale->text('Ship to') . qq|">
813 <input class=submit type=submit name=action value="|
814 . $locale->text('Print') . qq|">
815 <input class=submit type=submit name=action value="|
816 . $locale->text('E-mail') . qq|">
817 <input class=submit type=submit name=action value="|
818 . $locale->text('Save') . qq|">
823 <br>Workflow $form->{heading}<br>
824 <input class=submit type=submit name=action value="|
825 . $locale->text('Save as new') . qq|">
826 <input class=submit type=submit name=action value="|
827 . $locale->text('Delete') . qq|">|;
828 if ($form->{type} =~ /quotation$/) {
830 <input class=submit type=submit name=action value="|
831 . $locale->text('Order') . qq|">|;
834 <input class=submit type=submit name=action value="|
835 . $locale->text('Invoice') . qq|">
838 if ($form->{type} =~ /sales_order$/) {
840 <br>$form->{heading} als neue Vorlage verwenden für<br>
841 <input class=submit type=submit name=action value="|
842 . $locale->text('Purchase Order') . qq|">
843 <input class=submit type=submit name=action value="|
844 . $locale->text('Quotation') . qq|">
847 } elsif ($form->{type} =~ /purchase_order$/) {
849 <br>$form->{heading} als neue Vorlage verwenden für<br>
850 <input class=submit type=submit name=action value="|
851 . $locale->text('Sales Order') . qq|">
852 <input class=submit type=submit name=action value="|
853 . $locale->text('Quotation') . qq|">
858 <br>$form->{heading} als neue Vorlage verwenden für<br>
859 <input class=submit type=submit name=action value="|
860 . $locale->text('Order') . qq|">
865 if ($form->{menubar}) {
866 require "$form->{path}/menu.pl";
872 <input type=hidden name=rowcount value=$form->{rowcount}>
874 <input name=callback type=hidden value="$form->{callback}">
876 <input type=hidden name=path value=$form->{path}>
877 <input type=hidden name=login value=$form->{login}>
878 <input type=hidden name=password value=$form->{password}>
885 $lxdebug->leave_sub();
889 $lxdebug->enter_sub();
891 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
892 qw(exchangerate creditlimit creditremaining);
894 &check_name($form->{vc});
899 $buysell = 'sell' if ($form->{vc} eq 'vendor');
900 $form->{exchangerate} = $exchangerate
904 $form->check_exchangerate(
905 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
909 $i = $form->{rowcount};
911 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
913 if ( ($form->{"partnumber_$i"} eq "")
914 && ($form->{"description_$i"} eq "")
915 && ($form->{"partsgroup_$i"} eq "")) {
917 $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
922 if ( $form->{type} eq 'purchase_order'
923 || $form->{type} eq 'request_quotation') {
924 IR->retrieve_item(\%myconfig, \%$form);
926 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
927 IS->retrieve_item(\%myconfig, \%$form);
930 my $rows = scalar @{ $form->{item_list} };
932 $form->{"discount_$i"} =
933 $form->format_amount(\%myconfig, $form->{discount} * 100);
936 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
945 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
947 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
948 qw(partnumber description unit);
949 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
950 keys %{ $form->{item_list}[0] };
952 $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
954 ($dec) = ($s =~ /\.(\d+)/);
956 $decimalplaces = ($dec > 2) ? $dec : 2;
959 $form->{"sellprice_$i"} = $sellprice;
962 $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
963 # if there is an exchange rate adjust sellprice
964 $form->{"sellprice_$i"} /= $exchangerate;
968 $form->{"sellprice_$i"} * $form->{"qty_$i"} *
969 (1 - $form->{"discount_$i"} / 100);
970 map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
971 map { $form->{"${_}_base"} += $amount }
972 (split / /, $form->{"taxaccounts_$i"});
973 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
974 split / /, $form->{taxaccounts}
975 if !$form->{taxincluded};
977 $form->{creditremaining} -= $amount;
979 $form->{"sellprice_$i"} =
980 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
983 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
985 # get pricegroups for parts
986 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
988 # build up html code for prices_$i
996 # ok, so this is a new part
997 # ask if it is a part or service item
999 if ( $form->{"partsgroup_$i"}
1000 && ($form->{"partsnumber_$i"} eq "")
1001 && ($form->{"description_$i"} eq "")) {
1002 $form->{rowcount}--;
1003 $form->{"discount_$i"} = "";
1007 $form->{"id_$i"} = 0;
1008 $form->{"unit_$i"} = $locale->text('ea');
1017 $lxdebug->leave_sub();
1021 $lxdebug->enter_sub();
1023 if ($form->{type} eq 'purchase_order') {
1024 $form->{title} = $locale->text('Purchase Orders');
1025 $form->{vc} = 'vendor';
1026 $ordlabel = $locale->text('Order Number');
1027 $ordnumber = 'ordnumber';
1028 $employee = $locale->text('Employee');
1030 if ($form->{type} eq 'request_quotation') {
1031 $form->{title} = $locale->text('Request for Quotations');
1032 $form->{vc} = 'vendor';
1033 $ordlabel = $locale->text('RFQ Number');
1034 $ordnumber = 'quonumber';
1035 $employee = $locale->text('Employee');
1037 if ($form->{type} eq 'receive_order') {
1038 $form->{title} = $locale->text('Receive Merchandise');
1039 $form->{vc} = 'vendor';
1040 $ordlabel = $locale->text('Order Number');
1041 $ordnumber = 'ordnumber';
1042 $employee = $locale->text('Employee');
1044 if ($form->{type} eq 'sales_order') {
1045 $form->{title} = $locale->text('Sales Orders');
1046 $form->{vc} = 'customer';
1047 $ordlabel = $locale->text('Order Number');
1048 $ordnumber = 'ordnumber';
1049 $employee = $locale->text('Salesperson');
1051 if ($form->{type} eq 'ship_order') {
1052 $form->{title} = $locale->text('Ship Merchandise');
1053 $form->{vc} = 'customer';
1054 $ordlabel = $locale->text('Order Number');
1055 $ordnumber = 'ordnumber';
1056 $employee = $locale->text('Salesperson');
1060 if ($form->{type} eq 'sales_quotation') {
1061 $form->{title} = $locale->text('Quotations');
1062 $form->{vc} = 'customer';
1063 $ordlabel = $locale->text('Quotation Number');
1064 $ordnumber = 'quonumber';
1065 $employee = $locale->text('Employee');
1068 if ($form->{type} =~ /(ship|receive)_order/) {
1069 OE->get_warehouses(\%myconfig, \%$form);
1072 if (@{ $form->{all_warehouses} }) {
1073 $form->{selectwarehouse} = "<option>\n";
1074 $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
1077 $form->{selectwarehouse} .=
1078 "<option>$_->{description}--$_->{id}\n"
1079 } (@{ $form->{all_warehouses} });
1083 <th align=right>| . $locale->text('Warehouse') . qq|</th>
1084 <td colspan=3><select name=warehouse>$form->{selectwarehouse}</select></td>
1085 <input type=hidden name=selectwarehouse value="$form->{selectwarehouse}">
1092 # setup vendor / customer selection
1093 $form->all_vc(\%myconfig, $form->{vc},
1094 ($form->{vc} eq 'customer') ? "AR" : "AP");
1096 map { $vc .= "<option>$_->{name}--$_->{id}\n" }
1097 @{ $form->{"all_$form->{vc}"} };
1099 $vclabel = ucfirst $form->{vc};
1100 $vclabel = $locale->text($vclabel);
1102 # $locale->text('Vendor')
1103 # $locale->text('Customer')
1107 ? qq|<select name=$form->{vc}><option>\n$vc</select>|
1108 : qq|<input name=$form->{vc} size=35>|;
1111 if (@{ $form->{all_departments} }) {
1112 $form->{selectdepartment} = "<option>\n";
1115 $form->{selectdepartment} .=
1116 "<option>$_->{description}--$_->{id}\n"
1117 } (@{ $form->{all_departments} });
1122 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1123 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1125 | if $form->{selectdepartment};
1127 if ($form->{type} !~ /(ship_order|receive_order)/) {
1130 <td><input name="open" class=checkbox type=checkbox value=1 checked> |
1131 . $locale->text('Open') . qq|</td>
1132 <td><input name="closed" class=checkbox type=checkbox value=1 $form->{closed}> |
1133 . $locale->text('Closed') . qq|</td>
1139 <input type=hidden name="open" value=1>
1143 # use JavaScript Calendar or not
1144 $form->{jsscript} = $jscalendar;
1146 if ($form->{jsscript}) {
1148 # with JavaScript Calendar
1150 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
1151 <input type=button name=transdatefrom id="trigger3" value=|
1152 . $locale->text('button') . qq|></td>
1155 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
1156 <input type=button name=transdateto name=transdateto id="trigger4" value=|
1157 . $locale->text('button') . qq|></td>
1162 Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
1163 "transdateto", "BL", "trigger4");
1166 # without JavaScript Calendar
1168 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
1170 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
1178 <form method=post action=$form->{script}>
1182 <th class=listtop>$form->{title}</th>
1184 <tr height="5"></tr>
1189 <th align=right>$vclabel</th>
1190 <td colspan=3>$vc</td>
1195 <th align=right>$ordlabel</th>
1196 <td colspan=3><input name="$ordnumber" size=20></td>
1199 <th align=right>| . $locale->text('From') . qq|</th>
1201 <th align=right>| . $locale->text('Bis') . qq|</th>
1204 <input type=hidden name=sort value=transdate>
1206 <th align=right>| . $locale->text('Include in Report') . qq|</th>
1211 <td><input name="l_id" class=checkbox type=checkbox value=Y>
1212 | . $locale->text('ID') . qq|</td>
1213 <td><input name="l_$ordnumber" class=checkbox type=checkbox value=Y checked> $ordlabel</td>
1214 <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
1215 . $locale->text('Date') . qq|</td>
1216 <td><input name="l_reqdate" class=checkbox type=checkbox value=Y checked> |
1217 . $locale->text('Required by') . qq|</td>
1220 <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vclabel</td>
1221 <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
1222 <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
1223 . $locale->text('Ship via') . qq|</td>
1226 <td><input name="l_netamount" class=checkbox type=checkbox value=Y> |
1227 . $locale->text('Amount') . qq|</td>
1228 <td><input name="l_tax" class=checkbox type=checkbox value=Y> |
1229 . $locale->text('Tax') . qq|</td>
1230 <td><input name="l_amount" class=checkbox type=checkbox value=Y checked> |
1231 . $locale->text('Total') . qq|</td>
1234 <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
1235 . $locale->text('Subtotal') . qq|</td>
1243 <tr><td colspan=4><hr size=3 noshade></td></tr>
1249 <input type=hidden name=nextsub value=orders>
1250 <input type=hidden name=path value=$form->{path}>
1251 <input type=hidden name=login value=$form->{login}>
1252 <input type=hidden name=password value=$form->{password}>
1253 <input type=hidden name=vc value=$form->{vc}>
1254 <input type=hidden name=type value=$form->{type}>
1256 <input class=submit type=submit name=action value="|
1257 . $locale->text('Continue') . qq|">
1264 $lxdebug->leave_sub();
1268 $lxdebug->enter_sub();
1270 # split vendor / customer
1271 ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
1272 split(/--/, $form->{ $form->{vc} });
1274 OE->transactions(\%myconfig, \%$form);
1276 $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
1278 $number = $form->escape($form->{$ordnumber});
1279 $name = $form->escape($form->{ $form->{vc} });
1280 $department = $form->escape($form->{department});
1281 $warehouse = $form->escape($form->{warehouse});
1285 "$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";
1287 # construct callback
1288 $number = $form->escape($form->{$ordnumber}, 1);
1289 $name = $form->escape($form->{ $form->{vc} }, 1);
1290 $department = $form->escape($form->{department}, 1);
1291 $warehouse = $form->escape($form->{warehouse}, 1);
1294 "$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";
1297 $form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
1298 "name", "netamount", "tax", "amount",
1299 "curr", "employee", "shipvia", "open",
1302 $form->{l_open} = $form->{l_closed} = "Y"
1303 if ($form->{open} && $form->{closed});
1305 foreach $item (@columns) {
1306 if ($form->{"l_$item"} eq "Y") {
1307 push @column_index, $item;
1309 # add column to href and callback
1310 $callback .= "&l_$item=Y";
1311 $href .= "&l_$item=Y";
1315 if ($form->{l_subtotal} eq 'Y') {
1316 $callback .= "&l_subtotal=Y";
1317 $href .= "&l_subtotal=Y";
1320 if ($form->{vc} eq 'vendor') {
1321 if ($form->{type} eq 'receive_order') {
1322 $form->{title} = $locale->text('Receive Merchandise');
1323 } elsif ($form->{type} eq 'purchase_order') {
1324 $form->{title} = $locale->text('Purchase Orders');
1326 $form->{title} = $locale->text('Request for Quotations');
1328 $name = $locale->text('Vendor');
1329 $employee = $locale->text('Employee');
1331 if ($form->{vc} eq 'customer') {
1332 if ($form->{type} eq 'sales_order') {
1333 $form->{title} = $locale->text('Sales Orders');
1334 $employee = $locale->text('Salesperson');
1335 } elsif ($form->{type} eq 'ship_order') {
1336 $form->{title} = $locale->text('Ship Merchandise');
1337 $employee = $locale->text('Salesperson');
1339 $form->{title} = $locale->text('Quotations');
1340 $employee = $locale->text('Employee');
1342 $name = $locale->text('Customer');
1345 $column_header{id} =
1346 qq|<th><a class=listheading href=$href&sort=id>|
1347 . $locale->text('ID')
1349 $column_header{transdate} =
1350 qq|<th><a class=listheading href=$href&sort=transdate>|
1351 . $locale->text('Date')
1353 $column_header{reqdate} =
1354 qq|<th><a class=listheading href=$href&sort=reqdate>|
1355 . $locale->text('Required by')
1357 $column_header{ordnumber} =
1358 qq|<th><a class=listheading href=$href&sort=ordnumber>|
1359 . $locale->text('Order')
1361 $column_header{quonumber} =
1362 qq|<th><a class=listheading href=$href&sort=quonumber>|
1363 . $locale->text('Quotation')
1365 $column_header{name} =
1366 qq|<th><a class=listheading href=$href&sort=name>$name</a></th>|;
1367 $column_header{netamount} =
1368 qq|<th class=listheading>| . $locale->text('Amount') . qq|</th>|;
1369 $column_header{tax} =
1370 qq|<th class=listheading>| . $locale->text('Tax') . qq|</th>|;
1371 $column_header{amount} =
1372 qq|<th class=listheading>| . $locale->text('Total') . qq|</th>|;
1373 $column_header{curr} =
1374 qq|<th class=listheading>| . $locale->text('Curr') . qq|</th>|;
1375 $column_header{shipvia} =
1376 qq|<th><a class=listheading href=$href&sort=shipvia>|
1377 . $locale->text('Ship via')
1379 $column_header{open} =
1380 qq|<th class=listheading>| . $locale->text('O') . qq|</th>|;
1381 $column_header{closed} =
1382 qq|<th class=listheading>| . $locale->text('C') . qq|</th>|;
1384 $column_header{employee} =
1385 qq|<th><a class=listheading href=$href&sort=employee>$employee</a></th>|;
1387 if ($form->{ $form->{vc} }) {
1388 $option = $locale->text(ucfirst $form->{vc});
1389 $option .= " : $form->{$form->{vc}}";
1391 if ($form->{warehouse}) {
1392 ($warehouse) = split /--/, $form->{warehouse};
1393 $option .= "\n<br>" if ($option);
1394 $option .= $locale->text('Warehouse');
1395 $option .= " : $warehouse";
1397 if ($form->{department}) {
1398 $option .= "\n<br>" if ($option);
1399 ($department) = split /--/, $form->{department};
1400 $option .= $locale->text('Department') . " : $department";
1402 if ($form->{transdatefrom}) {
1404 . $locale->text('From') . " "
1405 . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
1407 if ($form->{transdateto}) {
1409 . $locale->text('Bis') . " "
1410 . $locale->date(\%myconfig, $form->{transdateto}, 1);
1412 if ($form->{open}) {
1413 $option .= "\n<br>" if ($option);
1414 $option .= $locale->text('Open');
1416 if ($form->{closed}) {
1417 $option .= "\n<br>" if ($option);
1418 $option .= $locale->text('Closed');
1428 <th class=listtop>$form->{title}</th>
1430 <tr height="5"></tr>
1437 <tr class=listheading>|;
1439 map { print "\n$column_header{$_}" } @column_index;
1445 # add sort and escape callback
1446 $callback = $form->escape($callback . "&sort=$form->{sort}");
1448 if (@{ $form->{OE} }) {
1449 $sameitem = $form->{OE}->[0]->{ $form->{sort} };
1453 $action = "ship_receive" if ($form->{type} =~ /(ship|receive)_order/);
1455 $warehouse = $form->escape($form->{warehouse});
1457 foreach $oe (@{ $form->{OE} }) {
1459 if ($form->{l_subtotal} eq 'Y') {
1460 if ($sameitem ne $oe->{ $form->{sort} }) {
1462 $sameitem = $oe->{ $form->{sort} };
1466 map { $oe->{$_} *= $oe->{exchangerate} } (qw(netamount amount));
1468 $column_data{netamount} =
1470 . $form->format_amount(\%myconfig, $oe->{netamount}, 2, " ")
1472 $column_data{tax} = "<td align=right>"
1473 . $form->format_amount(\%myconfig, $oe->{amount} - $oe->{netamount},
1476 $column_data{amount} =
1478 . $form->format_amount(\%myconfig, $oe->{amount}, 2, " ") . "</td>";
1480 $totalnetamount += $oe->{netamount};
1481 $totalamount += $oe->{amount};
1483 $subtotalnetamount += $oe->{netamount};
1484 $subtotalamount += $oe->{amount};
1486 $column_data{id} = "<td>$oe->{id}</td>";
1487 $column_data{transdate} = "<td>$oe->{transdate} </td>";
1488 $column_data{reqdate} = "<td>$oe->{reqdate} </td>";
1490 $column_data{$ordnumber} =
1491 "<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>";
1492 $column_data{name} = "<td>$oe->{name}</td>";
1494 $column_data{employee} = "<td>$oe->{employee} </td>";
1495 $column_data{shipvia} = "<td>$oe->{shipvia} </td>";
1497 if ($oe->{closed}) {
1498 $column_data{closed} = "<td align=center>X</td>";
1499 $column_data{open} = "<td> </td>";
1501 $column_data{closed} = "<td> </td>";
1502 $column_data{open} = "<td align=center>X</td>";
1508 <tr class=listrow$i>";
1510 map { print "\n$column_data{$_}" } @column_index;
1518 if ($form->{l_subtotal} eq 'Y') {
1524 <tr class=listtotal>|;
1526 map { $column_data{$_} = "<td> </td>" } @column_index;
1528 $column_data{netamount} =
1529 "<th class=listtotal align=right>"
1530 . $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>";
1531 $column_data{tax} = "<th class=listtotal align=right>"
1532 . $form->format_amount(\%myconfig, $totalamount - $totalnetamount,
1535 $column_data{amount} =
1536 "<th class=listtotal align=right>"
1537 . $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>";
1539 map { print "\n$column_data{$_}" } @column_index;
1547 <td><hr size=3 noshade></td>
1552 <form method=post action=$form->{script}>
1554 <input name=callback type=hidden value="$form->{callback}">
1556 <input type=hidden name=type value=$form->{type}>
1557 <input type=hidden name=vc value=$form->{vc}>
1559 <input type=hidden name=path value=$form->{path}>
1560 <input type=hidden name=login value=$form->{login}>
1561 <input type=hidden name=password value=$form->{password}>
1564 if ($form->{type} !~ /(ship|receive)_order/) {
1566 <input class=submit type=submit name=action value="|
1567 . $locale->text('Add') . qq|">|;
1570 if ($form->{menubar}) {
1571 require "$form->{path}/menu.pl";
1582 $lxdebug->leave_sub();
1586 $lxdebug->enter_sub();
1588 map { $column_data{$_} = "<td> </td>" } @column_index;
1590 $column_data{netamount} =
1591 "<th class=listsubtotal align=right>"
1592 . $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ")
1594 $column_data{tax} = "<td class=listsubtotal align=right>"
1595 . $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount,
1598 $column_data{amount} =
1599 "<th class=listsubtotal align=right>"
1600 . $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>";
1602 $subtotalnetamount = 0;
1603 $subtotalamount = 0;
1606 <tr class=listsubtotal>
1609 map { print "\n$column_data{$_}" } @column_index;
1615 $lxdebug->leave_sub();
1619 $lxdebug->enter_sub();
1621 if ($form->{type} =~ /_order$/) {
1622 $form->isblank("transdate", $locale->text('Order Date missing!'));
1624 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1627 $msg = ucfirst $form->{vc};
1628 $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
1630 # $locale->text('Customer missing!');
1631 # $locale->text('Vendor missing!');
1633 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1634 if ($form->{currency} ne $form->{defaultcurrency});
1638 # if the name changed get new values
1639 if (&check_name($form->{vc})) {
1644 $form->{id} = 0 if $form->{saveasnew};
1646 # this is for the internal notes section for the [email] Subject
1647 if ($form->{type} =~ /_order$/) {
1648 if ($form->{type} eq 'sales_order') {
1649 $form->{label} = $locale->text('Sales Order');
1651 $numberfld = "sonumber";
1652 $ordnumber = "ordnumber";
1654 $form->{label} = $locale->text('Purchase Order');
1656 $numberfld = "ponumber";
1657 $ordnumber = "ordnumber";
1660 $err = $locale->text('Cannot save order!');
1663 if ($form->{type} eq 'sales_quotation') {
1664 $form->{label} = $locale->text('Quotation');
1666 $numberfld = "sqnumber";
1667 $ordnumber = "quonumber";
1669 $form->{label} = $locale->text('Request for Quotation');
1671 $numberfld = "rfqnumber";
1672 $ordnumber = "quonumber";
1675 $err = $locale->text('Cannot save quotation!');
1679 $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld)
1680 unless $form->{$ordnumber};
1683 $form->{label} . " $form->{$ordnumber} " . $locale->text('saved!'))
1684 if (OE->save(\%myconfig, \%$form));
1687 $lxdebug->leave_sub();
1691 $lxdebug->enter_sub();
1695 if ($form->{type} =~ /_order$/) {
1696 $msg = $locale->text('Are you sure you want to delete Order Number');
1697 $ordnumber = 'ordnumber';
1699 $msg = $locale->text('Are you sure you want to delete Quotation Number');
1700 $ordnumber = 'quonumber';
1706 <form method=post action=$form->{script}>
1709 # delete action variable
1710 map { delete $form->{$_} } qw(action header);
1712 foreach $key (keys %$form) {
1713 $form->{$key} =~ s/\"/"/g;
1714 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1718 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
1720 <h4>$msg $form->{$ordnumber}</h4>
1722 <input name=action class=submit type=submit value="|
1723 . $locale->text('Yes') . qq|">
1730 $lxdebug->leave_sub();
1734 $lxdebug->enter_sub();
1736 if ($form->{type} =~ /_order$/) {
1737 $msg = $locale->text('Order deleted!');
1738 $err = $locale->text('Cannot delete order!');
1740 $msg = $locale->text('Quotation deleted!');
1741 $err = $locale->text('Cannot delete quotation!');
1744 $form->redirect($msg) if (OE->delete(\%myconfig, \%$form, $spool));
1747 $lxdebug->leave_sub();
1751 $lxdebug->enter_sub();
1753 if ($form->{type} =~ /_order$/) {
1754 $form->isblank("ordnumber", $locale->text('Order Number missing!'));
1755 $form->isblank("transdate", $locale->text('Order Date missing!'));
1758 $form->isblank("quonumber", $locale->text('Quotation Number missing!'));
1759 $form->isblank("transdate", $locale->text('Quotation Date missing!'));
1760 $form->{ordnumber} = "";
1763 # if the name changed get new values
1764 if (&check_name($form->{vc})) {
1769 ($null, $form->{cp_id}) = split /--/, $form->{contact};
1770 $form->{cp_id} *= 1;
1772 if ( $form->{type} =~ /_order/
1773 && $form->{currency} ne $form->{defaultcurrency}) {
1775 # check if we need a new exchangerate
1776 $buysell = ($form->{type} eq 'sales_order') ? "buy" : "sell";
1778 $orddate = $form->current_date(\%myconfig);
1780 $form->check_exchangerate(\%myconfig, $form->{currency}, $orddate,
1783 if (!$exchangerate) {
1784 &backorder_exchangerate($orddate, $buysell);
1789 # close orders/quotations
1790 $form->{closed} = 1;
1791 OE->save(\%myconfig, \%$form);
1793 $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
1795 $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
1798 $form->{closed} = 0;
1799 $form->{rowcount}--;
1800 $form->{shipto} = 1;
1802 if ($form->{type} =~ /_order$/) {
1803 $form->{exchangerate} = $exchangerate;
1807 if ( $form->{type} eq 'purchase_order'
1808 || $form->{type} eq 'request_quotation') {
1809 $form->{title} = $locale->text('Add Vendor Invoice');
1810 $form->{script} = 'ir.pl';
1814 if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
1815 $form->{title} = $locale->text('Add Sales Invoice');
1816 $form->{script} = 'is.pl';
1821 # bo creates the id, reset it
1822 map { delete $form->{$_} }
1823 qw(id subject message cc bcc printed emailed queued);
1824 $form->{ $form->{vc} } =~ s/--.*//g;
1825 $form->{type} = "invoice";
1828 $locale = new Locale "$myconfig{countrycode}", "$script";
1830 require "$form->{path}/$form->{script}";
1832 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
1834 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1835 qw(creditlimit creditremaining);
1837 $currency = $form->{currency};
1840 $form->{currency} = $currency;
1841 $form->{exchangerate} = "";
1842 $form->{forex} = "";
1843 $form->{exchangerate} = $exchangerate
1847 $form->check_exchangerate(
1848 \%myconfig, $form->{currency}, $form->{invdate}, $buysell
1851 $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
1856 for $i (1 .. $form->{rowcount}) {
1857 $form->{"discount_$i"} =
1858 $form->format_amount(\%myconfig, $form->{"discount_$i"});
1860 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
1862 $decimalplaces = ($dec > 2) ? $dec : 2;
1864 $form->{"sellprice_$i"} =
1865 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
1868 (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
1869 $dec_qty = length $dec_qty;
1870 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
1872 map { $form->{"${_}_$i"} =~ s/\"/"/g }
1873 qw(partnumber description unit);
1879 $lxdebug->leave_sub();
1882 sub backorder_exchangerate {
1883 $lxdebug->enter_sub();
1884 my ($orddate, $buysell) = @_;
1891 <form method=post action=$form->{script}>
1894 # delete action variable
1895 map { delete $form->{$_} } qw(action header exchangerate);
1897 foreach $key (keys %$form) {
1898 $form->{$key} =~ s/\"/"/g;
1899 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1902 $form->{title} = $locale->text('Add Exchangerate');
1906 <input type=hidden name=path value=$form->{path}>
1907 <input type=hidden name=login value=$form->{login}>
1908 <input type=hidden name=password value=$form->{password}>
1910 <input type=hidden name=exchangeratedate value=$orddate>
1911 <input type=hidden name=buysell value=$buysell>
1914 <tr><th class=listtop>$form->{title}</th></tr>
1915 <tr height="5"></tr>
1920 <th align=right>| . $locale->text('Currency') . qq|</th>
1921 <td>$form->{currency}</td>
1924 <th align=right>| . $locale->text('Date') . qq|</th>
1928 <th align=right>| . $locale->text('Exchangerate') . qq|</th>
1929 <td><input name=exchangerate size=11></td>
1939 <input type=hidden name=nextsub value=save_exchangerate>
1941 <input name=action class=submit type=submit value="|
1942 . $locale->text('Continue') . qq|">
1950 $lxdebug->leave_sub();
1953 sub save_exchangerate {
1954 $lxdebug->enter_sub();
1956 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'));
1957 $form->{exchangerate} =
1958 $form->parse_amount(\%myconfig, $form->{exchangerate});
1959 $form->save_exchangerate(\%myconfig, $form->{currency},
1960 $form->{exchangeratedate},
1961 $form->{exchangerate}, $form->{buysell});
1965 $lxdebug->leave_sub();
1968 sub create_backorder {
1969 $lxdebug->enter_sub();
1971 $form->{shipped} = 1;
1973 # figure out if we need to create a backorder
1974 # items aren't saved if qty != 0
1976 for $i (1 .. $form->{rowcount}) {
1977 $totalqty += $qty = $form->{"qty_$i"};
1978 $totalship += $ship = $form->{"ship_$i"};
1980 $form->{"qty_$i"} = $qty - $ship;
1983 if ($totalship == 0) {
1984 map { $form->{"ship_$_"} = $form->{"qty_$_"} } (1 .. $form->{rowcount});
1985 $form->{ordtotal} = 0;
1986 $form->{shipped} = 0;
1990 if ($totalqty == $totalship) {
1991 map { $form->{"qty_$_"} = $form->{"ship_$_"} } (1 .. $form->{rowcount});
1992 $form->{ordtotal} = 0;
1997 qw(partnumber description qty ship unit sellprice discount id inventory_accno bin income_accno expense_accno listprice assembly taxaccounts partsgroup)
2000 for $i (1 .. $form->{rowcount}) {
2002 $form->{"${_}_$i"} =
2003 $form->format_amount(\%myconfig, $form->{"${_}_$i"})
2004 } qw(sellprice discount);
2007 OE->save(\%myconfig, \%$form);
2009 # rebuild rows for invoice
2013 for $i (1 .. $form->{rowcount}) {
2014 $form->{"qty_$i"} = $form->{"ship_$i"};
2016 if ($form->{"qty_$i"}) {
2019 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
2024 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
2025 $form->{rowcount} = $count;
2027 $lxdebug->leave_sub();
2031 $lxdebug->enter_sub();
2033 $form->{saveasnew} = 1;
2034 $form->{closed} = 0;
2035 map { delete $form->{$_} } qw(printed emailed queued);
2039 $lxdebug->leave_sub();
2042 sub purchase_order {
2043 $lxdebug->enter_sub();
2045 $form->{title} = $locale->text('Add Purchase Order');
2046 $form->{vc} = "vendor";
2047 $form->{type} = "purchase_order";
2051 $lxdebug->leave_sub();
2055 $lxdebug->enter_sub();
2057 if ( $form->{type} eq 'sales_quotation'
2058 || $form->{type} eq 'request_quotation') {
2059 $form->{closed} = 1;
2060 OE->save(\%myconfig, \%$form);
2063 ($null, $form->{cp_id}) = split /--/, $form->{contact};
2064 $form->{cp_id} *= 1;
2066 $form->{title} = $locale->text('Add Sales Order');
2067 $form->{vc} = "customer";
2068 $form->{type} = "sales_order";
2072 $lxdebug->leave_sub();
2076 $lxdebug->enter_sub();
2078 $form->{transdate} = $form->current_date(\%myconfig);
2079 delete $form->{duedate};
2081 $form->{closed} = 0;
2084 map { delete $form->{$_} }
2085 qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal);
2092 for $i (1 .. $form->{rowcount} - 1) {
2093 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2094 qw(partnumber description unit);
2097 map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 0, "0") }
2098 qw(creditlimit creditremaining);
2102 $lxdebug->leave_sub();
2106 $lxdebug->enter_sub();
2112 OE->get_warehouses(\%myconfig, \%$form);
2115 if (@{ $form->{all_warehouses} }) {
2116 $form->{selectwarehouse} = "<option>\n";
2118 map { $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n" }
2119 (@{ $form->{all_warehouses} });
2121 if ($form->{warehouse}) {
2122 $form->{selectwarehouse} = "<option>$form->{warehouse}";
2126 $form->{shippingdate} = $form->current_date(\%myconfig);
2127 $form->{"$form->{vc}"} =~ s/--.*//;
2132 foreach $key (keys %$form) {
2133 if ($key =~ /_1$/) {
2139 for $i (1 .. $form->{rowcount}) {
2141 # undo formatting from prepare_order
2143 $form->{"${_}_$i"} =
2144 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
2146 $n = ($form->{"qty_$i"} -= $form->{"ship_$i"});
2148 && ($form->{"inventory_accno_$i"} || $form->{"assembly_$i"})) {
2149 $form->{"ship_$i"} = "";
2150 $form->{"serialnumber_$i"} = "";
2155 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
2160 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
2161 $form->{rowcount} = $count;
2163 &display_ship_receive;
2165 $lxdebug->leave_sub();
2168 sub display_ship_receive {
2169 $lxdebug->enter_sub();
2171 $vclabel = ucfirst $form->{vc};
2172 $vclabel = $locale->text($vclabel);
2174 $form->{rowcount}++;
2176 if ($form->{vc} eq 'customer') {
2177 $form->{title} = $locale->text('Ship Merchandise');
2178 $shipped = $locale->text('Shipping Date');
2180 $form->{title} = $locale->text('Receive Merchandise');
2181 $shipped = $locale->text('Date Received');
2184 # set option selected
2185 foreach $item (warehouse, employee) {
2186 $form->{"select$item"} =~ s/ selected//;
2187 $form->{"select$item"} =~
2188 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
2193 <th align=right>| . $locale->text('Warehouse') . qq|</th>
2194 <td><select name=warehouse>$form->{selectwarehouse}</select></td>
2195 <input type=hidden name=selectwarehouse value="$form->{selectwarehouse}">
2197 | if $form->{selectwarehouse};
2201 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
2202 <td><select name=employee>$form->{selectemployee}</select></td>
2203 <input type=hidden name=selectemployee value="$form->{selectemployee}">
2212 <form method=post action=$form->{script}>
2214 <input type=hidden name=id value=$form->{id}>
2216 <input type=hidden name=display_form value=display_ship_receive>
2218 <input type=hidden name=type value=$form->{type}>
2219 <input type=hidden name=media value=$form->{media}>
2220 <input type=hidden name=format value=$form->{format}>
2222 <input type=hidden name=queued value="$form->{queued}">
2223 <input type=hidden name=printed value="$form->{printed}">
2224 <input type=hidden name=emailed value="$form->{emailed}">
2226 <input type=hidden name=vc value=$form->{vc}>
2230 <th class=listtop>$form->{title}</th>
2232 <tr height="5"></tr>
2235 <table width="100%">
2240 <th align=right>$vclabel</th>
2241 <td colspan=3>$form->{$form->{vc}}</td>
2242 <input type=hidden name=$form->{vc} value="$form->{$form->{vc}}">
2243 <input type=hidden name="$form->{vc}_id" value=$form->{"$form->{vc}_id"}>
2247 <th align=right>| . $locale->text('Shipping Point') . qq|</th>
2249 <input name=shippingpoint size=35 value="$form->{shippingpoint}">
2252 <th align=right>| . $locale->text('Ship via') . qq|</th>
2254 <input name=shipvia size=35 value="$form->{shipvia}">
2263 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
2264 <td>$form->{ordnumber}</td>
2265 <input type=hidden name=ordnumber value="$form->{ordnumber}">
2268 <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
2269 <td>$form->{transdate}</td>
2270 <input type=hidden name=transdate value=$form->{transdate}>
2273 <th align=right nowrap>$shipped</th>
2274 <td><input name=shippingdate size=11 value=$form->{shippingdate}></td>
2283 <!-- shipto are in hidden variables -->
2285 <input type=hidden name=shiptoname value="$form->{shiptoname}">
2286 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
2287 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
2288 <input type=hidden name=shiptocity value="$form->{shiptocity}">
2289 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
2290 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
2291 <input type=hidden name=shiptophone value="$form->{shiptophone}">
2292 <input type=hidden name=shiptofax value="$form->{shiptofax}">
2293 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
2295 <!-- email variables -->
2296 <input type=hidden name=message value="$form->{message}">
2297 <input type=hidden name=email value="$form->{email}">
2298 <input type=hidden name=subject value="$form->{subject}">
2299 <input type=hidden name=cc value="$form->{cc}">
2300 <input type=hidden name=bcc value="$form->{bcc}">
2305 (partnumber, description, qty, ship, unit, bin, serialnumber);
2307 if ($form->{type} eq "ship_order") {
2308 $column_data{ship} =
2309 qq|<th class=listheading align=center width="auto">|
2310 . $locale->text('Ship')
2313 if ($form->{type} eq "receive_order") {
2314 $column_data{ship} =
2315 qq|<th class=listheading align=center width="auto">|
2316 . $locale->text('Recd')
2320 my $colspan = $#column_index + 1;
2322 $column_data{partnumber} =
2323 qq|<th class=listheading nowrap>| . $locale->text('Number') . qq|</th>|;
2324 $column_data{description} =
2325 qq|<th class=listheading nowrap>|
2326 . $locale->text('Description')
2329 qq|<th class=listheading nowrap>| . $locale->text('Qty') . qq|</th>|;
2330 $column_data{unit} =
2331 qq|<th class=listheading nowrap>| . $locale->text('Unit') . qq|</th>|;
2333 qq|<th class=listheading nowrap>| . $locale->text('Bin') . qq|</th>|;
2334 $column_data{serialnumber} =
2335 qq|<th class=listheading nowrap>|
2336 . $locale->text('Serial No.')
2343 <tr class=listheading>|;
2345 map { print "\n$column_data{$_}" } @column_index;
2351 for $i (1 .. $form->{rowcount} - 1) {
2354 $form->{"ship_$i"} = $form->parse_amount(\%myconfig, $form->{"ship_$i"});
2356 # convert " to "
2357 map { $form->{"${_}_$i"} =~ s/\"/"/g }
2358 qw(partnumber description unit bin serialnumber);
2360 $description = $form->{"description_$i"};
2361 $description =~ s/\n/<br>/g;
2363 $column_data{partnumber} =
2364 qq|<td>$form->{"partnumber_$i"}<input type=hidden name="partnumber_$i" value="$form->{"partnumber_$i"}"></td>|;
2365 $column_data{description} =
2366 qq|<td>$description<input type=hidden name="description_$i" value="$form->{"description_$i"}"></td>|;
2368 qq|<td align=right>|
2369 . $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty)
2370 . qq|<input type=hidden name="qty_$i" value="$form->{"qty_$i"}"></td>|;
2371 $column_data{ship} =
2372 qq|<td align=right><input name="ship_$i" size=5 value=|
2373 . $form->format_amount(\%myconfig, $form->{"ship_$i"})
2375 $column_data{unit} =
2376 qq|<td>$form->{"unit_$i"}<input type=hidden name="unit_$i" value="$form->{"unit_$i"}"></td>|;
2378 qq|<td>$form->{"bin_$i"}<input type=hidden name="bin_$i" value="$form->{"bin_$i"}"></td>|;
2380 $column_data{serialnumber} =
2381 qq|<td><input name="serialnumber_$i" size=15 value="$form->{"serialnumber_$i"}"></td>|;
2386 map { print "\n$column_data{$_}" } @column_index;
2391 <input type=hidden name="orderitems_id_$i" value=$form->{"orderitems_id_$i"}>
2392 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
2393 <input type=hidden name="assembly_$i" value="$form->{"assembly_$i"}">
2394 <input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">
2405 <td><hr size=3 noshade></td>
2411 $form->{copies} = 1;
2420 <input class=submit type=submit name=action value="|
2421 . $locale->text('Update') . qq|">
2422 <input class=submit type=submit name=action value="|
2423 . $locale->text('Print') . qq|">
2426 if ($form->{type} eq 'ship_order') {
2428 <input class=submit type=submit name=action value="|
2429 . $locale->text('Ship to') . qq|">
2430 <input class=submit type=submit name=action value="|
2431 . $locale->text('E-mail') . qq|">
2437 <input class=submit type=submit name=action value="|
2438 . $locale->text('Done') . qq|">
2441 if ($form->{menubar}) {
2442 require "$form->{path}/menu.pl";
2448 <input type=hidden name=rowcount value=$form->{rowcount}>
2450 <input name=callback type=hidden value="$callback">
2452 <input type=hidden name=path value=$form->{path}>
2453 <input type=hidden name=login value=$form->{login}>
2454 <input type=hidden name=password value=$form->{password}>
2462 $lxdebug->leave_sub();
2466 $lxdebug->enter_sub();
2468 if ($form->{type} eq 'ship_order') {
2469 $form->isblank("shippingdate", $locale->text('Shipping Date missing!'));
2471 $form->isblank("shippingdate", $locale->text('Date received missing!'));
2476 $total += $form->{"ship_$_"} =
2477 $form->parse_amount(\%myconfig, $form->{"ship_$_"})
2478 } (1 .. $form->{rowcount} - 1);
2480 $form->error($locale->text('Nothing entered!')) unless $total;
2482 $form->redirect($locale->text('Inventory saved!'))
2483 if OE->save_inventory(\%myconfig, \%$form);
2484 $form->error($locale->text('Could not save!'));
2486 $lxdebug->leave_sub();
2489 sub search_transfer {
2490 $lxdebug->enter_sub();
2492 OE->get_warehouses(\%myconfig, \%$form);
2495 if (@{ $form->{all_warehouses} }) {
2496 $form->{selectwarehouse} = "<option>\n";
2497 $form->{warehouse} = qq|$form->{warehouse}--$form->{warehouse_id}|;
2499 map { $form->{selectwarehouse} .= "<option>$_->{description}--$_->{id}\n" }
2500 (@{ $form->{all_warehouses} });
2502 $form->error($locale->text('Nothing to transfer!'));
2505 $form->{title} = $locale->text('Transfer Inventory');
2512 <form method=post action=$form->{script}>
2516 <th class=listtop>$form->{title}</th>
2518 <tr height="5"></tr>
2523 <th align=right nowrap>| . $locale->text('Transfer to') . qq|</th>
2524 <td><select name=warehouse>$form->{selectwarehouse}</select></td>
2527 <th align="right" nowrap="true">| . $locale->text('Part Number') . qq|</th>
2528 <td><input name=partnumber size=20></td>
2531 <th align="right" nowrap="true">| . $locale->text('Description') . qq|</th>
2532 <td><input name=description size=40></td>
2535 <th align=right nowrap>| . $locale->text('Group') . qq|</th>
2536 <td><input name=partsgroup size=20></td>
2542 <td><hr size=3 noshade></td>
2547 <input type=hidden name=sort value=partnumber>
2548 <input type=hidden name=nextsub value=list_transfer>
2550 <input type=hidden name=path value=$form->{path}>
2551 <input type=hidden name=login value=$form->{login}>
2552 <input type=hidden name=password value=$form->{password}>
2554 <input class=submit type=submit name=action value="|
2555 . $locale->text('Continue') . qq|">
2562 $lxdebug->leave_sub();
2566 $lxdebug->enter_sub();
2568 OE->get_inventory(\%myconfig, \%$form);
2570 $partnumber = $form->escape($form->{partnumber});
2571 $warehouse = $form->escape($form->{warehouse});
2572 $description = $form->escape($form->{description});
2573 $partsgroup = $form->escape($form->{partsgroup});
2577 "$form->{script}?path=$form->{path}&action=list_transfer&partnumber=$partnumber&warehouse=$warehouse&description=$description&partsgroup=$partsgroup&login=$form->{login}&password=$form->{password}";
2579 # construct callback
2580 $partnumber = $form->escape($form->{partnumber}, 1);
2581 $warehouse = $form->escape($form->{warehouse}, 1);
2582 $description = $form->escape($form->{description}, 1);
2583 $partsgroup = $form->escape($form->{partsgroup}, 1);
2586 "$form->{script}?path=$form->{path}&action=list_transfer&partnumber=$partnumber&warehouse=$warehouse&description=$description&partsgroup=$partsgroup&login=$form->{login}&password=$form->{password}";
2589 $form->sort_columns(
2590 qw(partnumber description partsgroup make model warehouse qty transfer));
2592 $column_header{partnumber} =
2593 qq|<th><a class=listheading href=$href&sort=partnumber>|
2594 . $locale->text('Part Number')
2596 $column_header{description} =
2597 qq|<th><a class=listheading href=$href&sort=description>|
2598 . $locale->text('Description')
2600 $column_header{partsgroup} =
2601 qq|<th><a class=listheading href=$href&sort=partsgroup>|
2602 . $locale->text('Group')
2604 $column_header{warehouse} =
2605 qq|<th><a class=listheading href=$href&sort=warehouse>|
2606 . $locale->text('From')
2608 $column_header{qty} =
2609 qq|<th><a class=listheading>| . $locale->text('Qty') . qq|</a></th>|;
2610 $column_header{transfer} =
2611 qq|<th><a class=listheading>| . $locale->text('Transfer') . qq|</a></th>|;
2613 $option = $locale->text('Transfer to');
2615 ($warehouse, $warehouse_id) = split /--/, $form->{warehouse};
2617 if ($form->{warehouse}) {
2618 $option .= " : $warehouse";
2620 if ($form->{partnumber}) {
2621 $option .= "\n<br>" if ($option);
2622 $option .= $locale->text('Part Number') . " : $form->{partnumber}";
2624 if ($form->{description}) {
2625 $option .= "\n<br>" if ($option);
2626 $option .= $locale->text('Description') . " : $form->{description}";
2628 if ($form->{partsgroup}) {
2629 $option .= "\n<br>" if ($option);
2630 $option .= $locale->text('Group') . " : $form->{partsgroup}";
2633 $form->{title} = $locale->text('Transfer Inventory');
2640 <form method=post action=$form->{script}>
2642 <input type=hidden name=warehouse_id value=$warehouse_id>
2646 <th class=listtop>$form->{title}</th>
2648 <tr height="5"></tr>
2655 <tr class=listheading>|;
2657 map { print "\n$column_header{$_}" } @column_index;
2663 if (@{ $form->{all_inventory} }) {
2664 $sameitem = $form->{all_inventory}->[0]->{ $form->{sort} };
2668 foreach $ref (@{ $form->{all_inventory} }) {
2672 $column_data{partnumber} =
2673 qq|<td><input type=hidden name="id_$i" value=$ref->{id}>$ref->{partnumber}</td>|;
2674 $column_data{description} = "<td>$ref->{description} </td>";
2675 $column_data{partsgroup} = "<td>$ref->{partsgroup} </td>";
2676 $column_data{warehouse} =
2677 qq|<td><input type=hidden name="warehouse_id_$i" value=$ref->{warehouse_id}>$ref->{warehouse} </td>|;
2679 qq|<td><input type=hidden name="qty_$i" value=$ref->{qty}>|
2680 . $form->format_amount(\%myconfig, $ref->{qty}, $dec_qty)
2682 $column_data{transfer} = qq|<td><input name="transfer_$i" size=4></td>|;
2687 <tr class=listrow$j>";
2689 map { print "\n$column_data{$_}" } @column_index;
2703 <td><hr size=3 noshade></td>
2709 <input name=callback type=hidden value="$callback">
2711 <input type=hidden name=rowcount value=$i>
2713 <input type=hidden name=path value=$form->{path}>
2714 <input type=hidden name=login value=$form->{login}>
2715 <input type=hidden name=password value=$form->{password}>
2717 <input class=submit type=submit name=action value="|
2718 . $locale->text('Transfer') . qq|">|;
2720 if ($form->{menubar}) {
2721 require "$form->{path}/menu.pl";
2732 $lxdebug->leave_sub();
2736 $lxdebug->enter_sub();
2738 $form->redirect($locale->text('Inventory transferred!'))
2739 if OE->transfer(\%myconfig, \%$form);
2740 $form->error($locale->text('Could not transfer Inventory!'));
2742 $lxdebug->leave_sub();