Store the tax rate on the row, not in a lookup table
Israeli tax rules for business expenses change on a schedule. Travel caps are revised every January, categories carry their own recognition and VAT rates, and an accountant expects a report filed last March to show exact
Israeli tax rules for business expenses change on a schedule. Travel caps are revised every January, categories carry their own recognition and VAT rates, and an accountant expects a report filed last March to show exactly what it showed last March.
A common first version of an expense model looks the rate up when a report is read:
const recognized = expense.amount * RATES[expense.category].taxShare;
It works until the first rule change. Then every old report quietly recalculates with the new rate, and last year's numbers drift.
Write the rate when you write the expense
The fix is boring and reliable: copy the rates onto the expense at the moment it is recorded.
function recordExpense(input, rules = currentRules()) {
const r = rules.categories[input.category];
return {
...input,
taxShare: r.taxShare, // most costs: 1
vatOffsetShare: r.vatShare, // fuel: 2/3, insurance: 0
rulesVersion: rules.version,
};
}
Reports now read only what is on the row. A rule change touches new rows and leaves filed periods alone.
Same idea for travel caps
Foreign business travel has its own table: a nightly hotel cap in dollars, a higher cap in 28 countries, and a reduced rate from the eighth night of a trip. A trip report should take the caps of the year the trip ended in and store them with the report, for the same reason.
Details that bite
- VAT offset depends on the category. Fuel and a car offset two thirds of the VAT, while bank fees, salaries and insurance offset none.
- A payment with no document still counts in profit and loss but offsets no VAT, so "no receipt" deserves its own flag rather than a null field.
- Foreign amounts convert at the Bank of Israel representative rate of the day they were paid, which is often days before anyone writes the report.
Where AI fits in
Frozen rates only help if the inputs are right, and typing receipts by hand is where most mistakes start. In Slate, an invoicing app for Israeli businesses, AI reads a photo or PDF of a receipt and fills in the supplier, their tax ID, the document number, the date, the amounts, the currency and the allocation number, then suggests a category. Up to 30 receipts can go in at once, each as its own row to check. The travel report works the same way with a flight ticket, a hotel invoice and a car rental receipt: AI recognizes each document and reads the destination, the dates, the nights and the payment day, and the caps logic above runs on what it extracted. The model only proposes values; nothing is saved until a person approves it.
If you want the rules themselves in plain English, there are two short explainers: the two numbers behind every receipt and what a week of business travel in Berlin adds up to.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.