Merge branch 'main' of http://8.130.121.29:3000/TianHua/PiolotTH_ReportFrom into main
This commit is contained in:
commit
a81583fe4b
@ -203,8 +203,8 @@ namespace Pilot.Report.Exploitation.AccountsReceivableStatements
|
||||
}
|
||||
sql += string.Format(@"
|
||||
SELECT
|
||||
ROW_NUMBER() OVER (ORDER BY [FID],OrderAmount desc) AS FIDENTITYID,
|
||||
DENSE_RANK() OVER (ORDER BY [FID] ) AS OUTPUTNUMBER,
|
||||
ROW_NUMBER() OVER (ORDER BY [DATE] DESC,[FID]) AS FIDENTITYID,
|
||||
DENSE_RANK() OVER (ORDER BY [DATE] DESC,[FID] ) AS OUTPUTNUMBER,
|
||||
*
|
||||
INTO {0}
|
||||
FROM YingShouZhanKuanMX_GZTH
|
||||
|
||||
@ -104,17 +104,24 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
// 创建一个单元格样式-------------------------------
|
||||
ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
|
||||
//创建字体格式为Times New Roman,字体大小为10号
|
||||
IFont font1 = workbook.CreateFont();
|
||||
font1.FontName = "Times New Roman";
|
||||
font1.FontHeightInPoints = 10;
|
||||
|
||||
// 设置边框样式
|
||||
cellStyle.BorderTop = BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = BorderStyle.Thin;
|
||||
cellStyle.BorderRight = BorderStyle.Thin;
|
||||
// 设置水平居中对齐
|
||||
cellStyle.Alignment = HorizontalAlignment.Center;
|
||||
cellStyle.Alignment = HorizontalAlignment.Right;
|
||||
// 设置垂直居中对齐
|
||||
cellStyle.VerticalAlignment = VerticalAlignment.Center;
|
||||
//设置数值格式保留两位小数
|
||||
cellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("0.00");
|
||||
cellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0.00");
|
||||
//设置字体和大小
|
||||
cellStyle.SetFont(font1);
|
||||
|
||||
// 创建一个单元格样式---------------------------------
|
||||
ICellStyle cellStyle2 = workbook.CreateCellStyle();
|
||||
@ -127,6 +134,49 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
|
||||
//垂直居中
|
||||
cellStyle2.VerticalAlignment = VerticalAlignment.Center;
|
||||
//设置字体和大小
|
||||
cellStyle2.SetFont(font1);
|
||||
//自动换行
|
||||
cellStyle2.WrapText = true;
|
||||
|
||||
// 创建一个单元格样式---------------------------------
|
||||
ICellStyle cellStyle3 = workbook.CreateCellStyle();
|
||||
|
||||
// 设置边框样式
|
||||
cellStyle3.BorderTop = BorderStyle.Thin;
|
||||
cellStyle3.BorderBottom = BorderStyle.Thin;
|
||||
cellStyle3.BorderLeft = BorderStyle.Thin;
|
||||
cellStyle3.BorderRight = BorderStyle.Thin;
|
||||
|
||||
//垂直居中
|
||||
cellStyle3.VerticalAlignment = VerticalAlignment.Center;
|
||||
// 设置水平右对齐
|
||||
cellStyle3.Alignment = HorizontalAlignment.Center;
|
||||
//设置字体和大小
|
||||
cellStyle3.SetFont(font1);
|
||||
|
||||
|
||||
// 创建一个单元格样式-------------------------------
|
||||
ICellStyle cellStyle4 = workbook.CreateCellStyle();
|
||||
|
||||
// 设置边框样式
|
||||
cellStyle4.BorderTop = BorderStyle.Thin;
|
||||
cellStyle4.BorderBottom = BorderStyle.Thin;
|
||||
cellStyle4.BorderLeft = BorderStyle.Thin;
|
||||
cellStyle4.BorderRight = BorderStyle.Thin;
|
||||
// 设置水平居中对齐
|
||||
cellStyle4.Alignment = HorizontalAlignment.Right;
|
||||
// 设置垂直居中对齐
|
||||
cellStyle4.VerticalAlignment = VerticalAlignment.Center;
|
||||
//设置数值格式保留两位小数
|
||||
cellStyle4.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0.00");
|
||||
// 创建字体并设置为加粗
|
||||
IFont font4 = workbook.CreateFont();
|
||||
font4.FontName = "Times New Roman";
|
||||
font4.FontHeightInPoints = 10;
|
||||
font4.IsBold = true; // 设置字体加粗
|
||||
// 将字体应用到单元格样式
|
||||
cellStyle4.SetFont(font4);
|
||||
|
||||
// 创建单元格样式---------------------------------------
|
||||
ICellStyle style = workbook.CreateCellStyle();
|
||||
@ -140,7 +190,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
// 创建字体并设置为加粗
|
||||
IFont font = workbook.CreateFont();
|
||||
font.IsBold = true; // 设置字体加粗
|
||||
|
||||
font.FontName = "Times New Roman";
|
||||
// 将字体应用到单元格样式
|
||||
style.SetFont(font);
|
||||
|
||||
@ -149,6 +199,8 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
|
||||
// 创建字体并设置为加粗
|
||||
IFont font2 = workbook.CreateFont();
|
||||
font2.FontName = "Times New Roman";
|
||||
font2.FontHeightInPoints = 10;
|
||||
font2.IsBold = true; // 设置字体加粗
|
||||
|
||||
// 将字体应用到单元格样式
|
||||
@ -168,6 +220,8 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
style3.VerticalAlignment = VerticalAlignment.Center;
|
||||
// 创建字体并设置为加粗
|
||||
IFont font3 = workbook.CreateFont();
|
||||
font3.FontName = "Times New Roman";
|
||||
font3.FontHeightInPoints = 10;
|
||||
font3.IsBold = true; // 设置字体加粗
|
||||
// 将字体应用到单元格样式
|
||||
style3.SetFont(font3);
|
||||
@ -186,7 +240,20 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
style4.VerticalAlignment = VerticalAlignment.Center;
|
||||
// 将字体应用到单元格样式
|
||||
style4.SetFont(font3);
|
||||
style4.DataFormat = workbook.CreateDataFormat().GetFormat("0.00");
|
||||
style4.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0.00");
|
||||
|
||||
|
||||
// 创建单元格样式---------------------------------------
|
||||
ICellStyle style5 = workbook.CreateCellStyle();
|
||||
|
||||
// 创建字体并设置为加粗
|
||||
IFont font5 = workbook.CreateFont();
|
||||
font5.FontName = "Times New Roman";
|
||||
font5.FontHeightInPoints = 10;
|
||||
//font5.IsBold = true; // 设置字体加粗
|
||||
|
||||
// 将字体应用到单元格样式
|
||||
style5.SetFont(font5);
|
||||
#endregion
|
||||
|
||||
#region 获取金额汇总数据
|
||||
@ -223,7 +290,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
//将新创建或获取的单元格的值修改
|
||||
cell22.SetCellValue("");
|
||||
var YFHpriceSumZW = ToChineseNumber(YFHpriceSum, Context);
|
||||
cell3.SetCellValue("贵公司截至 " + fDate + " 共欠我公司货款金额为:" + YFHpriceSum + "元(大写:"+ YFHpriceSumZW + ")");
|
||||
cell3.SetCellValue("贵公司截至 " + (string.IsNullOrWhiteSpace(fDate)? DateTime.Now.ToString("yyyy-MM-dd") : fDate) + " 共欠我公司货款金额为:" + YFHpriceSum.ToString("N") + "元(大写:"+ YFHpriceSumZW + ")");
|
||||
//将新创建或获取的单元格的值修改
|
||||
cell.SetCellValue("尊敬的 " + fClient + " 客户您好,我公司已根据合同/订单的要求向贵公司交付相关产品并请验收确认,鉴于我公司对贵公司已通知发货部分的交付义务已完成,");
|
||||
cell2.SetCellValue(fClient);
|
||||
@ -257,10 +324,10 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
continue;
|
||||
}
|
||||
|
||||
string date = string.IsNullOrWhiteSpace(list[i]["DATE"].ToString()) ? "" : list[i]["DATE"].ToString().Split(' ')[0];
|
||||
string ShipmentsDate = string.IsNullOrWhiteSpace(list[i]["ShipmentsDate"].ToString()) ? "" : list[i]["ShipmentsDate"].ToString().Split(' ')[0];
|
||||
string date = string.IsNullOrWhiteSpace(list[i]["DATE"].ToString()) ? "" : Convert.ToDateTime(list[i]["DATE"].ToString().Split(' ')[0]).ToString("yyyy/M/d");
|
||||
string ShipmentsDate = string.IsNullOrWhiteSpace(list[i]["ShipmentsDate"].ToString()) ? "" : string.Join(",",list[i]["ShipmentsDate"].ToString().Split(' ')[0].Split(',').Select(p=>Convert.ToDateTime(p).ToString("yyyy/M/d")).ToList());
|
||||
string PaymentDate = string.IsNullOrWhiteSpace(list[i]["PaymentDate"].ToString()) ? "" : list[i]["PaymentDate"].ToString().Split(' ')[0];
|
||||
string BillingDate = string.IsNullOrWhiteSpace(list[i]["ZPBillingDate"].ToString()) ? "" : list[i]["ZPBillingDate"].ToString().Split(' ')[0];
|
||||
string BillingDate = string.IsNullOrWhiteSpace(list[i]["ZPBillingDate"].ToString()) ? "" : string.Join(",", list[i]["ZPBillingDate"].ToString().Split(' ')[0].Split(',').Select(p => Convert.ToDateTime(p).ToString("yyyy/M/d")).ToList());
|
||||
string ReturnDate = string.IsNullOrWhiteSpace(list[i]["ReturnDate"].ToString()) ? "" : list[i]["ReturnDate"].ToString().Split(' ')[0];
|
||||
|
||||
//BillingDate += string.IsNullOrWhiteSpace(list[i]["PPBillingDate"].ToString()) ? "" : (string.IsNullOrWhiteSpace(BillingDate) ?"":",")+list[i]["PPBillingDate"].ToString().Split(' ')[0];
|
||||
@ -281,24 +348,24 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
{
|
||||
c1.SetCellValue(list[i]["OUTPUTNUMBER"].ToString());
|
||||
}
|
||||
c1.CellStyle = cellStyle;
|
||||
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 c4 = rowi.CreateCell(3); c4.SetCellValue(list[i]["ProjectName"].ToString()); c4.CellStyle = cellStyle2;
|
||||
ICell c5 = rowi.CreateCell(4); c5.SetCellValue(list[i]["SizeModel"].ToString()); c5.CellStyle = cellStyle2;
|
||||
|
||||
ICell c6 = rowi.CreateCell(5); c6.SetCellValue(""); c6.CellStyle = cellStyle; //数量
|
||||
ICell c6 = rowi.CreateCell(5); c6.SetCellValue(""); c6.CellStyle = cellStyle3; //数量
|
||||
if(!string.IsNullOrWhiteSpace(list[i]["FQty"].ToString()))
|
||||
{
|
||||
int FQty = Convert.ToInt32(list[i]["FQty"]);
|
||||
c6.SetCellValue(Convert.ToDouble(FQty)); c6.CellStyle = cellStyle; //数量
|
||||
c6.SetCellValue(Convert.ToDouble(FQty)); c6.CellStyle = cellStyle3; //数量
|
||||
}
|
||||
|
||||
ICell c7 = rowi.CreateCell(6); c7.SetCellValue(""); c7.CellStyle = cellStyle;
|
||||
ICell c7 = rowi.CreateCell(6); c7.SetCellValue(""); c7.CellStyle = cellStyle3;
|
||||
if(!string.IsNullOrWhiteSpace(list[i]["FTaxPrice"].ToString()))
|
||||
{
|
||||
decimal FTaxPrice = Math.Round(Convert.ToDecimal(list[i]["FTaxPrice"]), 2);
|
||||
c7.SetCellValue(Convert.ToDouble(FTaxPrice )); c7.CellStyle = cellStyle;
|
||||
c7.SetCellValue(Convert.ToDouble(FTaxPrice )); c7.CellStyle = cellStyle3;
|
||||
}
|
||||
|
||||
ICell c8 = rowi.CreateCell(7); c8.SetCellValue(""); c8.CellStyle = cellStyle;
|
||||
@ -316,11 +383,11 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
|
||||
}
|
||||
|
||||
ICell c11 = rowi.CreateCell(10); c11.SetCellValue(""); c11.CellStyle = cellStyle;
|
||||
ICell c11 = rowi.CreateCell(10); c11.SetCellValue(""); c11.CellStyle = cellStyle3;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["ShipmentsNum"].ToString()))
|
||||
{
|
||||
int ShipmentsNum = Convert.ToInt32(list[i]["ShipmentsNum"]);
|
||||
c11.SetCellValue(Convert.ToDouble(ShipmentsNum)); c11.CellStyle = cellStyle;
|
||||
c11.SetCellValue(Convert.ToDouble(ShipmentsNum)); c11.CellStyle = cellStyle3;
|
||||
}
|
||||
|
||||
ICell c12 = rowi.CreateCell(11); c12.SetCellValue(""); c12.CellStyle = cellStyle;
|
||||
@ -330,21 +397,21 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
c12.SetCellValue(Convert.ToDouble(ShipmentsAmount)); c12.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c14 = rowi.CreateCell(13); c14.SetCellValue(""); c14.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["ReturnNum"].ToString()))
|
||||
{
|
||||
int ReturnNum = Convert.ToInt32(list[i]["ReturnNum"]);
|
||||
c14.SetCellValue(Convert.ToDouble(ReturnNum)); c14.CellStyle = cellStyle;
|
||||
}
|
||||
//ICell c14 = rowi.CreateCell(13); c14.SetCellValue(""); c14.CellStyle = cellStyle3;
|
||||
//if (!string.IsNullOrWhiteSpace(list[i]["ReturnNum"].ToString()))
|
||||
//{
|
||||
// int ReturnNum = Convert.ToInt32(list[i]["ReturnNum"]);
|
||||
// c14.SetCellValue(Convert.ToDouble(ReturnNum)); c14.CellStyle = cellStyle3;
|
||||
//}
|
||||
|
||||
ICell c15 = rowi.CreateCell(14); c15.SetCellValue(""); c15.CellStyle = cellStyle;
|
||||
ICell c15 = rowi.CreateCell(14 - 2); c15.SetCellValue(""); c15.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["ReturnAmount"].ToString()))
|
||||
{
|
||||
decimal ReturnAmount = Math.Round(Convert.ToDecimal(list[i]["ReturnAmount"]), 2);
|
||||
c15.SetCellValue(Convert.ToDouble(ReturnAmount)); c15.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c19 = rowi.CreateCell(18); c19.SetCellValue(""); c19.CellStyle = cellStyle;
|
||||
ICell c19 = rowi.CreateCell(18 - 3); c19.SetCellValue(""); c19.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["PaymentAmount"].ToString()))
|
||||
{
|
||||
|
||||
@ -352,21 +419,21 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
c19.SetCellValue(Convert.ToDouble(PaymentAmount)); c19.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c20 = rowi.CreateCell(19); c20.SetCellValue(""); c20.CellStyle = cellStyle;
|
||||
ICell c20 = rowi.CreateCell(19 - 3); c20.SetCellValue(""); c20.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["ShippedDebt"].ToString()))
|
||||
{
|
||||
decimal ShippedDebt = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]), 2);
|
||||
c20.SetCellValue(Convert.ToDouble(ShippedDebt)); c20.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c21 = rowi.CreateCell(20); c21.SetCellValue(""); c21.CellStyle = cellStyle;
|
||||
ICell c21 = rowi.CreateCell(20 - 3); c21.SetCellValue(""); c21.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["InvoicedDebt"].ToString()))
|
||||
{
|
||||
decimal InvoicedDebt = Math.Round(Convert.ToDecimal(list[i]["InvoicedDebt"]), 2);
|
||||
c21.SetCellValue(Convert.ToDouble(InvoicedDebt)); c21.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c17 = rowi.CreateCell(16); c17.SetCellValue(""); c17.CellStyle = cellStyle;
|
||||
ICell c17 = rowi.CreateCell(16 - 2); c17.SetCellValue(""); c17.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["BillingAmount"].ToString()))
|
||||
{
|
||||
|
||||
@ -375,11 +442,11 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
}
|
||||
|
||||
ICell c10 = rowi.CreateCell(9); c10.SetCellValue(ShipmentsDate); c10.CellStyle = cellStyle2;//发货日期
|
||||
ICell c13 = rowi.CreateCell(12); c13.SetCellValue(ReturnDate); c13.CellStyle = cellStyle2;//退货日期
|
||||
ICell c16 = rowi.CreateCell(15); c16.SetCellValue(BillingDate); c16.CellStyle = cellStyle2; //开票日期
|
||||
ICell c18 = rowi.CreateCell(17); c18.SetCellValue(PaymentDate); c18.CellStyle = cellStyle2;//回款日期
|
||||
ICell c22 = rowi.CreateCell(21); c22.SetCellValue(list[i]["IsEnded"].ToString()); c22.CellStyle = cellStyle2;
|
||||
ICell c23 = rowi.CreateCell(22); c23.SetCellValue(list[i]["Remark"].ToString()); c23.CellStyle = cellStyle2;
|
||||
//ICell c13 = rowi.CreateCell(12); c13.SetCellValue(ReturnDate); c13.CellStyle = cellStyle2;//退货日期
|
||||
ICell c16 = rowi.CreateCell(15 - 2); c16.SetCellValue(BillingDate); c16.CellStyle = cellStyle2; //开票日期
|
||||
//ICell c18 = rowi.CreateCell(17); c18.SetCellValue(PaymentDate); c18.CellStyle = cellStyle2;//回款日期
|
||||
ICell c22 = rowi.CreateCell(21 - 3); c22.SetCellValue(list[i]["IsEnded"].ToString()); c22.CellStyle = cellStyle3;
|
||||
//ICell c23 = rowi.CreateCell(22 - 3); c23.SetCellValue(list[i]["Remark"].ToString()); c23.CellStyle = cellStyle2;
|
||||
n++;
|
||||
|
||||
//根据订单号分组合并单元格
|
||||
@ -398,17 +465,17 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
CellRangeAddress cellRangeAddress9 = new CellRangeAddress(GroupIndex, j + i - k, 9, 9);
|
||||
|
||||
CellRangeAddress cellRangeAddress11 = new CellRangeAddress(GroupIndex, j + i - k, 11, 11);
|
||||
CellRangeAddress cellRangeAddress12 = new CellRangeAddress(GroupIndex, j + i - k, 12, 12);
|
||||
CellRangeAddress cellRangeAddress14 = new CellRangeAddress(GroupIndex, j + i - k, 14, 14);
|
||||
//CellRangeAddress cellRangeAddress12 = new CellRangeAddress(GroupIndex, j + i - k, 12, 12);
|
||||
CellRangeAddress cellRangeAddress14 = new CellRangeAddress(GroupIndex, j + i - k, 14-2, 14-2);
|
||||
|
||||
CellRangeAddress cellRangeAddress15 = new CellRangeAddress(GroupIndex, j + i - k, 15, 15);
|
||||
CellRangeAddress cellRangeAddress16 = new CellRangeAddress(GroupIndex, j + i - k, 16, 16);
|
||||
CellRangeAddress cellRangeAddress17 = new CellRangeAddress(GroupIndex, j + i - k, 17, 17);
|
||||
CellRangeAddress cellRangeAddress18 = new CellRangeAddress(GroupIndex, j + i - k, 18, 18);
|
||||
CellRangeAddress cellRangeAddress19 = new CellRangeAddress(GroupIndex, j + i - k, 19, 19);
|
||||
CellRangeAddress cellRangeAddress20 = new CellRangeAddress(GroupIndex, j + i - k, 20, 20);
|
||||
CellRangeAddress cellRangeAddress21 = new CellRangeAddress(GroupIndex, j + i - k, 21, 21);
|
||||
CellRangeAddress cellRangeAddress22 = new CellRangeAddress(GroupIndex, j + i - k, 22, 22);
|
||||
CellRangeAddress cellRangeAddress15 = new CellRangeAddress(GroupIndex, j + i - k, 15 - 2, 15 - 2);
|
||||
CellRangeAddress cellRangeAddress16 = new CellRangeAddress(GroupIndex, j + i - k, 16 - 2, 16 - 2);
|
||||
//CellRangeAddress cellRangeAddress17 = new CellRangeAddress(GroupIndex, j + i - k, 17, 17);
|
||||
CellRangeAddress cellRangeAddress18 = new CellRangeAddress(GroupIndex, j + i - k, 18-3, 18 - 3);
|
||||
CellRangeAddress cellRangeAddress19 = new CellRangeAddress(GroupIndex, j + i - k, 19 - 3, 19 - 3);
|
||||
CellRangeAddress cellRangeAddress20 = new CellRangeAddress(GroupIndex, j + i - k, 20 - 3, 20 - 3);
|
||||
CellRangeAddress cellRangeAddress21 = new CellRangeAddress(GroupIndex, j + i - k, 21 - 3, 21 - 3);
|
||||
CellRangeAddress cellRangeAddress22 = new CellRangeAddress(GroupIndex, j + i - k, 22 - 3, 22 - 3);
|
||||
|
||||
// 检查并移除重叠的合并区域
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress0);
|
||||
@ -420,12 +487,12 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress9);
|
||||
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress11);
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress12);
|
||||
//RemoveOverlappingMergedRegions(sheet, cellRangeAddress12);
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress14);
|
||||
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress15);
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress16);
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress17);
|
||||
//RemoveOverlappingMergedRegions(sheet, cellRangeAddress17);
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress18);
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress19);
|
||||
RemoveOverlappingMergedRegions(sheet, cellRangeAddress20);
|
||||
@ -442,12 +509,12 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
sheet.AddMergedRegion(cellRangeAddress9);
|
||||
|
||||
sheet.AddMergedRegion(cellRangeAddress11);
|
||||
sheet.AddMergedRegion(cellRangeAddress12);
|
||||
//sheet.AddMergedRegion(cellRangeAddress12);
|
||||
sheet.AddMergedRegion(cellRangeAddress14);
|
||||
|
||||
sheet.AddMergedRegion(cellRangeAddress15);
|
||||
sheet.AddMergedRegion(cellRangeAddress16);
|
||||
sheet.AddMergedRegion(cellRangeAddress17);
|
||||
//sheet.AddMergedRegion(cellRangeAddress17);
|
||||
sheet.AddMergedRegion(cellRangeAddress18);
|
||||
sheet.AddMergedRegion(cellRangeAddress19);
|
||||
sheet.AddMergedRegion(cellRangeAddress20);
|
||||
@ -472,22 +539,22 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
c5.CellStyle = style3;
|
||||
c6.CellStyle = style3;
|
||||
c7.CellStyle = style3;
|
||||
c8.CellStyle = style3;
|
||||
c9.CellStyle = style3;
|
||||
c8.CellStyle = cellStyle4;
|
||||
c9.CellStyle = cellStyle4;
|
||||
c10.CellStyle = style3;
|
||||
c11.CellStyle = style3;
|
||||
c12.CellStyle = style3;
|
||||
c13.CellStyle = style3;
|
||||
c14.CellStyle = style3;
|
||||
c15.CellStyle = style3;
|
||||
c12.CellStyle = cellStyle4;
|
||||
//c13.CellStyle = style3;
|
||||
//c14.CellStyle = style3;
|
||||
c15.CellStyle = cellStyle4;
|
||||
c16.CellStyle = style3;
|
||||
c17.CellStyle = style3;
|
||||
c18.CellStyle = style3;
|
||||
c19.CellStyle = style3;
|
||||
c20.CellStyle = style3;
|
||||
c21.CellStyle = style3;
|
||||
c17.CellStyle = cellStyle4;
|
||||
//c18.CellStyle = style3;
|
||||
c19.CellStyle = cellStyle4;
|
||||
c20.CellStyle = cellStyle4;
|
||||
c21.CellStyle = cellStyle4;
|
||||
c22.CellStyle = style3;
|
||||
c23.CellStyle = style3;
|
||||
//c23.CellStyle = style3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,9 +567,9 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
IRow rr1 = sheet2.GetRow(15);
|
||||
IRow rr2 = sheet2.GetRow(16);
|
||||
IRow rr3 = sheet2.GetRow(17);
|
||||
ICell cc1 = rr1.GetCell(6);
|
||||
ICell cc2 = rr2.GetCell(6);
|
||||
ICell cc3 = rr3.GetCell(6);
|
||||
ICell cc1 = rr1.GetCell(6 + 1);
|
||||
ICell cc2 = rr2.GetCell(6 + 1);
|
||||
ICell cc3 = rr3.GetCell(6 + 1);
|
||||
cc1.SetCellValue(Convert.ToDouble(YFHpriceSum));
|
||||
cc2.SetCellValue(Convert.ToDouble(YFPpriceSum));
|
||||
cc3.SetCellValue(Convert.ToDouble(priceSum));
|
||||
@ -537,11 +604,11 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
}
|
||||
ICell CR1 = r1.CreateCell(i);
|
||||
CR1.SetCellValue(test1);
|
||||
if (i == 4 || i == 5 || i == 7 || i == 8 || i == 9)
|
||||
if (i == 4 + 1 || i == 5 + 1 || i == 7 + 1 || i == 8 + 1 || i == 9 + 1)
|
||||
{
|
||||
CR1.CellStyle = style;
|
||||
}
|
||||
else if (i == 6)
|
||||
else if (i == 6 + 1)
|
||||
{
|
||||
CR1.SetCellValue(Convert.ToDouble(test1));
|
||||
CR1.CellStyle = style4;
|
||||
@ -562,11 +629,11 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
}
|
||||
ICell CR1 = r2.CreateCell(i);
|
||||
CR1.SetCellValue(test1);
|
||||
if (i == 4 || i == 5 || i == 7 || i == 8 || i == 9)
|
||||
if (i == 4 + 1 || i == 5 + 1 || i == 7 + 1 || i == 8 + 1 || i == 9 + 1)
|
||||
{
|
||||
CR1.CellStyle = style;
|
||||
}
|
||||
else if (i == 6)
|
||||
else if (i == 6 + 1)
|
||||
{
|
||||
CR1.SetCellValue(Convert.ToDouble(test1));
|
||||
CR1.CellStyle = style4;
|
||||
@ -587,11 +654,11 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
}
|
||||
ICell CR1 = r3.CreateCell(i);
|
||||
CR1.SetCellValue(test1);
|
||||
if (i == 4 || i == 5 || i == 7 || i == 8 || i == 9)
|
||||
if (i == 4 + 1 || i == 5 + 1 || i == 7 + 1 || i == 8 + 1 || i == 9 + 1)
|
||||
{
|
||||
CR1.CellStyle = style;
|
||||
}
|
||||
else if (i == 6)
|
||||
else if (i == 6 + 1)
|
||||
{
|
||||
CR1.SetCellValue(Convert.ToDouble(test1));
|
||||
CR1.CellStyle = style4;
|
||||
@ -629,6 +696,10 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
{
|
||||
CR1.CellStyle = style2;
|
||||
}
|
||||
else
|
||||
{
|
||||
CR1.CellStyle = style5;
|
||||
}
|
||||
}
|
||||
|
||||
//第六行
|
||||
@ -645,6 +716,10 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
{
|
||||
CR1.CellStyle = style2;
|
||||
}
|
||||
else
|
||||
{
|
||||
CR1.CellStyle = style5;
|
||||
}
|
||||
}
|
||||
|
||||
//第七行
|
||||
@ -661,6 +736,10 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
{
|
||||
CR1.CellStyle = style2;
|
||||
}
|
||||
else
|
||||
{
|
||||
CR1.CellStyle = style5;
|
||||
}
|
||||
}
|
||||
|
||||
//合并单元格
|
||||
@ -669,12 +748,12 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
// 合并单元格的起始行、结束行、起始列和结束列
|
||||
int firstRow = n + i; // 比如第一行
|
||||
int lastRow = n + i; // 合并到第三行(0-based index)
|
||||
int firstCol = 4; // 比如第一列
|
||||
int firstCol2 = 7; // 比如第一列
|
||||
int firstCol = 4 + 1; // 比如第一列
|
||||
int firstCol2 = 7 + 1; // 比如第一列
|
||||
int firstCol3 = 0; // 比如第一列
|
||||
int lastCol = 5; // 合并到第三列(0-based index)
|
||||
int lastCol2 = 9; // 合并到第三列(0-based index)
|
||||
int lastCol3 = 3; // 合并到第三列(0-based index)
|
||||
int lastCol = 5 + 1; // 合并到第三列(0-based index)
|
||||
int lastCol2 = 9 + 1; // 合并到第三列(0-based index)
|
||||
int lastCol3 = 3+1; // 合并到第三列(0-based index)
|
||||
|
||||
// 创建CellRangeAddress对象
|
||||
CellRangeAddress cellRangeAddress = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol);
|
||||
@ -693,6 +772,8 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
}
|
||||
//移除第二个工作表
|
||||
workbook.RemoveSheetAt(1);
|
||||
//重命名工作表
|
||||
workbook.SetSheetName(0, string.Format("明细版{0}", DateTime.Now.ToString("yyyy-MM-dd")));
|
||||
#endregion
|
||||
|
||||
#region Excel代码2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user