details:   https://code.openbravo.com/erp/devel/pi/rev/800d3becdda0
changeset: 26623:800d3becdda0
user:      Jorge Garcia <jorge.garcia <at> openbravo.com>
date:      Mon May 11 18:56:21 2015 +0200
summary:   Fixed issue 29748: "Create VAT register" process should consider 
exchange rate

"Create VAT register" process in Tax Payment window should consider exchange
rate defined at document level.

The solution is to check if there is an exchange rate defined in the invoice
and if it's null, use the exchange rate defined in Conversion Rate window.

details:   https://code.openbravo.com/erp/devel/pi/rev/dc69cdec624f
changeset: 26624:dc69cdec624f
user:      Unai Martirena <unai.martirena <at> openbravo.com>
date:      Wed May 13 16:20:30 2015 +0200
summary:   Related to bug 29748: Fix copyright

diffstat:

 src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters_data.xsql |  18 
++++++++-
 1 files changed, 15 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r eb81377539da -r dc69cdec624f 
src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters_data.xsql
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters_data.xsql  
Wed May 13 15:58:31 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters_data.xsql  
Wed May 13 16:20:30 2015 +0200
@@ -12,7 +12,7 @@
        * under the License. 
        * The Original Code is Openbravo ERP. 
        * The Initial Developer of the Original Code is Openbravo SLU 
-       * All portions are Copyright (C) 2008 Openbravo SLU 
+       * All portions are Copyright (C) 2008-2015 Openbravo SLU 
        * All Rights Reserved. 
        * Contributor(s):  ______________________________________.
        ************************************************************************
@@ -28,11 +28,17 @@
          select C_invoice.C_invoice_ID, C_invoice.DocumentNo, 
          C_InvoiceTax.C_InvoiceTax_ID, coalesce(C_invoice.TaxDate, 
C_invoice.DateAcct) as TaxDate, 
          case when C_Invoice.C_Currency_ID = (select c_currency_id from 
c_taxpayment where c_taxpayment_id = ? ) then C_InvoiceTax.TaxAmt else
+         case when (select rate from c_conversion_rate_document WHERE 
c_invoice_id = C_invoice.C_invoice_ID AND c_currency_id = 
C_Invoice.C_Currency_ID AND c_currency_id_to = (select c_currency_id from 
c_taxpayment where c_taxpayment_id = ? )) IS NOT NULL
+         then ROUND (C_InvoiceTax.TaxAmt * (select rate from 
c_conversion_rate_document WHERE c_invoice_id = C_invoice.C_invoice_ID AND 
c_currency_id = C_Invoice.C_Currency_ID AND c_currency_id_to = (select 
c_currency_id from c_taxpayment where c_taxpayment_id = ? )) , 
+         C_get_currency_precision ((select c_currency_id from c_taxpayment 
where c_taxpayment_id = ? ), 'A')) else
          C_Currency_Convert(C_InvoiceTax.TaxAmt ,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 TaxAmt,
+         coalesce(C_invoice.TaxDate, C_invoice.DateAcct), 'S', 
c_invoice.ad_client_id, c_invoice.ad_org_id) end end as TaxAmt,
          case when C_Invoice.C_Currency_ID = (select c_currency_id from 
c_taxpayment where c_taxpayment_id = ? ) then C_InvoiceTax.TaxBaseAmt else
+         case when (select rate from c_conversion_rate_document WHERE 
c_invoice_id = C_invoice.C_invoice_ID AND c_currency_id = 
C_Invoice.C_Currency_ID AND c_currency_id_to = (select c_currency_id from 
c_taxpayment where c_taxpayment_id = ? )) IS NOT NULL
+         then ROUND (C_InvoiceTax.TaxBaseAmt * (select rate from 
c_conversion_rate_document WHERE c_invoice_id = C_invoice.C_invoice_ID AND 
c_currency_id = C_Invoice.C_Currency_ID AND c_currency_id_to = (select 
c_currency_id from c_taxpayment where c_taxpayment_id = ? )) , 
+         C_get_currency_precision ((select c_currency_id from c_taxpayment 
where c_taxpayment_id = ? ), 'A')) 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,
+         coalesce(C_invoice.TaxDate, C_invoice.DateAcct), 'S', 
c_invoice.ad_client_id, c_invoice.ad_org_id) end end as TaxBaseAmt,
          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,
@@ -58,6 +64,12 @@
         <Parameter name="taxPaymentID"/>
         <Parameter name="taxPaymentID"/>
         <Parameter name="taxPaymentID"/>
+        <Parameter name="taxPaymentID"/>
+        <Parameter name="taxPaymentID"/>
+        <Parameter name="taxPaymentID"/>
+        <Parameter name="taxPaymentID"/>
+        <Parameter name="taxPaymentID"/>
+        <Parameter name="taxPaymentID"/>
         <Parameter name="parTaxRegType_id" optional="true" after="and 
1=1"><![CDATA[ and C_TaxRegister_Type.C_TaxRegister_Type_ID= ?  ]]></Parameter>
         <Parameter name="parDateFrom" optional="true" after="and 
1=1"><![CDATA[ and coalesce(C_invoice.TaxDate, C_invoice.DateAcct) >= 
to_date(?) ]]></Parameter>
         <Parameter name="parDateTo" optional="true" after="and 1=1"><![CDATA[ 
and coalesce(C_invoice.TaxDate, C_invoice.DateAcct) < to_date(?)]]></Parameter>

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to