vat_ph 0.1.0

A library for calculating VAT in the Philippines.
Documentation
  • Coverage
  • 100%
    13 out of 13 items documented2 out of 5 items with examples
  • Size
  • Source code size: 32.49 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.93 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 25s Average build duration of successful builds.
  • all releases: 25s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Sheape/vat_ph
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Sheape

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.