1. Go to this page and download the library: Download rezzza/accounting 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/ */
rezzza / accounting example snippets
$resultsSet = new OperationSetResult(array(
'discount_rate' => new Percentage(10), // Our special discount rate for that lucky guy
'vat_rate' => new Percentage(19.6), // French VAT rate
));
$f = new Factory();
$os = new OperationSet(
array(
'price_discounted' => new Operation(
new Reference\Reference('price_excl_taxes'),
Operation::MINORATE,
new Reference\Reference('discount_rate')
),
'price_incl_taxes' => new Operation(
$f->value(new Reference\Reference('price_discounted')),
Operation::MAJORATE,
new Reference\Reference('vat_rate')
),
),
$resultsSet
);
$os
->getResultsSet()
->add(new Price(100, 'EUR'), 'price_excl_taxes');
$os->compute();
echo sprintf("%s\n", $os->getResultsSet());