Bläddra i källkod

添加报销数据处理及相关类和属性

在 `StatisticsController.cs` 中:
- 添加 `using SqlSugar;` 语句。
- 增加处理公司内部人员报销的数据查询和处理逻辑。
- 更新 `_totalExpenditure` 的计算逻辑,增加 `reimburseTotalPrice`。

在 `GroupStatementView.cs` 中:
- 添加 `using System.Runtime.Intrinsics.Arm;` 语句。
- 增加 `GroupReimburseFeeViews` 和 `GroupReimburseFeeStr` 属性。
- 添加 `GroupReimburseFeeInfoView` 类,定义报销费用信息结构。
- 添加 `GroupReimburseFeeSubInfo` 类,定义报销费用子项结构。
LEIYI 2 månader sedan
förälder
incheckning
5861e7a2ad

+ 41 - 1
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -10,6 +10,7 @@ using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Statistics;
 using OASystem.Infrastructure.Repositories.Groups;
+using SqlSugar;
 using System.Data;
 using static OASystem.API.OAMethodLib.GeneralMethod;
 using TypeInfo = OASystem.Domain.ViewModels.Statistics.TypeInfo;
@@ -1314,6 +1315,45 @@ ORDER BY
                 _geView.GroupRoyaltyFeeStr = string.Format(@"人民币总费用:{0} CNY", royaltyCNYTotalPrice.ToString("#0.00"));
                 #endregion
 
+                #region 公司内部人员报销
+                var reimburseDatas = await _sqlSugar
+                    .Queryable<Fin_DailyFeePayment, Sys_Users, Sys_SetData, Sys_Company>((dfp, u, sd1, c) =>
+                    new JoinQueryInfos(
+                        JoinType.Left, dfp.CreateUserId == u.Id,
+                        JoinType.Left, dfp.TransferTypeId == sd1.Id,
+                        JoinType.Left, dfp.CompanyId == c.Id
+                        ))
+                    .Where((dfp, u, sd1, c) => dfp.IsDel == 0 && dfp.PriceTypeId == 1353 && dfp.GroupId == _dto.DiId)
+                    .Select((dfp, u, sd1, c) => new GroupReimburseFeeInfoView()
+                    {
+                        TotalAmt = dfp.SumPrice,
+                        //FeeItems = SqlFunc.Subqueryable<Fin_DailyFeePaymentContent>()
+                        //           .Where(x => x.DFPId == dfp.Id && x.IsDel == 0)
+                        //           .Select(x => new GroupReimburseFeeSubInfo()
+                        //           {
+                        //               PriceName = x.PriceName,
+                        //               Quantity = x.Quantity,
+                        //               Price = x.Price,
+                        //               SubTotal = x.ItemTotal,
+                        //               Remark = x.Remark
+                        //           })
+                        //           .ToList(),
+                        AppReason = dfp.Instructions,
+                        TransferLabel = sd1.Name,
+                        ApplyComp = c.CompanyName,
+                        FAudit = dfp.FAudit,
+                        MAudit = dfp.MAudit,
+                        PayStatusFlag = dfp.IsPay == 0 ? "未付款" : "已付款",
+                        ApplyName = u.CnName,
+                        ApplyTime = dfp.CreateTime
+
+                    })
+                    .ToListAsync();
+                var reimburseTotalPrice = reimburseDatas.Sum(x => x.TotalAmt);
+                _geView.GroupReimburseFeeViews = reimburseDatas;
+                _geView.GroupReimburseFeeStr = string.Format(@"人民币总费用:{0} CNY", reimburseTotalPrice.ToString("#0.00"));
+
+                #endregion
                 _view.GroupExpenditure = _geView;
                 #endregion
 
@@ -1332,7 +1372,7 @@ ORDER BY
                 decimal _receivableProfit = 0.00M; //应收利润
                 decimal _receivedProfit = 0.00M;   //已收利润
                 _totalExpenditure = HotelCNYTotalPrice + CTGGRCNYTotalPrice + AirCNYTotalPrice + VisaCNYTotalPirce + InvitationalCNYTotalPrice +
