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|</td>
368 <td width=50> </td>
370 <input name=charttype type=radio class=radio value="H" $checked{H}> |
371 . $locale->text('Heading') . qq|<br>
372 <input name=charttype type=radio class=radio value="A" $checked{A}> |
373 . $locale->text('Account') . qq|</td>
380 if ($form->{charttype} eq "A") {
387 . $locale->text('Is this a summary account to record') . qq|</th>
389 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
390 . $locale->text('AR')
391 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
392 . $locale->text('AP')
393 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
394 . $locale->text('Inventory')
401 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
407 <th align=left>| . $locale->text('Receivables') . qq|</th>
408 <th align=left>| . $locale->text('Payables') . qq|</th>
409 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
410 <th align=left>| . $locale->text('Service Items') . qq|</th>
414 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
415 . $locale->text('Revenue') . qq|\n<br>
416 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
417 . $locale->text('Receipt') . qq|\n<br>
418 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
419 . $locale->text('Tax') . qq|
422 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
423 . $locale->text('Expense/Asset') . qq|\n<br>
424 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
425 . $locale->text('Payment') . qq|\n<br>
426 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
427 . $locale->text('Tax') . qq|
430 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
431 . $locale->text('Revenue') . qq|\n<br>
432 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
433 . $locale->text('Expense') . qq|\n<br>
434 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
435 . $locale->text('Tax') . qq|
438 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
439 . $locale->text('Revenue') . qq|\n<br>
440 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
441 . $locale->text('Expense') . qq|\n<br>
442 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
443 . $locale->text('Tax') . qq|
463 <td><hr size=3 noshade></td>
468 $lxdebug->leave_sub();
472 $lxdebug->enter_sub();
476 <input name=callback type=hidden value="$form->{callback}">
478 <input type=hidden name=path value=$form->{path}>
479 <input type=hidden name=login value=$form->{login}>
480 <input type=hidden name=password value=$form->{password}>
483 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
485 <input type=submit class=submit name=action value="|
486 . $locale->text('Save') . qq|">
490 if ($form->{id} && $form->{orphaned}) {
491 print qq|<input type=submit class=submit name=action value="|
492 . $locale->text('Delete') . qq|">|;
495 if ($form->{menubar}) {
496 require "$form->{path}/menu.pl";
507 $lxdebug->leave_sub();
511 $lxdebug->enter_sub();
513 $form->isblank("accno", $locale->text('Account Number missing!'));
514 $form->isblank("category", $locale->text('Account Type missing!'));
516 $form->redirect($locale->text('Account saved!'))
517 if (AM->save_account(\%myconfig, \%$form));
518 $form->error($locale->text('Cannot save account!'));
520 $lxdebug->leave_sub();
524 $lxdebug->enter_sub();
526 CA->all_accounts(\%myconfig, \%$form);
528 $form->{title} = $locale->text('Chart of Accounts');
532 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
534 @column_index = qw(accno gifi_accno description debit credit link);
536 $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
537 $column_header{gifi_accno} =
538 qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
539 $column_header{description} =
540 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
541 $column_header{debit} = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
542 $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
543 $column_header{link} = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
546 $colspan = $#column_index + 1;
553 <th class=listtop colspan=$colspan>$form->{title}</th>
556 <tr class=listheading>
559 map { print "$column_header{$_}\n" } @column_index;
566 $callback = $form->escape($callback);
568 foreach $ca (@{ $form->{CA} }) {
570 $ca->{debit} = " ";
571 $ca->{credit} = " ";
573 if ($ca->{amount} > 0) {
575 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
577 if ($ca->{amount} < 0) {
579 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
582 $ca->{link} =~ s/:/<br>/og;
584 if ($ca->{charttype} eq "H") {
585 print qq|<tr class=listheading>|;
587 $column_data{accno} =
588 qq|<th><a href=$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</a></th>|;
589 $column_data{gifi_accno} =
590 qq|<th><a href=$form->{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{gifi_accno}</a> </th>|;
591 $column_data{description} = qq|<th>$ca->{description} </th>|;
592 $column_data{debit} = qq|<th> </th>|;
593 $column_data{credit} = qq| <th> </th>|;
594 $column_data{link} = qq|<th> </th>|;
600 <tr valign=top class=listrow$i>|;
601 $column_data{accno} =
602 qq|<td><a href=$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</a></td>|;
603 $column_data{gifi_accno} =
604 qq|<td><a href=$form->{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{gifi_accno}</a> </td>|;
605 $column_data{description} = qq|<td>$ca->{description} </td>|;
606 $column_data{debit} = qq|<td align=right>$ca->{debit}</td>|;
607 $column_data{credit} = qq|<td align=right>$ca->{credit}</td>|;
608 $column_data{link} = qq|<td>$ca->{link} </td>|;
612 map { print "$column_data{$_}\n" } @column_index;
618 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
625 $lxdebug->leave_sub();
629 $lxdebug->enter_sub();
631 $form->{title} = $locale->text('Delete Account');
634 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
636 if ($form->{id} == $form->{$id}) {
637 $form->error($locale->text('Cannot delete default account!'));
641 $form->redirect($locale->text('Account deleted!'))
642 if (AM->delete_account(\%myconfig, \%$form));
643 $form->error($locale->text('Cannot delete account!'));
645 $lxdebug->leave_sub();
649 $lxdebug->enter_sub();
651 @{ $form->{fields} } = (accno, description);
652 $form->{table} = "gifi";
653 $form->{sortorder} = "accno";
655 AM->gifi_accounts(\%myconfig, \%$form);
657 $form->{title} = $locale->text('GIFI');
661 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
663 @column_index = qw(accno description);
665 $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
666 $column_header{description} =
667 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
670 $colspan = $#column_index + 1;
677 <th class=listtop colspan=$colspan>$form->{title}</th>
680 <tr class=listheading>
683 map { print "$column_header{$_}\n" } @column_index;
690 $callback = $form->escape($callback);
692 foreach $ca (@{ $form->{ALL} }) {
698 <tr valign=top class=listrow$i>|;
700 $column_data{accno} =
701 qq|<td><a href=$form->{script}?action=edit_gifi&coa=1&accno=$ca->{accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</td>|;
702 $column_data{description} = qq|<td>$ca->{description} </td>|;
704 map { print "$column_data{$_}\n" } @column_index;
711 <td colspan=$colspan><hr size=3 noshade></td>
719 $lxdebug->leave_sub();
723 $lxdebug->enter_sub();
725 $form->{title} = "Add";
729 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
736 $lxdebug->leave_sub();
740 $lxdebug->enter_sub();
742 $form->{title} = "Edit";
744 AM->get_gifi(\%myconfig, \%$form);
749 $lxdebug->leave_sub();
753 $lxdebug->enter_sub();
755 $form->{title} = $locale->text("$form->{title} GIFI");
757 # $locale->text('Add GIFI')
758 # $locale->text('Edit GIFI')
760 $form->{description} =~ s/\"/"/g;
767 <form method=post action=$form->{script}>
769 <input type=hidden name=id value=$form->{accno}>
770 <input type=hidden name=type value=gifi>
774 <th class=listtop>$form->{title}</th>
781 <th align=right>| . $locale->text('GIFI') . qq|</th>
782 <td><input name=accno size=20 value=$form->{accno}></td>
785 <th align=right>| . $locale->text('Description') . qq|</th>
786 <td><input name=description size=60 value="$form->{description}"></td>
792 <td colspan=2><hr size=3 noshade></td>
797 $lxdebug->leave_sub();
801 $lxdebug->enter_sub();
805 <input name=callback type=hidden value="$form->{callback}">
807 <input type=hidden name=path value=$form->{path}>
808 <input type=hidden name=login value=$form->{login}>
809 <input type=hidden name=password value=$form->{password}>
811 <br><input type=submit class=submit name=action value="|
812 . $locale->text('Save') . qq|">|;
816 <input type=submit class=submit name=action value="|
817 . $locale->text('Copy to COA') . qq|">
820 if ($form->{accno} && $form->{orphaned}) {
821 print qq|<input type=submit class=submit name=action value="|
822 . $locale->text('Delete') . qq|">|;
826 if ($form->{menubar}) {
827 require "$form->{path}/menu.pl";
838 $lxdebug->leave_sub();
842 $lxdebug->enter_sub();
844 $form->isblank("accno", $locale->text('GIFI missing!'));
845 AM->save_gifi(\%myconfig, \%$form);
846 $form->redirect($locale->text('GIFI saved!'));
848 $lxdebug->leave_sub();
852 $lxdebug->enter_sub();
854 $form->isblank("accno", $locale->text('GIFI missing!'));
856 AM->save_gifi(\%myconfig, \%$form);
859 $form->{gifi_accno} = $form->{accno};
860 $form->{title} = "Add";
861 $form->{charttype} = "A";
866 $lxdebug->leave_sub();
870 $lxdebug->enter_sub();
872 AM->delete_gifi(\%myconfig, \%$form);
873 $form->redirect($locale->text('GIFI deleted!'));
875 $lxdebug->leave_sub();
879 $lxdebug->enter_sub();
881 $form->{title} = "Add";
885 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
886 unless $form->{callback};
891 $lxdebug->leave_sub();
894 sub edit_department {
895 $lxdebug->enter_sub();
897 $form->{title} = "Edit";
899 AM->get_department(\%myconfig, \%$form);
904 $lxdebug->leave_sub();
907 sub list_department {
908 $lxdebug->enter_sub();
910 AM->departments(\%myconfig, \%$form);
913 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
915 $callback = $form->escape($form->{callback});
917 $form->{title} = $locale->text('Departments');
919 @column_index = qw(description cost profit);
921 $column_header{description} =
922 qq|<th class=listheading width=90%>|
923 . $locale->text('Description')
925 $column_header{cost} =
926 qq|<th class=listheading nowrap>|
927 . $locale->text('Cost Center')
929 $column_header{profit} =
930 qq|<th class=listheading nowrap>|
931 . $locale->text('Profit Center')
941 <th class=listtop>$form->{title}</th>
947 <tr class=listheading>
950 map { print "$column_header{$_}\n" } @column_index;
956 foreach $ref (@{ $form->{ALL} }) {
962 <tr valign=top class=listrow$i>
965 $costcenter = ($ref->{role} eq "C") ? "X" : "";
966 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
968 $column_data{description} =
969 qq|<td><a href=$form->{script}?action=edit_department&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
970 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
971 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
973 map { print "$column_data{$_}\n" } @column_index;
985 <td><hr size=3 noshade></td>
990 <form method=post action=$form->{script}>
992 <input name=callback type=hidden value="$form->{callback}">
994 <input type=hidden name=type value=department>
996 <input type=hidden name=path value=$form->{path}>
997 <input type=hidden name=login value=$form->{login}>
998 <input type=hidden name=password value=$form->{password}>
1000 <input class=submit type=submit name=action value="|
1001 . $locale->text('Add') . qq|">|;
1003 if ($form->{menubar}) {
1004 require "$form->{path}/menu.pl";
1015 $lxdebug->leave_sub();
1018 sub department_header {
1019 $lxdebug->enter_sub();
1021 $form->{title} = $locale->text("$form->{title} Department");
1023 # $locale->text('Add Department')
1024 # $locale->text('Edit Department')
1026 $form->{description} =~ s/\"/"/g;
1028 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
1030 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
1033 qq|<input name=description size=60 value="$form->{description}">|;
1036 $costcenter = "checked" if $form->{role} eq "C";
1037 $profitcenter = "checked" if $form->{role} eq "P";
1044 <form method=post action=$form->{script}>
1046 <input type=hidden name=id value=$form->{id}>
1047 <input type=hidden name=type value=department>
1051 <th class=listtop colspan=2>$form->{title}</th>
1053 <tr height="5"></tr>
1055 <th align=right>| . $locale->text('Description') . qq|</th>
1056 <td>$description</td>
1060 <td><input type=radio style=radio name=role value="C" $costcenter> |
1061 . $locale->text('Cost Center') . qq|
1062 <input type=radio style=radio name=role value="P" $profitcenter> |
1063 . $locale->text('Profit Center') . qq|
1066 <td colspan=2><hr size=3 noshade></td>
1071 $lxdebug->leave_sub();
1074 sub save_department {
1075 $lxdebug->enter_sub();
1077 $form->isblank("description", $locale->text('Description missing!'));
1078 AM->save_department(\%myconfig, \%$form);
1079 $form->redirect($locale->text('Department saved!'));
1081 $lxdebug->leave_sub();
1084 sub delete_department {
1085 $lxdebug->enter_sub();
1087 AM->delete_department(\%myconfig, \%$form);
1088 $form->redirect($locale->text('Department deleted!'));
1090 $lxdebug->leave_sub();
1094 $lxdebug->enter_sub();
1096 $form->{title} = "Add";
1099 "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1100 unless $form->{callback};
1105 $lxdebug->leave_sub();
1109 $lxdebug->enter_sub();
1111 $form->{title} = "Edit";
1113 AM->get_lead(\%myconfig, \%$form);
1117 $form->{orphaned} = 1;
1120 $lxdebug->leave_sub();
1124 $lxdebug->enter_sub();
1126 AM->lead(\%myconfig, \%$form);
1129 "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1131 $callback = $form->escape($form->{callback});
1133 $form->{title} = $locale->text('Lead');
1135 @column_index = qw(description cost profit);
1137 $column_header{description} =
1138 qq|<th class=listheading width=100%>|
1139 . $locale->text('Description')
1149 <th class=listtop>$form->{title}</th>
1151 <tr height="5"></tr>
1152 <tr class=listheading>
1155 map { print "$column_header{$_}\n" } @column_index;
1161 foreach $ref (@{ $form->{ALL} }) {
1167 <tr valign=top class=listrow$i>
1170 $lead = $ref->{lead};
1172 $column_data{description} =
1173 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>|;
1175 map { print "$column_data{$_}\n" } @column_index;
1184 <td><hr size=3 noshade></td>
1189 <form method=post action=$form->{script}>
1191 <input name=callback type=hidden value="$form->{callback}">
1193 <input type=hidden name=type value=lead>
1195 <input type=hidden name=path value=$form->{path}>
1196 <input type=hidden name=login value=$form->{login}>
1197 <input type=hidden name=password value=$form->{password}>
1199 <input class=submit type=submit name=action value="|
1200 . $locale->text('Add') . qq|">|;
1202 if ($form->{menubar}) {
1203 require "$form->{path}/menu.pl";
1214 $lxdebug->leave_sub();
1218 $lxdebug->enter_sub();
1220 $form->{title} = $locale->text("$form->{title} Lead");
1222 # $locale->text('Add Lead')
1223 # $locale->text('Edit Lead')
1225 $form->{description} =~ s/\"/"/g;
1228 qq|<input name=description size=50 value="$form->{lead}">|;
1235 <form method=post action=$form->{script}>
1237 <input type=hidden name=id value=$form->{id}>
1238 <input type=hidden name=type value=lead>
1242 <th class=listtop colspan=2>$form->{title}</th>
1244 <tr height="5"></tr>
1246 <th align=right>| . $locale->text('Description') . qq|</th>
1247 <td>$description</td>
1249 <td colspan=2><hr size=3 noshade></td>
1254 $lxdebug->leave_sub();
1258 $lxdebug->enter_sub();
1260 $form->isblank("description", $locale->text('Description missing!'));
1261 AM->save_lead(\%myconfig, \%$form);
1262 $form->redirect($locale->text('lead saved!'));
1264 $lxdebug->leave_sub();
1268 $lxdebug->enter_sub();
1270 AM->delete_lead(\%myconfig, \%$form);
1271 $form->redirect($locale->text('lead deleted!'));
1273 $lxdebug->leave_sub();
1277 $lxdebug->enter_sub();
1279 $form->{title} = "Add";
1282 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1283 unless $form->{callback};
1288 $lxdebug->leave_sub();
1292 $lxdebug->enter_sub();
1294 $form->{title} = "Edit";
1296 AM->get_business(\%myconfig, \%$form);
1300 $form->{orphaned} = 1;
1303 $lxdebug->leave_sub();
1307 $lxdebug->enter_sub();
1309 AM->business(\%myconfig, \%$form);
1312 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1314 $callback = $form->escape($form->{callback});
1316 $form->{title} = $locale->text('Type of Business');
1318 @column_index = qw(description discount customernumberinit);
1320 $column_header{description} =
1321 qq|<th class=listheading width=60%>|
1322 . $locale->text('Description')
1324 $column_header{discount} =
1325 qq|<th class=listheading width=10%>|
1326 . $locale->text('Discount')
1328 $column_header{customernumberinit} =
1329 qq|<th class=listheading>|
1330 . $locale->text('Customernumberinit')
1340 <th class=listtop>$form->{title}</th>
1342 <tr height="5"></tr>
1346 <tr class=listheading>
1349 map { print "$column_header{$_}\n" } @column_index;
1355 foreach $ref (@{ $form->{ALL} }) {
1361 <tr valign=top class=listrow$i>
1365 $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
1368 ? "<b>$ref->{description}</b>"
1369 : "$ref->{description}";
1370 $column_data{description} =
1371 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>|;
1372 $column_data{discount} = qq|<td align=right>$discount</td>|;
1373 $column_data{customernumberinit} =
1374 qq|<td align=right>$ref->{customernumberinit}</td>|;
1376 map { print "$column_data{$_}\n" } @column_index;
1388 <td><hr size=3 noshade></td>
1393 <form method=post action=$form->{script}>
1395 <input name=callback type=hidden value="$form->{callback}">
1397 <input type=hidden name=type value=business>
1399 <input type=hidden name=path value=$form->{path}>
1400 <input type=hidden name=login value=$form->{login}>
1401 <input type=hidden name=password value=$form->{password}>
1403 <input class=submit type=submit name=action value="|
1404 . $locale->text('Add') . qq|">|;
1406 if ($form->{menubar}) {
1407 require "$form->{path}/menu.pl";
1419 $lxdebug->leave_sub();
1422 sub business_header {
1423 $lxdebug->enter_sub();
1425 $form->{title} = $locale->text("$form->{title} Business");
1426 $form->{salesman} = "checked" if $form->{salesman};
1428 # $locale->text('Add Business')
1429 # $locale->text('Edit Business')
1431 $form->{description} =~ s/\"/"/g;
1433 $form->format_amount(\%myconfig, $form->{discount} * 100);
1440 <form method=post action=$form->{script}>
1442 <input type=hidden name=id value=$form->{id}>
1443 <input type=hidden name=type value=business>
1447 <th class=listtop colspan=2>$form->{title}</th>
1449 <tr height="5"></tr>
1451 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1452 <td><input name=description size=30 value="$form->{description}"></td>
1455 <th align=right>| . $locale->text('Discount') . qq| %</th>
1456 <td><input name=discount size=5 value=$form->{discount}></td>
1459 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1460 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1463 <td align=right>| . $locale->text('Salesman') . qq|</td>
1464 <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
1466 <td colspan=2><hr size=3 noshade></td>
1471 $lxdebug->leave_sub();
1475 $lxdebug->enter_sub();
1477 $form->isblank("description", $locale->text('Description missing!'));
1478 AM->save_business(\%myconfig, \%$form);
1479 $form->redirect($locale->text('Business saved!'));
1481 $lxdebug->leave_sub();
1484 sub delete_business {
1485 $lxdebug->enter_sub();
1487 AM->delete_business(\%myconfig, \%$form);
1488 $form->redirect($locale->text('Business deleted!'));
1490 $lxdebug->leave_sub();
1494 $lxdebug->enter_sub();
1496 $form->{title} = "Add";
1499 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1500 unless $form->{callback};
1505 $lxdebug->leave_sub();
1509 $lxdebug->enter_sub();
1511 $form->{title} = "Edit";
1513 AM->get_language(\%myconfig, \%$form);
1517 $form->{orphaned} = 1;
1520 $lxdebug->leave_sub();
1524 $lxdebug->enter_sub();
1526 AM->language(\%myconfig, \%$form);
1529 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1531 $callback = $form->escape($form->{callback});
1533 $form->{title} = $locale->text('Languages');
1535 @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
1537 $column_header{description} =
1538 qq|<th class=listheading width=60%>|
1539 . $locale->text('Description')
1541 $column_header{template_code} =
1542 qq|<th class=listheading width=10%>|
1543 . $locale->text('Template Code')
1545 $column_header{article_code} =
1546 qq|<th class=listheading>|
1547 . $locale->text('Article Code')
1549 $column_header{output_numberformat} =
1550 qq|<th class=listheading>|
1551 . $locale->text('Number Format')
1553 $column_header{output_dateformat} =
1554 qq|<th class=listheading>|
1555 . $locale->text('Date Format')
1557 $column_header{output_longdates} =
1558 qq|<th class=listheading>|
1559 . $locale->text('Long Dates')
1569 <th class=listtop>$form->{title}</th>
1571 <tr height="5"></tr>
1575 <tr class=listheading>
1578 map { print "$column_header{$_}\n" } @column_index;
1584 foreach $ref (@{ $form->{ALL} }) {
1590 <tr valign=top class=listrow$i>
1594 $column_data{description} =
1595 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>|;
1596 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1597 $column_data{article_code} =
1598 qq|<td align=right>$ref->{article_code}</td>|;
1599 $column_data{output_numberformat} =
1601 ($ref->{output_numberformat} ? $ref->{output_numberformat} :
1602 $locale->text("use program settings")) .
1604 $column_data{output_dateformat} =
1606 ($ref->{output_dateformat} ? $ref->{output_dateformat} :
1607 $locale->text("use program settings")) .
1609 $column_data{output_longdates} =
1611 ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
1614 map { print "$column_data{$_}\n" } @column_index;
1626 <td><hr size=3 noshade></td>
1631 <form method=post action=$form->{script}>
1633 <input name=callback type=hidden value="$form->{callback}">
1635 <input type=hidden name=type value=language>
1637 <input type=hidden name=path value=$form->{path}>
1638 <input type=hidden name=login value=$form->{login}>
1639 <input type=hidden name=password value=$form->{password}>
1641 <input class=submit type=submit name=action value="|
1642 . $locale->text('Add') . qq|">|;
1644 if ($form->{menubar}) {
1645 require "$form->{path}/menu.pl";
1657 $lxdebug->leave_sub();
1660 sub language_header {
1661 $lxdebug->enter_sub();
1663 $form->{title} = $locale->text("$form->{title} Language");
1665 # $locale->text('Add Language')
1666 # $locale->text('Edit Language')
1668 $form->{description} =~ s/\"/"/g;
1669 $form->{template_code} =~ s/\"/"/g;
1670 $form->{article_code} =~ s/\"/"/g;
1676 qq|<option value="">| . $locale->text("use program settings") .
1678 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1680 ($item eq $form->{output_numberformat})
1681 ? "<option selected>$item"
1687 qq|<option value="">| . $locale->text("use program settings") .
1689 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1691 ($item eq $form->{output_dateformat})
1692 ? "<option selected>$item"
1700 <form method=post action=$form->{script}>
1702 <input type=hidden name=id value=$form->{id}>
1703 <input type=hidden name=type value=language>
1707 <th class=listtop colspan=2>$form->{title}</th>
1709 <tr height="5"></tr>
1711 <th align=right>| . $locale->text('Language') . qq|</th>
1712 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1715 <th align=right>| . $locale->text('Template Code') . qq|</th>
1716 <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
1719 <th align=right>| . $locale->text('Article Code') . qq|</th>
1720 <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
1723 <th align=right>| . $locale->text('Number Format') . qq|</th>
1724 <td><select name="output_numberformat">$numberformat</select></td>
1727 <th align=right>| . $locale->text('Date Format') . qq|</th>
1728 <td><select name="output_dateformat">$dateformat</select></td>
1731 <th align=right>| . $locale->text('Long Dates') . qq|</th>
1732 <td><input type="radio" name="output_longdates" value="1"| .
1733 ($form->{output_longdates} ? " checked" : "") .
1734 qq|>| . $locale->text("Yes") .
1735 qq|<input type="radio" name="output_longdates" value="0"| .
1736 ($form->{output_longdates} ? "" : " checked") .
1737 qq|>| . $locale->text("No") .
1740 <td colspan=2><hr size=3 noshade></td>
1745 $lxdebug->leave_sub();
1749 $lxdebug->enter_sub();
1751 $form->isblank("description", $locale->text('Language missing!'));
1752 $form->isblank("template_code", $locale->text('Template Code missing!'));
1753 $form->isblank("article_code", $locale->text('Article Code missing!'));
1754 AM->save_language(\%myconfig, \%$form);
1755 $form->redirect($locale->text('Language saved!'));
1757 $lxdebug->leave_sub();
1760 sub delete_language {
1761 $lxdebug->enter_sub();
1763 AM->delete_language(\%myconfig, \%$form);
1764 $form->redirect($locale->text('Language deleted!'));
1766 $lxdebug->leave_sub();
1770 sub add_buchungsgruppe {
1771 $lxdebug->enter_sub();
1773 # $locale->text("Add Buchungsgruppe")
1774 # $locale->text("Edit Buchungsgruppe")
1775 $form->{title} = "Add";
1778 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1779 unless $form->{callback};
1780 AM->get_buchungsgruppe(\%myconfig, \%$form);
1782 $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
1785 &buchungsgruppe_header;
1788 $lxdebug->leave_sub();
1791 sub edit_buchungsgruppe {
1792 $lxdebug->enter_sub();
1794 $form->{title} = "Edit";
1796 AM->get_buchungsgruppe(\%myconfig, \%$form);
1798 &buchungsgruppe_header;
1802 $lxdebug->leave_sub();
1805 sub list_buchungsgruppe {
1806 $lxdebug->enter_sub();
1808 AM->buchungsgruppe(\%myconfig, \%$form);
1811 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1813 $callback = $form->escape($form->{callback});
1815 $form->{title} = $locale->text('Buchungsgruppen');
1817 @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 );
1819 $column_header{description} =
1820 qq|<th class=listheading width=60%>|
1821 . $locale->text('Description')
1823 $column_header{inventory_accno} =
1824 qq|<th class=listheading width=10%>|
1825 . $locale->text('Bestandskonto')
1827 $column_header{income_accno_0} =
1828 qq|<th class=listheading>|
1829 . $locale->text('Erlöse Inland')
1831 $column_header{expense_accno_0} =
1832 qq|<th class=listheading>|
1833 . $locale->text('Aufwand Inland')
1835 $column_header{income_accno_1} =
1836 qq|<th class=listheading>|
1837 . $locale->text('Erlöse EU m. UStId')
1839 $column_header{expense_accno_1} =
1840 qq|<th class=listheading>|
1841 . $locale->text('Aufwand EU m. UStId')
1843 $column_header{income_accno_2} =
1844 qq|<th class=listheading>|
1845 . $locale->text('Erlöse EU o. UStId')
1847 $column_header{expense_accno_2} =
1848 qq|<th class=listheading>|
1849 . $locale->text('Aufwand EU o. UStId')
1851 $column_header{income_accno_3} =
1852 qq|<th class=listheading>|
1853 . $locale->text('Erlöse Ausland')
1855 $column_header{expense_accno_3} =
1856 qq|<th class=listheading>|
1857 . $locale->text('Aufwand Ausland')
1866 <th class=listtop>$form->{title}</th>
1868 <tr height="5"></tr>
1872 <tr class=listheading>
1875 map { print "$column_header{$_}\n" } @column_index;
1881 foreach $ref (@{ $form->{ALL} }) {
1887 <tr valign=top class=listrow$i>
1891 $column_data{description} =
1892 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>|;
1893 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1894 $column_data{income_accno_0} =
1895 qq|<td align=right>$ref->{income_accno_0}</td>|;
1896 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1897 $column_data{income_accno_1} =
1898 qq|<td align=right>$ref->{income_accno_1}</td>|;
1899 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1900 $column_data{income_accno_2} =
1901 qq|<td align=right>$ref->{income_accno_2}</td>|;
1902 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1903 $column_data{income_accno_3} =
1904 qq|<td align=right>$ref->{income_accno_3}</td>|;
1905 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1907 map { print "$column_data{$_}\n" } @column_index;
1919 <td><hr size=3 noshade></td>
1924 <form method=post action=$form->{script}>
1926 <input name=callback type=hidden value="$form->{callback}">
1928 <input type=hidden name=type value=buchungsgruppe>
1930 <input type=hidden name=path value=$form->{path}>
1931 <input type=hidden name=login value=$form->{login}>
1932 <input type=hidden name=password value=$form->{password}>
1934 <input class=submit type=submit name=action value="|
1935 . $locale->text('Add') . qq|">|;
1937 if ($form->{menubar}) {
1938 require "$form->{path}/menu.pl";
1950 $lxdebug->leave_sub();
1953 sub buchungsgruppe_header {
1954 $lxdebug->enter_sub();
1956 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1958 # $locale->text('Buchungsgruppe hinzufügen')
1959 # $locale->text('Buchungsgruppe bearbeiten')
1961 my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
1962 my %acc_type_map = (
1963 "IC" => $acc_inventory,
1964 "IC_income" => $acc_income,
1965 "IC_sale" => $acc_income,
1966 "IC_expense" => $acc_expense,
1967 "IC_cogs" => $acc_expense,
1970 foreach $key (keys(%acc_type_map)) {
1971 foreach $ref (@{ $form->{IC_links}{$key} }) {
1972 $acc_type_map{$key}->{$ref->{"id"}} = $ref;
1976 foreach my $type (qw(IC IC_income IC_expense)) {
1977 $form->{"select$type"} =
1979 map({ "<option value=$_->{id} $_->{selected}>" .
1980 "$_->{accno}--" . H($_->{description}) . "</option>" }
1981 sort({ $a->{"accno"} cmp $b->{"accno"} }
1982 values(%{$acc_type_map{$type}}))));
1986 $form->{selectIC} =~ s/selected//g;
1987 $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/;
1988 $form->{selectIC_income} =~ s/selected//g;
1989 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1990 $form->{selectIC_expense} =~ s/selected//g;
1991 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1997 <th align=right>| . $locale->text('Inventory') . qq|</th>
1998 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1999 <input name=selectIC type=hidden value="$form->{selectIC}">
2003 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
2007 $linkaccounts .= qq|
2009 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
2010 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
2013 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
2014 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
2017 $form->{selectIC_income} =~ s/selected//g;
2018 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
2019 $form->{selectIC_expense} =~ s/selected//g;
2020 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
2022 $linkaccounts .= qq| <tr>
2023 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
2024 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
2027 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
2028 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
2032 $form->{selectIC_income} =~ s/selected//g;
2033 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
2034 $form->{selectIC_expense} =~ s/selected//g;
2035 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
2038 $linkaccounts .= qq| <tr>
2039 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
2040 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
2043 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
2044 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
2048 $form->{selectIC_income} =~ s/selected//g;
2049 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
2050 $form->{selectIC_expense} =~ s/selected//g;
2051 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
2054 $linkaccounts .= qq| <tr>
2055 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
2056 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
2059 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
2060 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
2070 <form method=post action=$form->{script}>
2072 <input type=hidden name=id value=$form->{id}>
2073 <input type=hidden name=type value=buchungsgruppe>
2077 <th class=listtop colspan=2>$form->{title}</th>
2079 <tr height="5"></tr>
2081 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
2082 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
2085 <td colspan=2><hr size=3 noshade></td>
2090 $lxdebug->leave_sub();
2093 sub save_buchungsgruppe {
2094 $lxdebug->enter_sub();
2096 $form->isblank("description", $locale->text('Description missing!'));
2098 AM->save_buchungsgruppe(\%myconfig, \%$form);
2099 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
2101 $lxdebug->leave_sub();
2104 sub delete_buchungsgruppe {
2105 $lxdebug->enter_sub();
2107 AM->delete_buchungsgruppe(\%myconfig, \%$form);
2108 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
2110 $lxdebug->leave_sub();
2115 $lxdebug->enter_sub();
2117 $form->{title} = "Add";
2120 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2121 unless $form->{callback};
2126 $lxdebug->leave_sub();
2130 $lxdebug->enter_sub();
2132 $form->{title} = "Edit";
2134 AM->get_printer(\%myconfig, \%$form);
2138 $form->{orphaned} = 1;
2141 $lxdebug->leave_sub();
2145 $lxdebug->enter_sub();
2147 AM->printer(\%myconfig, \%$form);
2150 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2152 $callback = $form->escape($form->{callback});
2154 $form->{title} = $locale->text('Printer');
2156 @column_index = qw(printer_description printer_command template_code);
2158 $column_header{printer_description} =
2159 qq|<th class=listheading width=60%>|
2160 . $locale->text('Printer Description')
2162 $column_header{printer_command} =
2163 qq|<th class=listheading width=10%>|
2164 . $locale->text('Printer Command')
2166 $column_header{template_code} =
2167 qq|<th class=listheading>|
2168 . $locale->text('Template Code')
2178 <th class=listtop>$form->{title}</th>
2180 <tr height="5"></tr>
2184 <tr class=listheading>
2187 map { print "$column_header{$_}\n" } @column_index;
2193 foreach $ref (@{ $form->{ALL} }) {
2199 <tr valign=top class=listrow$i>
2203 $column_data{printer_description} =
2204 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>|;
2205 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
2206 $column_data{template_code} =
2207 qq|<td align=right>$ref->{template_code}</td>|;
2209 map { print "$column_data{$_}\n" } @column_index;
2221 <td><hr size=3 noshade></td>
2226 <form method=post action=$form->{script}>
2228 <input name=callback type=hidden value="$form->{callback}">
2230 <input type=hidden name=type value=printer>
2232 <input type=hidden name=path value=$form->{path}>
2233 <input type=hidden name=login value=$form->{login}>
2234 <input type=hidden name=password value=$form->{password}>
2236 <input class=submit type=submit name=action value="|
2237 . $locale->text('Add') . qq|">|;
2239 if ($form->{menubar}) {
2240 require "$form->{path}/menu.pl";
2252 $lxdebug->leave_sub();
2255 sub printer_header {
2256 $lxdebug->enter_sub();
2258 $form->{title} = $locale->text("$form->{title} Printer");
2260 # $locale->text('Add Printer')
2261 # $locale->text('Edit Printer')
2263 $form->{printer_description} =~ s/\"/"/g;
2264 $form->{template_code} =~ s/\"/"/g;
2265 $form->{printer_command} =~ s/\"/"/g;
2273 <form method=post action=$form->{script}>
2275 <input type=hidden name=id value=$form->{id}>
2276 <input type=hidden name=type value=printer>
2280 <th class=listtop colspan=2>$form->{title}</th>
2282 <tr height="5"></tr>
2284 <th align=right>| . $locale->text('Printer') . qq|</th>
2285 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2288 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2289 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2292 <th align=right>| . $locale->text('Template Code') . qq|</th>
2293 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2295 <td colspan=2><hr size=3 noshade></td>
2300 $lxdebug->leave_sub();
2304 $lxdebug->enter_sub();
2306 $form->isblank("printer_description", $locale->text('Description missing!'));
2307 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2308 AM->save_printer(\%myconfig, \%$form);
2309 $form->redirect($locale->text('Printer saved!'));
2311 $lxdebug->leave_sub();
2314 sub delete_printer {
2315 $lxdebug->enter_sub();
2317 AM->delete_printer(\%myconfig, \%$form);
2318 $form->redirect($locale->text('Printer deleted!'));
2320 $lxdebug->leave_sub();
2325 $lxdebug->enter_sub();
2327 $form->{title} = "Add";
2330 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2331 unless $form->{callback};
2333 $form->{terms_netto} = 0;
2334 $form->{terms_skonto} = 0;
2335 $form->{percent_skonto} = 0;
2339 $lxdebug->leave_sub();
2343 $lxdebug->enter_sub();
2345 $form->{title} = "Edit";
2347 AM->get_payment(\%myconfig, \%$form);
2351 $form->{orphaned} = 1;
2354 $lxdebug->leave_sub();
2358 $lxdebug->enter_sub();
2360 AM->payment(\%myconfig, \%$form);
2363 "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2365 $callback = $form->escape($form->{callback});
2367 $form->{title} = $locale->text('Payment Terms');
2369 @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
2371 $column_header{description} =
2372 qq|<th class=listheading>|
2373 . $locale->text('Description')
2375 $column_header{description_long} =
2376 qq|<th class=listheading>|
2377 . $locale->text('Long Description')
2379 $column_header{terms_netto} =
2380 qq|<th class=listheading>|
2381 . $locale->text('Netto Terms')
2383 $column_header{terms_skonto} =
2384 qq|<th class=listheading>|
2385 . $locale->text('Skonto Terms')
2387 $column_header{percent_skonto} =
2388 qq|<th class=listheading>|
2389 . $locale->text('Skonto')
2399 <th class=listtop>$form->{title}</th>
2401 <tr height="5"></tr>
2405 <tr class=listheading>
2408 map { print "$column_header{$_}\n" } @column_index;
2414 foreach $ref (@{ $form->{ALL} }) {
2420 <tr valign=top class=listrow$i>
2424 $column_data{description} =
2425 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>|;
2426 $column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|;
2427 $column_data{terms_netto} =
2428 qq|<td align=right>$ref->{terms_netto}</td>|;
2429 $column_data{terms_skonto} =
2430 qq|<td align=right>$ref->{terms_skonto}</td>|;
2431 $column_data{percent_skonto} =
2432 qq|<td align=right>$ref->{percent_skonto} %</td>|;
2433 map { print "$column_data{$_}\n" } @column_index;
2445 <td><hr size=3 noshade></td>
2450 <form method=post action=$form->{script}>
2452 <input name=callback type=hidden value="$form->{callback}">
2454 <input type=hidden name=type value=payment>
2456 <input type=hidden name=path value=$form->{path}>
2457 <input type=hidden name=login value=$form->{login}>
2458 <input type=hidden name=password value=$form->{password}>
2460 <input class=submit type=submit name=action value="|
2461 . $locale->text('Add') . qq|">|;
2463 if ($form->{menubar}) {
2464 require "$form->{path}/menu.pl";
2476 $lxdebug->leave_sub();
2479 sub payment_header {
2480 $lxdebug->enter_sub();
2482 $form->{title} = $locale->text("$form->{title} Payment Terms");
2484 # $locale->text('Add Payment Terms')
2485 # $locale->text('Edit Payment Terms')
2487 $form->{description} =~ s/\"/"/g;
2496 <form method=post action=$form->{script}>
2498 <input type=hidden name=id value=$form->{id}>
2499 <input type=hidden name=type value=payment>
2503 <th class=listtop colspan=2>$form->{title}</th>
2505 <tr height="5"></tr>
2507 <th align=right>| . $locale->text('Description') . qq|</th>
2508 <td><input name=description size=30 value="$form->{description}"></td>
2511 <th align=right>| . $locale->text('Long Description') . qq|</th>
2512 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2515 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2516 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2519 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2520 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2523 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2524 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2526 <td colspan=2><hr size=3 noshade></td>
2531 $lxdebug->leave_sub();
2535 $lxdebug->enter_sub();
2537 $form->isblank("description", $locale->text('Language missing!'));
2538 AM->save_payment(\%myconfig, \%$form);
2539 $form->redirect($locale->text('Payment Terms saved!'));
2541 $lxdebug->leave_sub();
2544 sub delete_payment {
2545 $lxdebug->enter_sub();
2547 AM->delete_payment(\%myconfig, \%$form);
2548 $form->redirect($locale->text('Payment terms deleted!'));
2550 $lxdebug->leave_sub();
2554 $lxdebug->enter_sub();
2556 $form->{title} = "Add";
2559 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2560 unless $form->{callback};
2565 $lxdebug->leave_sub();
2569 $lxdebug->enter_sub();
2571 $form->{title} = "Edit";
2573 AM->get_sic(\%myconfig, \%$form);
2577 $form->{orphaned} = 1;
2580 $lxdebug->leave_sub();
2584 $lxdebug->enter_sub();
2586 AM->sic(\%myconfig, \%$form);
2589 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2591 $callback = $form->escape($form->{callback});
2593 $form->{title} = $locale->text('Standard Industrial Codes');
2595 @column_index = qw(code description);
2597 $column_header{code} =
2598 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
2599 $column_header{description} =
2600 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
2609 <th class=listtop>$form->{title}</th>
2611 <tr height="5"></tr>
2615 <tr class=listheading>
2618 map { print "$column_header{$_}\n" } @column_index;
2624 foreach $ref (@{ $form->{ALL} }) {
2629 if ($ref->{sictype} eq 'H') {
2631 <tr valign=top class=listheading>
2633 $column_data{code} =
2634 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>|;
2635 $column_data{description} = qq|<th>$ref->{description}</th>|;
2639 <tr valign=top class=listrow$i>
2642 $column_data{code} =
2643 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>|;
2644 $column_data{description} = qq|<td>$ref->{description}</td>|;
2648 map { print "$column_data{$_}\n" } @column_index;
2660 <td><hr size=3 noshade></td>
2665 <form method=post action=$form->{script}>
2667 <input name=callback type=hidden value="$form->{callback}">
2669 <input type=hidden name=type value=sic>
2671 <input type=hidden name=path value=$form->{path}>
2672 <input type=hidden name=login value=$form->{login}>
2673 <input type=hidden name=password value=$form->{password}>
2675 <input class=submit type=submit name=action value="|
2676 . $locale->text('Add') . qq|">|;
2678 if ($form->{menubar}) {
2679 require "$form->{path}/menu.pl";
2690 $lxdebug->leave_sub();
2694 $lxdebug->enter_sub();
2696 $form->{title} = $locale->text("$form->{title} SIC");
2698 # $locale->text('Add SIC')
2699 # $locale->text('Edit SIC')
2701 $form->{code} =~ s/\"/"/g;
2702 $form->{description} =~ s/\"/"/g;
2704 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
2711 <form method=post action=$form->{script}>
2713 <input type=hidden name=type value=sic>
2714 <input type=hidden name=id value=$form->{code}>
2718 <th class=listtop colspan=2>$form->{title}</th>
2720 <tr height="5"></tr>
2722 <th align=right>| . $locale->text('Code') . qq|</th>
2723 <td><input name=code size=10 value=$form->{code}></td>
2727 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
2728 . $locale->text('Heading') . qq|</th>
2731 <th align=right>| . $locale->text('Description') . qq|</th>
2732 <td><input name=description size=60 value="$form->{description}"></td>
2734 <td colspan=2><hr size=3 noshade></td>
2739 $lxdebug->leave_sub();
2743 $lxdebug->enter_sub();
2745 $form->isblank("code", $locale->text('Code missing!'));
2746 $form->isblank("description", $locale->text('Description missing!'));
2747 AM->save_sic(\%myconfig, \%$form);
2748 $form->redirect($locale->text('SIC saved!'));
2750 $lxdebug->leave_sub();
2754 $lxdebug->enter_sub();
2756 AM->delete_sic(\%myconfig, \%$form);
2757 $form->redirect($locale->text('SIC deleted!'));
2759 $lxdebug->leave_sub();
2762 sub display_stylesheet {
2763 $lxdebug->enter_sub();
2765 $form->{file} = "css/$myconfig{stylesheet}";
2768 $lxdebug->leave_sub();
2772 $lxdebug->enter_sub();
2774 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2775 $form->{file} =~ s/^\/*//g;
2776 $form->{file} =~ s/$userspath//;
2778 $form->error("$!: $form->{file}") unless -f $form->{file};
2780 AM->load_template(\%$form);
2782 $form->{title} = $form->{file};
2784 # if it is anything but html
2785 if ($form->{file} !~ /\.html$/) {
2786 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2796 <form method=post action=$form->{script}>
2798 <input name=file type=hidden value=$form->{file}>
2799 <input name=type type=hidden value=template>
2801 <input type=hidden name=path value=$form->{path}>
2802 <input type=hidden name=login value=$form->{login}>
2803 <input type=hidden name=password value=$form->{password}>
2805 <input name=action type=submit class=submit value="|
2806 . $locale->text('Edit') . qq|">|;
2808 if ($form->{menubar}) {
2809 require "$form->{path}/menu.pl";
2820 $lxdebug->leave_sub();
2824 $lxdebug->enter_sub();
2826 AM->load_template(\%$form);
2828 $form->{title} = $locale->text('Edit Template');
2830 # convert   to &nbsp;
2831 $form->{body} =~ s/ /&nbsp;/gi;
2838 <form method=post action=$form->{script}>
2840 <input name=file type=hidden value=$form->{file}>
2841 <input name=type type=hidden value=template>
2843 <input type=hidden name=path value=$form->{path}>
2844 <input type=hidden name=login value=$form->{login}>
2845 <input type=hidden name=password value=$form->{password}>
2847 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
2849 <textarea name=body rows=25 cols=70>
2854 <input type=submit class=submit name=action value="|
2855 . $locale->text('Save') . qq|">|;
2857 if ($form->{menubar}) {
2858 require "$form->{path}/menu.pl";
2870 $lxdebug->leave_sub();
2874 $lxdebug->enter_sub();
2876 AM->save_template(\%$form);
2877 $form->redirect($locale->text('Template saved!'));
2879 $lxdebug->leave_sub();
2883 $lxdebug->enter_sub();
2885 # get defaults for account numbers and last numbers
2886 AM->defaultaccounts(\%myconfig, \%$form);
2888 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2890 ($item eq $myconfig{dateformat})
2891 ? "<option selected>$item\n"
2892 : "<option>$item\n";
2895 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2897 ($item eq $myconfig{numberformat})
2898 ? "<option selected>$item\n"
2899 : "<option>$item\n";
2902 foreach $item (qw(name company address signature)) {
2903 $myconfig{$item} =~ s/\"/"/g;
2906 foreach $item (qw(address signature)) {
2907 $myconfig{$item} =~ s/\\n/\r\n/g;
2911 if ($opendocument_templates && $openofficeorg_writer_bin &&
2912 $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
2913 push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
2914 "value" => "opendocument_pdf" });
2916 if ($latex_templates) {
2917 push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
2919 push(@formats, { "name" => "HTML", "value" => "html" });
2920 if ($latex_templates) {
2921 push(@formats, { "name" => $locale->text("Postscript"),
2922 "value" => "postscript" });
2924 if ($opendocument_templates) {
2925 push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
2926 "value" => "opendocument" });
2929 if (!$myconfig{"template_format"}) {
2930 $myconfig{"template_format"} = "pdf";
2932 $template_format = "";
2933 foreach $item (@formats) {
2935 "<option value=\"$item->{value}\"" .
2936 ($item->{"value"} eq $myconfig{"template_format"} ?
2938 ">" . H($item->{"name"}) . "</option>";
2941 %countrycodes = User->country_codes;
2943 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2947 ($myconfig{countrycode} eq $key)
2948 ? "<option selected value=$key>$countrycodes{$key}\n"
2949 : "<option value=$key>$countrycodes{$key}\n";
2951 $countrycodes = "<option>American English\n$countrycodes";
2953 # use an other input number format than output numberformat
2954 # look at Form.pm, sub parse_amount
2955 my $in_numberformat = '';
2956 $text1 = qq|value="0">| . $locale->text('equal Outputformat');
2957 $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
2958 @in_nf = ($text1, $text2);
2959 foreach $item (@in_nf) {
2961 (substr($item, 7, 1) eq $myconfig{in_numberformat})
2962 ? "<option selected $item\n"
2963 : "<option $item\n";
2966 foreach $key (keys %{ $form->{IC} }) {
2967 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2969 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2970 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2971 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2975 opendir CSS, "css/.";
2976 @all = grep /.*\.css$/, readdir CSS;
2979 foreach $item (@all) {
2980 if ($item eq $myconfig{stylesheet}) {
2981 $selectstylesheet .= qq|<option selected>$item\n|;
2983 $selectstylesheet .= qq|<option>$item\n|;
2986 $selectstylesheet .= "<option>\n";
2988 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2992 if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
2993 else { $newS = "checked"; }
2998 <form method=post action=$form->{script}>
3000 <input type=hidden name=old_password value=$myconfig{password}>
3001 <input type=hidden name=type value=preferences>
3002 <input type=hidden name=role value=$myconfig{role}>
3005 <tr><th class=listtop>$form->{title}</th></tr>
3010 <th align=right>| . $locale->text('Name') . qq|</th>
3011 <td><input name=name size=15 value="$myconfig{name}"></td>
3014 <th align=right>| . $locale->text('Password') . qq|</th>
3015 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
3018 <th align=right>| . $locale->text('E-mail') . qq|</th>
3019 <td><input name=email size=30 value="$myconfig{email}"></td>
3022 <th align=right>| . $locale->text('Signature') . qq|</th>
3023 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
3026 <th align=right>| . $locale->text('Phone') . qq|</th>
3027 <td><input name=tel size=14 value="$myconfig{tel}"></td>
3030 <th align=right>| . $locale->text('Fax') . qq|</th>
3031 <td><input name=fax size=14 value="$myconfig{fax}"></td>
3034 <th align=right>| . $locale->text('Company') . qq|</th>
3035 <td><input name=company size=30 value="$myconfig{company}"></td>
3038 <th align=right>| . $locale->text('Address') . qq|</th>
3039 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
3042 <th align=right>| . $locale->text('Date Format') . qq|</th>
3043 <td><select name=dateformat>$dateformat</select></td>
3046 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
3047 <td><select name=numberformat>$numberformat</select></td>
3050 <th align=right>| . $locale->text('Input Number Format') . qq|</th>
3051 <td><select name=in_numberformat>$in_numberformat</select></td>
3055 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
3056 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
3059 <th align=right>| . $locale->text('Language') . qq|</th>
3060 <td><select name=countrycode>$countrycodes</select></td>
3063 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
3064 <td><select name=usestylesheet>$selectstylesheet</select></td>
3067 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
3068 <td><input name=menustyle type=radio class=radio value=neu $newS> New
3069 <input name=menustyle type=radio class=radio value=old $oldS> Old</td>
3071 <input name=printer type=hidden value="$myconfig{printer}">
3072 <tr class=listheading>
3073 <th colspan=2>| . $locale->text("Print options") . qq|</th>
3076 <th align=right>| . $locale->text('Default template format') . qq|</th>
3077 <td><select name="template_format">$template_format</select></td>
3080 <th align=right>| . $locale->text('Number of copies') . qq|</th>
3081 <td><input name="copies" size="10" value="| .
3082 $form->quote($myconfig{"copies"}) . qq|"></td>
3086 <tr class=listheading>
3087 <th colspan=2> </th>
3090 <th align=right>| . $locale->text('Business Number') . qq|</th>
3091 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
3097 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
3098 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
3099 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
3100 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
3105 <tr class=listheading>
3107 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
3113 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
3114 <td><select name=inventory_accno>$myconfig{IC}</select></td>
3117 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
3118 <td><select name=income_accno>$myconfig{IC_income}</select></td>
3121 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
3122 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
3125 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
3126 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
3129 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
3130 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
3135 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
3137 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
3146 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
3147 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
3148 <th align=right nowrap>|
3149 . $locale->text('Last Customer Number') . qq|</th>
3150 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
3153 <th align=right nowrap>|
3154 . $locale->text('Last Credit Note Number') . qq|</th>
3155 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
3156 <th align=right nowrap>|
3157 . $locale->text('Last Vendor Number') . qq|</th>
3158 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
3161 <th align=right nowrap>|
3162 . $locale->text('Last Sales Order Number') . qq|</th>
3163 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
3166 <th align=right nowrap>|
3167 . $locale->text('Last Purchase Order Number') . qq|</th>
3168 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
3169 <th align=right nowrap>|
3170 . $locale->text('Last Article Number') . qq|</th>
3171 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
3174 <th align=right nowrap>|
3175 . $locale->text('Last Sales Quotation Number') . qq|</th>
3176 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
3177 <th align=right nowrap>|
3178 . $locale->text('Last Service Number') . qq|</th>
3179 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
3182 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
3183 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
3184 <th align=right nowrap></th>
3190 # <tr class=listheading>
3191 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3198 # <th>| . $locale->text('Rate') . qq| (%)</th>
3199 # <th>| . $locale->text('Number') . qq|</th>
3203 # foreach $accno (sort keys %{ $form->{taxrates} }) {
3206 # <th align=right>$form->{taxrates}{$accno}{description}</th>
3207 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3208 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3211 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3214 # chop $form->{taxaccounts};
3217 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3226 <td><hr size=3 noshade></td>
3230 <input type=hidden name=path value=$form->{path}>
3231 <input type=hidden name=login value=$form->{login}>
3232 <input type=hidden name=password value=$form->{password}>
3235 <input type=submit class=submit name=action value="|
3236 . $locale->text('Save') . qq|">|;
3238 if ($form->{menubar}) {
3239 require "$form->{path}/menu.pl";
3250 $lxdebug->leave_sub();
3253 sub save_preferences {
3254 $lxdebug->enter_sub();
3256 $form->{stylesheet} = $form->{usestylesheet};
3258 $form->redirect($locale->text('Preferences saved!'))
3260 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3262 $form->error($locale->text('Cannot save preferences!'));
3264 $lxdebug->leave_sub();
3268 $lxdebug->enter_sub();
3270 if ($form->{media} eq 'email') {
3271 $form->error($locale->text('No email address for') . " $myconfig{name}")
3272 unless ($myconfig{email});
3274 $form->{OUT} = "$sendmail";
3278 AM->backup(\%myconfig, \%$form, $userspath);
3280 if ($form->{media} eq 'email') {
3281 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
3284 $lxdebug->leave_sub();
3288 $lxdebug->enter_sub();
3290 $form->{title} = $locale->text('Audit Control');
3292 AM->closedto(\%myconfig, \%$form);
3294 if ($form->{revtrans}) {
3295 $checked{Y} = "checked";
3297 $checked{N} = "checked";
3305 <form method=post action=$form->{script}>
3307 <input type=hidden name=path value=$form->{path}>
3308 <input type=hidden name=login value=$form->{login}>
3309 <input type=hidden name=password value=$form->{password}>
3312 <tr><th class=listtop>$form->{title}</th></tr>
3313 <tr height="5"></tr>
3319 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3320 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3321 . $locale->text('Yes')
3322 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3323 . $locale->text('No')
3327 <th>| . $locale->text('Close Books up to') . qq|</th>
3328 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3338 <input type=hidden name=nextsub value=doclose>
3340 <input type=submit class=submit name=action value="|
3341 . $locale->text('Continue') . qq|">
3349 $lxdebug->leave_sub();
3353 $lxdebug->enter_sub();
3355 AM->closebooks(\%myconfig, \%$form);
3357 if ($form->{revtrans}) {
3359 $locale->text('Transaction reversal enforced for all dates'));
3361 if ($form->{closedto}) {
3363 $locale->text('Transaction reversal enforced up to') . " "
3364 . $locale->date(\%myconfig, $form->{closedto}, 1));
3366 $form->redirect($locale->text('Books are open'));
3370 $lxdebug->leave_sub();
3374 $lxdebug->enter_sub();
3376 $form->{title} = "Add";
3379 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
3380 unless $form->{callback};
3385 $lxdebug->leave_sub();
3388 sub edit_warehouse {
3389 $lxdebug->enter_sub();
3391 $form->{title} = "Edit";
3393 AM->get_warehouse(\%myconfig, \%$form);
3398 $lxdebug->leave_sub();
3401 sub list_warehouse {
3402 $lxdebug->enter_sub();
3404 AM->warehouses(\%myconfig, \%$form);
3407 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
3409 $callback = $form->escape($form->{callback});
3411 $form->{title} = $locale->text('Warehouses');
3413 @column_index = qw(description);
3415 $column_header{description} =
3416 qq|<th class=listheading width=100%>|
3417 . $locale->text('Description')
3427 <th class=listtop>$form->{title}</th>
3429 <tr height="5"></tr>
3433 <tr class=listheading>
3436 map { print "$column_header{$_}\n" } @column_index;
3442 foreach $ref (@{ $form->{ALL} }) {
3448 <tr valign=top class=listrow$i>
3451 $column_data{description} =
3452 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>|;
3454 map { print "$column_data{$_}\n" } @column_index;
3466 <td><hr size=3 noshade></td>
3471 <form method=post action=$form->{script}>
3473 <input name=callback type=hidden value="$form->{callback}">
3475 <input type=hidden name=type value=warehouse>
3477 <input type=hidden name=path value=$form->{path}>
3478 <input type=hidden name=login value=$form->{login}>
3479 <input type=hidden name=password value=$form->{password}>
3481 <input class=submit type=submit name=action value="|
3482 . $locale->text('Add') . qq|">|;
3484 if ($form->{menubar}) {
3485 require "$form->{path}/menu.pl";
3496 $lxdebug->leave_sub();
3499 sub warehouse_header {
3500 $lxdebug->enter_sub();
3502 $form->{title} = $locale->text("$form->{title} Warehouse");
3504 # $locale->text('Add Warehouse')
3505 # $locale->text('Edit Warehouse')
3507 $form->{description} =~ s/\"/"/g;
3509 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
3511 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
3514 qq|<input name=description size=60 value="$form->{description}">|;
3522 <form method=post action=$form->{script}>
3524 <input type=hidden name=id value=$form->{id}>
3525 <input type=hidden name=type value=warehouse>
3529 <th class=listtop colspan=2>$form->{title}</th>
3531 <tr height="5"></tr>
3533 <th align=right>| . $locale->text('Description') . qq|</th>
3534 <td>$description</td>
3537 <td colspan=2><hr size=3 noshade></td>
3542 $lxdebug->leave_sub();
3545 sub save_warehouse {
3546 $lxdebug->enter_sub();
3548 $form->isblank("description", $locale->text('Description missing!'));
3549 AM->save_warehouse(\%myconfig, \%$form);
3550 $form->redirect($locale->text('Warehouse saved!'));
3552 $lxdebug->leave_sub();
3555 sub delete_warehouse {
3556 $lxdebug->enter_sub();
3558 AM->delete_warehouse(\%myconfig, \%$form);
3559 $form->redirect($locale->text('Warehouse deleted!'));
3561 $lxdebug->leave_sub();
3565 $lxdebug->enter_sub();
3567 &{ $form->{nextsub} };
3569 $lxdebug->leave_sub();
3573 $lxdebug->enter_sub();
3575 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3576 AM->units_in_use(\%myconfig, $form, $units);
3577 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3579 @languages = AM->language(\%myconfig, $form, 1);
3582 foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3583 map({ push(@unit_list, $units->{$_}); }
3584 sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3585 grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3588 foreach (@unit_list) {
3589 $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"});
3590 $_->{"UNITLANGUAGES"} = [];
3591 foreach my $lang (@languages) {
3592 push(@{ $_->{"UNITLANGUAGES"} },
3594 "unit" => $_->{"name"},
3595 "language_id" => $lang->{"id"},
3596 "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
3597 "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
3603 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3604 $ddbox = AM->unit_select_data($units, undef, 1);
3606 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3608 print($form->parse_html_template("am/edit_units",
3609 { "UNITS" => \@unit_list,
3610 "NEW_BASE_UNIT_DDBOX" => $ddbox,
3611 "LANGUAGES" => \@languages }));
3613 $lxdebug->leave_sub();
3617 $lxdebug->enter_sub();
3619 $form->isblank("new_name", $locale->text("The name is missing."));
3620 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3621 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($units->{$form->{"new_name"}});
3623 my ($base_unit, $factor);
3624 if ($form->{"new_base_unit"}) {
3625 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3627 $form->isblank("new_factor", $locale->text("The factor is missing."));
3628 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3629 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3630 $base_unit = $form->{"new_base_unit"};
3634 foreach my $lang (AM->language(\%myconfig, $form, 1)) {
3635 next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
3636 push(@languages, { "id" => $lang->{"id"},
3637 "localized" => $form->{"new_localized_$lang->{id}"},
3638 "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
3642 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
3644 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3648 $lxdebug->leave_sub();
3651 sub set_unit_languages {
3652 $lxdebug->enter_sub();
3654 my ($unit, $languages, $idx) = @_;
3656 $unit->{"LANGUAGES"} = [];
3658 foreach my $lang (@{$languages}) {
3659 push(@{ $unit->{"LANGUAGES"} },
3660 { "id" => $lang->{"id"},
3661 "localized" => $form->{"localized_${idx}_$lang->{id}"},
3662 "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
3666 $lxdebug->leave_sub();
3670 $lxdebug->enter_sub();
3672 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3673 AM->units_in_use(\%myconfig, $form, $old_units);
3675 @languages = AM->language(\%myconfig, $form, 1);
3679 foreach $i (1..($form->{"rowcount"} * 1)) {
3680 $old_unit = $old_units->{$form->{"old_name_$i"}};
3682 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3685 if ($form->{"unchangeable_$i"}) {
3686 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3687 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3688 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3692 if ($old_unit->{"in_use"}) {
3693 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3696 if ($form->{"delete_$i"}) {
3697 push(@delete_units, $old_unit->{"name"});
3701 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3703 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3704 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3705 $new_units->{$form->{"name_$i"}} = \%h;
3706 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3707 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3710 foreach $unit (values(%{$new_units})) {
3711 next unless ($unit->{"old_name"});
3712 if ($unit->{"base_unit"}) {
3713 $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"}))
3714 unless (defined($new_units->{$unit->{"base_unit"}}));
3715 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3716 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3718 $unit->{"base_unit"} = undef;
3719 $unit->{"factor"} = undef;
3723 foreach $unit (values(%{$new_units})) {
3724 next if ($unit->{"unchanged_unit"});
3726 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3728 while ($new_unit->{"base_unit"}) {
3729 $new_unit->{"seen"} = 1;
3730 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3731 if ($new_unit->{"seen"}) {
3732 $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, " .
3733 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3738 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3740 $form->{"saved_message"} = $locale->text("The units have been saved.");
3744 $lxdebug->leave_sub();