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 #======================================================================
45 require "$form->{path}/common.pl";
49 sub add { &{"add_$form->{type}"} }
50 sub edit { &{"edit_$form->{type}"} }
51 sub save { &{"save_$form->{type}"} }
52 sub delete { &{"delete_$form->{type}"} }
55 $lxdebug->enter_sub();
57 $form->{title} = "Add";
58 $form->{charttype} = "A";
59 AM->get_account(\%myconfig, \%$form);
62 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
63 unless $form->{callback};
68 $lxdebug->leave_sub();
72 $lxdebug->enter_sub();
74 $form->{title} = "Edit";
75 AM->get_account(\%myconfig, \%$form);
77 foreach my $item (split(/:/, $form->{link})) {
78 $form->{$item} = "checked";
84 $lxdebug->leave_sub();
88 $lxdebug->enter_sub();
90 $form->{title} = $locale->text("$form->{title} Account");
92 $checked{ $form->{charttype} } = "checked";
93 $checked{"$form->{category}_"} = "checked";
94 $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
96 $form->{description} =~ s/\"/"/g;
98 if (@{ $form->{TAXKEY} }) {
99 foreach my $item (@{ $form->{TAXKEY} }) {
101 $item->{rate} = $item->{rate} * 100 . '%';
103 if ($item->{tax} == $form->{tax}) {
104 $form->{selecttaxkey} .=
105 "<option value=$item->{tax} selected>$item->{taxdescription} ($item->{rate})\n";
107 $form->{selecttaxkey} .=
108 "<option value=$item->{tax}>$item->{taxdescription} ($item->{rate})\n";
116 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
117 <td><select name=tax>$form->{selecttaxkey}</select></td>
118 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
119 <td><input name=startdate value="$form->{startdate}"></td>
122 if (@{ $form->{NEWACCOUNT} }) {
123 if (!$form->{new_chart_valid}) {
124 $form->{selectnewaccount} = "<option value=></option>";
126 foreach $item (@{ $form->{NEWACCOUNT} }) {
127 if ($item->{id} == $form->{new_chart_id}) {
128 $form->{selectnewaccount} .=
129 "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
130 } elsif (!$form->{new_chart_valid}) {
131 $form->{selectnewaccount} .=
132 "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
143 <th align=right>| . $locale->text('Folgekonto') . qq|</th>
144 <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
145 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
146 <td><input name=valid_from value="$form->{valid_from}"></td>
152 $form->{selectustva} = "<option>\n";
154 %ustva = (35 => $locale->text('UStVA-Nr. 35'),
155 36 => $locale->text('UStVA-Nr. 36'),
156 39 => $locale->text('UStVA-Nr. 39'),
157 41 => $locale->text('UStVA-Nr. 41'),
158 42 => $locale->text('UStVA-Nr. 42'),
159 43 => $locale->text('UStVA-Nr. 43'),
160 44 => $locale->text('UStVA-Nr. 44'),
161 45 => $locale->text('UStVA-Nr. 45'),
162 48 => $locale->text('UStVA-Nr. 48'),
163 49 => $locale->text('UStVA-Nr. 49'),
164 51 => $locale->text('UStVA-Nr. 51 left'),
165 511 => $locale->text('UStVA-Nr. 51 right'),
166 52 => $locale->text('UStVA-Nr. 52'),
167 53 => $locale->text('UStVA-Nr. 53'),
168 59 => $locale->text('UStVA-Nr. 59'),
169 60 => $locale->text('UStVA-Nr. 60'),
170 61 => $locale->text('UStVA-Nr. 61'),
171 62 => $locale->text('UStVA-Nr. 62'),
172 63 => $locale->text('UStVA-Nr. 63'),
173 64 => $locale->text('UStVA-Nr. 64'),
174 65 => $locale->text('UStVA-Nr. 65'),
175 66 => $locale->text('UStVA-Nr. 66'),
176 67 => $locale->text('UStVA-Nr. 67'),
177 69 => $locale->text('UStVA-Nr. 69'),
178 73 => $locale->text('UStVA-Nr. 73'),
179 74 => $locale->text('UStVA-Nr. 74'),
180 76 => $locale->text('UStVA-Nr. 76'),
181 77 => $locale->text('UStVA-Nr. 77'),
182 80 => $locale->text('UStVA-Nr. 80'),
183 81 => $locale->text('UStVA-Nr. 81 left'),
184 811 => $locale->text('UStVA-Nr. 81 right'),
185 84 => $locale->text('UStVA-Nr. 84'),
186 85 => $locale->text('UStVA-Nr. 85'),
187 86 => $locale->text('UStVA-Nr. 86 left'),
188 861 => $locale->text('UStVA-Nr. 86 right'),
189 89 => $locale->text('UStVA-Nr. 89 left'),
190 891 => $locale->text('UStVA-Nr. 89 right'),
191 91 => $locale->text('UStVA-Nr. 91'),
192 93 => $locale->text('UStVA-Nr. 93 left'),
193 931 => $locale->text('UStVA-Nr. 93 right'),
194 94 => $locale->text('UStVA-Nr. 94'),
195 95 => $locale->text('UStVA-Nr. 95'),
196 96 => $locale->text('UStVA-Nr. 96'),
197 97 => $locale->text('UStVA-Nr. 97 links'),
198 971 => $locale->text('UStVA-Nr. 97 rechts'),
199 98 => $locale->text('UStVA-Nr. 98'));
201 foreach $item (sort({ $a cmp $b } keys %ustva)) {
202 if ($item == $form->{pos_ustva}) {
203 $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
205 $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
212 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
213 <td><select name=pos_ustva>$form->{selectustva}</select></td>
214 <input type=hidden name=selectustva value="$form->{selectustva}">
217 $form->{selecteur} = "<option>\n";
218 %eur = (1 => "Umsatzerlöse",
219 2 => "sonstige Erlöse",
220 3 => "Privatanteile",
222 5 => "Ausserordentliche Erträge",
223 6 => "Vereinnahmte Umsatzst.",
224 7 => "Umsatzsteuererstattungen",
225 8 => "Wareneingänge",
226 9 => "Löhne und Gehälter",
227 10 => "Gesetzl. sozialer Aufw.",
229 12 => "Gas, Strom, Wasser",
230 13 => "Instandhaltung",
231 14 => "Steuern, Versich., Beiträge",
233 16 => "Kfz-Versicherungen",
234 17 => "Sonst. Fahrtkosten",
235 18 => "Werbe- und Reisekosten",
236 19 => "Instandhaltung u. Werkzeuge",
237 20 => "Fachzeitschriften, Bücher",
238 21 => "Miete für Einrichtungen",
239 22 => "Rechts- und Beratungskosten",
240 23 => "Bürobedarf, Porto, Telefon",
241 24 => "Sonstige Aufwendungen",
242 25 => "Abschreibungen auf Anlagever.",
243 26 => "Abschreibungen auf GWG",
245 28 => "Umsatzsteuerzahlungen",
247 30 => "Ausserordentlicher Aufwand",
248 31 => "Betriebliche Steuern");
249 foreach $item (sort({ $a <=> $b } keys(%eur))) {
250 if ($item == $form->{pos_eur}) {
251 $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
253 $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
260 <th align=right>| . $locale->text('EUER') . qq|</th>
261 <td><select name=pos_eur>$form->{selecteur}</select></td>
262 <input type=hidden name=selecteur value="$form->{selecteur}">
265 $form->{selectbwa} = "<option>\n";
267 %bwapos = (1 => 'Umsatzerlöse',
268 2 => 'Best.Verdg.FE/UE',
269 3 => 'Aktiv.Eigenleistung',
270 4 => 'Mat./Wareneinkauf',
271 5 => 'So.betr.Erlöse',
272 10 => 'Personalkosten',
274 12 => 'Betriebl.Steuern',
275 13 => 'Vers./Beiträge',
276 14 => 'Kfz.Kosten o.St.',
277 15 => 'Werbe-Reisek.',
278 16 => 'Kosten Warenabgabe',
279 17 => 'Abschreibungen',
280 18 => 'Rep./instandhlt.',
281 19 => 'Übrige Steuern',
282 20 => 'Sonst.Kosten',
284 31 => 'Sonst.neutr.Aufw.',
286 33 => 'Sonst.neutr.Ertrag',
287 34 => 'Verr.kalk.Kosten',
288 35 => 'Steuern Eink.u.Ertr.');
289 foreach $item (sort({ $a <=> $b } keys %bwapos)) {
290 if ($item == $form->{pos_bwa}) {
291 $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
293 $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
300 <th align=right>| . $locale->text('BWA') . qq|</th>
301 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
302 <input type=hidden name=selectbwa value="$form->{selectbwa}">
305 # Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
306 # $form->{selectbilanz} = "<option>\n";
307 # foreach $item ((1, 2, 3, 4)) {
308 # if ($item == $form->{pos_bilanz}) {
309 # $form->{selectbilanz} .= "<option value=$item selected>$item\n";
311 # $form->{selectbilanz} .= "<option value=$item>$item\n";
318 # <th align=right>| . $locale->text('Bilanz') . qq|</th>
319 # <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
320 # <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
323 # this is for our parser only!
324 # type=submit $locale->text('Add Account')
325 # type=submit $locale->text('Edit Account')
326 $form->{type} = "account";
333 <form method=post action=$form->{script}>
335 <input type=hidden name=id value=$form->{id}>
336 <input type=hidden name=type value=account>
337 <input type=hidden name=orphaned value=$form->{orphaned}>
338 <input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
340 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
341 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
342 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
343 <input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
344 <input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
346 <table border=0 width=100%>
348 <th class=listtop>$form->{title}</th>
355 <th align=right>| . $locale->text('Account Number') . qq|</th>
356 <td><input name=accno size=20 value=$form->{accno}></td>
359 <th align=right>| . $locale->text('Description') . qq|</th>
360 <td><input name=description size=40 value="$form->{description}"></td>
363 <th align=right>| . $locale->text('Account Type') . qq|</th>
367 <td><input name=category type=radio class=radio value=A $checked{A_}> |
368 . $locale->text('Asset') . qq|\n<br>
369 <input name=category type=radio class=radio value=L $checked{L_}> |
370 . $locale->text('Liability') . qq|\n<br>
371 <input name=category type=radio class=radio value=Q $checked{Q_}> |
372 . $locale->text('Equity') . qq|\n<br>
373 <input name=category type=radio class=radio value=I $checked{I_}> |
374 . $locale->text('Revenue') . qq|\n<br>
375 <input name=category type=radio class=radio value=E $checked{E_}> |
376 . $locale->text('Expense') . qq|<br>
377 <input name=category type=radio class=radio value=C $checked{C_}> |
378 . $locale->text('Costs') . qq|</td>
379 <td width=50> </td>
381 <input name=charttype type=radio class=radio value="H" $checked{H}> |
382 . $locale->text('Heading') . qq|<br>
383 <input name=charttype type=radio class=radio value="A" $checked{A}> |
384 . $locale->text('Account') . qq|</td>
391 if ($form->{charttype} eq "A") {
398 . $locale->text('Is this a summary account to record') . qq|</th>
400 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
401 . $locale->text('AR')
402 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
403 . $locale->text('AP')
404 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
405 . $locale->text('Inventory')
412 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
418 <th align=left>| . $locale->text('Receivables') . qq|</th>
419 <th align=left>| . $locale->text('Payables') . qq|</th>
420 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
421 <th align=left>| . $locale->text('Service Items') . qq|</th>
425 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
426 . $locale->text('Revenue') . qq|\n<br>
427 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
428 . $locale->text('Receipt') . qq|\n<br>
429 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
430 . $locale->text('Tax') . qq|
433 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
434 . $locale->text('Expense/Asset') . qq|\n<br>
435 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
436 . $locale->text('Payment') . qq|\n<br>
437 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
438 . $locale->text('Tax') . qq|
441 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
442 . $locale->text('Revenue') . qq|\n<br>
443 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
444 . $locale->text('Expense') . qq|\n<br>
445 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
446 . $locale->text('Tax') . qq|
449 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
450 . $locale->text('Revenue') . qq|\n<br>
451 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
452 . $locale->text('Expense') . qq|\n<br>
453 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
454 . $locale->text('Tax') . qq|
474 <td><hr size=3 noshade></td>
479 $lxdebug->leave_sub();
483 $lxdebug->enter_sub();
487 <input name=callback type=hidden value="$form->{callback}">
489 <input type=hidden name=path value=$form->{path}>
490 <input type=hidden name=login value=$form->{login}>
491 <input type=hidden name=password value=$form->{password}>
494 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
496 <input type=submit class=submit name=action value="|
497 . $locale->text('Save') . qq|">
501 if ($form->{id} && $form->{orphaned}) {
502 print qq|<input type=submit class=submit name=action value="|
503 . $locale->text('Delete') . qq|">|;
513 $lxdebug->leave_sub();
517 $lxdebug->enter_sub();
519 $form->isblank("accno", $locale->text('Account Number missing!'));
520 $form->isblank("category", $locale->text('Account Type missing!'));
522 $form->redirect($locale->text('Account saved!'))
523 if (AM->save_account(\%myconfig, \%$form));
524 $form->error($locale->text('Cannot save account!'));
526 $lxdebug->leave_sub();
530 $lxdebug->enter_sub();
532 CA->all_accounts(\%myconfig, \%$form);
534 $form->{title} = $locale->text('Chart of Accounts');
538 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
543 $callback = $form->escape($callback);
545 foreach $ca (@{ $form->{CA} }) {
547 $ca->{debit} = " ";
548 $ca->{credit} = " ";
550 if ($ca->{amount} > 0) {
552 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
554 if ($ca->{amount} < 0) {
556 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
559 my @links = split( q{:}, $ca->{link});
563 foreach my $link (@links){
564 $link = ( $link eq 'AR') ? $locale->text('Account Link AR')
565 : ( $link eq 'AP') ? $locale->text('Account Link AP')
566 : ( $link eq 'IC') ? $locale->text('Account Link IC')
567 : ( $link eq 'AR_amount' ) ? $locale->text('Account Link AR_amount')
568 : ( $link eq 'AR_paid' ) ? $locale->text('Account Link AR_paid')
569 : ( $link eq 'AR_tax' ) ? $locale->text('Account Link AR_tax')
570 : ( $link eq 'AP_amount' ) ? $locale->text('Account Link AP_amount')
571 : ( $link eq 'AP_paid' ) ? $locale->text('Account Link AP_paid')
572 : ( $link eq 'AP_tax' ) ? $locale->text('Account Link AP_tax')
573 : ( $link eq 'IC_sale' ) ? $locale->text('Account Link IC_sale')
574 : ( $link eq 'IC_cogs' ) ? $locale->text('Account Link IC_cogs')
575 : ( $link eq 'IC_taxpart' ) ? $locale->text('Account Link IC_taxpart')
576 : ( $link eq 'IC_income' ) ? $locale->text('Account Link IC_income')
577 : ( $link eq 'IC_expense' ) ? $locale->text('Account Link IC_expense')
578 : ( $link eq 'IC_taxservice' ) ? $locale->text('Account Link IC_taxservice')
579 : ( $link eq 'CT_tax' ) ? $locale->text('Account Link CT_tax')
580 : $locale->text('Unknown Link') . ': ' . $link;
582 $ca->{link} .= qq|[| . $link . qq|] |;
585 $ca->{startdate} =~ s/,/<br>/og;
586 $ca->{tk_ustva} =~ s/,/<br>/og;
587 $ca->{taxkey} =~ s/,/<br>/og;
588 $ca->{taxaccount} =~ s/,/<br>/og;
589 $ca->{taxdescription} =~ s/,/<br>/og;
590 $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):q{};
592 $ca->{category} = ($ca->{category} eq 'A') ? $locale->text('Account Category A')
593 : ($ca->{category} eq 'E') ? $locale->text('Account Category E')
594 : ($ca->{category} eq 'L') ? $locale->text('Account Category L')
595 : ($ca->{category} eq 'I') ? $locale->text('Account Category I')
596 : ($ca->{category} eq 'Q') ? $locale->text('Account Category Q')
597 : ($ca->{category} eq 'C') ? $locale->text('Account Category C')
598 : ($ca->{category} eq 'G') ? $locale->text('Account Category G')
599 : $locale->text('Unknown Category') . ': ' . $ca->{category};
601 $ca->{link_edit_account} =
602 qq|$form->{script}?action=edit_account&id=$ca->{id}|
603 .qq|&path=$form->{path}&login=$form->{login}|
604 .qq|&password=$form->{password}&callback=$callback|;
607 my $parameters_ref = {
610 # hidden_variables => $_hidden_variables_ref,
613 # Ausgabe des Templates
614 print($form->parse_html_template('am/list_accounts', $parameters_ref));
616 $lxdebug->leave_sub();
622 $lxdebug->enter_sub();
624 $form->{title} = $locale->text('Delete Account');
627 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
629 if ($form->{id} == $form->{$id}) {
630 $form->error($locale->text('Cannot delete default account!'));
634 $form->redirect($locale->text('Account deleted!'))
635 if (AM->delete_account(\%myconfig, \%$form));
636 $form->error($locale->text('Cannot delete account!'));
638 $lxdebug->leave_sub();
642 $lxdebug->enter_sub();
644 $form->{title} = "Add";
648 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
649 unless $form->{callback};
654 $lxdebug->leave_sub();
657 sub edit_department {
658 $lxdebug->enter_sub();
660 $form->{title} = "Edit";
662 AM->get_department(\%myconfig, \%$form);
667 $lxdebug->leave_sub();
670 sub list_department {
671 $lxdebug->enter_sub();
673 AM->departments(\%myconfig, \%$form);
676 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
678 $callback = $form->escape($form->{callback});
680 $form->{title} = $locale->text('Departments');
682 @column_index = qw(description cost profit);
684 $column_header{description} =
685 qq|<th class=listheading width=90%>|
686 . $locale->text('Description')
688 $column_header{cost} =
689 qq|<th class=listheading nowrap>|
690 . $locale->text('Cost Center')
692 $column_header{profit} =
693 qq|<th class=listheading nowrap>|
694 . $locale->text('Profit Center')
704 <th class=listtop>$form->{title}</th>
710 <tr class=listheading>
713 map { print "$column_header{$_}\n" } @column_index;
719 foreach $ref (@{ $form->{ALL} }) {
725 <tr valign=top class=listrow$i>
728 $costcenter = ($ref->{role} eq "C") ? "X" : "";
729 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
731 $column_data{description} =
732 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>|;
733 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
734 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
736 map { print "$column_data{$_}\n" } @column_index;
748 <td><hr size=3 noshade></td>
753 <form method=post action=$form->{script}>
755 <input name=callback type=hidden value="$form->{callback}">
757 <input type=hidden name=type value=department>
759 <input type=hidden name=path value=$form->{path}>
760 <input type=hidden name=login value=$form->{login}>
761 <input type=hidden name=password value=$form->{password}>
763 <input class=submit type=submit name=action value="|
764 . $locale->text('Add') . qq|">
772 $lxdebug->leave_sub();
775 sub department_header {
776 $lxdebug->enter_sub();
778 $form->{title} = $locale->text("$form->{title} Department");
780 # $locale->text('Add Department')
781 # $locale->text('Edit Department')
783 $form->{description} =~ s/\"/"/g;
785 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
787 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
790 qq|<input name=description size=60 value="$form->{description}">|;
793 $costcenter = "checked" if $form->{role} eq "C";
794 $profitcenter = "checked" if $form->{role} eq "P";
801 <form method=post action=$form->{script}>
803 <input type=hidden name=id value=$form->{id}>
804 <input type=hidden name=type value=department>
808 <th class=listtop colspan=2>$form->{title}</th>
812 <th align=right>| . $locale->text('Description') . qq|</th>
813 <td>$description</td>
817 <td><input type=radio style=radio name=role value="C" $costcenter> |
818 . $locale->text('Cost Center') . qq|
819 <input type=radio style=radio name=role value="P" $profitcenter> |
820 . $locale->text('Profit Center') . qq|
823 <td colspan=2><hr size=3 noshade></td>
828 $lxdebug->leave_sub();
831 sub save_department {
832 $lxdebug->enter_sub();
834 $form->isblank("description", $locale->text('Description missing!'));
835 AM->save_department(\%myconfig, \%$form);
836 $form->redirect($locale->text('Department saved!'));
838 $lxdebug->leave_sub();
841 sub delete_department {
842 $lxdebug->enter_sub();
844 AM->delete_department(\%myconfig, \%$form);
845 $form->redirect($locale->text('Department deleted!'));
847 $lxdebug->leave_sub();
851 $lxdebug->enter_sub();
853 $form->{title} = "Add";
856 "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
857 unless $form->{callback};
862 $lxdebug->leave_sub();
866 $lxdebug->enter_sub();
868 $form->{title} = "Edit";
870 AM->get_lead(\%myconfig, \%$form);
874 $form->{orphaned} = 1;
877 $lxdebug->leave_sub();
881 $lxdebug->enter_sub();
883 AM->lead(\%myconfig, \%$form);
886 "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
888 $callback = $form->escape($form->{callback});
890 $form->{title} = $locale->text('Lead');
892 @column_index = qw(description cost profit);
894 $column_header{description} =
895 qq|<th class=listheading width=100%>|
896 . $locale->text('Description')
906 <th class=listtop>$form->{title}</th>
909 <tr class=listheading>
912 map { print "$column_header{$_}\n" } @column_index;
918 foreach $ref (@{ $form->{ALL} }) {
924 <tr valign=top class=listrow$i>
927 $lead = $ref->{lead};
929 $column_data{description} =
930 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>|;
932 map { print "$column_data{$_}\n" } @column_index;
941 <td><hr size=3 noshade></td>
946 <form method=post action=$form->{script}>
948 <input name=callback type=hidden value="$form->{callback}">
950 <input type=hidden name=type value=lead>
952 <input type=hidden name=path value=$form->{path}>
953 <input type=hidden name=login value=$form->{login}>
954 <input type=hidden name=password value=$form->{password}>
956 <input class=submit type=submit name=action value="|
957 . $locale->text('Add') . qq|">
965 $lxdebug->leave_sub();
969 $lxdebug->enter_sub();
971 $form->{title} = $locale->text("$form->{title} Lead");
973 # $locale->text('Add Lead')
974 # $locale->text('Edit Lead')
976 $form->{description} =~ s/\"/"/g;
979 qq|<input name=description size=50 value="$form->{lead}">|;
986 <form method=post action=$form->{script}>
988 <input type=hidden name=id value=$form->{id}>
989 <input type=hidden name=type value=lead>
993 <th class=listtop colspan=2>$form->{title}</th>
997 <th align=right>| . $locale->text('Description') . qq|</th>
998 <td>$description</td>
1000 <td colspan=2><hr size=3 noshade></td>
1005 $lxdebug->leave_sub();
1009 $lxdebug->enter_sub();
1011 $form->isblank("description", $locale->text('Description missing!'));
1012 AM->save_lead(\%myconfig, \%$form);
1013 $form->redirect($locale->text('lead saved!'));
1015 $lxdebug->leave_sub();
1019 $lxdebug->enter_sub();
1021 AM->delete_lead(\%myconfig, \%$form);
1022 $form->redirect($locale->text('lead deleted!'));
1024 $lxdebug->leave_sub();
1028 $lxdebug->enter_sub();
1030 $form->{title} = "Add";
1033 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1034 unless $form->{callback};
1039 $lxdebug->leave_sub();
1043 $lxdebug->enter_sub();
1045 $form->{title} = "Edit";
1047 AM->get_business(\%myconfig, \%$form);
1051 $form->{orphaned} = 1;
1054 $lxdebug->leave_sub();
1058 $lxdebug->enter_sub();
1060 AM->business(\%myconfig, \%$form);
1063 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1065 $callback = $form->escape($form->{callback});
1067 $form->{title} = $locale->text('Type of Business');
1069 @column_index = qw(description discount customernumberinit);
1071 $column_header{description} =
1072 qq|<th class=listheading width=60%>|
1073 . $locale->text('Description')
1075 $column_header{discount} =
1076 qq|<th class=listheading width=10%>|
1077 . $locale->text('Discount')
1079 $column_header{customernumberinit} =
1080 qq|<th class=listheading>|
1081 . $locale->text('Customernumberinit')
1091 <th class=listtop>$form->{title}</th>
1093 <tr height="5"></tr>
1097 <tr class=listheading>
1100 map { print "$column_header{$_}\n" } @column_index;
1106 foreach $ref (@{ $form->{ALL} }) {
1112 <tr valign=top class=listrow$i>
1116 $form->format_amount(\%myconfig, $ref->{discount} * 100);
1118 $ref->{description};
1119 $column_data{description} =
1120 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>|;
1121 $column_data{discount} = qq|<td align=right>$discount</td>|;
1122 $column_data{customernumberinit} =
1123 qq|<td align=right>$ref->{customernumberinit}</td>|;
1125 map { print "$column_data{$_}\n" } @column_index;
1137 <td><hr size=3 noshade></td>
1142 <form method=post action=$form->{script}>
1144 <input name=callback type=hidden value="$form->{callback}">
1146 <input type=hidden name=type value=business>
1148 <input type=hidden name=path value=$form->{path}>
1149 <input type=hidden name=login value=$form->{login}>
1150 <input type=hidden name=password value=$form->{password}>
1152 <input class=submit type=submit name=action value="|
1153 . $locale->text('Add') . qq|">
1161 $lxdebug->leave_sub();
1164 sub business_header {
1165 $lxdebug->enter_sub();
1167 $form->{title} = $locale->text("$form->{title} Business");
1169 # $locale->text('Add Business')
1170 # $locale->text('Edit Business')
1172 $form->{description} =~ s/\"/"/g;
1174 $form->format_amount(\%myconfig, $form->{discount} * 100);
1181 <form method=post action=$form->{script}>
1183 <input type=hidden name=id value=$form->{id}>
1184 <input type=hidden name=type value=business>
1188 <th class=listtop colspan=2>$form->{title}</th>
1190 <tr height="5"></tr>
1192 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1193 <td><input name=description size=30 value="$form->{description}"></td>
1196 <th align=right>| . $locale->text('Discount') . qq| %</th>
1197 <td><input name=discount size=5 value=$form->{discount}></td>
1200 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1201 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1203 <td colspan=2><hr size=3 noshade></td>
1208 $lxdebug->leave_sub();
1212 $lxdebug->enter_sub();
1214 $form->isblank("description", $locale->text('Description missing!'));
1215 $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100;
1216 AM->save_business(\%myconfig, \%$form);
1217 $form->redirect($locale->text('Business saved!'));
1219 $lxdebug->leave_sub();
1222 sub delete_business {
1223 $lxdebug->enter_sub();
1225 AM->delete_business(\%myconfig, \%$form);
1226 $form->redirect($locale->text('Business deleted!'));
1228 $lxdebug->leave_sub();
1232 $lxdebug->enter_sub();
1234 $form->{title} = "Add";
1237 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1238 unless $form->{callback};
1243 $lxdebug->leave_sub();
1247 $lxdebug->enter_sub();
1249 $form->{title} = "Edit";
1251 AM->get_language(\%myconfig, \%$form);
1255 $form->{orphaned} = 1;
1258 $lxdebug->leave_sub();
1262 $lxdebug->enter_sub();
1264 AM->language(\%myconfig, \%$form);
1267 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1269 $callback = $form->escape($form->{callback});
1271 $form->{title} = $locale->text('Languages');
1273 @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
1275 $column_header{description} =
1276 qq|<th class=listheading width=60%>|
1277 . $locale->text('Description')
1279 $column_header{template_code} =
1280 qq|<th class=listheading width=10%>|
1281 . $locale->text('Template Code')
1283 $column_header{article_code} =
1284 qq|<th class=listheading>|
1285 . $locale->text('Article Code')
1287 $column_header{output_numberformat} =
1288 qq|<th class=listheading>|
1289 . $locale->text('Number Format')
1291 $column_header{output_dateformat} =
1292 qq|<th class=listheading>|
1293 . $locale->text('Date Format')
1295 $column_header{output_longdates} =
1296 qq|<th class=listheading>|
1297 . $locale->text('Long Dates')
1307 <th class=listtop>$form->{title}</th>
1309 <tr height="5"></tr>
1313 <tr class=listheading>
1316 map { print "$column_header{$_}\n" } @column_index;
1322 foreach $ref (@{ $form->{ALL} }) {
1328 <tr valign=top class=listrow$i>
1332 $column_data{description} =
1333 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>|;
1334 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1335 $column_data{article_code} =
1336 qq|<td align=right>$ref->{article_code}</td>|;
1337 $column_data{output_numberformat} =
1339 ($ref->{output_numberformat} ? $ref->{output_numberformat} :
1340 $locale->text("use program settings")) .
1342 $column_data{output_dateformat} =
1344 ($ref->{output_dateformat} ? $ref->{output_dateformat} :
1345 $locale->text("use program settings")) .
1347 $column_data{output_longdates} =
1349 ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
1352 map { print "$column_data{$_}\n" } @column_index;
1364 <td><hr size=3 noshade></td>
1369 <form method=post action=$form->{script}>
1371 <input name=callback type=hidden value="$form->{callback}">
1373 <input type=hidden name=type value=language>
1375 <input type=hidden name=path value=$form->{path}>
1376 <input type=hidden name=login value=$form->{login}>
1377 <input type=hidden name=password value=$form->{password}>
1379 <input class=submit type=submit name=action value="|
1380 . $locale->text('Add') . qq|">
1388 $lxdebug->leave_sub();
1391 sub language_header {
1392 $lxdebug->enter_sub();
1394 $form->{title} = $locale->text("$form->{title} Language");
1396 # $locale->text('Add Language')
1397 # $locale->text('Edit Language')
1399 $form->{description} =~ s/\"/"/g;
1400 $form->{template_code} =~ s/\"/"/g;
1401 $form->{article_code} =~ s/\"/"/g;
1407 qq|<option value="">| . $locale->text("use program settings") .
1409 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1411 ($item eq $form->{output_numberformat})
1412 ? "<option selected>$item"
1418 qq|<option value="">| . $locale->text("use program settings") .
1420 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1422 ($item eq $form->{output_dateformat})
1423 ? "<option selected>$item"
1431 <form method=post action=$form->{script}>
1433 <input type=hidden name=id value=$form->{id}>
1434 <input type=hidden name=type value=language>
1438 <th class=listtop colspan=2>$form->{title}</th>
1440 <tr height="5"></tr>
1442 <th align=right>| . $locale->text('Language') . qq|</th>
1443 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1446 <th align=right>| . $locale->text('Template Code') . qq|</th>
1447 <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
1450 <th align=right>| . $locale->text('Article Code') . qq|</th>
1451 <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
1454 <th align=right>| . $locale->text('Number Format') . qq|</th>
1455 <td><select name="output_numberformat">$numberformat</select></td>
1458 <th align=right>| . $locale->text('Date Format') . qq|</th>
1459 <td><select name="output_dateformat">$dateformat</select></td>
1462 <th align=right>| . $locale->text('Long Dates') . qq|</th>
1463 <td><input type="radio" name="output_longdates" value="1"| .
1464 ($form->{output_longdates} ? " checked" : "") .
1465 qq|>| . $locale->text("Yes") .
1466 qq|<input type="radio" name="output_longdates" value="0"| .
1467 ($form->{output_longdates} ? "" : " checked") .
1468 qq|>| . $locale->text("No") .
1471 <td colspan=2><hr size=3 noshade></td>
1476 $lxdebug->leave_sub();
1480 $lxdebug->enter_sub();
1482 $form->isblank("description", $locale->text('Language missing!'));
1483 $form->isblank("template_code", $locale->text('Template Code missing!'));
1484 $form->isblank("article_code", $locale->text('Article Code missing!'));
1485 AM->save_language(\%myconfig, \%$form);
1486 $form->redirect($locale->text('Language saved!'));
1488 $lxdebug->leave_sub();
1491 sub delete_language {
1492 $lxdebug->enter_sub();
1494 AM->delete_language(\%myconfig, \%$form);
1495 $form->redirect($locale->text('Language deleted!'));
1497 $lxdebug->leave_sub();
1501 sub add_buchungsgruppe {
1502 $lxdebug->enter_sub();
1504 # $locale->text("Add Buchungsgruppe")
1505 # $locale->text("Edit Buchungsgruppe")
1506 $form->{title} = "Add";
1509 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1510 unless $form->{callback};
1511 AM->get_buchungsgruppe(\%myconfig, \%$form);
1512 $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
1513 for (my $i = 0; 4 > $i; $i++) {
1514 map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; }
1515 qw(income expense));
1518 &buchungsgruppe_header;
1521 $lxdebug->leave_sub();
1524 sub edit_buchungsgruppe {
1525 $lxdebug->enter_sub();
1527 $form->{title} = "Edit";
1529 AM->get_buchungsgruppe(\%myconfig, \%$form);
1531 &buchungsgruppe_header;
1535 $lxdebug->leave_sub();
1538 sub list_buchungsgruppe {
1539 $lxdebug->enter_sub();
1541 AM->buchungsgruppe(\%myconfig, \%$form);
1544 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1546 $callback = $form->escape($form->{callback});
1548 $form->{title} = $locale->text('Buchungsgruppen');
1550 @column_index = qw(up down description inventory_accno
1551 income_accno_0 expense_accno_0
1552 income_accno_1 expense_accno_1
1553 income_accno_2 expense_accno_2
1554 income_accno_3 expense_accno_3 );
1556 $column_header{up} =
1557 qq|<th class="listheading" width="16">|
1558 . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
1560 $column_header{down} =
1561 qq|<th class="listheading" width="16">|
1562 . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
1564 $column_header{description} =
1565 qq|<th class="listheading" width="40%">|
1566 . $locale->text('Description')
1568 $column_header{inventory_accno} =
1569 qq|<th class=listheading>|
1570 . $locale->text('Bestandskonto')
1572 $column_header{income_accno_0} =
1573 qq|<th class=listheading>|
1574 . $locale->text('Erlöse Inland')
1576 $column_header{expense_accno_0} =
1577 qq|<th class=listheading>|
1578 . $locale->text('Aufwand Inland')
1580 $column_header{income_accno_1} =
1581 qq|<th class=listheading>|
1582 . $locale->text('Erlöse EU m. UStId')
1584 $column_header{expense_accno_1} =
1585 qq|<th class=listheading>|
1586 . $locale->text('Aufwand EU m. UStId')
1588 $column_header{income_accno_2} =
1589 qq|<th class=listheading>|
1590 . $locale->text('Erlöse EU o. UStId')
1592 $column_header{expense_accno_2} =
1593 qq|<th class=listheading>|
1594 . $locale->text('Aufwand EU o. UStId')
1596 $column_header{income_accno_3} =
1597 qq|<th class=listheading>|
1598 . $locale->text('Erlöse Ausland')
1600 $column_header{expense_accno_3} =
1601 qq|<th class=listheading>|
1602 . $locale->text('Aufwand Ausland')
1611 <th class=listtop>$form->{title}</th>
1613 <tr height="5"></tr>
1617 <tr class=listheading>
1620 map { print "$column_header{$_}\n" } @column_index;
1626 my $swap_link = qq|$form->{script}?action=swap_buchungsgruppen&|;
1627 map({ $swap_link .= $_ . "=" . $form->escape($form->{$_}) . "&" }
1628 qw(login password path));
1631 foreach $ref (@{ $form->{ALL} }) {
1637 <tr valign=top class=listrow$i>
1641 my $pref = $form->{ALL}->[$row - 1];
1643 qq|<td align="center" valign="center" width="16">| .
1644 qq|<a href="${swap_link}id1=$ref->{id}&id2=$pref->{id}">| .
1645 qq|<img border="0" src="image/up.png" alt="| . $locale->text("up") . qq|">| .
1648 $column_data{up} = qq|<td width="16"> </td>|;
1651 if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
1652 $column_data{down} = qq|<td width="16"> </td>|;
1654 my $nref = $form->{ALL}->[$row + 1];
1655 $column_data{down} =
1656 qq|<td align="center" valign="center" width="16">| .
1657 qq|<a href="${swap_link}id1=$ref->{id}&id2=$nref->{id}">| .
1658 qq|<img border="0" src="image/down.png" alt="| . $locale->text("down") . qq|">| .
1662 $column_data{description} =
1663 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>|;
1664 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1665 $column_data{income_accno_0} =
1666 qq|<td align=right>$ref->{income_accno_0}</td>|;
1667 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1668 $column_data{income_accno_1} =
1669 qq|<td align=right>$ref->{income_accno_1}</td>|;
1670 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1671 $column_data{income_accno_2} =
1672 qq|<td align=right>$ref->{income_accno_2}</td>|;
1673 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1674 $column_data{income_accno_3} =
1675 qq|<td align=right>$ref->{income_accno_3}</td>|;
1676 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1678 map { print "$column_data{$_}\n" } @column_index;
1692 <td><hr size=3 noshade></td>
1697 <form method=post action=$form->{script}>
1699 <input name=callback type=hidden value="$form->{callback}">
1701 <input type=hidden name=type value=buchungsgruppe>
1703 <input type=hidden name=path value=$form->{path}>
1704 <input type=hidden name=login value=$form->{login}>
1705 <input type=hidden name=password value=$form->{password}>
1707 <input class=submit type=submit name=action value="|
1708 . $locale->text('Add') . qq|">
1716 $lxdebug->leave_sub();
1719 sub buchungsgruppe_header {
1720 $lxdebug->enter_sub();
1722 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1724 # $locale->text('Buchungsgruppe hinzufügen')
1725 # $locale->text('Buchungsgruppe bearbeiten')
1727 my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
1728 my %acc_type_map = (
1729 "IC" => $acc_inventory,
1730 "IC_income" => $acc_income,
1731 "IC_sale" => $acc_income,
1732 "IC_expense" => $acc_expense,
1733 "IC_cogs" => $acc_expense,
1736 foreach $key (keys(%acc_type_map)) {
1737 foreach $ref (@{ $form->{IC_links}{$key} }) {
1738 $acc_type_map{$key}->{$ref->{"id"}} = $ref;
1742 foreach my $type (qw(IC IC_income IC_expense)) {
1743 $form->{"select$type"} =
1745 map({ "<option value=$_->{id} $_->{selected}>" .
1746 "$_->{accno}--" . H($_->{description}) . "</option>" }
1747 sort({ $a->{"accno"} cmp $b->{"accno"} }
1748 values(%{$acc_type_map{$type}}))));
1752 $form->{selectIC} =~ s/selected//g;
1753 $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/;
1754 $form->{selectIC_income} =~ s/selected//g;
1755 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1756 $form->{selectIC_expense} =~ s/selected//g;
1757 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1763 <th align=right>| . $locale->text('Inventory') . qq|</th>
1764 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1765 <input name=selectIC type=hidden value="$form->{selectIC}">
1769 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
1773 $linkaccounts .= qq|
1775 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
1776 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
1779 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
1780 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
1783 $form->{selectIC_income} =~ s/selected//g;
1784 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
1785 $form->{selectIC_expense} =~ s/selected//g;
1786 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
1788 $linkaccounts .= qq| <tr>
1789 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
1790 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
1793 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
1794 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
1798 $form->{selectIC_income} =~ s/selected//g;
1799 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
1800 $form->{selectIC_expense} =~ s/selected//g;
1801 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
1804 $linkaccounts .= qq| <tr>
1805 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
1806 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
1809 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
1810 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
1814 $form->{selectIC_income} =~ s/selected//g;
1815 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
1816 $form->{selectIC_expense} =~ s/selected//g;
1817 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
1820 $linkaccounts .= qq| <tr>
1821 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
1822 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
1825 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
1826 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
1836 <form method=post action=$form->{script}>
1838 <input type=hidden name=id value=$form->{id}>
1839 <input type=hidden name=type value=buchungsgruppe>
1843 <th class=listtop colspan=2>$form->{title}</th>
1845 <tr height="5"></tr>
1847 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
1848 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1851 <td colspan=2><hr size=3 noshade></td>
1856 $lxdebug->leave_sub();
1859 sub save_buchungsgruppe {
1860 $lxdebug->enter_sub();
1862 $form->isblank("description", $locale->text('Description missing!'));
1864 AM->save_buchungsgruppe(\%myconfig, \%$form);
1865 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
1867 $lxdebug->leave_sub();
1870 sub delete_buchungsgruppe {
1871 $lxdebug->enter_sub();
1873 AM->delete_buchungsgruppe(\%myconfig, \%$form);
1874 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
1876 $lxdebug->leave_sub();
1879 sub swap_buchungsgruppen {
1880 $lxdebug->enter_sub();
1882 AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen");
1883 list_buchungsgruppe();
1885 $lxdebug->leave_sub();
1890 $lxdebug->enter_sub();
1892 $form->{title} = "Add";
1895 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1896 unless $form->{callback};
1901 $lxdebug->leave_sub();
1905 $lxdebug->enter_sub();
1907 $form->{title} = "Edit";
1909 AM->get_printer(\%myconfig, \%$form);
1913 $form->{orphaned} = 1;
1916 $lxdebug->leave_sub();
1920 $lxdebug->enter_sub();
1922 AM->printer(\%myconfig, \%$form);
1925 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1927 $callback = $form->escape($form->{callback});
1929 $form->{title} = $locale->text('Printer');
1931 @column_index = qw(printer_description printer_command template_code);
1933 $column_header{printer_description} =
1934 qq|<th class=listheading width=60%>|
1935 . $locale->text('Printer Description')
1937 $column_header{printer_command} =
1938 qq|<th class=listheading width=10%>|
1939 . $locale->text('Printer Command')
1941 $column_header{template_code} =
1942 qq|<th class=listheading>|
1943 . $locale->text('Template Code')
1953 <th class=listtop>$form->{title}</th>
1955 <tr height="5"></tr>
1959 <tr class=listheading>
1962 map { print "$column_header{$_}\n" } @column_index;
1968 foreach $ref (@{ $form->{ALL} }) {
1974 <tr valign=top class=listrow$i>
1978 $column_data{printer_description} =
1979 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>|;
1980 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
1981 $column_data{template_code} =
1982 qq|<td align=right>$ref->{template_code}</td>|;
1984 map { print "$column_data{$_}\n" } @column_index;
1996 <td><hr size=3 noshade></td>
2001 <form method=post action=$form->{script}>
2003 <input name=callback type=hidden value="$form->{callback}">
2005 <input type=hidden name=type value=printer>
2007 <input type=hidden name=path value=$form->{path}>
2008 <input type=hidden name=login value=$form->{login}>
2009 <input type=hidden name=password value=$form->{password}>
2011 <input class=submit type=submit name=action value="|
2012 . $locale->text('Add') . qq|">
2020 $lxdebug->leave_sub();
2023 sub printer_header {
2024 $lxdebug->enter_sub();
2026 $form->{title} = $locale->text("$form->{title} Printer");
2028 # $locale->text('Add Printer')
2029 # $locale->text('Edit Printer')
2031 $form->{printer_description} =~ s/\"/"/g;
2032 $form->{template_code} =~ s/\"/"/g;
2033 $form->{printer_command} =~ s/\"/"/g;
2041 <form method=post action=$form->{script}>
2043 <input type=hidden name=id value=$form->{id}>
2044 <input type=hidden name=type value=printer>
2048 <th class=listtop colspan=2>$form->{title}</th>
2050 <tr height="5"></tr>
2052 <th align=right>| . $locale->text('Printer') . qq|</th>
2053 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2056 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2057 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2060 <th align=right>| . $locale->text('Template Code') . qq|</th>
2061 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2063 <td colspan=2><hr size=3 noshade></td>
2068 $lxdebug->leave_sub();
2072 $lxdebug->enter_sub();
2074 $form->isblank("printer_description", $locale->text('Description missing!'));
2075 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2076 AM->save_printer(\%myconfig, \%$form);
2077 $form->redirect($locale->text('Printer saved!'));
2079 $lxdebug->leave_sub();
2082 sub delete_printer {
2083 $lxdebug->enter_sub();
2085 AM->delete_printer(\%myconfig, \%$form);
2086 $form->redirect($locale->text('Printer deleted!'));
2088 $lxdebug->leave_sub();
2092 $lxdebug->enter_sub();
2094 $form->{title} = "Add";
2097 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2098 unless $form->{callback};
2100 $form->{terms_netto} = 0;
2101 $form->{terms_skonto} = 0;
2102 $form->{percent_skonto} = 0;
2103 my @languages = AM->language(\%myconfig, $form, 1);
2104 map({ $_->{"language"} = $_->{"description"};
2105 $_->{"language_id"} = $_->{"id"}; } @languages);
2106 $form->{"TRANSLATION"} = \@languages;
2110 $lxdebug->leave_sub();
2114 $lxdebug->enter_sub();
2116 $form->{title} = "Edit";
2118 AM->get_payment(\%myconfig, $form);
2119 $form->{percent_skonto} =
2120 $form->format_amount(\%myconfig, $form->{percent_skonto} * 100);
2124 $form->{orphaned} = 1;
2127 $lxdebug->leave_sub();
2131 $lxdebug->enter_sub();
2133 AM->payment(\%myconfig, \%$form);
2135 $form->{callback} = build_std_url("action=list_payment");
2137 $callback = $form->escape($form->{callback});
2139 $form->{title} = $locale->text('Payment Terms');
2141 @column_index = qw(up down description description_long terms_netto
2142 terms_skonto percent_skonto);
2144 $column_header{up} =
2145 qq|<th class="listheading" align="center" valign="center" width="16">|
2146 . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
2148 $column_header{down} =
2149 qq|<th class="listheading" align="center" valign="center" width="16">|
2150 . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
2152 $column_header{description} =
2153 qq|<th class=listheading>|
2154 . $locale->text('Description')
2156 $column_header{description_long} =
2157 qq|<th class=listheading>|
2158 . $locale->text('Long Description')
2160 $column_header{terms_netto} =
2161 qq|<th class=listheading>|
2162 . $locale->text('Netto Terms')
2164 $column_header{terms_skonto} =
2165 qq|<th class=listheading>|
2166 . $locale->text('Skonto Terms')
2168 $column_header{percent_skonto} =
2169 qq|<th class=listheading>|
2170 . $locale->text('Skonto')
2180 <th class=listtop>$form->{title}</th>
2182 <tr height="5"></tr>
2186 <tr class=listheading>
2189 map { print "$column_header{$_}\n" } @column_index;
2195 my $swap_link = build_std_url("action=swap_payment_terms");
2198 foreach $ref (@{ $form->{ALL} }) {
2204 <tr valign=top class=listrow$i>
2208 my $pref = $form->{ALL}->[$row - 1];
2210 qq|<td align="center" valign="center" width="16">| .
2211 qq|<a href="${swap_link}&id1=$ref->{id}&id2=$pref->{id}">| .
2212 qq|<img border="0" src="image/up.png" alt="| . $locale->text("up") . qq|">| .
2215 $column_data{up} = qq|<td width="16"> </td>|;
2218 if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
2219 $column_data{down} = qq|<td width="16"> </td>|;
2221 my $nref = $form->{ALL}->[$row + 1];
2222 $column_data{down} =
2223 qq|<td align="center" valign="center" width="16">| .
2224 qq|<a href="${swap_link}&id1=$ref->{id}&id2=$nref->{id}">| .
2225 qq|<img border="0" src="image/down.png" alt="| . $locale->text("down") . qq|">| .
2229 $column_data{description} =
2231 build_std_url("action=edit_payment", "id=$ref->{id}", "callback=$callback") .
2232 qq|">| . H($ref->{description}) . qq|</a></td>|;
2233 $column_data{description_long} =
2234 qq|<td>| . H($ref->{description_long}) . qq|</td>|;
2235 $column_data{terms_netto} =
2236 qq|<td align=right>$ref->{terms_netto}</td>|;
2237 $column_data{terms_skonto} =
2238 qq|<td align=right>$ref->{terms_skonto}</td>|;
2239 $column_data{percent_skonto} =
2240 qq|<td align=right>| .
2241 $form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) .
2243 map { print "$column_data{$_}\n" } @column_index;
2256 <td><hr size=3 noshade></td>
2261 <form method=post action=$form->{script}>
2263 <input name=callback type=hidden value="$form->{callback}">
2265 <input type=hidden name=type value=payment>
2267 <input type=hidden name=path value=$form->{path}>
2268 <input type=hidden name=login value=$form->{login}>
2269 <input type=hidden name=password value=$form->{password}>
2271 <input class=submit type=submit name=action value="|
2272 . $locale->text('Add') . qq|">
2280 $lxdebug->leave_sub();
2283 sub payment_header {
2284 $lxdebug->enter_sub();
2286 $form->{title} = $locale->text("$form->{title} Payment Terms");
2288 # $locale->text('Add Payment Terms')
2289 # $locale->text('Edit Payment Terms')
2291 $form->{description} =~ s/\"/"/g;
2300 <form method=post action=$form->{script}>
2302 <input type=hidden name=id value=$form->{id}>
2303 <input type=hidden name=type value=payment>
2307 <th class=listtop colspan=2>$form->{title}</th>
2309 <tr height="5"></tr>
2311 <th align=right>| . $locale->text('Description') . qq|</th>
2312 <td><input name=description size=30 value="$form->{description}"></td>
2315 <th align=right>| . $locale->text('Long Description') . qq|</th>
2316 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2320 foreach my $language (@{ $form->{"TRANSLATION"} }) {
2323 <th align="right">| .
2324 sprintf($locale->text('Translation (%s)'),
2325 $language->{"language"})
2327 <td><input name="description_long_$language->{language_id}" size="50"
2328 value="| . Q($language->{"description_long"}) . qq|"></td>
2335 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2336 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2339 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2340 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2343 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2344 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2346 <td colspan=2><hr size=3 noshade></td>
2350 <p>| . $locale->text("You can use the following strings in the long " .
2351 "description and all translations. They will be " .
2352 "replaced by their actual values by Lx-Office " .
2353 "before they're output.")
2357 <li>| . $locale->text("<%netto_date%> -- Date the payment is due in " .
2360 <li>| . $locale->text("<%skonto_date%> -- Date the payment is due " .
2363 <li>| . $locale->text("<%skonto_amount%> -- The deductible amount")
2365 <li>| . $locale->text("<%total%> -- Amount payable")
2367 <li>| . $locale->text("<%invtotal%> -- Invoice total")
2369 <li>| . $locale->text("<%currency%> -- The selected currency")
2371 <li>| . $locale->text("<%terms_netto%> -- The number of days for " .
2374 <li>| . $locale->text("<%account_number%> -- Your account number")
2376 <li>| . $locale->text("<%bank%> -- Your bank")
2378 <li>| . $locale->text("<%bank_code%> -- Your bank code")
2382 $lxdebug->leave_sub();
2386 $lxdebug->enter_sub();
2388 $form->isblank("description", $locale->text('Description missing!'));
2389 $form->{"percent_skonto"} =
2390 $form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100;
2391 AM->save_payment(\%myconfig, \%$form);
2392 $form->redirect($locale->text('Payment Terms saved!'));
2394 $lxdebug->leave_sub();
2397 sub delete_payment {
2398 $lxdebug->enter_sub();
2400 AM->delete_payment(\%myconfig, \%$form);
2401 $form->redirect($locale->text('Payment terms deleted!'));
2403 $lxdebug->leave_sub();
2406 sub swap_payment_terms {
2407 $lxdebug->enter_sub();
2409 AM->swap_sortkeys(\%myconfig, $form, "payment_terms");
2412 $lxdebug->leave_sub();
2415 sub display_stylesheet {
2416 $lxdebug->enter_sub();
2418 $form->{file} = "css/$myconfig{stylesheet}";
2421 $lxdebug->leave_sub();
2425 $lxdebug->enter_sub();
2427 $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
2428 $form->{file} =~ s/^\/*//g;
2429 $form->{file} =~ s/$userspath//;
2431 $form->error("$!: $form->{file}") unless -f $form->{file};
2433 AM->load_template(\%$form);
2435 $form->{title} = $form->{file};
2437 # if it is anything but html
2438 if ($form->{file} !~ /\.html$/) {
2439 $form->{body} = "<pre>\n$form->{body}\n</pre>";
2449 <form method=post action=$form->{script}>
2451 <input name=file type=hidden value=$form->{file}>
2452 <input name=type type=hidden value=template>
2454 <input type=hidden name=path value=$form->{path}>
2455 <input type=hidden name=login value=$form->{login}>
2456 <input type=hidden name=password value=$form->{password}>
2458 <input name=action type=submit class=submit value="|
2459 . $locale->text('Edit') . qq|">
2467 $lxdebug->leave_sub();
2471 $lxdebug->enter_sub();
2473 AM->load_template(\%$form);
2475 $form->{title} = $locale->text('Edit Template');
2477 # convert   to &nbsp;
2478 $form->{body} =~ s/ /&nbsp;/gi;
2485 <form method=post action=$form->{script}>
2487 <input name=file type=hidden value=$form->{file}>
2488 <input name=type type=hidden value=template>
2490 <input type=hidden name=path value=$form->{path}>
2491 <input type=hidden name=login value=$form->{login}>
2492 <input type=hidden name=password value=$form->{password}>
2494 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
2496 <textarea name=body rows=25 cols=70>
2501 <input type=submit class=submit name=action value="|
2502 . $locale->text('Save') . qq|">
2511 $lxdebug->leave_sub();
2515 $lxdebug->enter_sub();
2517 AM->save_template(\%$form);
2518 $form->redirect($locale->text('Template saved!'));
2520 $lxdebug->leave_sub();
2524 $lxdebug->enter_sub();
2526 # get defaults for account numbers and last numbers
2527 AM->defaultaccounts(\%myconfig, \%$form);
2529 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2531 ($item eq $myconfig{dateformat})
2532 ? "<option selected>$item\n"
2533 : "<option>$item\n";
2536 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2538 ($item eq $myconfig{numberformat})
2539 ? "<option selected>$item\n"
2540 : "<option>$item\n";
2543 foreach $item (qw(name company address signature)) {
2544 $myconfig{$item} =~ s/\"/"/g;
2547 foreach $item (qw(address signature)) {
2548 $myconfig{$item} =~ s/\\n/\r\n/g;
2552 if ($opendocument_templates && $openofficeorg_writer_bin &&
2553 $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
2554 push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
2555 "value" => "opendocument_pdf" });
2557 if ($latex_templates) {
2558 push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
2560 push(@formats, { "name" => "HTML", "value" => "html" });
2561 if ($latex_templates) {
2562 push(@formats, { "name" => $locale->text("Postscript"),
2563 "value" => "postscript" });
2565 if ($opendocument_templates) {
2566 push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
2567 "value" => "opendocument" });
2570 if (!$myconfig{"template_format"}) {
2571 $myconfig{"template_format"} = "pdf";
2573 my $template_format = "";
2574 foreach $item (@formats) {
2576 "<option value=\"$item->{value}\"" .
2577 ($item->{"value"} eq $myconfig{"template_format"} ?
2579 ">" . H($item->{"name"}) . "</option>";
2582 if (!$myconfig{"default_media"}) {
2583 $myconfig{"default_media"} = "screen";
2585 my %selected = ($myconfig{"default_media"} => "selected");
2586 my $default_media = qq|
2587 <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
2588 <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
2589 <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
2593 $selected{$myconfig{"default_printer_id"}} = "selected"
2594 if ($myconfig{"default_printer_id"});
2595 my $default_printer = qq|<option></option>|;
2596 AM->printer(\%myconfig, $form);
2597 foreach my $printer (@{$form->{"ALL"}}) {
2598 $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
2599 qq|" $selected{$printer->{'id'}}>| .
2600 H($printer->{"printer_description"}) . qq|</option>|;
2603 %countrycodes = User->country_codes;
2605 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2609 ($myconfig{countrycode} eq $key)
2610 ? "<option selected value=$key>$countrycodes{$key}\n"
2611 : "<option value=$key>$countrycodes{$key}\n";
2613 $countrycodes = "<option>American English\n$countrycodes";
2615 foreach $key (keys %{ $form->{IC} }) {
2616 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2618 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2619 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2620 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2624 # opendir CSS, "css/.";
2625 # @all = grep /.*\.css$/, readdir CSS;
2628 # css dir has styles that are not intended as general layouts.
2629 # reverting to hardcoded list
2630 @all = qw(lx-office-erp.css Win2000.css);
2632 foreach $item (@all) {
2633 if ($item eq $myconfig{stylesheet}) {
2634 $selectstylesheet .= qq|<option selected>$item\n|;
2636 $selectstylesheet .= qq|<option>$item\n|;
2639 $selectstylesheet .= "<option>\n";
2641 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2645 if ($myconfig{menustyle} eq "old") {
2646 $menustyle_old = "checked";
2647 } elsif ($myconfig{menustyle} eq "neu") {
2648 $menustyle_neu = "checked";
2649 } elsif ($myconfig{menustyle} eq "v3") {
2650 $menustyle_v3 = "checked";
2653 my ($show_form_details, $hide_form_details);
2654 $myconfig{"show_form_details"} = 1
2655 unless (defined($myconfig{"show_form_details"}));
2656 $show_form_details = "checked" if ($myconfig{"show_form_details"});
2657 $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
2662 <form method=post action=$form->{script}>
2664 <input type=hidden name=old_password value=$myconfig{password}>
2665 <input type=hidden name=type value=preferences>
2666 <input type=hidden name=role value=$myconfig{role}>
2669 <tr><th class=listtop>$form->{title}</th></tr>
2674 <th align=right>| . $locale->text('Name') . qq|</th>
2675 <td><input name=name size=15 value="$myconfig{name}"></td>
2678 <th align=right>| . $locale->text('Password') . qq|</th>
2679 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2682 <th align=right>| . $locale->text('E-mail') . qq|</th>
2683 <td><input name=email size=30 value="$myconfig{email}"></td>
2686 <th align=right>| . $locale->text('Signature') . qq|</th>
2687 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2690 <th align=right>| . $locale->text('Phone') . qq|</th>
2691 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2694 <th align=right>| . $locale->text('Fax') . qq|</th>
2695 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2698 <th align=right>| . $locale->text('Company') . qq|</th>
2699 <td><input name=company size=30 value="$myconfig{company}"></td>
2702 <th align=right>| . $locale->text('Address') . qq|</th>
2703 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2706 <th align=right>| . $locale->text('Date Format') . qq|</th>
2707 <td><select name=dateformat>$dateformat</select></td>
2710 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2711 <td><select name=numberformat>$numberformat</select></td>
2715 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2716 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2719 <th align=right>| . $locale->text('Language') . qq|</th>
2720 <td><select name=countrycode>$countrycodes</select></td>
2723 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
2724 <td><select name=usestylesheet>$selectstylesheet</select></td>
2727 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
2728 <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
2729 $locale->text("Top (CSS)") . qq|
2730 <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
2731 $locale->text("Top (Javascript)") . qq|
2732 <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
2733 $locale->text("Old (on the side)") . qq|</td>
2736 <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
2737 <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details>
2738 <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
2739 <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details>
2740 <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
2742 <input name=printer type=hidden value="$myconfig{printer}">
2743 <tr class=listheading>
2744 <th colspan=2>| . $locale->text("Print options") . qq|</th>
2747 <th align=right>| . $locale->text('Default template format') . qq|</th>
2748 <td><select name="template_format">$template_format</select></td>
2751 <th align=right>| . $locale->text('Default output medium') . qq|</th>
2752 <td><select name="default_media">$default_media</select></td>
2755 <th align=right>| . $locale->text('Default printer') . qq|</th>
2756 <td><select name="default_printer_id">$default_printer</select></td>
2759 <th align=right>| . $locale->text('Number of copies') . qq|</th>
2760 <td><input name="copies" size="10" value="| .
2761 $form->quote($myconfig{"copies"}) . qq|"></td>
2765 <tr class=listheading>
2766 <th colspan=2> </th>
2769 <th align=right>| . $locale->text('Business Number') . qq|</th>
2770 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
2773 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
2774 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
2776 <tr class=listheading>
2778 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
2784 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
2785 <td><select name=inventory_accno>$myconfig{IC}</select></td>
2788 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
2789 <td><select name=income_accno>$myconfig{IC_income}</select></td>
2792 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
2793 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
2796 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
2797 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
2800 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
2801 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
2806 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
2808 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
2817 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
2818 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
2819 <th align=right nowrap>|
2820 . $locale->text('Last Customer Number') . qq|</th>
2821 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
2824 <th align=right nowrap>|
2825 . $locale->text('Last Credit Note Number') . qq|</th>
2826 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
2827 <th align=right nowrap>|
2828 . $locale->text('Last Vendor Number') . qq|</th>
2829 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
2832 <th align=right nowrap>|
2833 . $locale->text('Last Sales Order Number') . qq|</th>
2834 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
2837 <th align=right nowrap>|
2838 . $locale->text('Last Purchase Order Number') . qq|</th>
2839 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
2840 <th align=right nowrap>|
2841 . $locale->text('Last Article Number') . qq|</th>
2842 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
2845 <th align=right nowrap>|
2846 . $locale->text('Last Sales Quotation Number') . qq|</th>
2847 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
2848 <th align=right nowrap>|
2849 . $locale->text('Last Service Number') . qq|</th>
2850 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
2853 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
2854 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
2855 <th align=right nowrap></th>
2861 # <tr class=listheading>
2862 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
2869 # <th>| . $locale->text('Rate') . qq| (%)</th>
2870 # <th>| . $locale->text('Number') . qq|</th>
2874 # foreach $accno (sort keys %{ $form->{taxrates} }) {
2877 # <th align=right>$form->{taxrates}{$accno}{description}</th>
2878 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
2879 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
2882 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
2885 # chop $form->{taxaccounts};
2888 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
2897 <td><hr size=3 noshade></td>
2901 <input type=hidden name=path value=$form->{path}>
2902 <input type=hidden name=login value=$form->{login}>
2903 <input type=hidden name=password value=$form->{password}>
2906 <input type=submit class=submit name=action value="|
2907 . $locale->text('Save') . qq|">
2915 $lxdebug->leave_sub();
2918 sub save_preferences {
2919 $lxdebug->enter_sub();
2921 $form->{stylesheet} = $form->{usestylesheet};
2923 $form->redirect($locale->text('Preferences saved!'))
2925 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
2927 $form->error($locale->text('Cannot save preferences!'));
2929 $lxdebug->leave_sub();
2933 $lxdebug->enter_sub();
2935 $form->{title} = $locale->text('Audit Control');
2937 AM->closedto(\%myconfig, \%$form);
2939 if ($form->{revtrans}) {
2940 $checked{Y} = "checked";
2942 $checked{N} = "checked";
2950 <form method=post action=$form->{script}>
2952 <input type=hidden name=path value=$form->{path}>
2953 <input type=hidden name=login value=$form->{login}>
2954 <input type=hidden name=password value=$form->{password}>
2957 <tr><th class=listtop>$form->{title}</th></tr>
2958 <tr height="5"></tr>
2964 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
2965 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
2966 . $locale->text('Yes')
2967 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
2968 . $locale->text('No')
2972 <th>| . $locale->text('Close Books up to') . qq|</th>
2973 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
2983 <input type=hidden name=nextsub value=doclose>
2985 <input type=submit class=submit name=action value="|
2986 . $locale->text('Continue') . qq|">
2994 $lxdebug->leave_sub();
2998 $lxdebug->enter_sub();
3000 AM->closebooks(\%myconfig, \%$form);
3002 if ($form->{revtrans}) {
3004 $locale->text('Transaction reversal enforced for all dates'));
3006 if ($form->{closedto}) {
3008 $locale->text('Transaction reversal enforced up to') . " "
3009 . $locale->date(\%myconfig, $form->{closedto}, 1));
3011 $form->redirect($locale->text('Books are open'));
3015 $lxdebug->leave_sub();
3019 $lxdebug->enter_sub();
3021 &{ $form->{nextsub} };
3023 $lxdebug->leave_sub();
3027 $lxdebug->enter_sub();
3029 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3030 AM->units_in_use(\%myconfig, $form, $units);
3031 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3033 @languages = AM->language(\%myconfig, $form, 1);
3035 @unit_list = sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } values(%{$units}));
3038 foreach (@unit_list) {
3039 $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"} * 1) if ($_->{"factor"});
3040 $_->{"UNITLANGUAGES"} = [];
3041 foreach my $lang (@languages) {
3042 push(@{ $_->{"UNITLANGUAGES"} },
3044 "unit" => $_->{"name"},
3045 "language_id" => $lang->{"id"},
3046 "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
3047 "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
3053 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3054 $ddbox = AM->unit_select_data($units, undef, 1);
3056 my $updownlink = build_std_url("action=swap_units", "unit_type");
3058 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3060 print($form->parse_html_template("am/edit_units",
3061 { "UNITS" => \@unit_list,
3062 "NEW_BASE_UNIT_DDBOX" => $ddbox,
3063 "LANGUAGES" => \@languages,
3064 "updownlink" => $updownlink }));
3066 $lxdebug->leave_sub();
3070 $lxdebug->enter_sub();
3072 $form->isblank("new_name", $locale->text("The name is missing."));
3073 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3074 $all_units = AM->retrieve_units(\%myconfig, $form);
3075 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
3077 my ($base_unit, $factor);
3078 if ($form->{"new_base_unit"}) {
3079 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3081 $form->isblank("new_factor", $locale->text("The factor is missing."));
3082 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3083 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3084 $base_unit = $form->{"new_base_unit"};
3088 foreach my $lang (AM->language(\%myconfig, $form, 1)) {
3089 next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
3090 push(@languages, { "id" => $lang->{"id"},
3091 "localized" => $form->{"new_localized_$lang->{id}"},
3092 "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
3096 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
3098 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3102 $lxdebug->leave_sub();
3105 sub set_unit_languages {
3106 $lxdebug->enter_sub();
3108 my ($unit, $languages, $idx) = @_;
3110 $unit->{"LANGUAGES"} = [];
3112 foreach my $lang (@{$languages}) {
3113 push(@{ $unit->{"LANGUAGES"} },
3114 { "id" => $lang->{"id"},
3115 "localized" => $form->{"localized_${idx}_$lang->{id}"},
3116 "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
3120 $lxdebug->leave_sub();
3124 $lxdebug->enter_sub();
3126 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3127 AM->units_in_use(\%myconfig, $form, $old_units);
3129 @languages = AM->language(\%myconfig, $form, 1);
3133 foreach $i (1..($form->{"rowcount"} * 1)) {
3134 $old_unit = $old_units->{$form->{"old_name_$i"}};
3136 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3139 if ($form->{"unchangeable_$i"}) {
3140 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3141 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3142 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3146 if ($old_unit->{"in_use"}) {
3147 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3150 if ($form->{"delete_$i"}) {
3151 push(@delete_units, $old_unit->{"name"});
3155 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3157 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3158 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3159 $new_units->{$form->{"name_$i"}} = \%h;
3160 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3161 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3164 foreach $unit (values(%{$new_units})) {
3165 next unless ($unit->{"old_name"});
3166 if ($unit->{"base_unit"}) {
3167 $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"}))
3168 unless (defined($new_units->{$unit->{"base_unit"}}));
3169 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3170 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3172 $unit->{"base_unit"} = undef;
3173 $unit->{"factor"} = undef;
3177 foreach $unit (values(%{$new_units})) {
3178 next if ($unit->{"unchanged_unit"});
3180 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3182 while ($new_unit->{"base_unit"}) {
3183 $new_unit->{"seen"} = 1;
3184 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3185 if ($new_unit->{"seen"}) {
3186 $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, " .
3187 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3192 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3194 $form->{"saved_message"} = $locale->text("The units have been saved.");
3198 $lxdebug->leave_sub();
3201 sub show_history_search {
3202 $lxdebug->enter_sub();
3204 $form->{title} = $locale->text("History Search");
3207 print $form->parse_html_template("/common/search_history");
3209 $lxdebug->leave_sub();
3212 sub show_am_history {
3213 $lxdebug->enter_sub();
3214 my %search = ( "Artikelnummer" => "parts",
3215 "Kundennummer" => "customer",
3216 "Lieferantennummer" => "vendor",
3217 "Projektnummer" => "project",
3218 "Buchungsnummer" => "oe",
3219 "Eingangsrechnungnummer" => "ap",
3220 "Ausgangsrechnungnummer" => "ar"
3222 my %searchNo = ( "Artikelnummer" => "partnumber",
3223 "Kundennummer" => "customernumber",
3224 "Lieferantennummer" => "vendornumber",
3225 "Projektnummer" => "projectnummer",
3226 "Buchungsnummer" => "ordnumber",
3227 "Eingangsrechnungnummer" => "invnumber",
3228 "Ausgangsrechnungnummer" => "invnumber"
3233 foreach(split(/\,/, $form->{einschraenkungen})) {
3235 $restriction .= " AND addition = '" . $_ . "'";
3239 $restriction .= " OR addition = '" . $_ . "'";
3243 $restriction .= (($form->{transdate} ne "" && $form->{reqdate} ne "")
3244 ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|' AND st.itime::date <= '| . $form->{reqdate} . qq|'|
3245 : (($form->{transdate} ne "" && $form->{reqdate} eq "")
3246 ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|'|
3247 : ($form->{transdate} eq "" && $form->{reqdate} ne "")
3248 ? qq| AND st.itime::date <= '| . $form->{reqdate} . qq|'|
3253 my $dbh = $form->dbconnect(\%myconfig);
3255 $restriction .= ($form->{mitarbeiter} eq "" ? ""
3256 : ($form->{mitarbeiter} =~ /^[0-9]*$/
3257 ? " AND employee_id = " . $form->{mitarbeiter}
3258 : " AND employee_id = " . &get_employee_id($form->{mitarbeiter}, $dbh)));
3260 my $query = qq|SELECT id FROM $search{$form->{what2search}}
3261 WHERE $searchNo{$form->{'what2search'}} ILIKE '$form->{"searchid"}'
3264 my $sth = $dbh->prepare($query);
3266 $sth->execute() || $form->dberror($query);
3268 $form->{title} = $locale->text("History Search");
3271 while(my $hash_ref = $sth->fetchrow_hashref()){
3272 print $form->parse_html_template("/common/show_history",
3273 {"DATEN" => $form->get_history($dbh,$hash_ref->{id},$restriction),
3274 "SUCCESS" => ($form->get_history($dbh,$hash_ref->{id},$restriction) != 0),
3275 "NONEWWINDOW" => "1"
3281 $lxdebug->leave_sub();
3284 sub get_employee_id {
3285 $lxdebug->enter_sub();
3286 my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|;
3287 my $sth = $_[1]->prepare($query);
3288 $sth->execute() || $form->dberror($query);
3289 my $return = $sth->fetch();
3291 return ${$return}[0];
3292 $lxdebug->leave_sub();
3296 $lxdebug->enter_sub();
3298 my $dir = $form->{"dir"} eq "down" ? "down" : "up";
3299 my $unit_type = $form->{"unit_type"} eq "dimension" ?
3300 "dimension" : "service";
3301 AM->swap_units(\%myconfig, $form, $dir, $form->{"name"}, $unit_type);
3305 $lxdebug->leave_sub();