From da07a6ead8ba699b254b3ec385fb0ac7d180da24 Mon Sep 17 00:00:00 2001 From: mjudd Date: Thu, 26 Apr 2007 15:42:30 +0000 Subject: [PATCH] Feature Request http://sourceforge.net/tracker/index.php?func=detail&aid=1708139&group_id=176962&atid=879335 Add new rounding rule - whole number ending in 9 or 5 --- .../org/compiere/process/M_PriceList_Create.java | 14 ++++++++++++-- migration/316-trunk/010_add_feature_1708139.sql | 10 ++++++++++ .../postgresql/010_add_feature_1708139.sql | 10 ++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 migration/316-trunk/010_add_feature_1708139.sql create mode 100644 migration/316-trunk/postgresql/010_add_feature_1708139.sql diff --git a/base/src/org/compiere/process/M_PriceList_Create.java b/base/src/org/compiere/process/M_PriceList_Create.java index 926b326ff0..96d14cdf61 100644 --- a/base/src/org/compiere/process/M_PriceList_Create.java +++ b/base/src/org/compiere/process/M_PriceList_Create.java @@ -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") + "', " @@ -627,7 +634,10 @@ public class M_PriceList_Create extends SvrProcess { + " 'D', ROUND(PriceLimit, 1), " // Dime .10 + " 'T', ROUND(PriceLimit, -1), " // Ten 10.00 + " '5', ROUND(PriceLimit*20,0)/20, " // Nickle .05 - + " 'Q', ROUND(PriceLimit*4,0)/4, " //Quarter .25 + + " '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=" diff --git a/migration/316-trunk/010_add_feature_1708139.sql b/migration/316-trunk/010_add_feature_1708139.sql new file mode 100644 index 0000000000..3f91890264 --- /dev/null +++ b/migration/316-trunk/010_add_feature_1708139.sql @@ -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; diff --git a/migration/316-trunk/postgresql/010_add_feature_1708139.sql b/migration/316-trunk/postgresql/010_add_feature_1708139.sql new file mode 100644 index 0000000000..3cc93361f7 --- /dev/null +++ b/migration/316-trunk/postgresql/010_add_feature_1708139.sql @@ -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;