summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/lynx/aa.pl1710
-rwxr-xr-xbin/lynx/admin.pl1638
-rwxr-xr-xbin/lynx/am.pl3260
-rwxr-xr-xbin/lynx/ap.pl59
-rwxr-xr-xbin/lynx/ar.pl59
-rwxr-xr-xbin/lynx/arap.pl936
-rwxr-xr-xbin/lynx/arapprn.pl609
-rwxr-xr-xbin/lynx/bp.pl549
-rwxr-xr-xbin/lynx/ca.pl2
-rwxr-xr-xbin/mozilla/aa.pl42
-rwxr-xr-xbin/mozilla/admin.pl20
-rwxr-xr-xbin/mozilla/am.pl19
-rwxr-xr-xbin/mozilla/ap.pl44
-rwxr-xr-xbin/mozilla/ar.pl37
-rwxr-xr-xbin/mozilla/arap.pl36
-rwxr-xr-xbin/mozilla/arapprn.pl34
-rwxr-xr-xbin/mozilla/bp.pl35
17 files changed, 247 insertions, 8842 deletions
diff --git a/bin/lynx/aa.pl b/bin/lynx/aa.pl
index 50c143ef..ed093b04 100755
--- a/bin/lynx/aa.pl
+++ b/bin/lynx/aa.pl
@@ -1,1711 +1,7 @@
-#=====================================================================
-# LedgerSMB Small Medium Business Accounting
+#!/usr/bin/perl
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
-# under the GNU General Public License version 2 or, at your option, any later
-# version. For a full list including contact information of contributors,
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (c) 2005
-#
-# Author: DWS Systems Inc.
-# Web: http://www.sql-ledger.org
-#
-# Contributors:
-#
-#
-# Author: DWS Systems Inc.
-# Web: http://sourceforge.net/projects/ledger-smb/
-#
-# Contributors:
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#======================================================================
-#
-# AR / AP
-#
-#======================================================================
-
-# any custom scripts for this one
-if (-f "$form->{path}/custom_aa.pl") {
- eval { require "$form->{path}/custom_aa.pl"; };
-}
-if (-f "$form->{path}/$form->{login}_aa.pl") {
- eval { require "$form->{path}/$form->{login}_aa.pl"; };
-}
+require "bin/mozilla/aa.pl";
+## Differing routines go here
1;
-# end of main
-
-
-# this is for our long dates
-# $locale->text('January')
-# $locale->text('February')
-# $locale->text('March')
-# $locale->text('April')
-# $locale->text('May ')
-# $locale->text('June')
-# $locale->text('July')
-# $locale->text('August')
-# $locale->text('September')
-# $locale->text('October')
-# $locale->text('November')
-# $locale->text('December')
-
-# this is for our short month
-# $locale->text('Jan')
-# $locale->text('Feb')
-# $locale->text('Mar')
-# $locale->text('Apr')
-# $locale->text('May')
-# $locale->text('Jun')
-# $locale->text('Jul')
-# $locale->text('Aug')
-# $locale->text('Sep')
-# $locale->text('Oct')
-# $locale->text('Nov')
-# $locale->text('Dec')
-
-
-sub add {
-
- $form->{title} = "Add";
- $form->{callback} = "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
-
- &create_links;
-
- $form->{focus} = "amount_1";
- &display_form;
-
-}
-
-
-sub edit {
-
- $form->{title} = "Edit";
-
- &create_links;
- &display_form;
-
-}
-
-
-sub display_form {
-
- &form_header;
- &form_footer;
-
-}
-
-
-sub create_links {
-
- $form->create_links($form->{ARAP}, \%myconfig, $form->{vc});
-
- $duedate = $form->{duedate};
- $taxincluded = $form->{taxincluded};
-
- $form->{formname} = "transaction";
- $form->{format} = "postscript" if $myconfig{printer};
- $form->{media} = $myconfig{printer};
-
- $form->{selectformname} = qq|<option value="transaction">|.$locale->text('Transaction');
-
- if ($latex) {
- if ($form->{ARAP} eq 'AR') {
- $form->{selectformname} .= qq|
- <option value="receipt">|.$locale->text('Receipt');
- } else {
- $form->{selectformname} .= qq|
- <option value="check">|.$locale->text('Check');
- }
- }
-
- # currencies
- @curr = split /:/, $form->{currencies};
- $form->{defaultcurrency} = $curr[0];
- chomp $form->{defaultcurrency};
-
- for (@curr) { $form->{selectcurrency} .= "<option>$_\n" }
-
- AA->get_name(\%myconfig, \%$form);
-
- $form->{currency} =~ s/ //g;
- $form->{duedate} = $duedate if $duedate;
- $form->{taxincluded} = $taxincluded if $form->{id};
-
- $form->{notes} = $form->{intnotes} if !$form->{id};
-
- $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
- $form->{oldtransdate} = $form->{transdate};
-
- # customers/vendors
- $form->{"select$form->{vc}"} = "";
- if (@{ $form->{"all_$form->{vc}"} }) {
- $form->{$form->{vc}} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
- for (@{ $form->{"all_$form->{vc}"} }) { $form->{"select$form->{vc}"} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
- }
-
- # departments
- if (@{ $form->{all_department} }) {
- $form->{selectdepartment} = "<option>\n";
- $form->{department} = "$form->{department}--$form->{department_id}" if $form->{department_id};
-
- for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
- }
-
- $form->{employee} = "$form->{employee}--$form->{employee_id}";
- # sales staff
- if (@{ $form->{all_employee} }) {
- $form->{selectemployee} = "";
- for (@{ $form->{all_employee} }) { $form->{selectemployee} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
- }
-
- # projects
- if (@{ $form->{all_project} }) {
- $form->{selectprojectnumber} = "<option>\n";
- for (@{ $form->{all_project} }) { $form->{selectprojectnumber} .= qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n| }
- }
-
- if (@{ $form->{all_language} }) {
- $form->{selectlanguage} = "<option>\n";
- for (@{ $form->{all_language} }) { $form->{selectlanguage} .= qq|<option value="$_->{code}">$_->{description}\n| }
- }
-
- # forex
- $form->{forex} = $form->{exchangerate};
- $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
-
- $netamount = 0;
- $tax = 0;
- $taxrate = 0;
- $ml = ($form->{ARAP} eq 'AR') ? 1 : -1;
-
- foreach $key (keys %{ $form->{"$form->{ARAP}_links"} }) {
-
- $form->{"select$key"} = "";
- foreach $ref (@{ $form->{"$form->{ARAP}_links"}{$key} }) {
- if ($key eq "$form->{ARAP}_tax") {
- $form->{"select$form->{ARAP}_tax_$ref->{accno}"} = "<option>$ref->{accno}--$ref->{description}\n";
- next;
- }
- $form->{"select$key"} .= "<option>$ref->{accno}--$ref->{description}\n";
- }
-
- # if there is a value we have an old entry
- for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
- if ($key eq "$form->{ARAP}_paid") {
- $form->{"$form->{ARAP}_paid_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
- $form->{"paid_$i"} = $form->{acc_trans}{$key}->[$i-1]->{amount} * -1 * $ml;
- $form->{"datepaid_$i"} = $form->{acc_trans}{$key}->[$i-1]->{transdate};
- $form->{"source_$i"} = $form->{acc_trans}{$key}->[$i-1]->{source};
- $form->{"memo_$i"} = $form->{acc_trans}{$key}->[$i-1]->{memo};
-
- $form->{"forex_$i"} = $form->{"exchangerate_$i"} = $form->{acc_trans}{$key}->[$i-1]->{exchangerate};
-
- $form->{paidaccounts}++;
- } else {
-
- $akey = $key;
- $akey =~ s/$form->{ARAP}_//;
-
- if ($key eq "$form->{ARAP}_tax") {
- $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
- $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} = $form->{acc_trans}{$key}->[$i-1]->{amount} * $ml;
-
- $tax += $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
- $taxrate += $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
-
- } else {
- $form->{"${akey}_$i"} = $form->{acc_trans}{$key}->[$i-1]->{amount} * $ml;
-
- if ($akey eq 'amount') {
- $form->{"description_$i"} = $form->{acc_trans}{$key}->[$i-1]->{memo};
- $form->{rowcount}++;
- $netamount += $form->{"${akey}_$i"};
-
- $form->{"projectnumber_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}--$form->{acc_trans}{$key}->[$i-1]->{project_id}" if $form->{acc_trans}{$key}->[$i-1]->{project_id};
- } else {
- $form->{invtotal} = $form->{acc_trans}{$key}->[$i-1]->{amount} * -1 * $ml;
- }
- $form->{"${key}_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
- }
- }
- }
- }
-
- $form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
-
- if ($form->{taxincluded}) {
- $diff = 0;
- # add tax to individual amounts
- for $i (1 .. $form->{rowcount}) {
- if ($netamount) {
- $amount = $form->{"amount_$i"} * (1 + $tax / $netamount);
- $form->{"amount_$i"} = $form->round_amount($amount, 2);
- }
- }
- }
-
- $form->{invtotal} = $netamount + $tax;
-
- # check if calculated is equal to stored
- # taxincluded is terrible to calculate
- # this works only if all taxes are checked
-
- @taxaccounts = split / /, $form->{taxaccounts};
-
- if ($form->{id}) {
- if ($form->{taxincluded}) {
-
- $ml = 1;
-
- for (0 .. 1) {
- $taxrate = 0;
- $diff = 0;
-
- for (@taxaccounts) { $taxrate += $form->{"${_}_rate"} if ($form->{"${_}_rate"} * $ml) > 0 }
- $taxrate *= $ml;
-
- foreach $item (@taxaccounts) {
-
- if (($form->{"${item}_rate"} * $ml) > 0) {
- if ($taxrate) {
- $amount = $form->{invtotal} * $form->{"${item}_rate"} / (1 + $taxrate);
- $tax = $form->round_amount($amount, 2);
- $tax{$item} = $form->round_amount($amount - $diff, 2);
- $diff = $tax{$item} - ($amount - $diff);
-
- if ($tax) {
- if ($form->{"tax_$item"} == $tax{$item}) {
- $form->{"calctax_$item"} = 1;
- }
- }
- }
- }
- }
- $ml *= -1;
- }
-
- } else {
- for (@taxaccounts) {
- $tax = $form->round_amount($netamount * $form->{"${_}_rate"}, 2);
- if ($tax) {
- if ($form->{"tax_$_"} == $tax) {
- $form->{"calctax_$_"} = 1;
- }
- }
- }
- }
-
- } else {
- for (@taxaccounts) { $form->{"calctax_$_"} = 1 }
- }
-
-
- $form->{rowcount}++ if ($form->{id} || !$form->{rowcount});
-
- $form->{$form->{ARAP}} = $form->{"$form->{ARAP}_1"};
- $form->{rowcount} = 1 unless $form->{"$form->{ARAP}_amount_1"};
-
- $form->{locked} = ($form->{revtrans}) ? '1' : ($form->datetonum(\%myconfig, $form->{transdate}) <= $form->datetonum(\%myconfig, $form->{closedto}));
-
- # readonly
- if (! $form->{readonly}) {
- $form->{readonly} = 1 if $myconfig{acs} =~ /$form->{ARAP}--Add Transaction/;
- }
-
-}
-
-
-sub form_header {
-
- $title = $form->{title};
- $form->{title} = $locale->text("$title $form->{ARAP} Transaction");
-
- $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
-
-# $locale->text('Add AR Transaction')
-# $locale->text('Edit AR Transaction')
-# $locale->text('Add AP Transaction')
-# $locale->text('Edit AP Transaction')
-
- # set option selected
- for ("$form->{ARAP}", "currency") {
- $form->{"select$_"} =~ s/ selected//;
- $form->{"select$_"} =~ s/<option>\Q$form->{$_}\E/<option selected>$form->{$_}/;
- }
-
- for ("$form->{vc}", "department", "employee", "formname") {
- $form->{"select$_"} = $form->unescape($form->{"select$_"});
- $form->{"select$_"} =~ s/ selected//;
- $form->{"select$_"} =~ s/(<option value="\Q$form->{$_}\E")/$1 selected/;
- }
-
- $form->{selectprojectnumber} = $form->unescape($form->{selectprojectnumber});
-
- # format amounts
- $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate});
-
- $exchangerate = qq|<tr>|;
- $exchangerate .= qq|
- <th align=right nowrap>|.$locale->text('Currency').qq|</th>
- <td><select name=currency>$form->{selectcurrency}</select></td> | if $form->{defaultcurrency};
- $exchangerate .= qq|
- <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
- <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
-|;
-
- if ($form->{defaultcurrency} && $form->{currency} ne $form->{defaultcurrency}) {
- if ($form->{forex}) {
- $exchangerate .= qq|
- <th align=right>|.$locale->text('Exchange Rate').qq|</th>
- <td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td>
-|;
- } else {
- $exchangerate .= qq|
- <th align=right>|.$locale->text('Exchange Rate').qq|</th>
- <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
-|;
- }
- }
- $exchangerate .= qq|
-<input type=hidden name=forex value=$form->{forex}>
-</tr>
-|;
-
- $taxincluded = "";
- if ($form->{taxaccounts}) {
- $taxincluded = qq|
- <tr>
- <td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
- <th align=left nowrap>|.$locale->text('Tax Included').qq|</th>
- </tr>
-|;
- }
-
-
- if (($rows = $form->numtextrows($form->{notes}, 50) - 1) < 2) {
- $rows = 2;
- }
- $notes = qq|<textarea name=notes rows=$rows cols=50 wrap=soft>$form->{notes}</textarea>|;
-
- $department = qq|
- <tr>
- <th align="right" nowrap>|.$locale->text('Department').qq|</th>
- <td colspan=3><select name=department>$form->{selectdepartment}</select>
- <input type=hidden name=selectdepartment value="|.$form->escape($form->{selectdepartment},1).qq|">
- </td>
- </tr>
-| if $form->{selectdepartment};
-
-
- $n = ($form->{creditremaining} < 0) ? "0" : "1";
-
- $name = ($form->{"select$form->{vc}"}) ? qq|<select name="$form->{vc}">$form->{"select$form->{vc}"}</select>| : qq|<input name="$form->{vc}" value="$form->{$form->{vc}}" size=35>|;
-
- $employee = qq|
- <input type=hidden name=employee value="$form->{employee}">
-|;
-
- if ($form->{selectemployee}) {
- $label = ($form->{ARAP} eq 'AR') ? $locale->text('Salesperson') : $locale->text('Employee');
-
- $employee = qq|
- <tr>
- <th align=right nowrap>$label</th>
- <td><select name=employee>$form->{selectemployee}</select></td>
- <input type=hidden name=selectemployee value="|.$form->escape($form->{selectemployee},1).qq|">
- </tr>
-|;
- }
-
- $focus = ($form->{focus}) ? $form->{focus} : "amount_$form->{rowcount}";
-
- $form->header;
-
- print qq|
-<body onload="document.forms[0].${focus}.focus()" />
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=type value="$form->{formname}">
-<input type=hidden name=title value="$title">
-
-|;
-
- $form->hide_form(qw(id printed emailed sort closedto locked oldtransdate audittrail recurring checktax));
-
- if ($form->{vc} eq 'customer') {
- $label = $locale->text('Customer');
- } else {
- $label = $locale->text('Vendor');
- }
-
- $form->hide_form("old$form->{vc}", "$form->{vc}_id", "terms", "creditlimit", "creditremaining", "selectcurrency", "defaultcurrency", "select$form->{ARAP}_amount", "rowcount");
-
- print qq|
-
-<table width=100%>
- <tr class=listtop>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr valign=top>
- <td>
- <table width=100%>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align="right" nowrap>$label</th>
- <td colspan=3>$name</td>
- <input type=hidden name="select$form->{vc}" value="|.$form->escape($form->{"select$form->{vc}"},1).qq|">
- </tr>
- <tr>
- <td></td>
- <td colspan=3>
- <table width=100%>
- <tr>
- <th align=left nowrap>|.$locale->text('Credit Limit').qq|</th>
- <td>$form->{creditlimit}</td>
- <th align=left nowrap>|.$locale->text('Remaining').qq|</th>
- <td class="plus$n">|.$form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0").qq|</td>
- </tr>
- </table>
- </td>
- </tr>
- $exchangerate
- $department
- $taxincluded
- </table>
- </td>
- <td align=right>
- <table>
- $employee
- <tr>
- <th align=right nowrap>|.$locale->text('Invoice Number').qq|</th>
- <td><input name=invnumber size=20 value="$form->{invnumber}"></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('Order Number').qq|</th>
- <td><input name=ordnumber size=20 value="$form->{ordnumber}"></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('Invoice Date').qq|</th>
- <td><input name=transdate size=11 title="($myconfig{'dateformat'})" value=$form->{transdate}></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('Due Date').qq|</th>
- <td><input name=duedate size=11 title="$myconfig{'dateformat'}" value=$form->{duedate}></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('PO Number').qq|</th>
- <td><input name=ponumber size=20 value="$form->{ponumber}"></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <input type=hidden name=selectprojectnumber value="|.$form->escape($form->{selectprojectnumber},1).qq|">
- <tr>
- <td>
- <table>
-|;
-
- $project = qq|
- <th>|.$locale->text('Project').qq|</th>
-| if $form->{selectprojectnumber};
-
- print qq|
- <tr>
- <th>|.$locale->text('Amount').qq|</th>
- <th></th>
- <th>|.$locale->text('Account').qq|</th>
- <th>|.$locale->text('Description').qq|</th>
- $project
- </tr>
-|;
-
- for $i (1 .. $form->{rowcount}) {
-
- $selectamount = $form->{"select$form->{ARAP}_amount"};
- $selectamount =~ s/option>\Q$form->{"$form->{ARAP}_amount_$i"}\E/option selected>$form->{"$form->{ARAP}_amount_$i"}/;
-
- $selectprojectnumber = $form->{selectprojectnumber};
- $selectprojectnumber =~ s/(<option value="\Q$form->{"projectnumber_$i"}\E")/$1 selected/;
-
- # format amounts
- $form->{"amount_$i"} = $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
-
- $project = qq|
- <td align=right><select name="projectnumber_$i">$selectprojectnumber</select></td>
-| if $form->{selectprojectnumber};
-
- if (($rows = $form->numtextrows($form->{"description_$i"}, 40)) > 1) {
- $description = qq|<td><textarea name="description_$i" rows=$rows cols=40>$form->{"description_$i"}</textarea></td>|;
- } else {
- $description = qq|<td><input name="description_$i" size=40 value="$form->{"description_$i"}"></td>|;
- }
-
- print qq|
- <tr valign=top>
- <td><input name="amount_$i" size=10 value="$form->{"amount_$i"}" accesskey="$i"></td>
- <td></td>
- <td><select name="$form->{ARAP}_amount_$i">$selectamount</select></td>
- $description
- $project
- </tr>
-|;
- }
-
- foreach $item (split / /, $form->{taxaccounts}) {
-
- $form->{"calctax_$item"} = ($form->{"calctax_$item"}) ? "checked" : "";
-
- $form->{"tax_$item"} = $form->format_amount(\%myconfig, $form->{"tax_$item"}, 2);
-
- print qq|
- <tr>
- <td><input name="tax_$item" size=10 value=$form->{"tax_$item"}></td>
- <td align=right><input name="calctax_$item" class=checkbox type=checkbox value=1 $form->{"calctax_$item"}></td>
- <td><select name="$form->{ARAP}_tax_$item">$form->{"select$form->{ARAP}_tax_$item"}</select></td>
- </tr>
-|;
-
- $form->hide_form("${item}_rate", "${item}_description", "${item}_taxnumber", "select$form->{ARAP}_tax_$item");
- }
-
- $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
-
- $form->hide_form("oldinvtotal", "oldtotalpaid", "taxaccounts", "select$form->{ARAP}");
-
- print qq|
- <tr>
- <th align=left>$form->{invtotal}</th>
- <td></td>
- <td><select name=$form->{ARAP}>$form->{"select$form->{ARAP}"}</select></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Notes').qq|</th>
- <td></td>
- <td colspan=3>$notes</td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr class=listheading>
- <th class=listheading>|.$locale->text('Payments').qq|</th>
- </tr>
-
- <tr>
- <td>
- <table width=100%>
-|;
-
- if ($form->{currency} eq $form->{defaultcurrency}) {
- @column_index = qw(datepaid source memo paid ARAP_paid);
- } else {
- @column_index = qw(datepaid source memo paid exchangerate ARAP_paid);
- }
-
- $column_data{datepaid} = "<th>".$locale->text('Date')."</th>";
- $column_data{paid} = "<th>".$locale->text('Amount')."</th>";
- $column_data{exchangerate} = "<th>".$locale->text('Exch')."</th>";
- $column_data{ARAP_paid} = "<th>".$locale->text('Account')."</th>";
- $column_data{source} = "<th>".$locale->text('Source')."</th>";
- $column_data{memo} = "<th>".$locale->text('Memo')."</th>";
-
- print "
- <tr>
-";
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print "
- </tr>
-";
-
-
- $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
- for $i (1 .. $form->{paidaccounts}) {
-
- $form->hide_form("cleared_$i");
-
- print "
- <tr>
-";
-
- $form->{"select$form->{ARAP}_paid_$i"} = $form->{"select$form->{ARAP}_paid"};
- $form->{"select$form->{ARAP}_paid_$i"} =~ s/option>\Q$form->{"$form->{ARAP}_paid_$i"}\E/option selected>$form->{"$form->{ARAP}_paid_$i"}/;
-
- # format amounts
- $form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
- $form->{"exchangerate_$i"} = $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
-
- $exchangerate = qq|&nbsp;|;
- if ($form->{currency} ne $form->{defaultcurrency}) {
- if ($form->{"forex_$i"}) {
- $form->hide_form("exchangerate_$i");
- $exchangerate = qq|$form->{"exchangerate_$i"}|;
- } else {
- $exchangerate = qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
- }
- }
-
- $form->hide_form("forex_$i");
-
- $column_data{paid} = qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
- $column_data{ARAP_paid} = qq|<td align=center><select name="$form->{ARAP}_paid_$i">$form->{"select$form->{ARAP}_paid_$i"}</select></td>|;
- $column_data{exchangerate} = qq|<td align=center>$exchangerate</td>|;
- $column_data{datepaid} = qq|<td align=center><input name="datepaid_$i" size=11 value=$form->{"datepaid_$i"}></td>|;
- $column_data{source} = qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
- $column_data{memo} = qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
-
- for (@column_index) { print qq|$column_data{$_}\n| }
-
- print "
- </tr>
-";
- }
-
- $form->hide_form("paidaccounts", "select$form->{ARAP}_paid");
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
-}
-
-
-sub form_footer {
-
- $form->hide_form(qw(callback path login sessionid));
-
- $transdate = $form->datetonum(\%myconfig, $form->{transdate});
- $closedto = $form->datetonum(\%myconfig, $form->{closedto});
-
-# type=submit $locale->text('Update')
-# type=submit $locale->text('Print')
-# type=submit $locale->text('Post')
-# type=submit $locale->text('Print and Post')
-# type=submit $locale->text('Schedule')
-# type=submit $locale->text('Ship to')
-# type=submit $locale->text('Post as new')
-# type=submit $locale->text('Print and Post as new')
-# type=submit $locale->text('Delete')
-
- if (! $form->{readonly}) {
-
- &print_options;
-
- print "<br>";
-
- %button = ('Update' => { ndx => 1, key => 'U', value => $locale->text('Update') },
- 'Print' => { ndx => 2, key => 'P', value => $locale->text('Print') },
- 'Post' => { ndx => 3, key => 'O', value => $locale->text('Post') },
- 'Print and Post' => { ndx => 4, key => 'R', value => $locale->text('Print and Post') },
- 'Post as new' => { ndx => 5, key => 'N', value => $locale->text('Post as new') },
- 'Print and Post as new' => { ndx => 6, key => 'W', value => $locale->text('Print and Post as new') },
- 'Schedule' => { ndx => 7, key => 'H', value => $locale->text('Schedule') },
- 'Delete' => { ndx => 8, key => 'D', value => $locale->text('Delete') },
- );
-
- if ($form->{id}) {
-
- if ($form->{locked} || $transdate <= $closedto) {
- for ("Post", "Print and Post", "Delete") { delete $button{$_} }
- }
-
- if (!$latex) {
- for ("Print and Post", "Print and Post as new") { delete $button{$_} }
- }
-
- } else {
-
- for ("Post as new", "Print and Post as new", "Delete") { delete $button{$_} }
- delete $button{"Print and Post"} if ! $latex;
-
- if ($transdate <= $closedto) {
- for ("Post", "Print and Post") { delete $button{$_} }
- }
- }
-
- for (sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button) { $form->print_button(\%button, $_) }
-
- }
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub update {
- my $display = shift;
-
- if (!$display) {
-
- $form->{invtotal} = 0;
-
- $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate});
-
- @flds = ("amount", "$form->{ARAP}_amount", "projectnumber", "description");
- $count = 0;
- @a = ();
- for $i (1 .. $form->{rowcount}) {
- $form->{"amount_$i"} = $form->parse_amount(\%myconfig, $form->{"amount_$i"});
- if ($form->{"amount_$i"}) {
- push @a, {};
- $j = $#a;
-
- for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} }
- $count++;
- }
- }
-
- $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
- $form->{rowcount} = $count + 1;
-
- for (1 .. $form->{rowcount}) { $form->{invtotal} += $form->{"amount_$_"} }
-
- $form->{exchangerate} = $exchangerate if ($form->{forex} = ($exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, ($form->{ARAP} eq 'AR') ? 'buy' : 'sell')));
-
- if ($newname = &check_name($form->{vc})) {
- $form->{notes} = $form->{intnotes} unless $form->{id};
- &rebuild_vc($form->{vc}, $form->{ARAP}, $form->{transdate});
- }
- if ($form->{transdate} ne $form->{oldtransdate}) {
- $form->{duedate} = $form->current_date(\%myconfig, $form->{transdate}, $form->{terms} * 1);
- $form->{oldtransdate} = $form->{transdate};
- $newproj = &rebuild_vc($form->{vc}, $form->{ARAP}, $form->{transdate}) if ! $newname;
- $form->all_projects(\%myconfig, undef, $form->{transdate}) if ! $newproj;
-
- $form->{selectemployee} = "";
- if (@{ $form->{all_employee} }) {
- for (@{ $form->{all_employee} }) { $form->{selectemployee} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
- }
- }
- }
-
- # recalculate taxes
- @taxaccounts = split / /, $form->{taxaccounts};
-
- for (@taxaccounts) { $form->{"tax_$_"} = $form->parse_amount(\%myconfig, $form->{"tax_$_"}) }
-
- if ($form->{taxincluded}) {
-
- $ml = 1;
-
- for (0 .. 1) {
- $taxrate = 0;
- $diff = 0;
-
- for (@taxaccounts) {
- if (($form->{"${_}_rate"} * $ml) > 0) {
- if ($form->{"calctax_$_"}) {
- $taxrate += $form->{"${_}_rate"};
- } else {
- if ($form->{checktax}) {
- if ($form->{"tax_$_"}) {
- $taxrate += $form->{"${_}_rate"};
- }
- }
- }
- }
- }
-
- $taxrate *= $ml;
-
- foreach $item (@taxaccounts) {
- if (($form->{"${item}_rate"} * $ml) > 0) {
-
- if ($taxrate) {
- $a = $form->{invtotal} * $form->{"${item}_rate"} / (1 + $taxrate);
- $b = $form->round_amount($a, 2);
- $tax = $form->round_amount($a - $diff, 2);
- $diff = $b - ($a - $diff);
- }
- $form->{"tax_$item"} = $tax if $form->{"calctax_$item"};
-
- $form->{"select$form->{ARAP}_tax_$item"} = qq|<option>$item--$form->{"${item}_description"}|;
- $totaltax += $form->{"tax_$item"};
- }
- }
- $ml *= -1;
- }
- $totaltax += $form->round_amount($diff, 2);
-
- $form->{checktax} = 1;
-
- } else {
- foreach $item (@taxaccounts) {
- $form->{"calctax_$item"} = 1 if $form->{calctax};
-
- if ($form->{"calctax_$item"}) {
- $form->{"tax_$item"} = $form->round_amount($form->{invtotal} * $form->{"${item}_rate"}, 2);
- }
- $form->{"select$form->{ARAP}_tax_$item"} = qq|<option>$item--$form->{"${item}_description"}|;
- $totaltax += $form->{"tax_$item"};
- }
- }
-
- $form->{invtotal} = ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
-
- $j = 1;
- for $i (1 .. $form->{paidaccounts}) {
- if ($form->{"paid_$i"}) {
- for (qw(datepaid source memo cleared)) { $form->{"${_}_$j"} = $form->{"${_}_$i"} }
- for (qw(paid exchangerate)) { $form->{"${_}_$j"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
-
- $totalpaid += $form->{"paid_$j"};
-
- $form->{"exchangerate_$j"} = $exchangerate if ($form->{"forex_$j"} = ($exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$j"}, ($form->{ARAP} eq 'AR') ? 'buy' : 'sell')));
-
- if ($j++ != $i) {
- for (qw(datepaid source memo paid exchangerate forex cleared)) { delete $form->{"${_}_$i"} }
- }
- } else {
- for (qw(datepaid source memo paid exchangerate forex cleared)) { delete $form->{"${_}_$i"} }
- }
- }
- $form->{paidaccounts} = $j;
-
- $form->{creditremaining} -= ($form->{invtotal} - $totalpaid + $form->{oldtotalpaid} - $form->{oldinvtotal});
- $form->{oldinvtotal} = $form->{invtotal};
- $form->{oldtotalpaid} = $totalpaid;
-
- &display_form;
-
-}
-
-
-sub post {
-
- $label = ($form->{vc} eq 'customer') ? $locale->text('Customer missing!') : $locale->text('Vendor missing!');
-
- # check if there is an invoice number, invoice and due date
- $form->isblank("transdate", $locale->text('Invoice Date missing!'));
- $form->isblank("duedate", $locale->text('Due Date missing!'));
- $form->isblank($form->{vc}, $label);
-
- $closedto = $form->datetonum(\%myconfig, $form->{closedto});
- $transdate = $form->datetonum(\%myconfig, $form->{transdate});
-
- $form->error($locale->text('Cannot post transaction for a closed period!')) if ($transdate <= $closedto);
-
- $form->isblank("exchangerate", $locale->text('Exchange rate missing!')) if ($form->{currency} ne $form->{defaultcurrency});
-
- for $i (1 .. $form->{paidaccounts}) {
- if ($form->{"paid_$i"}) {
- $datepaid = $form->datetonum(\%myconfig, $form->{"datepaid_$i"});
-
- $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
-
- $form->error($locale->text('Cannot post payment for a closed period!')) if ($datepaid <= $closedto);
-
- if ($form->{currency} ne $form->{defaultcurrency}) {
- $form->{"exchangerate_$i"} = $form->{exchangerate} if ($transdate == $datepaid);
- $form->isblank("exchangerate_$i", $locale->text('Exchange rate for payment missing!'));
- }
- }
- }
-
- # if oldname ne name redo form
- ($name) = split /--/, $form->{$form->{vc}};
- if ($form->{"old$form->{vc}"} ne qq|$name--$form->{"$form->{vc}_id"}|) {
- &update;
- exit;
- }
-
- if (! $form->{repost}) {
- if ($form->{id}) {
- &repost;
- exit;
- }
- }
-
- if (AA->post_transaction(\%myconfig, \%$form)) {
- $form->redirect($locale->text('Transaction posted!'));
- } else {
- $form->error($locale->text('Cannot post transaction!'));
- }
-
-}
-
-
-sub delete {
-
- $form->{title} = $locale->text('Confirm!');
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
- $form->{action} = "yes";
- $form->hide_form;
-
- print qq|
-<h2 class=confirm>$form->{title}</h2>
-
-<h4>|.$locale->text('Are you sure you want to delete Transaction').qq| $form->{invnumber}</h4>
-
-<input name=action class=submit type=submit value="|.$locale->text('Yes').qq|">
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-
-sub yes {
-
- if (AA->delete_transaction(\%myconfig, \%$form, $spool)) {
- $form->redirect($locale->text('Transaction deleted!'));
- } else {
- $form->error($locale->text('Cannot delete transaction!'));
- }
-
-}
-
-
-sub search {
-
- $form->create_links($form->{ARAP}, \%myconfig, $form->{vc});
-
- $form->{"select$form->{ARAP}"} = "<option>\n";
- for (@{ $form->{"$form->{ARAP}_links"}{$form->{ARAP}} }) { $form->{"select$form->{ARAP}"} .= "<option>$_->{accno}--$_->{description}\n" }
-
- if (@{ $form->{"all_$form->{vc}"} }) {
- $selectname = "";
- for (@{ $form->{"all_$form->{vc}"} }) { $selectname .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
- $selectname = qq|<select name="$form->{vc}"><option>\n$selectname</select>|;
- } else {
- $selectname = qq|<input name=$form->{vc} size=35>|;
- }
-
- # departments
- if (@{ $form->{all_department} }) {
- $form->{selectdepartment} = "<option>\n";
-
- for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
-
- $l_department = qq|<input name="l_department" class=checkbox type=checkbox value=Y> |.$locale->text('Department');
-
- $department = qq|
- <tr>
- <th align=right nowrap>|.$locale->text('Department').qq|</th>
- <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
- </tr>
-|;
- }
-
- if (@{ $form->{all_employee} }) {
- $form->{selectemployee} = "<option>\n";
- for (@{ $form->{all_employee} }) { $form->{selectemployee} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
-
- $employeelabel = ($form->{ARAP} eq 'AR') ? $locale->text('Salesperson') : $locale->text('Employee');
-
- $employee = qq|
- <tr>
- <th align=right nowrap>$employeelabel</th>
- <td colspan=3><select name=employee>$form->{selectemployee}</select></td>
- </tr>
-|;
-
- $l_employee = qq|<input name="l_employee" class=checkbox type=checkbox value=Y> $employeelabel|;
-
- $l_manager = qq|<input name="l_manager" class=checkbox type=checkbox value=Y> |.$locale->text('Manager');
- }
-
-
- $form->{title} = ($form->{ARAP} eq 'AR') ? $locale->text('AR Transactions') : $locale->text('AP Transactions');
-
- $invnumber = qq|
- <tr>
- <th align=right nowrap>|.$locale->text('Invoice Number').qq|</th>
- <td colspan=3><input name=invnumber size=20></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('Order Number').qq|</th>
- <td colspan=3><input name=ordnumber size=20></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('PO Number').qq|</th>
- <td colspan=3><input name=ponumber size=20></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('Source').qq|</th>
- <td colspan=3><input name=source size=40></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('Description').qq|</th>
- <td colspan=3><input name=description size=40></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('Notes').qq|</th>
- <td colspan=3><input name=notes size=40></td>
- </tr>
-|;
-
- $openclosed = qq|
- <tr>
- <td nowrap><input name=open class=checkbox type=checkbox value=Y checked> |.$locale->text('Open').qq|</td>
- <td nowrap><input name=closed class=checkbox type=checkbox value=Y> |.$locale->text('Closed').qq|</td>
- </tr>
-|;
-
- $summary = qq|
- <tr>
- <td><input name=summary type=radio class=radio value=1 checked> |.$locale->text('Summary').qq|</td>
- <td><input name=summary type=radio class=radio value=0> |.$locale->text('Detail').qq|
- </td>
- </tr>
-|;
-
-
- if ($form->{outstanding}) {
- $form->{title} = ($form->{ARAP} eq 'AR') ? $locale->text('AR Outstanding') : $locale->text('AP Outstanding');
- $invnumber = "";
- $openclosed = "";
- $summary = "";
- }
-
- if (@{ $form->{all_years} }) {
- # accounting years
- $form->{selectaccountingyear} = "<option>\n";
- for (@{ $form->{all_years} }) { $form->{selectaccountingyear} .= qq|<option>$_\n| }
- $form->{selectaccountingmonth} = "<option>\n";
- for (sort keys %{ $form->{all_month} }) { $form->{selectaccountingmonth} .= qq|<option value=$_>|.$locale->text($form->{all_month}{$_}).qq|\n| }
-
- $selectfrom = qq|
- <tr>
- <th align=right>|.$locale->text('Period').qq|</th>
- <td colspan=3>
- <select name=month>$form->{selectaccountingmonth}</select>
- <select name=year>$form->{selectaccountingyear}</select>
- <input name=interval class=radio type=radio value=0 checked>&nbsp;|.$locale->text('Current').qq|
- <input name=interval class=radio type=radio value=1>&nbsp;|.$locale->text('Month').qq|
- <input name=interval class=radio type=radio value=3>&nbsp;|.$locale->text('Quarter').qq|
- <input name=interval class=radio type=radio value=12>&nbsp;|.$locale->text('Year').qq|
- </td>
- </tr>
-|;
- }
-
-
- $name = $locale->text('Customer');
- $l_name = qq|<input name="l_name" class=checkbox type=checkbox value=Y checked> $name|;
- $l_till = qq|<input name="l_till" class=checkbox type=checkbox value=Y> |.$locale->text('Till');
-
- if ($form->{vc} eq 'vendor') {
- $name = $locale->text('Vendor');
- $l_till = "";
- $l_name = qq|<input name="l_name" class=checkbox type=checkbox value=Y checked> $name|;
- }
-
- @a = ();
- push @a, qq|<input name="l_runningnumber" class=checkbox type=checkbox value=Y> |.$locale->text('No.');
- push @a, qq|<input name="l_id" class=checkbox type=checkbox value=Y> |.$locale->text('ID');
- push @a, qq|<input name="l_invnumber" class=checkbox type=checkbox value=Y checked> |.$locale->text('Invoice Number');
- push @a, qq|<input name="l_ordnumber" class=checkbox type=checkbox value=Y> |.$locale->text('Order Number');
- push @a, qq|<input name="l_ponumber" class=checkbox type=checkbox value=Y> |.$locale->text('PO Number');
- push @a, qq|<input name="l_transdate" class=checkbox type=checkbox value=Y checked> |.$locale->text('Invoice Date');
- push @a, $l_name;
- push @a, $l_employee if $l_employee;
- push @a, $l_manager if $l_employee;
- push @a, $l_department if $l_department;
- push @a, qq|<input name="l_netamount" class=checkbox type=checkbox value=Y> |.$locale->text('Amount');
- push @a, qq|<input name="l_tax" class=checkbox type=checkbox value=Y> |.$locale->text('Tax');
- push @a, qq|<input name="l_amount" class=checkbox type=checkbox value=Y checked> |.$locale->text('Total');
- push @a, qq|<input name="l_curr" class=checkbox type=checkbox value=Y> |.$locale->text('Currency');
- push @a, qq|<input name="l_datepaid" class=checkbox type=checkbox value=Y> |.$locale->text('Date Paid');
- push @a, qq|<input name="l_paid" class=checkbox type=checkbox value=Y checked> |.$locale->text('Paid');
- push @a, qq|<input name="l_duedate" class=checkbox type=checkbox value=Y> |.$locale->text('Due Date');
- push @a, qq|<input name="l_due" class=checkbox type=checkbox value=Y> |.$locale->text('Amount Due');
- push @a, qq|<input name="l_notes" class=checkbox type=checkbox value=Y> |.$locale->text('Notes');
- push @a, $l_till if $l_till;
- push @a, qq|<input name="l_shippingpoint" class=checkbox type=checkbox value=Y> |.$locale->text('Shipping Point');
- push @a, qq|<input name="l_shipvia" class=checkbox type=checkbox value=Y> |.$locale->text('Ship via');
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right>|.$locale->text('Account').qq|</th>
- <td colspan=3><select name=$form->{ARAP}>$form->{"select$form->{ARAP}"}</select></td>
- </tr>
- <tr>
- <th align=right>$name</th>
- <td colspan=3>$selectname</td>
- </tr>
- $employee
- $department
- $invnumber
- <tr>
- <th align=right>|.$locale->text('Ship via').qq|</th>
- <td colspan=3><input name=shipvia size=40></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('From').qq|</th>
- <td><input name=transdatefrom size=11 title="$myconfig{dateformat}"></td>
- <th align=right>|.$locale->text('To').qq|</th>
- <td><input name=transdateto size=11 title="$myconfig{dateformat}"></td>
- </tr>
- $selectfrom
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
- <td>
- <table width=100%>
- $openclosed
- $summary
-|;
-
- $form->{sort} = "transdate";
- $form->hide_form(qw(title outstanding sort));
-
-
- while (@a) {
- for (1 .. 5) {
- print qq|<td nowrap>|. shift @a;
- print qq|</td>\n|;
- }
- print qq|</tr>\n|;
- }
-
- print qq|
- <tr>
- <td nowrap><input name="l_subtotal" class=checkbox type=checkbox value=Y> |.$locale->text('Subtotal').qq|</td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<input type=hidden name=action value=continue>
-<input class=submit type=submit name=action value="|.$locale->text('Continue').qq|">|;
-
- $form->hide_form(qw(nextsub path login sessionid));
-
- print qq|
-</form>
-|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-
-</body>
-</html>
-|;
-
-}
-
-
-sub transactions {
-
- if ($form->{$form->{vc}}) {
- $form->{$form->{vc}} = $form->unescape($form->{$form->{vc}});
- ($form->{$form->{vc}}, $form->{"$form->{vc}_id"}) = split(/--/, $form->{$form->{vc}});
- }
-
- AA->transactions(\%myconfig, \%$form);
-
- $href = "$form->{script}?action=transactions";
- for (qw(direction oldsort till outstanding path login sessionid summary)) { $href .= qq|&$_=$form->{$_}| }
- $href .= "&title=".$form->escape($form->{title});
-
- $form->sort_order();
-
- $callback = "$form->{script}?action=transactions";
- for (qw(direction oldsort till outstanding path login sessionid summary)) { $callback .= qq|&$_=$form->{$_}| }
- $callback .= "&title=".$form->escape($form->{title},1);
-
- if ($form->{$form->{ARAP}}) {
- $callback .= "&$form->{ARAP}=".$form->escape($form->{$form->{ARAP}},1);
- $href .= "&$form->{ARAP}=".$form->escape($form->{$form->{ARAP}});
- $form->{$form->{ARAP}} =~ s/--/ /;
- $option = $locale->text('Account')." : $form->{$form->{ARAP}}";
- }
-
- if ($form->{$form->{vc}}) {
- $callback .= "&$form->{vc}=".$form->escape($form->{$form->{vc}},1).qq|--$form->{"$form->{vc}_id"}|;
- $href .= "&$form->{vc}=".$form->escape($form->{$form->{vc}}).qq|--$form->{"$form->{vc}_id"}|;
- $option .= "\n<br>" if ($option);
- $name = ($form->{vc} eq 'customer') ? $locale->text('Customer') : $locale->text('Vendor');
- $option .= "$name : $form->{$form->{vc}}";
- }
- if ($form->{department}) {
- $callback .= "&department=".$form->escape($form->{department},1);
- $href .= "&department=".$form->escape($form->{department});
- ($department) = split /--/, $form->{department};
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Department')." : $department";
- }
- if ($form->{employee}) {
- $callback .= "&employee=".$form->escape($form->{employee},1);
- $href .= "&employee=".$form->escape($form->{employee});
- ($employee) = split /--/, $form->{employee};
- $option .= "\n<br>" if ($option);
- if ($form->{ARAP} eq 'AR') {
- $option .= $locale->text('Salesperson');
- } else {
- $option .= $locale->text('Employee');
- }
- $option .= " : $employee";
- }
-
- if ($form->{invnumber}) {
- $callback .= "&invnumber=".$form->escape($form->{invnumber},1);
- $href .= "&invnumber=".$form->escape($form->{invnumber});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Invoice Number')." : $form->{invnumber}";
- }
- if ($form->{ordnumber}) {
- $callback .= "&ordnumber=".$form->escape($form->{ordnumber},1);
- $href .= "&ordnumber=".$form->escape($form->{ordnumber});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Order Number')." : $form->{ordnumber}";
- }
- if ($form->{ponumber}) {
- $callback .= "&ponumber=".$form->escape($form->{ponumber},1);
- $href .= "&ponumber=".$form->escape($form->{ponumber});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('PO Number')." : $form->{ponumber}";
- }
- if ($form->{source}) {
- $callback .= "&source=".$form->escape($form->{source},1);
- $href .= "&source=".$form->escape($form->{source});
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Source')." : $form->{source}";
- }
- if ($form->{description}) {
- $callback .= "&description=".$form->escape($form->{description},1);
- $href .= "&description=".$form->escape($form->{description});
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Description')." : $form->{description}";
- }
- if ($form->{notes}) {
- $callback .= "&notes=".$form->escape($form->{notes},1);
- $href .= "&notes=".$form->escape($form->{notes});
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Notes')." : $form->{notes}";
- }
- if ($form->{shipvia}) {
- $callback .= "&shipvia=".$form->escape($form->{shipvia},1);
- $href .= "&shipvia=".$form->escape($form->{shipvia});
- $option .= "\n<br>" if $option;
- $option .= $locale->text('Ship via')." : $form->{shipvia}";
- }
- if ($form->{transdatefrom}) {
- $callback .= "&transdatefrom=$form->{transdatefrom}";
- $href .= "&transdatefrom=$form->{transdatefrom}";
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('From')."&nbsp;".$locale->date(\%myconfig, $form->{transdatefrom}, 1);
- }
- if ($form->{transdateto}) {
- $callback .= "&transdateto=$form->{transdateto}";
- $href .= "&transdateto=$form->{transdateto}";
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('To')."&nbsp;".$locale->date(\%myconfig, $form->{transdateto}, 1);
- }
- if ($form->{open}) {
- $callback .= "&open=$form->{open}";
- $href .= "&open=$form->{open}";
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Open');
- }
- if ($form->{closed}) {
- $callback .= "&closed=$form->{closed}";
- $href .= "&closed=$form->{closed}";
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Closed');
- }
-
- @columns = $form->sort_columns(qw(transdate id invnumber ordnumber ponumber name netamount tax amount paid due curr datepaid duedate notes till employee manager shippingpoint shipvia department));
- pop @columns if $form->{department};
- unshift @columns, "runningnumber";
-
- foreach $item (@columns) {
- if ($form->{"l_$item"} eq "Y") {
- push @column_index, $item;
-
- if ($form->{l_curr} && $item =~ /(amount|tax|paid|due)/) {
- push @column_index, "fx_$item";
- }
-
- # add column to href and callback
- $callback .= "&l_$item=Y";
- $href .= "&l_$item=Y";
- }
- }
-
- if (!$form->{summary}) {
- foreach $item (qw(source debit credit accno description projectnumber)) {
- push @column_index, $item;
- }
- }
-
- if ($form->{l_subtotal} eq 'Y') {
- $callback .= "&l_subtotal=Y";
- $href .= "&l_subtotal=Y";
- }
-
- $employee = ($form->{ARAP} eq 'AR') ? $locale->text('Salesperson') : $locale->text('Employee');
- $name = ($form->{vc} eq 'customer') ? $locale->text('Customer') : $locale->text('Vendor');
-
- $column_header{runningnumber} = qq|<th class=listheading>&nbsp;</th>|;
- $column_header{id} = "<th><a class=listheading href=$href&sort=id>".$locale->text('ID')."</a></th>";
- $column_header{transdate} = "<th><a class=listheading href=$href&sort=transdate>".$locale->text('Date')."</a></th>";
- $column_header{duedate} = "<th><a class=listheading href=$href&sort=duedate>".$locale->text('Due Date')."</a></th>";
- $column_header{invnumber} = "<th><a class=listheading href=$href&sort=invnumber>".$locale->text('Invoice')."</a></th>";
- $column_header{ordnumber} = "<th><a class=listheading href=$href&sort=ordnumber>".$locale->text('Order')."</a></th>";
- $column_header{ponumber} = "<th><a class=listheading href=$href&sort=ponumber>".$locale->text('PO Number')."</a></th>";
- $column_header{name} = "<th><a class=listheading href=$href&sort=name>$name</a></th>";
- $column_header{netamount} = "<th class=listheading>" . $locale->text('Amount') . "</th>";
- $column_header{tax} = "<th class=listheading>" . $locale->text('Tax') . "</th>";
- $column_header{amount} = "<th class=listheading>" . $locale->text('Total') . "</th>";
- $column_header{paid} = "<th class=listheading>" . $locale->text('Paid') . "</th>";
- $column_header{datepaid} = "<th><a class=listheading href=$href&sort=datepaid>" . $locale->text('Date Paid') . "</a></th>";
- $column_header{due} = "<th class=listheading>" . $locale->text('Amount Due') . "</th>";
- $column_header{notes} = "<th class=listheading>".$locale->text('Notes')."</th>";
- $column_header{employee} = "<th><a class=listheading href=$href&sort=employee>$employee</th>";
- $column_header{manager} = "<th><a class=listheading href=$href&sort=manager>".$locale->text('Manager')."</th>";
- $column_header{till} = "<th class=listheading><a class=listheading href=$href&sort=till>".$locale->text('Till')."</th>";
-
- $column_header{shippingpoint} = "<th><a class=listheading href=$href&sort=shippingpoint>" . $locale->text('Shipping Point') . "</a></th>";
- $column_header{shipvia} = "<th><a class=listheading href=$href&sort=shipvia>" . $locale->text('Ship via') . "</a></th>";
-
- $column_header{curr} = "<th><a class=listheading href=$href&sort=curr>" . $locale->text('Curr') . "</a></th>";
- for (qw(amount tax netamount paid due)) { $column_header{"fx_$_"} = "<th>&nbsp;</th>" }
-
- $column_header{department} = "<th><a class=listheading href=$href&sort=department>" . $locale->text('Department') . "</a></th>";
-
- $column_header{accno} = "<th><a class=listheading href=$href&sort=accno>" . $locale->text('Account') . "</a></th>";
- $column_header{source} = "<th><a class=listheading href=$href&sort=source>" . $locale->text('Source') . "</a></th>";
- $column_header{debit} = "<th class=listheading>" . $locale->text('Debit') . "</th>";
- $column_header{credit} = "<th class=listheading>" . $locale->text('Credit') . "</th>";
- $column_header{projectnumber} = "<th><a class=listheading href=$href&sort=projectnumber>" . $locale->text('Project') . "</a></th>";
- $column_header{description} = "<th><a class=listheading href=$href&sort=linedescription>" . $locale->text('Description') . "</a></th>";
-
- $form->{title} = ($form->{title}) ? $form->{title} : $locale->text('AR Transactions');
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- for (@column_index) { print "\n$column_header{$_}" }
-
- print qq|
- </tr>
-|;
-
-
- # add sort and escape callback, this one we use for the add sub
- $form->{callback} = $callback .= "&sort=$form->{sort}";
-
- # escape callback for href
- $callback = $form->escape($callback);
-
- # flip direction
- $direction = ($form->{direction} eq 'ASC') ? "ASC" : "DESC";
- $href =~ s/&direction=(\w+)&/&direction=$direction&/;
-
- if (@{ $form->{transactions} }) {
- $sameitem = $form->{transactions}->[0]->{$form->{sort}};
- }
-
- # sums and tax on reports by Antonio Gallardo
- #
- $i = 0;
- foreach $ref (@{ $form->{transactions} }) {
-
- $i++;
-
- if ($form->{l_subtotal} eq 'Y') {
- if ($sameitem ne $ref->{$form->{sort}}) {
- &subtotal;
- $sameitem = $ref->{$form->{sort}};
- }
- }
-
- if ($form->{l_curr}) {
- for (qw(netamount amount paid)) { $ref->{"fx_$_"} = $ref->{$_}/$ref->{exchangerate} }
-
- for (qw(netamount amount paid)) { $column_data{"fx_$_"} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{"fx_$_"}, 2, "&nbsp;")."</td>" }
-
- $column_data{fx_tax} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{fx_amount} - $ref->{fx_netamount}, 2, "&nbsp;")."</td>";
- $column_data{fx_due} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{fx_amount} - $ref->{fx_paid}, 2, "&nbsp;")."</td>";
-
- $subtotalfxnetamount += $ref->{fx_netamount};
- $subtotalfxamount += $ref->{fx_amount};
- $subtotalfxpaid += $ref->{fx_paid};
-
- $totalfxnetamount += $ref->{fx_netamount};
- $totalfxamount += $ref->{fx_amount};
- $totalfxpaid += $ref->{fx_paid};
-
- }
-
- $column_data{runningnumber} = "<td align=right>$i</td>";
-
- for (qw(netamount amount paid debit credit)) { $column_data{$_} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{$_}, 2, "&nbsp;")."</td>" }
-
- $column_data{tax} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount} - $ref->{netamount}, 2, "&nbsp;")."</td>";
- $column_data{due} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount} - $ref->{paid}, 2, "&nbsp;")."</td>";
-
-
- $subtotalnetamount += $ref->{netamount};
- $subtotalamount += $ref->{amount};
- $subtotalpaid += $ref->{paid};
- $subtotaldebit += $ref->{debit};
- $subtotalcredit += $ref->{credit};
-
- $totalnetamount += $ref->{netamount};
- $totalamount += $ref->{amount};
- $totalpaid += $ref->{paid};
- $totaldebit += $ref->{debit};
- $totalcredit += $ref->{credit};
-
- $module = ($ref->{invoice}) ? ($form->{ARAP} eq 'AR') ? "is.pl" : "ir.pl" : $form->{script};
- $module = ($ref->{till}) ? "ps.pl" : $module;
-
- $column_data{invnumber} = "<td><a href=$module?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{invnumber}&nbsp;</a></td>";
-
- for (qw(notes description)) { $ref->{$_} =~ s/\r?\n/<br>/g }
- for (qw(transdate datepaid duedate department ordnumber ponumber notes shippingpoint shipvia employee manager till source description projectnumber)) { $column_data{$_} = "<td>$ref->{$_}&nbsp;</td>" }
- for (qw(id curr)) { $column_data{$_} = "<td>$ref->{$_}</td>" }
-
- $column_data{accno} = qq|<td><a href=ca.pl?path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&action=list_transactions&accounttype=standard&accno=$ref->{accno}&fromdate=$form->{transdatefrom}&todate=$form->{transdateto}&sort=transdate&l_subtotal=$form->{l_subtotal}&prevreport=$callback>$ref->{accno}</a></td>|;
-
- $column_data{name} = qq|<td><a href=ct.pl?path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&action=edit&id=$ref->{"$form->{vc}_id"}&db=$form->{vc}&callback=$callback>$ref->{name}</a></td>|;
-
- if ($ref->{id} != $sameid) {
- $j++; $j %= 2;
- }
-
- print "
- <tr class=listrow$j>
-";
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- print qq|
- </tr>
-|;
-
- $sameid = $ref->{id};
-
-
- }
-
- if ($form->{l_subtotal} eq 'Y') {
- &subtotal;
- $sameitem = $ref->{$form->{sort}};
- }
-
- # print totals
- print qq|
- <tr class=listtotal>
-|;
-
- for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-
- $column_data{netamount} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalnetamount, 2, "&nbsp;")."</th>";
- $column_data{tax} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalamount - $totalnetamount, 2, "&nbsp;")."</th>";
- $column_data{amount} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalamount, 2, "&nbsp;")."</th>";
- $column_data{paid} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalpaid, 2, "&nbsp;")."</th>";
- $column_data{due} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalamount - $totalpaid, 2, "&nbsp;")."</th>";
- $column_data{debit} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totaldebit, 2, "&nbsp;")."</th>";
- $column_data{credit} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalcredit, 2, "&nbsp;")."</th>";
-
- if ($form->{l_curr} && $form->{sort} eq 'curr' && $form->{l_subtotal}) {
- $column_data{fx_netamount} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalfxnetamount, 2, "&nbsp;")."</th>";
- $column_data{fx_tax} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalfxamount - $totalfxnetamount, 2, "&nbsp;")."</th>";
- $column_data{fx_amount} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalfxamount, 2, "&nbsp;")."</th>";
- $column_data{fx_paid} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalfxpaid, 2, "&nbsp;")."</th>";
- $column_data{fx_due} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalfxamount - $totalfxpaid, 2, "&nbsp;")."</th>";
- }
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- if ($myconfig{acs} !~ /$form->{ARAP}--$form->{ARAP}/) {
- $i = 1;
- if ($form->{ARAP} eq 'AR') {
- $button{'AR--Add Transaction'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('AR Transaction').qq|"> |;
- $button{'AR--Add Transaction'}{order} = $i++;
- $button{'AR--Sales Invoice'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Sales Invoice.').qq|"> |;
- $button{'AR--Sales Invoice'}{order} = $i++;
- } else {
- $button{'AP--Add Transaction'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('AP Transaction').qq|"> |;
- $button{'AP--Add Transaction'}{order} = $i++;
- $button{'AP--Vendor Invoice'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Vendor Invoice.').qq|"> |;
- $button{'AP--Vendor Invoice'}{order} = $i++;
- }
-
- foreach $item (split /;/, $myconfig{acs}) {
- delete $button{$item};
- }
- }
-
- print qq|
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=$form->{script}>
-|;
-
- $form->hide_form("callback", "path", "login", "sessionid", "$form->{vc}", "$form->{vc}_id");
-
- if (! $form->{till}) {
- foreach $item (sort { $a->{order} <=> $b->{order} } %button) {
- print $item->{code};
- }
- }
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub subtotal {
-
- for (@column_index) { $column_data{$_} = "<td>&nbsp;</td>" }
-
- $column_data{tax} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount, 2, "&nbsp;")."</th>";
- $column_data{amount} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotalamount, 2, "&nbsp;")."</th>";
- $column_data{paid} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotalpaid, 2, "&nbsp;")."</th>";
- $column_data{due} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotalamount - $subtotalpaid, 2, "&nbsp;")."</th>";
- $column_data{debit} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotaldebit, 2, "&nbsp;")."</th>";
- $column_data{credit} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotalcredit, 2, "&nbsp;")."</th>";
-
- if ($form->{l_curr} && $form->{sort} eq 'curr' && $form->{l_subtotal}) {
- $column_data{fx_tax} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotalfxamount - $subtotalfxnetamount, 2, "&nbsp;")."</th>";
- $column_data{fx_amount} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotalfxamount, 2, "&nbsp;")."</th>";
- $column_data{fx_paid} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotalfxpaid, 2, "&nbsp;")."</th>";
- $column_data{fx_due} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotalfxmount - $subtotalfxpaid, 2, "&nbsp;")."</th>";
- }
-
- $subtotalnetamount = 0;
- $subtotalamount = 0;
- $subtotalpaid = 0;
- $subtotaldebit = 0;
- $subtotalcredit = 0;
-
- $subtotalfxnetamount = 0;
- $subtotalfxamount = 0;
- $subtotalfxpaid = 0;
-
- print "<tr class=listsubtotal>";
-
- for (@column_index) { print "\n$column_data{$_}" }
-
-print "
-</tr>
-";
-
-}
-
-
-
diff --git a/bin/lynx/admin.pl b/bin/lynx/admin.pl
index 73c1729e..717ea889 100755
--- a/bin/lynx/admin.pl
+++ b/bin/lynx/admin.pl
@@ -1,1637 +1,3 @@
-#=====================================================================
-# LedgerSMB
-# Small Medium Business Accounting software
-#
-# See COPYRIGHT file for copyright information
-#======================================================================
-#
-# This file has NOT undergone whitespace cleanup.
-#
-#======================================================================
-#
-# setup module
-# add/edit/delete users
-#
-#======================================================================
-
-$menufile = "menu.ini";
-
-use LedgerSMB::Form;
-use LedgerSMB::User;
-
-
-$form = new Form;
-
-$locale = new Locale $language, "admin";
-$form->{charset} = $locale->{charset};
-
-eval { require DBI; };
-$form->error($locale->text('DBI not installed!')) if ($@);
-
-$form->{stylesheet} = "ledger-smb.css";
-$form->{favicon} = "favicon.ico";
-$form->{timeout} = 600;
-
-require "$form->{path}/pw.pl";
-
-# customization
-if (-f "$form->{path}/custom_$form->{script}") {
- eval { require "$form->{path}/custom_$form->{script}"; };
- $form->error($@) if ($@);
-}
-
-
-if ($form->{action}) {
-
- &check_password unless $form->{action} eq 'logout';
-
- &{ $locale->findsub($form->{action}) };
-
-} else {
-
- # if there are no drivers bail out
- $form->error($locale->text('No Database Drivers available!')) unless (User->dbdrivers);
-
- # create memberfile
- if (! -f $memberfile) {
- open(FH, ">$memberfile") or $form->error("$memberfile : $!");
- print FH qq|# LedgerSMB Accounting members
-
-[root login]
-password=
-
-|;
- close FH;
- }
-
- &adminlogin;
-
-}
-
-1;
-# end
-
-
-sub adminlogin {
-
- $form->{title} = qq|LedgerSMB $form->{version} |.$locale->text('Administration');
-
- $myheaderadd = qq|
-<script language="JavaScript" type="text/javascript">
-<!--
-function sf(){
- document.admin.password.focus();
-}
-// End -->
-</script>
- |;
- $form->header(undef, $headeradd);
-
- print qq|
-<body class=admin onload="sf()">
-
-<div align=center>
-
-<a href="http://sourceforge.net/projects/ledger-smb/"><img src="ledger-smb.png" width="200" height="100" border="0" alt="LedgerSMB Logo"></a>
-<h1 class=login>|.$locale->text('Version').qq| $form->{version}<p>|.$locale->text('Administration').qq|</h1>
-
-<form method=post action="$form->{script}" name=admin>
-
-<table>
- <tr>
- <th>|.$locale->text('Password').qq|</th>
- <td><input type=password name=password></td>
- <td><input type=submit class=submit name=action value="|.$locale->text('Login').qq|"></td>
- </tr>
-<input type=hidden name=action value=login>
-<input type=hidden name=path value=$form->{path}>
-</table>
-
-</form>
-
-<a href="http://sourceforge.net/projects/ledger-smb/">LedgerSMB |.$locale->text('website').qq|</a>
-
-</div>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub login {
-
- &list_users;
-
-}
-
-
-sub logout {
-
- $form->{callback} = "$form->{script}?path=$form->{path}&endsession=1";
- unlink "$userspath/adminhash";
- print qq|Set-Cookie: LedgerSMB=; path=/;\n|;
- $form->redirect($locale->text('You are logged out'));
-
-}
-
-
-sub add_user {
-
- $form->{title} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Administration')." / ".$locale->text('Add User');
-
- $form->{Oracle_sid} = $sid;
- $form->{Oracle_dbport} = '1521';
- $form->{Oracle_dbhost} = `hostname`;
-
- if (-f "css/ledger-smb.css") {
- $myconfig->{stylesheet} = "ledger-smb.css";
- }
- $myconfig->{vclimit} = 1000;
- $myconfig->{menuwidth} = 155;
- $myconfig->{timeout} = 3600;
-
- &form_header;
- &form_footer;
-
-}
-
-
-
-sub edit {
-
- $form->{title} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Administration')." / ".$locale->text('Edit User');
- $form->{edit} = 1;
-
- &form_header;
- &form_footer;
-
-}
-
-
-sub form_footer {
-
- if ($form->{edit}) {
- $delete = qq|<input type=submit class=submit name=action value="|.$locale->text('Delete').qq|">
-<input type=hidden name=edit value=1>|;
- }
-
- print qq|
-
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}">
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<input type=submit class=submit name=action value="|.$locale->text('Save').qq|">
-$delete
-
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub list_users {
-
- open(FH, "$memberfile") or $form->error("$memberfile : $!");
-
- $nologin = qq|
-<input type=submit class=submit name=action value="|.$locale->text('Lock System').qq|">|;
-
- if (-e "$userspath/nologin") {
- $nologin = qq|
-<input type=submit class=submit name=action value="|.$locale->text('Unlock System').qq|">|;
- }
-
-
- while (<FH>) {
- chop;
-
- if (/^\[.*\]/) {
- $login = $_;
- $login =~ s/(\[|\])//g;
- }
-
- if (/^(name=|company=|templates=|dbuser=|dbdriver=|dbname=|dbhost=)/) {
- chop ($var = $&);
- ($null, $member{$login}{$var}) = split /=/, $_, 2;
- }
- }
-
- close(FH);
-
-# type=submit $locale->text('Pg Database Administration')
-# type=submit $locale->text('PgPP Database Administration')
-# type=submit $locale->text('Oracle Database Administration')
-
- foreach $item (User->dbdrivers) {
- $dbdrivers .= qq|<input name=action type=submit class=submit value="|.$locale->text("$item Database Administration").qq|">|;
- }
-
-
- $column_header{login} = qq|<th>|.$locale->text('Login').qq|</th>|;
- $column_header{name} = qq|<th>|.$locale->text('Name').qq|</th>|;
- $column_header{company} = qq|<th>|.$locale->text('Company').qq|</th>|;
- $column_header{dbdriver} = qq|<th>|.$locale->text('Driver').qq|</th>|;
- $column_header{dbhost} = qq|<th>|.$locale->text('Host').qq|</th>|;
- $column_header{dataset} = qq|<th>|.$locale->text('Dataset').qq|</th>|;
- $column_header{templates} = qq|<th>|.$locale->text('Templates').qq|</th>|;
-
- @column_index = qw(login name company dbdriver dbhost dataset templates);
-
- $form->{title} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Administration');
-
- $form->{login} = "root login";
- $form->header;
-
- print qq|
-<body class=admin>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr>
- <tr class=listheading>
- <th>$form->{title}</th>
- </tr>
- <tr size=5></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
- </tr>
-|;
-
-foreach $key (sort keys %member) {
- $href = "$script?action=edit&login=$key&path=$form->{path}&sessionid=$form->{sessionid}";
- $href =~ s/ /%20/g;
-
- $member{$key}{templates} =~ s/^$templates\///;
- $member{$key}{dbhost} = $locale->text('localhost') unless $member{$key}{dbhost};
- $member{$key}{dbname} = $member{$key}{dbuser} if ($member{$key}{dbdriver} eq 'Oracle');
-
- $column_data{login} = qq|<td><a href=$href>$key</a></td>|;
- $column_data{name} = qq|<td>$member{$key}{name}</td>|;
- $column_data{company} = qq|<td>$member{$key}{company}</td>|;
- $column_data{dbdriver} = qq|<td>$member{$key}{dbdriver}</td>|;
- $column_data{dbhost} = qq|<td>$member{$key}{dbhost}</td>|;
- $column_data{dataset} = qq|<td>$member{$key}{dbname}</td>|;
- $column_data{templates} = qq|<td>$member{$key}{templates}</td>|;
-
- $i++; $i %= 2;
- print qq|
- <tr class=listrow$i>|;
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
- </tr>|;
-}
-
-
-print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<br><input type=submit class=submit name=action value="|.$locale->text('Add User').qq|">
-<input type=submit class=submit name=action value="|.$locale->text('Change Admin Password').qq|">
-
-$dbdrivers
-$nologin
-
-<input type=submit class=submit name=action value="|.$locale->text('Logout').qq|">
-
-</form>
-
-|.$locale->text('Click on login name to edit!').qq|
-<br>
-|.$locale->text('To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.').qq|
-
-</body>
-</html>
-|;
-
-}
-
-
-
-sub form_header {
-
- # if there is a login, get user
- if ($form->{login}) {
- # get user
- $myconfig = new User "$memberfile", "$form->{login}";
-
- for (qw(company address signature)) { $myconfig->{$_} = $form->quote($myconfig->{$_}) }
- for (qw(address signature)) { $myconfig->{$_} =~ s/\\n/\n/g }
-
- # strip basedir from templates directory
- $myconfig->{templates} =~ s/^$templates\///;
-
- $myconfig->{dbpasswd} = unpack 'u', $myconfig->{dbpasswd};
- }
-
- foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
- $dateformat .= ($item eq $myconfig->{dateformat}) ? "<option selected>$item\n" : "<option>$item\n";
- }
-
- foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00 1'000.00)) {
- $numberformat .= ($item eq $myconfig->{numberformat}) ? "<option selected>$item\n" : "<option>$item\n";
- }
-
-
- %countrycodes = User->country_codes;
- $countrycodes = "";
-
- foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
- $countrycodes .= ($myconfig->{countrycode} eq $key) ? "<option selected value=$key>$countrycodes{$key}" : "<option value=$key>$countrycodes{$key}";
- }
- $countrycodes = qq|<option value="">English\n$countrycodes|;
-
- # is there a templates basedir
- if (! -d "$templates") {
- $form->error($locale->text('Directory').": $templates ".$locale->text('does not exist'));
- }
-
- opendir TEMPLATEDIR, "$templates/." or $form->error("$templates : $!");
- @all = grep !/^\.\.?$/, readdir TEMPLATEDIR;
- closedir TEMPLATEDIR;
-
- @allhtml = sort grep /\.html/, @all;
-
- @alldir = ();
- for (@all) {
- if (-d "$templates/$_") {
- push @alldir, $_;
- }
- }
-
- @allhtml = reverse grep !/Default/, @allhtml;
- push @allhtml, 'Default';
- @allhtml = reverse @allhtml;
-
- foreach $item (sort @alldir) {
- if ($item eq $myconfig->{templates}) {
- $usetemplates .= qq|<option selected>$item\n|;
- } else {
- $usetemplates .= qq|<option>$item\n|;
- }
- }
-
- $lastitem = $allhtml[0];
- $lastitem =~ s/-.*//g;
- $mastertemplates = qq|<option>$lastitem\n|;
- foreach $item (@allhtml) {
- $item =~ s/-.*//g;
-
- if ($item ne $lastitem) {
- $mastertemplates .= qq|<option>$item\n|;
- $lastitem = $item;
- }
- }
-
- opendir CSS, "css/.";
- @all = grep /.*\.css$/, readdir CSS;
- closedir CSS;
-
- foreach $item (@all) {
- if ($item eq $myconfig->{stylesheet}) {
- $selectstylesheet .= qq|<option selected>$item\n|;
- } else {
- $selectstylesheet .= qq|<option>$item\n|;
- }
- }
- $selectstylesheet .= "<option>\n";
-
- if (%printer && $latex) {
- $selectprinter = "<option>\n";
- foreach $item (sort keys %printer) {
- if ($myconfig->{printer} eq $item) {
- $selectprinter .= qq|<option value="$item" selected>$item\n|;
- } else {
- $selectprinter .= qq|<option value="$item">$item\n|;
- }
- }
-
- $printer = qq|
- <tr>
- <th align=right>|.$locale->text('Printer').qq|</th>
- <td><select name=printer>$selectprinter</select></td>
- </tr>
-|;
-
- }
-
- $user = $form->{login};
- $form->{login} = "root login";
- $form->header;
- $form->{login} = $user;
-
- print qq|
-<body class=admin>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr class=listheading><th colspan=2>$form->{title}</th></tr>
- <tr size=5></tr>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align=right>|.$locale->text('Login').qq|</th>
- <td><input name=login value="$myconfig->{login}"></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Password').qq|</th>
- <td><input type=password name=new_password size=8 value=$myconfig->{password}></td>
- <input type=hidden name=old_password value=$myconfig->{password}>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Name').qq|</th>
- <td><input name=name size=15 value="$myconfig->{name}"></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('E-mail').qq|</th>
- <td><input name=email size=30 value="$myconfig->{email}"></td>
- </tr>
- <tr valign=top>
- <th align=right>|.$locale->text('Signature').qq|</th>
- <td><textarea name=signature rows=3 cols=35>$myconfig->{signature}</textarea></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Phone').qq|</th>
- <td><input name=tel size=14 value="$myconfig->{tel}"></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Fax').qq|</th>
- <td><input name=fax size=14 value="$myconfig->{fax}"></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Company').qq|</th>
- <td><input name=company size=35 value="$myconfig->{company}"></td>
- </tr>
- <tr valign=top>
- <th align=right>|.$locale->text('Address').qq|</th>
- <td><textarea name=address rows=4 cols=35>$myconfig->{address}</textarea></td>
- </tr>
- </table>
- </td>
- <td>
- <table>
- <tr>
- <th align=right>|.$locale->text('Date Format').qq|</th>
- <td><select name=dateformat>$dateformat</select></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Number Format').qq|</th>
- <td><select name=numberformat>$numberformat</select></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Dropdown Limit').qq|</th>
- <td><input name=vclimit value="$myconfig->{vclimit}"></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Menu Width').qq|</th>
- <td><input name=menuwidth value="$myconfig->{menuwidth}"></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Language').qq|</th>
- <td><select name=countrycode>$countrycodes</select></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Session Timeout').qq|</th>
- <td><input name=newtimeout value="$myconfig->{timeout}"></td>
- </tr>
-
- <tr>
- <th align=right>|.$locale->text('Stylesheet').qq|</th>
- <td><select name=userstylesheet>$selectstylesheet</select></td>
- </tr>
- $printer
- <tr>
- <th align=right>|.$locale->text('Use Templates').qq|</th>
- <td><select name=usetemplates>$usetemplates</select></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('New Templates').qq|</th>
- <td><input name=newtemplates></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Setup Templates').qq|</th>
- <td><select name=mastertemplates>$mastertemplates</select></td>
- </tr>
- <input type=hidden name=templates value=$myconfig->{templates}>
- </table>
- </td>
- </tr>
- <tr class=listheading>
- <th colspan=2>|.$locale->text('Database').qq|</th>
- </tr>|;
-
- # list section for database drivers
- foreach $item (User->dbdrivers) {
-
- print qq|
- <tr>
- <td colspan=2>
- <table>
- <tr>|;
-
- $checked = "";
- if ($myconfig->{dbdriver} eq $item) {
- for (qw(dbhost dbport dbuser dbpasswd dbname sid)) { $form->{"${item}_$_"} = $myconfig->{$_} }
- $checked = "checked";
- }
-
- print qq|
- <th align=right>|.$locale->text('Driver').qq|</th>
- <td><input name=dbdriver type=radio class=radio value=$item $checked>&nbsp;$item</td>
- <th align=right>|.$locale->text('Host').qq|</th>
- <td><input name="${item}_dbhost" size=30 value=$form->{"${item}_dbhost"}></td>
- </tr>
- <tr>|;
-
- if ($item =~ /Pg/) {
- print qq|
- <th align=right>|.$locale->text('Dataset').qq|</th>
- <td><input name="${item}_dbname" size=15 value=$form->{"${item}_dbname"}></td>
- <th align=right>|.$locale->text('Port').qq|</th>
- <td><input name="${item}_dbport" size=4 value=$form->{"${item}_dbport"}></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('User').qq|</th>
- <td><input name="${item}_dbuser" size=15 value=$form->{"${item}_dbuser"}></td>
- <th align=right>|.$locale->text('Password').qq|</th>
- <td><input name="${item}_dbpasswd" type=password size=10 value=$form->{"${item}_dbpasswd"}></td>
- </tr>|;
-
- }
-
- if ($item eq 'Oracle') {
- print qq|
- <th align=right>SID</th>
- <td><input name=Oracle_sid value=$form->{Oracle_sid}></td>
- <th align=right>|.$locale->text('Port').qq|</th>
- <td><input name="${item}_dbport size=4 value=$form->{"${item}_dbport"}></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Dataset').qq|</th>
- <td><input name="${item}_dbuser" size=15 value=$form->{"${item}_dbuser"}></td>
- <th align=right>|.$locale->text('Password').qq|</th>
- <td><input name="${item}_dbpasswd" type=password size=10 value=$form->{"${item}_dbpasswd"}></td>
-
- </tr>|;
- }
-
-
- print qq|
- <input type=hidden name=old_dbpasswd value=$myconfig->{dbpasswd}>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan=2><hr size=2 noshade></td>
- </tr>
-|;
-
- }
-
-
- # access control
- open(FH, $menufile) or $form->error("$menufile : $!");
- # scan for first menu level
- @a = <FH>;
- close(FH);
-
- if (open(FH, "custom_$menufile")) {
- push @a, <FH>;
- }
- close(FH);
-
- foreach $item (@a) {
- next unless $item =~ /\[\w+/;
- next if $item =~ /\#/;
-
- $item =~ s/(\[|\])//g;
- chop $item;
-
- if ($item =~ /--/) {
- ($level, $menuitem) = split /--/, $item, 2;
- } else {
- $level = $item;
- $menuitem = $item;
- push @acsorder, $item;
- }
-
- push @{ $acs{$level} }, $menuitem;
-
- }
-
- %role = ( 'admin' => $locale->text('Administrator'),
- 'user' => $locale->text('User'),
- 'supervisor' => $locale->text('Supervisor'),
- 'manager' => $locale->text('Manager')
-
- );
-
- $selectrole = "";
- foreach $item (qw(user admin supervisor manager)) {
- $selectrole .= ($myconfig->{role} eq $item) ? "<option selected value=$item>$role{$item}\n" : "<option value=$item>$role{$item}\n";
- }
-
- print qq|
- <tr class=listheading>
- <th colspan=2>|.$locale->text('Access Control').qq|</th>
- </tr>
- <tr>
- <td><select name=role>$selectrole</select></td>
- </tr>
-|;
-
- foreach $item (split /;/, $myconfig->{acs}) {
- ($key, $value) = split /--/, $item, 2;
- $excl{$key}{$value} = 1;
- }
-
- foreach $key (@acsorder) {
-
- $checked = "checked";
- if ($form->{login}) {
- $checked = ($excl{$key}{$key}) ? "" : "checked";
- }
-
- # can't have variable names with & and spaces
- $item = $form->escape("${key}--$key",1);
-
- $acsheading = $key;
- $acsheading =~ s/ /&nbsp;/g;
-
- $acsheading = qq|
- <th align=left nowrap><input name="$item" class=checkbox type=checkbox value=1 $checked>&nbsp;$acsheading</th>\n|;
- $menuitems .= "$item;";
- $acsdata = "
- <td>";
-
- foreach $item (@{ $acs{$key} }) {
-
- next if ($key eq $item);
-
- $checked = "checked";
- if ($form->{login}) {
- $checked = ($excl{$key}{$item}) ? "" : "checked";
- }
-
- $acsitem = $form->escape("${key}--$item",1);
-
- $acsdata .= qq|
- <br><input name="$acsitem" class=checkbox type=checkbox value=1 $checked>&nbsp;$item|;
- $menuitems .= "$acsitem;";
- }
-
- $acsdata .= "
- </td>";
-
- print qq|
- <tr valign=top>$acsheading $acsdata
- </tr>
-|;
- }
-
- print qq|<input type=hidden name=acs value="$menuitems">
-
- <tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-</div>
-|;
-
-}
-
-
-sub save {
-
- # no driver checked
- $form->error($locale->text('Database Driver not checked!')) unless $form->{dbdriver};
-
- # no spaces allowed in login name
- $form->{login} =~ s/ //g;
-
- $form->isblank("login", $locale->text('Login name missing!'));
-
- # check for duplicates
- if (!$form->{edit}) {
- $temp = new User "$memberfile", "$form->{login}";
-
- if ($temp->{login}) {
- $form->error("$form->{login} ".$locale->text('is already a member!'));
- }
- }
-
- # no spaces allowed in directories
- $form->{newtemplates} =~ s/( |\.\.|\*)//g;
-
- if ($form->{newtemplates} ne "") {
- $form->{templates} = $form->{newtemplates};
- } else {
- $form->{templates} = ($form->{usetemplates}) ? $form->{usetemplates} : $form->{login};
- }
-
- # is there a basedir
- if (! -d "$templates") {
- $form->error($locale->text('Directory').": $templates ".$locale->text('does not exist'));
- }
-
- # add base directory to $form->{templates}
- $form->{templates} = "$templates/$form->{templates}";
-
-
- $myconfig = new User "$memberfile", "$form->{login}";
-
- # redo acs variable and delete all the acs codes
- @acs = split /;/, $form->{acs};
-
- $form->{acs} = "";
- foreach $item (@acs) {
- $item = $form->escape($item,1);
- if (!$form->{$item}) {
- $form->{acs} .= $form->unescape($form->unescape("$item")).";";
- }
- delete $form->{$item};
- }
-
- # check which database was filled in
-
- $form->{dbhost} = $form->{"$form->{dbdriver}_dbhost"};
- $form->{dbport} = $form->{"$form->{dbdriver}_dbport"};
- $form->{dbpasswd} = $form->{"$form->{dbdriver}_dbpasswd"};
- $form->{dbuser} = $form->{"$form->{dbdriver}_dbuser"};
- $form->{dbname} = $form->{"$form->{dbdriver}_dbname"};
-
- if ($form->{dbdriver} eq 'Oracle') {
- $form->{sid} = $form->{Oracle_sid}, ;
-
- $form->isblank("dbhost", $locale->text('Hostname missing!'));
- $form->isblank("dbport", $locale->text('Port missing!'));
- $form->isblank("dbuser", $locale->text('Dataset missing!'));
- }
- if ($form->{dbdriver} =~ /Pg/) {
- $form->isblank("dbname", $locale->text('Dataset missing!'));
- $form->isblank("dbuser", $locale->text('Database User missing!'));
- }
-
- foreach $item (keys %{$form}) {
- $myconfig->{$item} = $form->{$item};
- }
-
- $myconfig->{password} = $form->{old_password};
- $myconfig->{password} = $form->{new_password} if $form->{new_password} ne $form->{old_password};
- $myconfig->{timeout} = $form->{newtimeout};
-
- delete $myconfig->{stylesheet};
- if ($form->{userstylesheet}) {
- $myconfig->{stylesheet} = $form->{userstylesheet};
- }
-
- $myconfig->{packpw} = 1;
-
- $myconfig->save_member($memberfile, $userspath);
-
- # create user template directory and copy master files
- if (! -d "$form->{templates}") {
-
- umask(002);
-
- if (mkdir "$form->{templates}", oct("771")) {
-
- umask(007);
-
- # copy templates to the directory
- opendir TEMPLATEDIR, "$templates/." or $form->error("$templates : $!");
- @templates = grep /$form->{mastertemplates}-/, readdir TEMPLATEDIR;
- closedir TEMPLATEDIR;
-
- foreach $file (@templates) {
- open(TEMP, "$templates/$file") or $form->error("$templates/$file : $!");
-
- $file =~ s/$form->{mastertemplates}-//;
- open(NEW, ">$form->{templates}/$file") or $form->error("$form->{templates}/$file : $!");
-
- while ($line = <TEMP>) {
- print NEW $line;
- }
- close(TEMP);
- close(NEW);
- }
- } else {
- $form->error("$form->{templates} : $!");
- }
- }
-
- $form->redirect($locale->text('User saved!'));
-
-}
-
-
-sub delete {
-
- $form->{templates} = ($form->{templates}) ? "$templates/$form->{templates}" : "$templates/$form->{login}";
-
- $form->error("$memberfile ".$locale->text('locked!')) if (-f ${memberfile}.LCK);
-
- open(FH, ">${memberfile}.LCK") or $form->error("${memberfile}.LCK : $!");
- close(FH);
-
- if (! open(CONF, "+<$memberfile")) {
- unlink "${memberfile}.LCK";
- $form->error("$memberfile : $!");
- }
-
- @config = <CONF>;
-
- seek(CONF, 0, 0);
- truncate(CONF, 0);
-
- while ($line = shift @config) {
-
- chop $line;
-
- if ($line =~ /^\[/) {
- last if ($line eq "[$form->{login}]");
- $login = &login_name($line);
- }
-
- if ($line =~ /^templates=/) {
- ($null, $user{$login}) = split /=/, $line, 2;
- }
-
- print CONF "$line\n";
- }
-
- # remove everything up to next login or EOF
- # and save template variable
- while ($line = shift @config) {
-
- chop $line;
-
- ($key, $value) = split /=/, $line, 2;
- $myconfig{$key} = $value;
-
- last if ($line =~ /^\[/);
- }
-
- # this one is either the next login or EOF
- print CONF "$line\n";
-
- $login = &login_name($line);
-
-
- while ($line = shift @config) {
-
- chop $line;
-
- if ($line =~ /^\[/) {
- $login = &login_name($line);
- }
-
- if ($line =~ /^templates=/) {
- ($null, $user{$login}) = split /=/, $line, 2;
- }
-
- print CONF "$line\n";
- }
-
- close(CONF);
- unlink "${memberfile}.LCK";
-
- # scan %user for $templatedir
- foreach $login (keys %user) {
- last if ($found = ($form->{templates} eq $user{$login}));
- }
-
- # if found keep directory otherwise delete
- if (!$found) {
- # delete it if there is a template directory
- $dir = "$form->{templates}";
- if (-d "$dir") {
- unlink <$dir/*>;
- rmdir "$dir";
- }
- }
-
- if ($myconfig{dbconnect}) {
- $myconfig{dbpasswd} = unpack 'u', $myconfig{dbpasswd};
- for (keys %myconfig) { $form->{$_} = $myconfig{$_} }
-
- User->delete_login(\%$form);
-
- # delete config file for user
- unlink "$userspath/$form->{login}.conf";
- }
-
- $form->redirect($locale->text('User deleted!'));
-
-}
-
-
-sub login_name {
- my $login = shift;
-
- $login =~ s/\[\]//g;
- return ($login) ? $login : undef;
-
-}
-
-
-sub change_admin_password {
-
- $form->{title} = qq|LedgerSMB |.$locale->text('Accounting')." ".$locale->text('Administration')." / ".$locale->text('Change Admin Password');
-
- $form->{login} = "root login";
- $form->header;
-
- print qq|
-<body class=admin>
-
-<form method=post action=$form->{script}>
-
-<table>
- <tr>
- <tr class=listheading>
- <th>|.$locale->text('Change Password').qq|</th>
- </tr>
- <tr size=5></tr>
- <tr>
- <td>
- <table width=100%>
- <tr>
- <th align=right>|.$locale->text('Password').qq|</th>
- <td><input type=password name=new_password></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Confirm').qq|</th>
- <td><input type=password name=confirm_password></td>
- </tr>
- </table>
- </td>
- </tr>
-
-</table>
-
-<br>
-<hr size=3 noshade>
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<p>
-<input type=submit class=submit name=action value="|.$locale->text('Change Password').qq|">
-
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub change_password {
-
- $form->error($locale->text('Passwords do not match!')) if $form->{new_password} ne $form->{confirm_password};
-
- $root->{password} = $form->{new_password};
-
- $root->{'root login'} = 1;
- $root->save_member($memberfile);
-
- $form->{callback} = "$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}";
-
- $form->redirect($locale->text('Password changed!'));
-
-}
-
-sub get_hash {
- use Digest::MD5;
- $form->{hash} = Digest::MD5::md5_hex rand();
-
-}
-
-sub check_password {
-
-
-
- $root = new User "$memberfile", "root login";
-
- if ($root->{password}) {
-
- if ($form->{password}) {
- $form->{callback} .= "&password=$form->{password}" if $form->{callback};
- $form->{sessionid} = time;
- if ($root->{password} ne crypt $form->{password}, 'ro') {
- &getpassword;
- exit;
- }
-
- &get_hash;
-
- open(HASHFILE, "> $userspath/adminhash")
- || $form->error("Can't Open Hashfile: $!");
- print HASHFILE $form->{hash};
-
- print qq|Set-Cookie: LedgerSMB=$form->{hash}; path=/;\n|;
-
- } else {
- if ($ENV{HTTP_USER_AGENT}) {
- $ENV{HTTP_COOKIE} =~ s/;\s*/;/g;
- %cookie = split /[=;]/, $ENV{HTTP_COOKIE}; # Changeme to %cookies
- $cookie = ($form->{path} eq 'bin/lynx') ? $cookie{login} : $cookie{"LedgerSMB-root login"};
-
- #fixes problem with first login and such
- if (!(-f "$userspath/adminhash")) {
- &get_hash;
- open(HASHFILE, "> $userspath/adminhash") || $form->error("Can't Open Hashfile: $!");
- print HASHFILE $form->{hash};
- close(HASHFILE);
- }
-
- open (HASHFILE, "< $userspath/adminhash") || $form->error("Can't Open Hashfile: $!");
-
- chomp($form->{hash} = <HASHFILE>);
-
- %cookies = split /[=;]/, $ENV{HTTP_COOKIE};
-
- if (! $cookie || $cookie ne $form->{sessionid} ||
- $form->{hash} ne $cookies{LedgerSMB}) {
- &getpassword;
- exit;
- }
- }
- }
- }
-
-}
-
-
-sub pg_database_administration {
-
- $form->{dbdriver} = 'Pg';
- &dbselect_source;
-
-}
-
-
-sub pgpp_database_administration {
-
- $form->{dbdriver} = 'PgPP';
- &dbselect_source;
-
-}
-
-
-sub oracle_database_administration {
-
- $form->{dbdriver} = 'Oracle';
- &dbselect_source;
-
-}
-
-
-sub dbdriver_defaults {
-
- # load some defaults for the selected driver
- %driverdefaults = ( 'Pg' => { dbport => '',
- dbuser => 'ledger-smb',
- dbdefault => 'template1',
- dbhost => '',
- connectstring => $locale->text('Connect to')
- },
- 'Oracle' => { dbport => '1521',
- dbuser => 'oralin',
- dbdefault => $sid,
- dbhost => `hostname`,
- connectstring => 'SID'
- }
- );
-
- $driverdefaults{PgPP} = $driverdefaults{Pg};
-
- for (keys %{ $driverdefaults{Pg} }) { $form->{$_} = $driverdefaults{$form->{dbdriver}}{$_} }
-
-}
-
-
-sub dbselect_source {
-
- &dbdriver_defaults;
-
- $form->{title} = "LedgerSMB ".$locale->text('Accounting')." / ".$locale->text('Database Administration');
-
- $form->{login} = "root login";
- $form->header;
-
- print qq|
-<body class=admin>
-
-<center>
-<h2>$form->{title}</h2>
-
-<form method=post action=$form->{script}>
-
-<table>
- <tr>
- <td>
- <table>
- <tr class=listheading>
- <th colspan=4>|.$locale->text('Database').qq|</th>
- </tr>
- <input type=hidden name=dbdriver value=$form->{dbdriver}>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right>|.$locale->text('Host').qq|</th>
- <td><input name=dbhost size=25 value=$form->{dbhost}></td>
- <th align=right>|.$locale->text('Port').qq|</th>
- <td><input name=dbport size=5 value=$form->{dbport}></td>
- </tr>
- <tr>
- <th align=right>|.$locale->text('User').qq|</th>
- <td><input name=dbuser size=10 value=$form->{dbuser}></td>
- <th align=right>|.$locale->text('Password').qq|</th>
- <td><input type=password name=dbpasswd size=10></td>
- </tr>
- <tr>
-
- <th align=right>$form->{connectstring}</th>
- <td colspan=3><input name=dbdefault size=10 value=$form->{dbdefault}></td>
-
- </tr>
- </table>
- </td>
- </tr>
- </table>
-
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}">
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<br>
-
-<input type=submit class=submit name=action value="|.$locale->text('Create Dataset').qq|">
-<input type=submit class=submit name=action value="|.$locale->text('Update Dataset').qq|">
-<input type=submit class=submit name=action value="|.$locale->text('Delete Dataset').qq|">
-
-</form>
-
- </td>
- </tr>
-</table>
-
-<p>|.$locale->text('This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!')
-
-.qq|
-</body>
-</html>
-|;
-
-}
-
-
-sub continue {
-
- &{ $form->{nextsub} };
-
-}
-
-
-sub update_dataset {
-
- %needsupdate = User->dbneedsupdate(\%$form);
-
- $form->{title} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Database Administration')." / ".$locale->text('Update Dataset');
-
- $form->{login} = "root login";
- $form->header;
-
- print qq|
-<body class=admin>
-
-
-<center>
-<h2>$form->{title}</h2>
-|;
-
-
- foreach $key (sort keys %needsupdate) {
- if ($needsupdate{$key} ne $form->{dbversion}) {
- $upd .= qq|<input name="db$key" class=checkbox type=checkbox value=1 checked> $key\n|;
- $form->{dbupdate} .= "db$key ";
- }
- }
-
- chop $form->{dbupdate};
-
-
- if ($form->{dbupdate}) {
-
- print qq|
-<table width=100%>
-<form method=post action=$form->{script}>
-
-<input type=hidden name=dbdriver value=$form->{dbdriver}>
-<input type=hidden name=dbhost value=$form->{dbhost}>
-<input type=hidden name=dbport value=$form->{dbport}>
-<input type=hidden name=dbuser value=$form->{dbuser}>
-<input type=hidden name=dbpasswd value=$form->{dbpasswd}>
-<input type=hidden name=dbdefault value=$form->{dbdefault}>
-
-<tr class=listheading>
- <th>|.$locale->text('The following Datasets need to be updated').qq|</th>
-</tr>
-<tr>
-<td>
-
-$upd
-
-</td>
-</tr>
-<tr>
-<td>
-
-<input name=dbupdate type=hidden value="$form->{dbupdate}">
-
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}">
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<input type=hidden name=nextsub value=dbupdate>
-
-<hr size=3 noshade>
-
-<br>
-<input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
-
-</td></tr>
-</table>
-</form>
-|;
-
- } else {
-
- print $locale->text('DBA')." : $form->{dbuser} : " .$locale->text('All Datasets up to date!');
-
- }
-
- print qq|
-
-</body>
-</html>
-|;
-
-}
-
-
-sub dbupdate {
-
- User->dbupdate(\%$form);
-
- $form->redirect($locale->text('Dataset updated!'));
-
-}
-
-
-sub create_dataset {
-
- @dbsources = sort User->dbsources(\%$form);
-
- opendir SQLDIR, "sql/." or $form->error($!);
- foreach $item (sort grep /-chart\.sql/, readdir SQLDIR) {
- next if ($item eq 'Default-chart.sql');
- $item =~ s/-chart\.sql//;
- push @charts, qq|<input name=chart class=radio type=radio value="$item">$item|;
- }
- closedir SQLDIR;
-
- # add Default at beginning
- unshift @charts, qq|<input name=chart class=radio type=radio value="Default" checked>Default|;
-
- $selectencoding = qq|<option>
- <option value=SQL_ASCII>ASCII
- <option value=EUC_JP>Japanese EUC
- <option value=EUC_CN>Chinese EUC
- <option value=EUC_KR>Korean EUC
- <option value=JOHAB>Korean EUC (Hangle base)
- <option value=EUC_TW>Taiwan EUC
- <option value=UNICODE>Unicode (UTF-8)
- <option value=MULE_INTERNAL>Mule internal type
- <option value=LATIN1>ISO 8859-1/ECMA 94 (Latin alphabet no. 1)
- <option value=LATIN2>ISO 8859-2/ECMA 94 (Latin alphabet no. 2)
- <option value=LATIN3>ISO 8859-3/ECMA 94 (Latin alphabet no. 3)
- <option value=LATIN4>ISO 8859-4/ECMA 94 (Latin alphabet no. 4)
- <option value=LATIN5>ISO 8859-9/ECMA 128 (Latin alphabet no. 5)
- <option value=LATIN6>ISO 8859-10/ECMA 144 (Latin alphabet no. 6)
- <option value=LATIN7>ISO 8859-13 (Latin alphabet no. 7)
- <option value=LATIN8>ISO 8859-14 (Latin alphabet no. 8)
- <option value=LATIN9>ISO 8859-15 (Latin alphabet no. 9)
- <option value=LATIN10>ISO 8859-16/ASRO SR 14111 (Latin alphabet no. 10)
- <option value=ISO_8859_5>ISO 8859-5/ECMA 113 (Latin/Cyrillic)
- <option value=ISO_8859_6>ISO 8859-6/ECMA 114 (Latin/Arabic)
- <option value=ISO_8859_7>ISO 8859-7/ECMA 118 (Latin/Greek)
- <option value=ISO_8859_8>ISO 8859-8/ECMA 121 (Latin/Hebrew)
- <option value=KOI8>KOI8-R(U)
- <option value=WIN>Windows CP1251
- <option value=ALT>Windows CP866
- <option value=WIN1256>Windows CP1256 (Arabic)
- <option value=TCVN>Windows CP1258 (Vietnamese)
- <option value=WIN874>Windows CP874 (Thai)
- |;
-
- $form->{title} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Database Administration')." / ".$locale->text('Create Dataset');
-
- $form->{login} = "root login";
- $form->header;
-
- print qq|
-<body class=admin>
-
-
-<center>
-<h2>$form->{title}</h2>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr class=listheading>
- <th colspan=2>&nbsp;</th>
- </tr>
-
- <tr>
-
- <th align=right nowrap>|.$locale->text('Existing Datasets').qq|</th>
- <td>
-|;
-
- for (@dbsources) { print "[&nbsp;$_&nbsp;] " }
-
- print qq|
- </td>
- </tr>
-
- <tr>
-
- <th align=right nowrap>|.$locale->text('Create Dataset').qq|</th>
- <td><input name=db></td>
-
- </tr>
-
- <tr>
-
- <th align=right nowrap>|.$locale->text('Multibyte Encoding').qq|</th>
- <td><select name=encoding>$selectencoding</select></td>
-
- </tr>
-
- <tr>
-
- <th align=right nowrap>|.$locale->text('Create Chart of Accounts').qq|</th>
- <td>
- <table>
-|;
-
- while (@charts) {
- print qq|
- <tr>
-|;
-
- for (0 .. 2) { print "<td>$charts[$_]</td>\n" }
-
- print qq|
- </tr>
-|;
-
- splice @charts, 0, 3;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td colspan=2>
- <hr size=3 noshade>
- </td>
- </tr>
-</table>
-|;
-
- $form->hide_form(qw(dbdriver dbuser dbhost dbport dbpasswd dbdefault path sessionid));
-
- print qq|
-
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}">
-<input type=hidden name=nextsub value=dbcreate>
-
-<br>
-<input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
-
-
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub dbcreate {
-
- $form->isblank("db", $locale->text('Dataset missing!'));
-
- User->dbcreate(\%$form);
-
- $form->{title} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Database Administration')." / ".$locale->text('Create Dataset');
-
- $form->{login} = "root login";
- $form->header;
-
- print qq|
-<body class=admin>
-
-
-<center>
-<h2>$form->{title}</h2>
-
-<form method=post action=$form->{script}>|
-
-.$locale->text('Dataset')." $form->{db} ".$locale->text('successfully created!')
-
-.qq|
-
-<input type=hidden name=path value="$form->{path}">
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<input type=hidden name=nextsub value=list_users>
-
-<p><input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
-</form>
-
-
-</body>
-</html>
-|;
-
-}
-
-
-sub delete_dataset {
-
- if (@dbsources = User->dbsources_unused(\%$form, $memberfile)) {
- foreach $item (sort @dbsources) {
- $dbsources .= qq|<input name=db class=radio type=radio value=$item>&nbsp;$item |;
- }
- } else {
- $form->error($locale->text('Nothing to delete!'));
- }
-
- $form->{title} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Database Administration')." / ".$locale->text('Delete Dataset');
-
- $form->{login} = "root login";
- $form->header;
-
- print qq|
-<body class=admin>
-
-<h2>$form->{title}</h2>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr class=listheading>
- <th>|.$locale->text('The following Datasets are not in use and can be deleted').qq|</th>
- </tr>
-
- <tr>
- <td>
- $dbsources
- </td>
- </tr>
-
- <tr><td>
-<p>
-<input type=hidden name=dbdriver value=$form->{dbdriver}>
-<input type=hidden name=dbuser value=$form->{dbuser}>
-<input type=hidden name=dbhost value=$form->{dbhost}>
-<input type=hidden name=dbport value=$form->{dbport}>
-<input type=hidden name=dbpasswd value=$form->{dbpasswd}>
-<input type=hidden name=dbdefault value=$form->{dbdefault}>
-
-<input name=callback type=hidden value="$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}">
-
-<input type=hidden name=path value="$form->{path}">
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<input type=hidden name=nextsub value=dbdelete>
-
-<hr size=3 noshade>
-
-<br>
-<input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
-
- </td></tr>
-</table>
-
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub dbdelete {
-
- if (!$form->{db}) {
- $form->error($locale->text('No Dataset selected!'));
- }
-
- User->dbdelete(\%$form);
-
- $form->{title} = "LedgerSMB ".$locale->text('Accounting')." ".$locale->text('Database Administration')." / ".$locale->text('Delete Dataset');
-
- $form->{login} = "root login";
- $form->header;
-
- print qq|
-<body class=admin>
-
-
-<center>
-<h2>$form->{title}</h2>
-
-<form method=post action=$form->{script}>
-
-$form->{db} |.$locale->text('successfully deleted!')
-
-.qq|
-
-<input type=hidden name=path value="$form->{path}">
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<input type=hidden name=nextsub value=list_users>
-
-<p><input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
-</form>
-
-
-</body>
-</html>
-|;
-
-}
-
-
-sub unlock_system {
-
- unlink "$userspath/nologin";
-
- $form->{callback} = "$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}";
-
- $form->redirect($locale->text('Lockfile removed!'));
-
-}
-
-
-sub lock_system {
-
- open(FH, ">$userspath/nologin") or $form->error($locale->text('Cannot create Lock!'));
- close(FH);
-
- $form->{callback} = "$form->{script}?action=list_users&path=$form->{path}&sessionid=$form->{sessionid}";
-
- $form->redirect($locale->text('Lockfile created!'));
-
-}
-
-
+#!/usr/bin/perl
+require "bin/mozilla/admin.pl";
diff --git a/bin/lynx/am.pl b/bin/lynx/am.pl
index e5601954..3d93f1eb 100755
--- a/bin/lynx/am.pl
+++ b/bin/lynx/am.pl
@@ -1,3260 +1,4 @@
-#=====================================================================
-# LedgerSMB
-# Small Medium Business Accounting software
-#
-# See COPYRIGHT file for copyright information
-#======================================================================
-#
-# This file has NOT undergone whitespace cleanup.
-#
-#======================================================================
-#
-# administration
-#
-#======================================================================
+#!/usr/bin/perl
-use LedgerSMB::AM;
-use LedgerSMB::CA;
-use LedgerSMB::Form;
-use LedgerSMB::User;
-use LedgerSMB::RP;
-use LedgerSMB::GL;
-
-
-1;
-# end of main
-
-
-
-sub add { &{ "add_$form->{type}" } };
-sub edit { &{ "edit_$form->{type}" } };
-sub save { &{ "save_$form->{type}" } };
-sub delete { &{ "delete_$form->{type}" } };
-
-
-sub save_as_new {
-
- delete $form->{id};
-
- &save;
-
-}
-
-
-sub add_account {
-
- $form->{title} = "Add";
- $form->{charttype} = "A";
-
- $form->{callback} = "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
-
- &account_header;
- &form_footer;
-
-}
-
-
-sub edit_account {
-
- $form->{title} = "Edit";
-
- $form->{accno} =~ s/\\'/'/g;
- $form->{accno} =~ s/\\\\/\\/g;
-
- AM->get_account(\%myconfig, \%$form);
-
- foreach my $item (split(/:/, $form->{link})) {
- $form->{$item} = "checked";
- }
-
- &account_header;
- &form_footer;
-
-}
-
-
-sub account_header {
-
- $form->{title} = $locale->text("$form->{title} Account");
-
- $checked{$form->{charttype}} = "checked";
- $checked{contra} = "checked" if $form->{contra};
- $checked{"$form->{category}_"} = "checked";
-
- for (qw(accno description)) { $form->{$_} = $form->quote($form->{$_}) }
-
-# this is for our parser only!
-# type=submit $locale->text('Add Account')
-# type=submit $locale->text('Edit Account')
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=type value=account>
-
-<input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>
-<input type=hidden name=income_accno_id value=$form->{income_accno_id}>
-<input type=hidden name=expense_accno_id value=$form->{expense_accno_id}>
-<input type=hidden name=fxgain_accno_id values=$form->{fxgain_accno_id}>
-<input type=hidden name=fxloss_accno_id values=$form->{fxloss_accno_id}>
-
-<table border=0 width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align="right">|.$locale->text('Account Number').qq|</th>
- <td><input name=accno size=20 value="$form->{accno}"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Description').qq|</th>
- <td><input name=description size=40 value="$form->{description}"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Account Type').qq|</th>
- <td>
- <table>
- <tr valign=top>
- <td><input name=category type=radio class=radio value=A $checked{A_}>&nbsp;|.$locale->text('Asset').qq|\n<br>
- <input name=category type=radio class=radio value=L $checked{L_}>&nbsp;|.$locale->text('Liability').qq|\n<br>
- <input name=category type=radio class=radio value=Q $checked{Q_}>&nbsp;|.$locale->text('Equity').qq|\n<br>
- <input name=category type=radio class=radio value=I $checked{I_}>&nbsp;|.$locale->text('Income').qq|\n<br>
- <input name=category type=radio class=radio value=E $checked{E_}>&nbsp;|.$locale->text('Expense')
- .qq|</td>
- <td>
- <input name=contra class=checkbox type=checkbox value=1 $checked{contra}>&nbsp;|.$locale->text('Contra').qq|
- </td>
- <td>
- <input name=charttype type=radio class=radio value="H" $checked{H}>&nbsp;|.$locale->text('Heading').qq|<br>
- <input name=charttype type=radio class=radio value="A" $checked{A}>&nbsp;|.$locale->text('Account')
- .qq|</td>
- </tr>
- </table>
- </td>
- </tr>
-|;
-
-
-if ($form->{charttype} eq "A") {
- print qq|
- <tr>
- <td colspan=2>
- <table>
- <tr>
- <th align=left>|.$locale->text('Is this a summary account to record').qq|</th>
- <td>
- <input name=AR class=checkbox type=checkbox value=AR $form->{AR}>&nbsp;|.$locale->text('AR')
- .qq|&nbsp;<input name=AP class=checkbox type=checkbox value=AP $form->{AP}>&nbsp;|.$locale->text('AP')
- .qq|&nbsp;<input name=IC class=checkbox type=checkbox value=IC $form->{IC}>&nbsp;|.$locale->text('Inventory')
- .qq|</td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <th colspan=2>|.$locale->text('Include in drop-down menus').qq|</th>
- </tr>
- <tr valign=top>
- <td colspan=2>
- <table width=100%>
- <tr>
- <th align=left>|.$locale->text('Receivables').qq|</th>
- <th align=left>|.$locale->text('Payables').qq|</th>
- <th align=left>|.$locale->text('Tracking Items').qq|</th>
- <th align=left>|.$locale->text('Non-tracking Items').qq|</th>
- </tr>
- <tr>
- <td>
- <input name=AR_amount class=checkbox type=checkbox value=AR_amount $form->{AR_amount}>&nbsp;|.$locale->text('Income').qq|\n<br>
- <input name=AR_paid class=checkbox type=checkbox value=AR_paid $form->{AR_paid}>&nbsp;|.$locale->text('Payment').qq|\n<br>
- <input name=AR_tax class=checkbox type=checkbox value=AR_tax $form->{AR_tax}>&nbsp;|.$locale->text('Tax') .qq|
- </td>
- <td>
- <input name=AP_amount class=checkbox type=checkbox value=AP_amount $form->{AP_amount}>&nbsp;|.$locale->text('Expense/Asset').qq|\n<br>
- <input name=AP_paid class=checkbox type=checkbox value=AP_paid $form->{AP_paid}>&nbsp;|.$locale->text('Payment').qq|\n<br>
- <input name=AP_tax class=checkbox type=checkbox value=AP_tax $form->{AP_tax}>&nbsp;|.$locale->text('Tax') .qq|
- </td>
- <td>
- <input name=IC_sale class=checkbox type=checkbox value=IC_sale $form->{IC_sale}>&nbsp;|.$locale->text('Income').qq|\n<br>
- <input name=IC_cogs class=checkbox type=checkbox value=IC_cogs $form->{IC_cogs}>&nbsp;|.$locale->text('COGS').qq|\n<br>
- <input name=IC_taxpart class=checkbox type=checkbox value=IC_taxpart $form->{IC_taxpart}>&nbsp;|.$locale->text('Tax') .qq|
- </td>
- <td>
- <input name=IC_income class=checkbox type=checkbox value=IC_income $form->{IC_income}>&nbsp;|.$locale->text('Income').qq|\n<br>
- <input name=IC_expense class=checkbox type=checkbox value=IC_expense $form->{IC_expense}>&nbsp;|.$locale->text('Expense').qq|\n<br>
- <input name=IC_taxservice class=checkbox type=checkbox value=IC_taxservice $form->{IC_taxservice}>&nbsp;|.$locale->text('Tax') .qq|
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- </tr>
-|;
-}
-
-print qq|
- <tr>
- <th align="right">|.$locale->text('GIFI').qq|</th>
- <td><input name=gifi_accno size=9 value=$form->{gifi_accno}></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
-}
-
-
-sub form_footer {
-
- $form->hide_form(qw(callback path login sessionid));
-
-# type=submit $locale->text('Save')
-# type=submit $locale->text('Save as new')
-# type=submit $locale->text('Delete')
-
- %button = ();
-
- if ($form->{id}) {
- $button{'Save'} = { ndx => 3, key => 'S', value => $locale->text('Save') };
- $button{'Save as new'} = { ndx => 7, key => 'N', value => $locale->text('Save as new') };
-
- if ($form->{orphaned}) {
- $button{'Delete'} = { ndx => 16, key => 'D', value => $locale->text('Delete') };
- }
- } else {
- $button{'Save'} = { ndx => 3, key => 'S', value => $locale->text('Save') };
- }
-
- for (sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button) { $form->print_button(\%button, $_) }
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub save_account {
-
- $form->isblank("accno", $locale->text('Account Number missing!'));
- $form->isblank("category", $locale->text('Account Type missing!'));
-
- # check for conflicting accounts
- if ($form->{AR} || $form->{AP} || $form->{IC}) {
- $a = "";
- for (qw(AR AP IC)) { $a .= $form->{$_} }
- $form->error($locale->text('Cannot set account for more than one of AR, AP or IC')) if length $a > 2;
-
- for (qw(AR_amount AR_tax AR_paid AP_amount AP_tax AP_paid IC_taxpart IC_taxservice IC_sale IC_cogs IC_income IC_expense)) { $form->error("$form->{AR}$form->{AP}$form->{IC} ". $locale->text('account cannot be set to any other type of account')) if $form->{$_} }
- }
-
- foreach $item ("AR", "AP") {
- $i = 0;
- for ("${item}_amount", "${item}_paid", "${item}_tax") { $i++ if $form->{$_} }
- $form->error($locale->text('Cannot set multiple options for')." $item") if $i > 1;
- }
-
- if (AM->save_account(\%myconfig, \%$form)) {
- $form->redirect($locale->text('Account saved!'));
- } else {
- $form->error($locale->text('Cannot save account!'));
- }
-
-}
-
-
-sub list_account {
-
- CA->all_accounts(\%myconfig, \%$form);
-
- $form->{title} = $locale->text('Chart of Accounts');
-
- # construct callback
- $callback = "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- @column_index = qw(accno gifi_accno description debit credit link);
-
- $column_header{accno} = qq|<th class=listtop>|.$locale->text('Account').qq|</a></th>|;
- $column_header{gifi_accno} = qq|<th class=listtop>|.$locale->text('GIFI').qq|</a></th>|;
- $column_header{description} = qq|<th class=listtop>|.$locale->text('Description').qq|</a></th>|;
- $column_header{debit} = qq|<th class=listtop>|.$locale->text('Debit').qq|</a></th>|;
- $column_header{credit} = qq|<th class=listtop>|.$locale->text('Credit').qq|</a></th>|;
- $column_header{link} = qq|<th class=listtop>|.$locale->text('Link').qq|</a></th>|;
-
-
- $form->header;
- $colspan = $#column_index + 1;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=$colspan>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr class="listheading">
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
-</tr>
-|;
-
- # escape callback
- $callback = $form->escape($callback);
-
- foreach $ca (@{ $form->{CA} }) {
-
- $ca->{debit} = "&nbsp;";
- $ca->{credit} = "&nbsp;";
-
- if ($ca->{amount} > 0) {
- $ca->{credit} = $form->format_amount(\%myconfig, $ca->{amount}, 2, "&nbsp;");
- }
- if ($ca->{amount} < 0) {
- $ca->{debit} = $form->format_amount(\%myconfig, -$ca->{amount}, 2, "&nbsp;");
- }
-
- $ca->{link} =~ s/:/<br>/og;
-
- $gifi_accno = $form->escape($ca->{gifi_accno});
-
- if ($ca->{charttype} eq "H") {
- print qq|<tr class="listheading">|;
-
- $column_data{accno} = qq|<th><a class="listheading" href="$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback">$ca->{accno}</a></th>|;
- $column_data{gifi_accno} = qq|<th class="listheading"><a href="$form->{script}?action=edit_gifi&accno=$gifi_accno&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback">$ca->{gifi_accno}</a>&nbsp;</th>|;
- $column_data{description} = qq|<th class="listheading">$ca->{description}&nbsp;</th>|;
- $column_data{debit} = qq|<th>&nbsp;</th>|;
- $column_data{credit} = qq| <th>&nbsp;</th>|;
- $column_data{link} = qq|<th>&nbsp;</th>|;
-
- } else {
- $i++; $i %= 2;
- print qq|
-<tr valign=top class="listrow$i">|;
- $column_data{accno} = qq|<td><a href="$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback">$ca->{accno}</a></td>|;
- $column_data{gifi_accno} = qq|<td><a href="$form->{script}?action=edit_gifi&accno=$gifi_accno&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback">$ca->{gifi_accno}</a>&nbsp;</td>|;
- $column_data{description} = qq|<td>$ca->{description}&nbsp;</td>|;
- $column_data{debit} = qq|<td align="right">$ca->{debit}</td>|;
- $column_data{credit} = qq|<td align="right">$ca->{credit}</td>|;
- $column_data{link} = qq|<td>$ca->{link}&nbsp;</td>|;
-
- }
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print "</tr>\n";
- }
-
- print qq|
- <tr><td colspan="$colspan"><hr size="3" noshade /></td></tr>
-</table>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub delete_account {
-
- $form->{title} = $locale->text('Delete Account');
-
- foreach $id (qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)) {
- if ($form->{id} == $form->{$id}) {
- $form->error($locale->text('Cannot delete default account!'));
- }
- }
-
- if (AM->delete_account(\%myconfig, \%$form)) {
- $form->redirect($locale->text('Account deleted!'));
- } else {
- $form->error($locale->text('Cannot delete account!'));
- }
-
-}
-
-
-sub list_gifi {
-
- @{ $form->{fields} } = qw(accno description);
- $form->{table} = "gifi";
-
- AM->gifi_accounts(\%myconfig, \%$form);
-
- $form->{title} = $locale->text('GIFI');
-
- # construct callback
- $callback = "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- @column_index = qw(accno description);
-
- $column_header{accno} = qq|<th class="listheading">|.$locale->text('GIFI').qq|</a></th>|;
- $column_header{description} = qq|<th class="listheading">|.$locale->text('Description').qq|</a></th>|;
-
-
- $form->header;
- $colspan = $#column_index + 1;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=$colspan>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr class="listheading">
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
-</tr>
-|;
-
- # escape callback
- $callback = $form->escape($callback);
-
- foreach $ca (@{ $form->{ALL} }) {
-
- $i++; $i %= 2;
-
- print qq|
-<tr valign=top class=listrow$i>|;
-
- $accno = $form->escape($ca->{accno});
- $column_data{accno} = qq|<td><a href=$form->{script}?action=edit_gifi&coa=1&accno=$accno&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ca->{accno}</td>|;
- $column_data{description} = qq|<td>$ca->{description}&nbsp;</td>|;
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print "</tr>\n";
- }
-
- print qq|
- <tr>
- <td colspan=$colspan><hr size=3 noshade></td>
- </tr>
-</table>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub add_gifi {
- $form->{title} = "Add";
-
- # construct callback
- $form->{callback} = "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $form->{coa} = 1;
-
- &gifi_header;
- &gifi_footer;
-
-}
-
-
-sub edit_gifi {
-
- $form->{title} = "Edit";
-
- AM->get_gifi(\%myconfig, \%$form);
-
- $form->error($locale->text('Account does not exist!')) unless $form->{accno};
-
- &gifi_header;
- &gifi_footer;
-
-}
-
-
-sub gifi_header {
-
- $form->{title} = $locale->text("$form->{title} GIFI");
-
-# $locale->text('Add GIFI')
-# $locale->text('Edit GIFI')
-
- for (qw(accno description)) { $form->{$_} = $form->quote($form->{$_}) }
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=id value="$form->{accno}">
-<input type=hidden name=type value=gifi>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right">|.$locale->text('GIFI').qq|</th>
- <td><input name=accno size=20 value="$form->{accno}"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Description').qq|</th>
- <td><input name=description size=60 value="$form->{description}"></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
-}
-
-
-sub gifi_footer {
-
- $form->hide_form(qw(callback path login sessionid));
-
-# type=submit $locale->text('Save')
-# type=submit $locale->text('Copy to COA')
-# type=submit $locale->text('Delete')
-
- %button = ();
-
- $button{'Save'} = { ndx => 3, key => 'S', value => $locale->text('Save') };
-
- if ($form->{accno}) {
- if ($form->{orphaned}) {
- $button{'Delete'} = { ndx => 16, key => 'D', value => $locale->text('Delete') };
- }
- }
-
- if ($form->{coa}) {
- $button{'Copy to COA'} = { ndx => 7, key => 'C', value => $locale->text('Copy to COA') };
- }
-
- for (sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button) { $form->print_button(\%button, $_) }
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub save_gifi {
-
- $form->isblank("accno", $locale->text('GIFI missing!'));
- AM->save_gifi(\%myconfig, \%$form);
- $form->redirect($locale->text('GIFI saved!'));
-
-}
-
-
-sub copy_to_coa {
-
- $form->isblank("accno", $locale->text('GIFI missing!'));
-
- AM->save_gifi(\%myconfig, \%$form);
-
- delete $form->{id};
- $form->{gifi_accno} = $form->{accno};
-
- $form->{title} = "Add";
- $form->{charttype} = "A";
-
- &account_header;
- &form_footer;
-
-}
-
-
-sub delete_gifi {
-
- AM->delete_gifi(\%myconfig, \%$form);
- $form->redirect($locale->text('GIFI deleted!'));
-
-}
-
-
-sub add_department {
-
- $form->{title} = "Add";
- $form->{role} = "P";
-
- $form->{callback} = "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
-
- &department_header;
- &form_footer;
-
-}
-
-
-sub edit_department {
-
- $form->{title} = "Edit";
-
- AM->get_department(\%myconfig, \%$form);
-
- &department_header;
- &form_footer;
-
-}
-
-
-sub list_department {
-
- AM->departments(\%myconfig, \%$form);
-
- $href = "$form->{script}?action=list_department&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $form->sort_order();
-
- $form->{callback} = "$form->{script}?action=list_department&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $callback = $form->escape($form->{callback});
-
- $form->{title} = $locale->text('Departments');
-
- @column_index = qw(description cost profit);
-
- $column_header{description} = qq|<th width=90%><a class="listheading" href=$href>|.$locale->text('Description').qq|</a></th>|;
- $column_header{cost} = qq|<th class="listheading" nowrap>|.$locale->text('Cost Center').qq|</th>|;
- $column_header{profit} = qq|<th class="listheading" nowrap>|.$locale->text('Profit Center').qq|</th>|;
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class="listheading">
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
- </tr>
-|;
-
- foreach $ref (@{ $form->{ALL} }) {
-
- $i++; $i %= 2;
-
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- $costcenter = ($ref->{role} eq "C") ? "*" : "&nbsp;";
- $profitcenter = ($ref->{role} eq "P") ? "*" : "&nbsp;";
-
- $column_data{description} = qq|<td><a href=$form->{script}?action=edit_department&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{description}</td>|;
- $column_data{cost} = qq|<td align=center>$costcenter</td>|;
- $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=$form->{script}>
-|;
-
- $form->{type} = "department";
-
- $form->hide_form(qw(type callback path login sessionid));
-
- print qq|
-<input class=submit type=submit name=action value="|.$locale->text('Add Department').qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
- </body>
- </html>
-|;
-
-}
-
-
-sub department_header {
-
- $form->{title} = $locale->text("$form->{title} Department");
-
-# $locale->text('Add Department')
-# $locale->text('Edit Department')
-
- $form->{description} = $form->quote($form->{description});
-
- if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
- $description = qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
- } else {
- $description = qq|<input name=description size=60 value="$form->{description}">|;
- }
-
- $costcenter = "checked" if $form->{role} eq "C";
- $profitcenter = "checked" if $form->{role} eq "P";
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=type value=department>
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=2>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <th align="right">|.$locale->text('Description').qq|</th>
- <td>$description</td>
- </tr>
- <tr>
- <td></td>
- <td><input type=radio style=radio name=role value="C" $costcenter> |.$locale->text('Cost Center').qq|
- <input type=radio style=radio name=role value="P" $profitcenter> |.$locale->text('Profit Center').qq|
- </td>
- <tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
-}
-
-
-sub save_department {
-
- $form->isblank("description", $locale->text('Description missing!'));
- AM->save_department(\%myconfig, \%$form);
- $form->redirect($locale->text('Department saved!'));
-
-}
-
-
-sub delete_department {
-
- AM->delete_department(\%myconfig, \%$form);
- $form->redirect($locale->text('Department deleted!'));
-
-}
-
-
-sub add_business {
-
- $form->{title} = "Add";
-
- $form->{callback} = "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
-
- &business_header;
- &form_footer;
-
-}
-
-
-sub edit_business {
-
- $form->{title} = "Edit";
-
- AM->get_business(\%myconfig, \%$form);
-
- &business_header;
-
- $form->{orphaned} = 1;
- &form_footer;
-
-}
-
-
-sub list_business {
-
- AM->business(\%myconfig, \%$form);
-
- $href = "$form->{script}?action=list_business&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $form->sort_order();
-
- $form->{callback} = "$form->{script}?action=list_business&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $callback = $form->escape($form->{callback});
-
- $form->{title} = $locale->text('Type of Business');
-
- @column_index = qw(description discount);
-
- $column_header{description} = qq|<th width=90%><a class="listheading" href=$href>|.$locale->text('Description').qq|</a></th>|;
- $column_header{discount} = qq|<th class="listheading">|.$locale->text('Discount').qq| %</th>|;
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class="listheading">
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
- </tr>
-|;
-
- foreach $ref (@{ $form->{ALL} }) {
-
- $i++; $i %= 2;
-
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- $discount = $form->format_amount(\%myconfig, $ref->{discount} * 100, 2, "&nbsp");
-
- $column_data{description} = qq|<td><a href=$form->{script}?action=edit_business&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{description}</td>|;
- $column_data{discount} = qq|<td align="right">$discount</td>|;
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=$form->{script}>
-|;
-
- $form->{type} = "business";
-
- $form->hide_form(qw(type callback path login sessionid));
-
- print qq|
-<input class=submit type=submit name=action value="|.$locale->text('Add Business').qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-
- </form>
-
- </body>
- </html>
-|;
-
-}
-
-
-sub business_header {
-
- $form->{title} = $locale->text("$form->{title} Business");
-
-# $locale->text('Add Business')
-# $locale->text('Edit Business')
-
- $form->{description} = $form->quote($form->{description});
- $form->{discount} = $form->format_amount(\%myconfig, $form->{discount} * 100);
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=type value=business>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right">|.$locale->text('Type of Business').qq|</th>
- <td><input name=description size=30 value="$form->{description}"></td>
- <tr>
- <tr>
- <th align="right">|.$locale->text('Discount').qq| %</th>
- <td><input name=discount size=5 value=$form->{discount}></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
-}
-
-
-sub save_business {
-
- $form->isblank("description", $locale->text('Description missing!'));
- AM->save_business(\%myconfig, \%$form);
- $form->redirect($locale->text('Business saved!'));
-
-}
-
-
-sub delete_business {
-
- AM->delete_business(\%myconfig, \%$form);
- $form->redirect($locale->text('Business deleted!'));
-
-}
-
-
-
-sub add_sic {
-
- $form->{title} = "Add";
-
- $form->{callback} = "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
-
- &sic_header;
- &form_footer;
-
-}
-
-
-sub edit_sic {
-
- $form->{title} = "Edit";
-
- $form->{code} =~ s/\\'/'/g;
- $form->{code} =~ s/\\\\/\\/g;
-
- AM->get_sic(\%myconfig, \%$form);
- $form->{id} = $form->{code};
-
- &sic_header;
-
- $form->{orphaned} = 1;
- &form_footer;
-
-}
-
-
-sub list_sic {
-
- AM->sic(\%myconfig, \%$form);
-
- $href = "$form->{script}?action=list_sic&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $form->sort_order();
-
- $form->{callback} = "$form->{script}?action=list_sic&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $callback = $form->escape($form->{callback});
-
- $form->{title} = $locale->text('Standard Industrial Codes');
-
- @column_index = $form->sort_columns(qw(code description));
-
- $column_header{code} = qq|<th><a class="listheading" href=$href&sort=code>|.$locale->text('Code').qq|</a></th>|;
- $column_header{description} = qq|<th><a class="listheading" href=$href&sort=description>|.$locale->text('Description').qq|</a></th>|;
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class="listheading">
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
- </tr>
-|;
-
- foreach $ref (@{ $form->{ALL} }) {
-
- $i++; $i %= 2;
-
- if ($ref->{sictype} eq 'H') {
- print qq|
- <tr valign=top class="listheading">
-|;
- $column_data{code} = qq|<th><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{code}</th>|;
- $column_data{description} = qq|<th>$ref->{description}</th>|;
-
- } else {
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- $column_data{code} = qq|<td><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{code}</td>|;
- $column_data{description} = qq|<td>$ref->{description}</td>|;
-
- }
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=$form->{script}>
-|;
-
- $form->{type} = "sic";
-
- $form->hide_form(qw(type callback path login sessionid));
-
- print qq|
-<input class=submit type=submit name=action value="|.$locale->text('Add SIC').qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
- </body>
- </html>
-|;
-
-}
-
-
-sub sic_header {
-
- $form->{title} = $locale->text("$form->{title} SIC");
-
-# $locale->text('Add SIC')
-# $locale->text('Edit SIC')
-
- for (qw(code description)) { $form->{$_} = $form->quote($form->{$_}) }
-
- $checked = ($form->{sictype} eq 'H') ? "checked" : "";
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=type value=sic>
-<input type=hidden name=id value="$form->{code}">
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=2>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <th align="right">|.$locale->text('Code').qq|</th>
- <td><input name=code size=10 value="$form->{code}"></td>
- <tr>
- <tr>
- <td></td>
- <th align=left><input name=sictype class=checkbox type=checkbox value="H" $checked> |.$locale->text('Heading').qq|</th>
- <tr>
- <tr>
- <th align="right">|.$locale->text('Description').qq|</th>
- <td><input name=description size=60 value="$form->{description}"></td>
- </tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
-}
-
-
-sub save_sic {
-
- $form->isblank("code", $locale->text('Code missing!'));
- $form->isblank("description", $locale->text('Description missing!'));
- AM->save_sic(\%myconfig, \%$form);
- $form->redirect($locale->text('SIC saved!'));
-
-}
-
-
-sub delete_sic {
-
- AM->delete_sic(\%myconfig, \%$form);
- $form->redirect($locale->text('SIC deleted!'));
-
-}
-
-
-sub add_language {
-
- $form->{title} = "Add";
-
- $form->{callback} = "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
-
- &language_header;
- &form_footer;
-
-}
-
-
-sub edit_language {
-
- $form->{title} = "Edit";
-
- $form->{code} =~ s/\\'/'/g;
- $form->{code} =~ s/\\\\/\\/g;
-
- AM->get_language(\%myconfig, \%$form);
- $form->{id} = $form->{code};
-
- &language_header;
-
- $form->{orphaned} = 1;
- &form_footer;
-
-}
-
-
-sub list_language {
-
- AM->language(\%myconfig, \%$form);
-
- $href = "$form->{script}?action=list_language&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $form->sort_order();
-
- $form->{callback} = "$form->{script}?action=list_language&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $callback = $form->escape($form->{callback});
-
- $form->{title} = $locale->text('Languages');
-
- @column_index = $form->sort_columns(qw(code description));
-
- $column_header{code} = qq|<th><a class="listheading" href=$href&sort=code>|.$locale->text('Code').qq|</a></th>|;
- $column_header{description} = qq|<th><a class="listheading" href=$href&sort=description>|.$locale->text('Description').qq|</a></th>|;
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class="listheading">
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
- </tr>
-|;
-
- foreach $ref (@{ $form->{ALL} }) {
-
- $i++; $i %= 2;
-
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- $column_data{code} = qq|<td><a href=$form->{script}?action=edit_language&code=$ref->{code}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{code}</td>|;
- $column_data{description} = qq|<td>$ref->{description}</td>|;
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=$form->{script}>
-|;
-
- $form->{type} = "language";
-
- $form->hide_form(qw(type callback path login sessionid));
-
- print qq|
-<input class=submit type=submit name=action value="|.$locale->text('Add Language').qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
- </body>
- </html>
-|;
-
-}
-
-
-sub language_header {
-
- $form->{title} = $locale->text("$form->{title} Language");
-
-# $locale->text('Add Language')
-# $locale->text('Edit Language')
-
- for (qw(code description)) { $form->{$_} = $form->quote($form->{$_}) }
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=type value=language>
-<input type=hidden name=id value="$form->{code}">
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=2>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <th align="right">|.$locale->text('Code').qq|</th>
- <td><input name=code size=10 value="$form->{code}"></td>
- <tr>
- <tr>
- <th align="right">|.$locale->text('Description').qq|</th>
- <td><input name=description size=60 value="$form->{description}"></td>
- </tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
-}
-
-
-sub save_language {
-
- $form->isblank("code", $locale->text('Code missing!'));
- $form->isblank("description", $locale->text('Description missing!'));
-
- $form->{code} =~ s/(\.\.|\*)//g;
-
- AM->save_language(\%myconfig, \%$form);
-
- if (! -d "$myconfig{templates}/$form->{code}") {
-
- umask(002);
-
- if (mkdir "$myconfig{templates}/$form->{code}", oct("771")) {
-
- umask(007);
-
- opendir TEMPLATEDIR, "$myconfig{templates}" or $form->error("$myconfig{templates} : $!");
- @templates = grep !/^(\.|\.\.)/, readdir TEMPLATEDIR;
- closedir TEMPLATEDIR;
-
- foreach $file (@templates) {
- if (-f "$myconfig{templates}/$file") {
- open(TEMP, "$myconfig{templates}/$file") or $form->error("$myconfig{templates}/$file : $!");
-
- open(NEW, ">$myconfig{templates}/$form->{code}/$file") or $form->error("$myconfig{templates}/$form->{code}/$file : $!");
-
- while ($line = <TEMP>) {
- print NEW $line;
- }
- close(TEMP);
- close(NEW);
- }
- }
- } else {
- $form->error("${templates}/$form->{code} : $!");
- }
- }
-
- $form->redirect($locale->text('Language saved!'));
-
-}
-
-
-sub delete_language {
-
- $form->{title} = $locale->text('Confirm!');
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
- for (qw(action nextsub)) { delete $form->{$_} }
-
- $form->hide_form;
-
- print qq|
-<h2 class=confirm>$form->{title}</h2>
-
-<h4>|.$locale->text('Deleting a language will also delete the templates for the language').qq| $form->{invnumber}</h4>
-
-<input type=hidden name=action value=continue>
-<input type=hidden name=nextsub value=yes_delete_language>
-<input name=action class=submit type=submit value="|.$locale->text('Continue').qq|">
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub yes_delete_language {
-
- AM->delete_language(\%myconfig, \%$form);
-
- # delete templates
- $dir = "$myconfig{templates}/$form->{code}";
- if (-d $dir) {
- unlink <$dir/*>;
- rmdir "$myconfig{templates}/$form->{code}";
- }
- $form->redirect($locale->text('Language deleted!'));
-
-}
-
-
-sub display_stylesheet {
-
- $form->{file} = "css/$myconfig{stylesheet}";
- &display_form;
-
-}
-
-
-sub list_templates {
-
- AM->language(\%myconfig, \%$form);
-
- if (! @{ $form->{ALL} }) {
- &display_form;
- exit;
- }
-
- unshift @{ $form->{ALL} }, { code => '.', description => $locale->text('Default Template') };
-
- $href = "$form->{script}?action=list_templates&direction=$form->{direction}&oldsort=$form->{oldsort}&file=$form->{file}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $form->sort_order();
-
- $form->{callback} = "$form->{script}?action=list_templates&direction=$form->{direction}&oldsort=$form->{oldsort}&file=$form->{file}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $callback = $form->escape($form->{callback});
-
- chomp $myconfig{templates};
- $form->{file} =~ s/$myconfig{templates}//;
- $form->{file} =~ s/\///;
- $form->{title} = $form->{file};
-
- @column_index = $form->sort_columns(qw(code description));
-
- $column_header{code} = qq|<th><a class="listheading" href=$href&sort=code>|.$locale->text('Code').qq|</a></th>|;
- $column_header{description} = qq|<th><a class="listheading" href=$href&sort=description>|.$locale->text('Description').qq|</a></th>|;
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class="listheading">
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
- </tr>
-|;
-
- foreach $ref (@{ $form->{ALL} }) {
-
- $i++; $i %= 2;
-
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- $column_data{code} = qq|<td><a href=$form->{script}?action=display_form&file=$myconfig{templates}/$ref->{code}/$form->{file}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&code=$ref->{code}&callback=$callback>$ref->{code}</td>|;
- $column_data{description} = qq|<td>$ref->{description}</td>|;
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=$form->{script}>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=type value=language>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
- </body>
- </html>
-|;
-
-}
-
-
-sub display_form {
-
- $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
- $form->{file} =~ s/^\/*//g;
- $form->{file} =~ s/$userspath//;
- $form->{file} =~ s/$memberfile//;
-
- $form->error("$!: $form->{file}") unless -f $form->{file};
-
- AM->load_template(\%$form);
-
- $form->{title} = $form->{file};
-
- $form->{body} =~ s/<%include (.*?)%>/<a href=$form->{script}\?action=display_form&file=$myconfig{templates}\/$form->{code}\/$1&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}>$1<\/a>/g;
-
- # if it is anything but html
- if ($form->{file} !~ /\.html$/) {
- $form->{body} = "<pre>\n$form->{body}\n</pre>";
- }
-
- $form->header;
-
- print qq|
-<body>
-
-$form->{body}
-
-<form method=post action=$form->{script}>
-|;
-
- $form->{type} = "template";
-
- $form->hide_form(qw(file type path login sessionid));
-
- print qq|
-<input name=action type=submit class=submit value="|.$locale->text('Edit').qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub edit_template {
-
- AM->load_template(\%$form);
-
- $form->{title} = $locale->text('Edit Template');
- # convert &nbsp to &amp;nbsp;
- $form->{body} =~ s/&nbsp;/&amp;nbsp;/gi;
-
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input name=file type=hidden value=$form->{file}>
-<input name=type type=hidden value=template>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}">
-
-<textarea name=body rows=25 cols=70>
-$form->{body}
-</textarea>
-
-<br>
-<input type=submit class=submit name=action value="|.$locale->text('Save').qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print q|
- </form>
-
-
-</body>
-</html>
-|;
-
-}
-
-
-sub save_template {
-
- AM->save_template(\%$form);
- $form->redirect($locale->text('Template saved!'));
-
-}
-
-
-sub defaults {
-
- # get defaults for account numbers and last numbers
- AM->defaultaccounts(\%myconfig, \%$form);
-
- foreach $key (keys %{ $form->{accno} }) {
- foreach $accno (sort keys %{ $form->{accno}{$key} }) {
- $form->{account}{$key} .= "<option>$accno--$form->{accno}{$key}{$accno}{description}\n";
- $form->{accno}{$form->{accno}{$key}{$accno}{id}} = $accno;
- }
- }
-
- for (qw(IC IC_inventory IC_income IC_expense FX_gain FX_loss)) { $form->{account}{$_} =~ s/>$form->{accno}{$form->{defaults}{$_}}/ selected>$form->{accno}{$form->{defaults}{$_}}/ }
-
- for (qw(accno defaults)) { delete $form->{$_} }
-
- $form->{title} = $locale->text('System Defaults');
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=type value=defaults>
-
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right">|.$locale->text('Business Number').qq|</th>
- <td><input name=businessnumber size=25 value="$form->{businessnumber}"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Weight Unit').qq|</th>
- <td><input name=weightunit size=5 value="$form->{weightunit}"></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <th class="listheading">|.$locale->text('Last Numbers & Default Accounts').qq|</th>
- </tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right" nowrap>|.$locale->text('Inventory').qq|</th>
- <td><select name=IC>$form->{account}{IC}</select></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Income').qq|</th>
- <td><select name=IC_income>$form->{account}{IC_income}</select></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Expense').qq|</th>
- <td><select name=IC_expense>$form->{account}{IC_expense}</select></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Foreign Exchange Gain').qq|</th>
- <td><select name=FX_gain>$form->{account}{FX_gain}</select></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Foreign Exchange Loss').qq|</th>
- <td><select name=FX_loss>$form->{account}{FX_loss}</select></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <th align=left>|.$locale->text('Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies').qq|</th>
- </tr>
- <tr>
- <td>
- <input name=curr size=40 value="$form->{curr}">
- </td>
- </tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right" nowrap>|.$locale->text('GL Reference Number').qq|</th>
- <td><input name=glnumber size=40 value="$form->{glnumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Sales Invoice/AR Transaction Number').qq|</th>
- <td><input name=sinumber size=40 value="$form->{sinumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Sales Order Number').qq|</th>
- <td><input name=sonumber size=40 value="$form->{sonumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Vendor Invoice/AP Transaction Number').qq|</th>
- <td><input name=vinumber size=40 value="$form->{vinumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Purchase Order Number').qq|</th>
- <td><input name=ponumber size=40 value="$form->{ponumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Sales Quotation Number').qq|</th>
- <td><input name=sqnumber size=40 value="$form->{sqnumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('RFQ Number').qq|</th>
- <td><input name=rfqnumber size=40 value="$form->{rfqnumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Part Number').qq|</th>
- <td><input name=partnumber size=40 value="$form->{partnumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Job/Project Number').qq|</th>
- <td><input name=projectnumber size=40 value="$form->{projectnumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Employee Number').qq|</th>
- <td><input name=employeenumber size=40 value="$form->{employeenumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Customer Number').qq|</th>
- <td><input name=customernumber size=40 value="$form->{customernumber}"></td>
- </tr>
- <tr>
- <th align="right" nowrap>|.$locale->text('Vendor Number').qq|</th>
- <td><input name=vendornumber size=40 value="$form->{vendornumber}"></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- $form->hide_form(qw(path login sessionid));
-
- print qq|
-<input type=submit class=submit name=action value="|.$locale->text('Save').qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub taxes {
-
- # get tax account numbers
- AM->taxes(\%myconfig, \%$form);
-
- $i = 0;
- foreach $ref (@{ $form->{taxrates} }) {
- $i++;
- $form->{"taxrate_$i"} = $form->format_amount(\%myconfig, $ref->{rate});
- $form->{"taxdescription_$i"} = $ref->{description};
-
- for (qw(taxnumber validto)) { $form->{"${_}_$i"} = $ref->{$_} }
- $form->{taxaccounts} .= "$ref->{id}_$i ";
- }
- chop $form->{taxaccounts};
-
- &display_taxes;
-
-}
-
-
-sub display_taxes {
-
- $form->{title} = $locale->text('Taxes');
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=type value=taxes>
-
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th></th>
- <th>|.$locale->text('Rate').qq| (%)</th>
- <th>|.$locale->text('Number').qq|</th>
- <th>|.$locale->text('Valid To').qq|</th>
- </tr>
-|;
-
- for (split(/ /, $form->{taxaccounts})) {
-
- ($null, $i) = split /_/, $_;
-
- $form->{"taxrate_$i"} = $form->format_amount(\%myconfig, $form->{"taxrate_$i"});
-
- $form->hide_form("taxdescription_$i");
-
- print qq|
- <tr>
- <th align="right">|;
-
- if ($form->{"taxdescription_$i"} eq $sametax) {
- print "";
- } else {
- print qq|$form->{"taxdescription_$i"}|;
- }
-
- print qq|</th>
- <td><input name="taxrate_$i" size=6 value=$form->{"taxrate_$i"}></td>
- <td><input name="taxnumber_$i" value="$form->{"taxnumber_$i"}"></td>
- <td><input name="validto_$i" size=11 value="$form->{"validto_$i"}" title="$myconfig{dateformat}"></td>
- </tr>
-|;
- $sametax = $form->{"taxdescription_$i"};
-
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- $form->hide_form(qw(taxaccounts path login sessionid));
-
- print qq|
-<input type=submit class=submit name=action value="|.$locale->text('Update').qq|">
-<input type=submit class=submit name=action value="|.$locale->text('Save').qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub update {
-
- @a = split / /, $form->{taxaccounts};
- $ndx = $#a + 1;
-
- foreach $item (@a) {
- ($accno, $i) = split /_/, $item;
- push @t, $accno;
-
- if ($form->{"validto_$i"}) {
- $j = $i + 1;
- if ($form->{"taxdescription_$i"} ne $form->{"taxdescription_$j"}) {
- #insert line
- for ($j = $ndx + 1; $j > $i; $j--) {
- $k = $j - 1;
- for (qw(taxrate taxdescription taxnumber validto)) { $form->{"${_}_$j"} = $form->{"${_}_$k"} }
- }
- $ndx++;
- $k = $i + 1;
- for (qw(taxdescription taxnumber)) { $form->{"${_}_$k"} = $form->{"${_}_$i"} }
- for (qw(taxrate validto)) { $form->{"${_}_$k"} = "" }
- push @t, $accno;
- }
- } else {
- # remove line
- $j = $i + 1;
- if ($form->{"taxdescription_$i"} eq $form->{"taxdescription_$j"}) {
- for ($j = $i + 1; $j <= $ndx; $j++) {
- $k = $j + 1;
- for (qw(taxrate taxdescription taxnumber validto)) { $form->{"${_}_$j"} = $form->{"${_}_$k"} }
- }
- $ndx--;
- splice @t, $i-1, 1;
- }
- }
-
- }
-
- $i = 1;
- $form->{taxaccounts} = "";
- for (@t) {
- $form->{taxaccounts} .= "${_}_$i ";
- $i++;
- }
- chop $form->{taxaccounts};
-
- &display_taxes;
-
-}
-
-
-
-sub config {
-
- foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
- $dateformat .= ($item eq $myconfig{dateformat}) ? "<option selected>$item\n" : "<option>$item\n";
- }
-
- foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00 1'000.00)) {
- $numberformat .= ($item eq $myconfig{numberformat}) ? "<option selected>$item\n" : "<option>$item\n";
- }
-
- for (qw(name company address signature)) { $myconfig{$_} = $form->quote($myconfig{$_}) }
- for (qw(address signature)) { $myconfig{$_} =~ s/\\n/\n/g }
-
- %countrycodes = User->country_codes;
- $countrycodes = '';
-
- foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
- $countrycodes .= ($myconfig{countrycode} eq $key) ? "<option selected value=$key>$countrycodes{$key}\n" : "<option value=$key>$countrycodes{$key}\n";
- }
- $countrycodes = qq|<option value="">English\n$countrycodes|;
-
- opendir CSS, "css/.";
- @all = grep /.*\.css$/, readdir CSS;
- closedir CSS;
-
- foreach $item (@all) {
- if ($item eq $myconfig{stylesheet}) {
- $selectstylesheet .= qq|<option selected>$item\n|;
- } else {
- $selectstylesheet .= qq|<option>$item\n|;
- }
- }
- $selectstylesheet .= "<option>\n";
-
- if (%printer && $latex) {
- $selectprinter = "<option>\n";
- foreach $item (sort keys %printer) {
- if ($myconfig{printer} eq $item) {
- $selectprinter .= qq|<option value="$item" selected>$item\n|;
- } else {
- $selectprinter .= qq|<option value="$item">$item\n|;
- }
- }
-
- $printer = qq|
- <tr>
- <th align="right">|.$locale->text('Printer').qq|</th>
- <td><select name=printer>$selectprinter</select></td>
- </tr>
-|;
- }
-
- $form->{title} = $locale->text('Edit Preferences for').qq| $form->{login}|;
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=old_password value=$myconfig{password}>
-<input type=hidden name=type value=preferences>
-<input type=hidden name=role value=$myconfig{role}>
-
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr>
- <td>
- <table width=100%>
- <tr valign=top>
- <td>
- <table>
- <tr>
- <th align="right">|.$locale->text('Name').qq|</th>
- <td><input name=name size=20 value="$myconfig{name}"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('E-mail').qq|</th>
- <td><input name=email size=35 value="$myconfig{email}"></td>
- </tr>
- <tr valign=top>
- <th align="right">|.$locale->text('Signature').qq|</th>
- <td><textarea name=signature rows=3 cols=35>$myconfig{signature}</textarea></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Phone').qq|</th>
- <td><input name=tel size=14 value="$myconfig{tel}"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Fax').qq|</th>
- <td><input name=fax size=14 value="$myconfig{fax}"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Company').qq|</th>
- <td><input name=company size=35 value="$myconfig{company}"></td>
- </tr>
- <tr valign=top>
- <th align="right">|.$locale->text('Address').qq|</th>
- <td><textarea name=address rows=4 cols=35>$myconfig{address}</textarea></td>
- </tr>
- </table>
- </td>
- <td>
- <table>
- <tr>
- <th align="right">|.$locale->text('Password').qq|</th>
- <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Confirm').qq|</th>
- <td><input type=password name=confirm_password size=10></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Date Format').qq|</th>
- <td><select name=dateformat>$dateformat</select></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Number Format').qq|</th>
- <td><select name=numberformat>$numberformat</select></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Dropdown Limit').qq|</th>
- <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Menu Width').qq|</th>
- <td><input name=menuwidth size=10 value="$myconfig{menuwidth}"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Language').qq|</th>
- <td><select name=countrycode>$countrycodes</select></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Session Timeout').qq|</th>
- <td><input name=timeout size=10 value="$myconfig{timeout}"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Stylesheet').qq|</th>
- <td><select name=usestylesheet>$selectstylesheet</select></td>
- </tr>
- $printer
- </table>
- </td>
- </tr>
- </table>
- </td>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- $form->hide_form(qw(path login sessionid));
-
- print qq|
-<input type=submit class=submit name=action value="|.$locale->text('Save').qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub save_defaults {
-
- if (AM->save_defaults(\%myconfig, \%$form)) {
- $form->redirect($locale->text('Defaults saved!'));
- } else {
- $form->error($locale->text('Cannot save defaults!'));
- }
-
-}
-
-
-sub save_taxes {
-
- if (AM->save_taxes(\%myconfig, \%$form)) {
- $form->redirect($locale->text('Taxes saved!'));
- } else {
- $form->error($locale->text('Cannot save taxes!'));
- }
-
-}
-
-
-sub save_preferences {
-
- $form->{stylesheet} = $form->{usestylesheet};
-
- if ($form->{new_password} ne $form->{old_password}) {
- $form->error($locale->text('Password does not match!')) if $form->{new_password} ne $form->{confirm_password};
- }
-
- if (AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath)) {
- $form->redirect($locale->text('Preferences saved!'));
- } else {
- $form->error($locale->text('Cannot save preferences!'));
- }
-
-}
-
-
-sub backup {
-
- if ($form->{media} eq 'email') {
- $form->error($locale->text('No email address for')." $myconfig{name}") unless ($myconfig{email});
-
- $form->{OUT} = "$sendmail";
-
- }
-
- $SIG{INT} = 'IGNORE';
- AM->backup(\%myconfig, \%$form, $userspath, $gzip);
-
- if ($form->{media} eq 'email') {
- $form->redirect($locale->text('Backup sent to').qq| $myconfig{email}|);
- }
-
-}
-
-
-
-sub audit_control {
-
- $form->{title} = $locale->text('Audit Control');
-
- AM->closedto(\%myconfig, \%$form);
-
- if ($form->{revtrans}) {
- $checked{revtransY} = "checked";
- } else {
- $checked{revtransN} = "checked";
- }
-
- if ($form->{audittrail}) {
- $checked{audittrailY} = "checked";
- } else {
- $checked{audittrailN} = "checked";
- }
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=sessionid value=$form->{sessionid}>
-
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right">|.$locale->text('Enforce transaction reversal for all dates').qq|</th>
- <td><input name=revtrans class=radio type=radio value="1" $checked{revtransY}> |.$locale->text('Yes').qq| <input name=revtrans class=radio type=radio value="0" $checked{revtransN}> |.$locale->text('No').qq|</td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Close Books up to').qq|</th>
- <td><input name=closedto size=11 title="$myconfig{dateformat}" value=$form->{closedto}></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Activate Audit trail').qq|</th>
- <td><input name=audittrail class=radio type=radio value="1" $checked{audittrailY}> |.$locale->text('Yes').qq| <input name=audittrail class=radio type=radio value="0" $checked{audittrailN}> |.$locale->text('No').qq|</td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Remove Audit trail up to').qq|</th>
- <td><input name=removeaudittrail size=11 title="$myconfig{dateformat}"></td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<hr size=3 noshade>
-
-<br>
-<input type=hidden name=nextsub value=doclose>
-<input type=hidden name=action value=continue>
-<input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
-
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub doclose {
-
- AM->closebooks(\%myconfig, \%$form);
-
- if ($form->{revtrans}) {
- $msg = $locale->text('Transaction reversal enforced for all dates');
- } else {
-
- if ($form->{closedto}) {
- $msg = $locale->text('Transaction reversal enforced up to')
- ." ".$locale->date(\%myconfig, $form->{closedto}, 1);
- } else {
- $msg = $locale->text('Books are open');
- }
- }
-
- $msg .= "<p>";
- if ($form->{audittrail}) {
- $msg .= $locale->text('Audit trail enabled');
- } else {
- $msg .= $locale->text('Audit trail disabled');
- }
-
- $msg .= "<p>";
- if ($form->{removeaudittrail}) {
- $msg .= $locale->text('Audit trail removed up to')
- ." ".$locale->date(\%myconfig, $form->{removeaudittrail}, 1);
- }
-
- $form->redirect($msg);
-
-}
-
-
-sub add_warehouse {
-
- $form->{title} = "Add";
-
- $form->{callback} = "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
-
- &warehouse_header;
- &form_footer;
-
-}
-
-
-sub edit_warehouse {
-
- $form->{title} = "Edit";
-
- AM->get_warehouse(\%myconfig, \%$form);
-
- &warehouse_header;
- &form_footer;
-
-}
-
-
-sub list_warehouse {
-
- AM->warehouses(\%myconfig, \%$form);
-
- $href = "$form->{script}?action=list_warehouse&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $form->sort_order();
-
- $form->{callback} = "$form->{script}?action=list_warehouse&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $callback = $form->escape($form->{callback});
-
- $form->{title} = $locale->text('Warehouses');
-
- @column_index = qw(description);
-
- $column_header{description} = qq|<th width=100%><a class="listheading" href=$href>|.$locale->text('Description').qq|</a></th>|;
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class="listheading">
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
- </tr>
-|;
-
- foreach $ref (@{ $form->{ALL} }) {
-
- $i++; $i %= 2;
-
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- $column_data{description} = qq|<td><a href=$form->{script}?action=edit_warehouse&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{description}</td>|;
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print qq|
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=$form->{script}>
-|;
-
- $form->{type} = "warehouse";
-
- $form->hide_form(qw(type callback path login sessionid));
-
- print qq|
-<input class=submit type=submit name=action value="|.$locale->text('Add Warehouse').qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
- </body>
- </html>
-|;
-
-}
-
-
-
-sub warehouse_header {
-
- $form->{title} = $locale->text("$form->{title} Warehouse");
-
-# $locale->text('Add Warehouse')
-# $locale->text('Edit Warehouse')
-
- $form->{description} = $form->quote($form->{description});
-
- if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
- $description = qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
- } else {
- $description = qq|<input name=description size=60 value="$form->{description}">|;
- }
-
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=type value=warehouse>
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=2>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <th align="right">|.$locale->text('Description').qq|</th>
- <td>$description</td>
- </tr>
- <tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
-}
-
-
-sub save_warehouse {
-
- $form->isblank("description", $locale->text('Description missing!'));
- AM->save_warehouse(\%myconfig, \%$form);
- $form->redirect($locale->text('Warehouse saved!'));
-
-}
-
-
-sub delete_warehouse {
-
- AM->delete_warehouse(\%myconfig, \%$form);
- $form->redirect($locale->text('Warehouse deleted!'));
-
-}
-
-
-sub yearend {
-
- AM->earningsaccounts(\%myconfig, \%$form);
- $chart = "";
- for (@{ $form->{chart} }) { $chart .= "<option>$_->{accno}--$_->{description}" }
-
- $form->{title} = $locale->text('Yearend');
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=decimalplaces value=2>
-<input type=hidden name=l_accno value=Y>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align="right">|.$locale->text('Yearend').qq|</th>
- <td><input name=todate size=11 title="$myconfig{dateformat}" value=$todate></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Reference').qq|</th>
- <td><input name=reference size=20 value="|.$locale->text('Yearend').qq|"></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Description').qq|</th>
- <td><textarea name=description rows=3 cols=50 wrap=soft></textarea></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Retained Earnings').qq|</th>
- <td><select name=accno>$chart</select></td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Method').qq|</th>
- <td><input name=method class=radio type=radio value=accrual checked>&nbsp;|.$locale->text('Accrual').qq|&nbsp;<input name=method class=radio type=radio value=cash>&nbsp;|.$locale->text('Cash').qq|</td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<hr size=3 noshade>
-
-<input type=hidden name=nextsub value=generate_yearend>
-|;
-
- $form->hide_form(qw(path login sessionid));
-
- print qq|
-<input class=submit type=submit name=action value="|.$locale->text('Continue').qq|">|;
-
-}
-
-
-sub generate_yearend {
-
- $form->isblank("todate", $locale->text('Yearend date missing!'));
-
- RP->yearend_statement(\%myconfig, \%$form);
-
- $form->{transdate} = $form->{todate};
-
- $earnings = 0;
-
- $form->{rowcount} = 1;
- foreach $key (keys %{ $form->{I} }) {
- if ($form->{I}{$key}{charttype} eq "A") {
- $form->{"debit_$form->{rowcount}"} = $form->{I}{$key}{this};
- $earnings += $form->{I}{$key}{this};
- $form->{"accno_$form->{rowcount}"} = $key;
- $form->{rowcount}++;
- $ok = 1;
- }
- }
-
- foreach $key (keys %{ $form->{E} }) {
- if ($form->{E}{$key}{charttype} eq "A") {
- $form->{"credit_$form->{rowcount}"} = $form->{E}{$key}{this} * -1;
- $earnings += $form->{E}{$key}{this};
- $form->{"accno_$form->{rowcount}"} = $key;
- $form->{rowcount}++;
- $ok = 1;
- }
- }
- if ($earnings > 0) {
- $form->{"credit_$form->{rowcount}"} = $earnings;
- $form->{"accno_$form->{rowcount}"} = $form->{accno}
- } else {
- $form->{"debit_$form->{rowcount}"} = $earnings * -1;
- $form->{"accno_$form->{rowcount}"} = $form->{accno}
- }
-
- if ($ok) {
- if (AM->post_yearend(\%myconfig, \%$form)) {
- $form->redirect($locale->text('Yearend posted!'));
- } else {
- $form->error($locale->text('Yearend posting failed!'));
- }
- } else {
- $form->error('Nothing to do!');
- }
-
-}
-
-
-
-sub company_logo {
-
- $myconfig{address} =~ s/\\n/<br>/g;
- $myconfig{dbhost} = $locale->text('localhost') unless $myconfig{dbhost};
-
- $form->{stylesheet} = $myconfig{stylesheet};
-
- $form->{title} = $locale->text('About');
-
- # create the logo screen
- $form->header;
-
- print qq|
-<body>
-
-<pre>
-
-</pre>
-<center>
-<a href="http://sourceforge.net/projects/ledger-smb/" target="_blank"><img src="ledger-smb.png" width="200" height="100" border="0" alt="LedgerSMB Logo" /></a>
-<h1 class="login">|.$locale->text('Version').qq| $form->{version}</h1>
-
-<p>
-|.$locale->text('Licensed to').qq|
-<p>
-<b>
-$myconfig{company}
-<br>$myconfig{address}
-</b>
-
-<p>
-<table border=0>
- <tr>
- <th align="right">|.$locale->text('User').qq|</th>
- <td>$myconfig{name}</td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Dataset').qq|</th>
- <td>$myconfig{dbname}</td>
- </tr>
- <tr>
- <th align="right">|.$locale->text('Database Host').qq|</th>
- <td>$myconfig{dbhost}</td>
- </tr>
-</table>
-
-</center>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub recurring_transactions {
-
-# $locale->text('Day')
-# $locale->text('Days')
-# $locale->text('Month')
-# $locale->text('Months')
-# $locale->text('Week')
-# $locale->text('Weeks')
-# $locale->text('Year')
-# $locale->text('Years')
-
- $form->{stylesheet} = $myconfig{stylesheet};
-
- $form->{title} = $locale->text('Recurring Transactions');
-
- $column_header{id} = "";
-
- AM->recurring_transactions(\%myconfig, \%$form);
-
- $href = "$form->{script}?action=recurring_transactions";
- for (qw(direction oldsort path login sessionid)) { $href .= qq|&$_=$form->{$_}| }
-
- $form->sort_order();
-
- # create the logo screen
- $form->header;
-
- @column_index = qw(ndx reference description);
-
- push @column_index, qw(nextdate enddate id amount curr repeat howmany recurringemail recurringprint);
-
- $column_header{reference} = qq|<th><a class="listheading" href="$href&sort=reference">|.$locale->text('Reference').q|</a></th>|;
- $column_header{ndx} = q|<th class="listheading">&nbsp;</th>|;
- $column_header{id} = q|<th class="listheading">|.$locale->text('ID').q|</th>|;
- $column_header{description} = q|<th class="listheading">|.$locale->text('Description').q|</th>|;
- $column_header{nextdate} = qq|<th><a class="listheading" href="$href&sort=nextdate">|.$locale->text('Next').q|</a></th>|;
- $column_header{enddate} = qq|<th><a class="listheading" href="$href&sort=enddate">|.$locale->text('Ends').q|</a></th>|;
- $column_header{amount} = q|<th class="listheading">|.$locale->text('Amount').q|</th>|;
- $column_header{curr} = q|<th class="listheading">&nbsp;</th>|;
- $column_header{repeat} = q|<th class="listheading">|.$locale->text('Every').q|</th>|;
- $column_header{howmany} = q|<th class="listheading">|.$locale->text('Times').q|</th>|;
- $column_header{recurringemail} = q|<th class="listheading">|.$locale->text('E-mail').q|</th>|;
- $column_header{recurringprint} = q|<th class="listheading">|.$locale->text('Print').q|</th>|;
-
-print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class="listheading">
-|;
-
- for (@column_index) { print "\n$column_header{$_}" }
-
- print qq|
- </tr>
-|;
-
- $i = 1;
- $colspan = $#column_index + 1;
-
- %tr = ( ar => $locale->text('AR'),
- ap => $locale->text('AP'),
- gl => $locale->text('GL'),
- so => $locale->text('Sales Orders'),
- po => $locale->text('Purchase Orders'),
- );
-
- %f = &formnames;
-
- foreach $transaction (sort keys %{ $form->{transactions} }) {
- print qq|
- <tr>
- <th class="listheading" colspan=$colspan>$tr{$transaction}</th>
- </tr>
-|;
-
- foreach $ref (@{ $form->{transactions}{$transaction} }) {
-
- for (@column_index) { $column_data{$_} = "<td nowrap>$ref->{$_}</td>" }
-
- if ($ref->{repeat} > 1) {
- $unit = $locale->text(ucfirst $ref->{unit});
- $repeat = "$ref->{repeat} $unit";
- } else {
- chop $ref->{unit};
- $unit = $locale->text(ucfirst $ref->{unit});
- $repeat = $unit;
- }
-
- $column_data{ndx} = qq|<td></td>|;
-
- if (!$ref->{expired}) {
- if ($ref->{overdue} <= 0) {
- $k++;
- $column_data{ndx} = qq|<td nowrap><input name="ndx_$k" class=checkbox type=checkbox value=$ref->{id} checked></td>|;
- }
- }
-
- $reference = ($ref->{reference}) ? $ref->{reference} : $locale->text('Next Number');
- $column_data{reference} = qq|<td nowrap><a href=$form->{script}?action=edit_recurring&id=$ref->{id}&vc=$ref->{vc}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&module=$ref->{module}&invoice=$ref->{invoice}&transaction=$ref->{transaction}&recurringnextdate=$ref->{nextdate}>$reference</a></td>|;
-
- $module = "$ref->{module}.pl";
- $type = "";
- if ($ref->{module} eq 'ar') {
- $module = "is.pl" if $ref->{invoice};
- $ref->{amount} /= $ref->{exchangerate};
- }
- if ($ref->{module} eq 'ap') {
- $module = "ir.pl" if $ref->{invoice};
- $ref->{amount} /= $ref->{exchangerate};
- }
- if ($ref->{module} eq 'oe') {
- $type = ($ref->{vc} eq 'customer') ? "sales_order" : "purchase_order";
- }
-
- $column_data{id} = qq|<td><a href="$module?action=edit&id=$ref->{id}&vc=$ref->{vc}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&type=$type&readonly=1">$ref->{id}</a></td>|;
-
- $column_data{repeat} = qq|<td align="right" nowrap>$repeat</td>|;
- $column_data{howmany} = qq|<td align="right" nowrap>|.$form->format_amount(\%myconfig, $ref->{howmany})."</td>";
- $column_data{amount} = qq|<td align="right" nowrap>|.$form->format_amount(\%myconfig, $ref->{amount}, 2)."</td>";
-
- $column_data{recurringemail} = "<td nowrap>";
- @f = split /:/, $ref->{recurringemail};
- for (0 .. $#f) { $column_data{recurringemail} .= "$f{$f[$_]}<br>" }
- $column_data{recurringemail} .= "</td>";
-
- $column_data{recurringprint} = "<td nowrap>";
- @f = split /:/, $ref->{recurringprint};
- for (0 .. $#f) { $column_data{recurringprint} .= "$f{$f[$_]}<br>" }
- $column_data{recurringprint} .= "</td>";
-
- $j++; $j %= 2;
- print qq|
- <tr class=listrow$j>
-|;
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- print qq|
- </tr>
-|;
- }
- }
-
- print qq|
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input name=lastndx type=hidden value=$k>
-|;
-
- $form->hide_form(qw(path login sessionid));
-
- print qq|
-<input class=submit type=submit name=action value="|.$locale->text('Process Transactions').qq|">| if $k;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub edit_recurring {
-
- %links = ( ar => 'create_links',
- ap => 'create_links',
- gl => 'create_links',
- is => 'invoice_links',
- ir => 'invoice_links',
- oe => 'order_links',
- );
- %prepare = ( is => 'prepare_invoice',
- ir => 'prepare_invoice',
- oe => 'prepare_order',
- );
-
- $form->{callback} = "$form->{script}?action=recurring_transactions&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $form->{type} = "transaction";
-
- if ($form->{module} eq 'ar') {
- if ($form->{invoice}) {
- $form->{type} = "invoice";
- $form->{module} = "is";
- }
- }
- if ($form->{module} eq 'ap') {
- if ($form->{invoice}) {
- $form->{type} = "invoice";
- $form->{module} = "ir";
- }
- }
-
- if ($form->{module} eq 'oe') {
- %tr = ( so => sales_order,
- po => purchase_order,
- );
-
- $form->{type} = $tr{$form->{transaction}};
- }
-
- $form->{script} = "$form->{module}.pl";
- do "$form->{path}/$form->{script}";
-
- &{ $links{$form->{module}} };
-
- # return if transaction doesn't exist
- $form->redirect unless $form->{recurring};
-
- if ($prepare{$form->{module}}) {
- &{ $prepare{$form->{module}} };
- }
-
- $form->{selectformat} = qq|<option value="html">html\n|;
- if ($latex) {
- $form->{selectformat} .= qq|
- <option value="postscript">|.$locale->text('Postscript').qq|
- <option value="pdf">|.$locale->text('PDF');
- }
-
- &schedule;
-
-}
-
-
-sub process_transactions {
-
- # save variables
- my $pt = new Form;
- for (keys %$form) { $pt->{$_} = $form->{$_} }
-
- my $defaultprinter;
- while (my ($key, $value) = each %printer) {
- if ($value =~ /lpr/) {
- $defaultprinter = $key;
- last;
- }
- }
-
- $myconfig{vclimit} = 0;
- %f = &formnames;
-
- for (my $i = 1; $i <= $pt->{lastndx}; $i++) {
- if ($pt->{"ndx_$i"}) {
- $id = $pt->{"ndx_$i"};
-
- # process transaction
- AM->recurring_details(\%myconfig, \%$pt, $id);
-
- $header = $form->{header};
- # reset $form
- for (keys %$form) { delete $form->{$_}; }
- for (qw(login path sessionid stylesheet timeout)) { $form->{$_} = $pt->{$_}; }
- $form->{id} = $id;
- $form->{header} = $header;
-
- # post, print, email
- if ($pt->{arid} || $pt->{apid} || $pt->{oeid}) {
- if ($pt->{arid} || $pt->{apid}) {
- if ($pt->{arid}) {
- $form->{script} = ($pt->{invoice}) ? "is.pl" : "ar.pl";
- $form->{ARAP} = "AR";
- $form->{module} = "ar";
- $invfld = "sinumber";
- } else {
- $form->{script} = ($pt->{invoice}) ? "ir.pl" : "ap.pl";
- $form->{ARAP} = "AP";
- $form->{module} = "ap";
- $invfld = "vinumber";
- }
- do "$form->{path}/$form->{script}";
-
- if ($pt->{invoice}) {
- &invoice_links;
- &prepare_invoice;
-
- for (keys %$form) { $form->{$_} = $form->unquote($form->{$_}) }
-
- } else {
- &create_links;
-
- $form->{type} = "transaction";
- for (1 .. $form->{rowcount} - 1) { $form->{"amount_$_"} = $form->format_amount(\%myconfig, $form->{"amount_$_"}, 2) }
- for (1 .. $form->{paidaccounts}) { $form->{"paid_$_"} = $form->format_amount(\%myconfig, $form->{"paid_$_"}, 2) }
-
- }
-
- delete $form->{"$form->{ARAP}_links"};
- for (qw(acc_trans invoice_details)) { delete $form->{$_} }
- for (qw(department employee language month partsgroup project years)) { delete $form->{"all_$_"} }
-
- $form->{invnumber} = $pt->{reference};
- $form->{transdate} = $pt->{nextdate};
-
- # tax accounts
- $form->all_taxaccounts(\%myconfig, undef, $form->{transdate});
-
- # calculate duedate
- $form->{duedate} = $form->add_date(\%myconfig, $form->{transdate}, $pt->{overdue}, "days");
-
- if ($pt->{payment}) {
- # calculate date paid
- for ($j = 1; $j <= $form->{paidaccounts}; $j++) {
- $form->{"datepaid_$j"} = $form->add_date(\%myconfig, $form->{transdate}, $pt->{paid}, "days");
-
- ($form->{"$form->{ARAP}_paid_$j"}) = split /--/, $form->{"$form->{ARAP}_paid_$j"};
- delete $form->{"cleared_$j"};
- }
-
- $form->{paidaccounts}++;
- } else {
- $form->{paidaccounts} = -1;
- }
-
- for (qw(id recurring intnotes printed emailed queued)) { delete $form->{$_} }
-
- ($form->{$form->{ARAP}}) = split /--/, $form->{$form->{ARAP}};
-
- $form->{invnumber} = $form->update_defaults(\%myconfig, "$invfld") unless $form->{invnumber};
- $form->{reference} = $form->{invnumber};
- for (qw(invnumber reference)) { $form->{$_} = $form->unquote($form->{$_}) }
-
- if ($pt->{invoice}) {
- if ($pt->{arid}) {
- $form->info("\n".$locale->text('Posting')." ".$locale->text('Sales Invoice')." $form->{invnumber}");
- $ok = IS->post_invoice(\%myconfig, \%$form);
- } else {
- $form->info("\n".$locale->text('Posting')." ".$locale->text('Vendor Invoice')." $form->{invnumber}");
- $ok = IR->post_invoice(\%myconfig, \%$form);
- }
- } else {
- if ($pt->{arid}) {
- $form->info("\n".$locale->text('Posting')." ".$locale->text('Transaction')." $form->{invnumber}");
- } else {
- $form->info("\n".$locale->text('Posting')." ".$locale->text('Transaction')." $form->{invnumber}");
- }
-
- $ok = AA->post_transaction(\%myconfig, \%$form);
-
- }
- $form->info(" ..... ".$locale->text('done'));
-
- # print form
- if ($latex && $ok) {
- $ok = &print_recurring(\%$pt, $defaultprinter);
- }
-
- &email_recurring(\%$pt) if $ok;
-
- } else {
-
- # order
- $form->{script} = "oe.pl";
- $form->{module} = "oe";
-
- $ordnumber = "ordnumber";
- if ($pt->{customer_id}) {
- $form->{vc} = "customer";
- $form->{type} = "sales_order";
- $ordfld = "sonumber";
- $flabel = $locale->text('Sales Order');
- } else {
- $form->{vc} = "vendor";
- $form->{type} = "purchase_order";
- $ordfld = "ponumber";
- $flabel = $locale->text('Purchase Order');
- }
- require "$form->{path}/$form->{script}";
-
- &order_links;
- &prepare_order;
-
- for (keys %$form) { $form->{$_} = $form->unquote($form->{$_}) }
-
- $form->{$ordnumber} = $pt->{reference};
- $form->{transdate} = $pt->{nextdate};
-
- # calculate reqdate
- $form->{reqdate} = $form->add_date(\%myconfig, $form->{transdate}, $pt->{req}, "days") if $form->{reqdate};
-
- for (qw(id recurring intnotes printed emailed queued)) { delete $form->{$_} }
- for (1 .. $form->{rowcount}) { delete $form->{"orderitems_id_$_"} }
-
- $form->{$ordnumber} = $form->update_defaults(\%myconfig, "$ordfld") unless $form->{$ordnumber};
- $form->{reference} = $form->{$ordnumber};
- for ("$ordnumber", "reference") { $form->{$_} = $form->unquote($form->{$_}) }
- $form->{closed} = 0;
-
- $form->info("\n".$locale->text('Saving')." ".$flabel." $form->{$ordnumber}");
- if ($ok = OE->save(\%myconfig, \%$form)) {
- $form->info(" ..... ".$locale->text('done'));
- } else {
- $form->info(" ..... ".$locale->text('failed'));
- }
-
- # print form
- if ($latex && $ok) {
- &print_recurring(\%$pt, $defaultprinter);
- }
-
- &email_recurring(\%$pt);
-
- }
-
- } else {
- # GL transaction
- GL->transaction(\%myconfig, \%$form);
-
- $form->{reference} = $pt->{reference};
- $form->{transdate} = $pt->{nextdate};
-
- $j = 1;
- foreach $ref (@{ $form->{GL} }) {
- $form->{"accno_$j"} = "$ref->{accno}--$ref->{description}";
-
- $form->{"projectnumber_$j"} = "$ref->{projectnumber}--$ref->{project_id}" if $ref->{project_id};
- $form->{"fx_transaction_$j"} = $ref->{fx_transaction};
-
- if ($ref->{amount} < 0) {
- $form->{"debit_$j"} = $ref->{amount} * -1;
- } else {
- $form->{"credit_$j"} = $ref->{amount};
- }
-
- $j++;
- }
-
- $form->{rowcount} = $j;
-
- for (qw(id recurring)) { delete $form->{$_} }
- $form->info("\n".$locale->text('Posting')." ".$locale->text('GL Transaction')." $form->{reference}");
- $ok = GL->post_transaction(\%myconfig, \%$form);
- $form->info(" ..... ".$locale->text('done'));
-
- }
-
- AM->update_recurring(\%myconfig, \%$pt, $id) if $ok;
-
- }
- }
-
- $form->{callback} = "am.pl?action=recurring_transactions&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&header=$form->{header}";
- $form->redirect;
-
-}
-
-
-sub print_recurring {
- my ($pt, $defaultprinter) = @_;
-
- my %f = &formnames;
- my $ok = 1;
-
- if ($pt->{recurringprint}) {
- @f = split /:/, $pt->{recurringprint};
- for ($j = 0; $j <= $#f; $j += 3) {
- $media = $f[$j+2];
- $media ||= $myconfig->{printer} if $printer{$myconfig->{printer}};
- $media ||= $defaultprinter;
-
- $form->info("\n".$locale->text('Printing')." ".$locale->text($f{$f[$j]})." $form->{reference}");
-
- @a = ("perl", "$form->{script}", "action=reprint&module=$form->{module}&type=$form->{type}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}&id=$form->{id}&formname=$f[$j]&format=$f[$j+1]&media=$media&vc=$form->{vc}&ARAP=$form->{ARAP}");
-
- $ok = !(system(@a));
-
- if ($ok) {
- $form->info(" ..... ".$locale->text('done'));
- } else {
- $form->info(" ..... ".$locale->text('failed'));
- last;
- }
- }
- }
-
- $ok;
-
-}
-
-
-sub email_recurring {
- my ($pt) = @_;
-
- my %f = &formnames;
- my $ok = 1;
-
- if ($pt->{recurringemail}) {
-
- @f = split /:/, $pt->{recurringemail};
- for ($j = 0; $j <= $#f; $j += 2) {
-
- $form->info("\n".$locale->text('Sending')." ".$locale->text($f{$f[$j]})." $form->{reference}");
-
- # no email, bail out
- if (!$form->{email}) {
- $form->info(" ..... ".$locale->text('E-mail address missing!'));
- last;
- }
-
- $message = $form->escape($pt->{message},1);
-
- @a = ("perl", "$form->{script}", "action=reprint&module=$form->{module}&type=$form->{type}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}&id=$form->{id}&formname=$f[$j]&format=$f[$j+1]&media=email&vc=$form->{vc}&ARAP=$form->{ARAP}&message=$message");
-
- $ok = !(system(@a));
-
- if ($ok) {
- $form->info(" ..... ".$locale->text('done'));
- } else {
- $form->info(" ..... ".$locale->text('failed'));
- last;
- }
- }
- }
-
- $ok;
-
-}
-
-
-
-sub formnames {
-
-# $locale->text('Transaction')
-# $locale->text('Invoice')
-# $locale->text('Credit Invoice')
-# $locale->text('Debit Invoice')
-# $locale->text('Packing List')
-# $locale->text('Pick List')
-# $locale->text('Sales Order')
-# $locale->text('Work Order')
-# $locale->text('Purchase Order')
-# $locale->text('Bin List')
-
- my %f = ( transaction => 'Transaction',
- invoice => 'Invoice',
- credit_invoice => 'Credit Invoice',
- debit_invoice => 'Debit Invoice',
- packing_list => 'Packing List',
- pick_list => 'Pick List',
- sales_order => 'Sales Order',
- work_order => 'Work Order',
- purchase_order => 'Purchase Order',
- bin_list => 'Bin List',
- );
-
- %f;
-
-}
-
-
-sub continue { &{ $form->{nextsub} } };
-
+require "bin/mozilla/am.pl";
diff --git a/bin/lynx/ap.pl b/bin/lynx/ap.pl
index 3f0a3db8..a9dae7f2 100755
--- a/bin/lynx/ap.pl
+++ b/bin/lynx/ap.pl
@@ -1,58 +1,3 @@
-#=====================================================================
-# LedgerSMB Small Medium Business Accounting
-
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
-# under the GNU General Public License version 2 or, at your option, any later
-# version. For a full list including contact information of contributors,
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (C) 2000
-#
-# Author: DWS Systems Inc.
-# Web: http://www.sql-ledger.org
-#
-# Contributors:
-#
-#
-# Author: DWS Systems Inc.
-# Web: http://sourceforge.net/projects/ledger-smb/
-#
-# Contributors:
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#======================================================================
-#
-# Accounts Payable
-#
-#======================================================================
-
-use SL::PE;
-use SL::IR;
-
-require "$form->{path}/arap.pl";
-require "$form->{path}/arapprn.pl";
-require "$form->{path}/aa.pl";
-
-$form->{vc} = 'vendor';
-$form->{ARAP} = 'AP';
-
-1;
-# end of main
+#!/usr/bin/perl
+require "bin/mozilla/ap.pl";
diff --git a/bin/lynx/ar.pl b/bin/lynx/ar.pl
index 46719f2f..562117c9 100755
--- a/bin/lynx/ar.pl
+++ b/bin/lynx/ar.pl
@@ -1,58 +1,3 @@
-#=====================================================================
-# LedgerSMB Small Medium Business Accounting
-
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
-# under the GNU General Public License version 2 or, at your option, any later
-# version. For a full list including contact information of contributors,
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (c) 2000
-#
-# Author: DWS Systems Inc.
-# Web: http://www.sql-ledger.org
-#
-# Contributors:
-#
-#
-# Author: DWS Systems Inc.
-# Web: http://sourceforge.net/projects/ledger-smb/
-#
-# Contributors:
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#======================================================================
-#
-# Accounts Receivable
-#
-#======================================================================
-
-use SL::PE;
-use SL::IS;
-
-require "$form->{path}/arap.pl";
-require "$form->{path}/arapprn.pl";
-require "$form->{path}/aa.pl";
-
-$form->{vc} = 'customer';
-$form->{ARAP} = 'AR';
-
-1;
-# end of main
+#!/usr/bin/perl
+require "bin/mozilla/ar.pl";
diff --git a/bin/lynx/arap.pl b/bin/lynx/arap.pl
index 89d16654..a3d4feed 100755
--- a/bin/lynx/arap.pl
+++ b/bin/lynx/arap.pl
@@ -1,935 +1,3 @@
-#=====================================================================
-# LedgerSMB Small Medium Business Accounting
-
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
-# under the GNU General Public License version 2 or, at your option, any later
-# version. For a full list including contact information of contributors,
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (c) 2003
-#
-# Author: DWS Systems Inc.
-# Web: http://www.sql-ledger.org
-#
-#
-#
-# Author: DWS Systems Inc.
-# Web: http://sourceforge.net/projects/ledger-smb/
-#
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#======================================================================
-#
-# common routines for gl, ar, ap, is, ir, oe
-#
-
-use SL::AA;
-
-# any custom scripts for this one
-if (-f "$form->{path}/custom_arap.pl") {
- eval { require "$form->{path}/custom_arap.pl"; };
-}
-if (-f "$form->{path}/$form->{login}_arap.pl") {
- eval { require "$form->{path}/$form->{login}_arap.pl"; };
-}
-
-
-1;
-# end of main
-
-
-sub check_name {
- my ($name) = @_;
-
- my ($new_name, $new_id) = split /--/, $form->{$name};
- my $rv = 0;
-
- # if we use a selection
- if ($form->{"select$name"}) {
- if ($form->{"old$name"} ne $form->{$name}) {
- # this is needed for is, ir and oe
- for (split / /, $form->{taxaccounts}) { delete $form->{"${_}_rate"} }
-
- # for credit calculations
- $form->{oldinvtotal} = 0;
- $form->{oldtotalpaid} = 0;
- $form->{calctax} = 1;
-
- $form->{"${name}_id"} = $new_id;
- AA->get_name(\%myconfig, \%$form);
-
- $form->{$name} = $form->{"old$name"} = "$new_name--$new_id";
- $form->{currency} =~ s/ //g;
-
- # put employee together if there is a new employee_id
- $form->{employee} = "$form->{employee}--$form->{employee_id}" if $form->{employee_id};
-
- $rv = 1;
- }
- } else {
-
- # check name, combine name and id
- if ($form->{"old$name"} ne qq|$form->{$name}--$form->{"${name}_id"}|) {
- # this is needed for is, ir and oe
- for (split / /, $form->{taxaccounts}) { delete $form->{"${_}_rate"} }
-
- # for credit calculations
- $form->{oldinvtotal} = 0;
- $form->{oldtotalpaid} = 0;
- $form->{calctax} = 1;
-
- # return one name or a list of names in $form->{name_list}
- if (($rv = $form->get_name(\%myconfig, $name, $form->{transdate})) > 1) {
- &select_name($name);
- exit;
- }
-
- if ($rv == 1) {
- # we got one name
- $form->{"${name}_id"} = $form->{name_list}[0]->{id};
- $form->{$name} = $form->{name_list}[0]->{name};
- $form->{"old$name"} = qq|$form->{$name}--$form->{"${name}_id"}|;
-
- AA->get_name(\%myconfig, \%$form);
-
- $form->{currency} =~ s/ //g;
- # put employee together if there is a new employee_id
- $form->{employee} = "$form->{employee}--$form->{employee_id}" if $form->{employee_id};
-
- } else {
- # name is not on file
- $msg = ucfirst $name . " not on file!";
- $form->error($locale->text($msg));
- }
- }
- }
-
- $rv;
-
-}
-
-# $locale->text('Customer not on file!')
-# $locale->text('Vendor not on file!')
-
-
-sub select_name {
- my ($table) = @_;
-
- @column_index = qw(ndx name address);
-
- $label = ucfirst $table;
- $column_data{ndx} = qq|<th>&nbsp;</th>|;
- $column_data{name} = qq|<th class=listheading>|.$locale->text($label).qq|</th>|;
- $column_data{address} = qq|<th class=listheading colspan=5>|.$locale->text('Address').qq|</th>|;
-
- # list items with radio button on a form
- $form->header;
-
- $title = $locale->text('Select from one of the names below');
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr>
- <th class=listtop>$title</th>
- </tr>
- <tr space=5></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- print qq|
- </tr>
-|;
-
- @column_index = qw(ndx name address city state zipcode country);
-
- my $i = 0;
- foreach $ref (@{ $form->{name_list} }) {
- $checked = ($i++) ? "" : "checked";
-
- $ref->{name} = $form->quote($ref->{name});
-
- $column_data{ndx} = qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
- $column_data{name} = qq|<td><input name="new_name_$i" type=hidden value="$ref->{name}">$ref->{name}</td>|;
- $column_data{address} = qq|<td>$ref->{address1} $ref->{address2}</td>|;
- for (qw(city state zipcode country)) { $column_data{$_} = qq|<td>$ref->{$_}&nbsp;</td>| }
-
- $j++; $j %= 2;
- print qq|
- <tr class=listrow$j>|;
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- print qq|
- </tr>
-
-<input name="new_id_$i" type=hidden value=$ref->{id}>
-
-|;
-
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input name=lastndx type=hidden value=$i>
-
-|;
-
- # delete variables
- for (qw(nextsub name_list)) { delete $form->{$_} }
-
- $form->{action} = "name_selected";
-
- $form->hide_form;
-
- print qq|
-<input type=hidden name=nextsub value=name_selected>
-<input type=hidden name=vc value=$table>
-<br>
-<input class=submit type=submit name=action value="|.$locale->text('Continue').qq|">
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-
-sub name_selected {
-
- # replace the variable with the one checked
-
- # index for new item
- $i = $form->{ndx};
-
- $form->{$form->{vc}} = $form->{"new_name_$i"};
- $form->{"$form->{vc}_id"} = $form->{"new_id_$i"};
- $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
-
- # delete all the new_ variables
- for $i (1 .. $form->{lastndx}) {
- for (qw(id, name)) { delete $form->{"new_${_}_$i"} }
- }
-
- for (qw(ndx lastndx nextsub)) { delete $form->{$_} }
-
- AA->get_name(\%myconfig, \%$form);
-
- # put employee together if there is a new employee_id
- $form->{employee} = "$form->{employee}--$form->{employee_id}" if $form->{employee_id};
-
- &update(1);
-
-}
-
-
-sub rebuild_vc {
- my ($vc, $ARAP, $transdate, $job) = @_;
-
- ($null, $form->{employee_id}) = split /--/, $form->{employee};
- $form->all_vc(\%myconfig, $vc, $ARAP, undef, $transdate, $job);
- $form->{"select$vc"} = "";
- for (@{ $form->{"all_$vc"} }) { $form->{"select$vc"} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
-
- $form->{selectprojectnumber} = "";
- if (@{ $form->{all_project} }) {
- $form->{selectprojectnumber} = "<option>\n";
- for (@{ $form->{all_project} }) { $form->{selectprojectnumber} .= qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n| }
- }
-
- 1;
-}
-
-
-
-sub add_transaction {
- my ($module) = @_;
-
- delete $form->{script};
- $form->{action} = "add";
- $form->{type} = "invoice" if $module =~ /(is|ir)/;
-
- $form->{callback} = $form->escape($form->{callback},1);
- $argv = "";
- for (keys %$form) { $argv .= "$_=$form->{$_}&" }
-
- $form->{callback} = "$module.pl?$argv";
-
- $form->redirect;
-
-}
-
-
-
-sub check_project {
-
- for $i (1 .. $form->{rowcount}) {
- $form->{"project_id_$i"} = "" unless $form->{"projectnumber_$i"};
- if ($form->{"projectnumber_$i"} ne $form->{"oldprojectnumber_$i"}) {
- if ($form->{"projectnumber_$i"}) {
- # get new project
- $form->{projectnumber} = $form->{"projectnumber_$i"};
- if (($rows = PE->projects(\%myconfig, $form)) > 1) {
- # check form->{project_list} how many there are
- $form->{rownumber} = $i;
- &select_project;
- exit;
- }
-
- if ($rows == 1) {
- $form->{"project_id_$i"} = $form->{project_list}->[0]->{id};
- $form->{"projectnumber_$i"} = $form->{project_list}->[0]->{projectnumber};
- $form->{"oldprojectnumber_$i"} = $form->{project_list}->[0]->{projectnumber};
- } else {
- # not on file
- $form->error($locale->text('Project not on file!'));
- }
- } else {
- $form->{"oldprojectnumber_$i"} = "";
- }
- }
- }
-
-}
-
-
-sub select_project {
-
- @column_index = qw(ndx projectnumber description);
-
- $column_data{ndx} = qq|<th>&nbsp;</th>|;
- $column_data{projectnumber} = qq|<th>|.$locale->text('Number').qq|</th>|;
- $column_data{description} = qq|<th>|.$locale->text('Description').qq|</th>|;
-
- # list items with radio button on a form
- $form->header;
-
- $title = $locale->text('Select from one of the projects below');
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=rownumber value=$form->{rownumber}>
-
-<table width=100%>
- <tr>
- <th class=listtop>$title</th>
- </tr>
- <tr space=5></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- print qq|
- </tr>
-|;
-
- my $i = 0;
- foreach $ref (@{ $form->{project_list} }) {
- $checked = ($i++) ? "" : "checked";
-
- $ref->{name} = $form->quote($ref->{name});
-
- $column_data{ndx} = qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
- $column_data{projectnumber} = qq|<td><input name="new_projectnumber_$i" type=hidden value="$ref->{projectnumber}">$ref->{projectnumber}</td>|;
- $column_data{description} = qq|<td>$ref->{description}</td>|;
-
- $j++; $j %= 2;
- print qq|
- <tr class=listrow$j>|;
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- print qq|
- </tr>
-
-<input name="new_id_$i" type=hidden value=$ref->{id}>
-
-|;
-
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input name=lastndx type=hidden value=$i>
-
-|;
-
- # delete list variable
- for (qw(nextsub project_list)) { delete $form->{$_} }
-
- $form->{action} = "project_selected";
-
- $form->hide_form;
-
- print qq|
-<input type=hidden name=nextsub value=project_selected>
-<br>
-<input class=submit type=submit name=action value="|.$locale->text('Continue').qq|">
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub project_selected {
-
- # replace the variable with the one checked
-
- # index for new item
- $i = $form->{ndx};
-
- $form->{"projectnumber_$form->{rownumber}"} = $form->{"new_projectnumber_$i"};
- $form->{"oldprojectnumber_$form->{rownumber}"} = $form->{"new_projectnumber_$i"};
- $form->{"project_id_$form->{rownumber}"} = $form->{"new_id_$i"};
-
- # delete all the new_ variables
- for $i (1 .. $form->{lastndx}) {
- for (qw(id projectnumber description)) { delete $form->{"new_${_}_$i"} }
- }
-
- for (qw(ndx lastndx nextsub)) { delete $form->{$_} }
-
- if ($form->{update}) {
- &{ $form->{update} };
- } else {
- &update;
- }
-
-}
-
-
-sub post_as_new {
-
- for (qw(id printed emailed queued)) { delete $form->{$_} }
- &post;
-
-}
-
-
-sub print_and_post_as_new {
-
- for (qw(id printed emailed queued)) { delete $form->{$_} }
- &print_and_post;
-
-}
-
-
-sub repost {
-
- if ($form->{type} =~ /_order/) {
- if ($form->{print_and_save}) {
- $form->{nextsub} = "print_and_save";
- $msg = $locale->text('You are printing and saving an existing order');
- } else {
- $form->{nextsub} = "save";
- $msg = $locale->text('You are saving an existing order');
- }
- } elsif ($form->{type} =~ /_quotation/) {
- if ($form->{print_and_save}) {
- $form->{nextsub} = "print_and_save";
- $msg = $locale->text('You are printing and saving an existing quotation');
- } else {
- $form->{nextsub} = "save";
- $msg = $locale->text('You are saving an existing quotation');
- }
- } else {
- if ($form->{print_and_post}) {
- $form->{nextsub} = "print_and_post";
- $msg = $locale->text('You are printing and posting an existing transaction!');
- } else {
- $form->{nextsub} = "post";
- $msg = $locale->text('You are posting an existing transaction!');
- }
- }
-
- delete $form->{action};
- $form->{repost} = 1;
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
- $form->hide_form;
-
- print qq|
-<h2 class=confirm>|.$locale->text('Warning!').qq|</h2>
-
-<h4>$msg</h4>
-
-<input name=action class=submit type=submit value="|.$locale->text('Continue').qq|">
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub schedule {
-
- ($form->{recurringreference}, $form->{recurringstartdate}, $form->{recurringrepeat}, $form->{recurringunit}, $form->{recurringhowmany}, $form->{recurringpayment}, $form->{recurringprint}, $form->{recurringemail}, $form->{recurringmessage}) = split /,/, $form->{recurring};
-
- $form->{recurringreference} = $form->quote($form->unescape($form->{recurringreference}));
- $form->{recurringmessage} = $form->quote($form->unescape($form->{recurringmessage}));
-
- $form->{recurringstartdate} ||= $form->{transdate};
- $recurringpayment = "checked" if $form->{recurringpayment};
-
- if ($form->{paidaccounts}) {
- $postpayment = qq|
- <tr>
- <th align=right nowrap>|.$locale->text('Include Payment').qq|</th>
- <td><input name=recurringpayment type=checkbox class=checkbox value=1 $recurringpayment></td>
- </tr>
-|;
- }
-
- if ($form->{recurringnextdate}) {
- $nextdate = qq|
- <tr>
- <th align=right nowrap>|.$locale->text('Next Date').qq|</th>
- <td><input name=recurringnextdate size=11 title="($myconfig{'dateformat'})" value=$form->{recurringnextdate}></td>
- </tr>
-|;
- }
-
- @a = split /<option/, $form->unescape($form->{selectformname});
- %formname = ();
-
- for ($i = 1; $i <= $#a; $i++) {
- $a[$i] =~ /"(.*)"/;
- $v = $1;
- $a[$i] =~ />(.*)/;
- $formname{$v} = $1;
- }
- for (qw(check receipt)) { delete $formname{$_} }
-
- $selectformat = $form->unescape($form->{selectformat});
-
- if ($form->{type} !~ /transaction/ && %formname) {
- $email = qq|
- <table>
- <tr>
- <th colspan=2 class=listheading>|.$locale->text('E-mail').qq|</th>
- </tr>
-
- <tr>
- <td>
- <table>
-|;
-
- # formname:format
- @p = split /:/, $form->{recurringemail};
- %p = ();
- for ($i = 0; $i <= $#p; $i += 2) {
- $p{$p[$i]}{format} = $p[$i+1];
- }
-
- foreach $item (keys %formname) {
-
- $checked = ($p{$item}{format}) ? "checked" : "";
- $selectformat =~ s/ selected//;
- $p{$item}{format} ||= "pdf";
- $selectformat =~ s/(<option value="\Q$p{$item}{format}\E")/$1 selected/;
-
- $email .= qq|
- <tr>
- <td><input name="email$item" type=checkbox class=checkbox value=1 $checked></td>
- <th align=left>$formname{$item}</th>
- <td><select name="emailformat$item">$selectformat</select></td>
- </tr>
-|;
- }
-
- $email .= qq|
- </table>
- </td>
- </tr>
- </table>
-|;
-
- $message = qq|
- <table>
- <tr>
- <th class=listheading>|.$locale->text('E-mail message').qq|</th>
- </tr>
-
- <tr>
- <td><textarea name="recurringmessage" rows=10 cols=60 wrap=soft>$form->{recurringmessage}</textarea></td>
- </tr>
- </table>
-|;
-
- }
-
-
- if (%printer && $latex && %formname) {
- $selectprinter = qq|<option>\n|;
- for (sort keys %printer) { $selectprinter .= qq|<option value="$_">$_\n| }
-
- # formname:format:printer
- @p = split /:/, $form->{recurringprint};
-
- %p = ();
- for ($i = 0; $i <= $#p; $i += 3) {
- $p{$p[$i]}{formname} = $p[$i];
- $p{$p[$i]}{format} = $p[$i+1];
- $p{$p[$i]}{printer} = $p[$i+2];
- }
-
- $print = qq|
- <table>
- <tr>
- <th colspan=2 class=listheading>|.$locale->text('Print').qq|</th>
- </tr>
-
- <tr>
- <td>
- <table>
-|;
-
- $selectformat =~ s/<option.*html//;
- foreach $item (keys %formname) {
-
- $selectprinter =~ s/ selected//;
- $selectprinter =~ s/(<option value="\Q$p{$item}{printer}\E")/$1 selected/;
-
- $checked = ($p{$item}{formname}) ? "checked" : "";
-
- $selectformat =~ s/ selected//;
- $p{$item}{format} ||= "postscript";
- $selectformat =~ s/(<option value="\Q$p{$item}{format}\E")/$1 selected/;
-
- $print .= qq|
- <tr>
- <td><input name="print$item" type=checkbox class=checkbox value=1 $checked></td>
- <th align=left>$formname{$item}</th>
- <td><select name="printprinter$item">$selectprinter</select></td>
- <td><select name="printformat$item">$selectformat</select></td>
- </tr>
-|;
- }
-
- $print .= qq|
- </table>
- </td>
- </tr>
- </table>
-|;
-
-
- }
-
- $selectrepeat = "";
- for (1 .. 31) { $selectrepeat .= qq|<option value="$_">$_\n| }
- $selectrepeat =~ s/(<option value="$form->{recurringrepeat}")/$1 selected/;
-
- $selectunit = qq|<option value="days">|.$locale->text('Day(s)').qq|
- <option value="weeks">|.$locale->text('Week(s)').qq|
- <option value="months">|.$locale->text('Month(s)').qq|
- <option value="years">|.$locale->text('Year(s)');
-
- if ($form->{recurringunit}) {
- $selectunit =~ s/(<option value="$form->{recurringunit}")/$1 selected/;
- }
-
- if ($form->{$form->{vc}}) {
- $description = $form->{$form->{vc}};
- } else {
- $description = $form->{description};
- }
-
- $repeat = qq|
- <table>
- <tr>
- <th colspan=3 class=listheading>|.$locale->text('Repeat').qq|</th>
- </tr>
-
- <tr>
- <th align=right nowrap>|.$locale->text('Every').qq|</th>
- <td><select name=recurringrepeat>$selectrepeat</td>
- <td><select name=recurringunit>$selectunit</td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('For').qq|</th>
- <td><input name=recurringhowmany size=3 value=$form->{recurringhowmany}></td>
- <th align=left nowrap>|.$locale->text('time(s)').qq|</th>
- </tr>
- </table>
-|;
-
-
- $title = $locale->text('Recurring Transaction') ." ". $locale->text('for') ." $description";
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr class=listtop>
- <th class=listtop>$title</th>
- </tr>
- <tr space=5></tr>
- <tr>
- <td>
- <table>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right nowrap>|.$locale->text('Reference').qq|</th>
- <td><input name=recurringreference size=20 value="$form->{recurringreference}"></td>
- </tr>
- <tr>
- <th align=right nowrap>|.$locale->text('Startdate').qq|</th>
- <td><input name=recurringstartdate size=11 title="($myconfig{'dateformat'})" value=$form->{recurringstartdate}></td>
- </tr>
- $nextdate
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td>
- <table>
- $postpayment
- </table>
- </td>
- </tr>
-
- <tr>
- <td>
- <table>
- <tr valign=top>
- <td>$repeat</td>
- <td>$print</td>
- </tr>
- <tr valign=top>
- <td>$email</td>
- <td>$message</td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-|;
-
-# type=submit $locale->text('Save Schedule')
-# type=submit $locale->text('Delete Schedule')
-
- %button = ('Save Schedule' => { ndx => 1, key => 'S', value => $locale->text('Save Schedule') },
- 'Delete Schedule' => { ndx => 16, key => 'D', value => $locale->text('Delete Schedule') },
- );
-
- $form->print_button(\%button, 'Save Schedule');
-
- if ($form->{recurring}) {
- $form->print_button(\%button, 'Delete Schedule');
- }
-
- # delete variables
- for (qw(action recurring)) { delete $form->{$_} }
- for (qw(reference startdate nextdate enddate repeat unit howmany payment print email message)) { delete $form->{"recurring$_"} }
-
- $form->hide_form;
-
- print qq|
-
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub save_schedule {
-
- $form->{recurring} = "";
-
- $form->{recurringreference} = $form->escape($form->{recurringreference},1);
- $form->{recurringmessage} = $form->escape($form->{recurringmessage},1);
- if ($form->{recurringstartdate}) {
- for (qw(reference startdate repeat unit howmany payment)) { $form->{recurring} .= qq|$form->{"recurring$_"},| }
- }
-
- @a = split /<option/, $form->unescape($form->{selectformname});
- @p = ();
-
- for ($i = 1; $i <= $#a; $i++) {
- $a[$i] =~ /"(.*)"/;
- push @p, $1;
- }
-
- $recurringemail = "";
- for (@p) { $recurringemail .= qq|$_:$form->{"emailformat$_"}:| if $form->{"email$_"} }
- chop $recurringemail;
-
- $recurringprint = "";
- for (@p) { $recurringprint .= qq|$_:$form->{"printformat$_"}:$form->{"printprinter$_"}:| if $form->{"print$_"} }
- chop $recurringprint;
-
- $form->{recurring} .= qq|$recurringprint,$recurringemail,$form->{recurringmessage}| if $recurringemail || $recurringprint;
-
- $form->save_recurring(undef, \%myconfig) if $form->{id};
-
- if ($form->{recurringid}) {
- $form->redirect;
- } else {
- &update;
- }
-
-}
-
-
-sub delete_schedule {
-
- $form->{recurring} = "";
-
- $form->save_recurring(undef, \%myconfig) if $form->{id};
-
- if ($form->{recurringid}) {
- $form->redirect;
- } else {
- &update;
- }
-
-}
-
-
-sub reprint {
-
- $myconfig{vclimit} = 0;
- $pf = "print_form";
-
- for (qw(format formname media message)) { $temp{$_} = $form->{$_} }
-
- if ($form->{module} eq 'oe') {
- &order_links;
- &prepare_order;
- delete $form->{order_details};
- for (keys %$form) { $form->{$_} = $form->unquote($form->{$_}) }
- } else {
- if ($form->{type} eq 'invoice') {
- &invoice_links;
- &prepare_invoice;
- for (keys %$form) { $form->{$_} = $form->unquote($form->{$_}) }
- } else {
- &create_links;
- $form->{rowcount}--;
- for (1 .. $form->{rowcount}) { $form->{"amount_$_"} = $form->format_amount(\%myconfig, $form->{"amount_$_"}, 2) }
- for (split / /, $form->{taxaccounts}) { $form->{"tax_$_"} = $form->format_amount(\%myconfig, $form->{"tax_$_"}, 2) }
- $pf = "print_transaction";
- }
- for (qw(acc_trans invoice_details)) { delete $form->{$_} }
- }
-
- for (qw(department employee language month partsgroup project years)) { delete $form->{"all_$_"} }
-
- for (keys %temp) { $form->{$_} = $temp{$_} }
-
- $form->{rowcount}++;
- $form->{paidaccounts}++;
-
- delete $form->{paid};
-
- for (1 .. $form->{paidaccounts}) { $form->{"paid_$_"} = $form->format_amount(\%myconfig, $form->{"paid_$_"}, 2) }
-
- $form->{copies} = 1;
-
- &$pf;
-
- if ($form->{media} eq 'email') {
- # add email message
- $now = scalar localtime;
- $cc = $locale->text('Cc').qq|: $form->{cc}\n| if $form->{cc};
- $bcc = $locale->text('Bcc').qq|: $form->{bcc}\n| if $form->{bcc};
-
- $form->{intnotes} .= qq|\n\n| if $form->{intnotes};
- $form->{intnotes} .= qq|[email]\n|
- .$locale->text('Date').qq|: $now\n|
- .$locale->text('To').qq|: $form->{email}\n${cc}${bcc}|
- .$locale->text('Subject').qq|: $form->{subject}\n\n|
- .$locale->text('Message').qq|: |;
-
- $form->{intnotes} .= ($form->{message}) ? $form->{message} : $locale->text('sent');
-
- $form->save_intnotes(\%myconfig, $form->{module});
- }
-
-}
-
-
-sub continue { &{ $form->{nextsub} } };
-sub gl_transaction { &add };
-sub ar_transaction { &add_transaction(ar) };
-sub ap_transaction { &add_transaction(ap) };
-sub sales_invoice_ { &add_transaction(is) };
-sub vendor_invoice_ { &add_transaction(ir) };
+#!/usr/bin/perl
+require "bin/mozilla/arap.pl";
diff --git a/bin/lynx/arapprn.pl b/bin/lynx/arapprn.pl
index a8a98bad..0b923c35 100755
--- a/bin/lynx/arapprn.pl
+++ b/bin/lynx/arapprn.pl
@@ -1,608 +1,3 @@
-#=====================================================================
-# LedgerSMB Small Medium Business Accounting
-
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
-# under the GNU General Public License version 2 or, at your option, any later
-# version. For a full list including contact information of contributors,
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (c) 2003
-#
-# Author: DWS Systems Inc.
-# Web: http://www.sql-ledger.org
-#
-#
-#
-# Author: DWS Systems Inc.
-# Web: http://sourceforge.net/projects/ledger-smb/
-#
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#======================================================================
-#
-#
-# printing routines for ar, ap
-#
-
-# any custom scripts for this one
-if (-f "$form->{path}/custom_arapprn.pl") {
- eval { require "$form->{path}/custom_arapprn.pl"; };
-}
-if (-f "$form->{path}/$form->{login}_arapprn.pl") {
- eval { require "$form->{path}/$form->{login}_arapprn.pl"; };
-}
-
-
-1;
-# end of main
-
-
-sub print {
-
- if ($form->{media} !~ /screen/) {
- $form->error($locale->text('Select postscript or PDF!')) if $form->{format} !~ /(postscript|pdf)/;
- $old_form = new Form;
- for (keys %$form) { $old_form->{$_} = $form->{$_} }
- }
-
- if ($form->{formname} =~ /(check|receipt)/) {
- if ($form->{media} eq 'screen') {
- $form->error($locale->text('Select postscript or PDF!')) if $form->{format} !~ /(postscript|pdf)/;
- }
- }
-
- if (! $form->{invnumber}) {
- $invfld = 'sinumber';
- $invfld = 'vinumber' if $form->{ARAP} eq 'AP';
- $form->{invnumber} = $form->update_defaults(\%myconfig, $invfld);
- if ($form->{media} eq 'screen') {
- if ($form->{media} eq 'screen') {
- &update;
- exit;
- }
- }
- }
-
- if ($form->{formname} =~ /(check|receipt)/) {
- if ($form->{media} ne 'screen') {
- for (qw(action header)) { delete $form->{$_} }
- $form->{invtotal} = $form->{oldinvtotal};
-
- foreach $key (keys %$form) {
- $form->{$key} =~ s/&/%26/g;
- $form->{previousform} .= qq|$key=$form->{$key}&|;
- }
- chop $form->{previousform};
- $form->{previousform} = $form->escape($form->{previousform}, 1);
- }
-
- if ($form->{paidaccounts} > 1) {
- if ($form->{"paid_$form->{paidaccounts}"}) {
- &update;
- exit;
- } elsif ($form->{paidaccounts} > 2) {
- # select payment
- &select_payment;
- exit;
- }
- } else {
- $form->error($locale->text('Nothing to print!'));
- }
-
- }
-
- &{ "print_$form->{formname}" }($old_form, 1);
-
-}
-
-
-sub print_check {
- my ($old_form, $i) = @_;
-
- $display_form = ($form->{display_form}) ? $form->{display_form} : "display_form";
-
- if ($form->{"paid_$i"}) {
- @a = ();
-
- if (exists $form->{longformat}) {
- $form->{"datepaid_$i"} = $locale->date(\%myconfig, $form->{"datepaid_$i"}, $form->{longformat});
- }
-
- push @a, "source_$i", "memo_$i";
- $form->format_string(@a);
- }
-
- $form->{amount} = $form->{"paid_$i"};
-
- if (($form->{formname} eq 'check' && $form->{vc} eq 'customer') ||
- ($form->{formname} eq 'receipt' && $form->{vc} eq 'vendor')) {
- $form->{amount} =~ s/-//g;
- }
-
- for (qw(datepaid source memo)) { $form->{$_} = $form->{"${_}_$i"} }
-
- &{ "$form->{vc}_details" };
- @a = qw(name address1 address2 city state zipcode country);
-
- foreach $item (qw(invnumber ordnumber)) {
- $temp{$item} = $form->{$item};
- delete $form->{$item};
- push(@{ $form->{$item} }, $temp{$item});
- }
- push(@{ $form->{invdate} }, $form->{transdate});
- push(@{ $form->{due} }, $form->format_amount(\%myconfig, $form->{oldinvtotal}, 2));
- push(@{ $form->{paid} }, $form->{"paid_$i"});
-
- use SL::CP;
- $c = CP->new(($form->{language_code}) ? $form->{language_code} : $myconfig{countrycode});
- $c->init;
- ($whole, $form->{decimal}) = split /\./, $form->parse_amount(\%myconfig, $form->{amount});
-
- $form->{decimal} .= "00";
- $form->{decimal} = substr($form->{decimal}, 0, 2);
- $form->{text_decimal} = $c->num2text($form->{decimal} * 1);
- $form->{text_amount} = $c->num2text($whole);
- $form->{integer_amount} = $form->format_amount($myconfig, $whole);
-
- ($form->{employee}) = split /--/, $form->{employee};
-
- $form->{notes} =~ s/^\s+//g;
- push @a, "notes";
-
- for (qw(company address tel fax businessnumber)) { $form->{$_} = $myconfig{$_} }
- $form->{address} =~ s/\\n/\n/g;
-
- push @a, qw(company address tel fax businessnumber text_amount text_decimal);
-
- $form->format_string(@a);
-
- $form->{templates} = "$myconfig{templates}";
- $form->{IN} = ($form->{formname} eq 'transaction') ? lc $form->{ARAP} . "_$form->{formname}.html" : "$form->{formname}.html";
-
- if ($form->{format} =~ /(postscript|pdf)/) {
- $form->{IN} =~ s/html$/tex/;
- }
-
- if ($form->{media} !~ /(screen)/) {
- $form->{OUT} = "| $printer{$form->{media}}";
-
- if ($form->{printed} !~ /$form->{formname}/) {
-
- $form->{printed} .= " $form->{formname}";
- $form->{printed} =~ s/^ //;
-
- $form->update_status(\%myconfig);
- }
-
- %audittrail = ( tablename => lc $form->{ARAP},
- reference => $form->{invnumber},
- formname => $form->{formname},
- action => 'printed',
- id => $form->{id} );
-
- %status = ();
- for (qw(printed audittrail)) { $status{$_} = $form->{$_} }
-
- $status{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
-
- }
-
- $form->{fileid} = $invnumber;
- $form->{fileid} =~ s/(\s|\W)+//g;
-
- $form->parse_template(\%myconfig, $userspath);
-
- if ($form->{previousform}) {
-
- $previousform = $form->unescape($form->{previousform});
-
- for (keys %$form) { delete $form->{$_} }
-
- foreach $item (split /&/, $previousform) {
- ($key, $value) = split /=/, $item, 2;
- $value =~ s/%26/&/g;
- $form->{$key} = $value;
- }
-
- for (qw(exchangerate creditlimit creditremaining)) { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
-
- for (1 .. $form->{rowcount}) { $form->{"amount_$_"} = $form->parse_amount(\%myconfig, $form->{"amount_$_"}) }
- for (split / /, $form->{taxaccounts}) { $form->{"tax_$_"} = $form->parse_amount(\%myconfig, $form->{"tax_$_"}) }
-
- for $i (1 .. $form->{paidaccounts}) {
- for (qw(paid exchangerate)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
- }
-
- for (qw(printed audittrail)) { $form->{$_} = $status{$_} }
-
- &{ "$display_form" };
-
- }
-
-}
-
-
-sub print_receipt {
- my ($old_form, $i) = @_;
-
- &print_check($old_form, $i);
-
-}
-
-
-sub print_transaction {
- my ($old_form) = @_;
-
- $display_form = ($form->{display_form}) ? $form->{display_form} : "display_form";
-
-
- &{ "$form->{vc}_details" };
- @a = qw(name address1 address2 city state zipcode country);
-
-
- $form->{invtotal} = 0;
- foreach $i (1 .. $form->{rowcount} - 1) {
- ($form->{tempaccno}, $form->{tempaccount}) = split /--/, $form->{"$form->{ARAP}_amount_$i"};
- ($form->{tempprojectnumber}) = split /--/, $form->{"projectnumber_$i"};
- $form->{tempdescription} = $form->{"description_$i"};
-
- $form->format_string(qw(tempaccno tempaccount tempprojectnumber tempdescription));
-
- push(@{ $form->{accno} }, $form->{tempaccno});
- push(@{ $form->{account} }, $form->{tempaccount});
- push(@{ $form->{description} }, $form->{tempdescription});
- push(@{ $form->{projectnumber} }, $form->{tempprojectnumber});
-
- push(@{ $form->{amount} }, $form->{"amount_$i"});
-
- $form->{subtotal} += $form->parse_amount(\%myconfig, $form->{"amount_$i"});
-
- }
-
- foreach $accno (split / /, $form->{taxaccounts}) {
- if ($form->{"tax_$accno"}) {
- $form->format_string("${accno}_description");
-
- $tax += $form->parse_amount(\%myconfig, $form->{"tax_$accno"});
-
- $form->{"${accno}_tax"} = $form->{"tax_$accno"};
- push(@{ $form->{tax} }, $form->{"tax_$accno"});
-
- push(@{ $form->{taxdescription} }, $form->{"${accno}_description"});
-
- $form->{"${accno}_taxrate"} = $form->format_amount($myconfig, $form->{"${accno}_rate"} * 100);
- push(@{ $form->{taxrate} }, $form->{"${accno}_taxrate"});
-
- push(@{ $form->{taxnumber} }, $form->{"${accno}_taxnumber"});
- }
- }
-
- $tax = 0 if $form->{taxincluded};
-
- push @a, $form->{ARAP};
- $form->format_string(@a);
-
- $form->{paid} = 0;
- for $i (1 .. $form->{paidaccounts} - 1) {
-
- if ($form->{"paid_$i"}) {
- @a = ();
- $form->{paid} += $form->parse_amount(\%myconfig, $form->{"paid_$i"});
-
- if (exists $form->{longformat}) {
- $form->{"datepaid_$i"} = $locale->date(\%myconfig, $form->{"datepaid_$i"}, $form->{longformat});
- }
-
- push @a, "$form->{ARAP}_paid_$i", "source_$i", "memo_$i";
- $form->format_string(@a);
-
- ($accno, $account) = split /--/, $form->{"$form->{ARAP}_paid_$i"};
-
- push(@{ $form->{payment} }, $form->{"paid_$i"});
- push(@{ $form->{paymentdate} }, $form->{"datepaid_$i"});
- push(@{ $form->{paymentaccount} }, $account);
- push(@{ $form->{paymentsource} }, $form->{"source_$i"});
- push(@{ $form->{paymentmemo} }, $form->{"memo_$i"});
- }
-
- }
-
- $form->{invtotal} = $form->{subtotal} + $tax;
- $form->{total} = $form->{invtotal} - $form->{paid};
-
- use SL::CP;
- $c = CP->new(($form->{language_code}) ? $form->{language_code} : $myconfig{countrycode});
- $c->init;
- ($whole, $form->{decimal}) = split /\./, $form->{invtotal};
-
- $form->{decimal} .= "00";
- $form->{decimal} = substr($form->{decimal}, 0, 2);
- $form->{text_decimal} = $c->num2text($form->{decimal} * 1);
- $form->{text_amount} = $c->num2text($whole);
- $form->{integer_amount} = $form->format_amount($myconfig, $whole);
-
- for (qw(invtotal subtotal paid total)) { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 2) }
-
- ($form->{employee}) = split /--/, $form->{employee};
-
- if (exists $form->{longformat}) {
- for (qw(duedate transdate)) { $form->{$_} = $locale->date(\%myconfig, $form->{$_}, $form->{longformat}) }
- }
-
- $form->{notes} =~ s/^\s+//g;
-
- @a = ("invnumber", "transdate", "duedate", "notes");
-
- for (qw(company address tel fax businessnumber)) { $form->{$_} = $myconfig{$_} }
- $form->{address} =~ s/\\n/\n/g;
-
- push @a, qw(company address tel fax businessnumber text_amount text_decimal);
-
- $form->format_string(@a);
-
- $form->{invdate} = $form->{transdate};
-
- $form->{templates} = "$myconfig{templates}";
- $form->{IN} = ($form->{formname} eq 'transaction') ? lc $form->{ARAP} . "_$form->{formname}.html" : "$form->{formname}.html";
-
- if ($form->{format} =~ /(postscript|pdf)/) {
- $form->{IN} =~ s/html$/tex/;
- }
-
- if ($form->{media} !~ /(screen)/) {
- $form->{OUT} = "| $printer{$form->{media}}";
-
- if ($form->{printed} !~ /$form->{formname}/) {
-
- $form->{printed} .= " $form->{formname}";
- $form->{printed} =~ s/^ //;
-
- $form->update_status(\%myconfig);
- }
-
- $old_form->{printed} = $form->{printed} if %$old_form;
-
- %audittrail = ( tablename => lc $form->{ARAP},
- reference => $form->{"invnumber"},
- formname => $form->{formname},
- action => 'printed',
- id => $form->{id} );
-
- $old_form->{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail) if %$old_form;
-
- }
-
- $form->{fileid} = $form->{invnumber};
- $form->{fileid} =~ s/(\s|\W)+//g;
-
- $form->parse_template(\%myconfig, $userspath);
-
- if (%$old_form) {
- $old_form->{invnumber} = $form->{invnumber};
- $old_form->{invtotal} = $form->{invtotal};
-
- for (keys %$form) { delete $form->{$_} }
- for (keys %$old_form) { $form->{$_} = $old_form->{$_} }
-
- if (! $form->{printandpost}) {
- for (qw(exchangerate creditlimit creditremaining)) { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
-
- for (1 .. $form->{rowcount}) { $form->{"amount_$_"} = $form->parse_amount(\%myconfig, $form->{"amount_$_"}) }
- for (split / /, $form->{taxaccounts}) { $form->{"tax_$_"} = $form->parse_amount(\%myconfig, $form->{"tax_$_"}) }
-
- for $i (1 .. $form->{paidaccounts}) {
- for (qw(paid exchangerate)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
- }
- }
-
- &{ "$display_form" };
-
- }
-
-}
-
-
-sub vendor_details { IR->vendor_details(\%myconfig, \%$form) };
-sub customer_details { IS->customer_details(\%myconfig, \%$form) };
-
-
-sub select_payment {
-
- @column_index = ("ndx", "datepaid", "source", "memo", "paid", "$form->{ARAP}_paid");
-
- # list payments with radio button on a form
- $form->header;
-
- $title = $locale->text('Select payment');
-
- $column_data{ndx} = qq|<th width=1%>&nbsp;</th>|;
- $column_data{datepaid} = qq|<th>|.$locale->text('Date').qq|</th>|;
- $column_data{source} = qq|<th>|.$locale->text('Source').qq|</th>|;
- $column_data{memo} = qq|<th>|.$locale->text('Memo').qq|</th>|;
- $column_data{paid} = qq|<th>|.$locale->text('Amount').qq|</th>|;
- $column_data{"$form->{ARAP}_paid"} = qq|<th>|.$locale->text('Account').qq|</th>|;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr>
- <th class=listtop>$title</th>
- </tr>
- <tr space=5></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>|;
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- print qq|
- </tr>
-|;
-
- $checked = "checked";
- foreach $i (1 .. $form->{paidaccounts} - 1) {
-
- for (@column_index) { $column_data{$_} = qq|<td>$form->{"${_}_$i"}</td>| }
-
- $paid = $form->{"paid_$i"};
- $ok = 1;
-
- $column_data{ndx} = qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
- $column_data{paid} = qq|<td align=right>$paid</td>|;
-
- $checked = "";
-
- $j++; $j %= 2;
- print qq|
- <tr class=listrow$j>|;
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- print qq|
- </tr>
-|;
-
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- for (qw(action nextsub)) { delete $form->{$_} }
-
- $form->hide_form;
-
- print qq|
-
-<br>
-<input type=hidden name=nextsub value=payment_selected>
-|;
-
- if ($ok) {
- print qq|
-<input class=submit type=submit name=action value="|.$locale->text('Continue').qq|">|;
- }
-
- print qq|
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-sub payment_selected {
-
- &{ "print_$form->{formname}" }($form->{oldform}, $form->{ndx});
-
-}
-
-
-sub print_options {
-
- if ($form->{selectlanguage}) {
- $form->{"selectlanguage"} = $form->unescape($form->{"selectlanguage"});
- $form->{"selectlanguage"} =~ s/ selected//;
- $form->{"selectlanguage"} =~ s/(<option value="\Q$form->{language_code}\E")/$1 selected/;
- $lang = qq|<select name=language_code>$form->{selectlanguage}</select>
- <input type=hidden name=selectlanguage value="|.
- $form->escape($form->{selectlanguage},1).qq|">|;
- }
-
- $form->{selectformname} = $form->unescape($form->{selectformname});
- $form->{selectformname} =~ s/ selected//;
- $form->{selectformname} =~ s/(<option value="\Q$form->{formname}\E")/$1 selected/;
-
- $type = qq|<select name=formname>$form->{selectformname}</select>
- <input type=hidden name=selectformname value="|.$form->escape($form->{selectformname},1).qq|">|;
-
- $media = qq|<select name=media>
- <option value="screen">|.$locale->text('Screen');
-
- $form->{selectformat} = qq|<option value="html">html\n|;
-
- if (%printer && $latex) {
- for (sort keys %printer) { $media .= qq|
- <option value="$_">$_| }
- }
-
- if ($latex) {
- $form->{selectformat} .= qq|
- <option value="postscript">|.$locale->text('Postscript').qq|
- <option value="pdf">|.$locale->text('PDF');
- }
-
- $format = qq|<select name=format>$form->{selectformat}</select>|;
- $format =~ s/(<option value="\Q$form->{format}\E")/$1 selected/;
- $format .= qq|
- <input type=hidden name=selectformat value="|.$form->escape($form->{selectformat},1).qq|">|;
- $media .= qq|</select>|;
- $media =~ s/(<option value="\Q$form->{media}\E")/$1 selected/;
-
- print qq|
- <table width=100%>
- <tr>
- <td>$type</td>
- <td>$lang</td>
- <td>$format</td>
- <td>$media</td>
- <td align=right width=90%>
- |;
-
- if ($form->{printed} =~ /$form->{formname}/) {
- print $locale->text('Printed').qq|<br>|;
- }
-
- if ($form->{recurring}) {
- print $locale->text('Scheduled');
- }
-
- print qq|
- </td>
- </tr>
- </table>
-|;
-
-}
-
-
-sub print_and_post {
-
- $form->error($locale->text('Select postscript or PDF!')) if $form->{format} !~ /(postscript|pdf)/;
- $form->error($locale->text('Select a Printer!')) if $form->{media} eq 'screen';
-
- $form->{printandpost} = 1;
- $form->{display_form} = "post";
- &print;
-
-}
-
+#!/usr/bin/perl
+require "bin/mozilla/arapprn.pl";
diff --git a/bin/lynx/bp.pl b/bin/lynx/bp.pl
index 7606cb23..fd88560b 100755
--- a/bin/lynx/bp.pl
+++ b/bin/lynx/bp.pl
@@ -1,548 +1,3 @@
-#=====================================================================
-# LedgerSMB Small Medium Business Accounting
-
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
-# under the GNU General Public License version 2 or, at your option, any later
-# version. For a full list including contact information of contributors,
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (c) 2003
-#
-# Author: DWS Systems Inc.
-# Web: http://www.sql-ledger.org
-#
-#
-#
-# Author: DWS Systems Inc.
-# Web: http://sourceforge.net/projects/ledger-smb/
-#
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#======================================================================
-#
-# Batch printing
-#
-#======================================================================
-
-
-use SL::BP;
-
-1;
-# end of main
-
-
-sub search {
-
-# $locale->text('Sales Invoices')
-# $locale->text('Packing Lists')
-# $locale->text('Pick Lists')
-# $locale->text('Sales Orders')
-# $locale->text('Work Orders')
-# $locale->text('Purchase Orders')
-# $locale->text('Bin Lists')
-# $locale->text('Quotations')
-# $locale->text('RFQs')
-# $locale->text('Time Cards')
-
- # setup customer/vendor selection
- BP->get_vc(\%myconfig, \%$form);
-
- if (@{ $form->{"all_$form->{vc}"} }) {
- $name = "<option>\n";
- for (@{ $form->{"all_$form->{vc}"} }) { $name .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
- $name = qq|<select name=$form->{vc}>$name</select>|;
- } else {
- $name = qq|<input name=$form->{vc} size=35>|;
- }
-
-# $locale->text('Customer')
-# $locale->text('Vendor')
-# $locale->text('Employee')
-
- %label = ( invoice => { title => 'Sales Invoices', name => 'Customer' },
- packing_list => { title => 'Packing Lists', name => 'Customer' },
- pick_list => { title => 'Pick Lists', name => 'Customer' },
- sales_order => { title => 'Sales Orders', name => 'Customer' },
- work_order => { title => 'Work Orders', name => 'Customer' },
- purchase_order => { title => 'Purchase Orders', name => 'Vendor' },
- bin_list => { title => 'Bin Lists', name => 'Vendor' },
- sales_quotation => { title => 'Quotations', name => 'Customer' },
- request_quotation => { title => 'RFQs', name => 'Vendor' },
- timecard => { title => 'Time Cards', name => 'Employee' },
- );
-
- $label{invoice}{invnumber} = qq|
- <tr>
- <th align=right nowrap>|.$locale->text('Invoice Number').qq|</th>
- <td colspan=3><input name=invnumber size=20></td>
- </tr>
-|;
- $label{invoice}{ordnumber} = qq|
- <tr>
- <th align=right nowrap>|.$locale->text('Order Number').qq|</th>
- <td colspan=3><input name=ordnumber size=20></td>
- </tr>
-|;
- $label{sales_quotation}{quonumber} = qq|
- <tr>
- <th align=right nowrap>|.$locale->text('Quotation Number').qq|</th>
- <td colspan=3><input name=quonumber size=20></td>
- </tr>
-|;
-
- $label{packing_list}{invnumber} = $label{invoice}{invnumber};
- $label{packing_list}{ordnumber} = $label{invoice}{ordnumber};
- $label{pick_list}{invnumber} = $label{invoice}{invnumber};
- $label{pick_list}{ordnumber} = $label{invoice}{ordnumber};
- $label{sales_order}{ordnumber} = $label{invoice}{ordnumber};
- $label{work_order}{ordnumber} = $label{invoice}{ordnumber};
- $label{purchase_order}{ordnumber} = $label{invoice}{ordnumber};
- $label{bin_list}{ordnumber} = $label{invoice}{ordnumber};
- $label{request_quotation}{quonumber} = $label{sales_quotation}{quonumber};
-
- # do one call to text
- $form->{title} = $locale->text('Print')." ".$locale->text($label{$form->{type}}{title});
-
- # accounting years
- if (@{ $form->{all_years} }) {
- # accounting years
- $form->{selectaccountingyear} = "<option>\n";
- for (@{ $form->{all_years} }) { $form->{selectaccountingyear} .= qq|<option>$_\n| }
- $form->{selectaccountingmonth} = "<option>\n";
- for (sort keys %{ $form->{all_month} }) { $form->{selectaccountingmonth} .= qq|<option value=$_>|.$locale->text($form->{all_month}{$_}).qq|\n| }
-
- $selectfrom = qq|
- <tr>
- <th align=right>|.$locale->text('Period').qq|</th>
- <td colspan=3>
- <select name=month>$form->{selectaccountingmonth}</select>
- <select name=year>$form->{selectaccountingyear}</select>
- <input name=interval class=radio type=radio value=0 checked>&nbsp;|.$locale->text('Current').qq|
- <input name=interval class=radio type=radio value=1>&nbsp;|.$locale->text('Month').qq|
- <input name=interval class=radio type=radio value=3>&nbsp;|.$locale->text('Quarter').qq|
- <input name=interval class=radio type=radio value=12>&nbsp;|.$locale->text('Year').qq|
- </td>
- </tr>
-|;
- }
-
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
- $form->hide_form(qw(vc type title));
-
- print qq|
-<table width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right>|.$locale->text($label{$form->{type}}{name}).qq|</th>
- <td colspan=3>$name</td>
- </tr>
- $account
- $label{$form->{type}}{invnumber}
- $label{$form->{type}}{ordnumber}
- $label{$form->{type}}{quonumber}
- <tr>
- <th align=right nowrap>|.$locale->text('From').qq|</th>
- <td><input name=transdatefrom size=11 title="$myconfig{dateformat}"></td>
- <th align=right>|.$locale->text('To').qq|</th>
- <td><input name=transdateto size=11 title="$myconfig{dateformat}"></td>
- </tr>
- $selectfrom
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<input type=hidden name=sort value=transdate>
-<input type=hidden name=nextsub value=list_spool>
-
-<br>
-<input class=submit type=submit name=action value="|.$locale->text('Continue').qq|">
-|;
-
- $form->hide_form(qw(path login sessionid));
-
- print qq|
-
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-
-sub remove {
-
- $selected = 0;
-
- for $i (1 .. $form->{rowcount}) {
- if ($form->{"checked_$i"}) {
- $selected = 1;
- last;
- }
- }
-
- $form->error('Nothing selected!') unless $selected;
-
- $form->{title} = $locale->text('Confirm!');
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
- for (qw(action header)) { delete $form->{$_} }
-
- foreach $key (keys %$form) {
- print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
- }
-
- print qq|
-<h2 class=confirm>$form->{title}</h2>
-
-<h4>|.$locale->text('Are you sure you want to remove the marked entries from the queue?').qq|</h4>
-
-<input name=action class=submit type=submit value="|.$locale->text('Yes').qq|">
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-
-sub yes {
-
- $form->info($locale->text('Removing marked entries from queue ...'));
- $form->{callback} .= "&header=1" if $form->{callback};
-
- if (BP->delete_spool(\%myconfig, \%$form, $spool)) {
- $form->redirect($locale->text('Removed spoolfiles!'));
- } else {
- $form->error($locale->text('Cannot remove files!'));
- }
-
-}
-
-
-sub print {
-
- if ($form->{callback}) {
- for (1 .. $form->{rowcount}) { $form->{callback} .= "&checked_$_=1" if $form->{"checked_$_"} }
- $form->{callback} .= "&header=1";
- }
-
- for $i (1 .. $form->{rowcount}) {
- if ($form->{"checked_$i"}) {
- $form->{OUT} = "| $printer{$form->{media}}";
- $form->info($locale->text('Printing')." ...");
-
- if (BP->print_spool(\%myconfig, \%$form, $spool)) {
- print $locale->text('done');
- $form->redirect($locale->text('Marked entries printed!'));
- }
- exit;
- }
- }
-
- $form->error('Nothing selected!');
-
-}
-
-
-sub list_spool {
-
- $form->{$form->{vc}} = $form->unescape($form->{$form->{vc}});
- ($form->{$form->{vc}}, $form->{"$form->{vc}_id"}) = split(/--/, $form->{$form->{vc}});
-
- BP->get_spoolfiles(\%myconfig, \%$form);
-
- $title = $form->escape($form->{title});
- $href = "$form->{script}?action=list_spool&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&vc=$form->{vc}&type=$form->{type}&title=$title";
-
- $form->sort_order();
-
- $title = $form->escape($form->{title},1);
- $callback = "$form->{script}?action=list_spool&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&vc=$form->{vc}&type=$form->{type}&title=$title";
-
- if ($form->{$form->{vc}}) {
- $callback .= "&$form->{vc}=".$form->escape($form->{$form->{vc}},1);
- $href .= "&$form->{vc}=".$form->escape($form->{$form->{vc}});
- $option = ($form->{vc} eq 'customer') ? $locale->text('Customer') : $locale->text('Vendor');
- $option .= " : $form->{$form->{vc}}";
- }
- if ($form->{account}) {
- $callback .= "&account=".$form->escape($form->{account},1);
- $href .= "&account=".$form->escape($form->{account});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Account')." : $form->{account}";
- }
- if ($form->{invnumber}) {
- $callback .= "&invnumber=".$form->escape($form->{invnumber},1);
- $href .= "&invnumber=".$form->escape($form->{invnumber});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Invoice Number')." : $form->{invnumber}";
- }
- if ($form->{ordnumber}) {
- $callback .= "&ordnumber=".$form->escape($form->{ordnumber},1);
- $href .= "&ordnumber=".$form->escape($form->{ordnumber});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Order Number')." : $form->{ordnumber}";
- }
- if ($form->{quonumber}) {
- $callback .= "&quonumber=".$form->escape($form->{quonumber},1);
- $href .= "&quonumber=".$form->escape($form->{quonumber});
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Quotation Number')." : $form->{quonumber}";
- }
-
- if ($form->{transdatefrom}) {
- $callback .= "&transdatefrom=$form->{transdatefrom}";
- $href .= "&transdatefrom=$form->{transdatefrom}";
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('From')."&nbsp;".$locale->date(\%myconfig, $form->{transdatefrom}, 1);
- }
- if ($form->{transdateto}) {
- $callback .= "&transdateto=$form->{transdateto}";
- $href .= "&transdateto=$form->{transdateto}";
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('To')."&nbsp;".$locale->date(\%myconfig, $form->{transdateto}, 1);
- }
-
- $name = ucfirst $form->{vc};
-
- @columns = qw(transdate);
- if ($form->{type} =~ /(invoice)/) {
- push @columns, "invnumber";
- }
- if ($form->{type} =~ /(packing|pick)_list/) {
- push @columns, "invnumber";
- }
- if ($form->{type} =~ /_(order|list)$/) {
- push @columns, "ordnumber";
- }
- if ($form->{type} =~ /_quotation$/) {
- push @columns, "quonumber";
- }
- if ($form->{type} eq 'timecard') {
- push @columns, "id";
- }
-
-
- push @columns, (name, spoolfile);
- @column_index = $form->sort_columns(@columns);
- unshift @column_index, "checked";
-
- $column_header{checked} = "<th class=listheading>&nbsp;</th>";
- $column_header{transdate} = "<th><a class=listheading href=$href&sort=transdate>".$locale->text('Date')."</a></th>";
- $column_header{invnumber} = "<th><a class=listheading href=$href&sort=invnumber>".$locale->text('Invoice')."</a></th>";
- $column_header{ordnumber} = "<th><a class=listheading href=$href&sort=ordnumber>".$locale->text('Order')."</a></th>";
- $column_header{quonumber} = "<th><a class=listheading href=$href&sort=quonumber>".$locale->text('Quotation')."</a></th>";
- $column_header{name} = "<th><a class=listheading href=$href&sort=name>".$locale->text($name)."</a></th>";
- $column_header{id} = "<th><a class=listheading href=$href&sort=id>".$locale->text('ID')."</a></th>";
- $column_header{spoolfile} = "<th class=listheading>".$locale->text('Spoolfile')."</th>";
-
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- for (@column_index) { print "\n$column_header{$_}" }
-
- print qq|
- </tr>
-|;
-
-
- # add sort and escape callback, this one we use for the add sub
- $form->{callback} = $callback .= "&sort=$form->{sort}";
-
- # escape callback for href
- $callback = $form->escape($callback);
-
- $i = 0;
-
- foreach $ref (@{ $form->{SPOOL} }) {
-
- $i++;
-
- $form->{"checked_$i"} = "checked" if $form->{"checked_$i"};
-
- # this is for audittrail
- $form->{module} = $ref->{module};
-
- if ($ref->{invoice}) {
- $ref->{module} = ($ref->{module} eq 'ar') ? "is" : "ir";
- }
- $module = "$ref->{module}.pl";
-
- $column_data{transdate} = "<td>$ref->{transdate}&nbsp;</td>";
-
- if ($spoolfile eq $ref->{spoolfile}) {
- $column_data{checked} = qq|<td></td>|;
- } else {
- $column_data{checked} = qq|<td><input name=checked_$i type=checkbox class=checkbox $form->{"checked_$i"} $form->{"checked_$i"}></td>|;
- }
-
- for (qw(id invnumber ordnumber quonumber)) { $column_data{$_} = qq|<td>$ref->{$_}</td>| }
-
- if ($ref->{module} eq 'oe') {
- $column_data{invnumber} = qq|<td>&nbsp</td>|;
- $column_data{ordnumber} = qq|<td><a href=$module?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&type=$form->{type}&callback=$callback>$ref->{ordnumber}</a></td>
- <input type=hidden name="reference_$i" value="$ref->{ordnumber}">|;
-
- $column_data{quonumber} = qq|<td><a href=$module?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&type=$form->{type}&callback=$callback>$ref->{quonumber}</a></td>
- <input type=hidden name="reference_$i" value="$ref->{quonumber}">|;
-
- } elsif ($ref->{module} eq 'jc') {
- $column_data{id} = qq|<td><a href=$module?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&type=$form->{type}&callback=$callback>$ref->{id}</a></td>
- <input type=hidden name="reference_$i" value="$ref->{id}">|;
- } else {
- $column_data{invnumber} = qq|<td><a href=$module?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&type=$form->{type}&callback=$callback>$ref->{invnumber}</a></td>
- <input type=hidden name="reference_$i" value="$ref->{invnumber}">|;
- }
-
-
- $column_data{name} = "<td>$ref->{name}</td>";
- $column_data{spoolfile} = qq|<td><a href=$spool/$ref->{spoolfile}>$ref->{spoolfile}</a></td>
-
-|;
-
- $spoolfile = $ref->{spoolfile};
-
- $j++; $j %= 2;
- print "
- <tr class=listrow$j>
-";
-
- for (@column_index) { print "\n$column_data{$_}" }
-
- print qq|
-<input type=hidden name="id_$i" value=$ref->{id}>
-<input type=hidden name="spoolfile_$i" value=$ref->{spoolfile}>
-
- </tr>
-|;
-
- }
-
- print qq|
-<input type=hidden name=rowcount value=$i>
-
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-|;
-
- $form->hide_form(qw(callback title vc type sort module account path login sessionid));
-
- if (%printer && $latex) {
- foreach $key (sort keys %printer) {
- print qq|
-<input name=media type=radio class=radio value="$key" |;
- print qq|checked| if $key eq $myconfig{printer};
- print qq|>$key|;
- }
-
- print qq|<p>\n|;
-
-# type=submit $locale->text('Select all')
-# type=submit $locale->text('Print')
-# type=submit $locale->text('Remove')
-
- %button = ('Select all' => { ndx => 2, key => 'A', value => $locale->text('Select all') },
- 'Print' => { ndx => 3, key => 'P', value => $locale->text('Print') },
- 'Remove' => { ndx => 4, key => 'R', value => $locale->text('Remove') },
- );
-
- for (sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button) { $form->print_button(\%button, $_) }
-
- }
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-</form>
-
-</body>
-</html>
-|;
-
-}
-
-
-sub select_all {
-
- for (1 .. $form->{rowcount}) { $form->{"checked_$_"} = 1 }
- &list_spool;
-
-}
-
-
-sub continue { &{ $form->{nextsub} } };
+#!/usr/bin/perl
+require "bin/mozilla/bp.pl";
diff --git a/bin/lynx/ca.pl b/bin/lynx/ca.pl
index c6371f7f..4993d2be 100755
--- a/bin/lynx/ca.pl
+++ b/bin/lynx/ca.pl
@@ -44,7 +44,7 @@
#
#======================================================================
-use SL::CA;
+use LedgerSMB::CA;
1;
# end of main
diff --git a/bin/mozilla/aa.pl b/bin/mozilla/aa.pl
index 0e02bf2f..50c143ef 100755
--- a/bin/mozilla/aa.pl
+++ b/bin/mozilla/aa.pl
@@ -1,12 +1,42 @@
#=====================================================================
-# LedgerSMB
-# Small Medium Business Accounting software
-#
-# See COPYRIGHT file for copyright information
-#======================================================================
+# LedgerSMB Small Medium Business Accounting
+
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+#
+# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
+# Copyright (c) 2005
+#
+# Author: DWS Systems Inc.
+# Web: http://www.sql-ledger.org
+#
+# Contributors:
+#
+#
+# Author: DWS Systems Inc.
+# Web: http://sourceforge.net/projects/ledger-smb/
+#
+# Contributors:
#
-# This file has NOT undergone whitespace cleanup.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#======================================================================
#
# AR / AP
diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl
index 73c1729e..d552e4ca 100755
--- a/bin/mozilla/admin.pl
+++ b/bin/mozilla/admin.pl
@@ -2,7 +2,25 @@
# LedgerSMB
# Small Medium Business Accounting software
#
-# See COPYRIGHT file for copyright information
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+#
+# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
+# Copyright (c) 2000
+#
+# Author: DWS Systems Inc.
+# Web: http://www.sql-ledger.org
+#
+# Contributors:
+#
+#
#======================================================================
#
# This file has NOT undergone whitespace cleanup.
diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl
index e5601954..3102051e 100755
--- a/bin/mozilla/am.pl
+++ b/bin/mozilla/am.pl
@@ -2,7 +2,24 @@
# LedgerSMB
# Small Medium Business Accounting software
#
-# See COPYRIGHT file for copyright information
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+#
+# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
+# Copyright (c) 2001
+#
+# Author: DWS Systems Inc.
+# Web: http://www.sql-ledger.org
+#
+# Contributors:
+#
#======================================================================
#
# This file has NOT undergone whitespace cleanup.
diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl
index 41ac1702..d1254e6a 100755
--- a/bin/mozilla/ap.pl
+++ b/bin/mozilla/ap.pl
@@ -1,12 +1,42 @@
#=====================================================================
-# LedgerSMB
-# Small Medium Business Accounting software
-#
-# See COPYRIGHT file for copyright information
-#======================================================================
+# LedgerSMB Small Medium Business Accounting
+
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+#
+# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
+# Copyright (C) 2000
+#
+# Author: DWS Systems Inc.
+# Web: http://www.sql-ledger.org
+#
+# Contributors:
+#
+#
+# Author: DWS Systems Inc.
+# Web: http://sourceforge.net/projects/ledger-smb/
+#
+# Contributors:
#
-# This file has NOT undergone whitespace cleanup.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#======================================================================
#
# Accounts Payable
@@ -14,7 +44,7 @@
#======================================================================
use LedgerSMB::PE;
-use LedgerSMB::IR;
+use Ledger::IR;
require "$form->{path}/arap.pl";
require "$form->{path}/arapprn.pl";
diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl
index c150a045..480388d1 100755
--- a/bin/mozilla/ar.pl
+++ b/bin/mozilla/ar.pl
@@ -1,12 +1,37 @@
#=====================================================================
-# LedgerSMB
-# Small Medium Business Accounting software
-#
-# See COPYRIGHT file for copyright information
-#======================================================================
+# LedgerSMB Small Medium Business Accounting
+
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+#
+# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
+# Copyright (c) 2000
+#
+# Author: DWS Systems Inc.
+# Web: http://www.sql-ledger.org
+#
+# Contributors:
+#
#
-# This file has NOT undergone whitespace cleanup.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#======================================================================
#
# Accounts Receivable
diff --git a/bin/mozilla/arap.pl b/bin/mozilla/arap.pl
index 4c6914bd..3e8890f3 100755
--- a/bin/mozilla/arap.pl
+++ b/bin/mozilla/arap.pl
@@ -1,12 +1,36 @@
#=====================================================================
-# LedgerSMB
-# Small Medium Business Accounting software
-#
-# See COPYRIGHT file for copyright information
-#======================================================================
+# LedgerSMB Small Medium Business Accounting
+
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+#
+# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
+# Copyright (c) 2003
+#
+# Author: DWS Systems Inc.
+# Web: http://www.sql-ledger.org
+#
+#
#
-# This file has NOT undergone whitespace cleanup.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#======================================================================
#
# common routines for gl, ar, ap, is, ir, oe
diff --git a/bin/mozilla/arapprn.pl b/bin/mozilla/arapprn.pl
index 84548415..7b123c46 100755
--- a/bin/mozilla/arapprn.pl
+++ b/bin/mozilla/arapprn.pl
@@ -1,14 +1,38 @@
#=====================================================================
-# LedgerSMB
-# Small Medium Business Accounting software
+# LedgerSMB Small Medium Business Accounting
+
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+#
+# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
+# Copyright (c) 2003
+#
+# Author: DWS Systems Inc.
+# Web: http://www.sql-ledger.org
#
-# See COPYRIGHT file for copyright information
-#======================================================================
#
-# This file has NOT undergone whitespace cleanup.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#======================================================================
#
+# This file has not undergone any whitespace cleanup.
#
# printing routines for ar, ap
#
diff --git a/bin/mozilla/bp.pl b/bin/mozilla/bp.pl
index 4ed10cb8..326f5417 100755
--- a/bin/mozilla/bp.pl
+++ b/bin/mozilla/bp.pl
@@ -1,12 +1,35 @@
#=====================================================================
-# LedgerSMB
-# Small Medium Business Accounting software
-#
-# See COPYRIGHT file for copyright information
-#======================================================================
+# LedgerSMB Small Medium Business Accounting
+
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+#
+# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
+# Copyright (c) 2003
+#
+# Author: DWS Systems Inc.
+# Web: http://www.sql-ledger.org
+#
#
-# This file has NOT undergone whitespace cleanup.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#======================================================================
#
# Batch printing