Updated GL system allows changing account defaults and add/updating journal entries

This commit is contained in:
2026-06-08 11:43:02 -05:00
parent 582720bf01
commit 15e93c1e45
16 changed files with 980 additions and 495 deletions

View File

@@ -635,9 +635,11 @@ function pmBookLedger(year, companyId) {
count += 1;
}
const assets = Object.values(byAsset).map((a) => ({ ...a, cost: round2(a.cost) })).sort((a, b) => b.cost - a.cost);
// Post PM spend to the company's configured maintenance expense / clearing accounts (admin-set defaults).
const defaults = require('./glAccounts').getDefaults(companyId);
const accounts = [
{ account: '6450', type: 'PM / maintenance expense', debit: round2(total), credit: 0 },
{ account: '2000', type: 'Maintenance clearing', debit: 0, credit: round2(total) }
{ account: defaults.pm_expense_account || '6450', type: 'PM / maintenance expense', debit: round2(total), credit: 0 },
{ account: defaults.pm_clearing_account || '2000', type: 'Maintenance clearing', debit: 0, credit: round2(total) }
];
return {
year: Number(year),