Added Section 179 Limits
This commit is contained in:
@@ -37,6 +37,8 @@ function fromRow(row) {
|
||||
real_property_end: row.real_property_end,
|
||||
max_recovery_years: row.max_recovery_years,
|
||||
leasehold_life_years: row.leasehold_life_years,
|
||||
section_179_increase: row.section_179_increase,
|
||||
section_179_cost_factor: row.section_179_cost_factor,
|
||||
notes: row.notes,
|
||||
enabled: Boolean(row.enabled),
|
||||
asset_count: one('SELECT COUNT(*) AS c FROM assets WHERE special_zone = ?', [row.code]).c
|
||||
@@ -57,6 +59,8 @@ function normalize(body) {
|
||||
real_property_end: body.real_property_end || null,
|
||||
max_recovery_years: num(body.max_recovery_years),
|
||||
leasehold_life_years: num(body.leasehold_life_years),
|
||||
section_179_increase: Number(body.section_179_increase) || 0,
|
||||
section_179_cost_factor: body.section_179_cost_factor === '' || body.section_179_cost_factor === null || body.section_179_cost_factor === undefined ? 1 : Number(body.section_179_cost_factor),
|
||||
notes: body.notes || null,
|
||||
enabled: body.enabled === false ? 0 : 1
|
||||
};
|
||||
@@ -72,9 +76,9 @@ function createZone(body, userId) {
|
||||
}
|
||||
const ts = now();
|
||||
run(
|
||||
`INSERT INTO depreciation_zones (code, name, allowance_percent, pis_start, pis_end, real_property_end, max_recovery_years, leasehold_life_years, notes, enabled, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
[code, input.name, input.allowance_percent, input.pis_start, input.pis_end, input.real_property_end, input.max_recovery_years, input.leasehold_life_years, input.notes, input.enabled, ts, ts]
|
||||
`INSERT INTO depreciation_zones (code, name, allowance_percent, pis_start, pis_end, real_property_end, max_recovery_years, leasehold_life_years, section_179_increase, section_179_cost_factor, notes, enabled, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
[code, input.name, input.allowance_percent, input.pis_start, input.pis_end, input.real_property_end, input.max_recovery_years, input.leasehold_life_years, input.section_179_increase, input.section_179_cost_factor, input.notes, input.enabled, ts, ts]
|
||||
);
|
||||
clearCache();
|
||||
audit(userId, 'create', 'depreciation_zone', code, null, input);
|
||||
@@ -87,8 +91,8 @@ function updateZone(code, body, userId) {
|
||||
const input = normalize({ ...before, ...body, enabled: body.enabled === undefined ? Boolean(before.enabled) : body.enabled });
|
||||
run(
|
||||
`UPDATE depreciation_zones SET name = ?, allowance_percent = ?, pis_start = ?, pis_end = ?, real_property_end = ?,
|
||||
max_recovery_years = ?, leasehold_life_years = ?, notes = ?, enabled = ?, updated_at = ? WHERE code = ?`,
|
||||
[input.name, input.allowance_percent, input.pis_start, input.pis_end, input.real_property_end, input.max_recovery_years, input.leasehold_life_years, input.notes, input.enabled, now(), code]
|
||||
max_recovery_years = ?, leasehold_life_years = ?, section_179_increase = ?, section_179_cost_factor = ?, notes = ?, enabled = ?, updated_at = ? WHERE code = ?`,
|
||||
[input.name, input.allowance_percent, input.pis_start, input.pis_end, input.real_property_end, input.max_recovery_years, input.leasehold_life_years, input.section_179_increase, input.section_179_cost_factor, input.notes, input.enabled, now(), code]
|
||||
);
|
||||
clearCache();
|
||||
audit(userId, 'update', 'depreciation_zone', code, before, input);
|
||||
|
||||
Reference in New Issue
Block a user