From 7b9e068cfe4e295f9ee960457d848c631f0136c7 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 27 八月 2021 16:09:56 +0800
Subject: [PATCH] 工作交接

---
 zhengcaioa/Services/HrSalaryService.cs |   69 +++++++++++++++++++++++++---------
 1 files changed, 51 insertions(+), 18 deletions(-)

diff --git a/zhengcaioa/Services/HrSalaryService.cs b/zhengcaioa/Services/HrSalaryService.cs
index 7c06702..3be0447 100644
--- a/zhengcaioa/Services/HrSalaryService.cs
+++ b/zhengcaioa/Services/HrSalaryService.cs
@@ -136,19 +136,38 @@
                     //璁$畻棰勫彂宸ヨ祫
                     if (user.advancewages.HasValue && user.advancewages.Value>0)
                     {
+                        //涓婁竴娆$殑宸ヨ祫
+                        var bf= _context.HrSalaries.Where(c => c.Userid == user.Id && c.Islock== "Q" && c.RecStatus=="A").
+                            OrderByDescending(c=>c.Year).ThenByDescending(c=>c.Month).FirstOrDefault();
+
                         var pc = user.advancewages.Value;
                         if (sum_f - sum_k > pc)
                         {
-                            updatepltRole.Daozhanggongzi = sum_f - sum_k;                            
+                            updatepltRole.Daozhanggongzi = sum_f - sum_k;
+                            updatepltRole.Yufagongzi = 0;
+                            if(bf!=null)
+                            {
+                                updatepltRole.Yufagongziheji = bf.Yufagongziheji??0 - (updatepltRole.Daozhanggongzi-pc);
+                            }
+                            else
+                            {
+                                updatepltRole.Yufagongziheji = (pc - updatepltRole.Daozhanggongzi);
+                            }
                         }
                         else
                         {
                             //棰勫彂
                             updatepltRole.Daozhanggongzi = pc;
                             updatepltRole.Yufagongzi = pc - (sum_f - sum_k);
-                            updatepltRole.Yufagongziheji += updatepltRole.Yufagongzi;
+                            if (bf != null)
+                            {
+                                updatepltRole.Yufagongziheji =bf.Yufagongziheji??0+ updatepltRole.Yufagongzi;
+                            }
+                            else
+                            {
+                                updatepltRole.Yufagongziheji = updatepltRole.Yufagongzi;
+                            }
                         }
-
                     }
                     else
                     {
@@ -350,7 +369,7 @@
 
 
 
-            if (searchEntity.totalrows == 0)
+            //if (searchEntity.totalrows == 0)
                 searchEntity.totalrows = query.Count();
             var rolelist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
 
@@ -415,7 +434,7 @@
                           && (string.IsNullOrWhiteSpace(searchEntity.Usernumber) || f.Usernumber == searchEntity.Usernumber.Trim())
                             && (string.IsNullOrWhiteSpace(searchEntity.DeptId) || f.DeptId == searchEntity.DeptId.Trim())
                               && (string.IsNullOrWhiteSpace(searchEntity.UserName) || f.UserName.Contains(searchEntity.UserName.Trim()))
-                              && ( (a.Year == year && a.Month == month))
+                              && (string.IsNullOrWhiteSpace(searchEntity.YearMonth) || ( a.Year == year && a.Month == month ))
                          select new HrSalaryDTO
                          {
                              Id = a.Id,
@@ -488,7 +507,7 @@
 
 
 
-            if (searchEntity.totalrows == 0)
+            //if (searchEntity.totalrows == 0)
                 searchEntity.totalrows = query.Count();
             var rolelist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
             if(rolelist!=null && rolelist.Count>0)
@@ -696,7 +715,9 @@
                         temp.reason = model.reason;
                         temp.amount = model.amount;
                         temp.basis = model.basis;
-                        temp.sub_time = DateTime.Now;
+                        temp.shenpi_status = model.shenpi_status;
+
+
                     }
                     else
                     {
@@ -727,12 +748,20 @@
         /// <param name="id"></param>
         /// <param name="user"></param>
         /// <returns></returns>
-        public HrSalaryAppeal GetAppeal(string id,string user)
+        public HrSalaryAppeal GetAppeal(string id = "", string user = "", string salaryId = "")
         {
             HrSalaryAppeal hd = new HrSalaryAppeal();
             try
             {
-                hd = _context.HrSalaryAppeal.Where(e => e.salary_id == id && e.sub_user == user).SingleOrDefault();
+                if (!string.IsNullOrEmpty(salaryId))
+                {
+                    hd = _context.HrSalaryAppeal.Where(e => e.salary_id == salaryId && e.sub_user == user && e.status == "A").FirstOrDefault();
+                }
+                else
+                {
+                    hd = _context.HrSalaryAppeal.Where(e => e.id == id && e.status == "A").FirstOrDefault();
+                }
+               
             }
             catch (Exception er)
             {
@@ -762,14 +791,15 @@
             DateTime st = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date;
             DateTime et = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1); 
             int month = 0;
-            if (!string.IsNullOrEmpty(searchEntity.searchDate))
+            if (!string.IsNullOrEmpty(searchEntity.searchDatestart))
             {
-                var times = searchEntity.searchDate.Split('|');
-                if (times.Length == 2)
-                {
-                    st = DateTime.Parse(times[0]);
-                    et= DateTime.Parse(times[1]);
-                }
+                st = DateTime.Parse(searchEntity.searchDatestart + "-01");
+                 
+            }
+            if (!string.IsNullOrEmpty(searchEntity.searchDateend))
+            {
+                et = DateTime.Parse(searchEntity.searchDateend + "-01");
+
             }
             var query = (from a in _context.HrSalaries where a.Year >= st.Year && a.Month >= st.Month && a.Year <= et.Year && a.Month <= et.Month select a);
 
@@ -780,7 +810,10 @@
                           && (string.IsNullOrWhiteSpace(searchEntity.Usernumber) || f.Usernumber == searchEntity.Usernumber.Trim())
                             && (string.IsNullOrWhiteSpace(searchEntity.DeptId) || f.DeptId == searchEntity.DeptId.Trim())
                               && (string.IsNullOrWhiteSpace(searchEntity.UserName) || f.UserName.Contains(searchEntity.UserName.Trim()))
-                         select new HrSalaryDTO
+
+                               && (string.IsNullOrWhiteSpace(searchEntity.UserId) || a.Userid.Contains(searchEntity.UserId.Trim()))
+
+                        select new HrSalaryDTO
                          {
                              Id = a.Id,
 
@@ -850,7 +883,7 @@
                          }).OrderByDescending(x => x.Modifytime).ToList();
 
 
-            if (searchEntity.totalrows == 0)
+            //if (searchEntity.totalrows == 0)
                 searchEntity.totalrows = list.Count();
             var rolelist = list.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
             if (rolelist != null && rolelist.Count > 0)

--
Gitblit v1.9.1