1 #=====================================================================
2 # SQL-Ledger, Accounting
5 # Author: Dieter Simader
6 # Email: dsimader@sql-ledger.org
7 # Web: http://www.sql-ledger.org
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #======================================================================
24 # Inventory received module
26 #======================================================================
32 require "$form->{path}/io.pl";
33 require "$form->{path}/arap.pl";
42 $form->{title} = $locale->text('Add Vendor Invoice');
44 $form->{callback} = "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}" unless $form->{callback};
54 $form->{title} = $locale->text('Edit Vendor Invoice');
65 $form->{vc} = "vendor";
68 $form->create_links("AP", \%myconfig, "vendor");
71 @curr = split /:/, $form->{currencies};
73 $form->{defaultcurrency} = $curr[0];
75 map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
77 if ($form->{all_vendor}) {
78 unless ($form->{vendor_id}) {
79 $form->{vendor_id} = $form->{all_vendor}->[0]->{id};
83 IR->get_vendor(\%myconfig, \%$form);
84 delete $form->{notes};
85 IR->retrieve_invoice(\%myconfig, \%$form);
87 $form->{oldlanguage_code} = $form->{language_code};
89 $form->get_partsgroup(\%myconfig, { language_code => $form->{language_code} });
90 if (@ { $form->{all_partsgroup} }) {
91 $form->{selectpartsgroup} = "<option>\n";
92 foreach $ref (@ { $form->{all_partsgroup} }) {
93 if ($ref->{translation}) {
94 $form->{selectpartsgroup} .= qq|<option value="$ref->{partsgroup}--$ref->{id}">$ref->{translation}\n|;
96 $form->{selectpartsgroup} .= qq|<option value="$ref->{partsgroup}--$ref->{id}">$ref->{partsgroup}\n|;
101 if (@{ $form->{all_projects} }) {
102 $form->{selectprojectnumber} = "<option>\n";
103 map { $form->{selectprojectnumber} .= qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n| } @{ $form->{all_projects} };
106 $form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
107 $form->{oldtransdate} = $form->{transdate};
110 if ($form->{all_vendor}) {
111 $form->{vendor} = "$form->{vendor}--$form->{vendor_id}";
112 map { $form->{selectvendor} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| } (@{ $form->{all_vendor} });
116 if ($form->{all_departments}) {
117 $form->{selectdepartment} = "<option>\n";
118 $form->{department} = "$form->{department}--$form->{department_id}";
120 map { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| } (@{ $form->{all_departments} });
123 if (@{ $form->{all_languages} }) {
124 $form->{selectlanguage} = "<option>\n";
125 map { $form->{selectlanguage} .= qq|<option value="$_->{code}">$_->{description}\n| } @{ $form->{all_languages} };
129 $form->{forex} = $form->{exchangerate};
130 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
132 foreach $key (keys %{ $form->{AP_links} }) {
134 foreach $ref (@{ $form->{AP_links}{$key} }) {
135 $form->{"select$key"} .= "<option>$ref->{accno}--$ref->{description}\n";
138 if ($key eq "AP_paid") {
139 for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
140 $form->{"AP_paid_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
142 $form->{"paid_$i"} = $form->{acc_trans}{$key}->[$i-1]->{amount};
143 $form->{"datepaid_$i"} = $form->{acc_trans}{$key}->[$i-1]->{transdate};
144 $form->{"forex_$i"} = $form->{"exchangerate_$i"} = $form->{acc_trans}{$key}->[$i-1]->{exchangerate};
145 $form->{"source_$i"} = $form->{acc_trans}{$key}->[$i-1]->{source};
146 $form->{"memo_$i"} = $form->{acc_trans}{$key}->[$i-1]->{memo};
148 $form->{paidaccounts} = $i;
151 $form->{$key} = "$form->{acc_trans}{$key}->[0]->{accno}--$form->{acc_trans}{$key}->[0]->{description}";
156 $form->{paidaccounts} = 1 unless (exists $form->{paidaccounts});
158 $form->{AP} = $form->{AP_1} unless $form->{id};
160 $form->{locked} = ($form->{revtrans}) ? '1' : ($form->datetonum($form->{transdate}, \%myconfig) <= $form->datetonum($form->{closedto}, \%myconfig));
162 $form->{readonly} = 1 if $myconfig{acs} =~ /AP--Vendor Invoice/;
168 sub prepare_invoice {
170 $form->{type} = "invoice";
171 $form->{oldcurrency} = $form->{currency};
175 map { $form->{$_} = $form->quote($form->{$_}) } qw(invnumber ordnumber quonumber);
177 foreach $ref (@{ $form->{invoice_details} }) {
179 map { $form->{"${_}_$i"} = $ref->{$_} } keys %{ $ref };
181 $form->{"projectnumber_$i"} = qq|$ref->{projectnumber}--$ref->{project_id}|;
182 $form->{"partsgroup_$i"} = qq|$ref->{partsgroup}--$ref->{partsgroup_id}|;
184 $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
186 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
188 $decimalplaces = ($dec > 2) ? $dec : 2;
190 $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
191 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
192 $form->{"oldqty_$i"} = $form->{"qty_$i"};
194 map { $form->{"${_}_$i"} = $form->quote($form->{"${_}_$i"}) } qw(partnumber sku description unit);
196 $form->{rowcount} = $i;
206 # set option selected
207 foreach $item (qw(AP currency)) {
208 $form->{"select$item"} =~ s/ selected//;
209 $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
212 foreach $item (qw(vendor department)) {
213 $form->{"select$item"} = $form->unescape($form->{"select$item"});
214 $form->{"select$item"} =~ s/ selected//;
215 $form->{"select$item"} =~ s/(<option value="\Q$form->{$item}\E")/$1 selected/;
218 if ($form->{selectlanguage}) {
219 $form->{"selectlanguage"} = $form->unescape($form->{"selectlanguage"});
220 $form->{"selectlanguage"} =~ s/ selected//;
221 $form->{"selectlanguage"} =~ s/(<option value="\Q$form->{language_code}\E")/$1 selected/;
225 <th align=right nowrap>|.$locale->text('Language').qq|</th>
226 <td><select name=language_code>$form->{selectlanguage}</select></td>
227 <input type=hidden name=oldlanguage_code value=$form->{oldlanguage_code}>
228 <input type=hidden name="selectlanguage" value="|.
229 $form->escape($form->{selectlanguage},1).qq|">
236 $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate});
239 if ($form->{currency} ne $form->{defaultcurrency}) {
240 if ($form->{forex}) {
242 <th align=right nowrap>|.$locale->text('Exchange Rate').qq|</th>
243 <td>$form->{exchangerate}<input type=hidden name=exchangerate value=$form->{exchangerate}></td>
247 <th align=right nowrap>|.$locale->text('Exchange Rate').qq|</th>
248 <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
253 <input type=hidden name=forex value=$form->{forex}>
256 if ($form->{selectvendor}) {
257 $vendor = qq|<select name=vendor>$form->{selectvendor}</select>
258 <input type=hidden name="selectvendor" value="|.
259 $form->escape($form->{selectvendor},1).qq|">|;
261 $vendor = qq|<input name=vendor value="$form->{vendor}" size=35>|;
266 <th align="right" nowrap>|.$locale->text('Department').qq|</th>
267 <td colspan=3><select name=department>$form->{selectdepartment}</select>
268 <input type=hidden name=selectdepartment value="|.
269 $form->escape($form->{selectdepartment},1).qq|">
272 | if $form->{selectdepartment};
274 $n = ($form->{creditremaining} < 0) ? "0" : "1";
282 <form method=post action="$form->{script}#end">
284 <input type=hidden name=id value=$form->{id}>
285 <input type=hidden name=title value="$form->{title}">
286 <input type=hidden name=vc value="vendor">
287 <input type=hidden name=type value=$form->{type}>
289 <input type=hidden name=terms value=$form->{terms}>
291 <input type=hidden name=creditlimit value=$form->{creditlimit}>
292 <input type=hidden name=creditremaining value=$form->{creditremaining}>
294 <input type=hidden name=closedto value=$form->{closedto}>
295 <input type=hidden name=locked value=$form->{locked}>
297 <input type=hidden name=shipped value=$form->{shipped}>
299 <input type=hidden name=oldtransdate value=$form->{oldtransdate}>
303 <th>$form->{title}</th>
313 <th align=right nowrap>|.$locale->text('Vendor').qq|</th>
314 <td colspan=3>$vendor</td>
316 <input type=hidden name=vendor_id value=$form->{vendor_id}>
317 <input type=hidden name=oldvendor value="$form->{oldvendor}">
325 <th nowrap>|.$locale->text('Credit Limit').qq|</th>
326 <td>|.$form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0").qq|</td>
328 <th nowrap>|.$locale->text('Remaining').qq|</th>
329 <td class="plus$n" nowrap>|.$form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0").qq|</td>
334 <th align=right>|.$locale->text('Record in').qq|</th>
335 <td colspan=3><select name=AP>$form->{selectAP}</select></td>
336 <input type=hidden name=selectAP value="$form->{selectAP}">
340 <th align=right nowrap>|.$locale->text('Currency').qq|</th>
341 <td><select name=currency>$form->{selectcurrency}</select></td>
349 <th align=right nowrap>|.$locale->text('Invoice Number').qq|</th>
350 <td><input name=invnumber size=20 value="$form->{invnumber}"></td>
353 <th align=right nowrap>|.$locale->text('Order Number').qq|</th>
354 <td><input name=ordnumber size=20 value="$form->{ordnumber}"></td>
355 <input type=hidden name=quonumber value="$form->{quonumber}">
358 <th align=right nowrap>|.$locale->text('Invoice Date').qq|</th>
359 <td><input name=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
362 <th align=right nowrap>|.$locale->text('Due Date').qq|</th>
363 <td><input name=duedate size=11 title="$myconfig{dateformat}" value=$form->{duedate}></td>
372 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
373 <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
374 <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
375 <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
377 <input type=hidden name=taxpart value="$form->{taxpart}">
378 <input type=hidden name=taxservice value="$form->{taxservice}">
380 <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
383 foreach $item (split / /, $form->{taxaccounts}) {
385 <input type=hidden name="${item}_rate" value=$form->{"${item}_rate"}>
386 <input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
396 $form->{invtotal} = $form->{invsubtotal};
398 if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
401 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
404 $rows = ($rows > $introws) ? $rows : $introws;
405 $notes = qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
406 $intnotes = qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
408 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
411 if ($form->{taxaccounts}) {
413 <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|.$locale->text('Tax Included').qq|</b>
417 if (!$form->{taxincluded}) {
419 foreach $item (split / /, $form->{taxaccounts}) {
420 if ($form->{"${item}_base"}) {
421 $form->{invtotal} += $form->{"${item}_total"} = $form->round_amount($form->{"${item}_base"} * $form->{"${item}_rate"}, 2);
422 $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
426 <th align=right>$form->{"${item}_description"}</th>
427 <td align=right>$form->{"${item}_total"}</td>
433 $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
437 <th align=right>|.$locale->text('Subtotal').qq|</th>
438 <td align=right>$form->{invsubtotal}</td>
445 $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
455 <th align=left>|.$locale->text('Notes').qq|</th>
456 <th align=left>|.$locale->text('Internal Notes').qq|</th>
471 <th align=right>|.$locale->text('Total').qq|</th>
472 <td align=right>$form->{invtotal}</td>
484 <th colspan=6 class=listheading>|.$locale->text('Payments').qq|</th>
488 if ($form->{currency} eq $form->{defaultcurrency}) {
489 @column_index = qw(datepaid source memo paid AP_paid);
491 @column_index = qw(datepaid source memo paid exchangerate AP_paid);
494 $column_data{datepaid} = "<th>".$locale->text('Date')."</th>";
495 $column_data{paid} = "<th>".$locale->text('Amount')."</th>";
496 $column_data{exchangerate} = "<th>".$locale->text('Exch')."</th>";
497 $column_data{AP_paid} = "<th>".$locale->text('Account')."</th>";
498 $column_data{source} = "<th>".$locale->text('Source')."</th>";
499 $column_data{memo} = "<th>".$locale->text('Memo')."</th>";
504 map { print "$column_data{$_}\n" } @column_index;
509 $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
510 for $i (1 .. $form->{paidaccounts}) {
516 $form->{"selectAP_paid_$i"} = $form->{selectAP_paid};
517 $form->{"selectAP_paid_$i"} =~ s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/;
520 $form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
521 $form->{"exchangerate_$i"} = $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
523 $exchangerate = qq| |;
524 if ($form->{currency} ne $form->{defaultcurrency}) {
525 if ($form->{"forex_$i"}) {
526 $exchangerate = qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
528 $exchangerate = qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
532 <input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
535 $column_data{"paid_$i"} = qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
536 $column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
537 $column_data{"AP_paid_$i"} = qq|<td align=center><select name="AP_paid_$i">$form->{"selectAP_paid_$i"}</select></td>|;
538 $column_data{"datepaid_$i"} = qq|<td align=center><input name="datepaid_$i" size=11 title="$myconfig{dateformat}" value=$form->{"datepaid_$i"}></td>|;
539 $column_data{"source_$i"} = qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
540 $column_data{"memo_$i"} = qq|<td align=center><input name="memo_$i" size=11 value=$form->{"memo_$i"}></td>|;
542 map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
550 <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
551 <input type=hidden name=selectAP_paid value="$form->{selectAP_paid}">
556 <td><hr size=3 noshade></td>
562 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
563 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
565 if (! $form->{readonly}) {
567 print qq|<input class=submit type=submit name=action value="|.$locale->text('Update').qq|">
570 if (!$form->{locked}) {
572 <input class=submit type=submit name=action value="|.$locale->text('Post').qq|">
573 <input class=submit type=submit name=action value="|.$locale->text('Delete').qq|">
578 <input class=submit type=submit name=action value="|.$locale->text('Post as new').qq|">
579 <input class=submit type=submit name=action value="|.$locale->text('Purchase Order').qq|">
583 if ($transdate > $closedto) {
584 print qq|<input class=submit type=submit name=action value="|.$locale->text('Update').qq|">
585 <input class=submit type=submit name=action value="|.$locale->text('Post').qq|">|;
590 if ($form->{menubar}) {
591 require "$form->{path}/menu.pl";
597 <input type=hidden name=rowcount value=$form->{rowcount}>
599 <input name=callback type=hidden value="$form->{callback}">
601 <input type=hidden name=path value=$form->{path}>
602 <input type=hidden name=login value=$form->{login}>
603 <input type=hidden name=sessionid value=$form->{sessionid}>
619 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate);
623 if ($form->{transdate} ne $form->{oldtransdate}) {
624 $form->{duedate} = $form->current_date(\%myconfig, $form->{transdate}, $form->{terms} * 1);
625 $form->{oldtransdate} = $form->{transdate};
629 $form->{exchangerate} = $exchangerate if ($form->{forex} = ($exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, 'sell')));
632 for $i (1 .. $form->{paidaccounts}) {
633 if ($form->{"paid_$i"}) {
634 map { $form->{"${_}_$j"} = $form->{"${_}_$i"} } qw(datepaid source memo);
635 map { $form->{"${_}_$j"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(paid exchangerate);
637 $form->{"exchangerate_$j"} = $exchangerate if ($form->{"forex_$j"} = ($exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$j"}, 'sell')));
638 map { delete $form->{"${_}_$i"} } qw(datepaid source memo paid exchangerate forex) if $j != $i;
640 map { delete $form->{"${_}_$i"} } qw(datepaid source memo paid exchangerate forex);
642 $form->{paidaccounts} = $j;
645 $i = $form->{rowcount};
646 $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
648 foreach $item (qw(partsgroup projectnumber)) {
649 $form->{"select$item"} = $form->unescape($form->{"select$item"}) if $form->{"select$item"};
652 if (($form->{"partnumber_$i"} eq "") && ($form->{"description_$i"} eq "") && ($form->{"partsgroup_$i"} eq "")) {
658 $form->{transdate} = $form->{oldtransdate};
659 IR->retrieve_item(\%myconfig, \%$form);
661 my $rows = scalar @{ $form->{item_list} };
664 $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
672 # override sellprice if there is one entered
673 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
675 map { $form->{item_list}[$i]{$_} = $form->quote($form->{item_list}[$i]{$_}) } qw(partnumber description unit);
677 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] };
679 $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
681 ($dec) = ($s =~ /\.(\d+)/);
683 $decimalplaces = ($dec > 2) ? $dec : 2;
686 $form->{"sellprice_$i"} = $sellprice;
688 # if there is an exchange rate adjust sellprice
689 $form->{"sellprice_$i"} /= $exchangerate;
692 $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
693 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
699 # ok, so this is a new part
700 # ask if it is a part or service item
702 if ($form->{"partsgroup_$i"} && ($form->{"partsnumber_$i"} eq "") && ($form->{"description_$i"} eq "")) {
704 $form->{"discount_$i"} = "";
708 $form->{"id_$i"} = 0;
709 $form->{"unit_$i"} = $locale->text('ea');
722 $form->isblank("transdate", $locale->text('Invoice Date missing!'));
723 $form->isblank("vendor", $locale->text('Vendor missing!'));
725 # if the vendor changed get new values
726 if (&check_name(vendor)) {
733 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
734 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
736 $form->error($locale->text('Cannot post invoice for a closed period!')) if ($transdate <= $closedto);
738 $form->isblank("exchangerate", $locale->text('Exchange rate missing!')) if ($form->{currency} ne $form->{defaultcurrency});
740 for $i (1 .. $form->{paidaccounts}) {
741 if ($form->{"paid_$i"}) {
742 $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
744 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
746 $form->error($locale->text('Cannot post payment for a closed period!')) if ($datepaid <= $closedto);
748 if ($form->{currency} ne $form->{defaultcurrency}) {
749 $form->{"exchangerate_$i"} = $form->{exchangerate} if ($transdate == $datepaid);
750 $form->isblank("exchangerate_$i", $locale->text('Exchange rate for payment missing!'));
756 ($form->{AP}) = split /--/, $form->{AP};
757 ($form->{AP_paid}) = split /--/, $form->{AP_paid};
759 $form->{id} = 0 if $form->{postasnew};
761 $form->{invnumber} = $form->update_defaults(\%myconfig, "vinumber") unless $form->{invnumber};
763 $form->redirect($locale->text('Invoice')." $form->{invnumber} ".$locale->text('posted!')) if (IR->post_invoice(\%myconfig, \%$form));
764 $form->error($locale->text('Cannot post invoice!'));
777 <form method=post action=$form->{script}>
780 # delete action variable
781 map { delete $form->{$_} } qw(action header);
786 <h2 class=confirm>|.$locale->text('Confirm!').qq|</h2>
788 <h4>|.$locale->text('Are you sure you want to delete Invoice Number').qq| $form->{invnumber}</h4>
790 <input name=action class=submit type=submit value="|.$locale->text('Yes').qq|">
801 $form->redirect($locale->text('Invoice deleted!')) if (IR->delete_invoice(\%myconfig, \%$form));
802 $form->error($locale->text('Cannot delete invoice!'));