public void LoadSheetInfo() { //得到所有的接单数据 AllSheetList = SheetDeal.GetAllSheet(); }
public bool PrintSheetLeftSheet(string searchKeys, List <SheetInfo> sheetList, ref string msg) { if (sheetList == null) { return(false); } if (sheetList.Count == 0) { return(false); } try { if (!xlsAccess.LoadXlsTemplate(ResourceMap.AppFolderPathHashtable[AppFolderPath.Templates] as string + ResourceMap.TemplatesNameHashtable[TemplatesName.SheetLeft] as string)) { return(false); } if (xlsAccess.GetSheet((ResourceMap.TemplatesNameHashtable[TemplatesName.SheetLeft] as string).Split('.')[0])) { //搜索条件 xlsAccess.SetCellValue(0, 2, string.IsNullOrEmpty(searchKeys) ? "无" : searchKeys); if (sheetList.Count > 1) { xlsAccess.CopyRow(3, 2, sheetList.Count - 1); } List <SheetBOPInfo> CurSheetBopList = null; for (int index = 0; index < sheetList.Count; index++) { xlsAccess.SetCellValue(index + 2, 0, sheetList[index].ID); xlsAccess.SetCellValue(index + 2, 1, sheetList[index].StartDate.ToString("yyyy-MM-dd")); xlsAccess.SetCellValue(index + 2, 2, sheetList[index].FinishDate == null ? "" : ((DateTime)(sheetList[index].FinishDate)).ToString("yyyy-MM-dd")); xlsAccess.SetCellValue(index + 2, 3, sheetList[index].SettleDate == null ? "" : ((DateTime)(sheetList[index].SettleDate)).ToString("yyyy-MM-dd")); xlsAccess.SetCellValue(index + 2, 4, sheetList[index].Accepter == null ? "" : sheetList[index].Accepter); xlsAccess.SetCellValue(index + 2, 5, sheetList[index].Customer == null ? "" : sheetList[index].Customer); xlsAccess.SetCellValue(index + 2, 6, sheetList[index].BSType == null ? "" : sheetList[index].BSType); xlsAccess.SetCellValue(index + 2, 7, sheetList[index].Price); double totalBOP = sheetList[index].Price; CurSheetBopList = SheetDeal.GetAllSheetBOPInfo(sheetList[index].ID).ToList(); CurSheetBopList.ForEach(info => totalBOP += (info.Balance - info.Payment)); xlsAccess.SetCellValue(index + 2, 8, totalBOP); } if (sheetList.Count != 0) { xlsAccess.SetCellFormula(2 + sheetList.Count, 8, "sum(I3:I" + (2 + sheetList.Count) + ")"); } return(SaveWithDialog()); //xlsAccess.SaveAs(ResourceMap.AppFolderPathHashtable[AppFolderPath.Outputs] as string + "SheetDetail_Left.xls"); } else { return(false); } } catch (Exception ex) { msg = ex.Message + ex.StackTrace.ToString(); return(false); } }