Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/adempiere/LVE
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Oct 3, 2019
2 parents ba5a6bd + 83a5aa7 commit 93d5a59
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ CREATE OR REPLACE VIEW LVE_RV_InvoiceBook AS
JOIN C_InvoiceLine il ON i.C_Invoice_ID = il.C_Invoice_ID
JOIN WH_Withholding whd ON (whd.C_InvoiceLine_ID = il.C_InvoiceLine_ID)
JOIN WH_Setting whs ON (whs.WH_Setting_ID = whd.WH_Setting_ID)
JOIN WH_Type wt ON whs.WH_Type_ID = wt.WH_Type_ID
JOIN WH_Type wt ON (whs.WH_Type_ID = wt.WH_Type_ID AND wt.IsFiscalDocument = 'Y')
WHERE i.DocStatus IN ('CO', 'CL')
GROUP BY
il.LineNetAmt,
Expand Down Expand Up @@ -183,7 +183,7 @@ UNION ALL
JOIN C_InvoiceLine il ON i.C_Invoice_ID = il.C_Invoice_ID
JOIN WH_Withholding whd ON whd.C_InvoiceLine_ID = il.C_InvoiceLine_ID
JOIN WH_Setting whs ON (whs.WH_Setting_ID = whd.WH_Setting_ID)
JOIN WH_Type wt ON whs.WH_Type_ID = wt.WH_Type_ID
JOIN WH_Type wt ON (whs.WH_Type_ID = wt.WH_Type_ID AND wt.IsFiscalDocument = 'Y')
WHERE i.DocStatus IN ('CO', 'CL')
GROUP BY il.LineNetAmt,
il.InvoiceToAllocate_ID,
Expand Down
22 changes: 11 additions & 11 deletions xml/migration/062_AddViewBook.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
(i.C_Invoice_ID::VARCHAR || COALESCE(it.C_Tax_ID, 0)::VARCHAR) AS DocumentTax_ID,
it.AliquotType
FROM C_Invoice i
LEFT JOIN C_Period p ON i.DateAcct >= p.StartDate AND i.DateAcct <= p.EndDate AND i.AD_Client_ID = p.AD_Client_ID
LEFT JOIN C_Period p ON i.DateAcct >= p.StartDate AND i.DateAcct <= p.EndDate AND i.AD_Client_ID = p.AD_Client_ID
JOIN C_DocType dt ON i.C_DocType_ID = dt.C_DocType_ID
JOIN C_BPartner bp ON i.C_BPartner_ID = bp.C_BPartner_ID
JOIN AD_OrgInfo oi ON oi.AD_Org_ID = i.AD_Org_ID
Expand All @@ -68,7 +68,7 @@
ELSE 0
END) AS Exempt,
sum(CASE
WHEN t.Rate &lt;&gt; 0 THEN it.TaxBaseAmt
WHEN t.Rate <> 0 THEN it.TaxBaseAmt
ELSE 0
End) AS Taxable,
it.C_Invoice_ID
Expand All @@ -83,20 +83,20 @@
t.AliquotType
FROM C_InvoiceTax it
JOIN C_Tax t ON it.C_Tax_ID = t.C_Tax_ID
WHERE t.Rate &lt;&gt; 0
WHERE t.Rate <> 0
GROUP BY it.C_Invoice_ID, t.Rate, it.C_Tax_ID, t.AliquotType) it ON i.C_Invoice_ID = it.C_Invoice_ID
LEFT JOIN (SELECT il.LineNetAmt AS WHTaxAmt,
il.InvoiceToAllocate_ID AS C_Invoice_ID,
i.DocumentNo AS WHDocumentNo,
wt.WH_Type_ID AS Record_ID,
p.C_Period_ID,
CASE WHEN whd.WHThirdParty_ID &gt; 0 THEN 'Y' ELSE 'N' END IsThirdParty
CASE WHEN whd.WHThirdParty_ID > 0 THEN 'Y' ELSE 'N' END IsThirdParty
FROM C_Invoice i
LEFT JOIN C_Period p ON i.DateAcct &gt;= p.StartDate AND i.DateAcct &lt;= p.EndDate AND i.AD_Client_ID = p.AD_Client_ID
LEFT JOIN C_Period p ON i.DateAcct >= p.StartDate AND i.DateAcct <= p.EndDate AND i.AD_Client_ID = p.AD_Client_ID
JOIN C_InvoiceLine il ON i.C_Invoice_ID = il.C_Invoice_ID
JOIN WH_Withholding whd ON (whd.C_InvoiceLine_ID = il.C_InvoiceLine_ID)
JOIN WH_Setting whs ON (whs.WH_Setting_ID = whd.WH_Setting_ID)
JOIN WH_Type wt ON whs.WH_Type_ID = wt.WH_Type_ID
JOIN WH_Type wt ON (whs.WH_Type_ID = wt.WH_Type_ID AND wt.IsFiscalDocument = 'Y')
WHERE i.DocStatus IN ('CO', 'CL')
GROUP BY
il.LineNetAmt,
Expand Down Expand Up @@ -169,7 +169,7 @@ UNION ALL
FROM C_Invoice i
JOIN AD_Client c ON i.AD_Client_ID = c.AD_Client_ID
JOIN AD_OrgInfo oi ON oi.AD_Org_ID = i.AD_Org_ID
LEFT JOIN C_Period p ON i.DateAcct &gt;= p.StartDate AND i.DateAcct &lt;= p.EndDate AND i.AD_Client_ID = p.AD_Client_ID
LEFT JOIN C_Period p ON i.DateAcct >= p.StartDate AND i.DateAcct <= p.EndDate AND i.AD_Client_ID = p.AD_Client_ID
JOIN C_DocType dt ON i.C_DocType_ID = dt.C_DocType_ID
JOIN C_BPartner bp ON i.C_BPartner_ID = bp.C_BPartner_ID
JOIN ( SELECT il.LineNetAmt AS WHTaxAmt,
Expand All @@ -181,13 +181,13 @@ UNION ALL
p.EndDate,
i.DateAcct,
i.DateInvoiced,
CASE WHEN whd.WHThirdParty_ID &gt; 0 THEN 'Y' ELSE 'N' END IsThirdParty
CASE WHEN whd.WHThirdParty_ID > 0 THEN 'Y' ELSE 'N' END IsThirdParty
FROM C_Invoice i
LEFT JOIN C_Period p ON i.DateAcct &gt;= p.StartDate AND i.DateAcct &lt;= p.EndDate AND i.AD_Client_ID = p.AD_Client_ID
LEFT JOIN C_Period p ON i.DateAcct >= p.StartDate AND i.DateAcct <= p.EndDate AND i.AD_Client_ID = p.AD_Client_ID
JOIN C_InvoiceLine il ON i.C_Invoice_ID = il.C_Invoice_ID
JOIN WH_Withholding whd ON whd.C_InvoiceLine_ID = il.C_InvoiceLine_ID
JOIN WH_Setting whs ON (whs.WH_Setting_ID = whd.WH_Setting_ID)
JOIN WH_Type wt ON whs.WH_Type_ID = wt.WH_Type_ID
JOIN WH_Type wt ON (whs.WH_Type_ID = wt.WH_Type_ID AND wt.IsFiscalDocument = 'Y')
WHERE i.DocStatus IN ('CO', 'CL')
GROUP BY il.LineNetAmt,
il.InvoiceToAllocate_ID,
Expand All @@ -199,7 +199,7 @@ UNION ALL
i.DateAcct,
i.DateInvoiced,
whd.WHThirdParty_ID
) iwh ON i.C_Invoice_ID = iwh.C_Invoice_ID AND p.C_Period_ID &lt;&gt; iwh.C_Period_ID,
) iwh ON i.C_Invoice_ID = iwh.C_Invoice_ID AND p.C_Period_ID <> iwh.C_Period_ID,
( SELECT wt.AD_Client_ID,
wt.AD_Org_ID,
wt.Name,
Expand Down

0 comments on commit 93d5a59

Please sign in to comment.