PHP code example of ameax / datev-xml

1. Go to this page and download the library: Download ameax/datev-xml 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/ */

    

ameax / datev-xml example snippets


    use Ameax\Datev\DataObjects\DatevAccountLedgerData;
    use Ameax\Datev\DataObjects\DatevDocumentData;
    use Ameax\Datev\DataObjects\DatevRepositoryData;
    use Ameax\Datev\Zip;
    use Carbon\Carbon;

    $datevDocumentData = new DatevDocumentData();

    $ledgerData = new DatevAccountLedgerData(
        consolidatedDate: new Carbon('2023-06-14'),
        consolidatedDeliveryDate: new Carbon('2023-06-14'),
        consolidatedInvoiceId: 'RE12345',
        customerName: 'ARANES',
        customerCity: 'Aufhausen',
        shipFromCountry: 'DE',
        accountName: 'ARANES Aufhausen',
        dueDate: new Carbon('2023-07-01'),
        bpAccountNo: '12345'
    );
    $ledgerData->addAccountsReceivableLedger(
        amount: 119.00,
        accountNo: '8400',
        information: 'Software',
        bookingText: 'Umsatz 19%'
    );
    $ledgerData->addAccountsReceivableLedger(
        amount: 214.00,
        accountNo: '8300',
        information: 'Bücher',
        bookingText: 'Umsatz 7%'
    );

    $datevDocumentData->buildAccountsReceivableLedger(
        datevAccountLedgerData: $ledgerData,
        filePaths             : ['path-to-invoice.pdf']
    );

    $datevRepositoryData = new DatevRepositoryData();

    $datevDocumentData->addSEPAFile(
        nameWithExtension  : 'sepa-2023-12345.xml',
        filePath           : 'path-to-sepafile.xml',
        date               : new Carbon('2023-05-01'),
        datevRepositoryData: $datevRepositoryData);

    $zipPath = $datevDocumentData->generateZip();