├── src └── Xml │ ├── Builder │ ├── VoidedBuilder.php │ ├── SummaryBuilder.php │ ├── RetentionBuilder.php │ ├── PerceptionBuilder.php │ ├── DespatchBuilder.php │ ├── InvoiceBuilder.php │ ├── NoteBuilder.php │ └── TwigBuilder.php │ ├── Filter │ ├── FormatFilter.php │ └── TributoFunction.php │ └── Templates │ ├── embededDespatch.xml.twig │ ├── voided.xml.twig │ ├── perception.xml.twig │ ├── retention.xml.twig │ ├── despatch.xml.twig │ ├── summary.xml.twig │ ├── despatch2022.xml.twig │ ├── notadb2.0.xml.twig │ ├── notacr2.0.xml.twig │ ├── invoice2.0.xml.twig │ ├── notadb2.1.xml.twig │ ├── notacr2.1.xml.twig │ └── invoice2.1.xml.twig ├── LICENSE └── composer.json /src/Xml/Builder/VoidedBuilder.php: -------------------------------------------------------------------------------- 1 | render('voided.xml.twig', $document); 32 | } 33 | } -------------------------------------------------------------------------------- /src/Xml/Builder/SummaryBuilder.php: -------------------------------------------------------------------------------- 1 | render('summary.xml.twig', $document); 32 | } 33 | } -------------------------------------------------------------------------------- /src/Xml/Builder/RetentionBuilder.php: -------------------------------------------------------------------------------- 1 | render('retention.xml.twig', $document); 32 | } 33 | } -------------------------------------------------------------------------------- /src/Xml/Builder/PerceptionBuilder.php: -------------------------------------------------------------------------------- 1 | render('perception.xml.twig', $document); 32 | } 33 | } -------------------------------------------------------------------------------- /src/Xml/Filter/FormatFilter.php: -------------------------------------------------------------------------------- 1 | getDecimalsLength($numString) > $decimals || strpos($numString, "E") !== false; 20 | 21 | return $applyFormat ? $this->number($number, $decimals) : $number; 22 | } 23 | 24 | private function getDecimalsLength(string $number): int 25 | { 26 | $lasPosition = strrchr($number, '.'); 27 | if ($lasPosition === false) { 28 | return 0; 29 | } 30 | 31 | return strlen(substr($lasPosition, 1)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Xml/Builder/DespatchBuilder.php: -------------------------------------------------------------------------------- 1 | getVersion() === '2022' ? 'despatch2022.xml.twig': 'despatch.xml.twig'; 34 | 35 | return $this->render($template, $document); 36 | } 37 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Giancarlos Salas 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "greenter/xml", 3 | "description": "XML generación de documentos electrónicos, Facturacion Electrónica SUNAT - Perú", 4 | "keywords": ["greenter", "sunat", "xml", "facturacion-electronica"], 5 | "homepage": "https://greenter.dev/", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Giancarlos Salas", 10 | "email": "giansalex@gmail.com" 11 | } 12 | ], 13 | "support": { 14 | "forum": "https://community.greenter.dev/" 15 | }, 16 | "type": "library", 17 | "require": { 18 | "php": ">=7.4", 19 | "greenter/core": "^5.0", 20 | "twig/twig": "~3.0" 21 | }, 22 | "require-dev": { 23 | "greenter/data": "^5.0", 24 | "greenter/ubl-validator": "^2.0", 25 | "phpunit/phpunit": "^9" 26 | }, 27 | "autoload": { 28 | "psr-4": { 29 | "Greenter\\": "src/" 30 | } 31 | }, 32 | "autoload-dev": { 33 | "psr-4": { 34 | "Tests\\Greenter\\": "tests/" 35 | } 36 | }, 37 | "extra": { 38 | "branch-alias": { 39 | "dev-master": "5.0-dev" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Xml/Builder/InvoiceBuilder.php: -------------------------------------------------------------------------------- 1 | twig->addFunction(new TwigFunction('getTributoAfect', [TributoFunction::class, 'getByAfectacion'])); 32 | } 33 | 34 | /** 35 | * Create xml for document. 36 | * 37 | * @param DocumentInterface $document 38 | * 39 | * @return string 40 | * 41 | * @throws \Exception 42 | */ 43 | public function build(DocumentInterface $document): ?string 44 | { 45 | /** @var Invoice $invoice */ 46 | $invoice = /*.(Invoice).*/ $document; 47 | $template = 'invoice'.$invoice->getUblVersion().'.xml.twig'; 48 | 49 | return $this->render($template, $document); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Xml/Builder/NoteBuilder.php: -------------------------------------------------------------------------------- 1 | twig->addFunction(new TwigFunction('getTributoAfect', [TributoFunction::class, 'getByAfectacion'])); 32 | } 33 | 34 | /** 35 | * Create xml for document. 36 | * 37 | * @param DocumentInterface $document 38 | * 39 | * @return string 40 | */ 41 | public function build(DocumentInterface $document): string 42 | { 43 | /** @var Note $note */ 44 | $note = /*.(Note).*/$document; 45 | $prefix = $note->getTipoDoc() === '07' ? 'notacr' : 'notadb'; 46 | $template = $prefix.$note->getUblVersion().'.xml.twig'; 47 | 48 | return $this->render($template, $document); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Xml/Filter/TributoFunction.php: -------------------------------------------------------------------------------- 1 | ['VAT', 'IGV'], 19 | '1016' => ['VAT', 'IVAP'], 20 | '2000' => ['EXC', 'ISC'], 21 | '9995' => ['FRE', 'EXP'], 22 | '9996' => ['FRE', 'GRA'], 23 | '9997' => ['VAT', 'EXO'], 24 | '9998' => ['FRE', 'INA'], 25 | '9999' => ['OTH', 'OTROS'], 26 | ]; 27 | 28 | public static function getByTributo(?string $code) 29 | { 30 | if (isset(self::$tributos[$code])) { 31 | $values = self::$tributos[$code]; 32 | return [ 33 | 'id' => $code, 34 | 'code' => $values[0], 35 | 'name' => $values[1], 36 | ]; 37 | } 38 | 39 | return null; 40 | } 41 | 42 | public static function getByAfectacion($afectacion) 43 | { 44 | $code = self::getCode($afectacion); 45 | 46 | return self::getByTributo($code); 47 | } 48 | 49 | private static function getCode($afectacion): string 50 | { 51 | $value = (int)$afectacion; 52 | 53 | switch ($value) { 54 | case 10: return '1000'; 55 | case 17: return '1016'; 56 | case 20: return '9997'; 57 | case 30: return '9998'; 58 | case 40: return '9995'; 59 | default: return '9996'; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /src/Xml/Templates/embededDespatch.xml.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ desp.llegada.ubigueo }} 4 | {{ desp.llegada.direccion }} 5 | 6 | 7 | {{ desp.partida.ubigueo }} 8 | {{ desp.partida.direccion }} 9 | 10 | 11 | {{ desp.transportista.numDoc }} 12 | {{ desp.transportista.tipoDoc }} 13 | 14 | 15 | {{ desp.transportista.rznSocial }} 16 | 17 | 18 | 19 | 20 | 21 | 22 | {{ desp.nroLicencia }} 23 | 24 | 25 | 26 | 27 | {{ desp.transpPlaca }} 28 | {{ desp.transpCodeAuth }} 29 | {{ desp.transpMarca }} 30 | 31 | {{ desp.modTraslado }} 32 | {{ desp.pesoBruto|n_format }} 33 | -------------------------------------------------------------------------------- /src/Xml/Builder/TwigBuilder.php: -------------------------------------------------------------------------------- 1 | '/dir/cache' 34 | */ 35 | public function __construct(array $options = []) 36 | { 37 | $this->twig = $this->createTwig($options); 38 | } 39 | 40 | /** 41 | * Get Content XML from template. 42 | * 43 | * @param string $template 44 | * @param object $doc 45 | * 46 | * @return string 47 | */ 48 | public function render($template, $doc): string 49 | { 50 | return $this->twig->render($template, [ 51 | 'doc' => $doc, 52 | ]); 53 | } 54 | 55 | private function createTwig(array $options) 56 | { 57 | $loader = new FilesystemLoader(__DIR__.'/../Templates'); 58 | 59 | $twigEnv = new Environment($loader, $options); 60 | $this->loadFilterAndFunctions($twigEnv); 61 | $this->configureTimezone($twigEnv); 62 | 63 | return $twigEnv; 64 | } 65 | 66 | private function configureTimezone(Environment $twig) 67 | { 68 | $extension = $twig->getExtension(CoreExtension::class); 69 | if ($extension instanceof CoreExtension) { 70 | $extension->setTimezone(TimeZonePe::DEFAULT); 71 | } 72 | } 73 | 74 | /** 75 | * @param Environment $twig 76 | */ 77 | private function loadFilterAndFunctions(Environment $twig) 78 | { 79 | $formatFilter = new FormatFilter(); 80 | 81 | $twig->addFilter(new TwigFilter('n_format', [$formatFilter, 'number'])); 82 | $twig->addFilter(new TwigFilter('n_format_limit', [$formatFilter, 'numberLimit'])); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/Xml/Templates/voided.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2.0 10 | 1.0 11 | {{ doc.xmlId }} 12 | {{ doc.fecGeneracion|date('Y-m-d') }} 13 | {{ doc.fecComunicacion|date('Y-m-d') }} 14 | {% set emp = doc.company %} 15 | 16 | SIGN{{ emp.ruc }} 17 | 18 | 19 | {{ emp.ruc }} 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | #GREENTER-SIGN 28 | 29 | 30 | 31 | 32 | {{ emp.ruc }} 33 | 6 34 | 35 | 36 | 37 | 38 | 39 | 40 | {% for det in doc.details %} 41 | 42 | {{ loop.index }} 43 | {{ det.tipoDoc }} 44 | {{ det.serie }} 45 | {{ det.correlativo }} 46 | 47 | 48 | {% endfor %} 49 | 50 | {% endapply %} -------------------------------------------------------------------------------- /src/Xml/Templates/perception.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2.0 10 | 1.0 11 | {% set emp = doc.company %} 12 | 13 | SIGN{{ emp.ruc }} 14 | 15 | 16 | {{ emp.ruc }} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | #GREENTER-SIGN 25 | 26 | 27 | 28 | {{ doc.serie }}-{{ doc.correlativo }} 29 | {{ doc.fechaEmision|date('Y-m-d') }} 30 | {{ doc.fechaEmision|date('H:i:s') }} 31 | 32 | 33 | {{ emp.ruc }} 34 | 35 | 36 | 37 | 38 | {% set addr = emp.address %} 39 | 40 | {{ addr.ubigueo }} 41 | 42 | {{ addr.departamento }} 43 | {{ addr.provincia }} 44 | {{ addr.distrito }} 45 | 46 | {{ addr.codigoPais }} 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | {{ doc.proveedor.numDoc }} 56 | 57 | 58 | 59 | 60 | 61 | {{ doc.regimen }} 62 | {{ doc.tasa|n_format }} 63 | {% if doc.observacion %} 64 | 65 | {% endif %} 66 | {{ doc.impPercibido|n_format }} 67 | {{ doc.impCobrado|n_format }} 68 | {% for det in doc.details %} 69 | 70 | {{ det.numDoc }} 71 | {{ det.fechaEmision|date('Y-m-d') }} 72 | {{ det.impTotal|n_format }} 73 | {% if det.cobros %} 74 | {% for cob in det.cobros %} 75 | 76 | {{ loop.index }} 77 | {{ cob.importe|n_format }} 78 | {{ cob.fecha|date('Y-m-d') }} 79 | 80 | {% endfor %} 81 | {% endif %} 82 | {% if det.impPercibido and det.impCobrar and det.fechaPercepcion %} 83 | 84 | {{ det.impPercibido|n_format }} 85 | {{ det.fechaPercepcion|date('Y-m-d') }} 86 | {{ det.impCobrar|n_format }} 87 | {% if det.tipoCambio %} 88 | 89 | {{ det.tipoCambio.monedaRef }} 90 | {{ det.tipoCambio.monedaObj }} 91 | {{ det.tipoCambio.factor|n_format(6)}} 92 | {{ det.tipoCambio.fecha|date('Y-m-d') }} 93 | 94 | {% endif %} 95 | 96 | {% endif %} 97 | 98 | {% endfor %} 99 | 100 | {% endapply %} -------------------------------------------------------------------------------- /src/Xml/Templates/retention.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2.0 10 | 1.0 11 | {% set emp = doc.company %} 12 | 13 | SIGN{{ emp.ruc }} 14 | 15 | 16 | {{ emp.ruc }} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | #GREENTER-SIGN 25 | 26 | 27 | 28 | {{ doc.serie }}-{{ doc.correlativo }} 29 | {{ doc.fechaEmision|date('Y-m-d') }} 30 | {{ doc.fechaEmision|date('H:i:s') }} 31 | 32 | 33 | {{ emp.ruc }} 34 | 35 | 36 | 37 | 38 | {% set addr = emp.address %} 39 | 40 | {{ addr.ubigueo }} 41 | 42 | {{ addr.departamento }} 43 | {{ addr.provincia }} 44 | {{ addr.distrito }} 45 | 46 | {{ addr.codigoPais }} 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | {{ doc.proveedor.numDoc }} 56 | 57 | 58 | 59 | 60 | 61 | {{ doc.regimen }} 62 | {{ doc.tasa|n_format }} 63 | {% if doc.observacion %} 64 | 65 | {% endif %} 66 | {{ doc.impRetenido|n_format }} 67 | {{ doc.impPagado|n_format }} 68 | {% for det in doc.details %} 69 | 70 | {{ det.numDoc }} 71 | {{ det.fechaEmision|date('Y-m-d') }} 72 | {{ det.impTotal|n_format }} 73 | {% if det.pagos %} 74 | {% for pay in det.pagos %} 75 | 76 | {{ loop.index }} 77 | {{ pay.importe|n_format }} 78 | {{ pay.fecha|date('Y-m-d') }} 79 | 80 | {% endfor %} 81 | {% endif %} 82 | {% if det.impRetenido and det.impPagar and det.fechaRetencion %} 83 | 84 | {{ det.impRetenido|n_format }} 85 | {{ det.fechaRetencion|date('Y-m-d') }} 86 | {{ det.impPagar|n_format }} 87 | {% if det.tipoCambio %} 88 | 89 | {{ det.tipoCambio.monedaRef }} 90 | {{ det.tipoCambio.monedaObj }} 91 | {{ det.tipoCambio.factor|n_format(6)}} 92 | {{ det.tipoCambio.fecha|date('Y-m-d') }} 93 | 94 | {% endif %} 95 | 96 | {% endif %} 97 | 98 | {% endfor %} 99 | 100 | {% endapply %} -------------------------------------------------------------------------------- /src/Xml/Templates/despatch.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2.1 10 | 1.0 11 | {{ doc.serie }}-{{ doc.correlativo }} 12 | {{ doc.fechaEmision|date('Y-m-d') }} 13 | {{ doc.fechaEmision|date('H:i:s') }} 14 | {{ doc.tipoDoc }} 15 | {% if doc.observacion %} 16 | 17 | {% endif %} 18 | {% if doc.docBaja %} 19 | 20 | {{ doc.docBaja.nroDoc }} 21 | {{ doc.docBaja.tipoDoc }} 22 | 23 | {% endif %} 24 | {% if doc.relDoc %} 25 | 26 | {{ doc.relDoc.nroDoc }} 27 | {{ doc.relDoc.tipoDoc }} 28 | 29 | {% endif %} 30 | {% set emp = doc.company %} 31 | 32 | SIGN{{ emp.ruc }} 33 | 34 | 35 | {{ emp.ruc }} 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | #GREENTER-SIGN 44 | 45 | 46 | 47 | 48 | {{ emp.ruc }} 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | {{ doc.destinatario.numDoc }} 57 | 58 | 59 | 60 | 61 | 62 | 63 | {% if doc.tercero %} 64 | 65 | {{ doc.tercero.numDoc }} 66 | 67 | 68 | 69 | 70 | 71 | 72 | {% endif %} 73 | {% set envio = doc.envio %} 74 | 75 | 1 76 | {{ envio.codTraslado }} 77 | {% if envio.desTraslado %} 78 | {{ envio.desTraslado }} 79 | {% endif %} 80 | {{ envio.pesoTotal|n_format(3) }} 81 | {% if envio.numBultos %} 82 | {{ envio.numBultos }} 83 | {% endif %} 84 | {{ envio.indTransbordo ? "true" : "false" }} 85 | 86 | {{ envio.modTraslado }} 87 | 88 | {{ envio.fecTraslado|date('Y-m-d') }} 89 | 90 | {% if envio.transportista %} 91 | 92 | 93 | {{ envio.transportista.numDoc }} 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | {{ envio.transportista.placa }} 102 | 103 | 104 | 105 | {{ envio.transportista.choferDoc }} 106 | 107 | {% endif %} 108 | 109 | 110 | 111 | {{ envio.llegada.ubigueo }} 112 | {{ envio.llegada.direccion }} 113 | 114 | 115 | {% if envio.numContenedor %} 116 | 117 | {{ envio.numContenedor }} 118 | 119 | {% endif %} 120 | 121 | {{ envio.partida.ubigueo }} 122 | {{ envio.partida.direccion }} 123 | 124 | {% if envio.codPuerto %} 125 | 126 | {{ envio.codPuerto }} 127 | 128 | {% endif %} 129 | 130 | {% for det in doc.details %} 131 | 132 | {{ loop.index }} 133 | {{ det.cantidad }} 134 | 135 | {{ loop.index }} 136 | 137 | 138 | 139 | 140 | {{ det.codigo }} 141 | 142 | {% if det.codProdSunat %} 143 | 144 | {{ det.codProdSunat }} 145 | 146 | {% endif %} 147 | 148 | 149 | {% endfor %} 150 | 151 | {% endapply %} 152 | -------------------------------------------------------------------------------- /src/Xml/Templates/summary.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2.0 10 | 1.1 11 | {{ doc.xmlId }} 12 | {{ doc.fecGeneracion|date('Y-m-d') }} 13 | {{ doc.fecResumen|date('Y-m-d') }} 14 | {% set emp = doc.company %} 15 | 16 | SIGN{{ emp.ruc }} 17 | 18 | 19 | {{ emp.ruc }} 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | #GREENTER-SIGN 28 | 29 | 30 | 31 | 32 | {{ emp.ruc }} 33 | 6 34 | 35 | 36 | 37 | 38 | 39 | 40 | {% for det in doc.details %} 41 | 42 | {{ loop.index }} 43 | {{ det.tipoDoc }} 44 | {{ det.serieNro }} 45 | 46 | {{ det.clienteNro }} 47 | {{ det.clienteTipo }} 48 | 49 | {% if det.docReferencia %} 50 | 51 | 52 | {{ det.docReferencia.nroDoc }} 53 | {{ det.docReferencia.tipoDoc }} 54 | 55 | 56 | {% endif %} 57 | {% if det.percepcion %} 58 | {% set perc = det.percepcion %} 59 | 60 | {{ perc.codReg }} 61 | {{ perc.tasa|n_format }} 62 | {{ perc.mto|n_format }} 63 | {{ perc.mtoTotal|n_format }} 64 | {{ perc.mtoBase|n_format }} 65 | 66 | {% endif %} 67 | 68 | {{ det.estado }} 69 | 70 | {{ det.total|n_format }} 71 | {% if det.mtoOperGravadas is not null %} 72 | 73 | {{ det.mtoOperGravadas|n_format }} 74 | 01 75 | 76 | {% endif %} 77 | {% if det.mtoOperExoneradas %} 78 | 79 | {{ det.mtoOperExoneradas|n_format }} 80 | 02 81 | 82 | {% endif %} 83 | {% if det.mtoOperInafectas %} 84 | 85 | {{ det.mtoOperInafectas|n_format }} 86 | 03 87 | 88 | {% endif %} 89 | {% if det.mtoOperExportacion %} 90 | 91 | {{ det.mtoOperExportacion|n_format }} 92 | 04 93 | 94 | {% endif %} 95 | {% if det.mtoOperGratuitas %} 96 | 97 | {{ det.mtoOperGratuitas|n_format }} 98 | 05 99 | 100 | {% endif %} 101 | {% if det.mtoOtrosCargos %} 102 | 103 | true 104 | {{ det.mtoOtrosCargos|n_format }} 105 | 106 | {% endif %} 107 | {% if det.mtoIvap %} 108 | {% set ivap = det.mtoIvap|n_format %} 109 | 110 | {{ ivap }} 111 | 112 | {{ ivap }} 113 | 114 | 115 | 1016 116 | IVAP 117 | VAT 118 | 119 | 120 | 121 | 122 | {% else %} 123 | {% set igv = det.mtoIGV|n_format %} 124 | 125 | {{ igv }} 126 | 127 | {{ igv }} 128 | 129 | 130 | 1000 131 | IGV 132 | VAT 133 | 134 | 135 | 136 | 137 | {% endif %} 138 | {% if det.mtoISC %} 139 | {% set isc = det.mtoISC|n_format %} 140 | 141 | {{ isc }} 142 | 143 | {{isc }} 144 | 145 | 146 | 2000 147 | ISC 148 | EXC 149 | 150 | 151 | 152 | 153 | {% endif %} 154 | {% if det.mtoOtrosTributos %} 155 | {% set oth = det.mtoOtrosTributos|n_format %} 156 | 157 | {{ oth }} 158 | 159 | {{ oth }} 160 | 161 | 162 | 9999 163 | OTROS 164 | OTH 165 | 166 | 167 | 168 | 169 | {% endif %} 170 | {% if det.mtoIcbper %} 171 | {% set icbper = det.mtoIcbper|n_format %} 172 | 173 | {{ icbper }} 174 | 175 | {{ icbper }} 176 | 177 | 178 | 7152 179 | ICBPER 180 | OTH 181 | 182 | 183 | 184 | 185 | {% endif %} 186 | 187 | {% endfor %} 188 | 189 | {% endapply %} -------------------------------------------------------------------------------- /src/Xml/Templates/despatch2022.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2.1 10 | 2.0 11 | {{ doc.serie }}-{{ doc.correlativo }} 12 | {{ doc.fechaEmision|date('Y-m-d') }} 13 | {{ doc.fechaEmision|date('H:i:s') }} 14 | {{ doc.tipoDoc }} 15 | {% if doc.observacion %} 16 | 17 | {% endif %} 18 | {% for rel in doc.addDocs %} 19 | 20 | {{ rel.nro }} 21 | {{ rel.tipo }} 22 | {{ rel.tipoDesc }} 23 | {% if rel.emisor %} 24 | 25 | 26 | {{ rel.emisor }} 27 | 28 | 29 | {% endif %} 30 | 31 | {% endfor %} 32 | {% set emp = doc.company %} 33 | 34 | SIGN{{ emp.ruc }} 35 | 36 | 37 | {{ emp.ruc }} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | #GREENTER-SIGN 46 | 47 | 48 | 49 | 50 | 51 | 52 | {{ emp.ruc }} 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | {{ doc.destinatario.numDoc }} 63 | 64 | 65 | 66 | 67 | 68 | 69 | {% if doc.comprador %} 70 | 71 | 72 | 73 | {{ doc.comprador.numDoc }} 74 | 75 | 76 | 77 | 78 | 79 | 80 | {% endif %} 81 | {% if doc.tercero %} 82 | 83 | 84 | 85 | {{ doc.tercero.numDoc }} 86 | 87 | 88 | 89 | 90 | 91 | 92 | {% endif %} 93 | {% set envio = doc.envio %} 94 | 95 | SUNAT_Envio 96 | {{ envio.codTraslado }} 97 | {% if envio.desTraslado %} 98 | {{ envio.desTraslado }} 99 | {% endif %} 100 | {% if envio.sustentoPeso %} 101 | {{ envio.sustentoPeso }} 102 | {% endif %} 103 | {{ envio.pesoTotal|n_format(3) }} 104 | {% if envio.pesoItems %} 105 | {{ envio.pesoItems|n_format(3) }} 106 | {% endif %} 107 | {% if envio.numBultos %} 108 | {{ envio.numBultos }} 109 | {% endif %} 110 | {% for indicador in envio.indicadores %} 111 | {{ indicador }} 112 | {% endfor %} 113 | 114 | {{ envio.modTraslado }} 115 | {% if envio.fecTraslado %} 116 | 117 | {{ envio.fecTraslado|date('Y-m-d') }} 118 | 119 | {% endif %} 120 | {% if envio.transportista %} 121 | 122 | 123 | {{ envio.transportista.numDoc }} 124 | 125 | 126 | 127 | {{ envio.transportista.nroMtc }} 128 | 129 | 130 | {% endif %} 131 | {% for chofer in envio.choferes %} 132 | 133 | {{ chofer.nroDoc }} 134 | {{ chofer.nombres }} 135 | {{ chofer.apellidos }} 136 | {{ chofer.tipo }} 137 | 138 | {{ chofer.licencia }} 139 | 140 | 141 | {% endfor %} 142 | 143 | 144 | 145 | {{ envio.llegada.ubigueo }} 146 | {% if envio.llegada.codLocal %} 147 | {{ envio.llegada.codLocal }} 148 | {% endif %} 149 | 150 | {{ envio.llegada.direccion }} 151 | 152 | 153 | 154 | 155 | {{ envio.partida.ubigueo }} 156 | {% if envio.partida.codLocal %} 157 | {{ envio.partida.codLocal }} 158 | {% endif %} 159 | 160 | {{ envio.partida.direccion }} 161 | 162 | 163 | 164 | 165 | {% for precinto in envio.contenedores %} 166 | 167 | 168 | {{ loop.index }} 169 | {{ precinto }} 170 | 171 | 172 | {% endfor %} 173 | {% if envio.vehiculo %} 174 | 175 | 176 | {{ envio.vehiculo.placa }} 177 | {% if envio.vehiculo.nroCirculacion %} 178 | 179 | {{ envio.vehiculo.nroCirculacion }} 180 | 181 | {% endif %} 182 | {% for sec in envio.vehiculo.secundarios %} 183 | 184 | {{ sec.placa }} 185 | {% if sec.nroCirculacion %} 186 | 187 | {{ sec.nroCirculacion }} 188 | 189 | {% endif %} 190 | {% if sec.nroAutorizacion %} 191 | 192 | {{ sec.nroAutorizacion }} 193 | 194 | {% endif %} 195 | 196 | {% endfor %} 197 | {% if envio.vehiculo.nroAutorizacion %} 198 | 199 | {{ envio.vehiculo.nroAutorizacion }} 200 | 201 | {% endif %} 202 | 203 | 204 | {% endif %} 205 | {% if envio.puerto %} 206 | 207 | {{ envio.puerto.codigo }} 208 | 1 209 | {{ envio.puerto.nombre }} 210 | 211 | {% elseif envio.aeropuerto %} 212 | 213 | {{ envio.aeropuerto.codigo }} 214 | 2 215 | {{ envio.aeropuerto.nombre }} 216 | 217 | {% endif %} 218 | 219 | {% for det in doc.details %} 220 | 221 | {{ loop.index }} 222 | {{ det.cantidad|n_format_limit(10) }} 223 | 224 | {{ loop.index }} 225 | 226 | 227 | 228 | 229 | {{ det.codigo }} 230 | 231 | {% if det.codProdSunat %} 232 | 233 | {{ det.codProdSunat }} 234 | 235 | {% endif %} 236 | {% for atr in det.atributos %} 237 | 238 | {{ atr.name }} 239 | {{ atr.code }} 240 | {% if atr.value %} 241 | {{ atr.value }} 242 | {% endif %} 243 | 244 | {% endfor %} 245 | 246 | 247 | {% endfor %} 248 | 249 | {% endapply %} 250 | -------------------------------------------------------------------------------- /src/Xml/Templates/notadb2.0.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | {% if doc.mtoOperGravadas %} 9 | 10 | 1001 11 | {{ doc.mtoOperGravadas|n_format }} 12 | 13 | {% endif %} 14 | {% if doc.mtoOperInafectas %} 15 | 16 | 1002 17 | {{ doc.mtoOperInafectas|n_format }} 18 | 19 | {% endif %} 20 | {% if doc.mtoOperExoneradas %} 21 | 22 | 1003 23 | {{ doc.mtoOperExoneradas|n_format }} 24 | 25 | {% endif %} 26 | {% if doc.perception %} 27 | {% set perc = doc.perception %} 28 | 29 | 2001 30 | {{ perc.mtoBase|n_format }} 31 | {{ perc.mto|n_format }} 32 | {{ perc.mtoTotal|n_format }} 33 | 34 | 35 | 2000 36 | COMPROBANTE DE PERCEPCION 37 | 38 | {% endif %} 39 | {% if doc.mtoOperGratuitas %} 40 | 41 | 1004 42 | {{ doc.mtoOperGratuitas|n_format }} 43 | 44 | {% endif %} 45 | {% for leg in doc.legends %} 46 | 47 | {{ leg.code }} 48 | {{ leg.value }} 49 | 50 | {% endfor %} 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 2.0 59 | 1.0 60 | {{ doc.serie }}-{{ doc.correlativo }} 61 | {{ doc.fechaEmision|date('Y-m-d') }} 62 | {{ doc.fechaEmision|date('H:i:s') }} 63 | {{ doc.tipoMoneda }} 64 | 65 | {{ doc.numDocfectado }} 66 | {{ doc.codMotivo }} 67 | {{ doc.desMotivo }} 68 | 69 | 70 | 71 | {{ doc.numDocfectado }} 72 | {{ doc.tipDocAfectado }} 73 | 74 | 75 | {% if doc.relDocs %} 76 | {% for rel in doc.relDocs %} 77 | 78 | {{ rel.nroDoc }} 79 | {{ rel.tipoDoc }} 80 | 81 | {% endfor %} 82 | {% endif %} 83 | {% set emp = doc.company %} 84 | 85 | SIGN{{ emp.ruc }} 86 | 87 | 88 | {{ emp.ruc }} 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | #GREENTER-SIGN 97 | 98 | 99 | 100 | 101 | {{ emp.ruc }} 102 | 6 103 | 104 | 105 | 106 | 107 | {% set addr = emp.address %} 108 | 109 | {{ addr.ubigueo }} 110 | 111 | {{ addr.departamento }} 112 | {{ addr.provincia }} 113 | {{ addr.distrito }} 114 | 115 | {{ addr.codigoPais }} 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | {% set client = doc.client %} 124 | 125 | {{ client.numDoc }} 126 | {{ client.tipoDoc }} 127 | 128 | {% if client.address %} 129 | {% set addr = client.address %} 130 | 131 | {{ addr.ubigueo }} 132 | 133 | 134 | {{ addr.codigoPais }} 135 | 136 | 137 | {% endif %} 138 | 139 | 140 | 141 | 142 | 143 | {% if doc.mtoISC %} 144 | {% set iscT = doc.mtoISC|n_format %} 145 | 146 | {{ iscT }} 147 | 148 | {{ iscT }} 149 | 150 | 151 | 2000 152 | ISC 153 | EXC 154 | 155 | 156 | 157 | 158 | {% endif %} 159 | {% if doc.mtoIGV %} 160 | {% set igvT = doc.mtoIGV|n_format %} 161 | 162 | {{ igvT }} 163 | 164 | {{ igvT }} 165 | 166 | 167 | 1000 168 | IGV 169 | VAT 170 | 171 | 172 | 173 | 174 | {% endif %} 175 | {% if doc.sumOtrosCargos %} 176 | {% set othT = doc.sumOtrosCargos|n_format %} 177 | 178 | {{ othT }} 179 | 180 | {{ othT }} 181 | 182 | 183 | 9999 184 | OTROS 185 | OTH 186 | 187 | 188 | 189 | 190 | {% endif %} 191 | 192 | {{ doc.mtoOtrosTributos|default(0)|n_format }} 193 | {{ doc.mtoImpVenta|n_format }} 194 | 195 | {% for detail in doc.details %} 196 | 197 | {{ loop.index }} 198 | {{ detail.cantidad }} 199 | {{ detail.mtoValorVenta|n_format }} 200 | 201 | {% if detail.mtoValorGratuito %} 202 | 203 | {{ detail.mtoValorGratuito|n_format }} 204 | 02 205 | 206 | {% else %} 207 | 208 | {{ detail.mtoPrecioUnitario|n_format }} 209 | 01 210 | 211 | {% endif %} 212 | 213 | {% if detail.isc %} 214 | {% set isc = detail.isc|n_format %} 215 | 216 | {{ isc }} 217 | 218 | {{ isc }} 219 | 220 | {{ detail.tipSisIsc }} 221 | 222 | 2000 223 | ISC 224 | EXC 225 | 226 | 227 | 228 | 229 | {% endif %} 230 | {% if detail.igv %} 231 | {% set igv = detail.igv|n_format %} 232 | 233 | {{ igv }} 234 | 235 | {{ igv }} 236 | 237 | {{ detail.tipAfeIgv }} 238 | 239 | 1000 240 | IGV 241 | VAT 242 | 243 | 244 | 245 | 246 | {% endif %} 247 | 248 | 249 | 250 | {{ detail.codProducto }} 251 | 252 | {% if detail.codProdSunat %} 253 | 254 | {{ detail.codProdSunat }} 255 | 256 | {% endif %} 257 | 258 | 259 | {{ detail.mtoValorUnitario|n_format }} 260 | 261 | 262 | {% endfor %} 263 | 264 | {% endapply %} -------------------------------------------------------------------------------- /src/Xml/Templates/notacr2.0.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | {% if doc.mtoOperGravadas %} 9 | 10 | 1001 11 | {{ doc.mtoOperGravadas|n_format }} 12 | 13 | {% endif %} 14 | {% if doc.mtoOperInafectas %} 15 | 16 | 1002 17 | {{ doc.mtoOperInafectas|n_format }} 18 | 19 | {% endif %} 20 | {% if doc.mtoOperExoneradas %} 21 | 22 | 1003 23 | {{ doc.mtoOperExoneradas|n_format }} 24 | 25 | {% endif %} 26 | {% if doc.perception %} 27 | {% set perc = doc.perception %} 28 | 29 | 2001 30 | {{ perc.mtoBase|n_format }} 31 | {{ perc.mto|n_format }} 32 | {{ perc.mtoTotal|n_format }} 33 | 34 | 35 | 2000 36 | COMPROBANTE DE PERCEPCION 37 | 38 | {% endif %} 39 | {% if doc.mtoOperGratuitas %} 40 | 41 | 1004 42 | {{ doc.mtoOperGratuitas|n_format }} 43 | 44 | {% endif %} 45 | {% for leg in doc.legends %} 46 | 47 | {{ leg.code }} 48 | {{ leg.value }} 49 | 50 | {% endfor %} 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 2.0 59 | 1.0 60 | {{ doc.serie }}-{{ doc.correlativo }} 61 | {{ doc.fechaEmision|date('Y-m-d') }} 62 | {{ doc.fechaEmision|date('H:i:s') }} 63 | {{ doc.tipoMoneda }} 64 | 65 | {{ doc.numDocfectado }} 66 | {{ doc.codMotivo }} 67 | {{ doc.desMotivo }} 68 | 69 | 70 | 71 | {{ doc.numDocfectado }} 72 | {{ doc.tipDocAfectado }} 73 | 74 | 75 | {% if doc.guias %} 76 | {% for guia in doc.guias %} 77 | 78 | {{ guia.nroDoc }} 79 | {{ guia.tipoDoc }} 80 | 81 | {% endfor %} 82 | {% endif %} 83 | {% if doc.relDocs %} 84 | {% for rel in doc.relDocs %} 85 | 86 | {{ rel.nroDoc }} 87 | {{ rel.tipoDoc }} 88 | 89 | {% endfor %} 90 | {% endif %} 91 | {% set emp = doc.company %} 92 | 93 | SIGN{{ emp.ruc }} 94 | 95 | 96 | {{ emp.ruc }} 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | #GREENTER-SIGN 105 | 106 | 107 | 108 | 109 | {{ emp.ruc }} 110 | 6 111 | 112 | 113 | 114 | 115 | {% set addr = emp.address %} 116 | 117 | {{ addr.ubigueo }} 118 | 119 | {{ addr.departamento }} 120 | {{ addr.provincia }} 121 | {{ addr.distrito }} 122 | 123 | {{ addr.codigoPais }} 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | {% set client = doc.client %} 132 | 133 | {{ client.numDoc }} 134 | {{ client.tipoDoc }} 135 | 136 | {% if client.address %} 137 | {% set addr = client.address %} 138 | 139 | {{ addr.ubigueo }} 140 | 141 | 142 | {{ addr.codigoPais }} 143 | 144 | 145 | {% endif %} 146 | 147 | 148 | 149 | 150 | 151 | {% if doc.mtoISC %} 152 | {% set iscT = doc.mtoISC|n_format %} 153 | 154 | {{ iscT }} 155 | 156 | {{ iscT }} 157 | 158 | 159 | 2000 160 | ISC 161 | EXC 162 | 163 | 164 | 165 | 166 | {% endif %} 167 | {% if doc.mtoIGV %} 168 | {% set igvT = doc.mtoIGV|n_format %} 169 | 170 | {{ igvT }} 171 | 172 | {{ igvT }} 173 | 174 | 175 | 1000 176 | IGV 177 | VAT 178 | 179 | 180 | 181 | 182 | {% endif %} 183 | {% if doc.sumOtrosCargos %} 184 | {% set othT = doc.sumOtrosCargos|n_format %} 185 | 186 | {{ othT }} 187 | 188 | {{ othT }} 189 | 190 | 191 | 9999 192 | OTROS 193 | OTH 194 | 195 | 196 | 197 | 198 | {% endif %} 199 | 200 | {{ doc.mtoOtrosTributos|default(0)|n_format }} 201 | {{ doc.mtoImpVenta|n_format }} 202 | 203 | {% for detail in doc.details %} 204 | 205 | {{ loop.index }} 206 | {{ detail.cantidad }} 207 | {{ detail.mtoValorVenta|n_format }} 208 | 209 | {% if detail.mtoValorGratuito %} 210 | 211 | {{ detail.mtoValorGratuito|n_format }} 212 | 02 213 | 214 | {% else %} 215 | 216 | {{ detail.mtoPrecioUnitario|n_format }} 217 | 01 218 | 219 | {% endif %} 220 | 221 | {% if detail.isc %} 222 | {% set isc = detail.isc|n_format %} 223 | 224 | {{ isc }} 225 | 226 | {{ isc }} 227 | 228 | {{ detail.tipSisIsc }} 229 | 230 | 2000 231 | ISC 232 | EXC 233 | 234 | 235 | 236 | 237 | {% endif %} 238 | {% if detail.igv %} 239 | {% set igv = detail.igv|n_format %} 240 | 241 | {{ igv }} 242 | 243 | {{ igv }} 244 | 245 | {{ detail.tipAfeIgv }} 246 | 247 | 1000 248 | IGV 249 | VAT 250 | 251 | 252 | 253 | 254 | {% endif %} 255 | 256 | 257 | 258 | {{ detail.codProducto }} 259 | 260 | {% if detail.codProdSunat %} 261 | 262 | {{ detail.codProdSunat }} 263 | 264 | {% endif %} 265 | 266 | 267 | {{ detail.mtoValorUnitario|n_format }} 268 | 269 | 270 | {% endfor %} 271 | 272 | {% endapply %} -------------------------------------------------------------------------------- /src/Xml/Templates/invoice2.0.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | {% if doc.mtoDescuentos %} 9 | 10 | 2005 11 | {{ doc.mtoDescuentos|n_format }} 12 | 13 | {% endif %} 14 | {% if doc.mtoOperGravadas %} 15 | 16 | 1001 17 | {{ doc.mtoOperGravadas|n_format }} 18 | 19 | {% endif %} 20 | 21 | 1002 22 | {{ doc.mtoOperInafectas|n_format }} 23 | 24 | 25 | 1003 26 | {{ doc.mtoOperExoneradas|n_format }} 27 | 28 | {% if doc.mtoOperGratuitas %} 29 | 30 | 1004 31 | {{ doc.mtoOperGratuitas|n_format }} 32 | 33 | {% endif %} 34 | {% if doc.detraccion %} 35 | {% set detr = doc.detraccion %} 36 | 37 | 2003 38 | {% if detr.valueRef %} 39 | {{ detr.valueRef|n_format }} 40 | {% endif %} 41 | {{ detr.mount|n_format }} 42 | {{ detr.percent|n_format }} 43 | 44 | {% endif %} 45 | {% if doc.perception %} 46 | {% set perc = doc.perception %} 47 | 48 | 2001 49 | {{ perc.mtoBase|n_format }} 50 | {{ perc.mto|n_format }} 51 | {{ perc.mtoTotal|n_format }} 52 | 53 | 54 | 2000 55 | COMPROBANTE DE PERCEPCION 56 | 57 | {% endif %} 58 | {% for leg in doc.legends %} 59 | 60 | {{ leg.code }} 61 | {{ leg.value }} 62 | 63 | {% endfor %} 64 | {% if doc.guiaEmbebida %} 65 | {% include 'embededDespatch.xml.twig' with {'desp': doc.guiaEmbebida} only %} 66 | {% endif %} 67 | {% if doc.tipoOperacion %} 68 | 69 | {{ doc.tipoOperacion }} 70 | 71 | {% endif %} 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 2.0 80 | 1.0 81 | {{ doc.serie }}-{{ doc.correlativo }} 82 | {{ doc.fechaEmision|date('Y-m-d') }} 83 | {{ doc.fechaEmision|date('H:i:s') }} 84 | {{ doc.tipoDoc }} 85 | {{ doc.tipoMoneda }} 86 | {% if doc.compra %} 87 | 88 | {{ doc.compra }} 89 | 90 | {% endif %} 91 | {% if doc.guias %} 92 | {% for guia in doc.guias %} 93 | 94 | {{ guia.nroDoc }} 95 | {{ guia.tipoDoc }} 96 | 97 | {% endfor %} 98 | {% endif %} 99 | {% if doc.relDocs %} 100 | {% for rel in doc.relDocs %} 101 | 102 | {{ rel.nroDoc }} 103 | {{ rel.tipoDoc }} 104 | 105 | {% endfor %} 106 | {% endif %} 107 | {% set emp = doc.company %} 108 | 109 | SIGN{{ emp.ruc }} 110 | 111 | 112 | {{ emp.ruc }} 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | #GREENTER-SIGN 121 | 122 | 123 | 124 | 125 | {{ emp.ruc }} 126 | 6 127 | 128 | 129 | 130 | 131 | {% set addr = emp.address %} 132 | 133 | {{ addr.ubigueo }} 134 | 135 | {{ addr.departamento }} 136 | {{ addr.provincia }} 137 | {{ addr.distrito }} 138 | 139 | {{ addr.codigoPais }} 140 | 141 | 142 | 143 | 144 | 145 | {% if emp.email or emp.telephone %} 146 | 147 | {% if emp.telephone %} 148 | {{ emp.telephone }} 149 | {% endif %} 150 | {% if emp.email %} 151 | {{ emp.email }} 152 | {% endif %} 153 | 154 | {% endif %} 155 | 156 | 157 | {% set client = doc.client %} 158 | 159 | {{ client.numDoc }} 160 | {{ client.tipoDoc }} 161 | 162 | {% if client.address %} 163 | {% set addr = client.address %} 164 | 165 | {% if addr.ubigueo %} 166 | {{ addr.ubigueo }} 167 | {% endif %} 168 | 169 | 170 | {{ addr.codigoPais }} 171 | 172 | 173 | {% endif %} 174 | 175 | 176 | 177 | {% if client.email or client.telephone %} 178 | 179 | {% if client.telephone %} 180 | {{ client.telephone }} 181 | {% endif %} 182 | {% if client.email %} 183 | {{ client.email }} 184 | {% endif %} 185 | 186 | {% endif %} 187 | 188 | 189 | {% set seller = doc.seller %} 190 | {% if seller %} 191 | 192 | {{ seller.numDoc }} 193 | {{ seller.tipoDoc }} 194 | 195 | {% if seller.address %} 196 | {% set addr = seller.address %} 197 | 198 | {% if addr.ubigueo %} 199 | {{ addr.ubigueo }} 200 | {% endif %} 201 | 202 | 203 | {{ addr.codigoPais }} 204 | 205 | 206 | {% endif %} 207 | 208 | 209 | 210 | {% if seller.email or seller.telephone %} 211 | 212 | {% if seller.telephone %} 213 | {{ seller.telephone }} 214 | {% endif %} 215 | {% if seller.email %} 216 | {{ seller.email }} 217 | {% endif %} 218 | 219 | {% endif %} 220 | 221 | 222 | {% endif %} 223 | {% if doc.fecVencimiento %} 224 | 225 | - 226 | {{ doc.fecVencimiento|date('Y-m-d') }} 227 | 228 | {% endif %} 229 | {% if doc.anticipos %} 230 | {% for ant in doc.anticipos %} 231 | 232 | {{ ant.nroDocRel }} 233 | {{ ant.total|n_format }} 234 | {{ emp.ruc }} 235 | 236 | {% endfor %} 237 | {% endif %} 238 | {% if doc.mtoISC %} 239 | {% set iscT = doc.mtoISC|n_format %} 240 | 241 | {{ iscT }} 242 | 243 | {{ iscT }} 244 | 245 | 246 | 2000 247 | ISC 248 | EXC 249 | 250 | 251 | 252 | 253 | {% endif %} 254 | {% set igvT = doc.mtoIGV|default(0)|n_format %} 255 | 256 | {{ igvT }} 257 | 258 | {{ igvT }} 259 | 260 | 261 | 1000 262 | IGV 263 | VAT 264 | 265 | 266 | 267 | 268 | {% if doc.sumOtrosCargos %} 269 | {% set othT = doc.sumOtrosCargos|n_format %} 270 | 271 | {{ othT }} 272 | 273 | {{ othT }} 274 | 275 | 276 | 9999 277 | OTROS 278 | OTH 279 | 280 | 281 | 282 | 283 | {% endif %} 284 | 285 | {{ doc.sumDsctoGlobal|default(0)|n_format }} 286 | {{ doc.mtoOtrosTributos|default(0)|n_format }} 287 | {% if doc.totalAnticipos is not null %}{{ doc.totalAnticipos|n_format }}{% endif %} 288 | {{ doc.mtoImpVenta|n_format }} 289 | 290 | {% for detail in doc.details %} 291 | 292 | {{ loop.index }} 293 | {{ detail.cantidad }} 294 | {{ detail.mtoValorVenta|n_format }} 295 | 296 | {% if detail.mtoValorGratuito %} 297 | 298 | {{ detail.mtoValorGratuito|n_format }} 299 | 02 300 | 301 | {% else %} 302 | 303 | {{ detail.mtoPrecioUnitario|n_format }} 304 | 01 305 | 306 | {% endif %} 307 | 308 | {% if detail.descuento %} 309 | 310 | false 311 | 00 312 | {{ detail.descuento|n_format }} 313 | 314 | {% endif %} 315 | {% if detail.isc %} 316 | {% set isc = detail.isc|n_format %} 317 | 318 | {{ isc }} 319 | 320 | {{ isc }} 321 | 322 | {{ detail.tipSisIsc }} 323 | 324 | 2000 325 | ISC 326 | EXC 327 | 328 | 329 | 330 | 331 | {% endif %} 332 | {% if detail.igv %} 333 | {% set igv = detail.igv|n_format %} 334 | 335 | {{ igv }} 336 | 337 | {{ igv }} 338 | 339 | {{ detail.tipAfeIgv }} 340 | {% set afect = getTributoAfect(detail.tipAfeIgv) %} 341 | 342 | {{ afect.id }} 343 | {{ afect.name }} 344 | {{ afect.code }} 345 | 346 | 347 | 348 | 349 | {% endif %} 350 | 351 | 352 | 353 | {{ detail.codProducto }} 354 | 355 | {% if detail.codProdSunat %} 356 | 357 | {{ detail.codProdSunat }} 358 | 359 | {% endif %} 360 | 361 | 362 | {{ detail.mtoValorUnitario|n_format }} 363 | 364 | 365 | {% endfor %} 366 | 367 | {% endapply %} -------------------------------------------------------------------------------- /src/Xml/Templates/notadb2.1.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2.1 10 | 2.0 11 | {{ doc.serie }}-{{ doc.correlativo }} 12 | {{ doc.fechaEmision|date('Y-m-d') }} 13 | {{ doc.fechaEmision|date('H:i:s') }} 14 | {% for leg in doc.legends %} 15 | 16 | {% endfor %} 17 | {{ doc.tipoMoneda }} 18 | 19 | {{ doc.numDocfectado }} 20 | {{ doc.codMotivo }} 21 | {{ doc.desMotivo }} 22 | 23 | {% if doc.compra %} 24 | 25 | {{ doc.compra }} 26 | 27 | {% endif %} 28 | 29 | 30 | {{ doc.numDocfectado }} 31 | {{ doc.tipDocAfectado }} 32 | 33 | 34 | {% if doc.guias %} 35 | {% for guia in doc.guias %} 36 | 37 | {{ guia.nroDoc }} 38 | {{ guia.tipoDoc }} 39 | 40 | {% endfor %} 41 | {% endif %} 42 | {% if doc.relDocs %} 43 | {% for rel in doc.relDocs %} 44 | 45 | {{ rel.nroDoc }} 46 | {{ rel.tipoDoc }} 47 | 48 | {% endfor %} 49 | {% endif %} 50 | {% set emp = doc.company %} 51 | 52 | SIGN{{ emp.ruc }} 53 | 54 | 55 | {{ emp.ruc }} 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | #GREENTER-SIGN 64 | 65 | 66 | 67 | 68 | 69 | 70 | {{ emp.ruc }} 71 | 72 | 73 | 74 | 75 | 76 | 77 | {% set addr = emp.address %} 78 | 79 | {{ addr.ubigueo }} 80 | {{ addr.codLocal }} 81 | {% if addr.urbanizacion %} 82 | {{ addr.urbanizacion }} 83 | {% endif %} 84 | {{ addr.provincia }} 85 | {{ addr.departamento }} 86 | {{ addr.distrito }} 87 | 88 | 89 | 90 | 91 | {{ addr.codigoPais }} 92 | 93 | 94 | 95 | {% if emp.email or emp.telephone %} 96 | 97 | {% if emp.telephone %} 98 | {{ emp.telephone }} 99 | {% endif %} 100 | {% if emp.email %} 101 | {{ emp.email }} 102 | {% endif %} 103 | 104 | {% endif %} 105 | 106 | 107 | {% set client = doc.client %} 108 | 109 | 110 | 111 | {{ client.numDoc }} 112 | 113 | 114 | 115 | {% if client.address %} 116 | {% set addr = client.address %} 117 | 118 | {% if addr.ubigueo %} 119 | {{ addr.ubigueo }} 120 | {% endif %} 121 | 122 | 123 | 124 | 125 | {{ addr.codigoPais }} 126 | 127 | 128 | {% endif %} 129 | 130 | {% if client.email or client.telephone %} 131 | 132 | {% if client.telephone %} 133 | {{ client.telephone }} 134 | {% endif %} 135 | {% if client.email %} 136 | {{ client.email }} 137 | {% endif %} 138 | 139 | {% endif %} 140 | 141 | 142 | 143 | {{ doc.totalImpuestos|n_format }} 144 | {% if doc.mtoISC %} 145 | 146 | {{ doc.mtoBaseIsc|n_format }} 147 | {{ doc.mtoISC|n_format }} 148 | 149 | 150 | 2000 151 | ISC 152 | EXC 153 | 154 | 155 | 156 | {% endif %} 157 | {% if doc.mtoOperGravadas %} 158 | 159 | {{ doc.mtoOperGravadas|n_format }} 160 | {{ doc.mtoIGV|n_format }} 161 | 162 | 163 | 1000 164 | IGV 165 | VAT 166 | 167 | 168 | 169 | {% endif %} 170 | {% if doc.mtoOperInafectas %} 171 | 172 | {{ doc.mtoOperInafectas|n_format }} 173 | 0 174 | 175 | 176 | 9998 177 | INA 178 | FRE 179 | 180 | 181 | 182 | {% endif %} 183 | {% if doc.mtoOperExoneradas %} 184 | 185 | {{ doc.mtoOperExoneradas|n_format }} 186 | 0 187 | 188 | 189 | 9997 190 | EXO 191 | VAT 192 | 193 | 194 | 195 | {% endif %} 196 | {% if doc.mtoOperGratuitas %} 197 | 198 | {{ doc.mtoOperGratuitas|n_format }} 199 | {{ doc.mtoIGVGratuitas|n_format }} 200 | 201 | 202 | 9996 203 | GRA 204 | FRE 205 | 206 | 207 | 208 | {% endif %} 209 | {% if doc.mtoOperExportacion %} 210 | 211 | {{ doc.mtoOperExportacion|n_format }} 212 | 0 213 | 214 | 215 | 9995 216 | EXP 217 | FRE 218 | 219 | 220 | 221 | {% endif %} 222 | {% if doc.mtoIvap %} 223 | 224 | {{ doc.mtoBaseIvap|n_format }} 225 | {{ doc.mtoIvap|n_format }} 226 | 227 | 228 | 1016 229 | IVAP 230 | VAT 231 | 232 | 233 | 234 | {% endif %} 235 | {% if doc.mtoOtrosTributos %} 236 | 237 | {{ doc.mtoBaseOth|n_format }} 238 | {{ doc.mtoOtrosTributos|n_format }} 239 | 240 | 241 | 9999 242 | OTROS 243 | OTH 244 | 245 | 246 | 247 | {% endif %} 248 | {% if doc.icbper %} 249 | 250 | {{ doc.icbper|n_format }} 251 | 252 | 253 | 7152 254 | ICBPER 255 | OTH 256 | 257 | 258 | 259 | {% endif %} 260 | 261 | 262 | {% if doc.valorVenta is not null %} 263 | {{ doc.valorVenta|n_format }} 264 | {% endif %} 265 | {% if doc.subTotal is not null %} 266 | {{ doc.subTotal|n_format }} 267 | {% endif %} 268 | {% if doc.sumOtrosCargos is not null %} 269 | {{ doc.sumOtrosCargos|n_format }} 270 | {% endif %} 271 | {% if doc.redondeo is not null %} 272 | {{ doc.redondeo|n_format }} 273 | {% endif %} 274 | {{ doc.mtoImpVenta|n_format }} 275 | 276 | {% for detail in doc.details %} 277 | 278 | {{ loop.index }} 279 | {{ detail.cantidad }} 280 | {{ detail.mtoValorVenta|n_format }} 281 | 282 | {% if detail.mtoValorGratuito %} 283 | 284 | {{ detail.mtoValorGratuito|n_format_limit(10) }} 285 | 02 286 | 287 | {% else %} 288 | 289 | {{ detail.mtoPrecioUnitario|n_format_limit(10) }} 290 | 01 291 | 292 | {% endif %} 293 | 294 | 295 | {{ detail.totalImpuestos|n_format }} 296 | {% if detail.isc %} 297 | 298 | {{ detail.mtoBaseIsc|n_format }} 299 | {{ detail.isc|n_format }} 300 | 301 | {{ detail.porcentajeIsc }} 302 | {{ detail.tipSisIsc }} 303 | 304 | 2000 305 | ISC 306 | EXC 307 | 308 | 309 | 310 | {% endif %} 311 | 312 | {{ detail.mtoBaseIgv|n_format }} 313 | {{ detail.igv|n_format }} 314 | 315 | {{ detail.porcentajeIgv }} 316 | {{ detail.tipAfeIgv }} 317 | {% set afect = getTributoAfect(detail.tipAfeIgv) %} 318 | 319 | {{ afect.id }} 320 | {{ afect.name }} 321 | {{ afect.code }} 322 | 323 | 324 | 325 | {% if detail.otroTributo %} 326 | 327 | {{ detail.mtoBaseOth|n_format }} 328 | {{ detail.otroTributo|n_format }} 329 | 330 | {{ detail.porcentajeOth }} 331 | 332 | 9999 333 | OTROS 334 | OTH 335 | 336 | 337 | 338 | {% endif %} 339 | {% if detail.icbper %} 340 | 341 | {{ detail.icbper|n_format }} 342 | {{ detail.cantidad }} 343 | 344 | {{ detail.factorIcbper|n_format }} 345 | 346 | 7152 347 | ICBPER 348 | OTH 349 | 350 | 351 | 352 | {% endif %} 353 | 354 | 355 | 356 | {% if detail.codProducto %} 357 | 358 | {{ detail.codProducto }} 359 | 360 | {% endif %} 361 | {% if detail.codProdGS1 %} 362 | 363 | {{ detail.codProdGS1 }} 364 | 365 | {% endif %} 366 | {% if detail.codProdSunat %} 367 | 368 | {{ detail.codProdSunat }} 369 | 370 | {% endif %} 371 | {% if detail.atributos %} 372 | {% for atr in detail.atributos %} 373 | 374 | {{ atr.name }} 375 | {{ atr.code }} 376 | {% if atr.value %} 377 | {{ atr.value }} 378 | {% endif %} 379 | {% if atr.fecInicio or atr.fecFin or atr.duracion %} 380 | 381 | {% if atr.fecInicio %} 382 | {{ atr.fecInicio|date('Y-m-d') }} 383 | {% endif %} 384 | {% if atr.fecFin %} 385 | {{ atr.fecFin|date('Y-m-d') }} 386 | {% endif %} 387 | {% if atr.duracion %} 388 | {{ atr.duracion }} 389 | {% endif %} 390 | 391 | {% endif %} 392 | 393 | {% endfor %} 394 | {% endif %} 395 | 396 | 397 | {{ detail.mtoValorUnitario|n_format_limit(10) }} 398 | 399 | 400 | {% endfor %} 401 | 402 | {% endapply %} -------------------------------------------------------------------------------- /src/Xml/Templates/notacr2.1.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 2.1 10 | 2.0 11 | {{ doc.serie }}-{{ doc.correlativo }} 12 | {{ doc.fechaEmision|date('Y-m-d') }} 13 | {{ doc.fechaEmision|date('H:i:s') }} 14 | {% for leg in doc.legends %} 15 | 16 | {% endfor %} 17 | {{ doc.tipoMoneda }} 18 | 19 | {{ doc.numDocfectado }} 20 | {{ doc.codMotivo }} 21 | {{ doc.desMotivo }} 22 | 23 | {% if doc.compra %} 24 | 25 | {{ doc.compra }} 26 | 27 | {% endif %} 28 | 29 | 30 | {{ doc.numDocfectado }} 31 | {{ doc.tipDocAfectado }} 32 | 33 | 34 | {% if doc.guias %} 35 | {% for guia in doc.guias %} 36 | 37 | {{ guia.nroDoc }} 38 | {{ guia.tipoDoc }} 39 | 40 | {% endfor %} 41 | {% endif %} 42 | {% if doc.relDocs %} 43 | {% for rel in doc.relDocs %} 44 | 45 | {{ rel.nroDoc }} 46 | {{ rel.tipoDoc }} 47 | 48 | {% endfor %} 49 | {% endif %} 50 | {% set emp = doc.company %} 51 | 52 | SIGN{{ emp.ruc }} 53 | 54 | 55 | {{ emp.ruc }} 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | #GREENTER-SIGN 64 | 65 | 66 | 67 | 68 | 69 | 70 | {{ emp.ruc }} 71 | 72 | 73 | 74 | 75 | 76 | 77 | {% set addr = emp.address %} 78 | 79 | {{ addr.ubigueo }} 80 | {{ addr.codLocal }} 81 | {% if addr.urbanizacion %} 82 | {{ addr.urbanizacion }} 83 | {% endif %} 84 | {{ addr.provincia }} 85 | {{ addr.departamento }} 86 | {{ addr.distrito }} 87 | 88 | 89 | 90 | 91 | {{ addr.codigoPais }} 92 | 93 | 94 | 95 | {% if emp.email or emp.telephone %} 96 | 97 | {% if emp.telephone %} 98 | {{ emp.telephone }} 99 | {% endif %} 100 | {% if emp.email %} 101 | {{ emp.email }} 102 | {% endif %} 103 | 104 | {% endif %} 105 | 106 | 107 | {% set client = doc.client %} 108 | 109 | 110 | 111 | {{ client.numDoc }} 112 | 113 | 114 | 115 | {% if client.address %} 116 | {% set addr = client.address %} 117 | 118 | {% if addr.ubigueo %} 119 | {{ addr.ubigueo }} 120 | {% endif %} 121 | 122 | 123 | 124 | 125 | {{ addr.codigoPais }} 126 | 127 | 128 | {% endif %} 129 | 130 | {% if client.email or client.telephone %} 131 | 132 | {% if client.telephone %} 133 | {{ client.telephone }} 134 | {% endif %} 135 | {% if client.email %} 136 | {{ client.email }} 137 | {% endif %} 138 | 139 | {% endif %} 140 | 141 | 142 | {% if doc.formaPago %} 143 | 144 | FormaPago 145 | {{ doc.formaPago.tipo }} 146 | {% if doc.formaPago.monto %} 147 | {{ doc.formaPago.monto|n_format }} 148 | {% endif %} 149 | 150 | {% endif %} 151 | {% if doc.cuotas %} 152 | {% for cuota in doc.cuotas %} 153 | 154 | FormaPago 155 | Cuota{{ "%03d"|format(loop.index) }} 156 | {{ cuota.monto|n_format }} 157 | {{ cuota.fechaPago|date('Y-m-d') }} 158 | 159 | {% endfor %} 160 | {% endif %} 161 | 162 | {{ doc.totalImpuestos|n_format }} 163 | {% if doc.mtoISC %} 164 | 165 | {{ doc.mtoBaseIsc|n_format }} 166 | {{ doc.mtoISC|n_format }} 167 | 168 | 169 | 2000 170 | ISC 171 | EXC 172 | 173 | 174 | 175 | {% endif %} 176 | {% if doc.mtoOperGravadas %} 177 | 178 | {{ doc.mtoOperGravadas|n_format }} 179 | {{ doc.mtoIGV|n_format }} 180 | 181 | 182 | 1000 183 | IGV 184 | VAT 185 | 186 | 187 | 188 | {% endif %} 189 | {% if doc.mtoOperInafectas %} 190 | 191 | {{ doc.mtoOperInafectas|n_format }} 192 | 0 193 | 194 | 195 | 9998 196 | INA 197 | FRE 198 | 199 | 200 | 201 | {% endif %} 202 | {% if doc.mtoOperExoneradas %} 203 | 204 | {{ doc.mtoOperExoneradas|n_format }} 205 | 0 206 | 207 | 208 | 9997 209 | EXO 210 | VAT 211 | 212 | 213 | 214 | {% endif %} 215 | {% if doc.mtoOperGratuitas %} 216 | 217 | {{ doc.mtoOperGratuitas|n_format }} 218 | {{ doc.mtoIGVGratuitas|n_format }} 219 | 220 | 221 | 9996 222 | GRA 223 | FRE 224 | 225 | 226 | 227 | {% endif %} 228 | {% if doc.mtoOperExportacion %} 229 | 230 | {{ doc.mtoOperExportacion|n_format }} 231 | 0 232 | 233 | 234 | 9995 235 | EXP 236 | FRE 237 | 238 | 239 | 240 | {% endif %} 241 | {% if doc.mtoIvap %} 242 | 243 | {{ doc.mtoBaseIvap|n_format }} 244 | {{ doc.mtoIvap|n_format }} 245 | 246 | 247 | 1016 248 | IVAP 249 | VAT 250 | 251 | 252 | 253 | {% endif %} 254 | {% if doc.mtoOtrosTributos %} 255 | 256 | {{ doc.mtoBaseOth|n_format }} 257 | {{ doc.mtoOtrosTributos|n_format }} 258 | 259 | 260 | 9999 261 | OTROS 262 | OTH 263 | 264 | 265 | 266 | {% endif %} 267 | {% if doc.icbper %} 268 | 269 | {{ doc.icbper|n_format }} 270 | 271 | 272 | 7152 273 | ICBPER 274 | OTH 275 | 276 | 277 | 278 | {% endif %} 279 | 280 | 281 | {% if doc.sumOtrosCargos is not null %} 282 | {{ doc.sumOtrosCargos|n_format }} 283 | {% endif %} 284 | {% if doc.redondeo is not null %} 285 | {{ doc.redondeo|n_format }} 286 | {% endif %} 287 | {{ doc.mtoImpVenta|n_format }} 288 | 289 | {% for detail in doc.details %} 290 | 291 | {{ loop.index }} 292 | {{ detail.cantidad }} 293 | {{ detail.mtoValorVenta|n_format }} 294 | 295 | {% if detail.mtoValorGratuito %} 296 | 297 | {{ detail.mtoValorGratuito|n_format_limit(10) }} 298 | 02 299 | 300 | {% else %} 301 | 302 | {{ detail.mtoPrecioUnitario|n_format_limit(10) }} 303 | 01 304 | 305 | {% endif %} 306 | 307 | 308 | {{ detail.totalImpuestos|n_format }} 309 | {% if detail.isc %} 310 | 311 | {{ detail.mtoBaseIsc|n_format }} 312 | {{ detail.isc|n_format }} 313 | 314 | {{ detail.porcentajeIsc }} 315 | {{ detail.tipSisIsc }} 316 | 317 | 2000 318 | ISC 319 | EXC 320 | 321 | 322 | 323 | {% endif %} 324 | 325 | {{ detail.mtoBaseIgv|n_format }} 326 | {{ detail.igv|n_format }} 327 | 328 | {{ detail.porcentajeIgv }} 329 | {{ detail.tipAfeIgv }} 330 | {% set afect = getTributoAfect(detail.tipAfeIgv) %} 331 | 332 | {{ afect.id }} 333 | {{ afect.name }} 334 | {{ afect.code }} 335 | 336 | 337 | 338 | {% if detail.otroTributo %} 339 | 340 | {{ detail.mtoBaseOth|n_format }} 341 | {{ detail.otroTributo|n_format }} 342 | 343 | {{ detail.porcentajeOth }} 344 | 345 | 9999 346 | OTROS 347 | OTH 348 | 349 | 350 | 351 | {% endif %} 352 | {% if detail.icbper %} 353 | 354 | {{ detail.icbper|n_format }} 355 | {{ detail.cantidad }} 356 | 357 | {{ detail.factorIcbper|n_format }} 358 | 359 | 7152 360 | ICBPER 361 | OTH 362 | 363 | 364 | 365 | {% endif %} 366 | 367 | 368 | 369 | {% if detail.codProducto %} 370 | 371 | {{ detail.codProducto }} 372 | 373 | {% endif %} 374 | {% if detail.codProdGS1 %} 375 | 376 | {{ detail.codProdGS1 }} 377 | 378 | {% endif %} 379 | {% if detail.codProdSunat %} 380 | 381 | {{ detail.codProdSunat }} 382 | 383 | {% endif %} 384 | {% if detail.atributos %} 385 | {% for atr in detail.atributos %} 386 | 387 | {{ atr.name }} 388 | {{ atr.code }} 389 | {% if atr.value %} 390 | {{ atr.value }} 391 | {% endif %} 392 | {% if atr.fecInicio or atr.fecFin or atr.duracion %} 393 | 394 | {% if atr.fecInicio %} 395 | {{ atr.fecInicio|date('Y-m-d') }} 396 | {% endif %} 397 | {% if atr.fecFin %} 398 | {{ atr.fecFin|date('Y-m-d') }} 399 | {% endif %} 400 | {% if atr.duracion %} 401 | {{ atr.duracion }} 402 | {% endif %} 403 | 404 | {% endif %} 405 | 406 | {% endfor %} 407 | {% endif %} 408 | 409 | 410 | {{ detail.mtoValorUnitario|n_format_limit(10) }} 411 | 412 | 413 | {% endfor %} 414 | 415 | {% endapply %} -------------------------------------------------------------------------------- /src/Xml/Templates/invoice2.1.xml.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {% set emp = doc.company %} 10 | 2.1 11 | 2.0 12 | {{ doc.serie }}-{{ doc.correlativo }} 13 | {{ doc.fechaEmision|date('Y-m-d') }} 14 | {{ doc.fechaEmision|date('H:i:s') }} 15 | {% if doc.fecVencimiento %} 16 | {{ doc.fecVencimiento|date('Y-m-d') }} 17 | {% endif %} 18 | {{ doc.tipoDoc }} 19 | {% for leg in doc.legends %} 20 | 21 | {% endfor %} 22 | {% if doc.observacion %} 23 | 24 | {% endif %} 25 | {{ doc.tipoMoneda }} 26 | {% if doc.compra %} 27 | 28 | {{ doc.compra }} 29 | 30 | {% endif %} 31 | {% if doc.guias %} 32 | {% for guia in doc.guias %} 33 | 34 | {{ guia.nroDoc }} 35 | {{ guia.tipoDoc }} 36 | 37 | {% endfor %} 38 | {% endif %} 39 | {% if doc.relDocs %} 40 | {% for rel in doc.relDocs %} 41 | 42 | {{ rel.nroDoc }} 43 | {{ rel.tipoDoc }} 44 | 45 | {% endfor %} 46 | {% endif %} 47 | {% if doc.anticipos %} 48 | {% for ant in doc.anticipos %} 49 | 50 | {{ ant.nroDocRel }} 51 | {{ ant.tipoDocRel }} 52 | {{ loop.index }} 53 | 54 | 55 | {{ emp.ruc }} 56 | 57 | 58 | 59 | {% endfor %} 60 | {% endif %} 61 | 62 | SIGN{{ emp.ruc }} 63 | 64 | 65 | {{ emp.ruc }} 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | #GREENTER-SIGN 74 | 75 | 76 | 77 | 78 | 79 | 80 | {{ emp.ruc }} 81 | 82 | {% if emp.nombreComercial %} 83 | 84 | 85 | 86 | {% endif %} 87 | 88 | 89 | {% set addr = emp.address %} 90 | 91 | {{ addr.ubigueo }} 92 | {{ addr.codLocal }} 93 | {% if addr.urbanizacion %} 94 | {{ addr.urbanizacion }} 95 | {% endif %} 96 | {{ addr.provincia }} 97 | {{ addr.departamento }} 98 | {{ addr.distrito }} 99 | 100 | 101 | 102 | 103 | {{ addr.codigoPais }} 104 | 105 | 106 | 107 | {% if emp.email or emp.telephone %} 108 | 109 | {% if emp.telephone %} 110 | {{ emp.telephone }} 111 | {% endif %} 112 | {% if emp.email %} 113 | {{ emp.email }} 114 | {% endif %} 115 | 116 | {% endif %} 117 | 118 | 119 | {% set client = doc.client %} 120 | 121 | 122 | 123 | {{ client.numDoc }} 124 | 125 | 126 | 127 | {% if client.address %} 128 | {% set addr = client.address %} 129 | 130 | {% if addr.ubigueo %} 131 | {{ addr.ubigueo }} 132 | {% endif %} 133 | 134 | 135 | 136 | 137 | {{ addr.codigoPais }} 138 | 139 | 140 | {% endif %} 141 | 142 | {% if client.email or client.telephone %} 143 | 144 | {% if client.telephone %} 145 | {{ client.telephone }} 146 | {% endif %} 147 | {% if client.email %} 148 | {{ client.email }} 149 | {% endif %} 150 | 151 | {% endif %} 152 | 153 | 154 | {% set seller = doc.seller %} 155 | {% if seller %} 156 | 157 | 158 | 159 | {{ seller.numDoc }} 160 | 161 | 162 | 163 | {% if seller.address %} 164 | {% set addr = seller.address %} 165 | 166 | {% if addr.ubigueo %} 167 | {{ addr.ubigueo }} 168 | {% endif %} 169 | 170 | 171 | 172 | 173 | {{ addr.codigoPais }} 174 | 175 | 176 | {% endif %} 177 | 178 | {% if seller.email or seller.telephone %} 179 | 180 | {% if seller.telephone %} 181 | {{ seller.telephone }} 182 | {% endif %} 183 | {% if seller.email %} 184 | {{ seller.email }} 185 | {% endif %} 186 | 187 | {% endif %} 188 | 189 | 190 | {% endif %} 191 | {% if doc.direccionEntrega %} 192 | {% set addr = doc.direccionEntrega %} 193 | 194 | 195 | 196 | {{ addr.ubigueo }} 197 | {% if addr.urbanizacion %} 198 | {{ addr.urbanizacion }} 199 | {% endif %} 200 | {{ addr.provincia }} 201 | {{ addr.departamento }} 202 | {{ addr.distrito }} 203 | 204 | 205 | 206 | 207 | {{ addr.codigoPais }} 208 | 209 | 210 | 211 | 212 | {% endif %} 213 | {% if doc.detraccion %} 214 | {% set detr = doc.detraccion %} 215 | 216 | Detraccion 217 | {{ detr.codMedioPago }} 218 | 219 | {{ detr.ctaBanco }} 220 | 221 | 222 | 223 | Detraccion 224 | {{ detr.codBienDetraccion }} 225 | {{ detr.percent }} 226 | {{ detr.mount|n_format }} 227 | 228 | {% endif %} 229 | {% if doc.perception %} 230 | 231 | Percepcion 232 | {{ doc.perception.mtoTotal|n_format }} 233 | 234 | {% endif %} 235 | {% if doc.formaPago %} 236 | 237 | FormaPago 238 | {{ doc.formaPago.tipo }} 239 | {% if doc.formaPago.monto %} 240 | {{ doc.formaPago.monto|n_format }} 241 | {% endif %} 242 | 243 | {% endif %} 244 | {% if doc.cuotas %} 245 | {% for cuota in doc.cuotas %} 246 | 247 | FormaPago 248 | Cuota{{ "%03d"|format(loop.index) }} 249 | {{ cuota.monto|n_format }} 250 | {{ cuota.fechaPago|date('Y-m-d') }} 251 | 252 | {% endfor %} 253 | {% endif %} 254 | {% if doc.anticipos %} 255 | {% for ant in doc.anticipos %} 256 | 257 | {{ loop.index }} 258 | {{ ant.total|n_format }} 259 | 260 | {% endfor %} 261 | {% endif %} 262 | {% if doc.cargos %} 263 | {% for cargo in doc.cargos %} 264 | 265 | true 266 | {{ cargo.codTipo }} 267 | {{ cargo.factor|n_format_limit(5) }} 268 | {{ cargo.monto|n_format }} 269 | {{ cargo.montoBase|n_format }} 270 | 271 | {% endfor %} 272 | {% endif %} 273 | {% if doc.descuentos %} 274 | {% for desc in doc.descuentos %} 275 | 276 | false 277 | {{ desc.codTipo }} 278 | {% if desc.factor is not null %} 279 | {{ desc.factor|n_format_limit(5) }} 280 | {% endif %} 281 | {{ desc.monto|n_format }} 282 | {{ desc.montoBase|n_format }} 283 | 284 | {% endfor %} 285 | {% endif %} 286 | {% if doc.perception %} 287 | {% set perc = doc.perception %} 288 | 289 | true 290 | {{ perc.codReg }} 291 | {{ perc.porcentaje|n_format_limit(5) }} 292 | {{ perc.mto|n_format }} 293 | {{ perc.mtoBase|n_format }} 294 | 295 | {% endif %} 296 | 297 | {{ doc.totalImpuestos|n_format }} 298 | {% if doc.mtoISC %} 299 | 300 | {{ doc.mtoBaseIsc|n_format }} 301 | {{ doc.mtoISC|n_format }} 302 | 303 | 304 | 2000 305 | ISC 306 | EXC 307 | 308 | 309 | 310 | {% endif %} 311 | {% if doc.mtoOperGravadas is not null %} 312 | 313 | {{ doc.mtoOperGravadas|n_format }} 314 | {{ doc.mtoIGV|n_format }} 315 | 316 | 317 | 1000 318 | IGV 319 | VAT 320 | 321 | 322 | 323 | {% endif %} 324 | {% if doc.mtoOperInafectas is not null %} 325 | 326 | {{ doc.mtoOperInafectas|n_format }} 327 | 0 328 | 329 | 330 | 9998 331 | INA 332 | FRE 333 | 334 | 335 | 336 | {% endif %} 337 | {% if doc.mtoOperExoneradas is not null %} 338 | 339 | {{ doc.mtoOperExoneradas|n_format }} 340 | 0 341 | 342 | 343 | 9997 344 | EXO 345 | VAT 346 | 347 | 348 | 349 | {% endif %} 350 | {% if doc.mtoOperGratuitas is not null %} 351 | 352 | {{ doc.mtoOperGratuitas|n_format }} 353 | {{ doc.mtoIGVGratuitas|n_format }} 354 | 355 | 356 | 9996 357 | GRA 358 | FRE 359 | 360 | 361 | 362 | {% endif %} 363 | {% if doc.mtoOperExportacion is not null %} 364 | 365 | {{ doc.mtoOperExportacion|n_format }} 366 | 0 367 | 368 | 369 | 9995 370 | EXP 371 | FRE 372 | 373 | 374 | 375 | {% endif %} 376 | {% if doc.mtoIvap %} 377 | 378 | {{ doc.mtoBaseIvap|n_format }} 379 | {{ doc.mtoIvap|n_format }} 380 | 381 | 382 | 1016 383 | IVAP 384 | VAT 385 | 386 | 387 | 388 | {% endif %} 389 | {% if doc.mtoOtrosTributos %} 390 | 391 | {{ doc.mtoBaseOth|n_format }} 392 | {{ doc.mtoOtrosTributos|n_format }} 393 | 394 | 395 | 9999 396 | OTROS 397 | OTH 398 | 399 | 400 | 401 | {% endif %} 402 | {% if doc.icbper %} 403 | 404 | {{ doc.icbper|n_format }} 405 | 406 | 407 | 7152 408 | ICBPER 409 | OTH 410 | 411 | 412 | 413 | {% endif %} 414 | 415 | 416 | {{ doc.valorVenta|n_format }} 417 | {% if doc.subTotal is not null %} 418 | {{ doc.subTotal|n_format }} 419 | {% endif %} 420 | {% if doc.sumOtrosDescuentos is not null %} 421 | {{ doc.sumOtrosDescuentos|n_format }} 422 | {% endif %} 423 | {% if doc.sumOtrosCargos is not null %} 424 | {{ doc.sumOtrosCargos|n_format }} 425 | {% endif %} 426 | {% if doc.totalAnticipos is not null %} 427 | {{ doc.totalAnticipos|n_format }} 428 | {% endif %} 429 | {% if doc.redondeo is not null %} 430 | {{ doc.redondeo|n_format }} 431 | {% endif %} 432 | {{ doc.mtoImpVenta|n_format }} 433 | 434 | {% for detail in doc.details %} 435 | 436 | {{ loop.index }} 437 | {{ detail.cantidad }} 438 | {{ detail.mtoValorVenta|n_format }} 439 | 440 | {% if detail.mtoValorGratuito %} 441 | 442 | {{ detail.mtoValorGratuito|n_format_limit(10) }} 443 | 02 444 | 445 | {% else %} 446 | 447 | {{ detail.mtoPrecioUnitario|n_format_limit(10) }} 448 | 01 449 | 450 | {% endif %} 451 | 452 | {% if detail.cargos %} 453 | {% for cargo in detail.cargos %} 454 | 455 | true 456 | {{ cargo.codTipo }} 457 | {{ cargo.factor|n_format_limit(5) }} 458 | {{ cargo.monto }} 459 | {{ cargo.montoBase }} 460 | 461 | {% endfor %} 462 | {% endif %} 463 | {% if detail.descuentos %} 464 | {% for desc in detail.descuentos %} 465 | 466 | false 467 | {{ desc.codTipo }} 468 | {{ desc.factor|n_format_limit(5) }} 469 | {{ desc.monto }} 470 | {{ desc.montoBase }} 471 | 472 | {% endfor %} 473 | {% endif %} 474 | 475 | {{ detail.totalImpuestos|n_format }} 476 | {% if detail.isc %} 477 | 478 | {{ detail.mtoBaseIsc|n_format }} 479 | {{ detail.isc|n_format }} 480 | 481 | {{ detail.porcentajeIsc }} 482 | {{ detail.tipSisIsc }} 483 | 484 | 2000 485 | ISC 486 | EXC 487 | 488 | 489 | 490 | {% endif %} 491 | 492 | {{ detail.mtoBaseIgv|n_format }} 493 | {{ detail.igv|n_format }} 494 | 495 | {{ detail.porcentajeIgv }} 496 | {{ detail.tipAfeIgv }} 497 | {% set afect = getTributoAfect(detail.tipAfeIgv) %} 498 | 499 | {{ afect.id }} 500 | {{ afect.name }} 501 | {{ afect.code }} 502 | 503 | 504 | 505 | {% if detail.otroTributo %} 506 | 507 | {{ detail.mtoBaseOth|n_format }} 508 | {{ detail.otroTributo|n_format }} 509 | 510 | {{ detail.porcentajeOth }} 511 | 512 | 9999 513 | OTROS 514 | OTH 515 | 516 | 517 | 518 | {% endif %} 519 | {% if detail.icbper %} 520 | 521 | {{ detail.icbper|n_format }} 522 | {{ detail.cantidad }} 523 | 524 | {{ detail.factorIcbper|n_format }} 525 | 526 | 7152 527 | ICBPER 528 | OTH 529 | 530 | 531 | 532 | {% endif %} 533 | 534 | 535 | 536 | {% if detail.codProducto %} 537 | 538 | {{ detail.codProducto }} 539 | 540 | {% endif %} 541 | {% if detail.codProdGS1 %} 542 | 543 | {{ detail.codProdGS1 }} 544 | 545 | {% endif %} 546 | {% if detail.codProdSunat %} 547 | 548 | {{ detail.codProdSunat }} 549 | 550 | {% endif %} 551 | {% if detail.atributos %} 552 | {% for atr in detail.atributos %} 553 | 554 | {{ atr.name }} 555 | {{ atr.code }} 556 | {% if atr.value is not null %} 557 | {{ atr.value }} 558 | {% endif %} 559 | {% if atr.fecInicio or atr.fecFin or atr.duracion %} 560 | 561 | {% if atr.fecInicio %} 562 | {{ atr.fecInicio|date('Y-m-d') }} 563 | {% endif %} 564 | {% if atr.fecFin %} 565 | {{ atr.fecFin|date('Y-m-d') }} 566 | {% endif %} 567 | {% if atr.duracion %} 568 | {{ atr.duracion }} 569 | {% endif %} 570 | 571 | {% endif %} 572 | 573 | {% endfor %} 574 | {% endif %} 575 | 576 | 577 | {{ detail.mtoValorUnitario|n_format_limit(10) }} 578 | 579 | 580 | {% endfor %} 581 | 582 | {% endapply %} 583 | --------------------------------------------------------------------------------