1 #=====================================================================
 
   4 # Based on SQL-Ledger Version 2.1.9
 
   5 # Web http://www.lx-office.org
 
   7 #=====================================================================
 
   8 # SQL-Ledger Accounting
 
   9 # Copyright (c) 1998-2002
 
  11 #  Author: Dieter Simader
 
  12 #   Email: dsimader@sql-ledger.org
 
  13 #     Web: http://www.sql-ledger.org
 
  16 # This program is free software; you can redistribute it and/or modify
 
  17 # it under the terms of the GNU General Public License as published by
 
  18 # the Free Software Foundation; either version 2 of the License, or
 
  19 # (at your option) any later version.
 
  21 # This program is distributed in the hope that it will be useful,
 
  22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  24 # GNU General Public License for more details.
 
  25 # You should have received a copy of the GNU General Public License
 
  26 # along with this program; if not, write to the Free Software
 
  27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
  28 #======================================================================
 
  32 #======================================================================
 
  45 require "$form->{path}/common.pl";
 
  49 sub add    { &{"add_$form->{type}"} }
 
  50 sub edit   { &{"edit_$form->{type}"} }
 
  51 sub save   { &{"save_$form->{type}"} }
 
  52 sub delete { &{"delete_$form->{type}"} }
 
  55   $lxdebug->enter_sub();
 
  57   $form->{title}     = "Add";
 
  58   $form->{charttype} = "A";
 
  59   AM->get_account(\%myconfig, \%$form);
 
  62     "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
  63     unless $form->{callback};
 
  68   $lxdebug->leave_sub();
 
  72   $lxdebug->enter_sub();
 
  74   $form->{title} = "Edit";
 
  75   AM->get_account(\%myconfig, \%$form);
 
  77   foreach my $item (split(/:/, $form->{link})) {
 
  78     $form->{$item} = "checked";
 
  84   $lxdebug->leave_sub();
 
  88   $lxdebug->enter_sub();
 
  90   $form->{title} = $locale->text("$form->{title} Account");
 
  92   $checked{ $form->{charttype} } = "checked";
 
  93   $checked{"$form->{category}_"} = "checked";
 
  94   $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
 
  96   $form->{description} =~ s/\"/"/g;
 
  98   if (@{ $form->{TAXKEY} }) {
 
  99     foreach $item (@{ $form->{TAXKEY} }) {
 
 100       if ($item->{tax} == $form->{tax}) {
 
 101         $form->{selecttaxkey} .=
 
 102           "<option value=$item->{tax} selected>$item->{taxdescription}\n";
 
 104         $form->{selecttaxkey} .=
 
 105           "<option value=$item->{tax}>$item->{taxdescription}\n";
 
 113                 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
 
 114                 <td><select name=tax>$form->{selecttaxkey}</select></td>
 
 115                 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
 
 116                 <td><input name=startdate value="$form->{startdate}"></td>
 
 119   if (@{ $form->{NEWACCOUNT} }) {
 
 120     if (!$form->{new_chart_valid}) {
 
 121       $form->{selectnewaccount} = "<option value=></option>";
 
 123     foreach $item (@{ $form->{NEWACCOUNT} }) {
 
 124       if ($item->{id} == $form->{new_chart_id}) {
 
 125         $form->{selectnewaccount} .=
 
 126           "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
 
 127       } elsif (!$form->{new_chart_valid}) {
 
 128         $form->{selectnewaccount} .=
 
 129           "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
 
 140                       <th align=right>| . $locale->text('Folgekonto') . qq|</th>
 
 141                       <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
 
 142                       <th align=right>| . $locale->text('Gültig ab') . qq|</th>
 
 143                       <td><input name=valid_from value="$form->{valid_from}"></td>
 
 149   $form->{selectustva} = "<option>\n";
 
 151   %ustva = (35  => $locale->text('UStVA-Nr. 35'),
 
 152             36  => $locale->text('UStVA-Nr. 36'),
 
 153             39  => $locale->text('UStVA-Nr. 39'),
 
 154             41  => $locale->text('UStVA-Nr. 41'),
 
 155             42  => $locale->text('UStVA-Nr. 42'),
 
 156             43  => $locale->text('UStVA-Nr. 43'),
 
 157             44  => $locale->text('UStVA-Nr. 44'),
 
 158             45  => $locale->text('UStVA-Nr. 45'),
 
 159             48  => $locale->text('UStVA-Nr. 48'),
 
 160             49  => $locale->text('UStVA-Nr. 49'),
 
 161             51  => $locale->text('UStVA-Nr. 51 left'),
 
 162             511 => $locale->text('UStVA-Nr. 51 right'),
 
 163             52  => $locale->text('UStVA-Nr. 52'),
 
 164             53  => $locale->text('UStVA-Nr. 53'),
 
 165             59  => $locale->text('UStVA-Nr. 59'),
 
 166             60  => $locale->text('UStVA-Nr. 60'),
 
 167             61  => $locale->text('UStVA-Nr. 61'),
 
 168             62  => $locale->text('UStVA-Nr. 62'),
 
 169             63  => $locale->text('UStVA-Nr. 63'),
 
 170             64  => $locale->text('UStVA-Nr. 64'),
 
 171             65  => $locale->text('UStVA-Nr. 65'),
 
 172             66  => $locale->text('UStVA-Nr. 66'),
 
 173             67  => $locale->text('UStVA-Nr. 67'),
 
 174             69  => $locale->text('UStVA-Nr. 69'),
 
 175             73  => $locale->text('UStVA-Nr. 73'),
 
 176             74  => $locale->text('UStVA-Nr. 74'),
 
 177             76  => $locale->text('UStVA-Nr. 76'),
 
 178             77  => $locale->text('UStVA-Nr. 77'),
 
 179             80  => $locale->text('UStVA-Nr. 80'),
 
 180             81  => $locale->text('UStVA-Nr. 81 left'),
 
 181             811 => $locale->text('UStVA-Nr. 81 right'),
 
 182             84  => $locale->text('UStVA-Nr. 84'),
 
 183             85  => $locale->text('UStVA-Nr. 85'),
 
 184             86  => $locale->text('UStVA-Nr. 86 left'),
 
 185             861 => $locale->text('UStVA-Nr. 86 right'),
 
 186             89  => $locale->text('UStVA-Nr. 89 left'),
 
 187             891 => $locale->text('UStVA-Nr. 89 right'),
 
 188             91  => $locale->text('UStVA-Nr. 91'),
 
 189             93  => $locale->text('UStVA-Nr. 93 left'),
 
 190             931 => $locale->text('UStVA-Nr. 93 right'),
 
 191             94  => $locale->text('UStVA-Nr. 94'),
 
 192             95  => $locale->text('UStVA-Nr. 95'),
 
 193             96  => $locale->text('UStVA-Nr. 96'),
 
 194             97  => $locale->text('UStVA-Nr. 97 links'),
 
 195             971 => $locale->text('UStVA-Nr. 97 rechts'),
 
 196             98  => $locale->text('UStVA-Nr. 98'));
 
 198   foreach $item (sort({ $a cmp $b } keys %ustva)) {
 
 199     if ($item == $form->{pos_ustva}) {
 
 200       $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
 
 202       $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
 
 209                 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
 
 210                 <td><select name=pos_ustva>$form->{selectustva}</select></td>
 
 211                 <input type=hidden name=selectustva value="$form->{selectustva}">
 
 214   $form->{selecteur} = "<option>\n";
 
 215   %eur = (1  => "Umsatzerlöse",
 
 216           2  => "sonstige Erlöse",
 
 217           3  => "Privatanteile",
 
 219           5  => "Ausserordentliche Erträge",
 
 220           6  => "Vereinnahmte Umsatzst.",
 
 221           7  => "Umsatzsteuererstattungen",
 
 222           8  => "Wareneingänge",
 
 223           9  => "Löhne und Gehälter",
 
 224           10 => "Gesetzl. sozialer Aufw.",
 
 226           12 => "Gas, Strom, Wasser",
 
 227           13 => "Instandhaltung",
 
 228           14 => "Steuern, Versich., Beiträge",
 
 230           16 => "Kfz-Versicherungen",
 
 231           17 => "Sonst. Fahrtkosten",
 
 232           18 => "Werbe- und Reisekosten",
 
 233           19 => "Instandhaltung u. Werkzeuge",
 
 234           20 => "Fachzeitschriften, Bücher",
 
 235           21 => "Miete für Einrichtungen",
 
 236           22 => "Rechts- und Beratungskosten",
 
 237           23 => "Bürobedarf, Porto, Telefon",
 
 238           24 => "Sonstige Aufwendungen",
 
 239           25 => "Abschreibungen auf Anlagever.",
 
 240           26 => "Abschreibungen auf GWG",
 
 242           28 => "Umsatzsteuerzahlungen",
 
 244           30 => "Ausserordentlicher Aufwand",
 
 245           31 => "Betriebliche Steuern");
 
 246   foreach $item (sort({ $a <=> $b } keys(%eur))) {
 
 247     if ($item == $form->{pos_eur}) {
 
 248       $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
 
 250       $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
 
 257                 <th align=right>| . $locale->text('EUER') . qq|</th>
 
 258                 <td><select name=pos_eur>$form->{selecteur}</select></td>
 
 259                 <input type=hidden name=selecteur value="$form->{selecteur}">
 
 262   $form->{selectbwa} = "<option>\n";
 
 264   %bwapos = (1  => 'Umsatzerlöse',
 
 265              2  => 'Best.Verdg.FE/UE',
 
 266              3  => 'Aktiv.Eigenleistung',
 
 267              4  => 'Mat./Wareneinkauf',
 
 268              5  => 'So.betr.Erlöse',
 
 269              10 => 'Personalkosten',
 
 271              12 => 'Betriebl.Steuern',
 
 272              13 => 'Vers./Beiträge',
 
 273              14 => 'Kfz.Kosten o.St.',
 
 274              15 => 'Werbe-Reisek.',
 
 275              16 => 'Kosten Warenabgabe',
 
 276              17 => 'Abschreibungen',
 
 277              18 => 'Rep./instandhlt.',
 
 278              19 => 'Übrige Steuern',
 
 279              20 => 'Sonst.Kosten',
 
 281              31 => 'Sonst.neutr.Aufw.',
 
 283              33 => 'Sonst.neutr.Ertrag',
 
 284              34 => 'Verr.kalk.Kosten',
 
 285              35 => 'Steuern Eink.u.Ertr.');
 
 286   foreach $item (sort({ $a <=> $b } keys %bwapos)) {
 
 287     if ($item == $form->{pos_bwa}) {
 
 288       $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
 
 290       $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
 
 297                 <th align=right>| . $locale->text('BWA') . qq|</th>
 
 298                 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
 
 299                 <input type=hidden name=selectbwa value="$form->{selectbwa}">
 
 302 # Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
 
 303 #  $form->{selectbilanz} = "<option>\n";
 
 304 #  foreach $item ((1, 2, 3, 4)) {
 
 305 #    if ($item == $form->{pos_bilanz}) {
 
 306 #      $form->{selectbilanz} .= "<option value=$item selected>$item\n";
 
 308 #      $form->{selectbilanz} .= "<option value=$item>$item\n";
 
 315 #               <th align=right>| . $locale->text('Bilanz') . qq|</th>
 
 316 #               <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
 
 317 #               <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
 
 320   # this is for our parser only!
 
 321   # type=submit $locale->text('Add Account')
 
 322   # type=submit $locale->text('Edit Account')
 
 323   $form->{type} = "account";
 
 330 <form method=post action=$form->{script}>
 
 332 <input type=hidden name=id value=$form->{id}>
 
 333 <input type=hidden name=type value=account>
 
 334 <input type=hidden name=orphaned value=$form->{orphaned}>
 
 335 <input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
 
 337 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
 
 338 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
 
 339 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
 
 340 <input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
 
 341 <input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
 
 343 <table border=0 width=100%>
 
 345     <th class=listtop>$form->{title}</th>
 
 352           <th align=right>| . $locale->text('Account Number') . qq|</th>
 
 353           <td><input name=accno size=20 value=$form->{accno}></td>
 
 356           <th align=right>| . $locale->text('Description') . qq|</th>
 
 357           <td><input name=description size=40 value="$form->{description}"></td>
 
 360           <th align=right>| . $locale->text('Account Type') . qq|</th>
 
 364                 <td><input name=category type=radio class=radio value=A $checked{A_}> |
 
 365     . $locale->text('Asset') . qq|\n<br>
 
 366                 <input name=category type=radio class=radio value=L $checked{L_}> |
 
 367     . $locale->text('Liability') . qq|\n<br>
 
 368                 <input name=category type=radio class=radio value=Q $checked{Q_}> |
 
 369     . $locale->text('Equity') . qq|\n<br>
 
 370                 <input name=category type=radio class=radio value=I $checked{I_}> |
 
 371     . $locale->text('Revenue') . qq|\n<br>
 
 372                 <input name=category type=radio class=radio value=E $checked{E_}> |
 
 373     . $locale->text('Expense') . qq|<br>
 
 374                 <input name=category type=radio class=radio value=C $checked{C_}> |
 
 375     . $locale->text('Costs') . qq|</td>
 
 376                 <td width=50> </td>
 
 378                 <input name=charttype type=radio class=radio value="H" $checked{H}> |
 
 379     . $locale->text('Heading') . qq|<br>
 
 380                 <input name=charttype type=radio class=radio value="A" $checked{A}> |
 
 381     . $locale->text('Account') . qq|</td>
 
 388   if ($form->{charttype} eq "A") {
 
 395       . $locale->text('Is this a summary account to record') . qq|</th>
 
 397                 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
 
 398       . $locale->text('AR')
 
 399       . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
 
 400       . $locale->text('AP')
 
 401       . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
 
 402       . $locale->text('Inventory')
 
 409           <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
 
 415                 <th align=left>| . $locale->text('Receivables') . qq|</th>
 
 416                 <th align=left>| . $locale->text('Payables') . qq|</th>
 
 417                 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
 
 418                 <th align=left>| . $locale->text('Service Items') . qq|</th>
 
 422                 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
 
 423       . $locale->text('Revenue') . qq|\n<br>
 
 424                 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
 
 425       . $locale->text('Receipt') . qq|\n<br>
 
 426                 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
 
 427       . $locale->text('Tax') . qq|
 
 430                 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
 
 431       . $locale->text('Expense/Asset') . qq|\n<br>
 
 432                 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
 
 433       . $locale->text('Payment') . qq|\n<br>
 
 434                 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
 
 435       . $locale->text('Tax') . qq|
 
 438                 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
 
 439       . $locale->text('Revenue') . qq|\n<br>
 
 440                 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
 
 441       . $locale->text('Expense') . qq|\n<br>
 
 442                 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
 
 443       . $locale->text('Tax') . qq|
 
 446                 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
 
 447       . $locale->text('Revenue') . qq|\n<br>
 
 448                 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
 
 449       . $locale->text('Expense') . qq|\n<br>
 
 450                 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
 
 451       . $locale->text('Tax') . qq|
 
 471     <td><hr size=3 noshade></td>
 
 476   $lxdebug->leave_sub();
 
 480   $lxdebug->enter_sub();
 
 484 <input name=callback type=hidden value="$form->{callback}">
 
 486 <input type=hidden name=path value=$form->{path}>
 
 487 <input type=hidden name=login value=$form->{login}>
 
 488 <input type=hidden name=password value=$form->{password}>
 
 491   if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
 
 493 <input type=submit class=submit name=action value="|
 
 494     . $locale->text('Save') . qq|">
 
 498   if ($form->{id} && $form->{orphaned}) {
 
 499     print qq|<input type=submit class=submit name=action value="|
 
 500       . $locale->text('Delete') . qq|">|;
 
 510   $lxdebug->leave_sub();
 
 514   $lxdebug->enter_sub();
 
 516   $form->isblank("accno",    $locale->text('Account Number missing!'));
 
 517   $form->isblank("category", $locale->text('Account Type missing!'));
 
 519   $form->redirect($locale->text('Account saved!'))
 
 520     if (AM->save_account(\%myconfig, \%$form));
 
 521   $form->error($locale->text('Cannot save account!'));
 
 523   $lxdebug->leave_sub();
 
 527   $lxdebug->enter_sub();
 
 529   CA->all_accounts(\%myconfig, \%$form);
 
 531   $form->{title} = $locale->text('Chart of Accounts');
 
 535     "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 540   $callback = $form->escape($callback);
 
 542   foreach $ca (@{ $form->{CA} }) {
 
 544     $ca->{debit}  = " ";
 
 545     $ca->{credit} = " ";
 
 547     if ($ca->{amount} > 0) {
 
 549         $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
 
 551     if ($ca->{amount} < 0) {
 
 553         $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
 
 556     my @links = split( q{:}, $ca->{link});
 
 560     foreach my $link (@links){
 
 561       $link = ( $link eq 'AR')             ? $locale->text('Account Link AR')
 
 562                : ( $link eq 'AP')             ? $locale->text('Account Link AP')
 
 563                : ( $link eq 'IC')             ? $locale->text('Account Link IC')
 
 564                : ( $link eq 'AR_amount' )     ? $locale->text('Account Link AR_amount')
 
 565                : ( $link eq 'AR_paid' )       ? $locale->text('Account Link AR_paid')
 
 566                : ( $link eq 'AR_tax' )        ? $locale->text('Account Link AR_tax')
 
 567                : ( $link eq 'AP_amount' )     ? $locale->text('Account Link AP_amount')
 
 568                : ( $link eq 'AP_paid' )       ? $locale->text('Account Link AP_paid')
 
 569                : ( $link eq 'AP_tax' )        ? $locale->text('Account Link AP_tax')
 
 570                : ( $link eq 'IC_sale' )       ? $locale->text('Account Link IC_sale')
 
 571                : ( $link eq 'IC_cogs' )       ? $locale->text('Account Link IC_cogs')
 
 572                : ( $link eq 'IC_taxpart' )    ? $locale->text('Account Link IC_taxpart')
 
 573                : ( $link eq 'IC_income' )     ? $locale->text('Account Link IC_income')
 
 574                : ( $link eq 'IC_expense' )    ? $locale->text('Account Link IC_expense')
 
 575                : ( $link eq 'IC_taxservice' ) ? $locale->text('Account Link IC_taxservice')
 
 576                : ( $link eq 'CT_tax' )        ? $locale->text('Account Link CT_tax')
 
 577                : $locale->text('Unknown Link') . ': ' . $link;
 
 579       $ca->{link} .= qq|[| . $link . qq|] |;
 
 582     $ca->{startdate}      =~ s/,/<br>/og;
 
 583     $ca->{tk_ustva}       =~ s/,/<br>/og;
 
 584     $ca->{taxkey}         =~ s/,/<br>/og;
 
 585     $ca->{taxaccount}     =~ s/,/<br>/og;
 
 586     $ca->{taxdescription} =~ s/,/<br>/og;
 
 587     $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):q{};
 
 589     $ca->{category} = ($ca->{category} eq 'A') ? $locale->text('Account Category A')
 
 590                     : ($ca->{category} eq 'E') ? $locale->text('Account Category E')
 
 591                     : ($ca->{category} eq 'L') ? $locale->text('Account Category L')
 
 592                     : ($ca->{category} eq 'I') ? $locale->text('Account Category I')
 
 593                     : ($ca->{category} eq 'Q') ? $locale->text('Account Category Q')
 
 594                     : ($ca->{category} eq 'C') ? $locale->text('Account Category C')
 
 595                     : ($ca->{category} eq 'G') ? $locale->text('Account Category G')
 
 596                     : $locale->text('Unknown Category') . ': ' . $ca->{category};
 
 598     $ca->{link_edit_account} = 
 
 599         qq|$form->{script}?action=edit_account&id=$ca->{id}|
 
 600        .qq|&path=$form->{path}&login=$form->{login}|
 
 601        .qq|&password=$form->{password}&callback=$callback|;
 
 604   my $parameters_ref = {
 
 607   #   hidden_variables                => $_hidden_variables_ref,
 
 610   # Ausgabe des Templates
 
 611   print($form->parse_html_template('am/list_accounts', $parameters_ref));
 
 613   $lxdebug->leave_sub();
 
 619   $lxdebug->enter_sub();
 
 621   $form->{title} = $locale->text('Delete Account');
 
 624     qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
 
 626     if ($form->{id} == $form->{$id}) {
 
 627       $form->error($locale->text('Cannot delete default account!'));
 
 631   $form->redirect($locale->text('Account deleted!'))
 
 632     if (AM->delete_account(\%myconfig, \%$form));
 
 633   $form->error($locale->text('Cannot delete account!'));
 
 635   $lxdebug->leave_sub();
 
 639   $lxdebug->enter_sub();
 
 641   @{ $form->{fields} } = (accno, description);
 
 642   $form->{table}     = "gifi";
 
 643   $form->{sortorder} = "accno";
 
 645   AM->gifi_accounts(\%myconfig, \%$form);
 
 647   $form->{title} = $locale->text('GIFI');
 
 651     "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 653   @column_index = qw(accno description);
 
 655   $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
 
 656   $column_header{description} =
 
 657     qq|<th>| . $locale->text('Description') . qq|</a></th>|;
 
 660   $colspan = $#column_index + 1;
 
 667     <th class=listtop colspan=$colspan>$form->{title}</th>
 
 670   <tr class=listheading>
 
 673   map { print "$column_header{$_}\n" } @column_index;
 
 680   $callback = $form->escape($callback);
 
 682   foreach $ca (@{ $form->{ALL} }) {
 
 688 <tr valign=top class=listrow$i>|;
 
 690     $column_data{accno} =
 
 691       qq|<td><a href=$form->{script}?action=edit_gifi&coa=1&accno=$ca->{accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</td>|;
 
 692     $column_data{description} = qq|<td>$ca->{description} </td>|;
 
 694     map { print "$column_data{$_}\n" } @column_index;
 
 701     <td colspan=$colspan><hr size=3 noshade></td>
 
 709   $lxdebug->leave_sub();
 
 713   $lxdebug->enter_sub();
 
 715   $form->{title} = "Add";
 
 719     "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 726   $lxdebug->leave_sub();
 
 730   $lxdebug->enter_sub();
 
 732   $form->{title} = "Edit";
 
 734   AM->get_gifi(\%myconfig, \%$form);
 
 739   $lxdebug->leave_sub();
 
 743   $lxdebug->enter_sub();
 
 745   $form->{title} = $locale->text("$form->{title} GIFI");
 
 747   # $locale->text('Add GIFI')
 
 748   # $locale->text('Edit GIFI')
 
 750   $form->{description} =~ s/\"/"/g;
 
 757 <form method=post action=$form->{script}>
 
 759 <input type=hidden name=id value=$form->{accno}>
 
 760 <input type=hidden name=type value=gifi>
 
 764     <th class=listtop>$form->{title}</th>
 
 771           <th align=right>| . $locale->text('GIFI') . qq|</th>
 
 772           <td><input name=accno size=20 value=$form->{accno}></td>
 
 775           <th align=right>| . $locale->text('Description') . qq|</th>
 
 776           <td><input name=description size=60 value="$form->{description}"></td>
 
 782     <td colspan=2><hr size=3 noshade></td>
 
 787   $lxdebug->leave_sub();
 
 791   $lxdebug->enter_sub();
 
 795 <input name=callback type=hidden value="$form->{callback}">
 
 797 <input type=hidden name=path value=$form->{path}>
 
 798 <input type=hidden name=login value=$form->{login}>
 
 799 <input type=hidden name=password value=$form->{password}>
 
 801 <br><input type=submit class=submit name=action value="|
 
 802     . $locale->text('Save') . qq|">|;
 
 806 <input type=submit class=submit name=action value="|
 
 807       . $locale->text('Copy to COA') . qq|">
 
 810     if ($form->{accno} && $form->{orphaned}) {
 
 811       print qq|<input type=submit class=submit name=action value="|
 
 812         . $locale->text('Delete') . qq|">|;
 
 823   $lxdebug->leave_sub();
 
 827   $lxdebug->enter_sub();
 
 829   $form->isblank("accno", $locale->text('GIFI missing!'));
 
 830   AM->save_gifi(\%myconfig, \%$form);
 
 831   $form->redirect($locale->text('GIFI saved!'));
 
 833   $lxdebug->leave_sub();
 
 837   $lxdebug->enter_sub();
 
 839   $form->isblank("accno", $locale->text('GIFI missing!'));
 
 841   AM->save_gifi(\%myconfig, \%$form);
 
 844   $form->{gifi_accno} = $form->{accno};
 
 845   $form->{title}      = "Add";
 
 846   $form->{charttype}  = "A";
 
 851   $lxdebug->leave_sub();
 
 855   $lxdebug->enter_sub();
 
 857   AM->delete_gifi(\%myconfig, \%$form);
 
 858   $form->redirect($locale->text('GIFI deleted!'));
 
 860   $lxdebug->leave_sub();
 
 864   $lxdebug->enter_sub();
 
 866   $form->{title} = "Add";
 
 870     "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
 871     unless $form->{callback};
 
 876   $lxdebug->leave_sub();
 
 879 sub edit_department {
 
 880   $lxdebug->enter_sub();
 
 882   $form->{title} = "Edit";
 
 884   AM->get_department(\%myconfig, \%$form);
 
 889   $lxdebug->leave_sub();
 
 892 sub list_department {
 
 893   $lxdebug->enter_sub();
 
 895   AM->departments(\%myconfig, \%$form);
 
 898     "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 900   $callback = $form->escape($form->{callback});
 
 902   $form->{title} = $locale->text('Departments');
 
 904   @column_index = qw(description cost profit);
 
 906   $column_header{description} =
 
 907       qq|<th class=listheading width=90%>|
 
 908     . $locale->text('Description')
 
 910   $column_header{cost} =
 
 911       qq|<th class=listheading nowrap>|
 
 912     . $locale->text('Cost Center')
 
 914   $column_header{profit} =
 
 915       qq|<th class=listheading nowrap>|
 
 916     . $locale->text('Profit Center')
 
 926     <th class=listtop>$form->{title}</th>
 
 932         <tr class=listheading>
 
 935   map { print "$column_header{$_}\n" } @column_index;
 
 941   foreach $ref (@{ $form->{ALL} }) {
 
 947         <tr valign=top class=listrow$i>
 
 950     $costcenter   = ($ref->{role} eq "C") ? "X" : "";
 
 951     $profitcenter = ($ref->{role} eq "P") ? "X" : "";
 
 953     $column_data{description} =
 
 954       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>|;
 
 955     $column_data{cost}   = qq|<td align=center>$costcenter</td>|;
 
 956     $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
 
 958     map { print "$column_data{$_}\n" } @column_index;
 
 970   <td><hr size=3 noshade></td>
 
 975 <form method=post action=$form->{script}>
 
 977 <input name=callback type=hidden value="$form->{callback}">
 
 979 <input type=hidden name=type value=department>
 
 981 <input type=hidden name=path value=$form->{path}>
 
 982 <input type=hidden name=login value=$form->{login}>
 
 983 <input type=hidden name=password value=$form->{password}>
 
 985 <input class=submit type=submit name=action value="|
 
 986     . $locale->text('Add') . qq|">
 
 994   $lxdebug->leave_sub();
 
 997 sub department_header {
 
 998   $lxdebug->enter_sub();
 
1000   $form->{title} = $locale->text("$form->{title} Department");
 
1002   # $locale->text('Add Department')
 
1003   # $locale->text('Edit Department')
 
1005   $form->{description} =~ s/\"/"/g;
 
1007   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
 
1009       qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
 
1012       qq|<input name=description size=60 value="$form->{description}">|;
 
1015   $costcenter   = "checked" if $form->{role} eq "C";
 
1016   $profitcenter = "checked" if $form->{role} eq "P";
 
1023 <form method=post action=$form->{script}>
 
1025 <input type=hidden name=id value=$form->{id}>
 
1026 <input type=hidden name=type value=department>
 
1030     <th class=listtop colspan=2>$form->{title}</th>
 
1032   <tr height="5"></tr>
 
1034     <th align=right>| . $locale->text('Description') . qq|</th>
 
1035     <td>$description</td>
 
1039     <td><input type=radio style=radio name=role value="C" $costcenter> |
 
1040     . $locale->text('Cost Center') . qq|
 
1041         <input type=radio style=radio name=role value="P" $profitcenter> |
 
1042     . $locale->text('Profit Center') . qq|
 
1045     <td colspan=2><hr size=3 noshade></td>
 
1050   $lxdebug->leave_sub();
 
1053 sub save_department {
 
1054   $lxdebug->enter_sub();
 
1056   $form->isblank("description", $locale->text('Description missing!'));
 
1057   AM->save_department(\%myconfig, \%$form);
 
1058   $form->redirect($locale->text('Department saved!'));
 
1060   $lxdebug->leave_sub();
 
1063 sub delete_department {
 
1064   $lxdebug->enter_sub();
 
1066   AM->delete_department(\%myconfig, \%$form);
 
1067   $form->redirect($locale->text('Department deleted!'));
 
1069   $lxdebug->leave_sub();
 
1073   $lxdebug->enter_sub();
 
1075   $form->{title} = "Add";
 
1078     "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1079     unless $form->{callback};
 
1084   $lxdebug->leave_sub();
 
1088   $lxdebug->enter_sub();
 
1090   $form->{title} = "Edit";
 
1092   AM->get_lead(\%myconfig, \%$form);
 
1096   $form->{orphaned} = 1;
 
1099   $lxdebug->leave_sub();
 
1103   $lxdebug->enter_sub();
 
1105   AM->lead(\%myconfig, \%$form);
 
1108     "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1110   $callback = $form->escape($form->{callback});
 
1112   $form->{title} = $locale->text('Lead');
 
1114   @column_index = qw(description cost profit);
 
1116   $column_header{description} =
 
1117       qq|<th class=listheading width=100%>|
 
1118     . $locale->text('Description')
 
1128     <th class=listtop>$form->{title}</th>
 
1130   <tr height="5"></tr>
 
1131   <tr class=listheading>
 
1134   map { print "$column_header{$_}\n" } @column_index;
 
1140   foreach $ref (@{ $form->{ALL} }) {
 
1146         <tr valign=top class=listrow$i>
 
1149         $lead = $ref->{lead};
 
1151     $column_data{description} =
 
1152       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>|;
 
1154     map { print "$column_data{$_}\n" } @column_index;
 
1163   <td><hr size=3 noshade></td>
 
1168 <form method=post action=$form->{script}>
 
1170 <input name=callback type=hidden value="$form->{callback}">
 
1172 <input type=hidden name=type value=lead>
 
1174 <input type=hidden name=path value=$form->{path}>
 
1175 <input type=hidden name=login value=$form->{login}>
 
1176 <input type=hidden name=password value=$form->{password}>
 
1178 <input class=submit type=submit name=action value="|
 
1179     . $locale->text('Add') . qq|">
 
1187   $lxdebug->leave_sub();
 
1191   $lxdebug->enter_sub();
 
1193   $form->{title} = $locale->text("$form->{title} Lead");
 
1195   # $locale->text('Add Lead')
 
1196   # $locale->text('Edit Lead')
 
1198   $form->{description} =~ s/\"/"/g;
 
1201       qq|<input name=description size=50 value="$form->{lead}">|;
 
1208 <form method=post action=$form->{script}>
 
1210 <input type=hidden name=id value=$form->{id}>
 
1211 <input type=hidden name=type value=lead>
 
1215     <th class=listtop colspan=2>$form->{title}</th>
 
1217   <tr height="5"></tr>
 
1219     <th align=right>| . $locale->text('Description') . qq|</th>
 
1220     <td>$description</td>
 
1222     <td colspan=2><hr size=3 noshade></td>
 
1227   $lxdebug->leave_sub();
 
1231   $lxdebug->enter_sub();
 
1233   $form->isblank("description", $locale->text('Description missing!'));
 
1234   AM->save_lead(\%myconfig, \%$form);
 
1235   $form->redirect($locale->text('lead saved!'));
 
1237   $lxdebug->leave_sub();
 
1241   $lxdebug->enter_sub();
 
1243   AM->delete_lead(\%myconfig, \%$form);
 
1244   $form->redirect($locale->text('lead deleted!'));
 
1246   $lxdebug->leave_sub();
 
1250   $lxdebug->enter_sub();
 
1252   $form->{title} = "Add";
 
1255     "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1256     unless $form->{callback};
 
1261   $lxdebug->leave_sub();
 
1265   $lxdebug->enter_sub();
 
1267   $form->{title} = "Edit";
 
1269   AM->get_business(\%myconfig, \%$form);
 
1273   $form->{orphaned} = 1;
 
1276   $lxdebug->leave_sub();
 
1280   $lxdebug->enter_sub();
 
1282   AM->business(\%myconfig, \%$form);
 
1285     "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1287   $callback = $form->escape($form->{callback});
 
1289   $form->{title} = $locale->text('Type of Business');
 
1291   @column_index = qw(description discount customernumberinit);
 
1293   $column_header{description} =
 
1294       qq|<th class=listheading width=60%>|
 
1295     . $locale->text('Description')
 
1297   $column_header{discount} =
 
1298       qq|<th class=listheading width=10%>|
 
1299     . $locale->text('Discount')
 
1301   $column_header{customernumberinit} =
 
1302       qq|<th class=listheading>|
 
1303     . $locale->text('Customernumberinit')
 
1313     <th class=listtop>$form->{title}</th>
 
1315   <tr height="5"></tr>
 
1319         <tr class=listheading>
 
1322   map { print "$column_header{$_}\n" } @column_index;
 
1328   foreach $ref (@{ $form->{ALL} }) {
 
1334         <tr valign=top class=listrow$i>
 
1338       $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
 
1341       ? "<b>$ref->{description}</b>"
 
1342       : "$ref->{description}";
 
1343     $column_data{description} =
 
1344       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>|;
 
1345     $column_data{discount}           = qq|<td align=right>$discount</td>|;
 
1346     $column_data{customernumberinit} =
 
1347       qq|<td align=right>$ref->{customernumberinit}</td>|;
 
1349     map { print "$column_data{$_}\n" } @column_index;
 
1361   <td><hr size=3 noshade></td>
 
1366 <form method=post action=$form->{script}>
 
1368 <input name=callback type=hidden value="$form->{callback}">
 
1370 <input type=hidden name=type value=business>
 
1372 <input type=hidden name=path value=$form->{path}>
 
1373 <input type=hidden name=login value=$form->{login}>
 
1374 <input type=hidden name=password value=$form->{password}>
 
1376 <input class=submit type=submit name=action value="|
 
1377     . $locale->text('Add') . qq|">
 
1385   $lxdebug->leave_sub();
 
1388 sub business_header {
 
1389   $lxdebug->enter_sub();
 
1391   $form->{title}    = $locale->text("$form->{title} Business");
 
1392   $form->{salesman} = "checked" if $form->{salesman};
 
1394   # $locale->text('Add Business')
 
1395   # $locale->text('Edit Business')
 
1397   $form->{description} =~ s/\"/"/g;
 
1399     $form->format_amount(\%myconfig, $form->{discount} * 100);
 
1406 <form method=post action=$form->{script}>
 
1408 <input type=hidden name=id value=$form->{id}>
 
1409 <input type=hidden name=type value=business>
 
1413     <th class=listtop colspan=2>$form->{title}</th>
 
1415   <tr height="5"></tr>
 
1417     <th align=right>| . $locale->text('Type of Business') . qq|</th>
 
1418     <td><input name=description size=30 value="$form->{description}"></td>
 
1421     <th align=right>| . $locale->text('Discount') . qq| %</th>
 
1422     <td><input name=discount size=5 value=$form->{discount}></td>
 
1425     <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
 
1426     <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
 
1429     <td align=right>| . $locale->text('Salesman') . qq|</td>
 
1430     <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
 
1432   <td colspan=2><hr size=3 noshade></td>
 
1437   $lxdebug->leave_sub();
 
1441   $lxdebug->enter_sub();
 
1443   $form->isblank("description", $locale->text('Description missing!'));
 
1444   AM->save_business(\%myconfig, \%$form);
 
1445   $form->redirect($locale->text('Business saved!'));
 
1447   $lxdebug->leave_sub();
 
1450 sub delete_business {
 
1451   $lxdebug->enter_sub();
 
1453   AM->delete_business(\%myconfig, \%$form);
 
1454   $form->redirect($locale->text('Business deleted!'));
 
1456   $lxdebug->leave_sub();
 
1460   $lxdebug->enter_sub();
 
1462   $form->{title} = "Add";
 
1465     "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1466     unless $form->{callback};
 
1471   $lxdebug->leave_sub();
 
1475   $lxdebug->enter_sub();
 
1477   $form->{title} = "Edit";
 
1479   AM->get_language(\%myconfig, \%$form);
 
1483   $form->{orphaned} = 1;
 
1486   $lxdebug->leave_sub();
 
1490   $lxdebug->enter_sub();
 
1492   AM->language(\%myconfig, \%$form);
 
1495     "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1497   $callback = $form->escape($form->{callback});
 
1499   $form->{title} = $locale->text('Languages');
 
1501   @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
 
1503   $column_header{description} =
 
1504       qq|<th class=listheading width=60%>|
 
1505     . $locale->text('Description')
 
1507   $column_header{template_code} =
 
1508       qq|<th class=listheading width=10%>|
 
1509     . $locale->text('Template Code')
 
1511   $column_header{article_code} =
 
1512       qq|<th class=listheading>|
 
1513     . $locale->text('Article Code')
 
1515   $column_header{output_numberformat} =
 
1516       qq|<th class=listheading>|
 
1517     . $locale->text('Number Format')
 
1519   $column_header{output_dateformat} =
 
1520       qq|<th class=listheading>|
 
1521     . $locale->text('Date Format')
 
1523   $column_header{output_longdates} =
 
1524       qq|<th class=listheading>|
 
1525     . $locale->text('Long Dates')
 
1535     <th class=listtop>$form->{title}</th>
 
1537   <tr height="5"></tr>
 
1541         <tr class=listheading>
 
1544   map { print "$column_header{$_}\n" } @column_index;
 
1550   foreach $ref (@{ $form->{ALL} }) {
 
1556         <tr valign=top class=listrow$i>
 
1560     $column_data{description} =
 
1561       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>|;
 
1562     $column_data{template_code}           = qq|<td align=right>$ref->{template_code}</td>|;
 
1563     $column_data{article_code} =
 
1564       qq|<td align=right>$ref->{article_code}</td>|;
 
1565     $column_data{output_numberformat} =
 
1567       ($ref->{output_numberformat} ? $ref->{output_numberformat} :
 
1568        $locale->text("use program settings")) .
 
1570     $column_data{output_dateformat} =
 
1572       ($ref->{output_dateformat} ? $ref->{output_dateformat} :
 
1573        $locale->text("use program settings")) .
 
1575     $column_data{output_longdates} =
 
1577       ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
 
1580     map { print "$column_data{$_}\n" } @column_index;
 
1592   <td><hr size=3 noshade></td>
 
1597 <form method=post action=$form->{script}>
 
1599 <input name=callback type=hidden value="$form->{callback}">
 
1601 <input type=hidden name=type value=language>
 
1603 <input type=hidden name=path value=$form->{path}>
 
1604 <input type=hidden name=login value=$form->{login}>
 
1605 <input type=hidden name=password value=$form->{password}>
 
1607 <input class=submit type=submit name=action value="|
 
1608     . $locale->text('Add') . qq|">
 
1616   $lxdebug->leave_sub();
 
1619 sub language_header {
 
1620   $lxdebug->enter_sub();
 
1622   $form->{title}    = $locale->text("$form->{title} Language");
 
1624   # $locale->text('Add Language')
 
1625   # $locale->text('Edit Language')
 
1627   $form->{description} =~ s/\"/"/g;
 
1628   $form->{template_code} =~ s/\"/"/g;
 
1629   $form->{article_code} =~ s/\"/"/g;
 
1635     qq|<option value="">| . $locale->text("use program settings") .
 
1637   foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
 
1639       ($item eq $form->{output_numberformat})
 
1640       ? "<option selected>$item"
 
1646     qq|<option value="">| . $locale->text("use program settings") .
 
1648   foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
 
1650       ($item eq $form->{output_dateformat})
 
1651       ? "<option selected>$item"
 
1659 <form method=post action=$form->{script}>
 
1661 <input type=hidden name=id value=$form->{id}>
 
1662 <input type=hidden name=type value=language>
 
1666     <th class=listtop colspan=2>$form->{title}</th>
 
1668   <tr height="5"></tr>
 
1670     <th align=right>| . $locale->text('Language') . qq|</th>
 
1671     <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
 
1674     <th align=right>| . $locale->text('Template Code') . qq|</th>
 
1675     <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
 
1678     <th align=right>| . $locale->text('Article Code') . qq|</th>
 
1679     <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
 
1682     <th align=right>| . $locale->text('Number Format') . qq|</th>
 
1683     <td><select name="output_numberformat">$numberformat</select></td>
 
1686     <th align=right>| . $locale->text('Date Format') . qq|</th>
 
1687     <td><select name="output_dateformat">$dateformat</select></td>
 
1690     <th align=right>| . $locale->text('Long Dates') . qq|</th>
 
1691     <td><input type="radio" name="output_longdates" value="1"| .
 
1692     ($form->{output_longdates} ? " checked" : "") .
 
1693     qq|>| . $locale->text("Yes") .
 
1694     qq|<input type="radio" name="output_longdates" value="0"| .
 
1695     ($form->{output_longdates} ? "" : " checked") .
 
1696     qq|>| . $locale->text("No") .
 
1699   <td colspan=2><hr size=3 noshade></td>
 
1704   $lxdebug->leave_sub();
 
1708   $lxdebug->enter_sub();
 
1710   $form->isblank("description", $locale->text('Language missing!'));
 
1711   $form->isblank("template_code", $locale->text('Template Code missing!'));
 
1712   $form->isblank("article_code", $locale->text('Article Code missing!'));
 
1713   AM->save_language(\%myconfig, \%$form);
 
1714   $form->redirect($locale->text('Language saved!'));
 
1716   $lxdebug->leave_sub();
 
1719 sub delete_language {
 
1720   $lxdebug->enter_sub();
 
1722   AM->delete_language(\%myconfig, \%$form);
 
1723   $form->redirect($locale->text('Language deleted!'));
 
1725   $lxdebug->leave_sub();
 
1729 sub add_buchungsgruppe {
 
1730   $lxdebug->enter_sub();
 
1732   # $locale->text("Add Buchungsgruppe")
 
1733   # $locale->text("Edit Buchungsgruppe")
 
1734   $form->{title} = "Add";
 
1737     "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1738     unless $form->{callback};
 
1739   AM->get_buchungsgruppe(\%myconfig, \%$form);
 
1740   $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
 
1741   for (my $i = 0; 4 > $i; $i++) {
 
1742     map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; }
 
1743         qw(income expense));
 
1746   &buchungsgruppe_header;
 
1749   $lxdebug->leave_sub();
 
1752 sub edit_buchungsgruppe {
 
1753   $lxdebug->enter_sub();
 
1755   $form->{title} = "Edit";
 
1757   AM->get_buchungsgruppe(\%myconfig, \%$form);
 
1759   &buchungsgruppe_header;
 
1763   $lxdebug->leave_sub();
 
1766 sub list_buchungsgruppe {
 
1767   $lxdebug->enter_sub();
 
1769   AM->buchungsgruppe(\%myconfig, \%$form);
 
1772     "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1774   $callback = $form->escape($form->{callback});
 
1776   $form->{title} = $locale->text('Buchungsgruppen');
 
1778   @column_index = qw(up down description inventory_accno
 
1779                      income_accno_0 expense_accno_0
 
1780                      income_accno_1 expense_accno_1
 
1781                      income_accno_2 expense_accno_2
 
1782                      income_accno_3 expense_accno_3 );
 
1784   $column_header{up} =
 
1785       qq|<th class="listheading">|
 
1786     . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
 
1788   $column_header{down} =
 
1789       qq|<th class="listheading">|
 
1790     . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
 
1792   $column_header{description} =
 
1793       qq|<th class="listheading" width="40%">|
 
1794     . $locale->text('Description')
 
1796   $column_header{inventory_accno} =
 
1797       qq|<th class=listheading>|
 
1798     . $locale->text('Bestandskonto')
 
1800   $column_header{income_accno_0} =
 
1801       qq|<th class=listheading>|
 
1802     . $locale->text('Erlöse Inland')
 
1804   $column_header{expense_accno_0} =
 
1805       qq|<th class=listheading>|
 
1806     . $locale->text('Aufwand Inland')
 
1808   $column_header{income_accno_1} =
 
1809       qq|<th class=listheading>|
 
1810     . $locale->text('Erlöse EU m. UStId')
 
1812   $column_header{expense_accno_1} =
 
1813       qq|<th class=listheading>|
 
1814     . $locale->text('Aufwand EU m. UStId')
 
1816   $column_header{income_accno_2} =
 
1817       qq|<th class=listheading>|
 
1818     . $locale->text('Erlöse EU o. UStId')
 
1820   $column_header{expense_accno_2} =
 
1821       qq|<th class=listheading>|
 
1822     . $locale->text('Aufwand EU o. UStId')
 
1824   $column_header{income_accno_3} =
 
1825       qq|<th class=listheading>|
 
1826     . $locale->text('Erlöse Ausland')
 
1828   $column_header{expense_accno_3} =
 
1829       qq|<th class=listheading>|
 
1830     . $locale->text('Aufwand Ausland')
 
1839     <th class=listtop>$form->{title}</th>
 
1841   <tr height="5"></tr>
 
1845         <tr class=listheading>
 
1848   map { print "$column_header{$_}\n" } @column_index;
 
1854   my $swap_link = qq|$form->{script}?action=swap_buchungsgruppen&|;
 
1855   map({ $swap_link .= $_ . "=" . $form->escape($form->{$_}) . "&" }
 
1856       qw(login password path));
 
1859   foreach $ref (@{ $form->{ALL} }) {
 
1865         <tr valign=top class=listrow$i>
 
1869       my $pref = $form->{ALL}->[$row - 1];
 
1871         qq|<td align="center" valign="center">| .
 
1872         qq|<a href="${swap_link}id1=$ref->{id}&id2=$pref->{id}">| .
 
1873         qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">| .
 
1876       $column_data{up} = qq|<td> </td>|;
 
1879     if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
 
1880       $column_data{down} = qq|<td> </td>|;
 
1882       my $nref = $form->{ALL}->[$row + 1];
 
1883       $column_data{down} =
 
1884         qq|<td align="center" valign="center">| .
 
1885         qq|<a href="${swap_link}id1=$ref->{id}&id2=$nref->{id}">| .
 
1886         qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">| .
 
1890     $column_data{description} =
 
1891       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>|;
 
1892     $column_data{inventory_accno}           = qq|<td align=right>$ref->{inventory_accno}</td>|;
 
1893     $column_data{income_accno_0} =
 
1894       qq|<td align=right>$ref->{income_accno_0}</td>|;
 
1895     $column_data{expense_accno_0}           = qq|<td align=right>$ref->{expense_accno_0}</td>|;
 
1896     $column_data{income_accno_1} =
 
1897       qq|<td align=right>$ref->{income_accno_1}</td>|;
 
1898     $column_data{expense_accno_1}           = qq|<td align=right>$ref->{expense_accno_1}</td>|;
 
1899     $column_data{income_accno_2} =
 
1900       qq|<td align=right>$ref->{income_accno_2}</td>|;
 
1901     $column_data{expense_accno_2}           = qq|<td align=right>$ref->{expense_accno_2}</td>|;
 
1902     $column_data{income_accno_3} =
 
1903       qq|<td align=right>$ref->{income_accno_3}</td>|;
 
1904     $column_data{expense_accno_3}           = qq|<td align=right>$ref->{expense_accno_3}</td>|;
 
1906     map { print "$column_data{$_}\n" } @column_index;
 
1920   <td><hr size=3 noshade></td>
 
1925 <form method=post action=$form->{script}>
 
1927 <input name=callback type=hidden value="$form->{callback}">
 
1929 <input type=hidden name=type value=buchungsgruppe>
 
1931 <input type=hidden name=path value=$form->{path}>
 
1932 <input type=hidden name=login value=$form->{login}>
 
1933 <input type=hidden name=password value=$form->{password}>
 
1935 <input class=submit type=submit name=action value="|
 
1936     . $locale->text('Add') . qq|">
 
1944   $lxdebug->leave_sub();
 
1947 sub buchungsgruppe_header {
 
1948   $lxdebug->enter_sub();
 
1950   $form->{title}    = $locale->text("$form->{title} Buchungsgruppe");
 
1952   # $locale->text('Buchungsgruppe hinzufügen')
 
1953   # $locale->text('Buchungsgruppe bearbeiten')
 
1955   my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
 
1956   my %acc_type_map = (
 
1957     "IC" => $acc_inventory,
 
1958     "IC_income" => $acc_income,
 
1959     "IC_sale" => $acc_income,
 
1960     "IC_expense" => $acc_expense,
 
1961     "IC_cogs" => $acc_expense,
 
1964   foreach $key (keys(%acc_type_map)) {
 
1965     foreach $ref (@{ $form->{IC_links}{$key} }) {
 
1966       $acc_type_map{$key}->{$ref->{"id"}} = $ref;
 
1970   foreach my $type (qw(IC IC_income IC_expense)) {
 
1971     $form->{"select$type"} =
 
1973            map({ "<option value=$_->{id} $_->{selected}>" .
 
1974                    "$_->{accno}--" . H($_->{description}) . "</option>" }
 
1975                sort({ $a->{"accno"} cmp $b->{"accno"} }
 
1976                     values(%{$acc_type_map{$type}}))));
 
1980     $form->{selectIC} =~ s/selected//g;
 
1981     $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/  value=$form->{inventory_accno_id} selected/;
 
1982     $form->{selectIC_income} =~ s/selected//g;
 
1983     $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/  value=$form->{income_accno_id_0} selected/;
 
1984     $form->{selectIC_expense} =~ s/selected//g;
 
1985     $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/  value=$form->{expense_accno_id_0} selected/;
 
1991                 <th align=right>| . $locale->text('Inventory') . qq|</th>
 
1992                 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
 
1993                 <input name=selectIC type=hidden value="$form->{selectIC}">
 
1997                 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
 
2001   $linkaccounts .= qq|
 
2003                 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
 
2004                 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
 
2007                 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
 
2008                 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
 
2011     $form->{selectIC_income} =~ s/selected//g;
 
2012     $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/  value=$form->{income_accno_id_1} selected/;
 
2013     $form->{selectIC_expense} =~ s/selected//g;
 
2014     $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/  value=$form->{expense_accno_id_1} selected/;
 
2016   $linkaccounts .= qq|        <tr>
 
2017                 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
 
2018                 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
 
2021                 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
 
2022                 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
 
2026     $form->{selectIC_income} =~ s/selected//g;
 
2027     $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/  value=$form->{income_accno_id_2} selected/;
 
2028     $form->{selectIC_expense} =~ s/selected//g;
 
2029     $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/  value=$form->{expense_accno_id_2} selected/;
 
2032   $linkaccounts .= qq|        <tr>
 
2033                 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
 
2034                 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
 
2037                 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
 
2038                 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
 
2042     $form->{selectIC_income} =~ s/selected//g;
 
2043     $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/  value=$form->{income_accno_id_3} selected/;
 
2044     $form->{selectIC_expense} =~ s/selected//g;
 
2045     $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/  value=$form->{expense_accno_id_3} selected/;
 
2048   $linkaccounts .= qq|        <tr>
 
2049                 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
 
2050                 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
 
2053                 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
 
2054                 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
 
2064 <form method=post action=$form->{script}>
 
2066 <input type=hidden name=id value=$form->{id}>
 
2067 <input type=hidden name=type value=buchungsgruppe>
 
2071     <th class=listtop colspan=2>$form->{title}</th>
 
2073   <tr height="5"></tr>
 
2075     <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
 
2076     <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
 
2079   <td colspan=2><hr size=3 noshade></td>
 
2084   $lxdebug->leave_sub();
 
2087 sub save_buchungsgruppe {
 
2088   $lxdebug->enter_sub();
 
2090   $form->isblank("description", $locale->text('Description missing!'));
 
2092   AM->save_buchungsgruppe(\%myconfig, \%$form);
 
2093   $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
 
2095   $lxdebug->leave_sub();
 
2098 sub delete_buchungsgruppe {
 
2099   $lxdebug->enter_sub();
 
2101   AM->delete_buchungsgruppe(\%myconfig, \%$form);
 
2102   $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
 
2104   $lxdebug->leave_sub();
 
2107 sub swap_buchungsgruppen {
 
2108   $lxdebug->enter_sub();
 
2110   AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen");
 
2111   list_buchungsgruppe();
 
2113   $lxdebug->leave_sub();
 
2118   $lxdebug->enter_sub();
 
2120   $form->{title} = "Add";
 
2123     "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
2124     unless $form->{callback};
 
2129   $lxdebug->leave_sub();
 
2133   $lxdebug->enter_sub();
 
2135   $form->{title} = "Edit";
 
2137   AM->get_printer(\%myconfig, \%$form);
 
2141   $form->{orphaned} = 1;
 
2144   $lxdebug->leave_sub();
 
2148   $lxdebug->enter_sub();
 
2150   AM->printer(\%myconfig, \%$form);
 
2153     "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
2155   $callback = $form->escape($form->{callback});
 
2157   $form->{title} = $locale->text('Printer');
 
2159   @column_index = qw(printer_description printer_command template_code);
 
2161   $column_header{printer_description} =
 
2162       qq|<th class=listheading width=60%>|
 
2163     . $locale->text('Printer Description')
 
2165   $column_header{printer_command} =
 
2166       qq|<th class=listheading width=10%>|
 
2167     . $locale->text('Printer Command')
 
2169   $column_header{template_code} =
 
2170       qq|<th class=listheading>|
 
2171     . $locale->text('Template Code')
 
2181     <th class=listtop>$form->{title}</th>
 
2183   <tr height="5"></tr>
 
2187         <tr class=listheading>
 
2190   map { print "$column_header{$_}\n" } @column_index;
 
2196   foreach $ref (@{ $form->{ALL} }) {
 
2202         <tr valign=top class=listrow$i>
 
2206     $column_data{printer_description} =
 
2207       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>|;
 
2208     $column_data{printer_command}           = qq|<td align=right>$ref->{printer_command}</td>|;
 
2209     $column_data{template_code} =
 
2210       qq|<td align=right>$ref->{template_code}</td>|;
 
2212     map { print "$column_data{$_}\n" } @column_index;
 
2224   <td><hr size=3 noshade></td>
 
2229 <form method=post action=$form->{script}>
 
2231 <input name=callback type=hidden value="$form->{callback}">
 
2233 <input type=hidden name=type value=printer>
 
2235 <input type=hidden name=path value=$form->{path}>
 
2236 <input type=hidden name=login value=$form->{login}>
 
2237 <input type=hidden name=password value=$form->{password}>
 
2239 <input class=submit type=submit name=action value="|
 
2240     . $locale->text('Add') . qq|">
 
2248   $lxdebug->leave_sub();
 
2251 sub printer_header {
 
2252   $lxdebug->enter_sub();
 
2254   $form->{title}    = $locale->text("$form->{title} Printer");
 
2256   # $locale->text('Add Printer')
 
2257   # $locale->text('Edit Printer')
 
2259   $form->{printer_description} =~ s/\"/"/g;
 
2260   $form->{template_code} =~ s/\"/"/g;
 
2261   $form->{printer_command} =~ s/\"/"/g;
 
2269 <form method=post action=$form->{script}>
 
2271 <input type=hidden name=id value=$form->{id}>
 
2272 <input type=hidden name=type value=printer>
 
2276     <th class=listtop colspan=2>$form->{title}</th>
 
2278   <tr height="5"></tr>
 
2280     <th align=right>| . $locale->text('Printer') . qq|</th>
 
2281     <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
 
2284     <th align=right>| . $locale->text('Printer Command') . qq|</th>
 
2285     <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
 
2288     <th align=right>| . $locale->text('Template Code') . qq|</th>
 
2289     <td><input name=template_code size=5 value="$form->{template_code}"></td>
 
2291   <td colspan=2><hr size=3 noshade></td>
 
2296   $lxdebug->leave_sub();
 
2300   $lxdebug->enter_sub();
 
2302   $form->isblank("printer_description", $locale->text('Description missing!'));
 
2303   $form->isblank("printer_command", $locale->text('Printer Command missing!'));
 
2304   AM->save_printer(\%myconfig, \%$form);
 
2305   $form->redirect($locale->text('Printer saved!'));
 
2307   $lxdebug->leave_sub();
 
2310 sub delete_printer {
 
2311   $lxdebug->enter_sub();
 
2313   AM->delete_printer(\%myconfig, \%$form);
 
2314   $form->redirect($locale->text('Printer deleted!'));
 
2316   $lxdebug->leave_sub();
 
2321   $lxdebug->enter_sub();
 
2323   $form->{title} = "Add";
 
2326     "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
2327     unless $form->{callback};
 
2329   $form->{terms_netto} = 0;
 
2330   $form->{terms_skonto} = 0;
 
2331   $form->{percent_skonto} = 0;
 
2332   my @languages = AM->language(\%myconfig, $form, 1);
 
2333   map({ $_->{"language"} = $_->{"description"};
 
2334         $_->{"language_id"} = $_->{"id"}; } @languages);
 
2335   $form->{"TRANSLATION"} = \@languages;
 
2339   $lxdebug->leave_sub();
 
2343   $lxdebug->enter_sub();
 
2345   $form->{title} = "Edit";
 
2347   AM->get_payment(\%myconfig, $form);
 
2348   $form->{percent_skonto} =
 
2349     $form->format_amount(\%myconfig, $form->{percent_skonto} * 100);
 
2353   $form->{orphaned} = 1;
 
2356   $lxdebug->leave_sub();
 
2360   $lxdebug->enter_sub();
 
2362   AM->payment(\%myconfig, \%$form);
 
2364   $form->{callback} = build_std_url("action=list_payment");
 
2366   $callback = $form->escape($form->{callback});
 
2368   $form->{title} = $locale->text('Payment Terms');
 
2370   @column_index = qw(up down description description_long terms_netto
 
2371                      terms_skonto percent_skonto);
 
2373   $column_header{up} =
 
2374       qq|<th class="listheading" align="center" valign="center">|
 
2375     . qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
 
2377   $column_header{down} =
 
2378       qq|<th class="listheading" align="center" valign="center">|
 
2379     . qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">|
 
2381   $column_header{description} =
 
2382       qq|<th class=listheading>|
 
2383     . $locale->text('Description')
 
2385   $column_header{description_long} =
 
2386       qq|<th class=listheading>|
 
2387     . $locale->text('Long Description')
 
2389   $column_header{terms_netto} =
 
2390       qq|<th class=listheading>|
 
2391     . $locale->text('Netto Terms')
 
2393   $column_header{terms_skonto} =
 
2394       qq|<th class=listheading>|
 
2395     . $locale->text('Skonto Terms')
 
2397   $column_header{percent_skonto} =
 
2398       qq|<th class=listheading>|
 
2399     . $locale->text('Skonto')
 
2409     <th class=listtop>$form->{title}</th>
 
2411   <tr height="5"></tr>
 
2415         <tr class=listheading>
 
2418   map { print "$column_header{$_}\n" } @column_index;
 
2424   my $swap_link = build_std_url("action=swap_payment_terms");
 
2427   foreach $ref (@{ $form->{ALL} }) {
 
2433         <tr valign=top class=listrow$i>
 
2437       my $pref = $form->{ALL}->[$row - 1];
 
2439         qq|<td align="center" valign="center">| .
 
2440         qq|<a href="${swap_link}&id1=$ref->{id}&id2=$pref->{id}">| .
 
2441         qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">| .
 
2444       $column_data{up} = qq|<td> </td>|;
 
2447     if ($row == (scalar(@{ $form->{ALL} }) - 1)) {
 
2448       $column_data{down} = qq|<td> </td>|;
 
2450       my $nref = $form->{ALL}->[$row + 1];
 
2451       $column_data{down} =
 
2452         qq|<td align="center" valign="center">| .
 
2453         qq|<a href="${swap_link}&id1=$ref->{id}&id2=$nref->{id}">| .
 
2454         qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">| .
 
2458     $column_data{description} =
 
2460       build_std_url("action=edit_payment", "id=$ref->{id}", "callback=$callback") .
 
2461       qq|">| . H($ref->{description}) . qq|</a></td>|;
 
2462     $column_data{description_long} =
 
2463       qq|<td>| . H($ref->{description_long}) . qq|</td>|;
 
2464     $column_data{terms_netto} =
 
2465       qq|<td align=right>$ref->{terms_netto}</td>|;
 
2466     $column_data{terms_skonto} =
 
2467       qq|<td align=right>$ref->{terms_skonto}</td>|;
 
2468     $column_data{percent_skonto} =
 
2469       qq|<td align=right>| .
 
2470       $form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) .
 
2472     map { print "$column_data{$_}\n" } @column_index;
 
2485   <td><hr size=3 noshade></td>
 
2490 <form method=post action=$form->{script}>
 
2492 <input name=callback type=hidden value="$form->{callback}">
 
2494 <input type=hidden name=type value=payment>
 
2496 <input type=hidden name=path value=$form->{path}>
 
2497 <input type=hidden name=login value=$form->{login}>
 
2498 <input type=hidden name=password value=$form->{password}>
 
2500 <input class=submit type=submit name=action value="|
 
2501     . $locale->text('Add') . qq|">
 
2509   $lxdebug->leave_sub();
 
2512 sub payment_header {
 
2513   $lxdebug->enter_sub();
 
2515   $form->{title}    = $locale->text("$form->{title} Payment Terms");
 
2517   # $locale->text('Add Payment Terms')
 
2518   # $locale->text('Edit Payment Terms')
 
2520   $form->{description} =~ s/\"/"/g;
 
2529 <form method=post action=$form->{script}>
 
2531 <input type=hidden name=id value=$form->{id}>
 
2532 <input type=hidden name=type value=payment>
 
2536     <th class=listtop colspan=2>$form->{title}</th>
 
2538   <tr height="5"></tr>
 
2540     <th align=right>| . $locale->text('Description') . qq|</th>
 
2541     <td><input name=description size=30 value="$form->{description}"></td>
 
2544     <th align=right>| . $locale->text('Long Description') . qq|</th>
 
2545     <td><input name=description_long size=50 value="$form->{description_long}"></td>
 
2549   foreach my $language (@{ $form->{"TRANSLATION"} }) {
 
2552     <th align="right">| .
 
2553     sprintf($locale->text('Translation (%s)'),
 
2554             $language->{"language"})
 
2556     <td><input name="description_long_$language->{language_id}" size="50"
 
2557          value="| . Q($language->{"description_long"}) . qq|"></td>
 
2564     <th align=right>| . $locale->text('Netto Terms') . qq|</th>
 
2565     <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
 
2568     <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
 
2569     <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
 
2572     <th align=right>| . $locale->text('Skonto') . qq| %</th>
 
2573     <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
 
2575   <td colspan=2><hr size=3 noshade></td>
 
2579 <p>| . $locale->text("You can use the following strings in the long " .
 
2580                      "description and all translations. They will be " .
 
2581                      "replaced by their actual values by Lx-Office " .
 
2582                      "before they're output.")
 
2586   <li>| . $locale->text("<%netto_date%> -- Date the payment is due in " .
 
2589   <li>| . $locale->text("<%skonto_date%> -- Date the payment is due " .
 
2592   <li>| . $locale->text("<%skonto_amount%> -- The deductible amount")
 
2594   <li>| . $locale->text("<%total%> -- Amount payable")
 
2596   <li>| . $locale->text("<%invtotal%> -- Invoice total")
 
2598   <li>| . $locale->text("<%currency%> -- The selected currency")
 
2600   <li>| . $locale->text("<%terms_netto%> -- The number of days for " .
 
2603   <li>| . $locale->text("<%account_number%> -- Your account number")
 
2605   <li>| . $locale->text("<%bank%> -- Your bank")
 
2607   <li>| . $locale->text("<%bank_code%> -- Your bank code")
 
2611   $lxdebug->leave_sub();
 
2615   $lxdebug->enter_sub();
 
2617   $form->isblank("description", $locale->text('Description missing!'));
 
2618   $form->{"percent_skonto"} =
 
2619     $form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100;
 
2620   AM->save_payment(\%myconfig, \%$form);
 
2621   $form->redirect($locale->text('Payment Terms saved!'));
 
2623   $lxdebug->leave_sub();
 
2626 sub delete_payment {
 
2627   $lxdebug->enter_sub();
 
2629   AM->delete_payment(\%myconfig, \%$form);
 
2630   $form->redirect($locale->text('Payment terms deleted!'));
 
2632   $lxdebug->leave_sub();
 
2635 sub swap_payment_terms {
 
2636   $lxdebug->enter_sub();
 
2638   AM->swap_sortkeys(\%myconfig, $form, "payment_terms");
 
2641   $lxdebug->leave_sub();
 
2645   $lxdebug->enter_sub();
 
2647   $form->{title} = "Add";
 
2650     "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
2651     unless $form->{callback};
 
2656   $lxdebug->leave_sub();
 
2660   $lxdebug->enter_sub();
 
2662   $form->{title} = "Edit";
 
2664   AM->get_sic(\%myconfig, \%$form);
 
2668   $form->{orphaned} = 1;
 
2671   $lxdebug->leave_sub();
 
2675   $lxdebug->enter_sub();
 
2677   AM->sic(\%myconfig, \%$form);
 
2680     "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
2682   $callback = $form->escape($form->{callback});
 
2684   $form->{title} = $locale->text('Standard Industrial Codes');
 
2686   @column_index = qw(code description);
 
2688   $column_header{code} =
 
2689     qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
 
2690   $column_header{description} =
 
2691     qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
 
2700     <th class=listtop>$form->{title}</th>
 
2702   <tr height="5"></tr>
 
2706         <tr class=listheading>
 
2709   map { print "$column_header{$_}\n" } @column_index;
 
2715   foreach $ref (@{ $form->{ALL} }) {
 
2720     if ($ref->{sictype} eq 'H') {
 
2722         <tr valign=top class=listheading>
 
2724       $column_data{code} =
 
2725         qq|<th><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}</th>|;
 
2726       $column_data{description} = qq|<th>$ref->{description}</th>|;
 
2730         <tr valign=top class=listrow$i>
 
2733       $column_data{code} =
 
2734         qq|<td><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}</td>|;
 
2735       $column_data{description} = qq|<td>$ref->{description}</td>|;
 
2739     map { print "$column_data{$_}\n" } @column_index;
 
2751   <td><hr size=3 noshade></td>
 
2756 <form method=post action=$form->{script}>
 
2758 <input name=callback type=hidden value="$form->{callback}">
 
2760 <input type=hidden name=type value=sic>
 
2762 <input type=hidden name=path value=$form->{path}>
 
2763 <input type=hidden name=login value=$form->{login}>
 
2764 <input type=hidden name=password value=$form->{password}>
 
2766 <input class=submit type=submit name=action value="|
 
2767     . $locale->text('Add') . qq|">
 
2775   $lxdebug->leave_sub();
 
2779   $lxdebug->enter_sub();
 
2781   $form->{title} = $locale->text("$form->{title} SIC");
 
2783   # $locale->text('Add SIC')
 
2784   # $locale->text('Edit SIC')
 
2786   $form->{code}        =~ s/\"/"/g;
 
2787   $form->{description} =~ s/\"/"/g;
 
2789   $checked = ($form->{sictype} eq 'H') ? "checked" : "";
 
2796 <form method=post action=$form->{script}>
 
2798 <input type=hidden name=type value=sic>
 
2799 <input type=hidden name=id value=$form->{code}>
 
2803     <th class=listtop colspan=2>$form->{title}</th>
 
2805   <tr height="5"></tr>
 
2807     <th align=right>| . $locale->text('Code') . qq|</th>
 
2808     <td><input name=code size=10 value=$form->{code}></td>
 
2812     <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
 
2813     . $locale->text('Heading') . qq|</th>
 
2816     <th align=right>| . $locale->text('Description') . qq|</th>
 
2817     <td><input name=description size=60 value="$form->{description}"></td>
 
2819     <td colspan=2><hr size=3 noshade></td>
 
2824   $lxdebug->leave_sub();
 
2828   $lxdebug->enter_sub();
 
2830   $form->isblank("code",        $locale->text('Code missing!'));
 
2831   $form->isblank("description", $locale->text('Description missing!'));
 
2832   AM->save_sic(\%myconfig, \%$form);
 
2833   $form->redirect($locale->text('SIC saved!'));
 
2835   $lxdebug->leave_sub();
 
2839   $lxdebug->enter_sub();
 
2841   AM->delete_sic(\%myconfig, \%$form);
 
2842   $form->redirect($locale->text('SIC deleted!'));
 
2844   $lxdebug->leave_sub();
 
2847 sub display_stylesheet {
 
2848   $lxdebug->enter_sub();
 
2850   $form->{file} = "css/$myconfig{stylesheet}";
 
2853   $lxdebug->leave_sub();
 
2857   $lxdebug->enter_sub();
 
2859   $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
 
2860   $form->{file} =~ s/^\/*//g;
 
2861   $form->{file} =~ s/$userspath//;
 
2863   $form->error("$!: $form->{file}") unless -f $form->{file};
 
2865   AM->load_template(\%$form);
 
2867   $form->{title} = $form->{file};
 
2869   # if it is anything but html
 
2870   if ($form->{file} !~ /\.html$/) {
 
2871     $form->{body} = "<pre>\n$form->{body}\n</pre>";
 
2881 <form method=post action=$form->{script}>
 
2883 <input name=file type=hidden value=$form->{file}>
 
2884 <input name=type type=hidden value=template>
 
2886 <input type=hidden name=path value=$form->{path}>
 
2887 <input type=hidden name=login value=$form->{login}>
 
2888 <input type=hidden name=password value=$form->{password}>
 
2890 <input name=action type=submit class=submit value="|
 
2891     . $locale->text('Edit') . qq|">
 
2899   $lxdebug->leave_sub();
 
2903   $lxdebug->enter_sub();
 
2905   AM->load_template(\%$form);
 
2907   $form->{title} = $locale->text('Edit Template');
 
2909   # convert   to &nbsp;
 
2910   $form->{body} =~ s/ /&nbsp;/gi;
 
2917 <form method=post action=$form->{script}>
 
2919 <input name=file type=hidden value=$form->{file}>
 
2920 <input name=type type=hidden value=template>
 
2922 <input type=hidden name=path value=$form->{path}>
 
2923 <input type=hidden name=login value=$form->{login}>
 
2924 <input type=hidden name=password value=$form->{password}>
 
2926 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
 
2928 <textarea name=body rows=25 cols=70>
 
2933 <input type=submit class=submit name=action value="|
 
2934     . $locale->text('Save') . qq|">
 
2943   $lxdebug->leave_sub();
 
2947   $lxdebug->enter_sub();
 
2949   AM->save_template(\%$form);
 
2950   $form->redirect($locale->text('Template saved!'));
 
2952   $lxdebug->leave_sub();
 
2956   $lxdebug->enter_sub();
 
2958   # get defaults for account numbers and last numbers
 
2959   AM->defaultaccounts(\%myconfig, \%$form);
 
2961   foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
 
2963       ($item eq $myconfig{dateformat})
 
2964       ? "<option selected>$item\n"
 
2965       : "<option>$item\n";
 
2968   foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
 
2970       ($item eq $myconfig{numberformat})
 
2971       ? "<option selected>$item\n"
 
2972       : "<option>$item\n";
 
2975   foreach $item (qw(name company address signature)) {
 
2976     $myconfig{$item} =~ s/\"/"/g;
 
2979   foreach $item (qw(address signature)) {
 
2980     $myconfig{$item} =~ s/\\n/\r\n/g;
 
2984   if ($opendocument_templates && $openofficeorg_writer_bin &&
 
2985       $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
 
2986     push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
 
2987                      "value" => "opendocument_pdf" });
 
2989   if ($latex_templates) {
 
2990     push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
 
2992   push(@formats, { "name" => "HTML", "value" => "html" });
 
2993   if ($latex_templates) {
 
2994     push(@formats, { "name" => $locale->text("Postscript"),
 
2995                      "value" => "postscript" });
 
2997   if ($opendocument_templates) {
 
2998     push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
 
2999                      "value" => "opendocument" });
 
3002   if (!$myconfig{"template_format"}) {
 
3003     $myconfig{"template_format"} = "pdf";
 
3005   my $template_format = "";
 
3006   foreach $item (@formats) {
 
3008       "<option value=\"$item->{value}\"" .
 
3009       ($item->{"value"} eq $myconfig{"template_format"} ?
 
3011        ">" . H($item->{"name"}) . "</option>";
 
3014   if (!$myconfig{"default_media"}) {
 
3015     $myconfig{"default_media"} = "screen";
 
3017   my %selected = ($myconfig{"default_media"} => "selected");
 
3018   my $default_media = qq|
 
3019   <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
 
3020   <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
 
3021   <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
 
3025   $selected{$myconfig{"default_printer_id"}} = "selected"
 
3026     if ($myconfig{"default_printer_id"});
 
3027   my $default_printer = qq|<option></option>|;
 
3028   AM->printer(\%myconfig, $form);
 
3029   foreach my $printer (@{$form->{"ALL"}}) {
 
3030     $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
 
3031       qq|" $selected{$printer->{'id'}}>| .
 
3032       H($printer->{"printer_description"}) . qq|</option>|;
 
3035   %countrycodes = User->country_codes;
 
3037   foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
 
3041       ($myconfig{countrycode} eq $key)
 
3042       ? "<option selected value=$key>$countrycodes{$key}\n"
 
3043       : "<option value=$key>$countrycodes{$key}\n";
 
3045   $countrycodes = "<option>American English\n$countrycodes";
 
3047   foreach $key (keys %{ $form->{IC} }) {
 
3048     foreach $accno (sort keys %{ $form->{IC}{$key} }) {
 
3050         ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
 
3051         ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
 
3052         : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
 
3056   opendir CSS, "css/.";
 
3057   @all = grep /.*\.css$/, readdir CSS;
 
3060   foreach $item (@all) {
 
3061     if ($item eq $myconfig{stylesheet}) {
 
3062       $selectstylesheet .= qq|<option selected>$item\n|;
 
3064       $selectstylesheet .= qq|<option>$item\n|;
 
3067   $selectstylesheet .= "<option>\n";
 
3069   $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
 
3073   if ($myconfig{menustyle} eq "old") {
 
3074     $menustyle_old = "checked";
 
3075   } elsif ($myconfig{menustyle} eq "neu") {
 
3076     $menustyle_neu = "checked";
 
3077   } elsif ($myconfig{menustyle} eq "v3") {
 
3078     $menustyle_v3 = "checked";
 
3081   my ($show_form_details, $hide_form_details);
 
3082   $myconfig{"show_form_details"} = 1
 
3083     unless (defined($myconfig{"show_form_details"}));
 
3084   $show_form_details = "checked" if ($myconfig{"show_form_details"});
 
3085   $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
 
3090 <form method=post action=$form->{script}>
 
3092 <input type=hidden name=old_password value=$myconfig{password}>
 
3093 <input type=hidden name=type value=preferences>
 
3094 <input type=hidden name=role value=$myconfig{role}>
 
3097   <tr><th class=listtop>$form->{title}</th></tr>
 
3102           <th align=right>| . $locale->text('Name') . qq|</th>
 
3103           <td><input name=name size=15 value="$myconfig{name}"></td>
 
3106           <th align=right>| . $locale->text('Password') . qq|</th>
 
3107           <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
 
3110           <th align=right>| . $locale->text('E-mail') . qq|</th>
 
3111           <td><input name=email size=30 value="$myconfig{email}"></td>
 
3114           <th align=right>| . $locale->text('Signature') . qq|</th>
 
3115           <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
 
3118           <th align=right>| . $locale->text('Phone') . qq|</th>
 
3119           <td><input name=tel size=14 value="$myconfig{tel}"></td>
 
3122           <th align=right>| . $locale->text('Fax') . qq|</th>
 
3123           <td><input name=fax size=14 value="$myconfig{fax}"></td>
 
3126           <th align=right>| . $locale->text('Company') . qq|</th>
 
3127           <td><input name=company size=30 value="$myconfig{company}"></td>
 
3130           <th align=right>| . $locale->text('Address') . qq|</th>
 
3131           <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
 
3134           <th align=right>| . $locale->text('Date Format') . qq|</th>
 
3135           <td><select name=dateformat>$dateformat</select></td>
 
3138           <th align=right>| . $locale->text('Output Number Format') . qq|</th>
 
3139           <td><select name=numberformat>$numberformat</select></td>
 
3143           <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
 
3144           <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
 
3147           <th align=right>| . $locale->text('Language') . qq|</th>
 
3148           <td><select name=countrycode>$countrycodes</select></td>
 
3151           <th align=right>| . $locale->text('Stylesheet') . qq|</th>
 
3152           <td><select name=usestylesheet>$selectstylesheet</select></td>
 
3155           <th align=right>| . $locale->text('Setup Menu') . qq|</th>
 
3156           <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
 
3157     $locale->text("Top (CSS)") . qq|
 
3158           <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
 
3159     $locale->text("Top (Javascript)") . qq|
 
3160     <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
 
3161     $locale->text("Old (on the side)") . qq|</td>
 
3164     <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
 
3165     <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details> 
 
3166     <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
 
3167     <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details> 
 
3168     <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
 
3170         <input name=printer type=hidden value="$myconfig{printer}">
 
3171         <tr class=listheading>
 
3172           <th colspan=2>| . $locale->text("Print options") . qq|</th>
 
3175           <th align=right>| . $locale->text('Default template format') . qq|</th>
 
3176           <td><select name="template_format">$template_format</select></td>
 
3179           <th align=right>| . $locale->text('Default output medium') . qq|</th>
 
3180           <td><select name="default_media">$default_media</select></td>
 
3183           <th align=right>| . $locale->text('Default printer') . qq|</th>
 
3184           <td><select name="default_printer_id">$default_printer</select></td>
 
3187           <th align=right>| . $locale->text('Number of copies') . qq|</th>
 
3188           <td><input name="copies" size="10" value="| .
 
3189     $form->quote($myconfig{"copies"}) . qq|"></td>
 
3193         <tr class=listheading>
 
3194           <th colspan=2> </th>
 
3197           <th align=right>| . $locale->text('Business Number') . qq|</th>
 
3198           <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
 
3201                 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
 
3202                 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
 
3204         <tr class=listheading>
 
3206     . $locale->text('Last Numbers & Default Accounts') . qq|</th>
 
3212                 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
 
3213                 <td><select name=inventory_accno>$myconfig{IC}</select></td>
 
3216                 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
 
3217                 <td><select name=income_accno>$myconfig{IC_income}</select></td>
 
3220                 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
 
3221                 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
 
3224                 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
 
3225                 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
 
3228                 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
 
3229                 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
 
3234     'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
 
3236     . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
 
3245                 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
 
3246                 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
 
3247                 <th align=right nowrap>|
 
3248     . $locale->text('Last Customer Number') . qq|</th>
 
3249                 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
 
3252                 <th align=right nowrap>|
 
3253     . $locale->text('Last Credit Note Number') . qq|</th>
 
3254                 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
 
3255                 <th align=right nowrap>|
 
3256     . $locale->text('Last Vendor Number') . qq|</th>
 
3257                 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
 
3260                 <th align=right nowrap>|
 
3261     . $locale->text('Last Sales Order Number') . qq|</th>
 
3262                 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
 
3265                 <th align=right nowrap>|
 
3266     . $locale->text('Last Purchase Order Number') . qq|</th>
 
3267                 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
 
3268                 <th align=right nowrap>|
 
3269     . $locale->text('Last Article Number') . qq|</th>
 
3270                 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
 
3273                 <th align=right nowrap>|
 
3274     . $locale->text('Last Sales Quotation Number') . qq|</th>
 
3275                 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
 
3276                 <th align=right nowrap>|
 
3277     . $locale->text('Last Service Number') . qq|</th>
 
3278                 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
 
3281                 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
 
3282                 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
 
3283                 <th align=right nowrap></th>
 
3289 #       <tr class=listheading>
 
3290 #         <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
 
3297 #               <th>| . $locale->text('Rate') . qq| (%)</th>
 
3298 #               <th>| . $locale->text('Number') . qq|</th>
 
3302 #   foreach $accno (sort keys %{ $form->{taxrates} }) {
 
3305 #               <th align=right>$form->{taxrates}{$accno}{description}</th>
 
3306 #               <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
 
3307 #               <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
 
3310 #     $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
 
3313 #   chop $form->{taxaccounts};
 
3316 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
 
3325     <td><hr size=3 noshade></td>
 
3329 <input type=hidden name=path value=$form->{path}>
 
3330 <input type=hidden name=login value=$form->{login}>
 
3331 <input type=hidden name=password value=$form->{password}>
 
3334 <input type=submit class=submit name=action value="|
 
3335     . $locale->text('Save') . qq|">
 
3343   $lxdebug->leave_sub();
 
3346 sub save_preferences {
 
3347   $lxdebug->enter_sub();
 
3349   $form->{stylesheet} = $form->{usestylesheet};
 
3351   $form->redirect($locale->text('Preferences saved!'))
 
3353      AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
 
3355   $form->error($locale->text('Cannot save preferences!'));
 
3357   $lxdebug->leave_sub();
 
3361   $lxdebug->enter_sub();
 
3363   if ($form->{media} eq 'email') {
 
3364     $form->error($locale->text('No email address for') . " $myconfig{name}")
 
3365       unless ($myconfig{email});
 
3367     $form->{OUT} = "$sendmail";
 
3371   AM->backup(\%myconfig, \%$form, $userspath);
 
3373   if ($form->{media} eq 'email') {
 
3374     $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
 
3377   $lxdebug->leave_sub();
 
3381   $lxdebug->enter_sub();
 
3383   $form->{title} = $locale->text('Audit Control');
 
3385   AM->closedto(\%myconfig, \%$form);
 
3387   if ($form->{revtrans}) {
 
3388     $checked{Y} = "checked";
 
3390     $checked{N} = "checked";
 
3398 <form method=post action=$form->{script}>
 
3400 <input type=hidden name=path value=$form->{path}>
 
3401 <input type=hidden name=login value=$form->{login}>
 
3402 <input type=hidden name=password value=$form->{password}>
 
3405   <tr><th class=listtop>$form->{title}</th></tr>
 
3406   <tr height="5"></tr>
 
3412     . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
 
3413           <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
 
3414     . $locale->text('Yes')
 
3415     . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
 
3416     . $locale->text('No')
 
3420           <th>| . $locale->text('Close Books up to') . qq|</th>
 
3421           <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
 
3431 <input type=hidden name=nextsub value=doclose>
 
3433 <input type=submit class=submit name=action value="|
 
3434     . $locale->text('Continue') . qq|">
 
3442   $lxdebug->leave_sub();
 
3446   $lxdebug->enter_sub();
 
3448   AM->closebooks(\%myconfig, \%$form);
 
3450   if ($form->{revtrans}) {
 
3452                  $locale->text('Transaction reversal enforced for all dates'));
 
3454     if ($form->{closedto}) {
 
3456                      $locale->text('Transaction reversal enforced up to') . " "
 
3457                        . $locale->date(\%myconfig, $form->{closedto}, 1));
 
3459       $form->redirect($locale->text('Books are open'));
 
3463   $lxdebug->leave_sub();
 
3467   $lxdebug->enter_sub();
 
3469   $form->{title} = "Add";
 
3472     "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
3473     unless $form->{callback};
 
3478   $lxdebug->leave_sub();
 
3481 sub edit_warehouse {
 
3482   $lxdebug->enter_sub();
 
3484   $form->{title} = "Edit";
 
3486   AM->get_warehouse(\%myconfig, \%$form);
 
3491   $lxdebug->leave_sub();
 
3494 sub list_warehouse {
 
3495   $lxdebug->enter_sub();
 
3497   AM->warehouses(\%myconfig, \%$form);
 
3500     "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
3502   $callback = $form->escape($form->{callback});
 
3504   $form->{title} = $locale->text('Warehouses');
 
3506   @column_index = qw(description);
 
3508   $column_header{description} =
 
3509       qq|<th class=listheading width=100%>|
 
3510     . $locale->text('Description')
 
3520     <th class=listtop>$form->{title}</th>
 
3522   <tr height="5"></tr>
 
3526         <tr class=listheading>
 
3529   map { print "$column_header{$_}\n" } @column_index;
 
3535   foreach $ref (@{ $form->{ALL} }) {
 
3541         <tr valign=top class=listrow$i>
 
3544     $column_data{description} =
 
3545       qq|<td><a href=$form->{script}?action=edit_warehouse&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
 
3547     map { print "$column_data{$_}\n" } @column_index;
 
3559   <td><hr size=3 noshade></td>
 
3564 <form method=post action=$form->{script}>
 
3566 <input name=callback type=hidden value="$form->{callback}">
 
3568 <input type=hidden name=type value=warehouse>
 
3570 <input type=hidden name=path value=$form->{path}>
 
3571 <input type=hidden name=login value=$form->{login}>
 
3572 <input type=hidden name=password value=$form->{password}>
 
3574 <input class=submit type=submit name=action value="|
 
3575     . $locale->text('Add') . qq|">
 
3583   $lxdebug->leave_sub();
 
3586 sub warehouse_header {
 
3587   $lxdebug->enter_sub();
 
3589   $form->{title} = $locale->text("$form->{title} Warehouse");
 
3591   # $locale->text('Add Warehouse')
 
3592   # $locale->text('Edit Warehouse')
 
3594   $form->{description} =~ s/\"/"/g;
 
3596   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
 
3598       qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
 
3601       qq|<input name=description size=60 value="$form->{description}">|;
 
3609 <form method=post action=$form->{script}>
 
3611 <input type=hidden name=id value=$form->{id}>
 
3612 <input type=hidden name=type value=warehouse>
 
3616     <th class=listtop colspan=2>$form->{title}</th>
 
3618   <tr height="5"></tr>
 
3620     <th align=right>| . $locale->text('Description') . qq|</th>
 
3621     <td>$description</td>
 
3624     <td colspan=2><hr size=3 noshade></td>
 
3629   $lxdebug->leave_sub();
 
3632 sub save_warehouse {
 
3633   $lxdebug->enter_sub();
 
3635   $form->isblank("description", $locale->text('Description missing!'));
 
3636   AM->save_warehouse(\%myconfig, \%$form);
 
3637   $form->redirect($locale->text('Warehouse saved!'));
 
3639   $lxdebug->leave_sub();
 
3642 sub delete_warehouse {
 
3643   $lxdebug->enter_sub();
 
3645   AM->delete_warehouse(\%myconfig, \%$form);
 
3646   $form->redirect($locale->text('Warehouse deleted!'));
 
3648   $lxdebug->leave_sub();
 
3652   $lxdebug->enter_sub();
 
3654   &{ $form->{nextsub} };
 
3656   $lxdebug->leave_sub();
 
3660   $lxdebug->enter_sub();
 
3662   $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
 
3663   AM->units_in_use(\%myconfig, $form, $units);
 
3664   map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
 
3666   @languages = AM->language(\%myconfig, $form, 1);
 
3669   foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
 
3670     map({ push(@unit_list, $units->{$_}); }
 
3671         sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
 
3672              grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
 
3675   foreach (@unit_list) {
 
3676     $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"});
 
3677     $_->{"UNITLANGUAGES"} = [];
 
3678     foreach my $lang (@languages) {
 
3679       push(@{ $_->{"UNITLANGUAGES"} },
 
3681              "unit" => $_->{"name"},
 
3682              "language_id" => $lang->{"id"},
 
3683              "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
 
3684              "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
 
3690   $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
 
3691   $ddbox = AM->unit_select_data($units, undef, 1);
 
3693   $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
 
3695   print($form->parse_html_template("am/edit_units",
 
3696                                    { "UNITS" => \@unit_list,
 
3697                                      "NEW_BASE_UNIT_DDBOX" => $ddbox,
 
3698                                      "LANGUAGES" => \@languages }));
 
3700   $lxdebug->leave_sub();
 
3704   $lxdebug->enter_sub();
 
3706   $form->isblank("new_name", $locale->text("The name is missing."));
 
3707   $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
 
3708   $all_units = AM->retrieve_units(\%myconfig, $form);
 
3709   $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
 
3711   my ($base_unit, $factor);
 
3712   if ($form->{"new_base_unit"}) {
 
3713     $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
 
3715     $form->isblank("new_factor", $locale->text("The factor is missing."));
 
3716     $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
 
3717     $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
 
3718     $base_unit = $form->{"new_base_unit"};
 
3722   foreach my $lang (AM->language(\%myconfig, $form, 1)) {
 
3723     next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
 
3724     push(@languages, { "id" => $lang->{"id"},
 
3725                        "localized" => $form->{"new_localized_$lang->{id}"},
 
3726                        "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
 
3730   AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
 
3732   $form->{"saved_message"} = $locale->text("The unit has been saved.");
 
3736   $lxdebug->leave_sub();
 
3739 sub set_unit_languages {
 
3740   $lxdebug->enter_sub();
 
3742   my ($unit, $languages, $idx) = @_;
 
3744   $unit->{"LANGUAGES"} = [];
 
3746   foreach my $lang (@{$languages}) {
 
3747     push(@{ $unit->{"LANGUAGES"} },
 
3748          { "id" => $lang->{"id"},
 
3749            "localized" => $form->{"localized_${idx}_$lang->{id}"},
 
3750            "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
 
3754   $lxdebug->leave_sub();
 
3758   $lxdebug->enter_sub();
 
3760   $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
 
3761   AM->units_in_use(\%myconfig, $form, $old_units);
 
3763   @languages = AM->language(\%myconfig, $form, 1);
 
3767   foreach $i (1..($form->{"rowcount"} * 1)) {
 
3768     $old_unit = $old_units->{$form->{"old_name_$i"}};
 
3770       $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
 
3773     if ($form->{"unchangeable_$i"}) {
 
3774       $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
 
3775       $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
 
3776       set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
 
3780     if ($old_unit->{"in_use"}) {
 
3781       $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
 
3784     if ($form->{"delete_$i"}) {
 
3785       push(@delete_units, $old_unit->{"name"});
 
3789     $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
 
3791     $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
 
3792     my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
 
3793     $new_units->{$form->{"name_$i"}} = \%h;
 
3794     $new_units->{$form->{"name_$i"}}->{"row"} = $i;
 
3795     set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
 
3798   foreach $unit (values(%{$new_units})) {
 
3799     next unless ($unit->{"old_name"});
 
3800     if ($unit->{"base_unit"}) {
 
3801       $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"}))
 
3802         unless (defined($new_units->{$unit->{"base_unit"}}));
 
3803       $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
 
3804       $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
 
3806       $unit->{"base_unit"} = undef;
 
3807       $unit->{"factor"} = undef;
 
3811   foreach $unit (values(%{$new_units})) {
 
3812     next if ($unit->{"unchanged_unit"});
 
3814     map({ $_->{"seen"} = 0; } values(%{$new_units}));
 
3816     while ($new_unit->{"base_unit"}) {
 
3817       $new_unit->{"seen"} = 1;
 
3818       $new_unit = $new_units->{$new_unit->{"base_unit"}};
 
3819       if ($new_unit->{"seen"}) {
 
3820         $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, " .
 
3821                                                         "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
 
3826   AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
 
3828   $form->{"saved_message"} = $locale->text("The units have been saved.");
 
3832   $lxdebug->leave_sub();