UNPKG

nodefact

Version:

Biblioteca para facturación electrónica en Perú con Node.js. Compatible con UBL 2.1 y servicios web de SUNAT.

198 lines (186 loc) 8.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.creditNoteTemplate = void 0; /** * Plantilla para Nota de Crédito Electrónica (UBL 2.1) */ const namespaces_1 = require("./namespaces"); exports.creditNoteTemplate = `<?xml version="1.0" encoding="UTF-8"?> <CreditNote xmlns="urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2" xmlns:cac="${namespaces_1.namespaces.cac}" xmlns:cbc="${namespaces_1.namespaces.cbc}" xmlns:ccts="${namespaces_1.namespaces.ccts}" xmlns:ds="${namespaces_1.namespaces.ds}" xmlns:ext="${namespaces_1.namespaces.ext}" xmlns:qdt="${namespaces_1.namespaces.qdt}" xmlns:sac="${namespaces_1.namespaces.sac}" xmlns:udt="${namespaces_1.namespaces.udt}" xmlns:xsi="${namespaces_1.namespaces.xsi}"> <ext:UBLExtensions> <ext:UBLExtension> <ext:ExtensionContent/> </ext:UBLExtension> </ext:UBLExtensions> <!-- Versión del UBL --> <cbc:UBLVersionID>2.1</cbc:UBLVersionID> <!-- Versión de la estructura del documento --> <cbc:CustomizationID>2.0</cbc:CustomizationID> <!-- Número de documento: Serie-Correlativo --> <cbc:ID>{{serie}}-{{correlativo}}</cbc:ID> <!-- Fecha de emisión --> <cbc:IssueDate>{{fechaEmision}}</cbc:IssueDate> <!-- Hora de emisión --> <cbc:IssueTime>{{horaEmision}}</cbc:IssueTime> <!-- Tipo de nota de crédito --> <cbc:CreditNoteTypeCode>{{tipoNota}}</cbc:CreditNoteTypeCode> <!-- Moneda --> <cbc:DocumentCurrencyCode>{{moneda}}</cbc:DocumentCurrencyCode> <!-- Motivo o sustento --> <cbc:DiscrepancyResponse> <cbc:ReferenceID>{{documentoReferencia.serie}}-{{documentoReferencia.correlativo}}</cbc:ReferenceID> <cbc:ResponseCode>{{tipoNota}}</cbc:ResponseCode> <cbc:Description>{{motivo}}</cbc:Description> </cbc:DiscrepancyResponse> <!-- Documento de referencia --> <cac:BillingReference> <cac:InvoiceDocumentReference> <cbc:ID>{{documentoReferencia.serie}}-{{documentoReferencia.correlativo}}</cbc:ID> <cbc:DocumentTypeCode>{{documentoReferencia.tipoDocumento}}</cbc:DocumentTypeCode> <cbc:IssueDate>{{documentoReferencia.fechaEmision}}</cbc:IssueDate> </cac:InvoiceDocumentReference> </cac:BillingReference> <!-- Firma Digital --> <cac:Signature> <cbc:ID>{{signatureID}}</cbc:ID> <cac:SignatoryParty> <cac:PartyIdentification> <cbc:ID>{{emisor.ruc}}</cbc:ID> </cac:PartyIdentification> <cac:PartyName> <cbc:Name>{{emisor.razonSocial}}</cbc:Name> </cac:PartyName> </cac:SignatoryParty> <cac:DigitalSignatureAttachment> <cac:ExternalReference> <cbc:URI>{{signatureURI}}</cbc:URI> </cac:ExternalReference> </cac:DigitalSignatureAttachment> </cac:Signature> <!-- Datos del Emisor --> <cac:AccountingSupplierParty> <cac:Party> <cac:PartyIdentification> <cbc:ID schemeID="6">{{emisor.ruc}}</cbc:ID> </cac:PartyIdentification> <cac:PartyName> <cbc:Name>{{emisor.nombreComercial}}</cbc:Name> </cac:PartyName> <cac:PartyLegalEntity> <cbc:RegistrationName>{{emisor.razonSocial}}</cbc:RegistrationName> <cac:RegistrationAddress> <cbc:ID>{{emisor.direccion.ubigeo}}</cbc:ID> <cbc:AddressTypeCode>0000</cbc:AddressTypeCode> <cbc:CitySubdivisionName>-</cbc:CitySubdivisionName> <cbc:CityName>{{emisor.direccion.provincia}}</cbc:CityName> <cbc:CountrySubentity>{{emisor.direccion.departamento}}</cbc:CountrySubentity> <cbc:District>{{emisor.direccion.distrito}}</cbc:District> <cac:AddressLine> <cbc:Line>{{emisor.direccion.direccion}}</cbc:Line> </cac:AddressLine> <cac:Country> <cbc:IdentificationCode>PE</cbc:IdentificationCode> </cac:Country> </cac:RegistrationAddress> </cac:PartyLegalEntity> </cac:Party> </cac:AccountingSupplierParty> <!-- Datos del Cliente --> <cac:AccountingCustomerParty> <cac:Party> <cac:PartyIdentification> <cbc:ID schemeID="{{receptor.tipoDocumento}}">{{receptor.numeroDocumento}}</cbc:ID> </cac:PartyIdentification> <cac:PartyLegalEntity> <cbc:RegistrationName>{{receptor.razonSocial}}</cbc:RegistrationName> {{#if receptor.direccion}} <cac:RegistrationAddress> {{#if receptor.direccion.ubigeo}} <cbc:ID>{{receptor.direccion.ubigeo}}</cbc:ID> {{/if}} <cac:AddressLine> <cbc:Line>{{receptor.direccion.direccion}}</cbc:Line> </cac:AddressLine> <cac:Country> <cbc:IdentificationCode>PE</cbc:IdentificationCode> </cac:Country> </cac:RegistrationAddress> {{/if}} </cac:PartyLegalEntity> </cac:Party> </cac:AccountingCustomerParty> <!-- Información de Impuestos a nivel de documento --> <cac:TaxTotal> <cbc:TaxAmount currencyID="{{moneda}}">{{impuestos.total}}</cbc:TaxAmount> <!-- IGV --> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="{{moneda}}">{{totalValorVenta}}</cbc:TaxableAmount> <cbc:TaxAmount currencyID="{{moneda}}">{{impuestos.igv}}</cbc:TaxAmount> <cac:TaxCategory> <cac:TaxScheme> <cbc:ID>1000</cbc:ID> <cbc:Name>IGV</cbc:Name> <cbc:TaxTypeCode>VAT</cbc:TaxTypeCode> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <!-- Información de totales --> <cac:LegalMonetaryTotal> <cbc:LineExtensionAmount currencyID="{{moneda}}">{{totalValorVenta}}</cbc:LineExtensionAmount> <cbc:TaxInclusiveAmount currencyID="{{moneda}}">{{totalPrecioVenta}}</cbc:TaxInclusiveAmount> <cbc:PayableAmount currencyID="{{moneda}}">{{totalPrecioVenta}}</cbc:PayableAmount> </cac:LegalMonetaryTotal> <!-- Detalle de ítems --> {{#each items}} <cac:CreditNoteLine> <cbc:ID>{{@index}}</cbc:ID> <cbc:CreditedQuantity unitCode="{{unidadMedida}}">{{cantidad}}</cbc:CreditedQuantity> <cbc:LineExtensionAmount currencyID="{{../moneda}}">{{subtotal}}</cbc:LineExtensionAmount> <!-- Precio unitario --> <cac:PricingReference> <cac:AlternativeConditionPrice> <cbc:PriceAmount currencyID="{{../moneda}}">{{precioUnitario}}</cbc:PriceAmount> <cbc:PriceTypeCode>01</cbc:PriceTypeCode> </cac:AlternativeConditionPrice> </cac:PricingReference> <!-- Impuestos del ítem --> <cac:TaxTotal> <cbc:TaxAmount currencyID="{{../moneda}}">{{igv}}</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="{{../moneda}}">{{subtotal}}</cbc:TaxableAmount> <cbc:TaxAmount currencyID="{{../moneda}}">{{igv}}</cbc:TaxAmount> <cac:TaxCategory> <cbc:Percent>{{porcentajeIGV}}</cbc:Percent> <cbc:TaxExemptionReasonCode>{{tipoIGV}}</cbc:TaxExemptionReasonCode> <cac:TaxScheme> <cbc:ID>1000</cbc:ID> <cbc:Name>IGV</cbc:Name> <cbc:TaxTypeCode>VAT</cbc:TaxTypeCode> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <!-- Descripción del ítem --> <cac:Item> <cbc:Description>{{descripcion}}</cbc:Description> <cac:SellersItemIdentification> <cbc:ID>{{codigo}}</cbc:ID> </cac:SellersItemIdentification> </cac:Item> <!-- Precio unitario sin impuestos --> <cac:Price> <cbc:PriceAmount currencyID="{{../moneda}}">{{valorUnitario}}</cbc:PriceAmount> </cac:Price> </cac:CreditNoteLine> {{/each}} </CreditNote>`;