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 { call_sub("add_$form->{type}"); }
48 sub delete { call_sub("delete_$form->{type}"); }
49 sub save { call_sub("save_$form->{type}"); }
50 sub edit { call_sub("edit_$form->{type}"); }
51 sub continue { call_sub($form->{"nextsub"}); }
54 $lxdebug->enter_sub();
56 $form->{title} = "Add";
57 $form->{charttype} = "A";
58 AM->get_account(\%myconfig, \%$form);
61 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
62 unless $form->{callback};
67 $lxdebug->leave_sub();
71 $lxdebug->enter_sub();
73 $form->{title} = "Edit";
74 AM->get_account(\%myconfig, \%$form);
76 foreach my $item (split(/:/, $form->{link})) {
77 $form->{$item} = "checked";
83 $lxdebug->leave_sub();
87 $lxdebug->enter_sub();
89 $form->{title} = $locale->text("$form->{title} Account");
91 $checked{ $form->{charttype} } = "checked";
92 $checked{"$form->{category}_"} = "checked";
93 $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
95 $form->{description} =~ s/\"/"/g;
97 if (@{ $form->{TAXKEY} }) {
98 foreach my $item (@{ $form->{TAXKEY} }) {
100 $item->{rate} = $item->{rate} * 100 . '%';
102 if ($item->{tax} == $form->{tax}) {
103 $form->{selecttaxkey} .=
104 "<option value=$item->{tax} selected>$item->{taxdescription} ($item->{rate})\n";
106 $form->{selecttaxkey} .=
107 "<option value=$item->{tax}>$item->{taxdescription} ($item->{rate})\n";
115 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
116 <td><select name=tax>$form->{selecttaxkey}</select></td>
117 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
118 <td><input name=startdate value="$form->{startdate}"></td>
121 if (@{ $form->{NEWACCOUNT} }) {
122 if (!$form->{new_chart_valid}) {
123 $form->{selectnewaccount} = "<option value=></option>";
125 foreach $item (@{ $form->{NEWACCOUNT} }) {
126 if ($item->{id} == $form->{new_chart_id}) {
127 $form->{selectnewaccount} .=
128 "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
129 } elsif (!$form->{new_chart_valid}) {
130 $form->{selectnewaccount} .=
131 "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
142 <th align=right>| . $locale->text('Folgekonto') . qq|</th>
143 <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
144 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
145 <td><input name=valid_from value="$form->{valid_from}"></td>
151 $form->{selectustva} = "<option>\n";
153 %ustva = (35 => $locale->text('UStVA-Nr. 35'),
154 36 => $locale->text('UStVA-Nr. 36'),
155 39 => $locale->text('UStVA-Nr. 39'),
156 41 => $locale->text('UStVA-Nr. 41'),
157 42 => $locale->text('UStVA-Nr. 42'),
158 43 => $locale->text('UStVA-Nr. 43'),
159 44 => $locale->text('UStVA-Nr. 44'),
160 45 => $locale->text('UStVA-Nr. 45'),
161 48 => $locale->text('UStVA-Nr. 48'),
162 49 => $locale->text('UStVA-Nr. 49'),
163 51 => $locale->text('UStVA-Nr. 51 left'),
164 511 => $locale->text('UStVA-Nr. 51 right'),
165 52 => $locale->text('UStVA-Nr. 52'),
166 53 => $locale->text('UStVA-Nr. 53'),
167 59 => $locale->text('UStVA-Nr. 59'),
168 60 => $locale->text('UStVA-Nr. 60'),
169 61 => $locale->text('UStVA-Nr. 61'),
170 62 => $locale->text('UStVA-Nr. 62'),
171 63 => $locale->text('UStVA-Nr. 63'),
172 64 => $locale->text('UStVA-Nr. 64'),
173 65 => $locale->text('UStVA-Nr. 65'),
174 66 => $locale->text('UStVA-Nr. 66'),
175 67 => $locale->text('UStVA-Nr. 67'),
176 69 => $locale->text('UStVA-Nr. 69'),
177 73 => $locale->text('UStVA-Nr. 73'),
178 74 => $locale->text('UStVA-Nr. 74'),
179 76 => $locale->text('UStVA-Nr. 76'),
180 77 => $locale->text('UStVA-Nr. 77'),
181 80 => $locale->text('UStVA-Nr. 80'),
182 81 => $locale->text('UStVA-Nr. 81 left'),
183 811 => $locale->text('UStVA-Nr. 81 right'),
184 84 => $locale->text('UStVA-Nr. 84'),
185 85 => $locale->text('UStVA-Nr. 85'),
186 86 => $locale->text('UStVA-Nr. 86 left'),
187 861 => $locale->text('UStVA-Nr. 86 right'),
188 89 => $locale->text('UStVA-Nr. 89 left'),
189 891 => $locale->text('UStVA-Nr. 89 right'),
190 91 => $locale->text('UStVA-Nr. 91'),
191 93 => $locale->text('UStVA-Nr. 93 left'),
192 931 => $locale->text('UStVA-Nr. 93 right'),
193 94 => $locale->text('UStVA-Nr. 94'),
194 95 => $locale->text('UStVA-Nr. 95'),
195 96 => $locale->text('UStVA-Nr. 96'),
196 97 => $locale->text('UStVA-Nr. 97 links'),
197 971 => $locale->text('UStVA-Nr. 97 rechts'),
198 98 => $locale->text('UStVA-Nr. 98'));
200 foreach $item (sort({ $a cmp $b } keys %ustva)) {
201 if ($item == $form->{pos_ustva}) {
202 $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
204 $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
211 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
212 <td><select name=pos_ustva>$form->{selectustva}</select></td>
213 <input type=hidden name=selectustva value="$form->{selectustva}">
216 $form->{selecteur} = "<option>\n";
217 %eur = (1 => "Umsatzerlöse",
218 2 => "sonstige Erlöse",
219 3 => "Privatanteile",
221 5 => "Ausserordentliche Erträge",
222 6 => "Vereinnahmte Umsatzst.",
223 7 => "Umsatzsteuererstattungen",
224 8 => "Wareneingänge",
225 9 => "Löhne und Gehälter",
226 10 => "Gesetzl. sozialer Aufw.",
228 12 => "Gas, Strom, Wasser",
229 13 => "Instandhaltung",
230 14 => "Steuern, Versich., Beiträge",
232 16 => "Kfz-Versicherungen",
233 17 => "Sonst. Fahrtkosten",
234 18 => "Werbe- und Reisekosten",
235 19 => "Instandhaltung u. Werkzeuge",
236 20 => "Fachzeitschriften, Bücher",
237 21 => "Miete für Einrichtungen",
238 22 => "Rechts- und Beratungskosten",
239 23 => "Bürobedarf, Porto, Telefon",
240 24 => "Sonstige Aufwendungen",
241 25 => "Abschreibungen auf Anlagever.",
242 26 => "Abschreibungen auf GWG",
244 28 => "Umsatzsteuerzahlungen",
246 30 => "Ausserordentlicher Aufwand",
247 31 => "Betriebliche Steuern");
248 foreach $item (sort({ $a <=> $b } keys(%eur))) {
249 if ($item == $form->{pos_eur}) {
250 $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
252 $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
259 <th align=right>| . $locale->text('EUER') . qq|</th>
260 <td><select name=pos_eur>$form->{selecteur}</select></td>
261 <input type=hidden name=selecteur value="$form->{selecteur}">
264 $form->{selectbwa} = "<option>\n";
266 %bwapos = (1 => 'Umsatzerlöse',
267 2 => 'Best.Verdg.FE/UE',
268 3 => 'Aktiv.Eigenleistung',
269 4 => 'Mat./Wareneinkauf',
270 5 => 'So.betr.Erlöse',
271 10 => 'Personalkosten',
273 12 => 'Betriebl.Steuern',
274 13 => 'Vers./Beiträge',
275 14 => 'Kfz.Kosten o.St.',
276 15 => 'Werbe-Reisek.',
277 16 => 'Kosten Warenabgabe',
278 17 => 'Abschreibungen',
279 18 => 'Rep./instandhlt.',
280 19 => 'Übrige Steuern',
281 20 => 'Sonst.Kosten',
283 31 => 'Sonst.neutr.Aufw.',
285 33 => 'Sonst.neutr.Ertrag',
286 34 => 'Verr.kalk.Kosten',
287 35 => 'Steuern Eink.u.Ertr.');
288 foreach $item (sort({ $a <=> $b } keys %bwapos)) {
289 if ($item == $form->{pos_bwa}) {
290 $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
292 $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
299 <th align=right>| . $locale->text('BWA') . qq|</th>
300 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
301 <input type=hidden name=selectbwa value="$form->{selectbwa}">
304 # Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
305 # $form->{selectbilanz} = "<option>\n";
306 # foreach $item ((1, 2, 3, 4)) {
307 # if ($item == $form->{pos_bilanz}) {
308 # $form->{selectbilanz} .= "<option value=$item selected>$item\n";
310 # $form->{selectbilanz} .= "<option value=$item>$item\n";
317 # <th align=right>| . $locale->text('Bilanz') . qq|</th>
318 # <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
319 # <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
322 # this is for our parser only!
323 # type=submit $locale->text('Add Account')
324 # type=submit $locale->text('Edit Account')
325 $form->{type} = "account";
332 <form method=post action=$form->{script}>
334 <input type=hidden name=id value=$form->{id}>
335 <input type=hidden name=type value=account>
336 <input type=hidden name=orphaned value=$form->{orphaned}>
337 <input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
339 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
340 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
341 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
342 <input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
343 <input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
345 <table border=0 width=100%>
347 <th class=listtop>$form->{title}</th>
354 <th align=right>| . $locale->text('Account Number') . qq|</th>
355 <td><input name=accno size=20 value=$form->{accno}></td>
358 <th align=right>| . $locale->text('Description') . qq|</th>
359 <td><input name=description size=40 value="$form->{description}"></td>
362 <th align=right>| . $locale->text('Account Type') . qq|</th>
366 <td><input name=category type=radio class=radio value=A $checked{A_}> |
367 . $locale->text('Asset') . qq|\n<br>
368 <input name=category type=radio class=radio value=L $checked{L_}> |
369 . $locale->text('Liability') . qq|\n<br>
370 <input name=category type=radio class=radio value=Q $checked{Q_}> |
371 . $locale->text('Equity') . qq|\n<br>
372 <input name=category type=radio class=radio value=I $checked{I_}> |
373 . $locale->text('Revenue') . qq|\n<br>
374 <input name=category type=radio class=radio value=E $checked{E_}> |
375 . $locale->text('Expense') . qq|<br>
376 <input name=category type=radio class=radio value=C $checked{C_}> |
377 . $locale->text('Costs') . qq|</td>
378 <td width=50> </td>
380 <input name=charttype type=radio class=radio value="H" $checked{H}> |
381 . $locale->text('Heading') . qq|<br>
382 <input name=charttype type=radio class=radio value="A" $checked{A}> |
383 . $locale->text('Account') . qq|</td>
390 if ($form->{charttype} eq "A") {
397 . $locale->text('Is this a summary account to record') . qq|</th>
399 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
400 . $locale->text('AR')
401 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
402 . $locale->text('AP')
403 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
404 . $locale->text('Inventory')
411 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
417 <th align=left>| . $locale->text('Receivables') . qq|</th>
418 <th align=left>| . $locale->text('Payables') . qq|</th>
419 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
420 <th align=left>| . $locale->text('Service Items') . qq|</th>
424 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
425 . $locale->text('Revenue') . qq|\n<br>
426 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
427 . $locale->text('Receipt') . qq|\n<br>
428 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
429 . $locale->text('Tax') . qq|
432 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
433 . $locale->text('Expense/Asset') . qq|\n<br>
434 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
435 . $locale->text('Payment') . qq|\n<br>
436 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
437 . $locale->text('Tax') . qq|
440 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
441 . $locale->text('Revenue') . qq|\n<br>
442 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
443 . $locale->text('Expense') . qq|\n<br>
444 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
445 . $locale->text('Tax') . qq|
448 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
449 . $locale->text('Revenue') . qq|\n<br>
450 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
451 . $locale->text('Expense') . qq|\n<br>
452 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
453 . $locale->text('Tax') . qq|
473 <td><hr size=3 noshade></td>
478 $lxdebug->leave_sub();
482 $lxdebug->enter_sub();
486 <input name=callback type=hidden value="$form->{callback}">
488 <input type=hidden name=path value=$form->{path}>
489 <input type=hidden name=login value=$form->{login}>
490 <input type=hidden name=password value=$form->{password}>
493 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
495 <input type=submit class=submit name=action value="|
496 . $locale->text('Save') . qq|">
500 if ($form->{id} && $form->{orphaned}) {
501 print qq|<input type=submit class=submit name=action value="|
502 . $locale->text('Delete') . qq|">|;
512 $lxdebug->leave_sub();
516 $lxdebug->enter_sub();
518 $form->isblank("accno", $locale->text('Account Number missing!'));
519 $form->isblank("category", $locale->text('Account Type missing!'));
521 $form->redirect($locale->text('Account saved!'))
522 if (AM->save_account(\%myconfig, \%$form));
523 $form->error($locale->text('Cannot save account!'));
525 $lxdebug->leave_sub();
529 $lxdebug->enter_sub();
531 CA->all_accounts(\%myconfig, \%$form);
533 $form->{title} = $locale->text('Chart of Accounts');
537 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
542 $callback = $form->escape($callback);
544 foreach $ca (@{ $form->{CA} }) {
546 $ca->{debit} = " ";
547 $ca->{credit} = " ";
549 if ($ca->{amount} > 0) {
551 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
553 if ($ca->{amount} < 0) {
555 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
558 my @links = split( q{:}, $ca->{link});
562 foreach my $link (@links){
563 $link = ( $link eq 'AR') ? $locale->text('Account Link AR')
564 : ( $link eq 'AP') ? $locale->text('Account Link AP')
565 : ( $link eq 'IC') ? $locale->text('Account Link IC')
566 : ( $link eq 'AR_amount' ) ? $locale->text('Account Link AR_amount')
567 : ( $link eq 'AR_paid' ) ? $locale->text('Account Link AR_paid')
568 : ( $link eq 'AR_tax' ) ? $locale->text('Account Link AR_tax')
569 : ( $link eq 'AP_amount' ) ? $locale->text('Account Link AP_amount')
570 : ( $link eq 'AP_paid' ) ? $locale->text('Account Link AP_paid')
571 : ( $link eq 'AP_tax' ) ? $locale->text('Account Link AP_tax')
572 : ( $link eq 'IC_sale' ) ? $locale->text('Account Link IC_sale')
573 : ( $link eq 'IC_cogs' ) ? $locale->text('Account Link IC_cogs')
574 : ( $link eq 'IC_taxpart' ) ? $locale->text('Account Link IC_taxpart')
575 : ( $link eq 'IC_income' ) ? $locale->text('Account Link IC_income')
576 : ( $link eq 'IC_expense' ) ? $locale->text('Account Link IC_expense')
577 : ( $link eq 'IC_taxservice' ) ? $locale->text('Account Link IC_taxservice')
578 : ( $link eq 'CT_tax' ) ? $locale->text('Account Link CT_tax')
579 : $locale->text('Unknown Link') . ': ' . $link;
581 $ca->{link} .= qq|[| . $link . qq|] |;
584 $ca->{startdate} =~ s/,/<br>/og;
585 $ca->{tk_ustva} =~ s/,/<br>/og;
586 $ca->{taxkey} =~ s/,/<br>/og;
587 $ca->{taxaccount} =~ s/,/<br>/og;
588 $ca->{taxdescription} =~ s/,/<br>/og;
589 $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):q{};
591 $ca->{category} = ($ca->{category} eq 'A') ? $locale->text('Account Category A')
592 : ($ca->{category} eq 'E') ? $locale->text('Account Category E')
593 : ($ca->{category} eq 'L') ? $locale->text('Account Category L')
594 : ($ca->{category} eq 'I') ? $locale->text('Account Category I')
595 : ($ca->{category} eq 'Q') ? $locale->text('Account Category Q')
596 : ($ca->{category} eq 'C') ? $locale->text('Account Category C')
597 : ($ca->{category} eq 'G') ? $locale->text('Account Category G')
598 : $locale->text('Unknown Category') . ': ' . $ca->{category};
600 $ca->{link_edit_account} =
601 qq|$form->{script}?action=edit_account&id=$ca->{id}|
602 .qq|&path=$form->{path}&login=$form->{login}|
603 .qq|&password=$form->{password}&callback=$callback|;
606 my $parameters_ref = {
609 # hidden_variables => $_hidden_variables_ref,
612 # Ausgabe des Templates
613 print($form->parse_html_template('am/list_accounts', $parameters_ref));
615 $lxdebug->leave_sub();
621 $lxdebug->enter_sub();
623 $form->{title} = $locale->text('Delete Account');
626 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
628 if ($form->{id} == $form->{$id}) {
629 $form->error($locale->text('Cannot delete default account!'));
633 $form->redirect($locale->text('Account deleted!'))
634 if (AM->delete_account(\%myconfig, \%$form));
635 $form->error($locale->text('Cannot delete account!'));
637 $lxdebug->leave_sub();
641 $lxdebug->enter_sub();
643 $form->{title} = "Add";
647 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
648 unless $form->{callback};
653 $lxdebug->leave_sub();
656 sub edit_department {
657 $lxdebug->enter_sub();
659 $form->{title} = "Edit";
661 AM->get_department(\%myconfig, \%$form);
666 $lxdebug->leave_sub();
669 sub list_department {
670 $lxdebug->enter_sub();
672 AM->departments(\%myconfig, \%$form);
675 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
677 $callback = $form->escape($form->{callback});
679 $form->{title} = $locale->text('Departments');
681 @column_index = qw(description cost profit);
683 $column_header{description} =
684 qq|<th class=listheading width=90%>|
685 . $locale->text('Description')
687 $column_header{cost} =
688 qq|<th class=listheading nowrap>|
689 . $locale->text('Cost Center')
691 $column_header{profit} =
692 qq|<th class=listheading nowrap>|
693 . $locale->text('Profit Center')
703 <th class=listtop>$form->{title}</th>
709 <tr class=listheading>
712 map { print "$column_header{$_}\n" } @column_index;
718 foreach $ref (@{ $form->{ALL} }) {
724 <tr valign=top class=listrow$i>
727 $costcenter = ($ref->{role} eq "C") ? "X" : "";
728 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
730 $column_data{description} =
731 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>|;
732 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
733 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
735 map { print "$column_data{$_}\n" } @column_index;
747 <td><hr size=3 noshade></td>
752 <form method=post action=$form->{script}>
754 <input name=callback type=hidden value="$form->{callback}">
756 <input type=hidden name=type value=department>
758 <input type=hidden name=path value=$form->{path}>
759 <input type=hidden name=login value=$form->{login}>
760 <input type=hidden name=password value=$form->{password}>
762 <input class=submit type=submit name=action value="|
763 . $locale->text('Add') . qq|">
771 $lxdebug->leave_sub();
774 sub department_header {
775 $lxdebug->enter_sub();
777 $form->{title} = $locale->text("$form->{title} Department");
779 # $locale->text('Add Department')
780 # $locale->text('Edit Department')
782 $form->{description} =~ s/\"/"/g;
784 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
786 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
789 qq|<input name=description size=60 value="$form->{description}">|;
792 $costcenter = "checked" if $form->{role} eq "C";
793 $profitcenter = "checked" if $form->{role} eq "P";
800 <form method=post action=$form->{script}>
802 <input type=hidden name=id value=$form->{id}>
803 <input type=hidden name=type value=department>
807 <th class=listtop colspan=2>$form->{title}</th>
811 <th align=right>| . $locale->text('Description') . qq|</th>
812 <td>$description</td>
816 <td><input type=radio style=radio name=role value="C" $costcenter> |
817 . $locale->text('Cost Center') . qq|
818 <input type=radio style=radio name=role value="P" $profitcenter> |
819 . $locale->text('Profit Center') . qq|
822 <td colspan=2><hr size=3 noshade></td>
827 $lxdebug->leave_sub();
830 sub save_department {
831 $lxdebug->enter_sub();
833 $form->isblank("description", $locale->text('Description missing!'));
834 AM->save_department(\%myconfig, \%$form);
835 $form->redirect($locale->text('Department saved!'));
837 $lxdebug->leave_sub();
840 sub delete_department {
841 $lxdebug->enter_sub();
843 AM->delete_department(\%myconfig, \%$form);
844 $form->redirect($locale->text('Department deleted!'));
846 $lxdebug->leave_sub();
850 $lxdebug->enter_sub();
852 $form->{title} = "Add";
855 "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
856 unless $form->{callback};
861 $lxdebug->leave_sub();
865 $lxdebug->enter_sub();
867 $form->{title} = "Edit";
869 AM->get_lead(\%myconfig, \%$form);
873 $form->{orphaned} = 1;
876 $lxdebug->leave_sub();
880 $lxdebug->enter_sub();
882 AM->lead(\%myconfig, \%$form);
885 "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
887 $callback = $form->escape($form->{callback});
889 $form->{title} = $locale->text('Lead');
891 @column_index = qw(description cost profit);
893 $column_header{description} =
894 qq|<th class=listheading width=100%>|
895 . $locale->text('Description')
905 <th class=listtop>$form->{title}</th>
908 <tr class=listheading>
911 map { print "$column_header{$_}\n" } @column_index;
917 foreach $ref (@{ $form->{ALL} }) {
923 <tr valign=top class=listrow$i>
926 $lead = $ref->{lead};
928 $column_data{description} =
929 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>|;
931 map { print "$column_data{$_}\n" } @column_index;
940 <td><hr size=3 noshade></td>
945 <form method=post action=$form->{script}>
947 <input name=callback type=hidden value="$form->{callback}">
949 <input type=hidden name=type value=lead>
951 <input type=hidden name=path value=$form->{path}>
952 <input type=hidden name=login value=$form->{login}>
953 <input type=hidden name=password value=$form->{password}>
955 <input class=submit type=submit name=action value="|
956 . $locale->text('Add') . qq|">
964 $lxdebug->leave_sub();
968 $lxdebug->enter_sub();
970 $form->{title} = $locale->text("$form->{title} Lead");
972 # $locale->text('Add Lead')
973 # $locale->text('Edit Lead')
975 $form->{description} =~ s/\"/"/g;
978 qq|<input name=description size=50 value="$form->{lead}">|;
985 <form method=post action=$form->{script}>
987 <input type=hidden name=id value=$form->{id}>
988 <input type=hidden name=type value=lead>
992 <th class=listtop colspan=2>$form->{title}</th>
996 <th align=right>| . $locale->text('Description') . qq|</th>
997 <td>$description</td>
999 <td colspan=2><hr size=3 noshade></td>
1004 $lxdebug->leave_sub();
1008 $lxdebug->enter_sub();
1010 $form->isblank("description", $locale->text('Description missing!'));
1011 AM->save_lead(\%myconfig, \%$form);
1012 $form->redirect($locale->text('lead saved!'));
1014 $lxdebug->leave_sub();
1018 $lxdebug->enter_sub();
1020 AM->delete_lead(\%myconfig, \%$form);
1021 $form->redirect($locale->text('lead deleted!'));
1023 $lxdebug->leave_sub();
1027 $lxdebug->enter_sub();
1029 $form->{title} = "Add";
1032 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1033 unless $form->{callback};
1038 $lxdebug->leave_sub();
1042 $lxdebug->enter_sub();
1044 $form->{title} = "Edit";
1046 AM->get_business(\%myconfig, \%$form);
1050 $form->{orphaned} = 1;
1053 $lxdebug->leave_sub();
1057 $lxdebug->enter_sub();
1059 AM->business(\%myconfig, \%$form);
1062 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1064 $callback = $form->escape($form->{callback});
1066 $form->{title} = $locale->text('Type of Business');
1068 @column_index = qw(description discount customernumberinit);
1070 $column_header{description} =
1071 qq|<th class=listheading width=60%>|
1072 . $locale->text('Description')
1074 $column_header{discount} =
1075 qq|<th class=listheading width=10%>|
1076 . $locale->text('Discount')
1078 $column_header{customernumberinit} =
1079 qq|<th class=listheading>|
1080 . $locale->text('Customernumberinit')
1090 <th class=listtop>$form->{title}</th>
1092 <tr height="5"></tr>
1096 <tr class=listheading>
1099 map { print "$column_header{$_}\n" } @column_index;
1105 foreach $ref (@{ $form->{ALL} }) {
1111 <tr valign=top class=listrow$i>
1115 $form->format_amount(\%myconfig, $ref->{discount} * 100);
1117 $ref->{description};
1118 $column_data{description} =
1119 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>|;
1120 $column_data{discount} = qq|<td align=right>$discount</td>|;
1121 $column_data{customernumberinit} =
1122 qq|<td align=right>$ref->{customernumberinit}</td>|;
1124 map { print "$column_data{$_}\n" } @column_index;
1136 <td><hr size=3 noshade></td>
1141 <form method=post action=$form->{script}>
1143 <input name=callback type=hidden value="$form->{callback}">
1145 <input type=hidden name=type value=business>
1147 <input type=hidden name=path value=$form->{path}>
1148 <input type=hidden name=login value=$form->{login}>
1149 <input type=hidden name=password value=$form->{password}>
1151 <input class=submit type=submit name=action value="|
1152 . $locale->text('Add') . qq|">
1160 $lxdebug->leave_sub();
1163 sub business_header {
1164 $lxdebug->enter_sub();
1166 $form->{title} = $locale->text("$form->{title} Business");
1168 # $locale->text('Add Business')
1169 # $locale->text('Edit Business')
1171 $form->{description} =~ s/\"/"/g;
1173 $form->format_amount(\%myconfig, $form->{discount} * 100);
1180 <form method=post action=$form->{script}>
1182 <input type=hidden name=id value=$form->{id}>
1183 <input type=hidden name=type value=business>
1187 <th class=listtop colspan=2>$form->{title}</th>
1189 <tr height="5"></tr>
1191 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1192 <td><input name=description size=30 value="$form->{description}"></td>
1195 <th align=right>| . $locale->text('Discount') . qq| %</th>
1196 <td><input name=discount size=5 value=$form->{discount}></td>
1199 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1200 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1202 <td colspan=2><hr size=3 noshade></td>
1207 $lxdebug->leave_sub();
1211 $lxdebug->enter_sub();
1213 $form->isblank("description", $locale->text('Description missing!'));
1214 $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100;
1215 AM->save_business(\%myconfig, \%$form);
1216 $form->redirect($locale->text('Business saved!'));
1218 $lxdebug->leave_sub();
1221 sub delete_business {
1222 $lxdebug->enter_sub();
1224 AM->delete_business(\%myconfig, \%$form);
1225 $form->redirect($locale->text('Business deleted!'));
1227 $lxdebug->leave_sub();
1231 $lxdebug->enter_sub();
1233 $form->{title} = "Add";
1236 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1237 unless $form->{callback};
1242 $lxdebug->leave_sub();
1246 $lxdebug->enter_sub();
1248 $form->{title} = "Edit";
1250 AM->get_language(\%myconfig, \%$form);
1254 $form->{orphaned} = 1;
1257 $lxdebug->leave_sub();
1261 $lxdebug->enter_sub();
1263 AM->language(\%myconfig, \%$form);
1266 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1268 $callback = $form->escape($form->{callback});
1270 $form->{title} = $locale->text('Languages');
1272 @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
1274 $column_header{description} =
1275 qq|<th class=listheading width=60%>|
1276 . $locale->text('Description')
1278 $column_header{template_code} =
1279 qq|<th class=listheading width=10%>|
1280 . $locale->text('Template Code')
1282 $column_header{article_code} =
1283 qq|<th class=listheading>|
1284 . $locale->text('Article Code')
1286 $column_header{output_numberformat} =
1287 qq|<th class=listheading>|
1288 . $locale->text('Number Format')
1290 $column_header{output_dateformat} =
1291 qq|<th class=listheading>|
1292 . $locale->text('Date Format')
1294 $column_header{output_longdates} =
1295 qq|<th class=listheading>|
1296 . $locale->text('Long Dates')
1306 <th class=listtop>$form->{title}</th>
1308 <tr height="5"></tr>
1312 <tr class=listheading>
1315 map { print "$column_header{$_}\n" } @column_index;
1321 foreach $ref (@{ $form->{ALL} }) {
1327 <tr valign=top class=listrow$i>
1331 $column_data{description} =
1332 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>|;
1333 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1334 $column_data{article_code} =
1335 qq|<td align=right>$ref->{article_code}</td>|;
1336 $column_data{output_numberformat} =
1338 ($ref->{output_numberformat} ? $ref->{output_numberformat} :
1339 $locale->text("use program settings")) .
1341 $column_data{output_dateformat} =
1343 ($ref->{output_dateformat} ? $ref->{output_dateformat} :
1344 $locale->text("use program settings")) .
1346 $column_data{output_longdates} =
1348 ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
1351 map { print "$column_data{$_}\n" } @column_index;
1363 <td><hr size=3 noshade></td>
1368 <form method=post action=$form->{script}>
1370 <input name=callback type=hidden value="$form->{callback}">
1372 <input type=hidden name=type value=language>
1374 <input type=hidden name=path value=$form->{path}>
1375 <input type=hidden name=login value=$form->{login}>
1376 <input type=hidden name=password value=$form->{password}>
1378 <input class=submit type=submit name=action value="|
1379 . $locale->text('Add') . qq|">
1387 $lxdebug->leave_sub();
1390 sub language_header {
1391 $lxdebug->enter_sub();
1393 $form->{title} = $locale->text("$form->{title} Language");
1395 # $locale->text('Add Language')
1396 # $locale->text('Edit Language')
1398 $form->{description} =~ s/\"/"/g;
1399 $form->{template_code} =~ s/\"/"/g;
1400 $form->{article_code} =~ s/\"/"/g;
1406 qq|<option value="">| . $locale->text("use program settings") .
1408 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1410 ($item eq $form->{output_numberformat})
1411 ? "<option selected>$item"
1417 qq|<option value="">| . $locale->text("use program settings") .
1419 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1421 ($item eq $form->{output_dateformat})
1422 ? "<option selected>$item"
1430 <form method=post action=$form->{script}>
1432 <input type=hidden name=id value=$form->{id}>
1433 <input type=hidden name=type value=language>
1437 <th class=listtop colspan=2>$form->{title}</th>
1439 <tr height="5"></tr>
1441 <th align=right>| . $locale->text('Language') . qq|</th>
1442 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1445 <th align=right>| . $locale->text('Template Code') . qq|</th>
1446 <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
1449 <th align=right>| . $locale->text('Article Code') . qq|</th>
1450 <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
1453 <th align=right>| . $locale->text('Number Format') . qq|</th>
1454 <td><select name="output_numberformat">$numberformat</select></td>
1457 <th align=right>| . $locale->text('Date Format') . qq|</th>
1458 <td><select name="output_dateformat">$dateformat</select></td>
1461 <th align=right>| . $locale->text('Long Dates') . qq|</th>
1462 <td><input type="radio" name="output_longdates" value="1"| .
1463 ($form->{output_longdates} ? " checked" : "") .
1464 qq|>| . $locale->text("Yes") .
1465 qq|<input type="radio" name="output_longdates" value="0"| .
1466 ($form->{output_longdates} ? "" : " checked") .
1467 qq|>| . $locale->text("No") .
1470 <td colspan=2><hr size=3 noshade></td>
1475 $lxdebug->leave_sub();
1479 $lxdebug->enter_sub();
1481 $form->isblank("description", $locale->text('Language missing!'));
1482 $form->isblank("template_code", $locale->text('Template Code missing!'));
1483 $form->isblank("article_code", $locale->text('Article Code missing!'));
1484 AM->save_language(\%myconfig, \%$form);
1485 $form->redirect($locale->text('Language saved!'));
1487 $lxdebug->leave_sub();
1490 sub delete_language {
1491 $lxdebug->enter_sub();
1493 AM->delete_language(\%myconfig, \%$form);
1494 $form->redirect($locale->text('Language deleted!'));
1496 $lxdebug->leave_sub();
1500 sub add_buchungsgruppe {
1501 $lxdebug->enter_sub();
1503 # $locale->text("Add Buchungsgruppe")
1504 # $locale->text("Edit Buchungsgruppe")
1505 $form->{title} = "Add";
1508 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1509 unless $form->{callback};
1510 AM->get_buchungsgruppe(\%myconfig, \%$form);
1511 $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
1512 for (my $i = 0; 4 > $i; $i++) {
1513 map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; }
1514 qw(income expense));
1517 &buchungsgruppe_header;
1520 $lxdebug->leave_sub();
1523 sub edit_buchungsgruppe {
1524 $lxdebug->enter_sub();
1526 $form->{title} = "Edit";
1528 AM->get_buchungsgruppe(\%myconfig, \%$form);
1530 &buchungsgruppe_header;
1534 $lxdebug->leave_sub();
1537 sub list_buchungsgruppe {
1538 $lxdebug->enter_sub();
1540 AM->buchungsgruppe(\%myconfig, \%$form);
1543 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1545 $callback = $form->escape($form->{callback});
1547 $form->{title} = $locale->text('Buchungsgruppen');
1549 @column_index = qw(up down description inventory_accno
1550 income_accno_0 expense_accno_0
1551 income_accno_1 expense_accno_1
1552 income_accno_2 expense_accno_2
1553 income_accno_3 expense_accno_3 );
1555 $column_header{up} =
1556 qq|<th class="listheading" width="16">|
1557 . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
1559 $column_header{down} =
1560 qq|<th class="listheading" width="16">|
1561 . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
1563 $column_header{description} =
1564 qq|<th class="listheading" width="40%">|
1565 . $locale->text('Description')
1567 $column_header{inventory_accno} =
1568 qq|<th class=listheading>|
1569 . $locale->text('Bestandskonto')
1571 $column_header{income_accno_0} =
1572 qq|<th class=listheading>|
1573 . $locale->text('Erlöse Inland')
1575 $column_header{expense_accno_0} =
1576 qq|<th class=listheading>|
1577 . $locale->text('Aufwand Inland')
1579 $column_header{income_accno_1} =
1580 qq|<th class=listheading>|
1581 . $locale->text('Erlöse EU m. UStId')
1583 $column_header{expense_accno_1} =
1584 qq|<th class=listheading>|
1585 . $locale->text('Aufwand EU m. UStId')
1587 $column_header{income_accno_2} =
1588 qq|<th class=listheading>|
1589 . $locale->text('Erlöse EU o. UStId')
1591 $column_header{expense_accno_2} =
1592 qq|<th class=listheading>|
1593 . $locale->text('Aufwand EU o. UStId')
1595 $column_header{income_accno_3} =
1596 qq|<th class=listheading>|
1597 . $locale->text('Erlöse Ausland')
1599 $column_header{expense_accno_3} =
1600 qq|<th class=listheading>|
1601 . $locale->text('Aufwand Ausland')
1610 <th class=listtop>$form->{title}</th>
1612 <tr height="5"></tr>
1616 <tr class=listheading>
1619 map { print "$column_header{$_}\n" } @column_index;
1625 my $swap_link = qq|$form->{script}?action=swap_buchungsgruppen&|;
1626 map({ $swap_link .= $_ . "=" . $form->escape($form->{$_}) . "&" }
1627 qw(login password path));
1630 foreach $ref (@{ $form->{ALL} }) {
1636 <tr valign=top class=listrow$i>
1640 my $pref = $form->{ALL}->[$row - 1];
1642 qq|<td align="center" valign="center" width="16">| .
1643 qq|<a href="${swap_link}id1=$ref->{id}&id2=$pref->{id}">| .
1644 qq|<img border="0" src="image/up.png" alt="| . $locale->text("up") . qq|">| .
1647 $column_data{up} = qq|<td width="16"> </td>|;
1650 if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
1651 $column_data{down} = qq|<td width="16"> </td>|;
1653 my $nref = $form->{ALL}->[$row + 1];
1654 $column_data{down} =
1655 qq|<td align="center" valign="center" width="16">| .
1656 qq|<a href="${swap_link}id1=$ref->{id}&id2=$nref->{id}">| .
1657 qq|<img border="0" src="image/down.png" alt="| . $locale->text("down") . qq|">| .
1661 $column_data{description} =
1662 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>|;
1663 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1664 $column_data{income_accno_0} =
1665 qq|<td align=right>$ref->{income_accno_0}</td>|;
1666 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1667 $column_data{income_accno_1} =
1668 qq|<td align=right>$ref->{income_accno_1}</td>|;
1669 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1670 $column_data{income_accno_2} =
1671 qq|<td align=right>$ref->{income_accno_2}</td>|;
1672 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1673 $column_data{income_accno_3} =
1674 qq|<td align=right>$ref->{income_accno_3}</td>|;
1675 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1677 map { print "$column_data{$_}\n" } @column_index;
1691 <td><hr size=3 noshade></td>
1696 <form method=post action=$form->{script}>
1698 <input name=callback type=hidden value="$form->{callback}">
1700 <input type=hidden name=type value=buchungsgruppe>
1702 <input type=hidden name=path value=$form->{path}>
1703 <input type=hidden name=login value=$form->{login}>
1704 <input type=hidden name=password value=$form->{password}>
1706 <input class=submit type=submit name=action value="|
1707 . $locale->text('Add') . qq|">
1715 $lxdebug->leave_sub();
1718 sub buchungsgruppe_header {
1719 $lxdebug->enter_sub();
1721 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1723 # $locale->text('Buchungsgruppe hinzufügen')
1724 # $locale->text('Buchungsgruppe bearbeiten')
1726 my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
1727 my %acc_type_map = (
1728 "IC" => $acc_inventory,
1729 "IC_income" => $acc_income,
1730 "IC_sale" => $acc_income,
1731 "IC_expense" => $acc_expense,
1732 "IC_cogs" => $acc_expense,
1735 foreach $key (keys(%acc_type_map)) {
1736 foreach $ref (@{ $form->{IC_links}{$key} }) {
1737 $acc_type_map{$key}->{$ref->{"id"}} = $ref;
1741 foreach my $type (qw(IC IC_income IC_expense)) {
1742 $form->{"select$type"} =
1744 map({ "<option value=$_->{id} $_->{selected}>" .
1745 "$_->{accno}--" . H($_->{description}) . "</option>" }
1746 sort({ $a->{"accno"} cmp $b->{"accno"} }
1747 values(%{$acc_type_map{$type}}))));
1751 $form->{selectIC} =~ s/selected//g;
1752 $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/;
1753 $form->{selectIC_income} =~ s/selected//g;
1754 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1755 $form->{selectIC_expense} =~ s/selected//g;
1756 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1762 <th align=right>| . $locale->text('Inventory') . qq|</th>
1763 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1764 <input name=selectIC type=hidden value="$form->{selectIC}">
1768 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
1772 $linkaccounts .= qq|
1774 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
1775 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
1778 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
1779 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
1782 $form->{selectIC_income} =~ s/selected//g;
1783 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
1784 $form->{selectIC_expense} =~ s/selected//g;
1785 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
1787 $linkaccounts .= qq| <tr>
1788 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
1789 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
1792 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
1793 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
1797 $form->{selectIC_income} =~ s/selected//g;
1798 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
1799 $form->{selectIC_expense} =~ s/selected//g;
1800 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
1803 $linkaccounts .= qq| <tr>
1804 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
1805 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
1808 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
1809 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
1813 $form->{selectIC_income} =~ s/selected//g;
1814 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
1815 $form->{selectIC_expense} =~ s/selected//g;
1816 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
1819 $linkaccounts .= qq| <tr>
1820 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
1821 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
1824 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
1825 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
1835 <form method=post action=$form->{script}>
1837 <input type=hidden name=id value=$form->{id}>
1838 <input type=hidden name=type value=buchungsgruppe>
1842 <th class=listtop colspan=2>$form->{title}</th>
1844 <tr height="5"></tr>
1846 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
1847 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1850 <td colspan=2><hr size=3 noshade></td>
1855 $lxdebug->leave_sub();
1858 sub save_buchungsgruppe {
1859 $lxdebug->enter_sub();
1861 $form->isblank("description", $locale->text('Description missing!'));
1863 AM->save_buchungsgruppe(\%myconfig, \%$form);
1864 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
1866 $lxdebug->leave_sub();
1869 sub delete_buchungsgruppe {
1870 $lxdebug->enter_sub();
1872 AM->delete_buchungsgruppe(\%myconfig, \%$form);
1873 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
1875 $lxdebug->leave_sub();
1878 sub swap_buchungsgruppen {
1879 $lxdebug->enter_sub();
1881 AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen");
1882 list_buchungsgruppe();
1884 $lxdebug->leave_sub();
1889 $lxdebug->enter_sub();
1891 $form->{title} = "Add";
1894 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1895 unless $form->{callback};
1900 $lxdebug->leave_sub();
1904 $lxdebug->enter_sub();
1906 $form->{title} = "Edit";
1908 AM->get_printer(\%myconfig, \%$form);
1912 $form->{orphaned} = 1;
1915 $lxdebug->leave_sub();
1919 $lxdebug->enter_sub();
1921 AM->printer(\%myconfig, \%$form);
1924 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1926 $callback = $form->escape($form->{callback});
1928 $form->{title} = $locale->text('Printer');
1930 @column_index = qw(printer_description printer_command template_code);
1932 $column_header{printer_description} =
1933 qq|<th class=listheading width=60%>|
1934 . $locale->text('Printer Description')
1936 $column_header{printer_command} =
1937 qq|<th class=listheading width=10%>|
1938 . $locale->text('Printer Command')
1940 $column_header{template_code} =
1941 qq|<th class=listheading>|
1942 . $locale->text('Template Code')
1952 <th class=listtop>$form->{title}</th>
1954 <tr height="5"></tr>
1958 <tr class=listheading>
1961 map { print "$column_header{$_}\n" } @column_index;
1967 foreach $ref (@{ $form->{ALL} }) {
1973 <tr valign=top class=listrow$i>
1977 $column_data{printer_description} =
1978 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>|;
1979 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
1980 $column_data{template_code} =
1981 qq|<td align=right>$ref->{template_code}</td>|;
1983 map { print "$column_data{$_}\n" } @column_index;
1995 <td><hr size=3 noshade></td>
2000 <form method=post action=$form->{script}>
2002 <input name=callback type=hidden value="$form->{callback}">
2004 <input type=hidden name=type value=printer>
2006 <input type=hidden name=path value=$form->{path}>
2007 <input type=hidden name=login value=$form->{login}>
2008 <input type=hidden name=password value=$form->{password}>
2010 <input class=submit type=submit name=action value="|
2011 . $locale->text('Add') . qq|">
2019 $lxdebug->leave_sub();
2022 sub printer_header {
2023 $lxdebug->enter_sub();
2025 $form->{title} = $locale->text("$form->{title} Printer");
2027 # $locale->text('Add Printer')
2028 # $locale->text('Edit Printer')
2030 $form->{printer_description} =~ s/\"/"/g;
2031 $form->{template_code} =~ s/\"/"/g;
2032 $form->{printer_command} =~ s/\"/"/g;
2040 <form method=post action=$form->{script}>
2042 <input type=hidden name=id value=$form->{id}>
2043 <input type=hidden name=type value=printer>
2047 <th class=listtop colspan=2>$form->{title}</th>
2049 <tr height="5"></tr>
2051 <th align=right>| . $locale->text('Printer') . qq|</th>
2052 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2055 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2056 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2059 <th align=right>| . $locale->text('Template Code') . qq|</th>
2060 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2062 <td colspan=2><hr size=3 noshade></td>
2067 $lxdebug->leave_sub();
2071 $lxdebug->enter_sub();
2073 $form->isblank("printer_description", $locale->text('Description missing!'));
2074 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2075 AM->save_printer(\%myconfig, \%$form);
2076 $form->redirect($locale->text('Printer saved!'));
2078 $lxdebug->leave_sub();
2081 sub delete_printer {
2082 $lxdebug->enter_sub();
2084 AM->delete_printer(\%myconfig, \%$form);
2085 $form->redirect($locale->text('Printer deleted!'));
2087 $lxdebug->leave_sub();
2091 $lxdebug->enter_sub();
2093 $form->{title} = "Add";
2096 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2097 unless $form->{callback};
2099 $form->{terms_netto} = 0;
2100 $form->{terms_skonto} = 0;
2101 $form->{percent_skonto} = 0;
2102 my @languages = AM->language(\%myconfig, $form, 1);
2103 map({ $_->{"language"} = $_->{"description"};
2104 $_->{"language_id"} = $_->{"id"}; } @languages);
2105 $form->{"TRANSLATION"} = \@languages;
2109 $lxdebug->leave_sub();
2113 $lxdebug->enter_sub();
2115 $form->{title} = "Edit";
2117 AM->get_payment(\%myconfig, $form);
2118 $form->{percent_skonto} =
2119 $form->format_amount(\%myconfig, $form->{percent_skonto} * 100);
2123 $form->{orphaned} = 1;
2126 $lxdebug->leave_sub();
2130 $lxdebug->enter_sub();
2132 AM->payment(\%myconfig, \%$form);
2134 $form->{callback} = build_std_url("action=list_payment");
2136 $callback = $form->escape($form->{callback});
2138 $form->{title} = $locale->text('Payment Terms');
2140 @column_index = qw(up down description description_long terms_netto
2141 terms_skonto percent_skonto);
2143 $column_header{up} =
2144 qq|<th class="listheading" align="center" valign="center" width="16">|
2145 . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
2147 $column_header{down} =
2148 qq|<th class="listheading" align="center" valign="center" width="16">|
2149 . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
2151 $column_header{description} =
2152 qq|<th class=listheading>|
2153 . $locale->text('Description')
2155 $column_header{description_long} =
2156 qq|<th class=listheading>|
2157 . $locale->text('Long Description')
2159 $column_header{terms_netto} =
2160 qq|<th class=listheading>|
2161 . $locale->text('Netto Terms')
2163 $column_header{terms_skonto} =
2164 qq|<th class=listheading>|
2165 . $locale->text('Skonto Terms')
2167 $column_header{percent_skonto} =
2168 qq|<th class=listheading>|
2169 . $locale->text('Skonto')
2179 <th class=listtop>$form->{title}</th>
2181 <tr height="5"></tr>
2185 <tr class=listheading>
2188 map { print "$column_header{$_}\n" } @column_index;
2194 my $swap_link = build_std_url("action=swap_payment_terms");
2197 foreach $ref (@{ $form->{ALL} }) {
2203 <tr valign=top class=listrow$i>
2207 my $pref = $form->{ALL}->[$row - 1];
2209 qq|<td align="center" valign="center" width="16">| .
2210 qq|<a href="${swap_link}&id1=$ref->{id}&id2=$pref->{id}">| .
2211 qq|<img border="0" src="image/up.png" alt="| . $locale->text("up") . qq|">| .
2214 $column_data{up} = qq|<td width="16"> </td>|;
2217 if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
2218 $column_data{down} = qq|<td width="16"> </td>|;
2220 my $nref = $form->{ALL}->[$row + 1];
2221 $column_data{down} =
2222 qq|<td align="center" valign="center" width="16">| .
2223 qq|<a href="${swap_link}&id1=$ref->{id}&id2=$nref->{id}">| .
2224 qq|<img border="0" src="image/down.png" alt="| . $locale->text("down") . qq|">| .
2228 $column_data{description} =
2230 build_std_url("action=edit_payment", "id=$ref->{id}", "callback=$callback") .
2231 qq|">| . H($ref->{description}) . qq|</a></td>|;
2232 $column_data{description_long} =
2233 qq|<td>| . H($ref->{description_long}) . qq|</td>|;
2234 $column_data{terms_netto} =
2235 qq|<td align=right>$ref->{terms_netto}</td>|;
2236 $column_data{terms_skonto} =
2237 qq|<td align=right>$ref->{terms_skonto}</td>|;
2238 $column_data{percent_skonto} =
2239 qq|<td align=right>| .
2240 $form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) .
2242 map { print "$column_data{$_}\n" } @column_index;
2255 <td><hr size=3 noshade></td>
2260 <form method=post action=$form->{script}>
2262 <input name=callback type=hidden value="$form->{callback}">
2264 <input type=hidden name=type value=payment>
2266 <input type=hidden name=path value=$form->{path}>
2267 <input type=hidden name=login value=$form->{login}>
2268 <input type=hidden name=password value=$form->{password}>
2270 <input class=submit type=submit name=action value="|
2271 . $locale->text('Add') . qq|">
2279 $lxdebug->leave_sub();
2282 sub payment_header {
2283 $lxdebug->enter_sub();
2285 $form->{title} = $locale->text("$form->{title} Payment Terms");
2287 # $locale->text('Add Payment Terms')
2288 # $locale->text('Edit Payment Terms')
2290 $form->{description} =~ s/\"/"/g;
2299 <form method=post action=$form->{script}>
2301 <input type=hidden name=id value=$form->{id}>
2302 <input type=hidden name=type value=payment>
2306 <th class=listtop colspan=2>$form->{title}</th>
2308 <tr height="5"></tr>
2310 <th align=right>| . $locale->text('Description') . qq|</th>
2311 <td><input name=description size=30 value="$form->{description}"></td>
2314 <th align=right>| . $locale->text('Long Description') . qq|</th>
2315 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2319 foreach my $language (@{ $form->{"TRANSLATION"} }) {
2322 <th align="right">| .
2323 sprintf($locale->text('Translation (%s)'),
2324 $language->{"language"})
2326 <td><input name="description_long_$language->{language_id}" size="50"
2327 value="| . Q($language->{"description_long"}) . qq|"></td>
2334 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2335 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2338 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2339 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2342 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2343 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2345 <td colspan=2><hr size=3 noshade></td>
2349 <p>| . $locale->text("You can use the following strings in the long " .
2350 "description and all translations. They will be " .
2351 "replaced by their actual values by Lx-Office " .
2352 "before they're output.")
2356 <li>| . $locale->text("<%netto_date%> -- Date the payment is due in " .
2359 <li>| . $locale->text("<%skonto_date%> -- Date the payment is due " .
2362 <li>| . $locale->text("<%skonto_amount%> -- The deductible amount")
2364 <li>| . $locale->text("<%total%> -- Amount payable")
2366 <li>| . $locale->text("<%invtotal%> -- Invoice total")
2368 <li>| . $locale->text("<%currency%> -- The selected currency")
2370 <li>| . $locale->text("<%terms_netto%> -- The number of days for " .
2373 <li>| . $locale->text("<%account_number%> -- Your account number")
2375 <li>| . $locale->text("<%bank%> -- Your bank")
2377 <li>| . $locale->text("<%bank_code%> -- Your bank code")
2381 $lxdebug->leave_sub();
2385 $lxdebug->enter_sub();
2387 $form->isblank("description", $locale->text('Description missing!'));
2388 $form->{"percent_skonto"} =
2389 $form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100;
2390 AM->save_payment(\%myconfig, \%$form);
2391 $form->redirect($locale->text('Payment Terms saved!'));
2393 $lxdebug->leave_sub();
2396 sub delete_payment {
2397 $lxdebug->enter_sub();
2399 AM->delete_payment(\%myconfig, \%$form);
2400 $form->redirect($locale->text('Payment terms deleted!'));
2402 $lxdebug->leave_sub();
2405 sub swap_payment_terms {
2406 $lxdebug->enter_sub();
2408 AM->swap_sortkeys(\%myconfig, $form, "payment_terms");
2411 $lxdebug->leave_sub();
2415 $lxdebug->enter_sub();
2417 # get defaults for account numbers and last numbers
2418 AM->defaultaccounts(\%myconfig, \%$form);
2420 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2422 ($item eq $myconfig{dateformat})
2423 ? "<option selected>$item\n"
2424 : "<option>$item\n";
2427 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2429 ($item eq $myconfig{numberformat})
2430 ? "<option selected>$item\n"
2431 : "<option>$item\n";
2434 foreach $item (qw(name company address signature)) {
2435 $myconfig{$item} =~ s/\"/"/g;
2438 foreach $item (qw(address signature)) {
2439 $myconfig{$item} =~ s/\\n/\r\n/g;
2443 if ($opendocument_templates && $openofficeorg_writer_bin &&
2444 $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
2445 push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
2446 "value" => "opendocument_pdf" });
2448 if ($latex_templates) {
2449 push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
2451 push(@formats, { "name" => "HTML", "value" => "html" });
2452 if ($latex_templates) {
2453 push(@formats, { "name" => $locale->text("Postscript"),
2454 "value" => "postscript" });
2456 if ($opendocument_templates) {
2457 push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
2458 "value" => "opendocument" });
2461 if (!$myconfig{"template_format"}) {
2462 $myconfig{"template_format"} = "pdf";
2464 my $template_format = "";
2465 foreach $item (@formats) {
2467 "<option value=\"$item->{value}\"" .
2468 ($item->{"value"} eq $myconfig{"template_format"} ?
2470 ">" . H($item->{"name"}) . "</option>";
2473 if (!$myconfig{"default_media"}) {
2474 $myconfig{"default_media"} = "screen";
2476 my %selected = ($myconfig{"default_media"} => "selected");
2477 my $default_media = qq|
2478 <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
2479 <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
2480 <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
2484 $selected{$myconfig{"default_printer_id"}} = "selected"
2485 if ($myconfig{"default_printer_id"});
2486 my $default_printer = qq|<option></option>|;
2487 AM->printer(\%myconfig, $form);
2488 foreach my $printer (@{$form->{"ALL"}}) {
2489 $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
2490 qq|" $selected{$printer->{'id'}}>| .
2491 H($printer->{"printer_description"}) . qq|</option>|;
2494 %countrycodes = User->country_codes;
2496 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2500 ($myconfig{countrycode} eq $key)
2501 ? "<option selected value=$key>$countrycodes{$key}\n"
2502 : "<option value=$key>$countrycodes{$key}\n";
2504 $countrycodes = "<option>American English\n$countrycodes";
2506 foreach $key (keys %{ $form->{IC} }) {
2507 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2509 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2510 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2511 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2515 # opendir CSS, "css/.";
2516 # @all = grep /.*\.css$/, readdir CSS;
2519 # css dir has styles that are not intended as general layouts.
2520 # reverting to hardcoded list
2521 @all = qw(lx-office-erp.css Win2000.css);
2523 foreach $item (@all) {
2524 if ($item eq $myconfig{stylesheet}) {
2525 $selectstylesheet .= qq|<option selected>$item\n|;
2527 $selectstylesheet .= qq|<option>$item\n|;
2530 $selectstylesheet .= "<option>\n";
2532 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2536 if ($myconfig{menustyle} eq "old") {
2537 $menustyle_old = "checked";
2538 } elsif ($myconfig{menustyle} eq "neu") {
2539 $menustyle_neu = "checked";
2540 } elsif ($myconfig{menustyle} eq "v3") {
2541 $menustyle_v3 = "checked";
2544 my ($show_form_details, $hide_form_details);
2545 $myconfig{"show_form_details"} = 1
2546 unless (defined($myconfig{"show_form_details"}));
2547 $show_form_details = "checked" if ($myconfig{"show_form_details"});
2548 $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
2553 <form method=post action=$form->{script}>
2555 <input type=hidden name=old_password value=$myconfig{password}>
2556 <input type=hidden name=type value=preferences>
2557 <input type=hidden name=role value=$myconfig{role}>
2560 <tr><th class=listtop>$form->{title}</th></tr>
2565 <th align=right>| . $locale->text('Name') . qq|</th>
2566 <td><input name=name size=15 value="$myconfig{name}"></td>
2569 <th align=right>| . $locale->text('Password') . qq|</th>
2570 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2573 <th align=right>| . $locale->text('E-mail') . qq|</th>
2574 <td><input name=email size=30 value="$myconfig{email}"></td>
2577 <th align=right>| . $locale->text('Signature') . qq|</th>
2578 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2581 <th align=right>| . $locale->text('Phone') . qq|</th>
2582 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2585 <th align=right>| . $locale->text('Fax') . qq|</th>
2586 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2589 <th align=right>| . $locale->text('Company') . qq|</th>
2590 <td><input name=company size=30 value="$myconfig{company}"></td>
2593 <th align=right>| . $locale->text('Address') . qq|</th>
2594 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2597 <th align=right>| . $locale->text('Date Format') . qq|</th>
2598 <td><select name=dateformat>$dateformat</select></td>
2601 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2602 <td><select name=numberformat>$numberformat</select></td>
2606 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2607 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2610 <th align=right>| . $locale->text('Language') . qq|</th>
2611 <td><select name=countrycode>$countrycodes</select></td>
2614 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
2615 <td><select name=usestylesheet>$selectstylesheet</select></td>
2618 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
2619 <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
2620 $locale->text("Top (CSS)") . qq|
2621 <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
2622 $locale->text("Top (Javascript)") . qq|
2623 <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
2624 $locale->text("Old (on the side)") . qq|</td>
2627 <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
2628 <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details>
2629 <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
2630 <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details>
2631 <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
2633 <input name=printer type=hidden value="$myconfig{printer}">
2634 <tr class=listheading>
2635 <th colspan=2>| . $locale->text("Print options") . qq|</th>
2638 <th align=right>| . $locale->text('Default template format') . qq|</th>
2639 <td><select name="template_format">$template_format</select></td>
2642 <th align=right>| . $locale->text('Default output medium') . qq|</th>
2643 <td><select name="default_media">$default_media</select></td>
2646 <th align=right>| . $locale->text('Default printer') . qq|</th>
2647 <td><select name="default_printer_id">$default_printer</select></td>
2650 <th align=right>| . $locale->text('Number of copies') . qq|</th>
2651 <td><input name="copies" size="10" value="| .
2652 $form->quote($myconfig{"copies"}) . qq|"></td>
2656 <tr class=listheading>
2657 <th colspan=2> </th>
2660 <th align=right>| . $locale->text('Business Number') . qq|</th>
2661 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
2664 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
2665 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
2667 <tr class=listheading>
2669 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
2675 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
2676 <td><select name=inventory_accno>$myconfig{IC}</select></td>
2679 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
2680 <td><select name=income_accno>$myconfig{IC_income}</select></td>
2683 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
2684 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
2687 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
2688 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
2691 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
2692 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
2697 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
2699 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
2708 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
2709 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
2710 <th align=right nowrap>|
2711 . $locale->text('Last Customer Number') . qq|</th>
2712 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
2715 <th align=right nowrap>|
2716 . $locale->text('Last Credit Note Number') . qq|</th>
2717 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
2718 <th align=right nowrap>|
2719 . $locale->text('Last Vendor Number') . qq|</th>
2720 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
2723 <th align=right nowrap>|
2724 . $locale->text('Last Sales Order Number') . qq|</th>
2725 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
2728 <th align=right nowrap>|
2729 . $locale->text('Last Purchase Order Number') . qq|</th>
2730 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
2731 <th align=right nowrap>|
2732 . $locale->text('Last Article Number') . qq|</th>
2733 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
2736 <th align=right nowrap>|
2737 . $locale->text('Last Sales Quotation Number') . qq|</th>
2738 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
2739 <th align=right nowrap>|
2740 . $locale->text('Last Service Number') . qq|</th>
2741 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
2744 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
2745 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
2746 <th align=right nowrap></th>
2752 # <tr class=listheading>
2753 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
2760 # <th>| . $locale->text('Rate') . qq| (%)</th>
2761 # <th>| . $locale->text('Number') . qq|</th>
2765 # foreach $accno (sort keys %{ $form->{taxrates} }) {
2768 # <th align=right>$form->{taxrates}{$accno}{description}</th>
2769 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
2770 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
2773 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
2776 # chop $form->{taxaccounts};
2779 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
2788 <td><hr size=3 noshade></td>
2792 <input type=hidden name=path value=$form->{path}>
2793 <input type=hidden name=login value=$form->{login}>
2794 <input type=hidden name=password value=$form->{password}>
2797 <input type=submit class=submit name=action value="|
2798 . $locale->text('Save') . qq|">
2806 $lxdebug->leave_sub();
2809 sub save_preferences {
2810 $lxdebug->enter_sub();
2812 $form->{stylesheet} = $form->{usestylesheet};
2814 $form->redirect($locale->text('Preferences saved!'))
2816 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
2818 $form->error($locale->text('Cannot save preferences!'));
2820 $lxdebug->leave_sub();
2824 $lxdebug->enter_sub();
2826 $form->{title} = $locale->text('Audit Control');
2828 AM->closedto(\%myconfig, \%$form);
2830 if ($form->{revtrans}) {
2831 $checked{Y} = "checked";
2833 $checked{N} = "checked";
2841 <form method=post action=$form->{script}>
2843 <input type=hidden name=path value=$form->{path}>
2844 <input type=hidden name=login value=$form->{login}>
2845 <input type=hidden name=password value=$form->{password}>
2848 <tr><th class=listtop>$form->{title}</th></tr>
2849 <tr height="5"></tr>
2855 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
2856 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
2857 . $locale->text('Yes')
2858 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
2859 . $locale->text('No')
2863 <th>| . $locale->text('Close Books up to') . qq|</th>
2864 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
2874 <input type=hidden name=nextsub value=doclose>
2876 <input type=submit class=submit name=action value="|
2877 . $locale->text('Continue') . qq|">
2885 $lxdebug->leave_sub();
2889 $lxdebug->enter_sub();
2891 AM->closebooks(\%myconfig, \%$form);
2893 if ($form->{revtrans}) {
2895 $locale->text('Transaction reversal enforced for all dates'));
2897 if ($form->{closedto}) {
2899 $locale->text('Transaction reversal enforced up to') . " "
2900 . $locale->date(\%myconfig, $form->{closedto}, 1));
2902 $form->redirect($locale->text('Books are open'));
2906 $lxdebug->leave_sub();
2910 $lxdebug->enter_sub();
2912 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
2913 AM->units_in_use(\%myconfig, $form, $units);
2914 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
2916 @languages = AM->language(\%myconfig, $form, 1);
2918 @unit_list = sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } values(%{$units}));
2921 foreach (@unit_list) {
2922 $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"} * 1) if ($_->{"factor"});
2923 $_->{"UNITLANGUAGES"} = [];
2924 foreach my $lang (@languages) {
2925 push(@{ $_->{"UNITLANGUAGES"} },
2927 "unit" => $_->{"name"},
2928 "language_id" => $lang->{"id"},
2929 "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
2930 "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
2936 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
2937 $ddbox = AM->unit_select_data($units, undef, 1);
2939 my $updownlink = build_std_url("action=swap_units", "unit_type");
2941 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
2943 print($form->parse_html_template("am/edit_units",
2944 { "UNITS" => \@unit_list,
2945 "NEW_BASE_UNIT_DDBOX" => $ddbox,
2946 "LANGUAGES" => \@languages,
2947 "updownlink" => $updownlink }));
2949 $lxdebug->leave_sub();
2953 $lxdebug->enter_sub();
2955 $form->isblank("new_name", $locale->text("The name is missing."));
2956 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
2957 $all_units = AM->retrieve_units(\%myconfig, $form);
2958 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
2960 my ($base_unit, $factor);
2961 if ($form->{"new_base_unit"}) {
2962 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
2964 $form->isblank("new_factor", $locale->text("The factor is missing."));
2965 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
2966 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
2967 $base_unit = $form->{"new_base_unit"};
2971 foreach my $lang (AM->language(\%myconfig, $form, 1)) {
2972 next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
2973 push(@languages, { "id" => $lang->{"id"},
2974 "localized" => $form->{"new_localized_$lang->{id}"},
2975 "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
2979 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
2981 $form->{"saved_message"} = $locale->text("The unit has been saved.");
2985 $lxdebug->leave_sub();
2988 sub set_unit_languages {
2989 $lxdebug->enter_sub();
2991 my ($unit, $languages, $idx) = @_;
2993 $unit->{"LANGUAGES"} = [];
2995 foreach my $lang (@{$languages}) {
2996 push(@{ $unit->{"LANGUAGES"} },
2997 { "id" => $lang->{"id"},
2998 "localized" => $form->{"localized_${idx}_$lang->{id}"},
2999 "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
3003 $lxdebug->leave_sub();
3007 $lxdebug->enter_sub();
3009 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3010 AM->units_in_use(\%myconfig, $form, $old_units);
3012 @languages = AM->language(\%myconfig, $form, 1);
3016 foreach $i (1..($form->{"rowcount"} * 1)) {
3017 $old_unit = $old_units->{$form->{"old_name_$i"}};
3019 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3022 if ($form->{"unchangeable_$i"}) {
3023 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3024 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3025 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3029 if ($old_unit->{"in_use"}) {
3030 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3033 if ($form->{"delete_$i"}) {
3034 push(@delete_units, $old_unit->{"name"});
3038 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3040 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3041 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3042 $new_units->{$form->{"name_$i"}} = \%h;
3043 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3044 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3047 foreach $unit (values(%{$new_units})) {
3048 next unless ($unit->{"old_name"});
3049 if ($unit->{"base_unit"}) {
3050 $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"}))
3051 unless (defined($new_units->{$unit->{"base_unit"}}));
3052 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3053 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3055 $unit->{"base_unit"} = undef;
3056 $unit->{"factor"} = undef;
3060 foreach $unit (values(%{$new_units})) {
3061 next if ($unit->{"unchanged_unit"});
3063 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3065 while ($new_unit->{"base_unit"}) {
3066 $new_unit->{"seen"} = 1;
3067 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3068 if ($new_unit->{"seen"}) {
3069 $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, " .
3070 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3075 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3077 $form->{"saved_message"} = $locale->text("The units have been saved.");
3081 $lxdebug->leave_sub();
3084 sub show_history_search {
3085 $lxdebug->enter_sub();
3087 $form->{title} = $locale->text("History Search");
3090 print $form->parse_html_template("/common/search_history");
3092 $lxdebug->leave_sub();
3095 sub show_am_history {
3096 $lxdebug->enter_sub();
3097 my %search = ( "Artikelnummer" => "parts",
3098 "Kundennummer" => "customer",
3099 "Lieferantennummer" => "vendor",
3100 "Projektnummer" => "project",
3101 "Buchungsnummer" => "oe",
3102 "Eingangsrechnungnummer" => "ap",
3103 "Ausgangsrechnungnummer" => "ar"
3105 my %searchNo = ( "Artikelnummer" => "partnumber",
3106 "Kundennummer" => "customernumber",
3107 "Lieferantennummer" => "vendornumber",
3108 "Projektnummer" => "projectnummer",
3109 "Buchungsnummer" => "ordnumber",
3110 "Eingangsrechnungnummer" => "invnumber",
3111 "Ausgangsrechnungnummer" => "invnumber"
3116 foreach(split(/\,/, $form->{einschraenkungen})) {
3118 $restriction .= " AND addition = '" . $_ . "'";
3122 $restriction .= " OR addition = '" . $_ . "'";
3126 $restriction .= (($form->{transdate} ne "" && $form->{reqdate} ne "")
3127 ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|' AND st.itime::date <= '| . $form->{reqdate} . qq|'|
3128 : (($form->{transdate} ne "" && $form->{reqdate} eq "")
3129 ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|'|
3130 : ($form->{transdate} eq "" && $form->{reqdate} ne "")
3131 ? qq| AND st.itime::date <= '| . $form->{reqdate} . qq|'|
3136 my $dbh = $form->dbconnect(\%myconfig);
3137 my $searchSNumber = $searchNo{$form->{'what2search'}} . qq|_| . $form->{'searchid'};
3138 $restriction .= ($form->{mitarbeiter} eq "" ? ""
3139 : ($form->{mitarbeiter} =~ /^[0-9]*$/
3140 ? " AND employee_id = " . $form->{mitarbeiter}
3141 : " AND employee_id = " . &get_employee_id($form->{mitarbeiter}, $dbh)));
3142 my $query = qq|SELECT trans_id AS id FROM history_erp WHERE sNumbers = '$searchSNumber' |;
3144 my $sth = $dbh->prepare($query);
3146 $sth->execute() || $form->dberror($query);
3148 if($sth->fetch() <= 0) {
3150 my $query = qq|SELECT id FROM $search{$form->{what2search}}
3151 WHERE $searchNo{$form->{'what2search'}} ILIKE '$form->{"searchid"}'
3154 $sth->execute() || $form->dberror($query);
3155 $form->{title} = $locale->text("History Search");
3158 while(my $hash_ref = $sth->fetchrow_hashref()){
3159 push(@daten, $form->get_history($dbh,$hash_ref->{id},$restriction));
3162 print $form->parse_html_template("/common/show_history",
3164 "SUCCESS" => (length(@daten) > 0),
3167 $lxdebug->leave_sub();
3170 sub get_employee_id {
3171 $lxdebug->enter_sub();
3172 my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|;
3173 my $sth = $_[1]->prepare($query);
3174 $sth->execute() || $form->dberror($query);
3175 my $return = $sth->fetch();
3177 return ${$return}[0];
3178 $lxdebug->leave_sub();
3182 $lxdebug->enter_sub();
3184 my $dir = $form->{"dir"} eq "down" ? "down" : "up";
3185 my $unit_type = $form->{"unit_type"} eq "dimension" ?
3186 "dimension" : "service";
3187 AM->swap_units(\%myconfig, $form, $dir, $form->{"name"}, $unit_type);
3191 $lxdebug->leave_sub();