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') %} +
+
+
+ {% set cl = doc.destinatario %}
+
+
+ {% set cl = doc.destinatario %}
+
+ {% set tr = doc.envio.transportista %} + {% if tr %} +
+
+ {% endif %} +
+
+
+
+
|
+
- {{ name }}
+ COMPROBANTE DE {{ name }}
E L E C T R Ó N I C A |
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');