https://github.com/sheape/vat_ph
Rust library that calculates Value Added Tax (VAT) in the Philippines.
https://github.com/sheape/vat_ph
finance ph rust tax vat
Last synced: 5 months ago
JSON representation
Rust library that calculates Value Added Tax (VAT) in the Philippines.
- Host: GitHub
- URL: https://github.com/sheape/vat_ph
- Owner: Sheape
- License: mit
- Created: 2025-06-20T15:38:32.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-06-20T17:58:07.000Z (12 months ago)
- Last Synced: 2025-06-20T18:16:16.522Z (12 months ago)
- Topics: finance, ph, rust, tax, vat
- Language: Rust
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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`.