X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=sql-ledger%2FSL%2FIC.pm;fp=sql-ledger%2FSL%2FIC.pm;h=0000000000000000000000000000000000000000;hp=cf70b06ca15ec4c3119abf594053ac46ec4c93d0;hb=86b1b489a4ed2f9bc0cba6cafeab0d6eca5584dc;hpb=948b8acdd4b9b3864342062d0c397a11f57c5700 diff --git a/sql-ledger/SL/IC.pm b/sql-ledger/SL/IC.pm deleted file mode 100644 index cf70b06ca..000000000 --- a/sql-ledger/SL/IC.pm +++ /dev/null @@ -1,1513 +0,0 @@ -#===================================================================== -# SQL-Ledger Accounting -# Copyright (C) 2000 -# -# 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. -#====================================================================== -# -# Inventory Control backend -# -#====================================================================== - -package IC; - - -sub get_part { - my ($self, $myconfig, $form) = @_; - - # connect to db - my $dbh = $form->dbconnect($myconfig); - my $i; - - my $query = qq|SELECT p.*, - c1.accno AS inventory_accno, - c2.accno AS income_accno, - c3.accno AS expense_accno, - pg.partsgroup - FROM parts p - LEFT JOIN chart c1 ON (p.inventory_accno_id = c1.id) - LEFT JOIN chart c2 ON (p.income_accno_id = c2.id) - LEFT JOIN chart c3 ON (p.expense_accno_id = c3.id) - LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id) - WHERE p.id = $form->{id}|; - my $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - my $ref = $sth->fetchrow_hashref(NAME_lc); - - # copy to $form variables - map { $form->{$_} = $ref->{$_} } ( keys %{ $ref } ); - - $sth->finish; - - my %oid = ('Pg' => 'a.oid', - 'PgPP' => 'a.oid', - 'Oracle' => 'a.rowid', - 'DB2' => '1=1' - ); - - # part, service item or labor - $form->{item} = ($form->{inventory_accno}) ? 'part' : 'service'; - $form->{item} = 'labor' if ! $form->{income_accno}; - - if ($form->{assembly}) { - $form->{item} = 'assembly'; - - # retrieve assembly items - $query = qq|SELECT p.id, p.partnumber, p.description, - p.sellprice, p.weight, a.qty, a.bom, a.adj, p.unit, - p.lastcost, p.listprice, - pg.partsgroup, p.assembly, p.partsgroup_id - FROM parts p - JOIN assembly a ON (a.parts_id = p.id) - LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id) - WHERE a.id = $form->{id} - ORDER BY $oid{$myconfig->{dbdriver}}|; - - $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - $form->{assembly_rows} = 0; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { - $form->{assembly_rows}++; - foreach my $key ( keys %{ $ref } ) { - $form->{"${key}_$form->{assembly_rows}"} = $ref->{$key}; - } - } - $sth->finish; - - } - - # setup accno hash for