Browse Source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

zhaiy 1 month ago
parent
commit
e87045fe8b

+ 149 - 2
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -5217,6 +5217,53 @@ FROM
             {
                 var data = await _enterExitCostRep.PostEnterExitCostOperate(dto);
 
+                if (dto.DayOtherPriceData.Any())
+                {
+                    var inserList = dto.DayOtherPriceData
+                        .Where(x => x.Id == 0)
+                        .Select(x => new Grp_DayOtherPrice
+                        {
+                            Cost = x.Cost,
+                            Id = x.Id,
+                            CreateTime = DateTime.Now,
+                            CreateUserId = dto.UserId,
+                            Currency = x.Currency,
+                            Diid = x.Diid,
+                            Index = x.Index,
+                            IsDel = 0,
+                            SetDataId = x.SetDataId,
+                            SubTotal = x.SubTotal
+                        })
+                        .ToList();
+                    var updateList = dto.DayOtherPriceData
+                        .Where(x => x.Id != 0)
+                        .Select(x => new Grp_DayOtherPrice
+                        {
+                            Cost = x.Cost,
+                            Id = x.Id,
+                            CreateTime = DateTime.Now,
+                            CreateUserId = dto.UserId,
+                            Currency = x.Currency,
+                            Diid = x.Diid,
+                            Index = x.Index,
+                            IsDel = 0,
+                            SetDataId = x.SetDataId,
+                            SubTotal = x.SubTotal,
+                        })
+                        .ToList();
+                    //添加
+                    _sqlSugar.BeginTran();
+                    if (inserList.Any())
+                    {
+                        var rowCount = _sqlSugar.Insertable<Grp_DayOtherPrice>(inserList).ExecuteCommand();
+                    }
+                    if (updateList.Any())
+                    {
+                        var rowCount = _sqlSugar.Updateable<Grp_DayOtherPrice>(updateList).ExecuteCommand();
+                    }
+                    _sqlSugar.CommitTran();
+                }
+
                 if (data.Code != 0)
                 {
                     return Ok(JsonView(false, data.Msg));
@@ -5314,6 +5361,20 @@ FROM
                 List<Grp_DayAndCost> dac2 = _DayAndCosts.Where(it => it.Type == 2).ToList(); //伙食费
                 List<Grp_DayAndCost> dac3 = _DayAndCosts.Where(it => it.Type == 3).ToList(); //公杂费
                 List<Grp_DayAndCost> dac4 = _DayAndCosts.Where(it => it.Type == 4).ToList(); //培训费
+                var dac5 = _sqlSugar.Queryable<Grp_DayOtherPrice>()
+                            .LeftJoin<Sys_SetData>((x,a)=> a.IsDel == 0 && a.Id == x.SetDataId)
+                            .LeftJoin<Sys_SetData>((x, a, b) => a.IsDel == 0 && a.Id == x.Currency)
+                            .Where((x, a, b) => x.IsDel == 0 && x.Diid == dto.DiId)
+                            .Select((x, a, b) => new
+                            {
+                                x.Index,
+                                itemName = a.Name,
+                                CurrencyStr = b.Name,
+                                x.Cost,
+                                x.SubTotal, 
+                            })
+                            .OrderBy((x) => x.Index)
+                            .ToList();
 
                 var _CurrDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 66).ToList();
                 var _DelegationInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == dto.DiId).First();
@@ -5357,6 +5418,7 @@ FROM
                         decimal mealsFeeTotal = _DayAndCosts.Where(it => it.Type == 2).Sum(it => it.SubTotal);  // 伙食费费
                         decimal miscellaneousFeeTotal = _DayAndCosts.Where(it => it.Type == 3).Sum(it => it.SubTotal);  // 公杂费
                         decimal tainFeeTotal = _DayAndCosts.Where(it => it.Type == 4).Sum(it => it.SubTotal);  // 培训费
+                        decimal otherPriceTotal = dac5.Sum(x => x.SubTotal);
 
                         decimal insidePayTotal = _EnterExitCosts.InsidePay;
 
