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);
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')
1557 <th class=listtop>$form->{title}</th>
1559 <tr height="5"></tr>
1563 <tr class=listheading>
1566 map { print "$column_header{$_}\n" } @column_index;
1572 foreach $ref (@{ $form->{ALL} }) {
1578 <tr valign=top class=listrow$i>
1582 $column_data{description} =
1583 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>|;
1584 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1585 $column_data{article_code} =
1586 qq|<td align=right>$ref->{article_code}</td>|;
1588 map { print "$column_data{$_}\n" } @column_index;
1600 <td><hr size=3 noshade></td>
1605 <form method=post action=$form->{script}>
1607 <input name=callback type=hidden value="$form->{callback}">
1609 <input type=hidden name=type value=language>
1611 <input type=hidden name=path value=$form->{path}>
1612 <input type=hidden name=login value=$form->{login}>
1613 <input type=hidden name=password value=$form->{password}>
1615 <input class=submit type=submit name=action value="|
1616 . $locale->text('Add') . qq|">|;
1618 if ($form->{menubar}) {
1619 require "$form->{path}/menu.pl";
1631 $lxdebug->leave_sub();
1634 sub language_header {
1635 $lxdebug->enter_sub();
1637 $form->{title} = $locale->text("$form->{title} Language");
1639 # $locale->text('Add Language')
1640 # $locale->text('Edit Language')
1642 $form->{description} =~ s/\"/"/g;
1643 $form->{template_code} =~ s/\"/"/g;
1644 $form->{article_code} =~ s/\"/"/g;
1652 <form method=post action=$form->{script}>
1654 <input type=hidden name=id value=$form->{id}>
1655 <input type=hidden name=type value=language>
1659 <th class=listtop colspan=2>$form->{title}</th>
1661 <tr height="5"></tr>
1663 <th align=right>| . $locale->text('Language') . qq|</th>
1664 <td><input name=description size=30 value="$form->{description}"></td>
1667 <th align=right>| . $locale->text('Template Code') . qq|</th>
1668 <td><input name=template_code size=5 value=$form->{template_code}></td>
1671 <th align=right>| . $locale->text('Article Code') . qq|</th>
1672 <td><input name=article_code size=10 value=$form->{article_code}></td>
1674 <td colspan=2><hr size=3 noshade></td>
1679 $lxdebug->leave_sub();
1683 $lxdebug->enter_sub();
1685 $form->isblank("description", $locale->text('Language missing!'));
1686 $form->isblank("template_code", $locale->text('Template Code missing!'));
1687 $form->isblank("article_code", $locale->text('Article Code missing!'));
1688 AM->save_language(\%myconfig, \%$form);
1689 $form->redirect($locale->text('Language saved!'));
1691 $lxdebug->leave_sub();
1694 sub delete_language {
1695 $lxdebug->enter_sub();
1697 AM->delete_language(\%myconfig, \%$form);
1698 $form->redirect($locale->text('Language deleted!'));
1700 $lxdebug->leave_sub();
1704 sub add_buchungsgruppe {
1705 $lxdebug->enter_sub();
1707 # $locale->text("Add Buchungsgruppe")
1708 # $locale->text("Edit Buchungsgruppe")
1709 $form->{title} = "Add";
1712 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1713 unless $form->{callback};
1714 AM->get_buchungsgruppe(\%myconfig, \%$form);
1716 $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
1719 &buchungsgruppe_header;
1722 $lxdebug->leave_sub();
1725 sub edit_buchungsgruppe {
1726 $lxdebug->enter_sub();
1728 $form->{title} = "Edit";
1730 AM->get_buchungsgruppe(\%myconfig, \%$form);
1732 &buchungsgruppe_header;
1736 $lxdebug->leave_sub();
1739 sub list_buchungsgruppe {
1740 $lxdebug->enter_sub();
1742 AM->buchungsgruppe(\%myconfig, \%$form);
1745 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1747 $callback = $form->escape($form->{callback});
1749 $form->{title} = $locale->text('Buchungsgruppen');
1751 @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 );
1753 $column_header{description} =
1754 qq|<th class=listheading width=60%>|
1755 . $locale->text('Description')
1757 $column_header{inventory_accno} =
1758 qq|<th class=listheading width=10%>|
1759 . $locale->text('Bestandskonto')
1761 $column_header{income_accno_0} =
1762 qq|<th class=listheading>|
1763 . $locale->text('Erlöse Inland')
1765 $column_header{expense_accno_0} =
1766 qq|<th class=listheading>|
1767 . $locale->text('Aufwand Inland')
1769 $column_header{income_accno_1} =
1770 qq|<th class=listheading>|
1771 . $locale->text('Erlöse EU m. UStId')
1773 $column_header{expense_accno_1} =
1774 qq|<th class=listheading>|
1775 . $locale->text('Aufwand EU m. UStId')
1777 $column_header{income_accno_2} =
1778 qq|<th class=listheading>|
1779 . $locale->text('Erlöse EU o. UStId')
1781 $column_header{expense_accno_2} =
1782 qq|<th class=listheading>|
1783 . $locale->text('Aufwand EU o. UStId')
1785 $column_header{income_accno_3} =
1786 qq|<th class=listheading>|
1787 . $locale->text('Erlöse Ausland')
1789 $column_header{expense_accno_3} =
1790 qq|<th class=listheading>|
1791 . $locale->text('Aufwand Ausland')
1800 <th class=listtop>$form->{title}</th>
1802 <tr height="5"></tr>
1806 <tr class=listheading>
1809 map { print "$column_header{$_}\n" } @column_index;
1815 foreach $ref (@{ $form->{ALL} }) {
1821 <tr valign=top class=listrow$i>
1825 $column_data{description} =
1826 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>|;
1827 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1828 $column_data{income_accno_0} =
1829 qq|<td align=right>$ref->{income_accno_0}</td>|;
1830 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1831 $column_data{income_accno_1} =
1832 qq|<td align=right>$ref->{income_accno_1}</td>|;
1833 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1834 $column_data{income_accno_2} =
1835 qq|<td align=right>$ref->{income_accno_2}</td>|;
1836 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1837 $column_data{income_accno_3} =
1838 qq|<td align=right>$ref->{income_accno_3}</td>|;
1839 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1841 map { print "$column_data{$_}\n" } @column_index;
1853 <td><hr size=3 noshade></td>
1858 <form method=post action=$form->{script}>
1860 <input name=callback type=hidden value="$form->{callback}">
1862 <input type=hidden name=type value=buchungsgruppe>
1864 <input type=hidden name=path value=$form->{path}>
1865 <input type=hidden name=login value=$form->{login}>
1866 <input type=hidden name=password value=$form->{password}>
1868 <input class=submit type=submit name=action value="|
1869 . $locale->text('Add') . qq|">|;
1871 if ($form->{menubar}) {
1872 require "$form->{path}/menu.pl";
1884 $lxdebug->leave_sub();
1887 sub buchungsgruppe_header {
1888 $lxdebug->enter_sub();
1890 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1892 # $locale->text('Buchungsgruppe hinzufügen')
1893 # $locale->text('Buchungsgruppe bearbeiten')
1895 my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
1896 my %acc_type_map = (
1897 "IC" => $acc_inventory,
1898 "IC_income" => $acc_income,
1899 "IC_sale" => $acc_income,
1900 "IC_expense" => $acc_expense,
1901 "IC_cogs" => $acc_expense,
1904 foreach $key (keys(%acc_type_map)) {
1905 foreach $ref (@{ $form->{IC_links}{$key} }) {
1906 $acc_type_map{$key}->{$ref->{"id"}} = $ref;
1910 foreach my $type (qw(IC IC_income IC_expense)) {
1911 $form->{"select$type"} =
1913 map({ "<option value=$_->{id} $_->{selected}>" .
1914 "$_->{accno}--" . H($_->{description}) . "</option>" }
1915 sort({ $a->{"accno"} cmp $b->{"accno"} }
1916 values(%{$acc_type_map{$type}}))));
1920 $form->{selectIC} =~ s/selected//g;
1921 $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/;
1922 $form->{selectIC_income} =~ s/selected//g;
1923 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1924 $form->{selectIC_expense} =~ s/selected//g;
1925 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1931 <th align=right>| . $locale->text('Inventory') . qq|</th>
1932 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1933 <input name=selectIC type=hidden value="$form->{selectIC}">
1937 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
1941 $linkaccounts .= qq|
1943 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
1944 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
1947 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
1948 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
1951 $form->{selectIC_income} =~ s/selected//g;
1952 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
1953 $form->{selectIC_expense} =~ s/selected//g;
1954 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
1956 $linkaccounts .= qq| <tr>
1957 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
1958 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
1961 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
1962 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
1966 $form->{selectIC_income} =~ s/selected//g;
1967 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
1968 $form->{selectIC_expense} =~ s/selected//g;
1969 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
1972 $linkaccounts .= qq| <tr>
1973 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
1974 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
1977 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
1978 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
1982 $form->{selectIC_income} =~ s/selected//g;
1983 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
1984 $form->{selectIC_expense} =~ s/selected//g;
1985 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
1988 $linkaccounts .= qq| <tr>
1989 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
1990 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
1993 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
1994 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
2004 <form method=post action=$form->{script}>
2006 <input type=hidden name=id value=$form->{id}>
2007 <input type=hidden name=type value=buchungsgruppe>
2011 <th class=listtop colspan=2>$form->{title}</th>
2013 <tr height="5"></tr>
2015 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
2016 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
2019 <td colspan=2><hr size=3 noshade></td>
2024 $lxdebug->leave_sub();
2027 sub save_buchungsgruppe {
2028 $lxdebug->enter_sub();
2030 $form->isblank("description", $locale->text('Description missing!'));
2032 AM->save_buchungsgruppe(\%myconfig, \%$form);
2033 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
2035 $lxdebug->leave_sub();
2038 sub delete_buchungsgruppe {
2039 $lxdebug->enter_sub();
2041 AM->delete_buchungsgruppe(\%myconfig, \%$form);
2042 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
2044 $lxdebug->leave_sub();
2049 $lxdebug->enter_sub();
2051 $form->{title} = "Add";
2054 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2055 unless $form->{callback};
2060 $lxdebug->leave_sub();
2064 $lxdebug->enter_sub();
2066 $form->{title} = "Edit";
2068 AM->get_printer(\%myconfig, \%$form);
2072 $form->{orphaned} = 1;
2075 $lxdebug->leave_sub();
2079 $lxdebug->enter_sub();
2081 AM->printer(\%myconfig, \%$form);
2084 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2086 $callback = $form->escape($form->{callback});
2088 $form->{title} = $locale->text('Printer');
2090 @column_index = qw(printer_description printer_command template_code);
2092 $column_header{printer_description} =
2093 qq|<th class=listheading width=60%>|
2094 . $locale->text('Printer Description')
2096 $column_header{printer_command} =
2097 qq|<th class=listheading width=10%>|
2098 . $locale->text('Printer Command')
2100 $column_header{template_code} =
2101 qq|<th class=listheading>|
2102 . $locale->text('Template Code')
2112 <th class=listtop>$form->{title}</th>
2114 <tr height="5"></tr>
2118 <tr class=listheading>
2121 map { print "$column_header{$_}\n" } @column_index;
2127 foreach $ref (@{ $form->{ALL} }) {
2133 <tr valign=top class=listrow$i>
2137 $column_data{printer_description} =
2138 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>|;
2139 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
2140 $column_data{template_code} =
2141 qq|<td align=right>$ref->{template_code}</td>|;
2143 map { print "$column_data{$_}\n" } @column_index;
2155 <td><hr size=3 noshade></td>
2160 <form method=post action=$form->{script}>
2162 <input name=callback type=hidden value="$form->{callback}">
2164 <input type=hidden name=type value=printer>
2166 <input type=hidden name=path value=$form->{path}>
2167 <input type=hidden name=login value=$form->{login}>
2168 <input type=hidden name=password value=$form->{password}>
2170 <input class=submit type=submit name=action value="|
2171 . $locale->text('Add') . qq|">|;
2173 if ($form->{menubar}) {
2174 require "$form->{path}/menu.pl";
2186 $lxdebug->leave_sub();
2189 sub printer_header {
2190 $lxdebug->enter_sub();
2192 $form->{title} = $locale->text("$form->{title} Printer");
2194 # $locale->text('Add Printer')
2195 # $locale->text('Edit Printer')
2197 $form->{printer_description} =~ s/\"/"/g;
2198 $form->{template_code} =~ s/\"/"/g;
2199 $form->{printer_command} =~ s/\"/"/g;
2207 <form method=post action=$form->{script}>
2209 <input type=hidden name=id value=$form->{id}>
2210 <input type=hidden name=type value=printer>
2214 <th class=listtop colspan=2>$form->{title}</th>
2216 <tr height="5"></tr>
2218 <th align=right>| . $locale->text('Printer') . qq|</th>
2219 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2222 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2223 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2226 <th align=right>| . $locale->text('Template Code') . qq|</th>
2227 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2229 <td colspan=2><hr size=3 noshade></td>
2234 $lxdebug->leave_sub();
2238 $lxdebug->enter_sub();
2240 $form->isblank("printer_description", $locale->text('Description missing!'));
2241 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2242 AM->save_printer(\%myconfig, \%$form);
2243 $form->redirect($locale->text('Printer saved!'));
2245 $lxdebug->leave_sub();
2248 sub delete_printer {
2249 $lxdebug->enter_sub();
2251 AM->delete_printer(\%myconfig, \%$form);
2252 $form->redirect($locale->text('Printer deleted!'));
2254 $lxdebug->leave_sub();
2259 $lxdebug->enter_sub();
2261 $form->{title} = "Add";
2264 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2265 unless $form->{callback};
2270 $lxdebug->leave_sub();
2274 $lxdebug->enter_sub();
2276 $form->{title} = "Edit";
2278 AM->get_payment(\%myconfig, \%$form);
2282 $form->{orphaned} = 1;
2285 $lxdebug->leave_sub();
2289 $lxdebug->enter_sub();
2291 AM->payment(\%myconfig, \%$form);
2294 "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2296 $callback = $form->escape($form->{callback});
2298 $form->{title} = $locale->text('Payment Terms');
2300 @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
2302 $column_header{description} =
2303 qq|<th class=listheading>|
2304 . $locale->text('Description')
2306 $column_header{description_long} =
2307 qq|<th class=listheading>|
2308 . $locale->text('Long Description')
2310 $column_header{terms_netto} =
2311 qq|<th class=listheading>|
2312 . $locale->text('Netto Terms')
2314 $column_header{terms_skonto} =
2315 qq|<th class=listheading>|
2316 . $locale->text('Skonto Terms')
2318 $column_header{percent_skonto} =
2319 qq|<th class=listheading>|
2320 . $locale->text('Skonto')
2330 <th class=listtop>$form->{title}</th>
2332 <tr height="5"></tr>
2336 <tr class=listheading>
2339 map { print "$column_header{$_}\n" } @column_index;
2345 foreach $ref (@{ $form->{ALL} }) {
2351 <tr valign=top class=listrow$i>
2355 $column_data{description} =
2356 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>|;
2357 $column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|;
2358 $column_data{terms_netto} =
2359 qq|<td align=right>$ref->{terms_netto}</td>|;
2360 $column_data{terms_skonto} =
2361 qq|<td align=right>$ref->{terms_skonto}</td>|;
2362 $column_data{percent_skonto} =
2363 qq|<td align=right>$ref->{percent_skonto} %</td>|;
2364 map { print "$column_data{$_}\n" } @column_index;
2376 <td><hr size=3 noshade></td>
2381 <form method=post action=$form->{script}>
2383 <input name=callback type=hidden value="$form->{callback}">
2385 <input type=hidden name=type value=business>
2387 <input type=hidden name=path value=$form->{path}>
2388 <input type=hidden name=login value=$form->{login}>
2389 <input type=hidden name=password value=$form->{password}>
2391 <input class=submit type=submit name=action value="|
2392 . $locale->text('Add') . qq|">|;
2394 if ($form->{menubar}) {
2395 require "$form->{path}/menu.pl";
2407 $lxdebug->leave_sub();
2410 sub payment_header {
2411 $lxdebug->enter_sub();
2413 $form->{title} = $locale->text("$form->{title} Payment Terms");
2415 # $locale->text('Add Payment Terms')
2416 # $locale->text('Edit Payment Terms')
2418 $form->{description} =~ s/\"/"/g;
2427 <form method=post action=$form->{script}>
2429 <input type=hidden name=id value=$form->{id}>
2430 <input type=hidden name=type value=payment>
2434 <th class=listtop colspan=2>$form->{title}</th>
2436 <tr height="5"></tr>
2438 <th align=right>| . $locale->text('Description') . qq|</th>
2439 <td><input name=description size=30 value="$form->{description}"></td>
2442 <th align=right>| . $locale->text('Ranking') . qq|</th>
2443 <td><input name=ranking size=30 value="$form->{ranking}"></td>
2446 <th align=right>| . $locale->text('Long Description') . qq|</th>
2447 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2450 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2451 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2454 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2455 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2458 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2459 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2461 <td colspan=2><hr size=3 noshade></td>
2466 $lxdebug->leave_sub();
2470 $lxdebug->enter_sub();
2472 $form->isblank("description", $locale->text('Language missing!'));
2473 AM->save_payment(\%myconfig, \%$form);
2474 $form->redirect($locale->text('Payment Terms saved!'));
2476 $lxdebug->leave_sub();
2479 sub delete_payment {
2480 $lxdebug->enter_sub();
2482 AM->delete_payment(\%myconfig, \%$form);
2483 $form->redirect($locale->text('Payment terms deleted!'));
2485 $lxdebug->leave_sub();
2489 $lxdebug->enter_sub();
2491 $form->{title} = "Add";
2494 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2495 unless $form->{callback};
2500 $lxdebug->leave_sub();
2504 $lxdebug->enter_sub();
2506 $form->{title} = "Edit";
2508 AM->get_sic(\%myconfig, \%$form);
2512 $form->{orphaned} = 1;
2515 $lxdebug->leave_sub();
2519 $lxdebug->enter_sub();
2521 AM->sic(\%myconfig, \%$form);
2524 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2526 $callback = $form->escape($form->{callback});
2528 $form->{title} = $locale->text('Standard Industrial Codes');
2530 @column_index = qw(code description);
2532 $column_header{code} =
2533 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
2534 $column_header{description} =
2535 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
2544 <th class=listtop>$form->{title}</th>
2546 <tr height="5"></tr>
2550 <tr class=listheading>
2553 map { print "$column_header{$_}\n" } @column_index;
2559 foreach $ref (@{ $form->{ALL} }) {
2564 if ($ref->{sictype} eq 'H') {
2566 <tr valign=top class=listheading>
2568 $column_data{code} =
2569 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>|;
2570 $column_data{description} = qq|<th>$ref->{description}</th>|;
2574 <tr valign=top class=listrow$i>
2577 $column_data{code} =
2578 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>|;
2579 $column_data{description} = qq|<td>$ref->{description}</td>|;
2583 map { print "$column_data{$_}\n" } @column_index;
2595 <td><hr size=3 noshade></td>
2600 <form method=post action=$form->{script}>
2602 <input name=callback type=hidden value="$form->{callback}">
2604 <input type=hidden name=type value=sic>
2606 <input type=hidden name=path value=$form->{path}>
2607 <input type=hidden name=login value=$form->{login}>
2608 <input type=hidden name=password value=$form->{password}>
2610 <input class=submit type=submit name=action value="|
2611 . $locale->text('Add') . qq|">|;
2613 if ($form->{menubar}) {
2614 require "$form->{path}/menu.pl";
2625 $lxdebug->leave_sub();
2629 $lxdebug->enter_sub();
2631 $form->{title} = $locale->text("$form->{title} SIC");
2633 # $locale->text('Add SIC')
2634 # $locale->text('Edit SIC')
2636 $form->{code} =~ s/\"/"/g;
2637 $form->{description} =~ s/\"/"/g;
2639 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
2646 <form method=post action=$form->{script}>
2648 <input type=hidden name=type value=sic>
2649 <input type=hidden name=id value=$form->{code}>
2653 <th class=listtop colspan=2>$form->{title}</th>
2655 <tr height="5"></tr>
2657 <th align=right>| . $locale->text('Code') . qq|</th>
2658 <td><input name=code size=10 value=$form->{code}></td>
2662 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
2663 . $locale->text('Heading') . qq|</th>
2666 <th align=right>| . $locale->text('Description') . qq|</th>
2667 <td><input name=description size=60 value="$form->{description}"></td>
2669 <td colspan=2><hr size=3 noshade></td>
2674 $lxdebug->leave_sub();
2678 $lxdebug->enter_sub();
2680 $form->isblank("code", $locale->text('Code missing!'));
2681 $form->isblank("description", $locale->text('Description missing!'));
2682 AM->save_sic(\%myconfig, \%$form);
2683 $form->redirect($locale->text('SIC saved!'));
2685 $lxdebug->leave_sub();
2689 $lxdebug->enter_sub();
2691 AM->delete_sic(\%myconfig, \%$form);
2692 $form->redirect($locale->text('SIC deleted!'));
2694 $lxdebug->leave_sub();
2697 sub display_stylesheet {
2698 $lxdebug->enter_sub();
2700 $form->{file} = "css/$myconfig{stylesheet}";
2703 $lxdebug->leave_sub();
2707 $lxdebug->enter_sub();
2709 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2710 $form->{file} =~ s/^\/*//g;
2711 $form->{file} =~ s/$userspath//;
2713 $form->error("$!: $form->{file}") unless -f $form->{file};
2715 AM->load_template(\%$form);
2717 $form->{title} = $form->{file};
2719 # if it is anything but html
2720 if ($form->{file} !~ /\.html$/) {
2721 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2731 <form method=post action=$form->{script}>
2733 <input name=file type=hidden value=$form->{file}>
2734 <input name=type type=hidden value=template>
2736 <input type=hidden name=path value=$form->{path}>
2737 <input type=hidden name=login value=$form->{login}>
2738 <input type=hidden name=password value=$form->{password}>
2740 <input name=action type=submit class=submit value="|
2741 . $locale->text('Edit') . qq|">|;
2743 if ($form->{menubar}) {
2744 require "$form->{path}/menu.pl";
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|">|;
2792 if ($form->{menubar}) {
2793 require "$form->{path}/menu.pl";
2805 $lxdebug->leave_sub();
2809 $lxdebug->enter_sub();
2811 AM->save_template(\%$form);
2812 $form->redirect($locale->text('Template saved!'));
2814 $lxdebug->leave_sub();
2818 $lxdebug->enter_sub();
2820 # get defaults for account numbers and last numbers
2821 AM->defaultaccounts(\%myconfig, \%$form);
2823 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2825 ($item eq $myconfig{dateformat})
2826 ? "<option selected>$item\n"
2827 : "<option>$item\n";
2830 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2832 ($item eq $myconfig{numberformat})
2833 ? "<option selected>$item\n"
2834 : "<option>$item\n";
2837 foreach $item (qw(name company address signature)) {
2838 $myconfig{$item} =~ s/\"/"/g;
2841 foreach $item (qw(address signature)) {
2842 $myconfig{$item} =~ s/\\n/\r\n/g;
2845 %countrycodes = User->country_codes;
2847 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2851 ($myconfig{countrycode} eq $key)
2852 ? "<option selected value=$key>$countrycodes{$key}\n"
2853 : "<option value=$key>$countrycodes{$key}\n";
2855 $countrycodes = "<option>American English\n$countrycodes";
2857 # use an other input number format than output numberformat
2858 # look at Form.pm, sub parse_amount
2859 my $in_numberformat = '';
2860 $text1 = qq|value="0">| . $locale->text('equal Outputformat');
2861 $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
2862 @in_nf = ($text1, $text2);
2863 foreach $item (@in_nf) {
2865 (substr($item, 7, 1) eq $myconfig{in_numberformat})
2866 ? "<option selected $item\n"
2867 : "<option $item\n";
2870 foreach $key (keys %{ $form->{IC} }) {
2871 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2873 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2874 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2875 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2879 opendir CSS, "css/.";
2880 @all = grep /.*\.css$/, readdir CSS;
2883 foreach $item (@all) {
2884 if ($item eq $myconfig{stylesheet}) {
2885 $selectstylesheet .= qq|<option selected>$item\n|;
2887 $selectstylesheet .= qq|<option>$item\n|;
2890 $selectstylesheet .= "<option>\n";
2892 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2896 if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
2897 else { $newS = "checked"; }
2902 <form method=post action=$form->{script}>
2904 <input type=hidden name=old_password value=$myconfig{password}>
2905 <input type=hidden name=type value=preferences>
2906 <input type=hidden name=role value=$myconfig{role}>
2909 <tr><th class=listtop>$form->{title}</th></tr>
2914 <th align=right>| . $locale->text('Name') . qq|</th>
2915 <td><input name=name size=15 value="$myconfig{name}"></td>
2918 <th align=right>| . $locale->text('Password') . qq|</th>
2919 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2922 <th align=right>| . $locale->text('E-mail') . qq|</th>
2923 <td><input name=email size=30 value="$myconfig{email}"></td>
2926 <th align=right>| . $locale->text('Signature') . qq|</th>
2927 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2930 <th align=right>| . $locale->text('Phone') . qq|</th>
2931 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2934 <th align=right>| . $locale->text('Fax') . qq|</th>
2935 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2938 <th align=right>| . $locale->text('Company') . qq|</th>
2939 <td><input name=company size=30 value="$myconfig{company}"></td>
2942 <th align=right>| . $locale->text('Address') . qq|</th>
2943 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2946 <th align=right>| . $locale->text('Date Format') . qq|</th>
2947 <td><select name=dateformat>$dateformat</select></td>
2950 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2951 <td><select name=numberformat>$numberformat</select></td>
2954 <th align=right>| . $locale->text('Input Number Format') . qq|</th>
2955 <td><select name=in_numberformat>$in_numberformat</select></td>
2959 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2960 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2963 <th align=right>| . $locale->text('Language') . qq|</th>
2964 <td><select name=countrycode>$countrycodes</select></td>
2967 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
2968 <td><select name=usestylesheet>$selectstylesheet</select></td>
2971 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
2972 <td><input name=menustyle type=radio class=radio value=neu $newS> New
2973 <input name=menustyle type=radio class=radio value=old $oldS> Old</td>
2975 <input name=printer type=hidden value="$myconfig{printer}">
2976 <tr class=listheading>
2977 <th colspan=2> </th>
2980 <th align=right>| . $locale->text('Business Number') . qq|</th>
2981 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
2987 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
2988 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
2989 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
2990 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
2995 <tr class=listheading>
2997 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
3003 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
3004 <td><select name=inventory_accno>$myconfig{IC}</select></td>
3007 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
3008 <td><select name=income_accno>$myconfig{IC_income}</select></td>
3011 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
3012 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
3015 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
3016 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
3019 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
3020 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
3025 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
3027 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
3036 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
3037 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
3038 <th align=right nowrap>|
3039 . $locale->text('Last Customer Number') . qq|</th>
3040 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
3043 <th align=right nowrap>|
3044 . $locale->text('Last Credit Note Number') . qq|</th>
3045 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
3046 <th align=right nowrap>|
3047 . $locale->text('Last Vendor Number') . qq|</th>
3048 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
3051 <th align=right nowrap>|
3052 . $locale->text('Last Sales Order Number') . qq|</th>
3053 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
3056 <th align=right nowrap>|
3057 . $locale->text('Last Purchase Order Number') . qq|</th>
3058 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
3059 <th align=right nowrap>|
3060 . $locale->text('Last Article Number') . qq|</th>
3061 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
3064 <th align=right nowrap>|
3065 . $locale->text('Last Sales Quotation Number') . qq|</th>
3066 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
3067 <th align=right nowrap>|
3068 . $locale->text('Last Service Number') . qq|</th>
3069 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
3072 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
3073 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
3074 <th align=right nowrap></th>
3080 # <tr class=listheading>
3081 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3088 # <th>| . $locale->text('Rate') . qq| (%)</th>
3089 # <th>| . $locale->text('Number') . qq|</th>
3093 # foreach $accno (sort keys %{ $form->{taxrates} }) {
3096 # <th align=right>$form->{taxrates}{$accno}{description}</th>
3097 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3098 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3101 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3104 # chop $form->{taxaccounts};
3107 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3116 <td><hr size=3 noshade></td>
3120 <input type=hidden name=path value=$form->{path}>
3121 <input type=hidden name=login value=$form->{login}>
3122 <input type=hidden name=password value=$form->{password}>
3125 <input type=submit class=submit name=action value="|
3126 . $locale->text('Save') . qq|">|;
3128 if ($form->{menubar}) {
3129 require "$form->{path}/menu.pl";
3140 $lxdebug->leave_sub();
3143 sub save_preferences {
3144 $lxdebug->enter_sub();
3146 $form->{stylesheet} = $form->{usestylesheet};
3148 $form->redirect($locale->text('Preferences saved!'))
3150 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3152 $form->error($locale->text('Cannot save preferences!'));
3154 $lxdebug->leave_sub();
3158 $lxdebug->enter_sub();
3160 if ($form->{media} eq 'email') {
3161 $form->error($locale->text('No email address for') . " $myconfig{name}")
3162 unless ($myconfig{email});
3164 $form->{OUT} = "$sendmail";
3168 AM->backup(\%myconfig, \%$form, $userspath);
3170 if ($form->{media} eq 'email') {
3171 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
3174 $lxdebug->leave_sub();
3178 $lxdebug->enter_sub();
3180 $form->{title} = $locale->text('Audit Control');
3182 AM->closedto(\%myconfig, \%$form);
3184 if ($form->{revtrans}) {
3185 $checked{Y} = "checked";
3187 $checked{N} = "checked";
3195 <form method=post action=$form->{script}>
3197 <input type=hidden name=path value=$form->{path}>
3198 <input type=hidden name=login value=$form->{login}>
3199 <input type=hidden name=password value=$form->{password}>
3202 <tr><th class=listtop>$form->{title}</th></tr>
3203 <tr height="5"></tr>
3209 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3210 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3211 . $locale->text('Yes')
3212 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3213 . $locale->text('No')
3217 <th>| . $locale->text('Close Books up to') . qq|</th>
3218 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3228 <input type=hidden name=nextsub value=doclose>
3230 <input type=submit class=submit name=action value="|
3231 . $locale->text('Continue') . qq|">
3239 $lxdebug->leave_sub();
3243 $lxdebug->enter_sub();
3245 AM->closebooks(\%myconfig, \%$form);
3247 if ($form->{revtrans}) {
3249 $locale->text('Transaction reversal enforced for all dates'));
3251 if ($form->{closedto}) {
3253 $locale->text('Transaction reversal enforced up to') . " "
3254 . $locale->date(\%myconfig, $form->{closedto}, 1));
3256 $form->redirect($locale->text('Books are open'));
3260 $lxdebug->leave_sub();
3264 $lxdebug->enter_sub();
3266 $form->{title} = "Add";
3269 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
3270 unless $form->{callback};
3275 $lxdebug->leave_sub();
3278 sub edit_warehouse {
3279 $lxdebug->enter_sub();
3281 $form->{title} = "Edit";
3283 AM->get_warehouse(\%myconfig, \%$form);
3288 $lxdebug->leave_sub();
3291 sub list_warehouse {
3292 $lxdebug->enter_sub();
3294 AM->warehouses(\%myconfig, \%$form);
3297 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
3299 $callback = $form->escape($form->{callback});
3301 $form->{title} = $locale->text('Warehouses');
3303 @column_index = qw(description);
3305 $column_header{description} =
3306 qq|<th class=listheading width=100%>|
3307 . $locale->text('Description')
3317 <th class=listtop>$form->{title}</th>
3319 <tr height="5"></tr>
3323 <tr class=listheading>
3326 map { print "$column_header{$_}\n" } @column_index;
3332 foreach $ref (@{ $form->{ALL} }) {
3338 <tr valign=top class=listrow$i>
3341 $column_data{description} =
3342 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>|;
3344 map { print "$column_data{$_}\n" } @column_index;
3356 <td><hr size=3 noshade></td>
3361 <form method=post action=$form->{script}>
3363 <input name=callback type=hidden value="$form->{callback}">
3365 <input type=hidden name=type value=warehouse>
3367 <input type=hidden name=path value=$form->{path}>
3368 <input type=hidden name=login value=$form->{login}>
3369 <input type=hidden name=password value=$form->{password}>
3371 <input class=submit type=submit name=action value="|
3372 . $locale->text('Add') . qq|">|;
3374 if ($form->{menubar}) {
3375 require "$form->{path}/menu.pl";
3386 $lxdebug->leave_sub();
3389 sub warehouse_header {
3390 $lxdebug->enter_sub();
3392 $form->{title} = $locale->text("$form->{title} Warehouse");
3394 # $locale->text('Add Warehouse')
3395 # $locale->text('Edit Warehouse')
3397 $form->{description} =~ s/\"/"/g;
3399 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
3401 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
3404 qq|<input name=description size=60 value="$form->{description}">|;
3412 <form method=post action=$form->{script}>
3414 <input type=hidden name=id value=$form->{id}>
3415 <input type=hidden name=type value=warehouse>
3419 <th class=listtop colspan=2>$form->{title}</th>
3421 <tr height="5"></tr>
3423 <th align=right>| . $locale->text('Description') . qq|</th>
3424 <td>$description</td>
3427 <td colspan=2><hr size=3 noshade></td>
3432 $lxdebug->leave_sub();
3435 sub save_warehouse {
3436 $lxdebug->enter_sub();
3438 $form->isblank("description", $locale->text('Description missing!'));
3439 AM->save_warehouse(\%myconfig, \%$form);
3440 $form->redirect($locale->text('Warehouse saved!'));
3442 $lxdebug->leave_sub();
3445 sub delete_warehouse {
3446 $lxdebug->enter_sub();
3448 AM->delete_warehouse(\%myconfig, \%$form);
3449 $form->redirect($locale->text('Warehouse deleted!'));
3451 $lxdebug->leave_sub();
3455 $lxdebug->enter_sub();
3457 &{ $form->{nextsub} };
3459 $lxdebug->leave_sub();
3463 $lxdebug->enter_sub();
3465 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3466 AM->units_in_use(\%myconfig, $form, $units);
3467 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3470 foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3471 map({ push(@unit_list, $units->{$_}); }
3472 sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3473 grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3475 map({ $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"}); } @unit_list);
3477 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3478 $ddbox = AM->unit_select_data($units, undef, 1);
3480 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3482 print($form->parse_html_template("am/edit_units", { "UNITS" => \@unit_list, "NEW_BASE_UNIT_DDBOX" => $ddbox }));
3484 $lxdebug->leave_sub();
3488 $lxdebug->enter_sub();
3490 $form->isblank("new_name", $locale->text("The name is missing."));
3491 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3492 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($units->{$form->{"new_name"}});
3494 my ($base_unit, $factor);
3495 if ($form->{"new_base_unit"}) {
3496 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3498 $form->isblank("new_factor", $locale->text("The factor is missing."));
3499 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3500 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3501 $base_unit = $form->{"new_base_unit"};
3504 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"});
3506 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3510 $lxdebug->leave_sub();
3514 $lxdebug->enter_sub();
3516 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3517 AM->units_in_use(\%myconfig, $form, $old_units);
3521 foreach $i (1..($form->{"rowcount"} * 1)) {
3522 $old_unit = $old_units->{$form->{"old_name_$i"}};
3524 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3527 if ($form->{"unchangeable_$i"}) {
3528 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3529 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3533 if ($old_unit->{"in_use"}) {
3534 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3537 if ($form->{"delete_$i"}) {
3538 push(@delete_units, $old_unit->{"name"});
3542 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3544 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3545 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3546 $new_units->{$form->{"name_$i"}} = \%h;
3547 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3550 foreach $unit (values(%{$new_units})) {
3551 next unless ($unit->{"old_name"});
3552 if ($unit->{"base_unit"}) {
3553 $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"}))
3554 unless (defined($new_units->{$unit->{"base_unit"}}));
3555 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3556 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3558 $unit->{"base_unit"} = undef;
3559 $unit->{"factor"} = undef;
3563 foreach $unit (values(%{$new_units})) {
3564 next if ($unit->{"unchanged_unit"});
3566 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3568 while ($new_unit->{"base_unit"}) {
3569 $new_unit->{"seen"} = 1;
3570 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3571 if ($new_unit->{"seen"}) {
3572 $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, " .
3573 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3578 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3580 $form->{"saved_message"} = $locale->text("The units have been saved.");
3584 $lxdebug->leave_sub();