webERP Forum

Full Version: Price breaks depending on quantity
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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!
You can set this up in the sales side using the discount matrix. However, we don't have the functionality on the purchasing side
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" Smile

Thanks again!
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... Smile )
Well this is really what the discount matrix is about ... if you get into a 100 prices the general price changes can get quite horrific. However, judicious use of discount matrices can make this whole nightmare much more manageable. The price increases and the discount % remains the same for all customers specific discount matrix set up ... change the 1 price and all customer prices after discount are updated .... VERY cool... but it needs discipline in marketing - yes VERY difficult for such types ... but when explained the virtues of this approach as a way to manage customer net pricing far out weigh the simplistic headline price changes and having a ridiculous number of prices to manage ... that you just can't!!
So more a management philosophy than a specific answer to your question - but I want webERP to be about best business practice. Yes you build in tools to work in a less efficient way.... but me not so interested sorry.

(edit: sorry was thinking about the sales price here)
Hi,
There is a price matrix for each item now. Just check the select product interface.
I think it is each to extend this feature to purchasing side.
Thanks and best regards!

Exson
This came up today at our company. I was considering altering the query on purchdata in PO_Items.php to include check on the Min Quantity field as a short term fix. Only select those where min qty >= qty on order line.
(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 ?
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
I got around the issue of updating by adding a "Refresh Prices" button to POItems.php

Tim
Pages: 1 2
Reference URL's