PHP code example of dazza-dev / dian-xml-generator
1. Go to this page and download the library: Download dazza-dev/dian-xml-generator 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/ */
'allowance_charges' => [
[
'is_charge' => true, // true: cargo, false: descuento
'reason_code' => '00', // Codigo del motivo del descuento o cargo (ver listado de codigos)
'percentage' => 10.00, // Porcentaje de descuento o cargo
'amount' => 840.34, // Monto del descuento o cargo
'base_amount' => 8403.36, // Monto base del descuento o cargo
],
];
'operation_type' => '2' // Anulación de factura electrónica
use DazzaDev\DianXmlGenerator\Builder\DocumentBuilder;
$documentBuilder = new DocumentBuilder(
type: 'invoice',
documentData: $documentData,
environment: '2', // 1: Producción, 2: Pruebas
software: $software,
);
$xml = $documentBuilder->getXml();
$document = $documentBuilder->getDocument();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.