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);
2351 $form->{percent_skonto} =
2352 $form->format_amount(\%myconfig, $form->{percent_skonto} * 100);
2356 $form->{orphaned} = 1;
2359 $lxdebug->leave_sub();
2363 $lxdebug->enter_sub();
2365 AM->payment(\%myconfig, \%$form);
2367 $form->{callback} = build_std_url("action=list_payment");
2369 $callback = $form->escape($form->{callback});
2371 $form->{title} = $locale->text('Payment Terms');
2373 @column_index = qw(up down description description_long terms_netto
2374 terms_skonto percent_skonto);
2376 $column_header{up} =
2377 qq|<th class="listheading" align="center" valign="center">|
2378 . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
2380 $column_header{down} =
2381 qq|<th class="listheading" align="center" valign="center">|
2382 . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
2384 $column_header{description} =
2385 qq|<th class=listheading>|
2386 . $locale->text('Description')
2388 $column_header{description_long} =
2389 qq|<th class=listheading>|
2390 . $locale->text('Long Description')
2392 $column_header{terms_netto} =
2393 qq|<th class=listheading>|
2394 . $locale->text('Netto Terms')
2396 $column_header{terms_skonto} =
2397 qq|<th class=listheading>|
2398 . $locale->text('Skonto Terms')
2400 $column_header{percent_skonto} =
2401 qq|<th class=listheading>|
2402 . $locale->text('Skonto')
2412 <th class=listtop>$form->{title}</th>
2414 <tr height="5"></tr>
2418 <tr class=listheading>
2421 map { print "$column_header{$_}\n" } @column_index;
2427 my $swap_link = build_std_url("action=swap_payment_terms");
2430 foreach $ref (@{ $form->{ALL} }) {
2436 <tr valign=top class=listrow$i>
2440 my $pref = $form->{ALL}->[$row - 1];
2442 qq|<td align="center" valign="center">| .
2443 qq|<a href="${swap_link}&id1=$ref->{id}&id2=$pref->{id}">| .
2444 qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">| .
2447 $column_data{up} = qq|<td> </td>|;
2450 if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
2451 $column_data{down} = qq|<td> </td>|;
2453 my $nref = $form->{ALL}->[$row + 1];
2454 $column_data{down} =
2455 qq|<td align="center" valign="center">| .
2456 qq|<a href="${swap_link}&id1=$ref->{id}&id2=$nref->{id}">| .
2457 qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">| .
2461 $column_data{description} =
2463 build_std_url("action=edit_payment", "id=$ref->{id}", "callback=$callback") .
2464 qq|">| . H($ref->{description}) . qq|</a></td>|;
2465 $column_data{description_long} =
2466 qq|<td align=right>| . H($ref->{description_long}) . qq|</td>|;
2467 $column_data{terms_netto} =
2468 qq|<td align=right>$ref->{terms_netto}</td>|;
2469 $column_data{terms_skonto} =
2470 qq|<td align=right>$ref->{terms_skonto}</td>|;
2471 $column_data{percent_skonto} =
2472 qq|<td align=right>| .
2473 $form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) .
2475 map { print "$column_data{$_}\n" } @column_index;
2488 <td><hr size=3 noshade></td>
2493 <form method=post action=$form->{script}>
2495 <input name=callback type=hidden value="$form->{callback}">
2497 <input type=hidden name=type value=payment>
2499 <input type=hidden name=path value=$form->{path}>
2500 <input type=hidden name=login value=$form->{login}>
2501 <input type=hidden name=password value=$form->{password}>
2503 <input class=submit type=submit name=action value="|
2504 . $locale->text('Add') . qq|">
2512 $lxdebug->leave_sub();
2515 sub payment_header {
2516 $lxdebug->enter_sub();
2518 $form->{title} = $locale->text("$form->{title} Payment Terms");
2520 # $locale->text('Add Payment Terms')
2521 # $locale->text('Edit Payment Terms')
2523 $form->{description} =~ s/\"/"/g;
2532 <form method=post action=$form->{script}>
2534 <input type=hidden name=id value=$form->{id}>
2535 <input type=hidden name=type value=payment>
2539 <th class=listtop colspan=2>$form->{title}</th>
2541 <tr height="5"></tr>
2543 <th align=right>| . $locale->text('Description') . qq|</th>
2544 <td><input name=description size=30 value="$form->{description}"></td>
2547 <th align=right>| . $locale->text('Long Description') . qq|</th>
2548 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2551 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2552 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2555 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2556 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2559 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2560 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2562 <td colspan=2><hr size=3 noshade></td>
2567 $lxdebug->leave_sub();
2571 $lxdebug->enter_sub();
2573 $form->isblank("description", $locale->text('Description missing!'));
2574 $form->{"percent_skonto"} =
2575 $form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100;
2576 AM->save_payment(\%myconfig, \%$form);
2577 $form->redirect($locale->text('Payment Terms saved!'));
2579 $lxdebug->leave_sub();
2582 sub delete_payment {
2583 $lxdebug->enter_sub();
2585 AM->delete_payment(\%myconfig, \%$form);
2586 $form->redirect($locale->text('Payment terms deleted!'));
2588 $lxdebug->leave_sub();
2591 sub swap_payment_terms {
2592 $lxdebug->enter_sub();
2594 AM->swap_sortkeys(\%myconfig, $form, "payment_terms");
2597 $lxdebug->leave_sub();
2601 $lxdebug->enter_sub();
2603 $form->{title} = "Add";
2606 "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2607 unless $form->{callback};
2612 $lxdebug->leave_sub();
2616 $lxdebug->enter_sub();
2618 $form->{title} = "Edit";
2620 AM->get_sic(\%myconfig, \%$form);
2624 $form->{orphaned} = 1;
2627 $lxdebug->leave_sub();
2631 $lxdebug->enter_sub();
2633 AM->sic(\%myconfig, \%$form);
2636 "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
2638 $callback = $form->escape($form->{callback});
2640 $form->{title} = $locale->text('Standard Industrial Codes');
2642 @column_index = qw(code description);
2644 $column_header{code} =
2645 qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
2646 $column_header{description} =
2647 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
2656 <th class=listtop>$form->{title}</th>
2658 <tr height="5"></tr>
2662 <tr class=listheading>
2665 map { print "$column_header{$_}\n" } @column_index;
2671 foreach $ref (@{ $form->{ALL} }) {
2676 if ($ref->{sictype} eq 'H') {
2678 <tr valign=top class=listheading>
2680 $column_data{code} =
2681 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>|;
2682 $column_data{description} = qq|<th>$ref->{description}</th>|;
2686 <tr valign=top class=listrow$i>
2689 $column_data{code} =
2690 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>|;
2691 $column_data{description} = qq|<td>$ref->{description}</td>|;
2695 map { print "$column_data{$_}\n" } @column_index;
2707 <td><hr size=3 noshade></td>
2712 <form method=post action=$form->{script}>
2714 <input name=callback type=hidden value="$form->{callback}">
2716 <input type=hidden name=type value=sic>
2718 <input type=hidden name=path value=$form->{path}>
2719 <input type=hidden name=login value=$form->{login}>
2720 <input type=hidden name=password value=$form->{password}>
2722 <input class=submit type=submit name=action value="|
2723 . $locale->text('Add') . qq|">
2731 $lxdebug->leave_sub();
2735 $lxdebug->enter_sub();
2737 $form->{title} = $locale->text("$form->{title} SIC");
2739 # $locale->text('Add SIC')
2740 # $locale->text('Edit SIC')
2742 $form->{code} =~ s/\"/"/g;
2743 $form->{description} =~ s/\"/"/g;
2745 $checked = ($form->{sictype} eq 'H') ? "checked" : "";
2752 <form method=post action=$form->{script}>
2754 <input type=hidden name=type value=sic>
2755 <input type=hidden name=id value=$form->{code}>
2759 <th class=listtop colspan=2>$form->{title}</th>
2761 <tr height="5"></tr>
2763 <th align=right>| . $locale->text('Code') . qq|</th>
2764 <td><input name=code size=10 value=$form->{code}></td>
2768 <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
2769 . $locale->text('Heading') . qq|</th>
2772 <th align=right>| . $locale->text('Description') . qq|</th>
2773 <td><input name=description size=60 value="$form->{description}"></td>
2775 <td colspan=2><hr size=3 noshade></td>
2780 $lxdebug->leave_sub();
2784 $lxdebug->enter_sub();
2786 $form->isblank("code", $locale->text('Code missing!'));
2787 $form->isblank("description", $locale->text('Description missing!'));
2788 AM->save_sic(\%myconfig, \%$form);
2789 $form->redirect($locale->text('SIC saved!'));
2791 $lxdebug->leave_sub();
2795 $lxdebug->enter_sub();
2797 AM->delete_sic(\%myconfig, \%$form);
2798 $form->redirect($locale->text('SIC deleted!'));
2800 $lxdebug->leave_sub();
2803 sub display_stylesheet {
2804 $lxdebug->enter_sub();
2806 $form->{file} = "css/$myconfig{stylesheet}";
2809 $lxdebug->leave_sub();
2813 $lxdebug->enter_sub();
2815 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2816 $form->{file} =~ s/^\/*//g;
2817 $form->{file} =~ s/$userspath//;
2819 $form->error("$!: $form->{file}") unless -f $form->{file};
2821 AM->load_template(\%$form);
2823 $form->{title} = $form->{file};
2825 # if it is anything but html
2826 if ($form->{file} !~ /\.html$/) {
2827 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2837 <form method=post action=$form->{script}>
2839 <input name=file type=hidden value=$form->{file}>
2840 <input name=type type=hidden value=template>
2842 <input type=hidden name=path value=$form->{path}>
2843 <input type=hidden name=login value=$form->{login}>
2844 <input type=hidden name=password value=$form->{password}>
2846 <input name=action type=submit class=submit value="|
2847 . $locale->text('Edit') . qq|">
2855 $lxdebug->leave_sub();
2859 $lxdebug->enter_sub();
2861 AM->load_template(\%$form);
2863 $form->{title} = $locale->text('Edit Template');
2865 # convert   to &nbsp;
2866 $form->{body} =~ s/ /&nbsp;/gi;
2873 <form method=post action=$form->{script}>
2875 <input name=file type=hidden value=$form->{file}>
2876 <input name=type type=hidden value=template>
2878 <input type=hidden name=path value=$form->{path}>
2879 <input type=hidden name=login value=$form->{login}>
2880 <input type=hidden name=password value=$form->{password}>
2882 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
2884 <textarea name=body rows=25 cols=70>
2889 <input type=submit class=submit name=action value="|
2890 . $locale->text('Save') . qq|">
2899 $lxdebug->leave_sub();
2903 $lxdebug->enter_sub();
2905 AM->save_template(\%$form);
2906 $form->redirect($locale->text('Template saved!'));
2908 $lxdebug->leave_sub();
2912 $lxdebug->enter_sub();
2914 # get defaults for account numbers and last numbers
2915 AM->defaultaccounts(\%myconfig, \%$form);
2917 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2919 ($item eq $myconfig{dateformat})
2920 ? "<option selected>$item\n"
2921 : "<option>$item\n";
2924 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2926 ($item eq $myconfig{numberformat})
2927 ? "<option selected>$item\n"
2928 : "<option>$item\n";
2931 foreach $item (qw(name company address signature)) {
2932 $myconfig{$item} =~ s/\"/"/g;
2935 foreach $item (qw(address signature)) {
2936 $myconfig{$item} =~ s/\\n/\r\n/g;
2940 if ($opendocument_templates && $openofficeorg_writer_bin &&
2941 $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
2942 push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
2943 "value" => "opendocument_pdf" });
2945 if ($latex_templates) {
2946 push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
2948 push(@formats, { "name" => "HTML", "value" => "html" });
2949 if ($latex_templates) {
2950 push(@formats, { "name" => $locale->text("Postscript"),
2951 "value" => "postscript" });
2953 if ($opendocument_templates) {
2954 push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
2955 "value" => "opendocument" });
2958 if (!$myconfig{"template_format"}) {
2959 $myconfig{"template_format"} = "pdf";
2961 my $template_format = "";
2962 foreach $item (@formats) {
2964 "<option value=\"$item->{value}\"" .
2965 ($item->{"value"} eq $myconfig{"template_format"} ?
2967 ">" . H($item->{"name"}) . "</option>";
2970 if (!$myconfig{"default_media"}) {
2971 $myconfig{"default_media"} = "screen";
2973 my %selected = ($myconfig{"default_media"} => "selected");
2974 my $default_media = qq|
2975 <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
2976 <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
2977 <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
2981 $selected{$myconfig{"default_printer_id"}} = "selected"
2982 if ($myconfig{"default_printer_id"});
2983 my $default_printer = qq|<option></option>|;
2984 AM->printer(\%myconfig, $form);
2985 foreach my $printer (@{$form->{"ALL"}}) {
2986 $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
2987 qq|" $selected{$printer->{'id'}}>| .
2988 H($printer->{"printer_description"}) . qq|</option>|;
2991 %countrycodes = User->country_codes;
2993 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2997 ($myconfig{countrycode} eq $key)
2998 ? "<option selected value=$key>$countrycodes{$key}\n"
2999 : "<option value=$key>$countrycodes{$key}\n";
3001 $countrycodes = "<option>American English\n$countrycodes";
3003 # use an other input number format than output numberformat
3004 # look at Form.pm, sub parse_amount
3005 my $in_numberformat = '';
3006 $text1 = qq|value="0">| . $locale->text('equal Outputformat');
3007 $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
3008 @in_nf = ($text1, $text2);
3009 foreach $item (@in_nf) {
3011 (substr($item, 7, 1) eq $myconfig{in_numberformat})
3012 ? "<option selected $item\n"
3013 : "<option $item\n";
3016 foreach $key (keys %{ $form->{IC} }) {
3017 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
3019 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
3020 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
3021 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
3025 opendir CSS, "css/.";
3026 @all = grep /.*\.css$/, readdir CSS;
3029 foreach $item (@all) {
3030 if ($item eq $myconfig{stylesheet}) {
3031 $selectstylesheet .= qq|<option selected>$item\n|;
3033 $selectstylesheet .= qq|<option>$item\n|;
3036 $selectstylesheet .= "<option>\n";
3038 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
3042 if ($myconfig{menustyle} eq "old") {
3043 $menustyle_old = "checked";
3044 } elsif ($myconfig{menustyle} eq "neu") {
3045 $menustyle_neu = "checked";
3046 } elsif ($myconfig{menustyle} eq "v3") {
3047 $menustyle_v3 = "checked";
3050 my ($show_form_details, $hide_form_details);
3051 $myconfig{"show_form_details"} = 1
3052 unless (defined($myconfig{"show_form_details"}));
3053 $show_form_details = "checked" if ($myconfig{"show_form_details"});
3054 $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
3059 <form method=post action=$form->{script}>
3061 <input type=hidden name=old_password value=$myconfig{password}>
3062 <input type=hidden name=type value=preferences>
3063 <input type=hidden name=role value=$myconfig{role}>
3066 <tr><th class=listtop>$form->{title}</th></tr>
3071 <th align=right>| . $locale->text('Name') . qq|</th>
3072 <td><input name=name size=15 value="$myconfig{name}"></td>
3075 <th align=right>| . $locale->text('Password') . qq|</th>
3076 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
3079 <th align=right>| . $locale->text('E-mail') . qq|</th>
3080 <td><input name=email size=30 value="$myconfig{email}"></td>
3083 <th align=right>| . $locale->text('Signature') . qq|</th>
3084 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
3087 <th align=right>| . $locale->text('Phone') . qq|</th>
3088 <td><input name=tel size=14 value="$myconfig{tel}"></td>
3091 <th align=right>| . $locale->text('Fax') . qq|</th>
3092 <td><input name=fax size=14 value="$myconfig{fax}"></td>
3095 <th align=right>| . $locale->text('Company') . qq|</th>
3096 <td><input name=company size=30 value="$myconfig{company}"></td>
3099 <th align=right>| . $locale->text('Address') . qq|</th>
3100 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
3103 <th align=right>| . $locale->text('Date Format') . qq|</th>
3104 <td><select name=dateformat>$dateformat</select></td>
3107 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
3108 <td><select name=numberformat>$numberformat</select></td>
3111 <th align=right>| . $locale->text('Input Number Format') . qq|</th>
3112 <td><select name=in_numberformat>$in_numberformat</select></td>
3116 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
3117 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
3120 <th align=right>| . $locale->text('Language') . qq|</th>
3121 <td><select name=countrycode>$countrycodes</select></td>
3124 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
3125 <td><select name=usestylesheet>$selectstylesheet</select></td>
3128 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
3129 <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
3130 $locale->text("Top (CSS)") . qq|
3131 <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
3132 $locale->text("Top (Javascript)") . qq|
3133 <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
3134 $locale->text("Old (on the side)") . qq|</td>
3137 <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
3138 <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details>
3139 <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
3140 <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details>
3141 <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
3143 <input name=printer type=hidden value="$myconfig{printer}">
3144 <tr class=listheading>
3145 <th colspan=2>| . $locale->text("Print options") . qq|</th>
3148 <th align=right>| . $locale->text('Default template format') . qq|</th>
3149 <td><select name="template_format">$template_format</select></td>
3152 <th align=right>| . $locale->text('Default output medium') . qq|</th>
3153 <td><select name="default_media">$default_media</select></td>
3156 <th align=right>| . $locale->text('Default printer') . qq|</th>
3157 <td><select name="default_printer_id">$default_printer</select></td>
3160 <th align=right>| . $locale->text('Number of copies') . qq|</th>
3161 <td><input name="copies" size="10" value="| .
3162 $form->quote($myconfig{"copies"}) . qq|"></td>
3166 <tr class=listheading>
3167 <th colspan=2> </th>
3170 <th align=right>| . $locale->text('Business Number') . qq|</th>
3171 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
3174 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
3175 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
3177 <tr class=listheading>
3179 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
3185 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
3186 <td><select name=inventory_accno>$myconfig{IC}</select></td>
3189 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
3190 <td><select name=income_accno>$myconfig{IC_income}</select></td>
3193 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
3194 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
3197 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
3198 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
3201 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
3202 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
3207 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
3209 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
3218 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
3219 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
3220 <th align=right nowrap>|
3221 . $locale->text('Last Customer Number') . qq|</th>
3222 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
3225 <th align=right nowrap>|
3226 . $locale->text('Last Credit Note Number') . qq|</th>
3227 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
3228 <th align=right nowrap>|
3229 . $locale->text('Last Vendor Number') . qq|</th>
3230 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
3233 <th align=right nowrap>|
3234 . $locale->text('Last Sales Order Number') . qq|</th>
3235 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
3238 <th align=right nowrap>|
3239 . $locale->text('Last Purchase Order Number') . qq|</th>
3240 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
3241 <th align=right nowrap>|
3242 . $locale->text('Last Article Number') . qq|</th>
3243 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
3246 <th align=right nowrap>|
3247 . $locale->text('Last Sales Quotation Number') . qq|</th>
3248 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
3249 <th align=right nowrap>|
3250 . $locale->text('Last Service Number') . qq|</th>
3251 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
3254 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
3255 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
3256 <th align=right nowrap></th>
3262 # <tr class=listheading>
3263 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3270 # <th>| . $locale->text('Rate') . qq| (%)</th>
3271 # <th>| . $locale->text('Number') . qq|</th>
3275 # foreach $accno (sort keys %{ $form->{taxrates} }) {
3278 # <th align=right>$form->{taxrates}{$accno}{description}</th>
3279 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3280 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3283 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3286 # chop $form->{taxaccounts};
3289 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3298 <td><hr size=3 noshade></td>
3302 <input type=hidden name=path value=$form->{path}>
3303 <input type=hidden name=login value=$form->{login}>
3304 <input type=hidden name=password value=$form->{password}>
3307 <input type=submit class=submit name=action value="|
3308 . $locale->text('Save') . qq|">
3316 $lxdebug->leave_sub();
3319 sub save_preferences {
3320 $lxdebug->enter_sub();
3322 $form->{stylesheet} = $form->{usestylesheet};
3324 $form->redirect($locale->text('Preferences saved!'))
3326 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3328 $form->error($locale->text('Cannot save preferences!'));
3330 $lxdebug->leave_sub();
3334 $lxdebug->enter_sub();
3336 if ($form->{media} eq 'email') {
3337 $form->error($locale->text('No email address for') . " $myconfig{name}")
3338 unless ($myconfig{email});
3340 $form->{OUT} = "$sendmail";
3344 AM->backup(\%myconfig, \%$form, $userspath);
3346 if ($form->{media} eq 'email') {
3347 $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
3350 $lxdebug->leave_sub();
3354 $lxdebug->enter_sub();
3356 $form->{title} = $locale->text('Audit Control');
3358 AM->closedto(\%myconfig, \%$form);
3360 if ($form->{revtrans}) {
3361 $checked{Y} = "checked";
3363 $checked{N} = "checked";
3371 <form method=post action=$form->{script}>
3373 <input type=hidden name=path value=$form->{path}>
3374 <input type=hidden name=login value=$form->{login}>
3375 <input type=hidden name=password value=$form->{password}>
3378 <tr><th class=listtop>$form->{title}</th></tr>
3379 <tr height="5"></tr>
3385 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3386 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3387 . $locale->text('Yes')
3388 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3389 . $locale->text('No')
3393 <th>| . $locale->text('Close Books up to') . qq|</th>
3394 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3404 <input type=hidden name=nextsub value=doclose>
3406 <input type=submit class=submit name=action value="|
3407 . $locale->text('Continue') . qq|">
3415 $lxdebug->leave_sub();
3419 $lxdebug->enter_sub();
3421 AM->closebooks(\%myconfig, \%$form);
3423 if ($form->{revtrans}) {
3425 $locale->text('Transaction reversal enforced for all dates'));
3427 if ($form->{closedto}) {
3429 $locale->text('Transaction reversal enforced up to') . " "
3430 . $locale->date(\%myconfig, $form->{closedto}, 1));
3432 $form->redirect($locale->text('Books are open'));
3436 $lxdebug->leave_sub();
3440 $lxdebug->enter_sub();
3442 $form->{title} = "Add";
3445 "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
3446 unless $form->{callback};
3451 $lxdebug->leave_sub();
3454 sub edit_warehouse {
3455 $lxdebug->enter_sub();
3457 $form->{title} = "Edit";
3459 AM->get_warehouse(\%myconfig, \%$form);
3464 $lxdebug->leave_sub();
3467 sub list_warehouse {
3468 $lxdebug->enter_sub();
3470 AM->warehouses(\%myconfig, \%$form);
3473 "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
3475 $callback = $form->escape($form->{callback});
3477 $form->{title} = $locale->text('Warehouses');
3479 @column_index = qw(description);
3481 $column_header{description} =
3482 qq|<th class=listheading width=100%>|
3483 . $locale->text('Description')
3493 <th class=listtop>$form->{title}</th>
3495 <tr height="5"></tr>
3499 <tr class=listheading>
3502 map { print "$column_header{$_}\n" } @column_index;
3508 foreach $ref (@{ $form->{ALL} }) {
3514 <tr valign=top class=listrow$i>
3517 $column_data{description} =
3518 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>|;
3520 map { print "$column_data{$_}\n" } @column_index;
3532 <td><hr size=3 noshade></td>
3537 <form method=post action=$form->{script}>
3539 <input name=callback type=hidden value="$form->{callback}">
3541 <input type=hidden name=type value=warehouse>
3543 <input type=hidden name=path value=$form->{path}>
3544 <input type=hidden name=login value=$form->{login}>
3545 <input type=hidden name=password value=$form->{password}>
3547 <input class=submit type=submit name=action value="|
3548 . $locale->text('Add') . qq|">
3556 $lxdebug->leave_sub();
3559 sub warehouse_header {
3560 $lxdebug->enter_sub();
3562 $form->{title} = $locale->text("$form->{title} Warehouse");
3564 # $locale->text('Add Warehouse')
3565 # $locale->text('Edit Warehouse')
3567 $form->{description} =~ s/\"/"/g;
3569 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
3571 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
3574 qq|<input name=description size=60 value="$form->{description}">|;
3582 <form method=post action=$form->{script}>
3584 <input type=hidden name=id value=$form->{id}>
3585 <input type=hidden name=type value=warehouse>
3589 <th class=listtop colspan=2>$form->{title}</th>
3591 <tr height="5"></tr>
3593 <th align=right>| . $locale->text('Description') . qq|</th>
3594 <td>$description</td>
3597 <td colspan=2><hr size=3 noshade></td>
3602 $lxdebug->leave_sub();
3605 sub save_warehouse {
3606 $lxdebug->enter_sub();
3608 $form->isblank("description", $locale->text('Description missing!'));
3609 AM->save_warehouse(\%myconfig, \%$form);
3610 $form->redirect($locale->text('Warehouse saved!'));
3612 $lxdebug->leave_sub();
3615 sub delete_warehouse {
3616 $lxdebug->enter_sub();
3618 AM->delete_warehouse(\%myconfig, \%$form);
3619 $form->redirect($locale->text('Warehouse deleted!'));
3621 $lxdebug->leave_sub();
3625 $lxdebug->enter_sub();
3627 &{ $form->{nextsub} };
3629 $lxdebug->leave_sub();
3633 $lxdebug->enter_sub();
3635 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3636 AM->units_in_use(\%myconfig, $form, $units);
3637 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3639 @languages = AM->language(\%myconfig, $form, 1);
3642 foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3643 map({ push(@unit_list, $units->{$_}); }
3644 sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3645 grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3648 foreach (@unit_list) {
3649 $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"});
3650 $_->{"UNITLANGUAGES"} = [];
3651 foreach my $lang (@languages) {
3652 push(@{ $_->{"UNITLANGUAGES"} },
3654 "unit" => $_->{"name"},
3655 "language_id" => $lang->{"id"},
3656 "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
3657 "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
3663 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3664 $ddbox = AM->unit_select_data($units, undef, 1);
3666 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3668 print($form->parse_html_template("am/edit_units",
3669 { "UNITS" => \@unit_list,
3670 "NEW_BASE_UNIT_DDBOX" => $ddbox,
3671 "LANGUAGES" => \@languages }));
3673 $lxdebug->leave_sub();
3677 $lxdebug->enter_sub();
3679 $form->isblank("new_name", $locale->text("The name is missing."));
3680 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3681 $all_units = AM->retrieve_units(\%myconfig, $form);
3682 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
3684 my ($base_unit, $factor);
3685 if ($form->{"new_base_unit"}) {
3686 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3688 $form->isblank("new_factor", $locale->text("The factor is missing."));
3689 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3690 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3691 $base_unit = $form->{"new_base_unit"};
3695 foreach my $lang (AM->language(\%myconfig, $form, 1)) {
3696 next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
3697 push(@languages, { "id" => $lang->{"id"},
3698 "localized" => $form->{"new_localized_$lang->{id}"},
3699 "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
3703 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
3705 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3709 $lxdebug->leave_sub();
3712 sub set_unit_languages {
3713 $lxdebug->enter_sub();
3715 my ($unit, $languages, $idx) = @_;
3717 $unit->{"LANGUAGES"} = [];
3719 foreach my $lang (@{$languages}) {
3720 push(@{ $unit->{"LANGUAGES"} },
3721 { "id" => $lang->{"id"},
3722 "localized" => $form->{"localized_${idx}_$lang->{id}"},
3723 "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
3727 $lxdebug->leave_sub();
3731 $lxdebug->enter_sub();
3733 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3734 AM->units_in_use(\%myconfig, $form, $old_units);
3736 @languages = AM->language(\%myconfig, $form, 1);
3740 foreach $i (1..($form->{"rowcount"} * 1)) {
3741 $old_unit = $old_units->{$form->{"old_name_$i"}};
3743 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3746 if ($form->{"unchangeable_$i"}) {
3747 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3748 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3749 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3753 if ($old_unit->{"in_use"}) {
3754 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3757 if ($form->{"delete_$i"}) {
3758 push(@delete_units, $old_unit->{"name"});
3762 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3764 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3765 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3766 $new_units->{$form->{"name_$i"}} = \%h;
3767 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3768 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3771 foreach $unit (values(%{$new_units})) {
3772 next unless ($unit->{"old_name"});
3773 if ($unit->{"base_unit"}) {
3774 $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"}))
3775 unless (defined($new_units->{$unit->{"base_unit"}}));
3776 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3777 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3779 $unit->{"base_unit"} = undef;
3780 $unit->{"factor"} = undef;
3784 foreach $unit (values(%{$new_units})) {
3785 next if ($unit->{"unchanged_unit"});
3787 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3789 while ($new_unit->{"base_unit"}) {
3790 $new_unit->{"seen"} = 1;
3791 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3792 if ($new_unit->{"seen"}) {
3793 $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, " .
3794 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3799 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3801 $form->{"saved_message"} = $locale->text("The units have been saved.");
3805 $lxdebug->leave_sub();