ソースを参照

1.尾款自动审核添加
2.会务成本部分调整

yuanrf 6 日 前
コミット
8361370c6a

+ 50 - 1
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -40,6 +40,7 @@ using System.ComponentModel.DataAnnotations;
 using System.Data;
 using System.Diagnostics;
 using System.Globalization;
+using System.IO;
 using System.IO.Compression;
 using System.Text.Json;
 using System.Text.RegularExpressions;
@@ -15211,6 +15212,46 @@ FROM
                 //自动审核
                 await _feeAuditRep.FeeAutomaticAudit(2, dto.DiId, dto.CTGGRId);
 
+                #region 尾款自动审核
+                var opinfos = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>()
+                .First(x => x.IsDel == 0 && x.DiId == dto.DiId && x.Id == dto.CTGGRId);
+                if (opinfos.PriceType == 1062)
+                {
+                    var isAuto = false; 
+                    //找对应的首付款
+                    var firstPrice = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>()
+                            .InnerJoin<Grp_CreditCardPayment>((x,a) => a.IsDel == 0  && a.CTable == 79 && a.CId == x.Id && a.DIId == x.DiId && (a.IsAuditGM == 1 || a.IsAuditGM == 3 ))
+                            .First(x => x.IsDel == 0 && x.DiId == dto.DiId && x.PriceName == opinfos.PriceName &&
+                             x.ServiceStartTime == opinfos.ServiceStartTime && x.ServiceEndTime == opinfos.ServiceEndTime && x.Area == opinfos.Area &&
+                             x.PriceType == 1061 && x.DiId == dto.DiId);
+
+                    if (firstPrice!= null && !(opinfos.SelectCheck.Contains("超时") || opinfos.SelectCheck.Contains("超支")) && firstPrice.CId == opinfos.CId)
+                    {
+                        var cprice = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(x => x.IsDel == 0 && x.CId == firstPrice.Id && x.CTable == 79);
+                        var balance = firstPrice.ServiceQuotedPrice * (100 - cprice.PayPercentage) / 100;
+                        if (balance >= opinfos.ServiceQuotedPrice)
+                        {
+                            isAuto = true;
+                        }
+
+                    }
+
+                    if (isAuto)
+                    {
+                        var execCount = _sqlSugar.Updateable<Grp_CreditCardPayment>()
+                               .SetColumns(a => new Grp_CreditCardPayment
+                               {
+                                   IsAuditGM = 3, //自动审核通过
+                                   AuditGMOperate = 4,
+                                   AuditGMDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                               })
+                               .Where(a => a.CId == dto.CTGGRId && a.CTable == 79 && a.DIId == dto.DiId)
+                               .ExecuteCommand();
+                    }
+                }
+                #endregion
+
+
                 #region 应用推送
                 try
                 {
@@ -26477,11 +26518,19 @@ ORDER BY
             .Where(x => x.IsDel == 0 && x.STid == 21)
             .Select(x => new { x.Id, Text = x.Name })
             .ToListAsync();
+
+            var hwids = _sqlSugar.Queryable<Sys_SetData>()
+                       .Where(x => x.IsDel == 0 && x.STid == 10 && x.Name.Contains("会务活动"))
+                       .Select(x => x.Id)
+                       .ToList();
+
+            //仅检索会务团组   
             var groupList = await _sqlSugar.Queryable<Grp_DelegationInfo>()
-            .Where(x => x.IsDel == 0)
+            .Where(x => x.IsDel == 0 && hwids.Contains(x.TeamDid))
             .OrderByDescending(x => x.VisitDate)
             .Select(x => new { x.Id, x.TeamName })
             .ToListAsync();
+
             var currenyList = await GeneralMethod.PostGroupTeamRateByDiIdAndCTableId(1, di.Id, 98);
             var userList = await _sqlSugar.Queryable<Sys_Users>()
             .Where(x => x.IsDel == 0)

+ 33 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -236,7 +236,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                              })
                                              .ToList();
 
-                var weikuanSign = new int[] { 1070, 1071, };
+                var weikuanSign = new int[] { 1070, 1071, 1452 };
                 TableInitialization.RemoveAll(x => weikuanSign.Contains(x.Id));
                 var weiKuanArr = _TableInitialization.Where(x => weikuanSign.Contains(x.Id)).ToList();
                 var weiKuanResultArr = carTouristGuides.Where(x => weikuanSign.Contains(x.SId)).ToList();
@@ -452,6 +452,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     {
                         weiOther.SidName = "其他额外费用";
                     }
+                    var cityPrice = weiKuanResultArr.Find(x => x.SId == 1452);
+                    if (cityPrice != null)
+                    {
+                        cityPrice.SidName = "城市税";
+                    }
                     carTouristGuides.Add(weiPrice ??= new CarTouristGuideGroundReservationsContentView
                     {
                         Count = 1,
@@ -472,6 +477,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         SidName = "其他额外费用",
                         Units = 0,
                     });
+                    carTouristGuides.Add(cityPrice ??= new CarTouristGuideGroundReservationsContentView
+                    {
+                        Count = 1,
+                        DatePrice = DateTime.Now,
+                        Price = 0,
+                        PriceContent = "",
+                        SId = 1452,
+                        SidName = "城市税",
+                        Units = 0,
+                    });
                 }
                 else
                 {
@@ -1159,6 +1174,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                 Regex regex = new Regex("^[\u4e00-\u9fa5]{0,}$");
 
+                //城市税排除计算
+                var excludeList = new List<int>() { 1452  };
+
                 #region 修改C表数据
 
                 Grp_CreditCardPayment c = new Grp_CreditCardPayment();
@@ -1171,13 +1189,26 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         {
                             if (int.Parse(dto.SelectCheck[i]) == carTouristList[j].SId)
                             {
+                                if (excludeList.Contains(carTouristList[j].SId))
+                                {
+                                    continue;
+                                }
+
                                 c.PayMoney += carTouristList[j].Price * carTouristList[j].Count;
                             }
                         }
                     }
                     else
                     {
-                        c.PayMoney = carTouristList.Sum(x => x.Price * x.Count);
+                        c.PayMoney = carTouristList.Sum(x =>
+                        {
+                            if (excludeList.Contains(x.SId))
+                            {
+                                return 0;
+                            }
+
+                            return x.Price * x.Count;
+                        });
                         break;
                     }
                 }