From 5f69d9c1dfcb8b2130592f97767f63a3779f2813 Mon Sep 17 00:00:00 2001 From: "LAPTOP-KB8JC2K2\\acer" Date: Fri, 9 Jul 2021 12:32:34 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=20=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=84=E0=B8=B3=E0=B8=99?= =?UTF-8?q?=E0=B8=A7=E0=B8=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eva_limit_frame_planEntity.cs | 13 +++++++------ .../vw_limit_frame_planService.cs | 6 +++--- Utils/MyHelper.cs | 4 +++- .../eva_limit_frame_group_d.js | 1 + 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Models/eva_limit_frame_plan/eva_limit_frame_planEntity.cs b/Models/eva_limit_frame_plan/eva_limit_frame_planEntity.cs index 70256f9..ea0192b 100644 --- a/Models/eva_limit_frame_plan/eva_limit_frame_planEntity.cs +++ b/Models/eva_limit_frame_plan/eva_limit_frame_planEntity.cs @@ -56,12 +56,13 @@ namespace TodoAPI2.Models public void DoAfterInsertUpdate(DataContext context) { - //total_salary = (from i in context.eva_limit_frame_employee - // join j in context.eva_limit_frame_group - // on i.frame_group_guid equals j.id - // select i.salary).Sum(); - //limit_frame_005_total = total_salary * limit_frame_005 / 100; - //limit_frame_005_total_rounded = MyHelper.RoundOff(limit_frame_005_total.Value, 10); + total_salary = (from i in context.eva_limit_frame_employee + join j in context.eva_limit_frame_group + on i.frame_group_guid equals j.id + where j.frame_plan_guid == this.id + select i.salary).Sum(); + limit_frame_005_total = total_salary * limit_frame_005 / 100; + limit_frame_005_total_rounded = MyHelper.RoundOff(limit_frame_005_total.Value, 10); } } diff --git a/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs b/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs index 6631520..f810d3b 100644 --- a/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs +++ b/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs @@ -256,9 +256,9 @@ namespace TodoAPI2.Models _repository.Context.AddRange(result_frame_group); _repository.Context.AddRange(result_frame_employee); - entity.total_salary = all_all_emp.Sum(z => z.salary); - entity.limit_frame_005_total = entity.total_salary * entity.limit_frame_005 / 100; - entity.limit_frame_005_total_rounded = MyHelper.RoundOff(entity.limit_frame_005_total.Value, 10); + //entity.total_salary = all_all_emp.Sum(z => z.salary); + //entity.limit_frame_005_total = entity.total_salary * entity.limit_frame_005 / 100; + //entity.limit_frame_005_total_rounded = MyHelper.RoundOff(entity.limit_frame_005_total.Value, 10); entity.SetAutoField(_repository.Context); diff --git a/Utils/MyHelper.cs b/Utils/MyHelper.cs index e44471f..794384e 100644 --- a/Utils/MyHelper.cs +++ b/Utils/MyHelper.cs @@ -426,6 +426,8 @@ public static class MyHelper public static decimal RoundOff(decimal i, decimal round_number) { - return (Math.Round(i / round_number)) * round_number; + string temp = i.ToString().Split(".")[0]; + + return Convert.ToDecimal(temp.Substring(0, temp.Length - 1)) * 10 + 10; } } diff --git a/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group_d.js b/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group_d.js index 20d80e6..44f895c 100644 --- a/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group_d.js +++ b/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group_d.js @@ -128,6 +128,7 @@ function funcCeilCalculateSalaryLimit(params) { var str_ceil = cal_ceil.toString(); var split_ceil = str_ceil.split(''); var num_last = Number(split_ceil[split_ceil.length - 1]); + console.log(num_last); if (num_last) { after_cal = num_check - num_last; }