get supplier prices - what is the right behavior?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

get supplier prices - what is the right behavior?

Si Chen-2
Hey everybody--

Something else interesting we encountered: when I wrote  
getSuppliersForProduct a couple of years ago for purchasing, I had it  
always return the lowest price of all the ones whose  
minimumOrderQuantity < orderQuantity.  This may not be the largest  
minimumOrderQuantity below orderQuantity, however, so you might get  
weird behavior like this:

0 - 1000  $1.00
1000 - 2000 $1.25
2000+  $1.50

In this case, if you try to order $2500, your price will be $1.00,  
even though it should actually be $1.50 with this price schedule.  
This price schedule might actually be the case for certain  
commodities, so now I think it's a bug.  The change is actually very  
simple in SupplierServices.java:
-            supplierProducts = EntityUtil.orderBy(supplierProducts,  
UtilMisc.toList("lastPrice ASC"));
+            supplierProducts = EntityUtil.orderBy(supplierProducts,  
UtilMisc.toList("minimumOrderQuantity DESC"));


Best Regards,

Si
[hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: get supplier prices - what is the right behavior?

David E Jones-2

Hmmm... I haven't reviewed this code in detail but what it sounds  
like is selecting the appropriate SupplierProduct record to use  
should include some more constraint checking and not just a different  
ordering.

-David


On Nov 21, 2006, at 10:42 PM, Si Chen wrote:

> Hey everybody--
>
> Something else interesting we encountered: when I wrote  
> getSuppliersForProduct a couple of years ago for purchasing, I had  
> it always return the lowest price of all the ones whose  
> minimumOrderQuantity < orderQuantity.  This may not be the largest  
> minimumOrderQuantity below orderQuantity, however, so you might get  
> weird behavior like this:
>
> 0 - 1000  $1.00
> 1000 - 2000 $1.25
> 2000+  $1.50
>
> In this case, if you try to order $2500, your price will be $1.00,  
> even though it should actually be $1.50 with this price schedule.  
> This price schedule might actually be the case for certain  
> commodities, so now I think it's a bug.  The change is actually  
> very simple in SupplierServices.java:
> -            supplierProducts = EntityUtil.orderBy
> (supplierProducts, UtilMisc.toList("lastPrice ASC"));
> +            supplierProducts = EntityUtil.orderBy
> (supplierProducts, UtilMisc.toList("minimumOrderQuantity DESC"));
>
>
> Best Regards,
>
> Si
> [hidden email]
>
>
>