@@ -5442,7 +5504,9 @@ FROM
                         int table1Row = 0,
                             table2Row = 0,
                             table3Row = 0,
-                            table4Row = 0;
+                            table4Row = 0,
+                            table5Row = 0;
+
                         //住宿费
                         if (_EnterExitCosts.ChoiceThree == 1)
                         {
@@ -5646,7 +5710,52 @@ FROM
                         {
                             table4.Rows.RemoveAt(table4Row);
                         }
-                        decimal otherFeeTotal = insidePayTotal + stayFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + tainFeeTotal;
+
+                        //其他费用
+                        Aspose.Words.Tables.Table table5 = allTables[3] as Aspose.Words.Tables.Table;
+                        if (_EnterExitCosts.OtherExpenses_Checked == 1)
+                        {
+                            dic.Add("SubQT", otherPriceTotal.ToString("#0.00"));
+
+                            table5Row = table5.Count;
+                            #region 填充word表格内容
+
+                            for (int i = 0; i < dac5.Count; i++)
+                            {
+                                var dac = dac5[i];
+                                if (dac == null) continue;
+
+                                builder.MoveToCell(3, i, 0, 0);
+                                builder.Write("第" + dac.Index.ToString() + "项:");
+
+                                builder.MoveToCell(3, i, 1, 0);
+
+                                builder.Write(dac.itemName);
+
+                                builder.MoveToCell(3, i, 2, 0);
+                                builder.Write("费用标准:");
+
+                                builder.MoveToCell(3, i, 3, 0);
+                                builder.Write(dac.Cost.ToString("#0.00") + dac.CurrencyStr);
+
+                                builder.MoveToCell(3, i, 4, 0);
+                                builder.Write("费用小计:");
+
+                                builder.MoveToCell(3, i, 5, 0);
+                                builder.Write(dac.SubTotal.ToString("#0.00") + "CNY");
+                            }
+
+                            #endregion
+                        }
+                        else dic.Add("SubQT", "0.00");
+                        //删除多余行
+                        while (table5.Rows.Count > table5Row)
+                        {
+                            table5.Rows.RemoveAt(table5Row);
+                        }
+
+                        //加上其他费用
+                        decimal otherFeeTotal = insidePayTotal + stayFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + tainFeeTotal + otherPriceTotal;
 
                         decimal subJJC = 0.00M,
                                 subGWC = 0.00M,
@@ -6700,6 +6809,15 @@ FROM
             if (dto.Id < 1) return Ok(JsonView(false, "请传入有效的Id参数;"));
 
             var _view = await _enterExitCostRep._OneClickClear(dto.Id, dto.DiId, dto.UserId);
+            await _sqlSugar.Updateable<Grp_DayOtherPrice>()
+                            .Where(x => x.Diid == dto.DiId && x.IsDel == 0)
+                            .SetColumns(x => new Grp_DayOtherPrice
+                            {
+                                IsDel = 1,
+                                DeleteUserId = dto.UserId,
+                                DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                            })
+                            .ExecuteCommandAsync();
 
             if (_view.Code == 0)
             {
@@ -6734,6 +6852,35 @@ FROM
             }
         }
 
+        /// <summary>
+        /// 删除三公其他费用
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult DeleteOtherExpenses(EnterExitCostSubItemDelDto dto)
+        {
+            var jw = JsonView(false,"删除失败!");
+
+            var data = new Grp_DayOtherPrice()
+            {
+                Id = dto.Id,
+                IsDel = 1,
+                DeleteUserId = dto.DeleteUserId,
+                DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")
+            };
+
+            var del = _sqlSugar.Updateable(data).UpdateColumns(it => new { it.IsDel, it.DeleteUserId, it.DeleteTime }).ExecuteCommand();
+
+            if (del > 0)
+            {
+                jw.Code = 200;
+                jw.Msg = "删除成功!";
+            }
+
+            return Ok(jw);
+        }
+
         /// <summary>
         /// 团组模块 - 出入境国家费用标准 List
         /// </summary>

