Openbravo Issue Tracking System - Localization Pack: Spain
View Issue Details
0026991Localization Pack: SpainAEAT 349public2014-07-01 18:592014-09-16 14:22
maite 
rafaroda 
urgentmajoralways
closedfixed 
5
 
 
0026991: It should not be possible to select invoices from different periods as "corrective 349" invoices in the tab "Reversed Invoices"
It should not be possible to select invoices from different periods as "corrective 349" invoices in the tab "Reversed Invoices"
1. Register a sales invoice for an amount of 100 € for a customer located in France. Tax rate to be used: Entregas intracomunitarias (%N=>0%). Invoice dated on August 2014. Complete and Post the invoice.
Launch the 349 tax form from the Tax Report Launcher for August period and realize that the Tax Base Amount for that customer is = 100

2. Register a new sales invoice for an amount of 200 € for the same customer as in 1. Once more the tax rate to be used: Entregas intracomunitarias (%N=>0%). Invoice dated on September 2014. Complete and Post the invoice.
Launch the 349 tax form from the Tax Report Launcher for September period and realize that the Tax Base Amount for that customer is = 200

3. Register a Reverse Sales Invoice for the same customer and for an amount of -200 €. Invoice dated on October 2014
Access "Reverse Invoice" tab, select August invoice (see point 1 above) and set it as "corrective 349". Enter below data:
Year = 2014
Period = August
Base Imponible del 349 Productos = 100

In this tab add a new record referencing the invoice dated in February (see point 2 above) and set it as "corrective 349". Enter below data:
Year = 2014
Period = September
Base Imponible del 349 Productos = 200

Realize that no error is obtained.

Launch the 349 tax form from the Tax Report Launcher for October and realize that it is not possible to validate the txt file obtained because it is not possible to import it in AEAT software "Informativas". Below error is shown (In Spanish):
Código: 31401A
Descripción: Base Imponible rectificada NO NUMÉRICA

The reason is:
Openbravo is making this calculation:
(1) to get new August tax base is doing 100-200 = -100
(2) to get new September tax base is doing 200-200= 0
but above calculations are not correct because it is not possible to indicate which amount (among reverse invoice amount of 200 €) should correct August invoice and which amount (among reverse invoice amount of 200 €) should correct September invoice.

Therefore it should not be possible to reference invoices from different periods (months or quarters) in the same reverse invoice as "Corrective 349", as there is no way to know the new tax base amount of each period (month or quarter).
At the end of the day end-user needs to register two Reversed Sales Invoice, first one reversing August invoice and second one reversing September invoice.

Same applies to purchase invoice.

Same applies for Quarterly submission of 349 tax form.

It should not be possible to reference invoices from different periods (months or quarters) in the same reverse invoice as "Corrective 349", as there is no way to know the new tax base amount of each period (month or quarter).
No tags attached.
related to defect 0027613 new vmromanos Base Imponible Rectificada is not properly calculated for Reverse Invoices with currency different from EURO 
Issue History
2014-07-01 18:59maiteNew Issue
2014-07-01 18:59maiteAssigned To => jonalegriaesarte
2014-07-01 19:00maiteIssue Monitored: networkb
2014-07-01 19:23heccamIssue Monitored: heccam
2014-07-21 16:36jonalegriaesarteRegression date => 2014-08-08
2014-07-21 16:40jonalegriaesarteRegression date2014-08-08 =>
2014-07-21 16:40jonalegriaesarteResolution time => 1407448800
2014-07-24 13:44jonalegriaesarteAssigned Tojonalegriaesarte => AtulOpenbravo
2014-08-19 13:53psanjuanSummaryShould not be possible to reference invoices from different periods in "Reversed Invoices" tab, in a "corrective 349" invoice => It should not be possible to select invoices from different periods as "corrective 349" invoices in the tab "Reversed Invoices"
2014-08-19 13:53psanjuanDescription Updatedbug_revision_view_page.php?rev_id=6350#r6350
2014-08-19 13:53psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=6352#r6352
2014-08-19 14:15psanjuanNote Added: 0069508
2014-08-19 14:15psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=6355#r6355
2014-08-19 14:15psanjuanProposed Solution updated
2014-08-19 14:25psanjuanNote Edited: 0069508bug_revision_view_page.php?bugnote_id=0069508#r6357
2014-08-19 14:29psanjuanNote Edited: 0069508bug_revision_view_page.php?bugnote_id=0069508#r6358
2014-08-19 14:29psanjuanNote Edited: 0069508bug_revision_view_page.php?bugnote_id=0069508#r6359
2014-08-19 14:30psanjuanNote Edited: 0069508bug_revision_view_page.php?bugnote_id=0069508#r6360
2014-08-19 14:35psanjuanNote Edited: 0069508bug_revision_view_page.php?bugnote_id=0069508#r6361
2014-08-19 14:39psanjuanNote Edited: 0069508bug_revision_view_page.php?bugnote_id=0069508#r6362
2014-08-26 16:10rafarodaStatusnew => scheduled
2014-08-26 16:10rafarodaAssigned ToAtulOpenbravo => rafaroda
2014-08-26 16:10rafarodafix_in_branch => pi
2014-09-02 18:43rafarodaNote Added: 0069918
2014-09-16 12:44rafarodaRelationship addedrelated to 0027613
2014-09-16 12:52hgbotCheckin
2014-09-16 12:52hgbotNote Added: 0070139
2014-09-16 12:52hgbotStatusscheduled => resolved
2014-09-16 12:52hgbotResolutionopen => fixed
2014-09-16 12:52hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat349.es/rev/d78267acb4cbc34acda720da1c9d52ee7902b894 [^]
2014-09-16 12:57psanjuanNote Added: 0070142
2014-09-16 13:00psanjuanNote Edited: 0070142bug_revision_view_page.php?bugnote_id=0070142#r6572
2014-09-16 13:12psanjuanNote Edited: 0070142bug_revision_view_page.php?bugnote_id=0070142#r6573
2014-09-16 13:12psanjuanNote Added: 0070144
2014-09-16 13:12psanjuanStatusresolved => closed
2014-09-16 13:12psanjuanfix_in_branchpi =>
2014-09-16 14:22hgbotCheckin
2014-09-16 14:22hgbotNote Added: 0070147

