1 #=====================================================================
 
   4 # Based on SQL-Ledger Version 2.1.9
 
   5 # Web http://www.lx-office.org
 
   7 #=====================================================================
 
   8 # SQL-Ledger Accounting
 
   9 # Copyright (c) 1998-2002
 
  11 #  Author: Dieter Simader
 
  12 #   Email: dsimader@sql-ledger.org
 
  13 #     Web: http://www.sql-ledger.org
 
  16 # This program is free software; you can redistribute it and/or modify
 
  17 # it under the terms of the GNU General Public License as published by
 
  18 # the Free Software Foundation; either version 2 of the License, or
 
  19 # (at your option) any later version.
 
  21 # This program is distributed in the hope that it will be useful,
 
  22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  24 # GNU General Public License for more details.
 
  25 # You should have received a copy of the GNU General Public License
 
  26 # along with this program; if not, write to the Free Software
 
  27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
  28 #======================================================================
 
  32 #======================================================================
 
  43 require "$form->{path}/common.pl";
 
  47 sub add    { &{"add_$form->{type}"} }
 
  48 sub edit   { &{"edit_$form->{type}"} }
 
  49 sub save   { &{"save_$form->{type}"} }
 
  50 sub delete { &{"delete_$form->{type}"} }
 
  53   $lxdebug->enter_sub();
 
  55   $form->{title}     = "Add";
 
  56   $form->{charttype} = "A";
 
  57   AM->get_account(\%myconfig, \%$form);
 
  60     "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
  61     unless $form->{callback};
 
  66   $lxdebug->leave_sub();
 
  70   $lxdebug->enter_sub();
 
  72   $form->{title} = "Edit";
 
  73   AM->get_account(\%myconfig, \%$form);
 
  75   foreach my $item (split(/:/, $form->{link})) {
 
  76     $form->{$item} = "checked";
 
  82   $lxdebug->leave_sub();
 
  86   $lxdebug->enter_sub();
 
  88   $form->{title} = $locale->text("$form->{title} Account");
 
  90   $checked{ $form->{charttype} } = "checked";
 
  91   $checked{"$form->{category}_"} = "checked";
 
  92   $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
 
  94   $form->{description} =~ s/\"/"/g;
 
  96   if (@{ $form->{TAXKEY} }) {
 
  97     foreach $item (@{ $form->{TAXKEY} }) {
 
  98       if ($item->{tax} == $form->{tax}) {
 
  99         $form->{selecttaxkey} .=
 
 100           "<option value=$item->{tax} selected>$item->{taxdescription}\n";
 
 102         $form->{selecttaxkey} .=
 
 103           "<option value=$item->{tax}>$item->{taxdescription}\n";
 
 111                 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
 
 112                 <td><select name=tax>$form->{selecttaxkey}</select></td>
 
 113                 <th align=right>| . $locale->text('Gültig ab') . qq|</th>
 
 114                 <td><input name=startdate value="$form->{startdate}"></td>
 
 117   if (@{ $form->{NEWACCOUNT} }) {
 
 118     if (!$form->{new_chart_valid}) {
 
 119       $form->{selectnewaccount} = "<option value=></option>";
 
 121     foreach $item (@{ $form->{NEWACCOUNT} }) {
 
 122       if ($item->{id} == $form->{new_chart_id}) {
 
 123         $form->{selectnewaccount} .=
 
 124           "<option value=$item->{id} selected>$item->{accno}--$item->{description}</option>";
 
 125       } elsif (!$form->{new_chart_valid}) {
 
 126         $form->{selectnewaccount} .=
 
 127           "<option value=$item->{id}>$item->{accno}--$item->{description}</option>";
 
 138                       <th align=right>| . $locale->text('Folgekonto') . qq|</th>
 
 139                       <td><select name=new_chart_id>$form->{selectnewaccount}</select></td>
 
 140                       <th align=right>| . $locale->text('Gültig ab') . qq|</th>
 
 141                       <td><input name=valid_from value="$form->{valid_from}"></td>
 
 147   $form->{selectustva} = "<option>\n";
 
 149   %ustva = (35  => $locale->text('UStVA-Nr. 35'),
 
 150             36  => $locale->text('UStVA-Nr. 36'),
 
 151             39  => $locale->text('UStVA-Nr. 39'),
 
 152             41  => $locale->text('UStVA-Nr. 41'),
 
 153             42  => $locale->text('UStVA-Nr. 42'),
 
 154             43  => $locale->text('UStVA-Nr. 43'),
 
 155             44  => $locale->text('UStVA-Nr. 44'),
 
 156             45  => $locale->text('UStVA-Nr. 45'),
 
 157             48  => $locale->text('UStVA-Nr. 48'),
 
 158             49  => $locale->text('UStVA-Nr. 49'),
 
 159             51  => $locale->text('UStVA-Nr. 51 left'),
 
 160             511 => $locale->text('UStVA-Nr. 51 right'),
 
 161             52  => $locale->text('UStVA-Nr. 52'),
 
 162             53  => $locale->text('UStVA-Nr. 53'),
 
 163             59  => $locale->text('UStVA-Nr. 59'),
 
 164             60  => $locale->text('UStVA-Nr. 60'),
 
 165             61  => $locale->text('UStVA-Nr. 61'),
 
 166             62  => $locale->text('UStVA-Nr. 62'),
 
 167             63  => $locale->text('UStVA-Nr. 63'),
 
 168             64  => $locale->text('UStVA-Nr. 64'),
 
 169             65  => $locale->text('UStVA-Nr. 65'),
 
 170             66  => $locale->text('UStVA-Nr. 66'),
 
 171             67  => $locale->text('UStVA-Nr. 67'),
 
 172             69  => $locale->text('UStVA-Nr. 69'),
 
 173             73  => $locale->text('UStVA-Nr. 73'),
 
 174             74  => $locale->text('UStVA-Nr. 74'),
 
 175             76  => $locale->text('UStVA-Nr. 76'),
 
 176             77  => $locale->text('UStVA-Nr. 77'),
 
 177             80  => $locale->text('UStVA-Nr. 80'),
 
 178             84  => $locale->text('UStVA-Nr. 84'),
 
 179             85  => $locale->text('UStVA-Nr. 85'),
 
 180             86  => $locale->text('UStVA-Nr. 86 left'),
 
 181             861 => $locale->text('UStVA-Nr. 86 right'),
 
 182             91  => $locale->text('UStVA-Nr. 91'),
 
 183             93  => $locale->text('UStVA-Nr. 93 left'),
 
 184             931 => $locale->text('UStVA-Nr. 93 right'),
 
 185             94  => $locale->text('UStVA-Nr. 94'),
 
 186             95  => $locale->text('UStVA-Nr. 95'),
 
 187             96  => $locale->text('UStVA-Nr. 96'),
 
 188             97  => $locale->text('UStVA-Nr. 97 links'),
 
 189             971 => $locale->text('UStVA-Nr. 97 rechts'),
 
 190             98  => $locale->text('UStVA-Nr. 98'));
 
 192   foreach $item (sort({ $a cmp $b } keys %ustva)) {
 
 193     if ($item == $form->{pos_ustva}) {
 
 194       $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
 
 196       $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
 
 203                 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
 
 204                 <td><select name=pos_ustva>$form->{selectustva}</select></td>
 
 205                 <input type=hidden name=selectustva value="$form->{selectustva}">
 
 208   $form->{selecteur} = "<option>\n";
 
 209   %eur = (1  => "Umsatzerlöse",
 
 210           2  => "sonstige Erlöse",
 
 211           3  => "Privatanteile",
 
 213           5  => "Ausserordentliche Erträge",
 
 214           6  => "Vereinnahmte Umsatzst.",
 
 215           7  => "Umsatzsteuererstattungen",
 
 216           8  => "Wareneingänge",
 
 217           9  => "Löhne und Gehälter",
 
 218           10 => "Gesetzl. sozialer Aufw.",
 
 220           12 => "Gas, Strom, Wasser",
 
 221           13 => "Instandhaltung",
 
 222           14 => "Steuern, Versich., Beiträge",
 
 224           16 => "Kfz-Versicherungen",
 
 225           17 => "Sonst. Fahrtkosten",
 
 226           18 => "Werbe- und Reisekosten",
 
 227           19 => "Instandhaltung u. Werkzeuge",
 
 228           20 => "Fachzeitschriften, Bücher",
 
 229           21 => "Miete für Einrichtungen",
 
 230           22 => "Rechts- und Beratungskosten",
 
 231           23 => "Bürobedarf, Porto, Telefon",
 
 232           24 => "Sonstige Aufwendungen",
 
 233           25 => "Abschreibungen auf Anlagever.",
 
 234           26 => "Abschreibungen auf GWG",
 
 236           28 => "Umsatzsteuerzahlungen",
 
 238           30 => "Ausserordentlicher Aufwand",
 
 239           31 => "Betriebliche Steuern");
 
 240   foreach $item (sort({ $a <=> $b } keys(%eur))) {
 
 241     if ($item == $form->{pos_eur}) {
 
 242       $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
 
 244       $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
 
 251                 <th align=right>| . $locale->text('EUER') . qq|</th>
 
 252                 <td><select name=pos_eur>$form->{selecteur}</select></td>
 
 253                 <input type=hidden name=selecteur value="$form->{selecteur}">
 
 256   $form->{selectbwa} = "<option>\n";
 
 258   %bwapos = (1  => 'Umsatzerlöse',
 
 259              2  => 'Best.Verdg.FE/UE',
 
 260              3  => 'Aktiv.Eigenleistung',
 
 261              4  => 'Mat./Wareneinkauf',
 
 262              5  => 'So.betr.Erlöse',
 
 263              10 => 'Personalkosten',
 
 265              12 => 'Betriebl.Steuern',
 
 266              13 => 'Vers./Beiträge',
 
 267              14 => 'Kfz.Kosten o.St.',
 
 268              15 => 'Werbe-Reisek.',
 
 269              16 => 'Kosten Warenabgabe',
 
 270              17 => 'Abschreibungen',
 
 271              18 => 'Rep./instandhlt.',
 
 272              19 => 'Übrige Steuern',
 
 273              20 => 'Sonst.Kosten',
 
 275              31 => 'Sonst.neutr.Aufw.',
 
 277              33 => 'Sonst.neutr.Ertrag',
 
 278              34 => 'Verr.kalk.Kosten',
 
 279              35 => 'Steuern Eink.u.Ertr.');
 
 280   foreach $item (sort({ $a <=> $b } keys %bwapos)) {
 
 281     if ($item == $form->{pos_bwa}) {
 
 282       $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
 
 284       $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
 
 291                 <th align=right>| . $locale->text('BWA') . qq|</th>
 
 292                 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
 
 293                 <input type=hidden name=selectbwa value="$form->{selectbwa}">
 
 296 # Entfernt bis es ordentlich umgesetzt wird (hli) 30.03.2006
 
 297 #  $form->{selectbilanz} = "<option>\n";
 
 298 #  foreach $item ((1, 2, 3, 4)) {
 
 299 #    if ($item == $form->{pos_bilanz}) {
 
 300 #      $form->{selectbilanz} .= "<option value=$item selected>$item\n";
 
 302 #      $form->{selectbilanz} .= "<option value=$item>$item\n";
 
 309 #               <th align=right>| . $locale->text('Bilanz') . qq|</th>
 
 310 #               <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
 
 311 #               <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
 
 314   # this is for our parser only!
 
 315   # type=submit $locale->text('Add Account')
 
 316   # type=submit $locale->text('Edit Account')
 
 317   $form->{type} = "account";
 
 324 <form method=post action=$form->{script}>
 
 326 <input type=hidden name=id value=$form->{id}>
 
 327 <input type=hidden name=type value=account>
 
 328 <input type=hidden name=orphaned value=$form->{orphaned}>
 
 329 <input type=hidden name=new_chart_valid value=$form->{new_chart_valid}>
 
 331 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
 
 332 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
 
 333 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
 
 334 <input type=hidden name=fxgain_accno_id value=$form->{fxgain_accno_id}>
 
 335 <input type=hidden name=fxloss_accno_id value=$form->{fxloss_accno_id}>
 
 337 <table border=0 width=100%>
 
 339     <th class=listtop>$form->{title}</th>
 
 346           <th align=right>| . $locale->text('Account Number') . qq|</th>
 
 347           <td><input name=accno size=20 value=$form->{accno}></td>
 
 350           <th align=right>| . $locale->text('Description') . qq|</th>
 
 351           <td><input name=description size=40 value="$form->{description}"></td>
 
 354           <th align=right>| . $locale->text('Account Type') . qq|</th>
 
 358                 <td><input name=category type=radio class=radio value=A $checked{A_}> |
 
 359     . $locale->text('Asset') . qq|\n<br>
 
 360                 <input name=category type=radio class=radio value=L $checked{L_}> |
 
 361     . $locale->text('Liability') . qq|\n<br>
 
 362                 <input name=category type=radio class=radio value=Q $checked{Q_}> |
 
 363     . $locale->text('Equity') . qq|\n<br>
 
 364                 <input name=category type=radio class=radio value=I $checked{I_}> |
 
 365     . $locale->text('Revenue') . qq|\n<br>
 
 366                 <input name=category type=radio class=radio value=E $checked{E_}> |
 
 367     . $locale->text('Expense') . qq|<br>
 
 368                 <input name=category type=radio class=radio value=C $checked{C_}> |
 
 369     . $locale->text('Costs') . qq|</td>
 
 370                 <td width=50> </td>
 
 372                 <input name=charttype type=radio class=radio value="H" $checked{H}> |
 
 373     . $locale->text('Heading') . qq|<br>
 
 374                 <input name=charttype type=radio class=radio value="A" $checked{A}> |
 
 375     . $locale->text('Account') . qq|</td>
 
 382   if ($form->{charttype} eq "A") {
 
 389       . $locale->text('Is this a summary account to record') . qq|</th>
 
 391                 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
 
 392       . $locale->text('AR')
 
 393       . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
 
 394       . $locale->text('AP')
 
 395       . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
 
 396       . $locale->text('Inventory')
 
 403           <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
 
 409                 <th align=left>| . $locale->text('Receivables') . qq|</th>
 
 410                 <th align=left>| . $locale->text('Payables') . qq|</th>
 
 411                 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
 
 412                 <th align=left>| . $locale->text('Service Items') . qq|</th>
 
 416                 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
 
 417       . $locale->text('Revenue') . qq|\n<br>
 
 418                 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
 
 419       . $locale->text('Receipt') . qq|\n<br>
 
 420                 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
 
 421       . $locale->text('Tax') . qq|
 
 424                 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
 
 425       . $locale->text('Expense/Asset') . qq|\n<br>
 
 426                 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
 
 427       . $locale->text('Payment') . qq|\n<br>
 
 428                 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
 
 429       . $locale->text('Tax') . qq|
 
 432                 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
 
 433       . $locale->text('Revenue') . qq|\n<br>
 
 434                 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
 
 435       . $locale->text('Expense') . qq|\n<br>
 
 436                 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
 
 437       . $locale->text('Tax') . qq|
 
 440                 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
 
 441       . $locale->text('Revenue') . qq|\n<br>
 
 442                 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
 
 443       . $locale->text('Expense') . qq|\n<br>
 
 444                 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
 
 445       . $locale->text('Tax') . qq|
 
 465     <td><hr size=3 noshade></td>
 
 470   $lxdebug->leave_sub();
 
 474   $lxdebug->enter_sub();
 
 478 <input name=callback type=hidden value="$form->{callback}">
 
 480 <input type=hidden name=path value=$form->{path}>
 
 481 <input type=hidden name=login value=$form->{login}>
 
 482 <input type=hidden name=password value=$form->{password}>
 
 485   if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
 
 487 <input type=submit class=submit name=action value="|
 
 488     . $locale->text('Save') . qq|">
 
 492   if ($form->{id} && $form->{orphaned}) {
 
 493     print qq|<input type=submit class=submit name=action value="|
 
 494       . $locale->text('Delete') . qq|">|;
 
 497   if ($form->{menubar}) {
 
 498     require "$form->{path}/menu.pl";
 
 509   $lxdebug->leave_sub();
 
 513   $lxdebug->enter_sub();
 
 515   $form->isblank("accno",    $locale->text('Account Number missing!'));
 
 516   $form->isblank("category", $locale->text('Account Type missing!'));
 
 518   $form->redirect($locale->text('Account saved!'))
 
 519     if (AM->save_account(\%myconfig, \%$form));
 
 520   $form->error($locale->text('Cannot save account!'));
 
 522   $lxdebug->leave_sub();
 
 526   $lxdebug->enter_sub();
 
 528   CA->all_accounts(\%myconfig, \%$form);
 
 530   $form->{title} = $locale->text('Chart of Accounts');
 
 534     "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 536   @column_index = qw(accno gifi_accno description debit credit link);
 
 538   $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
 
 539   $column_header{gifi_accno} =
 
 540     qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
 
 541   $column_header{description} =
 
 542     qq|<th>| . $locale->text('Description') . qq|</a></th>|;
 
 543   $column_header{debit}  = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
 
 544   $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
 
 545   $column_header{link}   = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
 
 548   $colspan = $#column_index + 1;
 
 555     <th class=listtop colspan=$colspan>$form->{title}</th>
 
 558   <tr class=listheading>
 
 561   map { print "$column_header{$_}\n" } @column_index;
 
 568   $callback = $form->escape($callback);
 
 570   foreach $ca (@{ $form->{CA} }) {
 
 572     $ca->{debit}  = " ";
 
 573     $ca->{credit} = " ";
 
 575     if ($ca->{amount} > 0) {
 
 577         $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
 
 579     if ($ca->{amount} < 0) {
 
 581         $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
 
 584     $ca->{link} =~ s/:/<br>/og;
 
 586     if ($ca->{charttype} eq "H") {
 
 587       print qq|<tr class=listheading>|;
 
 589       $column_data{accno} =
 
 590         qq|<th><a href=$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</a></th>|;
 
 591       $column_data{gifi_accno} =
 
 592         qq|<th><a href=$form->{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{gifi_accno}</a> </th>|;
 
 593       $column_data{description} = qq|<th>$ca->{description} </th>|;
 
 594       $column_data{debit}       = qq|<th> </th>|;
 
 595       $column_data{credit}      = qq| <th> </th>|;
 
 596       $column_data{link}        = qq|<th> </th>|;
 
 602 <tr valign=top class=listrow$i>|;
 
 603       $column_data{accno} =
 
 604         qq|<td><a href=$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{accno}</a></td>|;
 
 605       $column_data{gifi_accno} =
 
 606         qq|<td><a href=$form->{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ca->{gifi_accno}</a> </td>|;
 
 607       $column_data{description} = qq|<td>$ca->{description} </td>|;
 
 608       $column_data{debit}       = qq|<td align=right>$ca->{debit}</td>|;
 
 609       $column_data{credit}      = qq|<td align=right>$ca->{credit}</td>|;
 
 610       $column_data{link}        = qq|<td>$ca->{link} </td>|;
 
 614     map { print "$column_data{$_}\n" } @column_index;
 
 620   <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
 
 627   $lxdebug->leave_sub();
 
 631   $lxdebug->enter_sub();
 
 633   $form->{title} = $locale->text('Delete Account');
 
 636     qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
 
 638     if ($form->{id} == $form->{$id}) {
 
 639       $form->error($locale->text('Cannot delete default account!'));
 
 643   $form->redirect($locale->text('Account deleted!'))
 
 644     if (AM->delete_account(\%myconfig, \%$form));
 
 645   $form->error($locale->text('Cannot delete account!'));
 
 647   $lxdebug->leave_sub();
 
 651   $lxdebug->enter_sub();
 
 653   @{ $form->{fields} } = (accno, description);
 
 654   $form->{table}     = "gifi";
 
 655   $form->{sortorder} = "accno";
 
 657   AM->gifi_accounts(\%myconfig, \%$form);
 
 659   $form->{title} = $locale->text('GIFI');
 
 663     "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 665   @column_index = qw(accno description);
 
 667   $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
 
 668   $column_header{description} =
 
 669     qq|<th>| . $locale->text('Description') . qq|</a></th>|;
 
 672   $colspan = $#column_index + 1;
 
 679     <th class=listtop colspan=$colspan>$form->{title}</th>
 
 682   <tr class=listheading>
 
 685   map { print "$column_header{$_}\n" } @column_index;
 
 692   $callback = $form->escape($callback);
 
 694   foreach $ca (@{ $form->{ALL} }) {
 
 700 <tr valign=top class=listrow$i>|;
 
 702     $column_data{accno} =
 
 703       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>|;
 
 704     $column_data{description} = qq|<td>$ca->{description} </td>|;
 
 706     map { print "$column_data{$_}\n" } @column_index;
 
 713     <td colspan=$colspan><hr size=3 noshade></td>
 
 721   $lxdebug->leave_sub();
 
 725   $lxdebug->enter_sub();
 
 727   $form->{title} = "Add";
 
 731     "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 738   $lxdebug->leave_sub();
 
 742   $lxdebug->enter_sub();
 
 744   $form->{title} = "Edit";
 
 746   AM->get_gifi(\%myconfig, \%$form);
 
 751   $lxdebug->leave_sub();
 
 755   $lxdebug->enter_sub();
 
 757   $form->{title} = $locale->text("$form->{title} GIFI");
 
 759   # $locale->text('Add GIFI')
 
 760   # $locale->text('Edit GIFI')
 
 762   $form->{description} =~ s/\"/"/g;
 
 769 <form method=post action=$form->{script}>
 
 771 <input type=hidden name=id value=$form->{accno}>
 
 772 <input type=hidden name=type value=gifi>
 
 776     <th class=listtop>$form->{title}</th>
 
 783           <th align=right>| . $locale->text('GIFI') . qq|</th>
 
 784           <td><input name=accno size=20 value=$form->{accno}></td>
 
 787           <th align=right>| . $locale->text('Description') . qq|</th>
 
 788           <td><input name=description size=60 value="$form->{description}"></td>
 
 794     <td colspan=2><hr size=3 noshade></td>
 
 799   $lxdebug->leave_sub();
 
 803   $lxdebug->enter_sub();
 
 807 <input name=callback type=hidden value="$form->{callback}">
 
 809 <input type=hidden name=path value=$form->{path}>
 
 810 <input type=hidden name=login value=$form->{login}>
 
 811 <input type=hidden name=password value=$form->{password}>
 
 813 <br><input type=submit class=submit name=action value="|
 
 814     . $locale->text('Save') . qq|">|;
 
 818 <input type=submit class=submit name=action value="|
 
 819       . $locale->text('Copy to COA') . qq|">
 
 822     if ($form->{accno} && $form->{orphaned}) {
 
 823       print qq|<input type=submit class=submit name=action value="|
 
 824         . $locale->text('Delete') . qq|">|;
 
 828   if ($form->{menubar}) {
 
 829     require "$form->{path}/menu.pl";
 
 840   $lxdebug->leave_sub();
 
 844   $lxdebug->enter_sub();
 
 846   $form->isblank("accno", $locale->text('GIFI missing!'));
 
 847   AM->save_gifi(\%myconfig, \%$form);
 
 848   $form->redirect($locale->text('GIFI saved!'));
 
 850   $lxdebug->leave_sub();
 
 854   $lxdebug->enter_sub();
 
 856   $form->isblank("accno", $locale->text('GIFI missing!'));
 
 858   AM->save_gifi(\%myconfig, \%$form);
 
 861   $form->{gifi_accno} = $form->{accno};
 
 862   $form->{title}      = "Add";
 
 863   $form->{charttype}  = "A";
 
 868   $lxdebug->leave_sub();
 
 872   $lxdebug->enter_sub();
 
 874   AM->delete_gifi(\%myconfig, \%$form);
 
 875   $form->redirect($locale->text('GIFI deleted!'));
 
 877   $lxdebug->leave_sub();
 
 881   $lxdebug->enter_sub();
 
 883   $form->{title} = "Add";
 
 887     "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
 888     unless $form->{callback};
 
 893   $lxdebug->leave_sub();
 
 896 sub edit_department {
 
 897   $lxdebug->enter_sub();
 
 899   $form->{title} = "Edit";
 
 901   AM->get_department(\%myconfig, \%$form);
 
 906   $lxdebug->leave_sub();
 
 909 sub list_department {
 
 910   $lxdebug->enter_sub();
 
 912   AM->departments(\%myconfig, \%$form);
 
 915     "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 917   $callback = $form->escape($form->{callback});
 
 919   $form->{title} = $locale->text('Departments');
 
 921   @column_index = qw(description cost profit);
 
 923   $column_header{description} =
 
 924       qq|<th class=listheading width=90%>|
 
 925     . $locale->text('Description')
 
 927   $column_header{cost} =
 
 928       qq|<th class=listheading nowrap>|
 
 929     . $locale->text('Cost Center')
 
 931   $column_header{profit} =
 
 932       qq|<th class=listheading nowrap>|
 
 933     . $locale->text('Profit Center')
 
 943     <th class=listtop>$form->{title}</th>
 
 949         <tr class=listheading>
 
 952   map { print "$column_header{$_}\n" } @column_index;
 
 958   foreach $ref (@{ $form->{ALL} }) {
 
 964         <tr valign=top class=listrow$i>
 
 967     $costcenter   = ($ref->{role} eq "C") ? "X" : "";
 
 968     $profitcenter = ($ref->{role} eq "P") ? "X" : "";
 
 970     $column_data{description} =
 
 971       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>|;
 
 972     $column_data{cost}   = qq|<td align=center>$costcenter</td>|;
 
 973     $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
 
 975     map { print "$column_data{$_}\n" } @column_index;
 
 987   <td><hr size=3 noshade></td>
 
 992 <form method=post action=$form->{script}>
 
 994 <input name=callback type=hidden value="$form->{callback}">
 
 996 <input type=hidden name=type value=department>
 
 998 <input type=hidden name=path value=$form->{path}>
 
 999 <input type=hidden name=login value=$form->{login}>
 
1000 <input type=hidden name=password value=$form->{password}>
 
1002 <input class=submit type=submit name=action value="|
 
1003     . $locale->text('Add') . qq|">|;
 
1005   if ($form->{menubar}) {
 
1006     require "$form->{path}/menu.pl";
 
1017   $lxdebug->leave_sub();
 
1020 sub department_header {
 
1021   $lxdebug->enter_sub();
 
1023   $form->{title} = $locale->text("$form->{title} Department");
 
1025   # $locale->text('Add Department')
 
1026   # $locale->text('Edit Department')
 
1028   $form->{description} =~ s/\"/"/g;
 
1030   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
 
1032       qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
 
1035       qq|<input name=description size=60 value="$form->{description}">|;
 
1038   $costcenter   = "checked" if $form->{role} eq "C";
 
1039   $profitcenter = "checked" if $form->{role} eq "P";
 
1046 <form method=post action=$form->{script}>
 
1048 <input type=hidden name=id value=$form->{id}>
 
1049 <input type=hidden name=type value=department>
 
1053     <th class=listtop colspan=2>$form->{title}</th>
 
1055   <tr height="5"></tr>
 
1057     <th align=right>| . $locale->text('Description') . qq|</th>
 
1058     <td>$description</td>
 
1062     <td><input type=radio style=radio name=role value="C" $costcenter> |
 
1063     . $locale->text('Cost Center') . qq|
 
1064         <input type=radio style=radio name=role value="P" $profitcenter> |
 
1065     . $locale->text('Profit Center') . qq|
 
1068     <td colspan=2><hr size=3 noshade></td>
 
1073   $lxdebug->leave_sub();
 
1076 sub save_department {
 
1077   $lxdebug->enter_sub();
 
1079   $form->isblank("description", $locale->text('Description missing!'));
 
1080   AM->save_department(\%myconfig, \%$form);
 
1081   $form->redirect($locale->text('Department saved!'));
 
1083   $lxdebug->leave_sub();
 
1086 sub delete_department {
 
1087   $lxdebug->enter_sub();
 
1089   AM->delete_department(\%myconfig, \%$form);
 
1090   $form->redirect($locale->text('Department deleted!'));
 
1092   $lxdebug->leave_sub();
 
1096   $lxdebug->enter_sub();
 
1098   $form->{title} = "Add";
 
1101     "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1102     unless $form->{callback};
 
1107   $lxdebug->leave_sub();
 
1111   $lxdebug->enter_sub();
 
1113   $form->{title} = "Edit";
 
1115   AM->get_lead(\%myconfig, \%$form);
 
1119   $form->{orphaned} = 1;
 
1122   $lxdebug->leave_sub();
 
1126   $lxdebug->enter_sub();
 
1128   AM->lead(\%myconfig, \%$form);
 
1131     "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1133   $callback = $form->escape($form->{callback});
 
1135   $form->{title} = $locale->text('Lead');
 
1137   @column_index = qw(description cost profit);
 
1139   $column_header{description} =
 
1140       qq|<th class=listheading width=100%>|
 
1141     . $locale->text('Description')
 
1151     <th class=listtop>$form->{title}</th>
 
1153   <tr height="5"></tr>
 
1154   <tr class=listheading>
 
1157   map { print "$column_header{$_}\n" } @column_index;
 
1163   foreach $ref (@{ $form->{ALL} }) {
 
1169         <tr valign=top class=listrow$i>
 
1172         $lead = $ref->{lead};
 
1174     $column_data{description} =
 
1175       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>|;
 
1177     map { print "$column_data{$_}\n" } @column_index;
 
1186   <td><hr size=3 noshade></td>
 
1191 <form method=post action=$form->{script}>
 
1193 <input name=callback type=hidden value="$form->{callback}">
 
1195 <input type=hidden name=type value=lead>
 
1197 <input type=hidden name=path value=$form->{path}>
 
1198 <input type=hidden name=login value=$form->{login}>
 
1199 <input type=hidden name=password value=$form->{password}>
 
1201 <input class=submit type=submit name=action value="|
 
1202     . $locale->text('Add') . qq|">|;
 
1204   if ($form->{menubar}) {
 
1205     require "$form->{path}/menu.pl";
 
1216   $lxdebug->leave_sub();
 
1220   $lxdebug->enter_sub();
 
1222   $form->{title} = $locale->text("$form->{title} Lead");
 
1224   # $locale->text('Add Lead')
 
1225   # $locale->text('Edit Lead')
 
1227   $form->{description} =~ s/\"/"/g;
 
1230       qq|<input name=description size=50 value="$form->{lead}">|;
 
1237 <form method=post action=$form->{script}>
 
1239 <input type=hidden name=id value=$form->{id}>
 
1240 <input type=hidden name=type value=lead>
 
1244     <th class=listtop colspan=2>$form->{title}</th>
 
1246   <tr height="5"></tr>
 
1248     <th align=right>| . $locale->text('Description') . qq|</th>
 
1249     <td>$description</td>
 
1251     <td colspan=2><hr size=3 noshade></td>
 
1256   $lxdebug->leave_sub();
 
1260   $lxdebug->enter_sub();
 
1262   $form->isblank("description", $locale->text('Description missing!'));
 
1263   AM->save_lead(\%myconfig, \%$form);
 
1264   $form->redirect($locale->text('lead saved!'));
 
1266   $lxdebug->leave_sub();
 
1270   $lxdebug->enter_sub();
 
1272   AM->delete_lead(\%myconfig, \%$form);
 
1273   $form->redirect($locale->text('lead deleted!'));
 
1275   $lxdebug->leave_sub();
 
1279   $lxdebug->enter_sub();
 
1281   $form->{title} = "Add";
 
1284     "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1285     unless $form->{callback};
 
1290   $lxdebug->leave_sub();
 
1294   $lxdebug->enter_sub();
 
1296   $form->{title} = "Edit";
 
1298   AM->get_business(\%myconfig, \%$form);
 
1302   $form->{orphaned} = 1;
 
1305   $lxdebug->leave_sub();
 
1309   $lxdebug->enter_sub();
 
1311   AM->business(\%myconfig, \%$form);
 
1314     "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1316   $callback = $form->escape($form->{callback});
 
1318   $form->{title} = $locale->text('Type of Business');
 
1320   @column_index = qw(description discount customernumberinit);
 
1322   $column_header{description} =
 
1323       qq|<th class=listheading width=60%>|
 
1324     . $locale->text('Description')
 
1326   $column_header{discount} =
 
1327       qq|<th class=listheading width=10%>|
 
1328     . $locale->text('Discount')
 
1330   $column_header{customernumberinit} =
 
1331       qq|<th class=listheading>|
 
1332     . $locale->text('Customernumberinit')
 
1342     <th class=listtop>$form->{title}</th>
 
1344   <tr height="5"></tr>
 
1348         <tr class=listheading>
 
1351   map { print "$column_header{$_}\n" } @column_index;
 
1357   foreach $ref (@{ $form->{ALL} }) {
 
1363         <tr valign=top class=listrow$i>
 
1367       $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
 
1370       ? "<b>$ref->{description}</b>"
 
1371       : "$ref->{description}";
 
1372     $column_data{description} =
 
1373       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>|;
 
1374     $column_data{discount}           = qq|<td align=right>$discount</td>|;
 
1375     $column_data{customernumberinit} =
 
1376       qq|<td align=right>$ref->{customernumberinit}</td>|;
 
1378     map { print "$column_data{$_}\n" } @column_index;
 
1390   <td><hr size=3 noshade></td>
 
1395 <form method=post action=$form->{script}>
 
1397 <input name=callback type=hidden value="$form->{callback}">
 
1399 <input type=hidden name=type value=business>
 
1401 <input type=hidden name=path value=$form->{path}>
 
1402 <input type=hidden name=login value=$form->{login}>
 
1403 <input type=hidden name=password value=$form->{password}>
 
1405 <input class=submit type=submit name=action value="|
 
1406     . $locale->text('Add') . qq|">|;
 
1408   if ($form->{menubar}) {
 
1409     require "$form->{path}/menu.pl";
 
1421   $lxdebug->leave_sub();
 
1424 sub business_header {
 
1425   $lxdebug->enter_sub();
 
1427   $form->{title}    = $locale->text("$form->{title} Business");
 
1428   $form->{salesman} = "checked" if $form->{salesman};
 
1430   # $locale->text('Add Business')
 
1431   # $locale->text('Edit Business')
 
1433   $form->{description} =~ s/\"/"/g;
 
1435     $form->format_amount(\%myconfig, $form->{discount} * 100);
 
1442 <form method=post action=$form->{script}>
 
1444 <input type=hidden name=id value=$form->{id}>
 
1445 <input type=hidden name=type value=business>
 
1449     <th class=listtop colspan=2>$form->{title}</th>
 
1451   <tr height="5"></tr>
 
1453     <th align=right>| . $locale->text('Type of Business') . qq|</th>
 
1454     <td><input name=description size=30 value="$form->{description}"></td>
 
1457     <th align=right>| . $locale->text('Discount') . qq| %</th>
 
1458     <td><input name=discount size=5 value=$form->{discount}></td>
 
1461     <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
 
1462     <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
 
1465     <td align=right>| . $locale->text('Salesman') . qq|</td>
 
1466     <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
 
1468   <td colspan=2><hr size=3 noshade></td>
 
1473   $lxdebug->leave_sub();
 
1477   $lxdebug->enter_sub();
 
1479   $form->isblank("description", $locale->text('Description missing!'));
 
1480   AM->save_business(\%myconfig, \%$form);
 
1481   $form->redirect($locale->text('Business saved!'));
 
1483   $lxdebug->leave_sub();
 
1486 sub delete_business {
 
1487   $lxdebug->enter_sub();
 
1489   AM->delete_business(\%myconfig, \%$form);
 
1490   $form->redirect($locale->text('Business deleted!'));
 
1492   $lxdebug->leave_sub();
 
1496   $lxdebug->enter_sub();
 
1498   $form->{title} = "Add";
 
1501     "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1502     unless $form->{callback};
 
1507   $lxdebug->leave_sub();
 
1511   $lxdebug->enter_sub();
 
1513   $form->{title} = "Edit";
 
1515   AM->get_language(\%myconfig, \%$form);
 
1519   $form->{orphaned} = 1;
 
1522   $lxdebug->leave_sub();
 
1526   $lxdebug->enter_sub();
 
1528   AM->language(\%myconfig, \%$form);
 
1531     "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1533   $callback = $form->escape($form->{callback});
 
1535   $form->{title} = $locale->text('Languages');
 
1537   @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
 
1539   $column_header{description} =
 
1540       qq|<th class=listheading width=60%>|
 
1541     . $locale->text('Description')
 
1543   $column_header{template_code} =
 
1544       qq|<th class=listheading width=10%>|
 
1545     . $locale->text('Template Code')
 
1547   $column_header{article_code} =
 
1548       qq|<th class=listheading>|
 
1549     . $locale->text('Article Code')
 
1551   $column_header{output_numberformat} =
 
1552       qq|<th class=listheading>|
 
1553     . $locale->text('Number Format')
 
1555   $column_header{output_dateformat} =
 
1556       qq|<th class=listheading>|
 
1557     . $locale->text('Date Format')
 
1559   $column_header{output_longdates} =
 
1560       qq|<th class=listheading>|
 
1561     . $locale->text('Long Dates')
 
1571     <th class=listtop>$form->{title}</th>
 
1573   <tr height="5"></tr>
 
1577         <tr class=listheading>
 
1580   map { print "$column_header{$_}\n" } @column_index;
 
1586   foreach $ref (@{ $form->{ALL} }) {
 
1592         <tr valign=top class=listrow$i>
 
1596     $column_data{description} =
 
1597       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>|;
 
1598     $column_data{template_code}           = qq|<td align=right>$ref->{template_code}</td>|;
 
1599     $column_data{article_code} =
 
1600       qq|<td align=right>$ref->{article_code}</td>|;
 
1601     $column_data{output_numberformat} =
 
1603       ($ref->{output_numberformat} ? $ref->{output_numberformat} :
 
1604        $locale->text("use program settings")) .
 
1606     $column_data{output_dateformat} =
 
1608       ($ref->{output_dateformat} ? $ref->{output_dateformat} :
 
1609        $locale->text("use program settings")) .
 
1611     $column_data{output_longdates} =
 
1613       ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
 
1616     map { print "$column_data{$_}\n" } @column_index;
 
1628   <td><hr size=3 noshade></td>
 
1633 <form method=post action=$form->{script}>
 
1635 <input name=callback type=hidden value="$form->{callback}">
 
1637 <input type=hidden name=type value=language>
 
1639 <input type=hidden name=path value=$form->{path}>
 
1640 <input type=hidden name=login value=$form->{login}>
 
1641 <input type=hidden name=password value=$form->{password}>
 
1643 <input class=submit type=submit name=action value="|
 
1644     . $locale->text('Add') . qq|">|;
 
1646   if ($form->{menubar}) {
 
1647     require "$form->{path}/menu.pl";
 
1659   $lxdebug->leave_sub();
 
1662 sub language_header {
 
1663   $lxdebug->enter_sub();
 
1665   $form->{title}    = $locale->text("$form->{title} Language");
 
1667   # $locale->text('Add Language')
 
1668   # $locale->text('Edit Language')
 
1670   $form->{description} =~ s/\"/"/g;
 
1671   $form->{template_code} =~ s/\"/"/g;
 
1672   $form->{article_code} =~ s/\"/"/g;
 
1678     qq|<option value="">| . $locale->text("use program settings") .
 
1680   foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
 
1682       ($item eq $form->{output_numberformat})
 
1683       ? "<option selected>$item"
 
1689     qq|<option value="">| . $locale->text("use program settings") .
 
1691   foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
 
1693       ($item eq $form->{output_dateformat})
 
1694       ? "<option selected>$item"
 
1702 <form method=post action=$form->{script}>
 
1704 <input type=hidden name=id value=$form->{id}>
 
1705 <input type=hidden name=type value=language>
 
1709     <th class=listtop colspan=2>$form->{title}</th>
 
1711   <tr height="5"></tr>
 
1713     <th align=right>| . $locale->text('Language') . qq|</th>
 
1714     <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
 
1717     <th align=right>| . $locale->text('Template Code') . qq|</th>
 
1718     <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
 
1721     <th align=right>| . $locale->text('Article Code') . qq|</th>
 
1722     <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
 
1725     <th align=right>| . $locale->text('Number Format') . qq|</th>
 
1726     <td><select name="output_numberformat">$numberformat</select></td>
 
1729     <th align=right>| . $locale->text('Date Format') . qq|</th>
 
1730     <td><select name="output_dateformat">$dateformat</select></td>
 
1733     <th align=right>| . $locale->text('Long Dates') . qq|</th>
 
1734     <td><input type="radio" name="output_longdates" value="1"| .
 
1735     ($form->{output_longdates} ? " checked" : "") .
 
1736     qq|>| . $locale->text("Yes") .
 
1737     qq|<input type="radio" name="output_longdates" value="0"| .
 
1738     ($form->{output_longdates} ? "" : " checked") .
 
1739     qq|>| . $locale->text("No") .
 
1742   <td colspan=2><hr size=3 noshade></td>
 
1747   $lxdebug->leave_sub();
 
1751   $lxdebug->enter_sub();
 
1753   $form->isblank("description", $locale->text('Language missing!'));
 
1754   $form->isblank("template_code", $locale->text('Template Code missing!'));
 
1755   $form->isblank("article_code", $locale->text('Article Code missing!'));
 
1756   AM->save_language(\%myconfig, \%$form);
 
1757   $form->redirect($locale->text('Language saved!'));
 
1759   $lxdebug->leave_sub();
 
1762 sub delete_language {
 
1763   $lxdebug->enter_sub();
 
1765   AM->delete_language(\%myconfig, \%$form);
 
1766   $form->redirect($locale->text('Language deleted!'));
 
1768   $lxdebug->leave_sub();
 
1772 sub add_buchungsgruppe {
 
1773   $lxdebug->enter_sub();
 
1775   # $locale->text("Add Buchungsgruppe")
 
1776   # $locale->text("Edit Buchungsgruppe")
 
1777   $form->{title} = "Add";
 
1780     "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1781     unless $form->{callback};
 
1782   AM->get_buchungsgruppe(\%myconfig, \%$form);
 
1783   $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
 
1784   for (my $i = 0; 4 > $i; $i++) {
 
1785     map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; }
 
1786         qw(income expense));
 
1789   &buchungsgruppe_header;
 
1792   $lxdebug->leave_sub();
 
1795 sub edit_buchungsgruppe {
 
1796   $lxdebug->enter_sub();
 
1798   $form->{title} = "Edit";
 
1800   AM->get_buchungsgruppe(\%myconfig, \%$form);
 
1802   &buchungsgruppe_header;
 
1806   $lxdebug->leave_sub();
 
1809 sub list_buchungsgruppe {
 
1810   $lxdebug->enter_sub();
 
1812   AM->buchungsgruppe(\%myconfig, \%$form);
 
1815     "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1817   $callback = $form->escape($form->{callback});
 
1819   $form->{title} = $locale->text('Buchungsgruppen');
 
1821   @column_index = qw(description inventory_accno income_accno_0 expense_accno_0 income_accno_1 expense_accno_1 income_accno_2 expense_accno_2 income_accno_3 expense_accno_3 );
 
1823   $column_header{description} =
 
1824       qq|<th class=listheading width=60%>|
 
1825     . $locale->text('Description')
 
1827   $column_header{inventory_accno} =
 
1828       qq|<th class=listheading width=10%>|
 
1829     . $locale->text('Bestandskonto')
 
1831   $column_header{income_accno_0} =
 
1832       qq|<th class=listheading>|
 
1833     . $locale->text('Erlöse Inland')
 
1835   $column_header{expense_accno_0} =
 
1836       qq|<th class=listheading>|
 
1837     . $locale->text('Aufwand Inland')
 
1839   $column_header{income_accno_1} =
 
1840       qq|<th class=listheading>|
 
1841     . $locale->text('Erlöse EU m. UStId')
 
1843   $column_header{expense_accno_1} =
 
1844       qq|<th class=listheading>|
 
1845     . $locale->text('Aufwand EU m. UStId')
 
1847   $column_header{income_accno_2} =
 
1848       qq|<th class=listheading>|
 
1849     . $locale->text('Erlöse EU o. UStId')
 
1851   $column_header{expense_accno_2} =
 
1852       qq|<th class=listheading>|
 
1853     . $locale->text('Aufwand EU o. UStId')
 
1855   $column_header{income_accno_3} =
 
1856       qq|<th class=listheading>|
 
1857     . $locale->text('Erlöse Ausland')
 
1859   $column_header{expense_accno_3} =
 
1860       qq|<th class=listheading>|
 
1861     . $locale->text('Aufwand Ausland')
 
1870     <th class=listtop>$form->{title}</th>
 
1872   <tr height="5"></tr>
 
1876         <tr class=listheading>
 
1879   map { print "$column_header{$_}\n" } @column_index;
 
1885   foreach $ref (@{ $form->{ALL} }) {
 
1891         <tr valign=top class=listrow$i>
 
1895     $column_data{description} =
 
1896       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>|;
 
1897     $column_data{inventory_accno}           = qq|<td align=right>$ref->{inventory_accno}</td>|;
 
1898     $column_data{income_accno_0} =
 
1899       qq|<td align=right>$ref->{income_accno_0}</td>|;
 
1900     $column_data{expense_accno_0}           = qq|<td align=right>$ref->{expense_accno_0}</td>|;
 
1901     $column_data{income_accno_1} =
 
1902       qq|<td align=right>$ref->{income_accno_1}</td>|;
 
1903     $column_data{expense_accno_1}           = qq|<td align=right>$ref->{expense_accno_1}</td>|;
 
1904     $column_data{income_accno_2} =
 
1905       qq|<td align=right>$ref->{income_accno_2}</td>|;
 
1906     $column_data{expense_accno_2}           = qq|<td align=right>$ref->{expense_accno_2}</td>|;
 
1907     $column_data{income_accno_3} =
 
1908       qq|<td align=right>$ref->{income_accno_3}</td>|;
 
1909     $column_data{expense_accno_3}           = qq|<td align=right>$ref->{expense_accno_3}</td>|;
 
1911     map { print "$column_data{$_}\n" } @column_index;
 
1923   <td><hr size=3 noshade></td>
 
1928 <form method=post action=$form->{script}>
 
1930 <input name=callback type=hidden value="$form->{callback}">
 
1932 <input type=hidden name=type value=buchungsgruppe>
 
1934 <input type=hidden name=path value=$form->{path}>
 
1935 <input type=hidden name=login value=$form->{login}>
 
1936 <input type=hidden name=password value=$form->{password}>
 
1938 <input class=submit type=submit name=action value="|
 
1939     . $locale->text('Add') . qq|">|;
 
1941   if ($form->{menubar}) {
 
1942     require "$form->{path}/menu.pl";
 
1954   $lxdebug->leave_sub();
 
1957 sub buchungsgruppe_header {
 
1958   $lxdebug->enter_sub();
 
1960   $form->{title}    = $locale->text("$form->{title} Buchungsgruppe");
 
1962   # $locale->text('Buchungsgruppe hinzufügen')
 
1963   # $locale->text('Buchungsgruppe bearbeiten')
 
1965   my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
 
1966   my %acc_type_map = (
 
1967     "IC" => $acc_inventory,
 
1968     "IC_income" => $acc_income,
 
1969     "IC_sale" => $acc_income,
 
1970     "IC_expense" => $acc_expense,
 
1971     "IC_cogs" => $acc_expense,
 
1974   foreach $key (keys(%acc_type_map)) {
 
1975     foreach $ref (@{ $form->{IC_links}{$key} }) {
 
1976       $acc_type_map{$key}->{$ref->{"id"}} = $ref;
 
1980   foreach my $type (qw(IC IC_income IC_expense)) {
 
1981     $form->{"select$type"} =
 
1983            map({ "<option value=$_->{id} $_->{selected}>" .
 
1984                    "$_->{accno}--" . H($_->{description}) . "</option>" }
 
1985                sort({ $a->{"accno"} cmp $b->{"accno"} }
 
1986                     values(%{$acc_type_map{$type}}))));
 
1990     $form->{selectIC} =~ s/selected//g;
 
1991     $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/  value=$form->{inventory_accno_id} selected/;
 
1992     $form->{selectIC_income} =~ s/selected//g;
 
1993     $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/  value=$form->{income_accno_id_0} selected/;
 
1994     $form->{selectIC_expense} =~ s/selected//g;
 
1995     $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_0}/  value=$form->{expense_accno_id_0} selected/;
 
2001                 <th align=right>| . $locale->text('Inventory') . qq|</th>
 
2002                 <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
 
2003                 <input name=selectIC type=hidden value="$form->{selectIC}">
 
2007                 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
 
2011   $linkaccounts .= qq|
 
2013                 <th align=right>| . $locale->text('Erlöse Inland') . qq|</th>
 
2014                 <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
 
2017                 <th align=right>| . $locale->text('Aufwand Inland') . qq|</th>
 
2018                 <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
 
2021     $form->{selectIC_income} =~ s/selected//g;
 
2022     $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_1}/  value=$form->{income_accno_id_1} selected/;
 
2023     $form->{selectIC_expense} =~ s/selected//g;
 
2024     $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/  value=$form->{expense_accno_id_1} selected/;
 
2026   $linkaccounts .= qq|        <tr>
 
2027                 <th align=right>| . $locale->text('Erlöse EU m. UStId') . qq|</th>
 
2028                 <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
 
2031                 <th align=right>| . $locale->text('Aufwand EU m UStId') . qq|</th>
 
2032                 <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
 
2036     $form->{selectIC_income} =~ s/selected//g;
 
2037     $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_2}/  value=$form->{income_accno_id_2} selected/;
 
2038     $form->{selectIC_expense} =~ s/selected//g;
 
2039     $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_2}/  value=$form->{expense_accno_id_2} selected/;
 
2042   $linkaccounts .= qq|        <tr>
 
2043                 <th align=right>| . $locale->text('Erlöse EU o. UStId') . qq|</th>
 
2044                 <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
 
2047                 <th align=right>| . $locale->text('Aufwand EU o. UStId') . qq|</th>
 
2048                 <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
 
2052     $form->{selectIC_income} =~ s/selected//g;
 
2053     $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_3}/  value=$form->{income_accno_id_3} selected/;
 
2054     $form->{selectIC_expense} =~ s/selected//g;
 
2055     $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_3}/  value=$form->{expense_accno_id_3} selected/;
 
2058   $linkaccounts .= qq|        <tr>
 
2059                 <th align=right>| . $locale->text('Erlöse Ausland') . qq|</th>
 
2060                 <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
 
2063                 <th align=right>| . $locale->text('Aufwand Ausland') . qq|</th>
 
2064                 <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
 
2074 <form method=post action=$form->{script}>
 
2076 <input type=hidden name=id value=$form->{id}>
 
2077 <input type=hidden name=type value=buchungsgruppe>
 
2081     <th class=listtop colspan=2>$form->{title}</th>
 
2083   <tr height="5"></tr>
 
2085     <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
 
2086     <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
 
2089   <td colspan=2><hr size=3 noshade></td>
 
2094   $lxdebug->leave_sub();
 
2097 sub save_buchungsgruppe {
 
2098   $lxdebug->enter_sub();
 
2100   $form->isblank("description", $locale->text('Description missing!'));
 
2102   AM->save_buchungsgruppe(\%myconfig, \%$form);
 
2103   $form->redirect($locale->text('Buchungsgruppe gespeichert!'));
 
2105   $lxdebug->leave_sub();
 
2108 sub delete_buchungsgruppe {
 
2109   $lxdebug->enter_sub();
 
2111   AM->delete_buchungsgruppe(\%myconfig, \%$form);
 
2112   $form->redirect($locale->text('Buchungsgruppe gelöscht!'));
 
2114   $lxdebug->leave_sub();
 
2119   $lxdebug->enter_sub();
 
2121   $form->{title} = "Add";
 
2124     "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
2125     unless $form->{callback};
 
2130   $lxdebug->leave_sub();
 
2134   $lxdebug->enter_sub();
 
2136   $form->{title} = "Edit";
 
2138   AM->get_printer(\%myconfig, \%$form);
 
2142   $form->{orphaned} = 1;
 
2145   $lxdebug->leave_sub();
 
2149   $lxdebug->enter_sub();
 
2151   AM->printer(\%myconfig, \%$form);
 
2154     "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
2156   $callback = $form->escape($form->{callback});
 
2158   $form->{title} = $locale->text('Printer');
 
2160   @column_index = qw(printer_description printer_command template_code);
 
2162   $column_header{printer_description} =
 
2163       qq|<th class=listheading width=60%>|
 
2164     . $locale->text('Printer Description')
 
2166   $column_header{printer_command} =
 
2167       qq|<th class=listheading width=10%>|
 
2168     . $locale->text('Printer Command')
 
2170   $column_header{template_code} =
 
2171       qq|<th class=listheading>|
 
2172     . $locale->text('Template Code')
 
2182     <th class=listtop>$form->{title}</th>
 
2184   <tr height="5"></tr>
 
2188         <tr class=listheading>
 
2191   map { print "$column_header{$_}\n" } @column_index;
 
2197   foreach $ref (@{ $form->{ALL} }) {
 
2203         <tr valign=top class=listrow$i>
 
2207     $column_data{printer_description} =
 
2208       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>|;
 
2209     $column_data{printer_command}           = qq|<td align=right>$ref->{printer_command}</td>|;
 
2210     $column_data{template_code} =
 
2211       qq|<td align=right>$ref->{template_code}</td>|;
 
2213     map { print "$column_data{$_}\n" } @column_index;
 
2225   <td><hr size=3 noshade></td>
 
2230 <form method=post action=$form->{script}>
 
2232 <input name=callback type=hidden value="$form->{callback}">
 
2234 <input type=hidden name=type value=printer>
 
2236 <input type=hidden name=path value=$form->{path}>
 
2237 <input type=hidden name=login value=$form->{login}>
 
2238 <input type=hidden name=password value=$form->{password}>
 
2240 <input class=submit type=submit name=action value="|
 
2241     . $locale->text('Add') . qq|">|;
 
2243   if ($form->{menubar}) {
 
2244     require "$form->{path}/menu.pl";
 
2256   $lxdebug->leave_sub();
 
2259 sub printer_header {
 
2260   $lxdebug->enter_sub();
 
2262   $form->{title}    = $locale->text("$form->{title} Printer");
 
2264   # $locale->text('Add Printer')
 
2265   # $locale->text('Edit Printer')
 
2267   $form->{printer_description} =~ s/\"/"/g;
 
2268   $form->{template_code} =~ s/\"/"/g;
 
2269   $form->{printer_command} =~ s/\"/"/g;
 
2277 <form method=post action=$form->{script}>
 
2279 <input type=hidden name=id value=$form->{id}>
 
2280 <input type=hidden name=type value=printer>
 
2284     <th class=listtop colspan=2>$form->{title}</th>
 
2286   <tr height="5"></tr>
 
2288     <th align=right>| . $locale->text('Printer') . qq|</th>
 
2289     <td><input name=printer_description size=30 value="$form->{printer_description}"></td>
 
2292     <th align=right>| . $locale->text('Printer Command') . qq|</th>
 
2293     <td><input name=printer_command size=30 value="$form->{printer_command}"></td>
 
2296     <th align=right>| . $locale->text('Template Code') . qq|</th>
 
2297     <td><input name=template_code size=5 value="$form->{template_code}"></td>
 
2299   <td colspan=2><hr size=3 noshade></td>
 
2304   $lxdebug->leave_sub();
 
2308   $lxdebug->enter_sub();
 
2310   $form->isblank("printer_description", $locale->text('Description missing!'));
 
2311   $form->isblank("printer_command", $locale->text('Printer Command missing!'));
 
2312   AM->save_printer(\%myconfig, \%$form);
 
2313   $form->redirect($locale->text('Printer saved!'));
 
2315   $lxdebug->leave_sub();
 
2318 sub delete_printer {
 
2319   $lxdebug->enter_sub();
 
2321   AM->delete_printer(\%myconfig, \%$form);
 
2322   $form->redirect($locale->text('Printer deleted!'));
 
2324   $lxdebug->leave_sub();
 
2329   $lxdebug->enter_sub();
 
2331   $form->{title} = "Add";
 
2334     "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
2335     unless $form->{callback};
 
2337   $form->{terms_netto} = 0;
 
2338   $form->{terms_skonto} = 0;
 
2339   $form->{percent_skonto} = 0;
 
2343   $lxdebug->leave_sub();
 
2347   $lxdebug->enter_sub();
 
2349   $form->{title} = "Edit";
 
2351   AM->get_payment(\%myconfig, \%$form);
 
2355   $form->{orphaned} = 1;
 
2358   $lxdebug->leave_sub();
 
2362   $lxdebug->enter_sub();
 
2364   AM->payment(\%myconfig, \%$form);
 
2367     "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
2369   $callback = $form->escape($form->{callback});
 
2371   $form->{title} = $locale->text('Payment Terms');
 
2373   @column_index = qw(description description_long terms_netto terms_skonto percent_skonto);
 
2375   $column_header{description} =
 
2376       qq|<th class=listheading>|
 
2377     . $locale->text('Description')
 
2379   $column_header{description_long} =
 
2380       qq|<th class=listheading>|
 
2381     . $locale->text('Long Description')
 
2383   $column_header{terms_netto} =
 
2384       qq|<th class=listheading>|
 
2385     . $locale->text('Netto Terms')
 
2387   $column_header{terms_skonto} =
 
2388       qq|<th class=listheading>|
 
2389     . $locale->text('Skonto Terms')
 
2391   $column_header{percent_skonto} =
 
2392       qq|<th class=listheading>|
 
2393     . $locale->text('Skonto')
 
2403     <th class=listtop>$form->{title}</th>
 
2405   <tr height="5"></tr>
 
2409         <tr class=listheading>
 
2412   map { print "$column_header{$_}\n" } @column_index;
 
2418   foreach $ref (@{ $form->{ALL} }) {
 
2424         <tr valign=top class=listrow$i>
 
2428     $column_data{description} =
 
2429       qq|<td><a href=$form->{script}?action=edit_payment&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
 
2430     $column_data{description_long}           = qq|<td align=right>$ref->{description_long}</td>|;
 
2431     $column_data{terms_netto} =
 
2432       qq|<td align=right>$ref->{terms_netto}</td>|;
 
2433     $column_data{terms_skonto} =
 
2434       qq|<td align=right>$ref->{terms_skonto}</td>|;
 
2435     $column_data{percent_skonto} =
 
2436       qq|<td align=right>$ref->{percent_skonto} %</td>|;
 
2437     map { print "$column_data{$_}\n" } @column_index;
 
2449   <td><hr size=3 noshade></td>
 
2454 <form method=post action=$form->{script}>
 
2456 <input name=callback type=hidden value="$form->{callback}">
 
2458 <input type=hidden name=type value=payment>
 
2460 <input type=hidden name=path value=$form->{path}>
 
2461 <input type=hidden name=login value=$form->{login}>
 
2462 <input type=hidden name=password value=$form->{password}>
 
2464 <input class=submit type=submit name=action value="|
 
2465     . $locale->text('Add') . qq|">|;
 
2467   if ($form->{menubar}) {
 
2468     require "$form->{path}/menu.pl";
 
2480   $lxdebug->leave_sub();
 
2483 sub payment_header {
 
2484   $lxdebug->enter_sub();
 
2486   $form->{title}    = $locale->text("$form->{title} Payment Terms");
 
2488   # $locale->text('Add Payment Terms')
 
2489   # $locale->text('Edit Payment Terms')
 
2491   $form->{description} =~ s/\"/"/g;
 
2500 <form method=post action=$form->{script}>
 
2502 <input type=hidden name=id value=$form->{id}>
 
2503 <input type=hidden name=type value=payment>
 
2507     <th class=listtop colspan=2>$form->{title}</th>
 
2509   <tr height="5"></tr>
 
2511     <th align=right>| . $locale->text('Description') . qq|</th>
 
2512     <td><input name=description size=30 value="$form->{description}"></td>
 
2515     <th align=right>| . $locale->text('Long Description') . qq|</th>
 
2516     <td><input name=description_long size=50 value="$form->{description_long}"></td>
 
2519     <th align=right>| . $locale->text('Netto Terms') . qq|</th>
 
2520     <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
 
2523     <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
 
2524     <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
 
2527     <th align=right>| . $locale->text('Skonto') . qq| %</th>
 
2528     <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
 
2530   <td colspan=2><hr size=3 noshade></td>
 
2535   $lxdebug->leave_sub();
 
2539   $lxdebug->enter_sub();
 
2541   $form->isblank("description", $locale->text('Language missing!'));
 
2542   AM->save_payment(\%myconfig, \%$form);
 
2543   $form->redirect($locale->text('Payment Terms saved!'));
 
2545   $lxdebug->leave_sub();
 
2548 sub delete_payment {
 
2549   $lxdebug->enter_sub();
 
2551   AM->delete_payment(\%myconfig, \%$form);
 
2552   $form->redirect($locale->text('Payment terms deleted!'));
 
2554   $lxdebug->leave_sub();
 
2558   $lxdebug->enter_sub();
 
2560   $form->{title} = "Add";
 
2563     "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
2564     unless $form->{callback};
 
2569   $lxdebug->leave_sub();
 
2573   $lxdebug->enter_sub();
 
2575   $form->{title} = "Edit";
 
2577   AM->get_sic(\%myconfig, \%$form);
 
2581   $form->{orphaned} = 1;
 
2584   $lxdebug->leave_sub();
 
2588   $lxdebug->enter_sub();
 
2590   AM->sic(\%myconfig, \%$form);
 
2593     "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
2595   $callback = $form->escape($form->{callback});
 
2597   $form->{title} = $locale->text('Standard Industrial Codes');
 
2599   @column_index = qw(code description);
 
2601   $column_header{code} =
 
2602     qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
 
2603   $column_header{description} =
 
2604     qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
 
2613     <th class=listtop>$form->{title}</th>
 
2615   <tr height="5"></tr>
 
2619         <tr class=listheading>
 
2622   map { print "$column_header{$_}\n" } @column_index;
 
2628   foreach $ref (@{ $form->{ALL} }) {
 
2633     if ($ref->{sictype} eq 'H') {
 
2635         <tr valign=top class=listheading>
 
2637       $column_data{code} =
 
2638         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>|;
 
2639       $column_data{description} = qq|<th>$ref->{description}</th>|;
 
2643         <tr valign=top class=listrow$i>
 
2646       $column_data{code} =
 
2647         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>|;
 
2648       $column_data{description} = qq|<td>$ref->{description}</td>|;
 
2652     map { print "$column_data{$_}\n" } @column_index;
 
2664   <td><hr size=3 noshade></td>
 
2669 <form method=post action=$form->{script}>
 
2671 <input name=callback type=hidden value="$form->{callback}">
 
2673 <input type=hidden name=type value=sic>
 
2675 <input type=hidden name=path value=$form->{path}>
 
2676 <input type=hidden name=login value=$form->{login}>
 
2677 <input type=hidden name=password value=$form->{password}>
 
2679 <input class=submit type=submit name=action value="|
 
2680     . $locale->text('Add') . qq|">|;
 
2682   if ($form->{menubar}) {
 
2683     require "$form->{path}/menu.pl";
 
2694   $lxdebug->leave_sub();
 
2698   $lxdebug->enter_sub();
 
2700   $form->{title} = $locale->text("$form->{title} SIC");
 
2702   # $locale->text('Add SIC')
 
2703   # $locale->text('Edit SIC')
 
2705   $form->{code}        =~ s/\"/"/g;
 
2706   $form->{description} =~ s/\"/"/g;
 
2708   $checked = ($form->{sictype} eq 'H') ? "checked" : "";
 
2715 <form method=post action=$form->{script}>
 
2717 <input type=hidden name=type value=sic>
 
2718 <input type=hidden name=id value=$form->{code}>
 
2722     <th class=listtop colspan=2>$form->{title}</th>
 
2724   <tr height="5"></tr>
 
2726     <th align=right>| . $locale->text('Code') . qq|</th>
 
2727     <td><input name=code size=10 value=$form->{code}></td>
 
2731     <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
 
2732     . $locale->text('Heading') . qq|</th>
 
2735     <th align=right>| . $locale->text('Description') . qq|</th>
 
2736     <td><input name=description size=60 value="$form->{description}"></td>
 
2738     <td colspan=2><hr size=3 noshade></td>
 
2743   $lxdebug->leave_sub();
 
2747   $lxdebug->enter_sub();
 
2749   $form->isblank("code",        $locale->text('Code missing!'));
 
2750   $form->isblank("description", $locale->text('Description missing!'));
 
2751   AM->save_sic(\%myconfig, \%$form);
 
2752   $form->redirect($locale->text('SIC saved!'));
 
2754   $lxdebug->leave_sub();
 
2758   $lxdebug->enter_sub();
 
2760   AM->delete_sic(\%myconfig, \%$form);
 
2761   $form->redirect($locale->text('SIC deleted!'));
 
2763   $lxdebug->leave_sub();
 
2766 sub display_stylesheet {
 
2767   $lxdebug->enter_sub();
 
2769   $form->{file} = "css/$myconfig{stylesheet}";
 
2772   $lxdebug->leave_sub();
 
2776   $lxdebug->enter_sub();
 
2778   $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
 
2779   $form->{file} =~ s/^\/*//g;
 
2780   $form->{file} =~ s/$userspath//;
 
2782   $form->error("$!: $form->{file}") unless -f $form->{file};
 
2784   AM->load_template(\%$form);
 
2786   $form->{title} = $form->{file};
 
2788   # if it is anything but html
 
2789   if ($form->{file} !~ /\.html$/) {
 
2790     $form->{body} = "<pre>\n$form->{body}\n</pre>";
 
2800 <form method=post action=$form->{script}>
 
2802 <input name=file type=hidden value=$form->{file}>
 
2803 <input name=type type=hidden value=template>
 
2805 <input type=hidden name=path value=$form->{path}>
 
2806 <input type=hidden name=login value=$form->{login}>
 
2807 <input type=hidden name=password value=$form->{password}>
 
2809 <input name=action type=submit class=submit value="|
 
2810     . $locale->text('Edit') . qq|">|;
 
2812   if ($form->{menubar}) {
 
2813     require "$form->{path}/menu.pl";
 
2824   $lxdebug->leave_sub();
 
2828   $lxdebug->enter_sub();
 
2830   AM->load_template(\%$form);
 
2832   $form->{title} = $locale->text('Edit Template');
 
2834   # convert   to &nbsp;
 
2835   $form->{body} =~ s/ /&nbsp;/gi;
 
2842 <form method=post action=$form->{script}>
 
2844 <input name=file type=hidden value=$form->{file}>
 
2845 <input name=type type=hidden value=template>
 
2847 <input type=hidden name=path value=$form->{path}>
 
2848 <input type=hidden name=login value=$form->{login}>
 
2849 <input type=hidden name=password value=$form->{password}>
 
2851 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
 
2853 <textarea name=body rows=25 cols=70>
 
2858 <input type=submit class=submit name=action value="|
 
2859     . $locale->text('Save') . qq|">|;
 
2861   if ($form->{menubar}) {
 
2862     require "$form->{path}/menu.pl";
 
2874   $lxdebug->leave_sub();
 
2878   $lxdebug->enter_sub();
 
2880   AM->save_template(\%$form);
 
2881   $form->redirect($locale->text('Template saved!'));
 
2883   $lxdebug->leave_sub();
 
2887   $lxdebug->enter_sub();
 
2889   # get defaults for account numbers and last numbers
 
2890   AM->defaultaccounts(\%myconfig, \%$form);
 
2892   foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
 
2894       ($item eq $myconfig{dateformat})
 
2895       ? "<option selected>$item\n"
 
2896       : "<option>$item\n";
 
2899   foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
 
2901       ($item eq $myconfig{numberformat})
 
2902       ? "<option selected>$item\n"
 
2903       : "<option>$item\n";
 
2906   foreach $item (qw(name company address signature)) {
 
2907     $myconfig{$item} =~ s/\"/"/g;
 
2910   foreach $item (qw(address signature)) {
 
2911     $myconfig{$item} =~ s/\\n/\r\n/g;
 
2915   if ($opendocument_templates && $openofficeorg_writer_bin &&
 
2916       $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
 
2917     push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
 
2918                      "value" => "opendocument_pdf" });
 
2920   if ($latex_templates) {
 
2921     push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
 
2923   push(@formats, { "name" => "HTML", "value" => "html" });
 
2924   if ($latex_templates) {
 
2925     push(@formats, { "name" => $locale->text("Postscript"),
 
2926                      "value" => "postscript" });
 
2928   if ($opendocument_templates) {
 
2929     push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
 
2930                      "value" => "opendocument" });
 
2933   if (!$myconfig{"template_format"}) {
 
2934     $myconfig{"template_format"} = "pdf";
 
2936   $template_format = "";
 
2937   foreach $item (@formats) {
 
2939       "<option value=\"$item->{value}\"" .
 
2940       ($item->{"value"} eq $myconfig{"template_format"} ?
 
2942        ">" . H($item->{"name"}) . "</option>";
 
2945   %countrycodes = User->country_codes;
 
2947   foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
 
2951       ($myconfig{countrycode} eq $key)
 
2952       ? "<option selected value=$key>$countrycodes{$key}\n"
 
2953       : "<option value=$key>$countrycodes{$key}\n";
 
2955   $countrycodes = "<option>American English\n$countrycodes";
 
2957   # use an other input number format than output numberformat
 
2958   # look at Form.pm, sub parse_amount
 
2959   my $in_numberformat = '';
 
2960   $text1 = qq|value="0">| . $locale->text('equal Outputformat');
 
2961   $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
 
2962   @in_nf = ($text1, $text2);
 
2963   foreach $item (@in_nf) {
 
2965       (substr($item, 7, 1) eq $myconfig{in_numberformat})
 
2966       ? "<option selected $item\n"
 
2967       : "<option $item\n";
 
2970   foreach $key (keys %{ $form->{IC} }) {
 
2971     foreach $accno (sort keys %{ $form->{IC}{$key} }) {
 
2973         ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
 
2974         ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
 
2975         : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
 
2979   opendir CSS, "css/.";
 
2980   @all = grep /.*\.css$/, readdir CSS;
 
2983   foreach $item (@all) {
 
2984     if ($item eq $myconfig{stylesheet}) {
 
2985       $selectstylesheet .= qq|<option selected>$item\n|;
 
2987       $selectstylesheet .= qq|<option>$item\n|;
 
2990   $selectstylesheet .= "<option>\n";
 
2992   $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
 
2996   if ($myconfig{menustyle} eq "old") {
 
2997     $menustyle_old = "checked";
 
2998   } elsif ($myconfig{menustyle} eq "neu") {
 
2999     $menustyle_neu = "checked";
 
3000   } elsif ($myconfig{menustyle} eq "v3") {
 
3001     $menustyle_v3 = "checked";
 
3004   my ($show_form_details, $hide_form_details);
 
3005   $myconfig{"show_form_details"} = 1
 
3006     unless (defined($myconfig{"show_form_details"}));
 
3007   $show_form_details = "checked" if ($myconfig{"show_form_details"});
 
3008   $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
 
3013 <form method=post action=$form->{script}>
 
3015 <input type=hidden name=old_password value=$myconfig{password}>
 
3016 <input type=hidden name=type value=preferences>
 
3017 <input type=hidden name=role value=$myconfig{role}>
 
3020   <tr><th class=listtop>$form->{title}</th></tr>
 
3025           <th align=right>| . $locale->text('Name') . qq|</th>
 
3026           <td><input name=name size=15 value="$myconfig{name}"></td>
 
3029           <th align=right>| . $locale->text('Password') . qq|</th>
 
3030           <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
 
3033           <th align=right>| . $locale->text('E-mail') . qq|</th>
 
3034           <td><input name=email size=30 value="$myconfig{email}"></td>
 
3037           <th align=right>| . $locale->text('Signature') . qq|</th>
 
3038           <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
 
3041           <th align=right>| . $locale->text('Phone') . qq|</th>
 
3042           <td><input name=tel size=14 value="$myconfig{tel}"></td>
 
3045           <th align=right>| . $locale->text('Fax') . qq|</th>
 
3046           <td><input name=fax size=14 value="$myconfig{fax}"></td>
 
3049           <th align=right>| . $locale->text('Company') . qq|</th>
 
3050           <td><input name=company size=30 value="$myconfig{company}"></td>
 
3053           <th align=right>| . $locale->text('Address') . qq|</th>
 
3054           <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
 
3057           <th align=right>| . $locale->text('Date Format') . qq|</th>
 
3058           <td><select name=dateformat>$dateformat</select></td>
 
3061           <th align=right>| . $locale->text('Output Number Format') . qq|</th>
 
3062           <td><select name=numberformat>$numberformat</select></td>
 
3065           <th align=right>| . $locale->text('Input Number Format') . qq|</th>
 
3066           <td><select name=in_numberformat>$in_numberformat</select></td>
 
3070           <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
 
3071           <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
 
3074           <th align=right>| . $locale->text('Language') . qq|</th>
 
3075           <td><select name=countrycode>$countrycodes</select></td>
 
3078           <th align=right>| . $locale->text('Stylesheet') . qq|</th>
 
3079           <td><select name=usestylesheet>$selectstylesheet</select></td>
 
3082           <th align=right>| . $locale->text('Setup Menu') . qq|</th>
 
3083           <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3> | .
 
3084     $locale->text("Top (CSS)") . qq|
 
3085           <input name=menustyle type=radio class=radio value=neu $menustyle_neu> | .
 
3086     $locale->text("Top (Javascript)") . qq|
 
3087     <input name=menustyle type=radio class=radio value=old $menustyle_old> | .
 
3088     $locale->text("Old (on the side)") . qq|</td>
 
3091     <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
 
3092     <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details> 
 
3093     <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
 
3094     <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details> 
 
3095     <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
 
3097         <input name=printer type=hidden value="$myconfig{printer}">
 
3098         <tr class=listheading>
 
3099           <th colspan=2>| . $locale->text("Print options") . qq|</th>
 
3102           <th align=right>| . $locale->text('Default template format') . qq|</th>
 
3103           <td><select name="template_format">$template_format</select></td>
 
3106           <th align=right>| . $locale->text('Number of copies') . qq|</th>
 
3107           <td><input name="copies" size="10" value="| .
 
3108     $form->quote($myconfig{"copies"}) . qq|"></td>
 
3112         <tr class=listheading>
 
3113           <th colspan=2> </th>
 
3116           <th align=right>| . $locale->text('Business Number') . qq|</th>
 
3117           <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
 
3120                 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
 
3121                 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
 
3123         <tr class=listheading>
 
3125     . $locale->text('Last Numbers & Default Accounts') . qq|</th>
 
3131                 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
 
3132                 <td><select name=inventory_accno>$myconfig{IC}</select></td>
 
3135                 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
 
3136                 <td><select name=income_accno>$myconfig{IC_income}</select></td>
 
3139                 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
 
3140                 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
 
3143                 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
 
3144                 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
 
3147                 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
 
3148                 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
 
3153     'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
 
3155     . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
 
3164                 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
 
3165                 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
 
3166                 <th align=right nowrap>|
 
3167     . $locale->text('Last Customer Number') . qq|</th>
 
3168                 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
 
3171                 <th align=right nowrap>|
 
3172     . $locale->text('Last Credit Note Number') . qq|</th>
 
3173                 <td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
 
3174                 <th align=right nowrap>|
 
3175     . $locale->text('Last Vendor Number') . qq|</th>
 
3176                 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
 
3179                 <th align=right nowrap>|
 
3180     . $locale->text('Last Sales Order Number') . qq|</th>
 
3181                 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
 
3184                 <th align=right nowrap>|
 
3185     . $locale->text('Last Purchase Order Number') . qq|</th>
 
3186                 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
 
3187                 <th align=right nowrap>|
 
3188     . $locale->text('Last Article Number') . qq|</th>
 
3189                 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
 
3192                 <th align=right nowrap>|
 
3193     . $locale->text('Last Sales Quotation Number') . qq|</th>
 
3194                 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
 
3195                 <th align=right nowrap>|
 
3196     . $locale->text('Last Service Number') . qq|</th>
 
3197                 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
 
3200                 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
 
3201                 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
 
3202                 <th align=right nowrap></th>
 
3208 #       <tr class=listheading>
 
3209 #         <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
 
3216 #               <th>| . $locale->text('Rate') . qq| (%)</th>
 
3217 #               <th>| . $locale->text('Number') . qq|</th>
 
3221 #   foreach $accno (sort keys %{ $form->{taxrates} }) {
 
3224 #               <th align=right>$form->{taxrates}{$accno}{description}</th>
 
3225 #               <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
 
3226 #               <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
 
3229 #     $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
 
3232 #   chop $form->{taxaccounts};
 
3235 # <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
 
3244     <td><hr size=3 noshade></td>
 
3248 <input type=hidden name=path value=$form->{path}>
 
3249 <input type=hidden name=login value=$form->{login}>
 
3250 <input type=hidden name=password value=$form->{password}>
 
3253 <input type=submit class=submit name=action value="|
 
3254     . $locale->text('Save') . qq|">|;
 
3256   if ($form->{menubar}) {
 
3257     require "$form->{path}/menu.pl";
 
3268   $lxdebug->leave_sub();
 
3271 sub save_preferences {
 
3272   $lxdebug->enter_sub();
 
3274   $form->{stylesheet} = $form->{usestylesheet};
 
3276   $form->redirect($locale->text('Preferences saved!'))
 
3278      AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
 
3280   $form->error($locale->text('Cannot save preferences!'));
 
3282   $lxdebug->leave_sub();
 
3286   $lxdebug->enter_sub();
 
3288   if ($form->{media} eq 'email') {
 
3289     $form->error($locale->text('No email address for') . " $myconfig{name}")
 
3290       unless ($myconfig{email});
 
3292     $form->{OUT} = "$sendmail";
 
3296   AM->backup(\%myconfig, \%$form, $userspath);
 
3298   if ($form->{media} eq 'email') {
 
3299     $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
 
3302   $lxdebug->leave_sub();
 
3306   $lxdebug->enter_sub();
 
3308   $form->{title} = $locale->text('Audit Control');
 
3310   AM->closedto(\%myconfig, \%$form);
 
3312   if ($form->{revtrans}) {
 
3313     $checked{Y} = "checked";
 
3315     $checked{N} = "checked";
 
3323 <form method=post action=$form->{script}>
 
3325 <input type=hidden name=path value=$form->{path}>
 
3326 <input type=hidden name=login value=$form->{login}>
 
3327 <input type=hidden name=password value=$form->{password}>
 
3330   <tr><th class=listtop>$form->{title}</th></tr>
 
3331   <tr height="5"></tr>
 
3337     . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
 
3338           <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
 
3339     . $locale->text('Yes')
 
3340     . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
 
3341     . $locale->text('No')
 
3345           <th>| . $locale->text('Close Books up to') . qq|</th>
 
3346           <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
 
3356 <input type=hidden name=nextsub value=doclose>
 
3358 <input type=submit class=submit name=action value="|
 
3359     . $locale->text('Continue') . qq|">
 
3367   $lxdebug->leave_sub();
 
3371   $lxdebug->enter_sub();
 
3373   AM->closebooks(\%myconfig, \%$form);
 
3375   if ($form->{revtrans}) {
 
3377                  $locale->text('Transaction reversal enforced for all dates'));
 
3379     if ($form->{closedto}) {
 
3381                      $locale->text('Transaction reversal enforced up to') . " "
 
3382                        . $locale->date(\%myconfig, $form->{closedto}, 1));
 
3384       $form->redirect($locale->text('Books are open'));
 
3388   $lxdebug->leave_sub();
 
3392   $lxdebug->enter_sub();
 
3394   $form->{title} = "Add";
 
3397     "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
3398     unless $form->{callback};
 
3403   $lxdebug->leave_sub();
 
3406 sub edit_warehouse {
 
3407   $lxdebug->enter_sub();
 
3409   $form->{title} = "Edit";
 
3411   AM->get_warehouse(\%myconfig, \%$form);
 
3416   $lxdebug->leave_sub();
 
3419 sub list_warehouse {
 
3420   $lxdebug->enter_sub();
 
3422   AM->warehouses(\%myconfig, \%$form);
 
3425     "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
3427   $callback = $form->escape($form->{callback});
 
3429   $form->{title} = $locale->text('Warehouses');
 
3431   @column_index = qw(description);
 
3433   $column_header{description} =
 
3434       qq|<th class=listheading width=100%>|
 
3435     . $locale->text('Description')
 
3445     <th class=listtop>$form->{title}</th>
 
3447   <tr height="5"></tr>
 
3451         <tr class=listheading>
 
3454   map { print "$column_header{$_}\n" } @column_index;
 
3460   foreach $ref (@{ $form->{ALL} }) {
 
3466         <tr valign=top class=listrow$i>
 
3469     $column_data{description} =
 
3470       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>|;
 
3472     map { print "$column_data{$_}\n" } @column_index;
 
3484   <td><hr size=3 noshade></td>
 
3489 <form method=post action=$form->{script}>
 
3491 <input name=callback type=hidden value="$form->{callback}">
 
3493 <input type=hidden name=type value=warehouse>
 
3495 <input type=hidden name=path value=$form->{path}>
 
3496 <input type=hidden name=login value=$form->{login}>
 
3497 <input type=hidden name=password value=$form->{password}>
 
3499 <input class=submit type=submit name=action value="|
 
3500     . $locale->text('Add') . qq|">|;
 
3502   if ($form->{menubar}) {
 
3503     require "$form->{path}/menu.pl";
 
3514   $lxdebug->leave_sub();
 
3517 sub warehouse_header {
 
3518   $lxdebug->enter_sub();
 
3520   $form->{title} = $locale->text("$form->{title} Warehouse");
 
3522   # $locale->text('Add Warehouse')
 
3523   # $locale->text('Edit Warehouse')
 
3525   $form->{description} =~ s/\"/"/g;
 
3527   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
 
3529       qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
 
3532       qq|<input name=description size=60 value="$form->{description}">|;
 
3540 <form method=post action=$form->{script}>
 
3542 <input type=hidden name=id value=$form->{id}>
 
3543 <input type=hidden name=type value=warehouse>
 
3547     <th class=listtop colspan=2>$form->{title}</th>
 
3549   <tr height="5"></tr>
 
3551     <th align=right>| . $locale->text('Description') . qq|</th>
 
3552     <td>$description</td>
 
3555     <td colspan=2><hr size=3 noshade></td>
 
3560   $lxdebug->leave_sub();
 
3563 sub save_warehouse {
 
3564   $lxdebug->enter_sub();
 
3566   $form->isblank("description", $locale->text('Description missing!'));
 
3567   AM->save_warehouse(\%myconfig, \%$form);
 
3568   $form->redirect($locale->text('Warehouse saved!'));
 
3570   $lxdebug->leave_sub();
 
3573 sub delete_warehouse {
 
3574   $lxdebug->enter_sub();
 
3576   AM->delete_warehouse(\%myconfig, \%$form);
 
3577   $form->redirect($locale->text('Warehouse deleted!'));
 
3579   $lxdebug->leave_sub();
 
3583   $lxdebug->enter_sub();
 
3585   &{ $form->{nextsub} };
 
3587   $lxdebug->leave_sub();
 
3591   $lxdebug->enter_sub();
 
3593   $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
 
3594   AM->units_in_use(\%myconfig, $form, $units);
 
3595   map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
 
3597   @languages = AM->language(\%myconfig, $form, 1);
 
3600   foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
 
3601     map({ push(@unit_list, $units->{$_}); }
 
3602         sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
 
3603              grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
 
3606   foreach (@unit_list) {
 
3607     $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"}, 5) if ($_->{"factor"});
 
3608     $_->{"UNITLANGUAGES"} = [];
 
3609     foreach my $lang (@languages) {
 
3610       push(@{ $_->{"UNITLANGUAGES"} },
 
3612              "unit" => $_->{"name"},
 
3613              "language_id" => $lang->{"id"},
 
3614              "localized" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized"},
 
3615              "localized_plural" => $_->{"LANGUAGES"}->{$lang->{"template_code"}}->{"localized_plural"},
 
3621   $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
 
3622   $ddbox = AM->unit_select_data($units, undef, 1);
 
3624   $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
 
3626   print($form->parse_html_template("am/edit_units",
 
3627                                    { "UNITS" => \@unit_list,
 
3628                                      "NEW_BASE_UNIT_DDBOX" => $ddbox,
 
3629                                      "LANGUAGES" => \@languages }));
 
3631   $lxdebug->leave_sub();
 
3635   $lxdebug->enter_sub();
 
3637   $form->isblank("new_name", $locale->text("The name is missing."));
 
3638   $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
 
3639   $all_units = AM->retrieve_units(\%myconfig, $form);
 
3640   $form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
 
3642   my ($base_unit, $factor);
 
3643   if ($form->{"new_base_unit"}) {
 
3644     $form->show_generic_error($locale->text("The base unit does not exist.")) unless (defined($units->{$form->{"new_base_unit"}}));
 
3646     $form->isblank("new_factor", $locale->text("The factor is missing."));
 
3647     $factor = $form->parse_amount(\%myconfig, $form->{"new_factor"});
 
3648     $form->show_generic_error($locale->text("The factor is missing.")) unless ($factor);
 
3649     $base_unit = $form->{"new_base_unit"};
 
3653   foreach my $lang (AM->language(\%myconfig, $form, 1)) {
 
3654     next unless ($form->{"new_localized_$lang->{id}"} || $form->{"new_localized_plural_$lang->{id}"});
 
3655     push(@languages, { "id" => $lang->{"id"},
 
3656                        "localized" => $form->{"new_localized_$lang->{id}"},
 
3657                        "localized_plural" => $form->{"new_localized_plural_$lang->{id}"},
 
3661   AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
 
3663   $form->{"saved_message"} = $locale->text("The unit has been saved.");
 
3667   $lxdebug->leave_sub();
 
3670 sub set_unit_languages {
 
3671   $lxdebug->enter_sub();
 
3673   my ($unit, $languages, $idx) = @_;
 
3675   $unit->{"LANGUAGES"} = [];
 
3677   foreach my $lang (@{$languages}) {
 
3678     push(@{ $unit->{"LANGUAGES"} },
 
3679          { "id" => $lang->{"id"},
 
3680            "localized" => $form->{"localized_${idx}_$lang->{id}"},
 
3681            "localized_plural" => $form->{"localized_plural_${idx}_$lang->{id}"},
 
3685   $lxdebug->leave_sub();
 
3689   $lxdebug->enter_sub();
 
3691   $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
 
3692   AM->units_in_use(\%myconfig, $form, $old_units);
 
3694   @languages = AM->language(\%myconfig, $form, 1);
 
3698   foreach $i (1..($form->{"rowcount"} * 1)) {
 
3699     $old_unit = $old_units->{$form->{"old_name_$i"}};
 
3701       $form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
 
3704     if ($form->{"unchangeable_$i"}) {
 
3705       $new_units->{$form->{"old_name_$i"}} = $old_units->{$form->{"old_name_$i"}};
 
3706       $new_units->{$form->{"old_name_$i"}}->{"unchanged_unit"} = 1;
 
3707       set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
 
3711     if ($old_unit->{"in_use"}) {
 
3712       $form->show_generic_error(sprintf($locale->text("The unit in row %d has been used in the meantime and cannot be changed anymore."), $i));
 
3715     if ($form->{"delete_$i"}) {
 
3716       push(@delete_units, $old_unit->{"name"});
 
3720     $form->isblank("name_$i", sprintf($locale->text("The name is missing in row %d."), $i));
 
3722     $form->show_generic_error(sprintf($locale->text("The name in row %d has already been used before."), $i)) if ($new_units->{$form->{"name_$i"}});
 
3723     my %h = map({ $_ => $form->{"${_}_$i"} } qw(name base_unit factor old_name));
 
3724     $new_units->{$form->{"name_$i"}} = \%h;
 
3725     $new_units->{$form->{"name_$i"}}->{"row"} = $i;
 
3726     set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
 
3729   foreach $unit (values(%{$new_units})) {
 
3730     next unless ($unit->{"old_name"});
 
3731     if ($unit->{"base_unit"}) {
 
3732       $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"}))
 
3733         unless (defined($new_units->{$unit->{"base_unit"}}));
 
3734       $unit->{"factor"} = $form->parse_amount(\%myconfig, $unit->{"factor"});
 
3735       $form->show_generic_error(sprintf($locale->text("The factor is missing in row %d."), $unit->{"row"})) unless ($unit->{"factor"} >= 1.0);
 
3737       $unit->{"base_unit"} = undef;
 
3738       $unit->{"factor"} = undef;
 
3742   foreach $unit (values(%{$new_units})) {
 
3743     next if ($unit->{"unchanged_unit"});
 
3745     map({ $_->{"seen"} = 0; } values(%{$new_units}));
 
3747     while ($new_unit->{"base_unit"}) {
 
3748       $new_unit->{"seen"} = 1;
 
3749       $new_unit = $new_units->{$new_unit->{"base_unit"}};
 
3750       if ($new_unit->{"seen"}) {
 
3751         $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, " .
 
3752                                                         "B's base unit is C and C's base unit is A) in row %d."), $unit->{"row"}));
 
3757   AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
 
3759   $form->{"saved_message"} = $locale->text("The units have been saved.");
 
3763   $lxdebug->leave_sub();