Coder Social home page Coder Social logo

Comments (4)

jencisopy avatar jencisopy commented on September 15, 2024 1

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);
// //(preciovta
cantidad)*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.

jencisopy avatar jencisopy commented on September 15, 2024

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.

garak92 avatar garak92 commented on September 15, 2024

Muchas gracias @jencisopy, tuve exactamente el mismo issue con una factura con gravado parcial y esta fue la solución

from rshk-jsifenlib.

pablo avatar pablo commented on September 15, 2024

from rshk-jsifenlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.