https://github.com/webforge-labs/webforge-accounting
A small library for some basics for invoices
https://github.com/webforge-labs/webforge-accounting
Last synced: over 1 year ago
JSON representation
A small library for some basics for invoices
- Host: GitHub
- URL: https://github.com/webforge-labs/webforge-accounting
- Owner: webforge-labs
- License: mit
- Created: 2013-11-17T11:37:36.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-11-18T09:51:49.000Z (over 12 years ago)
- Last Synced: 2025-02-06T13:19:29.024Z (over 1 year ago)
- Language: PHP
- Size: 137 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Accounting
[](https://travis-ci.org/webforge-labs/webforge-accounting)
[](https://coveralls.io/r/webforge-labs/webforge-accounting?branch=master)
[](https://packagist.org/packages/webforge/accounting)
A small library for some basics for invoices
## Prices
The `Webforge\Accounting\Price` class will help you with some calculation basics:
```php
$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:
```php
$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());
```