Fix Total Project Cost calculation: include upfront lease cost
Some checks are pending
CI / Engine — lint / typecheck / test (push) Waiting to run
CI / API — lint / typecheck / test (push) Waiting to run
CI / Web — typecheck / lint / build (push) Waiting to run

- Added upfrontLeaseCostCr to totalCostCr calculation
- IDC and upfront fee now calculated on full project cost including lease
- Updated Land & Common card to show lease cost is included in total
This commit is contained in:
Manohar Gupta 2026-05-22 16:57:29 +05:30
parent f224e98e0a
commit 5098bf86f4

View file

@ -683,7 +683,13 @@ export function InputsTab({ scenarioId, inputsJson, onSaved }: Props) {
const solarTotalCr = computeCostWithTax(costItems, "SolarOnly");
const windTotalCr = computeCostWithTax(costItems, "WindOnly");
const bessTotalCr = computeCostWithTax(costItems, "BESSOnly");
const totalCostCr = solarTotalCr + windTotalCr + bessTotalCr;
// Calculate upfront lease cost based on user inputs (acres * rate * years)
const leaseRate = gv(inputs, "project", "land_lease_rate", 0.4);
const leaseYears = gv(inputs, "project", "land_lease_years", 5);
const upfrontLeaseCostCr = effectiveLandAcres * leaseRate * leaseYears;
const totalCostCr = solarTotalCr + windTotalCr + bessTotalCr + upfrontLeaseCostCr;
// COD sync helper
function handlePlantCodChange(v: string) {
@ -967,7 +973,7 @@ export function InputsTab({ scenarioId, inputsJson, onSaved }: Props) {
</div>
</ToggleCard>
{/* ── Land & Common ────────────────────────────────────── */}
{/* ── Land & Common ────────────────────────────────────── */}
<CollapsibleCard title="Land & Common Costs" cols={3}>
<NumField
label="Total Land Area"
@ -981,7 +987,7 @@ export function InputsTab({ scenarioId, inputsJson, onSaved }: Props) {
<NumField
label="Lease Rate"
sub="Lakh/acre/year"
value={gv(inputs, "project", "land_lease_rate", 0.4)}
value={leaseRate}
onChange={(v) => upd("project", "land_lease_rate", v)}
step={0.05}
min={0}
@ -990,7 +996,7 @@ export function InputsTab({ scenarioId, inputsJson, onSaved }: Props) {
<NumField
label="Lease Years"
sub="3, 5, 10 or custom"
value={gv(inputs, "project", "land_lease_years", 5)}
value={leaseYears}
onChange={(v) => upd("project", "land_lease_years", v)}
step={1}
min={1}
@ -998,7 +1004,7 @@ export function InputsTab({ scenarioId, inputsJson, onSaved }: Props) {
suffix="yr"
/>
<div className="col-span-3 text-[10px] text-muted-foreground py-1">
Upfront Lease Cost: <span className="font-medium text-foreground">{effectiveLandAcres * (gv(inputs, "project", "land_lease_rate", 0.4) || 0) * (gv(inputs, "project", "land_lease_years", 5) || 0)} Cr</span>
Upfront Lease Cost (included in Total Project Cost): <span className="font-medium text-foreground">{upfrontLeaseCostCr.toFixed(2)} Cr</span>
</div>
</CollapsibleCard>