From b867af4fb469c915916f5f08ab8ed661b1043b86 Mon Sep 17 00:00:00 2001 From: kamonwan taengsuk Date: Tue, 28 Mar 2023 13:45:21 +0700 Subject: [PATCH] fixed --- Controllers/building_four.Controller.cs | 166 +++++++++++---------- Models/budget/durable_articles_three.cs | 38 ++--- wwwroot/reports/building_fours.frx | 14 +- wwwroot/reports/durable_articles_three.frx | 49 +++++- 4 files changed, 157 insertions(+), 110 deletions(-) diff --git a/Controllers/building_four.Controller.cs b/Controllers/building_four.Controller.cs index 065f88a..b463bf7 100644 --- a/Controllers/building_four.Controller.cs +++ b/Controllers/building_four.Controller.cs @@ -36,24 +36,23 @@ namespace rmutr_report.Controllers { var a1 = a.usage_per_target.Where(d => d.used_year == d.used_year) .Sum(o => o.used_year); - building_fours.sum_year1 = a1; + building_fours.sum_year1 = a1; var a2 = a.usage_per_target.Where(d => d.year1 == d.year1) .Sum(o => o.year1); - building_fours.sum_year2 = a2; + building_fours.sum_year2 = a2; var a3 = a.usage_per_target.Where(d => d.year2 == d.year2) .Sum(o => o.year2); - building_fours.sum_year3 = a3; + building_fours.sum_year3 = a3; var a4 = a.usage_per_target.Where(d => d.year3 == d.year3) .Sum(o => o.year3); - building_fours.sum_year4 = a4; + building_fours.sum_year4 = a4; var a5 = a.usage_per_target.Where(d => d.year4 == d.year4) .Sum(o => o.year4); - building_fours.sum_year5 = a5; + building_fours.sum_year5 = a5; var a6 = a.usage_per_target.Where(d => d.year5 == d.year5) .Sum(o => o.year5); - building_fours.sum_year6 = a6; + building_fours.sum_year6 = a6; } - } // foreach (var bb in building_fours.material_construction_labor1) @@ -87,33 +86,34 @@ namespace rmutr_report.Controllers // } // } foreach (var cc in building_fours.budget_limit) + { + if (cc != null) { - if (cc != null) + var a = building_fours.budget_limit.Where(d => d.amount == d.amount) + .Sum(o => o.amount); + building_fours.amount = a; + if (cc.outside_amount != null) { - var a = building_fours.budget_limit.Where(d => d.amount == d.amount) - .Sum(o => o.amount); - building_fours.amount = a; - if (cc.outside_amount != null) - { - var b = building_fours.budget_limit.Where(d => d.outside_amount == d.outside_amount) - .Sum(o => o.outside_amount); - building_fours.outside_amount = b; - } - if (cc.outside_amount == null) - { - - building_fours.outside_amount = null; - } - - if (cc.amount != null && cc.outside_amount != null) - { - cc.total_amount = cc.amount + cc.outside_amount; - } - var c = building_fours.budget_limit.Where(d => d.total_amount == d.total_amount) - .Sum(o => o.total_amount); - building_fours.total_amount = c; + var b = building_fours.budget_limit.Where(d => d.outside_amount == d.outside_amount) + .Sum(o => o.outside_amount); + building_fours.outside_amount = b; } + + if (cc.outside_amount == null) + { + building_fours.outside_amount = null; + } + + if (cc.amount != null && cc.outside_amount != null) + { + cc.total_amount = cc.amount + cc.outside_amount; + } + + var c = building_fours.budget_limit.Where(d => d.total_amount == d.total_amount) + .Sum(o => o.total_amount); + building_fours.total_amount = c; } + } foreach (var boqPrice in building_fours.basic_information) { @@ -141,29 +141,31 @@ namespace rmutr_report.Controllers } else if (str.Length == 7) { + for (int i = 1; i <= str.Length - 1; i += 7) + { + boqPrice.list = str.Insert(i, ","); + } for (int i = 4; i <= str.Length - 1; i += 7) { boqPrice.list = str.Insert(i, ","); } } - else if (str.Length == 8) - { - boqPrice.list.Replace("10000000", "10,000,000"); - boqPrice.list.Replace("10000000.0000", "10,000,000"); - // for (int i = 3; i <= str.Length - 1; i += 8) - // { - // boqPrice.list = str.Insert(i, ","); - // //boqPrice.list = str.Insert(i, ","); - // } - // for (int i = 5; i <= str.Length - 1; i += 8) - // { - // boqPrice.list = str.Insert(i, ","); - // //boqPrice.list = str.Insert(i, ","); - // } - // boqPrice.list.Replace("10000000", "10,000,000"); - // boqPrice.list.Replace("10000000.0000", "10,000,000"); - } - + else if (str.Length == 8) + { + // boqPrice.list.Replace("10000000", "10,000,000"); + // boqPrice.list.Replace("10000000.0000", "10,000,000"); + for (int i = 2; i <= str.Length - 1; i += 8) + { + boqPrice.list = str.Insert(i, ","); + //boqPrice.list = str.Insert(i, ","); + } + + for (int i = 5; i <= str.Length - 1; i += 8) + { + boqPrice.list = str.Insert(i, ","); + //boqPrice.list = str.Insert(i, ","); + } + } } foreach (var boqPrice in building_fours.boq) @@ -194,6 +196,10 @@ namespace rmutr_report.Controllers } else if (str.Length == 7) { + for (int i = 1; i <= str.Length - 1; i += 7) + { + boqPrice.have = str.Insert(i, ","); + } for (int i = 4; i <= str.Length - 1; i += 7) { boqPrice.have = str.Insert(i, ","); @@ -201,43 +207,43 @@ namespace rmutr_report.Controllers } else if (str.Length == 8) { - boqPrice.have.Replace("10000000", "10,000,000"); - boqPrice.have.Replace("10000000.0000", "10,000,000"); - // for (int i = 3; i <= str.Length - 1; i += 8) - // { - // boqPrice.have = str.Insert(i, ","); - // //boqPrice.have = str.Insert(i, ","); - // } - // for (int i = 5; i <= str.Length - 1; i += 8) - // { - // boqPrice.have = str.Insert(i, ","); - // //boqPrice.list = str.Insert(i, ","); - // } - // - // boqPrice.have.Replace("10000000", "10,000,000"); - // boqPrice.have.Replace("10000000.0000", "10,000,000"); - // - } - - boqPrice.text1 = "- มี วงเงิน "+ boqPrice.have + " บาท"; - boqPrice.text2 = "- ดำเนินการจัดทำ BOQ เดือน "+ boqPrice.pending_boq_month; - boqPrice.text3 = "- BOQ แล้วเสร็จเดือน "+ boqPrice.done_boq_month; - boqPrice.text4 = "- ขออนุมัติ BOQ เดือน "+ boqPrice.approval_month; - boqPrice.text5 = "- ทำสัญญาก่อสร้าง เดือน "+ boqPrice.construction_contract_month; + // boqPrice.have.Replace("10000000", "10,000,000"); + // boqPrice.have.Replace("10000000.0000", "10,000,000"); + for (int i = 2; i <= str.Length - 1; i += 8) + { + boqPrice.have = str.Insert(i, ","); + //boqPrice.have = str.Insert(i, ","); + } + + for (int i = 5; i <= str.Length - 1; i += 8) + { + boqPrice.have = str.Insert(i, ","); + //boqPrice.list = str.Insert(i, ","); + } + // + // boqPrice.have.Replace("10000000", "10,000,000"); + // boqPrice.have.Replace("10000000.0000", "10,000,000"); + // + } + + boqPrice.text1 = "- มี วงเงิน " + boqPrice.have + " บาท"; + boqPrice.text2 = "- ดำเนินการจัดทำ BOQ เดือน " + boqPrice.pending_boq_month; + boqPrice.text3 = "- BOQ แล้วเสร็จเดือน " + boqPrice.done_boq_month; + boqPrice.text4 = "- ขออนุมัติ BOQ เดือน " + boqPrice.approval_month; + boqPrice.text5 = "- ทำสัญญาก่อสร้าง เดือน " + boqPrice.construction_contract_month; } + if (boqPrice.is_data == "2") { boqPrice.text1 = "- ไม่มี"; - boqPrice.text2 = "- กรณีไม่มีคาดว่าจะแล้วเสร็จ เดือน "+ boqPrice.months + " ปี "+ + boqPrice.text2 = "- กรณีไม่มีคาดว่าจะแล้วเสร็จ เดือน " + boqPrice.months + " ปี " + boqPrice.years; - boqPrice.text3 = "- ขณะนี้อยูในขั้นตอน "+ boqPrice.step; - + boqPrice.text3 = "- ขณะนี้อยูในขั้นตอน " + boqPrice.step; } - } - - - var _building_fours = new List() {building_fours}; + + + var _building_fours = new List() { building_fours }; Report report = new Report(); report.Load(_setting.report_path + "building_fours.frx"); @@ -274,7 +280,8 @@ namespace rmutr_report.Controllers stream.Seek(0, SeekOrigin.Begin); return File(stream, "text/csv"); break; - case "doc" : case "docx": + case "doc": + case "docx": Word2007Export word = new Word2007Export(); report.Export(word, stream); stream.Seek(0, SeekOrigin.Begin); @@ -518,6 +525,5 @@ namespace rmutr_report.Controllers // } // } // } - } } \ No newline at end of file diff --git a/Models/budget/durable_articles_three.cs b/Models/budget/durable_articles_three.cs index 2d6270b..d9e92e6 100644 --- a/Models/budget/durable_articles_three.cs +++ b/Models/budget/durable_articles_three.cs @@ -41,11 +41,11 @@ namespace rmutr_report.Models // public string image_description1 { get; set; } // public string image_description2 { get; set; } public List descript_more { get; set; } - //public List specification_data { get; set; } + public List specification_data { get; set; } public string specification { get; set; } - // public string quantity_specification { get; set; } - // public decimal? unit_price_specification { get; set; } - // public decimal? amount_specification { get; set; } + public string quantity_specification { get; set; } + public decimal? unit_price_specification { get; set; } + public decimal? amount_specification { get; set; } public List budget_spending_plan {get; set; } public string procurement_process { get; set; } public string incurring_debt { get; set; } @@ -98,21 +98,21 @@ namespace rmutr_report.Models public string remark { get; set; } } - // public class specification_datas - // { - // public string specification { get; set; } - // public string quantity { get; set; } - // public decimal? unit_price { get; set; } - // public decimal? amount { get; set; } - // public List data_detail { get; set; } - // } - // - // public class specification_data_details - // { - // public string list { get; set;} - // public string quantity { get; set;} - // public string attribute { get; set;} - // } + public class specification_datas + { + public string specification { get; set; } + public string quantity { get; set; } + public decimal? unit_price { get; set; } + public decimal? amount { get; set; } + public List data_detail { get; set; } + } + + public class specification_data_details + { + public string list { get; set;} + public string quantity { get; set;} + public string attribute { get; set;} + } public class budget_spending_plans { diff --git a/wwwroot/reports/building_fours.frx b/wwwroot/reports/building_fours.frx index a7afbb0..1b189af 100644 --- a/wwwroot/reports/building_fours.frx +++ b/wwwroot/reports/building_fours.frx @@ -1,5 +1,5 @@  - + @@ -360,7 +360,7 @@ - + @@ -422,7 +422,7 @@ - + @@ -789,11 +789,11 @@ - + - + @@ -810,7 +810,7 @@ - + @@ -829,7 +829,7 @@ - + diff --git a/wwwroot/reports/durable_articles_three.frx b/wwwroot/reports/durable_articles_three.frx index 1c76d48..3df2e07 100644 --- a/wwwroot/reports/durable_articles_three.frx +++ b/wwwroot/reports/durable_articles_three.frx @@ -1,5 +1,5 @@  - + @@ -33,6 +33,9 @@ + + + @@ -53,6 +56,17 @@ + + + + + + + + + + + @@ -211,9 +225,36 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +