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 #print(STDERR Dumper($form->{NEWACCOUNT}));
116 if (@{ $form->{NEWACCOUNT} }) {
117 if (!$form->{new_chart_valid}) {
118 $form->{selectnewaccount} = "<option value=></option>";
120 foreach $item (@{ $form->{NEWACCOUNT} }) {
121 if ($item->{id} == $form->{new_chart_id}) {
122 $form->{selectnewaccount} .=
123 "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
124 } elsif (!$form->{new_chart_valid}) {
125 $form->{selectnewaccount} .=
126 "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
137 <th align=right>| . $locale->text('Folgekonto') . qq|</th>
138 <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
139 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
140 <td><input name=valid_from value="$form->{valid_from}"></td>
146 $form->{selectustva} = "<option>\n";
148 %ustva = (35 => $locale->text('UStVA-Nr. 35'),
149 36 => $locale->text('UStVA-Nr. 36'),
150 39 => $locale->text('UStVA-Nr. 39'),
151 41 => $locale->text('UStVA-Nr. 41'),
152 42 => $locale->text('UStVA-Nr. 42'),
153 43 => $locale->text('UStVA-Nr. 43'),
154 44 => $locale->text('UStVA-Nr. 44'),
155 45 => $locale->text('UStVA-Nr. 45'),
156 48 => $locale->text('UStVA-Nr. 48'),
157 49 => $locale->text('UStVA-Nr. 49'),
158 51 => $locale->text('UStVA-Nr. 51 left'),
159 511 => $locale->text('UStVA-Nr. 51 right'),
160 52 => $locale->text('UStVA-Nr. 52'),
161 53 => $locale->text('UStVA-Nr. 53'),
162 59 => $locale->text('UStVA-Nr. 59'),
163 60 => $locale->text('UStVA-Nr. 60'),
164 61 => $locale->text('UStVA-Nr. 61'),
165 62 => $locale->text('UStVA-Nr. 62'),
166 63 => $locale->text('UStVA-Nr. 63'),
167 64 => $locale->text('UStVA-Nr. 64'),
168 65 => $locale->text('UStVA-Nr. 65'),
169 66 => $locale->text('UStVA-Nr. 66'),
170 67 => $locale->text('UStVA-Nr. 67'),
171 69 => $locale->text('UStVA-Nr. 69'),
172 73 => $locale->text('UStVA-Nr. 73'),
173 74 => $locale->text('UStVA-Nr. 74'),
174 76 => $locale->text('UStVA-Nr. 76'),
175 77 => $locale->text('UStVA-Nr. 77'),
176 80 => $locale->text('UStVA-Nr. 80'),
177 84 => $locale->text('UStVA-Nr. 84'),
178 85 => $locale->text('UStVA-Nr. 85'),
179 86 => $locale->text('UStVA-Nr. 86 left'),
180 861 => $locale->text('UStVA-Nr. 86 right'),
181 91 => $locale->text('UStVA-Nr. 91'),
182 93 => $locale->text('UStVA-Nr. 93 left'),
183 931 => $locale->text('UStVA-Nr. 93 right'),
184 94 => $locale->text('UStVA-Nr. 94'),
185 95 => $locale->text('UStVA-Nr. 95'),
186 96 => $locale->text('UStVA-Nr. 96'),
187 97 => $locale->text('UStVA-Nr. 97 links'),
188 971 => $locale->text('UStVA-Nr. 97 rechts'),
189 98 => $locale->text('UStVA-Nr. 98'));
191 foreach $item (sort({ $a cmp $b } keys %ustva)) {
192 if ($item == $form->{pos_ustva}) {
193 $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
195 $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
202 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
203 <td><select name=pos_ustva>$form->{selectustva}</select></td>
204 <input type=hidden name=selectustva value="$form->{selectustva}">
207 $form->{selecteur} = "<option>\n";
208 %eur = (1 => "Umsatzerlöse",
209 2 => "sonstige Erlöse",
210 3 => "Privatanteile",
212 5 => "Ausserordentliche Erträge",
213 6 => "Vereinnahmte Umsatzst.",
214 7 => "Umsatzsteuererstattungen",
215 8 => "Wareneingänge",
216 9 => "Löhne und Gehälter",
217 10 => "Gesetzl. sozialer Aufw.",
219 12 => "Gas, Strom, Wasser",
220 13 => "Instandhaltung",
221 14 => "Steuern, Versich., Beiträge",
223 16 => "Kfz-Versicherungen",
224 17 => "Sonst. Fahrtkosten",
225 18 => "Werbe- und Reisekosten",
226 19 => "Instandhaltung u. Werkzeuge",
227 20 => "Fachzeitschriften, Bücher",
228 21 => "Miete für Einrichtungen",
229 22 => "Rechts- und Beratungskosten",
230 23 => "Bürobedarf, Porto, Telefon",
231 24 => "Sonstige Aufwendungen",
232 25 => "Abschreibungen auf Anlagever.",
233 26 => "Abschreibungen auf GWG",
235 28 => "Umsatzsteuerzahlungen",
237 30 => "Ausserordentlicher Aufwand",
238 31 => "Betriebliche Steuern");
239 foreach $item (sort({ $a <=> $b } keys(%eur))) {
240 if ($item == $form->{pos_eur}) {
241 $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
243 $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
250 <th align=right>| . $locale->text('EUER') . qq|</th>
251 <td><select name=pos_eur>$form->{selecteur}</select></td>
252 <input type=hidden name=selecteur value="$form->{selecteur}">
255 $form->{selectbwa} = "<option>\n";
257 %bwapos = (1 => 'Umsatzerlöse',
258 2 => 'Best.Verdg.FE/UE',
259 3 => 'Aktiv.Eigenleistung',
260 4 => 'Mat./Wareneinkauf',
261 5 => 'So.betr.Erlöse',
262 10 => 'Personalkosten',
264 12 => 'Betriebl.Steuern',
265 13 => 'Vers./Beiträge',
266 14 => 'Kfz.Kosten o.St.',
267 15 => 'Werbe-Reisek.',
268 16 => 'Kosten Warenabgabe',
269 17 => 'Abschreibungen',
270 18 => 'Rep./instandhlt.',
271 19 => 'Übrige Steuern',
272 20 => 'Sonst.Kosten',
274 31 => 'Sonst.neutr.Aufw.',
276 33 => 'Sonst.neutr.Ertrag',
277 34 => 'Verr.kalk.Kosten',
278 35 => 'Steuern Eink.u.Ertr.');
279 foreach $item (sort({ $a <=> $b } keys %bwapos)) {
280 if ($item == $form->{pos_bwa}) {
281 $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
283 $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
290 <th align=right>| . $locale->text('BWA') . qq|</th>
291 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
292 <input type=hidden name=selectbwa value="$form->{selectbwa}">
295 # Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
296 # $form->{selectbilanz} = "<option>\n";
297 # foreach $item ((1, 2, 3, 4)) {
298 # if ($item == $form->{pos_bilanz}) {
299 # $form->{selectbilanz} .= "<option value=$item selected>$item\n";
301 # $form->{selectbilanz} .= "<option value=$item>$item\n";
308 # <th align=right>| . $locale->text('Bilanz') . qq|</th>
309 # <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
310 # <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
313 # this is for our parser only!
314 # type=submit $locale->text('Add Account')
315 # type=submit $locale->text('Edit Account')
316 $form->{type} = "account";
323 <form method=post action=$form->{script}>
325 <input type=hidden name=id value=$form->{id}>
326 <input type=hidden name=type value=account>
327 <input type=hidden name=orphaned value=$form->{orphaned}>
328 <input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
330 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
331 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
332 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
333 <input type=hidden name=fxgain_accno_id values=$form->{fxgain_accno_id}>
334 <input type=hidden name=fxloss_accno_id values=$form->{fxloss_accno_id}>
336 <table border=0 width=100%>
338 <th class=listtop>$form->{title}</th>
345 <th align=right>| . $locale->text('Account Number') . qq|</th>
346 <td><input name=accno size=20 value=$form->{accno}></td>
349 <th align=right>| . $locale->text('Description') . qq|</th>
350 <td><input name=description size=40 value="$form->{description}"></td>
353 <th align=right>| . $locale->text('Account Type') . qq|</th>
357 <td><input name=category type=radio class=radio value=A $checked{A_}> |
358 . $locale->text('Asset') . qq|\n<br>
359 <input name=category type=radio class=radio value=L $checked{L_}> |
360 . $locale->text('Liability') . qq|\n<br>
361 <input name=category type=radio class=radio value=Q $checked{Q_}> |
362 . $locale->text('Equity') . qq|\n<br>
363 <input name=category type=radio class=radio value=I $checked{I_}> |
364 . $locale->text('Revenue') . qq|\n<br>
365 <input name=category type=radio class=radio value=E $checked{E_}> |
366 . $locale->text('Expense') . qq|</td>
367 <td width=50> </td>
369 <input name=charttype type=radio class=radio value="H" $checked{H}> |
370 . $locale->text('Heading') . qq|<br>
371 <input name=charttype type=radio class=radio value="A" $checked{A}> |
372 . $locale->text('Account') . qq|</td>
379 if ($form->{charttype} eq "A") {
386 . $locale->text('Is this a summary account to record') . qq|</th>
388 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
389 . $locale->text('AR')
390 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
391 . $locale->text('AP')
392 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
393 . $locale->text('Inventory')
400 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
406 <th align=left>| . $locale->text('Receivables') . qq|</th>
407 <th align=left>| . $locale->text('Payables') . qq|</th>
408 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
409 <th align=left>| . $locale->text('Service Items') . qq|</th>
413 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
414 . $locale->text('Revenue') . qq|\n<br>
415 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
416 . $locale->text('Receipt') . qq|\n<br>
417 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
418 . $locale->text('Tax') . qq|
421 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
422 . $locale->text('Expense/Asset') . qq|\n<br>
423 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
424 . $locale->text('Payment') . qq|\n<br>
425 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
426 . $locale->text('Tax') . qq|
429 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
430 . $locale->text('Revenue') . qq|\n<br>
431 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
432 . $locale->text('Expense') . qq|\n<br>
433 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
434 . $locale->text('Tax') . qq|
437 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
438 . $locale->text('Revenue') . qq|\n<br>
439 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
440 . $locale->text('Expense') . qq|\n<br>
441 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
442 . $locale->text('Tax') . qq|
462 <td><hr size=3 noshade></td>
467 $lxdebug->leave_sub();
471 $lxdebug->enter_sub();
475 <input name=callback type=hidden value="$form->{callback}">
477 <input type=hidden name=path value=$form->{path}>
478 <input type=hidden name=login value=$form->{login}>
479 <input type=hidden name=password value=$form->{password}>
482 #print(STDERR "$form->{type} TYPE $form->{new_chart_valid} CHART_VALID\n");
483 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
485 <input type=submit class=submit name=action value="|
486 . $locale->text('Save') . qq|">
490 if ($form->{id} && $form->{orphaned}) {
491 print qq|<input type=submit class=submit name=action value="|
492 . $locale->text('Delete') . qq|">|;
495 if ($form->{menubar}) {
496 require "$form->{path}/menu.pl";
507 $lxdebug->leave_sub();
511 $lxdebug->enter_sub();
513 $form->isblank("accno", $locale->text('Account Number missing!'));
514 $form->isblank("category", $locale->text('Account Type missing!'));
516 $form->redirect($locale->text('Account saved!'))
517 if (AM->save_account(\%myconfig, \%$form));
518 $form->error($locale->text('Cannot save account!'));
520 $lxdebug->leave_sub();
524 $lxdebug->enter_sub();
526 CA->all_accounts(\%myconfig, \%$form);
528 $form->{title} = $locale->text('Chart of Accounts');
532 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
534 @column_index = qw(accno gifi_accno description debit credit link);
536 $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
537 $column_header{gifi_accno} =
538 qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
539 $column_header{description} =
540 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
541 $column_header{debit} = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
542 $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
543 $column_header{link} = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
546 $colspan = $#column_index + 1;
553 <th class=listtop colspan=$colspan>$form->{title}</th>
556 <tr class=listheading>
559 map { print "$column_header{$_}\n" } @column_index;
566 $callback = $form->escape($callback);
568 foreach $ca (@{ $form->{CA} }) {
570 $ca->{debit} = " ";
571 $ca->{credit} = " ";
573 if ($ca->{amount} > 0) {
575 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
577 if ($ca->{amount} < 0) {
579 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
582 $ca->{link} =~ s/:/<br>/og;
584 if ($ca->{charttype} eq "H") {
585 print qq|<tr class=listheading>|;
587 $column_data{accno} =
588 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>|;
589 $column_data{gifi_accno} =
590 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>|;
591 $column_data{description} = qq|<th>$ca->{description} </th>|;
592 $column_data{debit} = qq|<th> </th>|;
593 $column_data{credit} = qq| <th> </th>|;
594 $column_data{link} = qq|<th> </th>|;
600 <tr valign=top class=listrow$i>|;
601 $column_data{accno} =
602 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>|;
603 $column_data{gifi_accno} =
604 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>|;
605 $column_data{description} = qq|<td>$ca->{description} </td>|;
606 $column_data{debit} = qq|<td align=right>$ca->{debit}</td>|;
607 $column_data{credit} = qq|<td align=right>$ca->{credit}</td>|;
608 $column_data{link} = qq|<td>$ca->{link} </td>|;
612 map { print "$column_data{$_}\n" } @column_index;
618 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
625 $lxdebug->leave_sub();
629 $lxdebug->enter_sub();
631 $form->{title} = $locale->text('Delete Account');
634 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
636 if ($form->{id} == $form->{$id}) {
637 $form->error($locale->text('Cannot delete default account!'));
641 $form->redirect($locale->text('Account deleted!'))
642 if (AM->delete_account(\%myconfig, \%$form));
643 $form->error($locale->text('Cannot delete account!'));
645 $lxdebug->leave_sub();
649 $lxdebug->enter_sub();
651 @{ $form->{fields} } = (accno, description);
652 $form->{table} = "gifi";
653 $form->{sortorder} = "accno";
655 AM->gifi_accounts(\%myconfig, \%$form);
657 $form->{title} = $locale->text('GIFI');
661 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
663 @column_index = qw(accno description);
665 $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
666 $column_header{description} =
667 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
670 $colspan = $#column_index + 1;
677 <th class=listtop colspan=$colspan>$form->{title}</th>
680 <tr class=listheading>
683 map { print "$column_header{$_}\n" } @column_index;
690 $callback = $form->escape($callback);
692 foreach $ca (@{ $form->{ALL} }) {
698 <tr valign=top class=listrow$i>|;
700 $column_data{accno} =
701 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>|;
702 $column_data{description} = qq|<td>$ca->{description} </td>|;
704 map { print "$column_data{$_}\n" } @column_index;
711 <td colspan=$colspan><hr size=3 noshade></td>
719 $lxdebug->leave_sub();
723 $lxdebug->enter_sub();
725 $form->{title} = "Add";
729 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
736 $lxdebug->leave_sub();
740 $lxdebug->enter_sub();
742 $form->{title} = "Edit";
744 AM->get_gifi(\%myconfig, \%$form);
749 $lxdebug->leave_sub();
753 $lxdebug->enter_sub();
755 $form->{title} = $locale->text("$form->{title} GIFI");
757 # $locale->text('Add GIFI')
758 # $locale->text('Edit GIFI')
760 $form->{description} =~ s/\"/"/g;
767 <form method=post action=$form->{script}>
769 <input type=hidden name=id value=$form->{accno}>
770 <input type=hidden name=type value=gifi>
774 <th class=listtop>$form->{title}</th>
781 <th align=right>| . $locale->text('GIFI') . qq|</th>
782 <td><input name=accno size=20 value=$form->{accno}></td>
785 <th align=right>| . $locale->text('Description') . qq|</th>
786 <td><input name=description size=60 value="$form->{description}"></td>
792 <td colspan=2><hr size=3 noshade></td>
797 $lxdebug->leave_sub();
801 $lxdebug->enter_sub();
805 <input name=callback type=hidden value="$form->{callback}">
807 <input type=hidden name=path value=$form->{path}>
808 <input type=hidden name=login value=$form->{login}>
809 <input type=hidden name=password value=$form->{password}>
811 <br><input type=submit class=submit name=action value="|
812 . $locale->text('Save') . qq|">|;
816 <input type=submit class=submit name=action value="|
817 . $locale->text('Copy to COA') . qq|">
820 if ($form->{accno} && $form->{orphaned}) {
821 print qq|<input type=submit class=submit name=action value="|
822 . $locale->text('Delete') . qq|">|;
826 if ($form->{menubar}) {
827 require "$form->{path}/menu.pl";
838 $lxdebug->leave_sub();
842 $lxdebug->enter_sub();
844 $form->isblank("accno", $locale->text('GIFI missing!'));
845 AM->save_gifi(\%myconfig, \%$form);
846 $form->redirect($locale->text('GIFI saved!'));
848 $lxdebug->leave_sub();
852 $lxdebug->enter_sub();
854 $form->isblank("accno", $locale->text('GIFI missing!'));
856 AM->save_gifi(\%myconfig, \%$form);
859 $form->{gifi_accno} = $form->{accno};
860 $form->{title} = "Add";
861 $form->{charttype} = "A";
866 $lxdebug->leave_sub();
870 $lxdebug->enter_sub();
872 AM->delete_gifi(\%myconfig, \%$form);
873 $form->redirect($locale->text('GIFI deleted!'));
875 $lxdebug->leave_sub();
879 $lxdebug->enter_sub();
881 $form->{title} = "Add";
885 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
886 unless $form->{callback};
891 $lxdebug->leave_sub();
894 sub edit_department {
895 $lxdebug->enter_sub();
897 $form->{title} = "Edit";
899 AM->get_department(\%myconfig, \%$form);
904 $lxdebug->leave_sub();
907 sub list_department {
908 $lxdebug->enter_sub();
910 AM->departments(\%myconfig, \%$form);
913 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
915 $callback = $form->escape($form->{callback});
917 $form->{title} = $locale->text('Departments');
919 @column_index = qw(description cost profit);
921 $column_header{description} =
922 qq|<th class=listheading width=90%>|
923 . $locale->text('Description')
925 $column_header{cost} =
926 qq|<th class=listheading nowrap>|
927 . $locale->text('Cost Center')
929 $column_header{profit} =
930 qq|<th class=listheading nowrap>|
931 . $locale->text('Profit Center')
941 <th class=listtop>$form->{title}</th>
947 <tr class=listheading>
950 map { print "$column_header{$_}\n" } @column_index;
956 foreach $ref (@{ $form->{ALL} }) {
962 <tr valign=top class=listrow$i>
965 $costcenter = ($ref->{role} eq "C") ? "X" : "";
966 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
968 $column_data{description} =
969 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>|;
970 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
971 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
973 map { print "$column_data{$_}\n" } @column_index;
985 <td><hr size=3 noshade></td>
990 <form method=post action=$form->{script}>
992 <input name=callback type=hidden value="$form->{callback}">
994 <input type=hidden name=type value=department>
996 <input type=hidden name=path value=$form->{path}>
997 <input type=hidden name=login value=$form->{login}>
998 <input type=hidden name=password value=$form->{password}>
1000 <input class=submit type=submit name=action value="|
1001 . $locale->text('Add') . qq|">|;
1003 if ($form->{menubar}) {
1004 require "$form->{path}/menu.pl";
1015 $lxdebug->leave_sub();
1018 sub department_header {
1019 $lxdebug->enter_sub();
1021 $form->{title} = $locale->text("$form->{title} Department");
1023 # $locale->text('Add Department')
1024 # $locale->text('Edit Department')
1026 $form->{description} =~ s/\"/"/g;
1028 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
1030 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
1033 qq|<input name=description size=60 value="$form->{description}">|;
1036 $costcenter = "checked" if $form->{role} eq "C";
1037 $profitcenter = "checked" if $form->{role} eq "P";
1044 <form method=post action=$form->{script}>
1046 <input type=hidden name=id value=$form->{id}>
1047 <input type=hidden name=type value=department>
1051 <th class=listtop colspan=2>$form->{title}</th>
1053 <tr height="5"></tr>
1055 <th align=right>| . $locale->text('Description') . qq|</th>
1056 <td>$description</td>
1060 <td><input type=radio style=radio name=role value="C" $costcenter> |
1061 . $locale->text('Cost Center') . qq|
1062 <input type=radio style=radio name=role value="P" $profitcenter> |
1063 . $locale->text('Profit Center') . qq|
1066 <td colspan=2><hr size=3 noshade></td>
1071 $lxdebug->leave_sub();
1074 sub save_department {
1075 $lxdebug->enter_sub();
1077 $form->isblank("description", $locale->text('Description missing!'));
1078 AM->save_department(\%myconfig, \%$form);
1079 $form->redirect($locale->text('Department saved!'));
1081 $lxdebug->leave_sub();
1084 sub delete_department {
1085 $lxdebug->enter_sub();
1087 AM->delete_department(\%myconfig, \%$form);
1088 $form->redirect($locale->text('Department deleted!'));
1090 $lxdebug->leave_sub();
1094 $lxdebug->enter_sub();
1096 $form->{title} = "Add";
1099 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1100 unless $form->{callback};
1105 $lxdebug->leave_sub();
1109 $lxdebug->enter_sub();
1111 $form->{title} = "Edit";
1113 AM->get_business(\%myconfig, \%$form);
1117 $form->{orphaned} = 1;
1120 $lxdebug->leave_sub();
1124 $lxdebug->enter_sub();
1126 AM->business(\%myconfig, \%$form);
1129 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1131 $callback = $form->escape($form->{callback});
1133 $form->{title} = $locale->text('Type of Business');
1135 @column_index = qw(description discount customernumberinit);
1137 $column_header{description} =
1138 qq|<th class=listheading width=60%>|
1139 . $locale->text('Description')
1141 $column_header{discount} =
1142 qq|<th class=listheading width=10%>|
1143 . $locale->text('Discount')
1145 $column_header{customernumberinit} =
1146 qq|<th class=listheading>|
1147 . $locale->text('Customernumberinit')
1157 <th class=listtop>$form->{title}</th>
1159 <tr height="5"></tr>
1163 <tr class=listheading>
1166 map { print "$column_header{$_}\n" } @column_index;
1172 foreach $ref (@{ $form->{ALL} }) {
1178 <tr valign=top class=listrow$i>
1182 $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
1185 ? "<b>$ref->{description}</b>"
1186 : "$ref->{description}";
1187 $column_data{description} =
1188 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>|;
1189 $column_data{discount} = qq|<td align=right>$discount</td>|;
1190 $column_data{customernumberinit} =
1191 qq|<td align=right>$ref->{customernumberinit}</td>|;
1193 map { print "$column_data{$_}\n" } @column_index;
1205 <td><hr size=3 noshade></td>
1210 <form method=post action=$form->{script}>
1212 <input name=callback type=hidden value="$form->{callback}">
1214 <input type=hidden name=type value=business>
1216 <input type=hidden name=path value=$form->{path}>
1217 <input type=hidden name=login value=$form->{login}>
1218 <input type=hidden name=password value=$form->{password}>
1220 <input class=submit type=submit name=action value="|
1221 . $locale->text('Add') . qq|">|;
1223 if ($form->{menubar}) {
1224 require "$form->{path}/menu.pl";
1236 $lxdebug->leave_sub();
1239 sub business_header {
1240 $lxdebug->enter_sub();
1242 $form->{title} = $locale->text("$form->{title} Business");
1243 $form->{salesman} = "checked" if $form->{salesman};
1245 # $locale->text('Add Business')
1246 # $locale->text('Edit Business')
1248 $form->{description} =~ s/\"/"/g;
1250 $form->format_amount(\%myconfig, $form->{discount} * 100);
1257 <form method=post action=$form->{script}>
1259 <input type=hidden name=id value=$form->{id}>
1260 <input type=hidden name=type value=business>
1264 <th class=listtop colspan=2>$form->{title}</th>
1266 <tr height="5"></tr>
1268 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1269 <td><input name=description size=30 value="$form->{description}"></td>
1272 <th align=right>| . $locale->text('Discount') . qq| %</th>
1273 <td><input name=discount size=5 value=$form->{discount}></td>
1276 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1277 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1280 <td align=right>| . $locale->text('Salesman') . qq|</td>
1281 <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
1283 <td colspan=2><hr size=3 noshade></td>
1288 $lxdebug->leave_sub();
1292 $lxdebug->enter_sub();
1294 $form->isblank("description", $locale->text('Description missing!'));
1295 AM->save_business(\%myconfig, \%$form);
1296 $form->redirect($locale->text('Business saved!'));
1298 $lxdebug->leave_sub();
1301 sub delete_business {
1302 $lxdebug->enter_sub();
1304 AM->delete_business(\%myconfig, \%$form);
1305 $form->redirect($locale->text('Business deleted!'));
1307 $lxdebug->leave_sub();
1311 $lxdebug->enter_sub();
1313 $form->{title} = "Add";
1316 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1317 unless $form->{callback};
1322 $lxdebug->leave_sub();
1326 $lxdebug->enter_sub();
1328 $form->{title} = "Edit";
1330 AM->get_language(\%myconfig, \%$form);
1334 $form->{orphaned} = 1;
1337 $lxdebug->leave_sub();
1341 $lxdebug->enter_sub();
1343 AM->language(\%myconfig, \%$form);
1346 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1348 $callback = $form->escape($form->{callback});
1350 $form->{title} = $locale->text('Languages');
1352 @column_index = qw(description template_code article_code);
1354 $column_header{description} =
1355 qq|<th class=listheading width=60%>|
1356 . $locale->text('Description')
1358 $column_header{template_code} =
1359 qq|<th class=listheading width=10%>|
1360 . $locale->text('Template Code')
1362 $column_header{article_code} =
1363 qq|<th class=listheading>|
1364 . $locale->text('Article Code')
1374 <th class=listtop>$form->{title}</th>
1376 <tr height="5"></tr>
1380 <tr class=listheading>
1383 map { print "$column_header{$_}\n" } @column_index;
1389 foreach $ref (@{ $form->{ALL} }) {
1395 <tr valign=top class=listrow$i>
1399 $column_data{description} =
1400 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>|;
1401 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1402 $column_data{article_code} =
1403 qq|<td align=right>$ref->{article_code}</td>|;
1405 map { print "$column_data{$_}\n" } @column_index;
1417 <td><hr size=3 noshade></td>
1422 <form method=post action=$form->{script}>
1424 <input name=callback type=hidden value="$form->{callback}">
1426 <input type=hidden name=type value=language>
1428 <input type=hidden name=path value=$form->{path}>
1429 <input type=hidden name=login value=$form->{login}>
1430 <input type=hidden name=password value=$form->{password}>
1432 <input class=submit type=submit name=action value="|
1433 . $locale->text('Add') . qq|">|;
1435 if ($form->{menubar}) {
1436 require "$form->{path}/menu.pl";
1448 $lxdebug->leave_sub();
1451 sub language_header {
1452 $lxdebug->enter_sub();
1454 $form->{title} = $locale->text("$form->{title} Language");
1456 # $locale->text('Add Language')
1457 # $locale->text('Edit Language')
1459 $form->{description} =~ s/\"/"/g;
1460 $form->{template_code} =~ s/\"/"/g;
1461 $form->{article_code} =~ s/\"/"/g;
1469 <form method=post action=$form->{script}>
1471 <input type=hidden name=id value=$form->{id}>
1472 <input type=hidden name=type value=language>
1476 <th class=listtop colspan=2>$form->{title}</th>
1478 <tr height="5"></tr>
1480 <th align=right>| . $locale->text('Language') . qq|</th>
1481 <td><input name=description size=30 value="$form->{description}"></td>
1484 <th align=right>| . $locale->text('Template Code') . qq|</th>
1485 <td><input name=template_code size=5 value=$form->{template_code}></td>
1488 <th align=right>| . $locale->text('Article Code') . qq|</th>
1489 <td><input name=article_code size=10 value=$form->{article_code}></td>
1491 <td colspan=2><hr size=3 noshade></td>
1496 $lxdebug->leave_sub();
1500 $lxdebug->enter_sub();
1502 $form->isblank("description", $locale->text('Language missing!'));
1503 $form->isblank("template_code", $locale->text('Template Code missing!'));
1504 $form->isblank("article_code", $locale->text('Article Code missing!'));
1505 AM->save_language(\%myconfig, \%$form);
1506 $form->redirect($locale->text('Language saved!'));
1508 $lxdebug->leave_sub();
1511 sub delete_language {
1512 $lxdebug->enter_sub();
1514 AM->delete_language(\%myconfig, \%$form);
1515 $form->redirect($locale->text('Language deleted!'));
1517 $lxdebug->leave_sub();
1521 sub add_buchungsgruppe {
1522 $lxdebug->enter_sub();
1524 # $locale->text("Add Buchungsgruppe")
1525 # $locale->text("Edit Buchungsgruppe")
1526 $form->{title} = "Add";
1529 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1530 unless $form->{callback};
1531 AM->get_buchungsgruppe(\%myconfig, \%$form);
1533 &buchungsgruppe_header;
1536 $lxdebug->leave_sub();
1539 sub edit_buchungsgruppe {
1540 $lxdebug->enter_sub();
1542 $form->{title} = "Edit";
1544 AM->get_buchungsgruppe(\%myconfig, \%$form);
1546 &buchungsgruppe_header;
1550 $lxdebug->leave_sub();
1553 sub list_buchungsgruppe {
1554 $lxdebug->enter_sub();
1556 AM->buchungsgruppe(\%myconfig, \%$form);
1559 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1561 $callback = $form->escape($form->{callback});
1563 $form->{title} = $locale->text('Buchungsgruppen');
1565 @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 );
1567 $column_header{description} =
1568 qq|<th class=listheading width=60%>|
1569 . $locale->text('Description')
1571 $column_header{inventory_accno} =
1572 qq|<th class=listheading width=10%>|
1573 . $locale->text('Bestandskonto')
1575 $column_header{income_accno_0} =
1576 qq|<th class=listheading>|
1577 . $locale->text('Erlöse Inland')
1579 $column_header{expense_accno_0} =
1580 qq|<th class=listheading>|
1581 . $locale->text('Aufwand Inland')
1583 $column_header{income_accno_1} =
1584 qq|<th class=listheading>|
1585 . $locale->text('Erlöse EU o. UStId')
1587 $column_header{expense_accno_1} =
1588 qq|<th class=listheading>|
1589 . $locale->text('Aufwand EU o. UStId')
1591 $column_header{income_accno_2} =
1592 qq|<th class=listheading>|
1593 . $locale->text('Erlöse EU m. UStId')
1595 $column_header{expense_accno_2} =
1596 qq|<th class=listheading>|
1597 . $locale->text('Aufwand EU m. UStId')
1599 $column_header{income_accno_3} =
1600 qq|<th class=listheading>|
1601 . $locale->text('Erlöse Ausland')
1603 $column_header{expense_accno_3} =
1604 qq|<th class=listheading>|
1605 . $locale->text('Aufwand Ausland')
1614 <th class=listtop>$form->{title}</th>
1616 <tr height="5"></tr>
1620 <tr class=listheading>
1623 map { print "$column_header{$_}\n" } @column_index;
1629 foreach $ref (@{ $form->{ALL} }) {
1635 <tr valign=top class=listrow$i>
1639 $column_data{description} =
1640 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>|;
1641 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1642 $column_data{income_accno_0} =
1643 qq|<td align=right>$ref->{income_accno_0}</td>|;
1644 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1645 $column_data{income_accno_1} =
1646 qq|<td align=right>$ref->{income_accno_1}</td>|;
1647 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1648 $column_data{income_accno_2} =
1649 qq|<td align=right>$ref->{income_accno_2}</td>|;
1650 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1651 $column_data{income_accno_3} =
1652 qq|<td align=right>$ref->{income_accno_3}</td>|;
1653 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1655 map { print "$column_data{$_}\n" } @column_index;
1667 <td><hr size=3 noshade></td>
1672 <form method=post action=$form->{script}>
1674 <input name=callback type=hidden value="$form->{callback}">
1676 <input type=hidden name=type value=buchungsgruppe>
1678 <input type=hidden name=path value=$form->{path}>
1679 <input type=hidden name=login value=$form->{login}>
1680 <input type=hidden name=password value=$form->{password}>
1682 <input class=submit type=submit name=action value="|
1683 . $locale->text('Add') . qq|">|;
1685 if ($form->{menubar}) {
1686 require "$form->{path}/menu.pl";
1698 $lxdebug->leave_sub();
1701 sub buchungsgruppe_header {
1702 $lxdebug->enter_sub();
1704 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1706 # $locale->text('Buchungsgruppe hinzufügen')
1707 # $locale->text('Buchungsgruppe bearbeiten')
1709 $form->{description} =~ s/\"/"/g;
1711 # build the popup menus
1712 $form->{taxaccounts} = "";
1713 foreach $key (keys %{ $form->{IC_links} }) {
1714 foreach $ref (@{ $form->{IC_links}{$key} }) {
1716 # if this is a tax field
1717 if ($key =~ /IC_tax/) {
1718 if ($key =~ /$item/) {
1719 $form->{taxaccounts} .= "$ref->{accno} ";
1720 $form->{"IC_tax_$ref->{accno}_description"} =
1721 "$ref->{accno}--$ref->{description}";
1724 if ($form->{amount}{ $ref->{accno} }) {
1725 $form->{"IC_tax_$ref->{accno}"} = "checked";
1728 $form->{"IC_tax_$ref->{accno}"} = "checked";
1733 $form->{"select$key"} .=
1734 "<option value=$ref->{id} $ref->{selected}>$ref->{accno}--$ref->{description}\n";
1735 if (($key eq "IC") && ($ref->{selected} eq "selected")) {
1736 $form->{IC_default} = $ref->{id};
1738 if ($form->{amount}{$key} eq $ref->{accno}) {
1739 $form->{$key} = "$ref->{accno}--$ref->{description}";
1745 $form->{selectIC_income} = $form->{selectIC_sale};
1746 $form->{selectIC_expense} = $form->{selectIC_cogs};
1747 $form->{IC_income} = $form->{IC_sale};
1748 $form->{IC_expense} = $form->{IC_cogs};
1751 $form->{selectIC} =~ s/selected//g;
1752 $form->{selectIC} =~ s/ value=\$form->{inventory_accno_id}/ value=\$form->{inventory_accno_id} selected/;
1753 $form->{selectIC_income} =~ s/selected//g;
1754 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1755 $form->{selectIC_expense} =~ s/selected//g;
1756 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1762 <th align=right>| . $locale->text('Inventory') . qq|</th>
1763 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1764 <input name=selectIC type=hidden value="$form->{selectIC}">
1768 <input type=hidden name=inventory_accno_id value=1>|;
1772 $linkaccounts .= qq|
1774 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
1775 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
1778 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
1779 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
1782 $form->{selectIC_income} =~ s/selected//g;
1783 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
1784 $form->{selectIC_expense} =~ s/selected//g;
1785 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
1787 $linkaccounts .= qq| <tr>
1788 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
1789 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
1792 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
1793 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
1797 $form->{selectIC_income} =~ s/selected//g;
1798 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
1799 $form->{selectIC_expense} =~ s/selected//g;
1800 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
1803 $linkaccounts .= qq| <tr>
1804 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
1805 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
1808 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
1809 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
1813 $form->{selectIC_income} =~ s/selected//g;
1814 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
1815 $form->{selectIC_expense} =~ s/selected//g;
1816 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
1819 $linkaccounts .= qq| <tr>
1820 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
1821 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
1824 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
1825 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
1835 <form method=post action=$form->{script}>
1837 <input type=hidden name=id value=$form->{id}>
1838 <input type=hidden name=type value=buchungsgruppe>
1842 <th class=listtop colspan=2>$form->{title}</th>
1844 <tr height="5"></tr>
1846 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
1847 <td><input name=description size=30 value="$form->{description}"></td>
1850 <td colspan=2><hr size=3 noshade></td>
1855 $lxdebug->leave_sub();
1858 sub save_buchungsgruppe {
1859 $lxdebug->enter_sub();
1861 $form->isblank("description", $locale->text('Description missing!'));
1863 AM->save_buchungsgruppe(\%myconfig, \%$form);
1864 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
1866 $lxdebug->leave_sub();
1869 sub delete_buchungsgruppe {
1870 $lxdebug->enter_sub();
1872 AM->delete_buchungsgruppe(\%myconfig, \%$form);
1873 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
1875 $lxdebug->leave_sub();
1880 $lxdebug->enter_sub();
1882 $form->{title} = "Add";
1885 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1886 unless $form->{callback};
1891 $lxdebug->leave_sub();
1895 $lxdebug->enter_sub();
1897 $form->{title} = "Edit";
1899 AM->get_printer(\%myconfig, \%$form);
1903 $form->{orphaned} = 1;
1906 $lxdebug->leave_sub();
1910 $lxdebug->enter_sub();
1912 AM->printer(\%myconfig, \%$form);
1915 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1917 $callback = $form->escape($form->{callback});
1919 $form->{title} = $locale->text('Printer');
1921 @column_index = qw(printer_description printer_command template_code);
1923 $column_header{printer_description} =
1924 qq|<th class=listheading width=60%>|
1925 . $locale->text('Printer Description')
1927 $column_header{printer_command} =
1928 qq|<th class=listheading width=10%>|
1929 . $locale->text('Printer Command')
1931 $column_header{template_code} =
1932 qq|<th class=listheading>|
1933 . $locale->text('Template Code')
1943 <th class=listtop>$form->{title}</th>
1945 <tr height="5"></tr>
1949 <tr class=listheading>
1952 map { print "$column_header{$_}\n" } @column_index;
1958 foreach $ref (@{ $form->{ALL} }) {
1964 <tr valign=top class=listrow$i>
1968 $column_data{printer_description} =
1969 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>|;
1970 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
1971 $column_data{template_code} =
1972 qq|<td align=right>$ref->{template_code}</td>|;
1974 map { print "$column_data{$_}\n" } @column_index;
1986 <td><hr size=3 noshade></td>
1991 <form method=post action=$form->{script}>
1993 <input name=callback type=hidden value="$form->{callback}">
1995 <input type=hidden name=type value=printer>
1997 <input type=hidden name=path value=$form->{path}>
1998 <input type=hidden name=login value=$form->{login}>
1999 <input type=hidden name=password value=$form->{password}>
2001 <input class=submit type=submit name=action value="|
2002 . $locale->text('Add') . qq|">|;
2004 if ($form->{menubar}) {
2005 require "$form->{path}/menu.pl";
2017 $lxdebug->leave_sub();
2020 sub printer_header {
2021 $lxdebug->enter_sub();
2023 $form->{title} = $locale->text("$form->{title} Printer");
2025 # $locale->text('Add Printer')
2026 # $locale->text('Edit Printer')
2028 $form->{printer_description} =~ s/\"/"/g;
2029 $form->{template_code} =~ s/\"/"/g;
2030 $form->{printer_command} =~ s/\"/"/g;
2038 <form method=post action=$form->{script}>
2040 <input type=hidden name=id value=$form->{id}>
2041 <input type=hidden name=type value=printer>
2045 <th class=listtop colspan=2>$form->{title}</th>
2047 <tr height="5"></tr>
2049 <th align=right>| . $locale->text('Printer') . qq|</th>
2050 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2053 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2054 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2057 <th align=right>| . $locale->text('Template Code') . qq|</th>
2058 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2060 <td colspan=2><hr size=3 noshade></td>
2065 $lxdebug->leave_sub();
2069 $lxdebug->enter_sub();
2071 $form->isblank("printer_description", $locale->text('Description missing!'));
2072 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2073 AM->save_printer(\%myconfig, \%$form);
2074 $form->redirect($locale->text('Printer saved!'));
2076 $lxdebug->leave_sub();
2079 sub delete_printer {
2080 $lxdebug->enter_sub();
2082 AM->delete_printer(\%myconfig, \%$form);
2083 $form->redirect($locale->text('Printer deleted!'));
2085 $lxdebug->leave_sub();
2090 $lxdebug->enter_sub();
2092 $form->{title} = "Add";
2095 "$form->{script}?action=add_adr&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2096 unless $form->{callback};
2101 $lxdebug->leave_sub();
2105 $lxdebug->enter_sub();
2107 $form->{title} = "Edit";
2109 AM->get_adr(\%myconfig, \%$form);
2113 $form->{orphaned} = 1;
2116 $lxdebug->leave_sub();
2120 $lxdebug->enter_sub();
2122 AM->adr(\%myconfig, \%$form);
2125 "$form->{script}?action=list_adr&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2127 $callback = $form->escape($form->{callback});
2129 $form->{title} = $locale->text('ADR');
2131 @column_index = qw(adr_code adr_description);
2133 $column_header{adr_description} =
2134 qq|<th class=listheading width=60%>|
2135 . $locale->text('ADR Description')
2137 $column_header{adr_code} =
2138 qq|<th class=listheading width=10%>|
2139 . $locale->text('ADR Code')
2149 <th class=listtop>$form->{title}</th>
2151 <tr height="5"></tr>
2155 <tr class=listheading>
2158 map { print "$column_header{$_}\n" } @column_index;
2164 foreach $ref (@{ $form->{ALL} }) {
2170 <tr valign=top class=listrow$i>
2174 $column_data{adr_code} =
2175 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>|;
2176 $column_data{adr_description} = qq|<td align=left>$ref->{adr_description}</td>|;
2179 map { print "$column_data{$_}\n" } @column_index;
2191 <td><hr size=3 noshade></td>
2196 <form method=post action=$form->{script}>
2198 <input name=callback type=hidden value="$form->{callback}">
2200 <input type=hidden name=type value=adr>
2202 <input type=hidden name=path value=$form->{path}>
2203 <input type=hidden name=login value=$form->{login}>
2204 <input type=hidden name=password value=$form->{password}>
2206 <input class=submit type=submit name=action value="|
2207 . $locale->text('Add') . qq|">|;
2209 if ($form->{menubar}) {
2210 require "$form->{path}/menu.pl";
2222 $lxdebug->leave_sub();
2226 $lxdebug->enter_sub();
2228 $form->{title} = $locale->text("$form->{title} ADR");
2230 # $locale->text('Add ADR')
2231 # $locale->text('Edit ADR')
2233 $form->{adr_description} =~ s/\"/"/g;
2234 $form->{adr_code} =~ s/\"/"/g;
2242 <form method=post action=$form->{script}>
2244 <input type=hidden name=id value=$form->{id}>
2245 <input type=hidden name=type value=adr>
2249 <th class=listtop colspan=2>$form->{title}</th>
2251 <tr height="5"></tr>
2253 <th align=right>| . $locale->text('ADR Code') . qq|</th>
2254 <td><input name=adr_code size=30 value="$form->{adr_code}"></td>
2257 <th align=right>| . $locale->text('ADR Description') . qq|</th>
2258 <td><input name=adr_description size=60 value="$form->{adr_description}"></td>
2260 <td colspan=2><hr size=3 noshade></td>
2265 $lxdebug->leave_sub();
2269 $lxdebug->enter_sub();
2271 $form->isblank("adr_description", $locale->text('ADR Description missing!'));
2272 $form->isblank("adr_code", $locale->text('ADR Code missing!'));
2273 AM->save_adr(\%myconfig, \%$form);
2274 $form->redirect($locale->text('ADR saved!'));
2276 $lxdebug->leave_sub();
2281 $lxdebug->enter_sub();
2283 AM->delete_adr(\%myconfig, \%$form);
2284 $form->redirect($locale->text('ADR deleted!'));
2286 $lxdebug->leave_sub();
2291 $lxdebug->enter_sub();
2293 $form->{title} = "Add";
2296 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2297 unless $form->{callback};
2302 $lxdebug->leave_sub();
2306 $lxdebug->enter_sub();
2308 $form->{title} = "Edit";
2310 AM->get_payment(\%myconfig, \%$form);
2314 $form->{orphaned} = 1;
2317 $lxdebug->leave_sub();
2321 $lxdebug->enter_sub();
2323 AM->payment(\%myconfig, \%$form);
2326 "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2328 $callback = $form->escape($form->{callback});
2330 $form->{title} = $locale->text('Payment Terms');
2332 @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
2334 $column_header{description} =
2335 qq|<th class=listheading>|
2336 . $locale->text('Description')
2338 $column_header{description_long} =
2339 qq|<th class=listheading>|
2340 . $locale->text('Long Description')
2342 $column_header{terms_netto} =
2343 qq|<th class=listheading>|
2344 . $locale->text('Netto Terms')
2346 $column_header{terms_skonto} =
2347 qq|<th class=listheading>|
2348 . $locale->text('Skonto Terms')
2350 $column_header{percent_skonto} =
2351 qq|<th class=listheading>|
2352 . $locale->text('Skonto')
2362 <th class=listtop>$form->{title}</th>
2364 <tr height="5"></tr>
2368 <tr class=listheading>
2371 map { print "$column_header{$_}\n" } @column_index;
2377 foreach $ref (@{ $form->{ALL} }) {
2383 <tr valign=top class=listrow$i>
2387 $column_data{description} =
2388 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>|;
2389 $column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|;
2390 $column_data{terms_netto} =
2391 qq|<td align=right>$ref->{terms_netto}</td>|;
2392 $column_data{terms_skonto} =
2393 qq|<td align=right>$ref->{terms_skonto}</td>|;
2394 $column_data{percent_skonto} =
2395 qq|<td align=right>$ref->{percent_skonto} %</td>|;
2396 map { print "$column_data{$_}\n" } @column_index;
2408 <td><hr size=3 noshade></td>
2413 <form method=post action=$form->{script}>
2415 <input name=callback type=hidden value="$form->{callback}">
2417 <input type=hidden name=type value=business>
2419 <input type=hidden name=path value=$form->{path}>
2420 <input type=hidden name=login value=$form->{login}>
2421 <input type=hidden name=password value=$form->{password}>
2423 <input class=submit type=submit name=action value="|
2424 . $locale->text('Add') . qq|">|;
2426 if ($form->{menubar}) {
2427 require "$form->{path}/menu.pl";
2439 $lxdebug->leave_sub();
2442 sub payment_header {
2443 $lxdebug->enter_sub();
2445 $form->{title} = $locale->text("$form->{title} Payment Terms");
2447 # $locale->text('Add Payment Terms')
2448 # $locale->text('Edit Payment Terms')
2450 $form->{description} =~ s/\"/"/g;
2459 <form method=post action=$form->{script}>
2461 <input type=hidden name=id value=$form->{id}>
2462 <input type=hidden name=type value=payment>
2466 <th class=listtop colspan=2>$form->{title}</th>
2468 <tr height="5"></tr>
2470 <th align=right>| . $locale->text('Description') . qq|</th>
2471 <td><input name=description size=30 value="$form->{description}"></td>
2474 <th align=right>| . $locale->text('Ranking') . qq|</th>
2475 <td><input name=ranking size=30 value="$form->{ranking}"></td>
2478 <th align=right>| . $locale->text('Long Description') . qq|</th>
2479 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2482 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2483 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2486 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2487 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2490 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2491 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2493 <td colspan=2><hr size=3 noshade></td>
2498 $lxdebug->leave_sub();
2502 $lxdebug->enter_sub();
2504 $form->isblank("description", $locale->text('Language missing!'));
2505 AM->save_payment(\%myconfig, \%$form);
2506 $form->redirect($locale->text('Payment Terms saved!'));
2508 $lxdebug->leave_sub();
2511 sub delete_payment {
2512 $lxdebug->enter_sub();
2514 AM->delete_payment(\%myconfig, \%$form);
2515 $form->redirect($locale->text('Payment terms deleted!'));
2517 $lxdebug->leave_sub();
2521 $lxdebug->enter_sub();
2523 $form->{title} = "Add";
2526 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2527 unless $form->{callback};
2532 $lxdebug->leave_sub();
2536 $lxdebug->enter_sub();
2538 $form->{title} = "Edit";
2540 AM->get_sic(\%myconfig, \%$form);
2544 $form->{orphaned} = 1;
2547 $lxdebug->leave_sub();
2551 $lxdebug->enter_sub();
2553 AM->sic(\%myconfig, \%$form);
2556 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2558 $callback = $form->escape($form->{callback});
2560 $form->{title} = $locale->text('Standard Industrial Codes');
2562 @column_index = qw(code description);
2564 $column_header{code} =
2565 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
2566 $column_header{description} =
2567 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
2576 <th class=listtop>$form->{title}</th>
2578 <tr height="5"></tr>
2582 <tr class=listheading>
2585 map { print "$column_header{$_}\n" } @column_index;
2591 foreach $ref (@{ $form->{ALL} }) {
2596 if ($ref->{sictype} eq 'H') {
2598 <tr valign=top class=listheading>
2600 $column_data{code} =
2601 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>|;
2602 $column_data{description} = qq|<th>$ref->{description}</th>|;
2606 <tr valign=top class=listrow$i>
2609 $column_data{code} =
2610 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>|;
2611 $column_data{description} = qq|<td>$ref->{description}</td>|;
2615 map { print "$column_data{$_}\n" } @column_index;
2627 <td><hr size=3 noshade></td>
2632 <form method=post action=$form->{script}>
2634 <input name=callback type=hidden value="$form->{callback}">
2636 <input type=hidden name=type value=sic>
2638 <input type=hidden name=path value=$form->{path}>
2639 <input type=hidden name=login value=$form->{login}>
2640 <input type=hidden name=password value=$form->{password}>
2642 <input class=submit type=submit name=action value="|
2643 . $locale->text('Add') . qq|">|;
2645 if ($form->{menubar}) {
2646 require "$form->{path}/menu.pl";
2657 $lxdebug->leave_sub();
2661 $lxdebug->enter_sub();
2663 $form->{title} = $locale->text("$form->{title} SIC");
2665 # $locale->text('Add SIC')
2666 # $locale->text('Edit SIC')
2668 $form->{code} =~ s/\"/"/g;
2669 $form->{description} =~ s/\"/"/g;
2671 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
2678 <form method=post action=$form->{script}>
2680 <input type=hidden name=type value=sic>
2681 <input type=hidden name=id value=$form->{code}>
2685 <th class=listtop colspan=2>$form->{title}</th>
2687 <tr height="5"></tr>
2689 <th align=right>| . $locale->text('Code') . qq|</th>
2690 <td><input name=code size=10 value=$form->{code}></td>
2694 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
2695 . $locale->text('Heading') . qq|</th>
2698 <th align=right>| . $locale->text('Description') . qq|</th>
2699 <td><input name=description size=60 value="$form->{description}"></td>
2701 <td colspan=2><hr size=3 noshade></td>
2706 $lxdebug->leave_sub();
2710 $lxdebug->enter_sub();
2712 $form->isblank("code", $locale->text('Code missing!'));
2713 $form->isblank("description", $locale->text('Description missing!'));
2714 AM->save_sic(\%myconfig, \%$form);
2715 $form->redirect($locale->text('SIC saved!'));
2717 $lxdebug->leave_sub();
2721 $lxdebug->enter_sub();
2723 AM->delete_sic(\%myconfig, \%$form);
2724 $form->redirect($locale->text('SIC deleted!'));
2726 $lxdebug->leave_sub();
2729 sub display_stylesheet {
2730 $lxdebug->enter_sub();
2732 $form->{file} = "css/$myconfig{stylesheet}";
2735 $lxdebug->leave_sub();
2739 $lxdebug->enter_sub();
2741 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2742 $form->{file} =~ s/^\/*//g;
2743 $form->{file} =~ s/$userspath//;
2745 $form->error("$!: $form->{file}") unless -f $form->{file};
2747 AM->load_template(\%$form);
2749 $form->{title} = $form->{file};
2751 # if it is anything but html
2752 if ($form->{file} !~ /\.html$/) {
2753 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2763 <form method=post action=$form->{script}>
2765 <input name=file type=hidden value=$form->{file}>
2766 <input name=type type=hidden value=template>
2768 <input type=hidden name=path value=$form->{path}>
2769 <input type=hidden name=login value=$form->{login}>
2770 <input type=hidden name=password value=$form->{password}>
2772 <input name=action type=submit class=submit value="|
2773 . $locale->text('Edit') . qq|">|;
2775 if ($form->{menubar}) {
2776 require "$form->{path}/menu.pl";
2787 $lxdebug->leave_sub();
2791 $lxdebug->enter_sub();
2793 AM->load_template(\%$form);
2795 $form->{title} = $locale->text('Edit Template');
2797 # convert   to &nbsp;
2798 $form->{body} =~ s/ /&nbsp;/gi;
2805 <form method=post action=$form->{script}>
2807 <input name=file type=hidden value=$form->{file}>
2808 <input name=type type=hidden value=template>
2810 <input type=hidden name=path value=$form->{path}>
2811 <input type=hidden name=login value=$form->{login}>
2812 <input type=hidden name=password value=$form->{password}>
2814 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
2816 <textarea name=body rows=25 cols=70>
2821 <input type=submit class=submit name=action value="|
2822 . $locale->text('Save') . qq|">|;
2824 if ($form->{menubar}) {
2825 require "$form->{path}/menu.pl";
2837 $lxdebug->leave_sub();
2841 $lxdebug->enter_sub();
2843 AM->save_template(\%$form);
2844 $form->redirect($locale->text('Template saved!'));
2846 $lxdebug->leave_sub();
2850 $lxdebug->enter_sub();
2852 # get defaults for account numbers and last numbers
2853 AM->defaultaccounts(\%myconfig, \%$form);
2855 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2857 ($item eq $myconfig{dateformat})
2858 ? "<option selected>$item\n"
2859 : "<option>$item\n";
2862 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2864 ($item eq $myconfig{numberformat})
2865 ? "<option selected>$item\n"
2866 : "<option>$item\n";
2869 foreach $item (qw(name company address signature)) {
2870 $myconfig{$item} =~ s/\"/"/g;
2873 foreach $item (qw(address signature)) {
2874 $myconfig{$item} =~ s/\\n/\r\n/g;
2877 %countrycodes = User->country_codes;
2879 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2883 ($myconfig{countrycode} eq $key)
2884 ? "<option selected value=$key>$countrycodes{$key}\n"
2885 : "<option value=$key>$countrycodes{$key}\n";
2887 $countrycodes = "<option>American English\n$countrycodes";
2889 # use an other input number format than output numberformat
2890 # look at Form.pm, sub parse_amount
2891 my $in_numberformat = '';
2892 $text1 = qq|value="0">| . $locale->text('equal Outputformat');
2893 $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
2894 @in_nf = ($text1, $text2);
2895 foreach $item (@in_nf) {
2897 (substr($item, 7, 1) eq $myconfig{in_numberformat})
2898 ? "<option selected $item\n"
2899 : "<option $item\n";
2902 foreach $key (keys %{ $form->{IC} }) {
2903 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2905 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2906 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2907 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2911 opendir CSS, "css/.";
2912 @all = grep /.*\.css$/, readdir CSS;
2915 foreach $item (@all) {
2916 if ($item eq $myconfig{stylesheet}) {
2917 $selectstylesheet .= qq|<option selected>$item\n|;
2919 $selectstylesheet .= qq|<option>$item\n|;
2922 $selectstylesheet .= "<option>\n";
2924 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2928 if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
2929 else { $newS = "checked"; }
2934 <form method=post action=$form->{script}>
2936 <input type=hidden name=old_password value=$myconfig{password}>
2937 <input type=hidden name=type value=preferences>
2938 <input type=hidden name=role value=$myconfig{role}>
2941 <tr><th class=listtop>$form->{title}</th></tr>
2946 <th align=right>| . $locale->text('Name') . qq|</th>
2947 <td><input name=name size=15 value="$myconfig{name}"></td>
2950 <th align=right>| . $locale->text('Password') . qq|</th>
2951 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2954 <th align=right>| . $locale->text('E-mail') . qq|</th>
2955 <td><input name=email size=30 value="$myconfig{email}"></td>
2958 <th align=right>| . $locale->text('Signature') . qq|</th>
2959 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2962 <th align=right>| . $locale->text('Phone') . qq|</th>
2963 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2966 <th align=right>| . $locale->text('Fax') . qq|</th>
2967 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2970 <th align=right>| . $locale->text('Company') . qq|</th>
2971 <td><input name=company size=30 value="$myconfig{company}"></td>
2974 <th align=right>| . $locale->text('Address') . qq|</th>
2975 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2978 <th align=right>| . $locale->text('Date Format') . qq|</th>
2979 <td><select name=dateformat>$dateformat</select></td>
2982 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2983 <td><select name=numberformat>$numberformat</select></td>
2986 <th align=right>| . $locale->text('Input Number Format') . qq|</th>
2987 <td><select name=in_numberformat>$in_numberformat</select></td>
2991 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2992 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2995 <th align=right>| . $locale->text('Language') . qq|</th>
2996 <td><select name=countrycode>$countrycodes</select></td>
2999 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
3000 <td><select name=usestylesheet>$selectstylesheet</select></td>
3003 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
3004 <td><input name=menustyle type=radio class=radio value=neu $newS> New
3005 <input name=menustyle type=radio class=radio value=old $oldS> Old</td>
3007 <input name=printer type=hidden value="$myconfig{printer}">
3008 <tr class=listheading>
3009 <th colspan=2> </th>
3012 <th align=right>| . $locale->text('Business Number') . qq|</th>
3013 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
3019 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
3020 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
3021 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
3022 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
3027 <tr class=listheading>
3029 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
3035 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
3036 <td><select name=inventory_accno>$myconfig{IC}</select></td>
3039 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
3040 <td><select name=income_accno>$myconfig{IC_income}</select></td>
3043 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
3044 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
3047 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
3048 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
3051 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
3052 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
3057 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
3059 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
3068 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
3069 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
3070 <th align=right nowrap>|
3071 . $locale->text('Last Customer Number') . qq|</th>
3072 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
3075 <th align=right nowrap>|
3076 . $locale->text('Last Credit Note Number') . qq|</th>
3077 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
3078 <th align=right nowrap>|
3079 . $locale->text('Last Vendor Number') . qq|</th>
3080 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
3083 <th align=right nowrap>|
3084 . $locale->text('Last Sales Order Number') . qq|</th>
3085 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
3088 <th align=right nowrap>|
3089 . $locale->text('Last Purchase Order Number') . qq|</th>
3090 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
3091 <th align=right nowrap>|
3092 . $locale->text('Last Article Number') . qq|</th>
3093 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
3096 <th align=right nowrap>|
3097 . $locale->text('Last Sales Quotation Number') . qq|</th>
3098 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
3099 <th align=right nowrap>|
3100 . $locale->text('Last Service Number') . qq|</th>
3101 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
3104 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
3105 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
3106 <th align=right nowrap></th>
3112 <tr class=listheading>
3113 <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3120 <th>| . $locale->text('Rate') . qq| (%)</th>
3121 <th>| . $locale->text('Number') . qq|</th>
3125 foreach $accno (sort keys %{ $form->{taxrates} }) {
3128 <th align=right>$form->{taxrates}{$accno}{description}</th>
3129 <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3130 <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3133 $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3136 chop $form->{taxaccounts};
3139 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3148 <td><hr size=3 noshade></td>
3152 <input type=hidden name=path value=$form->{path}>
3153 <input type=hidden name=login value=$form->{login}>
3154 <input type=hidden name=password value=$form->{password}>
3157 <input type=submit class=submit name=action value="|
3158 . $locale->text('Save') . qq|">|;
3160 if ($form->{menubar}) {
3161 require "$form->{path}/menu.pl";
3172 $lxdebug->leave_sub();
3175 sub save_preferences {
3176 $lxdebug->enter_sub();
3178 $form->{stylesheet} = $form->{usestylesheet};
3180 $form->redirect($locale->text('Preferences saved!'))
3182 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3184 $form->error($locale->text('Cannot save preferences!'));
3186 $lxdebug->leave_sub();
3190 $lxdebug->enter_sub();
3192 if ($form->{media} eq 'email') {
3193 $form->error($locale->text('No email address for') . " $myconfig{name}")
3194 unless ($myconfig{email});
3196 $form->{OUT} = "$sendmail";
3200 AM->backup(\%myconfig, \%$form, $userspath);
3202 if ($form->{media} eq 'email') {
3203 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
3206 $lxdebug->leave_sub();
3210 $lxdebug->enter_sub();
3212 $form->{title} = $locale->text('Audit Control');
3214 AM->closedto(\%myconfig, \%$form);
3216 if ($form->{revtrans}) {
3217 $checked{Y} = "checked";
3219 $checked{N} = "checked";
3227 <form method=post action=$form->{script}>
3229 <input type=hidden name=path value=$form->{path}>
3230 <input type=hidden name=login value=$form->{login}>
3231 <input type=hidden name=password value=$form->{password}>
3234 <tr><th class=listtop>$form->{title}</th></tr>
3235 <tr height="5"></tr>
3241 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3242 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3243 . $locale->text('Yes')
3244 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3245 . $locale->text('No')
3249 <th>| . $locale->text('Close Books up to') . qq|</th>
3250 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3260 <input type=hidden name=nextsub value=doclose>
3262 <input type=submit class=submit name=action value="|
3263 . $locale->text('Continue') . qq|">
3271 $lxdebug->leave_sub();
3275 $lxdebug->enter_sub();
3277 AM->closebooks(\%myconfig, \%$form);
3279 if ($form->{revtrans}) {
3281 $locale->text('Transaction reversal enforced for all dates'));
3283 if ($form->{closedto}) {
3285 $locale->text('Transaction reversal enforced up to') . " "
3286 . $locale->date(\%myconfig, $form->{closedto}, 1));
3288 $form->redirect($locale->text('Books are open'));
3292 $lxdebug->leave_sub();
3296 $lxdebug->enter_sub();
3298 $form->{title} = "Add";
3301 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
3302 unless $form->{callback};
3307 $lxdebug->leave_sub();
3310 sub edit_warehouse {
3311 $lxdebug->enter_sub();
3313 $form->{title} = "Edit";
3315 AM->get_warehouse(\%myconfig, \%$form);
3320 $lxdebug->leave_sub();
3323 sub list_warehouse {
3324 $lxdebug->enter_sub();
3326 AM->warehouses(\%myconfig, \%$form);
3329 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
3331 $callback = $form->escape($form->{callback});
3333 $form->{title} = $locale->text('Warehouses');
3335 @column_index = qw(description);
3337 $column_header{description} =
3338 qq|<th class=listheading width=100%>|
3339 . $locale->text('Description')
3349 <th class=listtop>$form->{title}</th>
3351 <tr height="5"></tr>
3355 <tr class=listheading>
3358 map { print "$column_header{$_}\n" } @column_index;
3364 foreach $ref (@{ $form->{ALL} }) {
3370 <tr valign=top class=listrow$i>
3373 $column_data{description} =
3374 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>|;
3376 map { print "$column_data{$_}\n" } @column_index;
3388 <td><hr size=3 noshade></td>
3393 <form method=post action=$form->{script}>
3395 <input name=callback type=hidden value="$form->{callback}">
3397 <input type=hidden name=type value=warehouse>
3399 <input type=hidden name=path value=$form->{path}>
3400 <input type=hidden name=login value=$form->{login}>
3401 <input type=hidden name=password value=$form->{password}>
3403 <input class=submit type=submit name=action value="|
3404 . $locale->text('Add') . qq|">|;
3406 if ($form->{menubar}) {
3407 require "$form->{path}/menu.pl";
3418 $lxdebug->leave_sub();
3421 sub warehouse_header {
3422 $lxdebug->enter_sub();
3424 $form->{title} = $locale->text("$form->{title} Warehouse");
3426 # $locale->text('Add Warehouse')
3427 # $locale->text('Edit Warehouse')
3429 $form->{description} =~ s/\"/"/g;
3431 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
3433 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
3436 qq|<input name=description size=60 value="$form->{description}">|;
3444 <form method=post action=$form->{script}>
3446 <input type=hidden name=id value=$form->{id}>
3447 <input type=hidden name=type value=warehouse>
3451 <th class=listtop colspan=2>$form->{title}</th>
3453 <tr height="5"></tr>
3455 <th align=right>| . $locale->text('Description') . qq|</th>
3456 <td>$description</td>
3459 <td colspan=2><hr size=3 noshade></td>
3464 $lxdebug->leave_sub();
3467 sub save_warehouse {
3468 $lxdebug->enter_sub();
3470 $form->isblank("description", $locale->text('Description missing!'));
3471 AM->save_warehouse(\%myconfig, \%$form);
3472 $form->redirect($locale->text('Warehouse saved!'));
3474 $lxdebug->leave_sub();
3477 sub delete_warehouse {
3478 $lxdebug->enter_sub();
3480 AM->delete_warehouse(\%myconfig, \%$form);
3481 $form->redirect($locale->text('Warehouse deleted!'));
3483 $lxdebug->leave_sub();
3487 $lxdebug->enter_sub();
3489 &{ $form->{nextsub} };
3491 $lxdebug->leave_sub();
3495 $lxdebug->enter_sub();
3497 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3498 AM->units_in_use(\%myconfig, $form, $units);
3499 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3502 foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3503 map({ push(@unit_list, $units->{$_}); }
3504 sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3505 grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3507 map({ $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"}); } @unit_list);
3509 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3510 $ddbox = AM->unit_select_data($units, undef, 1);
3512 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3514 print($form->parse_html_template("am/edit_units", { "UNITS" => \@unit_list, "NEW_BASE_UNIT_DDBOX" => $ddbox }));
3516 $lxdebug->leave_sub();
3520 $lxdebug->enter_sub();
3522 $form->isblank("new_name", $locale->text("The name is missing."));
3523 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3524 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($units->{$form->{"new_name"}});
3526 my ($base_unit, $factor);
3527 if ($form->{"new_base_unit"}) {
3528 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3530 $form->isblank("new_factor", $locale->text("The factor is missing."));
3531 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3532 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3533 $base_unit = $form->{"new_base_unit"};
3536 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"});
3538 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3542 $lxdebug->leave_sub();
3546 $lxdebug->enter_sub();
3548 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3549 AM->units_in_use(\%myconfig, $form, $old_units);
3553 foreach $i (1..($form->{"rowcount"} * 1)) {
3554 $old_unit = $old_units->{$form->{"old_name_$i"}};
3556 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3559 if ($form->{"unchangeable_$i"}) {
3560 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3561 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3565 if ($old_unit->{"in_use"}) {
3566 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3569 if ($form->{"delete_$i"}) {
3570 push(@delete_units, $old_unit->{"name"});
3574 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3576 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3577 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3578 $new_units->{$form->{"name_$i"}} = \%h;
3579 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3582 foreach $unit (values(%{$new_units})) {
3583 next unless ($unit->{"old_name"});
3584 if ($unit->{"base_unit"}) {
3585 $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"}))
3586 unless (defined($new_units->{$unit->{"base_unit"}}));
3587 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3588 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3590 $unit->{"base_unit"} = undef;
3591 $unit->{"factor"} = undef;
3595 foreach $unit (values(%{$new_units})) {
3596 next if ($unit->{"unchanged_unit"});
3598 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3600 while ($new_unit->{"base_unit"}) {
3601 $new_unit->{"seen"} = 1;
3602 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3603 if ($new_unit->{"seen"}) {
3604 $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, " .
3605 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3610 #print(STDERR Dumper($delete_units));
3611 #print(STDERR Dumper($new_units));
3613 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3615 $form->{"saved_message"} = $locale->text("The units have been saved.");
3619 $lxdebug->leave_sub();