feat: emit live Excel formulas for ร.15 revenue-estimate semester rows
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
Replace static computed values for F/H/J/L/N/P/R with FormulaA1 cell formulas (=B-D, =(F*10)/100, etc.) so the exported report is auditable and recalculates in Excel, matching a reference ร15.xlsx. P/R now use the per-row contribution/framework percent passed from rmutr-api instead of a fixed 40%. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KhYYmBPw4LhYXoDnTNz2xV
This commit is contained in:
@@ -2290,24 +2290,27 @@ namespace rmutr_report.Controllers
|
||||
|
||||
if (detail.topic_type == 3)
|
||||
{
|
||||
var contributionPercent = detail.contribution_percent ?? 40;
|
||||
var frameworkPercent = detail.framework_percent ?? 40;
|
||||
|
||||
ws.Cell(row, 1).Value = detail.topic;
|
||||
ws.Cell(row, 2).Value = detail.revenue_estimates;
|
||||
ws.Cell(row, 3).Value = "บาท";
|
||||
ws.Cell(row, 4).Value = detail.less_revenue_estimates;
|
||||
ws.Cell(row, 5).Value = "บาท";
|
||||
ws.Cell(row, 6).Value = detail.balance_revenue_estimates;
|
||||
ws.Cell(row, 6).FormulaA1 = $"=B{row}-D{row}";
|
||||
ws.Cell(row, 7).Value = "บาท";
|
||||
ws.Cell(row, 8).Value = detail.less_accumulated_income;
|
||||
ws.Cell(row, 8).FormulaA1 = $"=(F{row}*10)/100";
|
||||
ws.Cell(row, 9).Value = "บาท";
|
||||
ws.Cell(row, 10).Value = detail.balance_before_allocating_according;
|
||||
ws.Cell(row, 10).FormulaA1 = $"=F{row}-H{row}";
|
||||
ws.Cell(row, 11).Value = "บาท";
|
||||
ws.Cell(row, 12).Value = detail.contribution_utility_bills;
|
||||
ws.Cell(row, 12).FormulaA1 = $"=(J{row}*5)/100";
|
||||
ws.Cell(row, 13).Value = "บาท";
|
||||
ws.Cell(row, 14).Value = detail.contribution_central_budget;
|
||||
ws.Cell(row, 14).FormulaA1 = $"=(J{row}*15)/100";
|
||||
ws.Cell(row, 15).Value = "บาท";
|
||||
ws.Cell(row, 16).Value = detail.contribution_central_expenditure;
|
||||
ws.Cell(row, 16).FormulaA1 = $"=(J{row}*{contributionPercent})/100";
|
||||
ws.Cell(row, 17).Value = "บาท";
|
||||
ws.Cell(row, 18).Value = detail.expenditure_limit;
|
||||
ws.Cell(row, 18).FormulaA1 = $"=(J{row}*{frameworkPercent})/100";
|
||||
ws.Cell(row, 19).Value = "บาท";
|
||||
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName =
|
||||
|
||||
@@ -46,6 +46,8 @@ namespace rmutr_report.Models
|
||||
public decimal? contribution_central_budget { get; set; }
|
||||
public decimal? contribution_central_expenditure { get; set; }
|
||||
public decimal? expenditure_limit { get; set; }
|
||||
public decimal? contribution_percent { get; set; }
|
||||
public decimal? framework_percent { get; set; }
|
||||
|
||||
|
||||
public int? topic_type { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user