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 sub add    { &{"add_$form->{type}"} }
 
  44 sub edit   { &{"edit_$form->{type}"} }
 
  45 sub save   { &{"save_$form->{type}"} }
 
  46 sub delete { &{"delete_$form->{type}"} }
 
  49   $lxdebug->enter_sub();
 
  51   $form->{title}     = "Add";
 
  52   $form->{charttype} = "A";
 
  53   AM->get_account(\%myconfig, \%$form);
 
  56     "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
  57     unless $form->{callback};
 
  62   $lxdebug->leave_sub();
 
  66   $lxdebug->enter_sub();
 
  68   $form->{title} = "Edit";
 
  69   AM->get_account(\%myconfig, \%$form);
 
  71   foreach my $item (split(/:/, $form->{link})) {
 
  72     $form->{$item} = "checked";
 
  78   $lxdebug->leave_sub();
 
  82   $lxdebug->enter_sub();
 
  84   $form->{title} = $locale->text("$form->{title} Account");
 
  86   $checked{ $form->{charttype} } = "checked";
 
  87   $checked{"$form->{category}_"} = "checked";
 
  88   $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked";
 
  90   $form->{description} =~ s/\"/"/g;
 
  92   if (@{ $form->{TAXKEY} }) {
 
  93     $form->{selecttaxkey} = "<option value=0>Keine Steuer 0%\n";
 
  94     foreach $item (@{ $form->{TAXKEY} }) {
 
  95       if ($item->{taxkey} == $form->{taxkey_id}) {
 
  96         $form->{selecttaxkey} .=
 
  97           "<option value=$item->{taxkey} selected>$item->{taxdescription}\n";
 
  99         $form->{selecttaxkey} .=
 
 100           "<option value=$item->{taxkey}>$item->{taxdescription}\n";
 
 108                 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
 
 109                 <td><select name=taxkey_id>$form->{selecttaxkey}</select></td>
 
 110                 <input type=hidden name=selecttaxkey value="$form->{selecttaxkey}">
 
 113   $form->{selectustva} = "<option>\n";
 
 114   %ustva = (48 => "Steuerfrei, Zeile 48",
 
 115             51 => "Steuerpflichtig 16%, Zeile 51",
 
 116             86 => "Steuerpflichtig 7%, Zeile 86",
 
 117             91 => "Steuerfrei, Zeile 91",
 
 118             97 => "Steuerpflichtig 16%, Zeile 97",
 
 119             93 => "Steuerpflichtig 7%, Zeile 93",
 
 120             94 => "Steuerpflichtig 16%, Zeile 94",
 
 121             66 => "Vorsteuer, Zeile 66");
 
 122   foreach $item (sort({ $a <=> $b } keys %ustva)) {
 
 123     if ($item == $form->{pos_ustva}) {
 
 124       $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
 
 126       $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
 
 133                 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
 
 134                 <td><select name=pos_ustva>$form->{selectustva}</select></td>
 
 135                 <input type=hidden name=selectustva value="$form->{selectustva}">
 
 138   $form->{selecteur} = "<option>\n";
 
 139   %eur = (1  => "Umsatzerlöse",
 
 140           2  => "sonstige Erlöse",
 
 141           3  => "Privatanteile",
 
 143           5  => "Ausserordentliche Erträge",
 
 144           6  => "Vereinnahmte Umsatzst.",
 
 145           7  => "Umsatzsteuererstattungen",
 
 146           8  => "Wareneingänge",
 
 147           9  => "Löhne und Gehälter",
 
 148           10 => "Gesetzl. sozialer Aufw.",
 
 150           12 => "Gas, Strom, Wasser",
 
 151           13 => "Instandhaltung",
 
 152           14 => "Steuern, Versich., Beiträge",
 
 154           16 => "Kfz-Versicherungen",
 
 155           17 => "Sonst. Fahrtkosten",
 
 156           18 => "Werbe- und Reisekosten",
 
 157           19 => "Instandhaltung u. Werkzeuge",
 
 158           20 => "Fachzeitschriften, Bücher",
 
 159           21 => "Miete für Einrichtungen",
 
 160           22 => "Rechts- und Beratungskosten",
 
 161           23 => "Bürobedarf, Porto, Telefon",
 
 162           24 => "Sonstige Aufwendungen",
 
 163           25 => "Abschreibungen auf Anlagever.",
 
 164           26 => "Abschreibungen auf GWG",
 
 166           28 => "Umsatzsteuerzahlungen",
 
 168           30 => "Ausserordentlicher Aufwand",
 
 169           31 => "Betriebliche Steuern");
 
 170   foreach $item (sort({ $a <=> $b } keys(%eur))) {
 
 171     if ($item == $form->{pos_eur}) {
 
 172       $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
 
 174       $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
 
 181                 <th align=right>| . $locale->text('EÜR') . qq|</th>
 
 182                 <td><select name=pos_eur>$form->{selecteur}</select></td>
 
 183                 <input type=hidden name=selecteur value="$form->{selecteur}">
 
 186   $form->{selectbwa} = "<option>\n";
 
 188   %bwapos = (1  => 'Umsatzerlöse',
 
 189              2  => 'Best.Verdg.FE/UE',
 
 190              3  => 'Aktiv.Eigenleistung',
 
 191              4  => 'Mat./Wareneinkauf',
 
 192              5  => 'So.betr.Erlöse',
 
 193              10 => 'Personalkosten',
 
 195              12 => 'Betriebl.Steuern',
 
 196              13 => 'Vers./Beiträge',
 
 197              14 => 'Kfz.Kosten o.St.',
 
 198              15 => 'Werbe-Reisek.',
 
 199              16 => 'Kosten Warenabgabe',
 
 200              17 => 'Abschreibungen',
 
 201              18 => 'Rep./instandhlt.',
 
 202              19 => 'Übrige Steuern',
 
 203              20 => 'Sonst.Kosten',
 
 205              31 => 'Sonst.neutr.Aufw.',
 
 207              33 => 'Sonst.neutr.Ertrag',
 
 208              34 => 'Verr.kalk.Kosten',
 
 209              35 => 'Steuern Eink.u.Ertr.');
 
 210   foreach $item (sort({ $a <=> $b } keys %bwapos)) {
 
 211     if ($item == $form->{pos_bwa}) {
 
 212       $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
 
 214       $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
 
 221                 <th align=right>| . $locale->text('BWA') . qq|</th>
 
 222                 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
 
 223                 <input type=hidden name=selectbwa value="$form->{selectbwa}">
 
 226   $form->{selectbilanz} = "<option>\n";
 
 227   foreach $item ((1, 2, 3, 4)) {
 
 228     if ($item == $form->{pos_bilanz}) {
 
 229       $form->{selectbilanz} .= "<option value=$item selected>$item\n";
 
 231       $form->{selectbilanz} .= "<option value=$item>$item\n";
 
 238                 <th align=right>| . $locale->text('Bilanz') . qq|</th>
 
 239                 <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
 
 240                 <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
 
 243   # this is for our parser only!
 
 244   # type=submit $locale->text('Add Account')
 
 245   # type=submit $locale->text('Edit Account')
 
 252 <form method=post action=$form->{script}>
 
 254 <input type=hidden name=id value=$form->{id}>
 
 255 <input type=hidden name=type value=account>
 
 257 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
 
 258 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
 
 259 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
 
 260 <input type=hidden name=fxgain_accno_id values=$form->{fxgain_accno_id}>
 
 261 <input type=hidden name=fxloss_accno_id values=$form->{fxloss_accno_id}>
 
 263 <table border=0 width=100%>
 
 265     <th class=listtop>$form->{title}</th>
 
 272           <th align=right>| . $locale->text('Account Number') . qq|</th>
 
 273           <td><input name=accno size=20 value=$form->{accno}></td>
 
 276           <th align=right>| . $locale->text('Description') . qq|</th>
 
 277           <td><input name=description size=40 value="$form->{description}"></td>
 
 280           <th align=right>| . $locale->text('Account Type') . qq|</th>
 
 284                 <td><input name=category type=radio class=radio value=A $checked{A_}> |
 
 285     . $locale->text('Asset') . qq|\n<br>
 
 286                 <input name=category type=radio class=radio value=L $checked{L_}> |
 
 287     . $locale->text('Liability') . qq|\n<br>
 
 288                 <input name=category type=radio class=radio value=Q $checked{Q_}> |
 
 289     . $locale->text('Equity') . qq|\n<br>
 
 290                 <input name=category type=radio class=radio value=I $checked{I_}> |
 
 291     . $locale->text('Revenue') . qq|\n<br>
 
 292                 <input name=category type=radio class=radio value=E $checked{E_}> |
 
 293     . $locale->text('Expense') . qq|</td>
 
 294                 <td width=50> </td>
 
 296                 <input name=charttype type=radio class=radio value="H" $checked{H}> |
 
 297     . $locale->text('Heading') . qq|<br>
 
 298                 <input name=charttype type=radio class=radio value="A" $checked{A}> |
 
 299     . $locale->text('Account') . qq|</td>
 
 306   if ($form->{charttype} eq "A") {
 
 313       . $locale->text('Is this a summary account to record') . qq|</th>
 
 315                 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
 
 316       . $locale->text('AR')
 
 317       . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
 
 318       . $locale->text('AP')
 
 319       . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
 
 320       . $locale->text('Inventory')
 
 327           <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
 
 333                 <th align=left>| . $locale->text('Receivables') . qq|</th>
 
 334                 <th align=left>| . $locale->text('Payables') . qq|</th>
 
 335                 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
 
 336                 <th align=left>| . $locale->text('Service Items') . qq|</th>
 
 340                 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
 
 341       . $locale->text('Revenue') . qq|\n<br>
 
 342                 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
 
 343       . $locale->text('Receipt') . qq|\n<br>
 
 344                 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
 
 345       . $locale->text('Tax') . qq|
 
 348                 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
 
 349       . $locale->text('Expense/Asset') . qq|\n<br>
 
 350                 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
 
 351       . $locale->text('Payment') . qq|\n<br>
 
 352                 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
 
 353       . $locale->text('Tax') . qq|
 
 356                 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
 
 357       . $locale->text('Revenue') . qq|\n<br>
 
 358                 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
 
 359       . $locale->text('COGS') . qq|\n<br>
 
 360                 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
 
 361       . $locale->text('Tax') . qq|
 
 364                 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
 
 365       . $locale->text('Revenue') . qq|\n<br>
 
 366                 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
 
 367       . $locale->text('Expense') . qq|\n<br>
 
 368                 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
 
 369       . $locale->text('Tax') . qq|
 
 388     <td><hr size=3 noshade></td>
 
 393   $lxdebug->leave_sub();
 
 397   $lxdebug->enter_sub();
 
 401 <input name=callback type=hidden value="$form->{callback}">
 
 403 <input type=hidden name=path value=$form->{path}>
 
 404 <input type=hidden name=login value=$form->{login}>
 
 405 <input type=hidden name=password value=$form->{password}>
 
 408 <input type=submit class=submit name=action value="|
 
 409     . $locale->text('Save') . qq|">
 
 412   if ($form->{id} && $form->{orphaned}) {
 
 413     print qq|<input type=submit class=submit name=action value="|
 
 414       . $locale->text('Delete') . qq|">|;
 
 417   if ($form->{menubar}) {
 
 418     require "$form->{path}/menu.pl";
 
 429   $lxdebug->leave_sub();
 
 433   $lxdebug->enter_sub();
 
 435   $form->isblank("accno",    $locale->text('Account Number missing!'));
 
 436   $form->isblank("category", $locale->text('Account Type missing!'));
 
 438   $form->redirect($locale->text('Account saved!'))
 
 439     if (AM->save_account(\%myconfig, \%$form));
 
 440   $form->error($locale->text('Cannot save account!'));
 
 442   $lxdebug->leave_sub();
 
 446   $lxdebug->enter_sub();
 
 448   CA->all_accounts(\%myconfig, \%$form);
 
 450   $form->{title} = $locale->text('Chart of Accounts');
 
 454     "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 456   @column_index = qw(accno gifi_accno description debit credit link);
 
 458   $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
 
 459   $column_header{gifi_accno} =
 
 460     qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
 
 461   $column_header{description} =
 
 462     qq|<th>| . $locale->text('Description') . qq|</a></th>|;
 
 463   $column_header{debit}  = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
 
 464   $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
 
 465   $column_header{link}   = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
 
 468   $colspan = $#column_index + 1;
 
 475     <th class=listtop colspan=$colspan>$form->{title}</th>
 
 478   <tr class=listheading>
 
 481   map { print "$column_header{$_}\n" } @column_index;
 
 488   $callback = $form->escape($callback);
 
 490   foreach $ca (@{ $form->{CA} }) {
 
 492     $ca->{debit}  = " ";
 
 493     $ca->{credit} = " ";
 
 495     if ($ca->{amount} > 0) {
 
 497         $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
 
 499     if ($ca->{amount} < 0) {
 
 501         $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
 
 504     $ca->{link} =~ s/:/<br>/og;
 
 506     if ($ca->{charttype} eq "H") {
 
 507       print qq|<tr class=listheading>|;
 
 509       $column_data{accno} =
 
 510         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>|;
 
 511       $column_data{gifi_accno} =
 
 512         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>|;
 
 513       $column_data{description} = qq|<th>$ca->{description} </th>|;
 
 514       $column_data{debit}       = qq|<th> </th>|;
 
 515       $column_data{credit}      = qq| <th> </th>|;
 
 516       $column_data{link}        = qq|<th> </th>|;
 
 522 <tr valign=top class=listrow$i>|;
 
 523       $column_data{accno} =
 
 524         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>|;
 
 525       $column_data{gifi_accno} =
 
 526         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>|;
 
 527       $column_data{description} = qq|<td>$ca->{description} </td>|;
 
 528       $column_data{debit}       = qq|<td align=right>$ca->{debit}</td>|;
 
 529       $column_data{credit}      = qq|<td align=right>$ca->{credit}</td>|;
 
 530       $column_data{link}        = qq|<td>$ca->{link} </td>|;
 
 534     map { print "$column_data{$_}\n" } @column_index;
 
 540   <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
 
 547   $lxdebug->leave_sub();
 
 551   $lxdebug->enter_sub();
 
 553   $form->{title} = $locale->text('Delete Account');
 
 556     qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
 
 558     if ($form->{id} == $form->{$id}) {
 
 559       $form->error($locale->text('Cannot delete default account!'));
 
 563   $form->redirect($locale->text('Account deleted!'))
 
 564     if (AM->delete_account(\%myconfig, \%$form));
 
 565   $form->error($locale->text('Cannot delete account!'));
 
 567   $lxdebug->leave_sub();
 
 571   $lxdebug->enter_sub();
 
 573   @{ $form->{fields} } = (accno, description);
 
 574   $form->{table}     = "gifi";
 
 575   $form->{sortorder} = "accno";
 
 577   AM->gifi_accounts(\%myconfig, \%$form);
 
 579   $form->{title} = $locale->text('GIFI');
 
 583     "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 585   @column_index = qw(accno description);
 
 587   $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
 
 588   $column_header{description} =
 
 589     qq|<th>| . $locale->text('Description') . qq|</a></th>|;
 
 592   $colspan = $#column_index + 1;
 
 599     <th class=listtop colspan=$colspan>$form->{title}</th>
 
 602   <tr class=listheading>
 
 605   map { print "$column_header{$_}\n" } @column_index;
 
 612   $callback = $form->escape($callback);
 
 614   foreach $ca (@{ $form->{ALL} }) {
 
 620 <tr valign=top class=listrow$i>|;
 
 622     $column_data{accno} =
 
 623       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>|;
 
 624     $column_data{description} = qq|<td>$ca->{description} </td>|;
 
 626     map { print "$column_data{$_}\n" } @column_index;
 
 633     <td colspan=$colspan><hr size=3 noshade></td>
 
 641   $lxdebug->leave_sub();
 
 645   $lxdebug->enter_sub();
 
 647   $form->{title} = "Add";
 
 651     "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 658   $lxdebug->leave_sub();
 
 662   $lxdebug->enter_sub();
 
 664   $form->{title} = "Edit";
 
 666   AM->get_gifi(\%myconfig, \%$form);
 
 671   $lxdebug->leave_sub();
 
 675   $lxdebug->enter_sub();
 
 677   $form->{title} = $locale->text("$form->{title} GIFI");
 
 679   # $locale->text('Add GIFI')
 
 680   # $locale->text('Edit GIFI')
 
 682   $form->{description} =~ s/\"/"/g;
 
 689 <form method=post action=$form->{script}>
 
 691 <input type=hidden name=id value=$form->{accno}>
 
 692 <input type=hidden name=type value=gifi>
 
 696     <th class=listtop>$form->{title}</th>
 
 703           <th align=right>| . $locale->text('GIFI') . qq|</th>
 
 704           <td><input name=accno size=20 value=$form->{accno}></td>
 
 707           <th align=right>| . $locale->text('Description') . qq|</th>
 
 708           <td><input name=description size=60 value="$form->{description}"></td>
 
 714     <td colspan=2><hr size=3 noshade></td>
 
 719   $lxdebug->leave_sub();
 
 723   $lxdebug->enter_sub();
 
 727 <input name=callback type=hidden value="$form->{callback}">
 
 729 <input type=hidden name=path value=$form->{path}>
 
 730 <input type=hidden name=login value=$form->{login}>
 
 731 <input type=hidden name=password value=$form->{password}>
 
 733 <br><input type=submit class=submit name=action value="|
 
 734     . $locale->text('Save') . qq|">|;
 
 738 <input type=submit class=submit name=action value="|
 
 739       . $locale->text('Copy to COA') . qq|">
 
 742     if ($form->{accno} && $form->{orphaned}) {
 
 743       print qq|<input type=submit class=submit name=action value="|
 
 744         . $locale->text('Delete') . qq|">|;
 
 748   if ($form->{menubar}) {
 
 749     require "$form->{path}/menu.pl";
 
 760   $lxdebug->leave_sub();
 
 764   $lxdebug->enter_sub();
 
 766   $form->isblank("accno", $locale->text('GIFI missing!'));
 
 767   AM->save_gifi(\%myconfig, \%$form);
 
 768   $form->redirect($locale->text('GIFI saved!'));
 
 770   $lxdebug->leave_sub();
 
 774   $lxdebug->enter_sub();
 
 776   $form->isblank("accno", $locale->text('GIFI missing!'));
 
 778   AM->save_gifi(\%myconfig, \%$form);
 
 781   $form->{gifi_accno} = $form->{accno};
 
 782   $form->{title}      = "Add";
 
 783   $form->{charttype}  = "A";
 
 788   $lxdebug->leave_sub();
 
 792   $lxdebug->enter_sub();
 
 794   AM->delete_gifi(\%myconfig, \%$form);
 
 795   $form->redirect($locale->text('GIFI deleted!'));
 
 797   $lxdebug->leave_sub();
 
 801   $lxdebug->enter_sub();
 
 803   $form->{title} = "Add";
 
 807     "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
 808     unless $form->{callback};
 
 813   $lxdebug->leave_sub();
 
 816 sub edit_department {
 
 817   $lxdebug->enter_sub();
 
 819   $form->{title} = "Edit";
 
 821   AM->get_department(\%myconfig, \%$form);
 
 826   $lxdebug->leave_sub();
 
 829 sub list_department {
 
 830   $lxdebug->enter_sub();
 
 832   AM->departments(\%myconfig, \%$form);
 
 835     "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 837   $callback = $form->escape($form->{callback});
 
 839   $form->{title} = $locale->text('Departments');
 
 841   @column_index = qw(description cost profit);
 
 843   $column_header{description} =
 
 844       qq|<th class=listheading width=90%>|
 
 845     . $locale->text('Description')
 
 847   $column_header{cost} =
 
 848       qq|<th class=listheading nowrap>|
 
 849     . $locale->text('Cost Center')
 
 851   $column_header{profit} =
 
 852       qq|<th class=listheading nowrap>|
 
 853     . $locale->text('Profit Center')
 
 863     <th class=listtop>$form->{title}</th>
 
 869         <tr class=listheading>
 
 872   map { print "$column_header{$_}\n" } @column_index;
 
 878   foreach $ref (@{ $form->{ALL} }) {
 
 884         <tr valign=top class=listrow$i>
 
 887     $costcenter   = ($ref->{role} eq "C") ? "X" : "";
 
 888     $profitcenter = ($ref->{role} eq "P") ? "X" : "";
 
 890     $column_data{description} =
 
 891       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>|;
 
 892     $column_data{cost}   = qq|<td align=center>$costcenter</td>|;
 
 893     $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
 
 895     map { print "$column_data{$_}\n" } @column_index;
 
 907   <td><hr size=3 noshade></td>
 
 912 <form method=post action=$form->{script}>
 
 914 <input name=callback type=hidden value="$form->{callback}">
 
 916 <input type=hidden name=type value=department>
 
 918 <input type=hidden name=path value=$form->{path}>
 
 919 <input type=hidden name=login value=$form->{login}>
 
 920 <input type=hidden name=password value=$form->{password}>
 
 922 <input class=submit type=submit name=action value="|
 
 923     . $locale->text('Add') . qq|">|;
 
 925   if ($form->{menubar}) {
 
 926     require "$form->{path}/menu.pl";
 
 937   $lxdebug->leave_sub();
 
 940 sub department_header {
 
 941   $lxdebug->enter_sub();
 
 943   $form->{title} = $locale->text("$form->{title} Department");
 
 945   # $locale->text('Add Department')
 
 946   # $locale->text('Edit Department')
 
 948   $form->{description} =~ s/\"/"/g;
 
 950   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
 
 952       qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
 
 955       qq|<input name=description size=60 value="$form->{description}">|;
 
 958   $costcenter   = "checked" if $form->{role} eq "C";
 
 959   $profitcenter = "checked" if $form->{role} eq "P";
 
 966 <form method=post action=$form->{script}>
 
 968 <input type=hidden name=id value=$form->{id}>
 
 969 <input type=hidden name=type value=department>
 
 973     <th class=listtop colspan=2>$form->{title}</th>
 
 977     <th align=right>| . $locale->text('Description') . qq|</th>
 
 978     <td>$description</td>
 
 982     <td><input type=radio style=radio name=role value="C" $costcenter> |
 
 983     . $locale->text('Cost Center') . qq|
 
 984         <input type=radio style=radio name=role value="P" $profitcenter> |
 
 985     . $locale->text('Profit Center') . qq|
 
 988     <td colspan=2><hr size=3 noshade></td>
 
 993   $lxdebug->leave_sub();
 
 996 sub save_department {
 
 997   $lxdebug->enter_sub();
 
 999   $form->isblank("description", $locale->text('Description missing!'));
 
1000   AM->save_department(\%myconfig, \%$form);
 
1001   $form->redirect($locale->text('Department saved!'));
 
1003   $lxdebug->leave_sub();
 
1006 sub delete_department {
 
1007   $lxdebug->enter_sub();
 
1009   AM->delete_department(\%myconfig, \%$form);
 
1010   $form->redirect($locale->text('Department deleted!'));
 
1012   $lxdebug->leave_sub();
 
1016   $lxdebug->enter_sub();
 
1018   $form->{title} = "Add";
 
1021     "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1022     unless $form->{callback};
 
1027   $lxdebug->leave_sub();
 
1031   $lxdebug->enter_sub();
 
1033   $form->{title} = "Edit";
 
1035   AM->get_business(\%myconfig, \%$form);
 
1039   $form->{orphaned} = 1;
 
1042   $lxdebug->leave_sub();
 
1046   $lxdebug->enter_sub();
 
1048   AM->business(\%myconfig, \%$form);
 
1051     "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1053   $callback = $form->escape($form->{callback});
 
1055   $form->{title} = $locale->text('Type of Business');
 
1057   @column_index = qw(description discount customernumberinit);
 
1059   $column_header{description} =
 
1060       qq|<th class=listheading width=60%>|
 
1061     . $locale->text('Description')
 
1063   $column_header{discount} =
 
1064       qq|<th class=listheading width=10%>|
 
1065     . $locale->text('Discount')
 
1067   $column_header{customernumberinit} =
 
1068       qq|<th class=listheading>|
 
1069     . $locale->text('Customernumberinit')
 
1079     <th class=listtop>$form->{title}</th>
 
1081   <tr height="5"></tr>
 
1085         <tr class=listheading>
 
1088   map { print "$column_header{$_}\n" } @column_index;
 
1094   foreach $ref (@{ $form->{ALL} }) {
 
1100         <tr valign=top class=listrow$i>
 
1104       $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
 
1107       ? "<b>$ref->{description}</b>"
 
1108       : "$ref->{description}";
 
1109     $column_data{description} =
 
1110       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>|;
 
1111     $column_data{discount}           = qq|<td align=right>$discount</td>|;
 
1112     $column_data{customernumberinit} =
 
1113       qq|<td align=right>$ref->{customernumberinit}</td>|;
 
1115     map { print "$column_data{$_}\n" } @column_index;
 
1127   <td><hr size=3 noshade></td>
 
1132 <form method=post action=$form->{script}>
 
1134 <input name=callback type=hidden value="$form->{callback}">
 
1136 <input type=hidden name=type value=business>
 
1138 <input type=hidden name=path value=$form->{path}>
 
1139 <input type=hidden name=login value=$form->{login}>
 
1140 <input type=hidden name=password value=$form->{password}>
 
1142 <input class=submit type=submit name=action value="|
 
1143     . $locale->text('Add') . qq|">|;
 
1145   if ($form->{menubar}) {
 
1146     require "$form->{path}/menu.pl";
 
1158   $lxdebug->leave_sub();
 
1161 sub business_header {
 
1162   $lxdebug->enter_sub();
 
1164   $form->{title}    = $locale->text("$form->{title} Business");
 
1165   $form->{salesman} = "checked" if $form->{salesman};
 
1167   # $locale->text('Add Business')
 
1168   # $locale->text('Edit Business')
 
1170   $form->{description} =~ s/\"/"/g;
 
1172     $form->format_amount(\%myconfig, $form->{discount} * 100);
 
1179 <form method=post action=$form->{script}>
 
1181 <input type=hidden name=id value=$form->{id}>
 
1182 <input type=hidden name=type value=business>
 
1186     <th class=listtop colspan=2>$form->{title}</th>
 
1188   <tr height="5"></tr>
 
1190     <th align=right>| . $locale->text('Type of Business') . qq|</th>
 
1191     <td><input name=description size=30 value="$form->{description}"></td>
 
1194     <th align=right>| . $locale->text('Discount') . qq| %</th>
 
1195     <td><input name=discount size=5 value=$form->{discount}></td>
 
1198     <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
 
1199     <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
 
1202     <td align=right>| . $locale->text('Salesman') . qq|</td>
 
1203     <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
 
1205   <td colspan=2><hr size=3 noshade></td>
 
1210   $lxdebug->leave_sub();
 
1214   $lxdebug->enter_sub();
 
1216   $form->isblank("description", $locale->text('Description missing!'));
 
1217   AM->save_business(\%myconfig, \%$form);
 
1218   $form->redirect($locale->text('Business saved!'));
 
1220   $lxdebug->leave_sub();
 
1223 sub delete_business {
 
1224   $lxdebug->enter_sub();
 
1226   AM->delete_business(\%myconfig, \%$form);
 
1227   $form->redirect($locale->text('Business deleted!'));
 
1229   $lxdebug->leave_sub();
 
1233   $lxdebug->enter_sub();
 
1235   $form->{title} = "Add";
 
1238     "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1239     unless $form->{callback};
 
1244   $lxdebug->leave_sub();
 
1248   $lxdebug->enter_sub();
 
1250   $form->{title} = "Edit";
 
1252   AM->get_sic(\%myconfig, \%$form);
 
1256   $form->{orphaned} = 1;
 
1259   $lxdebug->leave_sub();
 
1263   $lxdebug->enter_sub();
 
1265   AM->sic(\%myconfig, \%$form);
 
1268     "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1270   $callback = $form->escape($form->{callback});
 
1272   $form->{title} = $locale->text('Standard Industrial Codes');
 
1274   @column_index = qw(code description);
 
1276   $column_header{code} =
 
1277     qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
 
1278   $column_header{description} =
 
1279     qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
 
1288     <th class=listtop>$form->{title}</th>
 
1290   <tr height="5"></tr>
 
1294         <tr class=listheading>
 
1297   map { print "$column_header{$_}\n" } @column_index;
 
1303   foreach $ref (@{ $form->{ALL} }) {
 
1308     if ($ref->{sictype} eq 'H') {
 
1310         <tr valign=top class=listheading>
 
1312       $column_data{code} =
 
1313         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>|;
 
1314       $column_data{description} = qq|<th>$ref->{description}</th>|;
 
1318         <tr valign=top class=listrow$i>
 
1321       $column_data{code} =
 
1322         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>|;
 
1323       $column_data{description} = qq|<td>$ref->{description}</td>|;
 
1327     map { print "$column_data{$_}\n" } @column_index;
 
1339   <td><hr size=3 noshade></td>
 
1344 <form method=post action=$form->{script}>
 
1346 <input name=callback type=hidden value="$form->{callback}">
 
1348 <input type=hidden name=type value=sic>
 
1350 <input type=hidden name=path value=$form->{path}>
 
1351 <input type=hidden name=login value=$form->{login}>
 
1352 <input type=hidden name=password value=$form->{password}>
 
1354 <input class=submit type=submit name=action value="|
 
1355     . $locale->text('Add') . qq|">|;
 
1357   if ($form->{menubar}) {
 
1358     require "$form->{path}/menu.pl";
 
1369   $lxdebug->leave_sub();
 
1373   $lxdebug->enter_sub();
 
1375   $form->{title} = $locale->text("$form->{title} SIC");
 
1377   # $locale->text('Add SIC')
 
1378   # $locale->text('Edit SIC')
 
1380   $form->{code}        =~ s/\"/"/g;
 
1381   $form->{description} =~ s/\"/"/g;
 
1383   $checked = ($form->{sictype} eq 'H') ? "checked" : "";
 
1390 <form method=post action=$form->{script}>
 
1392 <input type=hidden name=type value=sic>
 
1393 <input type=hidden name=id value=$form->{code}>
 
1397     <th class=listtop colspan=2>$form->{title}</th>
 
1399   <tr height="5"></tr>
 
1401     <th align=right>| . $locale->text('Code') . qq|</th>
 
1402     <td><input name=code size=10 value=$form->{code}></td>
 
1406     <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
 
1407     . $locale->text('Heading') . qq|</th>
 
1410     <th align=right>| . $locale->text('Description') . qq|</th>
 
1411     <td><input name=description size=60 value="$form->{description}"></td>
 
1413     <td colspan=2><hr size=3 noshade></td>
 
1418   $lxdebug->leave_sub();
 
1422   $lxdebug->enter_sub();
 
1424   $form->isblank("code",        $locale->text('Code missing!'));
 
1425   $form->isblank("description", $locale->text('Description missing!'));
 
1426   AM->save_sic(\%myconfig, \%$form);
 
1427   $form->redirect($locale->text('SIC saved!'));
 
1429   $lxdebug->leave_sub();
 
1433   $lxdebug->enter_sub();
 
1435   AM->delete_sic(\%myconfig, \%$form);
 
1436   $form->redirect($locale->text('SIC deleted!'));
 
1438   $lxdebug->leave_sub();
 
1441 sub display_stylesheet {
 
1442   $lxdebug->enter_sub();
 
1444   $form->{file} = "css/$myconfig{stylesheet}";
 
1447   $lxdebug->leave_sub();
 
1451   $lxdebug->enter_sub();
 
1453   $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
 
1454   $form->{file} =~ s/^\/*//g;
 
1455   $form->{file} =~ s/$userspath//;
 
1457   $form->error("$!: $form->{file}") unless -f $form->{file};
 
1459   AM->load_template(\%$form);
 
1461   $form->{title} = $form->{file};
 
1463   # if it is anything but html
 
1464   if ($form->{file} !~ /\.html$/) {
 
1465     $form->{body} = "<pre>\n$form->{body}\n</pre>";
 
1475 <form method=post action=$form->{script}>
 
1477 <input name=file type=hidden value=$form->{file}>
 
1478 <input name=type type=hidden value=template>
 
1480 <input type=hidden name=path value=$form->{path}>
 
1481 <input type=hidden name=login value=$form->{login}>
 
1482 <input type=hidden name=password value=$form->{password}>
 
1484 <input name=action type=submit class=submit value="|
 
1485     . $locale->text('Edit') . qq|">|;
 
1487   if ($form->{menubar}) {
 
1488     require "$form->{path}/menu.pl";
 
1499   $lxdebug->leave_sub();
 
1503   $lxdebug->enter_sub();
 
1505   AM->load_template(\%$form);
 
1507   $form->{title} = $locale->text('Edit Template');
 
1509   # convert   to &nbsp;
 
1510   $form->{body} =~ s/ /&nbsp;/gi;
 
1517 <form method=post action=$form->{script}>
 
1519 <input name=file type=hidden value=$form->{file}>
 
1520 <input name=type type=hidden value=template>
 
1522 <input type=hidden name=path value=$form->{path}>
 
1523 <input type=hidden name=login value=$form->{login}>
 
1524 <input type=hidden name=password value=$form->{password}>
 
1526 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
 
1528 <textarea name=body rows=25 cols=70>
 
1533 <input type=submit class=submit name=action value="|
 
1534     . $locale->text('Save') . qq|">|;
 
1536   if ($form->{menubar}) {
 
1537     require "$form->{path}/menu.pl";
 
1549   $lxdebug->leave_sub();
 
1553   $lxdebug->enter_sub();
 
1555   AM->save_template(\%$form);
 
1556   $form->redirect($locale->text('Template saved!'));
 
1558   $lxdebug->leave_sub();
 
1562   $lxdebug->enter_sub();
 
1564   # get defaults for account numbers and last numbers
 
1565   AM->defaultaccounts(\%myconfig, \%$form);
 
1567   foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
 
1569       ($item eq $myconfig{dateformat})
 
1570       ? "<option selected>$item\n"
 
1571       : "<option>$item\n";
 
1574   foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
 
1576       ($item eq $myconfig{numberformat})
 
1577       ? "<option selected>$item\n"
 
1578       : "<option>$item\n";
 
1581   foreach $item (qw(name company address signature)) {
 
1582     $myconfig{$item} =~ s/\"/"/g;
 
1585   foreach $item (qw(address signature)) {
 
1586     $myconfig{$item} =~ s/\\n/\r\n/g;
 
1589   %countrycodes = User->country_codes;
 
1591   foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
 
1595       ($myconfig{countrycode} eq $key)
 
1596       ? "<option selected value=$key>$countrycodes{$key}\n"
 
1597       : "<option value=$key>$countrycodes{$key}\n";
 
1599   $countrycodes = "<option>American English\n$countrycodes";
 
1601   foreach $key (keys %{ $form->{IC} }) {
 
1602     foreach $accno (sort keys %{ $form->{IC}{$key} }) {
 
1604         ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
 
1605         ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
 
1606         : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
 
1610   opendir CSS, "css/.";
 
1611   @all = grep /.*\.css$/, readdir CSS;
 
1614   foreach $item (@all) {
 
1615     if ($item eq $myconfig{stylesheet}) {
 
1616       $selectstylesheet .= qq|<option selected>$item\n|;
 
1618       $selectstylesheet .= qq|<option>$item\n|;
 
1621   $selectstylesheet .= "<option>\n";
 
1623   $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
 
1627   if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
 
1628   else { $newS = "checked"; }
 
1633 <form method=post action=$form->{script}>
 
1635 <input type=hidden name=old_password value=$myconfig{password}>
 
1636 <input type=hidden name=type value=preferences>
 
1637 <input type=hidden name=role value=$myconfig{role}>
 
1640   <tr><th class=listtop>$form->{title}</th></tr>
 
1645           <th align=right>| . $locale->text('Name') . qq|</th>
 
1646           <td><input name=name size=15 value="$myconfig{name}"></td>
 
1649           <th align=right>| . $locale->text('Password') . qq|</th>
 
1650           <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
 
1653           <th align=right>| . $locale->text('E-mail') . qq|</th>
 
1654           <td><input name=email size=30 value="$myconfig{email}"></td>
 
1657           <th align=right>| . $locale->text('Signature') . qq|</th>
 
1658           <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
 
1661           <th align=right>| . $locale->text('Phone') . qq|</th>
 
1662           <td><input name=tel size=14 value="$myconfig{tel}"></td>
 
1665           <th align=right>| . $locale->text('Fax') . qq|</th>
 
1666           <td><input name=fax size=14 value="$myconfig{fax}"></td>
 
1669           <th align=right>| . $locale->text('Company') . qq|</th>
 
1670           <td><input name=company size=30 value="$myconfig{company}"></td>
 
1673           <th align=right>| . $locale->text('Address') . qq|</th>
 
1674           <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
 
1677           <th align=right>| . $locale->text('Date Format') . qq|</th>
 
1678           <td><select name=dateformat>$dateformat</select></td>
 
1681           <th align=right>| . $locale->text('Number Format') . qq|</th>
 
1682           <td><select name=numberformat>$numberformat</select></td>
 
1685           <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
 
1686           <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
 
1689           <th align=right>| . $locale->text('Language') . qq|</th>
 
1690           <td><select name=countrycode>$countrycodes</select></td>
 
1693           <th align=right>| . $locale->text('Character Set') . qq|</th>
 
1694           <td><input name=charset size=20 value="$myconfig{charset}"></td>
 
1697           <th align=right>| . $locale->text('Stylesheet') . qq|</th>
 
1698           <td><select name=usestylesheet>$selectstylesheet</select></td>
 
1701           <th align=right>| . $locale->text('Setup Menu') . qq|</th>
 
1702           <td><input name=menustyle type=radio class=radio value=neu $newS> New
 
1703                   <input name=menustyle type=radio class=radio value=old $oldS> Old</td>
 
1705         <input name=printer type=hidden value="$myconfig{printer}">
 
1706         <tr class=listheading>
 
1707           <th colspan=2> </th>
 
1710           <th align=right>| . $locale->text('Business Number') . qq|</th>
 
1711           <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
 
1717                 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
 
1718                 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
 
1719                 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
 
1720                 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
 
1725         <tr class=listheading>
 
1727     . $locale->text('Last Numbers & Default Accounts') . qq|</th>
 
1733                 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
 
1734                 <td><select name=inventory_accno>$myconfig{IC}</select></td>
 
1737                 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
 
1738                 <td><select name=income_accno>$myconfig{IC_income}</select></td>
 
1741                 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
 
1742                 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
 
1745                 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
 
1746                 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
 
1749                 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
 
1750                 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
 
1755     'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
 
1757     . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
 
1766                 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
 
1767                 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
 
1768                 <th align=right nowrap>|
 
1769     . $locale->text('Last Customer Number') . qq|</th>
 
1770                 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
 
1773                 <th align=right nowrap>|
 
1774     . $locale->text('Last Sales Order Number') . qq|</th>
 
1775                 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
 
1776                 <th align=right nowrap>|
 
1777     . $locale->text('Last Vendor Number') . qq|</th>
 
1778                 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
 
1781                 <th align=right nowrap>|
 
1782     . $locale->text('Last Purchase Order Number') . qq|</th>
 
1783                 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
 
1784                 <th align=right nowrap>|
 
1785     . $locale->text('Last Article Number') . qq|</th>
 
1786                 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
 
1789                 <th align=right nowrap>|
 
1790     . $locale->text('Last Sales Quotation Number') . qq|</th>
 
1791                 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
 
1792                 <th align=right nowrap>|
 
1793     . $locale->text('Last Service Number') . qq|</th>
 
1794                 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
 
1797                 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
 
1798                 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
 
1799                 <th align=right nowrap></th>
 
1805         <tr class=listheading>
 
1806           <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
 
1813                 <th>| . $locale->text('Rate') . qq| (%)</th>
 
1814                 <th>| . $locale->text('Number') . qq|</th>
 
1818   foreach $accno (sort keys %{ $form->{taxrates} }) {
 
1821                 <th align=right>$form->{taxrates}{$accno}{description}</th>
 
1822                 <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
 
1823                 <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
 
1826     $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
 
1829   chop $form->{taxaccounts};
 
1832 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
 
1841     <td><hr size=3 noshade></td>
 
1845 <input type=hidden name=path value=$form->{path}>
 
1846 <input type=hidden name=login value=$form->{login}>
 
1847 <input type=hidden name=password value=$form->{password}>
 
1850 <input type=submit class=submit name=action value="|
 
1851     . $locale->text('Save') . qq|">|;
 
1853   if ($form->{menubar}) {
 
1854     require "$form->{path}/menu.pl";
 
1865   $lxdebug->leave_sub();
 
1868 sub save_preferences {
 
1869   $lxdebug->enter_sub();
 
1871   $form->{stylesheet} = $form->{usestylesheet};
 
1873   $form->redirect($locale->text('Preferences saved!'))
 
1875      AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
 
1877   $form->error($locale->text('Cannot save preferences!'));
 
1879   $lxdebug->leave_sub();
 
1883   $lxdebug->enter_sub();
 
1885   if ($form->{media} eq 'email') {
 
1886     $form->error($locale->text('No email address for') . " $myconfig{name}")
 
1887       unless ($myconfig{email});
 
1889     $form->{OUT} = "$sendmail";
 
1893   AM->backup(\%myconfig, \%$form, $userspath);
 
1895   if ($form->{media} eq 'email') {
 
1896     $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
 
1899   $lxdebug->leave_sub();
 
1903   $lxdebug->enter_sub();
 
1905   $form->{title} = $locale->text('Audit Control');
 
1907   AM->closedto(\%myconfig, \%$form);
 
1909   if ($form->{revtrans}) {
 
1910     $checked{Y} = "checked";
 
1912     $checked{N} = "checked";
 
1920 <form method=post action=$form->{script}>
 
1922 <input type=hidden name=path value=$form->{path}>
 
1923 <input type=hidden name=login value=$form->{login}>
 
1924 <input type=hidden name=password value=$form->{password}>
 
1927   <tr><th class=listtop>$form->{title}</th></tr>
 
1928   <tr height="5"></tr>
 
1934     . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
 
1935           <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
 
1936     . $locale->text('Yes')
 
1937     . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
 
1938     . $locale->text('No')
 
1942           <th>| . $locale->text('Close Books up to') . qq|</th>
 
1943           <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
 
1953 <input type=hidden name=nextsub value=doclose>
 
1955 <input type=submit class=submit name=action value="|
 
1956     . $locale->text('Continue') . qq|">
 
1964   $lxdebug->leave_sub();
 
1968   $lxdebug->enter_sub();
 
1970   AM->closebooks(\%myconfig, \%$form);
 
1972   if ($form->{revtrans}) {
 
1974                  $locale->text('Transaction reversal enforced for all dates'));
 
1976     if ($form->{closedto}) {
 
1978                      $locale->text('Transaction reversal enforced up to') . " "
 
1979                        . $locale->date(\%myconfig, $form->{closedto}, 1));
 
1981       $form->redirect($locale->text('Books are open'));
 
1985   $lxdebug->leave_sub();
 
1989   $lxdebug->enter_sub();
 
1991   $form->{title} = "Add";
 
1994     "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1995     unless $form->{callback};
 
2000   $lxdebug->leave_sub();
 
2003 sub edit_warehouse {
 
2004   $lxdebug->enter_sub();
 
2006   $form->{title} = "Edit";
 
2008   AM->get_warehouse(\%myconfig, \%$form);
 
2013   $lxdebug->leave_sub();
 
2016 sub list_warehouse {
 
2017   $lxdebug->enter_sub();
 
2019   AM->warehouses(\%myconfig, \%$form);
 
2022     "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
2024   $callback = $form->escape($form->{callback});
 
2026   $form->{title} = $locale->text('Warehouses');
 
2028   @column_index = qw(description);
 
2030   $column_header{description} =
 
2031       qq|<th class=listheading width=100%>|
 
2032     . $locale->text('Description')
 
2042     <th class=listtop>$form->{title}</th>
 
2044   <tr height="5"></tr>
 
2048         <tr class=listheading>
 
2051   map { print "$column_header{$_}\n" } @column_index;
 
2057   foreach $ref (@{ $form->{ALL} }) {
 
2063         <tr valign=top class=listrow$i>
 
2066     $column_data{description} =
 
2067       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>|;
 
2069     map { print "$column_data{$_}\n" } @column_index;
 
2081   <td><hr size=3 noshade></td>
 
2086 <form method=post action=$form->{script}>
 
2088 <input name=callback type=hidden value="$form->{callback}">
 
2090 <input type=hidden name=type value=warehouse>
 
2092 <input type=hidden name=path value=$form->{path}>
 
2093 <input type=hidden name=login value=$form->{login}>
 
2094 <input type=hidden name=password value=$form->{password}>
 
2096 <input class=submit type=submit name=action value="|
 
2097     . $locale->text('Add') . qq|">|;
 
2099   if ($form->{menubar}) {
 
2100     require "$form->{path}/menu.pl";
 
2111   $lxdebug->leave_sub();
 
2114 sub warehouse_header {
 
2115   $lxdebug->enter_sub();
 
2117   $form->{title} = $locale->text("$form->{title} Warehouse");
 
2119   # $locale->text('Add Warehouse')
 
2120   # $locale->text('Edit Warehouse')
 
2122   $form->{description} =~ s/\"/"/g;
 
2124   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
 
2126       qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
 
2129       qq|<input name=description size=60 value="$form->{description}">|;
 
2137 <form method=post action=$form->{script}>
 
2139 <input type=hidden name=id value=$form->{id}>
 
2140 <input type=hidden name=type value=warehouse>
 
2144     <th class=listtop colspan=2>$form->{title}</th>
 
2146   <tr height="5"></tr>
 
2148     <th align=right>| . $locale->text('Description') . qq|</th>
 
2149     <td>$description</td>
 
2152     <td colspan=2><hr size=3 noshade></td>
 
2157   $lxdebug->leave_sub();
 
2160 sub save_warehouse {
 
2161   $lxdebug->enter_sub();
 
2163   $form->isblank("description", $locale->text('Description missing!'));
 
2164   AM->save_warehouse(\%myconfig, \%$form);
 
2165   $form->redirect($locale->text('Warehouse saved!'));
 
2167   $lxdebug->leave_sub();
 
2170 sub delete_warehouse {
 
2171   $lxdebug->enter_sub();
 
2173   AM->delete_warehouse(\%myconfig, \%$form);
 
2174   $form->redirect($locale->text('Warehouse deleted!'));
 
2176   $lxdebug->leave_sub();
 
2180   $lxdebug->enter_sub();
 
2182   &{ $form->{nextsub} };
 
2184   $lxdebug->leave_sub();