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-2002
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 #======================================================================
30 # Inventory invoicing module
32 #======================================================================
38 require "$form->{path}/io.pl";
39 require "$form->{path}/arap.pl";
40 require "bin/mozilla/drafts.pl";
47 $lxdebug->enter_sub();
49 return $lxdebug->leave_sub() if (load_draft_maybe());
51 if ($form->{type} eq "credit_note") {
52 $form->{title} = $locale->text('Add Credit Note');
54 if ($form->{storno}) {
55 $form->{title} = $locale->text('Add Storno Credit Note');
58 $form->{title} = $locale->text('Add Sales Invoice');
64 "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&path=$form->{path}&password=$form->{password}"
65 unless $form->{callback};
67 $form{jsscript} = "date";
69 if ($myconfig{acs} =~ "AR--Add Sales Invoice" || $myconfig{acs} =~ "AR--AR")
71 $form->error("Access Denied");
77 $lxdebug->leave_sub();
81 $lxdebug->enter_sub();
84 $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
85 #/show hhistory button
87 if ($myconfig{acs} =~ "AR--Add Sales Invoice" || $myconfig{acs} =~ "AR--AR")
89 $form->error("Access Denied");
92 if ($form->{print_and_post}) {
93 $form->{action} = "print";
94 $form->{resubmit} = 1;
95 $language_id = $form->{language_id};
96 $printer_id = $form->{printer_id};
100 if ($form->{print_and_post}) {
101 $form->{language_id} = $language_id;
102 $form->{printer_id} = $printer_id;
107 $lxdebug->leave_sub();
111 $lxdebug->enter_sub();
113 $form->{vc} = 'customer';
116 $form->{webdav} = $webdav;
117 $form->{lizenzen} = $lizenzen;
119 $form->create_links("AR", \%myconfig, "customer");
121 if ($form->{all_customer}) {
122 unless ($form->{customer_id}) {
123 $form->{customer_id} = $form->{all_customer}->[0]->{id};
124 $form->{salesman_id} = $form->{all_customer}->[0]->{salesman_id};
128 if ($form->{payment_id}) {
129 $payment_id = $form->{payment_id};
131 if ($form->{language_id}) {
132 $language_id = $form->{language_id};
134 if ($form->{taxzone_id}) {
135 $taxzone_id = $form->{taxzone_id};
140 if ($form->{shipto_id}) {
141 $shipto_id = $form->{shipto_id};
144 $cp_id = $form->{cp_id};
145 IS->get_customer(\%myconfig, \%$form);
147 #quote all_customer Bug 133
148 foreach $ref (@{ $form->{all_customer} }) {
149 $ref->{name} = $form->quote($ref->{name});
154 IS->retrieve_invoice(\%myconfig, \%$form);
155 $form->{cp_id} = $cp_id;
158 $form->{payment_id} = $payment_id;
161 $form->{language_id} = $language_id;
164 $form->{taxzone_id} = $taxzone_id;
167 $form->{shipto_id} = $shipto_id;
171 @curr = split(/:/, $form->{currencies});
173 $form->{defaultcurrency} = $curr[0];
175 map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
177 $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
179 if (@{ $form->{all_customer} }) {
180 $form->{customer} = "$form->{customer}--$form->{customer_id}";
181 map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}\n" }
182 (@{ $form->{all_customer} });
186 if ($form->{all_departments}) {
187 $form->{selectdepartment} = "<option>\n";
188 $form->{department} = "$form->{department}--$form->{department_id}";
191 $form->{selectdepartment} .=
192 "<option>$_->{description}--$_->{id}\n"
193 } (@{ $form->{all_departments} });
196 $form->{employee} = "$form->{employee}--$form->{employee_id}";
199 if ($form->{all_employees}) {
200 $form->{selectemployee} = "";
201 map { $form->{selectemployee} .= "<option>$_->{name}--$_->{id}\n" }
202 (@{ $form->{all_employees} });
206 $form->{forex} = $form->{exchangerate};
207 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
209 foreach $key (keys %{ $form->{AR_links} }) {
210 foreach $ref (@{ $form->{AR_links}{$key} }) {
211 $form->{"select$key"} .= "<option>$ref->{accno}--$ref->{description}\n";
214 if ($key eq "AR_paid") {
215 for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
216 $form->{"AR_paid_$i"} =
217 "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
220 $form->{"paid_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
221 $form->{"datepaid_$i"} =
222 $form->{acc_trans}{$key}->[$i - 1]->{transdate};
223 $form->{"forex_$i"} = $form->{"exchangerate_$i"} =
224 $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
225 $form->{"source_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
226 $form->{"memo_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{memo};
228 $form->{paidaccounts} = $i;
232 "$form->{acc_trans}{$key}->[0]->{accno}--$form->{acc_trans}{$key}->[0]->{description}";
237 $form->{paidaccounts} = 1 unless (exists $form->{paidaccounts});
239 $form->{AR} = $form->{AR_1} unless $form->{id};
242 ($form->datetonum($form->{invdate}, \%myconfig) <=
243 $form->datetonum($form->{closedto}, \%myconfig));
245 $lxdebug->leave_sub();
248 sub prepare_invoice {
249 $lxdebug->enter_sub();
251 if ($form->{type} eq "credit_note") {
252 $form->{type} = "credit_note";
253 $form->{formname} = "credit_note";
255 $form->{type} = "invoice";
256 $form->{formname} = "invoice";
261 map { $form->{$_} =~ s/\"/"/g }
262 qw(invnumber ordnumber quonumber shippingpoint shipvia notes intnotes);
264 # # get pricegroups for parts
265 # IS->get_pricegroups_for_parts(\%myconfig, \%$form);
269 foreach $ref (@{ $form->{invoice_details} }) {
272 map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
273 $form->{"discount_$i"} =
274 $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
275 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
277 $decimalplaces = ($dec > 2) ? $dec : 2;
279 $form->{"sellprice_$i"} =
280 $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
283 (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
284 $dec_qty = length $dec_qty;
287 $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
289 map { $form->{"${_}_$i"} =~ s/\"/"/g }
290 qw(partnumber description unit partnotes);
291 $form->{rowcount} = $i;
295 $lxdebug->leave_sub();
299 $lxdebug->enter_sub();
303 if ($form->{type} eq "credit_note") {
304 $form->{title} = $locale->text('Edit Credit Note');
306 if ($form->{storno}) {
307 $form->{title} = $locale->text('Edit Storno Credit Note');
310 $form->{title} = $locale->text('Edit Sales Invoice');
312 if ($form->{storno}) {
313 $form->{title} = $locale->text('Edit Storno Invoice');
319 ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
321 $payment = qq|<option value=""></option>|;
322 foreach $item (@{ $form->{payment_terms} }) {
323 if ($form->{payment_id} eq $item->{id}) {
324 $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
326 $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
330 my $set_duedate_url =
331 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=set_duedate";
333 my $pjx = new CGI::Ajax( 'set_duedate' => $set_duedate_url );
334 push(@ { $form->{AJAX} }, $pjx);
336 if (@{ $form->{TAXZONE} }) {
337 $form->{selecttaxzone} = "";
338 foreach $item (@{ $form->{TAXZONE} }) {
339 if ($item->{id} == $form->{taxzone_id}) {
340 $form->{selecttaxzone} .=
341 "<option value=$item->{id} selected>" . H($item->{description}) .
344 $form->{selecttaxzone} .=
345 "<option value=$item->{id}>" . H($item->{description}) . "</option>";
350 $form->{selecttaxzone} =~ s/ selected//g;
351 if ($form->{taxzone_id} ne "") {
352 $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}/value=$form->{taxzone_id} selected/;
358 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
359 <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
360 <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
363 my @old_project_ids = ($form->{"globalproject_id"});
364 map({ push(@old_project_ids, $form->{"project_id_$_"})
365 if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
367 $form->get_lists("contacts" => "ALL_CONTACTS",
368 "shipto" => "ALL_SHIPTO",
369 "projects" => { "key" => "ALL_PROJECTS",
371 "old_id" => \@old_project_ids },
372 "employees" => "ALL_SALESMEN");
374 my (%labels, @values);
375 foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
376 push(@values, $item->{"cp_id"});
377 $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
378 ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
381 NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
382 '-labels' => \%labels, '-default' => $form->{"cp_id"}));
386 foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
387 push(@values, $item->{"shipto_id"});
388 $labels{$item->{"shipto_id"}} =
389 $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
393 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
395 NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
396 '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
401 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
402 push(@values, $item->{"id"});
403 $labels{$item->{"id"}} = $item->{"projectnumber"};
405 my $globalprojectnumber =
406 NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
407 '-labels' => \%labels,
408 '-default' => $form->{"globalproject_id"}));
412 foreach my $item (@{ $form->{ALL_SALESMEN} }) {
413 push(@values, $item->{id});
414 $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
419 <th align="right">| . $locale->text('Salesman') . qq|</th>
421 NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
422 '-values' => \@values, '-labels' => \%labels))
426 # set option selected
427 foreach $item (qw(AR customer currency department employee)) {
428 $form->{"select$item"} =~ s/ selected//;
429 $form->{"select$item"} =~
430 s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
433 #quote customer Bug 133
434 $form->{selectcustomer} = $form->quote($form->{selectcustomer});
436 if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
442 $form->{exchangerate} =
443 $form->format_amount(\%myconfig, $form->{exchangerate});
445 $form->{creditlimit} =
446 $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
447 $form->{creditremaining} =
448 $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
451 if ($form->{currency} ne $form->{defaultcurrency}) {
452 if ($form->{forex}) {
455 . $locale->text('Exchangerate')
456 . qq|</th><td>$form->{exchangerate}<input type=hidden name=exchangerate value=$form->{exchangerate}></td>|;
460 . $locale->text('Exchangerate')
461 . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
465 <input type=hidden name=forex value=$form->{forex}>
469 ($form->{selectcustomer})
470 ? qq|<select name=customer>$form->{selectcustomer}</select>\n<input type=hidden name="selectcustomer" value="$form->{selectcustomer}">|
471 : qq|<input name=customer value="$form->{customer}" size=35>|;
475 <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
476 <td colspan=3><select name=department>$form->{selectdepartment}</select>
477 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
480 | if $form->{selectdepartment};
482 $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
484 if ($form->{business}) {
487 <th align=right>| . $locale->text('Business') . qq|</th>
488 <td>$form->{business}</td>
489 <th align=right>| . $locale->text('Trade Discount') . qq|</th>
491 . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
497 if ($form->{max_dunning_level}) {
503 <th align=right>| . $locale->text('Max. Dunning Level') . qq|:</th>
504 <td><b>$form->{max_dunning_level}</b></td>
505 <th align=right>| . $locale->text('Dunning Amount') . qq|:</th>
507 . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
516 $form->{fokus} = "invoice.customer";
518 # use JavaScript Calendar or not
519 $form->{jsscript} = $jscalendar;
521 if ($form->{type} eq "credit_note") {
522 if ($form->{jsscript}) {
524 # with JavaScript Calendar
526 <td><input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>
527 <td><input type=button name=invdate id="trigger1" value=|
528 . $locale->text('button') . qq|></td>
533 Form->write_trigger(\%myconfig, "1",
538 # without JavaScript Calendar
540 qq|<td><input name=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>|;
542 qq|<td width="13"><input name=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
545 if ($form->{jsscript}) {
547 # with JavaScript Calendar
549 <td><input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>
550 <td><input type=button name=invdate id="trigger1" value=|
551 . $locale->text('button') . qq|></td>
554 <td width="13"><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
555 <td width="4"><input type=button name=duedate id="trigger2" value=|
556 . $locale->text('button') . qq|></td></td>
559 <td width="13"><input name=deliverydate id=deliverydate size=11 title="$myconfig{dateformat}" value=$form->{deliverydate}></td>
560 <td width="4"><input type=button name=deliverydate id="trigger3" value=|
561 . $locale->text('button') . qq|></td></td>
566 Form->write_trigger(\%myconfig, "3",
568 "trigger1", "duedate",
570 "deliverydate", "BL",
574 # without JavaScript Calendar
576 qq|<td><input name=invdate size=11 title="$myconfig{dateformat}" value=$form->{invdate}></td>|;
578 qq|<td width="13"><input name=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>|;
581 if ($form->{resubmit} && ($form->{format} eq "html")) {
583 qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()|;
584 } elsif ($form->{resubmit}) {
585 $onload = qq|document.invoice.submit()|;
590 $credittext = $locale->text('Credit Limit exceeded!!!');
591 if ($creditwarning) {
592 $onload = qq|alert('$credittext')|;
595 $form->{"javascript"} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
598 $form->write_trigger(\%myconfig, 2,
599 "orddate", "BL", "trigger_orddate",
600 "quodate", "BL", "trigger_quodate");
601 # show history button js
602 $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
603 #/show history button js
607 <body onLoad="$onload">
608 <script type="text/javascript" src="js/common.js"></script>
609 <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
610 <script type="text/javascript" src="js/vendor_selection.js"></script>
611 <script type="text/javascript" src="js/calculate_qty.js"></script>
613 <form method=post name="invoice" action=$form->{script}>
616 <input type=hidden name=id value=$form->{id}>
617 <input type=hidden name=action value=$form->{action}>
619 <input type=hidden name=type value=$form->{type}>
620 <input type=hidden name=media value=$form->{media}>
621 <input type=hidden name=format value=$form->{format}>
623 <input type=hidden name=queued value="$form->{queued}">
624 <input type=hidden name=printed value="$form->{printed}">
625 <input type=hidden name=emailed value="$form->{emailed}">
627 <input type=hidden name=title value="$form->{title}">
628 <input type=hidden name=vc value=$form->{vc}>
630 <input type=hidden name=discount value=$form->{discount}>
631 <input type=hidden name=creditlimit value=$form->{creditlimit}>
632 <input type=hidden name=creditremaining value=$form->{creditremaining}>
634 <input type=hidden name=tradediscount value=$form->{tradediscount}>
635 <input type=hidden name=business value=$form->{business}>
637 <input type=hidden name=closedto value=$form->{closedto}>
638 <input type=hidden name=locked value=$form->{locked}>
640 <input type=hidden name=shipped value=$form->{shipped}>
641 <input type=hidden name=lizenzen value=$lizenzen>
642 <input type=hidden name=storno value=$form->{storno}>
643 <input type=hidden name=storno_id value=$form->{storno_id}>
645 | . ($form->{saved_message} ? qq|<p>$form->{saved_message}</p>| : "") . qq|
649 <th class=listtop>$form->{title}</th>
659 <th align=right nowrap>| . $locale->text('Customer') . qq|</th>
660 <td colspan=3>$customer</td>
661 <input type=hidden name=customer_klass value=$form->{customer_klass}>
662 <input type=hidden name=customer_id value=$form->{customer_id}>
663 <input type=hidden name=oldcustomer value="$form->{oldcustomer}">
664 <th align=richt nowrap>|
665 . $locale->text('Contact Person') . qq|</th>
666 <td colspan=3>$contact</td>
673 <th nowrap>| . $locale->text('Credit Limit') . qq|</th>
674 <td>$form->{creditlimit}</td>
676 <th nowrap>| . $locale->text('Remaining') . qq|</th>
677 <td class="plus$n">$form->{creditremaining}</td>
686 <th align=right nowrap>| . $locale->text('Record in') . qq|</th>
687 <td colspan=3><select name=AR style="width:280px;">$form->{selectAR}</select></td>
688 <input type=hidden name=selectAR value="$form->{selectAR}">
693 <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
694 <td><select name=currency>$form->{selectcurrency}</select></td>
695 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
696 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
697 <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
698 <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
702 <th align=right nowrap>| . $locale->text('Shipping Point') . qq|</th>
703 <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
706 <th align=right nowrap>| . $locale->text('Ship via') . qq|</th>
707 <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
714 # <button type="button" onclick="delivery_customer_selection_window('delivery_customer_string','delivery_customer_id')">| . $locale->text('Choose Customer') . qq|</button>
716 # <td colspan=2><input type=hidden name=delivery_customer_id value="$form->{delivery_customer_id}">
717 # <input size=45 id=delivery_customer_string name=delivery_customer_string value="$form->{delivery_customer_string}"></td>
721 # <button type="button" onclick="vendor_selection_window('delivery_vendor_string','delivery_vendor_id')">| . $locale->text('Choose Vendor') . qq|</button>
723 # <td colspan=2><input type=hidden name=delivery_vendor_id value="$form->{delivery_vendor_id}">
724 # <input size=45 id=delivery_vendor_string name=delivery_vendor_string value="$form->{delivery_vendor_string}"></td>
734 <th align=right nowrap>| . $locale->text('Employee') . qq|</th>
735 <td colspan=2><select name=employee>$form->{selectemployee}</select></td>
736 <input type=hidden name=selectemployee value="$form->{selectemployee}">
741 if ($form->{type} eq "credit_note") {
743 <th align=right nowrap>| . $locale->text('Credit Note Number') . qq|</th>
744 <td><input name=invnumber size=11 value="$form->{invnumber}"></td>
747 <th align=right>| . $locale->text('Credit Note Date') . qq|</th>
752 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
753 <td><input name=invnumber size=11 value="$form->{invnumber}"></td>
756 <th align=right>| . $locale->text('Invoice Date') . qq|</th>
760 <th align=right>| . $locale->text('Due Date') . qq|</th>
764 <th align=right>| . $locale->text('Delivery Date') . qq|</th>
769 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
770 <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
773 <th align="right" nowrap>| . $locale->text('Order Date') . qq|</th>
774 <td><input name="orddate" id="orddate" size="11" title="$myconfig{dateformat}" value="| . Q($form->{orddate}) . qq|"></td>
775 <td><input type="button" name="b_orddate" id="trigger_orddate" value="?"></td>
778 <th align=right nowrap>| . $locale->text('Quotation Number') . qq|</th>
779 <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
782 <th align="right" nowrap>| . $locale->text('Quotation Date') . qq|</th>
783 <td><input name="quodate" id="quodate" size="11" title="$myconfig{dateformat}" value="| . Q($form->{quodate}) . qq|"></td>
784 <td><input type="button" name="b_quodate" id="trigger_quodate" value="?"></td>
787 <th align=right nowrap>| . $locale->text('Customer Order Number') . qq|</th>
788 <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
791 <th align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
792 <td>$globalprojectnumber</td>
807 <!-- shipto are in hidden variables -->
809 <input type=hidden name=shiptoname value="$form->{shiptoname}">
810 <input type=hidden name=shiptostreet value="$form->{shiptostreet}">
811 <input type=hidden name=shiptozipcode value="$form->{shiptozipcode}">
812 <input type=hidden name=shiptocity value="$form->{shiptocity}">
813 <input type=hidden name=shiptocountry value="$form->{shiptocountry}">
814 <input type=hidden name=shiptocontact value="$form->{shiptocontact}">
815 <input type=hidden name=shiptophone value="$form->{shiptophone}">
816 <input type=hidden name=shiptofax value="$form->{shiptofax}">
817 <input type=hidden name=shiptoemail value="$form->{shiptoemail}">
819 <!-- email variables -->
820 <input type=hidden name=message value="$form->{message}">
821 <input type=hidden name=email value="$form->{email}">
822 <input type=hidden name=subject value="$form->{subject}">
823 <input type=hidden name=cc value="$form->{cc}">
824 <input type=hidden name=bcc value="$form->{bcc}">
825 <input type=hidden name=webdav value=$webdav>
826 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
829 foreach $item (split / /, $form->{taxaccounts}) {
831 <input type=hidden name="${item}_rate" value="$form->{"${item}_rate"}">
832 <input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
833 <input type=hidden name="${item}_taxnumber" value="$form->{"${item}_taxnumber"}">
836 $lxdebug->leave_sub();
840 $lxdebug->enter_sub();
842 $form->{invtotal} = $form->{invsubtotal};
844 if (($rows = $form->numtextrows($form->{notes}, 26, 8)) < 2) {
847 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
850 $rows = ($rows > $introws) ? $rows : $introws;
852 qq|<textarea name=notes rows=$rows cols=26 wrap=soft>$form->{notes}</textarea>|;
854 qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
856 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
859 if ($form->{taxaccounts}) {
861 <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
862 . $locale->text('Tax Included') . qq|</b><br><br>|;
865 if (!$form->{taxincluded}) {
867 foreach $item (split / /, $form->{taxaccounts}) {
868 if ($form->{"${item}_base"}) {
869 $form->{"${item}_total"} =
871 $form->{"${item}_base"} * $form->{"${item}_rate"},
873 $form->{invtotal} += $form->{"${item}_total"};
874 $form->{"${item}_total"} =
875 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
879 <th align=right>$form->{"${item}_description"} |
880 . $form->{"${item}_rate"} * 100 .qq|%</th>
881 <td align=right>$form->{"${item}_total"}</td>
887 $form->{invsubtotal} =
888 $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
892 <th align=right>| . $locale->text('Subtotal') . qq|</th>
893 <td align=right>$form->{invsubtotal}</td>
899 if ($form->{taxincluded}) {
900 foreach $item (split / /, $form->{taxaccounts}) {
901 if ($form->{"${item}_base"}) {
902 $form->{"${item}_total"} =
904 ($form->{"${item}_base"} * $form->{"${item}_rate"} /
905 (1 + $form->{"${item}_rate"})
908 $form->{"${item}_netto"} =
910 ($form->{"${item}_base"} - $form->{"${item}_total"}),
912 $form->{"${item}_total"} =
913 $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
914 $form->{"${item}_netto"} =
915 $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
919 <th align=right>Enthaltene $form->{"${item}_description"} |
920 . $form->{"${item}_rate"} * 100 .qq|%</th>
921 <td align=right>$form->{"${item}_total"}</td>
924 <th align=right>Nettobetrag</th>
925 <td align=right>$form->{"${item}_netto"}</td>
933 $form->{oldinvtotal} = $form->{invtotal};
935 $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
945 <th align=left>| . $locale->text('Notes') . qq|</th>
946 <th align=left>| . $locale->text('Internal Notes') . qq|</th>
947 <th align=right>| . $locale->text('Payment Terms') . qq|</th>
952 <td><select name=payment_id onChange="if (this.value) set_duedate(['payment_id__' + this.value],['duedate'])">$payment
957 <td align=right width=100%>
963 <th align=right>| . $locale->text('Total') . qq|</th>
964 <td align=right>$form->{invtotal}</td>
976 <td><hr size=3 noshade></td>
979 <th class=listtop align=left>Dokumente im Webdav-Repository</th>
982 <td align=left width=30%><b>Dateiname</b></td>
983 <td align=left width=70%><b>Webdavlink</b></td>
985 foreach $file (keys %{ $form->{WEBDAV} }) {
988 <td align=left>$file</td>
989 <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
1000 if ($form->{type} eq "credit_note") {
1005 <tr class=listheading>
1006 <th colspan=6 class=listheading>|
1007 . $locale->text('Payments') . qq|</th>
1015 <tr class=listheading>
1016 <th colspan=6 class=listheading>|
1017 . $locale->text('Incoming Payments') . qq|</th>
1022 if ($form->{currency} eq $form->{defaultcurrency}) {
1023 @column_index = qw(datepaid source memo paid AR_paid);
1025 @column_index = qw(datepaid source memo paid exchangerate AR_paid);
1028 $column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
1029 $column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
1030 $column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
1031 $column_data{AR_paid} = "<th>" . $locale->text('Account') . "</th>";
1032 $column_data{source} = "<th>" . $locale->text('Source') . "</th>";
1033 $column_data{memo} = "<th>" . $locale->text('Memo') . "</th>";
1038 map { print "$column_data{$_}\n" } @column_index;
1045 $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
1046 for $i (1 .. $form->{paidaccounts}) {
1051 $form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
1052 $form->{"selectAR_paid_$i"} =~
1053 s/option>\Q$form->{"AR_paid_$i"}\E/option selected>$form->{"AR_paid_$i"}/;
1056 $totalpaid += $form->{"paid_$i"};
1057 if ($form->{"paid_$i"}) {
1058 $form->{"paid_$i"} =
1059 $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
1061 $form->{"exchangerate_$i"} =
1062 $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
1064 $exchangerate = qq| |;
1065 if ($form->{currency} ne $form->{defaultcurrency}) {
1066 if ($form->{"forex_$i"}) {
1068 qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
1071 qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
1075 $exchangerate .= qq|
1076 <input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
1079 $column_data{"paid_$i"} =
1080 qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
1081 $column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
1082 $column_data{"AR_paid_$i"} =
1083 qq|<td align=center><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
1084 $column_data{"datepaid_$i"} =
1085 qq|<td align=center><input id="datepaid_$i" name="datepaid_$i" size=11 title="$myconfig{dateformat}" value=$form->{"datepaid_$i"}>
1086 <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="?"></td>|;
1087 $column_data{"source_$i"} =
1088 qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
1089 $column_data{"memo_$i"} =
1090 qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
1092 map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
1095 push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
1099 <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
1100 <input type=hidden name=selectAR_paid value="$form->{selectAR_paid}">
1101 <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
1102 <input type=hidden name=oldtotalpaid value=$totalpaid>
1107 <td><hr size=3 noshade></td>
1121 $invdate = $form->datetonum($form->{invdate}, \%myconfig);
1122 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
1125 my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ar");
1128 <input class=submit type=submit accesskey="u" name=action id=update_button value="|
1129 . $locale->text('Update') . qq|">
1130 <input class=submit type=submit name=action value="|
1131 . $locale->text('Ship to') . qq|">
1132 <input class=submit type=submit name=action value="|
1133 . $locale->text('Print') . qq|">
1134 <input class=submit type=submit name=action value="|
1135 . $locale->text('E-mail') . qq|"> |;
1136 print qq|<input class=submit type=submit name=action value="|
1137 . $locale->text('Storno') . qq|"> | if ($show_storno);
1138 print qq|<input class=submit type=submit name=action value="|
1139 . $locale->text('Post Payment') . qq|">
1141 print qq|<input class=submit type=submit name=action value="|
1142 . $locale->text('Use As Template') . qq|">
1144 if ($form->{id} && !($form->{type} eq "credit_note")) {
1146 <input class=submit type=submit name=action value="|
1147 . $locale->text('Credit Note') . qq|">
1150 if ($form->{radier}) {
1152 <input class=submit type=submit name=action value="|
1153 . $locale->text('Delete') . qq|">
1158 if ($invdate > $closedto) {
1160 <input class=submit type=submit name=action value="|
1161 . $locale->text('Order') . qq|">
1166 if ($invdate > $closedto) {
1167 print qq|<input class=submit type=submit name=action id=update_button value="|
1168 . $locale->text('Update') . qq|">
1169 <input class=submit type=submit name=action value="|
1170 . $locale->text('Ship to') . qq|">
1171 <input class=submit type=submit name=action value="|
1172 . $locale->text('Preview') . qq|">
1173 <input class=submit type=submit name=action value="|
1174 . $locale->text('E-mail') . qq|">
1175 <input class=submit type=submit name=action value="|
1176 . $locale->text('Print and Post') . qq|">
1177 <input class=submit type=submit name=action value="|
1178 . $locale->text('Post') . qq|"> | .
1179 NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'),
1180 '-class' => 'submit'));
1184 # button for saving history
1185 if($form->{id} ne "") {
1187 <input type="button" class="submit" onclick="set_history_window(|
1189 . qq|);" name="history" id="history" value="|
1190 . $locale->text('history')
1193 # /button for saving history
1196 print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
1199 <input type=hidden name=rowcount value=$form->{rowcount}>
1201 <input name=callback type=hidden value="$form->{callback}">
1203 . $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
1204 . $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}])
1206 <input type=hidden name=path value=$form->{path}>
1207 <input type=hidden name=login value=$form->{login}>
1208 <input type=hidden name=password value=$form->{password}>
1217 $lxdebug->leave_sub();
1221 $lxdebug->enter_sub();
1223 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1224 qw(exchangerate creditlimit creditremaining);
1225 if ($form->{second_run}) {
1226 $form->{print_and_post} = 0;
1229 $form->{update} = 1;
1231 &check_name(customer);
1233 $form->{exchangerate} = $exchangerate
1237 $form->check_exchangerate(
1238 \%myconfig, $form->{currency}, $form->{invdate}, 'buy'
1241 for $i (1 .. $form->{paidaccounts}) {
1242 if ($form->{"paid_$i"}) {
1244 $form->{"${_}_$i"} =
1245 $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
1246 } qw(paid exchangerate);
1248 $form->{"exchangerate_$i"} = $exchangerate
1250 $form->{"forex_$i"} = (
1252 $form->check_exchangerate(
1253 \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'
1258 $i = $form->{rowcount};
1259 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
1261 # if last row empty, check the form otherwise retrieve new item
1262 if ( ($form->{"partnumber_$i"} eq "")
1263 && ($form->{"description_$i"} eq "")
1264 && ($form->{"partsgroup_$i"} eq "")) {
1266 $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
1271 IS->retrieve_item(\%myconfig, \%$form);
1273 $rows = scalar @{ $form->{item_list} };
1275 $form->{"discount_$i"} =
1276 $form->format_amount(\%myconfig, $form->{discount} * 100);
1279 $form->{"qty_$i"} = ($form->{"qty_$i"} * 1) ? $form->{"qty_$i"} : 1;
1288 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
1290 map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
1291 qw(partnumber description unit);
1292 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
1293 keys %{ $form->{item_list}[0] };
1294 if ($form->{"part_payment_id_$i"} ne "") {
1295 $form->{payment_id} = $form->{"part_payment_id_$i"};
1298 if ($form->{"not_discountable_$i"}) {
1299 $form->{"discount_$i"} = 0;
1302 $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
1303 ($dec) = ($s =~ /\.(\d+)/);
1305 $decimalplaces = ($dec > 2) ? $dec : 2;
1308 $form->{"sellprice_$i"} = $sellprice;
1311 # if there is an exchange rate adjust sellprice
1312 $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
1313 $form->{"sellprice_$i"} /= $exchangerate;
1316 $form->{"listprice_$i"} /= $exchangerate;
1319 $form->{"sellprice_$i"} * $form->{"qty_$i"} *
1320 (1 - $form->{"discount_$i"} / 100);
1321 map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
1322 map { $form->{"${_}_base"} += $amount }
1323 (split / /, $form->{"taxaccounts_$i"});
1324 map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
1325 split / /, $form->{"taxaccounts_$i"}
1326 if !$form->{taxincluded};
1328 $form->{creditremaining} -= $amount;
1331 $form->{"${_}_$i"} =
1332 $form->format_amount(\%myconfig, $form->{"${_}_$i"},
1334 } qw(sellprice listprice);
1337 $form->format_amount(\%myconfig, $form->{"qty_$i"});
1340 if ($form->{"inventory_accno_$i"} ne "") {
1341 $form->{"lizenzen_$i"} = qq|<option></option>|;
1342 foreach $item (@{ $form->{LIZENZEN}{ $form->{"id_$i"} } }) {
1343 $form->{"lizenzen_$i"} .=
1344 qq|<option value="$item->{"id"}">$item->{"licensenumber"}</option>|;
1346 $form->{"lizenzen_$i"} .=
1347 qq|<option value=-1>Neue Lizenz</option>|;
1351 # get pricegroups for parts
1352 IS->get_pricegroups_for_parts(\%myconfig, \%$form);
1354 # build up html code for prices_$i
1355 &set_pricegroup($i);
1362 # ok, so this is a new part
1363 # ask if it is a part or service item
1365 if ( $form->{"partsgroup_$i"}
1366 && ($form->{"partsnumber_$i"} eq "")
1367 && ($form->{"description_$i"} eq "")) {
1368 $form->{rowcount}--;
1369 $form->{"discount_$i"} = "";
1373 $form->{"id_$i"} = 0;
1374 $form->{"unit_$i"} = $locale->text('ea');
1381 $lxdebug->leave_sub();
1385 $lxdebug->enter_sub();
1386 for $i (1 .. $form->{paidaccounts}) {
1387 if ($form->{"paid_$i"}) {
1388 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
1390 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
1392 $form->error($locale->text('Cannot post payment for a closed period!'))
1393 if ($datepaid <= $closedto);
1395 if ($form->{currency} ne $form->{defaultcurrency}) {
1396 $form->{"exchangerate_$i"} = $form->{exchangerate}
1397 if ($invdate == $datepaid);
1398 $form->isblank("exchangerate_$i",
1399 $locale->text('Exchangerate for payment missing!'));
1404 ($form->{AR}) = split /--/, $form->{AR};
1405 ($form->{AR_paid}) = split /--/, $form->{AR_paid};
1407 $form->redirect($locale->text(' Payment posted!'))
1408 if (IS->post_payment(\%myconfig, \%$form));
1409 $form->error($locale->text('Cannot post payment!'));
1412 $lxdebug->leave_sub();
1416 $lxdebug->enter_sub();
1417 $form->isblank("invdate", $locale->text('Invoice Date missing!'));
1418 $form->isblank("customer", $locale->text('Customer missing!'));
1420 # if oldcustomer ne customer redo form
1421 if (&check_name(customer)) {
1425 if ($form->{second_run}) {
1426 $form->{print_and_post} = 0;
1431 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
1432 $invdate = $form->datetonum($form->{invdate}, \%myconfig);
1434 $form->error($locale->text('Cannot post invoice for a closed period!'))
1435 if ($invdate <= $closedto);
1437 $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1438 if ($form->{currency} ne $form->{defaultcurrency});
1440 for $i (1 .. $form->{paidaccounts}) {
1441 if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
1442 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
1444 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
1446 $form->error($locale->text('Cannot post payment for a closed period!'))
1447 if ($datepaid <= $closedto);
1449 if ($form->{currency} ne $form->{defaultcurrency}) {
1450 $form->{"exchangerate_$i"} = $form->{exchangerate}
1451 if ($invdate == $datepaid);
1452 $form->isblank("exchangerate_$i",
1453 $locale->text('Exchangerate for payment missing!'));
1458 ($form->{AR}) = split /--/, $form->{AR};
1459 ($form->{AR_paid}) = split /--/, $form->{AR_paid};
1461 $form->{label} = $locale->text('Invoice');
1463 $form->{id} = 0 if $form->{postasnew};
1465 # get new invnumber in sequence if no invnumber is given or if posasnew was requested
1466 if ($form->{postasnew}) {
1467 if ($form->{type} eq "credit_note") {
1468 undef($form->{cnnumber});
1470 undef($form->{invnumber});
1475 $form->error($locale->text('Cannot post invoice!'))
1476 unless IS->post_invoice(\%myconfig, \%$form);
1477 remove_draft() if $form->{remove_draft};
1479 if(!exists $form->{addition}) {
1480 $form->{addition} = $print_post ? "PRINTED AND POSTED" :
1481 $form->{storno} ? "STORNO" :
1483 $form->save_history($form->dbconnect(\%myconfig));
1486 $form->redirect( $form->{label} . " $form->{invnumber} " . $locale->text('posted!'))
1489 $lxdebug->leave_sub();
1492 sub print_and_post {
1493 $lxdebug->enter_sub();
1495 $old_form = new Form;
1497 $form->{print_and_post} = 1;
1501 $lxdebug->leave_sub();
1505 sub use_as_template {
1506 $lxdebug->enter_sub();
1508 map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
1509 $form->{paidaccounts} = 1;
1510 $form->{rowcount}--;
1511 $form->{invdate} = $form->current_date(\%myconfig);
1514 $lxdebug->leave_sub();
1518 $lxdebug->enter_sub();
1520 if ($form->{storno}) {
1521 $form->error($locale->text('Cannot storno storno invoice!'));
1524 if (IS->has_storno(\%myconfig, $form, "ar")) {
1525 $form->error($locale->text("Invoice has already been storno'd!"));
1528 map({ my $key = $_; delete($form->{$key})
1529 unless (grep({ $key eq $_ } qw(path login password id type))); }
1536 $form->{storno_id} = $form->{id};
1537 $form->{storno} = 1;
1539 $form->{invnumber} = "Storno zu " . $form->{invnumber};
1542 $lxdebug->leave_sub();
1547 $lxdebug->enter_sub();
1549 $form->{preview} = 1;
1550 $old_form = new Form;
1551 for (keys %$form) { $old_form->{$_} = $form->{$_} }
1552 $old_form->{rowcount}++;
1554 &print_form($old_form);
1555 $lxdebug->leave_sub();
1560 $lxdebug->enter_sub();
1561 if ($form->{second_run}) {
1562 $form->{print_and_post} = 0;
1569 <form method=post action=$form->{script}>
1572 # delete action variable
1573 map { delete $form->{$_} } qw(action header);
1575 foreach $key (keys %$form) {
1576 $form->{$key} =~ s/\"/"/g;
1577 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1581 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
1584 . $locale->text('Are you sure you want to delete Invoice Number')
1585 . qq| $form->{invnumber}
1589 <input name=action class=submit type=submit value="|
1590 . $locale->text('Yes') . qq|">
1594 $lxdebug->leave_sub();
1598 $lxdebug->enter_sub();
1600 $form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
1602 $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
1605 $form->{rowcount}--;
1606 $form->{shipto} = 1;
1609 $form->{title} = $locale->text('Add Credit Note');
1610 $form->{script} = 'is.pl';
1615 # bo creates the id, reset it
1616 map { delete $form->{$_} }
1617 qw(id invnumber subject message cc bcc printed emailed queued);
1618 $form->{ $form->{vc} } =~ s/--.*//g;
1619 $form->{type} = "credit_note";
1622 map { $form->{"select$_"} = "" } ($form->{vc}, currency);
1624 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1625 qw(creditlimit creditremaining);
1627 $currency = $form->{currency};
1630 $form->{currency} = $currency;
1631 $form->{exchangerate} = "";
1632 $form->{forex} = "";
1633 $form->{exchangerate} = $exchangerate
1637 $form->check_exchangerate(
1638 \%myconfig, $form->{currency}, $form->{invdate}, $buysell
1641 $form->{creditremaining} -= ($form->{oldinvtotal} - $form->{ordtotal});
1648 $lxdebug->leave_sub();
1652 $lxdebug->enter_sub();
1653 if (IS->delete_invoice(\%myconfig, \%$form, $spool)) {
1654 # saving the history
1655 if(!exists $form->{addition}) {
1656 $form->{addition} = "DELETED";
1657 $form->save_history($form->dbconnect(\%myconfig));
1659 # /saving the history
1660 $form->redirect($locale->text('Invoice deleted!'));
1662 $form->error($locale->text('Cannot delete invoice!'));
1664 $lxdebug->leave_sub();
1668 $lxdebug->enter_sub();
1676 $lxdebug->leave_sub();