- Added one-click **eTIMS** action on Business Locations; it opens the existing KRA eTIMS settings tab directly without changing the aligned eTIMS form.
# eTIMS Integration Change Summary - 2026-09-10

- Added Comstore FC4 invoice fiscalisation with secure X-API-KEY requests.
- Added fast invoice-first processing to avoid a fiscal inventory read on every sale.
- Added automatic E337 missing-PLU upload and controlled invoice retry.
- Added E090/E351 fiscal stock repair/retry using current POS stock.
- Added business-location eTIMS configuration and product-level fiscal master-data overrides.
- Added API/device **Test Connection** action using health + device initialization.
- Added **Check Pending Invoices** action.
- Added **Upload Pending eTIMS Invoices** action using the Comstore manual-upload endpoint.
- Added eTIMS **sales return / credit note** integration with required refund reason code and refund payment method.
- Credit notes reference the original successful CU invoice and use Comstore `InvoiceType = credit`.
- Added protection against editing/deleting successfully fiscalised returns.
- Added persistence of eTIMS signature/QR metadata against both sales and sales returns.
- Added VAT A/B/C/D/E tax breakdown with inclusive 16% and 8% calculations.
- Added safeguards against tax ambiguity, mismatched totals, duplicate fiscalisation and unsafe edits/deletes.
- Improved the professional 80 mm thermal layout for both TAX INVOICE and CREDIT NOTE, including fixed aligned columns, totals, payment/refund details, tax summary, QR, CU identifiers and barcode.
- Normalized receipt monetary output so the currency symbol is not duplicated by browser formatting.
- Preserved the local transaction first: eTIMS/network failure does not roll back a sale or sales return already committed in POS.
- Fixed fresh-deployment Laravel `Please provide a valid cache path` failure by using a stable compiled Blade path and including required writable storage directories.
- Corrected eTIMS settings visibility: added a dedicated **KRA eTIMS** tab to the actual Business Location Settings page (`/business-location/{id}/settings`) and made that page save all eTIMS fields. This is the page reached by the Settings button in Business Locations.

## Settings persistence / controls fix
- Added a dedicated **Save eTIMS Settings** AJAX action with immediate success/error feedback.
- Fixed eTIMS action buttons not responding when the eTIMS partial was rendered before jQuery loaded; handlers now load after the main JavaScript bundle.
- Added persistent API-key status so a blank password field after reload is clearly shown as **saved securely**, not lost.
- Added **Apply Common Defaults** for safe technical defaults (local API URL, pieces quantity unit, finished-product type, auto-PLU and professional receipt).
- KRA item class, package unit, origin and tax are intentionally not guessed because they are product/compliance specific.
- Added a repair migration that recreates missing eTIMS columns in partially upgraded databases.
- Main Business Location Settings Update now returns to the eTIMS tab when that tab was active.
- Test, pending-status and manual-upload controls now show visible errors instead of silently doing nothing.

## 2026-09-11 tax detection / connection-test correction

- Fixed POS tax inheritance when eTIMS Default Tax Type is set to **Use product/POS tax**.
- eTIMS now checks the sale-line tax, then the product master tax (for example `VAT@16%`), then the stored tax id, before requiring a manual A/B/C/D/E override.
- `VAT@16%` maps automatically to eTIMS tax type **B** and 8% maps to **E**.
- Zero-rated tax names are safely mapped only when the tax master name clearly identifies Exempt, Zero-rated, or Non-VAT.
- Fixed a false-negative Test API / Device Connection result for Comstore builds whose `/api/init` success response contains `success/message` but omits `deviceConnection`.
