thegreenter / greenter

Facturación Electrónica - SUNAT - PE :four_leaf_clover:
https://greenter.dev
MIT License
274 stars 138 forks source link

Error 4312 /Invoice/cac:LegalMonetaryTotal/cbc:PayableAmount al enviar comprobantes, ¿ Qué puede estar mal ? #97

Closed zMiguelk3 closed 4 years ago

zMiguelk3 commented 4 years ago

Hola, Alguien ha tenido problemas al enviar documentos electrónicos, el mensaje de error es "El documento xx-xxx- ha sido aceptado con observaciones," , he revisado los cálculos y coinciden, ¿Cuál puede ser la razón , En beta funciona bien pero en producción no ?


<?xml version="1.0" encoding="utf-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ext:UBLExtensions>
    <ext:UBLExtension>
      <ext:ExtensionContent><Signature Id="STONER" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>cePNnQ1GoOC5KO7vyGTOzYVPRmw=</DigestValue></Reference></SignedInfo><SignatureValue>gAcPKMlw3sEAlCf3NCsAj1vT2RKQ+2qLx80+Wv/SXj65yrlkrsoKeZbBEM2N3pKN8IHuxDoCX5u7ZSnrTpuWSSZ8nFrdAXaclgGRJw+tGp6kQEo0+vLrBNv1G4HzIpl9k1yD1dYicFQmYvZt5qanunefQ+3JjxPix14SNlqWXBHp9bud0r7pF/jdIdSMTPUqTF+iQh+HBf+vJYf7lGd9q+8YXPZna0G2W9jhETA99LE44SJ2R5FKmGgSohRhgAcCZrwHOt+fey+E8F59wayv+rBxBX2ThetMS78ycpmR4YwAMe9DOrS5t9BeLE1kDXJaLBPM21S4brZ76XkXx1NQow==</SignatureValue><KeyInfo><X509Data><X509SubjectName>C=PE, O=EMPRESA EMISORA, OID.2.5.4.97=20529730072, OU=Issued by GRAMD PERUANA SAC [PE1], OU=GERENCIA, T=TITULAR-GERENTE, S=PIURA - PIURA, L=PIURA, SERIALNUMBER=DNI:16719517, SN=CHUYE JAIME, G=JOSE FRANCISCO, CN=JOSE FRANCISCO CHUYE JAIME, E=iselasaavedraauza78@gmail.com</X509SubjectName><X509Certificate>MIIKZDCCCEygAwIBAgIJaEnf8CGGhNzCMA0GCSqGSIb3DQEBCwUAMIIBIjELMAkGA1UEBhMCUEUxDTALBgNVBAgMBExJTUExDTALBgNVBAcMBExJTUExPTA7BgNVBAsMNHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tLnBlL2FkZHJlc3MxMDAuBgNVBAsMJ0FDIENBTUVSRklSTUEgUEVSw5ogQ0VSVElGSUNBRE9TIC0gMjAxNjEUMBIGA1UEBRMLMjA1NjYzMDI0NDcxGjAYBgNVBGEMEU5UUlBFLTIwNTY2MzAyNDQ3MSAwHgYDVQQKDBdDQU1FUkZJUk1BIFBFUsOaIFMuQS5DLjEwMC4GA1UEAwwnQUMgQ0FNRVJGSVJNQSBQRVLDmiBDRVJUSUZJQ0FET1MgLSAyMDE2MB4XDTE5MDQxMjIyMzU1MVoXDTI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NBIENPTiBWSU5DVUxBQ0lPTiBBIEVNUFJFU0EwHAYDVR0SBBUwE4ERY2FAY2FtZXJmaXJtYS5jb20wgZAGA1UdIASBiDCBhTCBggYMKwYBBAGBhy4eEAABMHIwKQYIKwYBBQUHAgEWHWh0dHBzOi8vcG9saWN5LmNhbWVyZmlybWEuY29tMEUGCCsGAQUFBwICMDkMN0NFUlRJRklDQURPIERFIFBFUlNPTkEgRklTSUNBIENPTiBWSU5DVUxBQ0lPTiBBIEVNUFJFU0EwDQYJKoZIhvcNAQELBQADggIBAFxyL2dMDztKtkpxUtk8KoJIodzvfjNQojCM1JkpSQVA6wLqm9XflM6MAPkFuvNMACndmVVX7m6tfz5g9QUn/PHJ/kIT8w86RqrNj4QlBnbwDcWINMnOpr2DdL7VzzFqMsTv0yNoUrw8AdnbqwWTf8a688EuzFPurzBinq4JCDl5wkqFwEVA4tkl8xIS0jb3DTH2oYaBFMUtXJ/4cDpL/iE9nFne0IeSYUaWkSSTZQyRoza1KbsPnioNsyJDC/L3oY+Yhb9fuB2xusy7/iY7dBUd/d9tMo/x6bm6n/CCN996jfUY1giy0W1otdtoO0x5P3Bz6kUkJR+g99qxnmifihb5bgWNK9r5IpSGw8Mh6aaNc55phX5DZ+KLcgBDM8eCZshd0C3H+w0gDCY6asNbB1RI/GW8x1dO2dwOV67NpMhdUxBVEi7gbZuIp0HiU4ox/1IBikjtM+EQ/LWDKg80B8+YorhjTncTZKFgKSX6ZK3/B9RcZ2Nip9C7I0YOBW3RMq2nrZ5DXMIusZuj9R9KjcnZ3qZBiafOTPc6Elz75DOz99PHHZfrCR4Nwv5kUMJyNaJ/5WeLspKRxBMfyxl/ZMilywq76xhbz32VwHB5uBHNqQDQ9y9q5Tf9H7fYCFuPwaaQiCcGBVrIQfDI9KcOtchit3skPJK7C0MWU2mMWax9</X509Certificate></X509Data></KeyInfo></Signature></ext:ExtensionContent>
    </ext:UBLExtension>
  </ext:UBLExtensions>
  <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
  <cbc:CustomizationID>2.0</cbc:CustomizationID>
  <cbc:ID>B100-00000015</cbc:ID>
  <cbc:IssueDate>2019-11-15</cbc:IssueDate>
  <cbc:IssueTime>18:44:38</cbc:IssueTime>
  <cbc:DueDate>2019-11-15</cbc:DueDate>
  <cbc:InvoiceTypeCode listID="0101" listAgencyName="PE:SUNAT" listName="Tipo de Documento" listURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo01">03</cbc:InvoiceTypeCode>
  <cbc:Note languageLocaleID="1000">DOS CON 00/100</cbc:Note>
  <cbc:DocumentCurrencyCode listID="ISO 4217 Alpha" listName="Currency" listAgencyName="United Nations Economic Commission for Europe">PEN</cbc:DocumentCurrencyCode>
  <cbc:LineCountNumeric>1</cbc:LineCountNumeric>
  <cac:Signature>
    <cbc:ID>B100-00000015</cbc:ID>
    <cac:SignatoryParty>
      <cac:PartyIdentification>
        <cbc:ID>XXXXXXXXXX</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
        <cbc:Name>EMPRESA EMISOR.</cbc:Name>
      </cac:PartyName>
    </cac:SignatoryParty>
    <cac:DigitalSignatureAttachment>
      <cac:ExternalReference>
        <cbc:URI>XXXXXXXXXX-B100-00000015</cbc:URI>
      </cac:ExternalReference>
    </cac:DigitalSignatureAttachment>
  </cac:Signature>
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cac:PartyIdentification>
        <cbc:ID schemeID="6" schemeName="Documento de Identidad" schemeAgencyName="PE:SUNAT" schemeURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06">XXXXXXXXXX</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
        <cbc:Name><![CDATA[EMPRESA EMISORA]]></cbc:Name>
      </cac:PartyName>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName><![CDATA[EMPRESA EMISORA]]></cbc:RegistrationName>
        <cac:RegistrationAddress>
          <cbc:AddressTypeCode listAgencyName="PE:SUNAT" listName="Establecimientos anexos">0000</cbc:AddressTypeCode>
        </cac:RegistrationAddress>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingSupplierParty>
  <cac:AccountingCustomerParty>
    <cac:Party>
      <cac:PartyIdentification>
        <cbc:ID schemeID="1" schemeName="Documento de Identidad" schemeAgencyName="PE:SUNAT" schemeURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06">00000000</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName><![CDATA[CLIENTES VARIOS]]></cbc:RegistrationName>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingCustomerParty>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="PEN">0.31</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="PEN">1.69</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="PEN">0.31</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID schemeID="UN/ECE 5305" schemeName="Tax Category Identifier" schemeAgencyName="United Nations Economic Commission for Europe">S</cbc:ID>
        <cac:TaxScheme>
          <cbc:ID schemeName="Codigo de tributos" schemeAgencyName="PE:SUNAT" schemeURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo05">1000</cbc:ID>
          <cbc:Name>IGV</cbc:Name>
          <cbc:TaxTypeCode>VAT</cbc:TaxTypeCode>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
  <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="PEN">1.69</cbc:LineExtensionAmount>
    <cbc:PayableAmount currencyID="PEN">2</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
    <cbc:InvoicedQuantity unitCode="NIU" unitCodeListID="UN/ECE rec 20" unitCodeListAgencyName="United Nations Economic Commission for Europe">1.00</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="PEN">1.69</cbc:LineExtensionAmount>
    <cac:PricingReference>
      <cac:AlternativeConditionPrice>
        <cbc:PriceAmount currencyID="PEN">2.00</cbc:PriceAmount>
        <cbc:PriceTypeCode listName="Tipo de Precio" listAgencyName="PE:SUNAT" listURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo16">01</cbc:PriceTypeCode>
      </cac:AlternativeConditionPrice>
    </cac:PricingReference>
    <cac:TaxTotal>
      <cbc:TaxAmount currencyID="PEN">0.31</cbc:TaxAmount>
      <cac:TaxSubtotal>
        <cbc:TaxableAmount currencyID="PEN">1.69</cbc:TaxableAmount>
        <cbc:TaxAmount currencyID="PEN">0.31</cbc:TaxAmount>
        <cac:TaxCategory>
          <cbc:ID schemeID="UN/ECE 5305" schemeName="Tax Category Identifier" schemeAgencyName="United Nations Economic Commission for Europe">S</cbc:ID>
          <cbc:Percent>18</cbc:Percent>
          <cbc:TaxExemptionReasonCode listAgencyName="PE:SUNAT" listName="Afectacion del IGV" listURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo07">10</cbc:TaxExemptionReasonCode>
          <cac:TaxScheme>
            <cbc:ID schemeName="Codigo de tributos" schemeURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo05" schemeAgencyName="PE:SUNAT">1000</cbc:ID>
            <cbc:Name>IGV</cbc:Name>
            <cbc:TaxTypeCode>VAT</cbc:TaxTypeCode>
          </cac:TaxScheme>
        </cac:TaxCategory>
      </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:Item>
      <cbc:Description><![CDATA[PRODUCTO PRUEBAS]]></cbc:Description>
      <cac:SellersItemIdentification>
        <cbc:ID>23</cbc:ID>
      </cac:SellersItemIdentification>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="PEN">1.6949152542</cbc:PriceAmount>
    </cac:Price>
  </cac:InvoiceLine>
</Invoice>
giansalex commented 4 years ago

Cual es el codigo o codigos de observacion?

zMiguelk3 commented 4 years ago

El código es 4312. "El importe total del comprobante no coincide con el valor calculado"

giansalex commented 4 years ago

Podrias revisar la reglas de validaciones, y verificar que los campos tenga los valores resultantes de las formulas indicadas

zMiguelk3 commented 4 years ago

Las he revisado y al parecer está bien, Sí tienen alguna idea del motivo, sería de gran ayuda un aporte.

34l commented 4 years ago

Te falta la línea cbc:TaxInclusiveAmount Te sugiero actualizar la librería completa Debes usar la función setSubTotal() ... suerte