diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index e1b42af..064d291 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -2109,140 +2109,152 @@ namespace rmutr_report.Controllers int r1 = 1; int r2 = 2; + + var sum1 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.revenue_estimates); + var sum2 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.less_revenue_estimates); + var sum3 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.balance_revenue_estimates); + var sum4 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.less_accumulated_income); + var sum5 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.balance_before_allocating_according); + var sum6 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_utility_bills); + var sum7 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_central_budget); + var sum8 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_central_expenditure); + var sum9 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.expenditure_limit); foreach (var detail in revenue_estimate.revenue_estimates_details) { if (detail.topic_type == 1) { - 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, 7).Value = "บาท"; - ws.Cell(row, 8).Value = detail.less_accumulated_income; - ws.Cell(row, 9).Value = "บาท"; - ws.Cell(row, 10).Value = detail.balance_before_allocating_according; - ws.Cell(row, 11).Value = "บาท"; - ws.Cell(row, 12).Value = detail.contribution_utility_bills; - ws.Cell(row, 13).Value = "บาท"; - ws.Cell(row, 14).Value = detail.contribution_central_budget; - ws.Cell(row, 15).Value = "บาท"; - ws.Cell(row, 16).Value = detail.contribution_central_expenditure; - ws.Cell(row, 17).Value = "บาท"; - ws.Cell(row, 18).Value = detail.expenditure_limit; - ws.Cell(row, 19).Value = "บาท"; + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = sum1;//data1.Sum(d => d.revenue_estimates); + ws.Cell(row, 3).Value = "บาท"; + ws.Cell(row, 4).Value = sum2;//data1.Sum(d => d.less_revenue_estimates); + ws.Cell(row, 5).Value = "บาท"; + ws.Cell(row, 6).Value = sum3;//data1.Sum(d => d.balance_revenue_estimates); + ws.Cell(row, 7).Value = "บาท"; + ws.Cell(row, 8).Value = sum4;//data1.Sum(d => d.less_accumulated_income); + ws.Cell(row, 9).Value = "บาท"; + ws.Cell(row, 10).Value = sum5;//data1.Sum(d => d.balance_before_allocating_according); + ws.Cell(row, 11).Value = "บาท"; + ws.Cell(row, 12).Value = sum6;//data1.Sum(d => d.contribution_utility_bills); + ws.Cell(row, 13).Value = "บาท"; + ws.Cell(row, 14).Value = sum7;//data1.Sum(d => d.contribution_central_budget); + ws.Cell(row, 15).Value = "บาท"; + ws.Cell(row, 16).Value = sum8;//data1.Sum(d => d.contribution_central_expenditure); + ws.Cell(row, 17).Value = "บาท"; + ws.Cell(row, 18).Value = sum9;//data1.Sum(d => d.expenditure_limit); + ws.Cell(row, 19).Value = "บาท"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = - "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.SetBold().Font.FontSize = 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Vertical = - XLAlignmentVerticalValues.Center; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; - ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal = - XLAlignmentHorizontalValues.Right; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = - XLColor.FromArgb(252, 228, 214); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = + "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = + XLColor.FromArgb(252, 228, 214); - ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 6).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 8).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 6).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 8).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - row++; + row++; + } if (detail.topic_type == 2) { - 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, 7).Value = "บาท"; - ws.Cell(row, 8).Value = detail.less_accumulated_income; - ws.Cell(row, 9).Value = "บาท"; - ws.Cell(row, 10).Value = detail.balance_before_allocating_according; - ws.Cell(row, 11).Value = "บาท"; - ws.Cell(row, 12).Value = detail.contribution_utility_bills; - ws.Cell(row, 13).Value = "บาท"; - ws.Cell(row, 14).Value = detail.contribution_central_budget; - ws.Cell(row, 15).Value = "บาท"; - ws.Cell(row, 16).Value = detail.contribution_central_expenditure; - ws.Cell(row, 17).Value = "บาท"; - ws.Cell(row, 18).Value = detail.expenditure_limit; - ws.Cell(row, 19).Value = "บาท"; + ws.Cell(row, 1).Value = detail.topic; + ws.Cell(row, 2).Value = sum1;//data1.Sum(d => d.revenue_estimates); + ws.Cell(row, 3).Value = "บาท"; + ws.Cell(row, 4).Value = sum2;//data1.Sum(d => d.less_revenue_estimates); + ws.Cell(row, 5).Value = "บาท"; + ws.Cell(row, 6).Value = sum3;//data1.Sum(d => d.balance_revenue_estimates); + ws.Cell(row, 7).Value = "บาท"; + ws.Cell(row, 8).Value = sum4;//data1.Sum(d => d.less_accumulated_income); + ws.Cell(row, 9).Value = "บาท"; + ws.Cell(row, 10).Value = sum5;//data1.Sum(d => d.balance_before_allocating_according); + ws.Cell(row, 11).Value = "บาท"; + ws.Cell(row, 12).Value = sum6;//data1.Sum(d => d.contribution_utility_bills); + ws.Cell(row, 13).Value = "บาท"; + ws.Cell(row, 14).Value = sum7;//data1.Sum(d => d.contribution_central_budget); + ws.Cell(row, 15).Value = "บาท"; + ws.Cell(row, 16).Value = sum8;//data1.Sum(d => d.contribution_central_expenditure); + ws.Cell(row, 17).Value = "บาท"; + ws.Cell(row, 18).Value = sum9;//data1.Sum(d => d.expenditure_limit); + ws.Cell(row, 19).Value = "บาท"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = - "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.SetBold().Font.FontSize = 14; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Vertical = - XLAlignmentVerticalValues.Center; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; - ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal = - XLAlignmentHorizontalValues.Right; - //ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = XLColor.FromArgb(252, 228, 214); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = + "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.SetBold().Font.FontSize = 14; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Right; + //ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = XLColor.FromArgb(252, 228, 214); - ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 6).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 8).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - row++; + ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 6).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 8).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + } if (detail.topic_type == 3) @@ -2311,71 +2323,74 @@ namespace rmutr_report.Controllers row++; } - if (detail.topic_type == 4) - { - ws.Cell(row, 1).Value = "รวม"; - 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, 7).Value = "บาท"; - ws.Cell(row, 8).Value = detail.less_accumulated_income; - ws.Cell(row, 9).Value = "บาท"; - ws.Cell(row, 10).Value = detail.balance_before_allocating_according; - ws.Cell(row, 11).Value = "บาท"; - ws.Cell(row, 12).Value = detail.contribution_utility_bills; - ws.Cell(row, 13).Value = "บาท"; - ws.Cell(row, 14).Value = detail.contribution_central_budget; - ws.Cell(row, 15).Value = "บาท"; - ws.Cell(row, 16).Value = detail.contribution_central_expenditure; - ws.Cell(row, 17).Value = "บาท"; - ws.Cell(row, 18).Value = detail.expenditure_limit; - ws.Cell(row, 19).Value = "บาท"; + // if (detail.topic_type == 4) + // { + if (detail.topic_type == 4) + { + ws.Cell(row, 1).Value = "รวม"; + ws.Cell(row, 2).Value = sum1;//data1.Sum(d => d.revenue_estimates); + ws.Cell(row, 3).Value = "บาท"; + ws.Cell(row, 4).Value = sum2;//data1.Sum(d => d.less_revenue_estimates); + ws.Cell(row, 5).Value = "บาท"; + ws.Cell(row, 6).Value = sum3;//data1.Sum(d => d.balance_revenue_estimates); + ws.Cell(row, 7).Value = "บาท"; + ws.Cell(row, 8).Value = sum4;//data1.Sum(d => d.less_accumulated_income); + ws.Cell(row, 9).Value = "บาท"; + ws.Cell(row, 10).Value = sum5;//data1.Sum(d => d.balance_before_allocating_according); + ws.Cell(row, 11).Value = "บาท"; + ws.Cell(row, 12).Value = sum6;//data1.Sum(d => d.contribution_utility_bills); + ws.Cell(row, 13).Value = "บาท"; + ws.Cell(row, 14).Value = sum7;//data1.Sum(d => d.contribution_central_budget); + ws.Cell(row, 15).Value = "บาท"; + ws.Cell(row, 16).Value = sum8;//data1.Sum(d => d.contribution_central_expenditure); + ws.Cell(row, 17).Value = "บาท"; + ws.Cell(row, 18).Value = sum9;//data1.Sum(d => d.expenditure_limit); + ws.Cell(row, 19).Value = "บาท"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = - "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.SetBold().Font.FontSize = 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Vertical = - XLAlignmentVerticalValues.Center; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder = - XLBorderStyleValues.Thin; - ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; - ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal = - XLAlignmentHorizontalValues.Right; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = - XLColor.FromArgb(252, 228, 214); + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = + "TH SarabunPSK"; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.SetBold().Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Vertical = + XLAlignmentVerticalValues.Center; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Border.OutsideBorder = + XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal = + XLAlignmentHorizontalValues.Right; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = + XLColor.FromArgb(252, 228, 214); - ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 6).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 8).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#0"); - ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - row++; + ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 6).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 8).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 10).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 12).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 14).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 16).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 18).Style.NumberFormat.SetFormat("#,#0"); + ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + row++; + //} } if (detail.is_footer == true) diff --git a/bin/Debug/net5.0/rmutr_report.dll b/bin/Debug/net5.0/rmutr_report.dll index 21f111a..70c0fd5 100644 Binary files a/bin/Debug/net5.0/rmutr_report.dll and b/bin/Debug/net5.0/rmutr_report.dll differ diff --git a/bin/Debug/net5.0/rmutr_report.pdb b/bin/Debug/net5.0/rmutr_report.pdb index 8db1ef3..7aad1c1 100644 Binary files a/bin/Debug/net5.0/rmutr_report.pdb and b/bin/Debug/net5.0/rmutr_report.pdb differ diff --git a/obj/Debug/net5.0/ref/rmutr_report.dll b/obj/Debug/net5.0/ref/rmutr_report.dll index 6b17bdf..0deaddd 100644 Binary files a/obj/Debug/net5.0/ref/rmutr_report.dll and b/obj/Debug/net5.0/ref/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/refint/rmutr_report.dll b/obj/Debug/net5.0/refint/rmutr_report.dll index 6b17bdf..0deaddd 100644 Binary files a/obj/Debug/net5.0/refint/rmutr_report.dll and b/obj/Debug/net5.0/refint/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.dll b/obj/Debug/net5.0/rmutr_report.dll index 21f111a..70c0fd5 100644 Binary files a/obj/Debug/net5.0/rmutr_report.dll and b/obj/Debug/net5.0/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.pdb b/obj/Debug/net5.0/rmutr_report.pdb index 8db1ef3..7aad1c1 100644 Binary files a/obj/Debug/net5.0/rmutr_report.pdb and b/obj/Debug/net5.0/rmutr_report.pdb differ