Merge von 704,707,730,731 aus unstable: USTVA Bugfix
[kivitendo-erp.git] / bin / mozilla / am.pl
1 #=====================================================================
2 # LX-Office ERP
3 # Copyright (C) 2004
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
6 #
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
10 #
11 #  Author: Dieter Simader
12 #   Email: dsimader@sql-ledger.org
13 #     Web: http://www.sql-ledger.org
14 #
15 #
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.
20 #
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 #======================================================================
29 #
30 # administration
31 #
32 #======================================================================
33
34 use SL::AM;
35 use SL::CA;
36 use SL::Form;
37 use SL::User;
38
39 1;
40
41 # end of main
42
43 sub add    { &{"add_$form->{type}"} }
44 sub edit   { &{"edit_$form->{type}"} }
45 sub save   { &{"save_$form->{type}"} }
46 sub delete { &{"delete_$form->{type}"} }
47
48 sub add_account {
49   $lxdebug->enter_sub();
50
51   $form->{title}     = "Add";
52   $form->{charttype} = "A";
53   AM->get_account(\%myconfig, \%$form);
54
55   $form->{callback} =
56     "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
57     unless $form->{callback};
58
59   &account_header;
60   &form_footer;
61
62   $lxdebug->leave_sub();
63 }
64
65 sub edit_account {
66   $lxdebug->enter_sub();
67
68   $form->{title} = "Edit";
69   AM->get_account(\%myconfig, \%$form);
70
71   foreach my $item (split(/:/, $form->{link})) {
72     $form->{$item} = "checked";
73   }
74
75   &account_header;
76   &form_footer;
77
78   $lxdebug->leave_sub();
79 }
80
81 sub account_header {
82   $lxdebug->enter_sub();
83
84   $form->{title} = $locale->text("$form->{title} Account");
85
86   $checked{ $form->{charttype} } = "checked";
87   $checked{"$form->{category}_"} = "checked";
88   $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
89
90   $form->{description} =~ s/\"/"/g;
91
92   if (@{ $form->{TAXKEY} }) {
93     $form->{selecttaxkey} = "<option value=0>Keine Steuer 0%\n";
94     foreach $item (@{ $form->{TAXKEY} }) {
95       if ($item->{taxkey} == $form->{taxkey_id}) {
96         $form->{selecttaxkey} .=
97           "<option value=$item->{taxkey} selected>$item->{taxdescription}\n";
98       } else {
99         $form->{selecttaxkey} .=
100           "<option value=$item->{taxkey}>$item->{taxdescription}\n";
101       }
102
103     }
104   }
105
106   $taxkey = qq|
107               <tr>
108                 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
109                 <td><select name=taxkey_id>$form->{selecttaxkey}</select></td>
110                 <input type=hidden name=selecttaxkey value="$form->{selecttaxkey}">
111               </tr>|;
112
113   $form->{selectustva} = "<option>\n";
114   %ustva = (41  => "Steuerfrei IGL a. Abnehmer m. UStID (§4 Nr. 1b UStG), Nr. 41",
115             44  => "Steuerfrei IGL n. Fahrz. o. UStID (§4 Nr. 1b UStG), Nr. 44",
116             49  => "Steuerfrei IGL n. Fahrz. a. Unternehmen (§2a UStG), Nr. 49",
117             43  => "Weit Steuerfreie Umsätze m. VSt Abzug (Ausfuhr, Umsätze §4 Nr.2-7 UStG), Nr. 43",
118             48  => "Steuerfreie Umsätze ohne VSt.abzug (§4 Nr.8-28 UStG), Nr. 48",
119             51  => "Steuerpflichtige Umsätze 16%, Nr. 51",
120             511 => "Steuerpflichtige Umsätze 16%, Nr. 51 rechts",
121             86  => "Steuerpflichtige Umsätze 7%, Nr. 86",
122             861 => "Steuerpflichtige Umsätze 7%, Nr. 86 rechts",
123             35  => "Nr. 35",
124             77  => "Nr. 77",
125             76  => "Nr. 76",
126             80  => "Nr. 80",
127             91  => "Steuerfrei, Nr. 91",
128             97  => "Steuerpflichtig 16%, Nr. 97",
129             971 => "Steuerpflichtig 16%, Nr. 97 rechts",
130             93  => "Steuerpflichtig 7%, Nr. 93",
131             931 => "Steuerpflichtig 7%, Nr. 93 rechts",
132             95  => "Nr. 95",
133             94  => "Steuerpflichtig 16%, Nr. 94",            
134             96  => "Nr. 96",
135             42  => "Nr. 42",
136             60  => "Nr. 60",
137             45  => "Nr. 45",
138             52  => "Nr. 52",
139             53  => "Nr. 53",
140             73  => "Nr. 73",
141             74  => "Nr. 74",
142             84  => "Nr. 84",
143             85  => "Nr. 85",
144             65  => "Nr. 65",
145             66  => "Abziehbare Vorsteuerbeträge, Nr. 66",
146             61  => "Nr. 61",
147             62  => "Nr. 62",
148             67  => "Nr. 67",
149             63  => "Nr. 63",
150             64  => "Nr. 64",
151             59  => "Nr. 59",
152             69  => "Nr. 69",
153             39  => "Nr. 39");
154   foreach $item (sort({ $a <=> $b } keys %ustva)) {
155     if ($item == $form->{pos_ustva}) {
156       $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
157     } else {
158       $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
159     }
160
161   }
162
163   $ustva = qq|
164               <tr>
165                 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
166                 <td><select name=pos_ustva>$form->{selectustva}</select></td>
167                 <input type=hidden name=selectustva value="$form->{selectustva}">
168               </tr>|;
169
170   $form->{selecteur} = "<option>\n";
171   %eur = (1  => "Umsatzerlöse",
172           2  => "sonstige Erlöse",
173           3  => "Privatanteile",
174           4  => "Zinserträge",
175           5  => "Ausserordentliche Erträge",
176           6  => "Vereinnahmte Umsatzst.",
177           7  => "Umsatzsteuererstattungen",
178           8  => "Wareneingänge",
179           9  => "Löhne und Gehälter",
180           10 => "Gesetzl. sozialer Aufw.",
181           11 => "Mieten",
182           12 => "Gas, Strom, Wasser",
183           13 => "Instandhaltung",
184           14 => "Steuern, Versich., Beiträge",
185           15 => "Kfz-Steuern",
186           16 => "Kfz-Versicherungen",
187           17 => "Sonst. Fahrtkosten",
188           18 => "Werbe- und Reisekosten",
189           19 => "Instandhaltung u. Werkzeuge",
190           20 => "Fachzeitschriften, Bücher",
191           21 => "Miete für Einrichtungen",
192           22 => "Rechts- und Beratungskosten",
193           23 => "Bürobedarf, Porto, Telefon",
194           24 => "Sonstige Aufwendungen",
195           25 => "Abschreibungen auf Anlagever.",
196           26 => "Abschreibungen auf GWG",
197           27 => "Vorsteuer",
198           28 => "Umsatzsteuerzahlungen",
199           29 => "Zinsaufwand",
200           30 => "Ausserordentlicher Aufwand",
201           31 => "Betriebliche Steuern");
202   foreach $item (sort({ $a <=> $b } keys(%eur))) {
203     if ($item == $form->{pos_eur}) {
204       $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
205     } else {
206       $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
207     }
208
209   }
210
211   $eur = qq|
212               <tr>
213                 <th align=right>| . $locale->text('EÜR') . qq|</th>
214                 <td><select name=pos_eur>$form->{selecteur}</select></td>
215                 <input type=hidden name=selecteur value="$form->{selecteur}">
216               </tr>|;
217
218   $form->{selectbwa} = "<option>\n";
219
220   %bwapos = (1  => 'Umsatzerlöse',
221              2  => 'Best.Verdg.FE/UE',
222              3  => 'Aktiv.Eigenleistung',
223              4  => 'Mat./Wareneinkauf',
224              5  => 'So.betr.Erlöse',
225              10 => 'Personalkosten',
226              11 => 'Raumkosten',
227              12 => 'Betriebl.Steuern',
228              13 => 'Vers./Beiträge',
229              14 => 'Kfz.Kosten o.St.',
230              15 => 'Werbe-Reisek.',
231              16 => 'Kosten Warenabgabe',
232              17 => 'Abschreibungen',
233              18 => 'Rep./instandhlt.',
234              19 => 'Übrige Steuern',
235              20 => 'Sonst.Kosten',
236              30 => 'Zinsauwand',
237              31 => 'Sonst.neutr.Aufw.',
238              32 => 'Zinserträge',
239              33 => 'Sonst.neutr.Ertrag',
240              34 => 'Verr.kalk.Kosten',
241              35 => 'Steuern Eink.u.Ertr.');
242   foreach $item (sort({ $a <=> $b } keys %bwapos)) {
243     if ($item == $form->{pos_bwa}) {
244       $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
245     } else {
246       $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
247     }
248
249   }
250
251   $bwa = qq|
252               <tr>
253                 <th align=right>| . $locale->text('BWA') . qq|</th>
254                 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
255                 <input type=hidden name=selectbwa value="$form->{selectbwa}">
256               </tr>|;
257
258   $form->{selectbilanz} = "<option>\n";
259   foreach $item ((1, 2, 3, 4)) {
260     if ($item == $form->{pos_bilanz}) {
261       $form->{selectbilanz} .= "<option value=$item selected>$item\n";
262     } else {
263       $form->{selectbilanz} .= "<option value=$item>$item\n";
264     }
265
266   }
267
268   $bilanz = qq|
269               <tr>
270                 <th align=right>| . $locale->text('Bilanz') . qq|</th>
271                 <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
272                 <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
273               </tr>|;
274
275   # this is for our parser only!
276   # type=submit $locale->text('Add Account')
277   # type=submit $locale->text('Edit Account')
278
279   $form->header;
280
281   print qq|
282 <body>
283
284 <form method=post action=$form->{script}>
285
286 <input type=hidden name=id value=$form->{id}>
287 <input type=hidden name=type value=account>
288
289 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
290 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
291 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
292 <input type=hidden name=fxgain_accno_id values=$form->{fxgain_accno_id}>
293 <input type=hidden name=fxloss_accno_id values=$form->{fxloss_accno_id}>
294
295 <table border=0 width=100%>
296   <tr>
297     <th class=listtop>$form->{title}</th>
298   </tr>
299   <tr height="5"></tr>
300   <tr valign=top>
301     <td>
302       <table>
303         <tr>
304           <th align=right>| . $locale->text('Account Number') . qq|</th>
305           <td><input name=accno size=20 value=$form->{accno}></td>
306         </tr>
307         <tr>
308           <th align=right>| . $locale->text('Description') . qq|</th>
309           <td><input name=description size=40 value="$form->{description}"></td>
310         </tr>
311         <tr>
312           <th align=right>| . $locale->text('Account Type') . qq|</th>
313           <td>
314             <table>
315               <tr valign=top>
316                 <td><input name=category type=radio class=radio value=A $checked{A_}>&nbsp;|
317     . $locale->text('Asset') . qq|\n<br>
318                 <input name=category type=radio class=radio value=L $checked{L_}>&nbsp;|
319     . $locale->text('Liability') . qq|\n<br>
320                 <input name=category type=radio class=radio value=I $checked{I_}>&nbsp;|
321     . $locale->text('Revenue') . qq|\n<br>
322                 <input name=category type=radio class=radio value=E $checked{E_}>&nbsp;|
323     . $locale->text('Expense') . qq|</td>
324                 <td width=50>&nbsp;</td>
325                 <td>
326                 <input name=charttype type=radio class=radio value="H" $checked{H}>&nbsp;|
327     . $locale->text('Heading') . qq|<br>
328                 <input name=charttype type=radio class=radio value="A" $checked{A}>&nbsp;|
329     . $locale->text('Account') . qq|</td>
330               </tr>
331             </table>
332           </td>
333         </tr>
334 |;
335
336   if ($form->{charttype} eq "A") {
337     print qq|
338         <tr>
339           <td colspan=2>
340             <table>
341               <tr>
342                 <th align=left>|
343       . $locale->text('Is this a summary account to record') . qq|</th>
344                 <td>
345                 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}>&nbsp;|
346       . $locale->text('AR')
347       . qq|&nbsp;<input name=AP type=checkbox class=checkbox value=AP $form->{AP}>&nbsp;|
348       . $locale->text('AP')
349       . qq|&nbsp;<input name=IC type=checkbox class=checkbox value=IC $form->{IC}>&nbsp;|
350       . $locale->text('Inventory')
351       . qq|</td>
352               </tr>
353             </table>
354           </td>
355         </tr>
356         <tr>
357           <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
358         </tr>
359         <tr valign=top>
360           <td colspan=2>
361             <table width=100%>
362               <tr>
363                 <th align=left>| . $locale->text('Receivables') . qq|</th>
364                 <th align=left>| . $locale->text('Payables') . qq|</th>
365                 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
366                 <th align=left>| . $locale->text('Service Items') . qq|</th>
367               </tr>
368               <tr>
369                 <td>
370                 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}>&nbsp;|
371       . $locale->text('Revenue') . qq|\n<br>
372                 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}>&nbsp;|
373       . $locale->text('Receipt') . qq|\n<br>
374                 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}>&nbsp;|
375       . $locale->text('Tax') . qq|
376                 </td>
377                 <td>
378                 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}>&nbsp;|
379       . $locale->text('Expense/Asset') . qq|\n<br>
380                 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}>&nbsp;|
381       . $locale->text('Payment') . qq|\n<br>
382                 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}>&nbsp;|
383       . $locale->text('Tax') . qq|
384                 </td>
385                 <td>
386                 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}>&nbsp;|
387       . $locale->text('Revenue') . qq|\n<br>
388                 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}>&nbsp;|
389       . $locale->text('COGS') . qq|\n<br>
390                 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}>&nbsp;|
391       . $locale->text('Tax') . qq|
392                 </td>
393                 <td>
394                 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}>&nbsp;|
395       . $locale->text('Revenue') . qq|\n<br>
396                 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}>&nbsp;|
397       . $locale->text('Expense') . qq|\n<br>
398                 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}>&nbsp;|
399       . $locale->text('Tax') . qq|
400                 </td>
401               </tr>
402             </table>
403           </td>
404         </tr>
405 |;
406   }
407
408   print qq|
409         $taxkey
410         $ustva
411         $eur
412         $bwa
413         $bilanz
414       </table>
415     </td>
416   </tr>
417   <tr>
418     <td><hr size=3 noshade></td>
419   </tr>
420 </table>
421 |;
422
423   $lxdebug->leave_sub();
424 }
425
426 sub form_footer {
427   $lxdebug->enter_sub();
428
429   print qq|
430
431 <input name=callback type=hidden value="$form->{callback}">
432
433 <input type=hidden name=path value=$form->{path}>
434 <input type=hidden name=login value=$form->{login}>
435 <input type=hidden name=password value=$form->{password}>
436
437 <br>
438 <input type=submit class=submit name=action value="|
439     . $locale->text('Save') . qq|">
440 |;
441
442   if ($form->{id} && $form->{orphaned}) {
443     print qq|<input type=submit class=submit name=action value="|
444       . $locale->text('Delete') . qq|">|;
445   }
446
447   if ($form->{menubar}) {
448     require "$form->{path}/menu.pl";
449     &menubar;
450   }
451
452   print qq|
453 </form>
454
455 </body>
456 </html>
457 |;
458
459   $lxdebug->leave_sub();
460 }
461
462 sub save_account {
463   $lxdebug->enter_sub();
464
465   $form->isblank("accno",    $locale->text('Account Number missing!'));
466   $form->isblank("category", $locale->text('Account Type missing!'));
467
468   $form->redirect($locale->text('Account saved!'))
469     if (AM->save_account(\%myconfig, \%$form));
470   $form->error($locale->text('Cannot save account!'));
471
472   $lxdebug->leave_sub();
473 }
474
475 sub list_account {
476   $lxdebug->enter_sub();
477
478   CA->all_accounts(\%myconfig, \%$form);
479
480   $form->{title} = $locale->text('Chart of Accounts');
481
482   # construct callback
483   $callback =
484     "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
485
486   @column_index = qw(accno gifi_accno description debit credit link);
487
488   $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
489   $column_header{gifi_accno} =
490     qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
491   $column_header{description} =
492     qq|<th>| . $locale->text('Description') . qq|</a></th>|;
493   $column_header{debit}  = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
494   $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
495   $column_header{link}   = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
496
497   $form->header;
498   $colspan = $#column_index + 1;
499
500   print qq|
501 <body>
502
503 <table width=100%>
504   <tr>
505     <th class=listtop colspan=$colspan>$form->{title}</th>
506   </tr>
507   <tr height=5></tr>
508   <tr class=listheading>
509 |;
510
511   map { print "$column_header{$_}\n" } @column_index;
512
513   print qq|
514 </tr>
515 |;
516
517   # escape callback
518   $callback = $form->escape($callback);
519
520   foreach $ca (@{ $form->{CA} }) {
521
522     $ca->{debit}  = "&nbsp;";
523     $ca->{credit} = "&nbsp;";
524
525     if ($ca->{amount} > 0) {
526       $ca->{credit} =
527         $form->format_amount(\%myconfig, $ca->{amount}, 2, "&nbsp;");
528     }
529     if ($ca->{amount} < 0) {
530       $ca->{debit} =
531         $form->format_amount(\%myconfig, -$ca->{amount}, 2, "&nbsp;");
532     }
533
534     $ca->{link} =~ s/:/<br>/og;
535
536     if ($ca->{charttype} eq "H") {
537       print qq|<tr class=listheading>|;
538
539       $column_data{accno} =
540         qq|<th><a href=$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</a></th>|;
541       $column_data{gifi_accno} =
542         qq|<th><a href=$form->{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{gifi_accno}</a>&nbsp;</th>|;
543       $column_data{description} = qq|<th>$ca->{description}&nbsp;</th>|;
544       $column_data{debit}       = qq|<th>&nbsp;</th>|;
545       $column_data{credit}      = qq| <th>&nbsp;</th>|;
546       $column_data{link}        = qq|<th>&nbsp;</th>|;
547
548     } else {
549       $i++;
550       $i %= 2;
551       print qq|
552 <tr valign=top class=listrow$i>|;
553       $column_data{accno} =
554         qq|<td><a href=$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</a></td>|;
555       $column_data{gifi_accno} =
556         qq|<td><a href=$form->{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{gifi_accno}</a>&nbsp;</td>|;
557       $column_data{description} = qq|<td>$ca->{description}&nbsp;</td>|;
558       $column_data{debit}       = qq|<td align=right>$ca->{debit}</td>|;
559       $column_data{credit}      = qq|<td align=right>$ca->{credit}</td>|;
560       $column_data{link}        = qq|<td>$ca->{link}&nbsp;</td>|;
561
562     }
563
564     map { print "$column_data{$_}\n" } @column_index;
565
566     print "</tr>\n";
567   }
568
569   print qq|
570   <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
571 </table>
572
573 </body>
574 </html>
575 |;
576
577   $lxdebug->leave_sub();
578 }
579
580 sub delete_account {
581   $lxdebug->enter_sub();
582
583   $form->{title} = $locale->text('Delete Account');
584
585   foreach $id (
586     qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
587     ) {
588     if ($form->{id} == $form->{$id}) {
589       $form->error($locale->text('Cannot delete default account!'));
590     }
591   }
592
593   $form->redirect($locale->text('Account deleted!'))
594     if (AM->delete_account(\%myconfig, \%$form));
595   $form->error($locale->text('Cannot delete account!'));
596
597   $lxdebug->leave_sub();
598 }
599
600 sub list_gifi {
601   $lxdebug->enter_sub();
602
603   @{ $form->{fields} } = (accno, description);
604   $form->{table}     = "gifi";
605   $form->{sortorder} = "accno";
606
607   AM->gifi_accounts(\%myconfig, \%$form);
608
609   $form->{title} = $locale->text('GIFI');
610
611   # construct callback
612   $callback =
613     "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
614
615   @column_index = qw(accno description);
616
617   $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
618   $column_header{description} =
619     qq|<th>| . $locale->text('Description') . qq|</a></th>|;
620
621   $form->header;
622   $colspan = $#column_index + 1;
623
624   print qq|
625 <body>
626
627 <table width=100%>
628   <tr>
629     <th class=listtop colspan=$colspan>$form->{title}</th>
630   </tr>
631   <tr height="5"></tr>
632   <tr class=listheading>
633 |;
634
635   map { print "$column_header{$_}\n" } @column_index;
636
637   print qq|
638 </tr>
639 |;
640
641   # escape callback
642   $callback = $form->escape($callback);
643
644   foreach $ca (@{ $form->{ALL} }) {
645
646     $i++;
647     $i %= 2;
648
649     print qq|
650 <tr valign=top class=listrow$i>|;
651
652     $column_data{accno} =
653       qq|<td><a href=$form->{script}?action=edit_gifi&coa=1&accno=$ca->{accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</td>|;
654     $column_data{description} = qq|<td>$ca->{description}&nbsp;</td>|;
655
656     map { print "$column_data{$_}\n" } @column_index;
657
658     print "</tr>\n";
659   }
660
661   print qq|
662   <tr>
663     <td colspan=$colspan><hr size=3 noshade></td>
664   </tr>
665 </table>
666
667 </body>
668 </html>
669 |;
670
671   $lxdebug->leave_sub();
672 }
673
674 sub add_gifi {
675   $lxdebug->enter_sub();
676
677   $form->{title} = "Add";
678
679   # construct callback
680   $form->{callback} =
681     "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
682
683   $form->{coa} = 1;
684
685   &gifi_header;
686   &gifi_footer;
687
688   $lxdebug->leave_sub();
689 }
690
691 sub edit_gifi {
692   $lxdebug->enter_sub();
693
694   $form->{title} = "Edit";
695
696   AM->get_gifi(\%myconfig, \%$form);
697
698   &gifi_header;
699   &gifi_footer;
700
701   $lxdebug->leave_sub();
702 }
703
704 sub gifi_header {
705   $lxdebug->enter_sub();
706
707   $form->{title} = $locale->text("$form->{title} GIFI");
708
709   # $locale->text('Add GIFI')
710   # $locale->text('Edit GIFI')
711
712   $form->{description} =~ s/\"/&quot;/g;
713
714   $form->header;
715
716   print qq|
717 <body>
718
719 <form method=post action=$form->{script}>
720
721 <input type=hidden name=id value=$form->{accno}>
722 <input type=hidden name=type value=gifi>
723
724 <table width=100%>
725   <tr>
726     <th class=listtop>$form->{title}</th>
727   </tr>
728   <tr height="5"></tr>
729   <tr>
730     <td>
731       <table>
732         <tr>
733           <th align=right>| . $locale->text('GIFI') . qq|</th>
734           <td><input name=accno size=20 value=$form->{accno}></td>
735         </tr>
736         <tr>
737           <th align=right>| . $locale->text('Description') . qq|</th>
738           <td><input name=description size=60 value="$form->{description}"></td>
739         </tr>
740       </table>
741     </td>
742   </tr>
743   <tr>
744     <td colspan=2><hr size=3 noshade></td>
745   </tr>
746 </table>
747 |;
748
749   $lxdebug->leave_sub();
750 }
751
752 sub gifi_footer {
753   $lxdebug->enter_sub();
754
755   print qq|
756
757 <input name=callback type=hidden value="$form->{callback}">
758
759 <input type=hidden name=path value=$form->{path}>
760 <input type=hidden name=login value=$form->{login}>
761 <input type=hidden name=password value=$form->{password}>
762
763 <br><input type=submit class=submit name=action value="|
764     . $locale->text('Save') . qq|">|;
765
766   if ($form->{coa}) {
767     print qq|
768 <input type=submit class=submit name=action value="|
769       . $locale->text('Copy to COA') . qq|">
770 |;
771
772     if ($form->{accno} && $form->{orphaned}) {
773       print qq|<input type=submit class=submit name=action value="|
774         . $locale->text('Delete') . qq|">|;
775     }
776   }
777
778   if ($form->{menubar}) {
779     require "$form->{path}/menu.pl";
780     &menubar;
781   }
782
783   print qq|
784   </form>
785
786 </body>
787 </html>
788 |;
789
790   $lxdebug->leave_sub();
791 }
792
793 sub save_gifi {
794   $lxdebug->enter_sub();
795
796   $form->isblank("accno", $locale->text('GIFI missing!'));
797   AM->save_gifi(\%myconfig, \%$form);
798   $form->redirect($locale->text('GIFI saved!'));
799
800   $lxdebug->leave_sub();
801 }
802
803 sub copy_to_coa {
804   $lxdebug->enter_sub();
805
806   $form->isblank("accno", $locale->text('GIFI missing!'));
807
808   AM->save_gifi(\%myconfig, \%$form);
809
810   delete $form->{id};
811   $form->{gifi_accno} = $form->{accno};
812   $form->{title}      = "Add";
813   $form->{charttype}  = "A";
814
815   &account_header;
816   &form_footer;
817
818   $lxdebug->leave_sub();
819 }
820
821 sub delete_gifi {
822   $lxdebug->enter_sub();
823
824   AM->delete_gifi(\%myconfig, \%$form);
825   $form->redirect($locale->text('GIFI deleted!'));
826
827   $lxdebug->leave_sub();
828 }
829
830 sub add_department {
831   $lxdebug->enter_sub();
832
833   $form->{title} = "Add";
834   $form->{role}  = "P";
835
836   $form->{callback} =
837     "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
838     unless $form->{callback};
839
840   &department_header;
841   &form_footer;
842
843   $lxdebug->leave_sub();
844 }
845
846 sub edit_department {
847   $lxdebug->enter_sub();
848
849   $form->{title} = "Edit";
850
851   AM->get_department(\%myconfig, \%$form);
852
853   &department_header;
854   &form_footer;
855
856   $lxdebug->leave_sub();
857 }
858
859 sub list_department {
860   $lxdebug->enter_sub();
861
862   AM->departments(\%myconfig, \%$form);
863
864   $form->{callback} =
865     "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
866
867   $callback = $form->escape($form->{callback});
868
869   $form->{title} = $locale->text('Departments');
870
871   @column_index = qw(description cost profit);
872
873   $column_header{description} =
874       qq|<th class=listheading width=90%>|
875     . $locale->text('Description')
876     . qq|</th>|;
877   $column_header{cost} =
878       qq|<th class=listheading nowrap>|
879     . $locale->text('Cost Center')
880     . qq|</th>|;
881   $column_header{profit} =
882       qq|<th class=listheading nowrap>|
883     . $locale->text('Profit Center')
884     . qq|</th>|;
885
886   $form->header;
887
888   print qq|
889 <body>
890
891 <table width=100%>
892   <tr>
893     <th class=listtop>$form->{title}</th>
894   </tr>
895   <tr height="5"></tr>
896   <tr>
897     <td>
898       <table width=100%>
899         <tr class=listheading>
900 |;
901
902   map { print "$column_header{$_}\n" } @column_index;
903
904   print qq|
905         </tr>
906 |;
907
908   foreach $ref (@{ $form->{ALL} }) {
909
910     $i++;
911     $i %= 2;
912
913     print qq|
914         <tr valign=top class=listrow$i>
915 |;
916
917     $costcenter   = ($ref->{role} eq "C") ? "X" : "";
918     $profitcenter = ($ref->{role} eq "P") ? "X" : "";
919
920     $column_data{description} =
921       qq|<td><a href=$form->{script}?action=edit_department&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
922     $column_data{cost}   = qq|<td align=center>$costcenter</td>|;
923     $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
924
925     map { print "$column_data{$_}\n" } @column_index;
926
927     print qq|
928         </tr>
929 |;
930   }
931
932   print qq|
933       </table>
934     </td>
935   </tr>
936   <tr>
937   <td><hr size=3 noshade></td>
938   </tr>
939 </table>
940
941 <br>
942 <form method=post action=$form->{script}>
943
944 <input name=callback type=hidden value="$form->{callback}">
945
946 <input type=hidden name=type value=department>
947
948 <input type=hidden name=path value=$form->{path}>
949 <input type=hidden name=login value=$form->{login}>
950 <input type=hidden name=password value=$form->{password}>
951
952 <input class=submit type=submit name=action value="|
953     . $locale->text('Add') . qq|">|;
954
955   if ($form->{menubar}) {
956     require "$form->{path}/menu.pl";
957     &menubar;
958   }
959
960   print qq|
961   </form>
962
963   </body>
964   </html>
965 |;
966
967   $lxdebug->leave_sub();
968 }
969
970 sub department_header {
971   $lxdebug->enter_sub();
972
973   $form->{title} = $locale->text("$form->{title} Department");
974
975   # $locale->text('Add Department')
976   # $locale->text('Edit Department')
977
978   $form->{description} =~ s/\"/&quot;/g;
979
980   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
981     $description =
982       qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
983   } else {
984     $description =
985       qq|<input name=description size=60 value="$form->{description}">|;
986   }
987
988   $costcenter   = "checked" if $form->{role} eq "C";
989   $profitcenter = "checked" if $form->{role} eq "P";
990
991   $form->header;
992
993   print qq|
994 <body>
995
996 <form method=post action=$form->{script}>
997
998 <input type=hidden name=id value=$form->{id}>
999 <input type=hidden name=type value=department>
1000
1001 <table width=100%>
1002   <tr>
1003     <th class=listtop colspan=2>$form->{title}</th>
1004   </tr>
1005   <tr height="5"></tr>
1006   <tr>
1007     <th align=right>| . $locale->text('Description') . qq|</th>
1008     <td>$description</td>
1009   </tr>
1010   <tr>
1011     <td></td>
1012     <td><input type=radio style=radio name=role value="C" $costcenter> |
1013     . $locale->text('Cost Center') . qq|
1014         <input type=radio style=radio name=role value="P" $profitcenter> |
1015     . $locale->text('Profit Center') . qq|
1016     </td>
1017   <tr>
1018     <td colspan=2><hr size=3 noshade></td>
1019   </tr>
1020 </table>
1021 |;
1022
1023   $lxdebug->leave_sub();
1024 }
1025
1026 sub save_department {
1027   $lxdebug->enter_sub();
1028
1029   $form->isblank("description", $locale->text('Description missing!'));
1030   AM->save_department(\%myconfig, \%$form);
1031   $form->redirect($locale->text('Department saved!'));
1032
1033   $lxdebug->leave_sub();
1034 }
1035
1036 sub delete_department {
1037   $lxdebug->enter_sub();
1038
1039   AM->delete_department(\%myconfig, \%$form);
1040   $form->redirect($locale->text('Department deleted!'));
1041
1042   $lxdebug->leave_sub();
1043 }
1044
1045 sub add_business {
1046   $lxdebug->enter_sub();
1047
1048   $form->{title} = "Add";
1049
1050   $form->{callback} =
1051     "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1052     unless $form->{callback};
1053
1054   &business_header;
1055   &form_footer;
1056
1057   $lxdebug->leave_sub();
1058 }
1059
1060 sub edit_business {
1061   $lxdebug->enter_sub();
1062
1063   $form->{title} = "Edit";
1064
1065   AM->get_business(\%myconfig, \%$form);
1066
1067   &business_header;
1068
1069   $form->{orphaned} = 1;
1070   &form_footer;
1071
1072   $lxdebug->leave_sub();
1073 }
1074
1075 sub list_business {
1076   $lxdebug->enter_sub();
1077
1078   AM->business(\%myconfig, \%$form);
1079
1080   $form->{callback} =
1081     "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1082
1083   $callback = $form->escape($form->{callback});
1084
1085   $form->{title} = $locale->text('Type of Business');
1086
1087   @column_index = qw(description discount customernumberinit);
1088
1089   $column_header{description} =
1090       qq|<th class=listheading width=60%>|
1091     . $locale->text('Description')
1092     . qq|</th>|;
1093   $column_header{discount} =
1094       qq|<th class=listheading width=10%>|
1095     . $locale->text('Discount')
1096     . qq| %</th>|;
1097   $column_header{customernumberinit} =
1098       qq|<th class=listheading>|
1099     . $locale->text('Customernumberinit')
1100     . qq|</th>|;
1101
1102   $form->header;
1103
1104   print qq|
1105 <body>
1106
1107 <table width=100%>
1108   <tr>
1109     <th class=listtop>$form->{title}</th>
1110   </tr>
1111   <tr height="5"></tr>
1112   <tr>
1113     <td>
1114       <table width=100%>
1115         <tr class=listheading>
1116 |;
1117
1118   map { print "$column_header{$_}\n" } @column_index;
1119
1120   print qq|
1121         </tr>
1122 |;
1123
1124   foreach $ref (@{ $form->{ALL} }) {
1125
1126     $i++;
1127     $i %= 2;
1128
1129     print qq|
1130         <tr valign=top class=listrow$i>
1131 |;
1132
1133     $discount =
1134       $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, "&nbsp");
1135     $description =
1136       ($ref->{salesman})
1137       ? "<b>$ref->{description}</b>"
1138       : "$ref->{description}";
1139     $column_data{description} =
1140       qq|<td><a href=$form->{script}?action=edit_business&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$description</td>|;
1141     $column_data{discount}           = qq|<td align=right>$discount</td>|;
1142     $column_data{customernumberinit} =
1143       qq|<td align=right>$ref->{customernumberinit}</td>|;
1144
1145     map { print "$column_data{$_}\n" } @column_index;
1146
1147     print qq|
1148         </tr>
1149 |;
1150   }
1151
1152   print qq|
1153       </table>
1154     </td>
1155   </tr>
1156   <tr>
1157   <td><hr size=3 noshade></td>
1158   </tr>
1159 </table>
1160
1161 <br>
1162 <form method=post action=$form->{script}>
1163
1164 <input name=callback type=hidden value="$form->{callback}">
1165
1166 <input type=hidden name=type value=business>
1167
1168 <input type=hidden name=path value=$form->{path}>
1169 <input type=hidden name=login value=$form->{login}>
1170 <input type=hidden name=password value=$form->{password}>
1171
1172 <input class=submit type=submit name=action value="|
1173     . $locale->text('Add') . qq|">|;
1174
1175   if ($form->{menubar}) {
1176     require "$form->{path}/menu.pl";
1177     &menubar;
1178   }
1179
1180   print qq|
1181
1182   </form>
1183
1184   </body>
1185   </html>
1186 |;
1187
1188   $lxdebug->leave_sub();
1189 }
1190
1191 sub business_header {
1192   $lxdebug->enter_sub();
1193
1194   $form->{title}    = $locale->text("$form->{title} Business");
1195   $form->{salesman} = "checked" if $form->{salesman};
1196
1197   # $locale->text('Add Business')
1198   # $locale->text('Edit Business')
1199
1200   $form->{description} =~ s/\"/&quot;/g;
1201   $form->{discount} =
1202     $form->format_amount(\%myconfig, $form->{discount} * 100);
1203
1204   $form->header;
1205
1206   print qq|
1207 <body>
1208
1209 <form method=post action=$form->{script}>
1210
1211 <input type=hidden name=id value=$form->{id}>
1212 <input type=hidden name=type value=business>
1213
1214 <table width=100%>
1215   <tr>
1216     <th class=listtop colspan=2>$form->{title}</th>
1217   </tr>
1218   <tr height="5"></tr>
1219   <tr>
1220     <th align=right>| . $locale->text('Type of Business') . qq|</th>
1221     <td><input name=description size=30 value="$form->{description}"></td>
1222   <tr>
1223   <tr>
1224     <th align=right>| . $locale->text('Discount') . qq| %</th>
1225     <td><input name=discount size=5 value=$form->{discount}></td>
1226   </tr>
1227   <tr>
1228     <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1229     <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1230   </tr>
1231   <tr>
1232     <td align=right>| . $locale->text('Salesman') . qq|</td>
1233     <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
1234   </tr>
1235   <td colspan=2><hr size=3 noshade></td>
1236   </tr>
1237 </table>
1238 |;
1239
1240   $lxdebug->leave_sub();
1241 }
1242
1243 sub save_business {
1244   $lxdebug->enter_sub();
1245
1246   $form->isblank("description", $locale->text('Description missing!'));
1247   AM->save_business(\%myconfig, \%$form);
1248   $form->redirect($locale->text('Business saved!'));
1249
1250   $lxdebug->leave_sub();
1251 }
1252
1253 sub delete_business {
1254   $lxdebug->enter_sub();
1255
1256   AM->delete_business(\%myconfig, \%$form);
1257   $form->redirect($locale->text('Business deleted!'));
1258
1259   $lxdebug->leave_sub();
1260 }
1261
1262 sub add_sic {
1263   $lxdebug->enter_sub();
1264
1265   $form->{title} = "Add";
1266
1267   $form->{callback} =
1268     "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1269     unless $form->{callback};
1270
1271   &sic_header;
1272   &form_footer;
1273
1274   $lxdebug->leave_sub();
1275 }
1276
1277 sub edit_sic {
1278   $lxdebug->enter_sub();
1279
1280   $form->{title} = "Edit";
1281
1282   AM->get_sic(\%myconfig, \%$form);
1283
1284   &sic_header;
1285
1286   $form->{orphaned} = 1;
1287   &form_footer;
1288
1289   $lxdebug->leave_sub();
1290 }
1291
1292 sub list_sic {
1293   $lxdebug->enter_sub();
1294
1295   AM->sic(\%myconfig, \%$form);
1296
1297   $form->{callback} =
1298     "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1299
1300   $callback = $form->escape($form->{callback});
1301
1302   $form->{title} = $locale->text('Standard Industrial Codes');
1303
1304   @column_index = qw(code description);
1305
1306   $column_header{code} =
1307     qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
1308   $column_header{description} =
1309     qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1310
1311   $form->header;
1312
1313   print qq|
1314 <body>
1315
1316 <table width=100%>
1317   <tr>
1318     <th class=listtop>$form->{title}</th>
1319   </tr>
1320   <tr height="5"></tr>
1321   <tr>
1322     <td>
1323       <table width=100%>
1324         <tr class=listheading>
1325 |;
1326
1327   map { print "$column_header{$_}\n" } @column_index;
1328
1329   print qq|
1330         </tr>
1331 |;
1332
1333   foreach $ref (@{ $form->{ALL} }) {
1334
1335     $i++;
1336     $i %= 2;
1337
1338     if ($ref->{sictype} eq 'H') {
1339       print qq|
1340         <tr valign=top class=listheading>
1341 |;
1342       $column_data{code} =
1343         qq|<th><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}</th>|;
1344       $column_data{description} = qq|<th>$ref->{description}</th>|;
1345
1346     } else {
1347       print qq|
1348         <tr valign=top class=listrow$i>
1349 |;
1350
1351       $column_data{code} =
1352         qq|<td><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}</td>|;
1353       $column_data{description} = qq|<td>$ref->{description}</td>|;
1354
1355     }
1356
1357     map { print "$column_data{$_}\n" } @column_index;
1358
1359     print qq|
1360         </tr>
1361 |;
1362   }
1363
1364   print qq|
1365       </table>
1366     </td>
1367   </tr>
1368   <tr>
1369   <td><hr size=3 noshade></td>
1370   </tr>
1371 </table>
1372
1373 <br>
1374 <form method=post action=$form->{script}>
1375
1376 <input name=callback type=hidden value="$form->{callback}">
1377
1378 <input type=hidden name=type value=sic>
1379
1380 <input type=hidden name=path value=$form->{path}>
1381 <input type=hidden name=login value=$form->{login}>
1382 <input type=hidden name=password value=$form->{password}>
1383
1384 <input class=submit type=submit name=action value="|
1385     . $locale->text('Add') . qq|">|;
1386
1387   if ($form->{menubar}) {
1388     require "$form->{path}/menu.pl";
1389     &menubar;
1390   }
1391
1392   print qq|
1393   </form>
1394
1395   </body>
1396   </html>
1397 |;
1398
1399   $lxdebug->leave_sub();
1400 }
1401
1402 sub sic_header {
1403   $lxdebug->enter_sub();
1404
1405   $form->{title} = $locale->text("$form->{title} SIC");
1406
1407   # $locale->text('Add SIC')
1408   # $locale->text('Edit SIC')
1409
1410   $form->{code}        =~ s/\"/&quot;/g;
1411   $form->{description} =~ s/\"/&quot;/g;
1412
1413   $checked = ($form->{sictype} eq 'H') ? "checked" : "";
1414
1415   $form->header;
1416
1417   print qq|
1418 <body>
1419
1420 <form method=post action=$form->{script}>
1421
1422 <input type=hidden name=type value=sic>
1423 <input type=hidden name=id value=$form->{code}>
1424
1425 <table width=100%>
1426   <tr>
1427     <th class=listtop colspan=2>$form->{title}</th>
1428   </tr>
1429   <tr height="5"></tr>
1430   <tr>
1431     <th align=right>| . $locale->text('Code') . qq|</th>
1432     <td><input name=code size=10 value=$form->{code}></td>
1433   <tr>
1434   <tr>
1435     <td></td>
1436     <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
1437     . $locale->text('Heading') . qq|</th>
1438   <tr>
1439   <tr>
1440     <th align=right>| . $locale->text('Description') . qq|</th>
1441     <td><input name=description size=60 value="$form->{description}"></td>
1442   </tr>
1443     <td colspan=2><hr size=3 noshade></td>
1444   </tr>
1445 </table>
1446 |;
1447
1448   $lxdebug->leave_sub();
1449 }
1450
1451 sub save_sic {
1452   $lxdebug->enter_sub();
1453
1454   $form->isblank("code",        $locale->text('Code missing!'));
1455   $form->isblank("description", $locale->text('Description missing!'));
1456   AM->save_sic(\%myconfig, \%$form);
1457   $form->redirect($locale->text('SIC saved!'));
1458
1459   $lxdebug->leave_sub();
1460 }
1461
1462 sub delete_sic {
1463   $lxdebug->enter_sub();
1464
1465   AM->delete_sic(\%myconfig, \%$form);
1466   $form->redirect($locale->text('SIC deleted!'));
1467
1468   $lxdebug->leave_sub();
1469 }
1470
1471 sub display_stylesheet {
1472   $lxdebug->enter_sub();
1473
1474   $form->{file} = "css/$myconfig{stylesheet}";
1475   &display_form;
1476
1477   $lxdebug->leave_sub();
1478 }
1479
1480 sub display_form {
1481   $lxdebug->enter_sub();
1482
1483   $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
1484   $form->{file} =~ s/^\/*//g;
1485   $form->{file} =~ s/$userspath//;
1486
1487   $form->error("$!: $form->{file}") unless -f $form->{file};
1488
1489   AM->load_template(\%$form);
1490
1491   $form->{title} = $form->{file};
1492
1493   # if it is anything but html
1494   if ($form->{file} !~ /\.html$/) {
1495     $form->{body} = "<pre>\n$form->{body}\n</pre>";
1496   }
1497
1498   $form->header;
1499
1500   print qq|
1501 <body>
1502
1503 $form->{body}
1504
1505 <form method=post action=$form->{script}>
1506
1507 <input name=file type=hidden value=$form->{file}>
1508 <input name=type type=hidden value=template>
1509
1510 <input type=hidden name=path value=$form->{path}>
1511 <input type=hidden name=login value=$form->{login}>
1512 <input type=hidden name=password value=$form->{password}>
1513
1514 <input name=action type=submit class=submit value="|
1515     . $locale->text('Edit') . qq|">|;
1516
1517   if ($form->{menubar}) {
1518     require "$form->{path}/menu.pl";
1519     &menubar;
1520   }
1521
1522   print qq|
1523   </form>
1524
1525 </body>
1526 </html>
1527 |;
1528
1529   $lxdebug->leave_sub();
1530 }
1531
1532 sub edit_template {
1533   $lxdebug->enter_sub();
1534
1535   AM->load_template(\%$form);
1536
1537   $form->{title} = $locale->text('Edit Template');
1538
1539   # convert &nbsp to &amp;nbsp;
1540   $form->{body} =~ s/&nbsp;/&amp;nbsp;/gi;
1541
1542   $form->header;
1543
1544   print qq|
1545 <body>
1546
1547 <form method=post action=$form->{script}>
1548
1549 <input name=file type=hidden value=$form->{file}>
1550 <input name=type type=hidden value=template>
1551
1552 <input type=hidden name=path value=$form->{path}>
1553 <input type=hidden name=login value=$form->{login}>
1554 <input type=hidden name=password value=$form->{password}>
1555
1556 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
1557
1558 <textarea name=body rows=25 cols=70>
1559 $form->{body}
1560 </textarea>
1561
1562 <br>
1563 <input type=submit class=submit name=action value="|
1564     . $locale->text('Save') . qq|">|;
1565
1566   if ($form->{menubar}) {
1567     require "$form->{path}/menu.pl";
1568     &menubar;
1569   }
1570
1571   print q|
1572   </form>
1573
1574
1575 </body>
1576 </html>
1577 |;
1578
1579   $lxdebug->leave_sub();
1580 }
1581
1582 sub save_template {
1583   $lxdebug->enter_sub();
1584
1585   AM->save_template(\%$form);
1586   $form->redirect($locale->text('Template saved!'));
1587
1588   $lxdebug->leave_sub();
1589 }
1590
1591 sub config {
1592   $lxdebug->enter_sub();
1593
1594   # get defaults for account numbers and last numbers
1595   AM->defaultaccounts(\%myconfig, \%$form);
1596
1597   foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1598     $dateformat .=
1599       ($item eq $myconfig{dateformat})
1600       ? "<option selected>$item\n"
1601       : "<option>$item\n";
1602   }
1603
1604   foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1605     $numberformat .=
1606       ($item eq $myconfig{numberformat})
1607       ? "<option selected>$item\n"
1608       : "<option>$item\n";
1609   }
1610   
1611   foreach $item (qw(name company address signature)) {
1612     $myconfig{$item} =~ s/\"/&quot;/g;
1613   }
1614
1615   foreach $item (qw(address signature)) {
1616     $myconfig{$item} =~ s/\\n/\r\n/g;
1617   }
1618
1619   %countrycodes = User->country_codes;
1620   $countrycodes = '';
1621   foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
1622                 keys %countrycodes
1623     ) {
1624     $countrycodes .=
1625       ($myconfig{countrycode} eq $key)
1626       ? "<option selected value=$key>$countrycodes{$key}\n"
1627       : "<option value=$key>$countrycodes{$key}\n";
1628   }
1629   $countrycodes = "<option>American English\n$countrycodes";
1630   
1631   # use an other input number format than output numberformat
1632   # look at Form.pm, sub parse_amount
1633   my $ in_numberformat = '';
1634   $text1 = qq|value="0">| . $locale->text('equal Outputformat');
1635   $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
1636   @in_nf = ($text1, $text2);
1637   foreach $item ( @in_nf ) {
1638     $in_numberformat .=
1639       ( substr($item, 7, 1) eq $myconfig{in_numberformat})
1640       ? "<option selected $item\n"
1641       : "<option $item\n";
1642   }
1643
1644
1645   
1646   foreach $key (keys %{ $form->{IC} }) {
1647     foreach $accno (sort keys %{ $form->{IC}{$key} }) {
1648       $myconfig{$key} .=
1649         ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
1650         ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
1651         : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
1652     }
1653   }
1654
1655   opendir CSS, "css/.";
1656   @all = grep /.*\.css$/, readdir CSS;
1657   closedir CSS;
1658
1659   foreach $item (@all) {
1660     if ($item eq $myconfig{stylesheet}) {
1661       $selectstylesheet .= qq|<option selected>$item\n|;
1662     } else {
1663       $selectstylesheet .= qq|<option>$item\n|;
1664     }
1665   }
1666   $selectstylesheet .= "<option>\n";
1667
1668   $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
1669
1670   $form->header;
1671
1672   if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
1673   else { $newS = "checked"; }
1674
1675   print qq|
1676 <body>
1677
1678 <form method=post action=$form->{script}>
1679
1680 <input type=hidden name=old_password value=$myconfig{password}>
1681 <input type=hidden name=type value=preferences>
1682 <input type=hidden name=role value=$myconfig{role}>
1683
1684 <table width=100%>
1685   <tr><th class=listtop>$form->{title}</th></tr>
1686   <tr>
1687     <td>
1688       <table>
1689         <tr>
1690           <th align=right>| . $locale->text('Name') . qq|</th>
1691           <td><input name=name size=15 value="$myconfig{name}"></td>
1692         </tr>
1693         <tr>
1694           <th align=right>| . $locale->text('Password') . qq|</th>
1695           <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
1696         </tr>
1697         <tr>
1698           <th align=right>| . $locale->text('E-mail') . qq|</th>
1699           <td><input name=email size=30 value="$myconfig{email}"></td>
1700         </tr>
1701         <tr valign=top>
1702           <th align=right>| . $locale->text('Signature') . qq|</th>
1703           <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
1704         </tr>
1705         <tr>
1706           <th align=right>| . $locale->text('Phone') . qq|</th>
1707           <td><input name=tel size=14 value="$myconfig{tel}"></td>
1708         </tr>
1709         <tr>
1710           <th align=right>| . $locale->text('Fax') . qq|</th>
1711           <td><input name=fax size=14 value="$myconfig{fax}"></td>
1712         </tr>
1713         <tr>
1714           <th align=right>| . $locale->text('Company') . qq|</th>
1715           <td><input name=company size=30 value="$myconfig{company}"></td>
1716         </tr>
1717         <tr valign=top>
1718           <th align=right>| . $locale->text('Address') . qq|</th>
1719           <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
1720         </tr>
1721         <tr>
1722           <th align=right>| . $locale->text('Date Format') . qq|</th>
1723           <td><select name=dateformat>$dateformat</select></td>
1724         </tr>
1725         <tr>
1726           <th align=right>| . $locale->text('Output Number Format') . qq|</th>
1727           <td><select name=numberformat>$numberformat</select></td>
1728         </tr>
1729         <tr>
1730           <th align=right>| . $locale->text('Input Number Format') . qq|</th>
1731           <td><select name=in_numberformat>$in_numberformat</select></td>
1732         </tr>
1733
1734         <tr>
1735           <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
1736           <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
1737         </tr>
1738         <tr>
1739           <th align=right>| . $locale->text('Language') . qq|</th>
1740           <td><select name=countrycode>$countrycodes</select></td>
1741         </tr>
1742         <tr>
1743           <th align=right>| . $locale->text('Character Set') . qq|</th>
1744           <td><input name=charset size=20 value="$myconfig{charset}"></td>
1745         </tr>
1746         <tr>
1747           <th align=right>| . $locale->text('Stylesheet') . qq|</th>
1748           <td><select name=usestylesheet>$selectstylesheet</select></td>
1749         </tr>
1750         <tr>
1751           <th align=right>| . $locale->text('Setup Menu') . qq|</th>
1752           <td><input name=menustyle type=radio class=radio value=neu $newS>&nbsp;New
1753                   <input name=menustyle type=radio class=radio value=old $oldS>&nbsp;Old</td>
1754         </tr>   
1755         <input name=printer type=hidden value="$myconfig{printer}">
1756         <tr class=listheading>
1757           <th colspan=2>&nbsp;</th>
1758         </tr>
1759         <tr>
1760           <th align=right>| . $locale->text('Business Number') . qq|</th>
1761           <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
1762         </tr>
1763         <tr>
1764           <td colspan=2>
1765             <table width=100%>
1766               <tr>
1767                 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
1768                 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
1769                 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
1770                 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
1771               </tr>
1772             </table>
1773           </td>
1774         </tr>
1775         <tr class=listheading>
1776           <th colspan=2>|
1777     . $locale->text('Last Numbers & Default Accounts') . qq|</th>
1778         </tr>
1779         <tr>
1780           <td colspan=2>
1781             <table width=100%>
1782               <tr>
1783                 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
1784                 <td><select name=inventory_accno>$myconfig{IC}</select></td>
1785               </tr>
1786               <tr>
1787                 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
1788                 <td><select name=income_accno>$myconfig{IC_income}</select></td>
1789               </tr>
1790               <tr>
1791                 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
1792                 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
1793               </tr>
1794               <tr>
1795                 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
1796                 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
1797               </tr>
1798               <tr>
1799                 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
1800                 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
1801               </tr>
1802               <tr>
1803                 <td colspan=2>|
1804     . $locale->text(
1805     'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
1806     )
1807     . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
1808               </tr>
1809             </table>
1810           </td>
1811          </tr>
1812          <tr>
1813            <td colspan=2>
1814              <table width=100%>
1815               <tr>
1816                 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
1817                 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
1818                 <th align=right nowrap>|
1819     . $locale->text('Last Customer Number') . qq|</th>
1820                 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
1821               </tr>
1822               <tr>
1823                 <th align=right nowrap>|
1824     . $locale->text('Last Sales Order Number') . qq|</th>
1825                 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
1826                 <th align=right nowrap>|
1827     . $locale->text('Last Vendor Number') . qq|</th>
1828                 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
1829               </tr>
1830               <tr>
1831                 <th align=right nowrap>|
1832     . $locale->text('Last Purchase Order Number') . qq|</th>
1833                 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
1834                 <th align=right nowrap>|
1835     . $locale->text('Last Article Number') . qq|</th>
1836                 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
1837               </tr>
1838               <tr>
1839                 <th align=right nowrap>|
1840     . $locale->text('Last Sales Quotation Number') . qq|</th>
1841                 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
1842                 <th align=right nowrap>|
1843     . $locale->text('Last Service Number') . qq|</th>
1844                 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
1845               </tr>
1846               <tr>
1847                 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
1848                 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
1849                 <th align=right nowrap></th>
1850                 <td></td>
1851               </tr>
1852             </table>
1853           </td>
1854         </tr>
1855         <tr class=listheading>
1856           <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
1857         </tr>
1858         <tr>
1859           <td colspan=2>
1860             <table>
1861               <tr>
1862                 <th>&nbsp;</th>
1863                 <th>| . $locale->text('Rate') . qq| (%)</th>
1864                 <th>| . $locale->text('Number') . qq|</th>
1865               </tr>
1866 |;
1867
1868   foreach $accno (sort keys %{ $form->{taxrates} }) {
1869     print qq|
1870               <tr>
1871                 <th align=right>$form->{taxrates}{$accno}{description}</th>
1872                 <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
1873                 <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
1874               </tr>
1875 |;
1876     $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
1877   }
1878
1879   chop $form->{taxaccounts};
1880
1881   print qq|
1882 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
1883
1884             </table>
1885           </td>
1886         </tr>
1887       </table>
1888     </td>
1889   </tr>
1890   <tr>
1891     <td><hr size=3 noshade></td>
1892   </tr>
1893 </table>
1894
1895 <input type=hidden name=path value=$form->{path}>
1896 <input type=hidden name=login value=$form->{login}>
1897 <input type=hidden name=password value=$form->{password}>
1898
1899 <br>
1900 <input type=submit class=submit name=action value="|
1901     . $locale->text('Save') . qq|">|;
1902
1903   if ($form->{menubar}) {
1904     require "$form->{path}/menu.pl";
1905     &menubar;
1906   }
1907
1908   print qq|
1909   </form>
1910
1911 </body>
1912 </html>
1913 |;
1914
1915   $lxdebug->leave_sub();
1916 }
1917
1918 sub save_preferences {
1919   $lxdebug->enter_sub();
1920
1921   $form->{stylesheet} = $form->{usestylesheet};
1922
1923   $form->redirect($locale->text('Preferences saved!'))
1924     if (
1925      AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
1926      ));
1927   $form->error($locale->text('Cannot save preferences!'));
1928
1929   $lxdebug->leave_sub();
1930 }
1931
1932 sub backup {
1933   $lxdebug->enter_sub();
1934
1935   if ($form->{media} eq 'email') {
1936     $form->error($locale->text('No email address for') . " $myconfig{name}")
1937       unless ($myconfig{email});
1938
1939     $form->{OUT} = "$sendmail";
1940
1941   }
1942
1943   AM->backup(\%myconfig, \%$form, $userspath);
1944
1945   if ($form->{media} eq 'email') {
1946     $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
1947   }
1948
1949   $lxdebug->leave_sub();
1950 }
1951
1952 sub audit_control {
1953   $lxdebug->enter_sub();
1954
1955   $form->{title} = $locale->text('Audit Control');
1956
1957   AM->closedto(\%myconfig, \%$form);
1958
1959   if ($form->{revtrans}) {
1960     $checked{Y} = "checked";
1961   } else {
1962     $checked{N} = "checked";
1963   }
1964
1965   $form->header;
1966
1967   print qq|
1968 <body>
1969
1970 <form method=post action=$form->{script}>
1971
1972 <input type=hidden name=path value=$form->{path}>
1973 <input type=hidden name=login value=$form->{login}>
1974 <input type=hidden name=password value=$form->{password}>
1975
1976 <table width=100%>
1977   <tr><th class=listtop>$form->{title}</th></tr>
1978   <tr height="5"></tr>
1979   <tr>
1980     <td>
1981       <table>
1982         <tr>
1983           <td>|
1984     . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
1985           <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
1986     . $locale->text('Yes')
1987     . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
1988     . $locale->text('No')
1989     . qq|</td>
1990         </tr>
1991         <tr>
1992           <th>| . $locale->text('Close Books up to') . qq|</th>
1993           <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
1994         </tr>
1995       </table>
1996     </td>
1997   </tr>
1998 </table>
1999
2000 <hr size=3 noshade>
2001
2002 <br>
2003 <input type=hidden name=nextsub value=doclose>
2004
2005 <input type=submit class=submit name=action value="|
2006     . $locale->text('Continue') . qq|">
2007
2008 </form>
2009
2010 </body>
2011 </html>
2012 |;
2013
2014   $lxdebug->leave_sub();
2015 }
2016
2017 sub doclose {
2018   $lxdebug->enter_sub();
2019
2020   AM->closebooks(\%myconfig, \%$form);
2021
2022   if ($form->{revtrans}) {
2023     $form->redirect(
2024                  $locale->text('Transaction reversal enforced for all dates'));
2025   } else {
2026     if ($form->{closedto}) {
2027       $form->redirect(
2028                      $locale->text('Transaction reversal enforced up to') . " "
2029                        . $locale->date(\%myconfig, $form->{closedto}, 1));
2030     } else {
2031       $form->redirect($locale->text('Books are open'));
2032     }
2033   }
2034
2035   $lxdebug->leave_sub();
2036 }
2037
2038 sub add_warehouse {
2039   $lxdebug->enter_sub();
2040
2041   $form->{title} = "Add";
2042
2043   $form->{callback} =
2044     "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2045     unless $form->{callback};
2046
2047   &warehouse_header;
2048   &form_footer;
2049
2050   $lxdebug->leave_sub();
2051 }
2052
2053 sub edit_warehouse {
2054   $lxdebug->enter_sub();
2055
2056   $form->{title} = "Edit";
2057
2058   AM->get_warehouse(\%myconfig, \%$form);
2059
2060   &warehouse_header;
2061   &form_footer;
2062
2063   $lxdebug->leave_sub();
2064 }
2065
2066 sub list_warehouse {
2067   $lxdebug->enter_sub();
2068
2069   AM->warehouses(\%myconfig, \%$form);
2070
2071   $form->{callback} =
2072     "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2073
2074   $callback = $form->escape($form->{callback});
2075
2076   $form->{title} = $locale->text('Warehouses');
2077
2078   @column_index = qw(description);
2079
2080   $column_header{description} =
2081       qq|<th class=listheading width=100%>|
2082     . $locale->text('Description')
2083     . qq|</th>|;
2084
2085   $form->header;
2086
2087   print qq|
2088 <body>
2089
2090 <table width=100%>
2091   <tr>
2092     <th class=listtop>$form->{title}</th>
2093   </tr>
2094   <tr height="5"></tr>
2095   <tr>
2096     <td>
2097       <table width=100%>
2098         <tr class=listheading>
2099 |;
2100
2101   map { print "$column_header{$_}\n" } @column_index;
2102
2103   print qq|
2104         </tr>
2105 |;
2106
2107   foreach $ref (@{ $form->{ALL} }) {
2108
2109     $i++;
2110     $i %= 2;
2111
2112     print qq|
2113         <tr valign=top class=listrow$i>
2114 |;
2115
2116     $column_data{description} =
2117       qq|<td><a href=$form->{script}?action=edit_warehouse&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
2118
2119     map { print "$column_data{$_}\n" } @column_index;
2120
2121     print qq|
2122         </tr>
2123 |;
2124   }
2125
2126   print qq|
2127       </table>
2128     </td>
2129   </tr>
2130   <tr>
2131   <td><hr size=3 noshade></td>
2132   </tr>
2133 </table>
2134
2135 <br>
2136 <form method=post action=$form->{script}>
2137
2138 <input name=callback type=hidden value="$form->{callback}">
2139
2140 <input type=hidden name=type value=warehouse>
2141
2142 <input type=hidden name=path value=$form->{path}>
2143 <input type=hidden name=login value=$form->{login}>
2144 <input type=hidden name=password value=$form->{password}>
2145
2146 <input class=submit type=submit name=action value="|
2147     . $locale->text('Add') . qq|">|;
2148
2149   if ($form->{menubar}) {
2150     require "$form->{path}/menu.pl";
2151     &menubar;
2152   }
2153
2154   print qq|
2155   </form>
2156
2157   </body>
2158   </html>
2159 |;
2160
2161   $lxdebug->leave_sub();
2162 }
2163
2164 sub warehouse_header {
2165   $lxdebug->enter_sub();
2166
2167   $form->{title} = $locale->text("$form->{title} Warehouse");
2168
2169   # $locale->text('Add Warehouse')
2170   # $locale->text('Edit Warehouse')
2171
2172   $form->{description} =~ s/\"/&quot;/g;
2173
2174   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
2175     $description =
2176       qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
2177   } else {
2178     $description =
2179       qq|<input name=description size=60 value="$form->{description}">|;
2180   }
2181
2182   $form->header;
2183
2184   print qq|
2185 <body>
2186
2187 <form method=post action=$form->{script}>
2188
2189 <input type=hidden name=id value=$form->{id}>
2190 <input type=hidden name=type value=warehouse>
2191
2192 <table width=100%>
2193   <tr>
2194     <th class=listtop colspan=2>$form->{title}</th>
2195   </tr>
2196   <tr height="5"></tr>
2197   <tr>
2198     <th align=right>| . $locale->text('Description') . qq|</th>
2199     <td>$description</td>
2200   </tr>
2201   <tr>
2202     <td colspan=2><hr size=3 noshade></td>
2203   </tr>
2204 </table>
2205 |;
2206
2207   $lxdebug->leave_sub();
2208 }
2209
2210 sub save_warehouse {
2211   $lxdebug->enter_sub();
2212
2213   $form->isblank("description", $locale->text('Description missing!'));
2214   AM->save_warehouse(\%myconfig, \%$form);
2215   $form->redirect($locale->text('Warehouse saved!'));
2216
2217   $lxdebug->leave_sub();
2218 }
2219
2220 sub delete_warehouse {
2221   $lxdebug->enter_sub();
2222
2223   AM->delete_warehouse(\%myconfig, \%$form);
2224   $form->redirect($locale->text('Warehouse deleted!'));
2225
2226   $lxdebug->leave_sub();
2227 }
2228
2229 sub continue {
2230   $lxdebug->enter_sub();
2231
2232   &{ $form->{nextsub} };
2233
2234   $lxdebug->leave_sub();
2235 }