PHP code example of puyu-pe / nexus-doc-gen
1. Go to this page and download the library: Download puyu-pe/nexus-doc-gen library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
puyu-pe / nexus-doc-gen example snippets
$data = json_decode([JSON])
$data = (object) [
'company' => (object) [
'ruc' => '20527056579',
'razonSocial' => 'NOMBRE DE LA EMPRESA',
'nombreComercial' => null,
'address' => (object) [
'ubigueo' => '030109',
'codigoPais' => 'PE',
'departamento' => 'Apurímac',
'provincia' => 'Abancay',
'distrito' => 'Abancay',
'urbanizacion' => null,
'direccion' => 'Av. Garcilazo de la Vega S/N',
'codLocal' => '0000',
],
'email' => null,
'telephone' => '083-321965',
],
'tipoOperacion' => '0101',
'formato' => 'ticket',
'tipoDoc' => '03',
'tipoDocNombre' => '', // REQUERIDO SI tipoDoc = 00
'codLocal' => '0000',
'serie' => 'B001',
'correlativo' => '25735',
'fechaEmision' => '2023-09-19 09:12:58',
'fechaVencimiento' => '2023-09-19',
'tipoMoneda' => 'PEN',
'mtoOperGravadas' => '0.00',
'mtoOperExoneradas' => '6.00',
'mtoOperInafectas' => '0.00',
'mtoIGV' => '0.00',
'totalImpuestos' => '0.00',
'valorVenta' => '6.00',
'subTotal' => '6.00',
'mtoImpVenta' => '6.00',
'formaPago' => (object) [
'moneda' => 'PEN',
'tipo' => 'Contado',
'monto' => '6.0000',
],
'cuotas' => [],
'client' => (object) [
'tipoDoc' => '1',
'numDoc' => '70430738',
'rznSocial' => 'LUIS ALFREDO HUAMANI QUISPE',
'address' => (object) [
'direccion' => null
]
],
'cashier' => (object) [
'tipoDoc' => 1,
'numDoc' => '-',
'rznSocial' => 'ucaja'
],
'detailsHeader' => //REQUERIDO SI tipoDoc = 00
[ // ENCABEZADO A MOSTRAR => DATO EN details
(object) [
'title ' => 'CODIGO',
'field' => 'codProducto',
'align' => 'left' //Alineación de items, opcional, por defecto derecha (right)
],
(object) [
'title ' => 'UNIDAD',
'field' => 'unidad'
],
(object) [
'title ' => 'DESCRIPCION',
'field' => 'descripcion'
],
(object) [
'title ' => 'CANTIDAD',
'field' => 'cantidad'
],
(object)
[ 'title ' => 'PRECIO ,
'field' UNITARIO' => 'mtoPrecioUnitario'
],
(object) [
'title ' => 'TOTAL',
'field' => 'total'
],
],
'details' => [ //DE ACUERDO A detailsHeader, si tipodoc = 00 incluir todos los mencionados en field
(object) [
'codProducto' => '1.3.23.14.1',
'unidad' => 'NIU',
'descripcion' => 'CONSTANCIA DE NOTAS POR SEMESTRE',
'cantidad' => '1.00',
'mtoValorUnitario' => '6.00',
'mtoValorVenta' => '6.00',
'mtoBaseIgv' => '6.00',
'porcentajeIgv' => 0,
'igv' => 0,
'tipAfeIgv' => '20',
'totalImpuestos' => 0,
'mtoPrecioUnitario' => '6.00',
'total' => '6.00' //REQUERIDO SI tipoDoc = 00
],
],
'detailsSummary' => [ //REQUERIDO SI tipoDoc = 00
(object) [ // TOTALES O RESUMEN A MOSTRAR
'title' => 'TOTAL',
'value' => '6.00',
'colspan' => 2 //Requerido para formato ticket
],
],
'legends' => [
(object) [
'code' => '1000',
'value' => 'SEIS CON 00/100 SOLES.',
],
],
'observation' => null,
'documentFooter' => null,
'params' => [VER CAMPO ADICIONAL]
];