diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index 0a17023..53dfadc 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -2111,7 +2111,8 @@ namespace rmutr_report.Controllers int r1 = 1; int r2 = 2; - + var result = new List(); + var res = result.SelectMany(j => j.revenue_estimates_details).Where(t=>t.topic_type==2).ToList(); 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); @@ -2121,28 +2122,38 @@ namespace rmutr_report.Controllers 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); + + var _sum1 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==2).Sum(d => d.revenue_estimates); + var _sum2 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==2).Sum(d => d.less_revenue_estimates); + var _sum3 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==2).Sum(d => d.balance_revenue_estimates); + var _sum4 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==2).Sum(d => d.less_accumulated_income); + var _sum5 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==2).Sum(d => d.balance_before_allocating_according); + var _sum6 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==2).Sum(d => d.contribution_utility_bills); + var _sum7 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==2).Sum(d => d.contribution_central_budget); + var _sum8 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==2).Sum(d => d.contribution_central_expenditure); + var _sum9 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==2).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 = sum1;//detail.revenue_estimates; + ws.Cell(row, 2).Value = _sum1;//detail.revenue_estimates; ws.Cell(row, 3).Value = "บาท"; - ws.Cell(row, 4).Value = sum2;//detail.less_revenue_estimates; + ws.Cell(row, 4).Value = _sum2;//detail.less_revenue_estimates; ws.Cell(row, 5).Value = "บาท"; - ws.Cell(row, 6).Value = sum3;//detail.balance_revenue_estimates; + ws.Cell(row, 6).Value = _sum3;//detail.balance_revenue_estimates; ws.Cell(row, 7).Value = "บาท"; - ws.Cell(row, 8).Value = sum4;//detail.less_accumulated_income; + ws.Cell(row, 8).Value = _sum4;//detail.less_accumulated_income; ws.Cell(row, 9).Value = "บาท"; - ws.Cell(row, 10).Value = sum5;//detail.balance_before_allocating_according; + ws.Cell(row, 10).Value = _sum5;//detail.balance_before_allocating_according; ws.Cell(row, 11).Value = "บาท"; - ws.Cell(row, 12).Value = sum6;//detail.contribution_utility_bills; + ws.Cell(row, 12).Value = _sum6;//detail.contribution_utility_bills; ws.Cell(row, 13).Value = "บาท"; - ws.Cell(row, 14).Value = sum7;//detail.contribution_central_budget; + ws.Cell(row, 14).Value = _sum7;//detail.contribution_central_budget; ws.Cell(row, 15).Value = "บาท"; - ws.Cell(row, 16).Value = sum8;//detail.contribution_central_expenditure; + ws.Cell(row, 16).Value = _sum8;//detail.contribution_central_expenditure; ws.Cell(row, 17).Value = "บาท"; - ws.Cell(row, 18).Value = sum9;//detail.expenditure_limit; + ws.Cell(row, 18).Value = _sum9;//detail.expenditure_limit; ws.Cell(row, 19).Value = "บาท"; ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = @@ -2346,23 +2357,23 @@ namespace rmutr_report.Controllers if (detail.topic_type == 4) { ws.Cell(row, 1).Value = "รวม"; - ws.Cell(row, 2).Value = sum1;//detail.revenue_estimates; + ws.Cell(row, 2).Value = _sum1;//detail.revenue_estimates; ws.Cell(row, 3).Value = "บาท"; - ws.Cell(row, 4).Value = sum2;//detail.less_revenue_estimates; + ws.Cell(row, 4).Value = _sum2;//detail.less_revenue_estimates; ws.Cell(row, 5).Value = "บาท"; - ws.Cell(row, 6).Value = sum3;//detail.balance_revenue_estimates; + ws.Cell(row, 6).Value = _sum3;//detail.balance_revenue_estimates; ws.Cell(row, 7).Value = "บาท"; - ws.Cell(row, 8).Value = sum4;//detail.less_accumulated_income; + ws.Cell(row, 8).Value = _sum4;//detail.less_accumulated_income; ws.Cell(row, 9).Value = "บาท"; - ws.Cell(row, 10).Value = sum5;//detail.balance_before_allocating_according; + ws.Cell(row, 10).Value = _sum5;//detail.balance_before_allocating_according; ws.Cell(row, 11).Value = "บาท"; - ws.Cell(row, 12).Value = sum6;//detail.contribution_utility_bills; + ws.Cell(row, 12).Value = _sum6;//detail.contribution_utility_bills; ws.Cell(row, 13).Value = "บาท"; - ws.Cell(row, 14).Value = sum7;//detail.contribution_central_budget; + ws.Cell(row, 14).Value = _sum7;//detail.contribution_central_budget; ws.Cell(row, 15).Value = "บาท"; - ws.Cell(row, 16).Value = sum8;//detail.contribution_central_expenditure; + ws.Cell(row, 16).Value = _sum8;//detail.contribution_central_expenditure; ws.Cell(row, 17).Value = "บาท"; - ws.Cell(row, 18).Value = sum9;//detail.expenditure_limit; + ws.Cell(row, 18).Value = _sum9;//detail.expenditure_limit; ws.Cell(row, 19).Value = "บาท"; ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = diff --git a/Controllers/HouseForRent.Controller.cs b/Controllers/HouseForRent.Controller.cs index e8bb199..f28cb47 100644 --- a/Controllers/HouseForRent.Controller.cs +++ b/Controllers/HouseForRent.Controller.cs @@ -26,12 +26,12 @@ namespace rmutr_report.Controllers { var workbook = new XLWorkbook(); var ws = workbook.Worksheets.Add("ค่าเช่าบ้าน"); - ws.Cell("F1").Value = "แบบ ง.1"; - ws.Cell("F1").Style.Font.FontName = "TH SarabunPSK"; - ws.Cell("F1").Style.Font.FontSize = 16; - ws.Cell("F1").Style.Font.Bold = true; - ws.Cell("F1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; - ws.Cell("F1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Cell("G1").Value = "แบบ ง.1"; + ws.Cell("G1").Style.Font.FontName = "TH SarabunPSK"; + ws.Cell("G1").Style.Font.FontSize = 16; + ws.Cell("G1").Style.Font.Bold = true; + ws.Cell("G1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell("G1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; ws.Range("A2:F2").Merge().Value = "รายละเอียดประกอบการเสนอของบประมาณรายการ ค่าเช่าบ้าน ปีงบประมาณ" + _house_for_rent.budget_year; ws.Range("A2:F2").Style.Alignment.WrapText = true; ws.Range("A2:F2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; @@ -101,7 +101,14 @@ namespace rmutr_report.Controllers ws.Cell("F5").Style.Font.FontSize = 16; ws.Cell("F5").Style.Font.Bold = true; ws.Cell("F5").Style.Alignment.WrapText = true; - ws.Range("A4:F5").Style.Fill.BackgroundColor = XLColor.SeaShell; + ws.Range("G4:G5").Merge().Value = "เบิกจ่ายจริง"; + ws.Range("G4:G5").Style.Alignment.WrapText = true; + ws.Range("G4:G5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Range("G4:G5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + ws.Range("G4").Style.Font.SetBold().Font.FontName = "TH SarabunPSK"; + ws.Range("G4").Style.Font.FontSize = 16; + ws.Range("A3:F3").Style.Font.Bold = true; + ws.Range("A4:G5").Style.Fill.BackgroundColor = XLColor.SeaShell; ws.Range("A4:F5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Range("A4:F5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; ws.Range("A4:F5").Style.Border.OutsideBorder = @@ -116,12 +123,17 @@ namespace rmutr_report.Controllers XLBorderStyleValues.Thin; ws.Range("E4:E5").Style.Border.RightBorder = XLBorderStyleValues.Thin; + ws.Range("G4:G5").Style.Border.RightBorder = + XLBorderStyleValues.Thin; + ws.Range("G4:G5").Style.Border.TopBorder = + XLBorderStyleValues.Thin; ws.Column(1).Width = 10; ws.Column(2).Width = 40; ws.Column(3).Width = 25; ws.Column(4).Width = 15; ws.Column(5).Width = 15; ws.Column(6).Width = 15; + ws.Column(7).Width = 15; int row = 6; //int row2 = 9; @@ -136,17 +148,18 @@ namespace rmutr_report.Controllers ws.Cell(row, 4).Value = house.salary_rate; ws.Cell(row, 5).Value = house.per_month; ws.Cell(row, 6).Value = house.per_year; + ws.Cell(row, 7).Value = house.actual_disbursement; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.FontName = + ws.Range(ws.Cell(row, 1), ws.Cell(row, 7)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Font.FontSize = 16; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.WrapText = true; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Alignment.Vertical = + ws.Range(ws.Cell(row, 1), ws.Cell(row, 7)).Style.Font.FontSize = 16; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 7)).Style.Alignment.WrapText = true; + ws.Range(ws.Cell(row, 1), ws.Cell(row, 7)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Border.OutsideBorder = + ws.Range(ws.Cell(row, 1), ws.Cell(row, 7)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 6)).Style.Border.RightBorder = + ws.Range(ws.Cell(row, 1), ws.Cell(row, 7)).Style.Border.RightBorder = XLBorderStyleValues.Thin; ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; @@ -154,9 +167,10 @@ namespace rmutr_report.Controllers ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; - ws.Range(ws.Cell(row, 4), ws.Cell(row, 6)).SetDataType(XLDataType.Number); - ws.Range(ws.Cell(row, 4), ws.Cell(row, 6)).Style.NumberFormat.SetFormat("#,#"); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 7)).SetDataType(XLDataType.Number); + ws.Range(ws.Cell(row, 4), ws.Cell(row, 7)).Style.NumberFormat.SetFormat("#,#"); row++; } diff --git a/Models/budget/house_for_rent.cs b/Models/budget/house_for_rent.cs index 42aaff3..762f68e 100644 --- a/Models/budget/house_for_rent.cs +++ b/Models/budget/house_for_rent.cs @@ -18,5 +18,6 @@ namespace rmutr_report.Models public decimal? per_month { get; set; } public decimal? per_year { get; set; } + public decimal? actual_disbursement { get; set; } } } \ No newline at end of file diff --git a/bin/Debug/net5.0/rmutr_report.dll b/bin/Debug/net5.0/rmutr_report.dll index d4ef4f2..0d0138b 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 b1c94be..53c007d 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 e8a7970..abb4ad6 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 e8a7970..abb4ad6 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 d4ef4f2..0d0138b 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 b1c94be..53c007d 100644 Binary files a/obj/Debug/net5.0/rmutr_report.pdb and b/obj/Debug/net5.0/rmutr_report.pdb differ