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|">|;
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|">|;
830 $lxdebug->leave_sub();
834 $lxdebug->enter_sub();
836 $form->isblank("accno", $locale->text('GIFI missing!'));
837 AM->save_gifi(\%myconfig, \%$form);
838 $form->redirect($locale->text('GIFI saved!'));
840 $lxdebug->leave_sub();
844 $lxdebug->enter_sub();
846 $form->isblank("accno", $locale->text('GIFI missing!'));
848 AM->save_gifi(\%myconfig, \%$form);
851 $form->{gifi_accno} = $form->{accno};
852 $form->{title} = "Add";
853 $form->{charttype} = "A";
858 $lxdebug->leave_sub();
862 $lxdebug->enter_sub();
864 AM->delete_gifi(\%myconfig, \%$form);
865 $form->redirect($locale->text('GIFI deleted!'));
867 $lxdebug->leave_sub();
871 $lxdebug->enter_sub();
873 $form->{title} = "Add";
877 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
878 unless $form->{callback};
883 $lxdebug->leave_sub();
886 sub edit_department {
887 $lxdebug->enter_sub();
889 $form->{title} = "Edit";
891 AM->get_department(\%myconfig, \%$form);
896 $lxdebug->leave_sub();
899 sub list_department {
900 $lxdebug->enter_sub();
902 AM->departments(\%myconfig, \%$form);
905 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
907 $callback = $form->escape($form->{callback});
909 $form->{title} = $locale->text('Departments');
911 @column_index = qw(description cost profit);
913 $column_header{description} =
914 qq|<th class=listheading width=90%>|
915 . $locale->text('Description')
917 $column_header{cost} =
918 qq|<th class=listheading nowrap>|
919 . $locale->text('Cost Center')
921 $column_header{profit} =
922 qq|<th class=listheading nowrap>|
923 . $locale->text('Profit Center')
933 <th class=listtop>$form->{title}</th>
939 <tr class=listheading>
942 map { print "$column_header{$_}\n" } @column_index;
948 foreach $ref (@{ $form->{ALL} }) {
954 <tr valign=top class=listrow$i>
957 $costcenter = ($ref->{role} eq "C") ? "X" : "";
958 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
960 $column_data{description} =
961 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>|;
962 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
963 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
965 map { print "$column_data{$_}\n" } @column_index;
977 <td><hr size=3 noshade></td>
982 <form method=post action=$form->{script}>
984 <input name=callback type=hidden value="$form->{callback}">
986 <input type=hidden name=type value=department>
988 <input type=hidden name=path value=$form->{path}>
989 <input type=hidden name=login value=$form->{login}>
990 <input type=hidden name=password value=$form->{password}>
992 <input class=submit type=submit name=action value="|
993 . $locale->text('Add') . qq|">
1001 $lxdebug->leave_sub();
1004 sub department_header {
1005 $lxdebug->enter_sub();
1007 $form->{title} = $locale->text("$form->{title} Department");
1009 # $locale->text('Add Department')
1010 # $locale->text('Edit Department')
1012 $form->{description} =~ s/\"/"/g;
1014 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
1016 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
1019 qq|<input name=description size=60 value="$form->{description}">|;
1022 $costcenter = "checked" if $form->{role} eq "C";
1023 $profitcenter = "checked" if $form->{role} eq "P";
1030 <form method=post action=$form->{script}>
1032 <input type=hidden name=id value=$form->{id}>
1033 <input type=hidden name=type value=department>
1037 <th class=listtop colspan=2>$form->{title}</th>
1039 <tr height="5"></tr>
1041 <th align=right>| . $locale->text('Description') . qq|</th>
1042 <td>$description</td>
1046 <td><input type=radio style=radio name=role value="C" $costcenter> |
1047 . $locale->text('Cost Center') . qq|
1048 <input type=radio style=radio name=role value="P" $profitcenter> |
1049 . $locale->text('Profit Center') . qq|
1052 <td colspan=2><hr size=3 noshade></td>
1057 $lxdebug->leave_sub();
1060 sub save_department {
1061 $lxdebug->enter_sub();
1063 $form->isblank("description", $locale->text('Description missing!'));
1064 AM->save_department(\%myconfig, \%$form);
1065 $form->redirect($locale->text('Department saved!'));
1067 $lxdebug->leave_sub();
1070 sub delete_department {
1071 $lxdebug->enter_sub();
1073 AM->delete_department(\%myconfig, \%$form);
1074 $form->redirect($locale->text('Department deleted!'));
1076 $lxdebug->leave_sub();
1080 $lxdebug->enter_sub();
1082 $form->{title} = "Add";
1085 "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1086 unless $form->{callback};
1091 $lxdebug->leave_sub();
1095 $lxdebug->enter_sub();
1097 $form->{title} = "Edit";
1099 AM->get_lead(\%myconfig, \%$form);
1103 $form->{orphaned} = 1;
1106 $lxdebug->leave_sub();
1110 $lxdebug->enter_sub();
1112 AM->lead(\%myconfig, \%$form);
1115 "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1117 $callback = $form->escape($form->{callback});
1119 $form->{title} = $locale->text('Lead');
1121 @column_index = qw(description cost profit);
1123 $column_header{description} =
1124 qq|<th class=listheading width=100%>|
1125 . $locale->text('Description')
1135 <th class=listtop>$form->{title}</th>
1137 <tr height="5"></tr>
1138 <tr class=listheading>
1141 map { print "$column_header{$_}\n" } @column_index;
1147 foreach $ref (@{ $form->{ALL} }) {
1153 <tr valign=top class=listrow$i>
1156 $lead = $ref->{lead};
1158 $column_data{description} =
1159 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>|;
1161 map { print "$column_data{$_}\n" } @column_index;
1170 <td><hr size=3 noshade></td>
1175 <form method=post action=$form->{script}>
1177 <input name=callback type=hidden value="$form->{callback}">
1179 <input type=hidden name=type value=lead>
1181 <input type=hidden name=path value=$form->{path}>
1182 <input type=hidden name=login value=$form->{login}>
1183 <input type=hidden name=password value=$form->{password}>
1185 <input class=submit type=submit name=action value="|
1186 . $locale->text('Add') . qq|">
1194 $lxdebug->leave_sub();
1198 $lxdebug->enter_sub();
1200 $form->{title} = $locale->text("$form->{title} Lead");
1202 # $locale->text('Add Lead')
1203 # $locale->text('Edit Lead')
1205 $form->{description} =~ s/\"/"/g;
1208 qq|<input name=description size=50 value="$form->{lead}">|;
1215 <form method=post action=$form->{script}>
1217 <input type=hidden name=id value=$form->{id}>
1218 <input type=hidden name=type value=lead>
1222 <th class=listtop colspan=2>$form->{title}</th>
1224 <tr height="5"></tr>
1226 <th align=right>| . $locale->text('Description') . qq|</th>
1227 <td>$description</td>
1229 <td colspan=2><hr size=3 noshade></td>
1234 $lxdebug->leave_sub();
1238 $lxdebug->enter_sub();
1240 $form->isblank("description", $locale->text('Description missing!'));
1241 AM->save_lead(\%myconfig, \%$form);
1242 $form->redirect($locale->text('lead saved!'));
1244 $lxdebug->leave_sub();
1248 $lxdebug->enter_sub();
1250 AM->delete_lead(\%myconfig, \%$form);
1251 $form->redirect($locale->text('lead deleted!'));
1253 $lxdebug->leave_sub();
1257 $lxdebug->enter_sub();
1259 $form->{title} = "Add";
1262 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1263 unless $form->{callback};
1268 $lxdebug->leave_sub();
1272 $lxdebug->enter_sub();
1274 $form->{title} = "Edit";
1276 AM->get_business(\%myconfig, \%$form);
1280 $form->{orphaned} = 1;
1283 $lxdebug->leave_sub();
1287 $lxdebug->enter_sub();
1289 AM->business(\%myconfig, \%$form);
1292 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1294 $callback = $form->escape($form->{callback});
1296 $form->{title} = $locale->text('Type of Business');
1298 @column_index = qw(description discount customernumberinit);
1300 $column_header{description} =
1301 qq|<th class=listheading width=60%>|
1302 . $locale->text('Description')
1304 $column_header{discount} =
1305 qq|<th class=listheading width=10%>|
1306 . $locale->text('Discount')
1308 $column_header{customernumberinit} =
1309 qq|<th class=listheading>|
1310 . $locale->text('Customernumberinit')
1320 <th class=listtop>$form->{title}</th>
1322 <tr height="5"></tr>
1326 <tr class=listheading>
1329 map { print "$column_header{$_}\n" } @column_index;
1335 foreach $ref (@{ $form->{ALL} }) {
1341 <tr valign=top class=listrow$i>
1345 $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
1348 ? "<b>$ref->{description}</b>"
1349 : "$ref->{description}";
1350 $column_data{description} =
1351 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>|;
1352 $column_data{discount} = qq|<td align=right>$discount</td>|;
1353 $column_data{customernumberinit} =
1354 qq|<td align=right>$ref->{customernumberinit}</td>|;
1356 map { print "$column_data{$_}\n" } @column_index;
1368 <td><hr size=3 noshade></td>
1373 <form method=post action=$form->{script}>
1375 <input name=callback type=hidden value="$form->{callback}">
1377 <input type=hidden name=type value=business>
1379 <input type=hidden name=path value=$form->{path}>
1380 <input type=hidden name=login value=$form->{login}>
1381 <input type=hidden name=password value=$form->{password}>
1383 <input class=submit type=submit name=action value="|
1384 . $locale->text('Add') . qq|">
1392 $lxdebug->leave_sub();
1395 sub business_header {
1396 $lxdebug->enter_sub();
1398 $form->{title} = $locale->text("$form->{title} Business");
1399 $form->{salesman} = "checked" if $form->{salesman};
1401 # $locale->text('Add Business')
1402 # $locale->text('Edit Business')
1404 $form->{description} =~ s/\"/"/g;
1406 $form->format_amount(\%myconfig, $form->{discount} * 100);
1413 <form method=post action=$form->{script}>
1415 <input type=hidden name=id value=$form->{id}>
1416 <input type=hidden name=type value=business>
1420 <th class=listtop colspan=2>$form->{title}</th>
1422 <tr height="5"></tr>
1424 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1425 <td><input name=description size=30 value="$form->{description}"></td>
1428 <th align=right>| . $locale->text('Discount') . qq| %</th>
1429 <td><input name=discount size=5 value=$form->{discount}></td>
1432 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1433 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1436 <td align=right>| . $locale->text('Salesman') . qq|</td>
1437 <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
1439 <td colspan=2><hr size=3 noshade></td>
1444 $lxdebug->leave_sub();
1448 $lxdebug->enter_sub();
1450 $form->isblank("description", $locale->text('Description missing!'));
1451 AM->save_business(\%myconfig, \%$form);
1452 $form->redirect($locale->text('Business saved!'));
1454 $lxdebug->leave_sub();
1457 sub delete_business {
1458 $lxdebug->enter_sub();
1460 AM->delete_business(\%myconfig, \%$form);
1461 $form->redirect($locale->text('Business deleted!'));
1463 $lxdebug->leave_sub();
1467 $lxdebug->enter_sub();
1469 $form->{title} = "Add";
1472 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1473 unless $form->{callback};
1478 $lxdebug->leave_sub();
1482 $lxdebug->enter_sub();
1484 $form->{title} = "Edit";
1486 AM->get_language(\%myconfig, \%$form);
1490 $form->{orphaned} = 1;
1493 $lxdebug->leave_sub();
1497 $lxdebug->enter_sub();
1499 AM->language(\%myconfig, \%$form);
1502 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1504 $callback = $form->escape($form->{callback});
1506 $form->{title} = $locale->text('Languages');
1508 @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
1510 $column_header{description} =
1511 qq|<th class=listheading width=60%>|
1512 . $locale->text('Description')
1514 $column_header{template_code} =
1515 qq|<th class=listheading width=10%>|
1516 . $locale->text('Template Code')
1518 $column_header{article_code} =
1519 qq|<th class=listheading>|
1520 . $locale->text('Article Code')
1522 $column_header{output_numberformat} =
1523 qq|<th class=listheading>|
1524 . $locale->text('Number Format')
1526 $column_header{output_dateformat} =
1527 qq|<th class=listheading>|
1528 . $locale->text('Date Format')
1530 $column_header{output_longdates} =
1531 qq|<th class=listheading>|
1532 . $locale->text('Long Dates')
1542 <th class=listtop>$form->{title}</th>
1544 <tr height="5"></tr>
1548 <tr class=listheading>
1551 map { print "$column_header{$_}\n" } @column_index;
1557 foreach $ref (@{ $form->{ALL} }) {
1563 <tr valign=top class=listrow$i>
1567 $column_data{description} =
1568 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>|;
1569 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1570 $column_data{article_code} =
1571 qq|<td align=right>$ref->{article_code}</td>|;
1572 $column_data{output_numberformat} =
1574 ($ref->{output_numberformat} ? $ref->{output_numberformat} :
1575 $locale->text("use program settings")) .
1577 $column_data{output_dateformat} =
1579 ($ref->{output_dateformat} ? $ref->{output_dateformat} :
1580 $locale->text("use program settings")) .
1582 $column_data{output_longdates} =
1584 ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
1587 map { print "$column_data{$_}\n" } @column_index;
1599 <td><hr size=3 noshade></td>
1604 <form method=post action=$form->{script}>
1606 <input name=callback type=hidden value="$form->{callback}">
1608 <input type=hidden name=type value=language>
1610 <input type=hidden name=path value=$form->{path}>
1611 <input type=hidden name=login value=$form->{login}>
1612 <input type=hidden name=password value=$form->{password}>
1614 <input class=submit type=submit name=action value="|
1615 . $locale->text('Add') . qq|">
1623 $lxdebug->leave_sub();
1626 sub language_header {
1627 $lxdebug->enter_sub();
1629 $form->{title} = $locale->text("$form->{title} Language");
1631 # $locale->text('Add Language')
1632 # $locale->text('Edit Language')
1634 $form->{description} =~ s/\"/"/g;
1635 $form->{template_code} =~ s/\"/"/g;
1636 $form->{article_code} =~ s/\"/"/g;
1642 qq|<option value="">| . $locale->text("use program settings") .
1644 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1646 ($item eq $form->{output_numberformat})
1647 ? "<option selected>$item"
1653 qq|<option value="">| . $locale->text("use program settings") .
1655 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1657 ($item eq $form->{output_dateformat})
1658 ? "<option selected>$item"
1666 <form method=post action=$form->{script}>
1668 <input type=hidden name=id value=$form->{id}>
1669 <input type=hidden name=type value=language>
1673 <th class=listtop colspan=2>$form->{title}</th>
1675 <tr height="5"></tr>
1677 <th align=right>| . $locale->text('Language') . qq|</th>
1678 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1681 <th align=right>| . $locale->text('Template Code') . qq|</th>
1682 <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
1685 <th align=right>| . $locale->text('Article Code') . qq|</th>
1686 <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
1689 <th align=right>| . $locale->text('Number Format') . qq|</th>
1690 <td><select name="output_numberformat">$numberformat</select></td>
1693 <th align=right>| . $locale->text('Date Format') . qq|</th>
1694 <td><select name="output_dateformat">$dateformat</select></td>
1697 <th align=right>| . $locale->text('Long Dates') . qq|</th>
1698 <td><input type="radio" name="output_longdates" value="1"| .
1699 ($form->{output_longdates} ? " checked" : "") .
1700 qq|>| . $locale->text("Yes") .
1701 qq|<input type="radio" name="output_longdates" value="0"| .
1702 ($form->{output_longdates} ? "" : " checked") .
1703 qq|>| . $locale->text("No") .
1706 <td colspan=2><hr size=3 noshade></td>
1711 $lxdebug->leave_sub();
1715 $lxdebug->enter_sub();
1717 $form->isblank("description", $locale->text('Language missing!'));
1718 $form->isblank("template_code", $locale->text('Template Code missing!'));
1719 $form->isblank("article_code", $locale->text('Article Code missing!'));
1720 AM->save_language(\%myconfig, \%$form);
1721 $form->redirect($locale->text('Language saved!'));
1723 $lxdebug->leave_sub();
1726 sub delete_language {
1727 $lxdebug->enter_sub();
1729 AM->delete_language(\%myconfig, \%$form);
1730 $form->redirect($locale->text('Language deleted!'));
1732 $lxdebug->leave_sub();
1736 sub add_buchungsgruppe {
1737 $lxdebug->enter_sub();
1739 # $locale->text("Add Buchungsgruppe")
1740 # $locale->text("Edit Buchungsgruppe")
1741 $form->{title} = "Add";
1744 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1745 unless $form->{callback};
1746 AM->get_buchungsgruppe(\%myconfig, \%$form);
1747 $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
1748 for (my $i = 0; 4 > $i; $i++) {
1749 map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; }
1750 qw(income expense));
1753 &buchungsgruppe_header;
1756 $lxdebug->leave_sub();
1759 sub edit_buchungsgruppe {
1760 $lxdebug->enter_sub();
1762 $form->{title} = "Edit";
1764 AM->get_buchungsgruppe(\%myconfig, \%$form);
1766 &buchungsgruppe_header;
1770 $lxdebug->leave_sub();
1773 sub list_buchungsgruppe {
1774 $lxdebug->enter_sub();
1776 AM->buchungsgruppe(\%myconfig, \%$form);
1779 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1781 $callback = $form->escape($form->{callback});
1783 $form->{title} = $locale->text('Buchungsgruppen');
1785 @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 );
1787 $column_header{description} =
1788 qq|<th class=listheading width=60%>|
1789 . $locale->text('Description')
1791 $column_header{inventory_accno} =
1792 qq|<th class=listheading width=10%>|
1793 . $locale->text('Bestandskonto')
1795 $column_header{income_accno_0} =
1796 qq|<th class=listheading>|
1797 . $locale->text('Erlöse Inland')
1799 $column_header{expense_accno_0} =
1800 qq|<th class=listheading>|
1801 . $locale->text('Aufwand Inland')
1803 $column_header{income_accno_1} =
1804 qq|<th class=listheading>|
1805 . $locale->text('Erlöse EU m. UStId')
1807 $column_header{expense_accno_1} =
1808 qq|<th class=listheading>|
1809 . $locale->text('Aufwand EU m. UStId')
1811 $column_header{income_accno_2} =
1812 qq|<th class=listheading>|
1813 . $locale->text('Erlöse EU o. UStId')
1815 $column_header{expense_accno_2} =
1816 qq|<th class=listheading>|
1817 . $locale->text('Aufwand EU o. UStId')
1819 $column_header{income_accno_3} =
1820 qq|<th class=listheading>|
1821 . $locale->text('Erlöse Ausland')
1823 $column_header{expense_accno_3} =
1824 qq|<th class=listheading>|
1825 . $locale->text('Aufwand Ausland')
1834 <th class=listtop>$form->{title}</th>
1836 <tr height="5"></tr>
1840 <tr class=listheading>
1843 map { print "$column_header{$_}\n" } @column_index;
1849 foreach $ref (@{ $form->{ALL} }) {
1855 <tr valign=top class=listrow$i>
1859 $column_data{description} =
1860 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>|;
1861 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1862 $column_data{income_accno_0} =
1863 qq|<td align=right>$ref->{income_accno_0}</td>|;
1864 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1865 $column_data{income_accno_1} =
1866 qq|<td align=right>$ref->{income_accno_1}</td>|;
1867 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1868 $column_data{income_accno_2} =
1869 qq|<td align=right>$ref->{income_accno_2}</td>|;
1870 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1871 $column_data{income_accno_3} =
1872 qq|<td align=right>$ref->{income_accno_3}</td>|;
1873 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1875 map { print "$column_data{$_}\n" } @column_index;
1887 <td><hr size=3 noshade></td>
1892 <form method=post action=$form->{script}>
1894 <input name=callback type=hidden value="$form->{callback}">
1896 <input type=hidden name=type value=buchungsgruppe>
1898 <input type=hidden name=path value=$form->{path}>
1899 <input type=hidden name=login value=$form->{login}>
1900 <input type=hidden name=password value=$form->{password}>
1902 <input class=submit type=submit name=action value="|
1903 . $locale->text('Add') . qq|">
1911 $lxdebug->leave_sub();
1914 sub buchungsgruppe_header {
1915 $lxdebug->enter_sub();
1917 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1919 # $locale->text('Buchungsgruppe hinzufügen')
1920 # $locale->text('Buchungsgruppe bearbeiten')
1922 my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
1923 my %acc_type_map = (
1924 "IC" => $acc_inventory,
1925 "IC_income" => $acc_income,
1926 "IC_sale" => $acc_income,
1927 "IC_expense" => $acc_expense,
1928 "IC_cogs" => $acc_expense,
1931 foreach $key (keys(%acc_type_map)) {
1932 foreach $ref (@{ $form->{IC_links}{$key} }) {
1933 $acc_type_map{$key}->{$ref->{"id"}} = $ref;
1937 foreach my $type (qw(IC IC_income IC_expense)) {
1938 $form->{"select$type"} =
1940 map({ "<option value=$_->{id} $_->{selected}>" .
1941 "$_->{accno}--" . H($_->{description}) . "</option>" }
1942 sort({ $a->{"accno"} cmp $b->{"accno"} }
1943 values(%{$acc_type_map{$type}}))));
1947 $form->{selectIC} =~ s/selected//g;
1948 $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/;
1949 $form->{selectIC_income} =~ s/selected//g;
1950 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1951 $form->{selectIC_expense} =~ s/selected//g;
1952 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1958 <th align=right>| . $locale->text('Inventory') . qq|</th>
1959 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1960 <input name=selectIC type=hidden value="$form->{selectIC}">
1964 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
1968 $linkaccounts .= qq|
1970 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
1971 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
1974 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
1975 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
1978 $form->{selectIC_income} =~ s/selected//g;
1979 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
1980 $form->{selectIC_expense} =~ s/selected//g;
1981 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
1983 $linkaccounts .= qq| <tr>
1984 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
1985 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
1988 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
1989 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
1993 $form->{selectIC_income} =~ s/selected//g;
1994 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
1995 $form->{selectIC_expense} =~ s/selected//g;
1996 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
1999 $linkaccounts .= qq| <tr>
2000 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
2001 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
2004 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
2005 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
2009 $form->{selectIC_income} =~ s/selected//g;
2010 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
2011 $form->{selectIC_expense} =~ s/selected//g;
2012 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
2015 $linkaccounts .= qq| <tr>
2016 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
2017 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
2020 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
2021 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
2031 <form method=post action=$form->{script}>
2033 <input type=hidden name=id value=$form->{id}>
2034 <input type=hidden name=type value=buchungsgruppe>
2038 <th class=listtop colspan=2>$form->{title}</th>
2040 <tr height="5"></tr>
2042 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
2043 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
2046 <td colspan=2><hr size=3 noshade></td>
2051 $lxdebug->leave_sub();
2054 sub save_buchungsgruppe {
2055 $lxdebug->enter_sub();
2057 $form->isblank("description", $locale->text('Description missing!'));
2059 AM->save_buchungsgruppe(\%myconfig, \%$form);
2060 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
2062 $lxdebug->leave_sub();
2065 sub delete_buchungsgruppe {
2066 $lxdebug->enter_sub();
2068 AM->delete_buchungsgruppe(\%myconfig, \%$form);
2069 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
2071 $lxdebug->leave_sub();
2076 $lxdebug->enter_sub();
2078 $form->{title} = "Add";
2081 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2082 unless $form->{callback};
2087 $lxdebug->leave_sub();
2091 $lxdebug->enter_sub();
2093 $form->{title} = "Edit";
2095 AM->get_printer(\%myconfig, \%$form);
2099 $form->{orphaned} = 1;
2102 $lxdebug->leave_sub();
2106 $lxdebug->enter_sub();
2108 AM->printer(\%myconfig, \%$form);
2111 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2113 $callback = $form->escape($form->{callback});
2115 $form->{title} = $locale->text('Printer');
2117 @column_index = qw(printer_description printer_command template_code);
2119 $column_header{printer_description} =
2120 qq|<th class=listheading width=60%>|
2121 . $locale->text('Printer Description')
2123 $column_header{printer_command} =
2124 qq|<th class=listheading width=10%>|
2125 . $locale->text('Printer Command')
2127 $column_header{template_code} =
2128 qq|<th class=listheading>|
2129 . $locale->text('Template Code')
2139 <th class=listtop>$form->{title}</th>
2141 <tr height="5"></tr>
2145 <tr class=listheading>
2148 map { print "$column_header{$_}\n" } @column_index;
2154 foreach $ref (@{ $form->{ALL} }) {
2160 <tr valign=top class=listrow$i>
2164 $column_data{printer_description} =
2165 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>|;
2166 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
2167 $column_data{template_code} =
2168 qq|<td align=right>$ref->{template_code}</td>|;
2170 map { print "$column_data{$_}\n" } @column_index;
2182 <td><hr size=3 noshade></td>
2187 <form method=post action=$form->{script}>
2189 <input name=callback type=hidden value="$form->{callback}">
2191 <input type=hidden name=type value=printer>
2193 <input type=hidden name=path value=$form->{path}>
2194 <input type=hidden name=login value=$form->{login}>
2195 <input type=hidden name=password value=$form->{password}>
2197 <input class=submit type=submit name=action value="|
2198 . $locale->text('Add') . qq|">
2206 $lxdebug->leave_sub();
2209 sub printer_header {
2210 $lxdebug->enter_sub();
2212 $form->{title} = $locale->text("$form->{title} Printer");
2214 # $locale->text('Add Printer')
2215 # $locale->text('Edit Printer')
2217 $form->{printer_description} =~ s/\"/"/g;
2218 $form->{template_code} =~ s/\"/"/g;
2219 $form->{printer_command} =~ s/\"/"/g;
2227 <form method=post action=$form->{script}>
2229 <input type=hidden name=id value=$form->{id}>
2230 <input type=hidden name=type value=printer>
2234 <th class=listtop colspan=2>$form->{title}</th>
2236 <tr height="5"></tr>
2238 <th align=right>| . $locale->text('Printer') . qq|</th>
2239 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2242 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2243 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2246 <th align=right>| . $locale->text('Template Code') . qq|</th>
2247 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2249 <td colspan=2><hr size=3 noshade></td>
2254 $lxdebug->leave_sub();
2258 $lxdebug->enter_sub();
2260 $form->isblank("printer_description", $locale->text('Description missing!'));
2261 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2262 AM->save_printer(\%myconfig, \%$form);
2263 $form->redirect($locale->text('Printer saved!'));
2265 $lxdebug->leave_sub();
2268 sub delete_printer {
2269 $lxdebug->enter_sub();
2271 AM->delete_printer(\%myconfig, \%$form);
2272 $form->redirect($locale->text('Printer deleted!'));
2274 $lxdebug->leave_sub();
2279 $lxdebug->enter_sub();
2281 $form->{title} = "Add";
2284 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2285 unless $form->{callback};
2287 $form->{terms_netto} = 0;
2288 $form->{terms_skonto} = 0;
2289 $form->{percent_skonto} = 0;
2293 $lxdebug->leave_sub();
2297 $lxdebug->enter_sub();
2299 $form->{title} = "Edit";
2301 AM->get_payment(\%myconfig, \%$form);
2305 $form->{orphaned} = 1;
2308 $lxdebug->leave_sub();
2312 $lxdebug->enter_sub();
2314 AM->payment(\%myconfig, \%$form);
2317 "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2319 $callback = $form->escape($form->{callback});
2321 $form->{title} = $locale->text('Payment Terms');
2323 @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
2325 $column_header{description} =
2326 qq|<th class=listheading>|
2327 . $locale->text('Description')
2329 $column_header{description_long} =
2330 qq|<th class=listheading>|
2331 . $locale->text('Long Description')
2333 $column_header{terms_netto} =
2334 qq|<th class=listheading>|
2335 . $locale->text('Netto Terms')
2337 $column_header{terms_skonto} =
2338 qq|<th class=listheading>|
2339 . $locale->text('Skonto Terms')
2341 $column_header{percent_skonto} =
2342 qq|<th class=listheading>|
2343 . $locale->text('Skonto')
2353 <th class=listtop>$form->{title}</th>
2355 <tr height="5"></tr>
2359 <tr class=listheading>
2362 map { print "$column_header{$_}\n" } @column_index;
2368 foreach $ref (@{ $form->{ALL} }) {
2374 <tr valign=top class=listrow$i>
2378 $column_data{description} =
2379 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>|;
2380 $column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|;
2381 $column_data{terms_netto} =
2382 qq|<td align=right>$ref->{terms_netto}</td>|;
2383 $column_data{terms_skonto} =
2384 qq|<td align=right>$ref->{terms_skonto}</td>|;
2385 $column_data{percent_skonto} =
2386 qq|<td align=right>$ref->{percent_skonto} %</td>|;
2387 map { print "$column_data{$_}\n" } @column_index;
2399 <td><hr size=3 noshade></td>
2404 <form method=post action=$form->{script}>
2406 <input name=callback type=hidden value="$form->{callback}">
2408 <input type=hidden name=type value=payment>
2410 <input type=hidden name=path value=$form->{path}>
2411 <input type=hidden name=login value=$form->{login}>
2412 <input type=hidden name=password value=$form->{password}>
2414 <input class=submit type=submit name=action value="|
2415 . $locale->text('Add') . qq|">
2423 $lxdebug->leave_sub();
2426 sub payment_header {
2427 $lxdebug->enter_sub();
2429 $form->{title} = $locale->text("$form->{title} Payment Terms");
2431 # $locale->text('Add Payment Terms')
2432 # $locale->text('Edit Payment Terms')
2434 $form->{description} =~ s/\"/"/g;
2443 <form method=post action=$form->{script}>
2445 <input type=hidden name=id value=$form->{id}>
2446 <input type=hidden name=type value=payment>
2450 <th class=listtop colspan=2>$form->{title}</th>
2452 <tr height="5"></tr>
2454 <th align=right>| . $locale->text('Description') . qq|</th>
2455 <td><input name=description size=30 value="$form->{description}"></td>
2458 <th align=right>| . $locale->text('Long Description') . qq|</th>
2459 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2462 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2463 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2466 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2467 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2470 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2471 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2473 <td colspan=2><hr size=3 noshade></td>
2478 $lxdebug->leave_sub();
2482 $lxdebug->enter_sub();
2484 $form->isblank("description", $locale->text('Language missing!'));
2485 AM->save_payment(\%myconfig, \%$form);
2486 $form->redirect($locale->text('Payment Terms saved!'));
2488 $lxdebug->leave_sub();
2491 sub delete_payment {
2492 $lxdebug->enter_sub();
2494 AM->delete_payment(\%myconfig, \%$form);
2495 $form->redirect($locale->text('Payment terms deleted!'));
2497 $lxdebug->leave_sub();
2501 $lxdebug->enter_sub();
2503 $form->{title} = "Add";
2506 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2507 unless $form->{callback};
2512 $lxdebug->leave_sub();
2516 $lxdebug->enter_sub();
2518 $form->{title} = "Edit";
2520 AM->get_sic(\%myconfig, \%$form);
2524 $form->{orphaned} = 1;
2527 $lxdebug->leave_sub();
2531 $lxdebug->enter_sub();
2533 AM->sic(\%myconfig, \%$form);
2536 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2538 $callback = $form->escape($form->{callback});
2540 $form->{title} = $locale->text('Standard Industrial Codes');
2542 @column_index = qw(code description);
2544 $column_header{code} =
2545 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
2546 $column_header{description} =
2547 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
2556 <th class=listtop>$form->{title}</th>
2558 <tr height="5"></tr>
2562 <tr class=listheading>
2565 map { print "$column_header{$_}\n" } @column_index;
2571 foreach $ref (@{ $form->{ALL} }) {
2576 if ($ref->{sictype} eq 'H') {
2578 <tr valign=top class=listheading>
2580 $column_data{code} =
2581 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>|;
2582 $column_data{description} = qq|<th>$ref->{description}</th>|;
2586 <tr valign=top class=listrow$i>
2589 $column_data{code} =
2590 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>|;
2591 $column_data{description} = qq|<td>$ref->{description}</td>|;
2595 map { print "$column_data{$_}\n" } @column_index;
2607 <td><hr size=3 noshade></td>
2612 <form method=post action=$form->{script}>
2614 <input name=callback type=hidden value="$form->{callback}">
2616 <input type=hidden name=type value=sic>
2618 <input type=hidden name=path value=$form->{path}>
2619 <input type=hidden name=login value=$form->{login}>
2620 <input type=hidden name=password value=$form->{password}>
2622 <input class=submit type=submit name=action value="|
2623 . $locale->text('Add') . qq|">
2631 $lxdebug->leave_sub();
2635 $lxdebug->enter_sub();
2637 $form->{title} = $locale->text("$form->{title} SIC");
2639 # $locale->text('Add SIC')
2640 # $locale->text('Edit SIC')
2642 $form->{code} =~ s/\"/"/g;
2643 $form->{description} =~ s/\"/"/g;
2645 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
2652 <form method=post action=$form->{script}>
2654 <input type=hidden name=type value=sic>
2655 <input type=hidden name=id value=$form->{code}>
2659 <th class=listtop colspan=2>$form->{title}</th>
2661 <tr height="5"></tr>
2663 <th align=right>| . $locale->text('Code') . qq|</th>
2664 <td><input name=code size=10 value=$form->{code}></td>
2668 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
2669 . $locale->text('Heading') . qq|</th>
2672 <th align=right>| . $locale->text('Description') . qq|</th>
2673 <td><input name=description size=60 value="$form->{description}"></td>
2675 <td colspan=2><hr size=3 noshade></td>
2680 $lxdebug->leave_sub();
2684 $lxdebug->enter_sub();
2686 $form->isblank("code", $locale->text('Code missing!'));
2687 $form->isblank("description", $locale->text('Description missing!'));
2688 AM->save_sic(\%myconfig, \%$form);
2689 $form->redirect($locale->text('SIC saved!'));
2691 $lxdebug->leave_sub();
2695 $lxdebug->enter_sub();
2697 AM->delete_sic(\%myconfig, \%$form);
2698 $form->redirect($locale->text('SIC deleted!'));
2700 $lxdebug->leave_sub();
2703 sub display_stylesheet {
2704 $lxdebug->enter_sub();
2706 $form->{file} = "css/$myconfig{stylesheet}";
2709 $lxdebug->leave_sub();
2713 $lxdebug->enter_sub();
2715 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2716 $form->{file} =~ s/^\/*//g;
2717 $form->{file} =~ s/$userspath//;
2719 $form->error("$!: $form->{file}") unless -f $form->{file};
2721 AM->load_template(\%$form);
2723 $form->{title} = $form->{file};
2725 # if it is anything but html
2726 if ($form->{file} !~ /\.html$/) {
2727 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2737 <form method=post action=$form->{script}>
2739 <input name=file type=hidden value=$form->{file}>
2740 <input name=type type=hidden value=template>
2742 <input type=hidden name=path value=$form->{path}>
2743 <input type=hidden name=login value=$form->{login}>
2744 <input type=hidden name=password value=$form->{password}>
2746 <input name=action type=submit class=submit value="|
2747 . $locale->text('Edit') . qq|">
2755 $lxdebug->leave_sub();
2759 $lxdebug->enter_sub();
2761 AM->load_template(\%$form);
2763 $form->{title} = $locale->text('Edit Template');
2765 # convert   to &nbsp;
2766 $form->{body} =~ s/ /&nbsp;/gi;
2773 <form method=post action=$form->{script}>
2775 <input name=file type=hidden value=$form->{file}>
2776 <input name=type type=hidden value=template>
2778 <input type=hidden name=path value=$form->{path}>
2779 <input type=hidden name=login value=$form->{login}>
2780 <input type=hidden name=password value=$form->{password}>
2782 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
2784 <textarea name=body rows=25 cols=70>
2789 <input type=submit class=submit name=action value="|
2790 . $locale->text('Save') . qq|">
2799 $lxdebug->leave_sub();
2803 $lxdebug->enter_sub();
2805 AM->save_template(\%$form);
2806 $form->redirect($locale->text('Template saved!'));
2808 $lxdebug->leave_sub();
2812 $lxdebug->enter_sub();
2814 # get defaults for account numbers and last numbers
2815 AM->defaultaccounts(\%myconfig, \%$form);
2817 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2819 ($item eq $myconfig{dateformat})
2820 ? "<option selected>$item\n"
2821 : "<option>$item\n";
2824 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2826 ($item eq $myconfig{numberformat})
2827 ? "<option selected>$item\n"
2828 : "<option>$item\n";
2831 foreach $item (qw(name company address signature)) {
2832 $myconfig{$item} =~ s/\"/"/g;
2835 foreach $item (qw(address signature)) {
2836 $myconfig{$item} =~ s/\\n/\r\n/g;
2840 if ($opendocument_templates && $openofficeorg_writer_bin &&
2841 $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
2842 push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
2843 "value" => "opendocument_pdf" });
2845 if ($latex_templates) {
2846 push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
2848 push(@formats, { "name" => "HTML", "value" => "html" });
2849 if ($latex_templates) {
2850 push(@formats, { "name" => $locale->text("Postscript"),
2851 "value" => "postscript" });
2853 if ($opendocument_templates) {
2854 push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
2855 "value" => "opendocument" });
2858 if (!$myconfig{"template_format"}) {
2859 $myconfig{"template_format"} = "pdf";
2861 my $template_format = "";
2862 foreach $item (@formats) {
2864 "<option value=\"$item->{value}\"" .
2865 ($item->{"value"} eq $myconfig{"template_format"} ?
2867 ">" . H($item->{"name"}) . "</option>";
2870 if (!$myconfig{"default_media"}) {
2871 $myconfig{"default_media"} = "screen";
2873 my %selected = ($myconfig{"default_media"} => "selected");
2874 my $default_media = qq|
2875 <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
2876 <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
2877 <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
2881 $selected{$myconfig{"default_printer_id"}} = "selected"
2882 if ($myconfig{"default_printer_id"});
2883 my $default_printer = qq|<option></option>|;
2884 AM->printer(\%myconfig, $form);
2885 foreach my $printer (@{$form->{"ALL"}}) {
2886 $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
2887 qq|" $selected{$printer->{'id'}}>| .
2888 H($printer->{"printer_description"}) . qq|</option>|;
2891 %countrycodes = User->country_codes;
2893 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2897 ($myconfig{countrycode} eq $key)
2898 ? "<option selected value=$key>$countrycodes{$key}\n"
2899 : "<option value=$key>$countrycodes{$key}\n";
2901 $countrycodes = "<option>American English\n$countrycodes";
2903 # use an other input number format than output numberformat
2904 # look at Form.pm, sub parse_amount
2905 my $in_numberformat = '';
2906 $text1 = qq|value="0">| . $locale->text('equal Outputformat');
2907 $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
2908 @in_nf = ($text1, $text2);
2909 foreach $item (@in_nf) {
2911 (substr($item, 7, 1) eq $myconfig{in_numberformat})
2912 ? "<option selected $item\n"
2913 : "<option $item\n";
2916 foreach $key (keys %{ $form->{IC} }) {
2917 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2919 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2920 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2921 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2925 opendir CSS, "css/.";
2926 @all = grep /.*\.css$/, readdir CSS;
2929 foreach $item (@all) {
2930 if ($item eq $myconfig{stylesheet}) {
2931 $selectstylesheet .= qq|<option selected>$item\n|;
2933 $selectstylesheet .= qq|<option>$item\n|;
2936 $selectstylesheet .= "<option>\n";
2938 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2942 if ($myconfig{menustyle} eq "old") {
2943 $menustyle_old = "checked";
2944 } elsif ($myconfig{menustyle} eq "neu") {
2945 $menustyle_neu = "checked";
2946 } elsif ($myconfig{menustyle} eq "v3") {
2947 $menustyle_v3 = "checked";
2950 my ($show_form_details, $hide_form_details);
2951 $myconfig{"show_form_details"} = 1
2952 unless (defined($myconfig{"show_form_details"}));
2953 $show_form_details = "checked" if ($myconfig{"show_form_details"});
2954 $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
2959 <form method=post action=$form->{script}>
2961 <input type=hidden name=old_password value=$myconfig{password}>
2962 <input type=hidden name=type value=preferences>
2963 <input type=hidden name=role value=$myconfig{role}>
2966 <tr><th class=listtop>$form->{title}</th></tr>
2971 <th align=right>| . $locale->text('Name') . qq|</th>
2972 <td><input name=name size=15 value="$myconfig{name}"></td>
2975 <th align=right>| . $locale->text('Password') . qq|</th>
2976 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2979 <th align=right>| . $locale->text('E-mail') . qq|</th>
2980 <td><input name=email size=30 value="$myconfig{email}"></td>
2983 <th align=right>| . $locale->text('Signature') . qq|</th>
2984 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2987 <th align=right>| . $locale->text('Phone') . qq|</th>
2988 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2991 <th align=right>| . $locale->text('Fax') . qq|</th>
2992 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2995 <th align=right>| . $locale->text('Company') . qq|</th>
2996 <td><input name=company size=30 value="$myconfig{company}"></td>
2999 <th align=right>| . $locale->text('Address') . qq|</th>
3000 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
3003 <th align=right>| . $locale->text('Date Format') . qq|</th>
3004 <td><select name=dateformat>$dateformat</select></td>
3007 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
3008 <td><select name=numberformat>$numberformat</select></td>
3011 <th align=right>| . $locale->text('Input Number Format') . qq|</th>
3012 <td><select name=in_numberformat>$in_numberformat</select></td>
3016 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
3017 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
3020 <th align=right>| . $locale->text('Language') . qq|</th>
3021 <td><select name=countrycode>$countrycodes</select></td>
3024 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
3025 <td><select name=usestylesheet>$selectstylesheet</select></td>
3028 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
3029 <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
3030 $locale->text("Top (CSS)") . qq|
3031 <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
3032 $locale->text("Top (Javascript)") . qq|
3033 <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
3034 $locale->text("Old (on the side)") . qq|</td>
3037 <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
3038 <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details>
3039 <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
3040 <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details>
3041 <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
3043 <input name=printer type=hidden value="$myconfig{printer}">
3044 <tr class=listheading>
3045 <th colspan=2>| . $locale->text("Print options") . qq|</th>
3048 <th align=right>| . $locale->text('Default template format') . qq|</th>
3049 <td><select name="template_format">$template_format</select></td>
3052 <th align=right>| . $locale->text('Default output medium') . qq|</th>
3053 <td><select name="default_media">$default_media</select></td>
3056 <th align=right>| . $locale->text('Default printer') . qq|</th>
3057 <td><select name="default_printer_id">$default_printer</select></td>
3060 <th align=right>| . $locale->text('Number of copies') . qq|</th>
3061 <td><input name="copies" size="10" value="| .
3062 $form->quote($myconfig{"copies"}) . qq|"></td>
3066 <tr class=listheading>
3067 <th colspan=2> </th>
3070 <th align=right>| . $locale->text('Business Number') . qq|</th>
3071 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
3074 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
3075 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
3077 <tr class=listheading>
3079 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
3085 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
3086 <td><select name=inventory_accno>$myconfig{IC}</select></td>
3089 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
3090 <td><select name=income_accno>$myconfig{IC_income}</select></td>
3093 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
3094 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
3097 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
3098 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
3101 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
3102 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
3107 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
3109 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
3118 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
3119 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
3120 <th align=right nowrap>|
3121 . $locale->text('Last Customer Number') . qq|</th>
3122 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
3125 <th align=right nowrap>|
3126 . $locale->text('Last Credit Note Number') . qq|</th>
3127 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
3128 <th align=right nowrap>|
3129 . $locale->text('Last Vendor Number') . qq|</th>
3130 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
3133 <th align=right nowrap>|
3134 . $locale->text('Last Sales Order Number') . qq|</th>
3135 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
3138 <th align=right nowrap>|
3139 . $locale->text('Last Purchase Order Number') . qq|</th>
3140 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
3141 <th align=right nowrap>|
3142 . $locale->text('Last Article Number') . qq|</th>
3143 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
3146 <th align=right nowrap>|
3147 . $locale->text('Last Sales Quotation Number') . qq|</th>
3148 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
3149 <th align=right nowrap>|
3150 . $locale->text('Last Service Number') . qq|</th>
3151 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
3154 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
3155 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
3156 <th align=right nowrap></th>
3162 # <tr class=listheading>
3163 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3170 # <th>| . $locale->text('Rate') . qq| (%)</th>
3171 # <th>| . $locale->text('Number') . qq|</th>
3175 # foreach $accno (sort keys %{ $form->{taxrates} }) {
3178 # <th align=right>$form->{taxrates}{$accno}{description}</th>
3179 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3180 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3183 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3186 # chop $form->{taxaccounts};
3189 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3198 <td><hr size=3 noshade></td>
3202 <input type=hidden name=path value=$form->{path}>
3203 <input type=hidden name=login value=$form->{login}>
3204 <input type=hidden name=password value=$form->{password}>
3207 <input type=submit class=submit name=action value="|
3208 . $locale->text('Save') . qq|">
3216 $lxdebug->leave_sub();
3219 sub save_preferences {
3220 $lxdebug->enter_sub();
3222 $form->{stylesheet} = $form->{usestylesheet};
3224 $form->redirect($locale->text('Preferences saved!'))
3226 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3228 $form->error($locale->text('Cannot save preferences!'));
3230 $lxdebug->leave_sub();
3234 $lxdebug->enter_sub();
3236 if ($form->{media} eq 'email') {
3237 $form->error($locale->text('No email address for') . " $myconfig{name}")
3238 unless ($myconfig{email});
3240 $form->{OUT} = "$sendmail";
3244 AM->backup(\%myconfig, \%$form, $userspath);
3246 if ($form->{media} eq 'email') {
3247 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
3250 $lxdebug->leave_sub();
3254 $lxdebug->enter_sub();
3256 $form->{title} = $locale->text('Audit Control');
3258 AM->closedto(\%myconfig, \%$form);
3260 if ($form->{revtrans}) {
3261 $checked{Y} = "checked";
3263 $checked{N} = "checked";
3271 <form method=post action=$form->{script}>
3273 <input type=hidden name=path value=$form->{path}>
3274 <input type=hidden name=login value=$form->{login}>
3275 <input type=hidden name=password value=$form->{password}>
3278 <tr><th class=listtop>$form->{title}</th></tr>
3279 <tr height="5"></tr>
3285 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3286 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3287 . $locale->text('Yes')
3288 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3289 . $locale->text('No')
3293 <th>| . $locale->text('Close Books up to') . qq|</th>
3294 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3304 <input type=hidden name=nextsub value=doclose>
3306 <input type=submit class=submit name=action value="|
3307 . $locale->text('Continue') . qq|">
3315 $lxdebug->leave_sub();
3319 $lxdebug->enter_sub();
3321 AM->closebooks(\%myconfig, \%$form);
3323 if ($form->{revtrans}) {
3325 $locale->text('Transaction reversal enforced for all dates'));
3327 if ($form->{closedto}) {
3329 $locale->text('Transaction reversal enforced up to') . " "
3330 . $locale->date(\%myconfig, $form->{closedto}, 1));
3332 $form->redirect($locale->text('Books are open'));
3336 $lxdebug->leave_sub();
3340 $lxdebug->enter_sub();
3342 $form->{title} = "Add";
3345 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
3346 unless $form->{callback};
3351 $lxdebug->leave_sub();
3354 sub edit_warehouse {
3355 $lxdebug->enter_sub();
3357 $form->{title} = "Edit";
3359 AM->get_warehouse(\%myconfig, \%$form);
3364 $lxdebug->leave_sub();
3367 sub list_warehouse {
3368 $lxdebug->enter_sub();
3370 AM->warehouses(\%myconfig, \%$form);
3373 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
3375 $callback = $form->escape($form->{callback});
3377 $form->{title} = $locale->text('Warehouses');
3379 @column_index = qw(description);
3381 $column_header{description} =
3382 qq|<th class=listheading width=100%>|
3383 . $locale->text('Description')
3393 <th class=listtop>$form->{title}</th>
3395 <tr height="5"></tr>
3399 <tr class=listheading>
3402 map { print "$column_header{$_}\n" } @column_index;
3408 foreach $ref (@{ $form->{ALL} }) {
3414 <tr valign=top class=listrow$i>
3417 $column_data{description} =
3418 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>|;
3420 map { print "$column_data{$_}\n" } @column_index;
3432 <td><hr size=3 noshade></td>
3437 <form method=post action=$form->{script}>
3439 <input name=callback type=hidden value="$form->{callback}">
3441 <input type=hidden name=type value=warehouse>
3443 <input type=hidden name=path value=$form->{path}>
3444 <input type=hidden name=login value=$form->{login}>
3445 <input type=hidden name=password value=$form->{password}>
3447 <input class=submit type=submit name=action value="|
3448 . $locale->text('Add') . qq|">
3456 $lxdebug->leave_sub();
3459 sub warehouse_header {
3460 $lxdebug->enter_sub();
3462 $form->{title} = $locale->text("$form->{title} Warehouse");
3464 # $locale->text('Add Warehouse')
3465 # $locale->text('Edit Warehouse')
3467 $form->{description} =~ s/\"/"/g;
3469 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
3471 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
3474 qq|<input name=description size=60 value="$form->{description}">|;
3482 <form method=post action=$form->{script}>
3484 <input type=hidden name=id value=$form->{id}>
3485 <input type=hidden name=type value=warehouse>
3489 <th class=listtop colspan=2>$form->{title}</th>
3491 <tr height="5"></tr>
3493 <th align=right>| . $locale->text('Description') . qq|</th>
3494 <td>$description</td>
3497 <td colspan=2><hr size=3 noshade></td>
3502 $lxdebug->leave_sub();
3505 sub save_warehouse {
3506 $lxdebug->enter_sub();
3508 $form->isblank("description", $locale->text('Description missing!'));
3509 AM->save_warehouse(\%myconfig, \%$form);
3510 $form->redirect($locale->text('Warehouse saved!'));
3512 $lxdebug->leave_sub();
3515 sub delete_warehouse {
3516 $lxdebug->enter_sub();
3518 AM->delete_warehouse(\%myconfig, \%$form);
3519 $form->redirect($locale->text('Warehouse deleted!'));
3521 $lxdebug->leave_sub();
3525 $lxdebug->enter_sub();
3527 &{ $form->{nextsub} };
3529 $lxdebug->leave_sub();
3533 $lxdebug->enter_sub();
3535 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3536 AM->units_in_use(\%myconfig, $form, $units);
3537 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3539 @languages = AM->language(\%myconfig, $form, 1);
3542 foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3543 map({ push(@unit_list, $units->{$_}); }
3544 sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3545 grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3548 foreach (@unit_list) {
3549 $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"});
3550 $_->{"UNITLANGUAGES"} = [];
3551 foreach my $lang (@languages) {
3552 push(@{ $_->{"UNITLANGUAGES"} },
3554 "unit" => $_->{"name"},
3555 "language_id" => $lang->{"id"},
3556 "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
3557 "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
3563 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3564 $ddbox = AM->unit_select_data($units, undef, 1);
3566 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3568 print($form->parse_html_template("am/edit_units",
3569 { "UNITS" => \@unit_list,
3570 "NEW_BASE_UNIT_DDBOX" => $ddbox,
3571 "LANGUAGES" => \@languages }));
3573 $lxdebug->leave_sub();
3577 $lxdebug->enter_sub();
3579 $form->isblank("new_name", $locale->text("The name is missing."));
3580 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3581 $all_units = AM->retrieve_units(\%myconfig, $form);
3582 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
3584 my ($base_unit, $factor);
3585 if ($form->{"new_base_unit"}) {
3586 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3588 $form->isblank("new_factor", $locale->text("The factor is missing."));
3589 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3590 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3591 $base_unit = $form->{"new_base_unit"};
3595 foreach my $lang (AM->language(\%myconfig, $form, 1)) {
3596 next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
3597 push(@languages, { "id" => $lang->{"id"},
3598 "localized" => $form->{"new_localized_$lang->{id}"},
3599 "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
3603 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
3605 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3609 $lxdebug->leave_sub();
3612 sub set_unit_languages {
3613 $lxdebug->enter_sub();
3615 my ($unit, $languages, $idx) = @_;
3617 $unit->{"LANGUAGES"} = [];
3619 foreach my $lang (@{$languages}) {
3620 push(@{ $unit->{"LANGUAGES"} },
3621 { "id" => $lang->{"id"},
3622 "localized" => $form->{"localized_${idx}_$lang->{id}"},
3623 "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
3627 $lxdebug->leave_sub();
3631 $lxdebug->enter_sub();
3633 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3634 AM->units_in_use(\%myconfig, $form, $old_units);
3636 @languages = AM->language(\%myconfig, $form, 1);
3640 foreach $i (1..($form->{"rowcount"} * 1)) {
3641 $old_unit = $old_units->{$form->{"old_name_$i"}};
3643 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3646 if ($form->{"unchangeable_$i"}) {
3647 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3648 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3649 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3653 if ($old_unit->{"in_use"}) {
3654 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3657 if ($form->{"delete_$i"}) {
3658 push(@delete_units, $old_unit->{"name"});
3662 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3664 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3665 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3666 $new_units->{$form->{"name_$i"}} = \%h;
3667 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3668 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3671 foreach $unit (values(%{$new_units})) {
3672 next unless ($unit->{"old_name"});
3673 if ($unit->{"base_unit"}) {
3674 $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"}))
3675 unless (defined($new_units->{$unit->{"base_unit"}}));
3676 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3677 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3679 $unit->{"base_unit"} = undef;
3680 $unit->{"factor"} = undef;
3684 foreach $unit (values(%{$new_units})) {
3685 next if ($unit->{"unchanged_unit"});
3687 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3689 while ($new_unit->{"base_unit"}) {
3690 $new_unit->{"seen"} = 1;
3691 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3692 if ($new_unit->{"seen"}) {
3693 $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, " .
3694 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3699 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3701 $form->{"saved_message"} = $locale->text("The units have been saved.");
3705 $lxdebug->leave_sub();