From 022491d9d2723ca4d7d0718cdb1fd67e7652428e Mon Sep 17 00:00:00 2001 From: cvs2git Date: Wed, 7 Apr 2004 09:08:35 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'NET_WHOIS_RAW_0_31'. --- sql-ledger/SL/AM.pm | 694 ---------------------- sql-ledger/SL/AP.pm | 381 ------------- sql-ledger/SL/AR.pm | 381 ------------- sql-ledger/SL/CA.pm | 262 --------- sql-ledger/SL/CP.pm | 308 ---------- sql-ledger/SL/CT.pm | 447 --------------- sql-ledger/SL/Form.pm | 1397 --------------------------------------------- sql-ledger/SL/GL.pm | 462 --------------- sql-ledger/SL/IC.pm | 936 ------------------------------ sql-ledger/SL/IR.pm | 995 -------------------------------- sql-ledger/SL/IS.pm | 1231 --------------------------------------- sql-ledger/SL/Inifile.pm | 87 --- sql-ledger/SL/Mailer.pm | 147 ----- sql-ledger/SL/Menu.pm | 117 ---- sql-ledger/SL/Num2text.pm | 162 ------ sql-ledger/SL/OE.pm | 674 ---------------------- sql-ledger/SL/PE.pm | 276 --------- sql-ledger/SL/RC.pm | 186 ------ sql-ledger/SL/RP.pm | 1310 ------------------------------------------ sql-ledger/SL/User.pm | 692 ---------------------- 20 files changed, 11145 deletions(-) delete mode 100644 sql-ledger/SL/AM.pm delete mode 100644 sql-ledger/SL/AP.pm delete mode 100644 sql-ledger/SL/AR.pm delete mode 100644 sql-ledger/SL/CA.pm delete mode 100644 sql-ledger/SL/CP.pm delete mode 100644 sql-ledger/SL/CT.pm delete mode 100644 sql-ledger/SL/Form.pm delete mode 100644 sql-ledger/SL/GL.pm delete mode 100644 sql-ledger/SL/IC.pm delete mode 100644 sql-ledger/SL/IR.pm delete mode 100644 sql-ledger/SL/IS.pm delete mode 100644 sql-ledger/SL/Inifile.pm delete mode 100644 sql-ledger/SL/Mailer.pm delete mode 100644 sql-ledger/SL/Menu.pm delete mode 100644 sql-ledger/SL/Num2text.pm delete mode 100644 sql-ledger/SL/OE.pm delete mode 100644 sql-ledger/SL/PE.pm delete mode 100644 sql-ledger/SL/RC.pm delete mode 100644 sql-ledger/SL/RP.pm delete mode 100644 sql-ledger/SL/User.pm (limited to 'sql-ledger/SL') diff --git a/sql-ledger/SL/AM.pm b/sql-ledger/SL/AM.pm deleted file mode 100644 index d691b3ce6..000000000 --- a/sql-ledger/SL/AM.pm +++ /dev/null @@ -1,694 +0,0 @@ -#===================================================================== -# SQL-Ledger Accounting -# Copyright (C) 2001 -# -# Author: Dieter Simader -# Email: dsimader@sql-ledger.org -# Web: http://www.sql-ledger.org -# -# 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. -#====================================================================== -# -# Administration module -# Chart of Accounts -# template routines -# preferences -# -#====================================================================== - -package AM; - - -sub get_account { - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my $query = qq|SELECT accno, description, charttype, gifi_accno, - category, link - FROM chart - WHERE id = $form->{id}|; - my $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - my $ref = $sth->fetchrow_hashref(NAME_lc); - - foreach my $key (keys %$ref) { - $form->{"$key"} = $ref->{"$key"}; - } - - $sth->finish; - - - # get default accounts - $query = qq|SELECT inventory_accno_id, income_accno_id, expense_accno_id - FROM defaults|; - $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - $ref = $sth->fetchrow_hashref(NAME_lc); - - map { $form->{$_} = $ref->{$_} } keys %ref; - - $sth->finish; - $dbh->disconnect; - -} - - -sub save_account { - my ($self, $myconfig, $form) = @_; - - # connect to database, turn off AutoCommit - my $dbh = $form->dbconnect_noauto($myconfig); - - # sanity check, can't have AR with AR_... - if ($form->{AR} || $form->{AP} || $form->{IC}) { - map { delete $form->{$_} } qw(AR_amount AR_tax AR_paid AP_amount AP_tax AP_paid IC_sale IC_cogs IC_taxpart IC_income IC_expense IC_taxservice); - } - - $form->{link} = ""; - foreach my $item ($form->{AR}, - $form->{AR_amount}, - $form->{AR_tax}, - $form->{AR_paid}, - $form->{AP}, - $form->{AP_amount}, - $form->{AP_tax}, - $form->{AP_paid}, - $form->{IC}, - $form->{IC_sale}, - $form->{IC_cogs}, - $form->{IC_taxpart}, - $form->{IC_income}, - $form->{IC_expense}, - $form->{IC_taxservice}, - $form->{CT_tax} - ) { - $form->{link} .= "${item}:" if ($item); - } - chop $form->{link}; - - # if we have an id then replace the old record - $form->{description} =~ s/'/''/g; - - # strip blanks from accno - map { $form->{$_} =~ s/ //g; } qw(accno gifi_accno); - - my ($query, $sth); - - if ($form->{id}) { - $query = qq|UPDATE chart SET - accno = '$form->{accno}', - description = '$form->{description}', - charttype = '$form->{charttype}', - gifi_accno = '$form->{gifi_accno}', - category = '$form->{category}', - link = '$form->{link}' - WHERE id = $form->{id}|; - } else { - $query = qq|INSERT INTO chart - (accno, description, charttype, gifi_accno, category, link) - VALUES ('$form->{accno}', '$form->{description}', - '$form->{charttype}', '$form->{gifi_accno}', - '$form->{category}', '$form->{link}')|; - } - $dbh->do($query) || $form->dberror($query); - - - if ($form->{IC_taxpart} || $form->{IC_taxservice} || $form->{CT_tax}) { - - my $chart_id = $form->{id}; - - unless ($form->{id}) { - # get id from chart - $query = qq|SELECT id - FROM chart - WHERE accno = '$form->{accno}'|; - $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - ($chart_id) = $sth->fetchrow_array; - $sth->finish; - } - - # add account if it doesn't exist in tax - $query = qq|SELECT chart_id - FROM tax - WHERE chart_id = $chart_id|; - $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - my ($tax_id) = $sth->fetchrow_array; - $sth->finish; - - # add tax if it doesn't exist - unless ($tax_id) { - $query = qq|INSERT INTO tax (chart_id, rate) - VALUES ($chart_id, 0)|; - $dbh->do($query) || $form->dberror($query); - } - } else { - # remove tax - if ($form->{id}) { - $query = qq|DELETE FROM tax - WHERE chart_id = $form->{id}|; - $dbh->do($query) || $form->dberror($query); - } - } - - - # commit - my $rc = $dbh->commit; - $dbh->disconnect; - - $rc; - -} - - - -sub delete_account { - my ($self, $myconfig, $form) = @_; - - # connect to database, turn off AutoCommit - my $dbh = $form->dbconnect_noauto($myconfig); - - # delete chart of account record - $query = qq|DELETE FROM chart - WHERE id = $form->{id}|; - $dbh->do($query) || $form->dberror($query); - - # set inventory_accno_id, income_accno_id, expense_accno_id to defaults - $query = qq|UPDATE parts - SET inventory_accno_id = - (SELECT inventory_accno_id FROM defaults) - WHERE inventory_accno_id = $form->{id}|; - $dbh->do($query) || $form->dberror($query); - - $query = qq|UPDATE parts - SET income_accno_id = - (SELECT income_accno_id FROM defaults) - WHERE income_accno_id = $form->{id}|; - $dbh->do($query) || $form->dberror($query); - - $query = qq|UPDATE parts - SET expense_accno_id = - (SELECT expense_accno_id FROM defaults) - WHERE expense_accno_id = $form->{id}|; - $dbh->do($query) || $form->dberror($query); - - foreach my $table (qw(partstax customertax vendortax tax)) { - $query = qq|DELETE FROM $table - WHERE chart_id = $form->{id}|; - $dbh->do($query) || $form->dberror($query); - } - - # commit and redirect - my $rc = $dbh->commit; - $dbh->disconnect; - - $rc; - -} - - -sub gifi_accounts { - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my $query = qq|SELECT accno, description - FROM gifi - ORDER BY accno|; - - $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { - push @{ $form->{ALL} }, $ref; - } - - $sth->finish; - $dbh->disconnect; - -} - - - -sub get_gifi { - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my $query = qq|SELECT accno, description - FROM gifi - WHERE accno = '$form->{accno}'|; - my $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - my $ref = $sth->fetchrow_hashref(NAME_lc); - - map { $form->{$_} = $ref->{$_} } keys %$ref; - - $sth->finish; - $dbh->disconnect; - -} - - -sub save_gifi { - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - $form->{description} =~ s/'/''/g; - $form->{accno} =~ s/ //g; - - # id is the old account number! - if ($form->{id}) { - $query = qq|UPDATE gifi SET - accno = '$form->{accno}', - description = '$form->{description}' - WHERE accno = '$form->{id}'|; - } else { - $query = qq|INSERT INTO gifi - (accno, description) - VALUES ('$form->{accno}', '$form->{description}')|; - } - $dbh->do($query) || $form->dberror($query); - - $dbh->disconnect; - -} - - -sub delete_gifi { - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - # id is the old account number! - $query = qq|DELETE FROM gifi - WHERE accno = '$form->{id}'|; - $dbh->do($query) || $form->dberror($query); - - $dbh->disconnect; - -} - - -sub load_template { - my ($self, $form) = @_; - - open(TEMPLATE, "$form->{file}") or $form->error("$form->{file} : $!"); - - while (