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 delete { &{"delete_$form->{type}"} }
53 if ($form->{display_nextsub}) {
54 &{ $form->{display_nextsub} }();
56 &{ $form->{nextsub} }();
61 if ($form->{save_nextsub}) {
62 &{ $form->{save_nextsub} }();
64 &{ $form->{nextsub} }();
69 if ($form->{edit_nextsub}) {
70 &{ $form->{edit_nextsub} }();
72 &{ "edit_$form->{type}" }();
77 $lxdebug->enter_sub();
79 $form->{title} = "Add";
80 $form->{charttype} = "A";
81 AM->get_account(\%myconfig, \%$form);
84 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
85 unless $form->{callback};
90 $lxdebug->leave_sub();
94 $lxdebug->enter_sub();
96 $form->{title} = "Edit";
97 AM->get_account(\%myconfig, \%$form);
99 foreach my $item (split(/:/, $form->{link})) {
100 $form->{$item} = "checked";
106 $lxdebug->leave_sub();
110 $lxdebug->enter_sub();
112 $form->{title} = $locale->text("$form->{title} Account");
114 $checked{ $form->{charttype} } = "checked";
115 $checked{"$form->{category}_"} = "checked";
116 $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
118 $form->{description} =~ s/\"/"/g;
120 if (@{ $form->{TAXKEY} }) {
121 foreach my $item (@{ $form->{TAXKEY} }) {
123 $item->{rate} = $item->{rate} * 100 . '%';
125 if ($item->{tax} == $form->{tax}) {
126 $form->{selecttaxkey} .=
127 "<option value=$item->{tax} selected>$item->{taxdescription} ($item->{rate})\n";
129 $form->{selecttaxkey} .=
130 "<option value=$item->{tax}>$item->{taxdescription} ($item->{rate})\n";
138 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
139 <td><select name=tax>$form->{selecttaxkey}</select></td>
140 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
141 <td><input name=startdate value="$form->{startdate}"></td>
144 if (@{ $form->{NEWACCOUNT} }) {
145 if (!$form->{new_chart_valid}) {
146 $form->{selectnewaccount} = "<option value=></option>";
148 foreach $item (@{ $form->{NEWACCOUNT} }) {
149 if ($item->{id} == $form->{new_chart_id}) {
150 $form->{selectnewaccount} .=
151 "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
152 } elsif (!$form->{new_chart_valid}) {
153 $form->{selectnewaccount} .=
154 "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
165 <th align=right>| . $locale->text('Folgekonto') . qq|</th>
166 <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
167 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
168 <td><input name=valid_from value="$form->{valid_from}"></td>
174 $form->{selectustva} = "<option>\n";
176 %ustva = (35 => $locale->text('UStVA-Nr. 35'),
177 36 => $locale->text('UStVA-Nr. 36'),
178 39 => $locale->text('UStVA-Nr. 39'),
179 41 => $locale->text('UStVA-Nr. 41'),
180 42 => $locale->text('UStVA-Nr. 42'),
181 43 => $locale->text('UStVA-Nr. 43'),
182 44 => $locale->text('UStVA-Nr. 44'),
183 45 => $locale->text('UStVA-Nr. 45'),
184 48 => $locale->text('UStVA-Nr. 48'),
185 49 => $locale->text('UStVA-Nr. 49'),
186 51 => $locale->text('UStVA-Nr. 51 left'),
187 511 => $locale->text('UStVA-Nr. 51 right'),
188 52 => $locale->text('UStVA-Nr. 52'),
189 53 => $locale->text('UStVA-Nr. 53'),
190 59 => $locale->text('UStVA-Nr. 59'),
191 60 => $locale->text('UStVA-Nr. 60'),
192 61 => $locale->text('UStVA-Nr. 61'),
193 62 => $locale->text('UStVA-Nr. 62'),
194 63 => $locale->text('UStVA-Nr. 63'),
195 64 => $locale->text('UStVA-Nr. 64'),
196 65 => $locale->text('UStVA-Nr. 65'),
197 66 => $locale->text('UStVA-Nr. 66'),
198 67 => $locale->text('UStVA-Nr. 67'),
199 69 => $locale->text('UStVA-Nr. 69'),
200 73 => $locale->text('UStVA-Nr. 73'),
201 74 => $locale->text('UStVA-Nr. 74'),
202 76 => $locale->text('UStVA-Nr. 76'),
203 77 => $locale->text('UStVA-Nr. 77'),
204 80 => $locale->text('UStVA-Nr. 80'),
205 81 => $locale->text('UStVA-Nr. 81 left'),
206 811 => $locale->text('UStVA-Nr. 81 right'),
207 84 => $locale->text('UStVA-Nr. 84'),
208 85 => $locale->text('UStVA-Nr. 85'),
209 86 => $locale->text('UStVA-Nr. 86 left'),
210 861 => $locale->text('UStVA-Nr. 86 right'),
211 89 => $locale->text('UStVA-Nr. 89 left'),
212 891 => $locale->text('UStVA-Nr. 89 right'),
213 91 => $locale->text('UStVA-Nr. 91'),
214 93 => $locale->text('UStVA-Nr. 93 left'),
215 931 => $locale->text('UStVA-Nr. 93 right'),
216 94 => $locale->text('UStVA-Nr. 94'),
217 95 => $locale->text('UStVA-Nr. 95'),
218 96 => $locale->text('UStVA-Nr. 96'),
219 97 => $locale->text('UStVA-Nr. 97 links'),
220 971 => $locale->text('UStVA-Nr. 97 rechts'),
221 98 => $locale->text('UStVA-Nr. 98'));
223 foreach $item (sort({ $a cmp $b } keys %ustva)) {
224 if ($item == $form->{pos_ustva}) {
225 $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
227 $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
234 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
235 <td><select name=pos_ustva>$form->{selectustva}</select></td>
236 <input type=hidden name=selectustva value="$form->{selectustva}">
239 $form->{selecteur} = "<option>\n";
240 %eur = (1 => "Umsatzerlöse",
241 2 => "sonstige Erlöse",
242 3 => "Privatanteile",
244 5 => "Ausserordentliche Erträge",
245 6 => "Vereinnahmte Umsatzst.",
246 7 => "Umsatzsteuererstattungen",
247 8 => "Wareneingänge",
248 9 => "Löhne und Gehälter",
249 10 => "Gesetzl. sozialer Aufw.",
251 12 => "Gas, Strom, Wasser",
252 13 => "Instandhaltung",
253 14 => "Steuern, Versich., Beiträge",
255 16 => "Kfz-Versicherungen",
256 17 => "Sonst. Fahrtkosten",
257 18 => "Werbe- und Reisekosten",
258 19 => "Instandhaltung u. Werkzeuge",
259 20 => "Fachzeitschriften, Bücher",
260 21 => "Miete für Einrichtungen",
261 22 => "Rechts- und Beratungskosten",
262 23 => "Bürobedarf, Porto, Telefon",
263 24 => "Sonstige Aufwendungen",
264 25 => "Abschreibungen auf Anlagever.",
265 26 => "Abschreibungen auf GWG",
267 28 => "Umsatzsteuerzahlungen",
269 30 => "Ausserordentlicher Aufwand",
270 31 => "Betriebliche Steuern");
271 foreach $item (sort({ $a <=> $b } keys(%eur))) {
272 if ($item == $form->{pos_eur}) {
273 $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
275 $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
282 <th align=right>| . $locale->text('EUER') . qq|</th>
283 <td><select name=pos_eur>$form->{selecteur}</select></td>
284 <input type=hidden name=selecteur value="$form->{selecteur}">
287 $form->{selectbwa} = "<option>\n";
289 %bwapos = (1 => 'Umsatzerlöse',
290 2 => 'Best.Verdg.FE/UE',
291 3 => 'Aktiv.Eigenleistung',
292 4 => 'Mat./Wareneinkauf',
293 5 => 'So.betr.Erlöse',
294 10 => 'Personalkosten',
296 12 => 'Betriebl.Steuern',
297 13 => 'Vers./Beiträge',
298 14 => 'Kfz.Kosten o.St.',
299 15 => 'Werbe-Reisek.',
300 16 => 'Kosten Warenabgabe',
301 17 => 'Abschreibungen',
302 18 => 'Rep./instandhlt.',
303 19 => 'Übrige Steuern',
304 20 => 'Sonst.Kosten',
306 31 => 'Sonst.neutr.Aufw.',
308 33 => 'Sonst.neutr.Ertrag',
309 34 => 'Verr.kalk.Kosten',
310 35 => 'Steuern Eink.u.Ertr.');
311 foreach $item (sort({ $a <=> $b } keys %bwapos)) {
312 if ($item == $form->{pos_bwa}) {
313 $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
315 $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
322 <th align=right>| . $locale->text('BWA') . qq|</th>
323 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
324 <input type=hidden name=selectbwa value="$form->{selectbwa}">
327 # Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
328 # $form->{selectbilanz} = "<option>\n";
329 # foreach $item ((1, 2, 3, 4)) {
330 # if ($item == $form->{pos_bilanz}) {
331 # $form->{selectbilanz} .= "<option value=$item selected>$item\n";
333 # $form->{selectbilanz} .= "<option value=$item>$item\n";
340 # <th align=right>| . $locale->text('Bilanz') . qq|</th>
341 # <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
342 # <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
345 # this is for our parser only!
346 # type=submit $locale->text('Add Account')
347 # type=submit $locale->text('Edit Account')
348 $form->{type} = "account";
355 <form method=post action=$form->{script}>
357 <input type=hidden name=id value=$form->{id}>
358 <input type=hidden name=type value=account>
359 <input type=hidden name=orphaned value=$form->{orphaned}>
360 <input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
362 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
363 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
364 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
365 <input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
366 <input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
368 <table border=0 width=100%>
370 <th class=listtop>$form->{title}</th>
377 <th align=right>| . $locale->text('Account Number') . qq|</th>
378 <td><input name=accno size=20 value=$form->{accno}></td>
381 <th align=right>| . $locale->text('Description') . qq|</th>
382 <td><input name=description size=40 value="$form->{description}"></td>
385 <th align=right>| . $locale->text('Account Type') . qq|</th>
389 <td><input name=category type=radio class=radio value=A $checked{A_}> |
390 . $locale->text('Asset') . qq|\n<br>
391 <input name=category type=radio class=radio value=L $checked{L_}> |
392 . $locale->text('Liability') . qq|\n<br>
393 <input name=category type=radio class=radio value=Q $checked{Q_}> |
394 . $locale->text('Equity') . qq|\n<br>
395 <input name=category type=radio class=radio value=I $checked{I_}> |
396 . $locale->text('Revenue') . qq|\n<br>
397 <input name=category type=radio class=radio value=E $checked{E_}> |
398 . $locale->text('Expense') . qq|<br>
399 <input name=category type=radio class=radio value=C $checked{C_}> |
400 . $locale->text('Costs') . qq|</td>
401 <td width=50> </td>
403 <input name=charttype type=radio class=radio value="H" $checked{H}> |
404 . $locale->text('Heading') . qq|<br>
405 <input name=charttype type=radio class=radio value="A" $checked{A}> |
406 . $locale->text('Account') . qq|</td>
413 if ($form->{charttype} eq "A") {
420 . $locale->text('Is this a summary account to record') . qq|</th>
422 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
423 . $locale->text('AR')
424 . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
425 . $locale->text('AP')
426 . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
427 . $locale->text('Inventory')
434 <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
440 <th align=left>| . $locale->text('Receivables') . qq|</th>
441 <th align=left>| . $locale->text('Payables') . qq|</th>
442 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
443 <th align=left>| . $locale->text('Service Items') . qq|</th>
447 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
448 . $locale->text('Revenue') . qq|\n<br>
449 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
450 . $locale->text('Receipt') . qq|\n<br>
451 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
452 . $locale->text('Tax') . qq|
455 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
456 . $locale->text('Expense/Asset') . qq|\n<br>
457 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
458 . $locale->text('Payment') . qq|\n<br>
459 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
460 . $locale->text('Tax') . qq|
463 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
464 . $locale->text('Revenue') . qq|\n<br>
465 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
466 . $locale->text('Expense') . qq|\n<br>
467 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
468 . $locale->text('Tax') . qq|
471 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
472 . $locale->text('Revenue') . qq|\n<br>
473 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
474 . $locale->text('Expense') . qq|\n<br>
475 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
476 . $locale->text('Tax') . qq|
496 <td><hr size=3 noshade></td>
501 $lxdebug->leave_sub();
505 $lxdebug->enter_sub();
509 <input name=callback type=hidden value="$form->{callback}">
511 <input type=hidden name=path value=$form->{path}>
512 <input type=hidden name=login value=$form->{login}>
513 <input type=hidden name=password value=$form->{password}>
516 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
518 <input type=submit class=submit name=action value="|
519 . $locale->text('Save') . qq|">
523 if ($form->{id} && $form->{orphaned}) {
524 print qq|<input type=submit class=submit name=action value="|
525 . $locale->text('Delete') . qq|">|;
535 $lxdebug->leave_sub();
539 $lxdebug->enter_sub();
541 $form->isblank("accno", $locale->text('Account Number missing!'));
542 $form->isblank("category", $locale->text('Account Type missing!'));
544 $form->redirect($locale->text('Account saved!'))
545 if (AM->save_account(\%myconfig, \%$form));
546 $form->error($locale->text('Cannot save account!'));
548 $lxdebug->leave_sub();
552 $lxdebug->enter_sub();
554 CA->all_accounts(\%myconfig, \%$form);
556 $form->{title} = $locale->text('Chart of Accounts');
560 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
565 $callback = $form->escape($callback);
567 foreach $ca (@{ $form->{CA} }) {
569 $ca->{debit} = " ";
570 $ca->{credit} = " ";
572 if ($ca->{amount} > 0) {
574 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
576 if ($ca->{amount} < 0) {
578 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
581 my @links = split( q{:}, $ca->{link});
585 foreach my $link (@links){
586 $link = ( $link eq 'AR') ? $locale->text('Account Link AR')
587 : ( $link eq 'AP') ? $locale->text('Account Link AP')
588 : ( $link eq 'IC') ? $locale->text('Account Link IC')
589 : ( $link eq 'AR_amount' ) ? $locale->text('Account Link AR_amount')
590 : ( $link eq 'AR_paid' ) ? $locale->text('Account Link AR_paid')
591 : ( $link eq 'AR_tax' ) ? $locale->text('Account Link AR_tax')
592 : ( $link eq 'AP_amount' ) ? $locale->text('Account Link AP_amount')
593 : ( $link eq 'AP_paid' ) ? $locale->text('Account Link AP_paid')
594 : ( $link eq 'AP_tax' ) ? $locale->text('Account Link AP_tax')
595 : ( $link eq 'IC_sale' ) ? $locale->text('Account Link IC_sale')
596 : ( $link eq 'IC_cogs' ) ? $locale->text('Account Link IC_cogs')
597 : ( $link eq 'IC_taxpart' ) ? $locale->text('Account Link IC_taxpart')
598 : ( $link eq 'IC_income' ) ? $locale->text('Account Link IC_income')
599 : ( $link eq 'IC_expense' ) ? $locale->text('Account Link IC_expense')
600 : ( $link eq 'IC_taxservice' ) ? $locale->text('Account Link IC_taxservice')
601 : ( $link eq 'CT_tax' ) ? $locale->text('Account Link CT_tax')
602 : $locale->text('Unknown Link') . ': ' . $link;
604 $ca->{link} .= qq|[| . $link . qq|] |;
607 $ca->{startdate} =~ s/,/<br>/og;
608 $ca->{tk_ustva} =~ s/,/<br>/og;
609 $ca->{taxkey} =~ s/,/<br>/og;
610 $ca->{taxaccount} =~ s/,/<br>/og;
611 $ca->{taxdescription} =~ s/,/<br>/og;
612 $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):q{};
614 $ca->{category} = ($ca->{category} eq 'A') ? $locale->text('Account Category A')
615 : ($ca->{category} eq 'E') ? $locale->text('Account Category E')
616 : ($ca->{category} eq 'L') ? $locale->text('Account Category L')
617 : ($ca->{category} eq 'I') ? $locale->text('Account Category I')
618 : ($ca->{category} eq 'Q') ? $locale->text('Account Category Q')
619 : ($ca->{category} eq 'C') ? $locale->text('Account Category C')
620 : ($ca->{category} eq 'G') ? $locale->text('Account Category G')
621 : $locale->text('Unknown Category') . ': ' . $ca->{category};
623 $ca->{link_edit_account} =
624 qq|$form->{script}?action=edit_account&id=$ca->{id}|
625 .qq|&path=$form->{path}&login=$form->{login}|
626 .qq|&password=$form->{password}&callback=$callback|;
629 my $parameters_ref = {
632 # hidden_variables => $_hidden_variables_ref,
635 # Ausgabe des Templates
636 print($form->parse_html_template('am/list_accounts', $parameters_ref));
638 $lxdebug->leave_sub();
644 $lxdebug->enter_sub();
646 $form->{title} = $locale->text('Delete Account');
649 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
651 if ($form->{id} == $form->{$id}) {
652 $form->error($locale->text('Cannot delete default account!'));
656 $form->redirect($locale->text('Account deleted!'))
657 if (AM->delete_account(\%myconfig, \%$form));
658 $form->error($locale->text('Cannot delete account!'));
660 $lxdebug->leave_sub();
664 $lxdebug->enter_sub();
666 $form->{title} = "Add";
670 "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
671 unless $form->{callback};
676 $lxdebug->leave_sub();
679 sub edit_department {
680 $lxdebug->enter_sub();
682 $form->{title} = "Edit";
684 AM->get_department(\%myconfig, \%$form);
689 $lxdebug->leave_sub();
692 sub list_department {
693 $lxdebug->enter_sub();
695 AM->departments(\%myconfig, \%$form);
698 "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
700 $callback = $form->escape($form->{callback});
702 $form->{title} = $locale->text('Departments');
704 @column_index = qw(description cost profit);
706 $column_header{description} =
707 qq|<th class=listheading width=90%>|
708 . $locale->text('Description')
710 $column_header{cost} =
711 qq|<th class=listheading nowrap>|
712 . $locale->text('Cost Center')
714 $column_header{profit} =
715 qq|<th class=listheading nowrap>|
716 . $locale->text('Profit Center')
726 <th class=listtop>$form->{title}</th>
732 <tr class=listheading>
735 map { print "$column_header{$_}\n" } @column_index;
741 foreach $ref (@{ $form->{ALL} }) {
747 <tr valign=top class=listrow$i>
750 $costcenter = ($ref->{role} eq "C") ? "X" : "";
751 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
753 $column_data{description} =
754 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>|;
755 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
756 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
758 map { print "$column_data{$_}\n" } @column_index;
770 <td><hr size=3 noshade></td>
775 <form method=post action=$form->{script}>
777 <input name=callback type=hidden value="$form->{callback}">
779 <input type=hidden name=type value=department>
781 <input type=hidden name=path value=$form->{path}>
782 <input type=hidden name=login value=$form->{login}>
783 <input type=hidden name=password value=$form->{password}>
785 <input class=submit type=submit name=action value="|
786 . $locale->text('Add') . qq|">
794 $lxdebug->leave_sub();
797 sub department_header {
798 $lxdebug->enter_sub();
800 $form->{title} = $locale->text("$form->{title} Department");
802 # $locale->text('Add Department')
803 # $locale->text('Edit Department')
805 $form->{description} =~ s/\"/"/g;
807 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
809 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
812 qq|<input name=description size=60 value="$form->{description}">|;
815 $costcenter = "checked" if $form->{role} eq "C";
816 $profitcenter = "checked" if $form->{role} eq "P";
823 <form method=post action=$form->{script}>
825 <input type=hidden name=id value=$form->{id}>
826 <input type=hidden name=type value=department>
830 <th class=listtop colspan=2>$form->{title}</th>
834 <th align=right>| . $locale->text('Description') . qq|</th>
835 <td>$description</td>
839 <td><input type=radio style=radio name=role value="C" $costcenter> |
840 . $locale->text('Cost Center') . qq|
841 <input type=radio style=radio name=role value="P" $profitcenter> |
842 . $locale->text('Profit Center') . qq|
845 <td colspan=2><hr size=3 noshade></td>
850 $lxdebug->leave_sub();
853 sub save_department {
854 $lxdebug->enter_sub();
856 $form->isblank("description", $locale->text('Description missing!'));
857 AM->save_department(\%myconfig, \%$form);
858 $form->redirect($locale->text('Department saved!'));
860 $lxdebug->leave_sub();
863 sub delete_department {
864 $lxdebug->enter_sub();
866 AM->delete_department(\%myconfig, \%$form);
867 $form->redirect($locale->text('Department deleted!'));
869 $lxdebug->leave_sub();
873 $lxdebug->enter_sub();
875 $form->{title} = "Add";
878 "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
879 unless $form->{callback};
884 $lxdebug->leave_sub();
888 $lxdebug->enter_sub();
890 $form->{title} = "Edit";
892 AM->get_lead(\%myconfig, \%$form);
896 $form->{orphaned} = 1;
899 $lxdebug->leave_sub();
903 $lxdebug->enter_sub();
905 AM->lead(\%myconfig, \%$form);
908 "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
910 $callback = $form->escape($form->{callback});
912 $form->{title} = $locale->text('Lead');
914 @column_index = qw(description cost profit);
916 $column_header{description} =
917 qq|<th class=listheading width=100%>|
918 . $locale->text('Description')
928 <th class=listtop>$form->{title}</th>
931 <tr class=listheading>
934 map { print "$column_header{$_}\n" } @column_index;
940 foreach $ref (@{ $form->{ALL} }) {
946 <tr valign=top class=listrow$i>
949 $lead = $ref->{lead};
951 $column_data{description} =
952 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>|;
954 map { print "$column_data{$_}\n" } @column_index;
963 <td><hr size=3 noshade></td>
968 <form method=post action=$form->{script}>
970 <input name=callback type=hidden value="$form->{callback}">
972 <input type=hidden name=type value=lead>
974 <input type=hidden name=path value=$form->{path}>
975 <input type=hidden name=login value=$form->{login}>
976 <input type=hidden name=password value=$form->{password}>
978 <input class=submit type=submit name=action value="|
979 . $locale->text('Add') . qq|">
987 $lxdebug->leave_sub();
991 $lxdebug->enter_sub();
993 $form->{title} = $locale->text("$form->{title} Lead");
995 # $locale->text('Add Lead')
996 # $locale->text('Edit Lead')
998 $form->{description} =~ s/\"/"/g;
1001 qq|<input name=description size=50 value="$form->{lead}">|;
1008 <form method=post action=$form->{script}>
1010 <input type=hidden name=id value=$form->{id}>
1011 <input type=hidden name=type value=lead>
1015 <th class=listtop colspan=2>$form->{title}</th>
1017 <tr height="5"></tr>
1019 <th align=right>| . $locale->text('Description') . qq|</th>
1020 <td>$description</td>
1022 <td colspan=2><hr size=3 noshade></td>
1027 $lxdebug->leave_sub();
1031 $lxdebug->enter_sub();
1033 $form->isblank("description", $locale->text('Description missing!'));
1034 AM->save_lead(\%myconfig, \%$form);
1035 $form->redirect($locale->text('lead saved!'));
1037 $lxdebug->leave_sub();
1041 $lxdebug->enter_sub();
1043 AM->delete_lead(\%myconfig, \%$form);
1044 $form->redirect($locale->text('lead deleted!'));
1046 $lxdebug->leave_sub();
1050 $lxdebug->enter_sub();
1052 $form->{title} = "Add";
1055 "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1056 unless $form->{callback};
1061 $lxdebug->leave_sub();
1065 $lxdebug->enter_sub();
1067 $form->{title} = "Edit";
1069 AM->get_business(\%myconfig, \%$form);
1073 $form->{orphaned} = 1;
1076 $lxdebug->leave_sub();
1080 $lxdebug->enter_sub();
1082 AM->business(\%myconfig, \%$form);
1085 "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1087 $callback = $form->escape($form->{callback});
1089 $form->{title} = $locale->text('Type of Business');
1091 @column_index = qw(description discount customernumberinit);
1093 $column_header{description} =
1094 qq|<th class=listheading width=60%>|
1095 . $locale->text('Description')
1097 $column_header{discount} =
1098 qq|<th class=listheading width=10%>|
1099 . $locale->text('Discount')
1101 $column_header{customernumberinit} =
1102 qq|<th class=listheading>|
1103 . $locale->text('Customernumberinit')
1113 <th class=listtop>$form->{title}</th>
1115 <tr height="5"></tr>
1119 <tr class=listheading>
1122 map { print "$column_header{$_}\n" } @column_index;
1128 foreach $ref (@{ $form->{ALL} }) {
1134 <tr valign=top class=listrow$i>
1138 $form->format_amount(\%myconfig, $ref->{discount} * 100);
1140 $ref->{description};
1141 $column_data{description} =
1142 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>|;
1143 $column_data{discount} = qq|<td align=right>$discount</td>|;
1144 $column_data{customernumberinit} =
1145 qq|<td align=right>$ref->{customernumberinit}</td>|;
1147 map { print "$column_data{$_}\n" } @column_index;
1159 <td><hr size=3 noshade></td>
1164 <form method=post action=$form->{script}>
1166 <input name=callback type=hidden value="$form->{callback}">
1168 <input type=hidden name=type value=business>
1170 <input type=hidden name=path value=$form->{path}>
1171 <input type=hidden name=login value=$form->{login}>
1172 <input type=hidden name=password value=$form->{password}>
1174 <input class=submit type=submit name=action value="|
1175 . $locale->text('Add') . qq|">
1183 $lxdebug->leave_sub();
1186 sub business_header {
1187 $lxdebug->enter_sub();
1189 $form->{title} = $locale->text("$form->{title} Business");
1191 # $locale->text('Add Business')
1192 # $locale->text('Edit Business')
1194 $form->{description} =~ s/\"/"/g;
1196 $form->format_amount(\%myconfig, $form->{discount} * 100);
1203 <form method=post action=$form->{script}>
1205 <input type=hidden name=id value=$form->{id}>
1206 <input type=hidden name=type value=business>
1210 <th class=listtop colspan=2>$form->{title}</th>
1212 <tr height="5"></tr>
1214 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1215 <td><input name=description size=30 value="$form->{description}"></td>
1218 <th align=right>| . $locale->text('Discount') . qq| %</th>
1219 <td><input name=discount size=5 value=$form->{discount}></td>
1222 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1223 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1225 <td colspan=2><hr size=3 noshade></td>
1230 $lxdebug->leave_sub();
1234 $lxdebug->enter_sub();
1236 $form->isblank("description", $locale->text('Description missing!'));
1237 $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100;
1238 AM->save_business(\%myconfig, \%$form);
1239 $form->redirect($locale->text('Business saved!'));
1241 $lxdebug->leave_sub();
1244 sub delete_business {
1245 $lxdebug->enter_sub();
1247 AM->delete_business(\%myconfig, \%$form);
1248 $form->redirect($locale->text('Business deleted!'));
1250 $lxdebug->leave_sub();
1254 $lxdebug->enter_sub();
1256 $form->{title} = "Add";
1259 "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1260 unless $form->{callback};
1265 $lxdebug->leave_sub();
1269 $lxdebug->enter_sub();
1271 $form->{title} = "Edit";
1273 AM->get_language(\%myconfig, \%$form);
1277 $form->{orphaned} = 1;
1280 $lxdebug->leave_sub();
1284 $lxdebug->enter_sub();
1286 AM->language(\%myconfig, \%$form);
1289 "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1291 $callback = $form->escape($form->{callback});
1293 $form->{title} = $locale->text('Languages');
1295 @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
1297 $column_header{description} =
1298 qq|<th class=listheading width=60%>|
1299 . $locale->text('Description')
1301 $column_header{template_code} =
1302 qq|<th class=listheading width=10%>|
1303 . $locale->text('Template Code')
1305 $column_header{article_code} =
1306 qq|<th class=listheading>|
1307 . $locale->text('Article Code')
1309 $column_header{output_numberformat} =
1310 qq|<th class=listheading>|
1311 . $locale->text('Number Format')
1313 $column_header{output_dateformat} =
1314 qq|<th class=listheading>|
1315 . $locale->text('Date Format')
1317 $column_header{output_longdates} =
1318 qq|<th class=listheading>|
1319 . $locale->text('Long Dates')
1329 <th class=listtop>$form->{title}</th>
1331 <tr height="5"></tr>
1335 <tr class=listheading>
1338 map { print "$column_header{$_}\n" } @column_index;
1344 foreach $ref (@{ $form->{ALL} }) {
1350 <tr valign=top class=listrow$i>
1354 $column_data{description} =
1355 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>|;
1356 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1357 $column_data{article_code} =
1358 qq|<td align=right>$ref->{article_code}</td>|;
1359 $column_data{output_numberformat} =
1361 ($ref->{output_numberformat} ? $ref->{output_numberformat} :
1362 $locale->text("use program settings")) .
1364 $column_data{output_dateformat} =
1366 ($ref->{output_dateformat} ? $ref->{output_dateformat} :
1367 $locale->text("use program settings")) .
1369 $column_data{output_longdates} =
1371 ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
1374 map { print "$column_data{$_}\n" } @column_index;
1386 <td><hr size=3 noshade></td>
1391 <form method=post action=$form->{script}>
1393 <input name=callback type=hidden value="$form->{callback}">
1395 <input type=hidden name=type value=language>
1397 <input type=hidden name=path value=$form->{path}>
1398 <input type=hidden name=login value=$form->{login}>
1399 <input type=hidden name=password value=$form->{password}>
1401 <input class=submit type=submit name=action value="|
1402 . $locale->text('Add') . qq|">
1410 $lxdebug->leave_sub();
1413 sub language_header {
1414 $lxdebug->enter_sub();
1416 $form->{title} = $locale->text("$form->{title} Language");
1418 # $locale->text('Add Language')
1419 # $locale->text('Edit Language')
1421 $form->{description} =~ s/\"/"/g;
1422 $form->{template_code} =~ s/\"/"/g;
1423 $form->{article_code} =~ s/\"/"/g;
1429 qq|<option value="">| . $locale->text("use program settings") .
1431 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1433 ($item eq $form->{output_numberformat})
1434 ? "<option selected>$item"
1440 qq|<option value="">| . $locale->text("use program settings") .
1442 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1444 ($item eq $form->{output_dateformat})
1445 ? "<option selected>$item"
1453 <form method=post action=$form->{script}>
1455 <input type=hidden name=id value=$form->{id}>
1456 <input type=hidden name=type value=language>
1460 <th class=listtop colspan=2>$form->{title}</th>
1462 <tr height="5"></tr>
1464 <th align=right>| . $locale->text('Language') . qq|</th>
1465 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1468 <th align=right>| . $locale->text('Template Code') . qq|</th>
1469 <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
1472 <th align=right>| . $locale->text('Article Code') . qq|</th>
1473 <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
1476 <th align=right>| . $locale->text('Number Format') . qq|</th>
1477 <td><select name="output_numberformat">$numberformat</select></td>
1480 <th align=right>| . $locale->text('Date Format') . qq|</th>
1481 <td><select name="output_dateformat">$dateformat</select></td>
1484 <th align=right>| . $locale->text('Long Dates') . qq|</th>
1485 <td><input type="radio" name="output_longdates" value="1"| .
1486 ($form->{output_longdates} ? " checked" : "") .
1487 qq|>| . $locale->text("Yes") .
1488 qq|<input type="radio" name="output_longdates" value="0"| .
1489 ($form->{output_longdates} ? "" : " checked") .
1490 qq|>| . $locale->text("No") .
1493 <td colspan=2><hr size=3 noshade></td>
1498 $lxdebug->leave_sub();
1502 $lxdebug->enter_sub();
1504 $form->isblank("description", $locale->text('Language missing!'));
1505 $form->isblank("template_code", $locale->text('Template Code missing!'));
1506 $form->isblank("article_code", $locale->text('Article Code missing!'));
1507 AM->save_language(\%myconfig, \%$form);
1508 $form->redirect($locale->text('Language saved!'));
1510 $lxdebug->leave_sub();
1513 sub delete_language {
1514 $lxdebug->enter_sub();
1516 AM->delete_language(\%myconfig, \%$form);
1517 $form->redirect($locale->text('Language deleted!'));
1519 $lxdebug->leave_sub();
1523 sub add_buchungsgruppe {
1524 $lxdebug->enter_sub();
1526 # $locale->text("Add Buchungsgruppe")
1527 # $locale->text("Edit Buchungsgruppe")
1528 $form->{title} = "Add";
1531 "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1532 unless $form->{callback};
1533 AM->get_buchungsgruppe(\%myconfig, \%$form);
1534 $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
1535 for (my $i = 0; 4 > $i; $i++) {
1536 map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; }
1537 qw(income expense));
1540 &buchungsgruppe_header;
1543 $lxdebug->leave_sub();
1546 sub edit_buchungsgruppe {
1547 $lxdebug->enter_sub();
1549 $form->{title} = "Edit";
1551 AM->get_buchungsgruppe(\%myconfig, \%$form);
1553 &buchungsgruppe_header;
1557 $lxdebug->leave_sub();
1560 sub list_buchungsgruppe {
1561 $lxdebug->enter_sub();
1563 AM->buchungsgruppe(\%myconfig, \%$form);
1566 "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1568 $callback = $form->escape($form->{callback});
1570 $form->{title} = $locale->text('Buchungsgruppen');
1572 @column_index = qw(up down description inventory_accno
1573 income_accno_0 expense_accno_0
1574 income_accno_1 expense_accno_1
1575 income_accno_2 expense_accno_2
1576 income_accno_3 expense_accno_3 );
1578 $column_header{up} =
1579 qq|<th class="listheading" width="16">|
1580 . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
1582 $column_header{down} =
1583 qq|<th class="listheading" width="16">|
1584 . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
1586 $column_header{description} =
1587 qq|<th class="listheading" width="40%">|
1588 . $locale->text('Description')
1590 $column_header{inventory_accno} =
1591 qq|<th class=listheading>|
1592 . $locale->text('Bestandskonto')
1594 $column_header{income_accno_0} =
1595 qq|<th class=listheading>|
1596 . $locale->text('Erlöse Inland')
1598 $column_header{expense_accno_0} =
1599 qq|<th class=listheading>|
1600 . $locale->text('Aufwand Inland')
1602 $column_header{income_accno_1} =
1603 qq|<th class=listheading>|
1604 . $locale->text('Erlöse EU m. UStId')
1606 $column_header{expense_accno_1} =
1607 qq|<th class=listheading>|
1608 . $locale->text('Aufwand EU m. UStId')
1610 $column_header{income_accno_2} =
1611 qq|<th class=listheading>|
1612 . $locale->text('Erlöse EU o. UStId')
1614 $column_header{expense_accno_2} =
1615 qq|<th class=listheading>|
1616 . $locale->text('Aufwand EU o. UStId')
1618 $column_header{income_accno_3} =
1619 qq|<th class=listheading>|
1620 . $locale->text('Erlöse Ausland')
1622 $column_header{expense_accno_3} =
1623 qq|<th class=listheading>|
1624 . $locale->text('Aufwand Ausland')
1633 <th class=listtop>$form->{title}</th>
1635 <tr height="5"></tr>
1639 <tr class=listheading>
1642 map { print "$column_header{$_}\n" } @column_index;
1648 my $swap_link = qq|$form->{script}?action=swap_buchungsgruppen&|;
1649 map({ $swap_link .= $_ . "=" . $form->escape($form->{$_}) . "&" }
1650 qw(login password path));
1653 foreach $ref (@{ $form->{ALL} }) {
1659 <tr valign=top class=listrow$i>
1663 my $pref = $form->{ALL}->[$row - 1];
1665 qq|<td align="center" valign="center" width="16">| .
1666 qq|<a href="${swap_link}id1=$ref->{id}&id2=$pref->{id}">| .
1667 qq|<img border="0" src="image/up.png" alt="| . $locale->text("up") . qq|">| .
1670 $column_data{up} = qq|<td width="16"> </td>|;
1673 if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
1674 $column_data{down} = qq|<td width="16"> </td>|;
1676 my $nref = $form->{ALL}->[$row + 1];
1677 $column_data{down} =
1678 qq|<td align="center" valign="center" width="16">| .
1679 qq|<a href="${swap_link}id1=$ref->{id}&id2=$nref->{id}">| .
1680 qq|<img border="0" src="image/down.png" alt="| . $locale->text("down") . qq|">| .
1684 $column_data{description} =
1685 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>|;
1686 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1687 $column_data{income_accno_0} =
1688 qq|<td align=right>$ref->{income_accno_0}</td>|;
1689 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1690 $column_data{income_accno_1} =
1691 qq|<td align=right>$ref->{income_accno_1}</td>|;
1692 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1693 $column_data{income_accno_2} =
1694 qq|<td align=right>$ref->{income_accno_2}</td>|;
1695 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1696 $column_data{income_accno_3} =
1697 qq|<td align=right>$ref->{income_accno_3}</td>|;
1698 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1700 map { print "$column_data{$_}\n" } @column_index;
1714 <td><hr size=3 noshade></td>
1719 <form method=post action=$form->{script}>
1721 <input name=callback type=hidden value="$form->{callback}">
1723 <input type=hidden name=type value=buchungsgruppe>
1725 <input type=hidden name=path value=$form->{path}>
1726 <input type=hidden name=login value=$form->{login}>
1727 <input type=hidden name=password value=$form->{password}>
1729 <input class=submit type=submit name=action value="|
1730 . $locale->text('Add') . qq|">
1738 $lxdebug->leave_sub();
1741 sub buchungsgruppe_header {
1742 $lxdebug->enter_sub();
1744 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1746 # $locale->text('Buchungsgruppe hinzufügen')
1747 # $locale->text('Buchungsgruppe bearbeiten')
1749 my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
1750 my %acc_type_map = (
1751 "IC" => $acc_inventory,
1752 "IC_income" => $acc_income,
1753 "IC_sale" => $acc_income,
1754 "IC_expense" => $acc_expense,
1755 "IC_cogs" => $acc_expense,
1758 foreach $key (keys(%acc_type_map)) {
1759 foreach $ref (@{ $form->{IC_links}{$key} }) {
1760 $acc_type_map{$key}->{$ref->{"id"}} = $ref;
1764 foreach my $type (qw(IC IC_income IC_expense)) {
1765 $form->{"select$type"} =
1767 map({ "<option value=$_->{id} $_->{selected}>" .
1768 "$_->{accno}--" . H($_->{description}) . "</option>" }
1769 sort({ $a->{"accno"} cmp $b->{"accno"} }
1770 values(%{$acc_type_map{$type}}))));
1774 $form->{selectIC} =~ s/selected//g;
1775 $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/;
1776 $form->{selectIC_income} =~ s/selected//g;
1777 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1778 $form->{selectIC_expense} =~ s/selected//g;
1779 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1785 <th align=right>| . $locale->text('Inventory') . qq|</th>
1786 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1787 <input name=selectIC type=hidden value="$form->{selectIC}">
1791 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
1795 $linkaccounts .= qq|
1797 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
1798 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
1801 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
1802 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
1805 $form->{selectIC_income} =~ s/selected//g;
1806 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
1807 $form->{selectIC_expense} =~ s/selected//g;
1808 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
1810 $linkaccounts .= qq| <tr>
1811 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
1812 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
1815 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
1816 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
1820 $form->{selectIC_income} =~ s/selected//g;
1821 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
1822 $form->{selectIC_expense} =~ s/selected//g;
1823 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
1826 $linkaccounts .= qq| <tr>
1827 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
1828 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
1831 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
1832 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
1836 $form->{selectIC_income} =~ s/selected//g;
1837 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
1838 $form->{selectIC_expense} =~ s/selected//g;
1839 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
1842 $linkaccounts .= qq| <tr>
1843 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
1844 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
1847 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
1848 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
1858 <form method=post action=$form->{script}>
1860 <input type=hidden name=id value=$form->{id}>
1861 <input type=hidden name=type value=buchungsgruppe>
1865 <th class=listtop colspan=2>$form->{title}</th>
1867 <tr height="5"></tr>
1869 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
1870 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1873 <td colspan=2><hr size=3 noshade></td>
1878 $lxdebug->leave_sub();
1881 sub save_buchungsgruppe {
1882 $lxdebug->enter_sub();
1884 $form->isblank("description", $locale->text('Description missing!'));
1886 AM->save_buchungsgruppe(\%myconfig, \%$form);
1887 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
1889 $lxdebug->leave_sub();
1892 sub delete_buchungsgruppe {
1893 $lxdebug->enter_sub();
1895 AM->delete_buchungsgruppe(\%myconfig, \%$form);
1896 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
1898 $lxdebug->leave_sub();
1901 sub swap_buchungsgruppen {
1902 $lxdebug->enter_sub();
1904 AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen");
1905 list_buchungsgruppe();
1907 $lxdebug->leave_sub();
1912 $lxdebug->enter_sub();
1914 $form->{title} = "Add";
1917 "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
1918 unless $form->{callback};
1923 $lxdebug->leave_sub();
1927 $lxdebug->enter_sub();
1929 $form->{title} = "Edit";
1931 AM->get_printer(\%myconfig, \%$form);
1935 $form->{orphaned} = 1;
1938 $lxdebug->leave_sub();
1942 $lxdebug->enter_sub();
1944 AM->printer(\%myconfig, \%$form);
1947 "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1949 $callback = $form->escape($form->{callback});
1951 $form->{title} = $locale->text('Printer');
1953 @column_index = qw(printer_description printer_command template_code);
1955 $column_header{printer_description} =
1956 qq|<th class=listheading width=60%>|
1957 . $locale->text('Printer Description')
1959 $column_header{printer_command} =
1960 qq|<th class=listheading width=10%>|
1961 . $locale->text('Printer Command')
1963 $column_header{template_code} =
1964 qq|<th class=listheading>|
1965 . $locale->text('Template Code')
1975 <th class=listtop>$form->{title}</th>
1977 <tr height="5"></tr>
1981 <tr class=listheading>
1984 map { print "$column_header{$_}\n" } @column_index;
1990 foreach $ref (@{ $form->{ALL} }) {
1996 <tr valign=top class=listrow$i>
2000 $column_data{printer_description} =
2001 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>|;
2002 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
2003 $column_data{template_code} =
2004 qq|<td align=right>$ref->{template_code}</td>|;
2006 map { print "$column_data{$_}\n" } @column_index;
2018 <td><hr size=3 noshade></td>
2023 <form method=post action=$form->{script}>
2025 <input name=callback type=hidden value="$form->{callback}">
2027 <input type=hidden name=type value=printer>
2029 <input type=hidden name=path value=$form->{path}>
2030 <input type=hidden name=login value=$form->{login}>
2031 <input type=hidden name=password value=$form->{password}>
2033 <input class=submit type=submit name=action value="|
2034 . $locale->text('Add') . qq|">
2042 $lxdebug->leave_sub();
2045 sub printer_header {
2046 $lxdebug->enter_sub();
2048 $form->{title} = $locale->text("$form->{title} Printer");
2050 # $locale->text('Add Printer')
2051 # $locale->text('Edit Printer')
2053 $form->{printer_description} =~ s/\"/"/g;
2054 $form->{template_code} =~ s/\"/"/g;
2055 $form->{printer_command} =~ s/\"/"/g;
2063 <form method=post action=$form->{script}>
2065 <input type=hidden name=id value=$form->{id}>
2066 <input type=hidden name=type value=printer>
2070 <th class=listtop colspan=2>$form->{title}</th>
2072 <tr height="5"></tr>
2074 <th align=right>| . $locale->text('Printer') . qq|</th>
2075 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2078 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2079 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2082 <th align=right>| . $locale->text('Template Code') . qq|</th>
2083 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2085 <td colspan=2><hr size=3 noshade></td>
2090 $lxdebug->leave_sub();
2094 $lxdebug->enter_sub();
2096 $form->isblank("printer_description", $locale->text('Description missing!'));
2097 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2098 AM->save_printer(\%myconfig, \%$form);
2099 $form->redirect($locale->text('Printer saved!'));
2101 $lxdebug->leave_sub();
2104 sub delete_printer {
2105 $lxdebug->enter_sub();
2107 AM->delete_printer(\%myconfig, \%$form);
2108 $form->redirect($locale->text('Printer deleted!'));
2110 $lxdebug->leave_sub();
2114 $lxdebug->enter_sub();
2116 $form->{title} = "Add";
2119 "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
2120 unless $form->{callback};
2122 $form->{terms_netto} = 0;
2123 $form->{terms_skonto} = 0;
2124 $form->{percent_skonto} = 0;
2125 my @languages = AM->language(\%myconfig, $form, 1);
2126 map({ $_->{"language"} = $_->{"description"};
2127 $_->{"language_id"} = $_->{"id"}; } @languages);
2128 $form->{"TRANSLATION"} = \@languages;
2132 $lxdebug->leave_sub();
2136 $lxdebug->enter_sub();
2138 $form->{title} = "Edit";
2140 AM->get_payment(\%myconfig, $form);
2141 $form->{percent_skonto} =
2142 $form->format_amount(\%myconfig, $form->{percent_skonto} * 100);
2146 $form->{orphaned} = 1;
2149 $lxdebug->leave_sub();
2153 $lxdebug->enter_sub();
2155 AM->payment(\%myconfig, \%$form);
2157 $form->{callback} = build_std_url("action=list_payment");
2159 $callback = $form->escape($form->{callback});
2161 $form->{title} = $locale->text('Payment Terms');
2163 @column_index = qw(up down description description_long terms_netto
2164 terms_skonto percent_skonto);
2166 $column_header{up} =
2167 qq|<th class="listheading" align="center" valign="center" width="16">|
2168 . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
2170 $column_header{down} =
2171 qq|<th class="listheading" align="center" valign="center" width="16">|
2172 . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
2174 $column_header{description} =
2175 qq|<th class=listheading>|
2176 . $locale->text('Description')
2178 $column_header{description_long} =
2179 qq|<th class=listheading>|
2180 . $locale->text('Long Description')
2182 $column_header{terms_netto} =
2183 qq|<th class=listheading>|
2184 . $locale->text('Netto Terms')
2186 $column_header{terms_skonto} =
2187 qq|<th class=listheading>|
2188 . $locale->text('Skonto Terms')
2190 $column_header{percent_skonto} =
2191 qq|<th class=listheading>|
2192 . $locale->text('Skonto')
2202 <th class=listtop>$form->{title}</th>
2204 <tr height="5"></tr>
2208 <tr class=listheading>
2211 map { print "$column_header{$_}\n" } @column_index;
2217 my $swap_link = build_std_url("action=swap_payment_terms");
2220 foreach $ref (@{ $form->{ALL} }) {
2226 <tr valign=top class=listrow$i>
2230 my $pref = $form->{ALL}->[$row - 1];
2232 qq|<td align="center" valign="center" width="16">| .
2233 qq|<a href="${swap_link}&id1=$ref->{id}&id2=$pref->{id}">| .
2234 qq|<img border="0" src="image/up.png" alt="| . $locale->text("up") . qq|">| .
2237 $column_data{up} = qq|<td width="16"> </td>|;
2240 if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
2241 $column_data{down} = qq|<td width="16"> </td>|;
2243 my $nref = $form->{ALL}->[$row + 1];
2244 $column_data{down} =
2245 qq|<td align="center" valign="center" width="16">| .
2246 qq|<a href="${swap_link}&id1=$ref->{id}&id2=$nref->{id}">| .
2247 qq|<img border="0" src="image/down.png" alt="| . $locale->text("down") . qq|">| .
2251 $column_data{description} =
2253 build_std_url("action=edit_payment", "id=$ref->{id}", "callback=$callback") .
2254 qq|">| . H($ref->{description}) . qq|</a></td>|;
2255 $column_data{description_long} =
2256 qq|<td>| . H($ref->{description_long}) . qq|</td>|;
2257 $column_data{terms_netto} =
2258 qq|<td align=right>$ref->{terms_netto}</td>|;
2259 $column_data{terms_skonto} =
2260 qq|<td align=right>$ref->{terms_skonto}</td>|;
2261 $column_data{percent_skonto} =
2262 qq|<td align=right>| .
2263 $form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) .
2265 map { print "$column_data{$_}\n" } @column_index;
2278 <td><hr size=3 noshade></td>
2283 <form method=post action=$form->{script}>
2285 <input name=callback type=hidden value="$form->{callback}">
2287 <input type=hidden name=type value=payment>
2289 <input type=hidden name=path value=$form->{path}>
2290 <input type=hidden name=login value=$form->{login}>
2291 <input type=hidden name=password value=$form->{password}>
2293 <input class=submit type=submit name=action value="|
2294 . $locale->text('Add') . qq|">
2302 $lxdebug->leave_sub();
2305 sub payment_header {
2306 $lxdebug->enter_sub();
2308 $form->{title} = $locale->text("$form->{title} Payment Terms");
2310 # $locale->text('Add Payment Terms')
2311 # $locale->text('Edit Payment Terms')
2313 $form->{description} =~ s/\"/"/g;
2322 <form method=post action=$form->{script}>
2324 <input type=hidden name=id value=$form->{id}>
2325 <input type=hidden name=type value=payment>
2329 <th class=listtop colspan=2>$form->{title}</th>
2331 <tr height="5"></tr>
2333 <th align=right>| . $locale->text('Description') . qq|</th>
2334 <td><input name=description size=30 value="$form->{description}"></td>
2337 <th align=right>| . $locale->text('Long Description') . qq|</th>
2338 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2342 foreach my $language (@{ $form->{"TRANSLATION"} }) {
2345 <th align="right">| .
2346 sprintf($locale->text('Translation (%s)'),
2347 $language->{"language"})
2349 <td><input name="description_long_$language->{language_id}" size="50"
2350 value="| . Q($language->{"description_long"}) . qq|"></td>
2357 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2358 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2361 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2362 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2365 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2366 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2368 <td colspan=2><hr size=3 noshade></td>
2372 <p>| . $locale->text("You can use the following strings in the long " .
2373 "description and all translations. They will be " .
2374 "replaced by their actual values by Lx-Office " .
2375 "before they're output.")
2379 <li>| . $locale->text("<%netto_date%> -- Date the payment is due in " .
2382 <li>| . $locale->text("<%skonto_date%> -- Date the payment is due " .
2385 <li>| . $locale->text("<%skonto_amount%> -- The deductible amount")
2387 <li>| . $locale->text("<%total%> -- Amount payable")
2389 <li>| . $locale->text("<%invtotal%> -- Invoice total")
2391 <li>| . $locale->text("<%currency%> -- The selected currency")
2393 <li>| . $locale->text("<%terms_netto%> -- The number of days for " .
2396 <li>| . $locale->text("<%account_number%> -- Your account number")
2398 <li>| . $locale->text("<%bank%> -- Your bank")
2400 <li>| . $locale->text("<%bank_code%> -- Your bank code")
2404 $lxdebug->leave_sub();
2408 $lxdebug->enter_sub();
2410 $form->isblank("description", $locale->text('Description missing!'));
2411 $form->{"percent_skonto"} =
2412 $form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100;
2413 AM->save_payment(\%myconfig, \%$form);
2414 $form->redirect($locale->text('Payment Terms saved!'));
2416 $lxdebug->leave_sub();
2419 sub delete_payment {
2420 $lxdebug->enter_sub();
2422 AM->delete_payment(\%myconfig, \%$form);
2423 $form->redirect($locale->text('Payment terms deleted!'));
2425 $lxdebug->leave_sub();
2428 sub swap_payment_terms {
2429 $lxdebug->enter_sub();
2431 AM->swap_sortkeys(\%myconfig, $form, "payment_terms");
2434 $lxdebug->leave_sub();
2437 sub display_template {
2438 $lxdebug->enter_sub();
2441 display_template_form();
2443 $lxdebug->leave_sub();
2447 $lxdebug->enter_sub();
2450 display_template_form();
2452 $lxdebug->leave_sub();
2456 $lxdebug->enter_sub();
2458 $form->isblank("formname", $locale->text("You're not editing a file.")) unless ($form->{type} eq "stylesheet");
2460 my ($filename) = AM->prepare_template_filename(\%myconfig, $form);
2461 if (my $error = AM->save_template($filename, $form->{content})) {
2462 $form->error(sprintf($locale->text("Saving the file '%s' failed. OS error message: %s"), $filename, $error));
2466 display_template_form();
2468 $lxdebug->leave_sub();
2471 sub display_template_form {
2472 $lxdebug->enter_sub();
2474 $form->{formname} =~ s|.*/||;
2475 my $format = $form->{format} eq "html" ? "html" : "tex";
2477 my $title = $form->{type} eq "stylesheet" ? $locale->text("Edit the stylesheet") : $locale->text("Edit templates");
2478 $form->{title} = $title;
2482 my @hidden = qw(login path password type format);
2484 if (($form->{type} ne "stylesheet") && !$form->{edit}) {
2485 $edit_options = "<p>";
2487 my %formname_setup =
2489 "balance_sheet" => { "translation" => $locale->text('Balance Sheet'), "html" => 1 },
2490 "bin_list" => $locale->text('Bin List'),
2491 "bwa" => { "translation" => $locale->text('BWA'), "html" => 1 },
2492 "check" => { "translation" => $locale->text('Check'), "html" => 1 },
2493 "credit_note" => $locale->text('Credit Note'),
2494 "income_statement" => { "translation" => $locale->text('Income Statement'), "html" => 1 },
2495 "invoice" => $locale->text('Invoice'),
2496 "packing_list" => $locale->text('Packing List'),
2497 "pick_list" => $locale->text('Pick List'),
2498 "proforma" => $locale->text('Proforma Invoice'),
2499 "purchase_order" => $locale->text('Purchase Order'),
2500 "receipt" => { "translation" => $locale->text('Receipt'), "tex" => 1 },
2501 "request_quotation" => $locale->text('RFQ'),
2502 "sales_order" => $locale->text('Confirmation'),
2503 "sales_quotation" => $locale->text('Quotation'),
2504 "statement" => $locale->text('Statement'),
2505 "storno_invoice" => $locale->text('Storno Invoice'),
2506 "storno_packing_list" => $locale->text('Storno Packing List'),
2507 "ustva-2004" => { "translation" => $locale->text("USTVA 2004"), "tex" => 1 },
2508 "ustva-2005" => { "translation" => $locale->text("USTVA 2005"), "tex" => 1 },
2509 "ustva-2006" => { "translation" => $locale->text("USTVA 2006"), "tex" => 1 },
2510 "ustva-2007" => { "translation" => $locale->text("USTVA 2007"), "tex" => 1 },
2511 "ustva" => $locale->text("USTVA"),
2512 "zahlungserinnerung" => $locale->text('Payment Reminder'),
2515 my (@values, %labels, $file, $setup);
2517 while (($file, $setup) = each(%formname_setup)) {
2518 next unless (!ref($setup) || $setup->{$format});
2520 push(@values, $file);
2521 $labels{$file} = ref($setup) ? $setup->{translation} : $setup;
2523 @values = sort({ $labels{$a} cmp $labels{$b} } @values);
2526 $locale->text("Template") . " " .
2527 NTI($cgi->popup_menu("-name" => "formname", "-default" => $form->{formname},
2528 "-values" => \@values, "-labels" => \%labels));
2530 $form->get_lists("printers" => "ALL_PRINTERS",
2531 "languages" => "ALL_LANGUAGES");
2536 foreach my $item (@{ $form->{ALL_LANGUAGES} }) {
2537 next unless ($item->{template_code});
2538 my $key = "$item->{id}--$item->{template_code}";
2539 push(@values, $key);
2540 $labels{$key} = $item->{description};
2543 if (1 != scalar(@values)) {
2545 " " . $locale->text("Language") . " " .
2546 NTI($cgi->popup_menu("-name" => "language", "-default" => $form->{language},
2547 "-values" => \@values, "-labels" => \%labels));
2553 foreach my $item (@{ $form->{ALL_PRINTERS} }) {
2554 next unless ($item->{template_code});
2555 my $key = "$item->{id}--$item->{template_code}";
2556 push(@values, $key);
2557 $labels{$key} = $item->{printer_description};
2560 if (1 != scalar(@values)) {
2562 " " . $locale->text("Printer") . " " .
2563 NTI($cgi->popup_menu("-name" => "printer", "-default" => $form->{printer},
2564 "-values" => \@values, "-labels" => \%labels));
2567 $edit_options .= qq|
2569 <input type="hidden" name="display_nextsub" value="display_template">
2571 <input name="action" type="submit" class="submit" value="|
2572 . $locale->text('Display') . qq|">
2580 push(@hidden, qw(formname language printer));
2583 if ($form->{formname} || ($form->{type} eq "stylesheet")) {
2584 my ($filename, $display_filename) = AM->prepare_template_filename(\%myconfig, $form);
2585 my ($content, $lines) = AM->load_template($filename);
2590 if ($form->{edit}) {
2591 $form->{fokus} = "Form.content";
2592 $body = qq|\n<p><div class="listtop">| . $locale->text('Edit file') . " '" . H($display_filename) . qq|'</div></p>\n<p>|
2593 . NTI($cgi->textarea("-name" => "content",
2595 "-default" => $content,
2601 <input type="hidden" name="save_nextsub" value="save_template">
2603 <input type="submit" name="action" value="| . $locale->text('Save') . qq|">
2608 $content = "\n\n" unless ($content);
2611 <p><div class="listtop">| . $locale->text('Display file') . " '" . H($display_filename) . qq|'</div></p>
2613 <input type="hidden" name="edit_nextsub" value="edit_template">
2615 <p><input name="action" type="submit" class="submit" value="| . $locale->text('Edit') . qq|"></p>
2618 <pre class="filecontent">| . H($content) . qq|</pre>
2624 <input name="action" type="submit" class="submit" value="|
2625 . $locale->text('Edit') . qq|">
2636 <div class="listheading">$title</div>
2638 <form method="post" name="Form" action="am.pl">
2641 $form->hide_form(@hidden);
2654 $lxdebug->leave_sub();
2658 $lxdebug->enter_sub();
2660 # get defaults for account numbers and last numbers
2661 AM->defaultaccounts(\%myconfig, \%$form);
2663 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2665 ($item eq $myconfig{dateformat})
2666 ? "<option selected>$item\n"
2667 : "<option>$item\n";
2670 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2672 ($item eq $myconfig{numberformat})
2673 ? "<option selected>$item\n"
2674 : "<option>$item\n";
2677 foreach $item (qw(name company address signature)) {
2678 $myconfig{$item} =~ s/\"/"/g;
2681 foreach $item (qw(address signature)) {
2682 $myconfig{$item} =~ s/\\n/\r\n/g;
2686 if ($opendocument_templates && $openofficeorg_writer_bin &&
2687 $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
2688 push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
2689 "value" => "opendocument_pdf" });
2691 if ($latex_templates) {
2692 push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
2694 push(@formats, { "name" => "HTML", "value" => "html" });
2695 if ($latex_templates) {
2696 push(@formats, { "name" => $locale->text("Postscript"),
2697 "value" => "postscript" });
2699 if ($opendocument_templates) {
2700 push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
2701 "value" => "opendocument" });
2704 if (!$myconfig{"template_format"}) {
2705 $myconfig{"template_format"} = "pdf";
2707 my $template_format = "";
2708 foreach $item (@formats) {
2710 "<option value=\"$item->{value}\"" .
2711 ($item->{"value"} eq $myconfig{"template_format"} ?
2713 ">" . H($item->{"name"}) . "</option>";
2716 if (!$myconfig{"default_media"}) {
2717 $myconfig{"default_media"} = "screen";
2719 my %selected = ($myconfig{"default_media"} => "selected");
2720 my $default_media = qq|
2721 <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
2722 <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
2723 <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
2727 $selected{$myconfig{"default_printer_id"}} = "selected"
2728 if ($myconfig{"default_printer_id"});
2729 my $default_printer = qq|<option></option>|;
2730 AM->printer(\%myconfig, $form);
2731 foreach my $printer (@{$form->{"ALL"}}) {
2732 $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
2733 qq|" $selected{$printer->{'id'}}>| .
2734 H($printer->{"printer_description"}) . qq|</option>|;
2737 %countrycodes = User->country_codes;
2739 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2743 ($myconfig{countrycode} eq $key)
2744 ? "<option selected value=$key>$countrycodes{$key}\n"
2745 : "<option value=$key>$countrycodes{$key}\n";
2747 $countrycodes = "<option>American English\n$countrycodes";
2749 foreach $key (keys %{ $form->{IC} }) {
2750 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2752 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2753 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2754 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2758 # opendir CSS, "css/.";
2759 # @all = grep /.*\.css$/, readdir CSS;
2762 # css dir has styles that are not intended as general layouts.
2763 # reverting to hardcoded list
2764 @all = qw(lx-office-erp.css Win2000.css);
2766 foreach $item (@all) {
2767 if ($item eq $myconfig{stylesheet}) {
2768 $selectstylesheet .= qq|<option selected>$item\n|;
2770 $selectstylesheet .= qq|<option>$item\n|;
2773 $selectstylesheet .= "<option>\n";
2775 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2779 if ($myconfig{menustyle} eq "old") {
2780 $menustyle_old = "checked";
2781 } elsif ($myconfig{menustyle} eq "neu") {
2782 $menustyle_neu = "checked";
2783 } elsif ($myconfig{menustyle} eq "v3") {
2784 $menustyle_v3 = "checked";
2787 my ($show_form_details, $hide_form_details);
2788 $myconfig{"show_form_details"} = 1
2789 unless (defined($myconfig{"show_form_details"}));
2790 $show_form_details = "checked" if ($myconfig{"show_form_details"});
2791 $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
2796 <form method=post action=$form->{script}>
2798 <input type=hidden name=old_password value=$myconfig{password}>
2799 <input type=hidden name=type value=preferences>
2800 <input type=hidden name=role value=$myconfig{role}>
2803 <tr><th class=listtop>$form->{title}</th></tr>
2808 <th align=right>| . $locale->text('Name') . qq|</th>
2809 <td><input name=name size=15 value="$myconfig{name}"></td>
2812 <th align=right>| . $locale->text('Password') . qq|</th>
2813 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2816 <th align=right>| . $locale->text('E-mail') . qq|</th>
2817 <td><input name=email size=30 value="$myconfig{email}"></td>
2820 <th align=right>| . $locale->text('Signature') . qq|</th>
2821 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2824 <th align=right>| . $locale->text('Phone') . qq|</th>
2825 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2828 <th align=right>| . $locale->text('Fax') . qq|</th>
2829 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2832 <th align=right>| . $locale->text('Company') . qq|</th>
2833 <td><input name=company size=30 value="$myconfig{company}"></td>
2836 <th align=right>| . $locale->text('Address') . qq|</th>
2837 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2840 <th align=right>| . $locale->text('Date Format') . qq|</th>
2841 <td><select name=dateformat>$dateformat</select></td>
2844 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2845 <td><select name=numberformat>$numberformat</select></td>
2849 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2850 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2853 <th align=right>| . $locale->text('Language') . qq|</th>
2854 <td><select name=countrycode>$countrycodes</select></td>
2857 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
2858 <td><select name=usestylesheet>$selectstylesheet</select></td>
2861 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
2862 <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
2863 $locale->text("Top (CSS)") . qq|
2864 <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
2865 $locale->text("Top (Javascript)") . qq|
2866 <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
2867 $locale->text("Old (on the side)") . qq|</td>
2870 <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
2871 <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details>
2872 <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
2873 <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details>
2874 <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
2876 <input name=printer type=hidden value="$myconfig{printer}">
2877 <tr class=listheading>
2878 <th colspan=2>| . $locale->text("Print options") . qq|</th>
2881 <th align=right>| . $locale->text('Default template format') . qq|</th>
2882 <td><select name="template_format">$template_format</select></td>
2885 <th align=right>| . $locale->text('Default output medium') . qq|</th>
2886 <td><select name="default_media">$default_media</select></td>
2889 <th align=right>| . $locale->text('Default printer') . qq|</th>
2890 <td><select name="default_printer_id">$default_printer</select></td>
2893 <th align=right>| . $locale->text('Number of copies') . qq|</th>
2894 <td><input name="copies" size="10" value="| .
2895 $form->quote($myconfig{"copies"}) . qq|"></td>
2899 <tr class=listheading>
2900 <th colspan=2> </th>
2903 <th align=right>| . $locale->text('Business Number') . qq|</th>
2904 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
2907 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
2908 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
2910 <tr class=listheading>
2912 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
2918 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
2919 <td><select name=inventory_accno>$myconfig{IC}</select></td>
2922 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
2923 <td><select name=income_accno>$myconfig{IC_income}</select></td>
2926 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
2927 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
2930 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
2931 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
2934 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
2935 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
2940 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
2942 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
2951 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
2952 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
2953 <th align=right nowrap>|
2954 . $locale->text('Last Customer Number') . qq|</th>
2955 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
2958 <th align=right nowrap>|
2959 . $locale->text('Last Credit Note Number') . qq|</th>
2960 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
2961 <th align=right nowrap>|
2962 . $locale->text('Last Vendor Number') . qq|</th>
2963 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
2966 <th align=right nowrap>|
2967 . $locale->text('Last Sales Order Number') . qq|</th>
2968 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
2971 <th align=right nowrap>|
2972 . $locale->text('Last Purchase Order Number') . qq|</th>
2973 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
2974 <th align=right nowrap>|
2975 . $locale->text('Last Article Number') . qq|</th>
2976 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
2979 <th align=right nowrap>|
2980 . $locale->text('Last Sales Quotation Number') . qq|</th>
2981 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
2982 <th align=right nowrap>|
2983 . $locale->text('Last Service Number') . qq|</th>
2984 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
2987 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
2988 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
2989 <th align=right nowrap></th>
2995 # <tr class=listheading>
2996 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
3003 # <th>| . $locale->text('Rate') . qq| (%)</th>
3004 # <th>| . $locale->text('Number') . qq|</th>
3008 # foreach $accno (sort keys %{ $form->{taxrates} }) {
3011 # <th align=right>$form->{taxrates}{$accno}{description}</th>
3012 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
3013 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
3016 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
3019 # chop $form->{taxaccounts};
3022 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
3031 <td><hr size=3 noshade></td>
3035 <input type=hidden name=path value=$form->{path}>
3036 <input type=hidden name=login value=$form->{login}>
3037 <input type=hidden name=password value=$form->{password}>
3040 <input type=submit class=submit name=action value="|
3041 . $locale->text('Save') . qq|">
3049 $lxdebug->leave_sub();
3052 sub save_preferences {
3053 $lxdebug->enter_sub();
3055 $form->{stylesheet} = $form->{usestylesheet};
3057 $form->redirect($locale->text('Preferences saved!'))
3059 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
3061 $form->error($locale->text('Cannot save preferences!'));
3063 $lxdebug->leave_sub();
3067 $lxdebug->enter_sub();
3069 $form->{title} = $locale->text('Audit Control');
3071 AM->closedto(\%myconfig, \%$form);
3073 if ($form->{revtrans}) {
3074 $checked{Y} = "checked";
3076 $checked{N} = "checked";
3084 <form method=post action=$form->{script}>
3086 <input type=hidden name=path value=$form->{path}>
3087 <input type=hidden name=login value=$form->{login}>
3088 <input type=hidden name=password value=$form->{password}>
3091 <tr><th class=listtop>$form->{title}</th></tr>
3092 <tr height="5"></tr>
3098 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
3099 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
3100 . $locale->text('Yes')
3101 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
3102 . $locale->text('No')
3106 <th>| . $locale->text('Close Books up to') . qq|</th>
3107 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
3117 <input type=hidden name=nextsub value=doclose>
3119 <input type=submit class=submit name=action value="|
3120 . $locale->text('Continue') . qq|">
3128 $lxdebug->leave_sub();
3132 $lxdebug->enter_sub();
3134 AM->closebooks(\%myconfig, \%$form);
3136 if ($form->{revtrans}) {
3138 $locale->text('Transaction reversal enforced for all dates'));
3140 if ($form->{closedto}) {
3142 $locale->text('Transaction reversal enforced up to') . " "
3143 . $locale->date(\%myconfig, $form->{closedto}, 1));
3145 $form->redirect($locale->text('Books are open'));
3149 $lxdebug->leave_sub();
3153 $lxdebug->enter_sub();
3155 &{ $form->{nextsub} };
3157 $lxdebug->leave_sub();
3161 $lxdebug->enter_sub();
3163 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3164 AM->units_in_use(\%myconfig, $form, $units);
3165 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
3167 @languages = AM->language(\%myconfig, $form, 1);
3169 @unit_list = sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } values(%{$units}));
3172 foreach (@unit_list) {
3173 $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"} * 1) if ($_->{"factor"});
3174 $_->{"UNITLANGUAGES"} = [];
3175 foreach my $lang (@languages) {
3176 push(@{ $_->{"UNITLANGUAGES"} },
3178 "unit" => $_->{"name"},
3179 "language_id" => $lang->{"id"},
3180 "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
3181 "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
3187 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3188 $ddbox = AM->unit_select_data($units, undef, 1);
3190 my $updownlink = build_std_url("action=swap_units", "unit_type");
3192 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3194 print($form->parse_html_template("am/edit_units",
3195 { "UNITS" => \@unit_list,
3196 "NEW_BASE_UNIT_DDBOX" => $ddbox,
3197 "LANGUAGES" => \@languages,
3198 "updownlink" => $updownlink }));
3200 $lxdebug->leave_sub();
3204 $lxdebug->enter_sub();
3206 $form->isblank("new_name", $locale->text("The name is missing."));
3207 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3208 $all_units = AM->retrieve_units(\%myconfig, $form);
3209 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
3211 my ($base_unit, $factor);
3212 if ($form->{"new_base_unit"}) {
3213 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
3215 $form->isblank("new_factor", $locale->text("The factor is missing."));
3216 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
3217 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
3218 $base_unit = $form->{"new_base_unit"};
3222 foreach my $lang (AM->language(\%myconfig, $form, 1)) {
3223 next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
3224 push(@languages, { "id" => $lang->{"id"},
3225 "localized" => $form->{"new_localized_$lang->{id}"},
3226 "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
3230 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
3232 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3236 $lxdebug->leave_sub();
3239 sub set_unit_languages {
3240 $lxdebug->enter_sub();
3242 my ($unit, $languages, $idx) = @_;
3244 $unit->{"LANGUAGES"} = [];
3246 foreach my $lang (@{$languages}) {
3247 push(@{ $unit->{"LANGUAGES"} },
3248 { "id" => $lang->{"id"},
3249 "localized" => $form->{"localized_${idx}_$lang->{id}"},
3250 "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
3254 $lxdebug->leave_sub();
3258 $lxdebug->enter_sub();
3260 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3261 AM->units_in_use(\%myconfig, $form, $old_units);
3263 @languages = AM->language(\%myconfig, $form, 1);
3267 foreach $i (1..($form->{"rowcount"} * 1)) {
3268 $old_unit = $old_units->{$form->{"old_name_$i"}};
3270 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3273 if ($form->{"unchangeable_$i"}) {
3274 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3275 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3276 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3280 if ($old_unit->{"in_use"}) {
3281 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3284 if ($form->{"delete_$i"}) {
3285 push(@delete_units, $old_unit->{"name"});
3289 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3291 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3292 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3293 $new_units->{$form->{"name_$i"}} = \%h;
3294 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3295 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3298 foreach $unit (values(%{$new_units})) {
3299 next unless ($unit->{"old_name"});
3300 if ($unit->{"base_unit"}) {
3301 $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"}))
3302 unless (defined($new_units->{$unit->{"base_unit"}}));
3303 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3304 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3306 $unit->{"base_unit"} = undef;
3307 $unit->{"factor"} = undef;
3311 foreach $unit (values(%{$new_units})) {
3312 next if ($unit->{"unchanged_unit"});
3314 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3316 while ($new_unit->{"base_unit"}) {
3317 $new_unit->{"seen"} = 1;
3318 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3319 if ($new_unit->{"seen"}) {
3320 $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, " .
3321 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3326 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3328 $form->{"saved_message"} = $locale->text("The units have been saved.");
3332 $lxdebug->leave_sub();
3335 sub show_history_search {
3336 $lxdebug->enter_sub();
3338 $form->{title} = $locale->text("History Search");
3341 print $form->parse_html_template("/common/search_history");
3343 $lxdebug->leave_sub();
3346 sub show_am_history {
3347 $lxdebug->enter_sub();
3348 my %search = ( "Artikelnummer" => "parts",
3349 "Kundennummer" => "customer",
3350 "Lieferantennummer" => "vendor",
3351 "Projektnummer" => "project",
3352 "Buchungsnummer" => "oe",
3353 "Eingangsrechnungnummer" => "ap",
3354 "Ausgangsrechnungnummer" => "ar"
3356 my %searchNo = ( "Artikelnummer" => "partnumber",
3357 "Kundennummer" => "customernumber",
3358 "Lieferantennummer" => "vendornumber",
3359 "Projektnummer" => "projectnummer",
3360 "Buchungsnummer" => "ordnumber",
3361 "Eingangsrechnungnummer" => "invnumber",
3362 "Ausgangsrechnungnummer" => "invnumber"
3367 foreach(split(/\,/, $form->{einschraenkungen})) {
3369 $restriction .= " AND addition = '" . $_ . "'";
3373 $restriction .= " OR addition = '" . $_ . "'";
3377 $restriction .= (($form->{transdate} ne "" && $form->{reqdate} ne "")
3378 ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|' AND st.itime::date <= '| . $form->{reqdate} . qq|'|
3379 : (($form->{transdate} ne "" && $form->{reqdate} eq "")
3380 ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|'|
3381 : ($form->{transdate} eq "" && $form->{reqdate} ne "")
3382 ? qq| AND st.itime::date <= '| . $form->{reqdate} . qq|'|
3387 my $dbh = $form->dbconnect(\%myconfig);
3389 $restriction .= ($form->{mitarbeiter} eq "" ? ""
3390 : ($form->{mitarbeiter} =~ /^[0-9]*$/
3391 ? " AND employee_id = " . $form->{mitarbeiter}
3392 : " AND employee_id = " . &get_employee_id($form->{mitarbeiter}, $dbh)));
3394 my $query = qq|SELECT id FROM $search{$form->{what2search}}
3395 WHERE $searchNo{$form->{'what2search'}} ILIKE '$form->{"searchid"}'
3398 my $sth = $dbh->prepare($query);
3400 $sth->execute() || $form->dberror($query);
3402 $form->{title} = $locale->text("History Search");
3405 while(my $hash_ref = $sth->fetchrow_hashref()){
3406 print $form->parse_html_template("/common/show_history",
3407 {"DATEN" => $form->get_history($dbh,$hash_ref->{id},$restriction),
3408 "SUCCESS" => ($form->get_history($dbh,$hash_ref->{id},$restriction) != 0),
3409 "NONEWWINDOW" => "1"
3415 $lxdebug->leave_sub();
3418 sub get_employee_id {
3419 $lxdebug->enter_sub();
3420 my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|;
3421 my $sth = $_[1]->prepare($query);
3422 $sth->execute() || $form->dberror($query);
3423 my $return = $sth->fetch();
3425 return ${$return}[0];
3426 $lxdebug->leave_sub();
3430 $lxdebug->enter_sub();
3432 my $dir = $form->{"dir"} eq "down" ? "down" : "up";
3433 my $unit_type = $form->{"unit_type"} eq "dimension" ?
3434 "dimension" : "service";
3435 AM->swap_units(\%myconfig, $form, $dir, $form->{"name"}, $unit_type);
3439 $lxdebug->leave_sub();