Skip to content

Commit

Permalink
feature(Budget)
Browse files Browse the repository at this point in the history
- exclude locked accounts in the budget management module

closes #7434
  • Loading branch information
lomamech committed Jan 25, 2024
1 parent 6210793 commit 416a354
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/controllers/finance/budget/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function buildBudgetData(fiscalYearId) {
a.id, a.number, a.label, a.locked, a.type_id,
a.parent, a.locked, a.hidden
FROM account AS a
WHERE a.type_id in (${allowedTypes});
WHERE a.type_id in (${allowedTypes}) AND a.locked = 0;
`;

// First get the basic account and FY budget data (if available)
Expand All @@ -103,7 +103,7 @@ function buildBudgetData(fiscalYearId) {
JOIN period AS p ON p.id = b.period_id
WHERE p.number = 0 and p.fiscal_year_id = ?
) AS bdata ON bdata.account_id = a.id
WHERE a.type_id in (${INCOME}, ${EXPENSE});
WHERE a.type_id in (${INCOME}, ${EXPENSE}) AND a.locked = 0;
`;

const actualsSql = `
Expand All @@ -114,7 +114,7 @@ function buildBudgetData(fiscalYearId) {
FROM period_total pt
JOIN account AS a ON a.id = pt.account_id
JOIN account_type AS at ON at.id = a.type_id
WHERE pt.fiscal_year_id = ? AND a.type_id in (${INCOME}, ${EXPENSE})
WHERE pt.fiscal_year_id = ? AND a.type_id in (${INCOME}, ${EXPENSE}) AND a.locked = 0
GROUP BY a.id;
`;

Expand All @@ -124,7 +124,7 @@ function buildBudgetData(fiscalYearId) {
JOIN period AS p ON p.id = pt.period_id
JOIN account AS a ON a.id = pt.account_id
JOIN account_type AS at ON at.id = a.type_id
WHERE pt.fiscal_year_id = ? AND a.type_id in (${INCOME}, ${EXPENSE})
WHERE pt.fiscal_year_id = ? AND a.type_id in (${INCOME}, ${EXPENSE}) AND a.locked = 0;
`;

const months = constants.periods.filter(elt => elt.periodNum !== 0);
Expand Down

0 comments on commit 416a354

Please sign in to comment.