|
@@ -9,8 +9,10 @@ using MathNet.Numerics.Distributions;
|
|
|
using Microsoft.EntityFrameworkCore.Query.Internal;
|
|
|
using NPOI.HPSF;
|
|
|
using NPOI.HSSF.UserModel;
|
|
|
+using NPOI.SS.Formula.Functions;
|
|
|
using NPOI.SS.Formula.PTG;
|
|
|
using NPOI.SS.UserModel;
|
|
|
+using NPOI.Util;
|
|
|
using NPOI.XSSF.UserModel;
|
|
|
using OASystem.API.OAMethodLib;
|
|
|
using OASystem.API.OAMethodLib.File;
|
|
@@ -1320,6 +1322,133 @@ namespace OASystem.API.Controllers
|
|
|
//将此段落加到单元格内
|
|
|
lshCell.AppendChild(p);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 已收账单
|
|
|
+ /// 提示导入出入境报价费用
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="groupId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostReceivablesImportFee(int groupId)
|
|
|
+ {
|
|
|
+ if (groupId < 1) return Ok(JsonView(false, "请传入有效的GroupId参数!"));
|
|
|
+
|
|
|
+ var _EnterExitCosts =await _sqlSugar.Queryable<Grp_EnterExitCost>()
|
|
|
+ .Where(it => it.IsDel == 0 && it.DiId == groupId)
|
|
|
+ .FirstAsync();
|
|
|
+ var _DayAndCosts =await _sqlSugar.Queryable<Grp_DayAndCost>()
|
|
|
+ .Where(it => it.IsDel == 0 && it.DiId == groupId)
|
|
|
+ .ToListAsync();
|
|
|
+ if (_EnterExitCosts == null) return Ok(JsonView(false, "该团组未填写出入境费用;"));
|
|
|
+
|
|
|
+ //数据源
|
|
|
+ var stayDatas = _DayAndCosts.Where(it => it.Type == 1).ToList(); //住宿费
|
|
|
+ var mealDatas = _DayAndCosts.Where(it => it.Type == 2).ToList(); //伙食费
|
|
|
+ var miscellaneousDatas = _DayAndCosts.Where(it => it.Type == 3).ToList(); //公杂费
|
|
|
+ var tainDatas = _DayAndCosts.Where(it => it.Type == 4).ToList(); //培训费
|
|
|
+
|
|
|
+ //筛选 陪同人员 = 1
|
|
|
+ var groupClientList = await _sqlSugar.Queryable<Grp_TourClientList>()
|
|
|
+ .LeftJoin<Crm_DeleClient>((tcl, dc) => tcl.ClientId == dc.Id)
|
|
|
+ .LeftJoin<Crm_CustomerCompany>((tcl, dc, cc) => dc.CrmCompanyId == cc.Id)
|
|
|
+ .LeftJoin<Sys_SetData>((tcl, dc, cc, sd) => tcl.ShippingSpaceTypeId == sd.Id)
|
|
|
+ .Where(tcl => tcl.IsDel == 0 &&
|
|
|
+ tcl.DiId == groupId &&
|
|
|
+ tcl.IsAccompany == 1
|
|
|
+ )
|
|
|
+ .Select((tcl, dc, cc, sd) => new
|
|
|
+ {
|
|
|
+ DiId = tcl.DiId,
|
|
|
+ CompanyId = cc.Id,
|
|
|
+ CompanyName = cc.CompanyFullName,
|
|
|
+ ClienId = dc.Id,
|
|
|
+ ClientName = dc.FirstName + dc.LastName,
|
|
|
+ SpaceId = tcl.ShippingSpaceTypeId,
|
|
|
+ SpaceName = sd.Name
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+ if (groupClientList.Count < 1) return Ok(JsonView(false, "该团组未填写接团客户名单;"));
|
|
|
+
|
|
|
+ decimal domesticFeeTotal =0.00M, //境内费用
|
|
|
+ economyClassFeeTotal = 0.00M, //经济舱费用
|
|
|
+ businessClassFeeTotal = 0.00M, //公务舱费用
|
|
|
+ firstClassFeeTotal = 0.00M, //头等舱费用
|
|
|
+ stayFeeTotal = 0.00M, //住宿费
|
|
|
+ mealsFeeTotal = 0.00M, //餐食费
|
|
|
+ miscellaneousFeeTotal = 0.00M, //公杂费
|
|
|
+ tainFeeTotal = 0.00M; //培训费
|
|
|
+
|
|
|
+ //境内费用(其他费用)
|
|
|
+ if (_EnterExitCosts.ChoiceOne == 1) domesticFeeTotal = _EnterExitCosts.InsidePay;
|
|
|
+
|
|
|
+ //住宿费
|
|
|
+ if (_EnterExitCosts.ChoiceThree == 1) stayFeeTotal = stayDatas.Sum(x => x.SubTotal);
|
|
|
+
|
|
|
+ //伙食费
|
|
|
+ if (_EnterExitCosts.ChoiceFour == 1) mealsFeeTotal = mealDatas.Sum(x => x.SubTotal);
|
|
|
+
|
|
|
+ //公杂费
|
|
|
+ if (_EnterExitCosts.ChoiceFive == 1) miscellaneousFeeTotal = miscellaneousDatas.Sum(x => x.SubTotal);
|
|
|
+
|
|
|
+ //培训费
|
|
|
+ if (_EnterExitCosts.ChoiceSix == 1) tainFeeTotal = tainDatas.Sum(x => x.SubTotal);
|
|
|
+
|
|
|
+ decimal otherFeeTotal = domesticFeeTotal + stayFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + tainFeeTotal;
|
|
|
+ //国际旅费合计
|
|
|
+ //经济舱
|
|
|
+ if (_EnterExitCosts.SumJJC == 1) economyClassFeeTotal = _EnterExitCosts.OutsideJJPay + otherFeeTotal;
|
|
|
+ //公务舱
|
|
|
+ if (_EnterExitCosts.SumGWC == 1) businessClassFeeTotal = _EnterExitCosts.OutsideGWPay + otherFeeTotal;
|
|
|
+ //头等舱
|
|
|
+ if (_EnterExitCosts.SumTDC == 1) firstClassFeeTotal = _EnterExitCosts.OutsideTDPay + otherFeeTotal;
|
|
|
+
|
|
|
+ var groupClientListGroup = groupClientList.GroupBy(x => x.CompanyId);
|
|
|
+
|
|
|
+ var _view = new List<ProceedsReceivedNewView>();
|
|
|
+ foreach (var item in groupClientListGroup)
|
|
|
+ {
|
|
|
+ string companyName = item.FirstOrDefault().CompanyName;
|
|
|
+ var airTicketGroup = item.GroupBy(x => x.SpaceId);
|
|
|
+
|
|
|
+ foreach (var airTicket in airTicketGroup)
|
|
|
+ {
|
|
|
+ int quantity = airTicket.Count();
|
|
|
+ if (quantity > 0)
|
|
|
+ {
|
|
|
+ decimal price = 0.00M;
|
|
|
+ string spaceName = airTicket.FirstOrDefault()?.SpaceName ?? string.Empty;
|
|
|
+ if (spaceName.Equals("经济舱")) price = economyClassFeeTotal;
|
|
|
+ else if (spaceName.Equals("公务舱")) price = businessClassFeeTotal;
|
|
|
+ else if (spaceName.Equals("头等舱")) price = firstClassFeeTotal;
|
|
|
+
|
|
|
+ if (price > 0)
|
|
|
+ {
|
|
|
+ decimal itemTotal = price * quantity;
|
|
|
+
|
|
|
+ _view.Add(new ProceedsReceivedNewView()
|
|
|
+ {
|
|
|
+ Id = 0,
|
|
|
+ Diid = groupId,
|
|
|
+ PriceName = $"{companyName}-{spaceName}",
|
|
|
+ Price = price,
|
|
|
+ Count = quantity,
|
|
|
+ Unit = "人",
|
|
|
+ ItemSumPrice = itemTotal,
|
|
|
+ Currency = 836,
|
|
|
+ Rate = 1.0000M,
|
|
|
+ AddingWay = 2,
|
|
|
+ Remark = "由出入境费用导入费用",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "操作成功", _view));
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 已收款项
|