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 $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 values=$form->{fxgain_accno_id}>
333 <input type=hidden name=fxloss_accno_id values=$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=I $checked{I_}> |
361 . $locale->text('Revenue') . qq|\n<br>
362 <input name=category type=radio class=radio value=E $checked{E_}> |
363 . $locale->text('Expense') . qq|</td>
364 <td width=50> </td>
366 <input name=charttype type=radio class=radio value="H" $checked{H}> |
367 . $locale->text('Heading') . qq|<br>
368 <input name=charttype type=radio class=radio value="A" $checked{A}> |
369 . $locale->text('Account') . qq|</td>
376 if ($form->{charttype} eq "A") {
383 . $locale->text('Is this a summary account to record') . qq|</th>
385 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
386 . $locale->text('AR')
387 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
388 . $locale->text('AP')
389 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
390 . $locale->text('Inventory')
397 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
403 <th align=left>| . $locale->text('Receivables') . qq|</th>
404 <th align=left>| . $locale->text('Payables') . qq|</th>
405 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
406 <th align=left>| . $locale->text('Service Items') . qq|</th>
410 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
411 . $locale->text('Revenue') . qq|\n<br>
412 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
413 . $locale->text('Receipt') . qq|\n<br>
414 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
415 . $locale->text('Tax') . qq|
418 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
419 . $locale->text('Expense/Asset') . qq|\n<br>
420 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
421 . $locale->text('Payment') . qq|\n<br>
422 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
423 . $locale->text('Tax') . qq|
426 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
427 . $locale->text('Revenue') . qq|\n<br>
428 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
429 . $locale->text('COGS') . qq|\n<br>
430 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
431 . $locale->text('Tax') . qq|
434 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
435 . $locale->text('Revenue') . qq|\n<br>
436 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
437 . $locale->text('Expense') . qq|\n<br>
438 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
439 . $locale->text('Tax') . qq|
459 <td><hr size=3 noshade></td>
464 $lxdebug->leave_sub();
468 $lxdebug->enter_sub();
472 <input name=callback type=hidden value="$form->{callback}">
474 <input type=hidden name=path value=$form->{path}>
475 <input type=hidden name=login value=$form->{login}>
476 <input type=hidden name=password value=$form->{password}>
479 #print(STDERR "$form->{type} TYPE $form->{new_chart_valid} CHART_VALID\n");
480 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
482 <input type=submit class=submit name=action value="|
483 . $locale->text('Save') . qq|">
487 if ($form->{id} && $form->{orphaned}) {
488 print qq|<input type=submit class=submit name=action value="|
489 . $locale->text('Delete') . qq|">|;
492 if ($form->{menubar}) {
493 require "$form->{path}/menu.pl";
504 $lxdebug->leave_sub();
508 $lxdebug->enter_sub();
510 $form->isblank("accno", $locale->text('Account Number missing!'));
511 $form->isblank("category", $locale->text('Account Type missing!'));
513 $form->redirect($locale->text('Account saved!'))
514 if (AM->save_account(\%myconfig, \%$form));
515 $form->error($locale->text('Cannot save account!'));
517 $lxdebug->leave_sub();
521 $lxdebug->enter_sub();
523 CA->all_accounts(\%myconfig, \%$form);
525 $form->{title} = $locale->text('Chart of Accounts');
529 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
531 @column_index = qw(accno gifi_accno description debit credit link);
533 $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
534 $column_header{gifi_accno} =
535 qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
536 $column_header{description} =
537 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
538 $column_header{debit} = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
539 $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
540 $column_header{link} = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
543 $colspan = $#column_index + 1;
550 <th class=listtop colspan=$colspan>$form->{title}</th>
553 <tr class=listheading>
556 map { print "$column_header{$_}\n" } @column_index;
563 $callback = $form->escape($callback);
565 foreach $ca (@{ $form->{CA} }) {
567 $ca->{debit} = " ";
568 $ca->{credit} = " ";
570 if ($ca->{amount} > 0) {
572 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
574 if ($ca->{amount} < 0) {
576 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
579 $ca->{link} =~ s/:/<br>/og;
581 if ($ca->{charttype} eq "H") {
582 print qq|<tr class=listheading>|;
584 $column_data{accno} =
585 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>|;
586 $column_data{gifi_accno} =
587 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>|;
588 $column_data{description} = qq|<th>$ca->{description} </th>|;
589 $column_data{debit} = qq|<th> </th>|;
590 $column_data{credit} = qq| <th> </th>|;
591 $column_data{link} = qq|<th> </th>|;
597 <tr valign=top class=listrow$i>|;
598 $column_data{accno} =
599 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>|;
600 $column_data{gifi_accno} =
601 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>|;
602 $column_data{description} = qq|<td>$ca->{description} </td>|;
603 $column_data{debit} = qq|<td align=right>$ca->{debit}</td>|;
604 $column_data{credit} = qq|<td align=right>$ca->{credit}</td>|;
605 $column_data{link} = qq|<td>$ca->{link} </td>|;
609 map { print "$column_data{$_}\n" } @column_index;
615 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
622 $lxdebug->leave_sub();
626 $lxdebug->enter_sub();
628 $form->{title} = $locale->text('Delete Account');
631 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
633 if ($form->{id} == $form->{$id}) {
634 $form->error($locale->text('Cannot delete default account!'));
638 $form->redirect($locale->text('Account deleted!'))
639 if (AM->delete_account(\%myconfig, \%$form));
640 $form->error($locale->text('Cannot delete account!'));
642 $lxdebug->leave_sub();
646 $lxdebug->enter_sub();
648 @{ $form->{fields} } = (accno, description);
649 $form->{table} = "gifi";
650 $form->{sortorder} = "accno";
652 AM->gifi_accounts(\%myconfig, \%$form);
654 $form->{title} = $locale->text('GIFI');
658 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
660 @column_index = qw(accno description);
662 $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
663 $column_header{description} =
664 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
667 $colspan = $#column_index + 1;
674 <th class=listtop colspan=$colspan>$form->{title}</th>
677 <tr class=listheading>
680 map { print "$column_header{$_}\n" } @column_index;
687 $callback = $form->escape($callback);
689 foreach $ca (@{ $form->{ALL} }) {
695 <tr valign=top class=listrow$i>|;
697 $column_data{accno} =
698 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>|;
699 $column_data{description} = qq|<td>$ca->{description} </td>|;
701 map { print "$column_data{$_}\n" } @column_index;
708 <td colspan=$colspan><hr size=3 noshade></td>
716 $lxdebug->leave_sub();
720 $lxdebug->enter_sub();
722 $form->{title} = "Add";
726 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
733 $lxdebug->leave_sub();
737 $lxdebug->enter_sub();
739 $form->{title} = "Edit";
741 AM->get_gifi(\%myconfig, \%$form);
746 $lxdebug->leave_sub();
750 $lxdebug->enter_sub();
752 $form->{title} = $locale->text("$form->{title} GIFI");
754 # $locale->text('Add GIFI')
755 # $locale->text('Edit GIFI')
757 $form->{description} =~ s/\"/"/g;
764 <form method=post action=$form->{script}>
766 <input type=hidden name=id value=$form->{accno}>
767 <input type=hidden name=type value=gifi>
771 <th class=listtop>$form->{title}</th>
778 <th align=right>| . $locale->text('GIFI') . qq|</th>
779 <td><input name=accno size=20 value=$form->{accno}></td>
782 <th align=right>| . $locale->text('Description') . qq|</th>
783 <td><input name=description size=60 value="$form->{description}"></td>
789 <td colspan=2><hr size=3 noshade></td>
794 $lxdebug->leave_sub();
798 $lxdebug->enter_sub();
802 <input name=callback type=hidden value="$form->{callback}">
804 <input type=hidden name=path value=$form->{path}>
805 <input type=hidden name=login value=$form->{login}>
806 <input type=hidden name=password value=$form->{password}>
808 <br><input type=submit class=submit name=action value="|
809 . $locale->text('Save') . qq|">|;
813 <input type=submit class=submit name=action value="|
814 . $locale->text('Copy to COA') . qq|">
817 if ($form->{accno} && $form->{orphaned}) {
818 print qq|<input type=submit class=submit name=action value="|
819 . $locale->text('Delete') . qq|">|;
823 if ($form->{menubar}) {
824 require "$form->{path}/menu.pl";
835 $lxdebug->leave_sub();
839 $lxdebug->enter_sub();
841 $form->isblank("accno", $locale->text('GIFI missing!'));
842 AM->save_gifi(\%myconfig, \%$form);
843 $form->redirect($locale->text('GIFI saved!'));
845 $lxdebug->leave_sub();
849 $lxdebug->enter_sub();
851 $form->isblank("accno", $locale->text('GIFI missing!'));
853 AM->save_gifi(\%myconfig, \%$form);
856 $form->{gifi_accno} = $form->{accno};
857 $form->{title} = "Add";
858 $form->{charttype} = "A";
863 $lxdebug->leave_sub();
867 $lxdebug->enter_sub();
869 AM->delete_gifi(\%myconfig, \%$form);
870 $form->redirect($locale->text('GIFI deleted!'));
872 $lxdebug->leave_sub();
876 $lxdebug->enter_sub();
878 $form->{title} = "Add";
882 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
883 unless $form->{callback};
888 $lxdebug->leave_sub();
891 sub edit_department {
892 $lxdebug->enter_sub();
894 $form->{title} = "Edit";
896 AM->get_department(\%myconfig, \%$form);
901 $lxdebug->leave_sub();
904 sub list_department {
905 $lxdebug->enter_sub();
907 AM->departments(\%myconfig, \%$form);
910 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
912 $callback = $form->escape($form->{callback});
914 $form->{title} = $locale->text('Departments');
916 @column_index = qw(description cost profit);
918 $column_header{description} =
919 qq|<th class=listheading width=90%>|
920 . $locale->text('Description')
922 $column_header{cost} =
923 qq|<th class=listheading nowrap>|
924 . $locale->text('Cost Center')
926 $column_header{profit} =
927 qq|<th class=listheading nowrap>|
928 . $locale->text('Profit Center')
938 <th class=listtop>$form->{title}</th>
944 <tr class=listheading>
947 map { print "$column_header{$_}\n" } @column_index;
953 foreach $ref (@{ $form->{ALL} }) {
959 <tr valign=top class=listrow$i>
962 $costcenter = ($ref->{role} eq "C") ? "X" : "";
963 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
965 $column_data{description} =
966 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>|;
967 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
968 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
970 map { print "$column_data{$_}\n" } @column_index;
982 <td><hr size=3 noshade></td>
987 <form method=post action=$form->{script}>
989 <input name=callback type=hidden value="$form->{callback}">
991 <input type=hidden name=type value=department>
993 <input type=hidden name=path value=$form->{path}>
994 <input type=hidden name=login value=$form->{login}>
995 <input type=hidden name=password value=$form->{password}>
997 <input class=submit type=submit name=action value="|
998 . $locale->text('Add') . qq|">|;
1000 if ($form->{menubar}) {
1001 require "$form->{path}/menu.pl";
1012 $lxdebug->leave_sub();
1015 sub department_header {
1016 $lxdebug->enter_sub();
1018 $form->{title} = $locale->text("$form->{title} Department");
1020 # $locale->text('Add Department')
1021 # $locale->text('Edit Department')
1023 $form->{description} =~ s/\"/"/g;
1025 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
1027 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
1030 qq|<input name=description size=60 value="$form->{description}">|;
1033 $costcenter = "checked" if $form->{role} eq "C";
1034 $profitcenter = "checked" if $form->{role} eq "P";
1041 <form method=post action=$form->{script}>
1043 <input type=hidden name=id value=$form->{id}>
1044 <input type=hidden name=type value=department>
1048 <th class=listtop colspan=2>$form->{title}</th>
1050 <tr height="5"></tr>
1052 <th align=right>| . $locale->text('Description') . qq|</th>
1053 <td>$description</td>
1057 <td><input type=radio style=radio name=role value="C" $costcenter> |
1058 . $locale->text('Cost Center') . qq|
1059 <input type=radio style=radio name=role value="P" $profitcenter> |
1060 . $locale->text('Profit Center') . qq|
1063 <td colspan=2><hr size=3 noshade></td>
1068 $lxdebug->leave_sub();
1071 sub save_department {
1072 $lxdebug->enter_sub();
1074 $form->isblank("description", $locale->text('Description missing!'));
1075 AM->save_department(\%myconfig, \%$form);
1076 $form->redirect($locale->text('Department saved!'));
1078 $lxdebug->leave_sub();
1081 sub delete_department {
1082 $lxdebug->enter_sub();
1084 AM->delete_department(\%myconfig, \%$form);
1085 $form->redirect($locale->text('Department deleted!'));
1087 $lxdebug->leave_sub();
1091 $lxdebug->enter_sub();
1093 $form->{title} = "Add";
1096 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1097 unless $form->{callback};
1102 $lxdebug->leave_sub();
1106 $lxdebug->enter_sub();
1108 $form->{title} = "Edit";
1110 AM->get_business(\%myconfig, \%$form);
1114 $form->{orphaned} = 1;
1117 $lxdebug->leave_sub();
1121 $lxdebug->enter_sub();
1123 AM->business(\%myconfig, \%$form);
1126 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1128 $callback = $form->escape($form->{callback});
1130 $form->{title} = $locale->text('Type of Business');
1132 @column_index = qw(description discount customernumberinit);
1134 $column_header{description} =
1135 qq|<th class=listheading width=60%>|
1136 . $locale->text('Description')
1138 $column_header{discount} =
1139 qq|<th class=listheading width=10%>|
1140 . $locale->text('Discount')
1142 $column_header{customernumberinit} =
1143 qq|<th class=listheading>|
1144 . $locale->text('Customernumberinit')
1154 <th class=listtop>$form->{title}</th>
1156 <tr height="5"></tr>
1160 <tr class=listheading>
1163 map { print "$column_header{$_}\n" } @column_index;
1169 foreach $ref (@{ $form->{ALL} }) {
1175 <tr valign=top class=listrow$i>
1179 $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
1182 ? "<b>$ref->{description}</b>"
1183 : "$ref->{description}";
1184 $column_data{description} =
1185 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>|;
1186 $column_data{discount} = qq|<td align=right>$discount</td>|;
1187 $column_data{customernumberinit} =
1188 qq|<td align=right>$ref->{customernumberinit}</td>|;
1190 map { print "$column_data{$_}\n" } @column_index;
1202 <td><hr size=3 noshade></td>
1207 <form method=post action=$form->{script}>
1209 <input name=callback type=hidden value="$form->{callback}">
1211 <input type=hidden name=type value=business>
1213 <input type=hidden name=path value=$form->{path}>
1214 <input type=hidden name=login value=$form->{login}>
1215 <input type=hidden name=password value=$form->{password}>
1217 <input class=submit type=submit name=action value="|
1218 . $locale->text('Add') . qq|">|;
1220 if ($form->{menubar}) {
1221 require "$form->{path}/menu.pl";
1233 $lxdebug->leave_sub();
1236 sub business_header {
1237 $lxdebug->enter_sub();
1239 $form->{title} = $locale->text("$form->{title} Business");
1240 $form->{salesman} = "checked" if $form->{salesman};
1242 # $locale->text('Add Business')
1243 # $locale->text('Edit Business')
1245 $form->{description} =~ s/\"/"/g;
1247 $form->format_amount(\%myconfig, $form->{discount} * 100);
1254 <form method=post action=$form->{script}>
1256 <input type=hidden name=id value=$form->{id}>
1257 <input type=hidden name=type value=business>
1261 <th class=listtop colspan=2>$form->{title}</th>
1263 <tr height="5"></tr>
1265 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1266 <td><input name=description size=30 value="$form->{description}"></td>
1269 <th align=right>| . $locale->text('Discount') . qq| %</th>
1270 <td><input name=discount size=5 value=$form->{discount}></td>
1273 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1274 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1277 <td align=right>| . $locale->text('Salesman') . qq|</td>
1278 <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
1280 <td colspan=2><hr size=3 noshade></td>
1285 $lxdebug->leave_sub();
1289 $lxdebug->enter_sub();
1291 $form->isblank("description", $locale->text('Description missing!'));
1292 AM->save_business(\%myconfig, \%$form);
1293 $form->redirect($locale->text('Business saved!'));
1295 $lxdebug->leave_sub();
1298 sub delete_business {
1299 $lxdebug->enter_sub();
1301 AM->delete_business(\%myconfig, \%$form);
1302 $form->redirect($locale->text('Business deleted!'));
1304 $lxdebug->leave_sub();
1308 $lxdebug->enter_sub();
1310 $form->{title} = "Add";
1313 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1314 unless $form->{callback};
1319 $lxdebug->leave_sub();
1323 $lxdebug->enter_sub();
1325 $form->{title} = "Edit";
1327 AM->get_language(\%myconfig, \%$form);
1331 $form->{orphaned} = 1;
1334 $lxdebug->leave_sub();
1338 $lxdebug->enter_sub();
1340 AM->language(\%myconfig, \%$form);
1343 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1345 $callback = $form->escape($form->{callback});
1347 $form->{title} = $locale->text('Languages');
1349 @column_index = qw(description template_code article_code);
1351 $column_header{description} =
1352 qq|<th class=listheading width=60%>|
1353 . $locale->text('Description')
1355 $column_header{template_code} =
1356 qq|<th class=listheading width=10%>|
1357 . $locale->text('Template Code')
1359 $column_header{article_code} =
1360 qq|<th class=listheading>|
1361 . $locale->text('Article Code')
1371 <th class=listtop>$form->{title}</th>
1373 <tr height="5"></tr>
1377 <tr class=listheading>
1380 map { print "$column_header{$_}\n" } @column_index;
1386 foreach $ref (@{ $form->{ALL} }) {
1392 <tr valign=top class=listrow$i>
1396 $column_data{description} =
1397 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>|;
1398 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1399 $column_data{article_code} =
1400 qq|<td align=right>$ref->{article_code}</td>|;
1402 map { print "$column_data{$_}\n" } @column_index;
1414 <td><hr size=3 noshade></td>
1419 <form method=post action=$form->{script}>
1421 <input name=callback type=hidden value="$form->{callback}">
1423 <input type=hidden name=type value=language>
1425 <input type=hidden name=path value=$form->{path}>
1426 <input type=hidden name=login value=$form->{login}>
1427 <input type=hidden name=password value=$form->{password}>
1429 <input class=submit type=submit name=action value="|
1430 . $locale->text('Add') . qq|">|;
1432 if ($form->{menubar}) {
1433 require "$form->{path}/menu.pl";
1445 $lxdebug->leave_sub();
1448 sub language_header {
1449 $lxdebug->enter_sub();
1451 $form->{title} = $locale->text("$form->{title} Language");
1453 # $locale->text('Add Language')
1454 # $locale->text('Edit Language')
1456 $form->{description} =~ s/\"/"/g;
1457 $form->{template_code} =~ s/\"/"/g;
1458 $form->{article_code} =~ s/\"/"/g;
1466 <form method=post action=$form->{script}>
1468 <input type=hidden name=id value=$form->{id}>
1469 <input type=hidden name=type value=language>
1473 <th class=listtop colspan=2>$form->{title}</th>
1475 <tr height="5"></tr>
1477 <th align=right>| . $locale->text('Language') . qq|</th>
1478 <td><input name=description size=30 value="$form->{description}"></td>
1481 <th align=right>| . $locale->text('Template Code') . qq|</th>
1482 <td><input name=template_code size=5 value=$form->{template_code}></td>
1485 <th align=right>| . $locale->text('Article Code') . qq|</th>
1486 <td><input name=article_code size=10 value=$form->{article_code}></td>
1488 <td colspan=2><hr size=3 noshade></td>
1493 $lxdebug->leave_sub();
1497 $lxdebug->enter_sub();
1499 $form->isblank("description", $locale->text('Language missing!'));
1500 $form->isblank("template_code", $locale->text('Template Code missing!'));
1501 $form->isblank("article_code", $locale->text('Article Code missing!'));
1502 AM->save_language(\%myconfig, \%$form);
1503 $form->redirect($locale->text('Language saved!'));
1505 $lxdebug->leave_sub();
1508 sub delete_language {
1509 $lxdebug->enter_sub();
1511 AM->delete_language(\%myconfig, \%$form);
1512 $form->redirect($locale->text('Language deleted!'));
1514 $lxdebug->leave_sub();
1518 sub add_buchungsgruppe {
1519 $lxdebug->enter_sub();
1521 # $locale->text("Add Buchungsgruppe")
1522 # $locale->text("Edit Buchungsgruppe")
1523 $form->{title} = "Add";
1526 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1527 unless $form->{callback};
1528 AM->get_buchungsgruppe(\%myconfig, \%$form);
1530 &buchungsgruppe_header;
1533 $lxdebug->leave_sub();
1536 sub edit_buchungsgruppe {
1537 $lxdebug->enter_sub();
1539 $form->{title} = "Edit";
1541 AM->get_buchungsgruppe(\%myconfig, \%$form);
1543 &buchungsgruppe_header;
1547 $lxdebug->leave_sub();
1550 sub list_buchungsgruppe {
1551 $lxdebug->enter_sub();
1553 AM->buchungsgruppe(\%myconfig, \%$form);
1556 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1558 $callback = $form->escape($form->{callback});
1560 $form->{title} = $locale->text('Buchungsgruppen');
1562 @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 );
1564 $column_header{description} =
1565 qq|<th class=listheading width=60%>|
1566 . $locale->text('Description')
1568 $column_header{inventory_accno} =
1569 qq|<th class=listheading width=10%>|
1570 . $locale->text('Bestandskonto')
1572 $column_header{income_accno_0} =
1573 qq|<th class=listheading>|
1574 . $locale->text('Erlöse Inland')
1576 $column_header{expense_accno_0} =
1577 qq|<th class=listheading>|
1578 . $locale->text('Aufwand Inland')
1580 $column_header{income_accno_1} =
1581 qq|<th class=listheading>|
1582 . $locale->text('Erlöse EU o. UStId')
1584 $column_header{expense_accno_1} =
1585 qq|<th class=listheading>|
1586 . $locale->text('Aufwand EU o. UStId')
1588 $column_header{income_accno_2} =
1589 qq|<th class=listheading>|
1590 . $locale->text('Erlöse EU m. UStId')
1592 $column_header{expense_accno_2} =
1593 qq|<th class=listheading>|
1594 . $locale->text('Aufwand EU m. UStId')
1596 $column_header{income_accno_3} =
1597 qq|<th class=listheading>|
1598 . $locale->text('Erlöse Ausland')
1600 $column_header{expense_accno_3} =
1601 qq|<th class=listheading>|
1602 . $locale->text('Aufwand Ausland')
1611 <th class=listtop>$form->{title}</th>
1613 <tr height="5"></tr>
1617 <tr class=listheading>
1620 map { print "$column_header{$_}\n" } @column_index;
1626 foreach $ref (@{ $form->{ALL} }) {
1632 <tr valign=top class=listrow$i>
1636 $column_data{description} =
1637 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>|;
1638 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1639 $column_data{income_accno_0} =
1640 qq|<td align=right>$ref->{income_accno_0}</td>|;
1641 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1642 $column_data{income_accno_1} =
1643 qq|<td align=right>$ref->{income_accno_1}</td>|;
1644 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1645 $column_data{income_accno_2} =
1646 qq|<td align=right>$ref->{income_accno_2}</td>|;
1647 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1648 $column_data{income_accno_3} =
1649 qq|<td align=right>$ref->{income_accno_3}</td>|;
1650 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1652 map { print "$column_data{$_}\n" } @column_index;
1664 <td><hr size=3 noshade></td>
1669 <form method=post action=$form->{script}>
1671 <input name=callback type=hidden value="$form->{callback}">
1673 <input type=hidden name=type value=buchungsgruppe>
1675 <input type=hidden name=path value=$form->{path}>
1676 <input type=hidden name=login value=$form->{login}>
1677 <input type=hidden name=password value=$form->{password}>
1679 <input class=submit type=submit name=action value="|
1680 . $locale->text('Add') . qq|">|;
1682 if ($form->{menubar}) {
1683 require "$form->{path}/menu.pl";
1695 $lxdebug->leave_sub();
1698 sub buchungsgruppe_header {
1699 $lxdebug->enter_sub();
1701 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1703 # $locale->text('Buchungsgruppe hinzufügen')
1704 # $locale->text('Buchungsgruppe bearbeiten')
1706 $form->{description} =~ s/\"/"/g;
1708 # build the popup menus
1709 $form->{taxaccounts} = "";
1710 foreach $key (keys %{ $form->{IC_links} }) {
1711 foreach $ref (@{ $form->{IC_links}{$key} }) {
1713 # if this is a tax field
1714 if ($key =~ /IC_tax/) {
1715 if ($key =~ /$item/) {
1716 $form->{taxaccounts} .= "$ref->{accno} ";
1717 $form->{"IC_tax_$ref->{accno}_description"} =
1718 "$ref->{accno}--$ref->{description}";
1721 if ($form->{amount}{ $ref->{accno} }) {
1722 $form->{"IC_tax_$ref->{accno}"} = "checked";
1725 $form->{"IC_tax_$ref->{accno}"} = "checked";
1730 $form->{"select$key"} .=
1731 "<option value=$ref->{id} $ref->{selected}>$ref->{accno}--$ref->{description}\n";
1732 if (($key eq "IC") && ($ref->{selected} eq "selected")) {
1733 $form->{IC_default} = $ref->{id};
1735 if ($form->{amount}{$key} eq $ref->{accno}) {
1736 $form->{$key} = "$ref->{accno}--$ref->{description}";
1742 $form->{selectIC_income} = $form->{selectIC_sale};
1743 $form->{selectIC_expense} = $form->{selectIC_cogs};
1744 $form->{IC_income} = $form->{IC_sale};
1745 $form->{IC_expense} = $form->{IC_cogs};
1748 $form->{selectIC} =~ s/selected//g;
1749 $form->{selectIC} =~ s/ value=\$form->{inventory_accno_id}/ value=\$form->{inventory_accno_id} selected/;
1750 $form->{selectIC_income} =~ s/selected//g;
1751 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1752 $form->{selectIC_expense} =~ s/selected//g;
1753 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1759 <th align=right>| . $locale->text('Inventory') . qq|</th>
1760 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1761 <input name=selectIC type=hidden value="$form->{selectIC}">
1765 <input type=hidden name=inventory_accno_id value=1>|;
1769 $linkaccounts .= qq|
1771 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
1772 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
1775 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
1776 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
1779 $form->{selectIC_income} =~ s/selected//g;
1780 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
1781 $form->{selectIC_expense} =~ s/selected//g;
1782 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
1784 $linkaccounts .= qq| <tr>
1785 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
1786 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
1789 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
1790 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
1794 $form->{selectIC_income} =~ s/selected//g;
1795 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
1796 $form->{selectIC_expense} =~ s/selected//g;
1797 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
1800 $linkaccounts .= qq| <tr>
1801 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
1802 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
1805 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
1806 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
1810 $form->{selectIC_income} =~ s/selected//g;
1811 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
1812 $form->{selectIC_expense} =~ s/selected//g;
1813 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
1816 $linkaccounts .= qq| <tr>
1817 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
1818 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
1821 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
1822 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
1832 <form method=post action=$form->{script}>
1834 <input type=hidden name=id value=$form->{id}>
1835 <input type=hidden name=type value=buchungsgruppe>
1839 <th class=listtop colspan=2>$form->{title}</th>
1841 <tr height="5"></tr>
1843 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
1844 <td><input name=description size=30 value="$form->{description}"></td>
1847 <td colspan=2><hr size=3 noshade></td>
1852 $lxdebug->leave_sub();
1855 sub save_buchungsgruppe {
1856 $lxdebug->enter_sub();
1858 $form->isblank("description", $locale->text('Description missing!'));
1860 AM->save_buchungsgruppe(\%myconfig, \%$form);
1861 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
1863 $lxdebug->leave_sub();
1866 sub delete_buchungsgruppe {
1867 $lxdebug->enter_sub();
1869 AM->delete_buchungsgruppe(\%myconfig, \%$form);
1870 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
1872 $lxdebug->leave_sub();
1877 $lxdebug->enter_sub();
1879 $form->{title} = "Add";
1882 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1883 unless $form->{callback};
1888 $lxdebug->leave_sub();
1892 $lxdebug->enter_sub();
1894 $form->{title} = "Edit";
1896 AM->get_printer(\%myconfig, \%$form);
1900 $form->{orphaned} = 1;
1903 $lxdebug->leave_sub();
1907 $lxdebug->enter_sub();
1909 AM->printer(\%myconfig, \%$form);
1912 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1914 $callback = $form->escape($form->{callback});
1916 $form->{title} = $locale->text('Printer');
1918 @column_index = qw(printer_description printer_command template_code);
1920 $column_header{printer_description} =
1921 qq|<th class=listheading width=60%>|
1922 . $locale->text('Printer Description')
1924 $column_header{printer_command} =
1925 qq|<th class=listheading width=10%>|
1926 . $locale->text('Printer Command')
1928 $column_header{template_code} =
1929 qq|<th class=listheading>|
1930 . $locale->text('Template Code')
1940 <th class=listtop>$form->{title}</th>
1942 <tr height="5"></tr>
1946 <tr class=listheading>
1949 map { print "$column_header{$_}\n" } @column_index;
1955 foreach $ref (@{ $form->{ALL} }) {
1961 <tr valign=top class=listrow$i>
1965 $column_data{printer_description} =
1966 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>|;
1967 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
1968 $column_data{template_code} =
1969 qq|<td align=right>$ref->{template_code}</td>|;
1971 map { print "$column_data{$_}\n" } @column_index;
1983 <td><hr size=3 noshade></td>
1988 <form method=post action=$form->{script}>
1990 <input name=callback type=hidden value="$form->{callback}">
1992 <input type=hidden name=type value=printer>
1994 <input type=hidden name=path value=$form->{path}>
1995 <input type=hidden name=login value=$form->{login}>
1996 <input type=hidden name=password value=$form->{password}>
1998 <input class=submit type=submit name=action value="|
1999 . $locale->text('Add') . qq|">|;
2001 if ($form->{menubar}) {
2002 require "$form->{path}/menu.pl";
2014 $lxdebug->leave_sub();
2017 sub printer_header {
2018 $lxdebug->enter_sub();
2020 $form->{title} = $locale->text("$form->{title} Printer");
2022 # $locale->text('Add Printer')
2023 # $locale->text('Edit Printer')
2025 $form->{printer_description} =~ s/\"/"/g;
2026 $form->{template_code} =~ s/\"/"/g;
2027 $form->{printer_command} =~ s/\"/"/g;
2035 <form method=post action=$form->{script}>
2037 <input type=hidden name=id value=$form->{id}>
2038 <input type=hidden name=type value=printer>
2042 <th class=listtop colspan=2>$form->{title}</th>
2044 <tr height="5"></tr>
2046 <th align=right>| . $locale->text('Printer') . qq|</th>
2047 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2050 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2051 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2054 <th align=right>| . $locale->text('Template Code') . qq|</th>
2055 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2057 <td colspan=2><hr size=3 noshade></td>
2062 $lxdebug->leave_sub();
2066 $lxdebug->enter_sub();
2068 $form->isblank("printer_description", $locale->text('Description missing!'));
2069 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2070 AM->save_printer(\%myconfig, \%$form);
2071 $form->redirect($locale->text('Printer saved!'));
2073 $lxdebug->leave_sub();
2076 sub delete_printer {
2077 $lxdebug->enter_sub();
2079 AM->delete_printer(\%myconfig, \%$form);
2080 $form->redirect($locale->text('Printer deleted!'));
2082 $lxdebug->leave_sub();
2087 $lxdebug->enter_sub();
2089 $form->{title} = "Add";
2092 "$form->{script}?action=add_adr&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2093 unless $form->{callback};
2098 $lxdebug->leave_sub();
2102 $lxdebug->enter_sub();
2104 $form->{title} = "Edit";
2106 AM->get_adr(\%myconfig, \%$form);
2110 $form->{orphaned} = 1;
2113 $lxdebug->leave_sub();
2117 $lxdebug->enter_sub();
2119 AM->adr(\%myconfig, \%$form);
2122 "$form->{script}?action=list_adr&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2124 $callback = $form->escape($form->{callback});
2126 $form->{title} = $locale->text('ADR');
2128 @column_index = qw(adr_code adr_description);
2130 $column_header{adr_description} =
2131 qq|<th class=listheading width=60%>|
2132 . $locale->text('ADR Description')
2134 $column_header{adr_code} =
2135 qq|<th class=listheading width=10%>|
2136 . $locale->text('ADR Code')
2146 <th class=listtop>$form->{title}</th>
2148 <tr height="5"></tr>
2152 <tr class=listheading>
2155 map { print "$column_header{$_}\n" } @column_index;
2161 foreach $ref (@{ $form->{ALL} }) {
2167 <tr valign=top class=listrow$i>
2171 $column_data{adr_code} =
2172 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>|;
2173 $column_data{adr_description} = qq|<td align=left>$ref->{adr_description}</td>|;
2176 map { print "$column_data{$_}\n" } @column_index;
2188 <td><hr size=3 noshade></td>
2193 <form method=post action=$form->{script}>
2195 <input name=callback type=hidden value="$form->{callback}">
2197 <input type=hidden name=type value=adr>
2199 <input type=hidden name=path value=$form->{path}>
2200 <input type=hidden name=login value=$form->{login}>
2201 <input type=hidden name=password value=$form->{password}>
2203 <input class=submit type=submit name=action value="|
2204 . $locale->text('Add') . qq|">|;
2206 if ($form->{menubar}) {
2207 require "$form->{path}/menu.pl";
2219 $lxdebug->leave_sub();
2223 $lxdebug->enter_sub();
2225 $form->{title} = $locale->text("$form->{title} ADR");
2227 # $locale->text('Add ADR')
2228 # $locale->text('Edit ADR')
2230 $form->{adr_description} =~ s/\"/"/g;
2231 $form->{adr_code} =~ s/\"/"/g;
2239 <form method=post action=$form->{script}>
2241 <input type=hidden name=id value=$form->{id}>
2242 <input type=hidden name=type value=adr>
2246 <th class=listtop colspan=2>$form->{title}</th>
2248 <tr height="5"></tr>
2250 <th align=right>| . $locale->text('ADR Code') . qq|</th>
2251 <td><input name=adr_code size=30 value="$form->{adr_code}"></td>
2254 <th align=right>| . $locale->text('ADR Description') . qq|</th>
2255 <td><input name=adr_description size=60 value="$form->{adr_description}"></td>
2257 <td colspan=2><hr size=3 noshade></td>
2262 $lxdebug->leave_sub();
2266 $lxdebug->enter_sub();
2268 $form->isblank("adr_description", $locale->text('ADR Description missing!'));
2269 $form->isblank("adr_code", $locale->text('ADR Code missing!'));
2270 AM->save_adr(\%myconfig, \%$form);
2271 $form->redirect($locale->text('ADR saved!'));
2273 $lxdebug->leave_sub();
2278 $lxdebug->enter_sub();
2280 AM->delete_adr(\%myconfig, \%$form);
2281 $form->redirect($locale->text('ADR deleted!'));
2283 $lxdebug->leave_sub();
2288 $lxdebug->enter_sub();
2290 $form->{title} = "Add";
2293 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2294 unless $form->{callback};
2299 $lxdebug->leave_sub();
2303 $lxdebug->enter_sub();
2305 $form->{title} = "Edit";
2307 AM->get_payment(\%myconfig, \%$form);
2311 $form->{orphaned} = 1;
2314 $lxdebug->leave_sub();
2318 $lxdebug->enter_sub();
2320 AM->payment(\%myconfig, \%$form);
2323 "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2325 $callback = $form->escape($form->{callback});
2327 $form->{title} = $locale->text('Payment Terms');
2329 @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
2331 $column_header{description} =
2332 qq|<th class=listheading>|
2333 . $locale->text('Description')
2335 $column_header{description_long} =
2336 qq|<th class=listheading>|
2337 . $locale->text('Long Description')
2339 $column_header{terms_netto} =
2340 qq|<th class=listheading>|
2341 . $locale->text('Netto Terms')
2343 $column_header{terms_skonto} =
2344 qq|<th class=listheading>|
2345 . $locale->text('Skonto Terms')
2347 $column_header{percent_skonto} =
2348 qq|<th class=listheading>|
2349 . $locale->text('Skonto')
2359 <th class=listtop>$form->{title}</th>
2361 <tr height="5"></tr>
2365 <tr class=listheading>
2368 map { print "$column_header{$_}\n" } @column_index;
2374 foreach $ref (@{ $form->{ALL} }) {
2380 <tr valign=top class=listrow$i>
2384 $column_data{description} =
2385 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>|;
2386 $column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|;
2387 $column_data{terms_netto} =
2388 qq|<td align=right>$ref->{terms_netto}</td>|;
2389 $column_data{terms_skonto} =
2390 qq|<td align=right>$ref->{terms_skonto}</td>|;
2391 $column_data{percent_skonto} =
2392 qq|<td align=right>$ref->{percent_skonto} %</td>|;
2393 map { print "$column_data{$_}\n" } @column_index;
2405 <td><hr size=3 noshade></td>
2410 <form method=post action=$form->{script}>
2412 <input name=callback type=hidden value="$form->{callback}">
2414 <input type=hidden name=type value=business>
2416 <input type=hidden name=path value=$form->{path}>
2417 <input type=hidden name=login value=$form->{login}>
2418 <input type=hidden name=password value=$form->{password}>
2420 <input class=submit type=submit name=action value="|
2421 . $locale->text('Add') . qq|">|;
2423 if ($form->{menubar}) {
2424 require "$form->{path}/menu.pl";
2436 $lxdebug->leave_sub();
2439 sub payment_header {
2440 $lxdebug->enter_sub();
2442 $form->{title} = $locale->text("$form->{title} Payment Terms");
2444 # $locale->text('Add Payment Terms')
2445 # $locale->text('Edit Payment Terms')
2447 $form->{description} =~ s/\"/"/g;
2456 <form method=post action=$form->{script}>
2458 <input type=hidden name=id value=$form->{id}>
2459 <input type=hidden name=type value=payment>
2463 <th class=listtop colspan=2>$form->{title}</th>
2465 <tr height="5"></tr>
2467 <th align=right>| . $locale->text('Description') . qq|</th>
2468 <td><input name=description size=30 value="$form->{description}"></td>
2471 <th align=right>| . $locale->text('Ranking') . qq|</th>
2472 <td><input name=ranking size=30 value="$form->{ranking}"></td>
2475 <th align=right>| . $locale->text('Long Description') . qq|</th>
2476 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2479 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2480 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2483 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2484 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2487 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2488 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2490 <td colspan=2><hr size=3 noshade></td>
2495 $lxdebug->leave_sub();
2499 $lxdebug->enter_sub();
2501 $form->isblank("description", $locale->text('Language missing!'));
2502 AM->save_payment(\%myconfig, \%$form);
2503 $form->redirect($locale->text('Payment Terms saved!'));
2505 $lxdebug->leave_sub();
2508 sub delete_payment {
2509 $lxdebug->enter_sub();
2511 AM->delete_payment(\%myconfig, \%$form);
2512 $form->redirect($locale->text('Payment terms deleted!'));
2514 $lxdebug->leave_sub();
2518 $lxdebug->enter_sub();
2520 $form->{title} = "Add";
2523 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2524 unless $form->{callback};
2529 $lxdebug->leave_sub();
2533 $lxdebug->enter_sub();
2535 $form->{title} = "Edit";
2537 AM->get_sic(\%myconfig, \%$form);
2541 $form->{orphaned} = 1;
2544 $lxdebug->leave_sub();
2548 $lxdebug->enter_sub();
2550 AM->sic(\%myconfig, \%$form);
2553 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2555 $callback = $form->escape($form->{callback});
2557 $form->{title} = $locale->text('Standard Industrial Codes');
2559 @column_index = qw(code description);
2561 $column_header{code} =
2562 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
2563 $column_header{description} =
2564 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
2573 <th class=listtop>$form->{title}</th>
2575 <tr height="5"></tr>
2579 <tr class=listheading>
2582 map { print "$column_header{$_}\n" } @column_index;
2588 foreach $ref (@{ $form->{ALL} }) {
2593 if ($ref->{sictype} eq 'H') {
2595 <tr valign=top class=listheading>
2597 $column_data{code} =
2598 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>|;
2599 $column_data{description} = qq|<th>$ref->{description}</th>|;
2603 <tr valign=top class=listrow$i>
2606 $column_data{code} =
2607 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>|;
2608 $column_data{description} = qq|<td>$ref->{description}</td>|;
2612 map { print "$column_data{$_}\n" } @column_index;
2624 <td><hr size=3 noshade></td>
2629 <form method=post action=$form->{script}>
2631 <input name=callback type=hidden value="$form->{callback}">
2633 <input type=hidden name=type value=sic>
2635 <input type=hidden name=path value=$form->{path}>
2636 <input type=hidden name=login value=$form->{login}>
2637 <input type=hidden name=password value=$form->{password}>
2639 <input class=submit type=submit name=action value="|
2640 . $locale->text('Add') . qq|">|;
2642 if ($form->{menubar}) {
2643 require "$form->{path}/menu.pl";
2654 $lxdebug->leave_sub();
2658 $lxdebug->enter_sub();
2660 $form->{title} = $locale->text("$form->{title} SIC");
2662 # $locale->text('Add SIC')
2663 # $locale->text('Edit SIC')
2665 $form->{code} =~ s/\"/"/g;
2666 $form->{description} =~ s/\"/"/g;
2668 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
2675 <form method=post action=$form->{script}>
2677 <input type=hidden name=type value=sic>
2678 <input type=hidden name=id value=$form->{code}>
2682 <th class=listtop colspan=2>$form->{title}</th>
2684 <tr height="5"></tr>
2686 <th align=right>| . $locale->text('Code') . qq|</th>
2687 <td><input name=code size=10 value=$form->{code}></td>
2691 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
2692 . $locale->text('Heading') . qq|</th>
2695 <th align=right>| . $locale->text('Description') . qq|</th>
2696 <td><input name=description size=60 value="$form->{description}"></td>
2698 <td colspan=2><hr size=3 noshade></td>
2703 $lxdebug->leave_sub();
2707 $lxdebug->enter_sub();
2709 $form->isblank("code", $locale->text('Code missing!'));
2710 $form->isblank("description", $locale->text('Description missing!'));
2711 AM->save_sic(\%myconfig, \%$form);
2712 $form->redirect($locale->text('SIC saved!'));
2714 $lxdebug->leave_sub();
2718 $lxdebug->enter_sub();
2720 AM->delete_sic(\%myconfig, \%$form);
2721 $form->redirect($locale->text('SIC deleted!'));
2723 $lxdebug->leave_sub();
2726 sub display_stylesheet {
2727 $lxdebug->enter_sub();
2729 $form->{file} = "css/$myconfig{stylesheet}";
2732 $lxdebug->leave_sub();
2736 $lxdebug->enter_sub();
2738 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2739 $form->{file} =~ s/^\/*//g;
2740 $form->{file} =~ s/$userspath//;
2742 $form->error("$!: $form->{file}") unless -f $form->{file};
2744 AM->load_template(\%$form);
2746 $form->{title} = $form->{file};
2748 # if it is anything but html
2749 if ($form->{file} !~ /\.html$/) {
2750 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2760 <form method=post action=$form->{script}>
2762 <input name=file type=hidden value=$form->{file}>
2763 <input name=type type=hidden value=template>
2765 <input type=hidden name=path value=$form->{path}>
2766 <input type=hidden name=login value=$form->{login}>
2767 <input type=hidden name=password value=$form->{password}>
2769 <input name=action type=submit class=submit value="|
2770 . $locale->text('Edit') . qq|">|;
2772 if ($form->{menubar}) {
2773 require "$form->{path}/menu.pl";
2784 $lxdebug->leave_sub();
2788 $lxdebug->enter_sub();
2790 AM->load_template(\%$form);
2792 $form->{title} = $locale->text('Edit Template');
2794 # convert   to &nbsp;
2795 $form->{body} =~ s/ /&nbsp;/gi;
2802 <form method=post action=$form->{script}>
2804 <input name=file type=hidden value=$form->{file}>
2805 <input name=type type=hidden value=template>
2807 <input type=hidden name=path value=$form->{path}>
2808 <input type=hidden name=login value=$form->{login}>
2809 <input type=hidden name=password value=$form->{password}>
2811 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
2813 <textarea name=body rows=25 cols=70>
2818 <input type=submit class=submit name=action value="|
2819 . $locale->text('Save') . qq|">|;
2821 if ($form->{menubar}) {
2822 require "$form->{path}/menu.pl";
2834 $lxdebug->leave_sub();
2838 $lxdebug->enter_sub();
2840 AM->save_template(\%$form);
2841 $form->redirect($locale->text('Template saved!'));
2843 $lxdebug->leave_sub();
2847 $lxdebug->enter_sub();
2849 # get defaults for account numbers and last numbers
2850 AM->defaultaccounts(\%myconfig, \%$form);
2852 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2854 ($item eq $myconfig{dateformat})
2855 ? "<option selected>$item\n"
2856 : "<option>$item\n";
2859 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2861 ($item eq $myconfig{numberformat})
2862 ? "<option selected>$item\n"
2863 : "<option>$item\n";
2866 foreach $item (qw(name company address signature)) {
2867 $myconfig{$item} =~ s/\"/"/g;
2870 foreach $item (qw(address signature)) {
2871 $myconfig{$item} =~ s/\\n/\r\n/g;
2874 %countrycodes = User->country_codes;
2876 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2880 ($myconfig{countrycode} eq $key)
2881 ? "<option selected value=$key>$countrycodes{$key}\n"
2882 : "<option value=$key>$countrycodes{$key}\n";
2884 $countrycodes = "<option>American English\n$countrycodes";
2886 # use an other input number format than output numberformat
2887 # look at Form.pm, sub parse_amount
2888 my $in_numberformat = '';
2889 $text1 = qq|value="0">| . $locale->text('equal Outputformat');
2890 $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
2891 @in_nf = ($text1, $text2);
2892 foreach $item (@in_nf) {
2894 (substr($item, 7, 1) eq $myconfig{in_numberformat})
2895 ? "<option selected $item\n"
2896 : "<option $item\n";
2899 foreach $key (keys %{ $form->{IC} }) {
2900 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2902 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2903 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2904 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2908 opendir CSS, "css/.";
2909 @all = grep /.*\.css$/, readdir CSS;
2912 foreach $item (@all) {
2913 if ($item eq $myconfig{stylesheet}) {
2914 $selectstylesheet .= qq|<option selected>$item\n|;
2916 $selectstylesheet .= qq|<option>$item\n|;
2919 $selectstylesheet .= "<option>\n";
2921 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2925 if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
2926 else { $newS = "checked"; }
2931 <form method=post action=$form->{script}>
2933 <input type=hidden name=old_password value=$myconfig{password}>
2934 <input type=hidden name=type value=preferences>
2935 <input type=hidden name=role value=$myconfig{role}>
2938 <tr><th class=listtop>$form->{title}</th></tr>
2943 <th align=right>| . $locale->text('Name') . qq|</th>
2944 <td><input name=name size=15 value="$myconfig{name}"></td>
2947 <th align=right>| . $locale->text('Password') . qq|</th>
2948 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2951 <th align=right>| . $locale->text('E-mail') . qq|</th>
2952 <td><input name=email size=30 value="$myconfig{email}"></td>
2955 <th align=right>| . $locale->text('Signature') . qq|</th>
2956 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2959 <th align=right>| . $locale->text('Phone') . qq|</th>
2960 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2963 <th align=right>| . $locale->text('Fax') . qq|</th>
2964 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2967 <th align=right>| . $locale->text('Company') . qq|</th>
2968 <td><input name=company size=30 value="$myconfig{company}"></td>
2971 <th align=right>| . $locale->text('Address') . qq|</th>
2972 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2975 <th align=right>| . $locale->text('Date Format') . qq|</th>
2976 <td><select name=dateformat>$dateformat</select></td>
2979 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2980 <td><select name=numberformat>$numberformat</select></td>
2983 <th align=right>| . $locale->text('Input Number Format') . qq|</th>
2984 <td><select name=in_numberformat>$in_numberformat</select></td>
2988 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2989 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2992 <th align=right>| . $locale->text('Language') . qq|</th>
2993 <td><select name=countrycode>$countrycodes</select></td>
2996 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
2997 <td><select name=usestylesheet>$selectstylesheet</select></td>
3000 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
3001 <td><input name=menustyle type=radio class=radio value=neu $newS> New
3002 <input name=menustyle type=radio class=radio value=old $oldS> Old</td>
3004 <input name=printer type=hidden value="$myconfig{printer}">
3005 <tr class=listheading>
3006 <th colspan=2> </th>
3009 <th align=right>| . $locale->text('Business Number') . qq|</th>
3010 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
3016 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
3017 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
3018 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
3019 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
3024 <tr class=listheading>
3026 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
3032 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
3033 <td><select name=inventory_accno>$myconfig{IC}</select></td>
3036 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
3037 <td><select name=income_accno>$myconfig{IC_income}</select></td>
3040 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
3041 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
3044 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
3045 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
3048 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
3049 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
3054 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
3056 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
3065 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
3066 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
3067 <th align=right nowrap>|
3068 . $locale->text('Last Customer Number') . qq|</th>
3069 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
3072 <th align=right nowrap>|
3073 . $locale->text('Last Credit Note Number') . qq|</th>
3074 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
3075 <th align=right nowrap>|
3076 . $locale->text('Last Vendor Number') . qq|</th>
3077 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
3080 <th align=right nowrap>|
3081 . $locale->text('Last Sales Order Number') . qq|</th>
3082 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
3085 <th align=right nowrap>|
3086 . $locale->text('Last Purchase Order Number') . qq|</th>
3087 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
3088 <th align=right nowrap>|
3089 . $locale->text('Last Article Number') . qq|</th>
3090 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
3093 <th align=right nowrap>|
3094 . $locale->text('Last Sales Quotation Number') . qq|</th>
3095 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
3096 <th align=right nowrap>|
3097 . $locale->text('Last Service Number') . qq|</th>
3098 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
3101 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
3102 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
3103 <th align=right nowrap></th>
3109 <tr class=listheading>
3110 <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3117 <th>| . $locale->text('Rate') . qq| (%)</th>
3118 <th>| . $locale->text('Number') . qq|</th>
3122 foreach $accno (sort keys %{ $form->{taxrates} }) {
3125 <th align=right>$form->{taxrates}{$accno}{description}</th>
3126 <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3127 <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3130 $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3133 chop $form->{taxaccounts};
3136 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3145 <td><hr size=3 noshade></td>
3149 <input type=hidden name=path value=$form->{path}>
3150 <input type=hidden name=login value=$form->{login}>
3151 <input type=hidden name=password value=$form->{password}>
3154 <input type=submit class=submit name=action value="|
3155 . $locale->text('Save') . qq|">|;
3157 if ($form->{menubar}) {
3158 require "$form->{path}/menu.pl";
3169 $lxdebug->leave_sub();
3172 sub save_preferences {
3173 $lxdebug->enter_sub();
3175 $form->{stylesheet} = $form->{usestylesheet};
3177 $form->redirect($locale->text('Preferences saved!'))
3179 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3181 $form->error($locale->text('Cannot save preferences!'));
3183 $lxdebug->leave_sub();
3187 $lxdebug->enter_sub();
3189 if ($form->{media} eq 'email') {
3190 $form->error($locale->text('No email address for') . " $myconfig{name}")
3191 unless ($myconfig{email});
3193 $form->{OUT} = "$sendmail";
3197 AM->backup(\%myconfig, \%$form, $userspath);
3199 if ($form->{media} eq 'email') {
3200 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
3203 $lxdebug->leave_sub();
3207 $lxdebug->enter_sub();
3209 $form->{title} = $locale->text('Audit Control');
3211 AM->closedto(\%myconfig, \%$form);
3213 if ($form->{revtrans}) {
3214 $checked{Y} = "checked";
3216 $checked{N} = "checked";
3224 <form method=post action=$form->{script}>
3226 <input type=hidden name=path value=$form->{path}>
3227 <input type=hidden name=login value=$form->{login}>
3228 <input type=hidden name=password value=$form->{password}>
3231 <tr><th class=listtop>$form->{title}</th></tr>
3232 <tr height="5"></tr>
3238 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3239 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3240 . $locale->text('Yes')
3241 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3242 . $locale->text('No')
3246 <th>| . $locale->text('Close Books up to') . qq|</th>
3247 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3257 <input type=hidden name=nextsub value=doclose>
3259 <input type=submit class=submit name=action value="|
3260 . $locale->text('Continue') . qq|">
3268 $lxdebug->leave_sub();
3272 $lxdebug->enter_sub();
3274 AM->closebooks(\%myconfig, \%$form);
3276 if ($form->{revtrans}) {
3278 $locale->text('Transaction reversal enforced for all dates'));
3280 if ($form->{closedto}) {
3282 $locale->text('Transaction reversal enforced up to') . " "
3283 . $locale->date(\%myconfig, $form->{closedto}, 1));
3285 $form->redirect($locale->text('Books are open'));
3289 $lxdebug->leave_sub();
3293 $lxdebug->enter_sub();
3295 $form->{title} = "Add";
3298 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
3299 unless $form->{callback};
3304 $lxdebug->leave_sub();
3307 sub edit_warehouse {
3308 $lxdebug->enter_sub();
3310 $form->{title} = "Edit";
3312 AM->get_warehouse(\%myconfig, \%$form);
3317 $lxdebug->leave_sub();
3320 sub list_warehouse {
3321 $lxdebug->enter_sub();
3323 AM->warehouses(\%myconfig, \%$form);
3326 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
3328 $callback = $form->escape($form->{callback});
3330 $form->{title} = $locale->text('Warehouses');
3332 @column_index = qw(description);
3334 $column_header{description} =
3335 qq|<th class=listheading width=100%>|
3336 . $locale->text('Description')
3346 <th class=listtop>$form->{title}</th>
3348 <tr height="5"></tr>
3352 <tr class=listheading>
3355 map { print "$column_header{$_}\n" } @column_index;
3361 foreach $ref (@{ $form->{ALL} }) {
3367 <tr valign=top class=listrow$i>
3370 $column_data{description} =
3371 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>|;
3373 map { print "$column_data{$_}\n" } @column_index;
3385 <td><hr size=3 noshade></td>
3390 <form method=post action=$form->{script}>
3392 <input name=callback type=hidden value="$form->{callback}">
3394 <input type=hidden name=type value=warehouse>
3396 <input type=hidden name=path value=$form->{path}>
3397 <input type=hidden name=login value=$form->{login}>
3398 <input type=hidden name=password value=$form->{password}>
3400 <input class=submit type=submit name=action value="|
3401 . $locale->text('Add') . qq|">|;
3403 if ($form->{menubar}) {
3404 require "$form->{path}/menu.pl";
3415 $lxdebug->leave_sub();
3418 sub warehouse_header {
3419 $lxdebug->enter_sub();
3421 $form->{title} = $locale->text("$form->{title} Warehouse");
3423 # $locale->text('Add Warehouse')
3424 # $locale->text('Edit Warehouse')
3426 $form->{description} =~ s/\"/"/g;
3428 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
3430 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
3433 qq|<input name=description size=60 value="$form->{description}">|;
3441 <form method=post action=$form->{script}>
3443 <input type=hidden name=id value=$form->{id}>
3444 <input type=hidden name=type value=warehouse>
3448 <th class=listtop colspan=2>$form->{title}</th>
3450 <tr height="5"></tr>
3452 <th align=right>| . $locale->text('Description') . qq|</th>
3453 <td>$description</td>
3456 <td colspan=2><hr size=3 noshade></td>
3461 $lxdebug->leave_sub();
3464 sub save_warehouse {
3465 $lxdebug->enter_sub();
3467 $form->isblank("description", $locale->text('Description missing!'));
3468 AM->save_warehouse(\%myconfig, \%$form);
3469 $form->redirect($locale->text('Warehouse saved!'));
3471 $lxdebug->leave_sub();
3474 sub delete_warehouse {
3475 $lxdebug->enter_sub();
3477 AM->delete_warehouse(\%myconfig, \%$form);
3478 $form->redirect($locale->text('Warehouse deleted!'));
3480 $lxdebug->leave_sub();
3484 $lxdebug->enter_sub();
3486 &{ $form->{nextsub} };
3488 $lxdebug->leave_sub();
3492 $lxdebug->enter_sub();
3494 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3495 AM->units_in_use(\%myconfig, $form, $units);
3496 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3499 foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3500 map({ push(@unit_list, $units->{$_}); }
3501 sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3502 grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3504 map({ $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"}); } @unit_list);
3506 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3507 $ddbox = AM->unit_select_data($units, undef, 1);
3509 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3511 print($form->parse_html_template("am/edit_units", { "UNITS" => \@unit_list, "NEW_BASE_UNIT_DDBOX" => $ddbox }));
3513 $lxdebug->leave_sub();
3517 $lxdebug->enter_sub();
3519 $form->isblank("new_name", $locale->text("The name is missing."));
3520 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3521 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($units->{$form->{"new_name"}});
3523 my ($base_unit, $factor);
3524 if ($form->{"new_base_unit"}) {
3525 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3527 $form->isblank("new_factor", $locale->text("The factor is missing."));
3528 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3529 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3530 $base_unit = $form->{"new_base_unit"};
3533 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"});
3535 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3539 $lxdebug->leave_sub();
3543 $lxdebug->enter_sub();
3545 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3546 AM->units_in_use(\%myconfig, $form, $old_units);
3550 foreach $i (1..($form->{"rowcount"} * 1)) {
3551 $old_unit = $old_units->{$form->{"old_name_$i"}};
3553 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3556 if ($form->{"unchangeable_$i"}) {
3557 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3558 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3562 if ($old_unit->{"in_use"}) {
3563 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3566 if ($form->{"delete_$i"}) {
3567 push(@delete_units, $old_unit->{"name"});
3571 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3573 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3574 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3575 $new_units->{$form->{"name_$i"}} = \%h;
3576 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3579 foreach $unit (values(%{$new_units})) {
3580 next unless ($unit->{"old_name"});
3581 if ($unit->{"base_unit"}) {
3582 $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"}))
3583 unless (defined($new_units->{$unit->{"base_unit"}}));
3584 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3585 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3587 $unit->{"base_unit"} = undef;
3588 $unit->{"factor"} = undef;
3592 foreach $unit (values(%{$new_units})) {
3593 next if ($unit->{"unchanged_unit"});
3595 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3597 while ($new_unit->{"base_unit"}) {
3598 $new_unit->{"seen"} = 1;
3599 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3600 if ($new_unit->{"seen"}) {
3601 $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, " .
3602 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3607 #print(STDERR Dumper($delete_units));
3608 #print(STDERR Dumper($new_units));
3610 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3612 $form->{"saved_message"} = $locale->text("The units have been saved.");
3616 $lxdebug->leave_sub();