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 #======================================================================
45 sub add { &{"add_$form->{type}"} }
46 sub edit { &{"edit_$form->{type}"} }
47 sub save { &{"save_$form->{type}"} }
48 sub delete { &{"delete_$form->{type}"} }
51 $lxdebug->enter_sub();
53 $form->{title} = "Add";
54 $form->{charttype} = "A";
55 AM->get_account(\%myconfig, \%$form);
58 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
59 unless $form->{callback};
64 $lxdebug->leave_sub();
68 $lxdebug->enter_sub();
70 $form->{title} = "Edit";
71 AM->get_account(\%myconfig, \%$form);
73 foreach my $item (split(/:/, $form->{link})) {
74 $form->{$item} = "checked";
80 $lxdebug->leave_sub();
84 $lxdebug->enter_sub();
86 $form->{title} = $locale->text("$form->{title} Account");
88 $checked{ $form->{charttype} } = "checked";
89 $checked{"$form->{category}_"} = "checked";
90 $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
92 $form->{description} =~ s/\"/"/g;
94 if (@{ $form->{TAXKEY} }) {
95 $form->{selecttaxkey} = "<option value=0>Keine Steuer 0%\n";
96 foreach $item (@{ $form->{TAXKEY} }) {
97 if ($item->{taxkey} == $form->{taxkey_id}) {
98 $form->{selecttaxkey} .=
99 "<option value=$item->{taxkey} selected>$item->{taxdescription}\n";
101 $form->{selecttaxkey} .=
102 "<option value=$item->{taxkey}>$item->{taxdescription}\n";
110 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
111 <td><select name=taxkey_id>$form->{selecttaxkey}</select></td>
112 <input type=hidden name=selecttaxkey value="$form->{selecttaxkey}">
115 if (@{ $form->{NEWACCOUNT} }) {
116 if (!$form->{new_chart_valid}) {
117 $form->{selectnewaccount} = "<option value=></option>";
119 foreach $item (@{ $form->{NEWACCOUNT} }) {
120 if ($item->{id} == $form->{new_chart_id}) {
121 $form->{selectnewaccount} .=
122 "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
123 } elsif (!$form->{new_chart_valid}) {
124 $form->{selectnewaccount} .=
125 "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
136 <th align=right>| . $locale->text('Folgekonto') . qq|</th>
137 <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
138 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
139 <td><input name=valid_from value="$form->{valid_from}"></td>
145 $form->{selectustva} = "<option>\n";
147 %ustva = (35 => $locale->text('UStVA-Nr. 35'),
148 36 => $locale->text('UStVA-Nr. 36'),
149 39 => $locale->text('UStVA-Nr. 39'),
150 41 => $locale->text('UStVA-Nr. 41'),
151 42 => $locale->text('UStVA-Nr. 42'),
152 43 => $locale->text('UStVA-Nr. 43'),
153 44 => $locale->text('UStVA-Nr. 44'),
154 45 => $locale->text('UStVA-Nr. 45'),
155 48 => $locale->text('UStVA-Nr. 48'),
156 49 => $locale->text('UStVA-Nr. 49'),
157 51 => $locale->text('UStVA-Nr. 51 left'),
158 511 => $locale->text('UStVA-Nr. 51 right'),
159 52 => $locale->text('UStVA-Nr. 52'),
160 53 => $locale->text('UStVA-Nr. 53'),
161 59 => $locale->text('UStVA-Nr. 59'),
162 60 => $locale->text('UStVA-Nr. 60'),
163 61 => $locale->text('UStVA-Nr. 61'),
164 62 => $locale->text('UStVA-Nr. 62'),
165 63 => $locale->text('UStVA-Nr. 63'),
166 64 => $locale->text('UStVA-Nr. 64'),
167 65 => $locale->text('UStVA-Nr. 65'),
168 66 => $locale->text('UStVA-Nr. 66'),
169 67 => $locale->text('UStVA-Nr. 67'),
170 69 => $locale->text('UStVA-Nr. 69'),
171 73 => $locale->text('UStVA-Nr. 73'),
172 74 => $locale->text('UStVA-Nr. 74'),
173 76 => $locale->text('UStVA-Nr. 76'),
174 77 => $locale->text('UStVA-Nr. 77'),
175 80 => $locale->text('UStVA-Nr. 80'),
176 84 => $locale->text('UStVA-Nr. 84'),
177 85 => $locale->text('UStVA-Nr. 85'),
178 86 => $locale->text('UStVA-Nr. 86 left'),
179 861 => $locale->text('UStVA-Nr. 86 right'),
180 91 => $locale->text('UStVA-Nr. 91'),
181 93 => $locale->text('UStVA-Nr. 93 left'),
182 931 => $locale->text('UStVA-Nr. 93 right'),
183 94 => $locale->text('UStVA-Nr. 94'),
184 95 => $locale->text('UStVA-Nr. 95'),
185 96 => $locale->text('UStVA-Nr. 96'),
186 97 => $locale->text('UStVA-Nr. 97 links'),
187 971 => $locale->text('UStVA-Nr. 97 rechts'),
188 98 => $locale->text('UStVA-Nr. 98'));
190 foreach $item (sort({ $a cmp $b } keys %ustva)) {
191 if ($item == $form->{pos_ustva}) {
192 $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
194 $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
201 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
202 <td><select name=pos_ustva>$form->{selectustva}</select></td>
203 <input type=hidden name=selectustva value="$form->{selectustva}">
206 $form->{selecteur} = "<option>\n";
207 %eur = (1 => "Umsatzerlöse",
208 2 => "sonstige Erlöse",
209 3 => "Privatanteile",
211 5 => "Ausserordentliche Erträge",
212 6 => "Vereinnahmte Umsatzst.",
213 7 => "Umsatzsteuererstattungen",
214 8 => "Wareneingänge",
215 9 => "Löhne und Gehälter",
216 10 => "Gesetzl. sozialer Aufw.",
218 12 => "Gas, Strom, Wasser",
219 13 => "Instandhaltung",
220 14 => "Steuern, Versich., Beiträge",
222 16 => "Kfz-Versicherungen",
223 17 => "Sonst. Fahrtkosten",
224 18 => "Werbe- und Reisekosten",
225 19 => "Instandhaltung u. Werkzeuge",
226 20 => "Fachzeitschriften, Bücher",
227 21 => "Miete für Einrichtungen",
228 22 => "Rechts- und Beratungskosten",
229 23 => "Bürobedarf, Porto, Telefon",
230 24 => "Sonstige Aufwendungen",
231 25 => "Abschreibungen auf Anlagever.",
232 26 => "Abschreibungen auf GWG",
234 28 => "Umsatzsteuerzahlungen",
236 30 => "Ausserordentlicher Aufwand",
237 31 => "Betriebliche Steuern");
238 foreach $item (sort({ $a <=> $b } keys(%eur))) {
239 if ($item == $form->{pos_eur}) {
240 $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
242 $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
249 <th align=right>| . $locale->text('EUER') . qq|</th>
250 <td><select name=pos_eur>$form->{selecteur}</select></td>
251 <input type=hidden name=selecteur value="$form->{selecteur}">
254 $form->{selectbwa} = "<option>\n";
256 %bwapos = (1 => 'Umsatzerlöse',
257 2 => 'Best.Verdg.FE/UE',
258 3 => 'Aktiv.Eigenleistung',
259 4 => 'Mat./Wareneinkauf',
260 5 => 'So.betr.Erlöse',
261 10 => 'Personalkosten',
263 12 => 'Betriebl.Steuern',
264 13 => 'Vers./Beiträge',
265 14 => 'Kfz.Kosten o.St.',
266 15 => 'Werbe-Reisek.',
267 16 => 'Kosten Warenabgabe',
268 17 => 'Abschreibungen',
269 18 => 'Rep./instandhlt.',
270 19 => 'Übrige Steuern',
271 20 => 'Sonst.Kosten',
273 31 => 'Sonst.neutr.Aufw.',
275 33 => 'Sonst.neutr.Ertrag',
276 34 => 'Verr.kalk.Kosten',
277 35 => 'Steuern Eink.u.Ertr.');
278 foreach $item (sort({ $a <=> $b } keys %bwapos)) {
279 if ($item == $form->{pos_bwa}) {
280 $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
282 $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
289 <th align=right>| . $locale->text('BWA') . qq|</th>
290 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
291 <input type=hidden name=selectbwa value="$form->{selectbwa}">
294 # Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
295 # $form->{selectbilanz} = "<option>\n";
296 # foreach $item ((1, 2, 3, 4)) {
297 # if ($item == $form->{pos_bilanz}) {
298 # $form->{selectbilanz} .= "<option value=$item selected>$item\n";
300 # $form->{selectbilanz} .= "<option value=$item>$item\n";
307 # <th align=right>| . $locale->text('Bilanz') . qq|</th>
308 # <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
309 # <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
312 # this is for our parser only!
313 # type=submit $locale->text('Add Account')
314 # type=submit $locale->text('Edit Account')
315 $form->{type} = "account";
322 <form method=post action=$form->{script}>
324 <input type=hidden name=id value=$form->{id}>
325 <input type=hidden name=type value=account>
326 <input type=hidden name=orphaned value=$form->{orphaned}>
327 <input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
329 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
330 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
331 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
332 <input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
333 <input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
335 <table border=0 width=100%>
337 <th class=listtop>$form->{title}</th>
344 <th align=right>| . $locale->text('Account Number') . qq|</th>
345 <td><input name=accno size=20 value=$form->{accno}></td>
348 <th align=right>| . $locale->text('Description') . qq|</th>
349 <td><input name=description size=40 value="$form->{description}"></td>
352 <th align=right>| . $locale->text('Account Type') . qq|</th>
356 <td><input name=category type=radio class=radio value=A $checked{A_}> |
357 . $locale->text('Asset') . qq|\n<br>
358 <input name=category type=radio class=radio value=L $checked{L_}> |
359 . $locale->text('Liability') . qq|\n<br>
360 <input name=category type=radio class=radio value=Q $checked{Q_}> |
361 . $locale->text('Equity') . qq|\n<br>
362 <input name=category type=radio class=radio value=I $checked{I_}> |
363 . $locale->text('Revenue') . qq|\n<br>
364 <input name=category type=radio class=radio value=E $checked{E_}> |
365 . $locale->text('Expense') . qq|</td>
366 <td width=50> </td>
368 <input name=charttype type=radio class=radio value="H" $checked{H}> |
369 . $locale->text('Heading') . qq|<br>
370 <input name=charttype type=radio class=radio value="A" $checked{A}> |
371 . $locale->text('Account') . qq|</td>
378 if ($form->{charttype} eq "A") {
385 . $locale->text('Is this a summary account to record') . qq|</th>
387 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
388 . $locale->text('AR')
389 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
390 . $locale->text('AP')
391 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
392 . $locale->text('Inventory')
399 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
405 <th align=left>| . $locale->text('Receivables') . qq|</th>
406 <th align=left>| . $locale->text('Payables') . qq|</th>
407 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
408 <th align=left>| . $locale->text('Service Items') . qq|</th>
412 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
413 . $locale->text('Revenue') . qq|\n<br>
414 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
415 . $locale->text('Receipt') . qq|\n<br>
416 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
417 . $locale->text('Tax') . qq|
420 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
421 . $locale->text('Expense/Asset') . qq|\n<br>
422 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
423 . $locale->text('Payment') . qq|\n<br>
424 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
425 . $locale->text('Tax') . qq|
428 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
429 . $locale->text('Revenue') . qq|\n<br>
430 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
431 . $locale->text('Expense') . qq|\n<br>
432 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
433 . $locale->text('Tax') . qq|
436 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
437 . $locale->text('Revenue') . qq|\n<br>
438 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
439 . $locale->text('Expense') . qq|\n<br>
440 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
441 . $locale->text('Tax') . qq|
461 <td><hr size=3 noshade></td>
466 $lxdebug->leave_sub();
470 $lxdebug->enter_sub();
474 <input name=callback type=hidden value="$form->{callback}">
476 <input type=hidden name=path value=$form->{path}>
477 <input type=hidden name=login value=$form->{login}>
478 <input type=hidden name=password value=$form->{password}>
481 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
483 <input type=submit class=submit name=action value="|
484 . $locale->text('Save') . qq|">
488 if ($form->{id} && $form->{orphaned}) {
489 print qq|<input type=submit class=submit name=action value="|
490 . $locale->text('Delete') . qq|">|;
493 if ($form->{menubar}) {
494 require "$form->{path}/menu.pl";
505 $lxdebug->leave_sub();
509 $lxdebug->enter_sub();
511 $form->isblank("accno", $locale->text('Account Number missing!'));
512 $form->isblank("category", $locale->text('Account Type missing!'));
514 $form->redirect($locale->text('Account saved!'))
515 if (AM->save_account(\%myconfig, \%$form));
516 $form->error($locale->text('Cannot save account!'));
518 $lxdebug->leave_sub();
522 $lxdebug->enter_sub();
524 CA->all_accounts(\%myconfig, \%$form);
526 $form->{title} = $locale->text('Chart of Accounts');
530 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
532 @column_index = qw(accno gifi_accno description debit credit link);
534 $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
535 $column_header{gifi_accno} =
536 qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
537 $column_header{description} =
538 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
539 $column_header{debit} = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
540 $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
541 $column_header{link} = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
544 $colspan = $#column_index + 1;
551 <th class=listtop colspan=$colspan>$form->{title}</th>
554 <tr class=listheading>
557 map { print "$column_header{$_}\n" } @column_index;
564 $callback = $form->escape($callback);
566 foreach $ca (@{ $form->{CA} }) {
568 $ca->{debit} = " ";
569 $ca->{credit} = " ";
571 if ($ca->{amount} > 0) {
573 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
575 if ($ca->{amount} < 0) {
577 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
580 $ca->{link} =~ s/:/<br>/og;
582 if ($ca->{charttype} eq "H") {
583 print qq|<tr class=listheading>|;
585 $column_data{accno} =
586 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>|;
587 $column_data{gifi_accno} =
588 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>|;
589 $column_data{description} = qq|<th>$ca->{description} </th>|;
590 $column_data{debit} = qq|<th> </th>|;
591 $column_data{credit} = qq| <th> </th>|;
592 $column_data{link} = qq|<th> </th>|;
598 <tr valign=top class=listrow$i>|;
599 $column_data{accno} =
600 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>|;
601 $column_data{gifi_accno} =
602 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>|;
603 $column_data{description} = qq|<td>$ca->{description} </td>|;
604 $column_data{debit} = qq|<td align=right>$ca->{debit}</td>|;
605 $column_data{credit} = qq|<td align=right>$ca->{credit}</td>|;
606 $column_data{link} = qq|<td>$ca->{link} </td>|;
610 map { print "$column_data{$_}\n" } @column_index;
616 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
623 $lxdebug->leave_sub();
627 $lxdebug->enter_sub();
629 $form->{title} = $locale->text('Delete Account');
632 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
634 if ($form->{id} == $form->{$id}) {
635 $form->error($locale->text('Cannot delete default account!'));
639 $form->redirect($locale->text('Account deleted!'))
640 if (AM->delete_account(\%myconfig, \%$form));
641 $form->error($locale->text('Cannot delete account!'));
643 $lxdebug->leave_sub();
647 $lxdebug->enter_sub();
649 @{ $form->{fields} } = (accno, description);
650 $form->{table} = "gifi";
651 $form->{sortorder} = "accno";
653 AM->gifi_accounts(\%myconfig, \%$form);
655 $form->{title} = $locale->text('GIFI');
659 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
661 @column_index = qw(accno description);
663 $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
664 $column_header{description} =
665 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
668 $colspan = $#column_index + 1;
675 <th class=listtop colspan=$colspan>$form->{title}</th>
678 <tr class=listheading>
681 map { print "$column_header{$_}\n" } @column_index;
688 $callback = $form->escape($callback);
690 foreach $ca (@{ $form->{ALL} }) {
696 <tr valign=top class=listrow$i>|;
698 $column_data{accno} =
699 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>|;
700 $column_data{description} = qq|<td>$ca->{description} </td>|;
702 map { print "$column_data{$_}\n" } @column_index;
709 <td colspan=$colspan><hr size=3 noshade></td>
717 $lxdebug->leave_sub();
721 $lxdebug->enter_sub();
723 $form->{title} = "Add";
727 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
734 $lxdebug->leave_sub();
738 $lxdebug->enter_sub();
740 $form->{title} = "Edit";
742 AM->get_gifi(\%myconfig, \%$form);
747 $lxdebug->leave_sub();
751 $lxdebug->enter_sub();
753 $form->{title} = $locale->text("$form->{title} GIFI");
755 # $locale->text('Add GIFI')
756 # $locale->text('Edit GIFI')
758 $form->{description} =~ s/\"/"/g;
765 <form method=post action=$form->{script}>
767 <input type=hidden name=id value=$form->{accno}>
768 <input type=hidden name=type value=gifi>
772 <th class=listtop>$form->{title}</th>
779 <th align=right>| . $locale->text('GIFI') . qq|</th>
780 <td><input name=accno size=20 value=$form->{accno}></td>
783 <th align=right>| . $locale->text('Description') . qq|</th>
784 <td><input name=description size=60 value="$form->{description}"></td>
790 <td colspan=2><hr size=3 noshade></td>
795 $lxdebug->leave_sub();
799 $lxdebug->enter_sub();
803 <input name=callback type=hidden value="$form->{callback}">
805 <input type=hidden name=path value=$form->{path}>
806 <input type=hidden name=login value=$form->{login}>
807 <input type=hidden name=password value=$form->{password}>
809 <br><input type=submit class=submit name=action value="|
810 . $locale->text('Save') . qq|">|;
814 <input type=submit class=submit name=action value="|
815 . $locale->text('Copy to COA') . qq|">
818 if ($form->{accno} && $form->{orphaned}) {
819 print qq|<input type=submit class=submit name=action value="|
820 . $locale->text('Delete') . qq|">|;
824 if ($form->{menubar}) {
825 require "$form->{path}/menu.pl";
836 $lxdebug->leave_sub();
840 $lxdebug->enter_sub();
842 $form->isblank("accno", $locale->text('GIFI missing!'));
843 AM->save_gifi(\%myconfig, \%$form);
844 $form->redirect($locale->text('GIFI saved!'));
846 $lxdebug->leave_sub();
850 $lxdebug->enter_sub();
852 $form->isblank("accno", $locale->text('GIFI missing!'));
854 AM->save_gifi(\%myconfig, \%$form);
857 $form->{gifi_accno} = $form->{accno};
858 $form->{title} = "Add";
859 $form->{charttype} = "A";
864 $lxdebug->leave_sub();
868 $lxdebug->enter_sub();
870 AM->delete_gifi(\%myconfig, \%$form);
871 $form->redirect($locale->text('GIFI deleted!'));
873 $lxdebug->leave_sub();
877 $lxdebug->enter_sub();
879 $form->{title} = "Add";
883 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
884 unless $form->{callback};
889 $lxdebug->leave_sub();
892 sub edit_department {
893 $lxdebug->enter_sub();
895 $form->{title} = "Edit";
897 AM->get_department(\%myconfig, \%$form);
902 $lxdebug->leave_sub();
905 sub list_department {
906 $lxdebug->enter_sub();
908 AM->departments(\%myconfig, \%$form);
911 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
913 $callback = $form->escape($form->{callback});
915 $form->{title} = $locale->text('Departments');
917 @column_index = qw(description cost profit);
919 $column_header{description} =
920 qq|<th class=listheading width=90%>|
921 . $locale->text('Description')
923 $column_header{cost} =
924 qq|<th class=listheading nowrap>|
925 . $locale->text('Cost Center')
927 $column_header{profit} =
928 qq|<th class=listheading nowrap>|
929 . $locale->text('Profit Center')
939 <th class=listtop>$form->{title}</th>
945 <tr class=listheading>
948 map { print "$column_header{$_}\n" } @column_index;
954 foreach $ref (@{ $form->{ALL} }) {
960 <tr valign=top class=listrow$i>
963 $costcenter = ($ref->{role} eq "C") ? "X" : "";
964 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
966 $column_data{description} =
967 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>|;
968 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
969 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
971 map { print "$column_data{$_}\n" } @column_index;
983 <td><hr size=3 noshade></td>
988 <form method=post action=$form->{script}>
990 <input name=callback type=hidden value="$form->{callback}">
992 <input type=hidden name=type value=department>
994 <input type=hidden name=path value=$form->{path}>
995 <input type=hidden name=login value=$form->{login}>
996 <input type=hidden name=password value=$form->{password}>
998 <input class=submit type=submit name=action value="|
999 . $locale->text('Add') . qq|">|;
1001 if ($form->{menubar}) {
1002 require "$form->{path}/menu.pl";
1013 $lxdebug->leave_sub();
1016 sub department_header {
1017 $lxdebug->enter_sub();
1019 $form->{title} = $locale->text("$form->{title} Department");
1021 # $locale->text('Add Department')
1022 # $locale->text('Edit Department')
1024 $form->{description} =~ s/\"/"/g;
1026 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
1028 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
1031 qq|<input name=description size=60 value="$form->{description}">|;
1034 $costcenter = "checked" if $form->{role} eq "C";
1035 $profitcenter = "checked" if $form->{role} eq "P";
1042 <form method=post action=$form->{script}>
1044 <input type=hidden name=id value=$form->{id}>
1045 <input type=hidden name=type value=department>
1049 <th class=listtop colspan=2>$form->{title}</th>
1051 <tr height="5"></tr>
1053 <th align=right>| . $locale->text('Description') . qq|</th>
1054 <td>$description</td>
1058 <td><input type=radio style=radio name=role value="C" $costcenter> |
1059 . $locale->text('Cost Center') . qq|
1060 <input type=radio style=radio name=role value="P" $profitcenter> |
1061 . $locale->text('Profit Center') . qq|
1064 <td colspan=2><hr size=3 noshade></td>
1069 $lxdebug->leave_sub();
1072 sub save_department {
1073 $lxdebug->enter_sub();
1075 $form->isblank("description", $locale->text('Description missing!'));
1076 AM->save_department(\%myconfig, \%$form);
1077 $form->redirect($locale->text('Department saved!'));
1079 $lxdebug->leave_sub();
1082 sub delete_department {
1083 $lxdebug->enter_sub();
1085 AM->delete_department(\%myconfig, \%$form);
1086 $form->redirect($locale->text('Department deleted!'));
1088 $lxdebug->leave_sub();
1092 $lxdebug->enter_sub();
1094 $form->{title} = "Add";
1097 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1098 unless $form->{callback};
1103 $lxdebug->leave_sub();
1107 $lxdebug->enter_sub();
1109 $form->{title} = "Edit";
1111 AM->get_business(\%myconfig, \%$form);
1115 $form->{orphaned} = 1;
1118 $lxdebug->leave_sub();
1122 $lxdebug->enter_sub();
1124 AM->business(\%myconfig, \%$form);
1127 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1129 $callback = $form->escape($form->{callback});
1131 $form->{title} = $locale->text('Type of Business');
1133 @column_index = qw(description discount customernumberinit);
1135 $column_header{description} =
1136 qq|<th class=listheading width=60%>|
1137 . $locale->text('Description')
1139 $column_header{discount} =
1140 qq|<th class=listheading width=10%>|
1141 . $locale->text('Discount')
1143 $column_header{customernumberinit} =
1144 qq|<th class=listheading>|
1145 . $locale->text('Customernumberinit')
1155 <th class=listtop>$form->{title}</th>
1157 <tr height="5"></tr>
1161 <tr class=listheading>
1164 map { print "$column_header{$_}\n" } @column_index;
1170 foreach $ref (@{ $form->{ALL} }) {
1176 <tr valign=top class=listrow$i>
1180 $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
1183 ? "<b>$ref->{description}</b>"
1184 : "$ref->{description}";
1185 $column_data{description} =
1186 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>|;
1187 $column_data{discount} = qq|<td align=right>$discount</td>|;
1188 $column_data{customernumberinit} =
1189 qq|<td align=right>$ref->{customernumberinit}</td>|;
1191 map { print "$column_data{$_}\n" } @column_index;
1203 <td><hr size=3 noshade></td>
1208 <form method=post action=$form->{script}>
1210 <input name=callback type=hidden value="$form->{callback}">
1212 <input type=hidden name=type value=business>
1214 <input type=hidden name=path value=$form->{path}>
1215 <input type=hidden name=login value=$form->{login}>
1216 <input type=hidden name=password value=$form->{password}>
1218 <input class=submit type=submit name=action value="|
1219 . $locale->text('Add') . qq|">|;
1221 if ($form->{menubar}) {
1222 require "$form->{path}/menu.pl";
1234 $lxdebug->leave_sub();
1237 sub business_header {
1238 $lxdebug->enter_sub();
1240 $form->{title} = $locale->text("$form->{title} Business");
1241 $form->{salesman} = "checked" if $form->{salesman};
1243 # $locale->text('Add Business')
1244 # $locale->text('Edit Business')
1246 $form->{description} =~ s/\"/"/g;
1248 $form->format_amount(\%myconfig, $form->{discount} * 100);
1255 <form method=post action=$form->{script}>
1257 <input type=hidden name=id value=$form->{id}>
1258 <input type=hidden name=type value=business>
1262 <th class=listtop colspan=2>$form->{title}</th>
1264 <tr height="5"></tr>
1266 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1267 <td><input name=description size=30 value="$form->{description}"></td>
1270 <th align=right>| . $locale->text('Discount') . qq| %</th>
1271 <td><input name=discount size=5 value=$form->{discount}></td>
1274 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1275 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1278 <td align=right>| . $locale->text('Salesman') . qq|</td>
1279 <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
1281 <td colspan=2><hr size=3 noshade></td>
1286 $lxdebug->leave_sub();
1290 $lxdebug->enter_sub();
1292 $form->isblank("description", $locale->text('Description missing!'));
1293 AM->save_business(\%myconfig, \%$form);
1294 $form->redirect($locale->text('Business saved!'));
1296 $lxdebug->leave_sub();
1299 sub delete_business {
1300 $lxdebug->enter_sub();
1302 AM->delete_business(\%myconfig, \%$form);
1303 $form->redirect($locale->text('Business deleted!'));
1305 $lxdebug->leave_sub();
1309 $lxdebug->enter_sub();
1311 $form->{title} = "Add";
1314 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1315 unless $form->{callback};
1320 $lxdebug->leave_sub();
1324 $lxdebug->enter_sub();
1326 $form->{title} = "Edit";
1328 AM->get_language(\%myconfig, \%$form);
1332 $form->{orphaned} = 1;
1335 $lxdebug->leave_sub();
1339 $lxdebug->enter_sub();
1341 AM->language(\%myconfig, \%$form);
1344 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1346 $callback = $form->escape($form->{callback});
1348 $form->{title} = $locale->text('Languages');
1350 @column_index = qw(description template_code article_code);
1352 $column_header{description} =
1353 qq|<th class=listheading width=60%>|
1354 . $locale->text('Description')
1356 $column_header{template_code} =
1357 qq|<th class=listheading width=10%>|
1358 . $locale->text('Template Code')
1360 $column_header{article_code} =
1361 qq|<th class=listheading>|
1362 . $locale->text('Article Code')
1372 <th class=listtop>$form->{title}</th>
1374 <tr height="5"></tr>
1378 <tr class=listheading>
1381 map { print "$column_header{$_}\n" } @column_index;
1387 foreach $ref (@{ $form->{ALL} }) {
1393 <tr valign=top class=listrow$i>
1397 $column_data{description} =
1398 qq|<td><a href=$form->{script}?action=edit_language&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
1399 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1400 $column_data{article_code} =
1401 qq|<td align=right>$ref->{article_code}</td>|;
1403 map { print "$column_data{$_}\n" } @column_index;
1415 <td><hr size=3 noshade></td>
1420 <form method=post action=$form->{script}>
1422 <input name=callback type=hidden value="$form->{callback}">
1424 <input type=hidden name=type value=language>
1426 <input type=hidden name=path value=$form->{path}>
1427 <input type=hidden name=login value=$form->{login}>
1428 <input type=hidden name=password value=$form->{password}>
1430 <input class=submit type=submit name=action value="|
1431 . $locale->text('Add') . qq|">|;
1433 if ($form->{menubar}) {
1434 require "$form->{path}/menu.pl";
1446 $lxdebug->leave_sub();
1449 sub language_header {
1450 $lxdebug->enter_sub();
1452 $form->{title} = $locale->text("$form->{title} Language");
1454 # $locale->text('Add Language')
1455 # $locale->text('Edit Language')
1457 $form->{description} =~ s/\"/"/g;
1458 $form->{template_code} =~ s/\"/"/g;
1459 $form->{article_code} =~ s/\"/"/g;
1467 <form method=post action=$form->{script}>
1469 <input type=hidden name=id value=$form->{id}>
1470 <input type=hidden name=type value=language>
1474 <th class=listtop colspan=2>$form->{title}</th>
1476 <tr height="5"></tr>
1478 <th align=right>| . $locale->text('Language') . qq|</th>
1479 <td><input name=description size=30 value="$form->{description}"></td>
1482 <th align=right>| . $locale->text('Template Code') . qq|</th>
1483 <td><input name=template_code size=5 value=$form->{template_code}></td>
1486 <th align=right>| . $locale->text('Article Code') . qq|</th>
1487 <td><input name=article_code size=10 value=$form->{article_code}></td>
1489 <td colspan=2><hr size=3 noshade></td>
1494 $lxdebug->leave_sub();
1498 $lxdebug->enter_sub();
1500 $form->isblank("description", $locale->text('Language missing!'));
1501 $form->isblank("template_code", $locale->text('Template Code missing!'));
1502 $form->isblank("article_code", $locale->text('Article Code missing!'));
1503 AM->save_language(\%myconfig, \%$form);
1504 $form->redirect($locale->text('Language saved!'));
1506 $lxdebug->leave_sub();
1509 sub delete_language {
1510 $lxdebug->enter_sub();
1512 AM->delete_language(\%myconfig, \%$form);
1513 $form->redirect($locale->text('Language deleted!'));
1515 $lxdebug->leave_sub();
1519 sub add_buchungsgruppe {
1520 $lxdebug->enter_sub();
1522 # $locale->text("Add Buchungsgruppe")
1523 # $locale->text("Edit Buchungsgruppe")
1524 $form->{title} = "Add";
1527 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1528 unless $form->{callback};
1529 AM->get_buchungsgruppe(\%myconfig, \%$form);
1531 &buchungsgruppe_header;
1534 $lxdebug->leave_sub();
1537 sub edit_buchungsgruppe {
1538 $lxdebug->enter_sub();
1540 $form->{title} = "Edit";
1542 AM->get_buchungsgruppe(\%myconfig, \%$form);
1544 &buchungsgruppe_header;
1548 $lxdebug->leave_sub();
1551 sub list_buchungsgruppe {
1552 $lxdebug->enter_sub();
1554 AM->buchungsgruppe(\%myconfig, \%$form);
1557 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1559 $callback = $form->escape($form->{callback});
1561 $form->{title} = $locale->text('Buchungsgruppen');
1563 @column_index = qw(description inventory_accno income_accno_0 expense_accno_0 income_accno_1 expense_accno_1 income_accno_2 expense_accno_2 income_accno_3 expense_accno_3 );
1565 $column_header{description} =
1566 qq|<th class=listheading width=60%>|
1567 . $locale->text('Description')
1569 $column_header{inventory_accno} =
1570 qq|<th class=listheading width=10%>|
1571 . $locale->text('Bestandskonto')
1573 $column_header{income_accno_0} =
1574 qq|<th class=listheading>|
1575 . $locale->text('Erlöse Inland')
1577 $column_header{expense_accno_0} =
1578 qq|<th class=listheading>|
1579 . $locale->text('Aufwand Inland')
1581 $column_header{income_accno_1} =
1582 qq|<th class=listheading>|
1583 . $locale->text('Erlöse EU o. UStId')
1585 $column_header{expense_accno_1} =
1586 qq|<th class=listheading>|
1587 . $locale->text('Aufwand EU o. UStId')
1589 $column_header{income_accno_2} =
1590 qq|<th class=listheading>|
1591 . $locale->text('Erlöse EU m. UStId')
1593 $column_header{expense_accno_2} =
1594 qq|<th class=listheading>|
1595 . $locale->text('Aufwand EU m. UStId')
1597 $column_header{income_accno_3} =
1598 qq|<th class=listheading>|
1599 . $locale->text('Erlöse Ausland')
1601 $column_header{expense_accno_3} =
1602 qq|<th class=listheading>|
1603 . $locale->text('Aufwand Ausland')
1612 <th class=listtop>$form->{title}</th>
1614 <tr height="5"></tr>
1618 <tr class=listheading>
1621 map { print "$column_header{$_}\n" } @column_index;
1627 foreach $ref (@{ $form->{ALL} }) {
1633 <tr valign=top class=listrow$i>
1637 $column_data{description} =
1638 qq|<td><a href=$form->{script}?action=edit_buchungsgruppe&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
1639 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1640 $column_data{income_accno_0} =
1641 qq|<td align=right>$ref->{income_accno_0}</td>|;
1642 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1643 $column_data{income_accno_1} =
1644 qq|<td align=right>$ref->{income_accno_1}</td>|;
1645 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1646 $column_data{income_accno_2} =
1647 qq|<td align=right>$ref->{income_accno_2}</td>|;
1648 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1649 $column_data{income_accno_3} =
1650 qq|<td align=right>$ref->{income_accno_3}</td>|;
1651 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1653 map { print "$column_data{$_}\n" } @column_index;
1665 <td><hr size=3 noshade></td>
1670 <form method=post action=$form->{script}>
1672 <input name=callback type=hidden value="$form->{callback}">
1674 <input type=hidden name=type value=buchungsgruppe>
1676 <input type=hidden name=path value=$form->{path}>
1677 <input type=hidden name=login value=$form->{login}>
1678 <input type=hidden name=password value=$form->{password}>
1680 <input class=submit type=submit name=action value="|
1681 . $locale->text('Add') . qq|">|;
1683 if ($form->{menubar}) {
1684 require "$form->{path}/menu.pl";
1696 $lxdebug->leave_sub();
1699 sub buchungsgruppe_header {
1700 $lxdebug->enter_sub();
1702 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1704 # $locale->text('Buchungsgruppe hinzufügen')
1705 # $locale->text('Buchungsgruppe bearbeiten')
1707 $form->{description} =~ s/\"/"/g;
1709 # build the popup menus
1710 $form->{taxaccounts} = "";
1711 foreach $key (keys %{ $form->{IC_links} }) {
1712 foreach $ref (@{ $form->{IC_links}{$key} }) {
1714 # if this is a tax field
1715 if ($key =~ /IC_tax/) {
1716 if ($key =~ /$item/) {
1717 $form->{taxaccounts} .= "$ref->{accno} ";
1718 $form->{"IC_tax_$ref->{accno}_description"} =
1719 "$ref->{accno}--$ref->{description}";
1722 if ($form->{amount}{ $ref->{accno} }) {
1723 $form->{"IC_tax_$ref->{accno}"} = "checked";
1726 $form->{"IC_tax_$ref->{accno}"} = "checked";
1731 $form->{"select$key"} .=
1732 "<option value=$ref->{id} $ref->{selected}>$ref->{accno}--$ref->{description}\n";
1733 if (($key eq "IC") && ($ref->{selected} eq "selected")) {
1734 $form->{IC_default} = $ref->{id};
1736 if ($form->{amount}{$key} eq $ref->{accno}) {
1737 $form->{$key} = "$ref->{accno}--$ref->{description}";
1743 $form->{selectIC_income} = $form->{selectIC_sale};
1744 $form->{selectIC_expense} = $form->{selectIC_cogs};
1745 $form->{IC_income} = $form->{IC_sale};
1746 $form->{IC_expense} = $form->{IC_cogs};
1749 $form->{selectIC} =~ s/selected//g;
1750 $form->{selectIC} =~ s/ value=\$form->{inventory_accno_id}/ value=\$form->{inventory_accno_id} selected/;
1751 $form->{selectIC_income} =~ s/selected//g;
1752 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1753 $form->{selectIC_expense} =~ s/selected//g;
1754 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1760 <th align=right>| . $locale->text('Inventory') . qq|</th>
1761 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1762 <input name=selectIC type=hidden value="$form->{selectIC}">
1766 <input type=hidden name=inventory_accno_id value=1>|;
1770 $linkaccounts .= qq|
1772 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
1773 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
1776 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
1777 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
1780 $form->{selectIC_income} =~ s/selected//g;
1781 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
1782 $form->{selectIC_expense} =~ s/selected//g;
1783 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
1785 $linkaccounts .= qq| <tr>
1786 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
1787 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
1790 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
1791 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
1795 $form->{selectIC_income} =~ s/selected//g;
1796 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
1797 $form->{selectIC_expense} =~ s/selected//g;
1798 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
1801 $linkaccounts .= qq| <tr>
1802 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
1803 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
1806 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
1807 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
1811 $form->{selectIC_income} =~ s/selected//g;
1812 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
1813 $form->{selectIC_expense} =~ s/selected//g;
1814 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
1817 $linkaccounts .= qq| <tr>
1818 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
1819 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
1822 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
1823 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
1833 <form method=post action=$form->{script}>
1835 <input type=hidden name=id value=$form->{id}>
1836 <input type=hidden name=type value=buchungsgruppe>
1840 <th class=listtop colspan=2>$form->{title}</th>
1842 <tr height="5"></tr>
1844 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
1845 <td><input name=description size=30 value="$form->{description}"></td>
1848 <td colspan=2><hr size=3 noshade></td>
1853 $lxdebug->leave_sub();
1856 sub save_buchungsgruppe {
1857 $lxdebug->enter_sub();
1859 $form->isblank("description", $locale->text('Description missing!'));
1861 AM->save_buchungsgruppe(\%myconfig, \%$form);
1862 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
1864 $lxdebug->leave_sub();
1867 sub delete_buchungsgruppe {
1868 $lxdebug->enter_sub();
1870 AM->delete_buchungsgruppe(\%myconfig, \%$form);
1871 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
1873 $lxdebug->leave_sub();
1878 $lxdebug->enter_sub();
1880 $form->{title} = "Add";
1883 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1884 unless $form->{callback};
1889 $lxdebug->leave_sub();
1893 $lxdebug->enter_sub();
1895 $form->{title} = "Edit";
1897 AM->get_printer(\%myconfig, \%$form);
1901 $form->{orphaned} = 1;
1904 $lxdebug->leave_sub();
1908 $lxdebug->enter_sub();
1910 AM->printer(\%myconfig, \%$form);
1913 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1915 $callback = $form->escape($form->{callback});
1917 $form->{title} = $locale->text('Printer');
1919 @column_index = qw(printer_description printer_command template_code);
1921 $column_header{printer_description} =
1922 qq|<th class=listheading width=60%>|
1923 . $locale->text('Printer Description')
1925 $column_header{printer_command} =
1926 qq|<th class=listheading width=10%>|
1927 . $locale->text('Printer Command')
1929 $column_header{template_code} =
1930 qq|<th class=listheading>|
1931 . $locale->text('Template Code')
1941 <th class=listtop>$form->{title}</th>
1943 <tr height="5"></tr>
1947 <tr class=listheading>
1950 map { print "$column_header{$_}\n" } @column_index;
1956 foreach $ref (@{ $form->{ALL} }) {
1962 <tr valign=top class=listrow$i>
1966 $column_data{printer_description} =
1967 qq|<td><a href=$form->{script}?action=edit_printer&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{printer_description}</td>|;
1968 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
1969 $column_data{template_code} =
1970 qq|<td align=right>$ref->{template_code}</td>|;
1972 map { print "$column_data{$_}\n" } @column_index;
1984 <td><hr size=3 noshade></td>
1989 <form method=post action=$form->{script}>
1991 <input name=callback type=hidden value="$form->{callback}">
1993 <input type=hidden name=type value=printer>
1995 <input type=hidden name=path value=$form->{path}>
1996 <input type=hidden name=login value=$form->{login}>
1997 <input type=hidden name=password value=$form->{password}>
1999 <input class=submit type=submit name=action value="|
2000 . $locale->text('Add') . qq|">|;
2002 if ($form->{menubar}) {
2003 require "$form->{path}/menu.pl";
2015 $lxdebug->leave_sub();
2018 sub printer_header {
2019 $lxdebug->enter_sub();
2021 $form->{title} = $locale->text("$form->{title} Printer");
2023 # $locale->text('Add Printer')
2024 # $locale->text('Edit Printer')
2026 $form->{printer_description} =~ s/\"/"/g;
2027 $form->{template_code} =~ s/\"/"/g;
2028 $form->{printer_command} =~ s/\"/"/g;
2036 <form method=post action=$form->{script}>
2038 <input type=hidden name=id value=$form->{id}>
2039 <input type=hidden name=type value=printer>
2043 <th class=listtop colspan=2>$form->{title}</th>
2045 <tr height="5"></tr>
2047 <th align=right>| . $locale->text('Printer') . qq|</th>
2048 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2051 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2052 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2055 <th align=right>| . $locale->text('Template Code') . qq|</th>
2056 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2058 <td colspan=2><hr size=3 noshade></td>
2063 $lxdebug->leave_sub();
2067 $lxdebug->enter_sub();
2069 $form->isblank("printer_description", $locale->text('Description missing!'));
2070 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2071 AM->save_printer(\%myconfig, \%$form);
2072 $form->redirect($locale->text('Printer saved!'));
2074 $lxdebug->leave_sub();
2077 sub delete_printer {
2078 $lxdebug->enter_sub();
2080 AM->delete_printer(\%myconfig, \%$form);
2081 $form->redirect($locale->text('Printer deleted!'));
2083 $lxdebug->leave_sub();
2088 $lxdebug->enter_sub();
2090 $form->{title} = "Add";
2093 "$form->{script}?action=add_adr&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2094 unless $form->{callback};
2099 $lxdebug->leave_sub();
2103 $lxdebug->enter_sub();
2105 $form->{title} = "Edit";
2107 AM->get_adr(\%myconfig, \%$form);
2111 $form->{orphaned} = 1;
2114 $lxdebug->leave_sub();
2118 $lxdebug->enter_sub();
2120 AM->adr(\%myconfig, \%$form);
2123 "$form->{script}?action=list_adr&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2125 $callback = $form->escape($form->{callback});
2127 $form->{title} = $locale->text('ADR');
2129 @column_index = qw(adr_code adr_description);
2131 $column_header{adr_description} =
2132 qq|<th class=listheading width=60%>|
2133 . $locale->text('ADR Description')
2135 $column_header{adr_code} =
2136 qq|<th class=listheading width=10%>|
2137 . $locale->text('ADR Code')
2147 <th class=listtop>$form->{title}</th>
2149 <tr height="5"></tr>
2153 <tr class=listheading>
2156 map { print "$column_header{$_}\n" } @column_index;
2162 foreach $ref (@{ $form->{ALL} }) {
2168 <tr valign=top class=listrow$i>
2172 $column_data{adr_code} =
2173 qq|<td><a href=$form->{script}?action=edit_adr&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{adr_code}</td>|;
2174 $column_data{adr_description} = qq|<td align=left>$ref->{adr_description}</td>|;
2177 map { print "$column_data{$_}\n" } @column_index;
2189 <td><hr size=3 noshade></td>
2194 <form method=post action=$form->{script}>
2196 <input name=callback type=hidden value="$form->{callback}">
2198 <input type=hidden name=type value=adr>
2200 <input type=hidden name=path value=$form->{path}>
2201 <input type=hidden name=login value=$form->{login}>
2202 <input type=hidden name=password value=$form->{password}>
2204 <input class=submit type=submit name=action value="|
2205 . $locale->text('Add') . qq|">|;
2207 if ($form->{menubar}) {
2208 require "$form->{path}/menu.pl";
2220 $lxdebug->leave_sub();
2224 $lxdebug->enter_sub();
2226 $form->{title} = $locale->text("$form->{title} ADR");
2228 # $locale->text('Add ADR')
2229 # $locale->text('Edit ADR')
2231 $form->{adr_description} =~ s/\"/"/g;
2232 $form->{adr_code} =~ s/\"/"/g;
2240 <form method=post action=$form->{script}>
2242 <input type=hidden name=id value=$form->{id}>
2243 <input type=hidden name=type value=adr>
2247 <th class=listtop colspan=2>$form->{title}</th>
2249 <tr height="5"></tr>
2251 <th align=right>| . $locale->text('ADR Code') . qq|</th>
2252 <td><input name=adr_code size=30 value="$form->{adr_code}"></td>
2255 <th align=right>| . $locale->text('ADR Description') . qq|</th>
2256 <td><input name=adr_description size=60 value="$form->{adr_description}"></td>
2258 <td colspan=2><hr size=3 noshade></td>
2263 $lxdebug->leave_sub();
2267 $lxdebug->enter_sub();
2269 $form->isblank("adr_description", $locale->text('ADR Description missing!'));
2270 $form->isblank("adr_code", $locale->text('ADR Code missing!'));
2271 AM->save_adr(\%myconfig, \%$form);
2272 $form->redirect($locale->text('ADR saved!'));
2274 $lxdebug->leave_sub();
2279 $lxdebug->enter_sub();
2281 AM->delete_adr(\%myconfig, \%$form);
2282 $form->redirect($locale->text('ADR deleted!'));
2284 $lxdebug->leave_sub();
2289 $lxdebug->enter_sub();
2291 $form->{title} = "Add";
2294 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2295 unless $form->{callback};
2300 $lxdebug->leave_sub();
2304 $lxdebug->enter_sub();
2306 $form->{title} = "Edit";
2308 AM->get_payment(\%myconfig, \%$form);
2312 $form->{orphaned} = 1;
2315 $lxdebug->leave_sub();
2319 $lxdebug->enter_sub();
2321 AM->payment(\%myconfig, \%$form);
2324 "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2326 $callback = $form->escape($form->{callback});
2328 $form->{title} = $locale->text('Payment Terms');
2330 @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
2332 $column_header{description} =
2333 qq|<th class=listheading>|
2334 . $locale->text('Description')
2336 $column_header{description_long} =
2337 qq|<th class=listheading>|
2338 . $locale->text('Long Description')
2340 $column_header{terms_netto} =
2341 qq|<th class=listheading>|
2342 . $locale->text('Netto Terms')
2344 $column_header{terms_skonto} =
2345 qq|<th class=listheading>|
2346 . $locale->text('Skonto Terms')
2348 $column_header{percent_skonto} =
2349 qq|<th class=listheading>|
2350 . $locale->text('Skonto')
2360 <th class=listtop>$form->{title}</th>
2362 <tr height="5"></tr>
2366 <tr class=listheading>
2369 map { print "$column_header{$_}\n" } @column_index;
2375 foreach $ref (@{ $form->{ALL} }) {
2381 <tr valign=top class=listrow$i>
2385 $column_data{description} =
2386 qq|<td><a href=$form->{script}?action=edit_payment&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
2387 $column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|;
2388 $column_data{terms_netto} =
2389 qq|<td align=right>$ref->{terms_netto}</td>|;
2390 $column_data{terms_skonto} =
2391 qq|<td align=right>$ref->{terms_skonto}</td>|;
2392 $column_data{percent_skonto} =
2393 qq|<td align=right>$ref->{percent_skonto} %</td>|;
2394 map { print "$column_data{$_}\n" } @column_index;
2406 <td><hr size=3 noshade></td>
2411 <form method=post action=$form->{script}>
2413 <input name=callback type=hidden value="$form->{callback}">
2415 <input type=hidden name=type value=business>
2417 <input type=hidden name=path value=$form->{path}>
2418 <input type=hidden name=login value=$form->{login}>
2419 <input type=hidden name=password value=$form->{password}>
2421 <input class=submit type=submit name=action value="|
2422 . $locale->text('Add') . qq|">|;
2424 if ($form->{menubar}) {
2425 require "$form->{path}/menu.pl";
2437 $lxdebug->leave_sub();
2440 sub payment_header {
2441 $lxdebug->enter_sub();
2443 $form->{title} = $locale->text("$form->{title} Payment Terms");
2445 # $locale->text('Add Payment Terms')
2446 # $locale->text('Edit Payment Terms')
2448 $form->{description} =~ s/\"/"/g;
2457 <form method=post action=$form->{script}>
2459 <input type=hidden name=id value=$form->{id}>
2460 <input type=hidden name=type value=payment>
2464 <th class=listtop colspan=2>$form->{title}</th>
2466 <tr height="5"></tr>
2468 <th align=right>| . $locale->text('Description') . qq|</th>
2469 <td><input name=description size=30 value="$form->{description}"></td>
2472 <th align=right>| . $locale->text('Ranking') . qq|</th>
2473 <td><input name=ranking size=30 value="$form->{ranking}"></td>
2476 <th align=right>| . $locale->text('Long Description') . qq|</th>
2477 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2480 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2481 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2484 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2485 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2488 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2489 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2491 <td colspan=2><hr size=3 noshade></td>
2496 $lxdebug->leave_sub();
2500 $lxdebug->enter_sub();
2502 $form->isblank("description", $locale->text('Language missing!'));
2503 AM->save_payment(\%myconfig, \%$form);
2504 $form->redirect($locale->text('Payment Terms saved!'));
2506 $lxdebug->leave_sub();
2509 sub delete_payment {
2510 $lxdebug->enter_sub();
2512 AM->delete_payment(\%myconfig, \%$form);
2513 $form->redirect($locale->text('Payment terms deleted!'));
2515 $lxdebug->leave_sub();
2519 $lxdebug->enter_sub();
2521 $form->{title} = "Add";
2524 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2525 unless $form->{callback};
2530 $lxdebug->leave_sub();
2534 $lxdebug->enter_sub();
2536 $form->{title} = "Edit";
2538 AM->get_sic(\%myconfig, \%$form);
2542 $form->{orphaned} = 1;
2545 $lxdebug->leave_sub();
2549 $lxdebug->enter_sub();
2551 AM->sic(\%myconfig, \%$form);
2554 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2556 $callback = $form->escape($form->{callback});
2558 $form->{title} = $locale->text('Standard Industrial Codes');
2560 @column_index = qw(code description);
2562 $column_header{code} =
2563 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
2564 $column_header{description} =
2565 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
2574 <th class=listtop>$form->{title}</th>
2576 <tr height="5"></tr>
2580 <tr class=listheading>
2583 map { print "$column_header{$_}\n" } @column_index;
2589 foreach $ref (@{ $form->{ALL} }) {
2594 if ($ref->{sictype} eq 'H') {
2596 <tr valign=top class=listheading>
2598 $column_data{code} =
2599 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>|;
2600 $column_data{description} = qq|<th>$ref->{description}</th>|;
2604 <tr valign=top class=listrow$i>
2607 $column_data{code} =
2608 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>|;
2609 $column_data{description} = qq|<td>$ref->{description}</td>|;
2613 map { print "$column_data{$_}\n" } @column_index;
2625 <td><hr size=3 noshade></td>
2630 <form method=post action=$form->{script}>
2632 <input name=callback type=hidden value="$form->{callback}">
2634 <input type=hidden name=type value=sic>
2636 <input type=hidden name=path value=$form->{path}>
2637 <input type=hidden name=login value=$form->{login}>
2638 <input type=hidden name=password value=$form->{password}>
2640 <input class=submit type=submit name=action value="|
2641 . $locale->text('Add') . qq|">|;
2643 if ($form->{menubar}) {
2644 require "$form->{path}/menu.pl";
2655 $lxdebug->leave_sub();
2659 $lxdebug->enter_sub();
2661 $form->{title} = $locale->text("$form->{title} SIC");
2663 # $locale->text('Add SIC')
2664 # $locale->text('Edit SIC')
2666 $form->{code} =~ s/\"/"/g;
2667 $form->{description} =~ s/\"/"/g;
2669 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
2676 <form method=post action=$form->{script}>
2678 <input type=hidden name=type value=sic>
2679 <input type=hidden name=id value=$form->{code}>
2683 <th class=listtop colspan=2>$form->{title}</th>
2685 <tr height="5"></tr>
2687 <th align=right>| . $locale->text('Code') . qq|</th>
2688 <td><input name=code size=10 value=$form->{code}></td>
2692 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
2693 . $locale->text('Heading') . qq|</th>
2696 <th align=right>| . $locale->text('Description') . qq|</th>
2697 <td><input name=description size=60 value="$form->{description}"></td>
2699 <td colspan=2><hr size=3 noshade></td>
2704 $lxdebug->leave_sub();
2708 $lxdebug->enter_sub();
2710 $form->isblank("code", $locale->text('Code missing!'));
2711 $form->isblank("description", $locale->text('Description missing!'));
2712 AM->save_sic(\%myconfig, \%$form);
2713 $form->redirect($locale->text('SIC saved!'));
2715 $lxdebug->leave_sub();
2719 $lxdebug->enter_sub();
2721 AM->delete_sic(\%myconfig, \%$form);
2722 $form->redirect($locale->text('SIC deleted!'));
2724 $lxdebug->leave_sub();
2727 sub display_stylesheet {
2728 $lxdebug->enter_sub();
2730 $form->{file} = "css/$myconfig{stylesheet}";
2733 $lxdebug->leave_sub();
2737 $lxdebug->enter_sub();
2739 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2740 $form->{file} =~ s/^\/*//g;
2741 $form->{file} =~ s/$userspath//;
2743 $form->error("$!: $form->{file}") unless -f $form->{file};
2745 AM->load_template(\%$form);
2747 $form->{title} = $form->{file};
2749 # if it is anything but html
2750 if ($form->{file} !~ /\.html$/) {
2751 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2761 <form method=post action=$form->{script}>
2763 <input name=file type=hidden value=$form->{file}>
2764 <input name=type type=hidden value=template>
2766 <input type=hidden name=path value=$form->{path}>
2767 <input type=hidden name=login value=$form->{login}>
2768 <input type=hidden name=password value=$form->{password}>
2770 <input name=action type=submit class=submit value="|
2771 . $locale->text('Edit') . qq|">|;
2773 if ($form->{menubar}) {
2774 require "$form->{path}/menu.pl";
2785 $lxdebug->leave_sub();
2789 $lxdebug->enter_sub();
2791 AM->load_template(\%$form);
2793 $form->{title} = $locale->text('Edit Template');
2795 # convert   to &nbsp;
2796 $form->{body} =~ s/ /&nbsp;/gi;
2803 <form method=post action=$form->{script}>
2805 <input name=file type=hidden value=$form->{file}>
2806 <input name=type type=hidden value=template>
2808 <input type=hidden name=path value=$form->{path}>
2809 <input type=hidden name=login value=$form->{login}>
2810 <input type=hidden name=password value=$form->{password}>
2812 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
2814 <textarea name=body rows=25 cols=70>
2819 <input type=submit class=submit name=action value="|
2820 . $locale->text('Save') . qq|">|;
2822 if ($form->{menubar}) {
2823 require "$form->{path}/menu.pl";
2835 $lxdebug->leave_sub();
2839 $lxdebug->enter_sub();
2841 AM->save_template(\%$form);
2842 $form->redirect($locale->text('Template saved!'));
2844 $lxdebug->leave_sub();
2848 $lxdebug->enter_sub();
2850 # get defaults for account numbers and last numbers
2851 AM->defaultaccounts(\%myconfig, \%$form);
2853 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2855 ($item eq $myconfig{dateformat})
2856 ? "<option selected>$item\n"
2857 : "<option>$item\n";
2860 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2862 ($item eq $myconfig{numberformat})
2863 ? "<option selected>$item\n"
2864 : "<option>$item\n";
2867 foreach $item (qw(name company address signature)) {
2868 $myconfig{$item} =~ s/\"/"/g;
2871 foreach $item (qw(address signature)) {
2872 $myconfig{$item} =~ s/\\n/\r\n/g;
2875 %countrycodes = User->country_codes;
2877 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2881 ($myconfig{countrycode} eq $key)
2882 ? "<option selected value=$key>$countrycodes{$key}\n"
2883 : "<option value=$key>$countrycodes{$key}\n";
2885 $countrycodes = "<option>American English\n$countrycodes";
2887 # use an other input number format than output numberformat
2888 # look at Form.pm, sub parse_amount
2889 my $in_numberformat = '';
2890 $text1 = qq|value="0">| . $locale->text('equal Outputformat');
2891 $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
2892 @in_nf = ($text1, $text2);
2893 foreach $item (@in_nf) {
2895 (substr($item, 7, 1) eq $myconfig{in_numberformat})
2896 ? "<option selected $item\n"
2897 : "<option $item\n";
2900 foreach $key (keys %{ $form->{IC} }) {
2901 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2903 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2904 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2905 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2909 opendir CSS, "css/.";
2910 @all = grep /.*\.css$/, readdir CSS;
2913 foreach $item (@all) {
2914 if ($item eq $myconfig{stylesheet}) {
2915 $selectstylesheet .= qq|<option selected>$item\n|;
2917 $selectstylesheet .= qq|<option>$item\n|;
2920 $selectstylesheet .= "<option>\n";
2922 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2926 if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
2927 else { $newS = "checked"; }
2932 <form method=post action=$form->{script}>
2934 <input type=hidden name=old_password value=$myconfig{password}>
2935 <input type=hidden name=type value=preferences>
2936 <input type=hidden name=role value=$myconfig{role}>
2939 <tr><th class=listtop>$form->{title}</th></tr>
2944 <th align=right>| . $locale->text('Name') . qq|</th>
2945 <td><input name=name size=15 value="$myconfig{name}"></td>
2948 <th align=right>| . $locale->text('Password') . qq|</th>
2949 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2952 <th align=right>| . $locale->text('E-mail') . qq|</th>
2953 <td><input name=email size=30 value="$myconfig{email}"></td>
2956 <th align=right>| . $locale->text('Signature') . qq|</th>
2957 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2960 <th align=right>| . $locale->text('Phone') . qq|</th>
2961 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2964 <th align=right>| . $locale->text('Fax') . qq|</th>
2965 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2968 <th align=right>| . $locale->text('Company') . qq|</th>
2969 <td><input name=company size=30 value="$myconfig{company}"></td>
2972 <th align=right>| . $locale->text('Address') . qq|</th>
2973 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2976 <th align=right>| . $locale->text('Date Format') . qq|</th>
2977 <td><select name=dateformat>$dateformat</select></td>
2980 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2981 <td><select name=numberformat>$numberformat</select></td>
2984 <th align=right>| . $locale->text('Input Number Format') . qq|</th>
2985 <td><select name=in_numberformat>$in_numberformat</select></td>
2989 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2990 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2993 <th align=right>| . $locale->text('Language') . qq|</th>
2994 <td><select name=countrycode>$countrycodes</select></td>
2997 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
2998 <td><select name=usestylesheet>$selectstylesheet</select></td>
3001 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
3002 <td><input name=menustyle type=radio class=radio value=neu $newS> New
3003 <input name=menustyle type=radio class=radio value=old $oldS> Old</td>
3005 <input name=printer type=hidden value="$myconfig{printer}">
3006 <tr class=listheading>
3007 <th colspan=2> </th>
3010 <th align=right>| . $locale->text('Business Number') . qq|</th>
3011 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
3017 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
3018 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
3019 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
3020 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
3025 <tr class=listheading>
3027 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
3033 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
3034 <td><select name=inventory_accno>$myconfig{IC}</select></td>
3037 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
3038 <td><select name=income_accno>$myconfig{IC_income}</select></td>
3041 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
3042 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
3045 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
3046 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
3049 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
3050 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
3055 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
3057 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
3066 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
3067 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
3068 <th align=right nowrap>|
3069 . $locale->text('Last Customer Number') . qq|</th>
3070 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
3073 <th align=right nowrap>|
3074 . $locale->text('Last Credit Note Number') . qq|</th>
3075 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
3076 <th align=right nowrap>|
3077 . $locale->text('Last Vendor Number') . qq|</th>
3078 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
3081 <th align=right nowrap>|
3082 . $locale->text('Last Sales Order Number') . qq|</th>
3083 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
3086 <th align=right nowrap>|
3087 . $locale->text('Last Purchase Order Number') . qq|</th>
3088 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
3089 <th align=right nowrap>|
3090 . $locale->text('Last Article Number') . qq|</th>
3091 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
3094 <th align=right nowrap>|
3095 . $locale->text('Last Sales Quotation Number') . qq|</th>
3096 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
3097 <th align=right nowrap>|
3098 . $locale->text('Last Service Number') . qq|</th>
3099 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
3102 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
3103 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
3104 <th align=right nowrap></th>
3110 <tr class=listheading>
3111 <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3118 <th>| . $locale->text('Rate') . qq| (%)</th>
3119 <th>| . $locale->text('Number') . qq|</th>
3123 foreach $accno (sort keys %{ $form->{taxrates} }) {
3126 <th align=right>$form->{taxrates}{$accno}{description}</th>
3127 <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3128 <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3131 $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3134 chop $form->{taxaccounts};
3137 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3146 <td><hr size=3 noshade></td>
3150 <input type=hidden name=path value=$form->{path}>
3151 <input type=hidden name=login value=$form->{login}>
3152 <input type=hidden name=password value=$form->{password}>
3155 <input type=submit class=submit name=action value="|
3156 . $locale->text('Save') . qq|">|;
3158 if ($form->{menubar}) {
3159 require "$form->{path}/menu.pl";
3170 $lxdebug->leave_sub();
3173 sub save_preferences {
3174 $lxdebug->enter_sub();
3176 $form->{stylesheet} = $form->{usestylesheet};
3178 $form->redirect($locale->text('Preferences saved!'))
3180 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3182 $form->error($locale->text('Cannot save preferences!'));
3184 $lxdebug->leave_sub();
3188 $lxdebug->enter_sub();
3190 if ($form->{media} eq 'email') {
3191 $form->error($locale->text('No email address for') . " $myconfig{name}")
3192 unless ($myconfig{email});
3194 $form->{OUT} = "$sendmail";
3198 AM->backup(\%myconfig, \%$form, $userspath);
3200 if ($form->{media} eq 'email') {
3201 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
3204 $lxdebug->leave_sub();
3208 $lxdebug->enter_sub();
3210 $form->{title} = $locale->text('Audit Control');
3212 AM->closedto(\%myconfig, \%$form);
3214 if ($form->{revtrans}) {
3215 $checked{Y} = "checked";
3217 $checked{N} = "checked";
3225 <form method=post action=$form->{script}>
3227 <input type=hidden name=path value=$form->{path}>
3228 <input type=hidden name=login value=$form->{login}>
3229 <input type=hidden name=password value=$form->{password}>
3232 <tr><th class=listtop>$form->{title}</th></tr>
3233 <tr height="5"></tr>
3239 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3240 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3241 . $locale->text('Yes')
3242 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3243 . $locale->text('No')
3247 <th>| . $locale->text('Close Books up to') . qq|</th>
3248 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3258 <input type=hidden name=nextsub value=doclose>
3260 <input type=submit class=submit name=action value="|
3261 . $locale->text('Continue') . qq|">
3269 $lxdebug->leave_sub();
3273 $lxdebug->enter_sub();
3275 AM->closebooks(\%myconfig, \%$form);
3277 if ($form->{revtrans}) {
3279 $locale->text('Transaction reversal enforced for all dates'));
3281 if ($form->{closedto}) {
3283 $locale->text('Transaction reversal enforced up to') . " "
3284 . $locale->date(\%myconfig, $form->{closedto}, 1));
3286 $form->redirect($locale->text('Books are open'));
3290 $lxdebug->leave_sub();
3294 $lxdebug->enter_sub();
3296 $form->{title} = "Add";
3299 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
3300 unless $form->{callback};
3305 $lxdebug->leave_sub();
3308 sub edit_warehouse {
3309 $lxdebug->enter_sub();
3311 $form->{title} = "Edit";
3313 AM->get_warehouse(\%myconfig, \%$form);
3318 $lxdebug->leave_sub();
3321 sub list_warehouse {
3322 $lxdebug->enter_sub();
3324 AM->warehouses(\%myconfig, \%$form);
3327 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
3329 $callback = $form->escape($form->{callback});
3331 $form->{title} = $locale->text('Warehouses');
3333 @column_index = qw(description);
3335 $column_header{description} =
3336 qq|<th class=listheading width=100%>|
3337 . $locale->text('Description')
3347 <th class=listtop>$form->{title}</th>
3349 <tr height="5"></tr>
3353 <tr class=listheading>
3356 map { print "$column_header{$_}\n" } @column_index;
3362 foreach $ref (@{ $form->{ALL} }) {
3368 <tr valign=top class=listrow$i>
3371 $column_data{description} =
3372 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>|;
3374 map { print "$column_data{$_}\n" } @column_index;
3386 <td><hr size=3 noshade></td>
3391 <form method=post action=$form->{script}>
3393 <input name=callback type=hidden value="$form->{callback}">
3395 <input type=hidden name=type value=warehouse>
3397 <input type=hidden name=path value=$form->{path}>
3398 <input type=hidden name=login value=$form->{login}>
3399 <input type=hidden name=password value=$form->{password}>
3401 <input class=submit type=submit name=action value="|
3402 . $locale->text('Add') . qq|">|;
3404 if ($form->{menubar}) {
3405 require "$form->{path}/menu.pl";
3416 $lxdebug->leave_sub();
3419 sub warehouse_header {
3420 $lxdebug->enter_sub();
3422 $form->{title} = $locale->text("$form->{title} Warehouse");
3424 # $locale->text('Add Warehouse')
3425 # $locale->text('Edit Warehouse')
3427 $form->{description} =~ s/\"/"/g;
3429 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
3431 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
3434 qq|<input name=description size=60 value="$form->{description}">|;
3442 <form method=post action=$form->{script}>
3444 <input type=hidden name=id value=$form->{id}>
3445 <input type=hidden name=type value=warehouse>
3449 <th class=listtop colspan=2>$form->{title}</th>
3451 <tr height="5"></tr>
3453 <th align=right>| . $locale->text('Description') . qq|</th>
3454 <td>$description</td>
3457 <td colspan=2><hr size=3 noshade></td>
3462 $lxdebug->leave_sub();
3465 sub save_warehouse {
3466 $lxdebug->enter_sub();
3468 $form->isblank("description", $locale->text('Description missing!'));
3469 AM->save_warehouse(\%myconfig, \%$form);
3470 $form->redirect($locale->text('Warehouse saved!'));
3472 $lxdebug->leave_sub();
3475 sub delete_warehouse {
3476 $lxdebug->enter_sub();
3478 AM->delete_warehouse(\%myconfig, \%$form);
3479 $form->redirect($locale->text('Warehouse deleted!'));
3481 $lxdebug->leave_sub();
3485 $lxdebug->enter_sub();
3487 &{ $form->{nextsub} };
3489 $lxdebug->leave_sub();
3493 $lxdebug->enter_sub();
3495 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3496 AM->units_in_use(\%myconfig, $form, $units);
3497 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3500 foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3501 map({ push(@unit_list, $units->{$_}); }
3502 sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3503 grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3505 map({ $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"}); } @unit_list);
3507 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3508 $ddbox = AM->unit_select_data($units, undef, 1);
3510 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3512 print($form->parse_html_template("am/edit_units", { "UNITS" => \@unit_list, "NEW_BASE_UNIT_DDBOX" => $ddbox }));
3514 $lxdebug->leave_sub();
3518 $lxdebug->enter_sub();
3520 $form->isblank("new_name", $locale->text("The name is missing."));
3521 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3522 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($units->{$form->{"new_name"}});
3524 my ($base_unit, $factor);
3525 if ($form->{"new_base_unit"}) {
3526 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3528 $form->isblank("new_factor", $locale->text("The factor is missing."));
3529 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3530 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3531 $base_unit = $form->{"new_base_unit"};
3534 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"});
3536 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3540 $lxdebug->leave_sub();
3544 $lxdebug->enter_sub();
3546 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3547 AM->units_in_use(\%myconfig, $form, $old_units);
3551 foreach $i (1..($form->{"rowcount"} * 1)) {
3552 $old_unit = $old_units->{$form->{"old_name_$i"}};
3554 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3557 if ($form->{"unchangeable_$i"}) {
3558 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3559 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3563 if ($old_unit->{"in_use"}) {
3564 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3567 if ($form->{"delete_$i"}) {
3568 push(@delete_units, $old_unit->{"name"});
3572 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3574 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3575 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3576 $new_units->{$form->{"name_$i"}} = \%h;
3577 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3580 foreach $unit (values(%{$new_units})) {
3581 next unless ($unit->{"old_name"});
3582 if ($unit->{"base_unit"}) {
3583 $form->show_generic_error(sprintf($locale->text("The base unit does not exist or it is about to be deleted in row %d."), $unit->{"row"}))
3584 unless (defined($new_units->{$unit->{"base_unit"}}));
3585 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3586 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3588 $unit->{"base_unit"} = undef;
3589 $unit->{"factor"} = undef;
3593 foreach $unit (values(%{$new_units})) {
3594 next if ($unit->{"unchanged_unit"});
3596 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3598 while ($new_unit->{"base_unit"}) {
3599 $new_unit->{"seen"} = 1;
3600 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3601 if ($new_unit->{"seen"}) {
3602 $form->show_generic_error(sprintf($locale->text("The base unit relations must not contain loops (e.g. by saying that unit A's base unit is B, " .
3603 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3608 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3610 $form->{"saved_message"} = $locale->text("The units have been saved.");
3614 $lxdebug->leave_sub();