# vat_ph
[](https://github.com/Sheape/vat_ph/blob/main/LICENSE)
`vat_ph` is a library for computing Value Added Tax (VAT) in the Philippines.
The computed VAT follows the guidelines set by the Bureau of Internal Revenue (BIR) under Republic Act 12023.
The computation uses [`rust_decimal`](https://docs.rs/rust_decimal/latest/rust_decimal/) crate to ensure precise
financial calculations.
## Usage
Using `compute_vat()`, you can compute the VAT given net, gross, or VAT. The result will be a struct containing all of
the three mentioned.
```rust
use rust_decimal::dec;
use vat_ph::compute_vat;
use vat_ph::VatInput;
let result = compute_vat(VatInput::Net(dec!(1000.0)), None);
assert!(result.is_ok());
let vat = result.unwrap();
assert_eq!(vat.net, dec!(1000.0));
assert_eq!(vat.vat, dec!(120.0));
assert_eq!(vat.gross, dec!(1120.0));
```
## Contribution
In order to contribute to this project, you can follow these steps:
1. Clone this repository.
2. Install the [rust toolchain](https://www.rust-lang.org/tools/install) version `1.86.0`.
3. Build the project with `cargo build`.
4. Run test using `cargo test`.