1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #======================================================================
32 #======================================================================
43 sub add { &{"add_$form->{type}"} }
44 sub edit { &{"edit_$form->{type}"} }
45 sub save { &{"save_$form->{type}"} }
46 sub delete { &{"delete_$form->{type}"} }
49 $lxdebug->enter_sub();
51 $form->{title} = "Add";
52 $form->{charttype} = "A";
53 AM->get_account(\%myconfig, \%$form);
56 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
57 unless $form->{callback};
62 $lxdebug->leave_sub();
66 $lxdebug->enter_sub();
68 $form->{title} = "Edit";
69 AM->get_account(\%myconfig, \%$form);
71 foreach my $item (split(/:/, $form->{link})) {
72 $form->{$item} = "checked";
78 $lxdebug->leave_sub();
82 $lxdebug->enter_sub();
84 $form->{title} = $locale->text("$form->{title} Account");
86 $checked{ $form->{charttype} } = "checked";
87 $checked{"$form->{category}_"} = "checked";
88 $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
90 $form->{description} =~ s/\"/"/g;
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";
99 $form->{selecttaxkey} .=
100 "<option value=$item->{taxkey}>$item->{taxdescription}\n";
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}">
113 $form->{selectustva} = "<option>\n";
114 %ustva = (48 => "Steuerfrei, Zeile 48",
115 51 => "Steuerpflichtig 16%, Zeile 51",
116 86 => "Steuerpflichtig 7%, Zeile 86",
117 91 => "Steuerfrei, Zeile 91",
118 97 => "Steuerpflichtig 16%, Zeile 97",
119 93 => "Steuerpflichtig 7%, Zeile 93",
120 94 => "Steuerpflichtig 16%, Zeile 94",
121 66 => "Vorsteuer, Zeile 66");
122 foreach $item (sort({ $a <=> $b } keys %ustva)) {
123 if ($item == $form->{pos_ustva}) {
124 $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
126 $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
133 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
134 <td><select name=pos_ustva>$form->{selectustva}</select></td>
135 <input type=hidden name=selectustva value="$form->{selectustva}">
138 $form->{selecteur} = "<option>\n";
139 %eur = (1 => "Umsatzerlöse",
140 2 => "sonstige Erlöse",
141 3 => "Privatanteile",
143 5 => "Ausserordentliche Erträge",
144 6 => "Vereinnahmte Umsatzst.",
145 7 => "Umsatzsteuererstattungen",
146 8 => "Wareneingänge",
147 9 => "Löhne und Gehälter",
148 10 => "Gesetzl. sozialer Aufw.",
150 12 => "Gas, Strom, Wasser",
151 13 => "Instandhaltung",
152 14 => "Steuern, Versich., Beiträge",
154 16 => "Kfz-Versicherungen",
155 17 => "Sonst. Fahrtkosten",
156 18 => "Werbe- und Reisekosten",
157 19 => "Instandhaltung u. Werkzeuge",
158 20 => "Fachzeitschriften, Bücher",
159 21 => "Miete für Einrichtungen",
160 22 => "Rechts- und Beratungskosten",
161 23 => "Bürobedarf, Porto, Telefon",
162 24 => "Sonstige Aufwendungen",
163 25 => "Abschreibungen auf Anlagever.",
164 26 => "Abschreibungen auf GWG",
166 28 => "Umsatzsteuerzahlungen",
168 30 => "Ausserordentlicher Aufwand",
169 31 => "Betriebliche Steuern");
170 foreach $item (sort({ $a <=> $b } keys(%eur))) {
171 if ($item == $form->{pos_eur}) {
172 $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
174 $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
181 <th align=right>| . $locale->text('EÜR') . qq|</th>
182 <td><select name=pos_eur>$form->{selecteur}</select></td>
183 <input type=hidden name=selecteur value="$form->{selecteur}">
186 $form->{selectbwa} = "<option>\n";
188 %bwapos = (1 => 'Umsatzerlöse',
189 2 => 'Best.Verdg.FE/UE',
190 3 => 'Aktiv.Eigenleistung',
191 4 => 'Mat./Wareneinkauf',
192 5 => 'So.betr.Erlöse',
193 10 => 'Personalkosten',
195 12 => 'Betriebl.Steuern',
196 13 => 'Vers./Beiträge',
197 14 => 'Kfz.Kosten o.St.',
198 15 => 'Werbe-Reisek.',
199 16 => 'Kosten Warenabgabe',
200 17 => 'Abschreibungen',
201 18 => 'Rep./instandhlt.',
202 19 => 'Übrige Steuern',
203 20 => 'Sonst.Kosten',
205 31 => 'Sonst.neutr.Aufw.',
207 33 => 'Sonst.neutr.Ertrag',
208 34 => 'Verr.kalk.Kosten',
209 35 => 'Steuern Eink.u.Ertr.');
210 foreach $item (sort({ $a <=> $b } keys %bwapos)) {
211 if ($item == $form->{pos_bwa}) {
212 $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
214 $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
221 <th align=right>| . $locale->text('BWA') . qq|</th>
222 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
223 <input type=hidden name=selectbwa value="$form->{selectbwa}">
226 $form->{selectbilanz} = "<option>\n";
227 foreach $item ((1, 2, 3, 4)) {
228 if ($item == $form->{pos_bilanz}) {
229 $form->{selectbilanz} .= "<option value=$item selected>$item\n";
231 $form->{selectbilanz} .= "<option value=$item>$item\n";
238 <th align=right>| . $locale->text('Bilanz') . qq|</th>
239 <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
240 <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
243 # this is for our parser only!
244 # type=submit $locale->text('Add Account')
245 # type=submit $locale->text('Edit Account')
252 <form method=post action=$form->{script}>
254 <input type=hidden name=id value=$form->{id}>
255 <input type=hidden name=type value=account>
257 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
258 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
259 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
260 <input type=hidden name=fxgain_accno_id values=$form->{fxgain_accno_id}>
261 <input type=hidden name=fxloss_accno_id values=$form->{fxloss_accno_id}>
263 <table border=0 width=100%>
265 <th class=listtop>$form->{title}</th>
272 <th align=right>| . $locale->text('Account Number') . qq|</th>
273 <td><input name=accno size=20 value=$form->{accno}></td>
276 <th align=right>| . $locale->text('Description') . qq|</th>
277 <td><input name=description size=40 value="$form->{description}"></td>
280 <th align=right>| . $locale->text('Account Type') . qq|</th>
284 <td><input name=category type=radio class=radio value=A $checked{A_}> |
285 . $locale->text('Asset') . qq|\n<br>
286 <input name=category type=radio class=radio value=L $checked{L_}> |
287 . $locale->text('Liability') . qq|\n<br>
288 <input name=category type=radio class=radio value=I $checked{I_}> |
289 . $locale->text('Revenue') . qq|\n<br>
290 <input name=category type=radio class=radio value=E $checked{E_}> |
291 . $locale->text('Expense') . qq|</td>
292 <td width=50> </td>
294 <input name=charttype type=radio class=radio value="H" $checked{H}> |
295 . $locale->text('Heading') . qq|<br>
296 <input name=charttype type=radio class=radio value="A" $checked{A}> |
297 . $locale->text('Account') . qq|</td>
304 if ($form->{charttype} eq "A") {
311 . $locale->text('Is this a summary account to record') . qq|</th>
313 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
314 . $locale->text('AR')
315 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
316 . $locale->text('AP')
317 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
318 . $locale->text('Inventory')
325 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
331 <th align=left>| . $locale->text('Receivables') . qq|</th>
332 <th align=left>| . $locale->text('Payables') . qq|</th>
333 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
334 <th align=left>| . $locale->text('Service Items') . qq|</th>
338 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
339 . $locale->text('Revenue') . qq|\n<br>
340 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
341 . $locale->text('Receipt') . qq|\n<br>
342 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
343 . $locale->text('Tax') . qq|
346 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
347 . $locale->text('Expense/Asset') . qq|\n<br>
348 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
349 . $locale->text('Payment') . qq|\n<br>
350 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
351 . $locale->text('Tax') . qq|
354 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
355 . $locale->text('Revenue') . qq|\n<br>
356 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
357 . $locale->text('COGS') . qq|\n<br>
358 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
359 . $locale->text('Tax') . qq|
362 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
363 . $locale->text('Revenue') . qq|\n<br>
364 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
365 . $locale->text('Expense') . qq|\n<br>
366 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
367 . $locale->text('Tax') . qq|
386 <td><hr size=3 noshade></td>
391 $lxdebug->leave_sub();
395 $lxdebug->enter_sub();
399 <input name=callback type=hidden value="$form->{callback}">
401 <input type=hidden name=path value=$form->{path}>
402 <input type=hidden name=login value=$form->{login}>
403 <input type=hidden name=password value=$form->{password}>
406 <input type=submit class=submit name=action value="|
407 . $locale->text('Save') . qq|">
410 if ($form->{id} && $form->{orphaned}) {
411 print qq|<input type=submit class=submit name=action value="|
412 . $locale->text('Delete') . qq|">|;
415 if ($form->{menubar}) {
416 require "$form->{path}/menu.pl";
427 $lxdebug->leave_sub();
431 $lxdebug->enter_sub();
433 $form->isblank("accno", $locale->text('Account Number missing!'));
434 $form->isblank("category", $locale->text('Account Type missing!'));
436 $form->redirect($locale->text('Account saved!'))
437 if (AM->save_account(\%myconfig, \%$form));
438 $form->error($locale->text('Cannot save account!'));
440 $lxdebug->leave_sub();
444 $lxdebug->enter_sub();
446 CA->all_accounts(\%myconfig, \%$form);
448 $form->{title} = $locale->text('Chart of Accounts');
452 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
454 @column_index = qw(accno gifi_accno description debit credit link);
456 $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
457 $column_header{gifi_accno} =
458 qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
459 $column_header{description} =
460 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
461 $column_header{debit} = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
462 $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
463 $column_header{link} = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
466 $colspan = $#column_index + 1;
473 <th class=listtop colspan=$colspan>$form->{title}</th>
476 <tr class=listheading>
479 map { print "$column_header{$_}\n" } @column_index;
486 $callback = $form->escape($callback);
488 foreach $ca (@{ $form->{CA} }) {
490 $ca->{debit} = " ";
491 $ca->{credit} = " ";
493 if ($ca->{amount} > 0) {
495 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
497 if ($ca->{amount} < 0) {
499 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
502 $ca->{link} =~ s/:/<br>/og;
504 if ($ca->{charttype} eq "H") {
505 print qq|<tr class=listheading>|;
507 $column_data{accno} =
508 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>|;
509 $column_data{gifi_accno} =
510 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> </th>|;
511 $column_data{description} = qq|<th>$ca->{description} </th>|;
512 $column_data{debit} = qq|<th> </th>|;
513 $column_data{credit} = qq| <th> </th>|;
514 $column_data{link} = qq|<th> </th>|;
520 <tr valign=top class=listrow$i>|;
521 $column_data{accno} =
522 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>|;
523 $column_data{gifi_accno} =
524 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> </td>|;
525 $column_data{description} = qq|<td>$ca->{description} </td>|;
526 $column_data{debit} = qq|<td align=right>$ca->{debit}</td>|;
527 $column_data{credit} = qq|<td align=right>$ca->{credit}</td>|;
528 $column_data{link} = qq|<td>$ca->{link} </td>|;
532 map { print "$column_data{$_}\n" } @column_index;
538 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
545 $lxdebug->leave_sub();
549 $lxdebug->enter_sub();
551 $form->{title} = $locale->text('Delete Account');
554 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
556 if ($form->{id} == $form->{$id}) {
557 $form->error($locale->text('Cannot delete default account!'));
561 $form->redirect($locale->text('Account deleted!'))
562 if (AM->delete_account(\%myconfig, \%$form));
563 $form->error($locale->text('Cannot delete account!'));
565 $lxdebug->leave_sub();
569 $lxdebug->enter_sub();
571 @{ $form->{fields} } = (accno, description);
572 $form->{table} = "gifi";
573 $form->{sortorder} = "accno";
575 AM->gifi_accounts(\%myconfig, \%$form);
577 $form->{title} = $locale->text('GIFI');
581 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
583 @column_index = qw(accno description);
585 $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
586 $column_header{description} =
587 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
590 $colspan = $#column_index + 1;
597 <th class=listtop colspan=$colspan>$form->{title}</th>
600 <tr class=listheading>
603 map { print "$column_header{$_}\n" } @column_index;
610 $callback = $form->escape($callback);
612 foreach $ca (@{ $form->{ALL} }) {
618 <tr valign=top class=listrow$i>|;
620 $column_data{accno} =
621 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>|;
622 $column_data{description} = qq|<td>$ca->{description} </td>|;
624 map { print "$column_data{$_}\n" } @column_index;
631 <td colspan=$colspan><hr size=3 noshade></td>
639 $lxdebug->leave_sub();
643 $lxdebug->enter_sub();
645 $form->{title} = "Add";
649 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
656 $lxdebug->leave_sub();
660 $lxdebug->enter_sub();
662 $form->{title} = "Edit";
664 AM->get_gifi(\%myconfig, \%$form);
669 $lxdebug->leave_sub();
673 $lxdebug->enter_sub();
675 $form->{title} = $locale->text("$form->{title} GIFI");
677 # $locale->text('Add GIFI')
678 # $locale->text('Edit GIFI')
680 $form->{description} =~ s/\"/"/g;
687 <form method=post action=$form->{script}>
689 <input type=hidden name=id value=$form->{accno}>
690 <input type=hidden name=type value=gifi>
694 <th class=listtop>$form->{title}</th>
701 <th align=right>| . $locale->text('GIFI') . qq|</th>
702 <td><input name=accno size=20 value=$form->{accno}></td>
705 <th align=right>| . $locale->text('Description') . qq|</th>
706 <td><input name=description size=60 value="$form->{description}"></td>
712 <td colspan=2><hr size=3 noshade></td>
717 $lxdebug->leave_sub();
721 $lxdebug->enter_sub();
725 <input name=callback type=hidden value="$form->{callback}">
727 <input type=hidden name=path value=$form->{path}>
728 <input type=hidden name=login value=$form->{login}>
729 <input type=hidden name=password value=$form->{password}>
731 <br><input type=submit class=submit name=action value="|
732 . $locale->text('Save') . qq|">|;
736 <input type=submit class=submit name=action value="|
737 . $locale->text('Copy to COA') . qq|">
740 if ($form->{accno} && $form->{orphaned}) {
741 print qq|<input type=submit class=submit name=action value="|
742 . $locale->text('Delete') . qq|">|;
746 if ($form->{menubar}) {
747 require "$form->{path}/menu.pl";
758 $lxdebug->leave_sub();
762 $lxdebug->enter_sub();
764 $form->isblank("accno", $locale->text('GIFI missing!'));
765 AM->save_gifi(\%myconfig, \%$form);
766 $form->redirect($locale->text('GIFI saved!'));
768 $lxdebug->leave_sub();
772 $lxdebug->enter_sub();
774 $form->isblank("accno", $locale->text('GIFI missing!'));
776 AM->save_gifi(\%myconfig, \%$form);
779 $form->{gifi_accno} = $form->{accno};
780 $form->{title} = "Add";
781 $form->{charttype} = "A";
786 $lxdebug->leave_sub();
790 $lxdebug->enter_sub();
792 AM->delete_gifi(\%myconfig, \%$form);
793 $form->redirect($locale->text('GIFI deleted!'));
795 $lxdebug->leave_sub();
799 $lxdebug->enter_sub();
801 $form->{title} = "Add";
805 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
806 unless $form->{callback};
811 $lxdebug->leave_sub();
814 sub edit_department {
815 $lxdebug->enter_sub();
817 $form->{title} = "Edit";
819 AM->get_department(\%myconfig, \%$form);
824 $lxdebug->leave_sub();
827 sub list_department {
828 $lxdebug->enter_sub();
830 AM->departments(\%myconfig, \%$form);
833 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
835 $callback = $form->escape($form->{callback});
837 $form->{title} = $locale->text('Departments');
839 @column_index = qw(description cost profit);
841 $column_header{description} =
842 qq|<th class=listheading width=90%>|
843 . $locale->text('Description')
845 $column_header{cost} =
846 qq|<th class=listheading nowrap>|
847 . $locale->text('Cost Center')
849 $column_header{profit} =
850 qq|<th class=listheading nowrap>|
851 . $locale->text('Profit Center')
861 <th class=listtop>$form->{title}</th>
867 <tr class=listheading>
870 map { print "$column_header{$_}\n" } @column_index;
876 foreach $ref (@{ $form->{ALL} }) {
882 <tr valign=top class=listrow$i>
885 $costcenter = ($ref->{role} eq "C") ? "X" : "";
886 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
888 $column_data{description} =
889 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>|;
890 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
891 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
893 map { print "$column_data{$_}\n" } @column_index;
905 <td><hr size=3 noshade></td>
910 <form method=post action=$form->{script}>
912 <input name=callback type=hidden value="$form->{callback}">
914 <input type=hidden name=type value=department>
916 <input type=hidden name=path value=$form->{path}>
917 <input type=hidden name=login value=$form->{login}>
918 <input type=hidden name=password value=$form->{password}>
920 <input class=submit type=submit name=action value="|
921 . $locale->text('Add') . qq|">|;
923 if ($form->{menubar}) {
924 require "$form->{path}/menu.pl";
935 $lxdebug->leave_sub();
938 sub department_header {
939 $lxdebug->enter_sub();
941 $form->{title} = $locale->text("$form->{title} Department");
943 # $locale->text('Add Department')
944 # $locale->text('Edit Department')
946 $form->{description} =~ s/\"/"/g;
948 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
950 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
953 qq|<input name=description size=60 value="$form->{description}">|;
956 $costcenter = "checked" if $form->{role} eq "C";
957 $profitcenter = "checked" if $form->{role} eq "P";
964 <form method=post action=$form->{script}>
966 <input type=hidden name=id value=$form->{id}>
967 <input type=hidden name=type value=department>
971 <th class=listtop colspan=2>$form->{title}</th>
975 <th align=right>| . $locale->text('Description') . qq|</th>
976 <td>$description</td>
980 <td><input type=radio style=radio name=role value="C" $costcenter> |
981 . $locale->text('Cost Center') . qq|
982 <input type=radio style=radio name=role value="P" $profitcenter> |
983 . $locale->text('Profit Center') . qq|
986 <td colspan=2><hr size=3 noshade></td>
991 $lxdebug->leave_sub();
994 sub save_department {
995 $lxdebug->enter_sub();
997 $form->isblank("description", $locale->text('Description missing!'));
998 AM->save_department(\%myconfig, \%$form);
999 $form->redirect($locale->text('Department saved!'));
1001 $lxdebug->leave_sub();
1004 sub delete_department {
1005 $lxdebug->enter_sub();
1007 AM->delete_department(\%myconfig, \%$form);
1008 $form->redirect($locale->text('Department deleted!'));
1010 $lxdebug->leave_sub();
1014 $lxdebug->enter_sub();
1016 $form->{title} = "Add";
1019 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1020 unless $form->{callback};
1025 $lxdebug->leave_sub();
1029 $lxdebug->enter_sub();
1031 $form->{title} = "Edit";
1033 AM->get_business(\%myconfig, \%$form);
1037 $form->{orphaned} = 1;
1040 $lxdebug->leave_sub();
1044 $lxdebug->enter_sub();
1046 AM->business(\%myconfig, \%$form);
1049 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1051 $callback = $form->escape($form->{callback});
1053 $form->{title} = $locale->text('Type of Business');
1055 @column_index = qw(description discount customernumberinit);
1057 $column_header{description} =
1058 qq|<th class=listheading width=60%>|
1059 . $locale->text('Description')
1061 $column_header{discount} =
1062 qq|<th class=listheading width=10%>|
1063 . $locale->text('Discount')
1065 $column_header{customernumberinit} =
1066 qq|<th class=listheading>|
1067 . $locale->text('Customernumberinit')
1077 <th class=listtop>$form->{title}</th>
1079 <tr height="5"></tr>
1083 <tr class=listheading>
1086 map { print "$column_header{$_}\n" } @column_index;
1092 foreach $ref (@{ $form->{ALL} }) {
1098 <tr valign=top class=listrow$i>
1102 $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
1105 ? "<b>$ref->{description}</b>"
1106 : "$ref->{description}";
1107 $column_data{description} =
1108 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>|;
1109 $column_data{discount} = qq|<td align=right>$discount</td>|;
1110 $column_data{customernumberinit} =
1111 qq|<td align=right>$ref->{customernumberinit}</td>|;
1113 map { print "$column_data{$_}\n" } @column_index;
1125 <td><hr size=3 noshade></td>
1130 <form method=post action=$form->{script}>
1132 <input name=callback type=hidden value="$form->{callback}">
1134 <input type=hidden name=type value=business>
1136 <input type=hidden name=path value=$form->{path}>
1137 <input type=hidden name=login value=$form->{login}>
1138 <input type=hidden name=password value=$form->{password}>
1140 <input class=submit type=submit name=action value="|
1141 . $locale->text('Add') . qq|">|;
1143 if ($form->{menubar}) {
1144 require "$form->{path}/menu.pl";
1156 $lxdebug->leave_sub();
1159 sub business_header {
1160 $lxdebug->enter_sub();
1162 $form->{title} = $locale->text("$form->{title} Business");
1163 $form->{salesman} = "checked" if $form->{salesman};
1165 # $locale->text('Add Business')
1166 # $locale->text('Edit Business')
1168 $form->{description} =~ s/\"/"/g;
1170 $form->format_amount(\%myconfig, $form->{discount} * 100);
1177 <form method=post action=$form->{script}>
1179 <input type=hidden name=id value=$form->{id}>
1180 <input type=hidden name=type value=business>
1184 <th class=listtop colspan=2>$form->{title}</th>
1186 <tr height="5"></tr>
1188 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1189 <td><input name=description size=30 value="$form->{description}"></td>
1192 <th align=right>| . $locale->text('Discount') . qq| %</th>
1193 <td><input name=discount size=5 value=$form->{discount}></td>
1196 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1197 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1200 <td align=right>| . $locale->text('Salesman') . qq|</td>
1201 <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
1203 <td colspan=2><hr size=3 noshade></td>
1208 $lxdebug->leave_sub();
1212 $lxdebug->enter_sub();
1214 $form->isblank("description", $locale->text('Description missing!'));
1215 AM->save_business(\%myconfig, \%$form);
1216 $form->redirect($locale->text('Business saved!'));
1218 $lxdebug->leave_sub();
1221 sub delete_business {
1222 $lxdebug->enter_sub();
1224 AM->delete_business(\%myconfig, \%$form);
1225 $form->redirect($locale->text('Business deleted!'));
1227 $lxdebug->leave_sub();
1231 $lxdebug->enter_sub();
1233 $form->{title} = "Add";
1236 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1237 unless $form->{callback};
1242 $lxdebug->leave_sub();
1246 $lxdebug->enter_sub();
1248 $form->{title} = "Edit";
1250 AM->get_sic(\%myconfig, \%$form);
1254 $form->{orphaned} = 1;
1257 $lxdebug->leave_sub();
1261 $lxdebug->enter_sub();
1263 AM->sic(\%myconfig, \%$form);
1266 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1268 $callback = $form->escape($form->{callback});
1270 $form->{title} = $locale->text('Standard Industrial Codes');
1272 @column_index = qw(code description);
1274 $column_header{code} =
1275 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
1276 $column_header{description} =
1277 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1286 <th class=listtop>$form->{title}</th>
1288 <tr height="5"></tr>
1292 <tr class=listheading>
1295 map { print "$column_header{$_}\n" } @column_index;
1301 foreach $ref (@{ $form->{ALL} }) {
1306 if ($ref->{sictype} eq 'H') {
1308 <tr valign=top class=listheading>
1310 $column_data{code} =
1311 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>|;
1312 $column_data{description} = qq|<th>$ref->{description}</th>|;
1316 <tr valign=top class=listrow$i>
1319 $column_data{code} =
1320 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>|;
1321 $column_data{description} = qq|<td>$ref->{description}</td>|;
1325 map { print "$column_data{$_}\n" } @column_index;
1337 <td><hr size=3 noshade></td>
1342 <form method=post action=$form->{script}>
1344 <input name=callback type=hidden value="$form->{callback}">
1346 <input type=hidden name=type value=sic>
1348 <input type=hidden name=path value=$form->{path}>
1349 <input type=hidden name=login value=$form->{login}>
1350 <input type=hidden name=password value=$form->{password}>
1352 <input class=submit type=submit name=action value="|
1353 . $locale->text('Add') . qq|">|;
1355 if ($form->{menubar}) {
1356 require "$form->{path}/menu.pl";
1367 $lxdebug->leave_sub();
1371 $lxdebug->enter_sub();
1373 $form->{title} = $locale->text("$form->{title} SIC");
1375 # $locale->text('Add SIC')
1376 # $locale->text('Edit SIC')
1378 $form->{code} =~ s/\"/"/g;
1379 $form->{description} =~ s/\"/"/g;
1381 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
1388 <form method=post action=$form->{script}>
1390 <input type=hidden name=type value=sic>
1391 <input type=hidden name=id value=$form->{code}>
1395 <th class=listtop colspan=2>$form->{title}</th>
1397 <tr height="5"></tr>
1399 <th align=right>| . $locale->text('Code') . qq|</th>
1400 <td><input name=code size=10 value=$form->{code}></td>
1404 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
1405 . $locale->text('Heading') . qq|</th>
1408 <th align=right>| . $locale->text('Description') . qq|</th>
1409 <td><input name=description size=60 value="$form->{description}"></td>
1411 <td colspan=2><hr size=3 noshade></td>
1416 $lxdebug->leave_sub();
1420 $lxdebug->enter_sub();
1422 $form->isblank("code", $locale->text('Code missing!'));
1423 $form->isblank("description", $locale->text('Description missing!'));
1424 AM->save_sic(\%myconfig, \%$form);
1425 $form->redirect($locale->text('SIC saved!'));
1427 $lxdebug->leave_sub();
1431 $lxdebug->enter_sub();
1433 AM->delete_sic(\%myconfig, \%$form);
1434 $form->redirect($locale->text('SIC deleted!'));
1436 $lxdebug->leave_sub();
1439 sub display_stylesheet {
1440 $lxdebug->enter_sub();
1442 $form->{file} = "css/$myconfig{stylesheet}";
1445 $lxdebug->leave_sub();
1449 $lxdebug->enter_sub();
1451 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
1452 $form->{file} =~ s/^\/*//g;
1453 $form->{file} =~ s/$userspath//;
1455 $form->error("$!: $form->{file}") unless -f $form->{file};
1457 AM->load_template(\%$form);
1459 $form->{title} = $form->{file};
1461 # if it is anything but html
1462 if ($form->{file} !~ /\.html$/) {
1463 $form->{body} = "<pre>\n$form->{body}\n</pre>";
1473 <form method=post action=$form->{script}>
1475 <input name=file type=hidden value=$form->{file}>
1476 <input name=type type=hidden value=template>
1478 <input type=hidden name=path value=$form->{path}>
1479 <input type=hidden name=login value=$form->{login}>
1480 <input type=hidden name=password value=$form->{password}>
1482 <input name=action type=submit class=submit value="|
1483 . $locale->text('Edit') . qq|">|;
1485 if ($form->{menubar}) {
1486 require "$form->{path}/menu.pl";
1497 $lxdebug->leave_sub();
1501 $lxdebug->enter_sub();
1503 AM->load_template(\%$form);
1505 $form->{title} = $locale->text('Edit Template');
1507 # convert   to &nbsp;
1508 $form->{body} =~ s/ /&nbsp;/gi;
1515 <form method=post action=$form->{script}>
1517 <input name=file type=hidden value=$form->{file}>
1518 <input name=type type=hidden value=template>
1520 <input type=hidden name=path value=$form->{path}>
1521 <input type=hidden name=login value=$form->{login}>
1522 <input type=hidden name=password value=$form->{password}>
1524 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
1526 <textarea name=body rows=25 cols=70>
1531 <input type=submit class=submit name=action value="|
1532 . $locale->text('Save') . qq|">|;
1534 if ($form->{menubar}) {
1535 require "$form->{path}/menu.pl";
1547 $lxdebug->leave_sub();
1551 $lxdebug->enter_sub();
1553 AM->save_template(\%$form);
1554 $form->redirect($locale->text('Template saved!'));
1556 $lxdebug->leave_sub();
1560 $lxdebug->enter_sub();
1562 # get defaults for account numbers and last numbers
1563 AM->defaultaccounts(\%myconfig, \%$form);
1565 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1567 ($item eq $myconfig{dateformat})
1568 ? "<option selected>$item\n"
1569 : "<option>$item\n";
1572 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1574 ($item eq $myconfig{numberformat})
1575 ? "<option selected>$item\n"
1576 : "<option>$item\n";
1579 foreach $item (qw(name company address signature)) {
1580 $myconfig{$item} =~ s/\"/"/g;
1583 foreach $item (qw(address signature)) {
1584 $myconfig{$item} =~ s/\\n/\r\n/g;
1587 %countrycodes = User->country_codes;
1589 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
1593 ($myconfig{countrycode} eq $key)
1594 ? "<option selected value=$key>$countrycodes{$key}\n"
1595 : "<option value=$key>$countrycodes{$key}\n";
1597 $countrycodes = "<option>American English\n$countrycodes";
1599 foreach $key (keys %{ $form->{IC} }) {
1600 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
1602 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
1603 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
1604 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
1608 opendir CSS, "css/.";
1609 @all = grep /.*\.css$/, readdir CSS;
1612 foreach $item (@all) {
1613 if ($item eq $myconfig{stylesheet}) {
1614 $selectstylesheet .= qq|<option selected>$item\n|;
1616 $selectstylesheet .= qq|<option>$item\n|;
1619 $selectstylesheet .= "<option>\n";
1621 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
1625 if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
1626 else { $newS = "checked"; }
1631 <form method=post action=$form->{script}>
1633 <input type=hidden name=old_password value=$myconfig{password}>
1634 <input type=hidden name=type value=preferences>
1635 <input type=hidden name=role value=$myconfig{role}>
1638 <tr><th class=listtop>$form->{title}</th></tr>
1643 <th align=right>| . $locale->text('Name') . qq|</th>
1644 <td><input name=name size=15 value="$myconfig{name}"></td>
1647 <th align=right>| . $locale->text('Password') . qq|</th>
1648 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
1651 <th align=right>| . $locale->text('E-mail') . qq|</th>
1652 <td><input name=email size=30 value="$myconfig{email}"></td>
1655 <th align=right>| . $locale->text('Signature') . qq|</th>
1656 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
1659 <th align=right>| . $locale->text('Phone') . qq|</th>
1660 <td><input name=tel size=14 value="$myconfig{tel}"></td>
1663 <th align=right>| . $locale->text('Fax') . qq|</th>
1664 <td><input name=fax size=14 value="$myconfig{fax}"></td>
1667 <th align=right>| . $locale->text('Company') . qq|</th>
1668 <td><input name=company size=30 value="$myconfig{company}"></td>
1671 <th align=right>| . $locale->text('Address') . qq|</th>
1672 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
1675 <th align=right>| . $locale->text('Date Format') . qq|</th>
1676 <td><select name=dateformat>$dateformat</select></td>
1679 <th align=right>| . $locale->text('Number Format') . qq|</th>
1680 <td><select name=numberformat>$numberformat</select></td>
1683 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
1684 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
1687 <th align=right>| . $locale->text('Language') . qq|</th>
1688 <td><select name=countrycode>$countrycodes</select></td>
1691 <th align=right>| . $locale->text('Character Set') . qq|</th>
1692 <td><input name=charset size=20 value="$myconfig{charset}"></td>
1695 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
1696 <td><select name=usestylesheet>$selectstylesheet</select></td>
1699 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
1700 <td><input name=menustyle type=radio class=radio value=neu $newS> New
1701 <input name=menustyle type=radio class=radio value=old $oldS> Old</td>
1703 <input name=printer type=hidden value="$myconfig{printer}">
1704 <tr class=listheading>
1705 <th colspan=2> </th>
1708 <th align=right>| . $locale->text('Business Number') . qq|</th>
1709 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
1715 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
1716 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
1717 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
1718 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
1723 <tr class=listheading>
1725 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
1731 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
1732 <td><select name=inventory_accno>$myconfig{IC}</select></td>
1735 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
1736 <td><select name=income_accno>$myconfig{IC_income}</select></td>
1739 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
1740 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
1743 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
1744 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
1747 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
1748 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
1753 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
1755 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
1764 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
1765 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
1766 <th align=right nowrap>|
1767 . $locale->text('Last Customer Number') . qq|</th>
1768 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
1771 <th align=right nowrap>|
1772 . $locale->text('Last Sales Order Number') . qq|</th>
1773 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
1774 <th align=right nowrap>|
1775 . $locale->text('Last Vendor Number') . qq|</th>
1776 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
1779 <th align=right nowrap>|
1780 . $locale->text('Last Purchase Order Number') . qq|</th>
1781 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
1782 <th align=right nowrap>|
1783 . $locale->text('Last Article Number') . qq|</th>
1784 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
1787 <th align=right nowrap>|
1788 . $locale->text('Last Sales Quotation Number') . qq|</th>
1789 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
1790 <th align=right nowrap>|
1791 . $locale->text('Last Service Number') . qq|</th>
1792 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
1795 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
1796 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
1797 <th align=right nowrap></th>
1803 <tr class=listheading>
1804 <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
1811 <th>| . $locale->text('Rate') . qq| (%)</th>
1812 <th>| . $locale->text('Number') . qq|</th>
1816 foreach $accno (sort keys %{ $form->{taxrates} }) {
1819 <th align=right>$form->{taxrates}{$accno}{description}</th>
1820 <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
1821 <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
1824 $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
1827 chop $form->{taxaccounts};
1830 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
1839 <td><hr size=3 noshade></td>
1843 <input type=hidden name=path value=$form->{path}>
1844 <input type=hidden name=login value=$form->{login}>
1845 <input type=hidden name=password value=$form->{password}>
1848 <input type=submit class=submit name=action value="|
1849 . $locale->text('Save') . qq|">|;
1851 if ($form->{menubar}) {
1852 require "$form->{path}/menu.pl";
1863 $lxdebug->leave_sub();
1866 sub save_preferences {
1867 $lxdebug->enter_sub();
1869 $form->{stylesheet} = $form->{usestylesheet};
1871 $form->redirect($locale->text('Preferences saved!'))
1873 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
1875 $form->error($locale->text('Cannot save preferences!'));
1877 $lxdebug->leave_sub();
1881 $lxdebug->enter_sub();
1883 if ($form->{media} eq 'email') {
1884 $form->error($locale->text('No email address for') . " $myconfig{name}")
1885 unless ($myconfig{email});
1887 $form->{OUT} = "$sendmail";
1891 AM->backup(\%myconfig, \%$form, $userspath);
1893 if ($form->{media} eq 'email') {
1894 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
1897 $lxdebug->leave_sub();
1901 $lxdebug->enter_sub();
1903 $form->{title} = $locale->text('Audit Control');
1905 AM->closedto(\%myconfig, \%$form);
1907 if ($form->{revtrans}) {
1908 $checked{Y} = "checked";
1910 $checked{N} = "checked";
1918 <form method=post action=$form->{script}>
1920 <input type=hidden name=path value=$form->{path}>
1921 <input type=hidden name=login value=$form->{login}>
1922 <input type=hidden name=password value=$form->{password}>
1925 <tr><th class=listtop>$form->{title}</th></tr>
1926 <tr height="5"></tr>
1932 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
1933 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
1934 . $locale->text('Yes')
1935 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
1936 . $locale->text('No')
1940 <th>| . $locale->text('Close Books up to') . qq|</th>
1941 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
1951 <input type=hidden name=nextsub value=doclose>
1953 <input type=submit class=submit name=action value="|
1954 . $locale->text('Continue') . qq|">
1962 $lxdebug->leave_sub();
1966 $lxdebug->enter_sub();
1968 AM->closebooks(\%myconfig, \%$form);
1970 if ($form->{revtrans}) {
1972 $locale->text('Transaction reversal enforced for all dates'));
1974 if ($form->{closedto}) {
1976 $locale->text('Transaction reversal enforced up to') . " "
1977 . $locale->date(\%myconfig, $form->{closedto}, 1));
1979 $form->redirect($locale->text('Books are open'));
1983 $lxdebug->leave_sub();
1987 $lxdebug->enter_sub();
1989 $form->{title} = "Add";
1992 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1993 unless $form->{callback};
1998 $lxdebug->leave_sub();
2001 sub edit_warehouse {
2002 $lxdebug->enter_sub();
2004 $form->{title} = "Edit";
2006 AM->get_warehouse(\%myconfig, \%$form);
2011 $lxdebug->leave_sub();
2014 sub list_warehouse {
2015 $lxdebug->enter_sub();
2017 AM->warehouses(\%myconfig, \%$form);
2020 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2022 $callback = $form->escape($form->{callback});
2024 $form->{title} = $locale->text('Warehouses');
2026 @column_index = qw(description);
2028 $column_header{description} =
2029 qq|<th class=listheading width=100%>|
2030 . $locale->text('Description')
2040 <th class=listtop>$form->{title}</th>
2042 <tr height="5"></tr>
2046 <tr class=listheading>
2049 map { print "$column_header{$_}\n" } @column_index;
2055 foreach $ref (@{ $form->{ALL} }) {
2061 <tr valign=top class=listrow$i>
2064 $column_data{description} =
2065 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>|;
2067 map { print "$column_data{$_}\n" } @column_index;
2079 <td><hr size=3 noshade></td>
2084 <form method=post action=$form->{script}>
2086 <input name=callback type=hidden value="$form->{callback}">
2088 <input type=hidden name=type value=warehouse>
2090 <input type=hidden name=path value=$form->{path}>
2091 <input type=hidden name=login value=$form->{login}>
2092 <input type=hidden name=password value=$form->{password}>
2094 <input class=submit type=submit name=action value="|
2095 . $locale->text('Add') . qq|">|;
2097 if ($form->{menubar}) {
2098 require "$form->{path}/menu.pl";
2109 $lxdebug->leave_sub();
2112 sub warehouse_header {
2113 $lxdebug->enter_sub();
2115 $form->{title} = $locale->text("$form->{title} Warehouse");
2117 # $locale->text('Add Warehouse')
2118 # $locale->text('Edit Warehouse')
2120 $form->{description} =~ s/\"/"/g;
2122 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
2124 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
2127 qq|<input name=description size=60 value="$form->{description}">|;
2135 <form method=post action=$form->{script}>
2137 <input type=hidden name=id value=$form->{id}>
2138 <input type=hidden name=type value=warehouse>
2142 <th class=listtop colspan=2>$form->{title}</th>
2144 <tr height="5"></tr>
2146 <th align=right>| . $locale->text('Description') . qq|</th>
2147 <td>$description</td>
2150 <td colspan=2><hr size=3 noshade></td>
2155 $lxdebug->leave_sub();
2158 sub save_warehouse {
2159 $lxdebug->enter_sub();
2161 $form->isblank("description", $locale->text('Description missing!'));
2162 AM->save_warehouse(\%myconfig, \%$form);
2163 $form->redirect($locale->text('Warehouse saved!'));
2165 $lxdebug->leave_sub();
2168 sub delete_warehouse {
2169 $lxdebug->enter_sub();
2171 AM->delete_warehouse(\%myconfig, \%$form);
2172 $form->redirect($locale->text('Warehouse deleted!'));
2174 $lxdebug->leave_sub();
2178 $lxdebug->enter_sub();
2180 &{ $form->{nextsub} };
2182 $lxdebug->leave_sub();