-                                    InsuranceCNYTotalPrice + DecreaseCNYTotalPrice + exTotalAmount + royaltyCNYTotalPrice;
+                                    InsuranceCNYTotalPrice + DecreaseCNYTotalPrice + exTotalAmount + royaltyCNYTotalPrice + reimburseTotalPrice;
                 _amountReceivable = frTotalAmount;
                 _amountReceived = prTotalAmount;
                 _receivableProfit = _amountReceivable - promTotalAmount - _totalExpenditure;

+ 87 - 1
OASystem/OASystem.Domain/ViewModels/Statistics/GroupStatementView.cs

@@ -5,6 +5,7 @@ using OASystem.Domain.Entities.Groups;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Runtime.Intrinsics.Arm;
 using System.Text;
 using System.Threading.Tasks;
 
@@ -616,6 +617,10 @@ namespace OASystem.Domain.ViewModels.Statistics
 
         public List<GroupRoyaltyFeeView> GroupRoyaltyFeeViews { get; set; }
         public string? GroupRoyaltyFeeStr { get; set; }
+
+
+        public List<GroupReimburseFeeInfoView> GroupReimburseFeeViews { get; set; }
+        public string? GroupReimburseFeeStr { get; set; }
     }
 
     /// <summary>
@@ -1420,7 +1425,6 @@ namespace OASystem.Domain.ViewModels.Statistics
 
     }
 
-
     public class GroupRoyaltyFeeInfo
     {
         public int GroupId { get; set; }
@@ -1473,6 +1477,88 @@ namespace OASystem.Domain.ViewModels.Statistics
         public DateTime CreateTime { get; set; }
     }
 
+    public class GroupReimburseFeeInfoView
+    {
+        /// <summary>
+        /// 金额总计
+        /// </summary>
+        public decimal TotalAmt { get; set; }
+
+        public string Currency { get; set; } = "CNY";
+
+        //public GroupReimburseFeeSubInfo[]? FeeItems { get; set; }
+
+        /// <summary>
+        /// 申请原因
+        /// </summary>
+        public string AppReason { get; set; }
+        
+        public int FAudit { get; set; }
+
+        public int MAudit { get; set; }
+
+        /// <summary>
+        /// 审核状态
+        /// </summary>
+        public string AuditStatusFlg
+        {
+            get
+            {
+                var fLabel = FAudit == 0 ? "财务未审核" : FAudit == 1 ? "财务已审核" : "财务审核未通过";
+                var mLabel = MAudit == 0 ? "总经理未审核" : MAudit == 1 ? "总经理已审核" : "总经理审核未通过";
+                return $"{fLabel}<br />{mLabel}";
+            }
+        }
+
+        /// <summary>
+        /// 付款描述
+        /// </summary>
+        public string PayStatusFlag { get; set; }
+        /// <summary>
+        /// 转账标识
+        /// </summary>
+        public string TransferLabel { get; set; }
+        /// <summary>
+        /// 申请公司
+        /// </summary>
+        public string ApplyComp { get; set; }
+        /// <summary>
+        /// 申请人
+        /// </summary>
+        public string ApplyName { get; set; }
+        /// <summary>
+        /// 申请时间
+        /// </summary>
+        public DateTime ApplyTime { get; set; }
+    }
+
+    public class GroupReimburseFeeSubInfo
+    {
+        /// <summary>
+        /// 费用名称
+        /// </summary>
+        public string? PriceName { get; set; }
+
+        /// <summary>
+        /// 数量
+        /// </summary>
+        public decimal Quantity { get; set; }
+
+        /// <summary>
+        /// 单价
+        /// </summary>
+        public decimal Price { get; set; }
+        
+        /// <summary>
+        /// 小记
+        /// </summary>
+        public decimal SubTotal { get; set; }
+
+        public string Currency { get; set; } = "CNY";
+
+        public string Remark { get; set; }
+    }
+
     /// <summary>
     /// 操作人员提成View
     /// </summary>