Comments (4)
Al final esto es lo que me funciono y ya esta aprobando las facturas.
Cambios en TgCamIVA
public void setupSOAPElements(GenerationCtx generationCtx, SOAPElement gCamItem, CMondT cMoneOpe, BigDecimal dTotOpeItem) throws SOAPException {
SOAPElement gCamIVA = gCamItem.addChildElement("gCamIVA");
gCamIVA.addChildElement("iAfecIVA").setTextContent(String.valueOf(this.iAfecIVA.getVal()));
gCamIVA.addChildElement("dDesAfecIVA").setTextContent(this.iAfecIVA.getDescripcion());
gCamIVA.addChildElement("dPropIVA").setTextContent(String.valueOf(this.dPropIVA));
gCamIVA.addChildElement("dTasaIVA").setTextContent(String.valueOf(this.dTasaIVA));
int scale = cMoneOpe.name().equals("PYG") ? 0 : 2;
dTotOpeItem = dTotOpeItem.setScale(scale, RoundingMode.HALF_UP);
BigDecimal hundred = BigDecimal.valueOf(100);
//AQUI ESTAN REDONDEANDO ERRONEAMENTE
//BigDecimal propIVA = this.dPropIVA.divide(hundred, scale, RoundingMode.HALF_UP);
BigDecimal propIVA = this.dPropIVA.divide(hundred, 3, RoundingMode.HALF_UP);
BigDecimal tasaIvaCoef = this.dTasaIVA.divide(hundred, 3, RoundingMode.HALF_UP).multiply(propIVA).add(BigDecimal.ONE);
BigDecimal montoSinIva;
if (this.iAfecIVA.getVal() == 1 || this.iAfecIVA.getVal() == 4) {
montoSinIva = dTotOpeItem.divide(tasaIvaCoef, scale, RoundingMode.HALF_UP);
dLiqIVAItem = dTotOpeItem.subtract(montoSinIva).setScale(scale, RoundingMode.HALF_UP);
dBasGravIVA = montoSinIva.multiply(propIVA).setScale(scale, RoundingMode.HALF_UP);
// if (this.dTasaIVA.equals(BigDecimal.valueOf(10))) {
// //(total)1/1.1
//
// this.dBasGravIVA = dTotOpeItem.multiply(propIVA).divide(BigDecimal.valueOf(1.1), scale, RoundingMode.HALF_UP);
// //(preciovtacantidad)*1/11
// this.dLiqIVAItem = dTotOpeItem.multiply(propIVA).divide(BigDecimal.valueOf(11), scale, RoundingMode.HALF_UP);
// } else if (this.dTasaIVA.equals(BigDecimal.valueOf(5))) {
// this.dBasGravIVA = dTotOpeItem.multiply(propIVA).divide(BigDecimal.valueOf(1.05), scale, RoundingMode.HALF_UP);
// this.dLiqIVAItem = dTotOpeItem.multiply(propIVA).divide(BigDecimal.valueOf(21), scale, RoundingMode.HALF_UP);
// }
} else {
this.dBasGravIVA = BigDecimal.ZERO;
this.dLiqIVAItem = BigDecimal.ZERO;
}
gCamIVA.addChildElement("dBasGravIVA").setTextContent(String.valueOf(this.dBasGravIVA));
gCamIVA.addChildElement("dLiqIVAItem").setTextContent(String.valueOf(this.dLiqIVAItem));
if (generationCtx.isHabilitarNotaTecnica13()) {
if (this.iAfecIVA.getVal() == 4) {
// Actualización: https://ekuatia.set.gov.py/portal/ekuatia/detail?content-id=/repository/collaboration/sites/ekuatia/documents/documentacion/documentacion-tecnica/NT_E_KUATIA_013_MT_V150.pdf
// E737 = [100 * EA008 * (100 – E733)] / [10000 + (E734 * E733)]
//this.dBasExe = (dTotOpeItem.multiply(hundred.subtract(dPropIVA)).multiply(hundred)).divide((this.dTasaIVA.multiply(dPropIVA)).add(BigDecimal.valueOf(10000)), scale, RoundingMode.HALF_UP);
//Mas simple y claro exento = total-basegravada-iva
this.dBasExe = dTotOpeItem.subtract(this.dBasGravIVA).subtract(this.dLiqIVAItem).setScale(scale, RoundingMode.HALF_UP);
} else {
this.dBasExe = BigDecimal.valueOf(0);
}
gCamIVA.addChildElement("dBasExe").setTextContent(String.valueOf(this.dBasExe));
}
}
from rshk-jsifenlib.
Y hay que corregir tambien la sumatoria en TgTotSub
Por ejemplo en los casos que la base no es el 100% como es en el rubro inmobiliario que es 5% sobre una base grabada del 30%. Entonces de un monto de 1.000.000.- se calcula el iva 5% sobre el 30% y queda mas o menos asi
Base Gravada = 285.714 dBasGravIVA - dBaseGrav10 o dBaseGrav5 (aqui no calcula bien)
IVA = 14.286 dLiqIVAItem - dIVA10
Base Exento = 700.000 dBasExe - dSubExe (aqui no calcula bien)
=======
Total = 1.000.000
Asi debe figurar en los xmls
Para esta situación se agrego la nt 13
Abajo una solución propuesta en TgTotSub
if (gCamIVA.getiAfecIVA().getVal() == 1 || gCamIVA.getiAfecIVA().getVal() == 4) {
if (gCamIVA.getdTasaIVA().equals(BigDecimal.valueOf(10))) {
//Se Agrego
this.dSubExe = this.dSubExe.add(dBasExe).setScale(scale);
//Correccin
this.dSub10 = this.dSub10.add(dTotOpeItem.subtract(dBasExe)).setScale(scale);
this.dIVA10 = this.dIVA10.add(dLiqIVAItem);
this.dBaseGrav10 = this.dBaseGrav10.add(dBasGravIVA);
this.dLiqTotIVA10 = BigDecimal.ZERO;
} else if (gCamIVA.getdTasaIVA().equals(BigDecimal.valueOf(5))) {
//Se agrego
this.dSubExe = this.dSubExe.add(dBasExe).setScale(scale);
//Correccin
this.dSub5 = this.dSub5.add(dTotOpeItem.subtract(dBasExe)).setScale(scale);
this.dIVA5 = this.dIVA5.add(dLiqIVAItem);
this.dBaseGrav5 = this.dBaseGrav5.add(dBasGravIVA);
this.dLiqTotIVA5 = BigDecimal.ZERO;
}
from rshk-jsifenlib.
Muchas gracias @jencisopy, tuve exactamente el mismo issue con una factura con gravado parcial y esta fue la solución
from rshk-jsifenlib.
from rshk-jsifenlib.
Related Issues (20)
- Num Ruc de 6 digitos HOT 1
- Orientación calculo dTotGralOpe HOT 7
- posible bug en generar de.generarXml() HOT 1
- Formato dRedon con "," (coma) en XML en algunas implementaciones HOT 1
- Divide sobre zero
- Warning en consultasDE HOT 3
- Kude HOT 1
- Calculo de iAfecIVA = 4 (Gravado parcial (Grav-Exento))
- Sugerencia - Al convertir un XML en objeto, adicionar el enlace de QR
- Codigo de respuesta 0301 HOT 1
- Problemas con firma digital al final de cada linea HOT 7
- Nota Tecnica 16
- Error 1301 - Descripción del país receptor no corresponde al código
- Notas técnicas 018, 019, 20
- Error XML Mal Formado en Eventos HOT 1
- Preguntas sobre el entorno de prueba de emisión de factura electrónica HOT 1
- Implementacion de nota tecnica 14
- Como realizar la firma del XML antes del envio.
- Implementación para Android HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rshk-jsifenlib.