Notes
(0069508)
psanjuan   
2014-08-19 14:15   
(edited on: 2014-08-19 14:39)
Below scenario should be possible:

January 2014 - Invoice 1 - Amount 100€
349 tax base for customer A (January) = 100€

February 2014 - Invoice 2 - Amount 200€
February 2014 - Invoice 3 - Amount 300€
February 2014 - Invoice 4 - Amount 400€
349 tax base for customer A (February) = 900€

March 2014 - Reverse Invoice 1 - Amount -500€
Reversed Invoice tab:
record 1 - Invoice 2 (February) set as 349 corrective with below data:
Year =2014
Period = February
Base Imponible 349 Productos = 900
record 2 - Invoice 3 (February) set as 349 corrective with below data:
Year =2014
Period = February
Base Imponible 349 Productos = 900

349 tax base for customer A (March) = 900-500= 400€ (Base Imponible Rectificada)
and 900€ as (Base Imponible declarada anteriormente)

Now if we launch 349 tax form for the period of March, Openbravo shows the same error
Código: 31401A
Descripción: Base Imponible rectificada NO NUMÉRICA

seems the calculation now is 900-500= 400
and once more 400 -500 = -100 (this gives the error)

Same applies to purchase invoice.

Same applies to quarterly submission.

(0069918)
rafaroda   
2014-09-02 18:43   
Hi Patricia,

Actually, for the Scenario 2 (in your comment) the code is getting: [{Period=02, Year=2014, BPTaxBaseAmount=1000.00, BPFormerAmount=900, BPId=44CB679908C64EF5B852E8DB8A1AA061, TaxKey=E}]

BPTaxBaseAmount (Base Imponible) = 1000: which seems wrong (kind of 2 * 500: actualy if we add the third Invoice 3 February as Reversed, BPTaxBaseAmount = 3 * 500 = 1500)

BPFormerAmount (Base Imponible declarada anteriormente) = 900: which seems correct

So Base Imponible Rectificada is calculated as BPFormerAmount - BPTaxBaseAmount (900 - 1000) which leads to the wrong -100 result.

Some error in the query selecting invoices https://code.openbravo.com/erp/pmods/org.openbravo.module.aeat349.es/file/e40ddcd62a4a/src/org/openbravo/module/aeat349/es/AEAT3492010ReportDao.java#l366 [^]
(0070139)
hgbot   
2014-09-16 12:52   
Repository: erp/pmods/org.openbravo.module.aeat349.es
Changeset: d78267acb4cbc34acda720da1c9d52ee7902b894
Author: Rafa Roda Palacios <rafa.roda <at> ubiquads.com>
Date: Tue Sep 16 12:50:13 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat349.es/rev/d78267acb4cbc34acda720da1c9d52ee7902b894 [^]

Fixes issue 26991 Proper calculation of Base Imponible Rectificada in 349

---
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_MESSAGE.xml
M src/org/openbravo/module/aeat349/es/AEAT3492010ReportDao.java
A src-db/database/model/functions/AEAT349_REVINVOICES_CHECK.xml
A src-db/database/sourcedata/AD_EP_PROCEDURES.xml
---
(0070142)
psanjuan   
2014-09-16 12:57   
(edited on: 2014-09-16 13:12)
To avoid not allowing to set invoices dated on different periods as "Correctivas del 349" for the same reverse invoice, two new fields should be included in the tab "Reversed Invoices".

The purpose of those two new fields should be to enter the reversed amount that matches each invoice set as corrective, for both "Product Tax Base" and "Service Tax Base".

(0070144)
psanjuan   
2014-09-16 13:12   
fixed and working
(0070147)
hgbot   
2014-09-16 14:22   
Repository: erp/pmods/org.openbravo.module.aeat349.es
Changeset: 71d751192efcf0296c00927db2f2d760de7741f0
Author: Rafa Roda Palacios <rafa.roda <at> ubiquads.com>
Date: Tue Sep 16 14:01:24 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.module.aeat349.es/rev/71d751192efcf0296c00927db2f2d760de7741f0 [^]

Related to issue 26991 Added small correction for purchase invoices

---
M src/org/openbravo/module/aeat349/es/AEAT3492010ReportDao.java
---