Fixes issue 18784: Tax Payment process should properly manage Reverse Purchase/Sales invoices
authorMikel Irurita <mikel.irurita@openbravo.com>
Mon, 24 Oct 2011 13:52:44 +0200
changeset 14074 6ff1238ec5b0
parent 14073 e5af0079aa01
child 14075 d88ff9e3b0ea
Fixes issue 18784: Tax Payment process should properly manage Reverse Purchase/Sales invoices
src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters.java
src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters_data.xsql
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters.java	Mon Oct 24 12:34:40 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters.java	Mon Oct 24 13:52:44 2011 +0200
@@ -218,7 +218,8 @@
             return myMessage;
           }
           if (myinvoice.docbasetype.equals(DocInvoice.DOCTYPE_APCredit)
-              || myinvoice.docbasetype.equals(DocInvoice.DOCTYPE_ARCredit)) {
+              || myinvoice.docbasetype.equals(DocInvoice.DOCTYPE_ARCredit)
+              || "Y".equals(myinvoice.isreversal)) { // isreversal means credit memo
             strTaxBaseAmt = (new BigDecimal(strTaxBaseAmt).negate()).toPlainString();
             strTaxAmt = (new BigDecimal(strTaxAmt).negate()).toPlainString();
             strTaxUndeducAmt = (new BigDecimal(strTaxUndeducAmt).negate()).toPlainString();
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters_data.xsql	Mon Oct 24 12:34:40 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters_data.xsql	Mon Oct 24 13:52:44 2011 +0200
@@ -33,7 +33,7 @@
          case when C_Invoice.C_Currency_ID = (select c_currency_id from c_taxpayment where c_taxpayment_id = ? ) then C_InvoiceTax.TaxBaseAmt else
          C_Currency_Convert(C_InvoiceTax.TaxBaseAmt ,C_Invoice.C_Currency_ID, (select c_currency_id from c_taxpayment where c_taxpayment_id = ? ),
          coalesce(C_invoice.TaxDate, C_invoice.DateAcct), 'S', c_invoice.ad_client_id, c_invoice.ad_org_id) end as TaxBaseAmt,
-         C_Tax.C_Tax_ID, C_Tax.IsTaxExempt ,C_Tax.IsTaxUndeductable, C_Tax.IsNoVat, C_DocType.DocBaseType
+         C_Tax.C_Tax_ID, C_Tax.IsTaxExempt ,C_Tax.IsTaxUndeductable, C_Tax.IsNoVat, C_DocType.DocBaseType, C_DocType.isreversal
          from C_Invoice,
          C_TaxRegister_Type_Lines,
          C_InvoiceTax,