Added Section 179 Limits

This commit is contained in:
2026-06-05 05:55:43 -05:00
parent 4072695432
commit dfd999b6a9
11 changed files with 454 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
const { parseJson } = require('./db');
const { buildDepreciationMethods } = require('./rule-catalog');
const { getZone } = require('./services/zones');
const { getLimit: getSection179Limit } = require('./services/section179Limits');
// Built-in method catalog, used as a fallback so codes like MF200/DB200 always resolve
// even if a particular rule set hasn't been re-expanded to include them.
@@ -47,7 +48,45 @@ function salvageValue(asset, book, methodRule) {
}
function section179Amount(asset, book) {
return Math.min(grossBasis(asset, book), Number(book.section_179_amount || 0));
return Math.min(grossBasis(asset, book), Number(book.section_179_amount || 0), section179Limit(asset, book));
}
// Enterprise/empowerment-zone Section 179 treatment for the federal book: an increased dollar
// limit and a reduced (e.g. 50%) share of cost counting toward the phaseout threshold. Applies
// only when the asset is flagged for such a zone and placed in service within the date window.
function zoneSection179(asset, book) {
if (!asset.special_zone || String(book.book_type) !== 'FEDERAL') return null;
const zone = getZone(asset.special_zone);
if (!zone) return null;
const increase = Number(zone.section_179_increase || 0);
const costFactor = Number(zone.section_179_cost_factor || 0) || 1;
if (!increase && costFactor === 1) return null;
const pis = asset.in_service_date || asset.acquired_date || '';
if (pis && zone.pis_start && pis < zone.pis_start) return null;
if (pis && zone.pis_end && pis > zone.pis_end) return null;
return { increase, costFactor };
}
// Applicable §179 dollar cap for an asset's placed-in-service year: the configured base limit
// (plus any enterprise-zone increase) less the dollar-for-dollar investment phaseout. Returns
// Infinity when no limit is configured for the year, leaving the entered §179 amount uncapped.
function section179Limit(asset, book) {
const pisYear = yearFromDate(asset.in_service_date || asset.acquired_date);
const limitRow = getSection179Limit(pisYear);
if (!limitRow) return Infinity;
let limit = Number(limitRow.base_limit) || 0;
const threshold = Number(limitRow.phaseout_threshold) || 0;
let costFactor = 1;
const zone = zoneSection179(asset, book);
if (zone) {
limit += zone.increase;
costFactor = zone.costFactor;
}
if (threshold > 0) {
const investment = grossBasis(asset, book) * costFactor;
limit -= Math.max(0, investment - threshold);
}
return Math.max(0, limit);
}
// Special-zone §168 allowance (e.g. New York Liberty Zone): applies to the federal tax book