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