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 #######################################################################
38 use List::Util qw(max);
44 require "bin/mozilla/common.pl";
46 # any custom scripts for this one
47 if (-f "bin/mozilla/custom_io.pl") {
48 eval { require "bin/mozilla/custom_io.pl"; };
50 if (-f "bin/mozilla/$form->{login}_io.pl") {
51 eval { require "bin/mozilla/$form->{login}_io.pl"; };
58 # this is for our long dates
59 # $locale->text('January')
60 # $locale->text('February')
61 # $locale->text('March')
62 # $locale->text('April')
63 # $locale->text('May ')
64 # $locale->text('June')
65 # $locale->text('July')
66 # $locale->text('August')
67 # $locale->text('September')
68 # $locale->text('October')
69 # $locale->text('November')
70 # $locale->text('December')
72 # this is for our short month
73 # $locale->text('Jan')
74 # $locale->text('Feb')
75 # $locale->text('Mar')
76 # $locale->text('Apr')
77 # $locale->text('May')
78 # $locale->text('Jun')
79 # $locale->text('Jul')
80 # $locale->text('Aug')
81 # $locale->text('Sep')
82 # $locale->text('Oct')
83 # $locale->text('Nov')
84 # $locale->text('Dec')
89 ########################################
90 # Eintrag fuer Version 2.2.0 geaendert #
91 # neue Optik im Rechnungsformular #
92 ########################################
94 ##################################################
95 # build html-code for pricegroups in variable $form->{prices_$j}
98 $lxdebug->enter_sub();
100 for $j (1 .. $rowcount) {
101 next unless $form->{PRICES}{$j};
102 # build drop down list for pricegroups
103 my $option_tmpl = qq|<option value="%s--%s" %s>%s</option>|;
104 $form->{"prices_$j"} = join '', map { sprintf $option_tmpl, @$_{qw(price pricegroup_id selected pricegroup)} }
105 (+{ pricegroup => $locale->text("none (pricegroup)") }, @{ $form->{PRICES}{$j} });
107 foreach $item (@{ $form->{PRICES}{$j} }) {
108 # set new selectedpricegroup_id and prices for "Preis"
109 $form->{"pricegroup_old_$j"} = $item->{pricegroup_id} if $item->{selected} && $item->{pricegroup_id};
110 $form->{"sellprice_$j"} = $item->{price} if $item->{selected} && $item->{pricegroup_id};
111 $form->{"price_new_$j"} = $form->{"sellprice_$j"} if $item->{selected} || !$item->{pricegroup_id};
114 $lxdebug->leave_sub();
118 $lxdebug->enter_sub();
119 @column_index = qw(ndx partnumber description onhand unit sellprice);
121 $column_data{ndx} = qq|<th> </th>|;
122 $column_data{partnumber} =
123 qq|<th class="listheading">| . $locale->text('Number') . qq|</th>|;
124 $column_data{description} =
125 qq|<th class="listheading">| . $locale->text('Part Description') . qq|</th>|;
126 $column_data{sellprice} =
127 qq|<th class="listheading">| . $locale->text('Price') . qq|</th>|;
128 $column_data{onhand} =
129 qq|<th class="listheading">| . $locale->text('Qty') . qq|</th>|;
131 qq|<th class="listheading">| . $locale->text('Unit') . qq|</th>|;
132 # list items with radio button on a form
135 $title = $locale->text('Select from one of the items below');
136 $colspan = $#column_index + 1;
141 <form method="post" action="$form->{script}">
145 <th class="listtop" colspan="$colspan">$title</th>
148 <tr class="listheading">|;
150 map { print "\n$column_data{$_}" } @column_index;
155 foreach $ref (@{ $form->{item_list} }) {
156 $checked = ($i++) ? "" : "checked";
159 if ($ref->{inventory_accno} > 0) {
160 $ref->{"lizenzen"} = qq|<option></option>|;
161 foreach $item (@{ $form->{LIZENZEN}{ $ref->{"id"} } }) {
162 $ref->{"lizenzen"} .=
163 qq|<option value=\"$item->{"id"}\">$item->{"licensenumber"}</option>|;
165 $ref->{"lizenzen"} .= qq|<option value="-1">Neue Lizenz</option>|;
166 $ref->{"lizenzen"} =~ s/\"/"/g;
170 map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description unit);
172 my $display_sellprice = $ref->{sellprice} * (1 - $form->{tradediscount});
173 $display_sellprice /= $ref->{price_factor} if ($ref->{price_factor});
174 $display_sellprice = $form->format_amount(\%myconfig, $display_sellprice, 2);
177 qq|<td><input name="ndx" class="radio" type="radio" value="$i" $checked></td>|;
178 $column_data{partnumber} =
179 qq|<td><input name="new_partnumber_$i" type="hidden" value="$ref->{partnumber}">$ref->{partnumber}</td>|;
180 $column_data{description} =
181 qq|<td><input name="new_description_$i" type="hidden" value="$ref->{description}">$ref->{description}</td>|;
182 $column_data{sellprice} =
183 qq|<td align="right"><input name="new_sellprice_$i" type="hidden" value="$ref->{sellprice}">|
186 $column_data{onhand} =
187 qq|<td align="right"><input name="new_onhand_$i" type="hidden" value="$ref->{onhand}">|
188 . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ")
191 qq|<td>$ref->{unit}</td>|;
195 <tr class=listrow$j>|;
197 map { print "\n$column_data{$_}" } @column_index;
202 qw(bin listprice inventory_accno income_accno expense_accno unit weight
203 assembly taxaccounts partsgroup formel longdescription not_discountable
204 part_payment_id partnotes id lastcost price_factor_id price_factor);
205 push(@new_fields, "lizenzen") if ($lizenzen);
207 print join "\n", map { $cgi->hidden("-name" => "new_${_}_$i", "-value" => $ref->{$_}) } @new_fields;
212 <tr><td colspan="8"><hr size="3" noshade></td></tr>
215 <input name="lastndx" type="hidden" value="$i">
219 # delete action variable
220 map { delete $form->{$_} } qw(action item_list header);
222 # save all other form variables
223 foreach $key (keys %${form}) {
224 $form->{$key} =~ s/\"/"/g;
225 print qq|<input name="$key" type="hidden" value="$form->{$key}">\n|;
229 <input type="hidden" name="nextsub" value="item_selected">
232 <input class="submit" type="submit" name="action" value="|
233 . $locale->text('Continue') . qq|">
240 $lxdebug->leave_sub();
244 $lxdebug->enter_sub();
246 # replace the last row with the checked row
247 $i = $form->{rowcount};
248 $i = $form->{assembly_rows} if ($form->{item} eq 'assembly');
254 #($form->{"sellprice_$i"},$form->{"$pricegroup_old_$i"}) = split /--/, $form->{"sellprice_$i"};
255 #$form->{"sellprice_$i"} = $form->{"sellprice_$i"};
257 # if there was a price entered, override it
258 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
261 qw(id partnumber description sellprice listprice inventory_accno
262 income_accno expense_accno bin unit weight assembly taxaccounts
263 partsgroup formel longdescription not_discountable partnotes lastcost
264 price_factor_id price_factor);
266 map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } @new_fields;
268 $form->{"marge_price_factor_$i"} = $form->{"new_price_factor_$j"};
270 if ($form->{"part_payment_id_$i"} ne "") {
271 $form->{payment_id} = $form->{"part_payment_id_$i"};
275 map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } qw(lizenzen);
278 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
280 $decimalplaces = ($dec > 2) ? $dec : 2;
283 $form->{"sellprice_$i"} = $sellprice;
286 # if there is an exchange rate adjust sellprice
287 if (($form->{exchangerate} * 1) != 0) {
288 $form->{"sellprice_$i"} /= $form->{exchangerate};
289 $form->{"sellprice_$i"} =
290 $form->round_amount($form->{"sellprice_$i"}, $decimalplaces);
294 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
295 qw(sellprice listprice weight);
297 $form->{sellprice} += ($form->{"sellprice_$i"} * $form->{"qty_$i"});
298 $form->{weight} += ($form->{"weight_$i"} * $form->{"qty_$i"});
300 if ($form->{"not_discountable_$i"}) {
301 $form->{"discount_$i"} = 0;
305 $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) *
307 map { $form->{"${_}_base"} += $amount }
308 (split / /, $form->{"taxaccounts_$i"});
309 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /,
310 $form->{"taxaccounts_$i"}
311 if !$form->{taxincluded};
313 $form->{creditremaining} -= $amount;
315 $form->{"runningnumber_$i"} = $i;
317 # delete all the new_ variables
318 for $i (1 .. $form->{lastndx}) {
319 map { delete $form->{"new_${_}_$i"} } @new_fields;
322 map { delete $form->{$_} } qw(ndx lastndx nextsub);
327 $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces)
328 } qw(sellprice listprice) if $form->{item} ne 'assembly';
330 # get pricegroups for parts
331 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
333 # build up html code for prices_$i
334 set_pricegroup($form->{rowcount});
338 $lxdebug->leave_sub();
342 $lxdebug->enter_sub();
345 $form->{old_callback} = $form->escape($form->{callback}, 1);
346 $form->{callback} = $form->escape("$form->{script}?action=display_form", 1);
348 # save all form variables except action in a previousform variable
349 my $previousform = join '&', map { $form->{$_} =~ s/&/%26/; "$_=$form->{$_}" } grep { !/action/ } keys %$form;
351 map { $form->{"${_}_$form->{rowcount}"} =~ s/\"/"/g } qw(partnumber description);
355 push @HIDDENS, { value => $cgi->hidden("-name" => "previousform", "-value" => $form->escape($previousform, 1)) };
356 push @HIDDENS, map +{ value => $cgi->hidden("-name" => $_, "-value" => $form->{$_}) }, qw(rowcount vc login password);
357 push @HIDDENS, map +{ value => $cgi->hidden("-name" => $_, "-value" => $form->{"${_}_$form->{rowcount}"}) }, qw(partnumber description unit sellprice);
358 push @HIDDENS, { value => $cgi->hidden("-name" => "taxaccount2", "-value" => $form->{taxaccounts}) };
360 print $form->parse_html_template("generic/new_item", { HIDDENS => \@HIDDENS} );
362 $lxdebug->leave_sub();
366 $lxdebug->enter_sub();
369 my @flds = (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 payment_id not_discountable shop ve gv buchungsgruppen_id language_values sellprice_pg pricegroup_old price_old price_new unit_old ordnumber transdate longdescription basefactor marge_total marge_percent marge_price_factor lastcost price_factor_id));
371 # remove any makes or model rows
372 if ($form->{item} eq 'part') {
373 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
374 qw(listprice sellprice lastcost weight rop);
376 @flds = (make, model);
377 for my $i (1 .. ($form->{makemodel_rows})) {
378 if (($form->{"make_$i"} ne "") || ($form->{"model_$i"} ne "")) {
382 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
387 $form->redo_rows(\@flds, \@a, $count, $form->{makemodel_rows});
388 $form->{makemodel_rows} = $count;
390 } elsif ($form->{item} eq 'assembly') {
392 $form->{sellprice} = 0;
394 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
395 qw(listprice rop stock);
398 qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup);
400 for my $i (1 .. ($form->{assembly_rows} - 1)) {
401 if ($form->{"qty_$i"}) {
405 $form->{"qty_$i"} = $form->parse_amount(\%myconfig, $form->{"qty_$i"});
407 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
409 #($form->{"sellprice_$i"},$form->{"$pricegroup_old_$i"}) = split /--/, $form->{"sellprice_$i"};
411 $form->{sellprice} += ($form->{"qty_$i"} * $form->{"sellprice_$i"});
412 $form->{weight} += ($form->{"qty_$i"} * $form->{"weight_$i"});
417 $form->{sellprice} = $form->round_amount($form->{sellprice}, 2);
419 $form->redo_rows(\@flds, \@a, $count, $form->{assembly_rows});
420 $form->{assembly_rows} = $count;
423 @flds = qw(make model);
426 for my $i (1 .. ($form->{makemodel_rows})) {
427 if (($form->{"make_$i"} ne "") || ($form->{"model_$i"} ne "")) {
431 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
436 $form->redo_rows(\@flds, \@a, $count, $form->{makemodel_rows});
437 $form->{makemodel_rows} = $count;
439 } elsif ($form->{item} eq 'service') {
440 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(listprice sellprice lastcost);
444 # this section applies to invoices and orders
445 # remove any empty numbers
446 if ($form->{rowcount}) {
447 for my $i (1 .. $form->{rowcount} - 1) {
448 if ($form->{"partnumber_$i"}) {
452 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
455 if ($form->{"licensenumber_$i"} == -1) {
463 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
464 $form->{rowcount} = $count;
466 $form->{creditremaining} -= &invoicetotal;
473 if ( $form->{type} =~ (/sales_quotation/)
474 or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/))
475 or (($form->{level} eq undef) and ($form->{type} =~ /invoice/))
476 or ($form->{type} =~ /sales_order/)) {
478 # get pricegroups for parts
479 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
481 # build up html code for prices_$i
482 set_pricegroup($form->{rowcount});
488 $lxdebug->leave_sub();
492 $lxdebug->enter_sub();
494 $form->{oldinvtotal} = 0;
496 # add all parts and deduct paid
497 map { $form->{"${_}_base"} = 0 } split / /, $form->{taxaccounts};
499 my ($amount, $sellprice, $discount, $qty);
501 for my $i (1 .. $form->{rowcount}) {
502 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
503 $discount = $form->parse_amount(\%myconfig, $form->{"discount_$i"});
504 $qty = $form->parse_amount(\%myconfig, $form->{"qty_$i"});
506 #($form->{"sellprice_$i"}, $form->{"$pricegroup_old_$i"}) = split /--/, $form->{"sellprice_$i"};
508 $amount = $sellprice * (1 - $discount / 100) * $qty;
509 map { $form->{"${_}_base"} += $amount }
510 (split (/ /, $form->{"taxaccounts_$i"}));
511 $form->{oldinvtotal} += $amount;
514 map { $form->{oldinvtotal} += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
515 split(/ /, $form->{taxaccounts})
516 if !$form->{taxincluded};
518 $form->{oldtotalpaid} = 0;
519 for $i (1 .. $form->{paidaccounts}) {
520 $form->{oldtotalpaid} += $form->{"paid_$i"};
523 $lxdebug->leave_sub();
526 return ($form->{oldinvtotal} - $form->{oldtotalpaid});
530 $lxdebug->enter_sub();
532 # check if items are valid
533 if ($form->{rowcount} == 1) {
538 for $i (1 .. $form->{rowcount} - 1) {
539 $form->isblank("partnumber_$i",
540 $locale->text('Number missing in Row') . " $i");
543 $lxdebug->leave_sub();
547 $lxdebug->enter_sub();
548 if ($form->{second_run}) {
549 $form->{print_and_post} = 0;
551 $form->{ordnumber} = $form->{invnumber};
553 $form->{old_employee_id} = $form->{employee_id};
554 $form->{old_salesman_id} = $form->{salesman_id};
556 map { delete $form->{$_} } qw(id printed emailed queued);
557 if ($form->{script} eq 'ir.pl' || $form->{type} eq 'request_quotation') {
558 $form->{title} = $locale->text('Add Purchase Order');
559 $form->{vc} = 'vendor';
560 $form->{type} = 'purchase_order';
563 if ($form->{script} eq 'is.pl' || $form->{type} eq 'sales_quotation') {
564 $form->{title} = $locale->text('Add Sales Order');
565 $form->{vc} = 'customer';
566 $form->{type} = 'sales_order';
569 $form->{script} = 'oe.pl';
577 require "bin/mozilla/$form->{script}";
578 my $script = $form->{"script"};
581 $locale = new Locale($language, $script);
583 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
585 $currency = $form->{currency};
589 $form->{currency} = $currency;
590 $form->{exchangerate} = "";
592 $form->{exchangerate} = $exchangerate
596 $form->check_exchangerate(
597 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
600 for $i (1 .. $form->{rowcount}) {
601 map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
602 $form->{"${_}_${i}"})
603 if ($form->{"${_}_${i}"}) }
604 qw(ship qty sellprice listprice basefactor));
610 $lxdebug->leave_sub();
614 $lxdebug->enter_sub();
615 if ($form->{second_run}) {
616 $form->{print_and_post} = 0;
618 map { delete $form->{$_} } qw(id printed emailed queued);
620 if ($form->{script} eq 'ir.pl' || $form->{type} eq 'purchase_order') {
621 $form->{title} = $locale->text('Add Request for Quotation');
622 $form->{vc} = 'vendor';
623 $form->{type} = 'request_quotation';
626 if ($form->{script} eq 'is.pl' || $form->{type} eq 'sales_order') {
627 $form->{title} = $locale->text('Add Quotation');
628 $form->{vc} = 'customer';
629 $form->{type} = 'sales_quotation';
635 $form->{script} = 'oe.pl';
641 require "bin/mozilla/$form->{script}";
643 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
645 $currency = $form->{currency};
649 $form->{currency} = $currency;
650 $form->{exchangerate} = "";
652 $form->{exchangerate} = $exchangerate
656 $form->check_exchangerate(
657 \%myconfig, $form->{currency}, $form->{transdate}, $buysell
660 for $i (1 .. $form->{rowcount}) {
661 map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
662 $form->{"${_}_${i}"})
663 if ($form->{"${_}_${i}"}) }
664 qw(ship qty sellprice listprice basefactor));
670 $lxdebug->leave_sub();
673 sub request_for_quotation {
678 $lxdebug->enter_sub();
679 if ($form->{second_run}) {
680 $form->{print_and_post} = 0;
681 $form->{resubmit} = 0;
684 $form->{email} = $form->{shiptoemail} if $form->{shiptoemail} && $form->{formname} =~ /(pick|packing|bin)_list/;
686 if ($form->{"cp_id"} && !$form->{"email"}) {
687 CT->get_contact(\%myconfig, $form);
688 $form->{"email"} = $form->{"cp_email"};
691 $title = $locale->text('E-mail') . " " . $form->get_formname_translation();
693 $form->{oldmedia} = $form->{media};
694 $form->{media} = "email";
696 my $attachment_filename = $form->generate_attachment_filename();
698 $form->{"fokus"} = $form->{"email"} ? "Form.subject" : "Form.email";
701 my (@dont_hide_key_list, %dont_hide_key, @hidden_keys);
702 @dont_hide_key_list = qw(action email cc bcc subject message formname sendmode format header override);
703 @dont_hide_key{@dont_hide_key_list} = (1) x @dont_hide_key_list;
704 @hidden_keys = grep { !$dont_hide_key{$_} } grep { !ref $form->{$_} } keys %$form;
706 print $form->parse_html_template('generic/edit_email',
708 a_filename => $attachment_filename,
709 _print_options_ => print_options('inline' => 1),
710 HIDDEN => [ map +{ name => $_, value => $form->{$_} }, @hidden_keys ],
711 SHOW_BCC => $myconfig{role} eq 'admin' });
713 $lxdebug->leave_sub();
717 $lxdebug->enter_sub();
719 my $callback = $form->{script} . "?action=edit";
720 map({ $callback .= "\&${_}=" . E($form->{$_}); }
721 qw(login password type id));
723 print_form("return");
725 Common->save_email_status(\%myconfig, $form);
727 $form->{callback} = $callback;
730 $lxdebug->leave_sub();
733 # generate the printing options displayed at the bottom of oe and is forms.
734 # this function will attempt to guess what type of form is displayed, and will generate according options
737 # this version builds the arrays of options pretty directly. if you have trouble understanding how,
738 # the opthash function builds hashrefs which are then pieced together for the template arrays.
739 # unneeded options are "undef"ed out, and then grepped out.
741 # the inline options is untested, but intended to be used later in metatemplating
743 $lxdebug->enter_sub();
747 # names 3 parameters and returns a hashref, for use in templates
748 sub opthash { +{ value => shift, selected => shift, oname => shift } }
749 (@FORMNAME, @FORMNAME, @LANGUAGE_ID, @FORMAT, @SENDMODE, @MEDIA, @PRINTER_ID, @SELECTS) = ();
751 # note: "||"-selection is only correct for values where "0" is _not_ a correct entry
752 $form->{sendmode} = "attachment";
753 $form->{format} = $form->{format} || $myconfig{template_format} || "pdf";
754 $form->{copies} = $form->{copies} || $myconfig{copies} || 3;
755 $form->{media} = $form->{media} || $myconfig{default_media} || "screen";
756 $form->{printer_id} = defined $form->{printer_id} ? $form->{printer_id} :
757 defined $myconfig{default_printer_id} ? $myconfig{default_printer_id} : "";
759 $form->{PD}{ $form->{formname} } = "selected";
760 $form->{DF}{ $form->{format} } = "selected";
761 $form->{OP}{ $form->{media} } = "selected";
762 $form->{SM}{ $form->{formname} } = "selected";
764 push @FORMNAME, grep $_,
765 ($form->{type} eq 'purchase_order') ? (
766 opthash("purchase_order", $form->{PD}{purchase_order}, $locale->text('Purchase Order')),
767 opthash("bin_list", $form->{PD}{bin_list}, $locale->text('Bin List'))
769 ($form->{type} eq 'credit_note') ?
770 opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef,
771 ($form->{type} eq 'sales_order') ? (
772 opthash("sales_order", $form->{PD}{sales_order}, $locale->text('Confirmation')),
773 opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')),
774 opthash("pick_list", $form->{PD}{pick_list}, $locale->text('Pick List')),
775 opthash("packing_list", $form->{PD}{packing_list}, $locale->text('Packing List'))
777 ($form->{type} =~ /_quotation$/) ?
778 opthash("$`_quotation", $form->{PD}{"$`_quotation"}, $locale->text('Quotation')) : undef,
779 ($form->{type} eq 'invoice') ? (
780 opthash("invoice", $form->{PD}{invoice}, $locale->text('Invoice')),
781 opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')),
782 opthash("packing_list", $form->{PD}{packing_list}, $locale->text('Packing List'))
784 ($form->{type} eq 'invoice' && $form->{storno}) ? (
785 opthash("storno_invoice", $form->{PD}{storno_invoice}, $locale->text('Storno Invoice')),
786 opthash("storno_packing_list", $form->{PD}{storno_packing_list}, $locale->text('Storno Packing List'))
788 ($form->{type} eq 'credit_note') ?
789 opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef;
792 opthash("attachment", $form->{SM}{attachment}, $locale->text('Attachment')),
793 opthash("inline", $form->{SM}{inline}, $locale->text('In-line'))
794 if ($form->{media} eq 'email');
796 push @MEDIA, grep $_,
797 opthash("screen", $form->{OP}{screen}, $locale->text('Screen')),
798 (scalar @{ $form->{printers} } && $latex_templates) ?
799 opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef,
800 ($latex_templates && !$options->{no_queue}) ?
801 opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef
802 if ($form->{media} ne 'email');
804 push @FORMAT, grep $_,
805 ($opendocument_templates && $openofficeorg_writer_bin && $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)
806 && !$options->{no_opendocument_pdf}) ?
807 opthash("opendocument_pdf", $form->{DF}{"opendocument_pdf"}, $locale->text("PDF (OpenDocument/OASIS)")) : undef,
809 opthash("pdf", $form->{DF}{pdf}, $locale->text('PDF')) : undef,
810 ($latex_templates && !$options->{no_postscript}) ?
811 opthash("postscript", $form->{DF}{postscript}, $locale->text('Postscript')) : undef,
812 (!$options->{no_html}) ?
813 opthash("html", $form->{DF}{html}, "HTML") : undef,
814 ($opendocument_templates && !$options->{no_opendocument}) ?
815 opthash("opendocument", $form->{DF}{opendocument}, $locale->text("OpenDocument/OASIS")) : undef;
818 map { opthash($_->{id}, ($_->{id} eq $form->{language_id} ? 'selected' : ''), $_->{description}) } +{}, @{ $form->{languages} }
819 if (ref $form->{languages} eq 'ARRAY');
822 map { opthash($_->{id}, ($_->{id} eq $form->{printer_id} ? 'selected' : ''), $_->{printer_description}) } +{}, @{ $form->{printers} }
823 if ((ref $form->{printers} eq 'ARRAY') && scalar @{ $form->{printers } });
825 @SELECTS = map { sname => lc $_, DATA => \@$_, show => !$options{"hide_" . lc($_)} && scalar @$_ }, qw(FORMNAME LANGUAGE_ID FORMAT SENDMODE MEDIA PRINTER_ID);
827 my %dont_display_groupitems = (
832 display_copies => scalar @{ $form->{printers} } && $latex_templates && $form->{media} ne 'email',
833 display_remove_draft => (!$form->{id} && $form->{draft_id}),
834 display_groupitems => !$dont_display_groupitems{$form->{type}},
835 groupitems_checked => $form->{groupitems} ? "checked" : '',
836 remove_draft_checked => $form->{remove_draft} ? "checked" : ''
839 my $print_options = $form->parse_html_template("generic/print_options", { SELECTS => \@SELECTS, %template_vars } );
841 if ($options{inline}) {
842 $lxdebug->leave_sub() and return $print_options;
844 print $print_options; $lxdebug->leave_sub();
849 $lxdebug->enter_sub();
851 if ($form->{print_nextsub}) {
852 call_sub($form->{print_nextsub});
853 $lxdebug->leave_sub();
857 # if this goes to the printer pass through
858 if ($form->{media} eq 'printer' || $form->{media} eq 'queue') {
859 $form->error($locale->text('Select postscript or PDF!'))
860 if ($form->{format} !~ /(postscript|pdf)/);
862 $old_form = new Form;
863 map { $old_form->{$_} = $form->{$_} } keys %$form;
866 if (!$form->{id} || (($form->{formname} eq "proforma") && !$form->{proforma} && (($form->{type} =~ /_order$/) || ($form->{type} =~ /_quotation$/)))) {
867 if ($form->{formname} eq "proforma") {
868 $form->{proforma} = 1;
870 $form->{print_and_save} = 1;
871 my $formname = $form->{formname};
873 $form->{formname} = $formname;
878 &print_form($old_form);
880 $lxdebug->leave_sub();
884 $lxdebug->enter_sub();
889 $numberfld = "invnumber";
892 ($form->{display_form}) ? $form->{display_form} : "display_form";
894 # $form->{"notes"} will be overridden by the customer's/vendor's "notes" field. So save it here.
895 $form->{ $form->{"formname"} . "notes" } = $form->{"notes"};
897 if ($form->{formname} eq "invoice") {
898 $form->{label} = $locale->text('Invoice');
900 if ($form->{formname} eq "packing_list") {
902 # this is from an invoice
903 $form->{label} = $locale->text('Packing List');
905 if ($form->{formname} eq 'sales_order') {
908 $form->{"${inv}date"} = $form->{transdate};
909 $form->{label} = $locale->text('Confirmation');
910 $numberfld = "sonumber";
914 if (($form->{type} eq 'invoice') && ($form->{formname} eq 'proforma') ) {
917 $form->{"${inv}date"} = $form->{invdate};
918 $form->{label} = $locale->text('Proforma Invoice');
919 $numberfld = "sonumber";
923 if (($form->{type} eq 'sales_order') && ($form->{formname} eq 'proforma') ) {
926 $form->{"${inv}date"} = $form->{transdate};
927 $form->{"invdate"} = $form->{transdate};
928 $form->{invnumber} = $form->{ordnumber};
929 $form->{label} = $locale->text('Proforma Invoice');
930 $numberfld = "sonumber";
934 if ($form->{formname} eq 'packing_list' && $form->{type} ne 'invoice') {
936 # we use the same packing list as from an invoice
939 $form->{invdate} = $form->{"${inv}date"} = $form->{transdate};
940 $form->{label} = $locale->text('Packing List');
942 # set invnumber for template packing_list
943 $form->{invnumber} = $form->{ordnumber};
945 if ($form->{formname} eq 'pick_list') {
948 $form->{"${inv}date"} =
949 ($form->{transdate}) ? $form->{transdate} : $form->{invdate};
950 $form->{label} = $locale->text('Pick List');
951 $order = 1 unless $form->{type} eq 'invoice';
953 if ($form->{formname} eq 'purchase_order') {
956 $form->{"${inv}date"} = $form->{transdate};
957 $form->{label} = $locale->text('Purchase Order');
958 $numberfld = "ponumber";
961 if ($form->{formname} eq 'bin_list') {
964 $form->{"${inv}date"} = $form->{transdate};
965 $form->{label} = $locale->text('Bin List');
968 if ($form->{formname} eq 'sales_quotation') {
971 $form->{"${inv}date"} = $form->{transdate};
972 $form->{label} = $locale->text('Quotation');
973 $numberfld = "sqnumber";
977 if (($form->{type} eq 'sales_quotation') && ($form->{formname} eq 'proforma') ) {
980 $form->{"${inv}date"} = $form->{transdate};
981 $form->{"invdate"} = $form->{transdate};
982 $form->{label} = $locale->text('Proforma Invoice');
983 $numberfld = "sqnumber";
987 if ($form->{formname} eq 'request_quotation') {
990 $form->{"${inv}date"} = $form->{transdate};
991 $form->{label} = $locale->text('RFQ');
992 $numberfld = "rfqnumber";
996 $form->isblank("email", $locale->text('E-mail address missing!'))
997 if ($form->{media} eq 'email');
998 $form->isblank("${inv}date",
999 $locale->text($form->{label})
1001 . $locale->text(' Date missing!'));
1003 # $locale->text('Invoice Number missing!')
1004 # $locale->text('Invoice Date missing!')
1005 # $locale->text('Packing List Number missing!')
1006 # $locale->text('Packing List Date missing!')
1007 # $locale->text('Order Number missing!')
1008 # $locale->text('Order Date missing!')
1009 # $locale->text('Quotation Number missing!')
1010 # $locale->text('Quotation Date missing!')
1013 $form->{what_done} = $form->{formname};
1014 if (!$form->{"${inv}number"} && !$form->{preview} && !$form->{id}) {
1015 $form->{"${inv}number"} = $form->update_defaults(\%myconfig, $numberfld);
1016 if ($form->{media} ne 'email') {
1018 # get pricegroups for parts
1019 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
1021 # build up html code for prices_$i
1022 set_pricegroup($form->{rowcount});
1024 $form->{rowcount}--;
1026 call_sub($display_form);
1027 # saving the history
1028 if(!exists $form->{addition}) {
1029 $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
1030 $form->{addition} = "PRINTED";
1031 $form->save_history($form->dbconnect(\%myconfig));
1033 # /saving the history
1040 # Save the email address given in the form because it should override the setting saved for the customer/vendor.
1041 my ($saved_email, $saved_cc, $saved_bcc) =
1042 ($form->{"email"}, $form->{"cc"}, $form->{"bcc"});
1044 $language_saved = $form->{language_id};
1045 $payment_id_saved = $form->{payment_id};
1046 $salesman_id_saved = $form->{salesman_id};
1047 $cp_id_saved = $form->{cp_id};
1049 call_sub("$form->{vc}_details");
1051 $form->{language_id} = $language_saved;
1052 $form->{payment_id} = $payment_id_saved;
1054 $form->{"email"} = $saved_email if ($saved_email);
1055 $form->{"cc"} = $saved_cc if ($saved_cc);
1056 $form->{"bcc"} = $saved_bcc if ($saved_bcc);
1058 if (!$cp_id_saved) {
1059 # No contact was selected. Delete all contact variables because
1060 # IS->customer_details() and IR->vendor_details() get the default
1062 map({ delete($form->{$_}); } grep(/^cp_/, keys(%{ $form })));
1065 my ($language_tc, $output_numberformat, $output_dateformat, $output_longdates);
1066 if ($form->{"language_id"}) {
1067 ($language_tc, $output_numberformat, $output_dateformat, $output_longdates) =
1068 AM->get_language_details(\%myconfig, $form, $form->{language_id});
1070 $output_dateformat = $myconfig{"dateformat"};
1071 $output_numberformat = $myconfig{"numberformat"};
1072 $output_longdates = 1;
1075 ($form->{employee}) = split /--/, $form->{employee};
1077 # create the form variables
1079 OE->order_details(\%myconfig, \%$form);
1081 IS->invoice_details(\%myconfig, \%$form, $locale);
1084 $form->get_salesman(\%myconfig, $salesman_id_saved);
1086 if ($form->{shipto_id}) {
1087 $form->get_shipto(\%myconfig);
1090 @a = qw(name street zipcode city country);
1094 # if there is no shipto fill it in from billto
1095 foreach $item (@a) {
1096 if ($form->{"shipto$item"}) {
1103 if ( $form->{formname} eq 'purchase_order'
1104 || $form->{formname} eq 'request_quotation') {
1105 $form->{shiptoname} = $myconfig{company};
1106 $form->{shiptostreet} = $myconfig{address};
1108 map { $form->{"shipto$_"} = $form->{$_} } @a;
1112 $form->{notes} =~ s/^\s+//g;
1114 $form->{templates} = "$myconfig{templates}";
1116 delete $form->{printer_command};
1118 $form->{language} = $form->get_template_language(\%myconfig);
1121 if ($form->{media} ne 'email') {
1122 $printer_code = $form->get_printer_code(\%myconfig);
1123 if ($printer_code ne "") {
1124 $printer_code = "_" . $printer_code;
1128 if ($form->{language} ne "") {
1129 map({ $form->{"unit"}->[$_] =
1130 AM->translate_units($form, $form->{"language"},
1131 $form->{"unit"}->[$_], $form->{"qty"}->[$_]); }
1132 (0..scalar(@{$form->{"unit"}}) - 1));
1133 $form->{language} = "_" . $form->{language};
1137 format_dates($output_dateformat, $output_longdates,
1138 qw(invdate orddate quodate pldate duedate reqdate transdate
1139 shippingdate deliverydate validitydate paymentdate
1140 datepaid transdate_oe deliverydate_oe
1141 employee_startdate employee_enddate
1143 grep({ /^datepaid_\d+$/ ||
1144 /^transdate_oe_\d+$/ ||
1145 /^deliverydate_oe_\d+$/ ||
1147 /^deliverydate_\d+$/ ||
1151 reformat_numbers($output_numberformat, 2,
1152 qw(invtotal ordtotal quototal subtotal linetotal
1153 listprice sellprice netprice discount
1154 tax taxbase total paid),
1155 grep({ /^linetotal_\d+$/ ||
1156 /^listprice_\d+$/ ||
1157 /^sellprice_\d+$/ ||
1167 reformat_numbers($output_numberformat, undef,
1168 qw(qty price_factor),
1172 $form->{IN} = "$form->{formname}$form->{language}${printer_code}.html";
1173 if ($form->{format} eq 'postscript') {
1174 $form->{postscript} = 1;
1175 $form->{IN} =~ s/html$/tex/;
1176 } elsif ($form->{"format"} =~ /pdf/) {
1178 if ($form->{"format"} =~ /opendocument/) {
1179 $form->{IN} =~ s/html$/odt/;
1181 $form->{IN} =~ s/html$/tex/;
1183 } elsif ($form->{"format"} =~ /opendocument/) {
1184 $form->{"opendocument"} = 1;
1185 $form->{"IN"} =~ s/html$/odt/;
1188 delete $form->{OUT};
1190 if ($form->{media} eq 'printer') {
1191 $form->{OUT} = "| $form->{printer_command} &>/dev/null";
1192 $form->{printed} .= " $form->{formname}";
1193 $form->{printed} =~ s/^ //;
1195 $printed = $form->{printed};
1197 if ($form->{media} eq 'email') {
1198 $form->{subject} = qq|$form->{label} $form->{"${inv}number"}|
1199 unless $form->{subject};
1201 $form->{emailed} .= " $form->{formname}";
1202 $form->{emailed} =~ s/^ //;
1204 $emailed = $form->{emailed};
1206 if ($form->{media} eq 'queue') {
1207 %queued = map { s|.*/|| } split / /, $form->{queued};
1209 if ($filename = $queued{ $form->{formname} }) {
1210 $form->{queued} =~ s/\Q$form->{formname} $filename\E//;
1211 unlink "$spool/$filename";
1212 $filename =~ s/\..*$//g;
1218 $filename .= ($form->{postscript}) ? '.ps' : '.pdf';
1219 $form->{OUT} = ">$spool/$filename";
1222 $form->{queued} .= " $form->{formname} $filename";
1224 $form->{queued} =~ s/^ //;
1226 $queued = $form->{queued};
1228 # saving the history
1229 if(!exists $form->{addition}) {
1230 $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
1231 if($form->{media} =~ /printer/) {
1232 $form->{addition} = "PRINTED";
1234 elsif($form->{media} =~ /email/) {
1235 $form->{addition} = "MAILED";
1237 elsif($form->{media} =~ /queue/) {
1238 $form->{addition} = "QUEUED";
1240 elsif($form->{media} =~ /screen/) {
1241 $form->{addition} = "SCREENED";
1243 $form->save_history($form->dbconnect(\%myconfig));
1245 # /saving the history
1247 $form->parse_template(\%myconfig, $userspath);
1249 $form->{callback} = "";
1251 if ($form->{media} eq 'email') {
1252 $form->{message} = $locale->text('sent') unless $form->{message};
1254 $message = $form->{message};
1256 # if we got back here restore the previous form
1257 if ($form->{media} =~ /(printer|email|queue)/) {
1259 $form->update_status(\%myconfig)
1260 if ($form->{media} eq 'queue' && $form->{id});
1262 return $lxdebug->leave_sub() if ($old_form eq "return");
1266 $old_form->{"${inv}number"} = $form->{"${inv}number"};
1268 # restore and display form
1269 map { $form->{$_} = $old_form->{$_} } keys %$old_form;
1271 $form->{queued} = $queued;
1272 $form->{printed} = $printed;
1273 $form->{emailed} = $emailed;
1274 $form->{message} = $message;
1276 $form->{rowcount}--;
1277 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1278 qw(exchangerate creditlimit creditremaining);
1280 for $i (1 .. $form->{paidaccounts}) {
1282 $form->{"${_}_$i"} =
1283 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
1284 } qw(paid exchangerate);
1287 call_sub($display_form);
1292 ($form->{media} eq 'printer')
1293 ? $locale->text('sent to printer')
1294 : $locale->text('emailed to') . " $form->{email}";
1295 $form->redirect(qq|$form->{label} $form->{"${inv}number"} $msg|);
1297 if ($form->{printing}) {
1298 call_sub($display_form);
1302 $lxdebug->leave_sub();
1305 sub customer_details {
1306 $lxdebug->enter_sub();
1307 IS->customer_details(\%myconfig, \%$form, @_);
1308 $lxdebug->leave_sub();
1311 sub vendor_details {
1312 $lxdebug->enter_sub();
1314 IR->vendor_details(\%myconfig, \%$form, @_);
1316 $lxdebug->leave_sub();
1320 $lxdebug->enter_sub();
1322 $form->{postasnew} = 1;
1323 map { delete $form->{$_} } qw(printed emailed queued);
1327 $lxdebug->leave_sub();
1331 $lxdebug->enter_sub();
1332 if ($form->{second_run}) {
1333 $form->{print_and_post} = 0;
1336 $title = $form->{title};
1337 $form->{title} = $locale->text('Ship to');
1339 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1340 qw(exchangerate creditlimit creditremaining);
1343 qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry
1344 shiptocontact shiptophone shiptofax shiptoemail
1345 shiptodepartment_1 shiptodepartment_2);
1348 (qw(name department_1 department_2 street zipcode city country
1349 contact email phone fax));
1351 # get details for name
1352 call_sub("$form->{vc}_details", @addr_vars);
1355 ($form->{vc} eq 'customer')
1356 ? $locale->text('Customer Number')
1357 : $locale->text('Vendor Number');
1359 # get pricegroups for parts
1360 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
1362 # build up html code for prices_$i
1363 set_pricegroup($form->{rowcount});
1365 $nextsub = ($form->{display_form}) ? $form->{display_form} : "display_form";
1367 $form->{rowcount}--;
1374 <form method="post" action="$form->{script}">
1376 <table width="100%">
1380 <tr class="listheading">
1381 <th class="listheading" colspan="2" width="50%">|
1382 . $locale->text('Billing Address') . qq|</th>
1383 <th class="listheading" width="50%">|
1384 . $locale->text('Shipping Address') . qq|</th>
1386 <tr height="5"></tr>
1388 <th align="right" nowrap>$number</th>
1389 <td>$form->{"$form->{vc}number"}</td>
1392 <th align="right" nowrap>| . $locale->text('Company Name') . qq|</th>
1393 <td>$form->{name}</td>
1394 <td><input name="shiptoname" size="35" value="$form->{shiptoname}"></td>
1397 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
1398 <td>$form->{department_1}</td>
1399 <td><input name="shiptodepartment_1" size="35" value="$form->{shiptodepartment_1}"></td>
1402 <th align="right" nowrap> </th>
1403 <td>$form->{department_2}</td>
1404 <td><input name="shiptodepartment_2" size="35" value="$form->{shiptodepartment_2}"></td>
1407 <th align="right" nowrap>| . $locale->text('Street') . qq|</th>
1408 <td>$form->{street}</td>
1409 <td><input name="shiptostreet" size="35" value="$form->{shiptostreet}"></td>
1412 <th align="right" nowrap>| . $locale->text('Zipcode') . qq|</th>
1413 <td>$form->{zipcode}</td>
1414 <td><input name="shiptozipcode" size="35" value="$form->{shiptozipcode}"></td>
1417 <th align="right" nowrap>| . $locale->text('City') . qq|</th>
1418 <td>$form->{city}</td>
1419 <td><input name="shiptocity" size="35" value="$form->{shiptocity}"></td>
1422 <th align="right" nowrap>| . $locale->text('Country') . qq|</th>
1423 <td>$form->{country}</td>
1424 <td><input name="shiptocountry" size="35" value="$form->{shiptocountry}"></td>
1427 <th align="right" nowrap>| . $locale->text('Contact') . qq|</th>
1428 <td>$form->{contact}</td>
1429 <td><input name="shiptocontact" size="35" value="$form->{shiptocontact}"></td>
1432 <th align="right" nowrap>| . $locale->text('Phone') . qq|</th>
1433 <td>$form->{phone}</td>
1434 <td><input name="shiptophone" size="20" value="$form->{shiptophone}"></td>
1437 <th align="right" nowrap>| . $locale->text('Fax') . qq|</th>
1438 <td>$form->{fax}</td>
1439 <td><input name="shiptofax" size="20" value="$form->{shiptofax}"></td>
1442 <th align="right" nowrap>| . $locale->text('E-mail') . qq|</th>
1443 <td>$form->{email}</td>
1444 <td><input name="shiptoemail" size="35" value="$form->{shiptoemail}"></td>
1450 | . $cgi->hidden("-name" => "nextsub", "-value" => $nextsub);
1456 map({ delete $form->{$_} } (@shipto_vars, qw(header)));
1457 $form->{title} = $title;
1459 foreach $key (keys %$form) {
1460 $form->{$key} =~ s/\"/"/g;
1461 print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|;
1466 <hr size="3" noshade>
1469 <input class="submit" type="submit" name="action" value="|
1470 . $locale->text('Continue') . qq|">
1477 $lxdebug->leave_sub();
1481 $lxdebug->enter_sub();
1486 $form->{old_callback} = $form->escape($form->{callback}, 1);
1487 $form->{callback} = $form->escape("$form->{script}?action=display_form", 1);
1488 $form->{old_callback} = $form->escape($form->{old_callback}, 1);
1491 delete $form->{action};
1492 $customer = $form->{customer};
1493 map { $form->{"old_$_"} = $form->{"${_}_$row"} } qw(partnumber description);
1495 # save all other form variables in a previousform variable
1496 $form->{row} = $row;
1497 foreach $key (keys %$form) {
1500 $form->{$key} =~ s/&/%26/g;
1501 $previousform .= qq|$key=$form->{$key}&|;
1504 $previousform = $form->escape($previousform, 1);
1506 $form->{script} = "licenses.pl";
1508 map { $form->{$_} = $form->{"old_$_"} } qw(partnumber description);
1509 map { $form->{$_} = $form->escape($form->{$_}, 1) }
1510 qw(partnumber description);
1512 qq|$form->{script}?login=$form->{login}&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|;
1515 $lxdebug->leave_sub();
1518 sub relink_accounts {
1519 $lxdebug->enter_sub();
1521 $form->{"taxaccounts"} =~ s/\s*$//;
1522 $form->{"taxaccounts"} =~ s/^\s*//;
1523 foreach my $accno (split(/\s*/, $form->{"taxaccounts"})) {
1524 map({ delete($form->{"${accno}_${_}"}); } qw(rate description taxnumber));
1526 $form->{"taxaccounts"} = "";
1528 for (my $i = 1; $i <= $form->{"rowcount"}; $i++) {
1529 if ($form->{"id_$i"}) {
1530 IC->retrieve_accounts(\%myconfig, $form, $form->{"id_$i"}, $i, 1);
1534 $lxdebug->leave_sub();
1538 $lxdebug->enter_sub();
1540 $form->get_duedate(\%myconfig);
1543 $result = "$form->{duedate}";
1546 $lxdebug->leave_sub();