vat_ph

Crates.iovat_ph
lib.rsvat_ph
version0.1.0
created_at2025-06-20 18:07:42.406029+00
updated_at2025-06-20 18:07:42.406029+00
descriptionA library for calculating VAT in the Philippines.
homepage
repositoryhttps://github.com/Sheape/vat_ph
max_upload_size
id1719966
size32,976
Paul Pare (Sheape)

documentation

README

vat_ph

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 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.

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 version 1.86.0.
  3. Build the project with cargo build.
  4. Run test using cargo test.
Commit count: 0

cargo fmt