09-30-2014, 05:06 AM,
|
|
MacPhotoBiker
Senior Member
   
|
Posts: 149
Threads: 34
Joined: Dec 2012
|
|
Price breaks depending on quantity
Hi,
is it possible to maintain several purchasing costs for one and the same article depending on quantities ("Price Breaks"), e.g.:
10 pcs: $5/ pc.
20 pcs: $4/pc.
50 pcs. $3/pc.
I tried to set up different prices for the same article with different quantities, but I got a key constraint error (because every article can only be set up once).
How could I set up the above example in both the purchase and the sales module?
Thanks a lot!
MacPhotoBiker
Just Core Business Inc.
[url]http://www.justcorebusiness.com[/url]
|
|
09-30-2014, 05:46 AM,
|
|
MacPhotoBiker
Senior Member
   
|
Posts: 149
Threads: 34
Joined: Dec 2012
|
|
RE: Price breaks depending on quantity
Hi Phil,
thanks a lot for clarifying.
On my end, it would certainly be "nice to have" (on the purchasing side), but it's not a "killer feature" either. Maybe that's an item for a "wishlist"
Thanks again!
MacPhotoBiker
Just Core Business Inc.
[url]http://www.justcorebusiness.com[/url]
|
|
05-18-2016, 06:54 PM,
|
|
richieeeee
Member
 
|
Posts: 9
Threads: 3
Joined: Jan 2013
|
|
RE: Price breaks depending on quantity
We would like to use WebERP for our electronics manufacturing purchasing hooked up with Octopart and this for us is certainly a killer feature as prices can vary widely across breaks of 10,100,1k pcs.
Phil - to implement purchasing price breaks in a WebERP database friendly way what would need to be done (and we can maybe have a tinker...  )
|
|
05-27-2016, 04:48 PM,
|
|
richieeeee
Member
 
|
Posts: 9
Threads: 3
Joined: Jan 2013
|
|
RE: Price breaks depending on quantity
(05-19-2016, 08:10 AM)phil Wrote: Well this is really what the discount matrix is about ...
Hey Phil any thoughts about the purchasing side of things ?
|
|
05-27-2016, 07:58 PM,
|
|
TimSchofield
Tim Schofield
      
|
Posts: 1,319
Threads: 22
Joined: Mar 2015
|
|
RE: Price breaks depending on quantity
It's not too hard to do this, but requires a few changes:
Firstly you need a new field in the purchdata table something like:
ALTER TABLE purchdata ADD COLUMN qtygreaterthan DOUBLE NOT NULL DEFAULT 0.0 AFTER price;
Then you need to change the primary key to include this field
ALTER TABLE purchdata DROP PRIMARY KEY;
ALTER TABLE purchdata ADD PRIMARY KEY (`supplierno`, `stockid` , `effectivefrom`, `qtygreaterthan`);
Then change the PurchData.php script to enable you to add values to this field. The only gotcha I found here was making sure you deal with the case where you are updating rather than inserting and the qtygreaterthan field was changing, but this is something of an edge case. So now I have data like this:
| supplierno | stockid | price | qtygreaterthan
+------------+---------+----------+----------------+--------------+
| 412001 | CB11 | 100.0000 | 0 |
| 412001 | CB11 | 110.0000 | 100 |
| 412001 | CB11 | 120.0000 | 200 |
Then in PO_Items.php you need to alter the sql at about line 586 to be the following:
$SQL = "SELECT price,
conversionfactor,
supplierdescription,
suppliersuom,
suppliers_partno,
leadtime,
MAX(purchdata.effectivefrom) AS latesteffectivefrom
FROM purchdata
WHERE purchdata.supplierno = '" . $_SESSION['PO' . $Identifier]->SupplierID . "'
AND purchdata.effectivefrom <=CURRENT_DATE
AND purchdata.stockid = '" . $ItemCode . "'
AND qtygreaterthan<'" . $Quantity . "'
GROUP BY purchdata.price,
purchdata.conversionfactor,
purchdata.supplierdescription,
purchdata.suppliersuom,
purchdata.suppliers_partno,
purchdata.leadtime
ORDER BY latesteffectivefrom DESC,
qtygreaterthan DESC LIMIT 1";
This should now select the correct the price when you insert a new item. What it doesn't currently do is alter the price if you change the quantity on an order and then update. This obviously depends on the company workflow - should the person entering the order manually alter the price would you want that overridden?
There are a number of reports/inquiries that would then need to be altered but the above should be enough to get you going. If you want the full diff (it's way too big to post here) then contact me privately.
Thanks
Tim
|
|
|