Browse Source

团组报表
加入超支费用 更改计算方式
/*
* 团组报表计算方式
* 当前总支出 = 团组支出.Sum() + 超支费用.Sum()
* 应收金额 = 应收表.Sum()
* 已收金额 = 已收表.Sum()
* 应收利润(应收-支出) = 应收金额 - 收款退还 - 当前总支出
* 已收利润(已收-支出) = 已收金额 - 收款退还 - 当前总支出
*
*/

leiy 11 months ago
parent
commit
7989204da0

+ 40 - 18
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -140,6 +140,16 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostGroupStatementDetails(GroupStatementDetailsDto _dto)
         {
+            /* 
+             * 团组报表计算方式
+             * 当前总支出 = 团组支出.Sum() + 超支费用.Sum()
+             * 应收金额 = 应收表.Sum()
+             * 已收金额 = 已收表.Sum()
+             * 应收利润(应收-支出) = 应收金额 - 收款退还 - 当前总支出
+             * 已收利润(已收-支出) = 已收金额 - 收款退还 - 当前总支出
+             * 
+             */
+
             #region  参数验证
             if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
             if (_dto.PageId < 1) _dto.PageId = 38; //团组报表页面Id
@@ -205,19 +215,19 @@ namespace OASystem.API.Controllers
                  */
                 decimal exTotalAmount = 0.00M;
                 string _ecSql = string.Format(@"Select gec.Id As GECId,gec.DiId As GECDiId,gec.PriceName,ccp.PayMoney,sd1.Name As PaymentCurrency,
-                                                ccp.RMBPrice As CNYPrice,ccp.DayRate,ccp.Payee,ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,
-                                                sd3.Name As CardType,ccp.IsPay,u.CnName As Applicant
-                                                From  Fin_GroupExtraCost gec
-                                                Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 81 And gec.Id = ccp.CId
+													   ccp.RMBPrice As CNYPrice,ccp.DayRate,ccp.Payee,ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,
+													   sd3.Name As CardType,ccp.IsPay,u.CnName As Applicant
+												From OA2023DB.dbo.Fin_GroupExtraCost gec
+												Left Join Grp_CreditCardPayment ccp On gec.Id = ccp.CId
                                                 Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
                                                 Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id 
                                                 Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
                                                 Left Join Sys_Users u On ccp.CreateUserId = u.Id
-                                                Where gec.IsDel = 0 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 And  gec.DiId = {0}",_dto.DiId);
+												Where ccp.IsDel = 0 And ccp.CTable = 1015 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 And ccp.DiId = {0}", _dto.DiId);
 
                 List<Gsd_ExtraCostsView> _ExtraCostsViews = await _sqlSugar.SqlQueryable<Gsd_ExtraCostsView>(_ecSql).ToListAsync();
 
-                #region 模拟数据
+                #region 超支费用 - 模拟数据
 
                 //if (_ExtraCostsViews.Count < 1)
                 //{
@@ -326,7 +336,7 @@ namespace OASystem.API.Controllers
                     _promView.Add(gsd_PaymentRefund);
                 }
 
-                #region 模拟数据
+                #region 收款退还 - 模拟数据
 
                 //if (_promView.Count < 1)
                 //{
@@ -720,7 +730,7 @@ namespace OASystem.API.Controllers
                 _geView.GroupVisaFeeStr = string.Format(@"人民币总费用:{0} CNY", VisaCNYTotalPirce.ConvertToDecimal1());
                 #endregion
 
-                #region 邀请/公务活动费用  CTable = 81
+                #region 邀请/公务活动  CTable = 81
 
                 List<GroupInvitationalFeeView> groupInvitationalFeeViews = new List<GroupInvitationalFeeView>();
                 string groupInvitationalFeeSql = string.Format(@"Select ioa.Id As IOAId,ioa.DiId As IOADiId,ioa.InviterArea,ioa.Inviter,ioa.InviteTime,
@@ -742,7 +752,7 @@ namespace OASystem.API.Controllers
 
                 groupInvitationalFeeViews = await _sqlSugar.SqlQueryable<GroupInvitationalFeeView>(groupInvitationalFeeSql).ToListAsync();
 
-                #region 模拟数据
+                #region 邀请/公务活动 - 模拟数据
                 //if (groupInvitationalFeeViews.Count < 1)
                 //{
                 //    groupInvitationalFeeViews.Add(new GroupInvitationalFeeView()
@@ -914,7 +924,7 @@ namespace OASystem.API.Controllers
                                                              Where dp.IsDel = 0 And ccp.IsAuditGM = 1 And ccp.IsPay = 1 And dp.Diid = {0}",_dto.DiId);
                 groupDecreaseFeeViews = await _sqlSugar.SqlQueryable<GroupDecreaseFeeView>(groupDecreaseFeeSql).ToListAsync();
 
-                #region 模拟数据
+                #region 保险费用 - 模拟数据
 
                 //if (groupDecreaseFeeViews.Count < 1)
                 //{
@@ -972,21 +982,33 @@ namespace OASystem.API.Controllers
                 _view.GroupExpenditure = _geView;
                 #endregion
 
+                /* 
+                 * 团组报表计算方式
+                 * 当前总支出 = 团组支出.Sum() + 超支费用.Sum()
+                 * 应收金额 = 应收表.Sum()
+                 * 已收金额 = 已收表.Sum()
+                 * 应收利润(应收-支出) = 应收金额 - 收款退还 - 当前总支出
+                 * 已收利润(已收-支出) = 已收金额 - 收款退还 - 当前总支出
+                 * 
+                 */
                 decimal _totalExpenditure = 0.00M; //总支出
                 decimal _amountReceivable = 0.00M; //应收金额
                 decimal _amountReceived = 0.00M;   //已收金额
-                decimal _profit = 0.00M;           //利润
+                decimal _receivableProfit = 0.00M; //应收利润
+                decimal _receivedProfit = 0.00M;   //已收利润
                 _totalExpenditure = HotelCNYTotalPrice + CTGGRCNYTotalPrice + AirCNYTotalPrice + VisaCNYTotalPirce + InvitationalCNYTotalPrice + 
                                     InsuranceCNYTotalPrice + DecreaseCNYTotalPrice + exTotalAmount;
                 _amountReceivable = frTotalAmount;
                 _amountReceived = prTotalAmount;
-                _profit = _amountReceived - _totalExpenditure;
-                _view.FeeTotalStr = string.Format(@"<span>
-                                                    <span>当前总支出:{0} CNY</span> 
-                                                    <span style='padding-left:10px;color: Green;'>应收金额:{1} CNY</span> 
-                                                    <span style='padding-left:10px;color: Green;'>已收金额:{2} CNY</span>
-                                                    <span style='padding-left:10px;color: Green;'>利润(收入-支出):{3} CNY</span>
-                                                    </span>", _totalExpenditure, _amountReceivable, _amountReceived, _profit);
+                _receivableProfit = _amountReceivable - promTotalAmount - _totalExpenditure;
+                _receivedProfit = _amountReceived - promTotalAmount - _totalExpenditure;
+                _view.FeeTotalStr = string.Format(@$"<span>
+                                                    <span>当前总支出:{_totalExpenditure.ToString("#0.00")} CNY</span> 
+                                                    <span style='padding-left:10px;color: Green;'>应收金额:{_amountReceivable.ToString("#0.00")} CNY</span> 
+                                                    <span style='padding-left:10px;color: Green;'>已收金额:{_amountReceived.ToString("#0.00")} CNY</span>
+                                                    <span style='padding-left:10px;color: Green;'>应收利润(应收-支出):{_receivableProfit.ToString("#0.00")} CNY</span>
+                                                    <span style='padding-left:10px;color: Green;'>已收利润(已收-支出):{_receivedProfit.ToString("#0.00")} CNY</span>
+                                                    </span>");
                 return Ok(JsonView(true, "查询成功!", _view));
             }
             else

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

@@ -250,7 +250,7 @@ namespace OASystem.Domain.ViewModels.Statistics
         /// <summary>
         /// 到款时间
         /// </summary>
-        public string? SectionTime { get; set; }
+        public DateTime SectionTime { get; set; }
 
         /// <summary>
         /// 费用金额