1
This commit is contained in:
@@ -29,10 +29,10 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
public override void BarItemClick(BarItemClickEventArgs e)
|
||||
{
|
||||
base.BarItemClick(e);
|
||||
// 判断 应收对账单【简易版】按钮
|
||||
// 判断 应收对账单【明细版】按钮
|
||||
if (e.BarItemKey == "Test_Button_1")
|
||||
{
|
||||
string FPath = "应收账款对账单【简易版】.xlsx";
|
||||
string FPath = "应收账款对账单【明细版】.xlsx";
|
||||
|
||||
// 在临时文件目录,生成一个完整的文件名: C:\Program Files\Kingdee\K3Cloud\WebSite\...\JD.xls
|
||||
string filePath = PathUtils.GetPhysicalPath(KeyConst.TEMPFILEPATH, Path.GetFileName(FPath));
|
||||
@@ -67,7 +67,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
if (sqlTestList.Count() > 0)
|
||||
{
|
||||
Num = 1;
|
||||
fAmount = Math.Round(Convert.ToDecimal(sqlTestList[0]["FAmount"]),2);
|
||||
fAmount = Math.Round(Convert.ToDecimal(sqlTestList[0]["FAmount"]), 2);
|
||||
fDate2 = sqlTestList[0]["FDate"].ToString().Split(' ')[0];
|
||||
}
|
||||
|
||||
@@ -78,11 +78,11 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
/// <summary>
|
||||
/// 赋值EXCEL
|
||||
/// </summary>
|
||||
static void Main(string outputFilePath, string fClient, string fDate, string fProject, DataRowCollection list, int Num, decimal fAmount,string fDate2, Kingdee.BOS.Context Context)
|
||||
static void Main(string outputFilePath, string fClient, string fDate, string fProject, DataRowCollection list, int Num, decimal fAmount, string fDate2, Kingdee.BOS.Context Context)
|
||||
{
|
||||
#region Excel代码
|
||||
|
||||
string filePath = @"D:\KingdeeModel\对账单模板.xlsx";
|
||||
string filePath = @"D:\KingdeeModel\对账单模板2.xlsx";
|
||||
FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read);
|
||||
IWorkbook workbook = new XSSFWorkbook(file);
|
||||
file.Close();
|
||||
@@ -219,44 +219,137 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
for (var i = 0; i < list.Count; i++)
|
||||
{
|
||||
string date = string.IsNullOrWhiteSpace(list[i]["DATE"].ToString()) ? "" : list[i]["DATE"].ToString().Split(' ')[0];
|
||||
decimal OrderAmount = Math.Round(Convert.ToDecimal(list[i]["OrderAmount"]), 2);
|
||||
decimal ShipmentsAmount = Math.Round(Convert.ToDecimal(list[i]["ShipmentsAmount"]), 2);
|
||||
decimal FBillAllAmount = Math.Round(Convert.ToDecimal(list[i]["FBillAllAmount"]), 2);
|
||||
decimal OrdeFALLAMOUNTFORrAmount = Math.Round(Convert.ToDecimal(list[i]["FALLAMOUNTFOR"]), 2);
|
||||
decimal PaymentAmount = Math.Round(Convert.ToDecimal(list[i]["PaymentAmount"]), 2);
|
||||
decimal ShippedDebt = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]), 2);
|
||||
decimal InvoicedDebt = Math.Round(Convert.ToDecimal(list[i]["InvoicedDebt"]), 2);
|
||||
string ShipmentsDate = string.IsNullOrWhiteSpace(list[i]["ShipmentsDate"].ToString()) ? "" : list[i]["ShipmentsDate"].ToString().Split(' ')[0];
|
||||
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 ReturnDate = string.IsNullOrWhiteSpace(list[i]["ReturnDate"].ToString()) ? "" : list[i]["ReturnDate"].ToString().Split(' ')[0];
|
||||
|
||||
IRow rowi = sheet.CreateRow(13 + i);
|
||||
ICell c1 = rowi.CreateCell(0); c1.SetCellValue(list[i]["Number"].ToString()); c1.CellStyle = cellStyle;
|
||||
ICell c2 = rowi.CreateCell(1); c2.SetCellValue(""+date+""); c2.CellStyle = cellStyle2;
|
||||
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(""+ OrderAmount + ""); c5.CellStyle = cellStyle;
|
||||
ICell c6 = rowi.CreateCell(5); c6.SetCellValue("" + ShipmentsAmount + ""); c6.CellStyle = cellStyle;
|
||||
ICell c7 = rowi.CreateCell(6); c7.SetCellValue("" + FBillAllAmount + ""); c7.CellStyle = cellStyle;
|
||||
ICell c8 = rowi.CreateCell(7); c8.SetCellValue("" + OrdeFALLAMOUNTFORrAmount + ""); c8.CellStyle = cellStyle;
|
||||
ICell c9 = rowi.CreateCell(8); c9.SetCellValue("" + PaymentAmount + ""); c9.CellStyle = cellStyle;
|
||||
ICell c10 = rowi.CreateCell(9); c10.SetCellValue("" + ShippedDebt + ""); c10.CellStyle = cellStyle;
|
||||
ICell c11 = rowi.CreateCell(10); c11.SetCellValue("" + InvoicedDebt + ""); c11.CellStyle = cellStyle;
|
||||
ICell c12 = rowi.CreateCell(11); c12.SetCellValue(list[i]["IsEnded"].ToString()); c12.CellStyle = cellStyle;
|
||||
ICell c13 = rowi.CreateCell(12); c13.SetCellValue(list[i]["Remark"].ToString()); c13.CellStyle = cellStyle2;
|
||||
n++;
|
||||
if(list[i]["Number"].ToString() == "合计")
|
||||
ICell c5 = rowi.CreateCell(4); c5.SetCellValue(list[i]["SizeModel"].ToString()); c5.CellStyle = cellStyle2;
|
||||
|
||||
ICell c6 = rowi.CreateCell(5); c6.SetCellValue(""); c6.CellStyle = cellStyle; //数量
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["FQty"].ToString()))
|
||||
{
|
||||
c1.CellStyle = style3;
|
||||
c2.CellStyle = style3;
|
||||
c3.CellStyle = style3;
|
||||
c4.CellStyle = style3;
|
||||
c5.CellStyle = style3;
|
||||
c6.CellStyle = style3;
|
||||
c7.CellStyle = style3;
|
||||
c8.CellStyle = style3;
|
||||
c9.CellStyle = style3;
|
||||
c10.CellStyle = style3;
|
||||
c11.CellStyle = style3;
|
||||
int FQty = Convert.ToInt32(list[i]["FQty"]);
|
||||
c6.SetCellValue("" + FQty + ""); c6.CellStyle = cellStyle; //数量
|
||||
}
|
||||
|
||||
ICell c7 = rowi.CreateCell(6); c7.SetCellValue(""); c7.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["FTaxPrice"].ToString()))
|
||||
{
|
||||
decimal FTaxPrice = Math.Round(Convert.ToDecimal(list[i]["FTaxPrice"]), 2);
|
||||
c7.SetCellValue("" + FTaxPrice + ""); c7.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c8 = rowi.CreateCell(7); c8.SetCellValue(""); c8.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["FAllAmount"].ToString()))
|
||||
{
|
||||
decimal FAllAmount = Math.Round(Convert.ToDecimal(list[i]["FAllAmount"]), 2);
|
||||
c8.SetCellValue("" + FAllAmount + ""); c8.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c9 = rowi.CreateCell(8); c9.SetCellValue(""); c9.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["OrderAmount"].ToString()))
|
||||
{
|
||||
decimal OrderAmount = Math.Round(Convert.ToDecimal(list[i]["OrderAmount"]), 2);
|
||||
c9.SetCellValue("" + OrderAmount + ""); c9.CellStyle = cellStyle;
|
||||
|
||||
}
|
||||
|
||||
ICell c11 = rowi.CreateCell(10); c11.SetCellValue(""); c11.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["ShipmentsNum"].ToString()))
|
||||
{
|
||||
int ShipmentsNum = Convert.ToInt32(list[i]["ShipmentsNum"]);
|
||||
c11.SetCellValue("" + ShipmentsNum + ""); c11.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c12 = rowi.CreateCell(11); c12.SetCellValue(""); c12.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["ShipmentsAmount"].ToString()))
|
||||
{
|
||||
decimal ShipmentsAmount = Math.Round(Convert.ToDecimal(list[i]["ShipmentsAmount"]), 2);
|
||||
c12.SetCellValue("" + 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("" + ReturnNum + ""); c14.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c15 = rowi.CreateCell(14); c15.SetCellValue(""); c15.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["ReturnAmount"].ToString()))
|
||||
{
|
||||
decimal ReturnAmount = Math.Round(Convert.ToDecimal(list[i]["ReturnAmount"]), 2);
|
||||
c15.SetCellValue("" + ReturnAmount + ""); c15.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c19 = rowi.CreateCell(18); c19.SetCellValue(""); c19.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["PaymentAmount"].ToString()))
|
||||
{
|
||||
|
||||
decimal PaymentAmount = Math.Round(Convert.ToDecimal(list[i]["PaymentAmount"]), 2);
|
||||
c19.SetCellValue("" + PaymentAmount + ""); c19.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c20 = rowi.CreateCell(19); c20.SetCellValue(""); c20.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["ShippedDebt"].ToString()))
|
||||
{
|
||||
decimal ShippedDebt = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]), 2);
|
||||
c20.SetCellValue("" + ShippedDebt + ""); c20.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c21 = rowi.CreateCell(20); c21.SetCellValue(""); c21.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["InvoicedDebt"].ToString()))
|
||||
{
|
||||
decimal InvoicedDebt = Math.Round(Convert.ToDecimal(list[i]["InvoicedDebt"]), 2);
|
||||
c21.SetCellValue("" + InvoicedDebt + ""); c21.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
ICell c17 = rowi.CreateCell(16); c17.SetCellValue(""); c17.CellStyle = cellStyle;
|
||||
if (!string.IsNullOrWhiteSpace(list[i]["BillingAmount"].ToString()))
|
||||
{
|
||||
|
||||
decimal BillingAmount = Math.Round(Convert.ToDecimal(list[i]["BillingAmount"]), 2);
|
||||
c17.SetCellValue("" + BillingAmount + ""); c17.CellStyle = cellStyle;
|
||||
}
|
||||
|
||||
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;
|
||||
n++;
|
||||
if (list[i]["Number"].ToString() == "合计")
|
||||
{
|
||||
c1.CellStyle = style3;
|
||||
c2.CellStyle = style3;
|
||||
c3.CellStyle = style3;
|
||||
c4.CellStyle = style3;
|
||||
c5.CellStyle = style3;
|
||||
c6.CellStyle = style3;
|
||||
c7.CellStyle = style3;
|
||||
c8.CellStyle = style3;
|
||||
c9.CellStyle = style3;
|
||||
c10.CellStyle = style3;
|
||||
c11.CellStyle = style3;
|
||||
c12.CellStyle = style3;
|
||||
c13.CellStyle = style3;
|
||||
c14.CellStyle = style3;
|
||||
c15.CellStyle = style3;
|
||||
c16.CellStyle = style3;
|
||||
c17.CellStyle = style3;
|
||||
c18.CellStyle = style3;
|
||||
c19.CellStyle = style3;
|
||||
c20.CellStyle = style3;
|
||||
c21.CellStyle = style3;
|
||||
c22.CellStyle = style3;
|
||||
c23.CellStyle = style3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +472,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
|
||||
}
|
||||
ICell CR1 = r5.CreateCell(i);
|
||||
CR1.SetCellValue(test1);
|
||||
if (i >= 4)
|
||||
if (i >= 4)
|
||||
{
|
||||
CR1.CellStyle = style2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user