MRP invoices XML export.

dev-master 2018-05-31 18:17 UTC

This package is auto-updated.

Last update: 2024-04-17 08:35:13 UTC


README

Build Status Coverage Status

MRP invoices XML export.

Usage

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.

How to run tests?

Tests are build with Nette Tester. You can run it like this:

tester.bat -c php.ini-win --coverage coverage.html --coverage-src ../src

Minimum requirements

  • PHP 5.4+
  • ext-zip
  • ext-mbstring

License

MIT License (c) Pavol Biely

Read the provided LICENSE file for details.