+ 12 - 0
OASystem/OASystem.Domain/Dtos/Groups/EnterExitCostDto.cs

@@ -217,6 +217,18 @@ namespace OASystem.Domain.Dtos.Groups
 
         #endregion
 
+        #region 其他费用
+        /// <summary>
+        ///  其他费用选择框
+        /// </summary>
+        public int OtherExpenses_Checked { get; set; }
+
+        /// <summary>
+        /// 培训费子项Data
+        /// </summary>
+        public List<DayOtherPriceView> DayOtherPriceData { get; set; }
+        #endregion
+
         #region 最下面 选择框状态
 
         /// <summary>

+ 26 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_DayOtherPrice.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.Groups
+{
+    /// <summary>
+    /// 三公费用其他费用表
+    /// </summary>
+    public class Grp_DayOtherPrice:EntityBase
+    {
+        public int Diid { get; set; }
+
+        public int SetDataId { get; set; }
+
+        public int Index { get; set; }
+
+        public decimal Cost { get; set; }
+
+        public int Currency { get; set; }
+
+        public decimal SubTotal { get; set; }
+    }
+}

+ 6 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_EnterExitCost.cs

@@ -243,5 +243,11 @@ namespace OASystem.Domain.Entities.Groups
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int IsConfirm { get; set; } = 1;
+
+
+        /// <summary>
+        /// 其他费用选择框
+        /// </summary>
+        public int OtherExpenses_Checked { get; set; }
     }
 }

+ 27 - 0
OASystem/OASystem.Domain/ViewModels/Groups/EnterExitCostView.cs

@@ -435,6 +435,16 @@ namespace OASystem.Domain.ViewModels.Groups
         /// 头等舱选择框
         /// </summary>
         public int AirTDC_Checked { get; set; }
+
+        /// <summary>
+        /// 其他款项选择框
+        /// </summary>
+        public int OtherExpenses_Checked { get; set; }
+
+        /// <summary>
+        /// 其他款项子项Data
+        /// </summary>
+        public List<DayOtherPriceView> DayOtherPriceData { get; set; }
         #endregion
     }
 
@@ -603,6 +613,23 @@ namespace OASystem.Domain.ViewModels.Groups
         public string? Remark { get; set; } = "";
     }
 
+    public class DayOtherPriceView
+    {
+        public int Id { get; set; }
+
+        public int Diid { get; set; }
+
+        public int SetDataId { get; set; }
+
+        public int Index { get; set; }
+
+        public decimal Cost { get; set; }
+
+        public int Currency { get; set; }
+
+        public decimal SubTotal { get; set; }
+    }
+
     /// <summary>
     /// 币种详情
     /// </summary>

+ 15 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -95,6 +95,21 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     enterExitCostInfoView.MiscellaneousFeeData = dayAndCostData.Where(it => it.Type == 3).ToList();  //公杂费 3
                     enterExitCostInfoView.TrainingExpenseData = dayAndCostData.Where(it => it.Type == 4).ToList();  //培训费 4
 
+                    enterExitCostInfoView.DayOtherPriceData = _sqlSugar.Queryable<Grp_DayOtherPrice>()
+                                                                .Where(x => x.IsDel == 0 && x.Diid == dto.DiId)
+                                                                .OrderBy(x=>x.Index)
+                                                                .Select(x => new DayOtherPriceView
+                                                                {
+                                                                    Diid = x.Diid,
+                                                                    Id = x.Id,
+                                                                    Cost = x.Cost,
+                                                                    Currency = x.Currency,
+                                                                    Index = x.Index,
+                                                                    SetDataId = x.SetDataId,
+                                                                    SubTotal = x.SubTotal,
+                                                                })
+                                                                .ToList();
+
                     enterExitCostInfoView.Currencys = (List<CurrencyInfo>?)CommonFun.GetCurrencyChinaToList(enterExitCostData.CurrencyRemark);
 
                     result.Msg = "查询成功";