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 = (41  => "Steuerfrei IGL a. Abnehmer m. UStID (§4 Nr. 1b UStG), Nr. 41",
 
 115             44  => "Steuerfrei IGL n. Fahrz. o. UStID (§4 Nr. 1b UStG), Nr. 44",
 
 116             49  => "Steuerfrei IGL n. Fahrz. a. Unternehmen (§2a UStG), Nr. 49",
 
 117             43  => "Weit Steuerfreie Umsätze m. VSt Abzug (Ausfuhr, Umsätze §4 Nr.2-7 UStG), Nr. 43",
 
 118             48  => "Steuerfreie Umsätze ohne VSt.abzug (§4 Nr.8-28 UStG), Nr. 48",
 
 119             51  => "Steuerpflichtige Umsätze 16%, Nr. 51",
 
 120             511 => "Steuerpflichtige Umsätze 16%, Nr. 51 rechts",
 
 121             86  => "Steuerpflichtige Umsätze 7%, Nr. 86",
 
 122             861 => "Steuerpflichtige Umsätze 7%, Nr. 86 rechts",
 
 127             91  => "Steuerfrei, Nr. 91",
 
 128             97  => "Steuerpflichtig 16%, Nr. 97",
 
 129             971 => "Steuerpflichtig 16%, Nr. 97 rechts",
 
 130             93  => "Steuerpflichtig 7%, Nr. 93",
 
 131             931 => "Steuerpflichtig 7%, Nr. 93 rechts",
 
 133             94  => "Steuerpflichtig 16%, Nr. 94",            
 
 145             66  => "Abziehbare Vorsteuerbeträge, Nr. 66",
 
 154   foreach $item (sort({ $a <=> $b } keys %ustva)) {
 
 155     if ($item == $form->{pos_ustva}) {
 
 156       $form->{selectustva} .= "<option value=$item selected>$ustva{$item}\n";
 
 158       $form->{selectustva} .= "<option value=$item>$ustva{$item}\n";
 
 165                 <th align=right>| . $locale->text('Umsatzsteuervoranmeldung') . qq|</th>
 
 166                 <td><select name=pos_ustva>$form->{selectustva}</select></td>
 
 167                 <input type=hidden name=selectustva value="$form->{selectustva}">
 
 170   $form->{selecteur} = "<option>\n";
 
 171   %eur = (1  => "Umsatzerlöse",
 
 172           2  => "sonstige Erlöse",
 
 173           3  => "Privatanteile",
 
 175           5  => "Ausserordentliche Erträge",
 
 176           6  => "Vereinnahmte Umsatzst.",
 
 177           7  => "Umsatzsteuererstattungen",
 
 178           8  => "Wareneingänge",
 
 179           9  => "Löhne und Gehälter",
 
 180           10 => "Gesetzl. sozialer Aufw.",
 
 182           12 => "Gas, Strom, Wasser",
 
 183           13 => "Instandhaltung",
 
 184           14 => "Steuern, Versich., Beiträge",
 
 186           16 => "Kfz-Versicherungen",
 
 187           17 => "Sonst. Fahrtkosten",
 
 188           18 => "Werbe- und Reisekosten",
 
 189           19 => "Instandhaltung u. Werkzeuge",
 
 190           20 => "Fachzeitschriften, Bücher",
 
 191           21 => "Miete für Einrichtungen",
 
 192           22 => "Rechts- und Beratungskosten",
 
 193           23 => "Bürobedarf, Porto, Telefon",
 
 194           24 => "Sonstige Aufwendungen",
 
 195           25 => "Abschreibungen auf Anlagever.",
 
 196           26 => "Abschreibungen auf GWG",
 
 198           28 => "Umsatzsteuerzahlungen",
 
 200           30 => "Ausserordentlicher Aufwand",
 
 201           31 => "Betriebliche Steuern");
 
 202   foreach $item (sort({ $a <=> $b } keys(%eur))) {
 
 203     if ($item == $form->{pos_eur}) {
 
 204       $form->{selecteur} .= "<option value=$item selected>$eur{$item}\n";
 
 206       $form->{selecteur} .= "<option value=$item>$eur{$item}\n";
 
 213                 <th align=right>| . $locale->text('EÜR') . qq|</th>
 
 214                 <td><select name=pos_eur>$form->{selecteur}</select></td>
 
 215                 <input type=hidden name=selecteur value="$form->{selecteur}">
 
 218   $form->{selectbwa} = "<option>\n";
 
 220   %bwapos = (1  => 'Umsatzerlöse',
 
 221              2  => 'Best.Verdg.FE/UE',
 
 222              3  => 'Aktiv.Eigenleistung',
 
 223              4  => 'Mat./Wareneinkauf',
 
 224              5  => 'So.betr.Erlöse',
 
 225              10 => 'Personalkosten',
 
 227              12 => 'Betriebl.Steuern',
 
 228              13 => 'Vers./Beiträge',
 
 229              14 => 'Kfz.Kosten o.St.',
 
 230              15 => 'Werbe-Reisek.',
 
 231              16 => 'Kosten Warenabgabe',
 
 232              17 => 'Abschreibungen',
 
 233              18 => 'Rep./instandhlt.',
 
 234              19 => 'Übrige Steuern',
 
 235              20 => 'Sonst.Kosten',
 
 237              31 => 'Sonst.neutr.Aufw.',
 
 239              33 => 'Sonst.neutr.Ertrag',
 
 240              34 => 'Verr.kalk.Kosten',
 
 241              35 => 'Steuern Eink.u.Ertr.');
 
 242   foreach $item (sort({ $a <=> $b } keys %bwapos)) {
 
 243     if ($item == $form->{pos_bwa}) {
 
 244       $form->{selectbwa} .= "<option value=$item selected>$bwapos{$item}\n";
 
 246       $form->{selectbwa} .= "<option value=$item>$bwapos{$item}\n";
 
 253                 <th align=right>| . $locale->text('BWA') . qq|</th>
 
 254                 <td><select name=pos_bwa>$form->{selectbwa}</select></td>
 
 255                 <input type=hidden name=selectbwa value="$form->{selectbwa}">
 
 258   $form->{selectbilanz} = "<option>\n";
 
 259   foreach $item ((1, 2, 3, 4)) {
 
 260     if ($item == $form->{pos_bilanz}) {
 
 261       $form->{selectbilanz} .= "<option value=$item selected>$item\n";
 
 263       $form->{selectbilanz} .= "<option value=$item>$item\n";
 
 270                 <th align=right>| . $locale->text('Bilanz') . qq|</th>
 
 271                 <td><select name=pos_bilanz>$form->{selectbilanz}</select></td>
 
 272                 <input type=hidden name=selectbilanz value="$form->{selectbilanz}">
 
 275   # this is for our parser only!
 
 276   # type=submit $locale->text('Add Account')
 
 277   # type=submit $locale->text('Edit Account')
 
 284 <form method=post action=$form->{script}>
 
 286 <input type=hidden name=id value=$form->{id}>
 
 287 <input type=hidden name=type value=account>
 
 289 <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
 
 290 <input type=hidden name=income_accno_id value=$form->{income_accno_id}>
 
 291 <input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
 
 292 <input type=hidden name=fxgain_accno_id values=$form->{fxgain_accno_id}>
 
 293 <input type=hidden name=fxloss_accno_id values=$form->{fxloss_accno_id}>
 
 295 <table border=0 width=100%>
 
 297     <th class=listtop>$form->{title}</th>
 
 304           <th align=right>| . $locale->text('Account Number') . qq|</th>
 
 305           <td><input name=accno size=20 value=$form->{accno}></td>
 
 308           <th align=right>| . $locale->text('Description') . qq|</th>
 
 309           <td><input name=description size=40 value="$form->{description}"></td>
 
 312           <th align=right>| . $locale->text('Account Type') . qq|</th>
 
 316                 <td><input name=category type=radio class=radio value=A $checked{A_}> |
 
 317     . $locale->text('Asset') . qq|\n<br>
 
 318                 <input name=category type=radio class=radio value=L $checked{L_}> |
 
 319     . $locale->text('Liability') . qq|\n<br>
 
 320                 <input name=category type=radio class=radio value=I $checked{I_}> |
 
 321     . $locale->text('Revenue') . qq|\n<br>
 
 322                 <input name=category type=radio class=radio value=E $checked{E_}> |
 
 323     . $locale->text('Expense') . qq|</td>
 
 324                 <td width=50> </td>
 
 326                 <input name=charttype type=radio class=radio value="H" $checked{H}> |
 
 327     . $locale->text('Heading') . qq|<br>
 
 328                 <input name=charttype type=radio class=radio value="A" $checked{A}> |
 
 329     . $locale->text('Account') . qq|</td>
 
 336   if ($form->{charttype} eq "A") {
 
 343       . $locale->text('Is this a summary account to record') . qq|</th>
 
 345                 <input name=AR type=checkbox class=checkbox value=AR $form->{AR}> |
 
 346       . $locale->text('AR')
 
 347       . qq| <input name=AP type=checkbox class=checkbox value=AP $form->{AP}> |
 
 348       . $locale->text('AP')
 
 349       . qq| <input name=IC type=checkbox class=checkbox value=IC $form->{IC}> |
 
 350       . $locale->text('Inventory')
 
 357           <th colspan=2>| . $locale->text('Include in drop-down menus') . qq|</th>
 
 363                 <th align=left>| . $locale->text('Receivables') . qq|</th>
 
 364                 <th align=left>| . $locale->text('Payables') . qq|</th>
 
 365                 <th align=left>| . $locale->text('Parts Inventory') . qq|</th>
 
 366                 <th align=left>| . $locale->text('Service Items') . qq|</th>
 
 370                 <input name=AR_amount type=checkbox class=checkbox value=AR_amount $form->{AR_amount}> |
 
 371       . $locale->text('Revenue') . qq|\n<br>
 
 372                 <input name=AR_paid type=checkbox class=checkbox value=AR_paid $form->{AR_paid}> |
 
 373       . $locale->text('Receipt') . qq|\n<br>
 
 374                 <input name=AR_tax type=checkbox class=checkbox value=AR_tax $form->{AR_tax}> |
 
 375       . $locale->text('Tax') . qq|
 
 378                 <input name=AP_amount type=checkbox class=checkbox value=AP_amount $form->{AP_amount}> |
 
 379       . $locale->text('Expense/Asset') . qq|\n<br>
 
 380                 <input name=AP_paid type=checkbox class=checkbox value=AP_paid $form->{AP_paid}> |
 
 381       . $locale->text('Payment') . qq|\n<br>
 
 382                 <input name=AP_tax type=checkbox class=checkbox value=AP_tax $form->{AP_tax}> |
 
 383       . $locale->text('Tax') . qq|
 
 386                 <input name=IC_sale type=checkbox class=checkbox value=IC_sale $form->{IC_sale}> |
 
 387       . $locale->text('Revenue') . qq|\n<br>
 
 388                 <input name=IC_cogs type=checkbox class=checkbox value=IC_cogs $form->{IC_cogs}> |
 
 389       . $locale->text('COGS') . qq|\n<br>
 
 390                 <input name=IC_taxpart type=checkbox class=checkbox value=IC_taxpart $form->{IC_taxpart}> |
 
 391       . $locale->text('Tax') . qq|
 
 394                 <input name=IC_income type=checkbox class=checkbox value=IC_income $form->{IC_income}> |
 
 395       . $locale->text('Revenue') . qq|\n<br>
 
 396                 <input name=IC_expense type=checkbox class=checkbox value=IC_expense $form->{IC_expense}> |
 
 397       . $locale->text('Expense') . qq|\n<br>
 
 398                 <input name=IC_taxservice type=checkbox class=checkbox value=IC_taxservice $form->{IC_taxservice}> |
 
 399       . $locale->text('Tax') . qq|
 
 418     <td><hr size=3 noshade></td>
 
 423   $lxdebug->leave_sub();
 
 427   $lxdebug->enter_sub();
 
 431 <input name=callback type=hidden value="$form->{callback}">
 
 433 <input type=hidden name=path value=$form->{path}>
 
 434 <input type=hidden name=login value=$form->{login}>
 
 435 <input type=hidden name=password value=$form->{password}>
 
 438 <input type=submit class=submit name=action value="|
 
 439     . $locale->text('Save') . qq|">
 
 442   if ($form->{id} && $form->{orphaned}) {
 
 443     print qq|<input type=submit class=submit name=action value="|
 
 444       . $locale->text('Delete') . qq|">|;
 
 447   if ($form->{menubar}) {
 
 448     require "$form->{path}/menu.pl";
 
 459   $lxdebug->leave_sub();
 
 463   $lxdebug->enter_sub();
 
 465   $form->isblank("accno",    $locale->text('Account Number missing!'));
 
 466   $form->isblank("category", $locale->text('Account Type missing!'));
 
 468   $form->redirect($locale->text('Account saved!'))
 
 469     if (AM->save_account(\%myconfig, \%$form));
 
 470   $form->error($locale->text('Cannot save account!'));
 
 472   $lxdebug->leave_sub();
 
 476   $lxdebug->enter_sub();
 
 478   CA->all_accounts(\%myconfig, \%$form);
 
 480   $form->{title} = $locale->text('Chart of Accounts');
 
 484     "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 486   @column_index = qw(accno gifi_accno description debit credit link);
 
 488   $column_header{accno} = qq|<th>| . $locale->text('Account') . qq|</a></th>|;
 
 489   $column_header{gifi_accno} =
 
 490     qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
 
 491   $column_header{description} =
 
 492     qq|<th>| . $locale->text('Description') . qq|</a></th>|;
 
 493   $column_header{debit}  = qq|<th>| . $locale->text('Debit') . qq|</a></th>|;
 
 494   $column_header{credit} = qq|<th>| . $locale->text('Credit') . qq|</a></th>|;
 
 495   $column_header{link}   = qq|<th>| . $locale->text('Link') . qq|</a></th>|;
 
 498   $colspan = $#column_index + 1;
 
 505     <th class=listtop colspan=$colspan>$form->{title}</th>
 
 508   <tr class=listheading>
 
 511   map { print "$column_header{$_}\n" } @column_index;
 
 518   $callback = $form->escape($callback);
 
 520   foreach $ca (@{ $form->{CA} }) {
 
 522     $ca->{debit}  = " ";
 
 523     $ca->{credit} = " ";
 
 525     if ($ca->{amount} > 0) {
 
 527         $form->format_amount(\%myconfig, $ca->{amount}, 2, " ");
 
 529     if ($ca->{amount} < 0) {
 
 531         $form->format_amount(\%myconfig, -$ca->{amount}, 2, " ");
 
 534     $ca->{link} =~ s/:/<br>/og;
 
 536     if ($ca->{charttype} eq "H") {
 
 537       print qq|<tr class=listheading>|;
 
 539       $column_data{accno} =
 
 540         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>|;
 
 541       $column_data{gifi_accno} =
 
 542         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>|;
 
 543       $column_data{description} = qq|<th>$ca->{description} </th>|;
 
 544       $column_data{debit}       = qq|<th> </th>|;
 
 545       $column_data{credit}      = qq| <th> </th>|;
 
 546       $column_data{link}        = qq|<th> </th>|;
 
 552 <tr valign=top class=listrow$i>|;
 
 553       $column_data{accno} =
 
 554         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>|;
 
 555       $column_data{gifi_accno} =
 
 556         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>|;
 
 557       $column_data{description} = qq|<td>$ca->{description} </td>|;
 
 558       $column_data{debit}       = qq|<td align=right>$ca->{debit}</td>|;
 
 559       $column_data{credit}      = qq|<td align=right>$ca->{credit}</td>|;
 
 560       $column_data{link}        = qq|<td>$ca->{link} </td>|;
 
 564     map { print "$column_data{$_}\n" } @column_index;
 
 570   <tr><td colspan=$colspan><hr size=3 noshade></td></tr>
 
 577   $lxdebug->leave_sub();
 
 581   $lxdebug->enter_sub();
 
 583   $form->{title} = $locale->text('Delete Account');
 
 586     qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
 
 588     if ($form->{id} == $form->{$id}) {
 
 589       $form->error($locale->text('Cannot delete default account!'));
 
 593   $form->redirect($locale->text('Account deleted!'))
 
 594     if (AM->delete_account(\%myconfig, \%$form));
 
 595   $form->error($locale->text('Cannot delete account!'));
 
 597   $lxdebug->leave_sub();
 
 601   $lxdebug->enter_sub();
 
 603   @{ $form->{fields} } = (accno, description);
 
 604   $form->{table}     = "gifi";
 
 605   $form->{sortorder} = "accno";
 
 607   AM->gifi_accounts(\%myconfig, \%$form);
 
 609   $form->{title} = $locale->text('GIFI');
 
 613     "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 615   @column_index = qw(accno description);
 
 617   $column_header{accno} = qq|<th>| . $locale->text('GIFI') . qq|</a></th>|;
 
 618   $column_header{description} =
 
 619     qq|<th>| . $locale->text('Description') . qq|</a></th>|;
 
 622   $colspan = $#column_index + 1;
 
 629     <th class=listtop colspan=$colspan>$form->{title}</th>
 
 632   <tr class=listheading>
 
 635   map { print "$column_header{$_}\n" } @column_index;
 
 642   $callback = $form->escape($callback);
 
 644   foreach $ca (@{ $form->{ALL} }) {
 
 650 <tr valign=top class=listrow$i>|;
 
 652     $column_data{accno} =
 
 653       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>|;
 
 654     $column_data{description} = qq|<td>$ca->{description} </td>|;
 
 656     map { print "$column_data{$_}\n" } @column_index;
 
 663     <td colspan=$colspan><hr size=3 noshade></td>
 
 671   $lxdebug->leave_sub();
 
 675   $lxdebug->enter_sub();
 
 677   $form->{title} = "Add";
 
 681     "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 688   $lxdebug->leave_sub();
 
 692   $lxdebug->enter_sub();
 
 694   $form->{title} = "Edit";
 
 696   AM->get_gifi(\%myconfig, \%$form);
 
 701   $lxdebug->leave_sub();
 
 705   $lxdebug->enter_sub();
 
 707   $form->{title} = $locale->text("$form->{title} GIFI");
 
 709   # $locale->text('Add GIFI')
 
 710   # $locale->text('Edit GIFI')
 
 712   $form->{description} =~ s/\"/"/g;
 
 719 <form method=post action=$form->{script}>
 
 721 <input type=hidden name=id value=$form->{accno}>
 
 722 <input type=hidden name=type value=gifi>
 
 726     <th class=listtop>$form->{title}</th>
 
 733           <th align=right>| . $locale->text('GIFI') . qq|</th>
 
 734           <td><input name=accno size=20 value=$form->{accno}></td>
 
 737           <th align=right>| . $locale->text('Description') . qq|</th>
 
 738           <td><input name=description size=60 value="$form->{description}"></td>
 
 744     <td colspan=2><hr size=3 noshade></td>
 
 749   $lxdebug->leave_sub();
 
 753   $lxdebug->enter_sub();
 
 757 <input name=callback type=hidden value="$form->{callback}">
 
 759 <input type=hidden name=path value=$form->{path}>
 
 760 <input type=hidden name=login value=$form->{login}>
 
 761 <input type=hidden name=password value=$form->{password}>
 
 763 <br><input type=submit class=submit name=action value="|
 
 764     . $locale->text('Save') . qq|">|;
 
 768 <input type=submit class=submit name=action value="|
 
 769       . $locale->text('Copy to COA') . qq|">
 
 772     if ($form->{accno} && $form->{orphaned}) {
 
 773       print qq|<input type=submit class=submit name=action value="|
 
 774         . $locale->text('Delete') . qq|">|;
 
 778   if ($form->{menubar}) {
 
 779     require "$form->{path}/menu.pl";
 
 790   $lxdebug->leave_sub();
 
 794   $lxdebug->enter_sub();
 
 796   $form->isblank("accno", $locale->text('GIFI missing!'));
 
 797   AM->save_gifi(\%myconfig, \%$form);
 
 798   $form->redirect($locale->text('GIFI saved!'));
 
 800   $lxdebug->leave_sub();
 
 804   $lxdebug->enter_sub();
 
 806   $form->isblank("accno", $locale->text('GIFI missing!'));
 
 808   AM->save_gifi(\%myconfig, \%$form);
 
 811   $form->{gifi_accno} = $form->{accno};
 
 812   $form->{title}      = "Add";
 
 813   $form->{charttype}  = "A";
 
 818   $lxdebug->leave_sub();
 
 822   $lxdebug->enter_sub();
 
 824   AM->delete_gifi(\%myconfig, \%$form);
 
 825   $form->redirect($locale->text('GIFI deleted!'));
 
 827   $lxdebug->leave_sub();
 
 831   $lxdebug->enter_sub();
 
 833   $form->{title} = "Add";
 
 837     "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
 838     unless $form->{callback};
 
 843   $lxdebug->leave_sub();
 
 846 sub edit_department {
 
 847   $lxdebug->enter_sub();
 
 849   $form->{title} = "Edit";
 
 851   AM->get_department(\%myconfig, \%$form);
 
 856   $lxdebug->leave_sub();
 
 859 sub list_department {
 
 860   $lxdebug->enter_sub();
 
 862   AM->departments(\%myconfig, \%$form);
 
 865     "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
 867   $callback = $form->escape($form->{callback});
 
 869   $form->{title} = $locale->text('Departments');
 
 871   @column_index = qw(description cost profit);
 
 873   $column_header{description} =
 
 874       qq|<th class=listheading width=90%>|
 
 875     . $locale->text('Description')
 
 877   $column_header{cost} =
 
 878       qq|<th class=listheading nowrap>|
 
 879     . $locale->text('Cost Center')
 
 881   $column_header{profit} =
 
 882       qq|<th class=listheading nowrap>|
 
 883     . $locale->text('Profit Center')
 
 893     <th class=listtop>$form->{title}</th>
 
 899         <tr class=listheading>
 
 902   map { print "$column_header{$_}\n" } @column_index;
 
 908   foreach $ref (@{ $form->{ALL} }) {
 
 914         <tr valign=top class=listrow$i>
 
 917     $costcenter   = ($ref->{role} eq "C") ? "X" : "";
 
 918     $profitcenter = ($ref->{role} eq "P") ? "X" : "";
 
 920     $column_data{description} =
 
 921       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>|;
 
 922     $column_data{cost}   = qq|<td align=center>$costcenter</td>|;
 
 923     $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
 
 925     map { print "$column_data{$_}\n" } @column_index;
 
 937   <td><hr size=3 noshade></td>
 
 942 <form method=post action=$form->{script}>
 
 944 <input name=callback type=hidden value="$form->{callback}">
 
 946 <input type=hidden name=type value=department>
 
 948 <input type=hidden name=path value=$form->{path}>
 
 949 <input type=hidden name=login value=$form->{login}>
 
 950 <input type=hidden name=password value=$form->{password}>
 
 952 <input class=submit type=submit name=action value="|
 
 953     . $locale->text('Add') . qq|">|;
 
 955   if ($form->{menubar}) {
 
 956     require "$form->{path}/menu.pl";
 
 967   $lxdebug->leave_sub();
 
 970 sub department_header {
 
 971   $lxdebug->enter_sub();
 
 973   $form->{title} = $locale->text("$form->{title} Department");
 
 975   # $locale->text('Add Department')
 
 976   # $locale->text('Edit Department')
 
 978   $form->{description} =~ s/\"/"/g;
 
 980   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
 
 982       qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
 
 985       qq|<input name=description size=60 value="$form->{description}">|;
 
 988   $costcenter   = "checked" if $form->{role} eq "C";
 
 989   $profitcenter = "checked" if $form->{role} eq "P";
 
 996 <form method=post action=$form->{script}>
 
 998 <input type=hidden name=id value=$form->{id}>
 
 999 <input type=hidden name=type value=department>
 
1003     <th class=listtop colspan=2>$form->{title}</th>
 
1005   <tr height="5"></tr>
 
1007     <th align=right>| . $locale->text('Description') . qq|</th>
 
1008     <td>$description</td>
 
1012     <td><input type=radio style=radio name=role value="C" $costcenter> |
 
1013     . $locale->text('Cost Center') . qq|
 
1014         <input type=radio style=radio name=role value="P" $profitcenter> |
 
1015     . $locale->text('Profit Center') . qq|
 
1018     <td colspan=2><hr size=3 noshade></td>
 
1023   $lxdebug->leave_sub();
 
1026 sub save_department {
 
1027   $lxdebug->enter_sub();
 
1029   $form->isblank("description", $locale->text('Description missing!'));
 
1030   AM->save_department(\%myconfig, \%$form);
 
1031   $form->redirect($locale->text('Department saved!'));
 
1033   $lxdebug->leave_sub();
 
1036 sub delete_department {
 
1037   $lxdebug->enter_sub();
 
1039   AM->delete_department(\%myconfig, \%$form);
 
1040   $form->redirect($locale->text('Department deleted!'));
 
1042   $lxdebug->leave_sub();
 
1046   $lxdebug->enter_sub();
 
1048   $form->{title} = "Add";
 
1051     "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1052     unless $form->{callback};
 
1057   $lxdebug->leave_sub();
 
1061   $lxdebug->enter_sub();
 
1063   $form->{title} = "Edit";
 
1065   AM->get_business(\%myconfig, \%$form);
 
1069   $form->{orphaned} = 1;
 
1072   $lxdebug->leave_sub();
 
1076   $lxdebug->enter_sub();
 
1078   AM->business(\%myconfig, \%$form);
 
1081     "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1083   $callback = $form->escape($form->{callback});
 
1085   $form->{title} = $locale->text('Type of Business');
 
1087   @column_index = qw(description discount customernumberinit);
 
1089   $column_header{description} =
 
1090       qq|<th class=listheading width=60%>|
 
1091     . $locale->text('Description')
 
1093   $column_header{discount} =
 
1094       qq|<th class=listheading width=10%>|
 
1095     . $locale->text('Discount')
 
1097   $column_header{customernumberinit} =
 
1098       qq|<th class=listheading>|
 
1099     . $locale->text('Customernumberinit')
 
1109     <th class=listtop>$form->{title}</th>
 
1111   <tr height="5"></tr>
 
1115         <tr class=listheading>
 
1118   map { print "$column_header{$_}\n" } @column_index;
 
1124   foreach $ref (@{ $form->{ALL} }) {
 
1130         <tr valign=top class=listrow$i>
 
1134       $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
 
1137       ? "<b>$ref->{description}</b>"
 
1138       : "$ref->{description}";
 
1139     $column_data{description} =
 
1140       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>|;
 
1141     $column_data{discount}           = qq|<td align=right>$discount</td>|;
 
1142     $column_data{customernumberinit} =
 
1143       qq|<td align=right>$ref->{customernumberinit}</td>|;
 
1145     map { print "$column_data{$_}\n" } @column_index;
 
1157   <td><hr size=3 noshade></td>
 
1162 <form method=post action=$form->{script}>
 
1164 <input name=callback type=hidden value="$form->{callback}">
 
1166 <input type=hidden name=type value=business>
 
1168 <input type=hidden name=path value=$form->{path}>
 
1169 <input type=hidden name=login value=$form->{login}>
 
1170 <input type=hidden name=password value=$form->{password}>
 
1172 <input class=submit type=submit name=action value="|
 
1173     . $locale->text('Add') . qq|">|;
 
1175   if ($form->{menubar}) {
 
1176     require "$form->{path}/menu.pl";
 
1188   $lxdebug->leave_sub();
 
1191 sub business_header {
 
1192   $lxdebug->enter_sub();
 
1194   $form->{title}    = $locale->text("$form->{title} Business");
 
1195   $form->{salesman} = "checked" if $form->{salesman};
 
1197   # $locale->text('Add Business')
 
1198   # $locale->text('Edit Business')
 
1200   $form->{description} =~ s/\"/"/g;
 
1202     $form->format_amount(\%myconfig, $form->{discount} * 100);
 
1209 <form method=post action=$form->{script}>
 
1211 <input type=hidden name=id value=$form->{id}>
 
1212 <input type=hidden name=type value=business>
 
1216     <th class=listtop colspan=2>$form->{title}</th>
 
1218   <tr height="5"></tr>
 
1220     <th align=right>| . $locale->text('Type of Business') . qq|</th>
 
1221     <td><input name=description size=30 value="$form->{description}"></td>
 
1224     <th align=right>| . $locale->text('Discount') . qq| %</th>
 
1225     <td><input name=discount size=5 value=$form->{discount}></td>
 
1228     <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
 
1229     <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
 
1232     <td align=right>| . $locale->text('Salesman') . qq|</td>
 
1233     <td><input name=salesman class=checkbox type=checkbox value=1 $form->{salesman}></td>
 
1235   <td colspan=2><hr size=3 noshade></td>
 
1240   $lxdebug->leave_sub();
 
1244   $lxdebug->enter_sub();
 
1246   $form->isblank("description", $locale->text('Description missing!'));
 
1247   AM->save_business(\%myconfig, \%$form);
 
1248   $form->redirect($locale->text('Business saved!'));
 
1250   $lxdebug->leave_sub();
 
1253 sub delete_business {
 
1254   $lxdebug->enter_sub();
 
1256   AM->delete_business(\%myconfig, \%$form);
 
1257   $form->redirect($locale->text('Business deleted!'));
 
1259   $lxdebug->leave_sub();
 
1263   $lxdebug->enter_sub();
 
1265   $form->{title} = "Add";
 
1268     "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
1269     unless $form->{callback};
 
1274   $lxdebug->leave_sub();
 
1278   $lxdebug->enter_sub();
 
1280   $form->{title} = "Edit";
 
1282   AM->get_sic(\%myconfig, \%$form);
 
1286   $form->{orphaned} = 1;
 
1289   $lxdebug->leave_sub();
 
1293   $lxdebug->enter_sub();
 
1295   AM->sic(\%myconfig, \%$form);
 
1298     "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
1300   $callback = $form->escape($form->{callback});
 
1302   $form->{title} = $locale->text('Standard Industrial Codes');
 
1304   @column_index = qw(code description);
 
1306   $column_header{code} =
 
1307     qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|;
 
1308   $column_header{description} =
 
1309     qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
 
1318     <th class=listtop>$form->{title}</th>
 
1320   <tr height="5"></tr>
 
1324         <tr class=listheading>
 
1327   map { print "$column_header{$_}\n" } @column_index;
 
1333   foreach $ref (@{ $form->{ALL} }) {
 
1338     if ($ref->{sictype} eq 'H') {
 
1340         <tr valign=top class=listheading>
 
1342       $column_data{code} =
 
1343         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>|;
 
1344       $column_data{description} = qq|<th>$ref->{description}</th>|;
 
1348         <tr valign=top class=listrow$i>
 
1351       $column_data{code} =
 
1352         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>|;
 
1353       $column_data{description} = qq|<td>$ref->{description}</td>|;
 
1357     map { print "$column_data{$_}\n" } @column_index;
 
1369   <td><hr size=3 noshade></td>
 
1374 <form method=post action=$form->{script}>
 
1376 <input name=callback type=hidden value="$form->{callback}">
 
1378 <input type=hidden name=type value=sic>
 
1380 <input type=hidden name=path value=$form->{path}>
 
1381 <input type=hidden name=login value=$form->{login}>
 
1382 <input type=hidden name=password value=$form->{password}>
 
1384 <input class=submit type=submit name=action value="|
 
1385     . $locale->text('Add') . qq|">|;
 
1387   if ($form->{menubar}) {
 
1388     require "$form->{path}/menu.pl";
 
1399   $lxdebug->leave_sub();
 
1403   $lxdebug->enter_sub();
 
1405   $form->{title} = $locale->text("$form->{title} SIC");
 
1407   # $locale->text('Add SIC')
 
1408   # $locale->text('Edit SIC')
 
1410   $form->{code}        =~ s/\"/"/g;
 
1411   $form->{description} =~ s/\"/"/g;
 
1413   $checked = ($form->{sictype} eq 'H') ? "checked" : "";
 
1420 <form method=post action=$form->{script}>
 
1422 <input type=hidden name=type value=sic>
 
1423 <input type=hidden name=id value=$form->{code}>
 
1427     <th class=listtop colspan=2>$form->{title}</th>
 
1429   <tr height="5"></tr>
 
1431     <th align=right>| . $locale->text('Code') . qq|</th>
 
1432     <td><input name=code size=10 value=$form->{code}></td>
 
1436     <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |
 
1437     . $locale->text('Heading') . qq|</th>
 
1440     <th align=right>| . $locale->text('Description') . qq|</th>
 
1441     <td><input name=description size=60 value="$form->{description}"></td>
 
1443     <td colspan=2><hr size=3 noshade></td>
 
1448   $lxdebug->leave_sub();
 
1452   $lxdebug->enter_sub();
 
1454   $form->isblank("code",        $locale->text('Code missing!'));
 
1455   $form->isblank("description", $locale->text('Description missing!'));
 
1456   AM->save_sic(\%myconfig, \%$form);
 
1457   $form->redirect($locale->text('SIC saved!'));
 
1459   $lxdebug->leave_sub();
 
1463   $lxdebug->enter_sub();
 
1465   AM->delete_sic(\%myconfig, \%$form);
 
1466   $form->redirect($locale->text('SIC deleted!'));
 
1468   $lxdebug->leave_sub();
 
1471 sub display_stylesheet {
 
1472   $lxdebug->enter_sub();
 
1474   $form->{file} = "css/$myconfig{stylesheet}";
 
1477   $lxdebug->leave_sub();
 
1481   $lxdebug->enter_sub();
 
1483   $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
 
1484   $form->{file} =~ s/^\/*//g;
 
1485   $form->{file} =~ s/$userspath//;
 
1487   $form->error("$!: $form->{file}") unless -f $form->{file};
 
1489   AM->load_template(\%$form);
 
1491   $form->{title} = $form->{file};
 
1493   # if it is anything but html
 
1494   if ($form->{file} !~ /\.html$/) {
 
1495     $form->{body} = "<pre>\n$form->{body}\n</pre>";
 
1505 <form method=post action=$form->{script}>
 
1507 <input name=file type=hidden value=$form->{file}>
 
1508 <input name=type type=hidden value=template>
 
1510 <input type=hidden name=path value=$form->{path}>
 
1511 <input type=hidden name=login value=$form->{login}>
 
1512 <input type=hidden name=password value=$form->{password}>
 
1514 <input name=action type=submit class=submit value="|
 
1515     . $locale->text('Edit') . qq|">|;
 
1517   if ($form->{menubar}) {
 
1518     require "$form->{path}/menu.pl";
 
1529   $lxdebug->leave_sub();
 
1533   $lxdebug->enter_sub();
 
1535   AM->load_template(\%$form);
 
1537   $form->{title} = $locale->text('Edit Template');
 
1539   # convert   to &nbsp;
 
1540   $form->{body} =~ s/ /&nbsp;/gi;
 
1547 <form method=post action=$form->{script}>
 
1549 <input name=file type=hidden value=$form->{file}>
 
1550 <input name=type type=hidden value=template>
 
1552 <input type=hidden name=path value=$form->{path}>
 
1553 <input type=hidden name=login value=$form->{login}>
 
1554 <input type=hidden name=password value=$form->{password}>
 
1556 <input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&password=$form->{password}">
 
1558 <textarea name=body rows=25 cols=70>
 
1563 <input type=submit class=submit name=action value="|
 
1564     . $locale->text('Save') . qq|">|;
 
1566   if ($form->{menubar}) {
 
1567     require "$form->{path}/menu.pl";
 
1579   $lxdebug->leave_sub();
 
1583   $lxdebug->enter_sub();
 
1585   AM->save_template(\%$form);
 
1586   $form->redirect($locale->text('Template saved!'));
 
1588   $lxdebug->leave_sub();
 
1592   $lxdebug->enter_sub();
 
1594   # get defaults for account numbers and last numbers
 
1595   AM->defaultaccounts(\%myconfig, \%$form);
 
1597   foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
 
1599       ($item eq $myconfig{dateformat})
 
1600       ? "<option selected>$item\n"
 
1601       : "<option>$item\n";
 
1604   foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
 
1606       ($item eq $myconfig{numberformat})
 
1607       ? "<option selected>$item\n"
 
1608       : "<option>$item\n";
 
1611   foreach $item (qw(name company address signature)) {
 
1612     $myconfig{$item} =~ s/\"/"/g;
 
1615   foreach $item (qw(address signature)) {
 
1616     $myconfig{$item} =~ s/\\n/\r\n/g;
 
1619   %countrycodes = User->country_codes;
 
1621   foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
 
1625       ($myconfig{countrycode} eq $key)
 
1626       ? "<option selected value=$key>$countrycodes{$key}\n"
 
1627       : "<option value=$key>$countrycodes{$key}\n";
 
1629   $countrycodes = "<option>American English\n$countrycodes";
 
1631   # use an other input number format than output numberformat
 
1632   # look at Form.pm, sub parse_amount
 
1633   my $ in_numberformat = '';
 
1634   $text1 = qq|value="0">| . $locale->text('equal Outputformat');
 
1635   $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
 
1636   @in_nf = ($text1, $text2);
 
1637   foreach $item ( @in_nf ) {
 
1639       ( substr($item, 7, 1) eq $myconfig{in_numberformat})
 
1640       ? "<option selected $item\n"
 
1641       : "<option $item\n";
 
1646   foreach $key (keys %{ $form->{IC} }) {
 
1647     foreach $accno (sort keys %{ $form->{IC}{$key} }) {
 
1649         ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
 
1650         ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
 
1651         : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
 
1655   opendir CSS, "css/.";
 
1656   @all = grep /.*\.css$/, readdir CSS;
 
1659   foreach $item (@all) {
 
1660     if ($item eq $myconfig{stylesheet}) {
 
1661       $selectstylesheet .= qq|<option selected>$item\n|;
 
1663       $selectstylesheet .= qq|<option>$item\n|;
 
1666   $selectstylesheet .= "<option>\n";
 
1668   $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
 
1672   if ($myconfig{menustyle} eq "old") { $oldS = "checked"; }
 
1673   else { $newS = "checked"; }
 
1678 <form method=post action=$form->{script}>
 
1680 <input type=hidden name=old_password value=$myconfig{password}>
 
1681 <input type=hidden name=type value=preferences>
 
1682 <input type=hidden name=role value=$myconfig{role}>
 
1685   <tr><th class=listtop>$form->{title}</th></tr>
 
1690           <th align=right>| . $locale->text('Name') . qq|</th>
 
1691           <td><input name=name size=15 value="$myconfig{name}"></td>
 
1694           <th align=right>| . $locale->text('Password') . qq|</th>
 
1695           <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
 
1698           <th align=right>| . $locale->text('E-mail') . qq|</th>
 
1699           <td><input name=email size=30 value="$myconfig{email}"></td>
 
1702           <th align=right>| . $locale->text('Signature') . qq|</th>
 
1703           <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
 
1706           <th align=right>| . $locale->text('Phone') . qq|</th>
 
1707           <td><input name=tel size=14 value="$myconfig{tel}"></td>
 
1710           <th align=right>| . $locale->text('Fax') . qq|</th>
 
1711           <td><input name=fax size=14 value="$myconfig{fax}"></td>
 
1714           <th align=right>| . $locale->text('Company') . qq|</th>
 
1715           <td><input name=company size=30 value="$myconfig{company}"></td>
 
1718           <th align=right>| . $locale->text('Address') . qq|</th>
 
1719           <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
 
1722           <th align=right>| . $locale->text('Date Format') . qq|</th>
 
1723           <td><select name=dateformat>$dateformat</select></td>
 
1726           <th align=right>| . $locale->text('Output Number Format') . qq|</th>
 
1727           <td><select name=numberformat>$numberformat</select></td>
 
1730           <th align=right>| . $locale->text('Input Number Format') . qq|</th>
 
1731           <td><select name=in_numberformat>$in_numberformat</select></td>
 
1735           <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
 
1736           <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
 
1739           <th align=right>| . $locale->text('Language') . qq|</th>
 
1740           <td><select name=countrycode>$countrycodes</select></td>
 
1743           <th align=right>| . $locale->text('Character Set') . qq|</th>
 
1744           <td><input name=charset size=20 value="$myconfig{charset}"></td>
 
1747           <th align=right>| . $locale->text('Stylesheet') . qq|</th>
 
1748           <td><select name=usestylesheet>$selectstylesheet</select></td>
 
1751           <th align=right>| . $locale->text('Setup Menu') . qq|</th>
 
1752           <td><input name=menustyle type=radio class=radio value=neu $newS> New
 
1753                   <input name=menustyle type=radio class=radio value=old $oldS> Old</td>
 
1755         <input name=printer type=hidden value="$myconfig{printer}">
 
1756         <tr class=listheading>
 
1757           <th colspan=2> </th>
 
1760           <th align=right>| . $locale->text('Business Number') . qq|</th>
 
1761           <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
 
1767                 <th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
 
1768                 <td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
 
1769                 <th align=right>| . $locale->text('Weight Unit') . qq|</th>
 
1770                 <td><input name=weightunit size=5 value="$form->{defaults}{weightunit}"></td>
 
1775         <tr class=listheading>
 
1777     . $locale->text('Last Numbers & Default Accounts') . qq|</th>
 
1783                 <th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
 
1784                 <td><select name=inventory_accno>$myconfig{IC}</select></td>
 
1787                 <th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
 
1788                 <td><select name=income_accno>$myconfig{IC_income}</select></td>
 
1791                 <th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
 
1792                 <td><select name=expense_accno>$myconfig{IC_expense}</select></td>
 
1795                 <th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
 
1796                 <td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
 
1799                 <th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
 
1800                 <td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
 
1805     'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
 
1807     . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
 
1816                 <th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
 
1817                 <td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
 
1818                 <th align=right nowrap>|
 
1819     . $locale->text('Last Customer Number') . qq|</th>
 
1820                 <td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
 
1823                 <th align=right nowrap>|
 
1824     . $locale->text('Last Sales Order Number') . qq|</th>
 
1825                 <td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
 
1826                 <th align=right nowrap>|
 
1827     . $locale->text('Last Vendor Number') . qq|</th>
 
1828                 <td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
 
1831                 <th align=right nowrap>|
 
1832     . $locale->text('Last Purchase Order Number') . qq|</th>
 
1833                 <td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
 
1834                 <th align=right nowrap>|
 
1835     . $locale->text('Last Article Number') . qq|</th>
 
1836                 <td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
 
1839                 <th align=right nowrap>|
 
1840     . $locale->text('Last Sales Quotation Number') . qq|</th>
 
1841                 <td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
 
1842                 <th align=right nowrap>|
 
1843     . $locale->text('Last Service Number') . qq|</th>
 
1844                 <td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
 
1847                 <th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
 
1848                 <td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
 
1849                 <th align=right nowrap></th>
 
1855         <tr class=listheading>
 
1856           <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
 
1863                 <th>| . $locale->text('Rate') . qq| (%)</th>
 
1864                 <th>| . $locale->text('Number') . qq|</th>
 
1868   foreach $accno (sort keys %{ $form->{taxrates} }) {
 
1871                 <th align=right>$form->{taxrates}{$accno}{description}</th>
 
1872                 <td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
 
1873                 <td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
 
1876     $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
 
1879   chop $form->{taxaccounts};
 
1882 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
 
1891     <td><hr size=3 noshade></td>
 
1895 <input type=hidden name=path value=$form->{path}>
 
1896 <input type=hidden name=login value=$form->{login}>
 
1897 <input type=hidden name=password value=$form->{password}>
 
1900 <input type=submit class=submit name=action value="|
 
1901     . $locale->text('Save') . qq|">|;
 
1903   if ($form->{menubar}) {
 
1904     require "$form->{path}/menu.pl";
 
1915   $lxdebug->leave_sub();
 
1918 sub save_preferences {
 
1919   $lxdebug->enter_sub();
 
1921   $form->{stylesheet} = $form->{usestylesheet};
 
1923   $form->redirect($locale->text('Preferences saved!'))
 
1925      AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath, $webdav
 
1927   $form->error($locale->text('Cannot save preferences!'));
 
1929   $lxdebug->leave_sub();
 
1933   $lxdebug->enter_sub();
 
1935   if ($form->{media} eq 'email') {
 
1936     $form->error($locale->text('No email address for') . " $myconfig{name}")
 
1937       unless ($myconfig{email});
 
1939     $form->{OUT} = "$sendmail";
 
1943   AM->backup(\%myconfig, \%$form, $userspath);
 
1945   if ($form->{media} eq 'email') {
 
1946     $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|);
 
1949   $lxdebug->leave_sub();
 
1953   $lxdebug->enter_sub();
 
1955   $form->{title} = $locale->text('Audit Control');
 
1957   AM->closedto(\%myconfig, \%$form);
 
1959   if ($form->{revtrans}) {
 
1960     $checked{Y} = "checked";
 
1962     $checked{N} = "checked";
 
1970 <form method=post action=$form->{script}>
 
1972 <input type=hidden name=path value=$form->{path}>
 
1973 <input type=hidden name=login value=$form->{login}>
 
1974 <input type=hidden name=password value=$form->{password}>
 
1977   <tr><th class=listtop>$form->{title}</th></tr>
 
1978   <tr height="5"></tr>
 
1984     . $locale->text('Enforce transaction reversal for all dates') . qq|</th>
 
1985           <td><input name=revtrans class=radio type=radio value="1" $checked{Y}> |
 
1986     . $locale->text('Yes')
 
1987     . qq| <input name=revtrans class=radio type=radio value="0" $checked{N}> |
 
1988     . $locale->text('No')
 
1992           <th>| . $locale->text('Close Books up to') . qq|</th>
 
1993           <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
 
2003 <input type=hidden name=nextsub value=doclose>
 
2005 <input type=submit class=submit name=action value="|
 
2006     . $locale->text('Continue') . qq|">
 
2014   $lxdebug->leave_sub();
 
2018   $lxdebug->enter_sub();
 
2020   AM->closebooks(\%myconfig, \%$form);
 
2022   if ($form->{revtrans}) {
 
2024                  $locale->text('Transaction reversal enforced for all dates'));
 
2026     if ($form->{closedto}) {
 
2028                      $locale->text('Transaction reversal enforced up to') . " "
 
2029                        . $locale->date(\%myconfig, $form->{closedto}, 1));
 
2031       $form->redirect($locale->text('Books are open'));
 
2035   $lxdebug->leave_sub();
 
2039   $lxdebug->enter_sub();
 
2041   $form->{title} = "Add";
 
2044     "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
 
2045     unless $form->{callback};
 
2050   $lxdebug->leave_sub();
 
2053 sub edit_warehouse {
 
2054   $lxdebug->enter_sub();
 
2056   $form->{title} = "Edit";
 
2058   AM->get_warehouse(\%myconfig, \%$form);
 
2063   $lxdebug->leave_sub();
 
2066 sub list_warehouse {
 
2067   $lxdebug->enter_sub();
 
2069   AM->warehouses(\%myconfig, \%$form);
 
2072     "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
 
2074   $callback = $form->escape($form->{callback});
 
2076   $form->{title} = $locale->text('Warehouses');
 
2078   @column_index = qw(description);
 
2080   $column_header{description} =
 
2081       qq|<th class=listheading width=100%>|
 
2082     . $locale->text('Description')
 
2092     <th class=listtop>$form->{title}</th>
 
2094   <tr height="5"></tr>
 
2098         <tr class=listheading>
 
2101   map { print "$column_header{$_}\n" } @column_index;
 
2107   foreach $ref (@{ $form->{ALL} }) {
 
2113         <tr valign=top class=listrow$i>
 
2116     $column_data{description} =
 
2117       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>|;
 
2119     map { print "$column_data{$_}\n" } @column_index;
 
2131   <td><hr size=3 noshade></td>
 
2136 <form method=post action=$form->{script}>
 
2138 <input name=callback type=hidden value="$form->{callback}">
 
2140 <input type=hidden name=type value=warehouse>
 
2142 <input type=hidden name=path value=$form->{path}>
 
2143 <input type=hidden name=login value=$form->{login}>
 
2144 <input type=hidden name=password value=$form->{password}>
 
2146 <input class=submit type=submit name=action value="|
 
2147     . $locale->text('Add') . qq|">|;
 
2149   if ($form->{menubar}) {
 
2150     require "$form->{path}/menu.pl";
 
2161   $lxdebug->leave_sub();
 
2164 sub warehouse_header {
 
2165   $lxdebug->enter_sub();
 
2167   $form->{title} = $locale->text("$form->{title} Warehouse");
 
2169   # $locale->text('Add Warehouse')
 
2170   # $locale->text('Edit Warehouse')
 
2172   $form->{description} =~ s/\"/"/g;
 
2174   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
 
2176       qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
 
2179       qq|<input name=description size=60 value="$form->{description}">|;
 
2187 <form method=post action=$form->{script}>
 
2189 <input type=hidden name=id value=$form->{id}>
 
2190 <input type=hidden name=type value=warehouse>
 
2194     <th class=listtop colspan=2>$form->{title}</th>
 
2196   <tr height="5"></tr>
 
2198     <th align=right>| . $locale->text('Description') . qq|</th>
 
2199     <td>$description</td>
 
2202     <td colspan=2><hr size=3 noshade></td>
 
2207   $lxdebug->leave_sub();
 
2210 sub save_warehouse {
 
2211   $lxdebug->enter_sub();
 
2213   $form->isblank("description", $locale->text('Description missing!'));
 
2214   AM->save_warehouse(\%myconfig, \%$form);
 
2215   $form->redirect($locale->text('Warehouse saved!'));
 
2217   $lxdebug->leave_sub();
 
2220 sub delete_warehouse {
 
2221   $lxdebug->enter_sub();
 
2223   AM->delete_warehouse(\%myconfig, \%$form);
 
2224   $form->redirect($locale->text('Warehouse deleted!'));
 
2226   $lxdebug->leave_sub();
 
2230   $lxdebug->enter_sub();
 
2232   &{ $form->{nextsub} };
 
2234   $lxdebug->leave_sub();