diff --git a/Pilot.Report.Exploitation/AccountsReceivable/LiteVersionPlugIn.cs b/Pilot.Report.Exploitation/AccountsReceivable/LiteVersionPlugIn.cs index 8ea8c6b..dbb71bd 100644 --- a/Pilot.Report.Exploitation/AccountsReceivable/LiteVersionPlugIn.cs +++ b/Pilot.Report.Exploitation/AccountsReceivable/LiteVersionPlugIn.cs @@ -216,18 +216,27 @@ namespace Pilot.Report.Exploitation.AccountsReceivable style2.SetFont(font2); int n = 14; + int j = 13; + 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); + decimal OrderAmount = string.IsNullOrWhiteSpace(list[i]["OrderAmount"].ToString()) ? 0 : Math.Round(Convert.ToDecimal(list[i]["OrderAmount"]), 2); + decimal ShipmentsAmount = string.IsNullOrWhiteSpace(list[i]["ShipmentsAmount"].ToString()) ? 0 : Math.Round(Convert.ToDecimal(list[i]["ShipmentsAmount"]), 2); + decimal FBillAllAmount = string.IsNullOrWhiteSpace(list[i]["FBillAllAmount"].ToString()) ? 0 : Math.Round(Convert.ToDecimal(list[i]["FBillAllAmount"]), 2); + decimal OrdeFALLAMOUNTFORrAmount = string.IsNullOrWhiteSpace(list[i]["FALLAMOUNTFOR"].ToString()) ? 0 : Math.Round(Convert.ToDecimal(list[i]["FALLAMOUNTFOR"]), 2); + decimal PaymentAmount = string.IsNullOrWhiteSpace(list[i]["PaymentAmount"].ToString()) ? 0 : Math.Round(Convert.ToDecimal(list[i]["PaymentAmount"]), 2); + decimal ShippedDebt = string.IsNullOrWhiteSpace(list[i]["ShippedDebt"].ToString()) ? 0 : Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]), 2); + decimal InvoicedDebt = string.IsNullOrWhiteSpace(list[i]["InvoicedDebt"].ToString()) ? 0 : Math.Round(Convert.ToDecimal(list[i]["InvoicedDebt"]), 2); + + //将合计行放到最下方 + IRow rowi = sheet.CreateRow(j + i); + if (list[i]["Number"].ToString() == "合计") + { + rowi = sheet.CreateRow(j + list.Count - 1); + j = 12; + } - 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 c3 = rowi.CreateCell(2); c3.SetCellValue(list[i]["CONTRACTNUMBER"].ToString()); c3.CellStyle = cellStyle2;