Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions packages/core/src/Core/Model/Despatch/Despatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Despatch implements DocumentInterface
*/
private $correlativo;
/**
* @var string
* @var array
*/
private $observacion;
/**
Expand Down Expand Up @@ -168,19 +168,19 @@ public function setCorrelativo(?string $correlativo): Despatch
}

/**
* @return string
* @return array
*/
public function getObservacion(): ?string
public function getObservacion(): ?array
{
return $this->observacion;
}

/**
* @param string $observacion
* @param array $observacion
*
* @return Despatch
*/
public function setObservacion(?string $observacion): Despatch
public function setObservacion(?array $observacion): Despatch
{
$this->observacion = $observacion;

Expand Down Expand Up @@ -406,4 +406,29 @@ public function getName(): string

return join('-', $parts);
}
}

//Extra para guia transportista
/**
* @var Client
*/
private $remitente;
/**
* @return Client
*/
public function getRemitente(): ?Client
{
return $this->remitente;
}

/**
* @param Client $remitente
*
* @return Despatch
*/
public function setRemitente(?Client $remitente): Despatch
{
$this->remitente = $remitente;

return $this;
}
}
27 changes: 26 additions & 1 deletion packages/core/src/Core/Model/Despatch/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,4 +545,29 @@

return $this;
}
}

//Extra para guia transportista
/**
* @var Transportist
*/
private $subContratado;
/**
* @return Transportist
*/
public function getSubContratado(): ?Transportist
{
return $this->subContratado;
}

/**
* @param Transportist $subContratado
*
* @return Despatch
*/
public function setSubContratado(?Transportist $subContratado): Shipment

Check failure on line 567 in packages/core/src/Core/Model/Despatch/Shipment.php

View workflow job for this annotation

GitHub Actions / build (7.4, true)

PHPDoc tag @return with type Greenter\Model\Despatch\Despatch is incompatible with native type Greenter\Model\Despatch\Shipment.

Check failure on line 567 in packages/core/src/Core/Model/Despatch/Shipment.php

View workflow job for this annotation

GitHub Actions / build (8.2, false)

PHPDoc tag @return with type Greenter\Model\Despatch\Despatch is incompatible with native type Greenter\Model\Despatch\Shipment.
{
$this->subContratado = $subContratado;

return $this;
}
}
10 changes: 5 additions & 5 deletions packages/core/src/Core/Model/Sale/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@
private $subTotal;

/**
* @var string
* @var string[]
*/
private $observacion;
private array $observacion = [];

/**
* @var Address
Expand Down Expand Up @@ -438,17 +438,17 @@
/**
* @return string
*/
public function getObservacion(): ?string
public function getObservacion(): ?array

Check failure on line 441 in packages/core/src/Core/Model/Sale/Invoice.php

View workflow job for this annotation

GitHub Actions / build (7.4, true)

PHPDoc tag @return with type string is incompatible with native type array|null.

Check failure on line 441 in packages/core/src/Core/Model/Sale/Invoice.php

View workflow job for this annotation

GitHub Actions / build (8.2, false)

PHPDoc tag @return with type string is incompatible with native type array|null.
{
return $this->observacion;
}

/**
* @param string $observacion
* @param array $observacion
*
* @return Invoice
*/
public function setObservacion(?string $observacion): Invoice
public function setObservacion(array $observacion): Invoice
{
$this->observacion = $observacion;

Expand Down
22 changes: 11 additions & 11 deletions packages/report/src/Report/Filter/DocumentFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,16 @@ class DocumentFilter
'03' => 'BOLETA DE VENTA',
'07' => 'NOTA DE CRÉDITO',
'08' => 'NOTA DE DÉBITO',
'09' => 'GUÍA DE REMISIÓN REMITENTE',
'09' => 'GUÍA DE REMISIÓN ELECTRONICA DEL REMITENTE',
'20' => 'RETENCIÓN',
'31' => 'GUÍA DE REMISIÓN TRANSPORTISTA',
'31' => 'GUÍA DE REMISIÓN ELECTRONICA DEL TRANSPORTISTA',
'40' => 'PERCEPCIÓN',
],
'02' => [
'PEN' => 'S/',
'USD' => '$',
'EUR' => '€',
],
'021' => [
'PEN' => 'SOLES',
'USD' => 'DÓLARES AMERICANOS',
'EUR' => 'EUROS',
],
'06' => [
'0' => 'N/D',
'1' => 'DNI',
Expand All @@ -64,6 +59,11 @@ class DocumentFilter
'18' => 'Traslado emisor itinerante CP',
'19' => 'Traslado a zona primaria'
],
'21' => [
'PEN' => 'SOLES',
'USD' => 'DÓLARES AMERICANOS',
'EUR' => 'EUROS',
],
'54' => [
'001' => 'Azúcar y melaza de caña',
'002' => 'Arroz',
Expand All @@ -73,15 +73,15 @@ class DocumentFilter
'007' => 'Caña de azúcar',
'008' => 'Madera',
'009' => 'Arena y piedra.',
'010' => 'Residuos, subproductos, desechos, recortes, desperdicios y formas primarias derivadas de los mismos',
'011' => 'Bienes gravados con el IGV por renuncia a la exoneración',
'010' => 'Residuos, subproductos, desechos, recortes y desperdicios',
'011' => 'Bienes gravados con el IGV, o renuncia a la exoneración',
'012' => 'Intermediación laboral y tercerización',
'013' => 'Animales vivos',
'014' => 'Carnes y despojos comestibles',
'015' => 'Abonos, cueros y pieles de origen animal',
'016' => 'Aceite de pescado',
'017' => 'Harina, polvo y “pellets” de pescado, crustáceos, moluscos y demás invertebrados acuáticos',
'019' => 'Arrendamiento de bienes',
'019' => 'Arrendamiento de bienes muebles',
'020' => 'Mantenimiento y reparación de bienes muebles',
'021' => 'Movimiento de carga',
'022' => 'Otros servicios empresariales',
Expand Down Expand Up @@ -133,4 +133,4 @@ public function getValueCatalog($value, $code): ?string
{
return $this->store[$code][$value] ?? '';
}
}
}
20 changes: 4 additions & 16 deletions packages/report/src/Report/Render/QrRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,13 @@ public function getImage($sale)
}

