src/org/openbravo/erpCommon/ad_process/CreateTaxReport_data.xsql
changeset 1271 762533f2593a
parent 1173 3b528c8e84a7
child 1605 8a0fe0193bef
equal deleted inserted replaced
1270:c9b59ec0d21a 1271:762533f2593a
    26       SELECT ? AS NUMBER_ROWS, ? AS PARENT, TR.C_TAX_REPORT_ID AS ID, TR.NAME, TR.DESCRIPTION, TR.ISSUMMARY, TR.ISSHOWN, 
    26       SELECT ? AS NUMBER_ROWS, ? AS PARENT, TR.C_TAX_REPORT_ID AS ID, TR.NAME, TR.DESCRIPTION, TR.ISSUMMARY, TR.ISSHOWN, 
    27       AD_TREENODE.NODE_ID, COALESCE((CASE       
    27       AD_TREENODE.NODE_ID, COALESCE((CASE       
    28       TR.ISSUMMARY WHEN 'N' THEN      (CASE ISNEGATIVE WHEN 'Y' THEN SUM(A.TAXAMT)*(-1) WHEN 'N' THEN SUM(A.TAXAMT) END) ELSE 0 END),0) AS TOTAL, 
    28       TR.ISSUMMARY WHEN 'N' THEN      (CASE ISNEGATIVE WHEN 'Y' THEN SUM(A.TAXAMT)*(-1) WHEN 'N' THEN SUM(A.TAXAMT) END) ELSE 0 END),0) AS TOTAL, 
    29       '' AS VALUE, ? AS LEVEL_TAX, (CASE TO_NUMBER(?) WHEN 0 THEN       
    29       '' AS VALUE, ? AS LEVEL_TAX, (CASE TO_NUMBER(?) WHEN 0 THEN       
    30       '' ELSE '' END) AS CLASS_TAX, 'TEXT-INDENT: '||TO_CHAR(TO_NUMBER(?)*10)||'pt' AS CLASS_STYLE
    30       '' ELSE '' END) AS CLASS_TAX, 'TEXT-INDENT: '||TO_CHAR(TO_NUMBER(?)*10)||'pt' AS CLASS_STYLE
    31       FROM C_TAX_REPORT TR LEFT JOIN (SELECT TAXAMT, C_TAX_ID, ISSOTRX
    31       FROM C_TAX_REPORT TR LEFT JOIN (SELECT CASE WHEN DOCBASETYPE IN ('ARC','APC') THEN -1 * TAXAMT ELSE TAXAMT END AS TAXAMT, C_TAX_ID, C_INVOICE.ISSOTRX
    32       FROM C_INVOICETAX, C_INVOICE
    32       FROM C_INVOICETAX, C_INVOICE, C_DOCTYPE
    33       WHERE C_INVOICETAX.C_INVOICE_ID = C_INVOICE.C_INVOICE_ID
    33       WHERE C_INVOICETAX.C_INVOICE_ID = C_INVOICE.C_INVOICE_ID
       
    34       AND C_INVOICE.C_DOCTYPE_ID = C_DOCTYPE.C_DOCTYPE_ID
    34       AND C_INVOICETAX.AD_CLIENT_ID IN ('1')
    35       AND C_INVOICETAX.AD_CLIENT_ID IN ('1')
    35       AND C_INVOICETAX.AD_ORG_ID IN ('1')
    36       AND C_INVOICETAX.AD_ORG_ID IN ('1')
    36       AND C_INVOICE.PROCESSED='Y'
    37       AND C_INVOICE.PROCESSED='Y'
    37       AND 1=1) A ON TR.C_TAX_ID = A.C_TAX_ID AND A.ISSOTRX = TR.ISSOTRX,
    38       AND 1=1) A ON TR.C_TAX_ID = A.C_TAX_ID AND A.ISSOTRX = TR.ISSOTRX,
    38       AD_TREE, AD_TREENODE
    39       AD_TREE, AD_TREENODE