|
@@ -2,6 +2,7 @@
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|
|
using NetUV.Core.Handles;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
+using NPOI.SS.Formula.PTG;
|
|
|
using OASystem.API.OAMethodLib;
|
|
|
using OASystem.Domain.AesEncryption;
|
|
|
using OASystem.Domain.Dtos.Statistics;
|
|
@@ -1367,14 +1368,42 @@ ORDER BY
|
|
|
// 获取工作簿中的工作表集合
|
|
|
var worksheets = designer.Workbook.Worksheets;
|
|
|
|
|
|
+ #region 获取sheet,定义datatable,局部变量
|
|
|
+ //签证费用相关
|
|
|
var visaFeeSheet = worksheets["签证费用"];
|
|
|
+ var visaFeeDt = new DataTable($"VisaFeeView");
|
|
|
+ decimal visaCNYTotalCost = 0.00M;
|
|
|
+
|
|
|
+ //邀请费用相关
|
|
|
+ var OAFeeSheet = worksheets["邀请费用"];
|
|
|
+ var OAFeeDt = new DataTable($"OAFeeView");
|
|
|
+ decimal OACNYTotalCost = 0.00M;
|
|
|
+
|
|
|
+ //机票费用相关
|
|
|
+ var airTicketFeeSheet = worksheets["机票费用"];
|
|
|
+ var airTicketFeeDt = new DataTable($"AirTicketFeeView");
|
|
|
+ decimal airTicketCNYTotalCost = 0.00M;
|
|
|
+
|
|
|
+ //保险费用相关
|
|
|
+ var insureFeeSheet = worksheets["保险费用"];
|
|
|
+ var insureFeeDt = new DataTable($"InsureFeeView");
|
|
|
+ decimal insureCNYTotalCost = 0.00M;
|
|
|
+
|
|
|
+ //其他费用相关
|
|
|
+ var otherFeeSheet = worksheets["其他费用"];
|
|
|
+ var otherFeeDt = new DataTable($"OtherFeeView");
|
|
|
+ decimal otherCNYTotalCost = 0.00M;
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region 签证费用
|
|
|
if (visaFeeSheet != null)
|
|
|
{
|
|
|
string groupVisaFeeSql = string.Format(@"Select vi.Id As VisaId,vi.DIId As VisaDiId,vi.VisaClient,ccp.PayMoney,sd1.Name As PayMoneyCurrency,
|
|
|
- ccp.DayRate,ccp.Payee,ccp.AuditGMDate,ccp.OrbitalPrivateTransfer,sd2.Name As PayWay,
|
|
|
- sd3.Name As CardTypeName,ccp.IsPay,u.CnName As Applicant,vi.CreateTime,
|
|
|
- (((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice
|
|
|
+ ccp.DayRate,ccp.Payee,ccp.AuditGMDate,sd2.Name As PaymentModes,sd3.Name As CardTypeName,u.CnName As Applicant,vi.CreateTime,
|
|
|
+ (((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,ccp.ConsumptionDate,
|
|
|
+ Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
|
|
|
+ Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,vi.Remark
|
|
|
From Grp_VisaInfo vi
|
|
|
Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 80 And vi.Id = ccp.CId
|
|
|
Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
|
|
@@ -1383,83 +1412,335 @@ ORDER BY
|
|
|
Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
Where vi.IsDel = 0 {1} And vi.DIId = {0} Order By CreateTime", diId,isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
|
|
|
- var groupVisaFeeViews = _sqlSugar.Queryable<Grp_VisaInfo>()
|
|
|
- .InnerJoin<Grp_CreditCardPayment>((vi, ccp) => ccp.IsDel == 0 && ccp.CTable == 80 && vi.Id == ccp.CId)
|
|
|
- .LeftJoin<Sys_SetData>((vi, ccp,sd1) => ccp.PaymentCurrency == sd1.Id)
|
|
|
- .LeftJoin<Sys_SetData>((vi, ccp, sd1, sd2) => ccp.PayDId == sd2.Id)
|
|
|
- .Where((vi, ccp, sd1) => vi.IsDel == 0 && vi.DIId == diId)
|
|
|
- .WhereIF(isAudit, (vi, ccp, sd1, sd2) => ccp.IsAuditGM == 1)
|
|
|
- .Select((vi, ccp, sd1, sd2) => new {
|
|
|
- //VisaClient = GetVisaClientNames( vi.VisaClient,_clientDatas),
|
|
|
- vi.VisaClient,
|
|
|
- ccp.PayMoney,
|
|
|
- ccp.DayRate,
|
|
|
- Currency = sd1.Name,
|
|
|
- ccp.ConsumptionDate,
|
|
|
- vi.Remark,
|
|
|
- ccp.Payee,
|
|
|
- PaymentModes = sd2.Name,
|
|
|
- CostMark = ccp.OrbitalPrivateTransfer == 0 ? "公转" : "私转",
|
|
|
- PaymentStatus = ccp.IsPay == 0 ? "未付款" :"已付款"
|
|
|
- })
|
|
|
- .ToList();
|
|
|
-
|
|
|
- var visaCNYTotalCost = groupVisaFeeViews.Sum(x => x.PayMoney * x.DayRate);
|
|
|
+ var groupVisaFeeViews = _sqlSugar.SqlQueryable<GroupVisaFeeExcelView>(groupVisaFeeSql).ToList();
|
|
|
+
|
|
|
+ foreach (var item in groupVisaFeeViews)
|
|
|
+ {
|
|
|
+ string names = string.Empty;
|
|
|
+ string visaClients = item.VisaClient;
|
|
|
+ if (!string.IsNullOrEmpty(visaClients))
|
|
|
+ {
|
|
|
+ var clientIds = new string[] { };
|
|
|
+ if (visaClients.Contains(',')) clientIds = visaClients.Split(',');
|
|
|
+ else clientIds = new string[] { visaClients };
|
|
|
+
|
|
|
+ if (clientIds.Length > 0)
|
|
|
+ {
|
|
|
+ var clientIds1 = new List<int>() { };
|
|
|
+ foreach (var clientIdStr in clientIds)
|
|
|
+ {
|
|
|
+ var isInt = int.TryParse(clientIdStr, out int id);
|
|
|
+ if (isInt) clientIds1.Add(id);
|
|
|
+ }
|
|
|
+ if (clientIds1.Count > 0)
|
|
|
+ {
|
|
|
+ var clients = _clientDatas.Where(it => clientIds1.Contains(it.Id)).ToList();
|
|
|
+
|
|
|
+ foreach (var client in clients)
|
|
|
+ {
|
|
|
+ EncryptionProcessor.DecryptProperties(client);
|
|
|
+ names += $"{client.LastName + client.FirstName},";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else names = visaClients;
|
|
|
+ }
|
|
|
+ if (names.Length > 0) names = names.Substring(0, names.Length - 1);
|
|
|
+ item.VisaClient = names;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- var visaFeeDt = CommonFun.ToDataTableArray(groupVisaFeeViews);
|
|
|
+ visaCNYTotalCost = groupVisaFeeViews.Sum(x => x.CNYPrice);
|
|
|
+
|
|
|
+ visaFeeDt = CommonFun.ToDataTableArray(groupVisaFeeViews);
|
|
|
visaFeeDt.TableName = $"VisaFeeView";
|
|
|
- designer.SetDataSource(visaFeeDt);
|
|
|
- designer.SetDataSource("VisaCNYTotalCost", visaCNYTotalCost.ToString("#0.00"));
|
|
|
+
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 邀请费用
|
|
|
+
|
|
|
+ if (OAFeeSheet != null)
|
|
|
+ {
|
|
|
+ string feeSql = string.Format(@"Select ioa.Id As IOAId,ioa.DiId As IOADiId,ioa.InviterArea,ioa.Inviter,CONVERT(DATE, ioa.InviteTime) AS InviteTime,
|
|
|
+ ioa.InviteCost,sd3.Name As InviteCurrency,ioa.SendCost,sd4.Name As SendCurrency,ioa.EventsCost,
|
|
|
+ sd5.Name As EventsCurrency,ioa.TranslateCost,sd6.Name As TranslateCurrency,ccp.PayMoney,
|
|
|
+ sd7.Name As PaymentCurrency,ccp.RMBPrice As CNYPrice,ccp.ConsumptionDate,
|
|
|
+ Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
|
|
|
+ Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,sd2.Name As PaymentModes,
|
|
|
+ ccp.Payee,ioa.Remark,ccp.AuditGMDate,u.CnName As Applicant,ioa.CreateTime
|
|
|
+ From Grp_InvitationOfficialActivities ioa
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 81 And ioa.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 ioa.InviteCurrency = sd3.Id
|
|
|
+ Left Join Sys_SetData sd4 On ioa.SendCurrency = sd4.Id
|
|
|
+ Left Join Sys_SetData sd5 On ioa.EventsCurrency = sd5.Id
|
|
|
+ Left Join Sys_SetData sd6 On ioa.TranslateCurrency = sd6.Id
|
|
|
+ Left Join Sys_SetData sd7 On ccp.PaymentCurrency = sd7.Id
|
|
|
+ Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where ioa.IsDel = 0 {1} And ioa.Diid = {0} Order By CreateTime", diId, isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
+
|
|
|
+ var feeViews = _sqlSugar.SqlQueryable<GroupOAFeeExcelView>(feeSql).ToList();
|
|
|
+
|
|
|
+ OACNYTotalCost = feeViews.Sum(x => x.CNYPrice);
|
|
|
+ OAFeeDt = CommonFun.ToDataTableArray(feeViews);
|
|
|
+ OAFeeDt.TableName = $"OAFeeView";
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 机票费用
|
|
|
+
|
|
|
+ if (airTicketFeeSheet != null)
|
|
|
+ {
|
|
|
+ string feeSql = string.Format(@"Select atr.Id As AirId,atr.DIId As AirDiId,atr.FlightsCode,atr.FlightsCity,
|
|
|
+ sd4.Name As AirTypeName,atr.FlightsDate,atr.FlightsTime,atr.ClientName,atr.ClientNum,
|
|
|
+ atr.PriceDescription,ccp.PayMoney,ccp.DayRate,sd1.Name As PayMoneyCurrency,
|
|
|
+ (((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,ccp.ConsumptionDate,
|
|
|
+ ccp.Payee,Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
|
|
|
+ Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,sd2.Name As PaymentModes,
|
|
|
+ sd3.Name As CardType,ccp.AuditGMDate,u.CnName As Applicant,atr.CreateTime,atr.Remark
|
|
|
+ From Grp_AirTicketReservations atr
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 85 And atr.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_SetData sd4 On atr.CType = sd4.Id
|
|
|
+ Left Join Sys_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where atr.IsDel = 0 {1} And atr.DiId = {0} Order By CreateTime", diId, isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
+
|
|
|
+ var feeViews = _sqlSugar.SqlQueryable<GroupAirTicketExcelView>(feeSql).ToList();
|
|
|
+
|
|
|
+ airTicketCNYTotalCost = feeViews.Sum(x => x.CNYPrice);
|
|
|
+ airTicketFeeDt = CommonFun.ToDataTableArray(feeViews);
|
|
|
+ airTicketFeeDt.TableName = $"AirTicketFeeView";
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 保险费用
|
|
|
+
|
|
|
+ if (insureFeeSheet != null)
|
|
|
+ {
|
|
|
+ string feeSql = string.Format(@"Select ic.Id As InsuranceId,ic.Diid As InsuranceDiId,ClientName,ccp.PayMoney,
|
|
|
+ sd1.Name As PayMoneyCurrency,ccp.DayRate,ccp.PayMoney * ccp.DayRate As CNYPrice,ccp.ConsumptionDate,
|
|
|
+ Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
|
|
|
+ Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,sd2.Name As PaymentModes,
|
|
|
+ ccp.Payee,ccp.AuditGMDate,u.CnName As Applicant,ic.CreateTime,ic.Remark
|
|
|
+ From Grp_Customers ic
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 82 And ic.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_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where ic.IsDel = 0 {1} And ic.DiId = {0} Order By CreateTime", diId, isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
+
|
|
|
+ var feeViews = _sqlSugar.SqlQueryable<GroupInsureExcelView>(feeSql).ToList();
|
|
|
+
|
|
|
+ foreach (var item in feeViews)
|
|
|
+ {
|
|
|
+ string itemClientName = "";
|
|
|
+ string insClients = item.ClientName;
|
|
|
+ if (!string.IsNullOrEmpty(insClients))
|
|
|
+ {
|
|
|
+ string[] clientIds = new string[] { };
|
|
|
+ if (insClients.Contains(',')) clientIds = insClients.Split(',');
|
|
|
+ else clientIds = new string[] { insClients };
|
|
|
+
|
|
|
+ if (clientIds.Length > 0)
|
|
|
+ {
|
|
|
+ List<int> output = new List<int>();
|
|
|
+ foreach (var clientId in clientIds)
|
|
|
+ if (int.TryParse(clientId, out int id))
|
|
|
+ output.Add(id);
|
|
|
+
|
|
|
+ if (output.Count > 0)
|
|
|
+ {
|
|
|
+ var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList();
|
|
|
+
|
|
|
+ foreach (var client in clients)
|
|
|
+ {
|
|
|
+ EncryptionProcessor.DecryptProperties(client);
|
|
|
+ itemClientName += $"{client.LastName + client.FirstName},";
|
|
|
+ }
|
|
|
+ if (itemClientName.Length > 0)
|
|
|
+ {
|
|
|
+ itemClientName = itemClientName.Substring(0, itemClientName.Length - 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else itemClientName = insClients;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ item.ClientName = itemClientName;
|
|
|
+ }
|
|
|
+
|
|
|
+ insureCNYTotalCost = feeViews.Sum(x => x.CNYPrice);
|
|
|
+ insureFeeDt = CommonFun.ToDataTableArray(feeViews);
|
|
|
+ insureFeeDt.TableName = $"InsureFeeView";
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 其他费用
|
|
|
+
|
|
|
+ if (insureFeeSheet != null)
|
|
|
+ {
|
|
|
+ string feeSql = string.Format(@"Select dp.Id As DPId,dp.DiId As DPDiId,dp.PriceName,ccp.PayMoney,sd1.Name As PayMoneyCurrency,
|
|
|
+ ccp.DayRate,(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,ccp.ConsumptionDate,
|
|
|
+ Case When ccp.OrbitalPrivateTransfer = 0 Then '公转' Else '私转' End As CostMark,
|
|
|
+ Case When ccp.IsPay = 0 Then '未付款' Else '已付款' End As IsPay,sd2.Name As PaymentModes,
|
|
|
+ ccp.Payee,ccp.AuditGMDate,u.CnName As Applicant,dp.CreateTime,dp.Remark
|
|
|
+ From Grp_DecreasePayments dp
|
|
|
+ Left Join Grp_CreditCardPayment ccp On ccp.isdel = 0 And ccp.CTable = 98 And dp.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_Users u On ccp.CreateUserId = u.Id
|
|
|
+ Where dp.IsDel = 0 And ccp.Ctable = 98 {1} And dp.Diid = {0}
|
|
|
+ Order By CreateTime", diId, isAudit ? "And ccp.IsAuditGM = 1" : " ");
|
|
|
+
|
|
|
+ var feeViews = _sqlSugar.SqlQueryable<GroupOtherFeeExcelView>(feeSql).ToList();
|
|
|
+
|
|
|
+ otherCNYTotalCost = feeViews.Sum(x => x.CNYPrice);
|
|
|
+ otherFeeDt = CommonFun.ToDataTableArray(feeViews);
|
|
|
+ otherFeeDt.TableName = $"OtherFeeView";
|
|
|
}
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
+ #region 统一填充数据源
|
|
|
designer.SetDataSource("GroupNo", groupNo);
|
|
|
designer.SetDataSource("GroupName", groupName);
|
|
|
designer.SetDataSource("Lister", lister);
|
|
|
- designer.Process();
|
|
|
- //文件名
|
|
|
- string fileName = $"{groupName}[{groupNo}]_团组费用清单{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
|
|
|
- designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + "GroupStatement/" + fileName);
|
|
|
- string url = AppSettingsHelper.Get("ExcelBaseUrl") + "Office/Excel/GroupStatement/" + fileName;
|
|
|
- return Ok(JsonView(true, "成功", url));
|
|
|
- }
|
|
|
|
|
|
- private string GetVisaClientNames(string nameStr, List<Crm_DeleClient> _clientDatas)
|
|
|
- {
|
|
|
- string names = string.Empty;
|
|
|
+ //签证
|
|
|
+ designer.SetDataSource(visaFeeDt);
|
|
|
+ designer.SetDataSource("VisaCNYTotalCost", $"{visaCNYTotalCost.ToString("#0.00")} CNY");
|
|
|
+ //商邀
|
|
|
+ designer.SetDataSource(OAFeeDt);
|
|
|
+ designer.SetDataSource("OACNYTotalCost", $"{OACNYTotalCost.ToString("#0.00")} CNY");
|
|
|
+ //机票
|
|
|
+ designer.SetDataSource(airTicketFeeDt);
|
|
|
+ designer.SetDataSource("AirTicketCNYTotalCost", $"{airTicketCNYTotalCost.ToString("#0.00")} CNY");
|
|
|
+ //保险
|
|
|
+ designer.SetDataSource(insureFeeDt);
|
|
|
+ designer.SetDataSource("InsureCNYTotalCost", $"{insureCNYTotalCost.ToString("#0.00")} CNY");
|
|
|
+ //其他费用
|
|
|
+ designer.SetDataSource(otherFeeDt);
|
|
|
+ designer.SetDataSource("OtherCNYTotalCost", $"{otherCNYTotalCost.ToString("#0.00")} CNY");
|
|
|
+
|
|
|
+ designer.Process();
|
|
|
|
|
|
- string visaClients = nameStr;
|
|
|
- if (!string.IsNullOrEmpty(visaClients))
|
|
|
+ #region 单元格样式设置 未付款设置为红色
|
|
|
+ /*
|
|
|
+ * 设置单元格样式
|
|
|
+ */
|
|
|
+ //背景颜色
|
|
|
+ Style style = designer.Workbook.CreateStyle();
|
|
|
+ style.ForegroundColor = System.Drawing.Color.Red;
|
|
|
+ style.Pattern = BackgroundType.Solid;
|
|
|
+ //字体
|
|
|
+ style.Font.Name = "微软雅黑"; // 字体名称
|
|
|
+ style.Font.Size = 10; // 字体大小
|
|
|
+ style.Font.Color = System.Drawing.Color.White; // 字体颜色
|
|
|
+
|
|
|
+ #region 签证费用单元格
|
|
|
+ for (int i = 0; i < visaFeeDt.Rows.Count; i++)
|
|
|
{
|
|
|
- var clientIds = new string[] { };
|
|
|
- if (visaClients.Contains(',')) clientIds = visaClients.Split(',');
|
|
|
- else clientIds = new string[] { visaClients };
|
|
|
+ var isPayStr = visaFeeDt.Rows[i]["IsPay"].ToString();
|
|
|
+ if (string.IsNullOrEmpty(isPayStr)) break;
|
|
|
+
|
|
|
+ if (isPayStr.Equals("未付款"))
|
|
|
+ {
|
|
|
+ var excelIndex = 6 + i;
|
|
|
+
|
|
|
+ if (visaFeeSheet != null)
|
|
|
+ {
|
|
|
+ Aspose.Cells.Range range = visaFeeSheet.Cells.CreateRange($"A{excelIndex}", $"I{excelIndex}");
|
|
|
+ range.ApplyStyle(style, new StyleFlag() { CellShading = true, Font = true });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
|
|
|
- if (clientIds.Length > 0)
|
|
|
+ #region 商邀费用单元格
|
|
|
+ for (int i = 0; i < OAFeeDt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ var isPayStr = OAFeeDt.Rows[i]["IsPay"].ToString();
|
|
|
+ if (string.IsNullOrEmpty(isPayStr)) break;
|
|
|
+ if (isPayStr.Equals("未付款"))
|
|
|
{
|
|
|
- var clientIds1 = new List<int>() { };
|
|
|
- foreach (var clientIdStr in clientIds)
|
|
|
+ var excelIndex = 6 + i;
|
|
|
+
|
|
|
+ if (OAFeeSheet != null)
|
|
|
{
|
|
|
- var isInt = int.TryParse(clientIdStr, out int id);
|
|
|
- if (isInt) clientIds1.Add(id);
|
|
|
+ Aspose.Cells.Range range = OAFeeSheet.Cells.CreateRange($"A{excelIndex}", $"R{excelIndex}");
|
|
|
+ range.ApplyStyle(style, new StyleFlag() { CellShading = true, Font = true });
|
|
|
}
|
|
|
- if (clientIds1.Count > 0)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 机票费用单元格
|
|
|
+ for (int i = 0; i < airTicketFeeDt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ var isPayStr = airTicketFeeDt.Rows[i]["IsPay"].ToString();
|
|
|
+ if (string.IsNullOrEmpty(isPayStr)) break;
|
|
|
+
|
|
|
+ if (isPayStr.Equals("未付款"))
|
|
|
+ {
|
|
|
+ var excelIndex = 6 + i;
|
|
|
+ if (airTicketFeeSheet != null)
|
|
|
{
|
|
|
- var clients = _clientDatas.Where(it => clientIds1.Contains(it.Id)).ToList();
|
|
|
+ Aspose.Cells.Range range = airTicketFeeSheet.Cells.CreateRange($"A{excelIndex}", $"M{excelIndex}");
|
|
|
+ range.ApplyStyle(style, new StyleFlag() { CellShading = true, Font = true });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
|
|
|
- foreach (var client in clients)
|
|
|
- {
|
|
|
- EncryptionProcessor.DecryptProperties(client);
|
|
|
- names += $"{client.LastName + client.FirstName},";
|
|
|
- }
|
|
|
+ #region 保险费用单元格
|
|
|
+ for (int i = 0; i < insureFeeDt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ var isPayStr = insureFeeDt.Rows[i]["IsPay"].ToString();
|
|
|
+ if (string.IsNullOrEmpty(isPayStr)) break;
|
|
|
+
|
|
|
+ if (isPayStr.Equals("未付款"))
|
|
|
+ {
|
|
|
+ var excelIndex = 6 + i;
|
|
|
+ if (insureFeeSheet != null)
|
|
|
+ {
|
|
|
+ Aspose.Cells.Range range = insureFeeSheet.Cells.CreateRange($"A{excelIndex}", $"I{excelIndex}");
|
|
|
+ range.ApplyStyle(style, new StyleFlag() { CellShading = true, Font = true });
|
|
|
}
|
|
|
- else names = visaClients;
|
|
|
}
|
|
|
}
|
|
|
+ #endregion
|
|
|
|
|
|
- if (names.Length > 0) names = names.Substring(0, names.Length - 1);
|
|
|
+ #region 其他费用单元格
|
|
|
+ for (int i = 0; i < otherFeeDt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ var isPayStr = otherFeeDt.Rows[i]["IsPay"].ToString();
|
|
|
+ if (string.IsNullOrEmpty(isPayStr)) break;
|
|
|
+
|
|
|
+ if (isPayStr.Equals("未付款"))
|
|
|
+ {
|
|
|
+ var excelIndex = 6 + i;
|
|
|
+ if (otherFeeSheet != null)
|
|
|
+ {
|
|
|
+ Aspose.Cells.Range range = otherFeeSheet.Cells.CreateRange($"A{excelIndex}", $"J{excelIndex}");
|
|
|
+ range.ApplyStyle(style, new StyleFlag() { CellShading = true, Font = true });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ #endregion
|
|
|
+ #endregion
|
|
|
|
|
|
- return names;
|
|
|
+ //文件名
|
|
|
+ string fileName = $"{groupName}[{groupNo}]_团组费用清单{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
|
|
|
+ designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + "GroupStatement/" + fileName);
|
|
|
+ string url = AppSettingsHelper.Get("ExcelBaseUrl") + "Office/Excel/GroupStatement/" + fileName;
|
|
|
+ return Ok(JsonView(true, "成功", url));
|
|
|
}
|
|
|
|
|
|
#endregion
|