/**
* @param Despatch $despatch
*
* Summary of getImageDespatch
* @param string $qr Link de la guía de remisión encontrada en el CDR
* @return string
*/
public function getImageDespatch($despatch)
public function getImageDespatch(string $qr)
{
$destinatario = $despatch->getDestinatario();
$params = [
$despatch->getCompany()->getRuc(),
$despatch->getTipoDoc(),
$despatch->getSerie(),
$despatch->getCorrelativo(),
$despatch->getFechaEmision()->format('Y-m-d'),
$destinatario->getTipoDoc(),
$destinatario->getNumDoc(),
];
$content = implode('|', $params).'|';

return $this->getQrImage($content);
return $this->getQrImage($qr);
}

/**
Expand Down
9 changes: 5 additions & 4 deletions packages/report/src/Report/Templates/despatch.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
<tbody><tr>
<td align="center">
<span style="font-family:Tahoma, Geneva, sans-serif; font-size:29px" text-align="center">{{ name }}</span>
<br>
<span style="font-family:Tahoma, Geneva, sans-serif; font-size:19px" text-align="center">E L E C T R Ó N I C A</span>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -178,7 +176,9 @@
<br><br>
<span style="font-family:Tahoma, Geneva, sans-serif; font-size:12px" text-align="center"><strong>Observaciones</strong></span>
<br>
<p>{{ doc.observacion }}</p>
{% for obs in doc.observacion %}
<p>{{ obs }}</p>
{% endfor %}
{% endif %}
</td>
</tr>
Expand All @@ -203,10 +203,11 @@
{% if params.system.hash is defined and params.system.hash%}
<strong>Resumen:</strong> {{ params.system.hash }}<br>
{% endif %}
<span>Representación Impresa de la {{ name }} ELECTRÓNICA.</span>
<span>Representación Impresa de la {{ name }}.</span>
</blockquote>
</td>
<td width="15%" align="right">
<img src="{{ qrCodeDespatch(params.system.qr)|image_b64('svg+xml') }}" alt="Qr Image">
{% if params.system.qr is defined %}
<img src="{{ qrUrl(params.system.qr)|image_b64('svg+xml') }}" alt="Qr Image">
{% endif %}
Expand Down
7 changes: 6 additions & 1 deletion packages/report/src/Report/Templates/invoice2.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,18 @@
<td class="no">{{ det.cantidad|n_format }}</td>
<td class="desc">
<h3>{{ det.codProducto }}</h3>
{{ det.descripcion }}
{{ det.descripcion|replace({'|': '<br>'})|raw }}
</td>
<td class="unit">{{ det.unidad }}</td>
<td class="qty">{{ moneda }}{{ det.mtoValorUnitario }}</td>
<td class="total">{{ moneda }}{{ det.mtoValorVenta }}</td>
</tr>
{% endfor %}
<tr>
{% for obs in doc.observacion %}
<span>{{ obs }}</span><br>
{% endfor %}
</tr>
</tbody>
<tfoot>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion packages/report/src/Report/Templates/perception.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<td width="40%" align="left"><strong>Tasa: </strong> {{ doc.tasa|n_format }}% </td>
</tr>
<tr>
<td width="60%" align="left"><strong>Tipo Moneda: </strong> {{ 'PEN'|catalog('021') }} </td>
<td width="60%" align="left"><strong>Tipo Moneda: </strong> {{ 'PEN'|catalog('21') }} </td>
<td width="40%" align="left"></td>
</tr>
</tbody></table>
Expand Down
2 changes: 1 addition & 1 deletion packages/report/src/Report/Templates/retention.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<td width="40%" align="left"><strong>Tasa: </strong> {{ doc.tasa|n_format }}% </td>
</tr>
<tr>
<td width="60%" align="left"><strong>Tipo Moneda: </strong> {{ 'PEN'|catalog('021') }} </td>
<td width="60%" align="left"><strong>Tipo Moneda: </strong> {{ 'PEN'|catalog('21') }} </td>
<td width="40%" align="left"></td>
</tr>
</tbody></table>
Expand Down
2 changes: 1 addition & 1 deletion packages/report/src/Report/Templates/summary.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<td width="40%" height="15" align="left"><strong>Fecha de Generación:</strong> {{ fecGen }}</td>
</tr>
<tr>
<td width="60%" align="left"><strong>Moneda: </strong> {{ 'PEN'|catalog('021') }} </td>
<td width="60%" align="left"><strong>Moneda: </strong> {{ 'PEN'|catalog('21') }} </td>
<td width="40%" align="left"></td>
</tr>
</tbody></table>
Expand Down
36 changes: 32 additions & 4 deletions packages/xml/src/Xml/Templates/despatch2022.xml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
<cbc:IssueDate>{{ doc.fechaEmision|date('Y-m-d') }}</cbc:IssueDate>
<cbc:IssueTime>{{ doc.fechaEmision|date('H:i:s') }}</cbc:IssueTime>
<cbc:DespatchAdviceTypeCode listAgencyName="PE:SUNAT" listName="Tipo de Documento" listURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo01">{{ doc.tipoDoc }}</cbc:DespatchAdviceTypeCode>
{% if doc.observacion %}
<cbc:Note><![CDATA[{{ doc.observacion|raw }}]]></cbc:Note>
{% endif %}
{% if doc.observacion %}
{% for obs in doc.observacion %}
<cbc:Note><![CDATA[{{ obs|raw }}]]></cbc:Note>
{% endfor %}
{% endif %}
{% for rel in doc.addDocs %}
<cac:AdditionalDocumentReference>
<cbc:ID>{{ rel.nro }}</cbc:ID>
Expand Down Expand Up @@ -110,6 +112,21 @@
{% for indicador in envio.indicadores %}
<cbc:SpecialInstructions>{{ indicador }}</cbc:SpecialInstructions>
{% endfor %}
{% if envio.subContratado %}
<cac:Consignment>
<!-- ID OBLIGATORIO POR UBL -->
<cbc:ID>SUNAT_Envio</cbc:ID>
<!-- DATOS DEL SUBCONTRATADOR -->
<cac:LogisticsOperatorParty>
<cac:PartyIdentification>
<cbc:ID schemeID="{{ envio.subContratado.tipoDoc }}" schemeName="Documento de Identidad" schemeAgencyName="PE:SUNAT" schemeURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06">{{ envio.subContratado.numDoc }}</cbc:ID>
</cac:PartyIdentification>
<cac:PartyLegalEntity>
<cbc:RegistrationName><![CDATA[{{ envio.subContratado.rznSocial|raw }}]]></cbc:RegistrationName>
</cac:PartyLegalEntity>
</cac:LogisticsOperatorParty>
</cac:Consignment>
{% endif %}
<cac:ShipmentStage>
<cbc:TransportModeCode listName="Modalidad de traslado" listAgencyName="PE:SUNAT" listURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo18">{{ envio.modTraslado }}</cbc:TransportModeCode>
{% if envio.fecTraslado %}
Expand Down Expand Up @@ -160,6 +177,17 @@
<cbc:Line>{{ envio.partida.direccion }}</cbc:Line>
</cac:AddressLine>
</cac:DespatchAddress>
{% if doc.remitente %}
<cac:DespatchParty>
<cac:PartyIdentification>
<cbc:ID schemeID="6" schemeName="Documento de Identidad" schemeAgencyName="PE:SUNAT"
schemeURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06">{{ doc.remitente.numDoc|raw }}</cbc:ID>
</cac:PartyIdentification>
<cac:PartyLegalEntity>
<cbc:RegistrationName><![CDATA[{{ doc.remitente.rznSocial }}]]></cbc:RegistrationName>
</cac:PartyLegalEntity>
</cac:DespatchParty>
{% endif %}
</cac:Despatch>
</cac:Delivery>
{% for precinto in envio.contenedores %}
Expand Down Expand Up @@ -246,4 +274,4 @@
</cac:DespatchLine>
{% endfor %}
</DespatchAdvice>
{% endapply %}
{% endapply %}
6 changes: 3 additions & 3 deletions packages/xml/src/Xml/Templates/invoice2.1.xml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
{% for leg in doc.legends %}
<cbc:Note languageLocaleID="{{ leg.code }}"><![CDATA[{{ leg.value }}]]></cbc:Note>
{% endfor %}
{% if doc.observacion %}
<cbc:Note><![CDATA[{{ doc.observacion }}]]></cbc:Note>
{% endif %}
{% for obs in doc.observacion %}
<cbc:Note><![CDATA[{{ obs }}]]></cbc:Note>
{% endfor %}
<cbc:DocumentCurrencyCode>{{ doc.tipoMoneda }}</cbc:DocumentCurrencyCode>
{% if doc.compra %}
<cac:OrderReference>
Expand Down
Loading