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 "bin/mozilla/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&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=login value=$form->{login}>
489 <input type=hidden name=password value=$form->{password}>
492 if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
494 <input type=submit class=submit name=action value="|
495 . $locale->text('Save') . qq|">
499 if ($form->{id} && $form->{orphaned}) {
500 print qq|<input type=submit class=submit name=action value="|
501 . $locale->text('Delete') . qq|">|;
511 $lxdebug->leave_sub();
515 $lxdebug->enter_sub();
517 $form->isblank("accno", $locale->text('Account Number missing!'));
518 $form->isblank("category", $locale->text('Account Type missing!'));
520 $form->redirect($locale->text('Account saved!'))
521 if (AM->save_account(\%myconfig, \%$form));
522 $form->error($locale->text('Cannot save account!'));
524 $lxdebug->leave_sub();
528 $lxdebug->enter_sub();
530 CA->all_accounts(\%myconfig, \%$form);
532 $form->{title} = $locale->text('Chart of Accounts');
536 "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}";
541 $callback = $form->escape($callback);
543 foreach $ca (@{ $form->{CA} }) {
545 $ca->{debit} = " ";
546 $ca->{credit} = " ";
548 if ($ca->{amount} > 0) {
550 $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
552 if ($ca->{amount} < 0) {
554 $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
557 my @links = split( q{:}, $ca->{link});
561 foreach my $link (@links){
562 $link = ( $link eq 'AR') ? $locale->text('Account Link AR')
563 : ( $link eq 'AP') ? $locale->text('Account Link AP')
564 : ( $link eq 'IC') ? $locale->text('Account Link IC')
565 : ( $link eq 'AR_amount' ) ? $locale->text('Account Link AR_amount')
566 : ( $link eq 'AR_paid' ) ? $locale->text('Account Link AR_paid')
567 : ( $link eq 'AR_tax' ) ? $locale->text('Account Link AR_tax')
568 : ( $link eq 'AP_amount' ) ? $locale->text('Account Link AP_amount')
569 : ( $link eq 'AP_paid' ) ? $locale->text('Account Link AP_paid')
570 : ( $link eq 'AP_tax' ) ? $locale->text('Account Link AP_tax')
571 : ( $link eq 'IC_sale' ) ? $locale->text('Account Link IC_sale')
572 : ( $link eq 'IC_cogs' ) ? $locale->text('Account Link IC_cogs')
573 : ( $link eq 'IC_taxpart' ) ? $locale->text('Account Link IC_taxpart')
574 : ( $link eq 'IC_income' ) ? $locale->text('Account Link IC_income')
575 : ( $link eq 'IC_expense' ) ? $locale->text('Account Link IC_expense')
576 : ( $link eq 'IC_taxservice' ) ? $locale->text('Account Link IC_taxservice')
577 : ( $link eq 'CT_tax' ) ? $locale->text('Account Link CT_tax')
578 : $locale->text('Unknown Link') . ': ' . $link;
580 $ca->{link} .= qq|[| . $link . qq|] |;
583 $ca->{startdate} =~ s/,/<br>/og;
584 $ca->{tk_ustva} =~ s/,/<br>/og;
585 $ca->{taxkey} =~ s/,/<br>/og;
586 $ca->{taxaccount} =~ s/,/<br>/og;
587 $ca->{taxdescription} =~ s/,/<br>/og;
588 $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):q{};
590 $ca->{category} = ($ca->{category} eq 'A') ? $locale->text('Account Category A')
591 : ($ca->{category} eq 'E') ? $locale->text('Account Category E')
592 : ($ca->{category} eq 'L') ? $locale->text('Account Category L')
593 : ($ca->{category} eq 'I') ? $locale->text('Account Category I')
594 : ($ca->{category} eq 'Q') ? $locale->text('Account Category Q')
595 : ($ca->{category} eq 'C') ? $locale->text('Account Category C')
596 : ($ca->{category} eq 'G') ? $locale->text('Account Category G')
597 : $locale->text('Unknown Category') . ': ' . $ca->{category};
599 $ca->{link_edit_account} =
600 qq|$form->{script}?action=edit_account&id=$ca->{id}|
601 .qq|&login=$form->{login}|
602 .qq|&password=$form->{password}&callback=$callback|;
605 my $parameters_ref = {
608 # hidden_variables => $_hidden_variables_ref,
611 # Ausgabe des Templates
612 print($form->parse_html_template('am/list_accounts', $parameters_ref));
614 $lxdebug->leave_sub();
620 $lxdebug->enter_sub();
622 $form->{title} = $locale->text('Delete Account');
625 qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
627 if ($form->{id} == $form->{$id}) {
628 $form->error($locale->text('Cannot delete default account!'));
632 $form->redirect($locale->text('Account deleted!'))
633 if (AM->delete_account(\%myconfig, \%$form));
634 $form->error($locale->text('Cannot delete account!'));
636 $lxdebug->leave_sub();
640 $lxdebug->enter_sub();
642 $form->{title} = "Add";
646 "$form->{script}?action=add_department&login=$form->{login}&password=$form->{password}"
647 unless $form->{callback};
652 $lxdebug->leave_sub();
655 sub edit_department {
656 $lxdebug->enter_sub();
658 $form->{title} = "Edit";
660 AM->get_department(\%myconfig, \%$form);
665 $lxdebug->leave_sub();
668 sub list_department {
669 $lxdebug->enter_sub();
671 AM->departments(\%myconfig, \%$form);
674 "$form->{script}?action=list_department&login=$form->{login}&password=$form->{password}";
676 $callback = $form->escape($form->{callback});
678 $form->{title} = $locale->text('Departments');
680 @column_index = qw(description cost profit);
682 $column_header{description} =
683 qq|<th class=listheading width=90%>|
684 . $locale->text('Description')
686 $column_header{cost} =
687 qq|<th class=listheading nowrap>|
688 . $locale->text('Cost Center')
690 $column_header{profit} =
691 qq|<th class=listheading nowrap>|
692 . $locale->text('Profit Center')
702 <th class=listtop>$form->{title}</th>
708 <tr class=listheading>
711 map { print "$column_header{$_}\n" } @column_index;
717 foreach $ref (@{ $form->{ALL} }) {
723 <tr valign=top class=listrow$i>
726 $costcenter = ($ref->{role} eq "C") ? "X" : "";
727 $profitcenter = ($ref->{role} eq "P") ? "X" : "";
729 $column_data{description} =
730 qq|<td><a href=$form->{script}?action=edit_department&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
731 $column_data{cost} = qq|<td align=center>$costcenter</td>|;
732 $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
734 map { print "$column_data{$_}\n" } @column_index;
746 <td><hr size=3 noshade></td>
751 <form method=post action=$form->{script}>
753 <input name=callback type=hidden value="$form->{callback}">
755 <input type=hidden name=type value=department>
757 <input type=hidden name=login value=$form->{login}>
758 <input type=hidden name=password value=$form->{password}>
760 <input class=submit type=submit name=action value="|
761 . $locale->text('Add') . qq|">
769 $lxdebug->leave_sub();
772 sub department_header {
773 $lxdebug->enter_sub();
775 $form->{title} = $locale->text("$form->{title} Department");
777 # $locale->text('Add Department')
778 # $locale->text('Edit Department')
780 $form->{description} =~ s/\"/"/g;
782 if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
784 qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
787 qq|<input name=description size=60 value="$form->{description}">|;
790 $costcenter = "checked" if $form->{role} eq "C";
791 $profitcenter = "checked" if $form->{role} eq "P";
798 <form method=post action=$form->{script}>
800 <input type=hidden name=id value=$form->{id}>
801 <input type=hidden name=type value=department>
805 <th class=listtop colspan=2>$form->{title}</th>
809 <th align=right>| . $locale->text('Description') . qq|</th>
810 <td>$description</td>
814 <td><input type=radio style=radio name=role value="C" $costcenter> |
815 . $locale->text('Cost Center') . qq|
816 <input type=radio style=radio name=role value="P" $profitcenter> |
817 . $locale->text('Profit Center') . qq|
820 <td colspan=2><hr size=3 noshade></td>
825 $lxdebug->leave_sub();
828 sub save_department {
829 $lxdebug->enter_sub();
831 $form->isblank("description", $locale->text('Description missing!'));
832 AM->save_department(\%myconfig, \%$form);
833 $form->redirect($locale->text('Department saved!'));
835 $lxdebug->leave_sub();
838 sub delete_department {
839 $lxdebug->enter_sub();
841 AM->delete_department(\%myconfig, \%$form);
842 $form->redirect($locale->text('Department deleted!'));
844 $lxdebug->leave_sub();
848 $lxdebug->enter_sub();
850 $form->{title} = "Add";
853 "$form->{script}?action=add_lead&login=$form->{login}&password=$form->{password}"
854 unless $form->{callback};
859 $lxdebug->leave_sub();
863 $lxdebug->enter_sub();
865 $form->{title} = "Edit";
867 AM->get_lead(\%myconfig, \%$form);
871 $form->{orphaned} = 1;
874 $lxdebug->leave_sub();
878 $lxdebug->enter_sub();
880 AM->lead(\%myconfig, \%$form);
883 "$form->{script}?action=list_lead&login=$form->{login}&password=$form->{password}";
885 $callback = $form->escape($form->{callback});
887 $form->{title} = $locale->text('Lead');
889 @column_index = qw(description cost profit);
891 $column_header{description} =
892 qq|<th class=listheading width=100%>|
893 . $locale->text('Description')
903 <th class=listtop>$form->{title}</th>
906 <tr class=listheading>
909 map { print "$column_header{$_}\n" } @column_index;
915 foreach $ref (@{ $form->{ALL} }) {
921 <tr valign=top class=listrow$i>
924 $lead = $ref->{lead};
926 $column_data{description} =
927 qq|<td><a href=$form->{script}?action=edit_lead&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{lead}</td>|;
929 map { print "$column_data{$_}\n" } @column_index;
938 <td><hr size=3 noshade></td>
943 <form method=post action=$form->{script}>
945 <input name=callback type=hidden value="$form->{callback}">
947 <input type=hidden name=type value=lead>
949 <input type=hidden name=login value=$form->{login}>
950 <input type=hidden name=password value=$form->{password}>
952 <input class=submit type=submit name=action value="|
953 . $locale->text('Add') . qq|">
961 $lxdebug->leave_sub();
965 $lxdebug->enter_sub();
967 $form->{title} = $locale->text("$form->{title} Lead");
969 # $locale->text('Add Lead')
970 # $locale->text('Edit Lead')
972 $form->{description} =~ s/\"/"/g;
975 qq|<input name=description size=50 value="$form->{lead}">|;
982 <form method=post action=$form->{script}>
984 <input type=hidden name=id value=$form->{id}>
985 <input type=hidden name=type value=lead>
989 <th class=listtop colspan=2>$form->{title}</th>
993 <th align=right>| . $locale->text('Description') . qq|</th>
994 <td>$description</td>
996 <td colspan=2><hr size=3 noshade></td>
1001 $lxdebug->leave_sub();
1005 $lxdebug->enter_sub();
1007 $form->isblank("description", $locale->text('Description missing!'));
1008 AM->save_lead(\%myconfig, \%$form);
1009 $form->redirect($locale->text('lead saved!'));
1011 $lxdebug->leave_sub();
1015 $lxdebug->enter_sub();
1017 AM->delete_lead(\%myconfig, \%$form);
1018 $form->redirect($locale->text('lead deleted!'));
1020 $lxdebug->leave_sub();
1024 $lxdebug->enter_sub();
1026 $form->{title} = "Add";
1029 "$form->{script}?action=add_business&login=$form->{login}&password=$form->{password}"
1030 unless $form->{callback};
1035 $lxdebug->leave_sub();
1039 $lxdebug->enter_sub();
1041 $form->{title} = "Edit";
1043 AM->get_business(\%myconfig, \%$form);
1047 $form->{orphaned} = 1;
1050 $lxdebug->leave_sub();
1054 $lxdebug->enter_sub();
1056 AM->business(\%myconfig, \%$form);
1059 "$form->{script}?action=list_business&login=$form->{login}&password=$form->{password}";
1061 $callback = $form->escape($form->{callback});
1063 $form->{title} = $locale->text('Type of Business');
1065 @column_index = qw(description discount customernumberinit);
1067 $column_header{description} =
1068 qq|<th class=listheading width=60%>|
1069 . $locale->text('Description')
1071 $column_header{discount} =
1072 qq|<th class=listheading width=10%>|
1073 . $locale->text('Discount')
1075 $column_header{customernumberinit} =
1076 qq|<th class=listheading>|
1077 . $locale->text('Customernumberinit')
1087 <th class=listtop>$form->{title}</th>
1089 <tr height="5"></tr>
1093 <tr class=listheading>
1096 map { print "$column_header{$_}\n" } @column_index;
1102 foreach $ref (@{ $form->{ALL} }) {
1108 <tr valign=top class=listrow$i>
1112 $form->format_amount(\%myconfig, $ref->{discount} * 100);
1114 $ref->{description};
1115 $column_data{description} =
1116 qq|<td><a href=$form->{script}?action=edit_business&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$description</td>|;
1117 $column_data{discount} = qq|<td align=right>$discount</td>|;
1118 $column_data{customernumberinit} =
1119 qq|<td align=right>$ref->{customernumberinit}</td>|;
1121 map { print "$column_data{$_}\n" } @column_index;
1133 <td><hr size=3 noshade></td>
1138 <form method=post action=$form->{script}>
1140 <input name=callback type=hidden value="$form->{callback}">
1142 <input type=hidden name=type value=business>
1144 <input type=hidden name=login value=$form->{login}>
1145 <input type=hidden name=password value=$form->{password}>
1147 <input class=submit type=submit name=action value="|
1148 . $locale->text('Add') . qq|">
1156 $lxdebug->leave_sub();
1159 sub business_header {
1160 $lxdebug->enter_sub();
1162 $form->{title} = $locale->text("$form->{title} Business");
1164 # $locale->text('Add Business')
1165 # $locale->text('Edit Business')
1167 $form->{description} =~ s/\"/"/g;
1169 $form->format_amount(\%myconfig, $form->{discount} * 100);
1176 <form method=post action=$form->{script}>
1178 <input type=hidden name=id value=$form->{id}>
1179 <input type=hidden name=type value=business>
1183 <th class=listtop colspan=2>$form->{title}</th>
1185 <tr height="5"></tr>
1187 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1188 <td><input name=description size=30 value="$form->{description}"></td>
1191 <th align=right>| . $locale->text('Discount') . qq| %</th>
1192 <td><input name=discount size=5 value=$form->{discount}></td>
1195 <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
1196 <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
1198 <td colspan=2><hr size=3 noshade></td>
1203 $lxdebug->leave_sub();
1207 $lxdebug->enter_sub();
1209 $form->isblank("description", $locale->text('Description missing!'));
1210 $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100;
1211 AM->save_business(\%myconfig, \%$form);
1212 $form->redirect($locale->text('Business saved!'));
1214 $lxdebug->leave_sub();
1217 sub delete_business {
1218 $lxdebug->enter_sub();
1220 AM->delete_business(\%myconfig, \%$form);
1221 $form->redirect($locale->text('Business deleted!'));
1223 $lxdebug->leave_sub();
1227 $lxdebug->enter_sub();
1229 $form->{title} = "Add";
1232 "$form->{script}?action=add_language&login=$form->{login}&password=$form->{password}"
1233 unless $form->{callback};
1238 $lxdebug->leave_sub();
1242 $lxdebug->enter_sub();
1244 $form->{title} = "Edit";
1246 AM->get_language(\%myconfig, \%$form);
1250 $form->{orphaned} = 1;
1253 $lxdebug->leave_sub();
1257 $lxdebug->enter_sub();
1259 AM->language(\%myconfig, \%$form);
1262 "$form->{script}?action=list_language&login=$form->{login}&password=$form->{password}";
1264 $callback = $form->escape($form->{callback});
1266 $form->{title} = $locale->text('Languages');
1268 @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
1270 $column_header{description} =
1271 qq|<th class=listheading width=60%>|
1272 . $locale->text('Description')
1274 $column_header{template_code} =
1275 qq|<th class=listheading width=10%>|
1276 . $locale->text('Template Code')
1278 $column_header{article_code} =
1279 qq|<th class=listheading>|
1280 . $locale->text('Article Code')
1282 $column_header{output_numberformat} =
1283 qq|<th class=listheading>|
1284 . $locale->text('Number Format')
1286 $column_header{output_dateformat} =
1287 qq|<th class=listheading>|
1288 . $locale->text('Date Format')
1290 $column_header{output_longdates} =
1291 qq|<th class=listheading>|
1292 . $locale->text('Long Dates')
1302 <th class=listtop>$form->{title}</th>
1304 <tr height="5"></tr>
1308 <tr class=listheading>
1311 map { print "$column_header{$_}\n" } @column_index;
1317 foreach $ref (@{ $form->{ALL} }) {
1323 <tr valign=top class=listrow$i>
1327 $column_data{description} =
1328 qq|<td><a href=$form->{script}?action=edit_language&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
1329 $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
1330 $column_data{article_code} =
1331 qq|<td align=right>$ref->{article_code}</td>|;
1332 $column_data{output_numberformat} =
1334 ($ref->{output_numberformat} ? $ref->{output_numberformat} :
1335 $locale->text("use program settings")) .
1337 $column_data{output_dateformat} =
1339 ($ref->{output_dateformat} ? $ref->{output_dateformat} :
1340 $locale->text("use program settings")) .
1342 $column_data{output_longdates} =
1344 ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
1347 map { print "$column_data{$_}\n" } @column_index;
1359 <td><hr size=3 noshade></td>
1364 <form method=post action=$form->{script}>
1366 <input name=callback type=hidden value="$form->{callback}">
1368 <input type=hidden name=type value=language>
1370 <input type=hidden name=login value=$form->{login}>
1371 <input type=hidden name=password value=$form->{password}>
1373 <input class=submit type=submit name=action value="|
1374 . $locale->text('Add') . qq|">
1382 $lxdebug->leave_sub();
1385 sub language_header {
1386 $lxdebug->enter_sub();
1388 $form->{title} = $locale->text("$form->{title} Language");
1390 # $locale->text('Add Language')
1391 # $locale->text('Edit Language')
1393 $form->{description} =~ s/\"/"/g;
1394 $form->{template_code} =~ s/\"/"/g;
1395 $form->{article_code} =~ s/\"/"/g;
1401 qq|<option value="">| . $locale->text("use program settings") .
1403 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1405 ($item eq $form->{output_numberformat})
1406 ? "<option selected>$item"
1412 qq|<option value="">| . $locale->text("use program settings") .
1414 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1416 ($item eq $form->{output_dateformat})
1417 ? "<option selected>$item"
1425 <form method=post action=$form->{script}>
1427 <input type=hidden name=id value=$form->{id}>
1428 <input type=hidden name=type value=language>
1432 <th class=listtop colspan=2>$form->{title}</th>
1434 <tr height="5"></tr>
1436 <th align=right>| . $locale->text('Language') . qq|</th>
1437 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1440 <th align=right>| . $locale->text('Template Code') . qq|</th>
1441 <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
1444 <th align=right>| . $locale->text('Article Code') . qq|</th>
1445 <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
1448 <th align=right>| . $locale->text('Number Format') . qq|</th>
1449 <td><select name="output_numberformat">$numberformat</select></td>
1452 <th align=right>| . $locale->text('Date Format') . qq|</th>
1453 <td><select name="output_dateformat">$dateformat</select></td>
1456 <th align=right>| . $locale->text('Long Dates') . qq|</th>
1457 <td><input type="radio" name="output_longdates" value="1"| .
1458 ($form->{output_longdates} ? " checked" : "") .
1459 qq|>| . $locale->text("Yes") .
1460 qq|<input type="radio" name="output_longdates" value="0"| .
1461 ($form->{output_longdates} ? "" : " checked") .
1462 qq|>| . $locale->text("No") .
1465 <td colspan=2><hr size=3 noshade></td>
1470 $lxdebug->leave_sub();
1474 $lxdebug->enter_sub();
1476 $form->isblank("description", $locale->text('Language missing!'));
1477 $form->isblank("template_code", $locale->text('Template Code missing!'));
1478 $form->isblank("article_code", $locale->text('Article Code missing!'));
1479 AM->save_language(\%myconfig, \%$form);
1480 $form->redirect($locale->text('Language saved!'));
1482 $lxdebug->leave_sub();
1485 sub delete_language {
1486 $lxdebug->enter_sub();
1488 AM->delete_language(\%myconfig, \%$form);
1489 $form->redirect($locale->text('Language deleted!'));
1491 $lxdebug->leave_sub();
1495 sub add_buchungsgruppe {
1496 $lxdebug->enter_sub();
1498 # $locale->text("Add Buchungsgruppe")
1499 # $locale->text("Edit Buchungsgruppe")
1500 $form->{title} = "Add";
1503 "$form->{script}?action=add_buchungsgruppe&login=$form->{login}&password=$form->{password}"
1504 unless $form->{callback};
1505 AM->get_buchungsgruppe(\%myconfig, \%$form);
1506 $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
1507 for (my $i = 0; 4 > $i; $i++) {
1508 map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; }
1509 qw(income expense));
1512 &buchungsgruppe_header;
1515 $lxdebug->leave_sub();
1518 sub edit_buchungsgruppe {
1519 $lxdebug->enter_sub();
1521 $form->{title} = "Edit";
1523 AM->get_buchungsgruppe(\%myconfig, \%$form);
1525 &buchungsgruppe_header;
1529 $lxdebug->leave_sub();
1532 sub list_buchungsgruppe {
1533 $lxdebug->enter_sub();
1535 AM->buchungsgruppe(\%myconfig, \%$form);
1538 "$form->{script}?action=list_buchungsgruppe&login=$form->{login}&password=$form->{password}";
1540 $callback = $form->escape($form->{callback});
1542 $form->{title} = $locale->text('Buchungsgruppen');
1544 @column_index = qw(up down description inventory_accno
1545 income_accno_0 expense_accno_0
1546 income_accno_1 expense_accno_1
1547 income_accno_2 expense_accno_2
1548 income_accno_3 expense_accno_3 );
1550 $column_header{up} =
1551 qq|<th class="listheading" width="16">|
1552 . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
1554 $column_header{down} =
1555 qq|<th class="listheading" width="16">|
1556 . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
1558 $column_header{description} =
1559 qq|<th class="listheading" width="40%">|
1560 . $locale->text('Description')
1562 $column_header{inventory_accno} =
1563 qq|<th class=listheading>|
1564 . $locale->text('Bestandskonto')
1566 $column_header{income_accno_0} =
1567 qq|<th class=listheading>|
1568 . $locale->text('Erlöse Inland')
1570 $column_header{expense_accno_0} =
1571 qq|<th class=listheading>|
1572 . $locale->text('Aufwand Inland')
1574 $column_header{income_accno_1} =
1575 qq|<th class=listheading>|
1576 . $locale->text('Erlöse EU m. UStId')
1578 $column_header{expense_accno_1} =
1579 qq|<th class=listheading>|
1580 . $locale->text('Aufwand EU m. UStId')
1582 $column_header{income_accno_2} =
1583 qq|<th class=listheading>|
1584 . $locale->text('Erlöse EU o. UStId')
1586 $column_header{expense_accno_2} =
1587 qq|<th class=listheading>|
1588 . $locale->text('Aufwand EU o. UStId')
1590 $column_header{income_accno_3} =
1591 qq|<th class=listheading>|
1592 . $locale->text('Erlöse Ausland')
1594 $column_header{expense_accno_3} =
1595 qq|<th class=listheading>|
1596 . $locale->text('Aufwand Ausland')
1605 <th class=listtop>$form->{title}</th>
1607 <tr height="5"></tr>
1611 <tr class=listheading>
1614 map { print "$column_header{$_}\n" } @column_index;
1620 my $swap_link = qq|$form->{script}?action=swap_buchungsgruppen&|;
1621 map({ $swap_link .= $_ . "=" . $form->escape($form->{$_}) . "&" }
1622 qw(login password));
1625 foreach $ref (@{ $form->{ALL} }) {
1631 <tr valign=top class=listrow$i>
1635 my $pref = $form->{ALL}->[$row - 1];
1637 qq|<td align="center" valign="center" width="16">| .
1638 qq|<a href="${swap_link}id1=$ref->{id}&id2=$pref->{id}">| .
1639 qq|<img border="0" src="image/up.png" alt="| . $locale->text("up") . qq|">| .
1642 $column_data{up} = qq|<td width="16"> </td>|;
1645 if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
1646 $column_data{down} = qq|<td width="16"> </td>|;
1648 my $nref = $form->{ALL}->[$row + 1];
1649 $column_data{down} =
1650 qq|<td align="center" valign="center" width="16">| .
1651 qq|<a href="${swap_link}id1=$ref->{id}&id2=$nref->{id}">| .
1652 qq|<img border="0" src="image/down.png" alt="| . $locale->text("down") . qq|">| .
1656 $column_data{description} =
1657 qq|<td><a href=$form->{script}?action=edit_buchungsgruppe&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
1658 $column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
1659 $column_data{income_accno_0} =
1660 qq|<td align=right>$ref->{income_accno_0}</td>|;
1661 $column_data{expense_accno_0} = qq|<td align=right>$ref->{expense_accno_0}</td>|;
1662 $column_data{income_accno_1} =
1663 qq|<td align=right>$ref->{income_accno_1}</td>|;
1664 $column_data{expense_accno_1} = qq|<td align=right>$ref->{expense_accno_1}</td>|;
1665 $column_data{income_accno_2} =
1666 qq|<td align=right>$ref->{income_accno_2}</td>|;
1667 $column_data{expense_accno_2} = qq|<td align=right>$ref->{expense_accno_2}</td>|;
1668 $column_data{income_accno_3} =
1669 qq|<td align=right>$ref->{income_accno_3}</td>|;
1670 $column_data{expense_accno_3} = qq|<td align=right>$ref->{expense_accno_3}</td>|;
1672 map { print "$column_data{$_}\n" } @column_index;
1686 <td><hr size=3 noshade></td>
1691 <form method=post action=$form->{script}>
1693 <input name=callback type=hidden value="$form->{callback}">
1695 <input type=hidden name=type value=buchungsgruppe>
1697 <input type=hidden name=login value=$form->{login}>
1698 <input type=hidden name=password value=$form->{password}>
1700 <input class=submit type=submit name=action value="|
1701 . $locale->text('Add') . qq|">
1709 $lxdebug->leave_sub();
1712 sub buchungsgruppe_header {
1713 $lxdebug->enter_sub();
1715 $form->{title} = $locale->text("$form->{title} Buchungsgruppe");
1717 # $locale->text('Buchungsgruppe hinzufügen')
1718 # $locale->text('Buchungsgruppe bearbeiten')
1720 my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
1721 my %acc_type_map = (
1722 "IC" => $acc_inventory,
1723 "IC_income" => $acc_income,
1724 "IC_sale" => $acc_income,
1725 "IC_expense" => $acc_expense,
1726 "IC_cogs" => $acc_expense,
1729 foreach $key (keys(%acc_type_map)) {
1730 foreach $ref (@{ $form->{IC_links}{$key} }) {
1731 $acc_type_map{$key}->{$ref->{"id"}} = $ref;
1735 foreach my $type (qw(IC IC_income IC_expense)) {
1736 $form->{"select$type"} =
1738 map({ "<option value=$_->{id} $_->{selected}>" .
1739 "$_->{accno}--" . H($_->{description}) . "</option>" }
1740 sort({ $a->{"accno"} cmp $b->{"accno"} }
1741 values(%{$acc_type_map{$type}}))));
1745 $form->{selectIC} =~ s/selected//g;
1746 $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/;
1747 $form->{selectIC_income} =~ s/selected//g;
1748 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/;
1749 $form->{selectIC_expense} =~ s/selected//g;
1750 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/ value=$form->{expense_accno_id_0} selected/;
1756 <th align=right>| . $locale->text('Inventory') . qq|</th>
1757 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
1758 <input name=selectIC type=hidden value="$form->{selectIC}">
1762 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
1766 $linkaccounts .= qq|
1768 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
1769 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
1772 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
1773 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
1776 $form->{selectIC_income} =~ s/selected//g;
1777 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/ value=$form->{income_accno_id_1} selected/;
1778 $form->{selectIC_expense} =~ s/selected//g;
1779 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/;
1781 $linkaccounts .= qq| <tr>
1782 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
1783 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
1786 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
1787 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
1791 $form->{selectIC_income} =~ s/selected//g;
1792 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/ value=$form->{income_accno_id_2} selected/;
1793 $form->{selectIC_expense} =~ s/selected//g;
1794 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/ value=$form->{expense_accno_id_2} selected/;
1797 $linkaccounts .= qq| <tr>
1798 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
1799 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
1802 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
1803 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
1807 $form->{selectIC_income} =~ s/selected//g;
1808 $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/ value=$form->{income_accno_id_3} selected/;
1809 $form->{selectIC_expense} =~ s/selected//g;
1810 $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/ value=$form->{expense_accno_id_3} selected/;
1813 $linkaccounts .= qq| <tr>
1814 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
1815 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
1818 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
1819 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
1829 <form method=post action=$form->{script}>
1831 <input type=hidden name=id value=$form->{id}>
1832 <input type=hidden name=type value=buchungsgruppe>
1836 <th class=listtop colspan=2>$form->{title}</th>
1838 <tr height="5"></tr>
1840 <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
1841 <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1844 <td colspan=2><hr size=3 noshade></td>
1849 $lxdebug->leave_sub();
1852 sub save_buchungsgruppe {
1853 $lxdebug->enter_sub();
1855 $form->isblank("description", $locale->text('Description missing!'));
1857 AM->save_buchungsgruppe(\%myconfig, \%$form);
1858 $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
1860 $lxdebug->leave_sub();
1863 sub delete_buchungsgruppe {
1864 $lxdebug->enter_sub();
1866 AM->delete_buchungsgruppe(\%myconfig, \%$form);
1867 $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
1869 $lxdebug->leave_sub();
1872 sub swap_buchungsgruppen {
1873 $lxdebug->enter_sub();
1875 AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen");
1876 list_buchungsgruppe();
1878 $lxdebug->leave_sub();
1883 $lxdebug->enter_sub();
1885 $form->{title} = "Add";
1888 "$form->{script}?action=add_printer&login=$form->{login}&password=$form->{password}"
1889 unless $form->{callback};
1894 $lxdebug->leave_sub();
1898 $lxdebug->enter_sub();
1900 $form->{title} = "Edit";
1902 AM->get_printer(\%myconfig, \%$form);
1906 $form->{orphaned} = 1;
1909 $lxdebug->leave_sub();
1913 $lxdebug->enter_sub();
1915 AM->printer(\%myconfig, \%$form);
1918 "$form->{script}?action=list_printer&login=$form->{login}&password=$form->{password}";
1920 $callback = $form->escape($form->{callback});
1922 $form->{title} = $locale->text('Printer');
1924 @column_index = qw(printer_description printer_command template_code);
1926 $column_header{printer_description} =
1927 qq|<th class=listheading width=60%>|
1928 . $locale->text('Printer Description')
1930 $column_header{printer_command} =
1931 qq|<th class=listheading width=10%>|
1932 . $locale->text('Printer Command')
1934 $column_header{template_code} =
1935 qq|<th class=listheading>|
1936 . $locale->text('Template Code')
1946 <th class=listtop>$form->{title}</th>
1948 <tr height="5"></tr>
1952 <tr class=listheading>
1955 map { print "$column_header{$_}\n" } @column_index;
1961 foreach $ref (@{ $form->{ALL} }) {
1967 <tr valign=top class=listrow$i>
1971 $column_data{printer_description} =
1972 qq|<td><a href=$form->{script}?action=edit_printer&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{printer_description}</td>|;
1973 $column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
1974 $column_data{template_code} =
1975 qq|<td align=right>$ref->{template_code}</td>|;
1977 map { print "$column_data{$_}\n" } @column_index;
1989 <td><hr size=3 noshade></td>
1994 <form method=post action=$form->{script}>
1996 <input name=callback type=hidden value="$form->{callback}">
1998 <input type=hidden name=type value=printer>
2000 <input type=hidden name=login value=$form->{login}>
2001 <input type=hidden name=password value=$form->{password}>
2003 <input class=submit type=submit name=action value="|
2004 . $locale->text('Add') . qq|">
2012 $lxdebug->leave_sub();
2015 sub printer_header {
2016 $lxdebug->enter_sub();
2018 $form->{title} = $locale->text("$form->{title} Printer");
2020 # $locale->text('Add Printer')
2021 # $locale->text('Edit Printer')
2023 $form->{printer_description} =~ s/\"/"/g;
2024 $form->{template_code} =~ s/\"/"/g;
2025 $form->{printer_command} =~ s/\"/"/g;
2033 <form method=post action=$form->{script}>
2035 <input type=hidden name=id value=$form->{id}>
2036 <input type=hidden name=type value=printer>
2040 <th class=listtop colspan=2>$form->{title}</th>
2042 <tr height="5"></tr>
2044 <th align=right>| . $locale->text('Printer') . qq|</th>
2045 <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
2048 <th align=right>| . $locale->text('Printer Command') . qq|</th>
2049 <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
2052 <th align=right>| . $locale->text('Template Code') . qq|</th>
2053 <td><input name=template_code size=5 value="$form->{template_code}"></td>
2055 <td colspan=2><hr size=3 noshade></td>
2060 $lxdebug->leave_sub();
2064 $lxdebug->enter_sub();
2066 $form->isblank("printer_description", $locale->text('Description missing!'));
2067 $form->isblank("printer_command", $locale->text('Printer Command missing!'));
2068 AM->save_printer(\%myconfig, \%$form);
2069 $form->redirect($locale->text('Printer saved!'));
2071 $lxdebug->leave_sub();
2074 sub delete_printer {
2075 $lxdebug->enter_sub();
2077 AM->delete_printer(\%myconfig, \%$form);
2078 $form->redirect($locale->text('Printer deleted!'));
2080 $lxdebug->leave_sub();
2084 $lxdebug->enter_sub();
2086 $form->{title} = "Add";
2089 "$form->{script}?action=add_payment&login=$form->{login}&password=$form->{password}"
2090 unless $form->{callback};
2092 $form->{terms_netto} = 0;
2093 $form->{terms_skonto} = 0;
2094 $form->{percent_skonto} = 0;
2095 my @languages = AM->language(\%myconfig, $form, 1);
2096 map({ $_->{"language"} = $_->{"description"};
2097 $_->{"language_id"} = $_->{"id"}; } @languages);
2098 $form->{"TRANSLATION"} = \@languages;
2102 $lxdebug->leave_sub();
2106 $lxdebug->enter_sub();
2108 $form->{title} = "Edit";
2110 AM->get_payment(\%myconfig, $form);
2111 $form->{percent_skonto} =
2112 $form->format_amount(\%myconfig, $form->{percent_skonto} * 100);
2116 $form->{orphaned} = 1;
2119 $lxdebug->leave_sub();
2123 $lxdebug->enter_sub();
2125 AM->payment(\%myconfig, \%$form);
2127 $form->{callback} = build_std_url("action=list_payment");
2129 $callback = $form->escape($form->{callback});
2131 $form->{title} = $locale->text('Payment Terms');
2133 @column_index = qw(up down description description_long terms_netto
2134 terms_skonto percent_skonto);
2136 $column_header{up} =
2137 qq|<th class="listheading" align="center" valign="center" width="16">|
2138 . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
2140 $column_header{down} =
2141 qq|<th class="listheading" align="center" valign="center" width="16">|
2142 . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
2144 $column_header{description} =
2145 qq|<th class=listheading>|
2146 . $locale->text('Description')
2148 $column_header{description_long} =
2149 qq|<th class=listheading>|
2150 . $locale->text('Long Description')
2152 $column_header{terms_netto} =
2153 qq|<th class=listheading>|
2154 . $locale->text('Netto Terms')
2156 $column_header{terms_skonto} =
2157 qq|<th class=listheading>|
2158 . $locale->text('Skonto Terms')
2160 $column_header{percent_skonto} =
2161 qq|<th class=listheading>|
2162 . $locale->text('Skonto')
2172 <th class=listtop>$form->{title}</th>
2174 <tr height="5"></tr>
2178 <tr class=listheading>
2181 map { print "$column_header{$_}\n" } @column_index;
2187 my $swap_link = build_std_url("action=swap_payment_terms");
2190 foreach $ref (@{ $form->{ALL} }) {
2196 <tr valign=top class=listrow$i>
2200 my $pref = $form->{ALL}->[$row - 1];
2202 qq|<td align="center" valign="center" width="16">| .
2203 qq|<a href="${swap_link}&id1=$ref->{id}&id2=$pref->{id}">| .
2204 qq|<img border="0" src="image/up.png" alt="| . $locale->text("up") . qq|">| .
2207 $column_data{up} = qq|<td width="16"> </td>|;
2210 if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
2211 $column_data{down} = qq|<td width="16"> </td>|;
2213 my $nref = $form->{ALL}->[$row + 1];
2214 $column_data{down} =
2215 qq|<td align="center" valign="center" width="16">| .
2216 qq|<a href="${swap_link}&id1=$ref->{id}&id2=$nref->{id}">| .
2217 qq|<img border="0" src="image/down.png" alt="| . $locale->text("down") . qq|">| .
2221 $column_data{description} =
2223 build_std_url("action=edit_payment", "id=$ref->{id}", "callback=$callback") .
2224 qq|">| . H($ref->{description}) . qq|</a></td>|;
2225 $column_data{description_long} =
2226 qq|<td>| . H($ref->{description_long}) . qq|</td>|;
2227 $column_data{terms_netto} =
2228 qq|<td align=right>$ref->{terms_netto}</td>|;
2229 $column_data{terms_skonto} =
2230 qq|<td align=right>$ref->{terms_skonto}</td>|;
2231 $column_data{percent_skonto} =
2232 qq|<td align=right>| .
2233 $form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) .
2235 map { print "$column_data{$_}\n" } @column_index;
2248 <td><hr size=3 noshade></td>
2253 <form method=post action=$form->{script}>
2255 <input name=callback type=hidden value="$form->{callback}">
2257 <input type=hidden name=type value=payment>
2259 <input type=hidden name=login value=$form->{login}>
2260 <input type=hidden name=password value=$form->{password}>
2262 <input class=submit type=submit name=action value="|
2263 . $locale->text('Add') . qq|">
2271 $lxdebug->leave_sub();
2274 sub payment_header {
2275 $lxdebug->enter_sub();
2277 $form->{title} = $locale->text("$form->{title} Payment Terms");
2279 # $locale->text('Add Payment Terms')
2280 # $locale->text('Edit Payment Terms')
2282 $form->{description} =~ s/\"/"/g;
2291 <form method=post action=$form->{script}>
2293 <input type=hidden name=id value=$form->{id}>
2294 <input type=hidden name=type value=payment>
2298 <th class=listtop colspan=2>$form->{title}</th>
2300 <tr height="5"></tr>
2302 <th align=right>| . $locale->text('Description') . qq|</th>
2303 <td><input name=description size=30 value="$form->{description}"></td>
2306 <th align=right>| . $locale->text('Long Description') . qq|</th>
2307 <td><input name=description_long size=50 value="$form->{description_long}"></td>
2311 foreach my $language (@{ $form->{"TRANSLATION"} }) {
2314 <th align="right">| .
2315 sprintf($locale->text('Translation (%s)'),
2316 $language->{"language"})
2318 <td><input name="description_long_$language->{language_id}" size="50"
2319 value="| . Q($language->{"description_long"}) . qq|"></td>
2326 <th align=right>| . $locale->text('Netto Terms') . qq|</th>
2327 <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
2330 <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
2331 <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
2334 <th align=right>| . $locale->text('Skonto') . qq| %</th>
2335 <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
2337 <td colspan=2><hr size=3 noshade></td>
2341 <p>| . $locale->text("You can use the following strings in the long " .
2342 "description and all translations. They will be " .
2343 "replaced by their actual values by Lx-Office " .
2344 "before they're output.")
2348 <li>| . $locale->text("<%netto_date%> -- Date the payment is due in " .
2351 <li>| . $locale->text("<%skonto_date%> -- Date the payment is due " .
2354 <li>| . $locale->text("<%skonto_amount%> -- The deductible amount")
2356 <li>| . $locale->text("<%total%> -- Amount payable")
2358 <li>| . $locale->text("<%invtotal%> -- Invoice total")
2360 <li>| . $locale->text("<%currency%> -- The selected currency")
2362 <li>| . $locale->text("<%terms_netto%> -- The number of days for " .
2365 <li>| . $locale->text("<%account_number%> -- Your account number")
2367 <li>| . $locale->text("<%bank%> -- Your bank")
2369 <li>| . $locale->text("<%bank_code%> -- Your bank code")
2373 $lxdebug->leave_sub();
2377 $lxdebug->enter_sub();
2379 $form->isblank("description", $locale->text('Description missing!'));
2380 $form->{"percent_skonto"} =
2381 $form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100;
2382 AM->save_payment(\%myconfig, \%$form);
2383 $form->redirect($locale->text('Payment Terms saved!'));
2385 $lxdebug->leave_sub();
2388 sub delete_payment {
2389 $lxdebug->enter_sub();
2391 AM->delete_payment(\%myconfig, \%$form);
2392 $form->redirect($locale->text('Payment terms deleted!'));
2394 $lxdebug->leave_sub();
2397 sub swap_payment_terms {
2398 $lxdebug->enter_sub();
2400 AM->swap_sortkeys(\%myconfig, $form, "payment_terms");
2403 $lxdebug->leave_sub();
2407 $lxdebug->enter_sub();
2409 # get defaults for account numbers and last numbers
2410 AM->defaultaccounts(\%myconfig, \%$form);
2412 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2414 ($item eq $myconfig{dateformat})
2415 ? "<option selected>$item\n"
2416 : "<option>$item\n";
2419 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2421 ($item eq $myconfig{numberformat})
2422 ? "<option selected>$item\n"
2423 : "<option>$item\n";
2426 foreach $item (qw(name company address signature)) {
2427 $myconfig{$item} =~ s/\"/"/g;
2430 foreach $item (qw(address signature)) {
2431 $myconfig{$item} =~ s/\\n/\r\n/g;
2435 if ($opendocument_templates && $openofficeorg_writer_bin &&
2436 $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
2437 push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
2438 "value" => "opendocument_pdf" });
2440 if ($latex_templates) {
2441 push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
2443 push(@formats, { "name" => "HTML", "value" => "html" });
2444 if ($latex_templates) {
2445 push(@formats, { "name" => $locale->text("Postscript"),
2446 "value" => "postscript" });
2448 if ($opendocument_templates) {
2449 push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
2450 "value" => "opendocument" });
2453 if (!$myconfig{"template_format"}) {
2454 $myconfig{"template_format"} = "pdf";
2456 my $template_format = "";
2457 foreach $item (@formats) {
2459 "<option value=\"$item->{value}\"" .
2460 ($item->{"value"} eq $myconfig{"template_format"} ?
2462 ">" . H($item->{"name"}) . "</option>";
2465 if (!$myconfig{"default_media"}) {
2466 $myconfig{"default_media"} = "screen";
2468 my %selected = ($myconfig{"default_media"} => "selected");
2469 my $default_media = qq|
2470 <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
2471 <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
2472 <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
2476 $selected{$myconfig{"default_printer_id"}} = "selected"
2477 if ($myconfig{"default_printer_id"});
2478 my $default_printer = qq|<option></option>|;
2479 AM->printer(\%myconfig, $form);
2480 foreach my $printer (@{$form->{"ALL"}}) {
2481 $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
2482 qq|" $selected{$printer->{'id'}}>| .
2483 H($printer->{"printer_description"}) . qq|</option>|;
2486 %countrycodes = User->country_codes;
2488 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2492 ($myconfig{countrycode} eq $key)
2493 ? "<option selected value=$key>$countrycodes{$key}\n"
2494 : "<option value=$key>$countrycodes{$key}\n";
2496 $countrycodes = "<option>American English\n$countrycodes";
2498 foreach $key (keys %{ $form->{IC} }) {
2499 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2501 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2502 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2503 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2507 # opendir CSS, "css/.";
2508 # @all = grep /.*\.css$/, readdir CSS;
2511 # css dir has styles that are not intended as general layouts.
2512 # reverting to hardcoded list
2513 @all = qw(lx-office-erp.css Win2000.css);
2515 foreach $item (@all) {
2516 if ($item eq $myconfig{stylesheet}) {
2517 $selectstylesheet .= qq|<option selected>$item\n|;
2519 $selectstylesheet .= qq|<option>$item\n|;
2522 $selectstylesheet .= "<option>\n";
2524 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2528 if ($myconfig{menustyle} eq "old") {
2529 $menustyle_old = "checked";
2530 } elsif ($myconfig{menustyle} eq "neu") {
2531 $menustyle_neu = "checked";
2532 } elsif ($myconfig{menustyle} eq "v3") {
2533 $menustyle_v3 = "checked";
2536 my ($show_form_details, $hide_form_details);
2537 $myconfig{"show_form_details"} = 1
2538 unless (defined($myconfig{"show_form_details"}));
2539 $show_form_details = "checked" if ($myconfig{"show_form_details"});
2540 $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
2545 <form method=post action=$form->{script}>
2547 <input type=hidden name=old_password value=$myconfig{password}>
2548 <input type=hidden name=type value=preferences>
2549 <input type=hidden name=role value=$myconfig{role}>
2552 <tr><th class=listtop>$form->{title}</th></tr>
2557 <th align=right>| . $locale->text('Name') . qq|</th>
2558 <td><input name=name size=15 value="$myconfig{name}"></td>
2561 <th align=right>| . $locale->text('Password') . qq|</th>
2562 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2565 <th align=right>| . $locale->text('E-mail') . qq|</th>
2566 <td><input name=email size=30 value="$myconfig{email}"></td>
2569 <th align=right>| . $locale->text('Signature') . qq|</th>
2570 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2573 <th align=right>| . $locale->text('Phone') . qq|</th>
2574 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2577 <th align=right>| . $locale->text('Fax') . qq|</th>
2578 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2581 <th align=right>| . $locale->text('Company') . qq|</th>
2582 <td><input name=company size=30 value="$myconfig{company}"></td>
2585 <th align=right>| . $locale->text('Address') . qq|</th>
2586 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2589 <th align=right>| . $locale->text('Date Format') . qq|</th>
2590 <td><select name=dateformat>$dateformat</select></td>
2593 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2594 <td><select name=numberformat>$numberformat</select></td>
2598 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2599 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2602 <th align=right>| . $locale->text('Language') . qq|</th>
2603 <td><select name=countrycode>$countrycodes</select></td>
2606 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
2607 <td><select name=usestylesheet>$selectstylesheet</select></td>
2610 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
2611 <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
2612 $locale->text("Top (CSS)") . qq|
2613 <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
2614 $locale->text("Top (Javascript)") . qq|
2615 <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
2616 $locale->text("Old (on the side)") . qq|</td>
2619 <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
2620 <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details>
2621 <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
2622 <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details>
2623 <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
2625 <input name=printer type=hidden value="$myconfig{printer}">
2626 <tr class=listheading>
2627 <th colspan=2>| . $locale->text("Print options") . qq|</th>
2630 <th align=right>| . $locale->text('Default template format') . qq|</th>
2631 <td><select name="template_format">$template_format</select></td>
2634 <th align=right>| . $locale->text('Default output medium') . qq|</th>
2635 <td><select name="default_media">$default_media</select></td>
2638 <th align=right>| . $locale->text('Default printer') . qq|</th>
2639 <td><select name="default_printer_id">$default_printer</select></td>
2642 <th align=right>| . $locale->text('Number of copies') . qq|</th>
2643 <td><input name="copies" size="10" value="| .
2644 $form->quote($myconfig{"copies"}) . qq|"></td>
2648 <tr class=listheading>
2649 <th colspan=2> </th>
2652 <th align=right>| . $locale->text('Business Number') . qq|</th>
2653 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
2656 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
2657 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
2659 <tr class=listheading>
2661 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
2667 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
2668 <td><select name=inventory_accno>$myconfig{IC}</select></td>
2671 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
2672 <td><select name=income_accno>$myconfig{IC_income}</select></td>
2675 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
2676 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
2679 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
2680 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
2683 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
2684 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
2689 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
2691 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
2700 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
2701 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
2702 <th align=right nowrap>|
2703 . $locale->text('Last Customer Number') . qq|</th>
2704 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
2707 <th align=right nowrap>|
2708 . $locale->text('Last Credit Note Number') . qq|</th>
2709 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
2710 <th align=right nowrap>|
2711 . $locale->text('Last Vendor Number') . qq|</th>
2712 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
2715 <th align=right nowrap>|
2716 . $locale->text('Last Sales Order Number') . qq|</th>
2717 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
2720 <th align=right nowrap>|
2721 . $locale->text('Last Purchase Order Number') . qq|</th>
2722 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
2723 <th align=right nowrap>|
2724 . $locale->text('Last Article Number') . qq|</th>
2725 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
2728 <th align=right nowrap>|
2729 . $locale->text('Last Sales Quotation Number') . qq|</th>
2730 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
2731 <th align=right nowrap>|
2732 . $locale->text('Last Service Number') . qq|</th>
2733 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
2736 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
2737 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
2738 <th align=right nowrap></th>
2744 # <tr class=listheading>
2745 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
2752 # <th>| . $locale->text('Rate') . qq| (%)</th>
2753 # <th>| . $locale->text('Number') . qq|</th>
2757 # foreach $accno (sort keys %{ $form->{taxrates} }) {
2760 # <th align=right>$form->{taxrates}{$accno}{description}</th>
2761 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
2762 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
2765 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
2768 # chop $form->{taxaccounts};
2771 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
2780 <td><hr size=3 noshade></td>
2784 <input type=hidden name=login value=$form->{login}>
2785 <input type=hidden name=password value=$form->{password}>
2788 <input type=submit class=submit name=action value="|
2789 . $locale->text('Save') . qq|">
2797 $lxdebug->leave_sub();
2800 sub save_preferences {
2801 $lxdebug->enter_sub();
2803 $form->{stylesheet} = $form->{usestylesheet};
2805 $form->redirect($locale->text('Preferences saved!'))
2807 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
2809 $form->error($locale->text('Cannot save preferences!'));
2811 $lxdebug->leave_sub();
2815 $lxdebug->enter_sub();
2817 $form->{title} = $locale->text('Audit Control');
2819 AM->closedto(\%myconfig, \%$form);
2821 if ($form->{revtrans}) {
2822 $checked{Y} = "checked";
2824 $checked{N} = "checked";
2832 <form method=post action=$form->{script}>
2834 <input type=hidden name=login value=$form->{login}>
2835 <input type=hidden name=password value=$form->{password}>
2838 <tr><th class=listtop>$form->{title}</th></tr>
2839 <tr height="5"></tr>
2845 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
2846 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
2847 . $locale->text('Yes')
2848 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
2849 . $locale->text('No')
2853 <th>| . $locale->text('Close Books up to') . qq|</th>
2854 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
2864 <input type=hidden name=nextsub value=doclose>
2866 <input type=submit class=submit name=action value="|
2867 . $locale->text('Continue') . qq|">
2875 $lxdebug->leave_sub();
2879 $lxdebug->enter_sub();
2881 AM->closebooks(\%myconfig, \%$form);
2883 if ($form->{revtrans}) {
2885 $locale->text('Transaction reversal enforced for all dates'));
2887 if ($form->{closedto}) {
2889 $locale->text('Transaction reversal enforced up to') . " "
2890 . $locale->date(\%myconfig, $form->{closedto}, 1));
2892 $form->redirect($locale->text('Books are open'));
2896 $lxdebug->leave_sub();
2900 $lxdebug->enter_sub();
2902 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
2903 AM->units_in_use(\%myconfig, $form, $units);
2904 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
2906 @languages = AM->language(\%myconfig, $form, 1);
2908 @unit_list = sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } values(%{$units}));
2911 foreach (@unit_list) {
2912 $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"} * 1) if ($_->{"factor"});
2913 $_->{"UNITLANGUAGES"} = [];
2914 foreach my $lang (@languages) {
2915 push(@{ $_->{"UNITLANGUAGES"} },
2917 "unit" => $_->{"name"},
2918 "language_id" => $lang->{"id"},
2919 "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
2920 "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
2926 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
2927 $ddbox = AM->unit_select_data($units, undef, 1);
2929 my $updownlink = build_std_url("action=swap_units", "unit_type");
2931 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
2933 print($form->parse_html_template("am/edit_units",
2934 { "UNITS" => \@unit_list,
2935 "NEW_BASE_UNIT_DDBOX" => $ddbox,
2936 "LANGUAGES" => \@languages,
2937 "updownlink" => $updownlink }));
2939 $lxdebug->leave_sub();
2943 $lxdebug->enter_sub();
2945 $form->isblank("new_name", $locale->text("The name is missing."));
2946 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
2947 $all_units = AM->retrieve_units(\%myconfig, $form);
2948 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
2950 my ($base_unit, $factor);
2951 if ($form->{"new_base_unit"}) {
2952 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
2954 $form->isblank("new_factor", $locale->text("The factor is missing."));
2955 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
2956 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
2957 $base_unit = $form->{"new_base_unit"};
2961 foreach my $lang (AM->language(\%myconfig, $form, 1)) {
2962 next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
2963 push(@languages, { "id" => $lang->{"id"},
2964 "localized" => $form->{"new_localized_$lang->{id}"},
2965 "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
2969 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
2971 $form->{"saved_message"} = $locale->text("The unit has been saved.");
2975 $lxdebug->leave_sub();
2978 sub set_unit_languages {
2979 $lxdebug->enter_sub();
2981 my ($unit, $languages, $idx) = @_;
2983 $unit->{"LANGUAGES"} = [];
2985 foreach my $lang (@{$languages}) {
2986 push(@{ $unit->{"LANGUAGES"} },
2987 { "id" => $lang->{"id"},
2988 "localized" => $form->{"localized_${idx}_$lang->{id}"},
2989 "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
2993 $lxdebug->leave_sub();
2997 $lxdebug->enter_sub();
2999 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3000 AM->units_in_use(\%myconfig, $form, $old_units);
3002 @languages = AM->language(\%myconfig, $form, 1);
3006 foreach $i (1..($form->{"rowcount"} * 1)) {
3007 $old_unit = $old_units->{$form->{"old_name_$i"}};
3009 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3012 if ($form->{"unchangeable_$i"}) {
3013 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3014 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3015 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3019 if ($old_unit->{"in_use"}) {
3020 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3023 if ($form->{"delete_$i"}) {
3024 push(@delete_units, $old_unit->{"name"});
3028 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3030 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3031 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3032 $new_units->{$form->{"name_$i"}} = \%h;
3033 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3034 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3037 foreach $unit (values(%{$new_units})) {
3038 next unless ($unit->{"old_name"});
3039 if ($unit->{"base_unit"}) {
3040 $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"}))
3041 unless (defined($new_units->{$unit->{"base_unit"}}));
3042 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3043 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3045 $unit->{"base_unit"} = undef;
3046 $unit->{"factor"} = undef;
3050 foreach $unit (values(%{$new_units})) {
3051 next if ($unit->{"unchanged_unit"});
3053 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3055 while ($new_unit->{"base_unit"}) {
3056 $new_unit->{"seen"} = 1;
3057 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3058 if ($new_unit->{"seen"}) {
3059 $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, " .
3060 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3065 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3067 $form->{"saved_message"} = $locale->text("The units have been saved.");
3071 $lxdebug->leave_sub();
3074 sub show_history_search {
3075 $lxdebug->enter_sub();
3077 $form->{title} = $locale->text("History Search");
3080 print $form->parse_html_template("/common/search_history");
3082 $lxdebug->leave_sub();
3085 sub show_am_history {
3086 $lxdebug->enter_sub();
3087 my %search = ( "Artikelnummer" => "parts",
3088 "Kundennummer" => "customer",
3089 "Lieferantennummer" => "vendor",
3090 "Projektnummer" => "project",
3091 "Buchungsnummer" => "oe",
3092 "Eingangsrechnungnummer" => "ap",
3093 "Ausgangsrechnungnummer" => "ar",
3094 "Mahnungsnummer" => "dunning"
3096 my %searchNo = ( "Artikelnummer" => "partnumber",
3097 "Kundennummer" => "customernumber",
3098 "Lieferantennummer" => "vendornumber",
3099 "Projektnummer" => "projectnummer",
3100 "Buchungsnummer" => "ordnumber",
3101 "Eingangsrechnungnummer" => "invnumber",
3102 "Ausgangsrechnungnummer" => "invnumber",
3103 "Mahnungsnummer" => "dunning_id"
3108 foreach(split(/\,/, $form->{einschraenkungen})) {
3110 $restriction .= " AND addition = '" . $_ . "'";
3114 $restriction .= " OR addition = '" . $_ . "'";
3118 $restriction .= (($form->{transdate} ne "" && $form->{reqdate} ne "")
3119 ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|' AND st.itime::date <= '| . $form->{reqdate} . qq|'|
3120 : (($form->{transdate} ne "" && $form->{reqdate} eq "")
3121 ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|'|
3122 : ($form->{transdate} eq "" && $form->{reqdate} ne "")
3123 ? qq| AND st.itime::date <= '| . $form->{reqdate} . qq|'|
3128 my $dbh = $form->dbconnect(\%myconfig);
3129 my $searchSNumber = $searchNo{$form->{'what2search'}} . qq|_| . $form->{'searchid'};
3130 $restriction .= ($form->{mitarbeiter} eq "" ? ""
3131 : ($form->{mitarbeiter} =~ /^[0-9]*$/
3132 ? " AND employee_id = " . $form->{mitarbeiter}
3133 : " AND employee_id = " . &get_employee_id($form->{mitarbeiter}, $dbh)));
3134 my $query = qq|SELECT trans_id AS id FROM history_erp WHERE sNumbers = '$searchSNumber' |;
3136 my $sth = $dbh->prepare($query);
3138 $sth->execute() || $form->dberror($query);
3140 if($sth->fetch() <= 0) {
3142 my $query = qq|SELECT id FROM $search{$form->{what2search}}
3143 WHERE $searchNo{$form->{'what2search'}} ILIKE '$form->{"searchid"}'
3146 $sth->execute() || $form->dberror($query);
3147 $form->{title} = $locale->text("History Search");
3150 while(my $hash_ref = $sth->fetchrow_hashref()){
3151 $daten = $form->get_history($dbh,$hash_ref->{id},$restriction);
3154 print $form->parse_html_template("/common/show_history",
3156 "SUCCESS" => ($daten != 0 ? 1 : 0),
3159 $lxdebug->leave_sub();
3162 sub get_employee_id {
3163 $lxdebug->enter_sub();
3164 my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|;
3165 my $sth = $_[1]->prepare($query);
3166 $sth->execute() || $form->dberror($query);
3167 my $return = $sth->fetch();
3169 return ${$return}[0];
3170 $lxdebug->leave_sub();
3174 $lxdebug->enter_sub();
3176 my $dir = $form->{"dir"} eq "down" ? "down" : "up";
3177 my $unit_type = $form->{"unit_type"} eq "dimension" ?
3178 "dimension" : "service";
3179 AM->swap_units(\%myconfig, $form, $dir, $form->{"name"}, $unit_type);
3183 $lxdebug->leave_sub();