From cc8e13b32fb574d602abb463dac1dd8f955929cf Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 7 Mar 2011 10:19:08 -0500 Subject: [PATCH] Fix problem in C_OrderLineTax_VT - product name was not printing attributes https://sourceforge.net/tracker/index.php?func=detail&aid=3176222&group_id=176962&atid=879332 --- .../oracle/views/C_ORDER_LINETAX_VT.sql | 2 +- .../postgresql/views/C_ORDER_LINETAX_VT.sql | 2 +- .../oracle/743_FixOrderLineTaxVT.sql | 109 +++++++++++++++++ .../postgresql/743_FixOrderLineTaxVT.sql | 111 ++++++++++++++++++ 4 files changed, 222 insertions(+), 2 deletions(-) create mode 100644 migration/360lts-release/oracle/743_FixOrderLineTaxVT.sql create mode 100644 migration/360lts-release/postgresql/743_FixOrderLineTaxVT.sql diff --git a/db/ddlutils/oracle/views/C_ORDER_LINETAX_VT.sql b/db/ddlutils/oracle/views/C_ORDER_LINETAX_VT.sql index 256e0275eb..d17d6ce462 100644 --- a/db/ddlutils/oracle/views/C_ORDER_LINETAX_VT.sql +++ b/db/ddlutils/oracle/views/C_ORDER_LINETAX_VT.sql @@ -17,7 +17,7 @@ SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol. CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered END AS QtyOrdered, CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered END AS QtyEntered, CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, - COALESCE(pt.Name,c.Name,p.Name||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line + COALESCE(c.Name,COALESCE(pt.Name,p.Name)||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line CASE WHEN COALESCE(c.Name,pt.Name, p.Name) IS NOT NULL THEN ol.Description END AS Description, -- second line COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, diff --git a/db/ddlutils/postgresql/views/C_ORDER_LINETAX_VT.sql b/db/ddlutils/postgresql/views/C_ORDER_LINETAX_VT.sql index 50db7309bd..a03f87e647 100644 --- a/db/ddlutils/postgresql/views/C_ORDER_LINETAX_VT.sql +++ b/db/ddlutils/postgresql/views/C_ORDER_LINETAX_VT.sql @@ -17,7 +17,7 @@ SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol. CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered END AS QtyOrdered, CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered END AS QtyEntered, CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, - COALESCE(pt.Name, c.Name,p.Name||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line + COALESCE(c.Name,COALESCE(pt.Name,p.Name)||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line CASE WHEN COALESCE(c.Name,pt.Name, p.Name) IS NOT NULL THEN ol.Description END AS Description, -- second line COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, diff --git a/migration/360lts-release/oracle/743_FixOrderLineTaxVT.sql b/migration/360lts-release/oracle/743_FixOrderLineTaxVT.sql new file mode 100644 index 0000000000..d17d6ce462 --- /dev/null +++ b/migration/360lts-release/oracle/743_FixOrderLineTaxVT.sql @@ -0,0 +1,109 @@ +CREATE OR REPLACE VIEW C_ORDER_LINETAX_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, C_ORDERLINE_ID, + C_TAX_ID, TAXINDICATOR, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, BPNAME, + C_LOCATION_ID, LINE, M_PRODUCT_ID,VendorProductNo, QTYORDERED, QTYENTERED, + UOMSYMBOL, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, + SKU, PRODUCTVALUE, RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST, + DISCOUNT, PRICEACTUAL, PRICEENTERED, LINENETAMT, PRODUCTDESCRIPTION, + IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, + C_PROJECTTASK_ID) +AS +SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, + uom.AD_Language, + ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, t.TaxIndicator, + ol.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.Name AS BPName, bpl.C_Location_ID, + ol.Line, p.M_Product_ID,po.VendorProductNo, + CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered END AS QtyOrdered, + CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered END AS QtyEntered, + CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, + COALESCE(c.Name,COALESCE(pt.Name,p.Name)||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line + CASE WHEN COALESCE(c.Name,pt.Name, p.Name) IS NOT NULL THEN ol.Description END AS Description, -- second line + COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line + p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, + ra.Description AS ResourceDescription, -- forth line + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 + THEN ol.PriceList END AS PriceList, + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 AND ol.QtyEntered<>0 + THEN ol.PriceList*ol.QtyOrdered/ol.QtyEntered END AS PriceEnteredList, + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList>ol.PriceActual AND ol.PriceList<>0 + THEN (ol.PriceList-ol.PriceActual)/ol.PriceList*100 END AS Discount, + CASE WHEN ol.PriceActual<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceActual END AS PriceActual, + CASE WHEN ol.PriceEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceEntered END AS PriceEntered, + CASE WHEN ol.LineNetAmt<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.LineNetAmt END AS LineNetAmt, + pt.Description as ProductDescription, p.ImageURL, + ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID +FROM C_OrderLine ol + INNER JOIN C_UOM_Trl uom ON (ol.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID) + LEFT OUTER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN M_Product_PO po ON (p.M_Product_ID=po.M_Product_ID AND i.C_BPartner_ID=po.C_BPartner_ID) + LEFT OUTER JOIN M_Product_Trl pt ON (ol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) + LEFT OUTER JOIN S_ResourceAssignment ra ON (ol.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID) + LEFT OUTER JOIN C_Charge_Trl c ON (ol.C_Charge_ID=c.C_Charge_ID AND uom.AD_Language=c.AD_Language) + LEFT OUTER JOIN C_BPartner_Product pp ON (ol.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID) + INNER JOIN C_BPartner bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + LEFT OUTER JOIN C_Tax_Trl t ON (ol.C_Tax_ID=t.C_Tax_ID AND uom.AD_Language=t.AD_Language) +UNION +SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, + uom.AD_Language, + ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, null, + null, null, null, null, + ol.Line+(bl.Line/100) AS Line, p.M_Product_ID,po.VendorProductNo, + --ol.QtyOrdered*b.BOMQty AS QtyInvoiced, + CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyOrdered*bl.QtyBOM ELSE ol.QtyOrdered*(bl.QtyBatch / 100) END AS QtyInvoiced, + --ol.QtyEntered*b.BOMQty AS QtyEntered, + CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyEntered*bl.QtyBOM ELSE ol.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered, + uom.UOMSymbol, + COALESCE(pt.Name, p.Name) AS Name, -- main + b.Description, + COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue, + null, null, null, null, null, null, null, pt.Description AS ProductDescription, p.ImageURL, + ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID +/*FROM M_Product_BOM b -- BOM lines + INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID) + INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product + AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') + INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product + INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN M_Product_Trl pt ON (b.M_ProductBOM_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)*/ +FROM PP_Product_BOM b + INNER JOIN C_ORDERLINE ol ON (b.M_Product_ID=ol.M_Product_ID) + INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID) + INNER JOIN M_PRODUCT bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product + AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') + INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID) + INNER JOIN M_Product p ON (p.M_Product_ID=bl.M_Product_ID) -- BOM line product + LEFT OUTER JOIN M_Product_PO po ON (p.M_Product_ID=po.M_Product_ID AND i.C_BPartner_ID=po.C_BPartner_ID) + INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN M_Product_Trl pt ON (pt.M_Product_ID=bl.M_Product_ID AND uom.AD_Language=pt.AD_Language) +UNION +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + l.AD_Language, o.C_Order_ID, null, null, null, + null, + null, null, null, + null, null, null, null, + null, null,null, + null, null, null, null, null, null, + null, null, null, null, null, null, null, null, + null,null,null,null,null +FROM C_Order o, AD_Language l +WHERE l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y' +UNION +SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.Updated, ot.UpdatedBy, + t.AD_Language, ot.C_Order_ID, null, ot.C_Tax_ID, t.TaxIndicator, + null, null, null, null, + null, null,null, + null, null, null, + t.Name, + null, null, null, null, null, null, + null, null, null, + CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, + CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, + CASE WHEN ot.IsTaxIncluded='Y' THEN NULL ELSE ot.TaxAmt END, + null, null, + null,null,null,null,null +FROM C_OrderTax ot + INNER JOIN C_Tax_Trl t ON (ot.C_Tax_ID=t.C_Tax_ID) +/ diff --git a/migration/360lts-release/postgresql/743_FixOrderLineTaxVT.sql b/migration/360lts-release/postgresql/743_FixOrderLineTaxVT.sql new file mode 100644 index 0000000000..a03f87e647 --- /dev/null +++ b/migration/360lts-release/postgresql/743_FixOrderLineTaxVT.sql @@ -0,0 +1,111 @@ +CREATE OR REPLACE VIEW C_ORDER_LINETAX_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, C_ORDERLINE_ID, + C_TAX_ID, TAXINDICATOR, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, BPNAME, + C_LOCATION_ID, LINE, M_PRODUCT_ID,VendorProductNo, QTYORDERED, QTYENTERED, + UOMSYMBOL, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, + SKU, PRODUCTVALUE, RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST, + DISCOUNT, PRICEACTUAL, PRICEENTERED, LINENETAMT, PRODUCTDESCRIPTION, + IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, + C_PROJECTTASK_ID) +AS +SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, + uom.AD_Language, + ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, t.TaxIndicator, + ol.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.Name AS BPName, bpl.C_Location_ID, + ol.Line, p.M_Product_ID,po.VendorProductNo, + CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered END AS QtyOrdered, + CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered END AS QtyEntered, + CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, + COALESCE(c.Name,COALESCE(pt.Name,p.Name)||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line + CASE WHEN COALESCE(c.Name,pt.Name, p.Name) IS NOT NULL THEN ol.Description END AS Description, -- second line + COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line + p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, + ra.Description AS ResourceDescription, -- forth line + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 + THEN ol.PriceList END AS PriceList, + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 AND ol.QtyEntered<>0 + THEN ol.PriceList*ol.QtyOrdered/ol.QtyEntered END AS PriceEnteredList, + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList>ol.PriceActual AND ol.PriceList<>0 + THEN (ol.PriceList-ol.PriceActual)/ol.PriceList*100 END AS Discount, + CASE WHEN ol.PriceActual<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceActual END AS PriceActual, + CASE WHEN ol.PriceEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceEntered END AS PriceEntered, + CASE WHEN ol.LineNetAmt<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.LineNetAmt END AS LineNetAmt, + pt.Description as ProductDescription, p.ImageURL, + ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID +FROM C_OrderLine ol + INNER JOIN C_UOM_Trl uom ON (ol.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID) + LEFT OUTER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN M_Product_PO po ON (p.M_Product_ID=po.M_Product_ID AND i.C_BPartner_ID=po.C_BPartner_ID) + LEFT OUTER JOIN M_Product_Trl pt ON (ol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) + LEFT OUTER JOIN S_ResourceAssignment ra ON (ol.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID) + LEFT OUTER JOIN C_Charge_Trl c ON (ol.C_Charge_ID=c.C_Charge_ID AND uom.AD_Language=c.AD_Language) + LEFT OUTER JOIN C_BPartner_Product pp ON (ol.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID) + INNER JOIN C_BPartner bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + LEFT OUTER JOIN C_Tax_Trl t ON (ol.C_Tax_ID=t.C_Tax_ID AND uom.AD_Language=t.AD_Language) +UNION +SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, + uom.AD_Language, + ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, null, + null, null, null, null, + ol.Line+(bl.Line/100) AS Line, p.M_Product_ID,po.VendorProductNo, + --ol.QtyOrdered*b.BOMQty AS QtyInvoiced, + CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyOrdered*bl.QtyBOM ELSE ol.QtyOrdered*(bl.QtyBatch / 100) END AS QtyInvoiced, + --ol.QtyEntered*b.BOMQty AS QtyEntered, + CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyEntered*bl.QtyBOM ELSE ol.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered, + uom.UOMSymbol, + COALESCE(pt.Name, p.Name) AS Name, -- main + b.Description, + COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue, + null, null, null, null, null, null, null, pt.Description AS ProductDescription, p.ImageURL, + ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID +/*FROM M_Product_BOM b -- BOM lines + INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID) + INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product + AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') + INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product + INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN M_Product_Trl pt ON (b.M_ProductBOM_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)*/ +FROM PP_Product_BOM b + INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID) + INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID) + INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product + AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') + INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID) + INNER JOIN M_Product p ON (p.M_Product_ID=bl.M_Product_ID) -- BOM line product + LEFT OUTER JOIN M_Product_PO po ON (p.M_Product_ID=po.M_Product_ID AND i.C_BPartner_ID=po.C_BPartner_ID) + INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN M_Product_Trl pt ON (pt.M_Product_ID=bl.M_Product_ID AND uom.AD_Language=pt.AD_Language) +UNION +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + l.AD_Language, o.C_Order_ID, null, null, null, + null, + null, null, null, + null, null, null, null, + null, null,null, + null, null, null, null, null, null, + null, null, null, null, null, null, null, null, + null,null,null,null,null +FROM C_Order o, AD_Language l +WHERE l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y' +UNION +SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.Updated, ot.UpdatedBy, + t.AD_Language, ot.C_Order_ID, null, ot.C_Tax_ID, t.TaxIndicator, + null, null, null, null, + null, null,null, + null, null, null, + t.Name, + null, null, null, null, null, null, + null, null, null, + CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, + CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, + CASE WHEN ot.IsTaxIncluded='Y' THEN NULL ELSE ot.TaxAmt END, + null, null, + null,null,null,null,null +FROM C_OrderTax ot + INNER JOIN C_Tax_Trl t ON (ot.C_Tax_ID=t.C_Tax_ID); + + +