diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index c203b9d..715d61c 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -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 = diff --git a/Models/budget/revenue_estimates.cs b/Models/budget/revenue_estimates.cs index 97729a9..992fe04 100644 --- a/Models/budget/revenue_estimates.cs +++ b/Models/budget/revenue_estimates.cs @@ -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; }