Add new rounding rule - whole number ending in 9 or 5
This commit is contained in:
mjudd 2007-04-26 15:42:30 +00:00
parent 61eda5ae7b
commit da07a6ead8
3 changed files with 32 additions and 2 deletions

View File

@ -605,11 +605,15 @@ public class M_PriceList_Create extends SvrProcess {
sqlupd = "UPDATE M_ProductPrice p "
+ " SET PriceList = DECODE('"
+ dl.getString("List_Rounding") + "',"
+ " 'N', PriceList, " + " '0', ROUND(PriceList, 0)," //Even .00
+ " 'N', PriceList, "
+ " '0', ROUND(PriceList, 0)," //Even .00
+ " 'D', ROUND(PriceList, 1)," //Dime .10
+ " 'T', ROUND(PriceList, -1), " //Ten 10.00
+ " '5', ROUND(PriceList*20,0)/20," //Nickle .05
+ " 'Q', ROUND(PriceList*4,0)/4," //Quarter .25
+ " '9', CASE" //Whole 9 or 5
+ " WHEN MOD(ROUND(PriceList),10)<=5 THEN ROUND(PriceList)+(5-MOD(ROUND(PriceList),10))"
+ " WHEN MOD(ROUND(PriceList),10)>5 THEN ROUND(PriceList)+(9-MOD(ROUND(PriceList),10)) END,"
+ " ROUND(PriceList, " + v.getInt("StdPrecision")
+ "))," //Currency
+ " PriceStd = DECODE('" + dl.getString("Std_Rounding")
@ -619,6 +623,9 @@ public class M_PriceList_Create extends SvrProcess {
+ "'T', ROUND(PriceStd, -1)," //Ten 10.00
+ "'5', ROUND(PriceStd*20,0)/20," //Nickle .05
+ "'Q', ROUND(PriceStd*4,0)/4," //Quarter .25
+ " '9', CASE" //Whole 9 or 5
+ " WHEN MOD(ROUND(PriceStd),10)<=5 THEN ROUND(PriceStd)+(5-MOD(ROUND(PriceStd),10))"
+ " WHEN MOD(ROUND(PriceStd),10)>5 THEN ROUND(PriceStd)+(9-MOD(ROUND(PriceStd),10)) END,"
+ "ROUND(PriceStd, " + v.getInt("StdPrecision") + "))," //Currency
+ "PriceLimit = DECODE('"
+ dl.getString("Limit_Rounding") + "', "
@ -628,6 +635,9 @@ public class M_PriceList_Create extends SvrProcess {
+ " 'T', ROUND(PriceLimit, -1), " // Ten 10.00
+ " '5', ROUND(PriceLimit*20,0)/20, " // Nickle .05
+ " 'Q', ROUND(PriceLimit*4,0)/4, " //Quarter .25
+ " '9', CASE" //Whole 9 or 5
+ " WHEN MOD(ROUND(PriceLimit),10)<=5 THEN ROUND(PriceLimit)+(5-MOD(ROUND(PriceLimit),10))"
+ " WHEN MOD(ROUND(PriceLimit),10)>5 THEN ROUND(PriceLimit)+(9-MOD(ROUND(PriceLimit),10)) END,"
+ " ROUND(PriceLimit, " + v.getInt("StdPrecision")
+ ")) " // Currency
+ " WHERE M_PriceList_Version_ID="

View File

@ -0,0 +1,10 @@
-- Feature Request - Allow rounding up of price list (schema) to nearest 5 or 9 unit of currency
-- http://sourceforge.net/tracker/index.php?func=detail&aid=1708139&group_id=176962&atid=879335
INSERT INTO AD_REF_LIST
(ad_ref_list_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby,
value, name, description, ad_reference_id, validfrom, validto, entitytype )
VALUES (1000015, 0, 0, 'Y', TO_DATE('2007-04-26','YYYY-MM-DD'),100, TO_DATE('2007-04-26','YYYY-MM-DD'), 100,
9, 'Ending in 9/5', 'The price ends in either a 5 or 9 whole unit',155,'','','D');
COMMIT;

View File

@ -0,0 +1,10 @@
-- Feature Request - Allow rounding up of price list (schema) to nearest 5 or 9 unit of currency
-- http://sourceforge.net/tracker/index.php?func=detail&aid=1708139&group_id=176962&atid=879335
INSERT INTO AD_REF_LIST
(ad_ref_list_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby,
value, name, description, ad_reference_id, validfrom, validto, entitytype )
VALUES (1000015, 0, 0, 'Y', TO_TIMESTAMP('2007-04-26','YYYY-MM-DD'),100, TO_TIMESTAMP('2007-04-26','YYYY-MM-DD'), 100,
9, 'Ending in 9/5', 'The price ends in either a 5 or 9 whole unit',155,'','','D');
COMMIT;