src-db/database/model/views/C_INVOICE_LINETAX_VT.xml
changeset 9910 6767429386d8
parent 7031 2aac4501bbd5
child 9911 444911e2b851
--- a/src-db/database/model/views/C_INVOICE_LINETAX_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_LINETAX_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,59 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_LINETAX_VT">
-    <view name="C_INVOICE_LINETAX_VT"><![CDATA[(((SELECT il.ad_client_id, il.ad_org_id, il.isactive, il.created, il.createdby, il.updated, il.updatedby, uom.ad_language, il.c_invoice_id, il.c_invoiceline_id, il.c_tax_id, il.line, 
-CASE
-WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN il.qtyinvoiced
-ELSE NULL
-END AS qtyinvoiced, 
-CASE
-WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN uom.uomsymbol
-ELSE NULL
-END AS uomsymbol, COALESCE(COALESCE(pt.name, p.name), il.description) AS name, 
-CASE
-WHEN COALESCE(pt.name, p.name) IS NOT NULL THEN il.description
-ELSE NULL
-END AS description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, ra.description AS resourcedescription, 
-CASE
-WHEN i.isdiscountprinted = 'Y' AND (il.pricelist <> 0 OR il.m_product_id IS NOT NULL) THEN il.pricelist
-ELSE NULL
-END AS pricelist, 
-CASE
-WHEN i.isdiscountprinted = 'Y' AND il.pricelist > il.priceactual THEN (il.pricelist - il.priceactual) / il.pricelist * 100
-ELSE NULL
-END AS discount, 
-CASE
-WHEN il.priceactual <> 0 OR il.m_product_id IS NOT NULL THEN il.priceactual
-ELSE NULL
-END AS priceactual, 
-CASE
-WHEN il.linenetamt <> 0 OR il.m_product_id IS NOT NULL THEN il.linenetamt
-ELSE NULL
-END AS linenetamt
-FROM c_invoiceline il
-JOIN c_uom_trl uom ON il.c_uom_id = uom.c_uom_id
-JOIN c_invoice i ON il.c_invoice_id = i.c_invoice_id
-LEFT JOIN m_product p ON il.m_product_id = p.m_product_id
-LEFT JOIN m_product_trl pt ON il.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language
-LEFT JOIN s_resourceassignment ra ON il.s_resourceassignment_id = ra.s_resourceassignment_id
-UNION 
-SELECT il.ad_client_id, il.ad_org_id, il.isactive, il.created, il.createdby, il.updated, il.updatedby, uom.ad_language, il.c_invoice_id, il.c_invoiceline_id, il.c_tax_id, il.line + b.line / 100 AS line, il.qtyinvoiced * b.bomqty AS qtyinvoiced, uom.uomsymbol, COALESCE(pt.name, p.name) AS name, b.description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM m_product_bom b
-JOIN c_invoiceline il ON b.m_product_id = il.m_product_id
-JOIN m_product bp ON bp.m_product_id = il.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y'
-JOIN m_product p ON b.m_productbom_id = p.m_product_id
-JOIN c_uom_trl uom ON p.c_uom_id = uom.c_uom_id
-JOIN m_product_trl pt ON b.m_productbom_id = pt.m_product_id AND uom.ad_language = pt.ad_language)
-UNION 
-SELECT il.ad_client_id, il.ad_org_id, il.isactive, il.created, il.createdby, il.updated, il.updatedby, l.ad_language, il.c_invoice_id, il.c_invoiceline_id, il.c_tax_id, il.line, NULL AS qtyinvoiced, NULL AS uomsymbol, il.description AS name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM c_invoiceline il, ad_language l
-WHERE il.c_uom_id IS NULL AND l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y')
-UNION 
-SELECT i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, l.ad_language, i.c_invoice_id, NULL AS c_invoiceline_id, NULL AS c_tax_id, 9998 AS line, NULL AS qtyinvoiced, NULL AS uomsymbol, NULL AS name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM c_invoice i, ad_language l
-WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y')
-UNION 
-SELECT it.ad_client_id, it.ad_org_id, it.isactive, it.created, it.createdby, it.updated, it.updatedby, l.ad_language, it.c_invoice_id, NULL AS c_invoiceline_id, it.c_tax_id, 9999 AS line, NULL AS qtyinvoiced, NULL AS uomsymbol, t.name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, it.taxbaseamt AS priceactual, it.taxamt AS linenetamt
-FROM c_invoicetax it
-JOIN c_tax t ON it.c_tax_id = t.c_tax_id, ad_language l
-WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y']]></view>
+    <view name="C_INVOICE_LINETAX_VT"><![CDATA[(((SELECT il.ad_client_id, il.ad_org_id,  il.isactive, il.created, il.createdby,  il.updated, il.updatedby, uom.ad_language,  il.c_invoice_id, il.c_invoiceline_id,  il.c_tax_id, il.line,  CASE WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN il.qtyinvoiced ELSE NULL END AS qtyinvoiced,  CASE WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN uom.uomsymbol ELSE NULL END AS uomsymbol,  COALESCE(COALESCE(pt.name, p.name), il.description) AS name,  CASE WHEN COALESCE(pt.name, p.name) IS NOT NULL THEN il.description ELSE NULL END AS description,  COALESCE(pt.documentnote, p.documentnote) AS documentnote,  p.upc, p.sku, p.value AS productvalue,  ra.description AS resourcedescription,  CASE WHEN i.isdiscountprinted = 'Y' AND (il.pricelist <> 0 OR il.m_product_id IS NOT NULL) THEN il.pricelist ELSE NULL END AS pricelist,  CASE WHEN i.isdiscountprinted = 'Y' AND il.pricelist > il.priceactual THEN (il.pricelist - il.priceactual) / il.pricelist * 100 ELSE NULL END AS discount,  CASE WHEN il.priceactual <> 0 OR il.m_product_id IS NOT NULL THEN il.priceactual ELSE NULL END AS priceactual,  CASE WHEN il.linenetamt <> 0 OR il.m_product_id IS NOT NULL THEN il.linenetamt ELSE NULL END AS linenetamt FROM c_invoiceline il JOIN c_uom_trl uom ON il.c_uom_id = uom.c_uom_id JOIN c_invoice i ON il.c_invoice_id = i.c_invoice_id LEFT JOIN m_product p ON il.m_product_id = p.m_product_id LEFT JOIN m_product_trl pt ON il.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language LEFT JOIN s_resourceassignment ra ON il.s_resourceassignment_id = ra.s_resourceassignment_id UNION  SELECT il.ad_client_id, il.ad_org_id,  il.isactive, il.created, il.createdby,  il.updated, il.updatedby, uom.ad_language,  il.c_invoice_id, il.c_invoiceline_id,  il.c_tax_id,  il.line + b.line / 100 AS line,  il.qtyinvoiced * b.bomqty AS qtyinvoiced,  uom.uomsymbol,  COALESCE(pt.name, p.name) AS name,  b.description,  COALESCE(pt.documentnote, p.documentnote) AS documentnote,  p.upc, p.sku, p.value AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist,  NULL AS discount,  NULL AS priceactual,  NULL AS linenetamt FROM m_product_bom b JOIN c_invoiceline il ON b.m_product_id = il.m_product_id JOIN m_product bp ON bp.m_product_id = il.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y' JOIN m_product p ON b.m_productbom_id = p.m_product_id JOIN c_uom_trl uom ON p.c_uom_id = uom.c_uom_id JOIN m_product_trl pt ON b.m_productbom_id = pt.m_product_id AND uom.ad_language = pt.ad_language) UNION  SELECT il.ad_client_id, il.ad_org_id, il.isactive,  il.created, il.createdby, il.updated, il.updatedby,  l.ad_language, il.c_invoice_id, il.c_invoiceline_id,  il.c_tax_id, il.line, NULL AS qtyinvoiced,  NULL AS uomsymbol, il.description AS name,  NULL AS description,  NULL AS documentnote,  NULL AS upc,  NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist,  NULL AS discount,  NULL AS priceactual,  NULL AS linenetamt FROM c_invoiceline il, ad_language l WHERE il.c_uom_id IS NULL AND l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y') UNION  SELECT i.ad_client_id, i.ad_org_id, i.isactive, i.created,  i.createdby, i.updated, i.updatedby, l.ad_language,  i.c_invoice_id, NULL AS c_invoiceline_id,  NULL AS c_tax_id, 9998 AS line,  NULL AS qtyinvoiced, NULL AS uomsymbol,  NULL AS name,  NULL AS description,  NULL AS documentnote,  NULL AS upc,  NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist, NULL AS discount,  NULL AS priceactual, NULL AS linenetamt FROM c_invoice i, ad_language l WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y') UNION  SELECT it.ad_client_id, it.ad_org_id, it.isactive, it.created,  it.createdby, it.updated, it.updatedby, l.ad_language,  it.c_invoice_id, NULL AS c_invoiceline_id,  it.c_tax_id, 9999 AS line, NULL AS qtyinvoiced,  NULL AS uomsymbol, t.name,  NULL AS description,  NULL AS documentnote,  NULL AS upc, NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist, NULL AS discount,  it.taxbaseamt AS priceactual, it.taxamt AS linenetamt FROM c_invoicetax it JOIN c_tax t ON it.c_tax_id = t.c_tax_id, ad_language l WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y']]></view>
   </database>