1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
6 #############################################################################
7 # Veraendert 2005-01-05 - Marco Welter <mawe@linux-studio.de> - Neue Optik #
8 #############################################################################
9 # SQL-Ledger, Accounting
10 # Copyright (c) 1998-2002
12 # Author: Dieter Simader
13 # Email: dsimader@sql-ledger.org
14 # Web: http://www.sql-ledger.org
17 # This program is free software; you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; either version 2 of the License, or
20 # (at your option) any later version.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #######################################################################
32 # common routines used in is, ir, oe
34 #######################################################################
36 # any custom scripts for this one
37 if (-f "$form->{path}/custom_io.pl") {
38 eval { require "$form->{path}/custom_io.pl"; };
40 if (-f "$form->{path}/$form->{login}_io.pl") {
41 eval { require "$form->{path}/$form->{login}_io.pl"; };
48 # this is for our long dates
49 # $locale->text('January')
50 # $locale->text('February')
51 # $locale->text('March')
52 # $locale->text('April')
53 # $locale->text('May ')
54 # $locale->text('June')
55 # $locale->text('July')
56 # $locale->text('August')
57 # $locale->text('September')
58 # $locale->text('October')
59 # $locale->text('November')
60 # $locale->text('December')
62 # this is for our short month
63 # $locale->text('Jan')
64 # $locale->text('Feb')
65 # $locale->text('Mar')
66 # $locale->text('Apr')
67 # $locale->text('May')
68 # $locale->text('Jun')
69 # $locale->text('Jul')
70 # $locale->text('Aug')
71 # $locale->text('Sep')
72 # $locale->text('Oct')
73 # $locale->text('Nov')
74 # $locale->text('Dec')
76 ########################################
77 # Eintrag fuer Version 2.2.0 geaendert #
78 # neue Optik im Rechnungsformular #
79 ########################################
81 $lxdebug->enter_sub();
84 if ($lizenzen && $form->{vc} eq "customer") {
85 if ($form->{type} =~ /sales_order/) {
86 @column_index = (runningnumber, partnumber, description, ship, qty);
87 } elsif ($form->{type} =~ /sales_quotation/) {
88 @column_index = (runningnumber, partnumber, description, qty);
90 @column_index = (runningnumber, partnumber, description, qty);
93 if ( ($form->{type} =~ /purchase_order/)
94 || ($form->{type} =~ /sales_order/)) {
95 @column_index = (runningnumber, partnumber, description, ship, qty);
97 @column_index = (runningnumber, partnumber, description, qty);
100 ############## ENDE Neueintrag ##################
102 push @column_index, qw(unit sellprice);
104 if ($form->{vc} eq 'customer') {
105 push @column_index, qw(discount);
108 push @column_index, "linetotal";
110 my $colspan = $#column_index + 1;
112 $form->{invsubtotal} = 0;
113 map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
115 ########################################
116 # Eintrag fuer Version 2.2.0 geaendert #
117 # neue Optik im Rechnungsformular #
118 ########################################
119 $column_data{runningnumber} =
120 qq|<th align=left nowrap width=5 class=listheading>|
121 . $locale->text('No.')
123 $column_data{partnumber} =
124 qq|<th align=left nowrap width=12 class=listheading>|
125 . $locale->text('Number')
127 $column_data{description} =
128 qq|<th align=left nowrap width=30 class=listheading>|
129 . $locale->text('Part Description')
132 qq|<th align=left nowrap width=5 class=listheading>|
133 . $locale->text('Ship')
136 qq|<th align=left nowrap width=5 class=listheading>|
137 . $locale->text('Qty')
140 qq|<th align=left nowrap width=5 class=listheading>|
141 . $locale->text('Unit')
143 $column_data{license} =
144 qq|<th align=left nowrap width=10 class=listheading>|
145 . $locale->text('License')
147 $column_data{serialnr} =
148 qq|<th align=left nowrap width=10 class=listheading>|
149 . $locale->text('Serial No.')
151 $column_data{projectnr} =
152 qq|<th align=left nowrap width=10 class=listheading>|
153 . $locale->text('Project')
155 $column_data{sellprice} =
156 qq|<th align=left nowrap width=10 class=listheading>|
157 . $locale->text('Price')
159 $column_data{discount} =
160 qq|<th align=left class=listheading>|
161 . $locale->text('Discount')
163 $column_data{linetotal} =
164 qq|<th align=left nowrap width=10 class=listheading>|
165 . $locale->text('Extended')
168 qq|<th align=left nowrap width=10 class=listheading>|
169 . $locale->text('Bin')
171 ############## ENDE Neueintrag ##################
177 <tr class=listheading>|;
179 map { print "\n$column_data{$_}" } @column_index;
185 $runningnumber = $locale->text('No.');
186 $deliverydate = $locale->text('Delivery Date');
187 $serialnumber = $locale->text('Serial No.');
188 $projectnumber = $locale->text('Project');
189 $partsgroup = $locale->text('Group');
191 $delvar = 'deliverydate';
193 if ($form->{type} =~ /_order$/ || $form->{type} =~ /_quotation$/) {
194 $deliverydate = $locale->text('Required by');
198 for $i (1 .. $numrows) {
203 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
204 } qw(qty ship discount sellprice);
206 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
208 $decimalplaces = ($dec > 2) ? $dec : 2;
212 $form->{"sellprice_$i"} * $form->{"discount_$i"} / 100,
215 $form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces);
216 $linetotal = $form->round_amount($linetotal * $form->{"qty_$i"}, 2);
218 # convert " to "
219 map { $form->{"${_}_$i"} =~ s/\"/"/g }
220 qw(partnumber description unit);
222 ########################################
223 # Eintrag fuer Version 2.2.0 geaendert #
224 # neue Optik im Rechnungsformular #
225 ########################################
226 $column_data{runningnumber} =
227 qq|<td><input name="runningnumber_$i" size=5 value=$i></td>|; # HuT
228 ############## ENDE Neueintrag ##################
230 $column_data{partnumber} =
231 qq|<td><input name="partnumber_$i" size=12 value="$form->{"partnumber_$i"}"></td>|;
233 if (($rows = $form->numtextrows($form->{"description_$i"}, 30, 6)) > 1) {
234 $column_data{description} =
235 qq|<td><textarea name="description_$i" rows=$rows cols=30 wrap=soft>$form->{"description_$i"}</textarea></td>|;
237 $column_data{description} =
238 qq|<td><input name="description_$i" size=30 value="$form->{"description_$i"}"></td>|;
242 qq|<td align=right><input name="qty_$i" size=5 value=|
243 . $form->format_amount(\%myconfig, $form->{"qty_$i"})
246 qq|<td align=right><input name="ship_$i" size=5 value=|
247 . $form->format_amount(\%myconfig, $form->{"ship_$i"})
250 qq|<td><input name="unit_$i" size=5 value="$form->{"unit_$i"}"></td>|;
251 $column_data{sellprice} =
252 qq|<td align=right><input name="sellprice_$i" size=9 value=|
253 . $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
256 $column_data{discount} =
257 qq|<td align=right><input name="discount_$i" size=3 value=|
258 . $form->format_amount(\%myconfig, $form->{"discount_$i"})
260 $column_data{linetotal} =
262 . $form->format_amount(\%myconfig, $linetotal, 2)
264 $column_data{bin} = qq|<td>$form->{"bin_$i"}</td>|;
266 ########################################
267 # Eintrag fuer Version 2.2.0 geaendert #
268 # neue Optik im Rechnungsformular #
269 ########################################
270 # if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") {
271 # $column_data{license} = qq|<td><select name="licensenumber_$i">$form->{"lizenzen_$i"}></select></td>|;
274 # if ($form->{type} !~ /_quotation/) {
275 # $column_data{serialnr} = qq|<td><input name="serialnumber_$i" size=10 value="$form->{"serialnumber_$i"}"></td>|;
278 # $column_data{projectnr} = qq|<td><input name="projectnumber_$i" size=10 value="$form->{"projectnumber_$i"}"></td>|;
279 ############## ENDE Neueintrag ##################
284 map { print "\n$column_data{$_}" } @column_index;
289 <input type=hidden name="orderitems_id_$i" value=$form->{"orderitems_id_$i"}>
290 <input type=hidden name="bo_$i" value=$form->{"bo_$i"}>
292 <input type=hidden name="id_$i" value=$form->{"id_$i"}>
293 <input type=hidden name="inventory_accno_$i" value=$form->{"inventory_accno_$i"}>
294 <input type=hidden name="bin_$i" value="$form->{"bin_$i"}">
295 <input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">
296 <input type=hidden name="partnotes_$i" value="$form->{"partnotes_$i"}">
297 <input type=hidden name="income_accno_$i" value=$form->{"income_accno_$i"}>
298 <input type=hidden name="expense_accno_$i" value=$form->{"expense_accno_$i"}>
299 <input type=hidden name="listprice_$i" value="$form->{"listprice_$i"}">
300 <input type=hidden name="assembly_$i" value="$form->{"assembly_$i"}">
301 <input type=hidden name="taxaccounts_$i" value="$form->{"taxaccounts_$i"}">
305 ########################################
306 # Eintrag fuer Version 2.2.0 geaendert #
307 # neue Optik im Rechnungsformular #
308 ########################################
312 <td colspan=$colspan>
314 if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") {
315 my $selected = $form->{"licensenumber_$i"};
317 $form->{"lizenzen_$i"} =~ s/ selected//g;
318 $form->{"lizenzen_$i"} =~
319 s/value="${selected}"\>/value="${selected}" selected\>/;
320 $lizenzen_quoted = $form->{"lizenzen_$i"};
321 $lizenzen_quoted =~ s/\"/"/g;
323 <b>Lizenz\#</b> <select name="licensenumber_$i" size=1>
324 $form->{"lizenzen_$i"}
326 <input type=hidden name="lizenzen_$i" value="${lizenzen_quoted}">
329 if ($form->{type} !~ /_quotation/) {
331 <b>$serialnumber</b> <input name="serialnumber_$i" size=15 value="$form->{"serialnumber_$i"}">|;
335 <b>$projectnumber</b> <input name="projectnumber_$i" size=10 value="$form->{"projectnumber_$i"}">
336 <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}">
337 <input type=hidden name="project_id_$i" value="$form->{"project_id_$i"}">
343 ############## ENDE Neueintrag ##################
345 map { $form->{"${_}_base"} += $linetotal }
346 (split / /, $form->{"taxaccounts_$i"});
348 $form->{invsubtotal} += $linetotal;
357 $lxdebug->leave_sub();
361 $lxdebug->enter_sub();
363 @column_index = qw(ndx partnumber description onhand sellprice);
365 $column_data{ndx} = qq|<th> </th>|;
366 $column_data{partnumber} =
367 qq|<th class=listheading>| . $locale->text('Number') . qq|</th>|;
368 $column_data{description} =
369 qq|<th class=listheading>| . $locale->text('Part Description') . qq|</th>|;
370 $column_data{sellprice} =
371 qq|<th class=listheading>| . $locale->text('Price') . qq|</th>|;
372 $column_data{onhand} =
373 qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
375 # list items with radio button on a form
378 $title = $locale->text('Select from one of the items below');
379 $colspan = $#column_index + 1;
384 <form method=post action=$form->{script}>
388 <th class=listtop colspan=$colspan>$title</th>
391 <tr class=listheading>|;
393 map { print "\n$column_data{$_}" } @column_index;
398 foreach $ref (@{ $form->{item_list} }) {
399 $checked = ($i++) ? "" : "checked";
402 if ($ref->{inventory_accno} > 0) {
403 $ref->{"lizenzen"} = qq|<option></option>|;
404 foreach $item (@{ $form->{LIZENZEN}{ $ref->{"id"} } }) {
405 $ref->{"lizenzen"} .=
406 qq|<option value=\"$item->{"id"}\">$item->{"licensenumber"}</option>|;
408 $ref->{"lizenzen"} .= qq|<option value=-1>Neue Lizenz</option>|;
409 $ref->{"lizenzen"} =~ s/\"/"/g;
413 map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description unit);
416 $form->round_amount($ref->{sellprice} * (1 - $form->{tradediscount}), 2);
419 qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
420 $column_data{partnumber} =
421 qq|<td><input name="new_partnumber_$i" type=hidden value="$ref->{partnumber}">$ref->{partnumber}</td>|;
422 $column_data{description} =
423 qq|<td><input name="new_description_$i" type=hidden value="$ref->{description}">$ref->{description}</td>|;
424 $column_data{sellprice} =
425 qq|<td align=right><input name="new_sellprice_$i" type=hidden value=$ref->{sellprice}>|
426 . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ")
428 $column_data{onhand} =
429 qq|<td align=right><input name="new_onhand_$i" type=hidden value=$ref->{onhand}>|
430 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
436 <tr class=listrow$j>|;
438 map { print "\n$column_data{$_}" } @column_index;
443 <input name="new_bin_$i" type=hidden value="$ref->{bin}">
444 <input name="new_listprice_$i" type=hidden value=$ref->{listprice}>
445 <input name="new_inventory_accno_$i" type=hidden value=$ref->{inventory_accno}>
446 <input name="new_income_accno_$i" type=hidden value=$ref->{income_accno}>
447 <input name="new_expense_accno_$i" type=hidden value=$ref->{expense_accno}>
448 <input name="new_unit_$i" type=hidden value="$ref->{unit}">
449 <input name="new_weight_$i" type=hidden value="$ref->{weight}">
450 <input name="new_assembly_$i" type=hidden value="$ref->{assembly}">
451 <input name="new_taxaccounts_$i" type=hidden value="$ref->{taxaccounts}">
452 <input name="new_partsgroup_$i" type=hidden value="$ref->{partsgroup}">
454 <input name="new_id_$i" type=hidden value=$ref->{id}>
459 <input name="new_lizenzen_$i" type=hidden value="$ref->{lizenzen}">
466 <tr><td colspan=8><hr size=3 noshade></td></tr>
469 <input name=lastndx type=hidden value=$i>
473 # delete action variable
474 map { delete $form->{$_} } qw(action item_list header);
476 # save all other form variables
477 foreach $key (keys %${form}) {
478 $form->{$key} =~ s/\"/"/g;
479 print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
483 <input type=hidden name=nextsub value=item_selected>
486 <input class=submit type=submit name=action value="|
487 . $locale->text('Continue') . qq|">
494 $lxdebug->leave_sub();
498 $lxdebug->enter_sub();
500 # replace the last row with the checked row
501 $i = $form->{rowcount};
502 $i = $form->{assembly_rows} if ($form->{item} eq 'assembly');
507 # if there was a price entered, override it
508 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
510 map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} }
511 qw(id partnumber description sellprice listprice inventory_accno income_accno expense_accno bin unit weight assembly taxaccounts partsgroup);
514 map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } qw(lizenzen);
517 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
519 $decimalplaces = ($dec > 2) ? $dec : 2;
522 $form->{"sellprice_$i"} = $sellprice;
525 # if there is an exchange rate adjust sellprice
526 if (($form->{exchangerate} * 1) != 0) {
527 $form->{"sellprice_$i"} /= $form->{exchangerate};
528 $form->{"sellprice_$i"} =
529 $form->round_amount($form->{"sellprice_$i"}, $decimalplaces);
533 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
534 qw(sellprice listprice weight);
536 $form->{sellprice} += ($form->{"sellprice_$i"} * $form->{"qty_$i"});
537 $form->{weight} += ($form->{"weight_$i"} * $form->{"qty_$i"});
540 $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) *
542 map { $form->{"${_}_base"} += $amount }
543 (split / /, $form->{"taxaccounts_$i"});
544 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /,
545 $form->{"taxaccounts_$i"}
546 if !$form->{taxincluded};
548 $form->{creditremaining} -= $amount;
550 $form->{"runningnumber_$i"} = $i;
552 # delete all the new_ variables
553 for $i (1 .. $form->{lastndx}) {
554 map { delete $form->{"new_${_}_$i"} }
555 qw(partnumber description sellprice bin listprice inventory_accno income_accno expense_accno unit assembly taxaccounts id);
558 map { delete $form->{$_} } qw(ndx lastndx nextsub);
563 $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces)
564 } qw(sellprice listprice) if $form->{item} ne 'assembly';
568 $lxdebug->leave_sub();
572 $lxdebug->enter_sub();
575 $form->{old_callback} = $form->escape($form->{callback}, 1);
576 $form->{callback} = $form->escape("$form->{script}?action=display_form", 1);
579 delete $form->{action};
581 # save all other form variables in a previousform variable
582 foreach $key (keys %$form) {
585 $form->{$key} =~ s/&/%26/g;
586 $previousform .= qq|$key=$form->{$key}&|;
589 $previousform = $form->escape($previousform, 1);
591 $i = $form->{rowcount};
592 map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description);
599 <h4 class=error>| . $locale->text('Item not on file!') . qq|
602 | . $locale->text('What type of item is this?') . qq|</h4>
604 <form method=post action=ic.pl>
608 <input class=radio type=radio name=item value=part checked> |
609 . $locale->text('Part') . qq|<br>
610 <input class=radio type=radio name=item value=service> |
611 . $locale->text('Service')
614 <input type=hidden name=previousform value="$previousform">
615 <input type=hidden name=partnumber value="$form->{"partnumber_$i"}">
616 <input type=hidden name=description value="$form->{"description_$i"}">
617 <input type=hidden name=rowcount value=$form->{rowcount}>
618 <input type=hidden name=taxaccount2 value=$form->{taxaccounts}>
619 <input type=hidden name=vc value=$form->{vc}>
621 <input type=hidden name=path value=$form->{path}>
622 <input type=hidden name=login value=$form->{login}>
623 <input type=hidden name=password value=$form->{password}>
625 <input type=hidden name=nextsub value=add>
628 <input class=submit type=submit name=action value="|
629 . $locale->text('Continue') . qq|">
636 $lxdebug->leave_sub();
640 $lxdebug->enter_sub();
642 # if we have a display_form
643 if ($form->{display_form}) {
644 &{"$form->{display_form}"};
647 if ( $form->{print_and_post}
648 && $form->{second_run}
649 && ($form->{action} eq "display_form")) {
650 for (keys %$form) { $old_form->{$_} = $form->{$_} }
651 $old_form->{rowcount}++;
653 #$form->{rowcount}--;
654 #$form->{rowcount}--;
656 $form->{print_and_post} = 0;
658 &print_form($old_form);
662 $form->{action} = "";
663 $form->{resubmit} = 0;
665 if ($form->{print_and_post} && !$form->{second_run}) {
666 $form->{second_run} = 1;
667 $form->{action} = "display_form";
670 $form->{resubmit} = 1;
675 $numrows = ++$form->{rowcount};
676 $subroutine = "display_row";
678 if ($form->{item} eq 'part') {
679 $numrows = ++$form->{makemodel_rows};
680 $subroutine = "makemodel_row";
682 if ($form->{item} eq 'assembly') {
683 $numrows = ++$form->{makemodel_rows};
684 $subroutine = "makemodel_row";
686 # create makemodel rows
687 &{$subroutine}($numrows);
689 $numrows = ++$form->{assembly_rows};
690 $subroutine = "assembly_row";
692 if ($form->{item} eq 'service') {
697 &{$subroutine}($numrows) if $numrows;
701 # if ($form->{print_and_post}) {
705 $lxdebug->leave_sub();
709 $lxdebug->enter_sub();
714 qw(id partnumber description qty ship sellprice unit discount inventory_accno income_accno expense_accno listprice taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup)
717 # remove any makes or model rows
718 if ($form->{item} eq 'part') {
719 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
720 qw(listprice sellprice lastcost weight rop);
722 @flds = (make, model);
723 for my $i (1 .. ($form->{makemodel_rows})) {
724 if (($form->{"make_$i"} ne "") || ($form->{"model_$i"} ne "")) {
728 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
733 $form->redo_rows(\@flds, \@a, $count, $form->{makemodel_rows});
734 $form->{makemodel_rows} = $count;
736 } elsif ($form->{item} eq 'assembly') {
738 $form->{sellprice} = 0;
740 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
741 qw(listprice rop stock);
744 qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup);
746 for my $i (1 .. ($form->{assembly_rows} - 1)) {
747 if ($form->{"qty_$i"}) {
751 $form->{"qty_$i"} = $form->parse_amount(\%myconfig, $form->{"qty_$i"});
753 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
755 $form->{sellprice} += ($form->{"qty_$i"} * $form->{"sellprice_$i"});
756 $form->{weight} += ($form->{"qty_$i"} * $form->{"weight_$i"});
761 $form->{sellprice} = $form->round_amount($form->{sellprice}, 2);
763 $form->redo_rows(\@flds, \@a, $count, $form->{assembly_rows});
764 $form->{assembly_rows} = $count;
767 @flds = qw(make model);
770 for my $i (1 .. ($form->{makemodel_rows})) {
771 if (($form->{"make_$i"} ne "") || ($form->{"model_$i"} ne "")) {
775 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
780 $form->redo_rows(\@flds, \@a, $count, $form->{makemodel_rows});
781 $form->{makemodel_rows} = $count;
785 # this section applies to invoices and orders
786 # remove any empty numbers
787 if ($form->{rowcount}) {
788 for my $i (1 .. $form->{rowcount} - 1) {
789 if ($form->{"partnumber_$i"}) {
793 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
796 if ($form->{"licensenumber_$i"} == -1) {
804 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
805 $form->{rowcount} = $count;
807 $form->{creditremaining} -= &invoicetotal;
814 $lxdebug->leave_sub();
818 $lxdebug->enter_sub();
820 $form->{oldinvtotal} = 0;
822 # add all parts and deduct paid
823 map { $form->{"${_}_base"} = 0 } split / /, $form->{taxaccounts};
825 my ($amount, $sellprice, $discount, $qty);
827 for my $i (1 .. $form->{rowcount}) {
828 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
829 $discount = $form->parse_amount(\%myconfig, $form->{"discount_$i"});
830 $qty = $form->parse_amount(\%myconfig, $form->{"qty_$i"});
832 $amount = $sellprice * (1 - $discount / 100) * $qty;
833 map { $form->{"${_}_base"} += $amount }
834 (split / /, $form->{"taxaccounts_$i"});
835 $form->{oldinvtotal} += $amount;
838 map { $form->{oldinvtotal} += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
839 split / /, $form->{taxaccounts}
840 if !$form->{taxincluded};
842 $form->{oldtotalpaid} = 0;
843 for $i (1 .. $form->{paidaccounts}) {
844 $form->{oldtotalpaid} += $form->{"paid_$i"};
847 $lxdebug->leave_sub();
850 return ($form->{oldinvtotal} - $form->{oldtotalpaid});
854 $lxdebug->enter_sub();
856 # check if items are valid
857 if ($form->{rowcount} == 1) {
862 for $i (1 .. $form->{rowcount} - 1) {
863 $form->isblank("partnumber_$i",
864 $locale->text('Number missing in Row') . " $i");
867 $lxdebug->leave_sub();
871 $lxdebug->enter_sub();
873 $form->{ordnumber} = $form->{invnumber};
875 map { delete $form->{$_} } qw(id printed emailed queued);
877 if ($form->{script} eq 'ir.pl' || $form->{type} eq 'request_quotation') {
878 $form->{title} = $locale->text('Add Purchase Order');
879 $form->{vc} = 'vendor';
880 $form->{type} = 'purchase_order';
883 if ($form->{script} eq 'is.pl' || $form->{type} eq 'sales_quotation') {
884 $form->{title} = $locale->text('Add Sales Order');
885 $form->{vc} = 'customer';
886 $form->{type} = 'sales_order';
889 $form->{script} = 'oe.pl';
895 ($null, $form->{cp_id}) = split /--/, $form->{contact};
898 require "$form->{path}/$form->{script}";
900 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
902 $currency = $form->{currency};
906 $form->{currency} = $currency;
907 $form->{exchangerate} = "";
909 $form->{exchangerate} = $exchangerate
913 $form->check_exchangerate(
914 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
920 $lxdebug->leave_sub();
924 $lxdebug->enter_sub();
926 map { delete $form->{$_} } qw(id printed emailed queued);
928 if ($form->{script} eq 'ir.pl' || $form->{type} eq 'purchase_order') {
929 $form->{title} = $locale->text('Add Request for Quotation');
930 $form->{vc} = 'vendor';
931 $form->{type} = 'request_quotation';
934 if ($form->{script} eq 'is.pl' || $form->{type} eq 'sales_order') {
935 $form->{title} = $locale->text('Add Quotation');
936 $form->{vc} = 'customer';
937 $form->{type} = 'sales_quotation';
941 ($null, $form->{cp_id}) = split /--/, $form->{contact};
944 $form->{script} = 'oe.pl';
950 require "$form->{path}/$form->{script}";
952 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
954 $currency = $form->{currency};
958 $form->{currency} = $currency;
959 $form->{exchangerate} = "";
961 $form->{exchangerate} = $exchangerate
965 $form->check_exchangerate(
966 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
972 $lxdebug->leave_sub();
976 $lxdebug->enter_sub();
978 if ($myconfig{role} eq 'admin') {
980 <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
981 <td><input name=bcc size=30 value="$form->{bcc}"></td>
985 if ($form->{formname} =~ /(pick|packing|bin)_list/) {
986 $form->{email} = $form->{shiptoemail} if $form->{shiptoemail};
989 $name = $form->{ $form->{vc} };
991 $title = $locale->text('E-mail') . " $name";
993 $form->{oldmedia} = $form->{media};
994 $form->{media} = "email";
1001 <form method=post action=$form->{script}>
1005 <th class=listtop>$title</th>
1007 <tr height="5"></tr>
1012 <th align=right nowrap>| . $locale->text('To') . qq|</th>
1013 <td><input name=email size=30 value="$form->{email}"></td>
1014 <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
1015 <td><input name=cc size=30 value="$form->{cc}"></td>
1018 <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
1019 <td><input name=subject size=30 value="$form->{subject}"></td>
1029 <th align=left nowrap>| . $locale->text('Message') . qq|</th>
1032 <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
1043 map { delete $form->{$_} }
1044 qw(action email cc bcc subject message formname sendmode format header override);
1046 # save all other variables
1047 foreach $key (keys %$form) {
1048 $form->{$key} =~ s/\"/"/g;
1049 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1056 <td><hr size=3 noshade></td>
1060 <input type=hidden name=nextsub value=send_email>
1063 <input name=action class=submit type=submit value="|
1064 . $locale->text('Continue') . qq|">
1071 $lxdebug->leave_sub();
1075 $lxdebug->enter_sub();
1077 $old_form = new Form;
1079 map { $old_form->{$_} = $form->{$_} } keys %$form;
1080 $old_form->{media} = $form->{oldmedia};
1082 &print_form($old_form);
1084 $lxdebug->leave_sub();
1088 $lxdebug->enter_sub();
1090 $form->{sendmode} = "attachment";
1091 $form->{copies} = 3 unless $form->{copies};
1093 $form->{PD}{ $form->{formname} } = "selected";
1094 $form->{DF}{ $form->{format} } = "";
1095 $form->{OP}{ $form->{media} } = "selected";
1096 $form->{SM}{ $form->{sendmode} } = "selected";
1098 if ($form->{type} eq 'purchase_order') {
1099 $type = qq|<select name=formname>
1100 <option value=purchase_order $form->{PD}{purchase_order}>|
1101 . $locale->text('Purchase Order') . qq|
1102 <option value=bin_list $form->{PD}{bin_list}>|
1103 . $locale->text('Bin List');
1106 if ($form->{type} eq 'sales_order') {
1107 $type = qq|<select name=formname>
1108 <option value=sales_order $form->{PD}{sales_order}>|
1109 . $locale->text('Confirmation') . qq|
1110 <option value=pick_list $form->{PD}{pick_list}>|
1111 . $locale->text('Pick List') . qq|
1112 <option value=packing_list $form->{PD}{packing_list}>|
1113 . $locale->text('Packing List');
1116 if ($form->{type} =~ /_quotation$/) {
1117 $type = qq|<select name=formname>
1118 <option value="$`_quotation" $form->{PD}{"$`_quotation"}>|
1119 . $locale->text('Quotation') . qq|
1123 if ($form->{type} eq 'invoice') {
1124 $type = qq|<select name=formname>
1125 <option value=invoice $form->{PD}{invoice}>| . $locale->text('Invoice');
1128 if ($form->{type} eq 'ship_order') {
1129 $type = qq|<select name=formname>
1130 <option value=pick_list $form->{PD}{pick_list}>|
1131 . $locale->text('Pick List') . qq|
1132 <option value=packing_list $form->{PD}{packing_list}>|
1133 . $locale->text('Packing List');
1136 if ($form->{type} eq 'receive_order') {
1137 $type = qq|<select name=formname>
1138 <option value=bin_list $form->{PD}{bin_list}>|
1139 . $locale->text('Bin List');
1142 if ($form->{media} eq 'email') {
1143 $media = qq|<select name=sendmode>
1144 <option value=attachment $form->{SM}{attachment}>|
1145 . $locale->text('Attachment') . qq|
1146 <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
1148 $media = qq|<select name=media>
1149 <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
1150 if ($myconfig{printer} && $latex) {
1152 <option value=printer $form->{OP}{printer}>|
1153 . $locale->text('Printer');
1157 <option value=queue $form->{OP}{queue}>| . $locale->text('Queue');
1161 $format = qq|<select name=format>
1162 <option value=html $form->{DF}{html}>html|;
1165 $format = qq|<select name=format>
1166 <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF') . qq|
1167 <option value=html $form->{DF}{html}>html
1168 <option value=postscript $form->{DF}{postscript}>|
1169 . $locale->text('Postscript');
1172 $language = qq|<select name=language>
1173 <option value=""></option>|;
1174 %lang = (de => "deutsch", en => "englisch", fr => "französisch");
1175 foreach $item (keys %lang) {
1176 if ($form->{language} eq $item) {
1177 $language .= qq|<option value="$item" selected>$lang{$item}</option>|;
1179 $language .= qq|<option value="$item">$lang{$item}</option>|;
1184 <table width=100% cellspacing=0 cellpadding=0>
1189 <td>$type</select></td>
1190 <td>$language</select</td>
1191 <td>$format</select></td>
1192 <td>$media</select></td>
1195 if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
1197 <td>| . $locale->text('Copies') . qq|
1198 <input name=copies size=2 value=$form->{copies}></td>
1202 $form->{groupitems} = "checked" if $form->{groupitems};
1205 <td>| . $locale->text('Group Items') . qq|</td>
1206 <td><input name=groupitems type=checkbox class=checkbox $form->{groupitems}></td>
1215 if ($form->{printed} =~ /$form->{formname}/) {
1217 <th>\|| . $locale->text('Printed') . qq|\|</th>
1221 if ($form->{emailed} =~ /$form->{formname}/) {
1223 <th>\|| . $locale->text('E-mailed') . qq|\|</th>
1227 if ($form->{queued} =~ /$form->{formname}/) {
1229 <th>\|| . $locale->text('Queued') . qq|\|</th>
1241 $lxdebug->leave_sub();
1245 $lxdebug->enter_sub();
1247 # if this goes to the printer pass through
1248 if ($form->{media} eq 'printer' || $form->{media} eq 'queue') {
1249 $form->error($locale->text('Select postscript or PDF!'))
1250 if ($form->{format} !~ /(postscript|pdf)/);
1252 $old_form = new Form;
1253 map { $old_form->{$_} = $form->{$_} } keys %$form;
1256 &print_form($old_form);
1258 $lxdebug->leave_sub();
1262 $lxdebug->enter_sub();
1263 my ($old_form) = @_;
1268 $numberfld = "invnumber";
1271 ($form->{display_form}) ? $form->{display_form} : "display_form";
1273 # $form->{"notes"} will be overridden by the customer's/vendor's "notes" field. So save it here.
1274 $form->{ $form->{"formname"} . "notes" } = $form->{"notes"};
1276 if ($form->{formname} eq "invoice") {
1277 $form->{label} = $locale->text('Invoice');
1279 if ($form->{formname} eq "packing_list") {
1281 # this is from an invoice
1282 $form->{label} = $locale->text('Packing List');
1284 if ($form->{formname} eq 'sales_order') {
1287 $form->{"${inv}date"} = $form->{transdate};
1288 $form->{label} = $locale->text('Sales Order');
1289 $numberfld = "sonumber";
1292 if ($form->{formname} eq 'packing_list' && $form->{type} ne 'invoice') {
1294 # we use the same packing list as from an invoice
1297 $form->{invdate} = $form->{"${inv}date"} = $form->{transdate};
1298 $form->{label} = $locale->text('Packing List');
1301 if ($form->{formname} eq 'pick_list') {
1304 $form->{"${inv}date"} =
1305 ($form->{transdate}) ? $form->{transdate} : $form->{invdate};
1306 $form->{label} = $locale->text('Pick List');
1307 $order = 1 unless $form->{type} eq 'invoice';
1309 if ($form->{formname} eq 'purchase_order') {
1312 $form->{"${inv}date"} = $form->{transdate};
1313 $form->{label} = $locale->text('Purchase Order');
1314 $numberfld = "ponumber";
1317 if ($form->{formname} eq 'bin_list') {
1320 $form->{"${inv}date"} = $form->{transdate};
1321 $form->{label} = $locale->text('Bin List');
1324 if ($form->{formname} eq 'sales_quotation') {
1327 $form->{"${inv}date"} = $form->{transdate};
1328 $form->{label} = $locale->text('Quotation');
1329 $numberfld = "sqnumber";
1332 if ($form->{formname} eq 'request_quotation') {
1335 $form->{"${inv}date"} = $form->{transdate};
1336 $form->{label} = $locale->text('Quotation');
1337 $numberfld = "rfqnumber";
1341 $form->isblank("email", $locale->text('E-mail address missing!'))
1342 if ($form->{media} eq 'email');
1343 $form->isblank("${inv}date",
1344 $locale->text($form->{label} . ' Date missing!'));
1346 # $locale->text('Invoice Number missing!')
1347 # $locale->text('Invoice Date missing!')
1348 # $locale->text('Packing List Number missing!')
1349 # $locale->text('Packing List Date missing!')
1350 # $locale->text('Order Number missing!')
1351 # $locale->text('Order Date missing!')
1352 # $locale->text('Quotation Number missing!')
1353 # $locale->text('Quotation Date missing!')
1356 if (!$form->{"${inv}number"} && !$form->{preview}) {
1357 $form->{"${inv}number"} = $form->update_defaults(\%myconfig, $numberfld);
1358 if ($form->{media} ne 'email') {
1359 $form->{rowcount}--;
1367 # Save the email address given in the form because it should override the setting saved for the customer/vendor.
1368 my ($saved_email, $saved_cc, $saved_bcc) =
1369 ($form->{"email"}, $form->{"cc"}, $form->{"bcc"});
1371 $language = $form->{language};
1372 &{"$form->{vc}_details"};
1373 $form->{language} = $language;
1375 $form->{"email"} = $saved_email if ($saved_email);
1376 $form->{"cc"} = $saved_cc if ($saved_cc);
1377 $form->{"bcc"} = $saved_bcc if ($saved_bcc);
1380 foreach $i (1 .. $form->{rowcount}) {
1382 ("partnumber_$i", "description_$i",
1383 "partsgroup_$i", "serialnumber_$i",
1384 "bin_$i", "unit_$i");
1386 map { push @a, "${_}_description" } split / /, $form->{taxaccounts};
1388 $ARAP = ($form->{vc} eq 'customer') ? "AR" : "AP";
1391 # format payment dates
1392 for $i (1 .. $form->{paidaccounts} - 1) {
1393 $form->{"datepaid_$i"} = $locale->date(\%myconfig, $form->{"datepaid_$i"});
1394 push @a, "${ARAP}_paid_$i", "source_$i", "memo_$i";
1397 $form->format_string(@a);
1399 ($form->{employee}) = split /--/, $form->{employee};
1400 ($form->{warehouse}, $form->{warehouse_id}) = split /--/, $form->{warehouse};
1402 # create the form variables
1404 OE->order_details(\%myconfig, \%$form);
1406 IS->invoice_details(\%myconfig, \%$form, $locale);
1409 map { $form->{$_} = $locale->date(\%myconfig, $form->{$_}, 1) }
1410 ("${inv}date", "${due}date", "shippingdate");
1412 @a = qw(name street zipcode city country);
1416 # if there is no shipto fill it in from billto
1417 foreach $item (@a) {
1418 if ($form->{"shipto$item"}) {
1425 if ( $form->{formname} eq 'purchase_order'
1426 || $form->{formname} eq 'request_quotation') {
1427 $form->{shiptoname} = $myconfig{company};
1428 $form->{shiptostreet} = $myconfig{address};
1430 map { $form->{"shipto$_"} = $form->{$_} } @a;
1434 $form->{notes} =~ s/^\s+//g;
1436 # some of the stuff could have umlauts so we translate them
1438 qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptoemail shippingpoint shipvia company address signature employee contact);
1440 push @a, ("${inv}date", "${due}date", email, cc, bcc);
1442 $form->format_string(@a);
1444 $form->{templates} = "$myconfig{templates}";
1445 if ($form->{language} ne "") {
1446 $form->{language} = "_" . $form->{language};
1449 $form->{IN} = "$form->{formname}$form->{language}.html";
1450 if ($form->{format} eq 'postscript') {
1451 $form->{postscript} = 1;
1452 $form->{IN} =~ s/html$/tex/;
1454 if ($form->{format} eq 'pdf') {
1456 $form->{IN} =~ s/html$/tex/;
1459 if ($form->{media} eq 'printer') {
1460 $form->{OUT} = "| $myconfig{printer}";
1461 $form->{printed} .= " $form->{formname}";
1462 $form->{printed} =~ s/^ //;
1464 $printed = $form->{printed};
1466 if ($form->{media} eq 'email') {
1467 $form->{subject} = qq|$form->{label} $form->{"${inv}number"}|
1468 unless $form->{subject};
1470 $form->{OUT} = "$sendmail";
1472 $form->{emailed} .= " $form->{formname}";
1473 $form->{emailed} =~ s/^ //;
1475 $emailed = $form->{emailed};
1477 if ($form->{media} eq 'queue') {
1478 %queued = split / /, $form->{queued};
1480 if ($filename = $queued{ $form->{formname} }) {
1481 $form->{queued} =~ s/$form->{formname} $filename//;
1482 unlink "$spool/$filename";
1483 $filename =~ s/\..*$//g;
1489 $filename .= ($form->{postscript}) ? '.ps' : '.pdf';
1490 $form->{OUT} = ">$spool/$filename";
1493 $form->{queued} .= " $form->{formname} $filename";
1495 $form->{queued} =~ s/^ //;
1497 $queued = $form->{queued};
1499 $form->parse_template(\%myconfig, $userspath);
1501 $form->{callback} = "";
1503 if ($form->{media} eq 'email') {
1504 $form->{message} = $locale->text('sent') unless $form->{message};
1506 $message = $form->{message};
1508 # if we got back here restore the previous form
1509 if ($form->{media} =~ /(printer|email|queue)/) {
1511 $form->update_status(\%myconfig)
1512 if ($form->{media} eq 'queue' && $form->{id});
1516 $old_form->{"${inv}number"} = $form->{"${inv}number"};
1518 # restore and display form
1519 map { $form->{$_} = $old_form->{$_} } keys %$old_form;
1521 $form->{queued} = $queued;
1522 $form->{printed} = $printed;
1523 $form->{emailed} = $emailed;
1524 $form->{message} = $message;
1526 $form->{rowcount}--;
1527 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1528 qw(exchangerate creditlimit creditremaining);
1530 for $i (1 .. $form->{paidaccounts}) {
1532 $form->{"${_}_$i"} =
1533 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
1534 } qw(paid exchangerate);
1542 ($form->{media} eq 'printer')
1543 ? $locale->text('sent to printer')
1544 : $locale->text('emailed to') . " $form->{email}";
1545 $form->redirect(qq|$form->{label} $form->{"${inv}number"} $msg|);
1550 $lxdebug->leave_sub();
1553 sub customer_details {
1554 $lxdebug->enter_sub();
1556 IS->customer_details(\%myconfig, \%$form);
1557 $lxdebug->leave_sub();
1560 sub vendor_details {
1561 $lxdebug->enter_sub();
1563 IR->vendor_details(\%myconfig, \%$form);
1565 $lxdebug->leave_sub();
1569 $lxdebug->enter_sub();
1571 $form->{postasnew} = 1;
1572 map { delete $form->{$_} } qw(printed emailed queued);
1576 $lxdebug->leave_sub();
1580 $lxdebug->enter_sub();
1582 $title = $form->{title};
1583 $form->{title} = $locale->text('Ship to');
1585 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1586 qw(exchangerate creditlimit creditremaining);
1587 $form_id = $form->{id};
1589 # get details for name
1590 &{"$form->{vc}_details"};
1591 $form->{id} = $form_id;
1594 ($form->{vc} eq 'customer')
1595 ? $locale->text('Customer Number')
1596 : $locale->text('Vendor Number');
1598 $nextsub = ($form->{display_form}) ? $form->{display_form} : "display_form";
1600 $form->{rowcount}--;
1607 <form method=post action=$form->{script}>
1613 <tr class=listheading>
1614 <th class=listheading colspan=2 width=50%>|
1615 . $locale->text('Billing Address') . qq|</th>
1616 <th class=listheading width=50%>|
1617 . $locale->text('Shipping Address') . qq|</th>
1619 <tr height="5"></tr>
1621 <th align=right nowrap>$number</th>
1622 <td>$form->{"$form->{vc}number"}</td>
1625 <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
1626 <td>$form->{name}</td>
1627 <td><input name=shiptoname size=35 value="$form->{shiptoname}"></td>
1630 <th align=right nowrap>| . $locale->text('Street') . qq|</th>
1631 <td>$form->{street}</td>
1632 <td><input name=shiptostreet size=35 value="$form->{shiptostreet}"></td>
1635 <th align=right nowrap>| . $locale->text('Zipcode') . qq|</th>
1636 <td>$form->{zipcode}</td>
1637 <td><input name=shiptozipcode size=35 value="$form->{shiptozipcode}"></td>
1640 <th align=right nowrap>| . $locale->text('City') . qq|</th>
1641 <td>$form->{city}</td>
1642 <td><input name=shiptocity size=35 value="$form->{shiptocity}"></td>
1645 <th align=right nowrap>| . $locale->text('Country') . qq|</th>
1646 <td>$form->{country}</td>
1647 <td><input name=shiptocountry size=35 value="$form->{shiptocountry}"></td>
1650 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
1651 <td>$form->{contact}</td>
1652 <td><input name=shiptocontact size=35 value="$form->{shiptocontact}"></td>
1655 <th align=right nowrap>| . $locale->text('Phone') . qq|</th>
1656 <td>$form->{"$form->{vc}phone"}</td>
1657 <td><input name=shiptophone size=20 value="$form->{shiptophone}"></td>
1660 <th align=right nowrap>| . $locale->text('Fax') . qq|</th>
1661 <td>$form->{"$form->{vc}fax"}</td>
1662 <td><input name=shiptofax size=20 value="$form->{shiptofax}"></td>
1665 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
1666 <td>$form->{email}</td>
1667 <td><input name=shiptoemail size=35 value="$form->{shiptoemail}"></td>
1674 <input type=hidden name=nextsub value=$nextsub>
1678 map { delete $form->{$_} }
1679 qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail header);
1680 $form->{title} = $title;
1682 foreach $key (keys %$form) {
1683 $form->{$key} =~ s/\"/"/g;
1684 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1692 <input class=submit type=submit name=action value="|
1693 . $locale->text('Continue') . qq|">
1700 $lxdebug->leave_sub();
1704 $lxdebug->enter_sub();
1709 $form->{old_callback} = $form->escape($form->{callback}, 1);
1710 $form->{callback} = $form->escape("$form->{script}?action=display_form", 1);
1711 $form->{old_callback} = $form->escape($form->{old_callback}, 1);
1714 delete $form->{action};
1715 $customer = $form->{customer};
1716 map { $form->{"old_$_"} = $form->{"${_}_$row"} } qw(partnumber description);
1718 # save all other form variables in a previousform variable
1719 $form->{row} = $row;
1720 foreach $key (keys %$form) {
1723 $form->{$key} =~ s/&/%26/g;
1724 $previousform .= qq|$key=$form->{$key}&|;
1727 $previousform = $form->escape($previousform, 1);
1729 $form->{script} = "licenses.pl";
1731 map { $form->{$_} = $form->{"old_$_"} } qw(partnumber description);
1732 map { $form->{$_} = $form->escape($form->{$_}, 1) }
1733 qw(partnumber description);
1735 qq|$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&customer=$customer&partnumber=$form->{partnumber}&description=$form->{description}&previousform="$previousform"&initial=1|;
1738 $lxdebug->leave_sub();