From 3308d397074aa55d08ed551264fd9814d4e30341 Mon Sep 17 00:00:00 2001 From: liqionghai <1> Date: Wed, 3 Sep 2025 09:53:37 +0800 Subject: [PATCH] 1 --- .../AccountsReceivable/LiteVersionPlugIn.cs | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Pilot.Report.Exploitation/AccountsReceivable/LiteVersionPlugIn.cs b/Pilot.Report.Exploitation/AccountsReceivable/LiteVersionPlugIn.cs index 8b9a7a8..cc5e5e3 100644 --- a/Pilot.Report.Exploitation/AccountsReceivable/LiteVersionPlugIn.cs +++ b/Pilot.Report.Exploitation/AccountsReceivable/LiteVersionPlugIn.cs @@ -43,7 +43,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable string F_SFYJKH = rptTitles.FirstOrDefault(a => a.TitleKey == "F_SFYJKH").TitleValue.ToString(); //string FPath = "应收账款对账单【简易版】.xlsx"; - string FPath = string.Format("{0}-{1}-应收账款对账单.xlsx", DateTime.Now.ToString("yyyyMMdd"), fClient); + string FPath = string.Format("{0}-{1}-应收账款对账单.xlsx", string.IsNullOrWhiteSpace(fDate) ? DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") : fDate, fClient); // 在临时文件目录,生成一个完整的文件名: C:\Program Files\Kingdee\K3Cloud\WebSite\...\JD.xls string filePath = PathUtils.GetPhysicalPath(KeyConst.TEMPFILEPATH, Path.GetFileName(FPath)); @@ -93,6 +93,8 @@ namespace Pilot.Report.Exploitation.AccountsReceivable //获取工作簿中的第一个工作表(索引为0) ISheet sheet = workbook.GetSheetAt(0); + //冻结该工作表至13行 + sheet.CreateFreezePane(0, 13); #endregion @@ -279,7 +281,10 @@ namespace Pilot.Report.Exploitation.AccountsReceivable //将新创建或获取的单元格的值修改 cell22.SetCellValue(""); var YFHpriceSumZW = ToChineseNumber(YFHpriceSum, Context); - cell3.SetCellValue("贵公司截至 " + (string.IsNullOrWhiteSpace(fDate) ? DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") : fDate) + " 共欠我公司货款金额为:" + YFHpriceSum.ToString("N") + "元(大写:" + YFHpriceSumZW + ")"); + + string CommonDate = string.IsNullOrWhiteSpace(fDate) ? DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") : fDate; + + cell3.SetCellValue("贵公司截至 " + CommonDate + " 共欠我公司货款金额为:" + YFHpriceSum.ToString("N") + "元(大写:" + YFHpriceSumZW + ")"); //将新创建或获取的单元格的值修改 cell.SetCellValue("尊敬的 " + fClient + " 客户您好,我公司已根据合同/订单的要求向贵公司交付相关产品并请验收确认,鉴于我公司对贵公司已通知发货部分的交付义务已完成,"); cell2.SetCellValue(fClient); @@ -320,10 +325,16 @@ namespace Pilot.Report.Exploitation.AccountsReceivable // rowi = sheet.CreateRow(j + list.Count - 1); // j = 12; //} - - ICell c1 = rowi.CreateCell(0); c1.SetCellValue(list[i]["Number"].ToString()); c1.CellStyle = cellStyle3; + string Number = list[i]["Number"].ToString(); + string CONTRACTNUMBER = list[i]["CONTRACTNUMBER"].ToString(); + if (list[i]["Number"].ToString() == "待核销") + { + Number = ""; + CONTRACTNUMBER = list[i]["Number"].ToString(); + } + ICell c1 = rowi.CreateCell(0); c1.SetCellValue(Number); c1.CellStyle = cellStyle3; ICell c2 = rowi.CreateCell(1); c2.SetCellValue(""+date+""); c2.CellStyle = cellStyle2; - ICell c3 = rowi.CreateCell(2); c3.SetCellValue(list[i]["CONTRACTNUMBER"].ToString()); c3.CellStyle = cellStyle2; + ICell c3 = rowi.CreateCell(2); c3.SetCellValue(CONTRACTNUMBER); c3.CellStyle = cellStyle2; ICell c4 = rowi.CreateCell(3); c4.SetCellValue(list[i]["ProjectName"].ToString()); c4.CellStyle = cellStyle2; ICell c5 = rowi.CreateCell(4); c5.SetCellValue(Convert.ToDouble(OrderAmount)); c5.CellStyle = cellStyle; ICell c6 = rowi.CreateCell(5); c6.SetCellValue(Convert.ToDouble(ShipmentsAmount )); c6.CellStyle = cellStyle; @@ -561,7 +572,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable //移除第二个工作表 workbook.RemoveSheetAt(1); //重命名工作表 - workbook.SetSheetName(0,string.Format("简易版{0}",DateTime.Now.ToString("yyyy-MM-dd"))); + workbook.SetSheetName(0,string.Format("简易版{0}", CommonDate)); #endregion #region Excel代码2