Phase 1: accounting

This commit is contained in:
2026-05-06 14:10:46 -05:00
parent 373c1cb945
commit d6d70e641c
8 changed files with 1241 additions and 9 deletions

View File

@@ -115,6 +115,32 @@ const API = {
syncPayments: () => fetch('/api/qbo/sync-payments', { method: 'POST' }).then(r => r.json()),
auth: () => window.location.href = '/auth/qbo'
},
// Accounting API (Phase 1 — read-only)
accounting: {
getAccounts: (type = null, activeOnly = true) => {
const params = new URLSearchParams();
if (type) params.set('type', type);
if (!activeOnly) params.set('activeOnly', 'false');
const qs = params.toString();
return fetch('/api/accounting/accounts' + (qs ? '?' + qs : '')).then(r => r.json());
},
syncAccounts: () => fetch('/api/accounting/sync-accounts', { method: 'POST' }).then(r => r.json()),
getRegister: (accountId, startDate, endDate) => {
const params = new URLSearchParams({ accountId });
if (startDate) params.set('startDate', startDate);
if (endDate) params.set('endDate', endDate);
return fetch('/api/accounting/register?' + params.toString()).then(r => r.json());
},
getProfitAndLoss: (startDate, endDate, accountingMethod = 'Accrual') => {
const params = new URLSearchParams({ startDate, endDate, accountingMethod });
return fetch('/api/accounting/reports/profit-loss?' + params.toString()).then(r => r.json());
},
getBalanceSheet: (asOfDate, accountingMethod = 'Accrual') => {
const params = new URLSearchParams({ asOfDate, accountingMethod });
return fetch('/api/accounting/reports/balance-sheet?' + params.toString()).then(r => r.json());
}
},
// Settings API
settings: {