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