diff --git a/src/Report/Filter/DocumentFilter.php b/src/Report/Filter/DocumentFilter.php index f5430c4..e91de94 100644 --- a/src/Report/Filter/DocumentFilter.php +++ b/src/Report/Filter/DocumentFilter.php @@ -22,8 +22,9 @@ class DocumentFilter '03' => 'BOLETA', '07' => 'NOTA DE CRÉDITO', '08' => 'NOTA DE DÉBITO', - '09' => 'GUÍA DE REMISIÓN', + '09' => 'GUÍA DE REMISIÓN REMITENTE', '20' => 'RETENCIÓN', + '31' => 'GUÍA DE REMISIÓN TRANSPORTISTA', '40' => 'PERCEPCIÓN', ], '02' => [ diff --git a/src/Report/Templates/despatch.html.twig b/src/Report/Templates/despatch.html.twig new file mode 100644 index 0000000..4b74ebc --- /dev/null +++ b/src/Report/Templates/despatch.html.twig @@ -0,0 +1,205 @@ + + + + + + +{% set cp = doc.company %} +{% set name = doc.tipoDoc|catalog('01') %} + + + + +
+ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + +
+ {{ name }} +
+ E L E C T R Ó N I C A +
+   +
+ R.U.C.: {{ cp.ruc }} +
+ No.: {{ doc.serie }}-{{ doc.correlativo }} +
+ Nro. R.I. Emisor: {{ params.user.resolucion }} +
+
+
+
+ + + + + + + + + + +
+ {{ cp.razonSocial }} +
+ Dirección: {{ cp.address.direccion }} +
+ {{ params.user.header|raw }} +
+
+
+
+
+ {% set cl = doc.destinatario %} + + + + + + + + + + + + +
DESTINATARIO
Razón Social: {{ cl.rznSocial }}{{ cl.tipoDoc|catalog('06') }}: {{ cl.numDoc }}
Dirección: {% if cl.address %}{{ cl.address.direccion }}{% endif %}
+

+
+ {% set cl = doc.destinatario %} + + + + + + + + + + + + + + + + + + + + + +
ENVIO
+ Fecha Emisión: {{ doc.fechaEmision|date('d/m/Y') }} + Fecha Inicio de Traslado: {{ doc.envio.fecTraslado|date('d/m/Y') }}
Motivo Traslado: {{ doc.envio.desTraslado }} Modalidad de Transporte: {{ doc.envio.modTraslado }}
Peso Bruto Total ({{ doc.envio.undPesoTotal }}): {{ doc.envio.pesoTotal }}% {% if doc.envio.numBultos %}Número de Bultos: {{ doc.envio.numBultos }}{% endif %}
P. Partida: {{ doc.envio.partida.ubigueo }} - {{ doc.envio.partida.direccion }}P. Llegada: {{ doc.envio.llegada.ubigueo }} - {{ doc.envio.llegada.direccion }}
+

+ {% set tr = doc.envio.transportista %} + {% if tr %} +
+ + + + + + + + + + + + + +
TRANSPORTE
Razón Social: {{ tr.rznSocial }}{{ tr.tipoDoc|catalog('06') }}: {{ tr.numDoc }}
Vehiculo: {{ tr.placa }}Conductor: {{ tr.choferTipoDoc|catalog('06') }} {{ tr.choferDoc }}
+

+ {% endif %} +
+ + + + + + + + + + {% for det in doc.details %} + + + + + + + + {% endfor %} + +
ItemCódigoDescripciónUnidadCantidad
{{ loop.index }}{{ det.codigo }}{{ det.descripcion }}{{ det.unidad }}{{ det.cantidad }}
+ + + + + +
+ + + + + + +
+ {% if doc.observacion %} + Observaciones +

+

{{ doc.observacion }}

+ {% endif %} +
+
+ {% if max_items is defined and doc.details|length > max_items %} +
+ {% endif %} +
+ + + + +
+
+ {% if params.user.footer is defined %} + {{ params.user.footer|raw }} + {% endif %} + {% if params.system.hash is defined and params.system.hash%} + Resumen {{ params.system.hash }}
+ {% endif %} + Representación Impresa de la {{ name }} ELECTRÓNICA. +
+
+
+
+ \ No newline at end of file diff --git a/src/Report/Templates/perception.html.twig b/src/Report/Templates/perception.html.twig index c8ff2b2..f1de67e 100644 --- a/src/Report/Templates/perception.html.twig +++ b/src/Report/Templates/perception.html.twig @@ -22,7 +22,7 @@ diff --git a/src/Report/Templates/retention.html.twig b/src/Report/Templates/retention.html.twig index ad342b5..4752bca 100644 --- a/src/Report/Templates/retention.html.twig +++ b/src/Report/Templates/retention.html.twig @@ -22,7 +22,7 @@
- {{ name }} + COMPROBANTE DE {{ name }}
E L E C T R Ó N I C A
diff --git a/tests/Report/HtmlReport2Test.php b/tests/Report/HtmlReport2Test.php index f8db7ea..9cb95ca 100644 --- a/tests/Report/HtmlReport2Test.php +++ b/tests/Report/HtmlReport2Test.php @@ -95,6 +95,24 @@ public function testGenPerceptionReport() $this->showResult($document->getName(), $html); } + /** + * @throws \Twig_Error_Loader + * @throws \Twig_Error_Runtime + * @throws \Twig_Error_Syntax + */ + public function testGenDespatchReport() + { + $report = $this->getReporter(); + $report->setTemplate('despatch.html.twig'); + + $document = $this->getDespatch(); + $parameters = $this->getDefaultParamters(); + unset($parameters['user']['footer']); + $html = $report->render($document, $parameters); + $this->assertNotEmpty($html); + $this->showResult($document->getName(), $html); + } + public function provideDocs() { return [ diff --git a/tests/Report/HtmlReportTrait.php b/tests/Report/HtmlReportTrait.php index 6dbf1c7..0c72e53 100644 --- a/tests/Report/HtmlReportTrait.php +++ b/tests/Report/HtmlReportTrait.php @@ -11,6 +11,11 @@ use Greenter\Model\Client\Client; use Greenter\Model\Company\Address; use Greenter\Model\Company\Company; +use Greenter\Model\Despatch\Despatch; +use Greenter\Model\Despatch\DespatchDetail; +use Greenter\Model\Despatch\Direction; +use Greenter\Model\Despatch\Shipment; +use Greenter\Model\Despatch\Transportist; use Greenter\Model\Perception\Perception; use Greenter\Model\Perception\PerceptionDetail; use Greenter\Model\Retention\Exchange; @@ -385,6 +390,68 @@ private function getPerception() return $perception; } + private function getDespatch() + { + $baja = new Document(); + $baja->setTipoDoc('09') + ->setNroDoc('T001-00001'); + + $rel = new Document(); + $rel->setTipoDoc('02') // Tipo: Numero de Orden de Entrega + ->setNroDoc('213123'); + + $transp = new Transportist(); + $transp->setTipoDoc('6') + ->setNumDoc('20000000002') + ->setRznSocial('TRANSPORTES S.A.C') + ->setPlaca('ABI-453') + ->setChoferTipoDoc('1') + ->setChoferDoc('40003344'); + + $envio = new Shipment(); + $envio->setModTraslado('01') + ->setCodTraslado('01') + ->setDesTraslado('VENTA') + ->setFecTraslado(new \DateTime()) + ->setCodPuerto('123') + ->setIndTransbordo(false) + ->setPesoTotal(12.5) + ->setUndPesoTotal('KGM') + ->setNumBultos(2) + ->setNumContenedor('XD-2232') + ->setLlegada(new Direction('150101', 'AV LIMA')) + ->setPartida(new Direction('150203', 'AV ITALIA')) + ->setTransportista($transp); + + $despatch = new Despatch(); + $despatch->setTipoDoc('09') + ->setSerie('T001') + ->setCorrelativo('123') + ->setFechaEmision(new \DateTime()) + ->setCompany($this->getCompany()) + ->setDestinatario($this->getClient()) + ->setTercero((new Client()) + ->setTipoDoc('6') + ->setNumDoc('20000000003') + ->setRznSocial('EMPRESA SA')) + ->setObservacion('NOTA GUIA') + ->setDocBaja($baja) + ->setRelDoc($rel) + ->setEnvio($envio); + + $detail = new DespatchDetail(); + $detail->setCantidad(2) + ->setUnidad('ZZ') + ->setDescripcion('PROD 1') + ->setCodigo('PROD1') + ->setCodProdSunat('P001'); + + $items = $this->getItems($detail, 4); + $despatch->setDetails($items); + + return $despatch; + } + private function getDefaultParamters() { $logo = file_get_contents(__DIR__.'/../Resources/logo.png');
- {{ name }} + COMPROBANTE DE {{ name }}
E L E C T R Ó N I C A