diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index 603e738..d9ef226 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -2588,14 +2588,17 @@ namespace rmutr_report.Controllers { notation.row_no = "หมายเหตุ : " + "1"; } + if (notation.amount != null) { - notation.amounts = bath; + notation.amounts = bath; } + if (notation.amount == null) { - notation.amounts = null; + notation.amounts = null; } + foreach (var notation2 in notation.notations_detail) { if (notation2.list != null && notation2.amount != null) @@ -2663,7 +2666,7 @@ namespace rmutr_report.Controllers { int row = 1; foreach (var dataDetail in detail.detail) - { + { if (dataDetail.topic_type == 5) { dataDetail.row_no = row.ToString(); @@ -2707,6 +2710,7 @@ namespace rmutr_report.Controllers return Ok(); } + [HttpPost, Route("reports/total_budget/{type}")] [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetBudgetTotalReport([FromRoute] string type, @@ -2715,23 +2719,23 @@ namespace rmutr_report.Controllers int row = 1; foreach (var detail2 in budget.data) { - var a = "- "; - if (detail2.topic_type == 2) - { - detail2.list = a + detail2.list; - } + var a = "- "; + if (detail2.topic_type == 2) + { + detail2.list = a + detail2.list; + } - if (detail2.topic_type == 5) - { - detail2.row_no = row.ToString(); - row++; - } - else - { - detail2.row_no = null; - } - + if (detail2.topic_type == 5) + { + detail2.row_no = row.ToString(); + row++; + } + else + { + detail2.row_no = null; + } } + var summaryBudget = new List() { budget }; Report report = new Report(); @@ -2763,5 +2767,54 @@ namespace rmutr_report.Controllers return Ok(); } + + [HttpPost, Route("reports/summary_subsidy_projects/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetBudgetSubsidySummaryReport([FromRoute] string type, + [FromBody] summary_subsidy_projects budget) + { + int row = 1; + foreach (var detail in budget.data) + { + if (detail.topic_type == 3) + { + detail.row_no = row; + row++; + } + else + { + detail.row_no = null; + } + } + + var summaryBudget = new List() { budget }; + + Report report = new Report(); + report.Load(_setting.report_path + "summary_subsidy_projects.frx"); + report.RegisterData(summaryBudget, "summary_subsidy_projects"); + report.Prepare(); + + MemoryStream stream = new MemoryStream(); + switch (type) + { + case "pdf": + PDFExport pdf = new PDFExport(); + report.Export(pdf, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "application/pdf"); + + case "xls": + case "xlsx": + Excel2007Export excel = new Excel2007Export(); + report.Export(excel, stream); + stream.Seek(0, SeekOrigin.Begin); + return File( + stream, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "project_summary_subsidy" + ".xlsx"); + } + + return Ok(); + } } } \ No newline at end of file diff --git a/Models/budget/summary_subsidy_projects.cs b/Models/budget/summary_subsidy_projects.cs new file mode 100644 index 0000000..25c9a0c --- /dev/null +++ b/Models/budget/summary_subsidy_projects.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class summary_subsidy_projects + { + public string budget_year { get; set; } + public string date_range { get; set; } + public string budget_project_name_th { get; set; } + public string agency_name_th { get; set; } + public string education_level_and_year { get; set; } + public string branch_name_th { get; set; } + public List data { get; set; } + + } + + public class summary_subsidy_projects_data + { + public int? topic_type { get; set; } + public int? row_no { get; set; } + public string project_name_th { get; set; } + public decimal? project_amount { get; set; } + public decimal? participants_amount { get; set; } + public decimal? organize_amount { get; set; } + public decimal? participants_eachtime_amount { get; set; } + public decimal? increased_cognition_amount { get; set; } + public decimal? customer_satisfaction { get; set; } + public decimal? project_achieve_objectives { get; set; } + public decimal? project_complete { get; set; } + public string start_date { get; set; } + public string end_date { get; set; } + public decimal? compensation { get; set; } + public decimal? cost { get; set; } + public decimal? material_cost { get; set; } + public decimal? total_budget { get; set; } + public string responsible_person { get; set; } + } +} \ No newline at end of file diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.dll b/bin/Debug/netcoreapp3.1/rmutr_report.dll index 77d96bc..7b5b1ad 100644 Binary files a/bin/Debug/netcoreapp3.1/rmutr_report.dll and b/bin/Debug/netcoreapp3.1/rmutr_report.dll differ diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.pdb b/bin/Debug/netcoreapp3.1/rmutr_report.pdb index 0cfd02b..3b20caf 100644 Binary files a/bin/Debug/netcoreapp3.1/rmutr_report.pdb and b/bin/Debug/netcoreapp3.1/rmutr_report.pdb differ diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index decabda..5754ee0 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,29 +1,27 @@ -image: atlassian/default-image:2 pipelines: - default: - - step: - runs-on: - - self.hosted - - linux - size: 2x - services: - - docker - caches: - - dotnetcore - script: - - docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD - - docker build -f Dockerfile.dev -t registry.71dev.com/rmutr_report:latest . - - docker push registry.71dev.com/rmutr_report:latest - - step: - runs-on: - - self.hosted - - linux - name: Deploy - image: atlassian/pipelines-kubectl - script: - - echo $KUBE_CONFIG | base64 -d > kubeconfig - - kubectl --insecure-skip-tls-verify --kubeconfig=kubeconfig rollout restart deployment/rmutr-report -n rmutr + branches: + master: + - step: + runs-on: + - self.hosted + - linux + - 8x + size: 8x + services: + - docker + caches: + - docker + script: # Modify the commands below to build your repository. + - docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD + - docker build -f Dockerfile.dev -t registry.71dev.com/rmutr_report:latest . + - docker push registry.71dev.com/rmutr_report:latest + - step: + name: Deploy to kubernates + image: atlassian/pipelines-kubectl + script: + - echo $KUBE_CONFIG_DELL | base64 -d > kubeconfig + - kubectl --insecure-skip-tls-verify --kubeconfig=kubeconfig rollout restart deployment/rmutr-report -n rmutr definitions: services: docker: - memory: 7128 \ No newline at end of file + memory: 14336 \ No newline at end of file diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index 77d96bc..7b5b1ad 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.dll and b/obj/Debug/netcoreapp3.1/rmutr_report.dll differ diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.pdb b/obj/Debug/netcoreapp3.1/rmutr_report.pdb index 0cfd02b..3b20caf 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.pdb and b/obj/Debug/netcoreapp3.1/rmutr_report.pdb differ diff --git a/wwwroot/reports/summary_subsidy_projects.frx b/wwwroot/reports/summary_subsidy_projects.frx new file mode 100644 index 0000000..3d0dbc9 --- /dev/null +++ b/wwwroot/reports/summary_subsidy_projects.frx @@ -0,0 +1,251 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + + + + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +