webforge/accounting

A small library for some basics for invoices

1.0.0 2013-11-18 09:50 UTC

This package is auto-updated.

Last update: 2024-04-07 01:12:39 UTC


README

Build Status
Coverage Status
Latest Stable Version

A small library for some basics for invoices

Prices

The Webforge\Accounting\Price class will help you with some calculation basics:

$price = new Price(4284, Price::GROSS, 0.19);

$this->assertEquals(4284, $price->getGross());
$this->assertEquals(3600, $price->getNet());
$this->assertEquals(0.19, $price->getTax());
$this->assertEquals(684, $price->getTaxValue()); // = 4284-3600

// or construct it the other way round:
$price = new Price(3600, Price::NET, 0.19);
$this->assertEquals(4284, $price->getGross());
$this->assertEquals(3600, $price->getNet());
$this->assertEquals(0.19, $price->getTax());
$this->assertEquals(684, $price->getTaxValue()); // = 4284-3600

You can provide prices without taxes:

$price = new Price(4284, Price::GROSS, Price::NO_TAXES);

$this->assertEquals(4284, $price->getGross());
$this->assertEquals(4284, $price->getNet());
$this->assertEquals(0, $price->getTax());
$this->assertEquals(0, $price->getTaxValue());