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 $form->{selecttaxkey} = "<option value=0>Keine Steuer 0%\n";
98 foreach $item (@{ $form->{TAXKEY} }) {
99 if ($item->{tax} == $form->{tax}) {
100 $form->{selecttaxkey} .=
101 "<option value=$item->{tax} selected>$item->{taxdescription}\n";
103 $form->{selecttaxkey} .=
104 "<option value=$item->{tax}>$item->{taxdescription}\n";
112 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
113 <td><select name=tax>$form->{selecttaxkey}</select></td>
114 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
115 <td><input name=startdate value="$form->{startdate}"></td>
118 if (@{ $form->{NEWACCOUNT} }) {
119 if (!$form->{new_chart_valid}) {
120 $form->{selectnewaccount} = "<option value=></option>";
122 foreach $item (@{ $form->{NEWACCOUNT} }) {
123 if ($item->{id} == $form->{new_chart_id}) {
124 $form->{selectnewaccount} .=
125 "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
126 } elsif (!$form->{new_chart_valid}) {
127 $form->{selectnewaccount} .=
128 "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
139 <th align=right>| . $locale->text('Folgekonto') . qq|</th>
140 <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
141 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
142 <td><input name=valid_from value="$form->{valid_from}"></td>
148 $form->{selectustva} = "<option>\n";
150 %ustva = (35 => $locale->text('UStVA-Nr. 35'),
151 36 => $locale->text('UStVA-Nr. 36'),
152 39 => $locale->text('UStVA-Nr. 39'),
153 41 => $locale->text('UStVA-Nr. 41'),
154 42 => $locale->text('UStVA-Nr. 42'),
155 43 => $locale->text('UStVA-Nr. 43'),
156 44 => $locale->text('UStVA-Nr. 44'),
157 45 => $locale->text('UStVA-Nr. 45'),
158 48 => $locale->text('UStVA-Nr. 48'),
159 49 => $locale->text('UStVA-Nr. 49'),
160 51 => $locale->text('UStVA-Nr. 51 left'),
161 511 => $locale->text('UStVA-Nr. 51 right'),
162 52 => $locale->text('UStVA-Nr. 52'),
163 53 => $locale->text('UStVA-Nr. 53'),
164 59 => $locale->text('UStVA-Nr. 59'),
165 60 => $locale->text('UStVA-Nr. 60'),
166 61 => $locale->text('UStVA-Nr. 61'),
167 62 => $locale->text('UStVA-Nr. 62'),
168 63 => $locale->text('UStVA-Nr. 63'),
169 64 => $locale->text('UStVA-Nr. 64'),
170 65 => $locale->text('UStVA-Nr. 65'),
171 66 => $locale->text('UStVA-Nr. 66'),
172 67 => $locale->text('UStVA-Nr. 67'),
173 69 => $locale->text('UStVA-Nr. 69'),
174 73 => $locale->text('UStVA-Nr. 73'),
175 74 => $locale->text('UStVA-Nr. 74'),
176 76 => $locale->text('UStVA-Nr. 76'),
177 77 => $locale->text('UStVA-Nr. 77'),
178 80 => $locale->text('UStVA-Nr. 80'),
179 84 => $locale->text('UStVA-Nr. 84'),
180 85 => $locale->text('UStVA-Nr. 85'),
181 86 => $locale->text('UStVA-Nr. 86 left'),
182 861 => $locale->text('UStVA-Nr. 86 right'),
183 91 => $locale->text('UStVA-Nr. 91'),
184 93 => $locale->text('UStVA-Nr. 93 left'),
185 931 => $locale->text('UStVA-Nr. 93 right'),
186 94 => $locale->text('UStVA-Nr. 94'),
187 95 => $locale->text('UStVA-Nr. 95'),
188 96 => $locale->text('UStVA-Nr. 96'),
189 97 => $locale->text('UStVA-Nr. 97 links'),
190 971 => $locale->text('UStVA-Nr. 97 rechts'),
191 98 => $locale->text('UStVA-Nr. 98'));
193 foreach $item (sort({ $a cmp $b } keys %ustva)) {
194 if ($item == $form->{pos_ustva}) {
195 $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
197 $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
204 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
205 <td><select name=pos_ustva>$form->{selectustva}</select></td>
206 <input type=hidden name=selectustva value="$form->{selectustva}">
209 $form->{selecteur} = "<option>\n";
210 %eur = (1 => "Umsatzerlöse",
211 2 => "sonstige Erlöse",
212 3 => "Privatanteile",
214 5 => "Ausserordentliche Erträge",
215 6 => "Vereinnahmte Umsatzst.",
216 7 => "Umsatzsteuererstattungen",
217 8 => "Wareneingänge",
218 9 => "Löhne und Gehälter",
219 10 => "Gesetzl. sozialer Aufw.",
221 12 => "Gas, Strom, Wasser",
222 13 => "Instandhaltung",
223 14 => "Steuern, Versich., Beiträge",
225 16 => "Kfz-Versicherungen",
226 17 => "Sonst. Fahrtkosten",
227 18 => "Werbe- und Reisekosten",
228 19 => "Instandhaltung u. Werkzeuge",
229 20 => "Fachzeitschriften, Bücher",
230 21 => "Miete für Einrichtungen",
231 22 => "Rechts- und Beratungskosten",
232 23 => "Bürobedarf, Porto, Telefon",
233 24 => "Sonstige Aufwendungen",
234 25 => "Abschreibungen auf Anlagever.",
235 26 => "Abschreibungen auf GWG",
237 28 => "Umsatzsteuerzahlungen",
239 30 => "Ausserordentlicher Aufwand",
240 31 => "Betriebliche Steuern");
241 foreach $item (sort({ $a <=> $b } keys(%eur))) {
242 if ($item == $form->{pos_eur}) {
243 $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
245 $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
252 <th align=right>| . $locale->text('EUER') . qq|</th>
253 <td><select name=pos_eur>$form->{selecteur}</select></td>
254 <input type=hidden name=selecteur value="$form->{selecteur}">
257 $form->{selectbwa} = "<option>\n";
259 %bwapos = (1 => 'Umsatzerlöse',
260 2 => 'Best.Verdg.FE/UE',
261 3 => 'Aktiv.Eigenleistung',
262 4 => 'Mat./Wareneinkauf',
263 5 => 'So.betr.Erlöse',
264 10 => 'Personalkosten',
266 12 => 'Betriebl.Steuern',
267 13 => 'Vers./Beiträge',
268 14 => 'Kfz.Kosten o.St.',
269 15 => 'Werbe-Reisek.',
270 16 => 'Kosten Warenabgabe',
271 17 => 'Abschreibungen',
272 18 => 'Rep./instandhlt.',
273 19 => 'Übrige Steuern',
274 20 => 'Sonst.Kosten',
276 31 => 'Sonst.neutr.Aufw.',
278 33 => 'Sonst.neutr.Ertrag',
279 34 => 'Verr.kalk.Kosten',
280 35 => 'Steuern Eink.u.Ertr.');
281 foreach $item (sort({ $a <=> $b } keys %bwapos)) {
282 if ($item == $form->{pos_bwa}) {
283 $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
285 $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
292 <th align=right>| . $locale->text('BWA') . qq|</th>
293 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
294 <input type=hidden name=selectbwa value="$form->{selectbwa}">
297 # Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
298 # $form->{selectbilanz} = "<option>\n";
299 # foreach $item ((1, 2, 3, 4)) {
300 # if ($item == $form->{pos_bilanz}) {
301 # $form->{selectbilanz} .= "<option value=$item selected>$item\n";
303 # $form->{selectbilanz} .= "<option value=$item>$item\n";
310 # <th align=right>| . $locale->text('Bilanz') . qq|</th>
311 # <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
312 # <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
315 # this is for our parser only!
316 # type=submit $locale->text('Add Account')
317 # type=submit $locale->text('Edit Account')
318 $form->{type} = "account";
325 <form method=post action=$form->{script}>
327 <input type=hidden name=id value=$form->{id}>
328 <input type=hidden name=type value=account>
329 <input type=hidden name=orphaned value=$form->{orphaned}>
330 <input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
332 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
333 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
334 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
335 <input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
336 <input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
338 <table border=0 width=100%>
340 <th class=listtop>$form->{title}</th>
347 <th align=right>| . $locale->text('Account Number') . qq|</th>
348 <td><input name=accno size=20 value=$form->{accno}></td>
351 <th align=right>| . $locale->text('Description') . qq|</th>
352 <td><input name=description size=40 value="$form->{description}"></td>
355 <th align=right>| . $locale->text('Account Type') . qq|</th>
359 <td><input name=category type=radio class=radio value=A $checked{A_}> |
360 . $locale->text('Asset') . qq|\n<br>
361 <input name=category type=radio class=radio value=L $checked{L_}> |
362 . $locale->text('Liability') . qq|\n<br>
363 <input name=category type=radio class=radio value=Q $checked{Q_}> |
364 . $locale->text('Equity') . qq|\n<br>
365 <input name=category type=radio class=radio value=I $checked{I_}> |
366 . $locale->text('Revenue') . qq|\n<br>
367 <input name=category type=radio class=radio value=E $checked{E_}> |
368 . $locale->text('Expense') . qq|</td>
369 <td width=50> </td>
371 <input name=charttype type=radio class=radio value="H" $checked{H}> |
372 . $locale->text('Heading') . qq|<br>
373 <input name=charttype type=radio class=radio value="A" $checked{A}> |
374 . $locale->text('Account') . qq|</td>
381 if ($form->{charttype} eq "A") {
388 . $locale->text('Is this a summary account to record') . qq|</th>
390 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
391 . $locale->text('AR')
392 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
393 . $locale->text('AP')
394 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
395 . $locale->text('Inventory')
402 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
408 <th align=left>| . $locale->text('Receivables') . qq|</th>
409 <th align=left>| . $locale->text('Payables') . qq|</th>
410 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
411 <th align=left>| . $locale->text('Service Items') . qq|</th>
415 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
416 . $locale->text('Revenue') . qq|\n<br>
417 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
418 . $locale->text('Receipt') . qq|\n<br>
419 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
420 . $locale->text('Tax') . qq|
423 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
424 . $locale->text('Expense/Asset') . qq|\n<br>
425 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
426 . $locale->text('Payment') . qq|\n<br>
427 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
428 . $locale->text('Tax') . qq|
431 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
432 . $locale->text('Revenue') . qq|\n<br>
433 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
434 . $locale->text('Expense') . qq|\n<br>
435 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
436 . $locale->text('Tax') . qq|
439 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
440 . $locale->text('Revenue') . qq|\n<br>
441 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
442 . $locale->text('Expense') . qq|\n<br>
443 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
444 . $locale->text('Tax') . qq|
464 <td><hr size=3 noshade></td>
469 $lxdebug->leave_sub();
473 $lxdebug->enter_sub();
477 <input name=callback type=hidden value="$form->{callback}">
479 <input type=hidden name=path value=$form->{path}>
480 <input type=hidden name=login value=$form->{login}>
481 <input type=hidden name=password value=$form->{password}>
484 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
486 <input type=submit class=submit name=action value="|
487 . $locale->text('Save') . qq|">
491 if ($form->{id} && $form->{orphaned}) {
492 print qq|<input type=submit class=submit name=action value="|
493 . $locale->text('Delete') . qq|">|;
496 if ($form->{menubar}) {
497 require "$form->{path}/menu.pl";
508 $lxdebug->leave_sub();
512 $lxdebug->enter_sub();
514 $form->isblank("accno", $locale->text('Account Number missing!'));
515 $form->isblank("category", $locale->text('Account Type missing!'));
517 $form->redirect($locale->text('Account saved!'))
518 if (AM->save_account(\%myconfig, \%$form));
519 $form->error($locale->text('Cannot save account!'));
521 $lxdebug->leave_sub();
525 $lxdebug->enter_sub();
527 CA->all_accounts(\%myconfig, \%$form);
529 $form->{title} = $locale->text('Chart of Accounts');
533 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
535 @column_index = qw(accno gifi_accno description debit credit link);
537 $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
538 $column_header{gifi_accno} =
539 qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
540 $column_header{description} =
541 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
542 $column_header{debit} = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
543 $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
544 $column_header{link} = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
547 $colspan = $#column_index + 1;
554 <th class=listtop colspan=$colspan>$form->{title}</th>
557 <tr class=listheading>
560 map { print "$column_header{$_}\n" } @column_index;
567 $callback = $form->escape($callback);
569 foreach $ca (@{ $form->{CA} }) {
571 $ca->{debit} = " ";
572 $ca->{credit} = " ";
574 if ($ca->{amount} > 0) {
576 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
578 if ($ca->{amount} < 0) {
580 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
583 $ca->{link} =~ s/:/<br>/og;
585 if ($ca->{charttype} eq "H") {
586 print qq|<tr class=listheading>|;
588 $column_data{accno} =
589 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>|;
590 $column_data{gifi_accno} =
591 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>|;
592 $column_data{description} = qq|<th>$ca->{description} </th>|;
593 $column_data{debit} = qq|<th> </th>|;
594 $column_data{credit} = qq| <th> </th>|;
595 $column_data{link} = qq|<th> </th>|;
601 <tr valign=top class=listrow$i>|;
602 $column_data{accno} =
603 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>|;
604 $column_data{gifi_accno} =
605 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>|;
606 $column_data{description} = qq|<td>$ca->{description} </td>|;
607 $column_data{debit} = qq|<td align=right>$ca->{debit}</td>|;
608 $column_data{credit} = qq|<td align=right>$ca->{credit}</td>|;
609 $column_data{link} = qq|<td>$ca->{link} </td>|;
613 map { print "$column_data{$_}\n" } @column_index;
619 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
626 $lxdebug->leave_sub();
630 $lxdebug->enter_sub();
632 $form->{title} = $locale->text('Delete Account');
635 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
637 if ($form->{id} == $form->{$id}) {
638 $form->error($locale->text('Cannot delete default account!'));
642 $form->redirect($locale->text('Account deleted!'))
643 if (AM->delete_account(\%myconfig, \%$form));
644 $form->error($locale->text('Cannot delete account!'));
646 $lxdebug->leave_sub();
650 $lxdebug->enter_sub();
652 @{ $form->{fields} } = (accno, description);
653 $form->{table} = "gifi";
654 $form->{sortorder} = "accno";
656 AM->gifi_accounts(\%myconfig, \%$form);
658 $form->{title} = $locale->text('GIFI');
662 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
664 @column_index = qw(accno description);
666 $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
667 $column_header{description} =
668 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
671 $colspan = $#column_index + 1;
678 <th class=listtop colspan=$colspan>$form->{title}</th>
681 <tr class=listheading>
684 map { print "$column_header{$_}\n" } @column_index;
691 $callback = $form->escape($callback);
693 foreach $ca (@{ $form->{ALL} }) {
699 <tr valign=top class=listrow$i>|;
701 $column_data{accno} =
702 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>|;
703 $column_data{description} = qq|<td>$ca->{description} </td>|;
705 map { print "$column_data{$_}\n" } @column_index;
712 <td colspan=$colspan><hr size=3 noshade></td>
720 $lxdebug->leave_sub();
724 $lxdebug->enter_sub();
726 $form->{title} = "Add";
730 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
737 $lxdebug->leave_sub();
741 $lxdebug->enter_sub();
743 $form->{title} = "Edit";
745 AM->get_gifi(\%myconfig, \%$form);
750 $lxdebug->leave_sub();
754 $lxdebug->enter_sub();
756 $form->{title} = $locale->text("$form->{title} GIFI");
758 # $locale->text('Add GIFI')
759 # $locale->text('Edit GIFI')
761 $form->{description} =~ s/\"/"/g;
768 <form method=post action=$form->{script}>
770 <input type=hidden name=id value=$form->{accno}>
771 <input type=hidden name=type value=gifi>
775 <th class=listtop>$form->{title}</th>
782 <th align=right>| . $locale->text('GIFI') . qq|</th>
783 <td><input name=accno size=20 value=$form->{accno}></td>
786 <th align=right>| . $locale->text('Description') . qq|</th>
787 <td><input name=description size=60 value="$form->{description}"></td>
793 <td colspan=2><hr size=3 noshade></td>
798 $lxdebug->leave_sub();
802 $lxdebug->enter_sub();
806 <input name=callback type=hidden value="$form->{callback}">
808 <input type=hidden name=path value=$form->{path}>
809 <input type=hidden name=login value=$form->{login}>
810 <input type=hidden name=password value=$form->{password}>
812 <br><input type=submit class=submit name=action value="|
813 . $locale->text('Save') . qq|">|;
817 <input type=submit class=submit name=action value="|
818 . $locale->text('Copy to COA') . qq|">
821 if ($form->{accno} && $form->{orphaned}) {
822 print qq|<input type=submit class=submit name=action value="|
823 . $locale->text('Delete') . qq|">|;
827 if ($form->{menubar}) {
828 require "$form->{path}/menu.pl";
839 $lxdebug->leave_sub();
843 $lxdebug->enter_sub();
845 $form->isblank("accno", $locale->text('GIFI missing!'));
846 AM->save_gifi(\%myconfig, \%$form);
847 $form->redirect($locale->text('GIFI saved!'));
849 $lxdebug->leave_sub();
853 $lxdebug->enter_sub();
855 $form->isblank("accno", $locale->text('GIFI missing!'));
857 AM->save_gifi(\%myconfig, \%$form);
860 $form->{gifi_accno} = $form->{accno};
861 $form->{title} = "Add";
862 $form->{charttype} = "A";
867 $lxdebug->leave_sub();
871 $lxdebug->enter_sub();
873 AM->delete_gifi(\%myconfig, \%$form);
874 $form->redirect($locale->text('GIFI deleted!'));
876 $lxdebug->leave_sub();
880 $lxdebug->enter_sub();
882 $form->{title} = "Add";
886 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
887 unless $form->{callback};
892 $lxdebug->leave_sub();
895 sub edit_department {
896 $lxdebug->enter_sub();
898 $form->{title} = "Edit";
900 AM->get_department(\%myconfig, \%$form);
905 $lxdebug->leave_sub();
908 sub list_department {
909 $lxdebug->enter_sub();
911 AM->departments(\%myconfig, \%$form);
914 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
916 $callback = $form->escape($form->{callback});
918 $form->{title} = $locale->text('Departments');
920 @column_index = qw(description cost profit);
922 $column_header{description} =
923 qq|<th class=listheading width=90%>|
924 . $locale->text('Description')
926 $column_header{cost} =
927 qq|<th class=listheading nowrap>|
928 . $locale->text('Cost Center')
930 $column_header{profit} =
931 qq|<th class=listheading nowrap>|
932 . $locale->text('Profit Center')
942 <th class=listtop>$form->{title}</th>
948 <tr class=listheading>
951 map { print "$column_header{$_}\n" } @column_index;
957 foreach $ref (@{ $form->{ALL} }) {
963 <tr valign=top class=listrow$i>
966 $costcenter = ($ref->{role} eq "C") ? "X" : "";
967 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
969 $column_data{description} =
970 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>|;
971 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
972 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
974 map { print "$column_data{$_}\n" } @column_index;
986 <td><hr size=3 noshade></td>
991 <form method=post action=$form->{script}>
993 <input name=callback type=hidden value="$form->{callback}">
995 <input type=hidden name=type value=department>
997 <input type=hidden name=path value=$form->{path}>
998 <input type=hidden name=login value=$form->{login}>
999 <input type=hidden name=password value=$form->{password}>
1001 <input class=submit type=submit name=action value="|
1002 . $locale->text('Add') . qq|">|;
1004 if ($form->{menubar}) {
1005 require "$form->{path}/menu.pl";
1016 $lxdebug->leave_sub();
1019 sub department_header {
1020 $lxdebug->enter_sub();
1022 $form->{title} = $locale->text("$form->{title} Department");
1024 # $locale->text('Add Department')
1025 # $locale->text('Edit Department')
1027 $form->{description} =~ s/\"/"/g;
1029 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
1031 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
1034 qq|<input name=description size=60 value="$form->{description}">|;
1037 $costcenter = "checked" if $form->{role} eq "C";
1038 $profitcenter = "checked" if $form->{role} eq "P";
1045 <form method=post action=$form->{script}>
1047 <input type=hidden name=id value=$form->{id}>
1048 <input type=hidden name=type value=department>
1052 <th class=listtop colspan=2>$form->{title}</th>
1054 <tr height="5"></tr>
1056 <th align=right>| . $locale->text('Description') . qq|</th>
1057 <td>$description</td>
1061 <td><input type=radio style=radio name=role value="C" $costcenter> |
1062 . $locale->text('Cost Center') . qq|
1063 <input type=radio style=radio name=role value="P" $profitcenter> |
1064 . $locale->text('Profit Center') . qq|
1067 <td colspan=2><hr size=3 noshade></td>
1072 $lxdebug->leave_sub();
1075 sub save_department {
1076 $lxdebug->enter_sub();
1078 $form->isblank("description", $locale->text('Description missing!'));
1079 AM->save_department(\%myconfig, \%$form);
1080 $form->redirect($locale->text('Department saved!'));
1082 $lxdebug->leave_sub();
1085 sub delete_department {
1086 $lxdebug->enter_sub();
1088 AM->delete_department(\%myconfig, \%$form);
1089 $form->redirect($locale->text('Department deleted!'));
1091 $lxdebug->leave_sub();
1095 $lxdebug->enter_sub();
1097 $form->{title} = "Add";
1100 "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1101 unless $form->{callback};
1106 $lxdebug->leave_sub();
1110 $lxdebug->enter_sub();
1112 $form->{title} = "Edit";
1114 AM->get_lead(\%myconfig, \%$form);
1118 $form->{orphaned} = 1;
1121 $lxdebug->leave_sub();
1125 $lxdebug->enter_sub();
1127 AM->lead(\%myconfig, \%$form);
1130 "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1132 $callback = $form->escape($form->{callback});
1134 $form->{title} = $locale->text('Lead');
1136 @column_index = qw(description cost profit);
1138 $column_header{description} =
1139 qq|<th class=listheading width=100%>|
1140 . $locale->text('Description')
1150 <th class=listtop>$form->{title}</th>
1152 <tr height="5"></tr>
1153 <tr class=listheading>
1156 map { print "$column_header{$_}\n" } @column_index;
1162 foreach $ref (@{ $form->{ALL} }) {
1168 <tr valign=top class=listrow$i>
1171 $lead = $ref->{lead};
1173 $column_data{description} =
1174 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>|;
1176 map { print "$column_data{$_}\n" } @column_index;
1185 <td><hr size=3 noshade></td>
1190 <form method=post action=$form->{script}>
1192 <input name=callback type=hidden value="$form->{callback}">
1194 <input type=hidden name=type value=lead>
1196 <input type=hidden name=path value=$form->{path}>
1197 <input type=hidden name=login value=$form->{login}>
1198 <input type=hidden name=password value=$form->{password}>
1200 <input class=submit type=submit name=action value="|
1201 . $locale->text('Add') . qq|">|;
1203 if ($form->{menubar}) {
1204 require "$form->{path}/menu.pl";
1215 $lxdebug->leave_sub();
1219 $lxdebug->enter_sub();
1221 $form->{title} = $locale->text("$form->{title} Lead");
1223 # $locale->text('Add Lead')
1224 # $locale->text('Edit Lead')
1226 $form->{description} =~ s/\"/"/g;
1229 qq|<input name=description size=50 value="$form->{lead}">|;
1236 <form method=post action=$form->{script}>
1238 <input type=hidden name=id value=$form->{id}>
1239 <input type=hidden name=type value=lead>
1243 <th class=listtop colspan=2>$form->{title}</th>
1245 <tr height="5"></tr>
1247 <th align=right>| . $locale->text('Description') . qq|</th>
1248 <td>$description</td>
1250 <td colspan=2><hr size=3 noshade></td>
1255 $lxdebug->leave_sub();
1259 $lxdebug->enter_sub();
1261 $form->isblank("description", $locale->text('Description missing!'));
1262 AM->save_lead(\%myconfig, \%$form);
1263 $form->redirect($locale->text('lead saved!'));
1265 $lxdebug->leave_sub();
1269 $lxdebug->enter_sub();
1271 AM->delete_lead(\%myconfig, \%$form);
1272 $form->redirect($locale->text('lead deleted!'));
1274 $lxdebug->leave_sub();
1278 $lxdebug->enter_sub();
1280 $form->{title} = "Add";
1283 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1284 unless $form->{callback};
1289 $lxdebug->leave_sub();
1293 $lxdebug->enter_sub();
1295 $form->{title} = "Edit";
1297 AM->get_business(\%myconfig, \%$form);
1301 $form->{orphaned} = 1;
1304 $lxdebug->leave_sub();
1308 $lxdebug->enter_sub();
1310 AM->business(\%myconfig, \%$form);
1313 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1315 $callback = $form->escape($form->{callback});
1317 $form->{title} = $locale->text('Type of Business');
1319 @column_index = qw(description discount customernumberinit);
1321 $column_header{description} =
1322 qq|<th class=listheading width=60%>|
1323 . $locale->text('Description')
1325 $column_header{discount} =
1326 qq|<th class=listheading width=10%>|
1327 . $locale->text('Discount')
1329 $column_header{customernumberinit} =
1330 qq|<th class=listheading>|
1331 . $locale->text('Customernumberinit')
1341 <th class=listtop>$form->{title}</th>
1343 <tr height="5"></tr>
1347 <tr class=listheading>
1350 map { print "$column_header{$_}\n" } @column_index;
1356 foreach $ref (@{ $form->{ALL} }) {
1362 <tr valign=top class=listrow$i>
1366 $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
1369 ? "<b>$ref->{description}</b>"
1370 : "$ref->{description}";
1371 $column_data{description} =
1372 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>|;
1373 $column_data{discount} = qq|<td align=right>$discount</td>|;
1374 $column_data{customernumberinit} =
1375 qq|<td align=right>$ref->{customernumberinit}</td>|;
1377 map { print "$column_data{$_}\n" } @column_index;
1389 <td><hr size=3 noshade></td>
1394 <form method=post action=$form->{script}>
1396 <input name=callback type=hidden value="$form->{callback}">
1398 <input type=hidden name=type value=business>
1400 <input type=hidden name=path value=$form->{path}>
1401 <input type=hidden name=login value=$form->{login}>
1402 <input type=hidden name=password value=$form->{password}>
1404 <input class=submit type=submit name=action value="|
1405 . $locale->text('Add') . qq|">|;
1407 if ($form->{menubar}) {
1408 require "$form->{path}/menu.pl";
1420 $lxdebug->leave_sub();
1423 sub business_header {
1424 $lxdebug->enter_sub();
1426 $form->{title} = $locale->text("$form->{title} Business");
1427 $form->{salesman} = "checked" if $form->{salesman};
1429 # $locale->text('Add Business')
1430 # $locale->text('Edit Business')
1432 $form->{description} =~ s/\"/"/g;
1434 $form->format_amount(\%myconfig, $form->{discount} * 100);
1441 <form method=post action=$form->{script}>
1443 <input type=hidden name=id value=$form->{id}>
1444 <input type=hidden name=type value=business>
1448 <th class=listtop colspan=2>$form->{title}</th>
1450 <tr height="5"></tr>
1452 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1453 <td><input name=description size=30 value="$form->{description}"></td>
1456 <th align=right>| . $locale->text('Discount') . qq| %</th>
1457 <td><input name=discount size=5 value=$form->{discount}></td>
1460 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1461 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1464 <td align=right>| . $locale->text('Salesman') . qq|</td>
1465 <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
1467 <td colspan=2><hr size=3 noshade></td>
1472 $lxdebug->leave_sub();
1476 $lxdebug->enter_sub();
1478 $form->isblank("description", $locale->text('Description missing!'));
1479 AM->save_business(\%myconfig, \%$form);
1480 $form->redirect($locale->text('Business saved!'));
1482 $lxdebug->leave_sub();
1485 sub delete_business {
1486 $lxdebug->enter_sub();
1488 AM->delete_business(\%myconfig, \%$form);
1489 $form->redirect($locale->text('Business deleted!'));
1491 $lxdebug->leave_sub();
1495 $lxdebug->enter_sub();
1497 $form->{title} = "Add";
1500 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1501 unless $form->{callback};
1506 $lxdebug->leave_sub();
1510 $lxdebug->enter_sub();
1512 $form->{title} = "Edit";
1514 AM->get_language(\%myconfig, \%$form);
1518 $form->{orphaned} = 1;
1521 $lxdebug->leave_sub();
1525 $lxdebug->enter_sub();
1527 AM->language(\%myconfig, \%$form);
1530 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1532 $callback = $form->escape($form->{callback});
1534 $form->{title} = $locale->text('Languages');
1536 @column_index = qw(description template_code article_code);
1538 $column_header{description} =
1539 qq|<th class=listheading width=60%>|
1540 . $locale->text('Description')
1542 $column_header{template_code} =
1543 qq|<th class=listheading width=10%>|
1544 . $locale->text('Template Code')
1546 $column_header{article_code} =
1547 qq|<th class=listheading>|
1548 . $locale->text('Article Code')
1558 <th class=listtop>$form->{title}</th>
1560 <tr height="5"></tr>
1564 <tr class=listheading>
1567 map { print "$column_header{$_}\n" } @column_index;
1573 foreach $ref (@{ $form->{ALL} }) {
1579 <tr valign=top class=listrow$i>
1583 $column_data{description} =
1584 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>|;
1585 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1586 $column_data{article_code} =
1587 qq|<td align=right>$ref->{article_code}</td>|;
1589 map { print "$column_data{$_}\n" } @column_index;
1601 <td><hr size=3 noshade></td>
1606 <form method=post action=$form->{script}>
1608 <input name=callback type=hidden value="$form->{callback}">
1610 <input type=hidden name=type value=language>
1612 <input type=hidden name=path value=$form->{path}>
1613 <input type=hidden name=login value=$form->{login}>
1614 <input type=hidden name=password value=$form->{password}>
1616 <input class=submit type=submit name=action value="|
1617 . $locale->text('Add') . qq|">|;
1619 if ($form->{menubar}) {
1620 require "$form->{path}/menu.pl";
1632 $lxdebug->leave_sub();
1635 sub language_header {
1636 $lxdebug->enter_sub();
1638 $form->{title} = $locale->text("$form->{title} Language");
1640 # $locale->text('Add Language')
1641 # $locale->text('Edit Language')
1643 $form->{description} =~ s/\"/"/g;
1644 $form->{template_code} =~ s/\"/"/g;
1645 $form->{article_code} =~ s/\"/"/g;
1653 <form method=post action=$form->{script}>
1655 <input type=hidden name=id value=$form->{id}>
1656 <input type=hidden name=type value=language>
1660 <th class=listtop colspan=2>$form->{title}</th>
1662 <tr height="5"></tr>
1664 <th align=right>| . $locale->text('Language') . qq|</th>
1665 <td><input name=description size=30 value="$form->{description}"></td>
1668 <th align=right>| . $locale->text('Template Code') . qq|</th>
1669 <td><input name=template_code size=5 value=$form->{template_code}></td>
1672 <th align=right>| . $locale->text('Article Code') . qq|</th>
1673 <td><input name=article_code size=10 value=$form->{article_code}></td>
1675 <td colspan=2><hr size=3 noshade></td>
1680 $lxdebug->leave_sub();
1684 $lxdebug->enter_sub();
1686 $form->isblank("description", $locale->text('Language missing!'));
1687 $form->isblank("template_code", $locale->text('Template Code missing!'));
1688 $form->isblank("article_code", $locale->text('Article Code missing!'));
1689 AM->save_language(\%myconfig, \%$form);
1690 $form->redirect($locale->text('Language saved!'));
1692 $lxdebug->leave_sub();
1695 sub delete_language {
1696 $lxdebug->enter_sub();
1698 AM->delete_language(\%myconfig, \%$form);
1699 $form->redirect($locale->text('Language deleted!'));
1701 $lxdebug->leave_sub();
1705 sub add_buchungsgruppe {
1706 $lxdebug->enter_sub();
1708 # $locale->text("Add Buchungsgruppe")
1709 # $locale->text("Edit Buchungsgruppe")
1710 $form->{title} = "Add";
1713 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1714 unless $form->{callback};
1715 AM->get_buchungsgruppe(\%myconfig, \%$form);
1717 $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
1720 &buchungsgruppe_header;
1723 $lxdebug->leave_sub();
1726 sub edit_buchungsgruppe {
1727 $lxdebug->enter_sub();
1729 $form->{title} = "Edit";
1731 AM->get_buchungsgruppe(\%myconfig, \%$form);
1733 &buchungsgruppe_header;
1737 $lxdebug->leave_sub();
1740 sub list_buchungsgruppe {
1741 $lxdebug->enter_sub();
1743 AM->buchungsgruppe(\%myconfig, \%$form);
1746 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1748 $callback = $form->escape($form->{callback});
1750 $form->{title} = $locale->text('Buchungsgruppen');
1752 @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 );
1754 $column_header{description} =
1755 qq|<th class=listheading width=60%>|
1756 . $locale->text('Description')
1758 $column_header{inventory_accno} =
1759 qq|<th class=listheading width=10%>|
1760 . $locale->text('Bestandskonto')
1762 $column_header{income_accno_0} =
1763 qq|<th class=listheading>|
1764 . $locale->text('Erlöse Inland')
1766 $column_header{expense_accno_0} =
1767 qq|<th class=listheading>|
1768 . $locale->text('Aufwand Inland')
1770 $column_header{income_accno_1} =
1771 qq|<th class=listheading>|
1772 . $locale->text('Erlöse EU m. UStId')
1774 $column_header{expense_accno_1} =
1775 qq|<th class=listheading>|
1776 . $locale->text('Aufwand EU m. UStId')
1778 $column_header{income_accno_2} =
1779 qq|<th class=listheading>|
1780 . $locale->text('Erlöse EU o. UStId')
1782 $column_header{expense_accno_2} =
1783 qq|<th class=listheading>|
1784 . $locale->text('Aufwand EU o. UStId')
1786 $column_header{income_accno_3} =
1787 qq|<th class=listheading>|
1788 . $locale->text('Erlöse Ausland')
1790 $column_header{expense_accno_3} =
1791 qq|<th class=listheading>|
1792 . $locale->text('Aufwand Ausland')
1801 <th class=listtop>$form->{title}</th>
1803 <tr height="5"></tr>
1807 <tr class=listheading>
1810 map { print "$column_header{$_}\n" } @column_index;
1816 foreach $ref (@{ $form->{ALL} }) {
1822 <tr valign=top class=listrow$i>
1826 $column_data{description} =
1827 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>|;
1828 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1829 $column_data{income_accno_0} =
1830 qq|<td align=right>$ref->{income_accno_0}</td>|;
1831 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1832 $column_data{income_accno_1} =
1833 qq|<td align=right>$ref->{income_accno_1}</td>|;
1834 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1835 $column_data{income_accno_2} =
1836 qq|<td align=right>$ref->{income_accno_2}</td>|;
1837 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1838 $column_data{income_accno_3} =
1839 qq|<td align=right>$ref->{income_accno_3}</td>|;
1840 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1842 map { print "$column_data{$_}\n" } @column_index;
1854 <td><hr size=3 noshade></td>
1859 <form method=post action=$form->{script}>
1861 <input name=callback type=hidden value="$form->{callback}">
1863 <input type=hidden name=type value=buchungsgruppe>
1865 <input type=hidden name=path value=$form->{path}>
1866 <input type=hidden name=login value=$form->{login}>
1867 <input type=hidden name=password value=$form->{password}>
1869 <input class=submit type=submit name=action value="|
1870 . $locale->text('Add') . qq|">|;
1872 if ($form->{menubar}) {
1873 require "$form->{path}/menu.pl";
1885 $lxdebug->leave_sub();
1888 sub buchungsgruppe_header {
1889 $lxdebug->enter_sub();
1891 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1893 # $locale->text('Buchungsgruppe hinzufügen')
1894 # $locale->text('Buchungsgruppe bearbeiten')
1896 my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
1897 my %acc_type_map = (
1898 "IC" => $acc_inventory,
1899 "IC_income" => $acc_income,
1900 "IC_sale" => $acc_income,
1901 "IC_expense" => $acc_expense,
1902 "IC_cogs" => $acc_expense,
1905 foreach $key (keys(%acc_type_map)) {
1906 foreach $ref (@{ $form->{IC_links}{$key} }) {
1907 $acc_type_map{$key}->{$ref->{"id"}} = $ref;
1911 foreach my $type (qw(IC IC_income IC_expense)) {
1912 $form->{"select$type"} =
1914 map({ "<option value=$_->{id} $_->{selected}>" .
1915 "$_->{accno}--" . H($_->{description}) . "</option>" }
1916 sort({ $a->{"accno"} cmp $b->{"accno"} }
1917 values(%{$acc_type_map{$type}}))));
1921 $form->{selectIC} =~ s/selected//g;
1922 $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/;
1923 $form->{selectIC_income} =~ s/selected//g;
1924 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1925 $form->{selectIC_expense} =~ s/selected//g;
1926 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1932 <th align=right>| . $locale->text('Inventory') . qq|</th>
1933 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1934 <input name=selectIC type=hidden value="$form->{selectIC}">
1938 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
1942 $linkaccounts .= qq|
1944 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
1945 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
1948 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
1949 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
1952 $form->{selectIC_income} =~ s/selected//g;
1953 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
1954 $form->{selectIC_expense} =~ s/selected//g;
1955 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
1957 $linkaccounts .= qq| <tr>
1958 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
1959 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
1962 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
1963 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
1967 $form->{selectIC_income} =~ s/selected//g;
1968 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
1969 $form->{selectIC_expense} =~ s/selected//g;
1970 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
1973 $linkaccounts .= qq| <tr>
1974 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
1975 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
1978 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
1979 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
1983 $form->{selectIC_income} =~ s/selected//g;
1984 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
1985 $form->{selectIC_expense} =~ s/selected//g;
1986 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
1989 $linkaccounts .= qq| <tr>
1990 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
1991 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
1994 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
1995 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
2005 <form method=post action=$form->{script}>
2007 <input type=hidden name=id value=$form->{id}>
2008 <input type=hidden name=type value=buchungsgruppe>
2012 <th class=listtop colspan=2>$form->{title}</th>
2014 <tr height="5"></tr>
2016 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
2017 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
2020 <td colspan=2><hr size=3 noshade></td>
2025 $lxdebug->leave_sub();
2028 sub save_buchungsgruppe {
2029 $lxdebug->enter_sub();
2031 $form->isblank("description", $locale->text('Description missing!'));
2033 AM->save_buchungsgruppe(\%myconfig, \%$form);
2034 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
2036 $lxdebug->leave_sub();
2039 sub delete_buchungsgruppe {
2040 $lxdebug->enter_sub();
2042 AM->delete_buchungsgruppe(\%myconfig, \%$form);
2043 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
2045 $lxdebug->leave_sub();
2050 $lxdebug->enter_sub();
2052 $form->{title} = "Add";
2055 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2056 unless $form->{callback};
2061 $lxdebug->leave_sub();
2065 $lxdebug->enter_sub();
2067 $form->{title} = "Edit";
2069 AM->get_printer(\%myconfig, \%$form);
2073 $form->{orphaned} = 1;
2076 $lxdebug->leave_sub();
2080 $lxdebug->enter_sub();
2082 AM->printer(\%myconfig, \%$form);
2085 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2087 $callback = $form->escape($form->{callback});
2089 $form->{title} = $locale->text('Printer');
2091 @column_index = qw(printer_description printer_command template_code);
2093 $column_header{printer_description} =
2094 qq|<th class=listheading width=60%>|
2095 . $locale->text('Printer Description')
2097 $column_header{printer_command} =
2098 qq|<th class=listheading width=10%>|
2099 . $locale->text('Printer Command')
2101 $column_header{template_code} =
2102 qq|<th class=listheading>|
2103 . $locale->text('Template Code')
2113 <th class=listtop>$form->{title}</th>
2115 <tr height="5"></tr>
2119 <tr class=listheading>
2122 map { print "$column_header{$_}\n" } @column_index;
2128 foreach $ref (@{ $form->{ALL} }) {
2134 <tr valign=top class=listrow$i>
2138 $column_data{printer_description} =
2139 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>|;
2140 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
2141 $column_data{template_code} =
2142 qq|<td align=right>$ref->{template_code}</td>|;
2144 map { print "$column_data{$_}\n" } @column_index;
2156 <td><hr size=3 noshade></td>
2161 <form method=post action=$form->{script}>
2163 <input name=callback type=hidden value="$form->{callback}">
2165 <input type=hidden name=type value=printer>
2167 <input type=hidden name=path value=$form->{path}>
2168 <input type=hidden name=login value=$form->{login}>
2169 <input type=hidden name=password value=$form->{password}>
2171 <input class=submit type=submit name=action value="|
2172 . $locale->text('Add') . qq|">|;
2174 if ($form->{menubar}) {
2175 require "$form->{path}/menu.pl";
2187 $lxdebug->leave_sub();
2190 sub printer_header {
2191 $lxdebug->enter_sub();
2193 $form->{title} = $locale->text("$form->{title} Printer");
2195 # $locale->text('Add Printer')
2196 # $locale->text('Edit Printer')
2198 $form->{printer_description} =~ s/\"/"/g;
2199 $form->{template_code} =~ s/\"/"/g;
2200 $form->{printer_command} =~ s/\"/"/g;
2208 <form method=post action=$form->{script}>
2210 <input type=hidden name=id value=$form->{id}>
2211 <input type=hidden name=type value=printer>
2215 <th class=listtop colspan=2>$form->{title}</th>
2217 <tr height="5"></tr>
2219 <th align=right>| . $locale->text('Printer') . qq|</th>
2220 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2223 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2224 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2227 <th align=right>| . $locale->text('Template Code') . qq|</th>
2228 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2230 <td colspan=2><hr size=3 noshade></td>
2235 $lxdebug->leave_sub();
2239 $lxdebug->enter_sub();
2241 $form->isblank("printer_description", $locale->text('Description missing!'));
2242 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2243 AM->save_printer(\%myconfig, \%$form);
2244 $form->redirect($locale->text('Printer saved!'));
2246 $lxdebug->leave_sub();
2249 sub delete_printer {
2250 $lxdebug->enter_sub();
2252 AM->delete_printer(\%myconfig, \%$form);
2253 $form->redirect($locale->text('Printer deleted!'));
2255 $lxdebug->leave_sub();
2260 $lxdebug->enter_sub();
2262 $form->{title} = "Add";
2265 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2266 unless $form->{callback};
2271 $lxdebug->leave_sub();
2275 $lxdebug->enter_sub();
2277 $form->{title} = "Edit";
2279 AM->get_payment(\%myconfig, \%$form);
2283 $form->{orphaned} = 1;
2286 $lxdebug->leave_sub();
2290 $lxdebug->enter_sub();
2292 AM->payment(\%myconfig, \%$form);
2295 "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2297 $callback = $form->escape($form->{callback});
2299 $form->{title} = $locale->text('Payment Terms');
2301 @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
2303 $column_header{description} =
2304 qq|<th class=listheading>|
2305 . $locale->text('Description')
2307 $column_header{description_long} =
2308 qq|<th class=listheading>|
2309 . $locale->text('Long Description')
2311 $column_header{terms_netto} =
2312 qq|<th class=listheading>|
2313 . $locale->text('Netto Terms')
2315 $column_header{terms_skonto} =
2316 qq|<th class=listheading>|
2317 . $locale->text('Skonto Terms')
2319 $column_header{percent_skonto} =
2320 qq|<th class=listheading>|
2321 . $locale->text('Skonto')
2331 <th class=listtop>$form->{title}</th>
2333 <tr height="5"></tr>
2337 <tr class=listheading>
2340 map { print "$column_header{$_}\n" } @column_index;
2346 foreach $ref (@{ $form->{ALL} }) {
2352 <tr valign=top class=listrow$i>
2356 $column_data{description} =
2357 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>|;
2358 $column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|;
2359 $column_data{terms_netto} =
2360 qq|<td align=right>$ref->{terms_netto}</td>|;
2361 $column_data{terms_skonto} =
2362 qq|<td align=right>$ref->{terms_skonto}</td>|;
2363 $column_data{percent_skonto} =
2364 qq|<td align=right>$ref->{percent_skonto} %</td>|;
2365 map { print "$column_data{$_}\n" } @column_index;
2377 <td><hr size=3 noshade></td>
2382 <form method=post action=$form->{script}>
2384 <input name=callback type=hidden value="$form->{callback}">
2386 <input type=hidden name=type value=business>
2388 <input type=hidden name=path value=$form->{path}>
2389 <input type=hidden name=login value=$form->{login}>
2390 <input type=hidden name=password value=$form->{password}>
2392 <input class=submit type=submit name=action value="|
2393 . $locale->text('Add') . qq|">|;
2395 if ($form->{menubar}) {
2396 require "$form->{path}/menu.pl";
2408 $lxdebug->leave_sub();
2411 sub payment_header {
2412 $lxdebug->enter_sub();
2414 $form->{title} = $locale->text("$form->{title} Payment Terms");
2416 # $locale->text('Add Payment Terms')
2417 # $locale->text('Edit Payment Terms')
2419 $form->{description} =~ s/\"/"/g;
2428 <form method=post action=$form->{script}>
2430 <input type=hidden name=id value=$form->{id}>
2431 <input type=hidden name=type value=payment>
2435 <th class=listtop colspan=2>$form->{title}</th>
2437 <tr height="5"></tr>
2439 <th align=right>| . $locale->text('Description') . qq|</th>
2440 <td><input name=description size=30 value="$form->{description}"></td>
2443 <th align=right>| . $locale->text('Ranking') . qq|</th>
2444 <td><input name=ranking size=30 value="$form->{ranking}"></td>
2447 <th align=right>| . $locale->text('Long Description') . qq|</th>
2448 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2451 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2452 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2455 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2456 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2459 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2460 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2462 <td colspan=2><hr size=3 noshade></td>
2467 $lxdebug->leave_sub();
2471 $lxdebug->enter_sub();
2473 $form->isblank("description", $locale->text('Language missing!'));
2474 AM->save_payment(\%myconfig, \%$form);
2475 $form->redirect($locale->text('Payment Terms saved!'));
2477 $lxdebug->leave_sub();
2480 sub delete_payment {
2481 $lxdebug->enter_sub();
2483 AM->delete_payment(\%myconfig, \%$form);
2484 $form->redirect($locale->text('Payment terms deleted!'));
2486 $lxdebug->leave_sub();
2490 $lxdebug->enter_sub();
2492 $form->{title} = "Add";
2495 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2496 unless $form->{callback};
2501 $lxdebug->leave_sub();
2505 $lxdebug->enter_sub();
2507 $form->{title} = "Edit";
2509 AM->get_sic(\%myconfig, \%$form);
2513 $form->{orphaned} = 1;
2516 $lxdebug->leave_sub();
2520 $lxdebug->enter_sub();
2522 AM->sic(\%myconfig, \%$form);
2525 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2527 $callback = $form->escape($form->{callback});
2529 $form->{title} = $locale->text('Standard Industrial Codes');
2531 @column_index = qw(code description);
2533 $column_header{code} =
2534 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
2535 $column_header{description} =
2536 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
2545 <th class=listtop>$form->{title}</th>
2547 <tr height="5"></tr>
2551 <tr class=listheading>
2554 map { print "$column_header{$_}\n" } @column_index;
2560 foreach $ref (@{ $form->{ALL} }) {
2565 if ($ref->{sictype} eq 'H') {
2567 <tr valign=top class=listheading>
2569 $column_data{code} =
2570 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>|;
2571 $column_data{description} = qq|<th>$ref->{description}</th>|;
2575 <tr valign=top class=listrow$i>
2578 $column_data{code} =
2579 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>|;
2580 $column_data{description} = qq|<td>$ref->{description}</td>|;
2584 map { print "$column_data{$_}\n" } @column_index;
2596 <td><hr size=3 noshade></td>
2601 <form method=post action=$form->{script}>
2603 <input name=callback type=hidden value="$form->{callback}">
2605 <input type=hidden name=type value=sic>
2607 <input type=hidden name=path value=$form->{path}>
2608 <input type=hidden name=login value=$form->{login}>
2609 <input type=hidden name=password value=$form->{password}>
2611 <input class=submit type=submit name=action value="|
2612 . $locale->text('Add') . qq|">|;
2614 if ($form->{menubar}) {
2615 require "$form->{path}/menu.pl";
2626 $lxdebug->leave_sub();
2630 $lxdebug->enter_sub();
2632 $form->{title} = $locale->text("$form->{title} SIC");
2634 # $locale->text('Add SIC')
2635 # $locale->text('Edit SIC')
2637 $form->{code} =~ s/\"/"/g;
2638 $form->{description} =~ s/\"/"/g;
2640 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
2647 <form method=post action=$form->{script}>
2649 <input type=hidden name=type value=sic>
2650 <input type=hidden name=id value=$form->{code}>
2654 <th class=listtop colspan=2>$form->{title}</th>
2656 <tr height="5"></tr>
2658 <th align=right>| . $locale->text('Code') . qq|</th>
2659 <td><input name=code size=10 value=$form->{code}></td>
2663 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
2664 . $locale->text('Heading') . qq|</th>
2667 <th align=right>| . $locale->text('Description') . qq|</th>
2668 <td><input name=description size=60 value="$form->{description}"></td>
2670 <td colspan=2><hr size=3 noshade></td>
2675 $lxdebug->leave_sub();
2679 $lxdebug->enter_sub();
2681 $form->isblank("code", $locale->text('Code missing!'));
2682 $form->isblank("description", $locale->text('Description missing!'));
2683 AM->save_sic(\%myconfig, \%$form);
2684 $form->redirect($locale->text('SIC saved!'));
2686 $lxdebug->leave_sub();
2690 $lxdebug->enter_sub();
2692 AM->delete_sic(\%myconfig, \%$form);
2693 $form->redirect($locale->text('SIC deleted!'));
2695 $lxdebug->leave_sub();
2698 sub display_stylesheet {
2699 $lxdebug->enter_sub();
2701 $form->{file} = "css/$myconfig{stylesheet}";
2704 $lxdebug->leave_sub();
2708 $lxdebug->enter_sub();
2710 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2711 $form->{file} =~ s/^\/*//g;
2712 $form->{file} =~ s/$userspath//;
2714 $form->error("$!: $form->{file}") unless -f $form->{file};
2716 AM->load_template(\%$form);
2718 $form->{title} = $form->{file};
2720 # if it is anything but html
2721 if ($form->{file} !~ /\.html$/) {
2722 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2732 <form method=post action=$form->{script}>
2734 <input name=file type=hidden value=$form->{file}>
2735 <input name=type type=hidden value=template>
2737 <input type=hidden name=path value=$form->{path}>
2738 <input type=hidden name=login value=$form->{login}>
2739 <input type=hidden name=password value=$form->{password}>
2741 <input name=action type=submit class=submit value="|
2742 . $locale->text('Edit') . qq|">|;
2744 if ($form->{menubar}) {
2745 require "$form->{path}/menu.pl";
2756 $lxdebug->leave_sub();
2760 $lxdebug->enter_sub();
2762 AM->load_template(\%$form);
2764 $form->{title} = $locale->text('Edit Template');
2766 # convert   to &nbsp;
2767 $form->{body} =~ s/ /&nbsp;/gi;
2774 <form method=post action=$form->{script}>
2776 <input name=file type=hidden value=$form->{file}>
2777 <input name=type type=hidden value=template>
2779 <input type=hidden name=path value=$form->{path}>
2780 <input type=hidden name=login value=$form->{login}>
2781 <input type=hidden name=password value=$form->{password}>
2783 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
2785 <textarea name=body rows=25 cols=70>
2790 <input type=submit class=submit name=action value="|
2791 . $locale->text('Save') . qq|">|;
2793 if ($form->{menubar}) {
2794 require "$form->{path}/menu.pl";
2806 $lxdebug->leave_sub();
2810 $lxdebug->enter_sub();
2812 AM->save_template(\%$form);
2813 $form->redirect($locale->text('Template saved!'));
2815 $lxdebug->leave_sub();
2819 $lxdebug->enter_sub();
2821 # get defaults for account numbers and last numbers
2822 AM->defaultaccounts(\%myconfig, \%$form);
2824 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2826 ($item eq $myconfig{dateformat})
2827 ? "<option selected>$item\n"
2828 : "<option>$item\n";
2831 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2833 ($item eq $myconfig{numberformat})
2834 ? "<option selected>$item\n"
2835 : "<option>$item\n";
2838 foreach $item (qw(name company address signature)) {
2839 $myconfig{$item} =~ s/\"/"/g;
2842 foreach $item (qw(address signature)) {
2843 $myconfig{$item} =~ s/\\n/\r\n/g;
2846 %countrycodes = User->country_codes;
2848 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2852 ($myconfig{countrycode} eq $key)
2853 ? "<option selected value=$key>$countrycodes{$key}\n"
2854 : "<option value=$key>$countrycodes{$key}\n";
2856 $countrycodes = "<option>American English\n$countrycodes";
2858 # use an other input number format than output numberformat
2859 # look at Form.pm, sub parse_amount
2860 my $in_numberformat = '';
2861 $text1 = qq|value="0">| . $locale->text('equal Outputformat');
2862 $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
2863 @in_nf = ($text1, $text2);
2864 foreach $item (@in_nf) {
2866 (substr($item, 7, 1) eq $myconfig{in_numberformat})
2867 ? "<option selected $item\n"
2868 : "<option $item\n";
2871 foreach $key (keys %{ $form->{IC} }) {
2872 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2874 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2875 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2876 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2880 opendir CSS, "css/.";
2881 @all = grep /.*\.css$/, readdir CSS;
2884 foreach $item (@all) {
2885 if ($item eq $myconfig{stylesheet}) {
2886 $selectstylesheet .= qq|<option selected>$item\n|;
2888 $selectstylesheet .= qq|<option>$item\n|;
2891 $selectstylesheet .= "<option>\n";
2893 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2897 if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
2898 else { $newS = "checked"; }
2903 <form method=post action=$form->{script}>
2905 <input type=hidden name=old_password value=$myconfig{password}>
2906 <input type=hidden name=type value=preferences>
2907 <input type=hidden name=role value=$myconfig{role}>
2910 <tr><th class=listtop>$form->{title}</th></tr>
2915 <th align=right>| . $locale->text('Name') . qq|</th>
2916 <td><input name=name size=15 value="$myconfig{name}"></td>
2919 <th align=right>| . $locale->text('Password') . qq|</th>
2920 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2923 <th align=right>| . $locale->text('E-mail') . qq|</th>
2924 <td><input name=email size=30 value="$myconfig{email}"></td>
2927 <th align=right>| . $locale->text('Signature') . qq|</th>
2928 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2931 <th align=right>| . $locale->text('Phone') . qq|</th>
2932 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2935 <th align=right>| . $locale->text('Fax') . qq|</th>
2936 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2939 <th align=right>| . $locale->text('Company') . qq|</th>
2940 <td><input name=company size=30 value="$myconfig{company}"></td>
2943 <th align=right>| . $locale->text('Address') . qq|</th>
2944 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2947 <th align=right>| . $locale->text('Date Format') . qq|</th>
2948 <td><select name=dateformat>$dateformat</select></td>
2951 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2952 <td><select name=numberformat>$numberformat</select></td>
2955 <th align=right>| . $locale->text('Input Number Format') . qq|</th>
2956 <td><select name=in_numberformat>$in_numberformat</select></td>
2960 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2961 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2964 <th align=right>| . $locale->text('Language') . qq|</th>
2965 <td><select name=countrycode>$countrycodes</select></td>
2968 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
2969 <td><select name=usestylesheet>$selectstylesheet</select></td>
2972 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
2973 <td><input name=menustyle type=radio class=radio value=neu $newS> New
2974 <input name=menustyle type=radio class=radio value=old $oldS> Old</td>
2976 <input name=printer type=hidden value="$myconfig{printer}">
2977 <tr class=listheading>
2978 <th colspan=2> </th>
2981 <th align=right>| . $locale->text('Business Number') . qq|</th>
2982 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
2988 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
2989 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
2990 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
2991 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
2996 <tr class=listheading>
2998 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
3004 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
3005 <td><select name=inventory_accno>$myconfig{IC}</select></td>
3008 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
3009 <td><select name=income_accno>$myconfig{IC_income}</select></td>
3012 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
3013 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
3016 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
3017 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
3020 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
3021 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
3026 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
3028 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
3037 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
3038 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
3039 <th align=right nowrap>|
3040 . $locale->text('Last Customer Number') . qq|</th>
3041 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
3044 <th align=right nowrap>|
3045 . $locale->text('Last Credit Note Number') . qq|</th>
3046 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
3047 <th align=right nowrap>|
3048 . $locale->text('Last Vendor Number') . qq|</th>
3049 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
3052 <th align=right nowrap>|
3053 . $locale->text('Last Sales Order Number') . qq|</th>
3054 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
3057 <th align=right nowrap>|
3058 . $locale->text('Last Purchase Order Number') . qq|</th>
3059 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
3060 <th align=right nowrap>|
3061 . $locale->text('Last Article Number') . qq|</th>
3062 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
3065 <th align=right nowrap>|
3066 . $locale->text('Last Sales Quotation Number') . qq|</th>
3067 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
3068 <th align=right nowrap>|
3069 . $locale->text('Last Service Number') . qq|</th>
3070 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
3073 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
3074 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
3075 <th align=right nowrap></th>
3081 # <tr class=listheading>
3082 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3089 # <th>| . $locale->text('Rate') . qq| (%)</th>
3090 # <th>| . $locale->text('Number') . qq|</th>
3094 # foreach $accno (sort keys %{ $form->{taxrates} }) {
3097 # <th align=right>$form->{taxrates}{$accno}{description}</th>
3098 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3099 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3102 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3105 # chop $form->{taxaccounts};
3108 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3117 <td><hr size=3 noshade></td>
3121 <input type=hidden name=path value=$form->{path}>
3122 <input type=hidden name=login value=$form->{login}>
3123 <input type=hidden name=password value=$form->{password}>
3126 <input type=submit class=submit name=action value="|
3127 . $locale->text('Save') . qq|">|;
3129 if ($form->{menubar}) {
3130 require "$form->{path}/menu.pl";
3141 $lxdebug->leave_sub();
3144 sub save_preferences {
3145 $lxdebug->enter_sub();
3147 $form->{stylesheet} = $form->{usestylesheet};
3149 $form->redirect($locale->text('Preferences saved!'))
3151 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3153 $form->error($locale->text('Cannot save preferences!'));
3155 $lxdebug->leave_sub();
3159 $lxdebug->enter_sub();
3161 if ($form->{media} eq 'email') {
3162 $form->error($locale->text('No email address for') . " $myconfig{name}")
3163 unless ($myconfig{email});
3165 $form->{OUT} = "$sendmail";
3169 AM->backup(\%myconfig, \%$form, $userspath);
3171 if ($form->{media} eq 'email') {
3172 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
3175 $lxdebug->leave_sub();
3179 $lxdebug->enter_sub();
3181 $form->{title} = $locale->text('Audit Control');
3183 AM->closedto(\%myconfig, \%$form);
3185 if ($form->{revtrans}) {
3186 $checked{Y} = "checked";
3188 $checked{N} = "checked";
3196 <form method=post action=$form->{script}>
3198 <input type=hidden name=path value=$form->{path}>
3199 <input type=hidden name=login value=$form->{login}>
3200 <input type=hidden name=password value=$form->{password}>
3203 <tr><th class=listtop>$form->{title}</th></tr>
3204 <tr height="5"></tr>
3210 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3211 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3212 . $locale->text('Yes')
3213 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3214 . $locale->text('No')
3218 <th>| . $locale->text('Close Books up to') . qq|</th>
3219 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3229 <input type=hidden name=nextsub value=doclose>
3231 <input type=submit class=submit name=action value="|
3232 . $locale->text('Continue') . qq|">
3240 $lxdebug->leave_sub();
3244 $lxdebug->enter_sub();
3246 AM->closebooks(\%myconfig, \%$form);
3248 if ($form->{revtrans}) {
3250 $locale->text('Transaction reversal enforced for all dates'));
3252 if ($form->{closedto}) {
3254 $locale->text('Transaction reversal enforced up to') . " "
3255 . $locale->date(\%myconfig, $form->{closedto}, 1));
3257 $form->redirect($locale->text('Books are open'));
3261 $lxdebug->leave_sub();
3265 $lxdebug->enter_sub();
3267 $form->{title} = "Add";
3270 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
3271 unless $form->{callback};
3276 $lxdebug->leave_sub();
3279 sub edit_warehouse {
3280 $lxdebug->enter_sub();
3282 $form->{title} = "Edit";
3284 AM->get_warehouse(\%myconfig, \%$form);
3289 $lxdebug->leave_sub();
3292 sub list_warehouse {
3293 $lxdebug->enter_sub();
3295 AM->warehouses(\%myconfig, \%$form);
3298 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
3300 $callback = $form->escape($form->{callback});
3302 $form->{title} = $locale->text('Warehouses');
3304 @column_index = qw(description);
3306 $column_header{description} =
3307 qq|<th class=listheading width=100%>|
3308 . $locale->text('Description')
3318 <th class=listtop>$form->{title}</th>
3320 <tr height="5"></tr>
3324 <tr class=listheading>
3327 map { print "$column_header{$_}\n" } @column_index;
3333 foreach $ref (@{ $form->{ALL} }) {
3339 <tr valign=top class=listrow$i>
3342 $column_data{description} =
3343 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>|;
3345 map { print "$column_data{$_}\n" } @column_index;
3357 <td><hr size=3 noshade></td>
3362 <form method=post action=$form->{script}>
3364 <input name=callback type=hidden value="$form->{callback}">
3366 <input type=hidden name=type value=warehouse>
3368 <input type=hidden name=path value=$form->{path}>
3369 <input type=hidden name=login value=$form->{login}>
3370 <input type=hidden name=password value=$form->{password}>
3372 <input class=submit type=submit name=action value="|
3373 . $locale->text('Add') . qq|">|;
3375 if ($form->{menubar}) {
3376 require "$form->{path}/menu.pl";
3387 $lxdebug->leave_sub();
3390 sub warehouse_header {
3391 $lxdebug->enter_sub();
3393 $form->{title} = $locale->text("$form->{title} Warehouse");
3395 # $locale->text('Add Warehouse')
3396 # $locale->text('Edit Warehouse')
3398 $form->{description} =~ s/\"/"/g;
3400 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
3402 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
3405 qq|<input name=description size=60 value="$form->{description}">|;
3413 <form method=post action=$form->{script}>
3415 <input type=hidden name=id value=$form->{id}>
3416 <input type=hidden name=type value=warehouse>
3420 <th class=listtop colspan=2>$form->{title}</th>
3422 <tr height="5"></tr>
3424 <th align=right>| . $locale->text('Description') . qq|</th>
3425 <td>$description</td>
3428 <td colspan=2><hr size=3 noshade></td>
3433 $lxdebug->leave_sub();
3436 sub save_warehouse {
3437 $lxdebug->enter_sub();
3439 $form->isblank("description", $locale->text('Description missing!'));
3440 AM->save_warehouse(\%myconfig, \%$form);
3441 $form->redirect($locale->text('Warehouse saved!'));
3443 $lxdebug->leave_sub();
3446 sub delete_warehouse {
3447 $lxdebug->enter_sub();
3449 AM->delete_warehouse(\%myconfig, \%$form);
3450 $form->redirect($locale->text('Warehouse deleted!'));
3452 $lxdebug->leave_sub();
3456 $lxdebug->enter_sub();
3458 &{ $form->{nextsub} };
3460 $lxdebug->leave_sub();
3464 $lxdebug->enter_sub();
3466 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3467 AM->units_in_use(\%myconfig, $form, $units);
3468 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3471 foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3472 map({ push(@unit_list, $units->{$_}); }
3473 sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3474 grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3476 map({ $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"}); } @unit_list);
3478 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3479 $ddbox = AM->unit_select_data($units, undef, 1);
3481 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3483 print($form->parse_html_template("am/edit_units", { "UNITS" => \@unit_list, "NEW_BASE_UNIT_DDBOX" => $ddbox }));
3485 $lxdebug->leave_sub();
3489 $lxdebug->enter_sub();
3491 $form->isblank("new_name", $locale->text("The name is missing."));
3492 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3493 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($units->{$form->{"new_name"}});
3495 my ($base_unit, $factor);
3496 if ($form->{"new_base_unit"}) {
3497 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3499 $form->isblank("new_factor", $locale->text("The factor is missing."));
3500 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3501 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3502 $base_unit = $form->{"new_base_unit"};
3505 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"});
3507 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3511 $lxdebug->leave_sub();
3515 $lxdebug->enter_sub();
3517 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3518 AM->units_in_use(\%myconfig, $form, $old_units);
3522 foreach $i (1..($form->{"rowcount"} * 1)) {
3523 $old_unit = $old_units->{$form->{"old_name_$i"}};
3525 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3528 if ($form->{"unchangeable_$i"}) {
3529 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3530 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3534 if ($old_unit->{"in_use"}) {
3535 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3538 if ($form->{"delete_$i"}) {
3539 push(@delete_units, $old_unit->{"name"});
3543 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3545 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3546 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3547 $new_units->{$form->{"name_$i"}} = \%h;
3548 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3551 foreach $unit (values(%{$new_units})) {
3552 next unless ($unit->{"old_name"});
3553 if ($unit->{"base_unit"}) {
3554 $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"}))
3555 unless (defined($new_units->{$unit->{"base_unit"}}));
3556 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3557 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3559 $unit->{"base_unit"} = undef;
3560 $unit->{"factor"} = undef;
3564 foreach $unit (values(%{$new_units})) {
3565 next if ($unit->{"unchanged_unit"});
3567 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3569 while ($new_unit->{"base_unit"}) {
3570 $new_unit->{"seen"} = 1;
3571 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3572 if ($new_unit->{"seen"}) {
3573 $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, " .
3574 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3579 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3581 $form->{"saved_message"} = $locale->text("The units have been saved.");
3585 $lxdebug->leave_sub();