PHP code example of kenod / isdoc-exporter

1. Go to this page and download the library: Download kenod/isdoc-exporter 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/ */

    

kenod / isdoc-exporter example snippets


use Kenod\IsdocExporter\Invoice;

$invoice = new Invoice();
$invoice
    ->setNumber('2024001')
    ->setIssueDate('2024-01-15')
    ->setDueDate('2024-02-15');

$invoice->supplier
    ->setName('Supplier s.r.o.')
    ->setStreet('Main Street 10')
    ->setCity('Prague')
    ->setZip('110 00')
    ->setCompanyId('12345678');

$invoice->customer
    ->setName('Customer a.s.')
    ->setStreet('Side Street 20')
    ->setCity('Brno')
    ->setZip('602 00')
    ->setCompanyId('87654321');

$invoice->payment
    ->setAccountNumber('123456789')
    ->setBankCode('0100')
    ->setVariableSymbol('2024001');

$invoice
    ->addItem('Website development', 1.0, 'pcs', 15000.0, 15000.0, 0.0)
    ->addItem('Hosting for 1 year', 12.0, 'months', 200.0, 200.0, 0.0);

// Save to file
$invoice->export()->save('invoice.isdoc');

// Or get XML as string
$xml = $invoice->export()->toString();

// Or send as HTTP download
$invoice->export()->download('invoice.isdoc');

$invoice = new Invoice();
$invoice
    ->setNumber('FV-2024-042')
    ->setIssueDate('2024-03-01')
    ->setDueDate('2024-03-15')
    ->setVatPayer(true)
    ->setDeliveryDate('2024-02-29')
    ->setRoundTotal(true);

// Supplier and customer setup...

// Items with VAT (unitPrice without VAT, unitPriceWithVat with VAT, vatRate)
$invoice
    ->addItem('Development', 80.0, 'hrs', 1500.0, 1815.0, 21.0)
    ->addItem('Printed manual', 50.0, 'pcs', 350.0, 392.0, 12.0);

$invoice->export()->save('vat_invoice.isdoc');

use Kenod\IsdocExporter\DocumentType;
use Kenod\IsdocExporter\Invoice;

$invoice = new Invoice();
$invoice
    ->setDocumentType(DocumentType::CreditNote)
    ->setNumber('DN-2024-001')
    ->setIssueDate('2024-04-01')
    ->setDueDate('2024-04-15')
    ->setVatPayer(true)
    ->setDeliveryDate('2024-04-01')
    ->setOriginalDocumentNumber('FV-2024-042')
    ->setOriginalDocumentDate('2024-03-01');

// ...

$invoice = new Invoice();
$invoice
    ->setNumber('FV-2024-RC-001')
    ->setIssueDate('2024-06-30')
    ->setDueDate('2024-07-30')
    ->setVatPayer(true)
    ->setDeliveryDate('2024-06-30')
    ->setReverseCharge(true)
    ->setReverseChargeType('4'); // 4 = construction services

// ...

$invoice = new Invoice();
$invoice
    ->setCurrencyCode('CZK')
    ->setForeignCurrencyCode('EUR')
    ->setCurrencyRate(25.35)
    ->setRefCurrencyRate(1.0);

// ...