Browse Source

提成逻辑修改,已收款项修改

yuanrf 3 months ago
parent
commit
6e9968163b

+ 28 - 2
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -1617,6 +1617,30 @@ namespace OASystem.API.Controllers
 
                 Result ffrData = await _proceedsReceivedRep.PostAmountReceivedAddOrEditDto(dto);
 
+                #region 判断金额是否收完
+
+                //已收
+                var Fin_ProceedsReceived_SumPrice = _sqlSugar
+                    .Queryable<Fin_ProceedsReceived>()
+                    .Where(x => x.Diid == dto.DiId && x.IsDel == 0)
+                    .Sum(x=>x.Price);
+
+                //收款账单金额 (应收)
+                var Fin_ForeignReceivables_SumPrice = _sqlSugar
+                    .Queryable<Fin_ForeignReceivables>()
+                    .Where(x => x.Diid == dto.DiId && x.IsDel == 0)
+                    .Sum(x => x.ItemSumPrice);
+
+                if ((Fin_ProceedsReceived_SumPrice - Fin_ForeignReceivables_SumPrice) >= 0)
+                {
+                    _sqlSugar.Updateable<Grp_DelegationInfo>()
+                        .Where(x => x.Id == dto.DiId && x.IsDel == 0)
+                        .SetColumns(x => new Grp_DelegationInfo { IsSure = 1 })
+                        .ExecuteCommand();
+                }
+
+                #endregion
+
                 if (dto.PortType == 1)
                 {
                     if (ffrData.Code != 0)
@@ -5335,8 +5359,8 @@ Group by PriceType ", dto.diId);
                 JoinQueryInfos(
                     JoinType.Left, a.Id == x.DIId,
                     JoinType.Left, b.CTable == 85 && b.CId == x.Id)
-                ).Where((x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && (b.IsAuditGM == 1 || b.IsAuditGM == 3)
-                    && a.IsDel == 0 && a.VisitDate >= StartDateTime && a.VisitDate <= EndDateTime && b.IsDel == 0 && a.IsSure == 1 && auditState.Contains(b.IsAuditGM))
+                ).Where((x, a, b) => x.IsDel == 0 && x.CreateUserId == userId && a.IsDel == 0 && a.VisitDate >= StartDateTime 
+                                                  && a.VisitDate <= EndDateTime && b.IsDel == 0 && auditState.Contains(b.IsAuditGM)) // 取消团组确认状态 && a.IsSure == 1
                     .Select((x, a, b) => new
                     {
                         x.FlightsDescription,
@@ -5349,6 +5373,7 @@ Group by PriceType ", dto.diId);
                         x.ClientName,
                         x.ClientNum,
                         x.FlightsCode,
+                        a.IsSure
                     }).ToList();
 
                 var groupByid = listAir.GroupBy(x => x.Id);
@@ -5460,6 +5485,7 @@ Group by PriceType ", dto.diId);
                         VisitDate = groupinfo.VisitDate,
                         Temp = temp,
                         Price = (groupAirCount * 10),
+                        State = groupinfo.IsSure
                     });
                 }
             }

+ 1 - 1
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -1454,7 +1454,7 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
 
                 #endregion
 
-                string sqlWhere = string.Empty;
+                //string sqlWhere = string.Empty;
                 if (!string.IsNullOrWhiteSpace(dto.Country)) { columns += ",Country"; }
                 //if (!string.IsNullOrWhiteSpace(dto.UnitName)) { columns += ",UnitName"; }
                 //if (!string.IsNullOrWhiteSpace(dto.Contact)) { columns += ",Contact"; }

+ 2 - 0
OASystem/OASystem.Domain/Dtos/Financial/ComputeRoyaltiesDto.cs

@@ -77,6 +77,8 @@ namespace OASystem.Domain.Dtos.Financial
         public string? TeamLvStr { get; set; }
         public DateTime VisitDate { get; set; }
         public string Temp { get; set; }
+
+        public int State { get; set; }
     }
 
     public class RoyaltyConfirmByUserDto