Add new fields for tax and depreciation in receipt processing

- Introduced fields: receipt_location, calculated_tax, is_depreciable, cca_rate, useful_life, and residual_value in DBReceipt model.
- Updated process_document function to handle new receipt data attributes.
- Enhanced DocumentProcessResponse schema to include new fields.
- Updated document processing rules to incorporate tax calculation based on location and depreciation rules.
This commit is contained in:
bolade
2025-10-07 11:15:26 +01:00
parent 823c05f78d
commit d8315f13ac
5 changed files with 172 additions and 23 deletions
+1 -11
View File
@@ -44,17 +44,7 @@ If the location is missing, apply the users location sales tax by default.
**FX (Foreign Exchange):** If the receipt is in a different currency, flag the FX difference for manual review but dont fetch exchange rates.
### Tax Rules:
Four Rules for Tax and Depreciation Handling
### 1. **Sales Tax Rule**
**Purpose**: To calculate and apply the correct sales tax based on the shipping and billing addresses.
- **When Billing and Shipping Address are the Same**: Apply the sales tax rate based on the billing address.
- **When Billing and Shipping Address are Different**: Apply the sales tax rate based on the shipping address.
**Example**:
1. If the billing and shipping address are in Ontario, the system will apply the 13% HST tax rate based on Ontario's tax rate.
2. If the billing address is in Ontario but the shipping address is in Quebec, the system will apply the 14.975% QST tax rate based on the shipping address.
### 2. **Foreign Exchange (FX) Rule**
**Purpose**: To handle discrepancies when transactions and receipts are in different currencies (e.g., USD vs. CAD).
- **Action**: Identify the currency mismatch, but do not automatically fetch the exchange rate. Flag the FX difference for manual review, allowing the user to approve or adjust the balance.