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();
2438 $lxdebug->enter_sub();
2440 # get defaults for account numbers and last numbers
2441 AM->defaultaccounts(\%myconfig, \%$form);
2443 foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2445 ($item eq $myconfig{dateformat})
2446 ? "<option selected>$item\n"
2447 : "<option>$item\n";
2450 foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2452 ($item eq $myconfig{numberformat})
2453 ? "<option selected>$item\n"
2454 : "<option>$item\n";
2457 foreach $item (qw(name company address signature)) {
2458 $myconfig{$item} =~ s/\"/"/g;
2461 foreach $item (qw(address signature)) {
2462 $myconfig{$item} =~ s/\\n/\r\n/g;
2466 if ($opendocument_templates && $openofficeorg_writer_bin &&
2467 $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
2468 push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
2469 "value" => "opendocument_pdf" });
2471 if ($latex_templates) {
2472 push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
2474 push(@formats, { "name" => "HTML", "value" => "html" });
2475 if ($latex_templates) {
2476 push(@formats, { "name" => $locale->text("Postscript"),
2477 "value" => "postscript" });
2479 if ($opendocument_templates) {
2480 push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
2481 "value" => "opendocument" });
2484 if (!$myconfig{"template_format"}) {
2485 $myconfig{"template_format"} = "pdf";
2487 my $template_format = "";
2488 foreach $item (@formats) {
2490 "<option value=\"$item->{value}\"" .
2491 ($item->{"value"} eq $myconfig{"template_format"} ?
2493 ">" . H($item->{"name"}) . "</option>";
2496 if (!$myconfig{"default_media"}) {
2497 $myconfig{"default_media"} = "screen";
2499 my %selected = ($myconfig{"default_media"} => "selected");
2500 my $default_media = qq|
2501 <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
2502 <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
2503 <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
2507 $selected{$myconfig{"default_printer_id"}} = "selected"
2508 if ($myconfig{"default_printer_id"});
2509 my $default_printer = qq|<option></option>|;
2510 AM->printer(\%myconfig, $form);
2511 foreach my $printer (@{$form->{"ALL"}}) {
2512 $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
2513 qq|" $selected{$printer->{'id'}}>| .
2514 H($printer->{"printer_description"}) . qq|</option>|;
2517 %countrycodes = User->country_codes;
2519 foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2523 ($myconfig{countrycode} eq $key)
2524 ? "<option selected value=$key>$countrycodes{$key}\n"
2525 : "<option value=$key>$countrycodes{$key}\n";
2527 $countrycodes = "<option>American English\n$countrycodes";
2529 foreach $key (keys %{ $form->{IC} }) {
2530 foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2532 ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2533 ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2534 : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2538 # opendir CSS, "css/.";
2539 # @all = grep /.*\.css$/, readdir CSS;
2542 # css dir has styles that are not intended as general layouts.
2543 # reverting to hardcoded list
2544 @all = qw(lx-office-erp.css Win2000.css);
2546 foreach $item (@all) {
2547 if ($item eq $myconfig{stylesheet}) {
2548 $selectstylesheet .= qq|<option selected>$item\n|;
2550 $selectstylesheet .= qq|<option>$item\n|;
2553 $selectstylesheet .= "<option>\n";
2555 $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2559 if ($myconfig{menustyle} eq "old") {
2560 $menustyle_old = "checked";
2561 } elsif ($myconfig{menustyle} eq "neu") {
2562 $menustyle_neu = "checked";
2563 } elsif ($myconfig{menustyle} eq "v3") {
2564 $menustyle_v3 = "checked";
2567 my ($show_form_details, $hide_form_details);
2568 $myconfig{"show_form_details"} = 1
2569 unless (defined($myconfig{"show_form_details"}));
2570 $show_form_details = "checked" if ($myconfig{"show_form_details"});
2571 $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
2576 <form method=post action=$form->{script}>
2578 <input type=hidden name=old_password value=$myconfig{password}>
2579 <input type=hidden name=type value=preferences>
2580 <input type=hidden name=role value=$myconfig{role}>
2583 <tr><th class=listtop>$form->{title}</th></tr>
2588 <th align=right>| . $locale->text('Name') . qq|</th>
2589 <td><input name=name size=15 value="$myconfig{name}"></td>
2592 <th align=right>| . $locale->text('Password') . qq|</th>
2593 <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2596 <th align=right>| . $locale->text('E-mail') . qq|</th>
2597 <td><input name=email size=30 value="$myconfig{email}"></td>
2600 <th align=right>| . $locale->text('Signature') . qq|</th>
2601 <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2604 <th align=right>| . $locale->text('Phone') . qq|</th>
2605 <td><input name=tel size=14 value="$myconfig{tel}"></td>
2608 <th align=right>| . $locale->text('Fax') . qq|</th>
2609 <td><input name=fax size=14 value="$myconfig{fax}"></td>
2612 <th align=right>| . $locale->text('Company') . qq|</th>
2613 <td><input name=company size=30 value="$myconfig{company}"></td>
2616 <th align=right>| . $locale->text('Address') . qq|</th>
2617 <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2620 <th align=right>| . $locale->text('Date Format') . qq|</th>
2621 <td><select name=dateformat>$dateformat</select></td>
2624 <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2625 <td><select name=numberformat>$numberformat</select></td>
2629 <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2630 <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2633 <th align=right>| . $locale->text('Language') . qq|</th>
2634 <td><select name=countrycode>$countrycodes</select></td>
2637 <th align=right>| . $locale->text('Stylesheet') . qq|</th>
2638 <td><select name=usestylesheet>$selectstylesheet</select></td>
2641 <th align=right>| . $locale->text('Setup Menu') . qq|</th>
2642 <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
2643 $locale->text("Top (CSS)") . qq|
2644 <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
2645 $locale->text("Top (Javascript)") . qq|
2646 <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
2647 $locale->text("Old (on the side)") . qq|</td>
2650 <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
2651 <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details>
2652 <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
2653 <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details>
2654 <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
2656 <input name=printer type=hidden value="$myconfig{printer}">
2657 <tr class=listheading>
2658 <th colspan=2>| . $locale->text("Print options") . qq|</th>
2661 <th align=right>| . $locale->text('Default template format') . qq|</th>
2662 <td><select name="template_format">$template_format</select></td>
2665 <th align=right>| . $locale->text('Default output medium') . qq|</th>
2666 <td><select name="default_media">$default_media</select></td>
2669 <th align=right>| . $locale->text('Default printer') . qq|</th>
2670 <td><select name="default_printer_id">$default_printer</select></td>
2673 <th align=right>| . $locale->text('Number of copies') . qq|</th>
2674 <td><input name="copies" size="10" value="| .
2675 $form->quote($myconfig{"copies"}) . qq|"></td>
2679 <tr class=listheading>
2680 <th colspan=2> </th>
2683 <th align=right>| . $locale->text('Business Number') . qq|</th>
2684 <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
2687 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
2688 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
2690 <tr class=listheading>
2692 . $locale->text('Last Numbers & Default Accounts') . qq|</th>
2698 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
2699 <td><select name=inventory_accno>$myconfig{IC}</select></td>
2702 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
2703 <td><select name=income_accno>$myconfig{IC_income}</select></td>
2706 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
2707 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
2710 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
2711 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
2714 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
2715 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
2720 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
2722 . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
2731 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
2732 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
2733 <th align=right nowrap>|
2734 . $locale->text('Last Customer Number') . qq|</th>
2735 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
2738 <th align=right nowrap>|
2739 . $locale->text('Last Credit Note Number') . qq|</th>
2740 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
2741 <th align=right nowrap>|
2742 . $locale->text('Last Vendor Number') . qq|</th>
2743 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
2746 <th align=right nowrap>|
2747 . $locale->text('Last Sales Order Number') . qq|</th>
2748 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
2751 <th align=right nowrap>|
2752 . $locale->text('Last Purchase Order Number') . qq|</th>
2753 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
2754 <th align=right nowrap>|
2755 . $locale->text('Last Article Number') . qq|</th>
2756 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
2759 <th align=right nowrap>|
2760 . $locale->text('Last Sales Quotation Number') . qq|</th>
2761 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
2762 <th align=right nowrap>|
2763 . $locale->text('Last Service Number') . qq|</th>
2764 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
2767 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
2768 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
2769 <th align=right nowrap></th>
2775 # <tr class=listheading>
2776 # <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
2783 # <th>| . $locale->text('Rate') . qq| (%)</th>
2784 # <th>| . $locale->text('Number') . qq|</th>
2788 # foreach $accno (sort keys %{ $form->{taxrates} }) {
2791 # <th align=right>$form->{taxrates}{$accno}{description}</th>
2792 # <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
2793 # <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
2796 # $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
2799 # chop $form->{taxaccounts};
2802 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
2811 <td><hr size=3 noshade></td>
2815 <input type=hidden name=path value=$form->{path}>
2816 <input type=hidden name=login value=$form->{login}>
2817 <input type=hidden name=password value=$form->{password}>
2820 <input type=submit class=submit name=action value="|
2821 . $locale->text('Save') . qq|">
2829 $lxdebug->leave_sub();
2832 sub save_preferences {
2833 $lxdebug->enter_sub();
2835 $form->{stylesheet} = $form->{usestylesheet};
2837 $form->redirect($locale->text('Preferences saved!'))
2839 AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
2841 $form->error($locale->text('Cannot save preferences!'));
2843 $lxdebug->leave_sub();
2847 $lxdebug->enter_sub();
2849 $form->{title} = $locale->text('Audit Control');
2851 AM->closedto(\%myconfig, \%$form);
2853 if ($form->{revtrans}) {
2854 $checked{Y} = "checked";
2856 $checked{N} = "checked";
2864 <form method=post action=$form->{script}>
2866 <input type=hidden name=path value=$form->{path}>
2867 <input type=hidden name=login value=$form->{login}>
2868 <input type=hidden name=password value=$form->{password}>
2871 <tr><th class=listtop>$form->{title}</th></tr>
2872 <tr height="5"></tr>
2878 . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
2879 <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
2880 . $locale->text('Yes')
2881 . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
2882 . $locale->text('No')
2886 <th>| . $locale->text('Close Books up to') . qq|</th>
2887 <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
2897 <input type=hidden name=nextsub value=doclose>
2899 <input type=submit class=submit name=action value="|
2900 . $locale->text('Continue') . qq|">
2908 $lxdebug->leave_sub();
2912 $lxdebug->enter_sub();
2914 AM->closebooks(\%myconfig, \%$form);
2916 if ($form->{revtrans}) {
2918 $locale->text('Transaction reversal enforced for all dates'));
2920 if ($form->{closedto}) {
2922 $locale->text('Transaction reversal enforced up to') . " "
2923 . $locale->date(\%myconfig, $form->{closedto}, 1));
2925 $form->redirect($locale->text('Books are open'));
2929 $lxdebug->leave_sub();
2933 $lxdebug->enter_sub();
2935 &{ $form->{nextsub} };
2937 $lxdebug->leave_sub();
2941 $lxdebug->enter_sub();
2943 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
2944 AM->units_in_use(\%myconfig, $form, $units);
2945 map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
2947 @languages = AM->language(\%myconfig, $form, 1);
2949 @unit_list = sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } values(%{$units}));
2952 foreach (@unit_list) {
2953 $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"} * 1) if ($_->{"factor"});
2954 $_->{"UNITLANGUAGES"} = [];
2955 foreach my $lang (@languages) {
2956 push(@{ $_->{"UNITLANGUAGES"} },
2958 "unit" => $_->{"name"},
2959 "language_id" => $lang->{"id"},
2960 "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
2961 "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
2967 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
2968 $ddbox = AM->unit_select_data($units, undef, 1);
2970 my $updownlink = build_std_url("action=swap_units", "unit_type");
2972 $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
2974 print($form->parse_html_template("am/edit_units",
2975 { "UNITS" => \@unit_list,
2976 "NEW_BASE_UNIT_DDBOX" => $ddbox,
2977 "LANGUAGES" => \@languages,
2978 "updownlink" => $updownlink }));
2980 $lxdebug->leave_sub();
2984 $lxdebug->enter_sub();
2986 $form->isblank("new_name", $locale->text("The name is missing."));
2987 $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
2988 $all_units = AM->retrieve_units(\%myconfig, $form);
2989 $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
2991 my ($base_unit, $factor);
2992 if ($form->{"new_base_unit"}) {
2993 $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
2995 $form->isblank("new_factor", $locale->text("The factor is missing."));
2996 $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
2997 $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
2998 $base_unit = $form->{"new_base_unit"};
3002 foreach my $lang (AM->language(\%myconfig, $form, 1)) {
3003 next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
3004 push(@languages, { "id" => $lang->{"id"},
3005 "localized" => $form->{"new_localized_$lang->{id}"},
3006 "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
3010 AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
3012 $form->{"saved_message"} = $locale->text("The unit has been saved.");
3016 $lxdebug->leave_sub();
3019 sub set_unit_languages {
3020 $lxdebug->enter_sub();
3022 my ($unit, $languages, $idx) = @_;
3024 $unit->{"LANGUAGES"} = [];
3026 foreach my $lang (@{$languages}) {
3027 push(@{ $unit->{"LANGUAGES"} },
3028 { "id" => $lang->{"id"},
3029 "localized" => $form->{"localized_${idx}_$lang->{id}"},
3030 "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
3034 $lxdebug->leave_sub();
3038 $lxdebug->enter_sub();
3040 $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
3041 AM->units_in_use(\%myconfig, $form, $old_units);
3043 @languages = AM->language(\%myconfig, $form, 1);
3047 foreach $i (1..($form->{"rowcount"} * 1)) {
3048 $old_unit = $old_units->{$form->{"old_name_$i"}};
3050 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
3053 if ($form->{"unchangeable_$i"}) {
3054 $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
3055 $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
3056 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3060 if ($old_unit->{"in_use"}) {
3061 $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
3064 if ($form->{"delete_$i"}) {
3065 push(@delete_units, $old_unit->{"name"});
3069 $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
3071 $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
3072 my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
3073 $new_units->{$form->{"name_$i"}} = \%h;
3074 $new_units->{$form->{"name_$i"}}->{"row"} = $i;
3075 set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
3078 foreach $unit (values(%{$new_units})) {
3079 next unless ($unit->{"old_name"});
3080 if ($unit->{"base_unit"}) {
3081 $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"}))
3082 unless (defined($new_units->{$unit->{"base_unit"}}));
3083 $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
3084 $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
3086 $unit->{"base_unit"} = undef;
3087 $unit->{"factor"} = undef;
3091 foreach $unit (values(%{$new_units})) {
3092 next if ($unit->{"unchanged_unit"});
3094 map({ $_->{"seen"} = 0; } values(%{$new_units}));
3096 while ($new_unit->{"base_unit"}) {
3097 $new_unit->{"seen"} = 1;
3098 $new_unit = $new_units->{$new_unit->{"base_unit"}};
3099 if ($new_unit->{"seen"}) {
3100 $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, " .
3101 "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
3106 AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
3108 $form->{"saved_message"} = $locale->text("The units have been saved.");
3112 $lxdebug->leave_sub();
3115 sub show_history_search {
3116 $lxdebug->enter_sub();
3118 $form->{title} = $locale->text("History Search");
3121 print $form->parse_html_template("/common/search_history");
3123 $lxdebug->leave_sub();
3126 sub show_am_history {
3127 $lxdebug->enter_sub();
3128 my %search = ( "Artikelnummer" => "parts",
3129 "Kundennummer" => "customer",
3130 "Lieferantennummer" => "vendor",
3131 "Projektnummer" => "project",
3132 "Buchungsnummer" => "oe",
3133 "Eingangsrechnungnummer" => "ap",
3134 "Ausgangsrechnungnummer" => "ar"
3136 my %searchNo = ( "Artikelnummer" => "partnumber",
3137 "Kundennummer" => "customernumber",
3138 "Lieferantennummer" => "vendornumber",
3139 "Projektnummer" => "projectnummer",
3140 "Buchungsnummer" => "ordnumber",
3141 "Eingangsrechnungnummer" => "invnumber",
3142 "Ausgangsrechnungnummer" => "invnumber"
3147 foreach(split(/\,/, $form->{einschraenkungen})) {
3149 $restriction .= " AND addition = '" . $_ . "'";
3153 $restriction .= " OR addition = '" . $_ . "'";
3157 $restriction .= (($form->{transdate} ne "" && $form->{reqdate} ne "")
3158 ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|' AND st.itime::date <= '| . $form->{reqdate} . qq|'|
3159 : (($form->{transdate} ne "" && $form->{reqdate} eq "")
3160 ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|'|
3161 : ($form->{transdate} eq "" && $form->{reqdate} ne "")
3162 ? qq| AND st.itime::date <= '| . $form->{reqdate} . qq|'|
3167 my $dbh = $form->dbconnect(\%myconfig);
3169 $restriction .= ($form->{mitarbeiter} eq "" ? ""
3170 : ($form->{mitarbeiter} =~ /^[0-9]*$/
3171 ? " AND employee_id = " . $form->{mitarbeiter}
3172 : " AND employee_id = " . &get_employee_id($form->{mitarbeiter}, $dbh)));
3174 my $query = qq|SELECT id FROM $search{$form->{what2search}}
3175 WHERE $searchNo{$form->{'what2search'}} ILIKE '$form->{"searchid"}'
3178 my $sth = $dbh->prepare($query);
3180 $sth->execute() || $form->dberror($query);
3182 $form->{title} = $locale->text("History Search");
3185 while(my $hash_ref = $sth->fetchrow_hashref()){
3186 print $form->parse_html_template("/common/show_history",
3187 {"DATEN" => $form->get_history($dbh,$hash_ref->{id},$restriction),
3188 "SUCCESS" => ($form->get_history($dbh,$hash_ref->{id},$restriction) != 0),
3189 "NONEWWINDOW" => "1"
3195 $lxdebug->leave_sub();
3198 sub get_employee_id {
3199 $lxdebug->enter_sub();
3200 my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|;
3201 my $sth = $_[1]->prepare($query);
3202 $sth->execute() || $form->dberror($query);
3203 my $return = $sth->fetch();
3205 return ${$return}[0];
3206 $lxdebug->leave_sub();
3210 $lxdebug->enter_sub();
3212 my $dir = $form->{"dir"} eq "down" ? "down" : "up";
3213 my $unit_type = $form->{"unit_type"} eq "dimension" ?
3214 "dimension" : "service";
3215 AM->swap_units(\%myconfig, $form, $dir, $form->{"name"}, $unit_type);
3219 $lxdebug->leave_sub();