1
This commit is contained in:
@@ -35,7 +35,18 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
// 判断 应收对账单【明细版】按钮
|
||||
if (e.BarItemKey == "Test_Button_1")
|
||||
{
|
||||
string FPath = "应收账款对账单【明细版】.xlsx";
|
||||
var reportModel = this.SysReportModel;
|
||||
|
||||
//单据头
|
||||
var rptTitles = reportModel.ReportTitles;
|
||||
string fClient = rptTitles.FirstOrDefault(a => a.TitleKey == "FClient").TitleValue.ToString();
|
||||
string fDate = rptTitles.FirstOrDefault(a => a.TitleKey == "FDate").TitleValue.ToString();
|
||||
string fProject = rptTitles.FirstOrDefault(a => a.TitleKey == "FProject").TitleValue.ToString();
|
||||
string FState = rptTitles.FirstOrDefault(a => a.TitleKey == "FState").TitleValue.ToString();
|
||||
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);
|
||||
|
||||
// 在临时文件目录,生成一个完整的文件名: C:\Program Files\Kingdee\K3Cloud\WebSite\...\JD.xls
|
||||
string filePath = PathUtils.GetPhysicalPath(KeyConst.TEMPFILEPATH, Path.GetFileName(FPath));
|
||||
@@ -49,15 +60,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
//显示
|
||||
this.View.ShowForm(showParameter);
|
||||
|
||||
var reportModel = this.SysReportModel;
|
||||
|
||||
//单据头
|
||||
var rptTitles = reportModel.ReportTitles;
|
||||
string fClient = rptTitles.FirstOrDefault(a => a.TitleKey == "FClient").TitleValue.ToString();
|
||||
string fDate = rptTitles.FirstOrDefault(a => a.TitleKey == "FDate").TitleValue.ToString();
|
||||
string fProject = rptTitles.FirstOrDefault(a => a.TitleKey == "FProject").TitleValue.ToString();
|
||||
string FState = rptTitles.FirstOrDefault(a => a.TitleKey == "FState").TitleValue.ToString();
|
||||
string F_SFYJKH = rptTitles.FirstOrDefault(a => a.TitleKey == "F_SFYJKH").TitleValue.ToString();
|
||||
|
||||
//单据体
|
||||
var list = reportModel.DataSource.Rows;
|
||||
|
||||
@@ -110,7 +113,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
cellStyle.Alignment = HorizontalAlignment.Center;
|
||||
// 设置垂直居中对齐
|
||||
cellStyle.VerticalAlignment = VerticalAlignment.Center;
|
||||
|
||||
//设置数值格式保留两位小数
|
||||
cellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("0.00");
|
||||
|
||||
// 创建一个单元格样式---------------------------------
|
||||
@@ -169,6 +172,21 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
// 将字体应用到单元格样式
|
||||
style3.SetFont(font3);
|
||||
|
||||
// 创建一个单元格样式-------------------------------
|
||||
ICellStyle style4 = workbook.CreateCellStyle();
|
||||
|
||||
// 设置边框样式
|
||||
style4.BorderTop = BorderStyle.Thin;
|
||||
style4.BorderBottom = BorderStyle.Thin;
|
||||
style4.BorderLeft = BorderStyle.Thin;
|
||||
style4.BorderRight = BorderStyle.Thin;
|
||||
// 设置水平居中对齐
|
||||
style4.Alignment = HorizontalAlignment.Left;
|
||||
// 设置垂直居中对齐
|
||||
style4.VerticalAlignment = VerticalAlignment.Center;
|
||||
// 将字体应用到单元格样式
|
||||
style4.SetFont(font3);
|
||||
style4.DataFormat = workbook.CreateDataFormat().GetFormat("0.00");
|
||||
#endregion
|
||||
|
||||
#region 获取金额汇总数据
|
||||
@@ -183,7 +201,8 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
{
|
||||
YFHpriceSum = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]), 2);
|
||||
YFPpriceSum = Math.Round(Convert.ToDecimal(list[i]["InvoicedDebt"]), 2);
|
||||
priceSum = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]) + Convert.ToDecimal(list[i]["InvoicedDebt"]), 2);
|
||||
//priceSum = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]) + Convert.ToDecimal(list[i]["InvoicedDebt"]), 2);
|
||||
priceSum = Math.Round(Convert.ToDecimal(list[i]["OwedTickets"]), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +263,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
string BillingDate = string.IsNullOrWhiteSpace(list[i]["ZPBillingDate"].ToString()) ? "" : list[i]["ZPBillingDate"].ToString().Split(' ')[0];
|
||||
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];
|
||||
//BillingDate += string.IsNullOrWhiteSpace(list[i]["PPBillingDate"].ToString()) ? "" : (string.IsNullOrWhiteSpace(BillingDate) ?"":",")+list[i]["PPBillingDate"].ToString().Split(' ')[0];
|
||||
|
||||
//将合计行放到最下方
|
||||
IRow rowi = sheet.CreateRow(j + i);
|
||||
@@ -271,7 +290,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
if(!string.IsNullOrWhiteSpace(list[i]["FTaxPrice"].ToString()))
|
||||
{
|
||||
decimal FTaxPrice = Math.Round(Convert.ToDecimal(list[i]["FTaxPrice"]), 2);
|
||||
c7.SetCellValue("" + FTaxPrice + ""); c7.CellStyle = cellStyle;
|
||||
c7.SetCellValue(Convert.ToDouble(FTaxPrice )); c7.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c8 = rowi.CreateCell(7); c8.SetCellValue(""); c8.CellStyle = cellStyle;
|
||||
@@ -458,9 +477,9 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
ICell cc1 = rr1.GetCell(6);
|
||||
ICell cc2 = rr2.GetCell(6);
|
||||
ICell cc3 = rr3.GetCell(6);
|
||||
cc1.SetCellValue("" + YFHpriceSum + "");
|
||||
cc2.SetCellValue("" + YFPpriceSum + "");
|
||||
cc3.SetCellValue("" + priceSum + "");
|
||||
cc1.SetCellValue(Convert.ToDouble(YFHpriceSum));
|
||||
cc2.SetCellValue(Convert.ToDouble(YFPpriceSum));
|
||||
cc3.SetCellValue(Convert.ToDouble(priceSum));
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -492,10 +511,15 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
}
|
||||
ICell CR1 = r1.CreateCell(i);
|
||||
CR1.SetCellValue(test1);
|
||||
if (i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9)
|
||||
if (i == 4 || i == 5 || i == 7 || i == 8 || i == 9)
|
||||
{
|
||||
CR1.CellStyle = style;
|
||||
}
|
||||
else if (i == 6)
|
||||
{
|
||||
CR1.SetCellValue(Convert.ToDouble(test1));
|
||||
CR1.CellStyle = style4;
|
||||
}
|
||||
else
|
||||
{
|
||||
CR1.CellStyle = style2;
|
||||
@@ -512,10 +536,15 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
}
|
||||
ICell CR1 = r2.CreateCell(i);
|
||||
CR1.SetCellValue(test1);
|
||||
if (i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9)
|
||||
if (i == 4 || i == 5 || i == 7 || i == 8 || i == 9)
|
||||
{
|
||||
CR1.CellStyle = style;
|
||||
}
|
||||
else if (i == 6)
|
||||
{
|
||||
CR1.SetCellValue(Convert.ToDouble(test1));
|
||||
CR1.CellStyle = style4;
|
||||
}
|
||||
else
|
||||
{
|
||||
CR1.CellStyle = style2;
|
||||
@@ -532,10 +561,15 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
}
|
||||
ICell CR1 = r3.CreateCell(i);
|
||||
CR1.SetCellValue(test1);
|
||||
if (i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9)
|
||||
if (i == 4 || i == 5 || i == 7 || i == 8 || i == 9)
|
||||
{
|
||||
CR1.CellStyle = style;
|
||||
}
|
||||
else if (i == 6)
|
||||
{
|
||||
CR1.SetCellValue(Convert.ToDouble(test1));
|
||||
CR1.CellStyle = style4;
|
||||
}
|
||||
else
|
||||
{
|
||||
CR1.CellStyle = style2;
|
||||
|
||||
Reference in New Issue
Block a user