MRP invoices XML export.
Use composer to install this package.
$invoice = new Mrp\Invoice();
$invoice->addRow(['idfak' => 1, 'cislo' => '1201700001', 'ico' => '12345678', ...]);
$invoiceItem = new Mrp\InvoiceItem();
$invoiceItem->addRow(['idr' => 1, 'idfak' => 1, 'cenamj' => 50, ...]);
$invoiceItem->addRow(['idr' => 2, 'idfak' => 1, 'cenamj' => 200, ...]);
$address = new Mrp\Address();
$address->addRow(['idradr' => 1, 'firma' => 'Company', 'ico' => '11112222', ...]);
$bankAccount = new Mrp\BankAccount();
$bankAccount->addRow(['idr' => '1', 'idradr' => '1', ...]);
$zip = new ZipArchive();
if ($zip->open('export.zip', ZipArchive::CREATE) === true) {
$zip->addFromString('mrp/FAKVY.XML', $invoice->getXml());
$zip->addFromString('mrp/FAKVYPOL.XML', $invoiceItem->getXml());
$zip->addFromString('mrp/FV_ADRES.XML', $address->getXml());
$zip->addFromString('mrp/FV_ADRESBAN.XML', $bankAccount->getXml());
$zip->close();
}
You can find input fields for addRow()
method on MRP website. Please use all array keys as lowercase.
Tests are build with Nette Tester. You can run it like this:
tester.bat -c php.ini-win --coverage coverage.html --coverage-src ../src
- PHP 5.4+
- ext-zip
- ext-mbstring
MIT License (c) Pavol Biely
Read the provided LICENSE file for details.