[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [183] trunk
- Subject: SF.net SVN: ledger-smb: [183] trunk
- From: ..hidden..
- Date: Mon, 02 Oct 2006 16:40:21 -0700
Revision: 183
http://svn.sourceforge.net/ledger-smb/?rev=183&view=rev
Author: einhverfr
Date: 2006-10-02 16:40:18 -0700 (Mon, 02 Oct 2006)
Log Message:
-----------
Broke out price matrix logic (warning, this is untested but cannot test from
this machine so will be tested tonight)
Modified Paths:
--------------
trunk/Changelog
trunk/LedgerSMB/IR.pm
trunk/LedgerSMB/IS.pm
trunk/LedgerSMB/JC.pm
trunk/LedgerSMB/OE.pm
Added Paths:
-----------
trunk/LedgerSMB/PriceMatrix.pm
Modified: trunk/Changelog
===================================================================
--- trunk/Changelog 2006-10-02 22:58:42 UTC (rev 182)
+++ trunk/Changelog 2006-10-02 23:40:18 UTC (rev 183)
@@ -1,6 +1,7 @@
Changelog for LedgerSMB 1.2.0
-* Added Gentoo ebuilds documentation (Jayson R).
+* Broke out price matrix calls into PriceMatrix.pm (Chris T)
+* Added Gentoo ebuilds documentation and metadata(Jayson R).
* POS register now goes from add invoice to add invoice. (Chris T)
* Added pole display and separate cash drawer open calls. (Chris T)
* Added simple text import function for invoices received (PDT's) (Chris T)
Modified: trunk/LedgerSMB/IR.pm
===================================================================
--- trunk/LedgerSMB/IR.pm 2006-10-02 22:58:42 UTC (rev 182)
+++ trunk/LedgerSMB/IR.pm 2006-10-02 23:40:18 UTC (rev 183)
@@ -32,8 +32,8 @@
#======================================================================
package IR;
+use LedgerSMB::PriceMatrix;
-
sub post_invoice {
my ($self, $myconfig, $form) = @_;
@@ -850,11 +850,7 @@
&exchangerate_defaults($dbh, $form);
# price matrix and vendor partnumber
- $query = qq|SELECT partnumber
- FROM partsvendor
- WHERE parts_id = ?
- AND vendor_id = $form->{vendor_id}|;
- my $pmh = $dbh->prepare($query) || $form->dberror($query);
+ my $pmh = PriceMatrix::PriceMatrixQuery($dbh, $form);
# tax rates for part
$query = qq|SELECT c.accno
@@ -885,7 +881,7 @@
# price matrix
$ref->{sellprice} = $form->round_amount($ref->{fxsellprice} * $form->{$form->{currency}}, $decimalplaces);
- &price_matrix($pmh, $ref, $decimalplaces, $form);
+ PriceMatrix::price_matrix($pmh, $ref, $decimalplaces, $form, $myconfig);
$ref->{sellprice} = $ref->{fxsellprice};
$ref->{qty} *= -1;
@@ -974,11 +970,7 @@
my $tth = $dbh->prepare($query) || $form->dberror($query);
# price matrix
- $query = qq|SELECT p.*
- FROM partsvendor p
- WHERE p.parts_id = ?
- AND vendor_id = $form->{vendor_id}|;
- my $pmh = $dbh->prepare($query) || $form->dberror($query);
+ my $pmh = PriceMatrix::price_matrix_query($dbh, $form);
my $ref;
my $ptref;
@@ -1000,7 +992,7 @@
chop $ref->{taxaccounts};
# get vendor price and partnumber
- &price_matrix($pmh, $ref, $decimalplaces, $form);
+ PriceMatrix::price_matrix($pmh, $ref, $decimalplaces, $form, $myconfig);
$ref->{description} = $ref->{translation} if $ref->{translation};
$ref->{partsgroup} = $ref->{grouptranslation} if $ref->{grouptranslation};
@@ -1060,30 +1052,6 @@
}
-sub price_matrix {
- my ($pmh, $ref, $decimalplaces, $form) = @_;
-
- $pmh->execute($ref->{id});
- my $mref = $pmh->fetchrow_hashref(NAME_lc);
-
- if ($mref->{partnumber} ne "") {
- $ref->{partnumber} = $mref->{partnumber};
- }
-
- if ($mref->{lastcost}) {
- # do a conversion
- $ref->{sellprice} = $form->round_amount($mref->{lastcost} * $form->{$mref->{curr}}, $decimalplaces);
- }
- $pmh->finish;
-
- $ref->{sellprice} *= 1;
-
- # add 0:price to matrix
- $ref->{pricematrix} = "0:$ref->{sellprice}";
-
-}
-
-
sub vendor_details {
my ($self, $myconfig, $form) = @_;
Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm 2006-10-02 22:58:42 UTC (rev 182)
+++ trunk/LedgerSMB/IS.pm 2006-10-02 23:40:18 UTC (rev 183)
@@ -32,8 +32,8 @@
#======================================================================
package IS;
+use LedgerSMB::PriceMatrix;
-
sub invoice_details {
my ($self, $myconfig, $form) = @_;
@@ -1377,7 +1377,7 @@
&exchangerate_defaults($dbh, $form);
# query for price matrix
- my $pmh = &price_matrix_query($dbh, $form);
+ my $pmh = PriceMatrix::price_matrix_query($dbh, $form);
# taxes
$query = qq|SELECT c.accno
@@ -1409,7 +1409,7 @@
# price matrix
$ref->{sellprice} = ($ref->{fxsellprice} * $form->{$form->{currency}});
- &price_matrix($pmh, $ref, $form->{transdate}, $decimalplaces, $form, $myconfig);
+ PriceMatrix::price_matrix($pmh, $ref, $form->{transdate}, $decimalplaces, $form, $myconfig);
$ref->{sellprice} = $ref->{fxsellprice};
$ref->{partsgroup} = $ref->{partsgrouptranslation} if $ref->{partsgrouptranslation};
@@ -1503,7 +1503,7 @@
# price matrix
- my $pmh = &price_matrix_query($dbh, $form);
+ my $pmh = PriceMatrix::price_matrix_query($dbh, $form);
my $transdate = $form->datetonum($myconfig, $form->{transdate});
@@ -1524,7 +1524,7 @@
chop $ref->{taxaccounts};
# get matrix
- &price_matrix($pmh, $ref, $transdate, $decimalplaces, $form, $myconfig);
+ PriceMatrix::price_matrix($pmh, $ref, $transdate, $decimalplaces, $form, $myconfig);
$ref->{description} = $ref->{translation} if $ref->{translation};
$ref->{partsgroup} = $ref->{grouptranslation} if $ref->{grouptranslation};
@@ -1539,121 +1539,6 @@
}
-sub price_matrix_query {
- my ($dbh, $form) = @_;
-
- my $query = qq|SELECT p.id AS parts_id, 0 AS customer_id, 0 AS pricegroup_id,
- 0 AS pricebreak, p.sellprice, NULL AS validfrom, NULL AS validto,
- '$form->{defaultcurrency}' AS curr, '' AS pricegroup
- FROM parts p
- WHERE p.id = ?
-
- UNION
-
- SELECT p.*, g.pricegroup
- FROM partscustomer p
- LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
- WHERE p.parts_id = ?
- AND p.customer_id = $form->{customer_id}
-
- UNION
-
- SELECT p.*, g.pricegroup
- FROM partscustomer p
- LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
- JOIN customer c ON (c.pricegroup_id = g.id)
- WHERE p.parts_id = ?
- AND c.id = $form->{customer_id}
-
- UNION
-
- SELECT p.*, '' AS pricegroup
- FROM partscustomer p
- WHERE p.customer_id = 0
- AND p.pricegroup_id = 0
- AND p.parts_id = ?
-
- ORDER BY customer_id DESC, pricegroup_id DESC, pricebreak
-
- |;
- my $sth = $dbh->prepare($query) || $form->dberror($query);
-
- $sth;
-
-}
-
-
-sub price_matrix {
- my ($pmh, $ref, $transdate, $decimalplaces, $form, $myconfig) = @_;
-
- $pmh->execute($ref->{id}, $ref->{id}, $ref->{id}, $ref->{id});
-
- $ref->{pricematrix} = "";
-
- my $customerprice;
- my $pricegroupprice;
- my $sellprice;
- my $baseprice;
- my $mref;
- my %p = ();
- my $i = 0;
-
- while ($mref = $pmh->fetchrow_hashref(NAME_lc)) {
-
- # check date
- if ($mref->{validfrom}) {
- next if $transdate < $form->datetonum($myconfig, $mref->{validfrom});
- }
- if ($mref->{validto}) {
- next if $transdate > $form->datetonum($myconfig, $mref->{validto});
- }
-
- # convert price
- $sellprice = $form->round_amount($mref->{sellprice} * $form->{$mref->{curr}}, $decimalplaces);
-
- $mref->{pricebreak} *= 1;
-
- if ($mref->{customer_id}) {
- $p{$mref->{pricebreak}} = $sellprice;
- $customerprice = 1;
- }
-
- if ($mref->{pricegroup_id}) {
- if (!$customerprice) {
- $p{$mref->{pricebreak}} = $sellprice;
- $pricegroupprice = 1;
- }
- }
-
- if (!$customerprice && !$pricegroupprice) {
- $p{$mref->{pricebreak}} = $sellprice;
- }
-
- if (($mref->{pricebreak} + $mref->{customer_id} + $mref->{pricegroup_id}) == 0) {
- $baseprice = $sellprice;
- }
-
- $i++;
-
- }
- $pmh->finish;
-
- if (! exists $p{0}) {
- $p{0} = $baseprice;
- }
-
- if ($i > 1) {
- $ref->{sellprice} = $p{0};
- for (sort { $a <=> $b } keys %p) { $ref->{pricematrix} .= "${_}:$p{$_} " }
- } else {
- $ref->{sellprice} = $form->round_amount($p{0} * (1 - $form->{tradediscount}), $decimalplaces);
- $ref->{pricematrix} = "0:$ref->{sellprice} " if $ref->{sellprice};
- }
- chop $ref->{pricematrix};
-
-}
-
-
sub exchangerate_defaults {
my ($dbh, $form) = @_;
Modified: trunk/LedgerSMB/JC.pm
===================================================================
--- trunk/LedgerSMB/JC.pm 2006-10-02 22:58:42 UTC (rev 182)
+++ trunk/LedgerSMB/JC.pm 2006-10-02 23:40:18 UTC (rev 183)
@@ -35,6 +35,7 @@
package JC;
use LedgerSMB::IS;
+use LedgerSMB::PriceMatrix;
sub get_jcitems {
my ($self, $myconfig, $form) = @_;
@@ -268,12 +269,12 @@
my $sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- my $pmh = price_matrix_query($dbh, $project_id, $customer_id);
+ my $pmh = PriceMatrix::price_matrix_query($dbh, $form);
IS::exchangerate_defaults($dbh, $form);
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
$ref->{description} = $ref->{translation} if $ref->{translation};
- IS::price_matrix($pmh, $ref, $form->datetonum($form->{transdate}), 4, $form, $myconfig);
+ PriceMatrix::price_matrix($pmh, $ref, $form->{transdate}, 4, $form, $myconfig);
push @{ $form->{all_parts} }, $ref;
}
$sth->finish;
@@ -552,49 +553,6 @@
}
-sub price_matrix_query {
- my ($dbh, $project_id, $customer_id) = @_;
-
- my $query = qq|SELECT p.id AS parts_id, 0 AS customer_id, 0 AS pricegroup_id,
- 0 AS pricebreak, p.sellprice, NULL AS validfrom, NULL AS validto,
- (SELECT substr(curr,1,3) FROM defaults) AS curr, '' AS pricegroup
- FROM parts p
- WHERE p.id = ?
- UNION
-
- SELECT p.*, g.pricegroup
- FROM partscustomer p
- LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
- WHERE p.parts_id = ?
- AND p.customer_id = $customer_id
-
- UNION
-
- SELECT p.*, g.pricegroup
- FROM partscustomer p
- LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
- JOIN customer c ON (c.pricegroup_id = g.id)
- WHERE p.parts_id = ?
- AND c.id = $customer_id
-
- UNION
-
- SELECT p.*, '' AS pricegroup
- FROM partscustomer p
- WHERE p.customer_id = 0
- AND p.pricegroup_id = 0
- AND p.parts_id = ?
-
- ORDER BY customer_id DESC, pricegroup_id DESC, pricebreak
-
- |;
- my $sth = $dbh->prepare($query) || $form->dberror($query);
-
- $sth;
-
-}
-
-
1;
Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm 2006-10-02 22:58:42 UTC (rev 182)
+++ trunk/LedgerSMB/OE.pm 2006-10-02 23:40:18 UTC (rev 183)
@@ -778,6 +778,7 @@
sub retrieve {
+ use LedgerSMB::PriceMatrix;
my ($self, $myconfig, $form) = @_;
# connect to database
@@ -874,7 +875,7 @@
&exchangerate_defaults($dbh, $form);
# query for price matrix
- my $pmh = &price_matrix_query($dbh, $form);
+ my $pmh = PriceMatrix::price_matrix_query($dbh, $form);
# taxes
$query = qq|
@@ -923,7 +924,7 @@
}
# partnumber and price matrix
- &price_matrix(
+ PriceMatrix::price_matrix(
$pmh, $ref, $form->{transdate}, $decimalplaces,
$form, $myconfig);
@@ -957,174 +958,6 @@
}
-sub price_matrix_query {
- my ($dbh, $form) = @_;
-
- my $query;
- my $sth;
-
- my @queryargs;
-
- if ($form->{customer_id}) {
- my $defaultcurrency = $form->{dbh}->quote(
- $form->{defaultcurrency});
- my $customer_id = $form->{dbh}->quote($form->{customer_id});
- $query = qq|
- SELECT p.id AS parts_id, 0 AS customer_id,
- 0 AS pricegroup_id, 0 AS pricebreak,
- p.sellprice, NULL AS validfrom, NULL AS validto,
- $defaultcurrency AS curr, '' AS pricegroup
- FROM parts p
- WHERE p.id = ?
-
- UNION
-
- SELECT p.*, g.pricegroup
- FROM partscustomer p
- LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
- WHERE p.parts_id = ?
- AND p.customer_id = $customer_id
-
- UNION
-
- SELECT p.*, g.pricegroup
- FROM partscustomer p
- LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
- JOIN customer c ON (c.pricegroup_id = g.id)
- WHERE p.parts_id = ?
- AND c.id = $customer_id
-
- UNION
-
- SELECT p.*, '' AS pricegroup
- FROM partscustomer p
- WHERE p.customer_id = 0
- AND p.pricegroup_id = 0
- AND p.parts_id = ?
-
- ORDER BY customer_id DESC, pricegroup_id DESC,
- pricebreak
- |;
- $sth = $dbh->prepare($query) || $form->dberror($query);
- } elsif ($form->{vendor_id}) {
- my $vendor_id = $form->{dbh}->quote($form->{vendor_id});
- # price matrix and vendor's partnumber
- $query = qq|
- SELECT partnumber
- FROM partsvendor
- WHERE parts_id = ?
- AND vendor_id = $vendor_id|;
- $sth = $dbh->prepare($query) || $form->dberror($query);
- }
-
- $sth;
-}
-
-
-sub price_matrix {
- my ($pmh, $ref, $transdate, $decimalplaces, $form, $myconfig) = @_;
- $ref->{pricematrix} = "";
- my $customerprice;
- my $pricegroupprice;
- my $sellprice;
- my $mref;
- my %p = ();
-
- # depends if this is a customer or vendor
- if ($form->{customer_id}) {
- $pmh->execute($ref->{id}, $ref->{id}, $ref->{id}, $ref->{id});
-
- while ($mref = $pmh->fetchrow_hashref(NAME_lc)) {
-
- # check date
- if ($mref->{validfrom}) {
- next if $transdate < $form->datetonum(
- $myconfig, $mref->{validfrom});
- }
- if ($mref->{validto}) {
- next if $transdate > $form->datetonum(
- $myconfig, $mref->{validto});
- }
-
- # convert price
- $sellprice = $form->round_amount($mref->{sellprice}
- * $form->{$mref->{curr}}, $decimalplaces);
-
- if ($mref->{customer_id}) {
- $ref->{sellprice} = $sellprice
- if !$mref->{pricebreak};
- $p{$mref->{pricebreak}} = $sellprice;
- $customerprice = 1;
- }
-
- if ($mref->{pricegroup_id}) {
- if (! $customerprice) {
- $ref->{sellprice} = $sellprice
- if !$mref->{pricebreak};
- $p{$mref->{pricebreak}} = $sellprice;
- }
- $pricegroupprice = 1;
- }
-
- if (!$customerprice && !$pricegroupprice) {
- $p{$mref->{pricebreak}} = $sellprice;
- }
-
- }
- $pmh->finish;
-
- if (%p) {
- if ($ref->{sellprice}) {
- $p{0} = $ref->{sellprice};
- }
- for (sort { $a <=> $b } keys %p) {
- $ref->{pricematrix} .= "${_}:$p{$_} ";
- }
- } else {
- if ($init) {
- $ref->{sellprice} = $form->round_amount(
- $ref->{sellprice}, $decimalplaces);
- } else {
- $ref->{sellprice} = $form->round_amount(
- $ref->{sellprice} *
- (1 - $form->{tradediscount}),
- $decimalplaces);
- }
- $ref->{pricematrix} = "0:$ref->{sellprice} "
- if $ref->{sellprice};
- }
- chop $ref->{pricematrix};
-
- }
-
-
- if ($form->{vendor_id}) {
- $pmh->execute($ref->{id});
-
- $mref = $pmh->fetchrow_hashref(NAME_lc);
-
- if ($mref->{partnumber} ne "") {
- $ref->{partnumber} = $mref->{partnumber};
- }
-
- if ($mref->{lastcost}) {
- # do a conversion
- $ref->{sellprice} = $form->round_amount(
- $mref->{lastcost} * $form->{$mref->{curr}},
- $decimalplaces);
- }
- $pmh->finish;
-
- $ref->{sellprice} *= 1;
-
- # add 0:price to matrix
- $ref->{pricematrix} = "0:$ref->{sellprice}";
-
- }
-
-}
-
-
sub exchangerate_defaults {
my ($dbh2, $form) = @_;
$dbh = $form->{dbh};
Added: trunk/LedgerSMB/PriceMatrix.pm
===================================================================
--- trunk/LedgerSMB/PriceMatrix.pm (rev 0)
+++ trunk/LedgerSMB/PriceMatrix.pm 2006-10-02 23:40:18 UTC (rev 183)
@@ -0,0 +1,204 @@
+#=====================================================================
+# LedgerSMB
+# Small Medium Business Accounting software
+# http://www.ledgersmb.org/
+#
+# 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 undergone whitespace cleanup
+#
+#======================================================================
+#
+# Price Matrix module
+#
+#
+#======================================================================
+
+package PriceMatrix;
+
+sub price_matrix_query {
+ my ($dbh, $form) = @_;
+
+ my $query;
+ my $sth;
+
+ my @queryargs;
+
+ if ($form->{customer_id}) {
+ my $defaultcurrency = $form->{dbh}->quote(
+ $form->{defaultcurrency});
+ my $customer_id = $form->{dbh}->quote($form->{customer_id});
+ $query = qq|
+ SELECT p.id AS parts_id, 0 AS customer_id,
+ 0 AS pricegroup_id, 0 AS pricebreak,
+ p.sellprice, NULL AS validfrom, NULL AS validto,
+ (SELECT substr(curr,1,3) FROM defaults) AS curr,
+ '' AS pricegroup
+ FROM parts p
+ WHERE p.id = ?
+
+ UNION
+
+ SELECT p.*, g.pricegroup
+ FROM partscustomer p
+ LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
+ WHERE p.parts_id = ?
+ AND p.customer_id = $customer_id
+
+ UNION
+
+ SELECT p.*, g.pricegroup
+ FROM partscustomer p
+ LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
+ JOIN customer c ON (c.pricegroup_id = g.id)
+ WHERE p.parts_id = ?
+ AND c.id = $customer_id
+
+ UNION
+
+ SELECT p.*, '' AS pricegroup
+ FROM partscustomer p
+ WHERE p.customer_id = 0
+ AND p.pricegroup_id = 0
+ AND p.parts_id = ?
+
+ ORDER BY customer_id DESC, pricegroup_id DESC,
+ pricebreak
+ |;
+ $sth = $dbh->prepare($query) || $form->dberror($query);
+ } elsif ($form->{vendor_id}) {
+ my $vendor_id = $form->{dbh}->quote($form->{vendor_id});
+ # price matrix and vendor's partnumber
+ $query = qq|
+ SELECT partnumber
+ FROM partsvendor
+ WHERE parts_id = ?
+ AND vendor_id = $vendor_id|;
+ $sth = $dbh->prepare($query) || $form->dberror($query);
+ }
+
+ $sth;
+}
+
+
+sub price_matrix {
+ my ($pmh, $ref, $transdate, $decimalplaces, $form, $myconfig) = @_;
+ $ref->{pricematrix} = "";
+ my $customerprice;
+ my $pricegroupprice;
+ my $sellprice;
+ my $mref;
+ my %p = ();
+
+ # depends if this is a customer or vendor
+ if ($form->{customer_id}) {
+ $pmh->execute($ref->{id}, $ref->{id}, $ref->{id}, $ref->{id});
+
+ while ($mref = $pmh->fetchrow_hashref(NAME_lc)) {
+
+ # check date
+ if ($mref->{validfrom}) {
+ next if $transdate < $form->datetonum(
+ $myconfig, $mref->{validfrom});
+ }
+ if ($mref->{validto}) {
+ next if $transdate > $form->datetonum(
+ $myconfig, $mref->{validto});
+ }
+
+ # convert price
+ $sellprice = $form->round_amount($mref->{sellprice}
+ * $form->{$mref->{curr}}, $decimalplaces);
+
+ if ($mref->{customer_id}) {
+ $ref->{sellprice} = $sellprice
+ if !$mref->{pricebreak};
+ $p{$mref->{pricebreak}} = $sellprice;
+ $customerprice = 1;
+ }
+
+ if ($mref->{pricegroup_id}) {
+ if (! $customerprice) {
+ $ref->{sellprice} = $sellprice
+ if !$mref->{pricebreak};
+ $p{$mref->{pricebreak}} = $sellprice;
+ }
+ $pricegroupprice = 1;
+ }
+
+ if (!$customerprice && !$pricegroupprice) {
+ $p{$mref->{pricebreak}} = $sellprice;
+ }
+
+ }
+ $pmh->finish;
+
+ if (%p) {
+ if ($ref->{sellprice}) {
+ $p{0} = $ref->{sellprice};
+ }
+ for (sort { $a <=> $b } keys %p) {
+ $ref->{pricematrix} .= "${_}:$p{$_} ";
+ }
+ } else {
+ if ($init) {
+ $ref->{sellprice} = $form->round_amount(
+ $ref->{sellprice}, $decimalplaces);
+ } else {
+ $ref->{sellprice} = $form->round_amount(
+ $ref->{sellprice} *
+ (1 - $form->{tradediscount}),
+ $decimalplaces);
+ }
+ $ref->{pricematrix} = "0:$ref->{sellprice} "
+ if $ref->{sellprice};
+ }
+ chop $ref->{pricematrix};
+
+ }
+
+
+ if ($form->{vendor_id}) {
+ $pmh->execute($ref->{id});
+
+ $mref = $pmh->fetchrow_hashref(NAME_lc);
+
+ if ($mref->{partnumber} ne "") {
+ $ref->{partnumber} = $mref->{partnumber};
+ }
+
+ if ($mref->{lastcost}) {
+ # do a conversion
+ $ref->{sellprice} = $form->round_amount(
+ $mref->{lastcost} * $form->{$mref->{curr}},
+ $decimalplaces);
+ }
+ $pmh->finish;
+
+ $ref->{sellprice} *= 1;
+
+ # add 0:price to matrix
+ $ref->{pricematrix} = "0:$ref->{sellprice}";
+
+ }
+
+}
+1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.