1
This commit is contained in:
parent
95379dc97a
commit
2626e3dcd1
@ -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
|
||||
|
||||
@ -136,6 +136,8 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
cellStyle2.VerticalAlignment = VerticalAlignment.Center;
|
||||
//设置字体和大小
|
||||
cellStyle2.SetFont(font1);
|
||||
//自动换行
|
||||
cellStyle2.WrapText = true;
|
||||
|
||||
// 创建一个单元格样式---------------------------------
|
||||
ICellStyle cellStyle3 = workbook.CreateCellStyle();
|
||||
@ -188,7 +190,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
// 创建字体并设置为加粗
|
||||
IFont font = workbook.CreateFont();
|
||||
font.IsBold = true; // 设置字体加粗
|
||||
|
||||
font.FontName = "Times New Roman";
|
||||
// 将字体应用到单元格样式
|
||||
style.SetFont(font);
|
||||
|
||||
@ -239,6 +241,19 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
// 将字体应用到单元格样式
|
||||
style4.SetFont(font3);
|
||||
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 获取金额汇总数据
|
||||
@ -430,7 +445,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
//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 = 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++;
|
||||
|
||||
@ -552,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));
|
||||
@ -589,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;
|
||||
@ -614,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;
|
||||
@ -639,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;
|
||||
@ -681,6 +696,10 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
{
|
||||
CR1.CellStyle = style2;
|
||||
}
|
||||
else
|
||||
{
|
||||
CR1.CellStyle = style5;
|
||||
}
|
||||
}
|
||||
|
||||
//第六行
|
||||
@ -697,6 +716,10 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
{
|
||||
CR1.CellStyle = style2;
|
||||
}
|
||||
else
|
||||
{
|
||||
CR1.CellStyle = style5;
|
||||
}
|
||||
}
|
||||
|
||||
//第七行
|
||||
@ -713,6 +736,10 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
{
|
||||
CR1.CellStyle = style2;
|
||||
}
|
||||
else
|
||||
{
|
||||
CR1.CellStyle = style5;
|
||||
}
|
||||
}
|
||||
|
||||
//合并单元格
|
||||
@ -721,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);
|
||||
@ -745,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