diff --git a/posterita/src/main/org/posterita/businesslogic/CommissionManager.java b/posterita/src/main/org/posterita/businesslogic/CommissionManager.java index b6547c54a1..4a783a1b77 100644 --- a/posterita/src/main/org/posterita/businesslogic/CommissionManager.java +++ b/posterita/src/main/org/posterita/businesslogic/CommissionManager.java @@ -162,16 +162,24 @@ public class CommissionManager "camt.ACTUALQTY," +//5 "camt.COMMISSIONAMT," +//6 "cline.DESCRIPTION," +//7 - "DECODE(com.FREQUENCYTYPE,'"+MCommission.FREQUENCYTYPE_Monthly+"','Monthly','"+ - MCommission.FREQUENCYTYPE_Quarterly+"','Quarterly','"+ - MCommission.FREQUENCYTYPE_Weekly+"','Weekly','"+ - MCommission.FREQUENCYTYPE_Yearly+"','Yearly',com.FREQUENCYTYPE) frequency," +//8 - "DECODE(com.DOCBASISTYPE,'"+MCommission.DOCBASISTYPE_Invoice+"','Invoice','"+ - MCommission.DOCBASISTYPE_Order+"','Order','"+ - MCommission.DOCBASISTYPE_Receipt+"','Payment Receipt',com.DOCBASISTYPE) docbasis," +//9 + //"DECODE(com.FREQUENCYTYPE,'"+MCommission.FREQUENCYTYPE_Monthly+"','Monthly','"+ + "CASE WHEN com.FREQUENCYTYPE='"+MCommission.FREQUENCYTYPE_Monthly+"' THEN 'Monthly' "+ + //MCommission.FREQUENCYTYPE_Quarterly+"','Quarterly','"+ + " WHEN com.FREQUENCYTYPE='"+MCommission.FREQUENCYTYPE_Quarterly+"' THEN 'Quarterly' "+ + //MCommission.FREQUENCYTYPE_Weekly+"','Weekly','"+ + " WHEN com.FREQUENCYTYPE='"+MCommission.FREQUENCYTYPE_Weekly+"' THEN 'Weekly' "+ + //MCommission.FREQUENCYTYPE_Yearly+"','Yearly',com.FREQUENCYTYPE) frequency," +//8 + " WHEN com.FREQUENCYTYPE='"+MCommission.FREQUENCYTYPE_Yearly+"' THEN 'Yearly' ELSE com.FREQUENCYTYPE END AS frequency," +//8 + //"DECODE(com.DOCBASISTYPE,'"+MCommission.DOCBASISTYPE_Invoice+"','Invoice','"+ + "CASE WHEN com.DOCBASISTYPE ='"+MCommission.DOCBASISTYPE_Invoice+"' THEN 'Invoice' "+ + //MCommission.DOCBASISTYPE_Order+"','Order','"+ + " WHEN com.DOCBASISTYPE ='"+MCommission.DOCBASISTYPE_Order+"' THEN 'Order' "+ + //MCommission.DOCBASISTYPE_Receipt+"','Payment Receipt',com.DOCBASISTYPE) docbasis," +//9 + " WHEN com.DOCBASISTYPE ='"+MCommission.DOCBASISTYPE_Receipt+"' THEN 'Payment Receipt' ELSE com.DOCBASISTYPE END AS docbasis," +//9 "cline.AMTMULTIPLIER*100, "+//10 "crun.DESCRIPTION,"+//11 - "nvl(cline.AMTSUBTRACT,0)"+//12 + //"nvl(cline.AMTSUBTRACT,0)"+//12 + "COALESCE(cline.AMTSUBTRACT,0)"+//12 " from C_COMMISSIONAMT camt, C_COMMISSIONLINE cline,C_COMMISSION com,C_COMMISSIONRUN crun " + " where camt.C_COMMISSIONLINE_ID=cline.C_COMMISSIONLINE_ID"+ " and cline.C_COMMISSION_ID=com.C_COMMISSION_ID"+ diff --git a/posterita/src/main/org/posterita/businesslogic/CreditOrderManager.java b/posterita/src/main/org/posterita/businesslogic/CreditOrderManager.java index 436f7fc24f..25e32e26a7 100644 --- a/posterita/src/main/org/posterita/businesslogic/CreditOrderManager.java +++ b/posterita/src/main/org/posterita/businesslogic/CreditOrderManager.java @@ -197,8 +197,10 @@ public class CreditOrderManager "pt.NAME,"+//19 "bp.name|| ' ' || bp.name2,"+//20 "op.C_BPARTNER_ID,"+//21 - "DECODE(ord.GRANDTOTAL-nvl(sum(cl.AMOUNT),0),0,'"+Constants.PAID+"',ord.GRANDTOTAL,'"+Constants.UNPAID+"','"+Constants.PARTIALLY_PAID+"') status,"+//22 - " DECODE(sign(op.OPENAMT),-1,'"+Constants.OVER_PAID+"','NULL') sign"+//23 + //"DECODE(ord.GRANDTOTAL-nvl(sum(cl.AMOUNT),0),0,'"+Constants.PAID+"',ord.GRANDTOTAL,'"+Constants.UNPAID+"','"+Constants.PARTIALLY_PAID+"') status,"+//22 + " CASE WHEN ord.GRANDTOTAL-COALESCE(sum(cl.AMOUNT),0) = 0 THEN '"+Constants.PAID+"' WHEN ord.GRANDTOTAL-COALESCE(sum(cl.AMOUNT),0) = ord.GRANDTOTAL THEN '"+Constants.UNPAID+"' ELSE '"+Constants.PARTIALLY_PAID+"' END AS status,"+//22 + //" DECODE(sign(op.OPENAMT),-1,'"+Constants.OVER_PAID+"','NULL') sign"+//23 + " CASE WHEN sign(op.OPENAMT) = -1 THEN '"+Constants.OVER_PAID+"' ELSE 'NULL' END AS sign"+//23 " from RV_OPENITEM op left outer join c_cashline cl on op.C_INVOICE_ID=cl.C_INVOICE_ID,C_ORDER ord,C_CURRENCY cr,C_PAYMENTTERM pt,c_bpartner bp " + " where op.C_ORDER_ID=ord.C_ORDER_ID"+ " and op.C_CURRENCY_ID=cr.C_CURRENCY_ID"+ @@ -362,7 +364,8 @@ public class CreditOrderManager " CREATED," +//3 "C_BPARTNER_ID," +//4 "C_INVOICE_ID," +//5 - "DECODE(TENDERTYPE,'K','Cheque','C','Card','Cash') tenderType," +//6 + //"DECODE(TENDERTYPE,'K','Cheque','C','Card','Cash') tenderType," +//6 + "CASE WHEN TENDERTYPE='K' THEN 'Cheque' WHEN TENDERTYPE= 'C' THEN 'Card' ELSE 'Cash' END AS tenderType," +//6 "PAYAMT," +//7 "DISCOUNTAMT,"+//8 "WRITEOFFAMT," +//9 @@ -602,8 +605,10 @@ public class CreditOrderManager "CREATEDBY," +//3 "DOCUMENTNO," +//4 "C_INVOICE_ID," +//5 - "decode(TENDERTYPE,'"+MPayment.TENDERTYPE_Check+"','Cheque','" + - MPayment.TENDERTYPE_CreditCard+"','Card')," +//6 + //"decode(TENDERTYPE,'"+MPayment.TENDERTYPE_Check+"','Cheque','" + + "CASE WHEN TENDERTYPE='"+MPayment.TENDERTYPE_Check+"' THEN 'Cheque' " + + //MPayment.TENDERTYPE_CreditCard+"','Card')," +//6 + " WHEN TENDERTYPE='"+MPayment.TENDERTYPE_CreditCard+"' THEN 'Card' END ," +//6 "CREDITCARDNUMBER," +//7 "CHECKNO," +//8 "PAYAMT," +//9 diff --git a/posterita/src/main/org/posterita/businesslogic/InventoryManager.java b/posterita/src/main/org/posterita/businesslogic/InventoryManager.java index e7d525b841..1ea61a1866 100644 --- a/posterita/src/main/org/posterita/businesslogic/InventoryManager.java +++ b/posterita/src/main/org/posterita/businesslogic/InventoryManager.java @@ -262,7 +262,8 @@ public class InventoryManager "DOCUMENTNO," +//2 "to_char(MOVEMENTDATE,'dd/Mon/yyyy')," +//3 " description," +//5 - "DECODE(DOCSTATUS,'CO','Completed','DR','Drafted',DOCSTATUS) status" +//4 + //"DECODE(DOCSTATUS,'CO','Completed','DR','Drafted',DOCSTATUS) status" +//4 + " CASE WHEN DOCSTATUS='CO' THEN 'Completed' WHEN DOCSTATUS='DR' THEN 'Drafted' ELSE DOCSTATUS END AS status" +//4 " from M_inventory" + " where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ " and ad_org_id="+Env.getAD_Org_ID(ctx)+ diff --git a/posterita/src/main/org/posterita/businesslogic/InvoiceManager.java b/posterita/src/main/org/posterita/businesslogic/InvoiceManager.java index a5b3872ed9..b27073e4c3 100644 --- a/posterita/src/main/org/posterita/businesslogic/InvoiceManager.java +++ b/posterita/src/main/org/posterita/businesslogic/InvoiceManager.java @@ -488,7 +488,8 @@ public class InvoiceManager extends AbstractDocumentManager " inv.C_ORDER_ID,"+ //6 " inv.DATEINVOICED,"+ //7 " inv.GRANDTOTAL,"+ //8 - " decode(inv.ISPAID,'N','No','Y','Yes') isPaid"); //9 + //" decode(inv.ISPAID,'N','No','Y','Yes') isPaid"); //9 + " CASE WHEN inv.ISPAID = 'N' THEN 'No' WHEN inv.ISPAID='Y' THEN 'Yes' ELSE isPaid END"); //9 from.append(" from C_INVOICE inv,C_BPARTNER bp"); diff --git a/posterita/src/main/org/posterita/businesslogic/POSBpartnerInfoManager.java b/posterita/src/main/org/posterita/businesslogic/POSBpartnerInfoManager.java index 74b495486c..e6db697238 100644 --- a/posterita/src/main/org/posterita/businesslogic/POSBpartnerInfoManager.java +++ b/posterita/src/main/org/posterita/businesslogic/POSBpartnerInfoManager.java @@ -85,31 +85,41 @@ public class POSBpartnerInfoManager { + // 13 "bp.FIRSTSALE, " + // 14 - "DECODE(bp.SOCREDITSTATUS,'" + //"DECODE(bp.SOCREDITSTATUS,'" + "CASE WHEN bp.SOCREDITSTATUS='" + MBPartner.SOCREDITSTATUS_CreditHold - + "','" + //+ "','" + + "' THEN '" + Constants.CREDIT_HOLD - + "'," - + "'" + //+ "'," + //+ "'" + + "' WHEN bp.SOCREDITSTATUS='" + MBPartner.SOCREDITSTATUS_CreditStop - + "','" + //+ "','" + + "' THEN '" + Constants.CREDIT_STOP - + "'," - + "'" + //+ "'," + + "' WHEN bp.SOCREDITSTATUS='" + MBPartner.SOCREDITSTATUS_NoCreditCheck - + "','" + //+ "','" + + "' THEN '" + Constants.NO_CREDIT_CHECK - + "'," - + "'" + //+ "'," + + "' WHEN bp.SOCREDITSTATUS='" + //+ "'" + MBPartner.SOCREDITSTATUS_CreditOK - + "','" + //+ "','" + + "' THEN '" + Constants.CREDIT_OK - + "'," - + "'" + //+ "'," + + "' WHEN bp.SOCREDITSTATUS='" + //+ "'" + MBPartner.SOCREDITSTATUS_CreditWatch - + "','" + //+ "','" + + "' THEN '" + Constants.CREDIT_WATCH - + "',bp.SOCREDITSTATUS) creditStatus" + //+ "',bp.SOCREDITSTATUS) creditStatus" + + "' ELSE bp.SOCREDITSTATUS END AS creditStatus" + // 15 " from C_BPARTNER bp left join (C_BPARTNER_LOCATION bploc left join C_LOCATION loc on bploc.c_location_id=loc.c_location_id)" + " on bp.C_BPARTNER_ID=bploc.C_BPARTNER_ID" diff --git a/posterita/src/main/org/posterita/businesslogic/POSReportManager.java b/posterita/src/main/org/posterita/businesslogic/POSReportManager.java index 9ce187d1b3..e1da3d513e 100644 --- a/posterita/src/main/org/posterita/businesslogic/POSReportManager.java +++ b/posterita/src/main/org/posterita/businesslogic/POSReportManager.java @@ -488,7 +488,8 @@ public class POSReportManager { "ord.docStatus, " + // 6 " ord.paymentrule," + // 7 " bp.C_BPARTNER_ID," + // 8 - " DECODE(bp.isCustomer,'N','No','Y','Yes','No') isCustomer," + // 9 + //" DECODE(bp.isCustomer,'N','No','Y','Yes','No') isCustomer," + // 9 + " CASE WHEN bp.isCustomer = 'N' THEN 'No' WHEN bp.isCustomer = 'Y' THEN 'Yes' ELSE 'No' END AS isCustomer," + //9 " ord.ORDERTYPE " + // 10 " from c_order ord,C_BPARTNER bp" + " where ord.C_BPARTNER_ID=bp.C_BPARTNER_ID" @@ -812,19 +813,27 @@ public class POSReportManager { throw new UnsupportedDatabaseException( "Operation GetSalesAnalysisReport is not supported on Database: " + DB.getDatabase().getName()); - String sql = "select DECODE(grouping(bp.name),1,'Total',bp.name) Dealer," + String sql = + //"select DECODE(grouping(bp.name),1,'Total',bp.name) Dealer," + "select CASE WHEN grouping(bp.name) = 1 THEN 'Total' ELSE bp.name END AS Dealer," + // 1 - " DECODE(grouping(pc.name),1,bp.name || ' ' ||'Total',pc.name) revenueRecog," + //" DECODE(grouping(pc.name),1,bp.name || ' ' ||'Total',pc.name) revenueRecog," + " CASE WHEN grouping(pc.name) = 1 THEN bp.name || ' ' ||'Total' ELSE pc.name END AS revenueRecog," + // 2 - "DECODE(grouping(attr_brand),1,pc.name|| ' ' || 'Total',attr_brand) brand," + //"DECODE(grouping(attr_brand),1,pc.name|| ' ' || 'Total',attr_brand) brand," + " CASE WHEN grouping(attr_brand) = 1 THEN pc.name|| ' ' || 'Total' ELSE attr_brand END AS brand," + // 3 - "DECODE(grouping(attr_model),1,attr_brand|| ' ' || 'Total',attr_model) Model," + //"DECODE(grouping(attr_model),1,attr_brand|| ' ' || 'Total',attr_model) Model," + "CASE WHEN grouping(attr_model) = 1 THEN attr_brand|| ' ' || 'Total' ELSE attr_model END AS Model," + // 4 - "DECODE(grouping(attr_design),1,attr_model|| ' ' || 'Total',attr_design) Design," + //"DECODE(grouping(attr_design),1,attr_model|| ' ' || 'Total',attr_design) Design," + "CASE WHEN grouping(attr_design) = 1 THEN attr_model|| ' ' || 'Total' ELSE attr_design END AS Design," + // 5 - "DECODE(grouping(attr_colour),1,attr_design|| ' ' || 'Total',attr_colour) colour," + //"DECODE(grouping(attr_colour),1,attr_design|| ' ' || 'Total',attr_colour) colour," + "CASE WHEN (grouping(attr_colour) = 1 THEN attr_design|| ' ' || 'Total' ELSE attr_colour END AS colour," + // 6 - "DECODE(grouping(attr_size),1,attr_colour|| ' ' || 'Total',attr_size) Size1," + //"DECODE(grouping(attr_size),1,attr_colour|| ' ' || 'Total',attr_size) Size1," + "CASE WHEN grouping(attr_size) = 1 THEN attr_colour|| ' ' || 'Total' ELSE attr_size END AS Size1," + // 7 "sum(ol.qtyordered)," + // 8 diff --git a/posterita/src/main/org/posterita/businesslogic/PaymentTermManager.java b/posterita/src/main/org/posterita/businesslogic/PaymentTermManager.java index 78c882db61..b97053c7ed 100644 --- a/posterita/src/main/org/posterita/businesslogic/PaymentTermManager.java +++ b/posterita/src/main/org/posterita/businesslogic/PaymentTermManager.java @@ -54,9 +54,12 @@ public class PaymentTermManager " C_PAYMENTTERM_ID," +//1 " NAME," +//2 " NETDAYS,"+//3 - " DECODE(isActive,'Y','true','false') active,"+//4 - " DECODE(AFTERDELIVERY,'Y','true','false') delivery,"+//5 - " DECODE(ISDUEFIXED,'Y','true','false') dueFixed,"+//6 + " CASE WHEN isActive = 'Y' THEN 'true' ELSE 'false' END AS active ," + + //" DECODE(isActive,'Y','true','false') active,"+//4 + " CASE WHEN AFTERDELIVERY = 'Y' THEN 'true' ELSE 'false' END AS delivery," + + //" DECODE(AFTERDELIVERY,'Y','true','false') delivery,"+//5 + " CASE WHEN ISDUEFIXED = 'Y' THEN 'true' ELSE 'false' END AS dueFixed," + + //" DECODE(ISDUEFIXED,'Y','true','false') dueFixed,"+// " FIXMONTHCUTOFF,"+//7 " FIXMONTHDAY,"+//8 " FIXMONTHOFFSET"+//9 @@ -218,9 +221,12 @@ public class PaymentTermManager " C_PAYMENTTERM_ID," +//1 " NAME," +//2 " NETDAYS,"+//3 - " DECODE(isActive,'Y','true','false') active,"+//4 - " DECODE(AFTERDELIVERY,'Y','true','false') delivery,"+//5 - " DECODE(ISDUEFIXED,'Y','true','false') dueFixed,"+//6 + //" DECODE(isActive,'Y','true','false') active,"+//4 + " CASE WHEN isActive='Y' THEN 'true' ELSE 'false' END AS active,"+//4 + //" DECODE(AFTERDELIVERY,'Y','true','false') delivery,"+//5 + " CASE WHEN AFTERDELIVERY = 'Y' THEN 'true' ELSE 'false' END AS delivery,"+//5 + //" DECODE(ISDUEFIXED,'Y','true','false') dueFixed,"+//6 + " CASE WHEN ISDUEFIXED = 'Y' THEN 'true' ELSE 'false' END AS dueFixed,"+//6 " FIXMONTHCUTOFF,"+//7 " FIXMONTHDAY,"+//8 " FIXMONTHOFFSET,"+//9 diff --git a/posterita/src/main/org/posterita/businesslogic/SalesAnalysisReportManager.java b/posterita/src/main/org/posterita/businesslogic/SalesAnalysisReportManager.java index eda5e7957d..4a607eb1d0 100644 --- a/posterita/src/main/org/posterita/businesslogic/SalesAnalysisReportManager.java +++ b/posterita/src/main/org/posterita/businesslogic/SalesAnalysisReportManager.java @@ -248,7 +248,8 @@ public class SalesAnalysisReportManager if(salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)) { sql = "" + - "select DECODE(rev.NAME, null, 'others', rev.Name) \"Revenue_Recognition\"," + //1.Revenue Recognition + //"select DECODE(rev.NAME, null, 'others', rev.Name) \"Revenue_Recognition\"," + //1.Revenue Recognition + "select CASE WHEN rev.NAME = null THEN 'others' ELSE rev.Name END AS \"Revenue_Recognition\"," + //1.Revenue Recognition "to_char(fact.DATEACCT,'DD-MON-YYYY') as \"Date\"," + //2.Date "SUM(fact.AMTACCTCR-fact.AMTACCTDR) as \"Value\"," + //3.Value " SUM(0 - FACT.QTY) as \"Qty\" " + //4.Qty @@ -268,7 +269,8 @@ public class SalesAnalysisReportManager else if(salesGroup.equalsIgnoreCase(Constants.ATTRIBUTESET)) { sql = "" + - " select DECODE(attrSet.NAME, null, 'others', attrSet.NAME) \"Attributeset\"," + //1.Attributeset + //" select DECODE(attrSet.NAME, null, 'others', attrSet.NAME) \"Attributeset\"," + //1.Attributeset + " select CASE WHEN attrSet.NAME = null THEN 'others' ELSE attrSet.NAME END AS \"Attributeset\"," + //1.Attributeset " to_char(fact.DATEACCT,'DD-MON-YYYY') as \"Date\"," + //2.Date " SUM(fact.AMTACCTCR-fact.AMTACCTDR) as \"Value\"," + //3.Value " SUM(0 - FACT.QTY) as \"Qty\" " + //4.Qty @@ -309,7 +311,8 @@ public class SalesAnalysisReportManager else if(salesGroup.equalsIgnoreCase(Constants.GROUP1)) { sql = "" + - " select DECODE(PROD.GROUP1, null, 'Ungroup', PROD.GROUP1) \"Group1\"," + //1.Product + //" select DECODE(PROD.GROUP1, null, 'Ungroup', PROD.GROUP1) \"Group1\"," + //1.Product + " select CASE WHEN PROD.GROUP1 = null THEN 'Ungroup' ELSE PROD.GROUP1 END AS \"Group1\"," + //1.Product " to_char(fact.DATEACCT,'DD-MON-YYYY') as \"Date\"," + //3.Date " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //4.Value " SUM(0 - FACT.QTY) as \"Qty\" " + //5.Qty @@ -328,7 +331,8 @@ public class SalesAnalysisReportManager else if(salesGroup.equalsIgnoreCase(Constants.GROUP2)) { sql = "" + - " select DECODE(PROD.GROUP2, null, 'Ungroup', PROD.GROUP2) \"Group2\"," + //1.Product + //" select DECODE(PROD.GROUP2, null, 'Ungroup', PROD.GROUP2) \"Group2\"," + //1.Product + " select CASE WHEN PROD.GROUP2 = null THEN 'Ungroup' ELSE PROD.GROUP2 END AS \"Group2\"," + //1.Product " to_char(fact.DATEACCT,'DD-MON-YYYY') as \"Date\"," + //3.Date " SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\"," + //4.Value " SUM(0 - FACT.QTY) as \"Qty\" " + //5.Qty @@ -471,7 +475,8 @@ public class SalesAnalysisReportManager if(salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)) { - sql = "select DECODE(rev.NAME, null, 'others', rev.Name) RevenueRecognition,SUM(fact.AMTACCTCR - fact.AMTACCTDR) as Revenue_Recognition,SUM(0-fact.QTY) as Qty " + + //sql = "select DECODE(rev.NAME, null, 'others', rev.Name) RevenueRecognition,SUM(fact.AMTACCTCR - fact.AMTACCTDR) as Revenue_Recognition,SUM(0-fact.QTY) as Qty " + + sql = "select CASE WHEN rev.NAME = null THEN 'others' ELSE rev.Name END AS RevenueRecognition,SUM(fact.AMTACCTCR - fact.AMTACCTDR) as Revenue_Recognition,SUM(0-fact.QTY) as Qty " + "from FACT_ACCT fact, (M_PRODUCT prod right outer join C_REVENUERECOGNITION rev on rev.C_REVENUERECOGNITION_ID = prod.C_REVENUERECOGNITION_ID) " + "where fact.ACCOUNT_ID = " + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id+") " + @@ -517,7 +522,8 @@ public class SalesAnalysisReportManager } else if(salesGroup.equalsIgnoreCase(Constants.GROUP1)) { - sql = "select DECODE(PROD.GROUP1, null, 'Ungrouped', PROD.GROUP1) \"Group1\",SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\",SUM(0 - FACT.QTY) as \"Qty\" " + + //sql = "select DECODE(PROD.GROUP1, null, 'Ungrouped', PROD.GROUP1) \"Group1\",SUM(FACT.AMTACCTCR - FACT.AMTACC//TDR) as \"Value\",SUM(0 - FACT.QTY) as \"Qty\" " + + sql = "select CASE WHEN PROD.GROUP1 = null THEN 'Ungrouped' ELSE PROD.GROUP1 END AS \"Group1\",SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\",SUM(0 - FACT.QTY) as \"Qty\" " + "from FACT_ACCT FACT, M_PRODUCT PROD " + "where FACT.ACCOUNT_ID = " + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + @@ -531,7 +537,8 @@ public class SalesAnalysisReportManager } else if(salesGroup.equalsIgnoreCase(Constants.GROUP2)) { - sql = "select DECODE(PROD.GROUP2, null, 'Ungrouped', PROD.GROUP2) \"Group2\",SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\",SUM(0 - FACT.QTY) as \"Qty\" " + + //sql = "select DECODE(PROD.GROUP2, null, 'Ungrouped', PROD.GROUP2) \"Group2\",SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\",SUM(0 - FACT.QTY) as \"Qty\" " + + sql = "select CASE WHEN PROD.GROUP2 = null THEN 'Ungrouped' ELSE PROD.GROUP2 END AS \"Group2\",SUM(FACT.AMTACCTCR - FACT.AMTACCTDR) as \"Value\",SUM(0 - FACT.QTY) as \"Qty\" " + "from FACT_ACCT FACT, M_PRODUCT PROD " + "where FACT.ACCOUNT_ID = " + "(select C_ELEMENTVALUE_ID from C_ELEMENTVALUE where value = '"+account_id+"' and AD_CLIENT_ID = "+ad_client_id +") " + @@ -622,7 +629,8 @@ public class SalesAnalysisReportManager if(salesGroup.equalsIgnoreCase(Constants.REVENUE_RECOGNITION)) { sql = "" + - "select DECODE(rev.NAME, null, 'others', rev.Name) RevenueRecognition," + //1.Revenue Recognition + //"select DECODE(rev.NAME, null, 'others', rev.Name) RevenueRecognition," + //1.Revenue Recognition + "select CASE WHEN rev.NAME = null THEN 'others' ELSE rev.Name END AS RevenueRecognition," + //1.Revenue Recognition "to_char(fact.DATEACCT,'DD-MON-YYYY')," + //2.Date "SUM(fact.AMTACCTCR-fact.AMTACCTDR) as REVENUE," + //3.Value "SUM(0-fact.QTY) " + //4.Qty diff --git a/posterita/src/main/org/posterita/businesslogic/TaxManager.java b/posterita/src/main/org/posterita/businesslogic/TaxManager.java index 44b6d7ee6d..c591adb6fb 100644 --- a/posterita/src/main/org/posterita/businesslogic/TaxManager.java +++ b/posterita/src/main/org/posterita/businesslogic/TaxManager.java @@ -239,7 +239,8 @@ public class TaxManager public static ArrayList getAllTaxRates(Properties ctx,boolean isActive) throws OperationException { String sql="select C_TAX_ID,NAME,DESCRIPTION,RATE,ISTAXEXEMPT," + - " DECODE(isActive,'Y','true','false') active"+ + //" DECODE(isActive,'Y','true','false') active"+ + " CASE WHEN isActive='Y' THEN 'true' ELSE 'false' END AS active"+ " from C_Tax" + " where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ " and AD_ORG_ID="+Env.getAD_Org_ID(ctx); @@ -287,7 +288,8 @@ public class TaxManager public static TaxBean getTaxRate(Properties ctx,int taxId) throws OperationException { String sql="select C_TAX_ID,NAME,DESCRIPTION,RATE,ISTAXEXEMPT," + - " DECODE(isActive,'Y','true','false') active"+ + //" DECODE(isActive,'Y','true','false') active"+ + " CASE WHEN isActive='Y' THEN 'true' ELSE 'false' END AS active"+ " from C_Tax" + " where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ " and AD_ORG_ID="+Env.getAD_Org_ID(ctx)+ diff --git a/posterita/src/main/org/posterita/businesslogic/UDIMessageManager.java b/posterita/src/main/org/posterita/businesslogic/UDIMessageManager.java index e2c6787189..fe028e8a1f 100644 --- a/posterita/src/main/org/posterita/businesslogic/UDIMessageManager.java +++ b/posterita/src/main/org/posterita/businesslogic/UDIMessageManager.java @@ -52,7 +52,8 @@ public class UDIMessageManager " msg.created," + //4 " org.name, " + //5 " msg.AD_ORG_ID," + //6 - " decode(msg.U_READ,'Y','true','false')" + //7 + //" decode(msg.U_READ,'Y','true','false')" + //7 + " CASE WHEN msg.U_READ='Y' THEN 'true' ELSE 'false' END" + //7 " from U_MESSAGE msg " + " join AD_ORG org ON org.AD_ORG_ID = msg.AD_ORG_ID " + " where msg.C_AD_ORG_ID =" + strOrgID + @@ -144,7 +145,8 @@ public class UDIMessageManager " msg.created," + //4 " org.name, " + //5 " msg.AD_ORG_ID," + //6 - " decode(msg.U_READ,'Y','true','false')" + //7 + //" decode(msg.U_READ,'Y','true','false')" + //7 + " CASE WHEN msg.U_READ='Y' THEN 'true' ELSE 'false' END" + //7 " from U_MESSAGE msg " + " join AD_ORG org ON org.AD_ORG_ID = msg.C_AD_ORG_ID " + " where msg.AD_ORG_ID =" + strOrgID + diff --git a/posterita/src/main/org/posterita/model/UDIMMovementLineOverride.java b/posterita/src/main/org/posterita/model/UDIMMovementLineOverride.java index fef5fccd7e..f6469b1ff6 100644 --- a/posterita/src/main/org/posterita/model/UDIMMovementLineOverride.java +++ b/posterita/src/main/org/posterita/model/UDIMMovementLineOverride.java @@ -23,7 +23,7 @@ public class UDIMMovementLineOverride extends MMovementLine // Set Line No if (getLine() == 0) { - String sql = "SELECT COALESCE(MAX(Line),0)+10 AS DefaultValue FROM M_MovementLine WHERE M_Movement_ID=?"; + String sql = "SELECT NVL(MAX(Line),0)+10 AS DefaultValue FROM M_MovementLine WHERE M_Movement_ID=?"; int ii = DB.getSQLValue (get_TrxName(), sql, getM_Movement_ID()); setLine (ii); } diff --git a/posterita/src/main/org/posterita/webstore/businesslogic/DocumentHistoryManager.java b/posterita/src/main/org/posterita/webstore/businesslogic/DocumentHistoryManager.java index 0443a59cdf..b4c33429e2 100644 --- a/posterita/src/main/org/posterita/webstore/businesslogic/DocumentHistoryManager.java +++ b/posterita/src/main/org/posterita/webstore/businesslogic/DocumentHistoryManager.java @@ -57,8 +57,10 @@ public class DocumentHistoryManager sql.append(" partner.name2, "); //7.partnerName2 sql.append(" ord.created, "); //8.dateCreated sql.append(" ship.docstatus,"); //9/docStatus - sql.append(" DECODE(pay.docstatus, 'CO', 'Paid', 'Awaiting Payment') paymentStatus,"); - sql.append(" DECODE (ship.docstatus, 'CO', 'Shipped', 'Not Shipped') shipmentStatus,"); + //sql.append(" DECODE(pay.docstatus, 'CO', 'Paid', 'Awaiting Payment') paymentStatus,"); + sql.append(" CASE WHEN pay.docstatus = 'CO' THEN 'Paid' ELSE 'Awaiting Payment' END AS paymentStatus,"); + //sql.append(" DECODE (ship.docstatus, 'CO', 'Shipped', 'Not Shipped') shipmentStatus,"); + sql.append(" CASE WHEN ship.docstatus= 'CO' THEN 'Shipped' ELSE 'Not Shipped' END AS shipmentStatus,"); sql.append(" ord.documentNo,"); sql.append(" inv.documentNo,"); sql.append(" pay.documentNo,");