TKTAX-Donations
A focused crate for modeling charitable transactions (donationes in Latin) with comprehensive valuation features (inflatio, depreciatio) for tax or record-keeping systems. This crate is part of the broader TKTAX ecosystem, providing calculations for fair-market values, generating donation summaries, and handling advanced date-based amortization.
Features
- Donation Builder (Praeparatio Donatio): Constructs donation records with flexible error handling and optional Amazon integration for historical unit-price lookups.
- Depreciation & Inflation Calculation (Depreciatio & Inflatio): Applies monthly and yearly factors to original prices using robust decimal arithmetic.
- Estimation & Reporting: Generates precise
DonationValueEstimateitems, supporting multiple display formats and advanced grouped reporting. - Multiple Donation Sources: Handles:
- Full Amazon purchase history lookups
- Items with uncertain origins but approximate or exact listing references
- Configurable donation types (books, furniture, clothing, etc.)
Quick Start
Add the dependency to your Cargo.toml:
[]
= "0.1.0"
Then construct and estimate donations:
use *;
Technical Overview
- Numeric Calculations: Utilizes
Decimalfor monetary and factor operations, preventing floating-point inaccuracies. - Chronological Modeling: Leverages
chrono::NaiveDatefor date arithmetic, ensuring day-level precision without time-zone complexity. - Typed Error Handling:
DonationBuilderErrorand related error structures avoid stringly-typed error messages. - DonationValueEstimate: Encapsulates item name, quantity, original price, elapsed time, inflation factor, and depreciation adjustments into a structured, auditable record.
Example Analysis
Within an application, you can group and display donation data:
use *;
License
Dual-licensed under MIT or Apache-2.0. See LICENSE for details.
Contributing
Contributions and suggestions are welcome. Please open an issue or pull request in the GitHub repository.