Summary
Successfully migrated all invoices from USD to AUD currency and implemented automatic 10% GST (Goods and Services Tax) calculations for Australian compliance.
Database Changes
New Columns Added to invoices table:
- tax_rate - NUMERIC(5,2) DEFAULT 10.00 - Tax rate as percentage
- tax_amount - NUMERIC(10,2) DEFAULT 0 - Calculated tax amount in currency
Schema Updates:
- Changed default currency from 'USD' to 'AUD'
- Added index on currency column for performance
Migration Results
Invoices Updated:
- 502 invoices converted from USD/usd to AUD
- 502 invoices had GST calculated retroactively
- 108 invoices had totals corrected to include GST
GST Calculation:
- Default rate: 10% (Australian GST)
- Formula: tax_amount = subtotal × (tax_rate / 100)
- Total: total = subtotal + tax_amount
Code Changes
Backend (rmm-psa-backend):
- routes/invoices.js:
- Changed default currency from 'USD' to 'AUD'
- Auto-calculate GST on invoice creation
- Auto-calculate GST on invoice updates
- Include tax_rate, tax_amount, subtotal in INSERT/UPDATE queries
- routes/invoice-payments.js:
- Changed Stripe payment intent currency from 'usd' to 'aud' (lowercase)
- Payment amounts now in AUD cents
- migrations/2026_03_17_add_gst_to_invoices.sql:
- Database migration script for GST columns
- Currency conversion SQL
- Retroactive tax calculations
Frontend (rmm-psa-dashboard):
- src/pages/InvoiceDetail.jsx:
- Display dynamic tax rate (reads from invoice.tax_rate)
- Use tax_amount field from backend (with fallback to tax_total)
- Show GST breakdown in totals section
Invoice Display Format
Before:
After:
Subtotal (ex GST): AUD $500.00
GST (10%): AUD $50.00
─────────────────────────────
TOTAL (inc GST): AUD $550.00
Stripe Integration
- Payment intents now created in AUD currency
- Stripe automatically handles AUD payment processing
- Connected accounts must support AUD (verify with Stripe)
Testing Results
Sample invoices verified:
- ✅ Invoice #20: AUD $191.64 + GST $19.16 = $210.80
- ✅ Invoice #503: AUD $500.00 + GST $50.00 = $550.00
- ✅ Invoice #504: AUD $150.00 + GST $15.00 = $165.00
- ✅ Invoice #505: AUD $75.00 + GST $7.50 = $82.50
All calculations verified correct within 1 cent tolerance.
Deployment Status
- ✅ Backend: Deployed (commit c4c5640)
- ✅ Frontend: Deployed (commit 1551770)
- ✅ Database: Migrated (502 invoices)
- ✅ Stripe: Configured for AUD
Future Considerations
- Multi-Currency Support: If needed, the tax_rate column allows per-invoice tax rates
- Tax Exemptions: Can set tax_rate=0 for tax-exempt invoices
- Different Tax Rates: System supports variable tax rates per invoice
- Currency Symbol: Frontend displays currency code (AUD) - could add $ symbol for AUD
Rollback Instructions
If rollback is needed:
UPDATE invoices SET currency = 'USD';
ALTER TABLE invoices ALTER COLUMN currency SET DEFAULT 'USD';
UPDATE invoices SET tax_rate = 0, tax_amount = 0;
UPDATE invoices SET total = subtotal;
Note: Stripe payments already processed in AUD cannot be automatically converted back.
Support Notes
- GST is automatically calculated for all new invoices
- Existing invoices have been retroactively updated
- Invoice totals include GST (clearly labeled)
- Customers will see AUD pricing on all invoices and payment pages
- Test card payments (4242...) work with AUD in Stripe test mode
Generated: March 17, 2026 Migration completed successfully ✅