1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #======================================================================
32 #======================================================================
43 require "$form->{path}/common.pl";
47 sub add { &{"add_$form->{type}"} }
48 sub edit { &{"edit_$form->{type}"} }
49 sub save { &{"save_$form->{type}"} }
50 sub delete { &{"delete_$form->{type}"} }
53 $lxdebug->enter_sub();
55 $form->{title} = "Add";
56 $form->{charttype} = "A";
57 AM->get_account(\%myconfig, \%$form);
60 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
61 unless $form->{callback};
66 $lxdebug->leave_sub();
70 $lxdebug->enter_sub();
72 $form->{title} = "Edit";
73 AM->get_account(\%myconfig, \%$form);
75 foreach my $item (split(/:/, $form->{link})) {
76 $form->{$item} = "checked";
82 $lxdebug->leave_sub();
86 $lxdebug->enter_sub();
88 $form->{title} = $locale->text("$form->{title} Account");
90 $checked{ $form->{charttype} } = "checked";
91 $checked{"$form->{category}_"} = "checked";
92 $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
94 $form->{description} =~ s/\"/"/g;
96 if (@{ $form->{TAXKEY} }) {
97 foreach $item (@{ $form->{TAXKEY} }) {
98 if ($item->{tax} == $form->{tax}) {
99 $form->{selecttaxkey} .=
100 "<option value=$item->{tax} selected>$item->{taxdescription}\n";
102 $form->{selecttaxkey} .=
103 "<option value=$item->{tax}>$item->{taxdescription}\n";
111 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
112 <td><select name=tax>$form->{selecttaxkey}</select></td>
113 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
114 <td><input name=startdate value="$form->{startdate}"></td>
117 if (@{ $form->{NEWACCOUNT} }) {
118 if (!$form->{new_chart_valid}) {
119 $form->{selectnewaccount} = "<option value=></option>";
121 foreach $item (@{ $form->{NEWACCOUNT} }) {
122 if ($item->{id} == $form->{new_chart_id}) {
123 $form->{selectnewaccount} .=
124 "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
125 } elsif (!$form->{new_chart_valid}) {
126 $form->{selectnewaccount} .=
127 "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
138 <th align=right>| . $locale->text('Folgekonto') . qq|</th>
139 <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
140 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
141 <td><input name=valid_from value="$form->{valid_from}"></td>
147 $form->{selectustva} = "<option>\n";
149 %ustva = (35 => $locale->text('UStVA-Nr. 35'),
150 36 => $locale->text('UStVA-Nr. 36'),
151 39 => $locale->text('UStVA-Nr. 39'),
152 41 => $locale->text('UStVA-Nr. 41'),
153 42 => $locale->text('UStVA-Nr. 42'),
154 43 => $locale->text('UStVA-Nr. 43'),
155 44 => $locale->text('UStVA-Nr. 44'),
156 45 => $locale->text('UStVA-Nr. 45'),
157 48 => $locale->text('UStVA-Nr. 48'),
158 49 => $locale->text('UStVA-Nr. 49'),
159 51 => $locale->text('UStVA-Nr. 51 left'),
160 511 => $locale->text('UStVA-Nr. 51 right'),
161 52 => $locale->text('UStVA-Nr. 52'),
162 53 => $locale->text('UStVA-Nr. 53'),
163 59 => $locale->text('UStVA-Nr. 59'),
164 60 => $locale->text('UStVA-Nr. 60'),
165 61 => $locale->text('UStVA-Nr. 61'),
166 62 => $locale->text('UStVA-Nr. 62'),
167 63 => $locale->text('UStVA-Nr. 63'),
168 64 => $locale->text('UStVA-Nr. 64'),
169 65 => $locale->text('UStVA-Nr. 65'),
170 66 => $locale->text('UStVA-Nr. 66'),
171 67 => $locale->text('UStVA-Nr. 67'),
172 69 => $locale->text('UStVA-Nr. 69'),
173 73 => $locale->text('UStVA-Nr. 73'),
174 74 => $locale->text('UStVA-Nr. 74'),
175 76 => $locale->text('UStVA-Nr. 76'),
176 77 => $locale->text('UStVA-Nr. 77'),
177 80 => $locale->text('UStVA-Nr. 80'),
178 84 => $locale->text('UStVA-Nr. 84'),
179 85 => $locale->text('UStVA-Nr. 85'),
180 86 => $locale->text('UStVA-Nr. 86 left'),
181 861 => $locale->text('UStVA-Nr. 86 right'),
182 91 => $locale->text('UStVA-Nr. 91'),
183 93 => $locale->text('UStVA-Nr. 93 left'),
184 931 => $locale->text('UStVA-Nr. 93 right'),
185 94 => $locale->text('UStVA-Nr. 94'),
186 95 => $locale->text('UStVA-Nr. 95'),
187 96 => $locale->text('UStVA-Nr. 96'),
188 97 => $locale->text('UStVA-Nr. 97 links'),
189 971 => $locale->text('UStVA-Nr. 97 rechts'),
190 98 => $locale->text('UStVA-Nr. 98'));
192 foreach $item (sort({ $a cmp $b } keys %ustva)) {
193 if ($item == $form->{pos_ustva}) {
194 $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
196 $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
203 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
204 <td><select name=pos_ustva>$form->{selectustva}</select></td>
205 <input type=hidden name=selectustva value="$form->{selectustva}">
208 $form->{selecteur} = "<option>\n";
209 %eur = (1 => "Umsatzerlöse",
210 2 => "sonstige Erlöse",
211 3 => "Privatanteile",
213 5 => "Ausserordentliche Erträge",
214 6 => "Vereinnahmte Umsatzst.",
215 7 => "Umsatzsteuererstattungen",
216 8 => "Wareneingänge",
217 9 => "Löhne und Gehälter",
218 10 => "Gesetzl. sozialer Aufw.",
220 12 => "Gas, Strom, Wasser",
221 13 => "Instandhaltung",
222 14 => "Steuern, Versich., Beiträge",
224 16 => "Kfz-Versicherungen",
225 17 => "Sonst. Fahrtkosten",
226 18 => "Werbe- und Reisekosten",
227 19 => "Instandhaltung u. Werkzeuge",
228 20 => "Fachzeitschriften, Bücher",
229 21 => "Miete für Einrichtungen",
230 22 => "Rechts- und Beratungskosten",
231 23 => "Bürobedarf, Porto, Telefon",
232 24 => "Sonstige Aufwendungen",
233 25 => "Abschreibungen auf Anlagever.",
234 26 => "Abschreibungen auf GWG",
236 28 => "Umsatzsteuerzahlungen",
238 30 => "Ausserordentlicher Aufwand",
239 31 => "Betriebliche Steuern");
240 foreach $item (sort({ $a <=> $b } keys(%eur))) {
241 if ($item == $form->{pos_eur}) {
242 $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
244 $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
251 <th align=right>| . $locale->text('EUER') . qq|</th>
252 <td><select name=pos_eur>$form->{selecteur}</select></td>
253 <input type=hidden name=selecteur value="$form->{selecteur}">
256 $form->{selectbwa} = "<option>\n";
258 %bwapos = (1 => 'Umsatzerlöse',
259 2 => 'Best.Verdg.FE/UE',
260 3 => 'Aktiv.Eigenleistung',
261 4 => 'Mat./Wareneinkauf',
262 5 => 'So.betr.Erlöse',
263 10 => 'Personalkosten',
265 12 => 'Betriebl.Steuern',
266 13 => 'Vers./Beiträge',
267 14 => 'Kfz.Kosten o.St.',
268 15 => 'Werbe-Reisek.',
269 16 => 'Kosten Warenabgabe',
270 17 => 'Abschreibungen',
271 18 => 'Rep./instandhlt.',
272 19 => 'Übrige Steuern',
273 20 => 'Sonst.Kosten',
275 31 => 'Sonst.neutr.Aufw.',
277 33 => 'Sonst.neutr.Ertrag',
278 34 => 'Verr.kalk.Kosten',
279 35 => 'Steuern Eink.u.Ertr.');
280 foreach $item (sort({ $a <=> $b } keys %bwapos)) {
281 if ($item == $form->{pos_bwa}) {
282 $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
284 $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
291 <th align=right>| . $locale->text('BWA') . qq|</th>
292 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
293 <input type=hidden name=selectbwa value="$form->{selectbwa}">
296 # Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
297 # $form->{selectbilanz} = "<option>\n";
298 # foreach $item ((1, 2, 3, 4)) {
299 # if ($item == $form->{pos_bilanz}) {
300 # $form->{selectbilanz} .= "<option value=$item selected>$item\n";
302 # $form->{selectbilanz} .= "<option value=$item>$item\n";
309 # <th align=right>| . $locale->text('Bilanz') . qq|</th>
310 # <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
311 # <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
314 # this is for our parser only!
315 # type=submit $locale->text('Add Account')
316 # type=submit $locale->text('Edit Account')
317 $form->{type} = "account";
324 <form method=post action=$form->{script}>
326 <input type=hidden name=id value=$form->{id}>
327 <input type=hidden name=type value=account>
328 <input type=hidden name=orphaned value=$form->{orphaned}>
329 <input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
331 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
332 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
333 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
334 <input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
335 <input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
337 <table border=0 width=100%>
339 <th class=listtop>$form->{title}</th>
346 <th align=right>| . $locale->text('Account Number') . qq|</th>
347 <td><input name=accno size=20 value=$form->{accno}></td>
350 <th align=right>| . $locale->text('Description') . qq|</th>
351 <td><input name=description size=40 value="$form->{description}"></td>
354 <th align=right>| . $locale->text('Account Type') . qq|</th>
358 <td><input name=category type=radio class=radio value=A $checked{A_}> |
359 . $locale->text('Asset') . qq|\n<br>
360 <input name=category type=radio class=radio value=L $checked{L_}> |
361 . $locale->text('Liability') . qq|\n<br>
362 <input name=category type=radio class=radio value=Q $checked{Q_}> |
363 . $locale->text('Equity') . qq|\n<br>
364 <input name=category type=radio class=radio value=I $checked{I_}> |
365 . $locale->text('Revenue') . qq|\n<br>
366 <input name=category type=radio class=radio value=E $checked{E_}> |
367 . $locale->text('Expense') . qq|<br>
368 <input name=category type=radio class=radio value=C $checked{C_}> |
369 . $locale->text('Costs') . qq|</td>
370 <td width=50> </td>
372 <input name=charttype type=radio class=radio value="H" $checked{H}> |
373 . $locale->text('Heading') . qq|<br>
374 <input name=charttype type=radio class=radio value="A" $checked{A}> |
375 . $locale->text('Account') . qq|</td>
382 if ($form->{charttype} eq "A") {
389 . $locale->text('Is this a summary account to record') . qq|</th>
391 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
392 . $locale->text('AR')
393 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
394 . $locale->text('AP')
395 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
396 . $locale->text('Inventory')
403 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
409 <th align=left>| . $locale->text('Receivables') . qq|</th>
410 <th align=left>| . $locale->text('Payables') . qq|</th>
411 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
412 <th align=left>| . $locale->text('Service Items') . qq|</th>
416 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
417 . $locale->text('Revenue') . qq|\n<br>
418 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
419 . $locale->text('Receipt') . qq|\n<br>
420 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
421 . $locale->text('Tax') . qq|
424 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
425 . $locale->text('Expense/Asset') . qq|\n<br>
426 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
427 . $locale->text('Payment') . qq|\n<br>
428 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
429 . $locale->text('Tax') . qq|
432 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
433 . $locale->text('Revenue') . qq|\n<br>
434 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
435 . $locale->text('Expense') . qq|\n<br>
436 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
437 . $locale->text('Tax') . qq|
440 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
441 . $locale->text('Revenue') . qq|\n<br>
442 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
443 . $locale->text('Expense') . qq|\n<br>
444 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
445 . $locale->text('Tax') . qq|
465 <td><hr size=3 noshade></td>
470 $lxdebug->leave_sub();
474 $lxdebug->enter_sub();
478 <input name=callback type=hidden value="$form->{callback}">
480 <input type=hidden name=path value=$form->{path}>
481 <input type=hidden name=login value=$form->{login}>
482 <input type=hidden name=password value=$form->{password}>
485 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
487 <input type=submit class=submit name=action value="|
488 . $locale->text('Save') . qq|">
492 if ($form->{id} && $form->{orphaned}) {
493 print qq|<input type=submit class=submit name=action value="|
494 . $locale->text('Delete') . qq|">|;
504 $lxdebug->leave_sub();
508 $lxdebug->enter_sub();
510 $form->isblank("accno", $locale->text('Account Number missing!'));
511 $form->isblank("category", $locale->text('Account Type missing!'));
513 $form->redirect($locale->text('Account saved!'))
514 if (AM->save_account(\%myconfig, \%$form));
515 $form->error($locale->text('Cannot save account!'));
517 $lxdebug->leave_sub();
521 $lxdebug->enter_sub();
523 CA->all_accounts(\%myconfig, \%$form);
525 $form->{title} = $locale->text('Chart of Accounts');
529 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
531 @column_index = qw(accno gifi_accno description debit credit link);
533 $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
534 $column_header{gifi_accno} =
535 qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
536 $column_header{description} =
537 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
538 $column_header{debit} = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
539 $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
540 $column_header{link} = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
543 $colspan = $#column_index + 1;
550 <th class=listtop colspan=$colspan>$form->{title}</th>
553 <tr class=listheading>
556 map { print "$column_header{$_}\n" } @column_index;
563 $callback = $form->escape($callback);
565 foreach $ca (@{ $form->{CA} }) {
567 $ca->{debit} = " ";
568 $ca->{credit} = " ";
570 if ($ca->{amount} > 0) {
572 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
574 if ($ca->{amount} < 0) {
576 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
579 $ca->{link} =~ s/:/<br>/og;
581 if ($ca->{charttype} eq "H") {
582 print qq|<tr class=listheading>|;
584 $column_data{accno} =
585 qq|<th><a href=$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</a></th>|;
586 $column_data{gifi_accno} =
587 qq|<th><a href=$form->{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{gifi_accno}</a> </th>|;
588 $column_data{description} = qq|<th>$ca->{description} </th>|;
589 $column_data{debit} = qq|<th> </th>|;
590 $column_data{credit} = qq| <th> </th>|;
591 $column_data{link} = qq|<th> </th>|;
597 <tr valign=top class=listrow$i>|;
598 $column_data{accno} =
599 qq|<td><a href=$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</a></td>|;
600 $column_data{gifi_accno} =
601 qq|<td><a href=$form->{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{gifi_accno}</a> </td>|;
602 $column_data{description} = qq|<td>$ca->{description} </td>|;
603 $column_data{debit} = qq|<td align=right>$ca->{debit}</td>|;
604 $column_data{credit} = qq|<td align=right>$ca->{credit}</td>|;
605 $column_data{link} = qq|<td>$ca->{link} </td>|;
609 map { print "$column_data{$_}\n" } @column_index;
615 <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
622 $lxdebug->leave_sub();
626 $lxdebug->enter_sub();
628 $form->{title} = $locale->text('Delete Account');
631 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
633 if ($form->{id} == $form->{$id}) {
634 $form->error($locale->text('Cannot delete default account!'));
638 $form->redirect($locale->text('Account deleted!'))
639 if (AM->delete_account(\%myconfig, \%$form));
640 $form->error($locale->text('Cannot delete account!'));
642 $lxdebug->leave_sub();
646 $lxdebug->enter_sub();
648 @{ $form->{fields} } = (accno, description);
649 $form->{table} = "gifi";
650 $form->{sortorder} = "accno";
652 AM->gifi_accounts(\%myconfig, \%$form);
654 $form->{title} = $locale->text('GIFI');
658 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
660 @column_index = qw(accno description);
662 $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
663 $column_header{description} =
664 qq|<th>| . $locale->text('Description') . qq|</a></th>|;
667 $colspan = $#column_index + 1;
674 <th class=listtop colspan=$colspan>$form->{title}</th>
677 <tr class=listheading>
680 map { print "$column_header{$_}\n" } @column_index;
687 $callback = $form->escape($callback);
689 foreach $ca (@{ $form->{ALL} }) {
695 <tr valign=top class=listrow$i>|;
697 $column_data{accno} =
698 qq|<td><a href=$form->{script}?action=edit_gifi&coa=1&accno=$ca->{accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</td>|;
699 $column_data{description} = qq|<td>$ca->{description} </td>|;
701 map { print "$column_data{$_}\n" } @column_index;
708 <td colspan=$colspan><hr size=3 noshade></td>
716 $lxdebug->leave_sub();
720 $lxdebug->enter_sub();
722 $form->{title} = "Add";
726 "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
733 $lxdebug->leave_sub();
737 $lxdebug->enter_sub();
739 $form->{title} = "Edit";
741 AM->get_gifi(\%myconfig, \%$form);
746 $lxdebug->leave_sub();
750 $lxdebug->enter_sub();
752 $form->{title} = $locale->text("$form->{title} GIFI");
754 # $locale->text('Add GIFI')
755 # $locale->text('Edit GIFI')
757 $form->{description} =~ s/\"/"/g;
764 <form method=post action=$form->{script}>
766 <input type=hidden name=id value=$form->{accno}>
767 <input type=hidden name=type value=gifi>
771 <th class=listtop>$form->{title}</th>
778 <th align=right>| . $locale->text('GIFI') . qq|</th>
779 <td><input name=accno size=20 value=$form->{accno}></td>
782 <th align=right>| . $locale->text('Description') . qq|</th>
783 <td><input name=description size=60 value="$form->{description}"></td>
789 <td colspan=2><hr size=3 noshade></td>
794 $lxdebug->leave_sub();
798 $lxdebug->enter_sub();
802 <input name=callback type=hidden value="$form->{callback}">
804 <input type=hidden name=path value=$form->{path}>
805 <input type=hidden name=login value=$form->{login}>
806 <input type=hidden name=password value=$form->{password}>
808 <br><input type=submit class=submit name=action value="|
809 . $locale->text('Save') . qq|">|;
813 <input type=submit class=submit name=action value="|
814 . $locale->text('Copy to COA') . qq|">
817 if ($form->{accno} && $form->{orphaned}) {
818 print qq|<input type=submit class=submit name=action value="|
819 . $locale->text('Delete') . qq|">|;
830 $lxdebug->leave_sub();
834 $lxdebug->enter_sub();
836 $form->isblank("accno", $locale->text('GIFI missing!'));
837 AM->save_gifi(\%myconfig, \%$form);
838 $form->redirect($locale->text('GIFI saved!'));
840 $lxdebug->leave_sub();
844 $lxdebug->enter_sub();
846 $form->isblank("accno", $locale->text('GIFI missing!'));
848 AM->save_gifi(\%myconfig, \%$form);
851 $form->{gifi_accno} = $form->{accno};
852 $form->{title} = "Add";
853 $form->{charttype} = "A";
858 $lxdebug->leave_sub();
862 $lxdebug->enter_sub();
864 AM->delete_gifi(\%myconfig, \%$form);
865 $form->redirect($locale->text('GIFI deleted!'));
867 $lxdebug->leave_sub();
871 $lxdebug->enter_sub();
873 $form->{title} = "Add";
877 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
878 unless $form->{callback};
883 $lxdebug->leave_sub();
886 sub edit_department {
887 $lxdebug->enter_sub();
889 $form->{title} = "Edit";
891 AM->get_department(\%myconfig, \%$form);
896 $lxdebug->leave_sub();
899 sub list_department {
900 $lxdebug->enter_sub();
902 AM->departments(\%myconfig, \%$form);
905 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
907 $callback = $form->escape($form->{callback});
909 $form->{title} = $locale->text('Departments');
911 @column_index = qw(description cost profit);
913 $column_header{description} =
914 qq|<th class=listheading width=90%>|
915 . $locale->text('Description')
917 $column_header{cost} =
918 qq|<th class=listheading nowrap>|
919 . $locale->text('Cost Center')
921 $column_header{profit} =
922 qq|<th class=listheading nowrap>|
923 . $locale->text('Profit Center')
933 <th class=listtop>$form->{title}</th>
939 <tr class=listheading>
942 map { print "$column_header{$_}\n" } @column_index;
948 foreach $ref (@{ $form->{ALL} }) {
954 <tr valign=top class=listrow$i>
957 $costcenter = ($ref->{role} eq "C") ? "X" : "";
958 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
960 $column_data{description} =
961 qq|<td><a href=$form->{script}?action=edit_department&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
962 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
963 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
965 map { print "$column_data{$_}\n" } @column_index;
977 <td><hr size=3 noshade></td>
982 <form method=post action=$form->{script}>
984 <input name=callback type=hidden value="$form->{callback}">
986 <input type=hidden name=type value=department>
988 <input type=hidden name=path value=$form->{path}>
989 <input type=hidden name=login value=$form->{login}>
990 <input type=hidden name=password value=$form->{password}>
992 <input class=submit type=submit name=action value="|
993 . $locale->text('Add') . qq|">
1001 $lxdebug->leave_sub();
1004 sub department_header {
1005 $lxdebug->enter_sub();
1007 $form->{title} = $locale->text("$form->{title} Department");
1009 # $locale->text('Add Department')
1010 # $locale->text('Edit Department')
1012 $form->{description} =~ s/\"/"/g;
1014 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
1016 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
1019 qq|<input name=description size=60 value="$form->{description}">|;
1022 $costcenter = "checked" if $form->{role} eq "C";
1023 $profitcenter = "checked" if $form->{role} eq "P";
1030 <form method=post action=$form->{script}>
1032 <input type=hidden name=id value=$form->{id}>
1033 <input type=hidden name=type value=department>
1037 <th class=listtop colspan=2>$form->{title}</th>
1039 <tr height="5"></tr>
1041 <th align=right>| . $locale->text('Description') . qq|</th>
1042 <td>$description</td>
1046 <td><input type=radio style=radio name=role value="C" $costcenter> |
1047 . $locale->text('Cost Center') . qq|
1048 <input type=radio style=radio name=role value="P" $profitcenter> |
1049 . $locale->text('Profit Center') . qq|
1052 <td colspan=2><hr size=3 noshade></td>
1057 $lxdebug->leave_sub();
1060 sub save_department {
1061 $lxdebug->enter_sub();
1063 $form->isblank("description", $locale->text('Description missing!'));
1064 AM->save_department(\%myconfig, \%$form);
1065 $form->redirect($locale->text('Department saved!'));
1067 $lxdebug->leave_sub();
1070 sub delete_department {
1071 $lxdebug->enter_sub();
1073 AM->delete_department(\%myconfig, \%$form);
1074 $form->redirect($locale->text('Department deleted!'));
1076 $lxdebug->leave_sub();
1080 $lxdebug->enter_sub();
1082 $form->{title} = "Add";
1085 "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1086 unless $form->{callback};
1091 $lxdebug->leave_sub();
1095 $lxdebug->enter_sub();
1097 $form->{title} = "Edit";
1099 AM->get_lead(\%myconfig, \%$form);
1103 $form->{orphaned} = 1;
1106 $lxdebug->leave_sub();
1110 $lxdebug->enter_sub();
1112 AM->lead(\%myconfig, \%$form);
1115 "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1117 $callback = $form->escape($form->{callback});
1119 $form->{title} = $locale->text('Lead');
1121 @column_index = qw(description cost profit);
1123 $column_header{description} =
1124 qq|<th class=listheading width=100%>|
1125 . $locale->text('Description')
1135 <th class=listtop>$form->{title}</th>
1137 <tr height="5"></tr>
1138 <tr class=listheading>
1141 map { print "$column_header{$_}\n" } @column_index;
1147 foreach $ref (@{ $form->{ALL} }) {
1153 <tr valign=top class=listrow$i>
1156 $lead = $ref->{lead};
1158 $column_data{description} =
1159 qq|<td><a href=$form->{script}?action=edit_lead&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{lead}</td>|;
1161 map { print "$column_data{$_}\n" } @column_index;
1170 <td><hr size=3 noshade></td>
1175 <form method=post action=$form->{script}>
1177 <input name=callback type=hidden value="$form->{callback}">
1179 <input type=hidden name=type value=lead>
1181 <input type=hidden name=path value=$form->{path}>
1182 <input type=hidden name=login value=$form->{login}>
1183 <input type=hidden name=password value=$form->{password}>
1185 <input class=submit type=submit name=action value="|
1186 . $locale->text('Add') . qq|">
1194 $lxdebug->leave_sub();
1198 $lxdebug->enter_sub();
1200 $form->{title} = $locale->text("$form->{title} Lead");
1202 # $locale->text('Add Lead')
1203 # $locale->text('Edit Lead')
1205 $form->{description} =~ s/\"/"/g;
1208 qq|<input name=description size=50 value="$form->{lead}">|;
1215 <form method=post action=$form->{script}>
1217 <input type=hidden name=id value=$form->{id}>
1218 <input type=hidden name=type value=lead>
1222 <th class=listtop colspan=2>$form->{title}</th>
1224 <tr height="5"></tr>
1226 <th align=right>| . $locale->text('Description') . qq|</th>
1227 <td>$description</td>
1229 <td colspan=2><hr size=3 noshade></td>
1234 $lxdebug->leave_sub();
1238 $lxdebug->enter_sub();
1240 $form->isblank("description", $locale->text('Description missing!'));
1241 AM->save_lead(\%myconfig, \%$form);
1242 $form->redirect($locale->text('lead saved!'));
1244 $lxdebug->leave_sub();
1248 $lxdebug->enter_sub();
1250 AM->delete_lead(\%myconfig, \%$form);
1251 $form->redirect($locale->text('lead deleted!'));
1253 $lxdebug->leave_sub();
1257 $lxdebug->enter_sub();
1259 $form->{title} = "Add";
1262 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1263 unless $form->{callback};
1268 $lxdebug->leave_sub();
1272 $lxdebug->enter_sub();
1274 $form->{title} = "Edit";
1276 AM->get_business(\%myconfig, \%$form);
1280 $form->{orphaned} = 1;
1283 $lxdebug->leave_sub();
1287 $lxdebug->enter_sub();
1289 AM->business(\%myconfig, \%$form);
1292 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1294 $callback = $form->escape($form->{callback});
1296 $form->{title} = $locale->text('Type of Business');
1298 @column_index = qw(description discount customernumberinit);
1300 $column_header{description} =
1301 qq|<th class=listheading width=60%>|
1302 . $locale->text('Description')
1304 $column_header{discount} =
1305 qq|<th class=listheading width=10%>|
1306 . $locale->text('Discount')
1308 $column_header{customernumberinit} =
1309 qq|<th class=listheading>|
1310 . $locale->text('Customernumberinit')
1320 <th class=listtop>$form->{title}</th>
1322 <tr height="5"></tr>
1326 <tr class=listheading>
1329 map { print "$column_header{$_}\n" } @column_index;
1335 foreach $ref (@{ $form->{ALL} }) {
1341 <tr valign=top class=listrow$i>
1345 $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
1348 ? "<b>$ref->{description}</b>"
1349 : "$ref->{description}";
1350 $column_data{description} =
1351 qq|<td><a href=$form->{script}?action=edit_business&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$description</td>|;
1352 $column_data{discount} = qq|<td align=right>$discount</td>|;
1353 $column_data{customernumberinit} =
1354 qq|<td align=right>$ref->{customernumberinit}</td>|;
1356 map { print "$column_data{$_}\n" } @column_index;
1368 <td><hr size=3 noshade></td>
1373 <form method=post action=$form->{script}>
1375 <input name=callback type=hidden value="$form->{callback}">
1377 <input type=hidden name=type value=business>
1379 <input type=hidden name=path value=$form->{path}>
1380 <input type=hidden name=login value=$form->{login}>
1381 <input type=hidden name=password value=$form->{password}>
1383 <input class=submit type=submit name=action value="|
1384 . $locale->text('Add') . qq|">
1392 $lxdebug->leave_sub();
1395 sub business_header {
1396 $lxdebug->enter_sub();
1398 $form->{title} = $locale->text("$form->{title} Business");
1399 $form->{salesman} = "checked" if $form->{salesman};
1401 # $locale->text('Add Business')
1402 # $locale->text('Edit Business')
1404 $form->{description} =~ s/\"/"/g;
1406 $form->format_amount(\%myconfig, $form->{discount} * 100);
1413 <form method=post action=$form->{script}>
1415 <input type=hidden name=id value=$form->{id}>
1416 <input type=hidden name=type value=business>
1420 <th class=listtop colspan=2>$form->{title}</th>
1422 <tr height="5"></tr>
1424 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1425 <td><input name=description size=30 value="$form->{description}"></td>
1428 <th align=right>| . $locale->text('Discount') . qq| %</th>
1429 <td><input name=discount size=5 value=$form->{discount}></td>
1432 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1433 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1436 <td align=right>| . $locale->text('Salesman') . qq|</td>
1437 <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
1439 <td colspan=2><hr size=3 noshade></td>
1444 $lxdebug->leave_sub();
1448 $lxdebug->enter_sub();
1450 $form->isblank("description", $locale->text('Description missing!'));
1451 AM->save_business(\%myconfig, \%$form);
1452 $form->redirect($locale->text('Business saved!'));
1454 $lxdebug->leave_sub();
1457 sub delete_business {
1458 $lxdebug->enter_sub();
1460 AM->delete_business(\%myconfig, \%$form);
1461 $form->redirect($locale->text('Business deleted!'));
1463 $lxdebug->leave_sub();
1467 $lxdebug->enter_sub();
1469 $form->{title} = "Add";
1472 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1473 unless $form->{callback};
1478 $lxdebug->leave_sub();
1482 $lxdebug->enter_sub();
1484 $form->{title} = "Edit";
1486 AM->get_language(\%myconfig, \%$form);
1490 $form->{orphaned} = 1;
1493 $lxdebug->leave_sub();
1497 $lxdebug->enter_sub();
1499 AM->language(\%myconfig, \%$form);
1502 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1504 $callback = $form->escape($form->{callback});
1506 $form->{title} = $locale->text('Languages');
1508 @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
1510 $column_header{description} =
1511 qq|<th class=listheading width=60%>|
1512 . $locale->text('Description')
1514 $column_header{template_code} =
1515 qq|<th class=listheading width=10%>|
1516 . $locale->text('Template Code')
1518 $column_header{article_code} =
1519 qq|<th class=listheading>|
1520 . $locale->text('Article Code')
1522 $column_header{output_numberformat} =
1523 qq|<th class=listheading>|
1524 . $locale->text('Number Format')
1526 $column_header{output_dateformat} =
1527 qq|<th class=listheading>|
1528 . $locale->text('Date Format')
1530 $column_header{output_longdates} =
1531 qq|<th class=listheading>|
1532 . $locale->text('Long Dates')
1542 <th class=listtop>$form->{title}</th>
1544 <tr height="5"></tr>
1548 <tr class=listheading>
1551 map { print "$column_header{$_}\n" } @column_index;
1557 foreach $ref (@{ $form->{ALL} }) {
1563 <tr valign=top class=listrow$i>
1567 $column_data{description} =
1568 qq|<td><a href=$form->{script}?action=edit_language&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
1569 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1570 $column_data{article_code} =
1571 qq|<td align=right>$ref->{article_code}</td>|;
1572 $column_data{output_numberformat} =
1574 ($ref->{output_numberformat} ? $ref->{output_numberformat} :
1575 $locale->text("use program settings")) .
1577 $column_data{output_dateformat} =
1579 ($ref->{output_dateformat} ? $ref->{output_dateformat} :
1580 $locale->text("use program settings")) .
1582 $column_data{output_longdates} =
1584 ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
1587 map { print "$column_data{$_}\n" } @column_index;
1599 <td><hr size=3 noshade></td>
1604 <form method=post action=$form->{script}>
1606 <input name=callback type=hidden value="$form->{callback}">
1608 <input type=hidden name=type value=language>
1610 <input type=hidden name=path value=$form->{path}>
1611 <input type=hidden name=login value=$form->{login}>
1612 <input type=hidden name=password value=$form->{password}>
1614 <input class=submit type=submit name=action value="|
1615 . $locale->text('Add') . qq|">
1623 $lxdebug->leave_sub();
1626 sub language_header {
1627 $lxdebug->enter_sub();
1629 $form->{title} = $locale->text("$form->{title} Language");
1631 # $locale->text('Add Language')
1632 # $locale->text('Edit Language')
1634 $form->{description} =~ s/\"/"/g;
1635 $form->{template_code} =~ s/\"/"/g;
1636 $form->{article_code} =~ s/\"/"/g;
1642 qq|<option value="">| . $locale->text("use program settings") .
1644 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1646 ($item eq $form->{output_numberformat})
1647 ? "<option selected>$item"
1653 qq|<option value="">| . $locale->text("use program settings") .
1655 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1657 ($item eq $form->{output_dateformat})
1658 ? "<option selected>$item"
1666 <form method=post action=$form->{script}>
1668 <input type=hidden name=id value=$form->{id}>
1669 <input type=hidden name=type value=language>
1673 <th class=listtop colspan=2>$form->{title}</th>
1675 <tr height="5"></tr>
1677 <th align=right>| . $locale->text('Language') . qq|</th>
1678 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1681 <th align=right>| . $locale->text('Template Code') . qq|</th>
1682 <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
1685 <th align=right>| . $locale->text('Article Code') . qq|</th>
1686 <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
1689 <th align=right>| . $locale->text('Number Format') . qq|</th>
1690 <td><select name="output_numberformat">$numberformat</select></td>
1693 <th align=right>| . $locale->text('Date Format') . qq|</th>
1694 <td><select name="output_dateformat">$dateformat</select></td>
1697 <th align=right>| . $locale->text('Long Dates') . qq|</th>
1698 <td><input type="radio" name="output_longdates" value="1"| .
1699 ($form->{output_longdates} ? " checked" : "") .
1700 qq|>| . $locale->text("Yes") .
1701 qq|<input type="radio" name="output_longdates" value="0"| .
1702 ($form->{output_longdates} ? "" : " checked") .
1703 qq|>| . $locale->text("No") .
1706 <td colspan=2><hr size=3 noshade></td>
1711 $lxdebug->leave_sub();
1715 $lxdebug->enter_sub();
1717 $form->isblank("description", $locale->text('Language missing!'));
1718 $form->isblank("template_code", $locale->text('Template Code missing!'));
1719 $form->isblank("article_code", $locale->text('Article Code missing!'));
1720 AM->save_language(\%myconfig, \%$form);
1721 $form->redirect($locale->text('Language saved!'));
1723 $lxdebug->leave_sub();
1726 sub delete_language {
1727 $lxdebug->enter_sub();
1729 AM->delete_language(\%myconfig, \%$form);
1730 $form->redirect($locale->text('Language deleted!'));
1732 $lxdebug->leave_sub();
1736 sub add_buchungsgruppe {
1737 $lxdebug->enter_sub();
1739 # $locale->text("Add Buchungsgruppe")
1740 # $locale->text("Edit Buchungsgruppe")
1741 $form->{title} = "Add";
1744 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1745 unless $form->{callback};
1746 AM->get_buchungsgruppe(\%myconfig, \%$form);
1747 $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
1748 for (my $i = 0; 4 > $i; $i++) {
1749 map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; }
1750 qw(income expense));
1753 &buchungsgruppe_header;
1756 $lxdebug->leave_sub();
1759 sub edit_buchungsgruppe {
1760 $lxdebug->enter_sub();
1762 $form->{title} = "Edit";
1764 AM->get_buchungsgruppe(\%myconfig, \%$form);
1766 &buchungsgruppe_header;
1770 $lxdebug->leave_sub();
1773 sub list_buchungsgruppe {
1774 $lxdebug->enter_sub();
1776 AM->buchungsgruppe(\%myconfig, \%$form);
1779 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1781 $callback = $form->escape($form->{callback});
1783 $form->{title} = $locale->text('Buchungsgruppen');
1785 @column_index = qw(up down description inventory_accno
1786 income_accno_0 expense_accno_0
1787 income_accno_1 expense_accno_1
1788 income_accno_2 expense_accno_2
1789 income_accno_3 expense_accno_3 );
1791 $column_header{up} =
1792 qq|<th class="listheading">|
1793 . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
1795 $column_header{down} =
1796 qq|<th class="listheading">|
1797 . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
1799 $column_header{description} =
1800 qq|<th class="listheading" width="40%">|
1801 . $locale->text('Description')
1803 $column_header{inventory_accno} =
1804 qq|<th class=listheading>|
1805 . $locale->text('Bestandskonto')
1807 $column_header{income_accno_0} =
1808 qq|<th class=listheading>|
1809 . $locale->text('Erlöse Inland')
1811 $column_header{expense_accno_0} =
1812 qq|<th class=listheading>|
1813 . $locale->text('Aufwand Inland')
1815 $column_header{income_accno_1} =
1816 qq|<th class=listheading>|
1817 . $locale->text('Erlöse EU m. UStId')
1819 $column_header{expense_accno_1} =
1820 qq|<th class=listheading>|
1821 . $locale->text('Aufwand EU m. UStId')
1823 $column_header{income_accno_2} =
1824 qq|<th class=listheading>|
1825 . $locale->text('Erlöse EU o. UStId')
1827 $column_header{expense_accno_2} =
1828 qq|<th class=listheading>|
1829 . $locale->text('Aufwand EU o. UStId')
1831 $column_header{income_accno_3} =
1832 qq|<th class=listheading>|
1833 . $locale->text('Erlöse Ausland')
1835 $column_header{expense_accno_3} =
1836 qq|<th class=listheading>|
1837 . $locale->text('Aufwand Ausland')
1846 <th class=listtop>$form->{title}</th>
1848 <tr height="5"></tr>
1852 <tr class=listheading>
1855 map { print "$column_header{$_}\n" } @column_index;
1861 my $swap_link = qq|$form->{script}?action=swap_buchungsgruppen&|;
1862 map({ $swap_link .= $_ . "=" . $form->escape($form->{$_}) . "&" }
1863 qw(login password path));
1866 foreach $ref (@{ $form->{ALL} }) {
1872 <tr valign=top class=listrow$i>
1876 my $pref = $form->{ALL}->[$row - 1];
1878 qq|<td align="center" valign="center">| .
1879 qq|<a href="${swap_link}id1=$ref->{id}&id2=$pref->{id}">| .
1880 qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">| .
1883 $column_data{up} = qq|<td> </td>|;
1886 if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
1887 $column_data{down} = qq|<td> </td>|;
1889 my $nref = $form->{ALL}->[$row + 1];
1890 $column_data{down} =
1891 qq|<td align="center" valign="center">| .
1892 qq|<a href="${swap_link}id1=$ref->{id}&id2=$nref->{id}">| .
1893 qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">| .
1897 $column_data{description} =
1898 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>|;
1899 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1900 $column_data{income_accno_0} =
1901 qq|<td align=right>$ref->{income_accno_0}</td>|;
1902 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1903 $column_data{income_accno_1} =
1904 qq|<td align=right>$ref->{income_accno_1}</td>|;
1905 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1906 $column_data{income_accno_2} =
1907 qq|<td align=right>$ref->{income_accno_2}</td>|;
1908 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1909 $column_data{income_accno_3} =
1910 qq|<td align=right>$ref->{income_accno_3}</td>|;
1911 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1913 map { print "$column_data{$_}\n" } @column_index;
1927 <td><hr size=3 noshade></td>
1932 <form method=post action=$form->{script}>
1934 <input name=callback type=hidden value="$form->{callback}">
1936 <input type=hidden name=type value=buchungsgruppe>
1938 <input type=hidden name=path value=$form->{path}>
1939 <input type=hidden name=login value=$form->{login}>
1940 <input type=hidden name=password value=$form->{password}>
1942 <input class=submit type=submit name=action value="|
1943 . $locale->text('Add') . qq|">
1951 $lxdebug->leave_sub();
1954 sub buchungsgruppe_header {
1955 $lxdebug->enter_sub();
1957 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1959 # $locale->text('Buchungsgruppe hinzufügen')
1960 # $locale->text('Buchungsgruppe bearbeiten')
1962 my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
1963 my %acc_type_map = (
1964 "IC" => $acc_inventory,
1965 "IC_income" => $acc_income,
1966 "IC_sale" => $acc_income,
1967 "IC_expense" => $acc_expense,
1968 "IC_cogs" => $acc_expense,
1971 foreach $key (keys(%acc_type_map)) {
1972 foreach $ref (@{ $form->{IC_links}{$key} }) {
1973 $acc_type_map{$key}->{$ref->{"id"}} = $ref;
1977 foreach my $type (qw(IC IC_income IC_expense)) {
1978 $form->{"select$type"} =
1980 map({ "<option value=$_->{id} $_->{selected}>" .
1981 "$_->{accno}--" . H($_->{description}) . "</option>" }
1982 sort({ $a->{"accno"} cmp $b->{"accno"} }
1983 values(%{$acc_type_map{$type}}))));
1987 $form->{selectIC} =~ s/selected//g;
1988 $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/;
1989 $form->{selectIC_income} =~ s/selected//g;
1990 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1991 $form->{selectIC_expense} =~ s/selected//g;
1992 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1998 <th align=right>| . $locale->text('Inventory') . qq|</th>
1999 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
2000 <input name=selectIC type=hidden value="$form->{selectIC}">
2004 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
2008 $linkaccounts .= qq|
2010 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
2011 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
2014 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
2015 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
2018 $form->{selectIC_income} =~ s/selected//g;
2019 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
2020 $form->{selectIC_expense} =~ s/selected//g;
2021 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
2023 $linkaccounts .= qq| <tr>
2024 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
2025 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
2028 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
2029 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
2033 $form->{selectIC_income} =~ s/selected//g;
2034 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
2035 $form->{selectIC_expense} =~ s/selected//g;
2036 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
2039 $linkaccounts .= qq| <tr>
2040 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
2041 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
2044 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
2045 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
2049 $form->{selectIC_income} =~ s/selected//g;
2050 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
2051 $form->{selectIC_expense} =~ s/selected//g;
2052 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
2055 $linkaccounts .= qq| <tr>
2056 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
2057 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
2060 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
2061 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
2071 <form method=post action=$form->{script}>
2073 <input type=hidden name=id value=$form->{id}>
2074 <input type=hidden name=type value=buchungsgruppe>
2078 <th class=listtop colspan=2>$form->{title}</th>
2080 <tr height="5"></tr>
2082 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
2083 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
2086 <td colspan=2><hr size=3 noshade></td>
2091 $lxdebug->leave_sub();
2094 sub save_buchungsgruppe {
2095 $lxdebug->enter_sub();
2097 $form->isblank("description", $locale->text('Description missing!'));
2099 AM->save_buchungsgruppe(\%myconfig, \%$form);
2100 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
2102 $lxdebug->leave_sub();
2105 sub delete_buchungsgruppe {
2106 $lxdebug->enter_sub();
2108 AM->delete_buchungsgruppe(\%myconfig, \%$form);
2109 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
2111 $lxdebug->leave_sub();
2114 sub swap_buchungsgruppen {
2115 $lxdebug->enter_sub();
2117 AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen");
2118 list_buchungsgruppe();
2120 $lxdebug->leave_sub();
2125 $lxdebug->enter_sub();
2127 $form->{title} = "Add";
2130 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2131 unless $form->{callback};
2136 $lxdebug->leave_sub();
2140 $lxdebug->enter_sub();
2142 $form->{title} = "Edit";
2144 AM->get_printer(\%myconfig, \%$form);
2148 $form->{orphaned} = 1;
2151 $lxdebug->leave_sub();
2155 $lxdebug->enter_sub();
2157 AM->printer(\%myconfig, \%$form);
2160 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2162 $callback = $form->escape($form->{callback});
2164 $form->{title} = $locale->text('Printer');
2166 @column_index = qw(printer_description printer_command template_code);
2168 $column_header{printer_description} =
2169 qq|<th class=listheading width=60%>|
2170 . $locale->text('Printer Description')
2172 $column_header{printer_command} =
2173 qq|<th class=listheading width=10%>|
2174 . $locale->text('Printer Command')
2176 $column_header{template_code} =
2177 qq|<th class=listheading>|
2178 . $locale->text('Template Code')
2188 <th class=listtop>$form->{title}</th>
2190 <tr height="5"></tr>
2194 <tr class=listheading>
2197 map { print "$column_header{$_}\n" } @column_index;
2203 foreach $ref (@{ $form->{ALL} }) {
2209 <tr valign=top class=listrow$i>
2213 $column_data{printer_description} =
2214 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>|;
2215 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
2216 $column_data{template_code} =
2217 qq|<td align=right>$ref->{template_code}</td>|;
2219 map { print "$column_data{$_}\n" } @column_index;
2231 <td><hr size=3 noshade></td>
2236 <form method=post action=$form->{script}>
2238 <input name=callback type=hidden value="$form->{callback}">
2240 <input type=hidden name=type value=printer>
2242 <input type=hidden name=path value=$form->{path}>
2243 <input type=hidden name=login value=$form->{login}>
2244 <input type=hidden name=password value=$form->{password}>
2246 <input class=submit type=submit name=action value="|
2247 . $locale->text('Add') . qq|">
2255 $lxdebug->leave_sub();
2258 sub printer_header {
2259 $lxdebug->enter_sub();
2261 $form->{title} = $locale->text("$form->{title} Printer");
2263 # $locale->text('Add Printer')
2264 # $locale->text('Edit Printer')
2266 $form->{printer_description} =~ s/\"/"/g;
2267 $form->{template_code} =~ s/\"/"/g;
2268 $form->{printer_command} =~ s/\"/"/g;
2276 <form method=post action=$form->{script}>
2278 <input type=hidden name=id value=$form->{id}>
2279 <input type=hidden name=type value=printer>
2283 <th class=listtop colspan=2>$form->{title}</th>
2285 <tr height="5"></tr>
2287 <th align=right>| . $locale->text('Printer') . qq|</th>
2288 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2291 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2292 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2295 <th align=right>| . $locale->text('Template Code') . qq|</th>
2296 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2298 <td colspan=2><hr size=3 noshade></td>
2303 $lxdebug->leave_sub();
2307 $lxdebug->enter_sub();
2309 $form->isblank("printer_description", $locale->text('Description missing!'));
2310 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2311 AM->save_printer(\%myconfig, \%$form);
2312 $form->redirect($locale->text('Printer saved!'));
2314 $lxdebug->leave_sub();
2317 sub delete_printer {
2318 $lxdebug->enter_sub();
2320 AM->delete_printer(\%myconfig, \%$form);
2321 $form->redirect($locale->text('Printer deleted!'));
2323 $lxdebug->leave_sub();
2328 $lxdebug->enter_sub();
2330 $form->{title} = "Add";
2333 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2334 unless $form->{callback};
2336 $form->{terms_netto} = 0;
2337 $form->{terms_skonto} = 0;
2338 $form->{percent_skonto} = 0;
2342 $lxdebug->leave_sub();
2346 $lxdebug->enter_sub();
2348 $form->{title} = "Edit";
2350 AM->get_payment(\%myconfig, \%$form);
2354 $form->{orphaned} = 1;
2357 $lxdebug->leave_sub();
2361 $lxdebug->enter_sub();
2363 AM->payment(\%myconfig, \%$form);
2366 "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2368 $callback = $form->escape($form->{callback});
2370 $form->{title} = $locale->text('Payment Terms');
2372 @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
2374 $column_header{description} =
2375 qq|<th class=listheading>|
2376 . $locale->text('Description')
2378 $column_header{description_long} =
2379 qq|<th class=listheading>|
2380 . $locale->text('Long Description')
2382 $column_header{terms_netto} =
2383 qq|<th class=listheading>|
2384 . $locale->text('Netto Terms')
2386 $column_header{terms_skonto} =
2387 qq|<th class=listheading>|
2388 . $locale->text('Skonto Terms')
2390 $column_header{percent_skonto} =
2391 qq|<th class=listheading>|
2392 . $locale->text('Skonto')
2402 <th class=listtop>$form->{title}</th>
2404 <tr height="5"></tr>
2408 <tr class=listheading>
2411 map { print "$column_header{$_}\n" } @column_index;
2417 foreach $ref (@{ $form->{ALL} }) {
2423 <tr valign=top class=listrow$i>
2427 $column_data{description} =
2428 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>|;
2429 $column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|;
2430 $column_data{terms_netto} =
2431 qq|<td align=right>$ref->{terms_netto}</td>|;
2432 $column_data{terms_skonto} =
2433 qq|<td align=right>$ref->{terms_skonto}</td>|;
2434 $column_data{percent_skonto} =
2435 qq|<td align=right>$ref->{percent_skonto} %</td>|;
2436 map { print "$column_data{$_}\n" } @column_index;
2448 <td><hr size=3 noshade></td>
2453 <form method=post action=$form->{script}>
2455 <input name=callback type=hidden value="$form->{callback}">
2457 <input type=hidden name=type value=payment>
2459 <input type=hidden name=path value=$form->{path}>
2460 <input type=hidden name=login value=$form->{login}>
2461 <input type=hidden name=password value=$form->{password}>
2463 <input class=submit type=submit name=action value="|
2464 . $locale->text('Add') . qq|">
2472 $lxdebug->leave_sub();
2475 sub payment_header {
2476 $lxdebug->enter_sub();
2478 $form->{title} = $locale->text("$form->{title} Payment Terms");
2480 # $locale->text('Add Payment Terms')
2481 # $locale->text('Edit Payment Terms')
2483 $form->{description} =~ s/\"/"/g;
2492 <form method=post action=$form->{script}>
2494 <input type=hidden name=id value=$form->{id}>
2495 <input type=hidden name=type value=payment>
2499 <th class=listtop colspan=2>$form->{title}</th>
2501 <tr height="5"></tr>
2503 <th align=right>| . $locale->text('Description') . qq|</th>
2504 <td><input name=description size=30 value="$form->{description}"></td>
2507 <th align=right>| . $locale->text('Long Description') . qq|</th>
2508 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2511 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2512 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2515 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2516 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2519 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2520 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2522 <td colspan=2><hr size=3 noshade></td>
2527 $lxdebug->leave_sub();
2531 $lxdebug->enter_sub();
2533 $form->isblank("description", $locale->text('Language missing!'));
2534 AM->save_payment(\%myconfig, \%$form);
2535 $form->redirect($locale->text('Payment Terms saved!'));
2537 $lxdebug->leave_sub();
2540 sub delete_payment {
2541 $lxdebug->enter_sub();
2543 AM->delete_payment(\%myconfig, \%$form);
2544 $form->redirect($locale->text('Payment terms deleted!'));
2546 $lxdebug->leave_sub();
2550 $lxdebug->enter_sub();
2552 $form->{title} = "Add";
2555 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2556 unless $form->{callback};
2561 $lxdebug->leave_sub();
2565 $lxdebug->enter_sub();
2567 $form->{title} = "Edit";
2569 AM->get_sic(\%myconfig, \%$form);
2573 $form->{orphaned} = 1;
2576 $lxdebug->leave_sub();
2580 $lxdebug->enter_sub();
2582 AM->sic(\%myconfig, \%$form);
2585 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2587 $callback = $form->escape($form->{callback});
2589 $form->{title} = $locale->text('Standard Industrial Codes');
2591 @column_index = qw(code description);
2593 $column_header{code} =
2594 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
2595 $column_header{description} =
2596 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
2605 <th class=listtop>$form->{title}</th>
2607 <tr height="5"></tr>
2611 <tr class=listheading>
2614 map { print "$column_header{$_}\n" } @column_index;
2620 foreach $ref (@{ $form->{ALL} }) {
2625 if ($ref->{sictype} eq 'H') {
2627 <tr valign=top class=listheading>
2629 $column_data{code} =
2630 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>|;
2631 $column_data{description} = qq|<th>$ref->{description}</th>|;
2635 <tr valign=top class=listrow$i>
2638 $column_data{code} =
2639 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>|;
2640 $column_data{description} = qq|<td>$ref->{description}</td>|;
2644 map { print "$column_data{$_}\n" } @column_index;
2656 <td><hr size=3 noshade></td>
2661 <form method=post action=$form->{script}>
2663 <input name=callback type=hidden value="$form->{callback}">
2665 <input type=hidden name=type value=sic>
2667 <input type=hidden name=path value=$form->{path}>
2668 <input type=hidden name=login value=$form->{login}>
2669 <input type=hidden name=password value=$form->{password}>
2671 <input class=submit type=submit name=action value="|
2672 . $locale->text('Add') . qq|">
2680 $lxdebug->leave_sub();
2684 $lxdebug->enter_sub();
2686 $form->{title} = $locale->text("$form->{title} SIC");
2688 # $locale->text('Add SIC')
2689 # $locale->text('Edit SIC')
2691 $form->{code} =~ s/\"/"/g;
2692 $form->{description} =~ s/\"/"/g;
2694 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
2701 <form method=post action=$form->{script}>
2703 <input type=hidden name=type value=sic>
2704 <input type=hidden name=id value=$form->{code}>
2708 <th class=listtop colspan=2>$form->{title}</th>
2710 <tr height="5"></tr>
2712 <th align=right>| . $locale->text('Code') . qq|</th>
2713 <td><input name=code size=10 value=$form->{code}></td>
2717 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
2718 . $locale->text('Heading') . qq|</th>
2721 <th align=right>| . $locale->text('Description') . qq|</th>
2722 <td><input name=description size=60 value="$form->{description}"></td>
2724 <td colspan=2><hr size=3 noshade></td>
2729 $lxdebug->leave_sub();
2733 $lxdebug->enter_sub();
2735 $form->isblank("code", $locale->text('Code missing!'));
2736 $form->isblank("description", $locale->text('Description missing!'));
2737 AM->save_sic(\%myconfig, \%$form);
2738 $form->redirect($locale->text('SIC saved!'));
2740 $lxdebug->leave_sub();
2744 $lxdebug->enter_sub();
2746 AM->delete_sic(\%myconfig, \%$form);
2747 $form->redirect($locale->text('SIC deleted!'));
2749 $lxdebug->leave_sub();
2752 sub display_stylesheet {
2753 $lxdebug->enter_sub();
2755 $form->{file} = "css/$myconfig{stylesheet}";
2758 $lxdebug->leave_sub();
2762 $lxdebug->enter_sub();
2764 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2765 $form->{file} =~ s/^\/*//g;
2766 $form->{file} =~ s/$userspath//;
2768 $form->error("$!: $form->{file}") unless -f $form->{file};
2770 AM->load_template(\%$form);
2772 $form->{title} = $form->{file};
2774 # if it is anything but html
2775 if ($form->{file} !~ /\.html$/) {
2776 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2786 <form method=post action=$form->{script}>
2788 <input name=file type=hidden value=$form->{file}>
2789 <input name=type type=hidden value=template>
2791 <input type=hidden name=path value=$form->{path}>
2792 <input type=hidden name=login value=$form->{login}>
2793 <input type=hidden name=password value=$form->{password}>
2795 <input name=action type=submit class=submit value="|
2796 . $locale->text('Edit') . qq|">
2804 $lxdebug->leave_sub();
2808 $lxdebug->enter_sub();
2810 AM->load_template(\%$form);
2812 $form->{title} = $locale->text('Edit Template');
2814 # convert   to &nbsp;
2815 $form->{body} =~ s/ /&nbsp;/gi;
2822 <form method=post action=$form->{script}>
2824 <input name=file type=hidden value=$form->{file}>
2825 <input name=type type=hidden value=template>
2827 <input type=hidden name=path value=$form->{path}>
2828 <input type=hidden name=login value=$form->{login}>
2829 <input type=hidden name=password value=$form->{password}>
2831 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
2833 <textarea name=body rows=25 cols=70>
2838 <input type=submit class=submit name=action value="|
2839 . $locale->text('Save') . qq|">
2848 $lxdebug->leave_sub();
2852 $lxdebug->enter_sub();
2854 AM->save_template(\%$form);
2855 $form->redirect($locale->text('Template saved!'));
2857 $lxdebug->leave_sub();
2861 $lxdebug->enter_sub();
2863 # get defaults for account numbers and last numbers
2864 AM->defaultaccounts(\%myconfig, \%$form);
2866 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2868 ($item eq $myconfig{dateformat})
2869 ? "<option selected>$item\n"
2870 : "<option>$item\n";
2873 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2875 ($item eq $myconfig{numberformat})
2876 ? "<option selected>$item\n"
2877 : "<option>$item\n";
2880 foreach $item (qw(name company address signature)) {
2881 $myconfig{$item} =~ s/\"/"/g;
2884 foreach $item (qw(address signature)) {
2885 $myconfig{$item} =~ s/\\n/\r\n/g;
2889 if ($opendocument_templates && $openofficeorg_writer_bin &&
2890 $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
2891 push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
2892 "value" => "opendocument_pdf" });
2894 if ($latex_templates) {
2895 push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
2897 push(@formats, { "name" => "HTML", "value" => "html" });
2898 if ($latex_templates) {
2899 push(@formats, { "name" => $locale->text("Postscript"),
2900 "value" => "postscript" });
2902 if ($opendocument_templates) {
2903 push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
2904 "value" => "opendocument" });
2907 if (!$myconfig{"template_format"}) {
2908 $myconfig{"template_format"} = "pdf";
2910 my $template_format = "";
2911 foreach $item (@formats) {
2913 "<option value=\"$item->{value}\"" .
2914 ($item->{"value"} eq $myconfig{"template_format"} ?
2916 ">" . H($item->{"name"}) . "</option>";
2919 if (!$myconfig{"default_media"}) {
2920 $myconfig{"default_media"} = "screen";
2922 my %selected = ($myconfig{"default_media"} => "selected");
2923 my $default_media = qq|
2924 <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
2925 <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
2926 <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
2930 $selected{$myconfig{"default_printer_id"}} = "selected"
2931 if ($myconfig{"default_printer_id"});
2932 my $default_printer = qq|<option></option>|;
2933 AM->printer(\%myconfig, $form);
2934 foreach my $printer (@{$form->{"ALL"}}) {
2935 $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
2936 qq|" $selected{$printer->{'id'}}>| .
2937 H($printer->{"printer_description"}) . qq|</option>|;
2940 %countrycodes = User->country_codes;
2942 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2946 ($myconfig{countrycode} eq $key)
2947 ? "<option selected value=$key>$countrycodes{$key}\n"
2948 : "<option value=$key>$countrycodes{$key}\n";
2950 $countrycodes = "<option>American English\n$countrycodes";
2952 # use an other input number format than output numberformat
2953 # look at Form.pm, sub parse_amount
2954 my $in_numberformat = '';
2955 $text1 = qq|value="0">| . $locale->text('equal Outputformat');
2956 $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
2957 @in_nf = ($text1, $text2);
2958 foreach $item (@in_nf) {
2960 (substr($item, 7, 1) eq $myconfig{in_numberformat})
2961 ? "<option selected $item\n"
2962 : "<option $item\n";
2965 foreach $key (keys %{ $form->{IC} }) {
2966 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2968 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2969 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2970 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2974 opendir CSS, "css/.";
2975 @all = grep /.*\.css$/, readdir CSS;
2978 foreach $item (@all) {
2979 if ($item eq $myconfig{stylesheet}) {
2980 $selectstylesheet .= qq|<option selected>$item\n|;
2982 $selectstylesheet .= qq|<option>$item\n|;
2985 $selectstylesheet .= "<option>\n";
2987 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2991 if ($myconfig{menustyle} eq "old") {
2992 $menustyle_old = "checked";
2993 } elsif ($myconfig{menustyle} eq "neu") {
2994 $menustyle_neu = "checked";
2995 } elsif ($myconfig{menustyle} eq "v3") {
2996 $menustyle_v3 = "checked";
2999 my ($show_form_details, $hide_form_details);
3000 $myconfig{"show_form_details"} = 1
3001 unless (defined($myconfig{"show_form_details"}));
3002 $show_form_details = "checked" if ($myconfig{"show_form_details"});
3003 $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
3008 <form method=post action=$form->{script}>
3010 <input type=hidden name=old_password value=$myconfig{password}>
3011 <input type=hidden name=type value=preferences>
3012 <input type=hidden name=role value=$myconfig{role}>
3015 <tr><th class=listtop>$form->{title}</th></tr>
3020 <th align=right>| . $locale->text('Name') . qq|</th>
3021 <td><input name=name size=15 value="$myconfig{name}"></td>
3024 <th align=right>| . $locale->text('Password') . qq|</th>
3025 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
3028 <th align=right>| . $locale->text('E-mail') . qq|</th>
3029 <td><input name=email size=30 value="$myconfig{email}"></td>
3032 <th align=right>| . $locale->text('Signature') . qq|</th>
3033 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
3036 <th align=right>| . $locale->text('Phone') . qq|</th>
3037 <td><input name=tel size=14 value="$myconfig{tel}"></td>
3040 <th align=right>| . $locale->text('Fax') . qq|</th>
3041 <td><input name=fax size=14 value="$myconfig{fax}"></td>
3044 <th align=right>| . $locale->text('Company') . qq|</th>
3045 <td><input name=company size=30 value="$myconfig{company}"></td>
3048 <th align=right>| . $locale->text('Address') . qq|</th>
3049 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
3052 <th align=right>| . $locale->text('Date Format') . qq|</th>
3053 <td><select name=dateformat>$dateformat</select></td>
3056 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
3057 <td><select name=numberformat>$numberformat</select></td>
3060 <th align=right>| . $locale->text('Input Number Format') . qq|</th>
3061 <td><select name=in_numberformat>$in_numberformat</select></td>
3065 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
3066 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
3069 <th align=right>| . $locale->text('Language') . qq|</th>
3070 <td><select name=countrycode>$countrycodes</select></td>
3073 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
3074 <td><select name=usestylesheet>$selectstylesheet</select></td>
3077 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
3078 <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
3079 $locale->text("Top (CSS)") . qq|
3080 <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
3081 $locale->text("Top (Javascript)") . qq|
3082 <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
3083 $locale->text("Old (on the side)") . qq|</td>
3086 <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
3087 <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details>
3088 <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
3089 <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details>
3090 <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
3092 <input name=printer type=hidden value="$myconfig{printer}">
3093 <tr class=listheading>
3094 <th colspan=2>| . $locale->text("Print options") . qq|</th>
3097 <th align=right>| . $locale->text('Default template format') . qq|</th>
3098 <td><select name="template_format">$template_format</select></td>
3101 <th align=right>| . $locale->text('Default output medium') . qq|</th>
3102 <td><select name="default_media">$default_media</select></td>
3105 <th align=right>| . $locale->text('Default printer') . qq|</th>
3106 <td><select name="default_printer_id">$default_printer</select></td>
3109 <th align=right>| . $locale->text('Number of copies') . qq|</th>
3110 <td><input name="copies" size="10" value="| .
3111 $form->quote($myconfig{"copies"}) . qq|"></td>
3115 <tr class=listheading>
3116 <th colspan=2> </th>
3119 <th align=right>| . $locale->text('Business Number') . qq|</th>
3120 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
3123 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
3124 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
3126 <tr class=listheading>
3128 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
3134 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
3135 <td><select name=inventory_accno>$myconfig{IC}</select></td>
3138 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
3139 <td><select name=income_accno>$myconfig{IC_income}</select></td>
3142 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
3143 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
3146 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
3147 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
3150 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
3151 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
3156 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
3158 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
3167 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
3168 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
3169 <th align=right nowrap>|
3170 . $locale->text('Last Customer Number') . qq|</th>
3171 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
3174 <th align=right nowrap>|
3175 . $locale->text('Last Credit Note Number') . qq|</th>
3176 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
3177 <th align=right nowrap>|
3178 . $locale->text('Last Vendor Number') . qq|</th>
3179 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
3182 <th align=right nowrap>|
3183 . $locale->text('Last Sales Order Number') . qq|</th>
3184 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
3187 <th align=right nowrap>|
3188 . $locale->text('Last Purchase Order Number') . qq|</th>
3189 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
3190 <th align=right nowrap>|
3191 . $locale->text('Last Article Number') . qq|</th>
3192 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
3195 <th align=right nowrap>|
3196 . $locale->text('Last Sales Quotation Number') . qq|</th>
3197 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
3198 <th align=right nowrap>|
3199 . $locale->text('Last Service Number') . qq|</th>
3200 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
3203 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
3204 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
3205 <th align=right nowrap></th>
3211 # <tr class=listheading>
3212 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3219 # <th>| . $locale->text('Rate') . qq| (%)</th>
3220 # <th>| . $locale->text('Number') . qq|</th>
3224 # foreach $accno (sort keys %{ $form->{taxrates} }) {
3227 # <th align=right>$form->{taxrates}{$accno}{description}</th>
3228 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3229 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3232 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3235 # chop $form->{taxaccounts};
3238 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3247 <td><hr size=3 noshade></td>
3251 <input type=hidden name=path value=$form->{path}>
3252 <input type=hidden name=login value=$form->{login}>
3253 <input type=hidden name=password value=$form->{password}>
3256 <input type=submit class=submit name=action value="|
3257 . $locale->text('Save') . qq|">
3265 $lxdebug->leave_sub();
3268 sub save_preferences {
3269 $lxdebug->enter_sub();
3271 $form->{stylesheet} = $form->{usestylesheet};
3273 $form->redirect($locale->text('Preferences saved!'))
3275 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3277 $form->error($locale->text('Cannot save preferences!'));
3279 $lxdebug->leave_sub();
3283 $lxdebug->enter_sub();
3285 if ($form->{media} eq 'email') {
3286 $form->error($locale->text('No email address for') . " $myconfig{name}")
3287 unless ($myconfig{email});
3289 $form->{OUT} = "$sendmail";
3293 AM->backup(\%myconfig, \%$form, $userspath);
3295 if ($form->{media} eq 'email') {
3296 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
3299 $lxdebug->leave_sub();
3303 $lxdebug->enter_sub();
3305 $form->{title} = $locale->text('Audit Control');
3307 AM->closedto(\%myconfig, \%$form);
3309 if ($form->{revtrans}) {
3310 $checked{Y} = "checked";
3312 $checked{N} = "checked";
3320 <form method=post action=$form->{script}>
3322 <input type=hidden name=path value=$form->{path}>
3323 <input type=hidden name=login value=$form->{login}>
3324 <input type=hidden name=password value=$form->{password}>
3327 <tr><th class=listtop>$form->{title}</th></tr>
3328 <tr height="5"></tr>
3334 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3335 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3336 . $locale->text('Yes')
3337 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3338 . $locale->text('No')
3342 <th>| . $locale->text('Close Books up to') . qq|</th>
3343 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3353 <input type=hidden name=nextsub value=doclose>
3355 <input type=submit class=submit name=action value="|
3356 . $locale->text('Continue') . qq|">
3364 $lxdebug->leave_sub();
3368 $lxdebug->enter_sub();
3370 AM->closebooks(\%myconfig, \%$form);
3372 if ($form->{revtrans}) {
3374 $locale->text('Transaction reversal enforced for all dates'));
3376 if ($form->{closedto}) {
3378 $locale->text('Transaction reversal enforced up to') . " "
3379 . $locale->date(\%myconfig, $form->{closedto}, 1));
3381 $form->redirect($locale->text('Books are open'));
3385 $lxdebug->leave_sub();
3389 $lxdebug->enter_sub();
3391 $form->{title} = "Add";
3394 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
3395 unless $form->{callback};
3400 $lxdebug->leave_sub();
3403 sub edit_warehouse {
3404 $lxdebug->enter_sub();
3406 $form->{title} = "Edit";
3408 AM->get_warehouse(\%myconfig, \%$form);
3413 $lxdebug->leave_sub();
3416 sub list_warehouse {
3417 $lxdebug->enter_sub();
3419 AM->warehouses(\%myconfig, \%$form);
3422 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
3424 $callback = $form->escape($form->{callback});
3426 $form->{title} = $locale->text('Warehouses');
3428 @column_index = qw(description);
3430 $column_header{description} =
3431 qq|<th class=listheading width=100%>|
3432 . $locale->text('Description')
3442 <th class=listtop>$form->{title}</th>
3444 <tr height="5"></tr>
3448 <tr class=listheading>
3451 map { print "$column_header{$_}\n" } @column_index;
3457 foreach $ref (@{ $form->{ALL} }) {
3463 <tr valign=top class=listrow$i>
3466 $column_data{description} =
3467 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>|;
3469 map { print "$column_data{$_}\n" } @column_index;
3481 <td><hr size=3 noshade></td>
3486 <form method=post action=$form->{script}>
3488 <input name=callback type=hidden value="$form->{callback}">
3490 <input type=hidden name=type value=warehouse>
3492 <input type=hidden name=path value=$form->{path}>
3493 <input type=hidden name=login value=$form->{login}>
3494 <input type=hidden name=password value=$form->{password}>
3496 <input class=submit type=submit name=action value="|
3497 . $locale->text('Add') . qq|">
3505 $lxdebug->leave_sub();
3508 sub warehouse_header {
3509 $lxdebug->enter_sub();
3511 $form->{title} = $locale->text("$form->{title} Warehouse");
3513 # $locale->text('Add Warehouse')
3514 # $locale->text('Edit Warehouse')
3516 $form->{description} =~ s/\"/"/g;
3518 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
3520 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
3523 qq|<input name=description size=60 value="$form->{description}">|;
3531 <form method=post action=$form->{script}>
3533 <input type=hidden name=id value=$form->{id}>
3534 <input type=hidden name=type value=warehouse>
3538 <th class=listtop colspan=2>$form->{title}</th>
3540 <tr height="5"></tr>
3542 <th align=right>| . $locale->text('Description') . qq|</th>
3543 <td>$description</td>
3546 <td colspan=2><hr size=3 noshade></td>
3551 $lxdebug->leave_sub();
3554 sub save_warehouse {
3555 $lxdebug->enter_sub();
3557 $form->isblank("description", $locale->text('Description missing!'));
3558 AM->save_warehouse(\%myconfig, \%$form);
3559 $form->redirect($locale->text('Warehouse saved!'));
3561 $lxdebug->leave_sub();
3564 sub delete_warehouse {
3565 $lxdebug->enter_sub();
3567 AM->delete_warehouse(\%myconfig, \%$form);
3568 $form->redirect($locale->text('Warehouse deleted!'));
3570 $lxdebug->leave_sub();
3574 $lxdebug->enter_sub();
3576 &{ $form->{nextsub} };
3578 $lxdebug->leave_sub();
3582 $lxdebug->enter_sub();
3584 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3585 AM->units_in_use(\%myconfig, $form, $units);
3586 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3588 @languages = AM->language(\%myconfig, $form, 1);
3591 foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3592 map({ push(@unit_list, $units->{$_}); }
3593 sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3594 grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3597 foreach (@unit_list) {
3598 $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"});
3599 $_->{"UNITLANGUAGES"} = [];
3600 foreach my $lang (@languages) {
3601 push(@{ $_->{"UNITLANGUAGES"} },
3603 "unit" => $_->{"name"},
3604 "language_id" => $lang->{"id"},
3605 "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
3606 "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
3612 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3613 $ddbox = AM->unit_select_data($units, undef, 1);
3615 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3617 print($form->parse_html_template("am/edit_units",
3618 { "UNITS" => \@unit_list,
3619 "NEW_BASE_UNIT_DDBOX" => $ddbox,
3620 "LANGUAGES" => \@languages }));
3622 $lxdebug->leave_sub();
3626 $lxdebug->enter_sub();
3628 $form->isblank("new_name", $locale->text("The name is missing."));
3629 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3630 $all_units = AM->retrieve_units(\%myconfig, $form);
3631 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
3633 my ($base_unit, $factor);
3634 if ($form->{"new_base_unit"}) {
3635 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3637 $form->isblank("new_factor", $locale->text("The factor is missing."));
3638 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3639 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3640 $base_unit = $form->{"new_base_unit"};
3644 foreach my $lang (AM->language(\%myconfig, $form, 1)) {
3645 next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
3646 push(@languages, { "id" => $lang->{"id"},
3647 "localized" => $form->{"new_localized_$lang->{id}"},
3648 "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
3652 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
3654 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3658 $lxdebug->leave_sub();
3661 sub set_unit_languages {
3662 $lxdebug->enter_sub();
3664 my ($unit, $languages, $idx) = @_;
3666 $unit->{"LANGUAGES"} = [];
3668 foreach my $lang (@{$languages}) {
3669 push(@{ $unit->{"LANGUAGES"} },
3670 { "id" => $lang->{"id"},
3671 "localized" => $form->{"localized_${idx}_$lang->{id}"},
3672 "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
3676 $lxdebug->leave_sub();
3680 $lxdebug->enter_sub();
3682 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3683 AM->units_in_use(\%myconfig, $form, $old_units);
3685 @languages = AM->language(\%myconfig, $form, 1);
3689 foreach $i (1..($form->{"rowcount"} * 1)) {
3690 $old_unit = $old_units->{$form->{"old_name_$i"}};
3692 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3695 if ($form->{"unchangeable_$i"}) {
3696 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3697 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3698 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3702 if ($old_unit->{"in_use"}) {
3703 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3706 if ($form->{"delete_$i"}) {
3707 push(@delete_units, $old_unit->{"name"});
3711 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3713 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3714 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3715 $new_units->{$form->{"name_$i"}} = \%h;
3716 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3717 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3720 foreach $unit (values(%{$new_units})) {
3721 next unless ($unit->{"old_name"});
3722 if ($unit->{"base_unit"}) {
3723 $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"}))
3724 unless (defined($new_units->{$unit->{"base_unit"}}));
3725 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3726 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3728 $unit->{"base_unit"} = undef;
3729 $unit->{"factor"} = undef;
3733 foreach $unit (values(%{$new_units})) {
3734 next if ($unit->{"unchanged_unit"});
3736 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3738 while ($new_unit->{"base_unit"}) {
3739 $new_unit->{"seen"} = 1;
3740 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3741 if ($new_unit->{"seen"}) {
3742 $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, " .
3743 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3748 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3750 $form->{"saved_message"} = $locale->text("The units have been saved.");
3754 $lxdebug->leave_sub();