1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #======================================================================
32 #======================================================================
43 require "$form->{path}/common.pl";
47 sub add { &{"add_$form->{type}"} }
48 sub edit { &{"edit_$form->{type}"} }
49 sub save { &{"save_$form->{type}"} }
50 sub delete { &{"delete_$form->{type}"} }
53 $lxdebug->enter_sub();
55 $form->{title} = "Add";
56 $form->{charttype} = "A";
57 AM->get_account(\%myconfig, \%$form);
60 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
61 unless $form->{callback};
66 $lxdebug->leave_sub();
70 $lxdebug->enter_sub();
72 $form->{title} = "Edit";
73 AM->get_account(\%myconfig, \%$form);
75 foreach my $item (split(/:/, $form->{link})) {
76 $form->{$item} = "checked";
82 $lxdebug->leave_sub();
86 $lxdebug->enter_sub();
88 $form->{title} = $locale->text("$form->{title} Account");
90 $checked{ $form->{charttype} } = "checked";
91 $checked{"$form->{category}_"} = "checked";
92 $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
94 $form->{description} =~ s/\"/"/g;
96 if (@{ $form->{TAXKEY} }) {
97 foreach $item (@{ $form->{TAXKEY} }) {
98 if ($item->{tax} == $form->{tax}) {
99 $form->{selecttaxkey} .=
100 "<option value=$item->{tax} selected>$item->{taxdescription}\n";
102 $form->{selecttaxkey} .=
103 "<option value=$item->{tax}>$item->{taxdescription}\n";
111 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
112 <td><select name=tax>$form->{selecttaxkey}</select></td>
113 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
114 <td><input name=startdate value="$form->{startdate}"></td>
117 if (@{ $form->{NEWACCOUNT} }) {
118 if (!$form->{new_chart_valid}) {
119 $form->{selectnewaccount} = "<option value=></option>";
121 foreach $item (@{ $form->{NEWACCOUNT} }) {
122 if ($item->{id} == $form->{new_chart_id}) {
123 $form->{selectnewaccount} .=
124 "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
125 } elsif (!$form->{new_chart_valid}) {
126 $form->{selectnewaccount} .=
127 "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
138 <th align=right>| . $locale->text('Folgekonto') . qq|</th>
139 <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
140 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
141 <td><input name=valid_from value="$form->{valid_from}"></td>
147 $form->{selectustva} = "<option>\n";
149 %ustva = (35 => $locale->text('UStVA-Nr. 35'),
150 36 => $locale->text('UStVA-Nr. 36'),
151 39 => $locale->text('UStVA-Nr. 39'),
152 41 => $locale->text('UStVA-Nr. 41'),
153 42 => $locale->text('UStVA-Nr. 42'),
154 43 => $locale->text('UStVA-Nr. 43'),
155 44 => $locale->text('UStVA-Nr. 44'),
156 45 => $locale->text('UStVA-Nr. 45'),
157 48 => $locale->text('UStVA-Nr. 48'),
158 49 => $locale->text('UStVA-Nr. 49'),
159 51 => $locale->text('UStVA-Nr. 51 left'),
160 511 => $locale->text('UStVA-Nr. 51 right'),
161 52 => $locale->text('UStVA-Nr. 52'),
162 53 => $locale->text('UStVA-Nr. 53'),
163 59 => $locale->text('UStVA-Nr. 59'),
164 60 => $locale->text('UStVA-Nr. 60'),
165 61 => $locale->text('UStVA-Nr. 61'),
166 62 => $locale->text('UStVA-Nr. 62'),
167 63 => $locale->text('UStVA-Nr. 63'),
168 64 => $locale->text('UStVA-Nr. 64'),
169 65 => $locale->text('UStVA-Nr. 65'),
170 66 => $locale->text('UStVA-Nr. 66'),
171 67 => $locale->text('UStVA-Nr. 67'),
172 69 => $locale->text('UStVA-Nr. 69'),
173 73 => $locale->text('UStVA-Nr. 73'),
174 74 => $locale->text('UStVA-Nr. 74'),
175 76 => $locale->text('UStVA-Nr. 76'),
176 77 => $locale->text('UStVA-Nr. 77'),
177 80 => $locale->text('UStVA-Nr. 80'),
178 84 => $locale->text('UStVA-Nr. 84'),
179 85 => $locale->text('UStVA-Nr. 85'),
180 86 => $locale->text('UStVA-Nr. 86 left'),
181 861 => $locale->text('UStVA-Nr. 86 right'),
182 91 => $locale->text('UStVA-Nr. 91'),
183 93 => $locale->text('UStVA-Nr. 93 left'),
184 931 => $locale->text('UStVA-Nr. 93 right'),
185 94 => $locale->text('UStVA-Nr. 94'),
186 95 => $locale->text('UStVA-Nr. 95'),
187 96 => $locale->text('UStVA-Nr. 96'),
188 97 => $locale->text('UStVA-Nr. 97 links'),
189 971 => $locale->text('UStVA-Nr. 97 rechts'),
190 98 => $locale->text('UStVA-Nr. 98'));
192 foreach $item (sort({ $a cmp $b } keys %ustva)) {
193 if ($item == $form->{pos_ustva}) {
194 $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
196 $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
203 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
204 <td><select name=pos_ustva>$form->{selectustva}</select></td>
205 <input type=hidden name=selectustva value="$form->{selectustva}">
208 $form->{selecteur} = "<option>\n";
209 %eur = (1 => "Umsatzerlöse",
210 2 => "sonstige Erlöse",
211 3 => "Privatanteile",
213 5 => "Ausserordentliche Erträge",
214 6 => "Vereinnahmte Umsatzst.",
215 7 => "Umsatzsteuererstattungen",
216 8 => "Wareneingänge",
217 9 => "Löhne und Gehälter",
218 10 => "Gesetzl. sozialer Aufw.",
220 12 => "Gas, Strom, Wasser",
221 13 => "Instandhaltung",
222 14 => "Steuern, Versich., Beiträge",
224 16 => "Kfz-Versicherungen",
225 17 => "Sonst. Fahrtkosten",
226 18 => "Werbe- und Reisekosten",
227 19 => "Instandhaltung u. Werkzeuge",
228 20 => "Fachzeitschriften, Bücher",
229 21 => "Miete für Einrichtungen",
230 22 => "Rechts- und Beratungskosten",
231 23 => "Bürobedarf, Porto, Telefon",
232 24 => "Sonstige Aufwendungen",
233 25 => "Abschreibungen auf Anlagever.",
234 26 => "Abschreibungen auf GWG",
236 28 => "Umsatzsteuerzahlungen",
238 30 => "Ausserordentlicher Aufwand",
239 31 => "Betriebliche Steuern");
240 foreach $item (sort({ $a <=> $b } keys(%eur))) {
241 if ($item == $form->{pos_eur}) {
242 $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
244 $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
251 <th align=right>| . $locale->text('EUER') . qq|</th>
252 <td><select name=pos_eur>$form->{selecteur}</select></td>
253 <input type=hidden name=selecteur value="$form->{selecteur}">
256 $form->{selectbwa} = "<option>\n";
258 %bwapos = (1 => 'Umsatzerlöse',
259 2 => 'Best.Verdg.FE/UE',
260 3 => 'Aktiv.Eigenleistung',
261 4 => 'Mat./Wareneinkauf',
262 5 => 'So.betr.Erlöse',
263 10 => 'Personalkosten',
265 12 => 'Betriebl.Steuern',
266 13 => 'Vers./Beiträge',
267 14 => 'Kfz.Kosten o.St.',
268 15 => 'Werbe-Reisek.',
269 16 => 'Kosten Warenabgabe',
270 17 => 'Abschreibungen',
271 18 => 'Rep./instandhlt.',
272 19 => 'Übrige Steuern',
273 20 => 'Sonst.Kosten',
275 31 => 'Sonst.neutr.Aufw.',
277 33 => 'Sonst.neutr.Ertrag',
278 34 => 'Verr.kalk.Kosten',
279 35 => 'Steuern Eink.u.Ertr.');
280 foreach $item (sort({ $a <=> $b } keys %bwapos)) {
281 if ($item == $form->{pos_bwa}) {
282 $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
284 $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
291 <th align=right>| . $locale->text('BWA') . qq|</th>
292 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
293 <input type=hidden name=selectbwa value="$form->{selectbwa}">
296 # Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
297 # $form->{selectbilanz} = "<option>\n";
298 # foreach $item ((1, 2, 3, 4)) {
299 # if ($item == $form->{pos_bilanz}) {
300 # $form->{selectbilanz} .= "<option value=$item selected>$item\n";
302 # $form->{selectbilanz} .= "<option value=$item>$item\n";
309 # <th align=right>| . $locale->text('Bilanz') . qq|</th>
310 # <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
311 # <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
314 # this is for our parser only!
315 # type=submit $locale->text('Add Account')
316 # type=submit $locale->text('Edit Account')
317 $form->{type} = "account";
324 <form method=post action=$form->{script}>
326 <input type=hidden name=id value=$form->{id}>
327 <input type=hidden name=type value=account>
328 <input type=hidden name=orphaned value=$form->{orphaned}>
329 <input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
331 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
332 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
333 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
334 <input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
335 <input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
337 <table border=0 width=100%>
339 <th class=listtop>$form->{title}</th>
346 <th align=right>| . $locale->text('Account Number') . qq|</th>
347 <td><input name=accno size=20 value=$form->{accno}></td>
350 <th align=right>| . $locale->text('Description') . qq|</th>
351 <td><input name=description size=40 value="$form->{description}"></td>
354 <th align=right>| . $locale->text('Account Type') . qq|</th>
358 <td><input name=category type=radio class=radio value=A $checked{A_}> |
359 . $locale->text('Asset') . qq|\n<br>
360 <input name=category type=radio class=radio value=L $checked{L_}> |
361 . $locale->text('Liability') . qq|\n<br>
362 <input name=category type=radio class=radio value=Q $checked{Q_}> |
363 . $locale->text('Equity') . qq|\n<br>
364 <input name=category type=radio class=radio value=I $checked{I_}> |
365 . $locale->text('Revenue') . qq|\n<br>
366 <input name=category type=radio class=radio value=E $checked{E_}> |
367 . $locale->text('Expense') . qq|<br>
368 <input name=category type=radio class=radio value=C $checked{C_}> |
369 . $locale->text('Costs') . qq|</td>
370 <td width=50> </td>
372 <input name=charttype type=radio class=radio value="H" $checked{H}> |
373 . $locale->text('Heading') . qq|<br>
374 <input name=charttype type=radio class=radio value="A" $checked{A}> |
375 . $locale->text('Account') . qq|</td>
382 if ($form->{charttype} eq "A") {
389 . $locale->text('Is this a summary account to record') . qq|</th>
391 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
392 . $locale->text('AR')
393 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
394 . $locale->text('AP')
395 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
396 . $locale->text('Inventory')
403 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
409 <th align=left>| . $locale->text('Receivables') . qq|</th>
410 <th align=left>| . $locale->text('Payables') . qq|</th>
411 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
412 <th align=left>| . $locale->text('Service Items') . qq|</th>
416 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
417 . $locale->text('Revenue') . qq|\n<br>
418 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
419 . $locale->text('Receipt') . qq|\n<br>
420 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
421 . $locale->text('Tax') . qq|
424 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
425 . $locale->text('Expense/Asset') . qq|\n<br>
426 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
427 . $locale->text('Payment') . qq|\n<br>
428 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
429 . $locale->text('Tax') . qq|
432 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
433 . $locale->text('Revenue') . qq|\n<br>
434 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
435 . $locale->text('Expense') . qq|\n<br>
436 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
437 . $locale->text('Tax') . qq|
440 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
441 . $locale->text('Revenue') . qq|\n<br>
442 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
443 . $locale->text('Expense') . qq|\n<br>
444 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
445 . $locale->text('Tax') . qq|
465 <td><hr size=3 noshade></td>
470 $lxdebug->leave_sub();
474 $lxdebug->enter_sub();
478 <input name=callback type=hidden value="$form->{callback}">
480 <input type=hidden name=path value=$form->{path}>
481 <input type=hidden name=login value=$form->{login}>
482 <input type=hidden name=password value=$form->{password}>
485 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
487 <input type=submit class=submit name=action value="|
488 . $locale->text('Save') . qq|">
492 if ($form->{id} && $form->{orphaned}) {
493 print qq|<input type=submit class=submit name=action value="|
494 . $locale->text('Delete') . qq|">|;
497 if ($form->{menubar}) {
498 require "$form->{path}/menu.pl";
509 $lxdebug->leave_sub();
513 $lxdebug->enter_sub();
515 $form->isblank("accno", $locale->text('Account Number missing!'));
516 $form->isblank("category", $locale->text('Account Type missing!'));
518 $form->redirect($locale->text('Account saved!'))
519 if (AM->save_account(\%myconfig, \%$form));
520 $form->error($locale->text('Cannot save account!'));
522 $lxdebug->leave_sub();
526 $lxdebug->enter_sub();
528 CA->all_accounts(\%myconfig, \%$form);
530 $form->{title} = $locale->text('Chart of Accounts');
534 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
536 @column_index = qw(accno gifi_accno description debit credit link);
538 $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
539 $column_header{gifi_accno} =
540 qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
541 $column_header{description} =
542 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
543 $column_header{debit} = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
544 $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
545 $column_header{link} = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
548 $colspan = $#column_index + 1;
555 <th class=listtop colspan=$colspan>$form->{title}</th>
558 <tr class=listheading>
561 map { print "$column_header{$_}\n" } @column_index;
568 $callback = $form->escape($callback);
570 foreach $ca (@{ $form->{CA} }) {
572 $ca->{debit} = " ";
573 $ca->{credit} = " ";
575 if ($ca->{amount} > 0) {
577 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
579 if ($ca->{amount} < 0) {
581 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
584 $ca->{link} =~ s/:/<br>/og;
586 if ($ca->{charttype} eq "H") {
587 print qq|<tr class=listheading>|;
589 $column_data{accno} =
590 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>|;
591 $column_data{gifi_accno} =
592 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>|;
593 $column_data{description} = qq|<th>$ca->{description} </th>|;
594 $column_data{debit} = qq|<th> </th>|;
595 $column_data{credit} = qq| <th> </th>|;
596 $column_data{link} = qq|<th> </th>|;
602 <tr valign=top class=listrow$i>|;
603 $column_data{accno} =
604 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>|;
605 $column_data{gifi_accno} =
606 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>|;
607 $column_data{description} = qq|<td>$ca->{description} </td>|;
608 $column_data{debit} = qq|<td align=right>$ca->{debit}</td>|;
609 $column_data{credit} = qq|<td align=right>$ca->{credit}</td>|;
610 $column_data{link} = qq|<td>$ca->{link} </td>|;
614 map { print "$column_data{$_}\n" } @column_index;
620 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
627 $lxdebug->leave_sub();
631 $lxdebug->enter_sub();
633 $form->{title} = $locale->text('Delete Account');
636 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
638 if ($form->{id} == $form->{$id}) {
639 $form->error($locale->text('Cannot delete default account!'));
643 $form->redirect($locale->text('Account deleted!'))
644 if (AM->delete_account(\%myconfig, \%$form));
645 $form->error($locale->text('Cannot delete account!'));
647 $lxdebug->leave_sub();
651 $lxdebug->enter_sub();
653 @{ $form->{fields} } = (accno, description);
654 $form->{table} = "gifi";
655 $form->{sortorder} = "accno";
657 AM->gifi_accounts(\%myconfig, \%$form);
659 $form->{title} = $locale->text('GIFI');
663 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
665 @column_index = qw(accno description);
667 $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
668 $column_header{description} =
669 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
672 $colspan = $#column_index + 1;
679 <th class=listtop colspan=$colspan>$form->{title}</th>
682 <tr class=listheading>
685 map { print "$column_header{$_}\n" } @column_index;
692 $callback = $form->escape($callback);
694 foreach $ca (@{ $form->{ALL} }) {
700 <tr valign=top class=listrow$i>|;
702 $column_data{accno} =
703 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>|;
704 $column_data{description} = qq|<td>$ca->{description} </td>|;
706 map { print "$column_data{$_}\n" } @column_index;
713 <td colspan=$colspan><hr size=3 noshade></td>
721 $lxdebug->leave_sub();
725 $lxdebug->enter_sub();
727 $form->{title} = "Add";
731 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
738 $lxdebug->leave_sub();
742 $lxdebug->enter_sub();
744 $form->{title} = "Edit";
746 AM->get_gifi(\%myconfig, \%$form);
751 $lxdebug->leave_sub();
755 $lxdebug->enter_sub();
757 $form->{title} = $locale->text("$form->{title} GIFI");
759 # $locale->text('Add GIFI')
760 # $locale->text('Edit GIFI')
762 $form->{description} =~ s/\"/"/g;
769 <form method=post action=$form->{script}>
771 <input type=hidden name=id value=$form->{accno}>
772 <input type=hidden name=type value=gifi>
776 <th class=listtop>$form->{title}</th>
783 <th align=right>| . $locale->text('GIFI') . qq|</th>
784 <td><input name=accno size=20 value=$form->{accno}></td>
787 <th align=right>| . $locale->text('Description') . qq|</th>
788 <td><input name=description size=60 value="$form->{description}"></td>
794 <td colspan=2><hr size=3 noshade></td>
799 $lxdebug->leave_sub();
803 $lxdebug->enter_sub();
807 <input name=callback type=hidden value="$form->{callback}">
809 <input type=hidden name=path value=$form->{path}>
810 <input type=hidden name=login value=$form->{login}>
811 <input type=hidden name=password value=$form->{password}>
813 <br><input type=submit class=submit name=action value="|
814 . $locale->text('Save') . qq|">|;
818 <input type=submit class=submit name=action value="|
819 . $locale->text('Copy to COA') . qq|">
822 if ($form->{accno} && $form->{orphaned}) {
823 print qq|<input type=submit class=submit name=action value="|
824 . $locale->text('Delete') . qq|">|;
828 if ($form->{menubar}) {
829 require "$form->{path}/menu.pl";
840 $lxdebug->leave_sub();
844 $lxdebug->enter_sub();
846 $form->isblank("accno", $locale->text('GIFI missing!'));
847 AM->save_gifi(\%myconfig, \%$form);
848 $form->redirect($locale->text('GIFI saved!'));
850 $lxdebug->leave_sub();
854 $lxdebug->enter_sub();
856 $form->isblank("accno", $locale->text('GIFI missing!'));
858 AM->save_gifi(\%myconfig, \%$form);
861 $form->{gifi_accno} = $form->{accno};
862 $form->{title} = "Add";
863 $form->{charttype} = "A";
868 $lxdebug->leave_sub();
872 $lxdebug->enter_sub();
874 AM->delete_gifi(\%myconfig, \%$form);
875 $form->redirect($locale->text('GIFI deleted!'));
877 $lxdebug->leave_sub();
881 $lxdebug->enter_sub();
883 $form->{title} = "Add";
887 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
888 unless $form->{callback};
893 $lxdebug->leave_sub();
896 sub edit_department {
897 $lxdebug->enter_sub();
899 $form->{title} = "Edit";
901 AM->get_department(\%myconfig, \%$form);
906 $lxdebug->leave_sub();
909 sub list_department {
910 $lxdebug->enter_sub();
912 AM->departments(\%myconfig, \%$form);
915 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
917 $callback = $form->escape($form->{callback});
919 $form->{title} = $locale->text('Departments');
921 @column_index = qw(description cost profit);
923 $column_header{description} =
924 qq|<th class=listheading width=90%>|
925 . $locale->text('Description')
927 $column_header{cost} =
928 qq|<th class=listheading nowrap>|
929 . $locale->text('Cost Center')
931 $column_header{profit} =
932 qq|<th class=listheading nowrap>|
933 . $locale->text('Profit Center')
943 <th class=listtop>$form->{title}</th>
949 <tr class=listheading>
952 map { print "$column_header{$_}\n" } @column_index;
958 foreach $ref (@{ $form->{ALL} }) {
964 <tr valign=top class=listrow$i>
967 $costcenter = ($ref->{role} eq "C") ? "X" : "";
968 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
970 $column_data{description} =
971 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>|;
972 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
973 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
975 map { print "$column_data{$_}\n" } @column_index;
987 <td><hr size=3 noshade></td>
992 <form method=post action=$form->{script}>
994 <input name=callback type=hidden value="$form->{callback}">
996 <input type=hidden name=type value=department>
998 <input type=hidden name=path value=$form->{path}>
999 <input type=hidden name=login value=$form->{login}>
1000 <input type=hidden name=password value=$form->{password}>
1002 <input class=submit type=submit name=action value="|
1003 . $locale->text('Add') . qq|">|;
1005 if ($form->{menubar}) {
1006 require "$form->{path}/menu.pl";
1017 $lxdebug->leave_sub();
1020 sub department_header {
1021 $lxdebug->enter_sub();
1023 $form->{title} = $locale->text("$form->{title} Department");
1025 # $locale->text('Add Department')
1026 # $locale->text('Edit Department')
1028 $form->{description} =~ s/\"/"/g;
1030 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
1032 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
1035 qq|<input name=description size=60 value="$form->{description}">|;
1038 $costcenter = "checked" if $form->{role} eq "C";
1039 $profitcenter = "checked" if $form->{role} eq "P";
1046 <form method=post action=$form->{script}>
1048 <input type=hidden name=id value=$form->{id}>
1049 <input type=hidden name=type value=department>
1053 <th class=listtop colspan=2>$form->{title}</th>
1055 <tr height="5"></tr>
1057 <th align=right>| . $locale->text('Description') . qq|</th>
1058 <td>$description</td>
1062 <td><input type=radio style=radio name=role value="C" $costcenter> |
1063 . $locale->text('Cost Center') . qq|
1064 <input type=radio style=radio name=role value="P" $profitcenter> |
1065 . $locale->text('Profit Center') . qq|
1068 <td colspan=2><hr size=3 noshade></td>
1073 $lxdebug->leave_sub();
1076 sub save_department {
1077 $lxdebug->enter_sub();
1079 $form->isblank("description", $locale->text('Description missing!'));
1080 AM->save_department(\%myconfig, \%$form);
1081 $form->redirect($locale->text('Department saved!'));
1083 $lxdebug->leave_sub();
1086 sub delete_department {
1087 $lxdebug->enter_sub();
1089 AM->delete_department(\%myconfig, \%$form);
1090 $form->redirect($locale->text('Department deleted!'));
1092 $lxdebug->leave_sub();
1096 $lxdebug->enter_sub();
1098 $form->{title} = "Add";
1101 "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1102 unless $form->{callback};
1107 $lxdebug->leave_sub();
1111 $lxdebug->enter_sub();
1113 $form->{title} = "Edit";
1115 AM->get_lead(\%myconfig, \%$form);
1119 $form->{orphaned} = 1;
1122 $lxdebug->leave_sub();
1126 $lxdebug->enter_sub();
1128 AM->lead(\%myconfig, \%$form);
1131 "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1133 $callback = $form->escape($form->{callback});
1135 $form->{title} = $locale->text('Lead');
1137 @column_index = qw(description cost profit);
1139 $column_header{description} =
1140 qq|<th class=listheading width=100%>|
1141 . $locale->text('Description')
1151 <th class=listtop>$form->{title}</th>
1153 <tr height="5"></tr>
1154 <tr class=listheading>
1157 map { print "$column_header{$_}\n" } @column_index;
1163 foreach $ref (@{ $form->{ALL} }) {
1169 <tr valign=top class=listrow$i>
1172 $lead = $ref->{lead};
1174 $column_data{description} =
1175 qq|<td><a href=$form->{script}?action=edit_lead&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{lead}</td>|;
1177 map { print "$column_data{$_}\n" } @column_index;
1186 <td><hr size=3 noshade></td>
1191 <form method=post action=$form->{script}>
1193 <input name=callback type=hidden value="$form->{callback}">
1195 <input type=hidden name=type value=lead>
1197 <input type=hidden name=path value=$form->{path}>
1198 <input type=hidden name=login value=$form->{login}>
1199 <input type=hidden name=password value=$form->{password}>
1201 <input class=submit type=submit name=action value="|
1202 . $locale->text('Add') . qq|">|;
1204 if ($form->{menubar}) {
1205 require "$form->{path}/menu.pl";
1216 $lxdebug->leave_sub();
1220 $lxdebug->enter_sub();
1222 $form->{title} = $locale->text("$form->{title} Lead");
1224 # $locale->text('Add Lead')
1225 # $locale->text('Edit Lead')
1227 $form->{description} =~ s/\"/"/g;
1230 qq|<input name=description size=50 value="$form->{lead}">|;
1237 <form method=post action=$form->{script}>
1239 <input type=hidden name=id value=$form->{id}>
1240 <input type=hidden name=type value=lead>
1244 <th class=listtop colspan=2>$form->{title}</th>
1246 <tr height="5"></tr>
1248 <th align=right>| . $locale->text('Description') . qq|</th>
1249 <td>$description</td>
1251 <td colspan=2><hr size=3 noshade></td>
1256 $lxdebug->leave_sub();
1260 $lxdebug->enter_sub();
1262 $form->isblank("description", $locale->text('Description missing!'));
1263 AM->save_lead(\%myconfig, \%$form);
1264 $form->redirect($locale->text('lead saved!'));
1266 $lxdebug->leave_sub();
1270 $lxdebug->enter_sub();
1272 AM->delete_lead(\%myconfig, \%$form);
1273 $form->redirect($locale->text('lead deleted!'));
1275 $lxdebug->leave_sub();
1279 $lxdebug->enter_sub();
1281 $form->{title} = "Add";
1284 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1285 unless $form->{callback};
1290 $lxdebug->leave_sub();
1294 $lxdebug->enter_sub();
1296 $form->{title} = "Edit";
1298 AM->get_business(\%myconfig, \%$form);
1302 $form->{orphaned} = 1;
1305 $lxdebug->leave_sub();
1309 $lxdebug->enter_sub();
1311 AM->business(\%myconfig, \%$form);
1314 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1316 $callback = $form->escape($form->{callback});
1318 $form->{title} = $locale->text('Type of Business');
1320 @column_index = qw(description discount customernumberinit);
1322 $column_header{description} =
1323 qq|<th class=listheading width=60%>|
1324 . $locale->text('Description')
1326 $column_header{discount} =
1327 qq|<th class=listheading width=10%>|
1328 . $locale->text('Discount')
1330 $column_header{customernumberinit} =
1331 qq|<th class=listheading>|
1332 . $locale->text('Customernumberinit')
1342 <th class=listtop>$form->{title}</th>
1344 <tr height="5"></tr>
1348 <tr class=listheading>
1351 map { print "$column_header{$_}\n" } @column_index;
1357 foreach $ref (@{ $form->{ALL} }) {
1363 <tr valign=top class=listrow$i>
1367 $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
1370 ? "<b>$ref->{description}</b>"
1371 : "$ref->{description}";
1372 $column_data{description} =
1373 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>|;
1374 $column_data{discount} = qq|<td align=right>$discount</td>|;
1375 $column_data{customernumberinit} =
1376 qq|<td align=right>$ref->{customernumberinit}</td>|;
1378 map { print "$column_data{$_}\n" } @column_index;
1390 <td><hr size=3 noshade></td>
1395 <form method=post action=$form->{script}>
1397 <input name=callback type=hidden value="$form->{callback}">
1399 <input type=hidden name=type value=business>
1401 <input type=hidden name=path value=$form->{path}>
1402 <input type=hidden name=login value=$form->{login}>
1403 <input type=hidden name=password value=$form->{password}>
1405 <input class=submit type=submit name=action value="|
1406 . $locale->text('Add') . qq|">|;
1408 if ($form->{menubar}) {
1409 require "$form->{path}/menu.pl";
1421 $lxdebug->leave_sub();
1424 sub business_header {
1425 $lxdebug->enter_sub();
1427 $form->{title} = $locale->text("$form->{title} Business");
1428 $form->{salesman} = "checked" if $form->{salesman};
1430 # $locale->text('Add Business')
1431 # $locale->text('Edit Business')
1433 $form->{description} =~ s/\"/"/g;
1435 $form->format_amount(\%myconfig, $form->{discount} * 100);
1442 <form method=post action=$form->{script}>
1444 <input type=hidden name=id value=$form->{id}>
1445 <input type=hidden name=type value=business>
1449 <th class=listtop colspan=2>$form->{title}</th>
1451 <tr height="5"></tr>
1453 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1454 <td><input name=description size=30 value="$form->{description}"></td>
1457 <th align=right>| . $locale->text('Discount') . qq| %</th>
1458 <td><input name=discount size=5 value=$form->{discount}></td>
1461 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1462 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1465 <td align=right>| . $locale->text('Salesman') . qq|</td>
1466 <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
1468 <td colspan=2><hr size=3 noshade></td>
1473 $lxdebug->leave_sub();
1477 $lxdebug->enter_sub();
1479 $form->isblank("description", $locale->text('Description missing!'));
1480 AM->save_business(\%myconfig, \%$form);
1481 $form->redirect($locale->text('Business saved!'));
1483 $lxdebug->leave_sub();
1486 sub delete_business {
1487 $lxdebug->enter_sub();
1489 AM->delete_business(\%myconfig, \%$form);
1490 $form->redirect($locale->text('Business deleted!'));
1492 $lxdebug->leave_sub();
1496 $lxdebug->enter_sub();
1498 $form->{title} = "Add";
1501 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1502 unless $form->{callback};
1507 $lxdebug->leave_sub();
1511 $lxdebug->enter_sub();
1513 $form->{title} = "Edit";
1515 AM->get_language(\%myconfig, \%$form);
1519 $form->{orphaned} = 1;
1522 $lxdebug->leave_sub();
1526 $lxdebug->enter_sub();
1528 AM->language(\%myconfig, \%$form);
1531 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1533 $callback = $form->escape($form->{callback});
1535 $form->{title} = $locale->text('Languages');
1537 @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
1539 $column_header{description} =
1540 qq|<th class=listheading width=60%>|
1541 . $locale->text('Description')
1543 $column_header{template_code} =
1544 qq|<th class=listheading width=10%>|
1545 . $locale->text('Template Code')
1547 $column_header{article_code} =
1548 qq|<th class=listheading>|
1549 . $locale->text('Article Code')
1551 $column_header{output_numberformat} =
1552 qq|<th class=listheading>|
1553 . $locale->text('Number Format')
1555 $column_header{output_dateformat} =
1556 qq|<th class=listheading>|
1557 . $locale->text('Date Format')
1559 $column_header{output_longdates} =
1560 qq|<th class=listheading>|
1561 . $locale->text('Long Dates')
1571 <th class=listtop>$form->{title}</th>
1573 <tr height="5"></tr>
1577 <tr class=listheading>
1580 map { print "$column_header{$_}\n" } @column_index;
1586 foreach $ref (@{ $form->{ALL} }) {
1592 <tr valign=top class=listrow$i>
1596 $column_data{description} =
1597 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>|;
1598 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1599 $column_data{article_code} =
1600 qq|<td align=right>$ref->{article_code}</td>|;
1601 $column_data{output_numberformat} =
1603 ($ref->{output_numberformat} ? $ref->{output_numberformat} :
1604 $locale->text("use program settings")) .
1606 $column_data{output_dateformat} =
1608 ($ref->{output_dateformat} ? $ref->{output_dateformat} :
1609 $locale->text("use program settings")) .
1611 $column_data{output_longdates} =
1613 ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
1616 map { print "$column_data{$_}\n" } @column_index;
1628 <td><hr size=3 noshade></td>
1633 <form method=post action=$form->{script}>
1635 <input name=callback type=hidden value="$form->{callback}">
1637 <input type=hidden name=type value=language>
1639 <input type=hidden name=path value=$form->{path}>
1640 <input type=hidden name=login value=$form->{login}>
1641 <input type=hidden name=password value=$form->{password}>
1643 <input class=submit type=submit name=action value="|
1644 . $locale->text('Add') . qq|">|;
1646 if ($form->{menubar}) {
1647 require "$form->{path}/menu.pl";
1659 $lxdebug->leave_sub();
1662 sub language_header {
1663 $lxdebug->enter_sub();
1665 $form->{title} = $locale->text("$form->{title} Language");
1667 # $locale->text('Add Language')
1668 # $locale->text('Edit Language')
1670 $form->{description} =~ s/\"/"/g;
1671 $form->{template_code} =~ s/\"/"/g;
1672 $form->{article_code} =~ s/\"/"/g;
1678 qq|<option value="">| . $locale->text("use program settings") .
1680 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1682 ($item eq $form->{output_numberformat})
1683 ? "<option selected>$item"
1689 qq|<option value="">| . $locale->text("use program settings") .
1691 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1693 ($item eq $form->{output_dateformat})
1694 ? "<option selected>$item"
1702 <form method=post action=$form->{script}>
1704 <input type=hidden name=id value=$form->{id}>
1705 <input type=hidden name=type value=language>
1709 <th class=listtop colspan=2>$form->{title}</th>
1711 <tr height="5"></tr>
1713 <th align=right>| . $locale->text('Language') . qq|</th>
1714 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1717 <th align=right>| . $locale->text('Template Code') . qq|</th>
1718 <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
1721 <th align=right>| . $locale->text('Article Code') . qq|</th>
1722 <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
1725 <th align=right>| . $locale->text('Number Format') . qq|</th>
1726 <td><select name="output_numberformat">$numberformat</select></td>
1729 <th align=right>| . $locale->text('Date Format') . qq|</th>
1730 <td><select name="output_dateformat">$dateformat</select></td>
1733 <th align=right>| . $locale->text('Long Dates') . qq|</th>
1734 <td><input type="radio" name="output_longdates" value="1"| .
1735 ($form->{output_longdates} ? " checked" : "") .
1736 qq|>| . $locale->text("Yes") .
1737 qq|<input type="radio" name="output_longdates" value="0"| .
1738 ($form->{output_longdates} ? "" : " checked") .
1739 qq|>| . $locale->text("No") .
1742 <td colspan=2><hr size=3 noshade></td>
1747 $lxdebug->leave_sub();
1751 $lxdebug->enter_sub();
1753 $form->isblank("description", $locale->text('Language missing!'));
1754 $form->isblank("template_code", $locale->text('Template Code missing!'));
1755 $form->isblank("article_code", $locale->text('Article Code missing!'));
1756 AM->save_language(\%myconfig, \%$form);
1757 $form->redirect($locale->text('Language saved!'));
1759 $lxdebug->leave_sub();
1762 sub delete_language {
1763 $lxdebug->enter_sub();
1765 AM->delete_language(\%myconfig, \%$form);
1766 $form->redirect($locale->text('Language deleted!'));
1768 $lxdebug->leave_sub();
1772 sub add_buchungsgruppe {
1773 $lxdebug->enter_sub();
1775 # $locale->text("Add Buchungsgruppe")
1776 # $locale->text("Edit Buchungsgruppe")
1777 $form->{title} = "Add";
1780 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1781 unless $form->{callback};
1782 AM->get_buchungsgruppe(\%myconfig, \%$form);
1784 $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
1787 &buchungsgruppe_header;
1790 $lxdebug->leave_sub();
1793 sub edit_buchungsgruppe {
1794 $lxdebug->enter_sub();
1796 $form->{title} = "Edit";
1798 AM->get_buchungsgruppe(\%myconfig, \%$form);
1800 &buchungsgruppe_header;
1804 $lxdebug->leave_sub();
1807 sub list_buchungsgruppe {
1808 $lxdebug->enter_sub();
1810 AM->buchungsgruppe(\%myconfig, \%$form);
1813 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1815 $callback = $form->escape($form->{callback});
1817 $form->{title} = $locale->text('Buchungsgruppen');
1819 @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 );
1821 $column_header{description} =
1822 qq|<th class=listheading width=60%>|
1823 . $locale->text('Description')
1825 $column_header{inventory_accno} =
1826 qq|<th class=listheading width=10%>|
1827 . $locale->text('Bestandskonto')
1829 $column_header{income_accno_0} =
1830 qq|<th class=listheading>|
1831 . $locale->text('Erlöse Inland')
1833 $column_header{expense_accno_0} =
1834 qq|<th class=listheading>|
1835 . $locale->text('Aufwand Inland')
1837 $column_header{income_accno_1} =
1838 qq|<th class=listheading>|
1839 . $locale->text('Erlöse EU m. UStId')
1841 $column_header{expense_accno_1} =
1842 qq|<th class=listheading>|
1843 . $locale->text('Aufwand EU m. UStId')
1845 $column_header{income_accno_2} =
1846 qq|<th class=listheading>|
1847 . $locale->text('Erlöse EU o. UStId')
1849 $column_header{expense_accno_2} =
1850 qq|<th class=listheading>|
1851 . $locale->text('Aufwand EU o. UStId')
1853 $column_header{income_accno_3} =
1854 qq|<th class=listheading>|
1855 . $locale->text('Erlöse Ausland')
1857 $column_header{expense_accno_3} =
1858 qq|<th class=listheading>|
1859 . $locale->text('Aufwand Ausland')
1868 <th class=listtop>$form->{title}</th>
1870 <tr height="5"></tr>
1874 <tr class=listheading>
1877 map { print "$column_header{$_}\n" } @column_index;
1883 foreach $ref (@{ $form->{ALL} }) {
1889 <tr valign=top class=listrow$i>
1893 $column_data{description} =
1894 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>|;
1895 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1896 $column_data{income_accno_0} =
1897 qq|<td align=right>$ref->{income_accno_0}</td>|;
1898 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1899 $column_data{income_accno_1} =
1900 qq|<td align=right>$ref->{income_accno_1}</td>|;
1901 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1902 $column_data{income_accno_2} =
1903 qq|<td align=right>$ref->{income_accno_2}</td>|;
1904 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1905 $column_data{income_accno_3} =
1906 qq|<td align=right>$ref->{income_accno_3}</td>|;
1907 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1909 map { print "$column_data{$_}\n" } @column_index;
1921 <td><hr size=3 noshade></td>
1926 <form method=post action=$form->{script}>
1928 <input name=callback type=hidden value="$form->{callback}">
1930 <input type=hidden name=type value=buchungsgruppe>
1932 <input type=hidden name=path value=$form->{path}>
1933 <input type=hidden name=login value=$form->{login}>
1934 <input type=hidden name=password value=$form->{password}>
1936 <input class=submit type=submit name=action value="|
1937 . $locale->text('Add') . qq|">|;
1939 if ($form->{menubar}) {
1940 require "$form->{path}/menu.pl";
1952 $lxdebug->leave_sub();
1955 sub buchungsgruppe_header {
1956 $lxdebug->enter_sub();
1958 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1960 # $locale->text('Buchungsgruppe hinzufügen')
1961 # $locale->text('Buchungsgruppe bearbeiten')
1963 my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
1964 my %acc_type_map = (
1965 "IC" => $acc_inventory,
1966 "IC_income" => $acc_income,
1967 "IC_sale" => $acc_income,
1968 "IC_expense" => $acc_expense,
1969 "IC_cogs" => $acc_expense,
1972 foreach $key (keys(%acc_type_map)) {
1973 foreach $ref (@{ $form->{IC_links}{$key} }) {
1974 $acc_type_map{$key}->{$ref->{"id"}} = $ref;
1978 foreach my $type (qw(IC IC_income IC_expense)) {
1979 $form->{"select$type"} =
1981 map({ "<option value=$_->{id} $_->{selected}>" .
1982 "$_->{accno}--" . H($_->{description}) . "</option>" }
1983 sort({ $a->{"accno"} cmp $b->{"accno"} }
1984 values(%{$acc_type_map{$type}}))));
1988 $form->{selectIC} =~ s/selected//g;
1989 $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/;
1990 $form->{selectIC_income} =~ s/selected//g;
1991 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1992 $form->{selectIC_expense} =~ s/selected//g;
1993 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1999 <th align=right>| . $locale->text('Inventory') . qq|</th>
2000 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
2001 <input name=selectIC type=hidden value="$form->{selectIC}">
2005 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
2009 $linkaccounts .= qq|
2011 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
2012 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
2015 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
2016 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
2019 $form->{selectIC_income} =~ s/selected//g;
2020 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
2021 $form->{selectIC_expense} =~ s/selected//g;
2022 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
2024 $linkaccounts .= qq| <tr>
2025 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
2026 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
2029 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
2030 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
2034 $form->{selectIC_income} =~ s/selected//g;
2035 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
2036 $form->{selectIC_expense} =~ s/selected//g;
2037 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
2040 $linkaccounts .= qq| <tr>
2041 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
2042 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
2045 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
2046 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
2050 $form->{selectIC_income} =~ s/selected//g;
2051 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
2052 $form->{selectIC_expense} =~ s/selected//g;
2053 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
2056 $linkaccounts .= qq| <tr>
2057 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
2058 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
2061 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
2062 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
2072 <form method=post action=$form->{script}>
2074 <input type=hidden name=id value=$form->{id}>
2075 <input type=hidden name=type value=buchungsgruppe>
2079 <th class=listtop colspan=2>$form->{title}</th>
2081 <tr height="5"></tr>
2083 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
2084 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
2087 <td colspan=2><hr size=3 noshade></td>
2092 $lxdebug->leave_sub();
2095 sub save_buchungsgruppe {
2096 $lxdebug->enter_sub();
2098 $form->isblank("description", $locale->text('Description missing!'));
2100 AM->save_buchungsgruppe(\%myconfig, \%$form);
2101 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
2103 $lxdebug->leave_sub();
2106 sub delete_buchungsgruppe {
2107 $lxdebug->enter_sub();
2109 AM->delete_buchungsgruppe(\%myconfig, \%$form);
2110 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
2112 $lxdebug->leave_sub();
2117 $lxdebug->enter_sub();
2119 $form->{title} = "Add";
2122 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2123 unless $form->{callback};
2128 $lxdebug->leave_sub();
2132 $lxdebug->enter_sub();
2134 $form->{title} = "Edit";
2136 AM->get_printer(\%myconfig, \%$form);
2140 $form->{orphaned} = 1;
2143 $lxdebug->leave_sub();
2147 $lxdebug->enter_sub();
2149 AM->printer(\%myconfig, \%$form);
2152 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2154 $callback = $form->escape($form->{callback});
2156 $form->{title} = $locale->text('Printer');
2158 @column_index = qw(printer_description printer_command template_code);
2160 $column_header{printer_description} =
2161 qq|<th class=listheading width=60%>|
2162 . $locale->text('Printer Description')
2164 $column_header{printer_command} =
2165 qq|<th class=listheading width=10%>|
2166 . $locale->text('Printer Command')
2168 $column_header{template_code} =
2169 qq|<th class=listheading>|
2170 . $locale->text('Template Code')
2180 <th class=listtop>$form->{title}</th>
2182 <tr height="5"></tr>
2186 <tr class=listheading>
2189 map { print "$column_header{$_}\n" } @column_index;
2195 foreach $ref (@{ $form->{ALL} }) {
2201 <tr valign=top class=listrow$i>
2205 $column_data{printer_description} =
2206 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>|;
2207 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
2208 $column_data{template_code} =
2209 qq|<td align=right>$ref->{template_code}</td>|;
2211 map { print "$column_data{$_}\n" } @column_index;
2223 <td><hr size=3 noshade></td>
2228 <form method=post action=$form->{script}>
2230 <input name=callback type=hidden value="$form->{callback}">
2232 <input type=hidden name=type value=printer>
2234 <input type=hidden name=path value=$form->{path}>
2235 <input type=hidden name=login value=$form->{login}>
2236 <input type=hidden name=password value=$form->{password}>
2238 <input class=submit type=submit name=action value="|
2239 . $locale->text('Add') . qq|">|;
2241 if ($form->{menubar}) {
2242 require "$form->{path}/menu.pl";
2254 $lxdebug->leave_sub();
2257 sub printer_header {
2258 $lxdebug->enter_sub();
2260 $form->{title} = $locale->text("$form->{title} Printer");
2262 # $locale->text('Add Printer')
2263 # $locale->text('Edit Printer')
2265 $form->{printer_description} =~ s/\"/"/g;
2266 $form->{template_code} =~ s/\"/"/g;
2267 $form->{printer_command} =~ s/\"/"/g;
2275 <form method=post action=$form->{script}>
2277 <input type=hidden name=id value=$form->{id}>
2278 <input type=hidden name=type value=printer>
2282 <th class=listtop colspan=2>$form->{title}</th>
2284 <tr height="5"></tr>
2286 <th align=right>| . $locale->text('Printer') . qq|</th>
2287 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2290 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2291 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2294 <th align=right>| . $locale->text('Template Code') . qq|</th>
2295 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2297 <td colspan=2><hr size=3 noshade></td>
2302 $lxdebug->leave_sub();
2306 $lxdebug->enter_sub();
2308 $form->isblank("printer_description", $locale->text('Description missing!'));
2309 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2310 AM->save_printer(\%myconfig, \%$form);
2311 $form->redirect($locale->text('Printer saved!'));
2313 $lxdebug->leave_sub();
2316 sub delete_printer {
2317 $lxdebug->enter_sub();
2319 AM->delete_printer(\%myconfig, \%$form);
2320 $form->redirect($locale->text('Printer deleted!'));
2322 $lxdebug->leave_sub();
2327 $lxdebug->enter_sub();
2329 $form->{title} = "Add";
2332 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2333 unless $form->{callback};
2335 $form->{terms_netto} = 0;
2336 $form->{terms_skonto} = 0;
2337 $form->{percent_skonto} = 0;
2341 $lxdebug->leave_sub();
2345 $lxdebug->enter_sub();
2347 $form->{title} = "Edit";
2349 AM->get_payment(\%myconfig, \%$form);
2353 $form->{orphaned} = 1;
2356 $lxdebug->leave_sub();
2360 $lxdebug->enter_sub();
2362 AM->payment(\%myconfig, \%$form);
2365 "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2367 $callback = $form->escape($form->{callback});
2369 $form->{title} = $locale->text('Payment Terms');
2371 @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
2373 $column_header{description} =
2374 qq|<th class=listheading>|
2375 . $locale->text('Description')
2377 $column_header{description_long} =
2378 qq|<th class=listheading>|
2379 . $locale->text('Long Description')
2381 $column_header{terms_netto} =
2382 qq|<th class=listheading>|
2383 . $locale->text('Netto Terms')
2385 $column_header{terms_skonto} =
2386 qq|<th class=listheading>|
2387 . $locale->text('Skonto Terms')
2389 $column_header{percent_skonto} =
2390 qq|<th class=listheading>|
2391 . $locale->text('Skonto')
2401 <th class=listtop>$form->{title}</th>
2403 <tr height="5"></tr>
2407 <tr class=listheading>
2410 map { print "$column_header{$_}\n" } @column_index;
2416 foreach $ref (@{ $form->{ALL} }) {
2422 <tr valign=top class=listrow$i>
2426 $column_data{description} =
2427 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>|;
2428 $column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|;
2429 $column_data{terms_netto} =
2430 qq|<td align=right>$ref->{terms_netto}</td>|;
2431 $column_data{terms_skonto} =
2432 qq|<td align=right>$ref->{terms_skonto}</td>|;
2433 $column_data{percent_skonto} =
2434 qq|<td align=right>$ref->{percent_skonto} %</td>|;
2435 map { print "$column_data{$_}\n" } @column_index;
2447 <td><hr size=3 noshade></td>
2452 <form method=post action=$form->{script}>
2454 <input name=callback type=hidden value="$form->{callback}">
2456 <input type=hidden name=type value=payment>
2458 <input type=hidden name=path value=$form->{path}>
2459 <input type=hidden name=login value=$form->{login}>
2460 <input type=hidden name=password value=$form->{password}>
2462 <input class=submit type=submit name=action value="|
2463 . $locale->text('Add') . qq|">|;
2465 if ($form->{menubar}) {
2466 require "$form->{path}/menu.pl";
2478 $lxdebug->leave_sub();
2481 sub payment_header {
2482 $lxdebug->enter_sub();
2484 $form->{title} = $locale->text("$form->{title} Payment Terms");
2486 # $locale->text('Add Payment Terms')
2487 # $locale->text('Edit Payment Terms')
2489 $form->{description} =~ s/\"/"/g;
2498 <form method=post action=$form->{script}>
2500 <input type=hidden name=id value=$form->{id}>
2501 <input type=hidden name=type value=payment>
2505 <th class=listtop colspan=2>$form->{title}</th>
2507 <tr height="5"></tr>
2509 <th align=right>| . $locale->text('Description') . qq|</th>
2510 <td><input name=description size=30 value="$form->{description}"></td>
2513 <th align=right>| . $locale->text('Long Description') . qq|</th>
2514 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2517 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2518 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2521 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2522 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2525 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2526 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2528 <td colspan=2><hr size=3 noshade></td>
2533 $lxdebug->leave_sub();
2537 $lxdebug->enter_sub();
2539 $form->isblank("description", $locale->text('Language missing!'));
2540 AM->save_payment(\%myconfig, \%$form);
2541 $form->redirect($locale->text('Payment Terms saved!'));
2543 $lxdebug->leave_sub();
2546 sub delete_payment {
2547 $lxdebug->enter_sub();
2549 AM->delete_payment(\%myconfig, \%$form);
2550 $form->redirect($locale->text('Payment terms deleted!'));
2552 $lxdebug->leave_sub();
2556 $lxdebug->enter_sub();
2558 $form->{title} = "Add";
2561 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2562 unless $form->{callback};
2567 $lxdebug->leave_sub();
2571 $lxdebug->enter_sub();
2573 $form->{title} = "Edit";
2575 AM->get_sic(\%myconfig, \%$form);
2579 $form->{orphaned} = 1;
2582 $lxdebug->leave_sub();
2586 $lxdebug->enter_sub();
2588 AM->sic(\%myconfig, \%$form);
2591 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2593 $callback = $form->escape($form->{callback});
2595 $form->{title} = $locale->text('Standard Industrial Codes');
2597 @column_index = qw(code description);
2599 $column_header{code} =
2600 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
2601 $column_header{description} =
2602 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
2611 <th class=listtop>$form->{title}</th>
2613 <tr height="5"></tr>
2617 <tr class=listheading>
2620 map { print "$column_header{$_}\n" } @column_index;
2626 foreach $ref (@{ $form->{ALL} }) {
2631 if ($ref->{sictype} eq 'H') {
2633 <tr valign=top class=listheading>
2635 $column_data{code} =
2636 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>|;
2637 $column_data{description} = qq|<th>$ref->{description}</th>|;
2641 <tr valign=top class=listrow$i>
2644 $column_data{code} =
2645 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>|;
2646 $column_data{description} = qq|<td>$ref->{description}</td>|;
2650 map { print "$column_data{$_}\n" } @column_index;
2662 <td><hr size=3 noshade></td>
2667 <form method=post action=$form->{script}>
2669 <input name=callback type=hidden value="$form->{callback}">
2671 <input type=hidden name=type value=sic>
2673 <input type=hidden name=path value=$form->{path}>
2674 <input type=hidden name=login value=$form->{login}>
2675 <input type=hidden name=password value=$form->{password}>
2677 <input class=submit type=submit name=action value="|
2678 . $locale->text('Add') . qq|">|;
2680 if ($form->{menubar}) {
2681 require "$form->{path}/menu.pl";
2692 $lxdebug->leave_sub();
2696 $lxdebug->enter_sub();
2698 $form->{title} = $locale->text("$form->{title} SIC");
2700 # $locale->text('Add SIC')
2701 # $locale->text('Edit SIC')
2703 $form->{code} =~ s/\"/"/g;
2704 $form->{description} =~ s/\"/"/g;
2706 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
2713 <form method=post action=$form->{script}>
2715 <input type=hidden name=type value=sic>
2716 <input type=hidden name=id value=$form->{code}>
2720 <th class=listtop colspan=2>$form->{title}</th>
2722 <tr height="5"></tr>
2724 <th align=right>| . $locale->text('Code') . qq|</th>
2725 <td><input name=code size=10 value=$form->{code}></td>
2729 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
2730 . $locale->text('Heading') . qq|</th>
2733 <th align=right>| . $locale->text('Description') . qq|</th>
2734 <td><input name=description size=60 value="$form->{description}"></td>
2736 <td colspan=2><hr size=3 noshade></td>
2741 $lxdebug->leave_sub();
2745 $lxdebug->enter_sub();
2747 $form->isblank("code", $locale->text('Code missing!'));
2748 $form->isblank("description", $locale->text('Description missing!'));
2749 AM->save_sic(\%myconfig, \%$form);
2750 $form->redirect($locale->text('SIC saved!'));
2752 $lxdebug->leave_sub();
2756 $lxdebug->enter_sub();
2758 AM->delete_sic(\%myconfig, \%$form);
2759 $form->redirect($locale->text('SIC deleted!'));
2761 $lxdebug->leave_sub();
2764 sub display_stylesheet {
2765 $lxdebug->enter_sub();
2767 $form->{file} = "css/$myconfig{stylesheet}";
2770 $lxdebug->leave_sub();
2774 $lxdebug->enter_sub();
2776 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2777 $form->{file} =~ s/^\/*//g;
2778 $form->{file} =~ s/$userspath//;
2780 $form->error("$!: $form->{file}") unless -f $form->{file};
2782 AM->load_template(\%$form);
2784 $form->{title} = $form->{file};
2786 # if it is anything but html
2787 if ($form->{file} !~ /\.html$/) {
2788 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2798 <form method=post action=$form->{script}>
2800 <input name=file type=hidden value=$form->{file}>
2801 <input name=type type=hidden value=template>
2803 <input type=hidden name=path value=$form->{path}>
2804 <input type=hidden name=login value=$form->{login}>
2805 <input type=hidden name=password value=$form->{password}>
2807 <input name=action type=submit class=submit value="|
2808 . $locale->text('Edit') . qq|">|;
2810 if ($form->{menubar}) {
2811 require "$form->{path}/menu.pl";
2822 $lxdebug->leave_sub();
2826 $lxdebug->enter_sub();
2828 AM->load_template(\%$form);
2830 $form->{title} = $locale->text('Edit Template');
2832 # convert   to &nbsp;
2833 $form->{body} =~ s/ /&nbsp;/gi;
2840 <form method=post action=$form->{script}>
2842 <input name=file type=hidden value=$form->{file}>
2843 <input name=type type=hidden value=template>
2845 <input type=hidden name=path value=$form->{path}>
2846 <input type=hidden name=login value=$form->{login}>
2847 <input type=hidden name=password value=$form->{password}>
2849 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
2851 <textarea name=body rows=25 cols=70>
2856 <input type=submit class=submit name=action value="|
2857 . $locale->text('Save') . qq|">|;
2859 if ($form->{menubar}) {
2860 require "$form->{path}/menu.pl";
2872 $lxdebug->leave_sub();
2876 $lxdebug->enter_sub();
2878 AM->save_template(\%$form);
2879 $form->redirect($locale->text('Template saved!'));
2881 $lxdebug->leave_sub();
2885 $lxdebug->enter_sub();
2887 # get defaults for account numbers and last numbers
2888 AM->defaultaccounts(\%myconfig, \%$form);
2890 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2892 ($item eq $myconfig{dateformat})
2893 ? "<option selected>$item\n"
2894 : "<option>$item\n";
2897 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2899 ($item eq $myconfig{numberformat})
2900 ? "<option selected>$item\n"
2901 : "<option>$item\n";
2904 foreach $item (qw(name company address signature)) {
2905 $myconfig{$item} =~ s/\"/"/g;
2908 foreach $item (qw(address signature)) {
2909 $myconfig{$item} =~ s/\\n/\r\n/g;
2913 if ($opendocument_templates && $openofficeorg_writer_bin &&
2914 $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
2915 push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
2916 "value" => "opendocument_pdf" });
2918 if ($latex_templates) {
2919 push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
2921 push(@formats, { "name" => "HTML", "value" => "html" });
2922 if ($latex_templates) {
2923 push(@formats, { "name" => $locale->text("Postscript"),
2924 "value" => "postscript" });
2926 if ($opendocument_templates) {
2927 push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
2928 "value" => "opendocument" });
2931 if (!$myconfig{"template_format"}) {
2932 $myconfig{"template_format"} = "pdf";
2934 $template_format = "";
2935 foreach $item (@formats) {
2937 "<option value=\"$item->{value}\"" .
2938 ($item->{"value"} eq $myconfig{"template_format"} ?
2940 ">" . H($item->{"name"}) . "</option>";
2943 %countrycodes = User->country_codes;
2945 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2949 ($myconfig{countrycode} eq $key)
2950 ? "<option selected value=$key>$countrycodes{$key}\n"
2951 : "<option value=$key>$countrycodes{$key}\n";
2953 $countrycodes = "<option>American English\n$countrycodes";
2955 # use an other input number format than output numberformat
2956 # look at Form.pm, sub parse_amount
2957 my $in_numberformat = '';
2958 $text1 = qq|value="0">| . $locale->text('equal Outputformat');
2959 $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
2960 @in_nf = ($text1, $text2);
2961 foreach $item (@in_nf) {
2963 (substr($item, 7, 1) eq $myconfig{in_numberformat})
2964 ? "<option selected $item\n"
2965 : "<option $item\n";
2968 foreach $key (keys %{ $form->{IC} }) {
2969 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2971 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2972 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2973 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2977 opendir CSS, "css/.";
2978 @all = grep /.*\.css$/, readdir CSS;
2981 foreach $item (@all) {
2982 if ($item eq $myconfig{stylesheet}) {
2983 $selectstylesheet .= qq|<option selected>$item\n|;
2985 $selectstylesheet .= qq|<option>$item\n|;
2988 $selectstylesheet .= "<option>\n";
2990 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2994 if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
2995 else { $newS = "checked"; }
3000 <form method=post action=$form->{script}>
3002 <input type=hidden name=old_password value=$myconfig{password}>
3003 <input type=hidden name=type value=preferences>
3004 <input type=hidden name=role value=$myconfig{role}>
3007 <tr><th class=listtop>$form->{title}</th></tr>
3012 <th align=right>| . $locale->text('Name') . qq|</th>
3013 <td><input name=name size=15 value="$myconfig{name}"></td>
3016 <th align=right>| . $locale->text('Password') . qq|</th>
3017 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
3020 <th align=right>| . $locale->text('E-mail') . qq|</th>
3021 <td><input name=email size=30 value="$myconfig{email}"></td>
3024 <th align=right>| . $locale->text('Signature') . qq|</th>
3025 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
3028 <th align=right>| . $locale->text('Phone') . qq|</th>
3029 <td><input name=tel size=14 value="$myconfig{tel}"></td>
3032 <th align=right>| . $locale->text('Fax') . qq|</th>
3033 <td><input name=fax size=14 value="$myconfig{fax}"></td>
3036 <th align=right>| . $locale->text('Company') . qq|</th>
3037 <td><input name=company size=30 value="$myconfig{company}"></td>
3040 <th align=right>| . $locale->text('Address') . qq|</th>
3041 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
3044 <th align=right>| . $locale->text('Date Format') . qq|</th>
3045 <td><select name=dateformat>$dateformat</select></td>
3048 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
3049 <td><select name=numberformat>$numberformat</select></td>
3052 <th align=right>| . $locale->text('Input Number Format') . qq|</th>
3053 <td><select name=in_numberformat>$in_numberformat</select></td>
3057 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
3058 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
3061 <th align=right>| . $locale->text('Language') . qq|</th>
3062 <td><select name=countrycode>$countrycodes</select></td>
3065 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
3066 <td><select name=usestylesheet>$selectstylesheet</select></td>
3069 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
3070 <td><input name=menustyle type=radio class=radio value=neu $newS> New
3071 <input name=menustyle type=radio class=radio value=old $oldS> Old</td>
3073 <input name=printer type=hidden value="$myconfig{printer}">
3074 <tr class=listheading>
3075 <th colspan=2>| . $locale->text("Print options") . qq|</th>
3078 <th align=right>| . $locale->text('Default template format') . qq|</th>
3079 <td><select name="template_format">$template_format</select></td>
3082 <th align=right>| . $locale->text('Number of copies') . qq|</th>
3083 <td><input name="copies" size="10" value="| .
3084 $form->quote($myconfig{"copies"}) . qq|"></td>
3088 <tr class=listheading>
3089 <th colspan=2> </th>
3092 <th align=right>| . $locale->text('Business Number') . qq|</th>
3093 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
3099 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
3100 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
3101 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
3102 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
3107 <tr class=listheading>
3109 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
3115 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
3116 <td><select name=inventory_accno>$myconfig{IC}</select></td>
3119 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
3120 <td><select name=income_accno>$myconfig{IC_income}</select></td>
3123 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
3124 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
3127 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
3128 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
3131 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
3132 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
3137 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
3139 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
3148 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
3149 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
3150 <th align=right nowrap>|
3151 . $locale->text('Last Customer Number') . qq|</th>
3152 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
3155 <th align=right nowrap>|
3156 . $locale->text('Last Credit Note Number') . qq|</th>
3157 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
3158 <th align=right nowrap>|
3159 . $locale->text('Last Vendor Number') . qq|</th>
3160 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
3163 <th align=right nowrap>|
3164 . $locale->text('Last Sales Order Number') . qq|</th>
3165 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
3168 <th align=right nowrap>|
3169 . $locale->text('Last Purchase Order Number') . qq|</th>
3170 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
3171 <th align=right nowrap>|
3172 . $locale->text('Last Article Number') . qq|</th>
3173 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
3176 <th align=right nowrap>|
3177 . $locale->text('Last Sales Quotation Number') . qq|</th>
3178 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
3179 <th align=right nowrap>|
3180 . $locale->text('Last Service Number') . qq|</th>
3181 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
3184 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
3185 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
3186 <th align=right nowrap></th>
3192 # <tr class=listheading>
3193 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3200 # <th>| . $locale->text('Rate') . qq| (%)</th>
3201 # <th>| . $locale->text('Number') . qq|</th>
3205 # foreach $accno (sort keys %{ $form->{taxrates} }) {
3208 # <th align=right>$form->{taxrates}{$accno}{description}</th>
3209 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3210 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3213 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3216 # chop $form->{taxaccounts};
3219 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3228 <td><hr size=3 noshade></td>
3232 <input type=hidden name=path value=$form->{path}>
3233 <input type=hidden name=login value=$form->{login}>
3234 <input type=hidden name=password value=$form->{password}>
3237 <input type=submit class=submit name=action value="|
3238 . $locale->text('Save') . qq|">|;
3240 if ($form->{menubar}) {
3241 require "$form->{path}/menu.pl";
3252 $lxdebug->leave_sub();
3255 sub save_preferences {
3256 $lxdebug->enter_sub();
3258 $form->{stylesheet} = $form->{usestylesheet};
3260 $form->redirect($locale->text('Preferences saved!'))
3262 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3264 $form->error($locale->text('Cannot save preferences!'));
3266 $lxdebug->leave_sub();
3270 $lxdebug->enter_sub();
3272 if ($form->{media} eq 'email') {
3273 $form->error($locale->text('No email address for') . " $myconfig{name}")
3274 unless ($myconfig{email});
3276 $form->{OUT} = "$sendmail";
3280 AM->backup(\%myconfig, \%$form, $userspath);
3282 if ($form->{media} eq 'email') {
3283 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
3286 $lxdebug->leave_sub();
3290 $lxdebug->enter_sub();
3292 $form->{title} = $locale->text('Audit Control');
3294 AM->closedto(\%myconfig, \%$form);
3296 if ($form->{revtrans}) {
3297 $checked{Y} = "checked";
3299 $checked{N} = "checked";
3307 <form method=post action=$form->{script}>
3309 <input type=hidden name=path value=$form->{path}>
3310 <input type=hidden name=login value=$form->{login}>
3311 <input type=hidden name=password value=$form->{password}>
3314 <tr><th class=listtop>$form->{title}</th></tr>
3315 <tr height="5"></tr>
3321 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3322 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3323 . $locale->text('Yes')
3324 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3325 . $locale->text('No')
3329 <th>| . $locale->text('Close Books up to') . qq|</th>
3330 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3340 <input type=hidden name=nextsub value=doclose>
3342 <input type=submit class=submit name=action value="|
3343 . $locale->text('Continue') . qq|">
3351 $lxdebug->leave_sub();
3355 $lxdebug->enter_sub();
3357 AM->closebooks(\%myconfig, \%$form);
3359 if ($form->{revtrans}) {
3361 $locale->text('Transaction reversal enforced for all dates'));
3363 if ($form->{closedto}) {
3365 $locale->text('Transaction reversal enforced up to') . " "
3366 . $locale->date(\%myconfig, $form->{closedto}, 1));
3368 $form->redirect($locale->text('Books are open'));
3372 $lxdebug->leave_sub();
3376 $lxdebug->enter_sub();
3378 $form->{title} = "Add";
3381 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
3382 unless $form->{callback};
3387 $lxdebug->leave_sub();
3390 sub edit_warehouse {
3391 $lxdebug->enter_sub();
3393 $form->{title} = "Edit";
3395 AM->get_warehouse(\%myconfig, \%$form);
3400 $lxdebug->leave_sub();
3403 sub list_warehouse {
3404 $lxdebug->enter_sub();
3406 AM->warehouses(\%myconfig, \%$form);
3409 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
3411 $callback = $form->escape($form->{callback});
3413 $form->{title} = $locale->text('Warehouses');
3415 @column_index = qw(description);
3417 $column_header{description} =
3418 qq|<th class=listheading width=100%>|
3419 . $locale->text('Description')
3429 <th class=listtop>$form->{title}</th>
3431 <tr height="5"></tr>
3435 <tr class=listheading>
3438 map { print "$column_header{$_}\n" } @column_index;
3444 foreach $ref (@{ $form->{ALL} }) {
3450 <tr valign=top class=listrow$i>
3453 $column_data{description} =
3454 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>|;
3456 map { print "$column_data{$_}\n" } @column_index;
3468 <td><hr size=3 noshade></td>
3473 <form method=post action=$form->{script}>
3475 <input name=callback type=hidden value="$form->{callback}">
3477 <input type=hidden name=type value=warehouse>
3479 <input type=hidden name=path value=$form->{path}>
3480 <input type=hidden name=login value=$form->{login}>
3481 <input type=hidden name=password value=$form->{password}>
3483 <input class=submit type=submit name=action value="|
3484 . $locale->text('Add') . qq|">|;
3486 if ($form->{menubar}) {
3487 require "$form->{path}/menu.pl";
3498 $lxdebug->leave_sub();
3501 sub warehouse_header {
3502 $lxdebug->enter_sub();
3504 $form->{title} = $locale->text("$form->{title} Warehouse");
3506 # $locale->text('Add Warehouse')
3507 # $locale->text('Edit Warehouse')
3509 $form->{description} =~ s/\"/"/g;
3511 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
3513 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
3516 qq|<input name=description size=60 value="$form->{description}">|;
3524 <form method=post action=$form->{script}>
3526 <input type=hidden name=id value=$form->{id}>
3527 <input type=hidden name=type value=warehouse>
3531 <th class=listtop colspan=2>$form->{title}</th>
3533 <tr height="5"></tr>
3535 <th align=right>| . $locale->text('Description') . qq|</th>
3536 <td>$description</td>
3539 <td colspan=2><hr size=3 noshade></td>
3544 $lxdebug->leave_sub();
3547 sub save_warehouse {
3548 $lxdebug->enter_sub();
3550 $form->isblank("description", $locale->text('Description missing!'));
3551 AM->save_warehouse(\%myconfig, \%$form);
3552 $form->redirect($locale->text('Warehouse saved!'));
3554 $lxdebug->leave_sub();
3557 sub delete_warehouse {
3558 $lxdebug->enter_sub();
3560 AM->delete_warehouse(\%myconfig, \%$form);
3561 $form->redirect($locale->text('Warehouse deleted!'));
3563 $lxdebug->leave_sub();
3567 $lxdebug->enter_sub();
3569 &{ $form->{nextsub} };
3571 $lxdebug->leave_sub();
3575 $lxdebug->enter_sub();
3577 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3578 AM->units_in_use(\%myconfig, $form, $units);
3579 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3581 @languages = AM->language(\%myconfig, $form, 1);
3584 foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3585 map({ push(@unit_list, $units->{$_}); }
3586 sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3587 grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3590 foreach (@unit_list) {
3591 $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"});
3592 $_->{"UNITLANGUAGES"} = [];
3593 foreach my $lang (@languages) {
3594 push(@{ $_->{"UNITLANGUAGES"} },
3596 "unit" => $_->{"name"},
3597 "language_id" => $lang->{"id"},
3598 "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
3599 "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
3605 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3606 $ddbox = AM->unit_select_data($units, undef, 1);
3608 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3610 print($form->parse_html_template("am/edit_units",
3611 { "UNITS" => \@unit_list,
3612 "NEW_BASE_UNIT_DDBOX" => $ddbox,
3613 "LANGUAGES" => \@languages }));
3615 $lxdebug->leave_sub();
3619 $lxdebug->enter_sub();
3621 $form->isblank("new_name", $locale->text("The name is missing."));
3622 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3623 $all_units = AM->retrieve_units(\%myconfig, $form);
3624 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
3626 my ($base_unit, $factor);
3627 if ($form->{"new_base_unit"}) {
3628 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3630 $form->isblank("new_factor", $locale->text("The factor is missing."));
3631 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3632 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3633 $base_unit = $form->{"new_base_unit"};
3637 foreach my $lang (AM->language(\%myconfig, $form, 1)) {
3638 next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
3639 push(@languages, { "id" => $lang->{"id"},
3640 "localized" => $form->{"new_localized_$lang->{id}"},
3641 "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
3645 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
3647 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3651 $lxdebug->leave_sub();
3654 sub set_unit_languages {
3655 $lxdebug->enter_sub();
3657 my ($unit, $languages, $idx) = @_;
3659 $unit->{"LANGUAGES"} = [];
3661 foreach my $lang (@{$languages}) {
3662 push(@{ $unit->{"LANGUAGES"} },
3663 { "id" => $lang->{"id"},
3664 "localized" => $form->{"localized_${idx}_$lang->{id}"},
3665 "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
3669 $lxdebug->leave_sub();
3673 $lxdebug->enter_sub();
3675 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3676 AM->units_in_use(\%myconfig, $form, $old_units);
3678 @languages = AM->language(\%myconfig, $form, 1);
3682 foreach $i (1..($form->{"rowcount"} * 1)) {
3683 $old_unit = $old_units->{$form->{"old_name_$i"}};
3685 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3688 if ($form->{"unchangeable_$i"}) {
3689 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3690 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3691 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3695 if ($old_unit->{"in_use"}) {
3696 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3699 if ($form->{"delete_$i"}) {
3700 push(@delete_units, $old_unit->{"name"});
3704 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3706 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3707 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3708 $new_units->{$form->{"name_$i"}} = \%h;
3709 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3710 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3713 foreach $unit (values(%{$new_units})) {
3714 next unless ($unit->{"old_name"});
3715 if ($unit->{"base_unit"}) {
3716 $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"}))
3717 unless (defined($new_units->{$unit->{"base_unit"}}));
3718 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3719 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3721 $unit->{"base_unit"} = undef;
3722 $unit->{"factor"} = undef;
3726 foreach $unit (values(%{$new_units})) {
3727 next if ($unit->{"unchanged_unit"});
3729 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3731 while ($new_unit->{"base_unit"}) {
3732 $new_unit->{"seen"} = 1;
3733 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3734 if ($new_unit->{"seen"}) {
3735 $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, " .
3736 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3741 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3743 $form->{"saved_message"} = $locale->text("The units have been saved.");
3747 $lxdebug->leave_sub();