private void DoExport() { try { if (dataGridView1.DataSource != null && dataGridView1.Rows.Count > 0) { List <CashRecord> list = (List <CashRecord>) this.dataGridView1.DataSource; List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void DoExport() { try { if (dataGridView1.DataSource != null && dataGridView1.Rows.Count > 0) { List <PfRetailAnalysisInfo> list = DataGridViewUtil.BindingListToList <PfRetailAnalysisInfo>(dataGridView1.DataSource); System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void DoExport() { try { List <CheckStoreSummary> unableStore = new List <CheckStoreSummary>(); List <CheckStoreSummary> stores = new List <CheckStoreSummary>(); List <CheckStoreSummary> list = (List <CheckStoreSummary>) this.dataGridView1.DataSource; System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void DoExport() { try { if (DataGridView == null) { ShowMessage("请设置FileName属性!"); return; } List <T> list = DataGridView.DataSource as List <T>; List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in DataGridView.Columns) { if (item.Visible) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray();//new System.Collections.SortedList(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); ShowMessage("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
//private int GetBigClass(int classID) //{ // int id =0; // return id; //} /// <summary> /// 绑定CostumeStore数据源 /// </summary> /// <param name="listPage"></param> private void BindingCostumeStoreDataSource(List <CostumeInvoicing> listPage) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } this.skinSplitContainer1.Panel2Collapsed = true; if (columnsHide != null && columnsHide.Count > 0) { dataGridViewPagingSumCtrl.AppendNotShowInColumnSettings(columnsHide.ToArray()); } if (columnsDisplay != null && columnsDisplay.Count > 0) { dataGridViewPagingSumCtrl.RemoveNotShowInColumnSettings(columnsDisplay.ToArray()); } // DataTable dt = DataGridViewUtil.ToDataTable<CostumeInvoicing>(listPage); this.dataGridViewPagingSumCtrl.BindingDataSource <CostumeInvoicing>(DataGridViewUtil.ToDataTable(listPage)); } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void DoExport() { try { List <Supplier> list = DataGridViewUtil.BindingListToList <Supplier>(dataGridView1.DataSource); System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { if (item.Name != "Column1" && item.Name != "Column2" && item.Name != "enabledDataGridViewCheckBoxColumn") { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void DoExport() { try { List <SalesAnalysisDeatil> list = dataGridView_RetailDetail.DataSource as List <SalesAnalysisDeatil>; List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView_RetailDetail.Columns) { if (item.Visible) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray();//new System.Collections.SortedList(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); ShowMessage("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void DoExport() { try { List <DistributorCommissionRecord> list = (List <DistributorCommissionRecord>) this.dataGridView_RetailDetail.DataSource;; //System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView_RetailDetail.Columns) { if (item.Visible) { //if (item.Name != "Column1" &&item.Name != "Column2" && item.Name != "Column3" && item.Name != "enabledDataGridViewCheckBoxColumn") //{ keys.Add(item.DataPropertyName); values.Add(item.HeaderText); //} } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void Search(PfOrder record) { try { if (GlobalUtil.EngineUnconnectioned(this)) { return; } skinLabelOrder.Text = record.ID; //List<BoundDetail> listPage = GlobalCache.ServerProxy. //GetDetail4SupplierAccountRecord(record.SourceOrderID); List <PfCustomerRetailDetail> listitems = new List <PfCustomerRetailDetail>(); listitems = GlobalCache.ServerProxy.GetPfCustomerRetailDetails(record.ID); /* List<PfOrderDetail> pfListItems=new List<PfOrderDetail>(); * // * if (record.IsRetail) * { * } * else * {*/ // pfListItems = GlobalCache.ServerProxy.GetPfOrderDetails(record.ID); // } //GetPfCustomerRetailDetails /* if (listitems != null) * { * int totalCount = 0; * decimal totalPrice = 0; * for (int i = 0; i < listitems.Count; i++) * { * totalCount += listitems[i].BuyCount; * //totalPrice += listitems[i].; * } * skinLabelCount.Text = totalCount.ToString(); * skinLabelPrice.Text = totalPrice.ToString(); * foreach (var item in listitems) * { * item.CostumeName = CommonGlobalCache.GetCostumeName(item.CostumeID); * * } * this.dataGridViewPagingSumCtrl.BindingDataSource<BoundDetail>(DataGridViewUtil.ToDataTable(listitems)); * }*/ if (listitems != null) { this.dataGridViewPagingSumCtrl.BindingDataSource <BoundDetail>(DataGridViewUtil.ToDataTable(listitems)); } } catch (Exception ee) { GlobalUtil.ShowError(ee); } finally { GlobalUtil.UnLockPage(this); } }
private void BindingReplenishDetailSource(List <ReplenishDetail> list) { if (list != null && list.Count > 0) { foreach (ReplenishDetail detail in list) { detail.CostumeName = CommonGlobalCache.GetCostumeName(detail.CostumeID); } } dataGridViewPagingSumCtrl.BindingDataSource <ReplenishDetail>(DataGridViewUtil.ToDataTable(list)); }
private void BindingDataSource(List <RechargeRecord> rechargeRecordList) { if (rechargeRecordList != null && rechargeRecordList.Count > 0) { foreach (RechargeRecord record in rechargeRecordList) { record.GuideName = CommonGlobalCache.GetUserName(record.GuideID); } } dataGridViewPagingSumCtrl1.BindingDataSource <RechargeRecord>(DataGridViewUtil.ToDataTable(rechargeRecordList)); }
private void BindingOutboundDetailSource(List <BoundDetail> list) { if (list != null && list.Count > 0) { foreach (BoundDetail detail in list) { detail.CostumeName = CommonGlobalCache.GetCostumeName(detail.CostumeID); } } dataGridViewPagingSumCtrl2.BindingDataSource <BoundDetail>(DataGridViewUtil.ToDataTable(list)); //dataGridViewPagingSumCtrl2.BindingDataSource<BoundDetail>(DataGridViewUtil.ListToBindingList(list)); }
/// <summary> /// 绑定RetailDetail数据源并设置下方的Label值 /// </summary> private void BindingDataSource(List <DayBenefitReportDetail> retailDetailList) { if (retailDetailList != null && retailDetailList.Count > 0) { foreach (DayBenefitReportDetail detail in retailDetailList) { detail.CostumeName = CommonGlobalCache.GetCostumeName(detail.CostumeID); detail.SizeDisplayName = CommonGlobalUtil.GetCostumeSizeName(detail.CostumeID, detail.SizeName); // detail.GuideName = CommonGlobalCache.GetUserName(detail.gu) } } dataGridViewPagingSumCtrl.BindingDataSource <DayBenefitReportDetail>(DataGridViewUtil.ToDataTable(retailDetailList)); }
/// <summary> /// 绑定数据 /// </summary> /// <param name="view"></param> /// <param name="dayBenefitReportList"></param> private void BindingSource(DataGridView view, List <DayBenefitReport> dayBenefitReportList) { if (dayBenefitReportList != null) { foreach (var item in dayBenefitReportList) { item.ShopName = CommonGlobalCache.GetShopName(item.ShopID); item.RefundRate = Math.Abs(item.RefundRate); item.QuantityOfRefund = Math.Abs(item.QuantityOfRefund); } } dataGridViewPagingSumCtrl.BindingDataSource <DayBenefitReport>(DataGridViewUtil.ToDataTable(dayBenefitReportList)); }
/// <summary> /// 绑定plenishOrderSource源到dataGridView中 /// </summary> /// <param name="listPage"></param> private void BindingSource(DataGridView view, List <BrandBenefitMonthReport> details) { view.DataSource = null; this.skinSplitContainer1.Panel2Collapsed = true; if (details != null) { foreach (var item in details) { item.RefundRate = Math.Abs(item.RefundRate); item.QuantityOfRefund = Math.Abs(item.QuantityOfRefund); } } dataGridViewPagingSumCtrl.BindingDataSource(DataGridViewUtil.ToDataTable <BrandBenefitMonthReport>(details), SalesBenefit, ListSortDirection.Descending); }
private void BindingCheckStoreDetailSource(List <CheckStoreDetail> list, CheckStoreOrderState curState) { if (list != null && list.Count > 0) { foreach (CheckStoreDetail detail in list) { detail.CostumeName = CommonGlobalCache.GetCostumeName(detail.CostumeID); //if (curState == CheckStoreOrderState.ChildOrder) { // detail.SumCountWinLost = 0; //} } } this.dataGridViewPagingSumCtrl.BindingDataSource <CheckStoreDetail>(DataGridViewUtil.ToDataTable(list)); }
private void Search(PfOrder record) { try { if (GlobalUtil.EngineUnconnectioned(this)) { return; } skinLabelOrder.Text = record.ID; skinLabelOpreator.Text = record.AdminUserName; skinLabelSupplier.Text = record.PfCustomerName; //List<BoundDetail> listPage = GlobalCache.ServerProxy. //GetDetail4SupplierAccountRecord(record.SourceOrderID); //GetPfOrderDetails //ShowMessage(record.OrderType); this.Text = record.OrderType + "单明细"; List <PfOrderDetail> pflistPage = GlobalCache.ServerProxy.GetPfOrderDetails(record.ID); if (pflistPage != null) { int totalCount = 0; decimal totalPrice = 0; for (int i = 0; i < pflistPage.Count; i++) { totalCount += pflistPage[i].SumCount; totalPrice += pflistPage[i].SumCost; } skinLabelCount.Text = totalCount.ToString(); skinLabelPrice.Text = totalPrice.ToString(); foreach (var item in pflistPage) { item.CostumeName = CommonGlobalCache.GetCostumeName(item.CostumeID); } } this.dataGridViewPagingSumCtrl.BindingDataSource <BoundDetail>(DataGridViewUtil.ToDataTable(pflistPage)); } catch (Exception ee) { GlobalUtil.ShowError(ee); } finally { GlobalUtil.UnLockPage(this); } }
/// <summary> /// 绑定plenishOrderSource源到dataGridView中 /// </summary> /// <param name="listPage"></param> private void BindingSource(DataGridView view, List <BrandBenefitDayReport> listPage) { this.skinSplitContainer1.Panel2Collapsed = true; if (listPage != null) { foreach (var item in listPage) { item.RefundRate = Math.Abs(item.RefundRate); item.QuantityOfRefund = Math.Abs(item.QuantityOfRefund); } this.dataGridViewPagingSumCtrl.BindingDataSource(DataGridViewUtil.ToDataTable <BrandBenefitDayReport>(listPage), salesBenefitDataGridViewTextBoxColumn, ListSortDirection.Descending); } else { view.DataSource = null; } }
private void DoExport() { try { List <AllocateOrder> list = (List <AllocateOrder>)(dataGridView1.DataSource); // System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { if (item.Name != "operationColumn" && item.Name != "ColumnCancel" && item.Name != "ColumnRedo" && item.Name != "ColumnPick" && item.Name != "ColumnPrint") { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } } /* List<AllocateOrder> ExportList = new List<AllocateOrder>(); * foreach (AllocateOrder cItem in list) * { * AllocateOrder curBrand = new AllocateOrder(); * curBrand.Name = cItem.Name; * curBrand.FirstCharSpell = cItem.FirstCharSpell; * ExportList.Add(curBrand); * }*/ NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void DoExport() { try { List <CostumeColor> list = DataGridViewUtil.BindingListToList <CostumeColor>(dataGridView1.DataSource); System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { if (item.Name == "Column1" || item.Name == "Column3" || item.Name == "Column4") { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } } List <CostumeColor> ExportList = new List <CostumeColor>(); foreach (CostumeColor cItem in list) { CostumeColor curBrand = new CostumeColor(); curBrand.Name = cItem.Name; curBrand.ID = cItem.ID; curBrand.FirstCharSpell = cItem.FirstCharSpell; ExportList.Add(curBrand); } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(ExportList), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void DoExport() { try { List <CostumeStore> unableStore = new List <CostumeStore>(); List <CostumeStore> stores = new List <CostumeStore>(); List <Member> list = dataGridView1.DataSource as List <Member>; List <String> keys = new List <string>(); List <String> values = new List <string>(); DataGridViewColumn[] columns = new DataGridViewColumn[] { this.phoneNumberDataGridViewTextBoxColumn1, this.nameDataGridViewTextBoxColumn1, this.sexNameDataGridViewTextBoxColumn, this.balanceDataGridViewTextBoxColumn1, this.currentIntegrationDataGridViewTextBoxColumn1, this.accruedIntegrationDataGridViewTextBoxColumn1, this.accruedSpendDataGridViewTextBoxColumn1, this.shopIDDataGridViewTextBoxColumn1, this.BuyCount, this.QuantityOfBuy, this.guideIDDataGridViewTextBoxColumn1, this.CreatedTime, }; foreach (var item in columns) { if (item.Visible) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray();//new System.Collections.SortedList(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); ShowMessage("导出完毕!"); } catch (Exception ex) { CommonGlobalUtil.ShowError(ex); } finally { UnLockPage(); } }
private void DoExport() { try { List <SizeGroup> list = DataGridViewUtil.BindingListToList <SizeGroup>(dataGridView1.DataSource); System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { if (item.Name != "enabledDataGridViewCheckBoxColumn" && item.Name != "ColumnEdit" && item.Name != "ColumnDelete") { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } } //List<Brand> ExportList = new List<Brand>(); //foreach (Brand cItem in list) //{ // Brand curBrand = new Brand(); // curBrand.Name = cItem.Name; // curBrand.FirstCharSpell = cItem.FirstCharSpell; // ExportList.Add(curBrand); //} NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
/// <summary> /// 绑定RetailDetail数据源并设置下方的Label值 /// </summary> private void BindingDataSource(List <PriceRangeReport> retailDetailList) { this.dataGridViewDetail.DataSource = null; if (retailDetailList != null && retailDetailList.Count > 0) { foreach (PriceRangeReport detail in retailDetailList) { //Costume costume= GlobalCache.GetCostume(detail.CostumeID); //detail.CostumeName = costume.Name; ////按款查询需要前端补充颜色信息 //if (string.IsNullOrEmpty(detail.ColorName)) //{ // detail.ColorName = costume.Colors; //} detail.ShopName = GlobalCache.GetShopName(detail.ShopID); } // this.dataGridViewDetail.DataSource = retailDetailList; this.dataGridViewPagingSumCtrl.BindingDataSource <PriceRangeReport>(DataGridViewUtil.ToDataTable <PriceRangeReport>(retailDetailList)); } }
private void DoExport() { try { if (dataGridView1.DataSource != null && dataGridView1.Rows.Count > 0) { List <PfAccountRecordSummaryInfo> list = DataGridViewUtil.BindingListToList <PfAccountRecordSummaryInfo>(dataGridView1.DataSource); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { keys.Add(item.DataPropertyName); if (item.Name == "shouldPayDataGridViewTextBoxColumn" || item.Name == "otherMoneyDataGridViewTextBoxColumn" || item.Name == "payMoneyDataGridViewTextBoxColumn") { values.Add("本期发生" + item.HeaderText); } else { values.Add(item.HeaderText); } } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
//点击搜索按钮 private void BaseButton_Search_Click(object sender, EventArgs e) { string memberId = skinTextBoxMemberId.Text; if (string.IsNullOrEmpty(memberId)) { GlobalMessageBox.Show("请先输入会员信息,再进行查询!"); return; } this.pagePara = new GetMemberBalanceChangePara() { StartDate = new Date(this.dateTimePicker_Start.Value), EndDate = new Date(this.dateTimePicker_End.Value), MemberID = memberId, }; InteractResult <List <MemberBalanceChange> > memberList = CommonGlobalCache.ServerProxy.GetMemberBalanceChange(this.pagePara); dataGridViewPagingSumCtrl.BindingDataSource <MemberBalanceChange>(DataGridViewUtil.ToDataTable(memberList.Data)); }
/// <summary> /// 绑定plenishOrderSource源到dataGridView中 /// </summary> /// <param name="listPage"></param> private void BindingSource(List <DayBenefitReport> listPage) { this.skinSplitContainer1.Panel2Collapsed = true; if (listPage != null) { foreach (var item in listPage) { item.RefundRate = Math.Abs(item.RefundRate); item.QuantityOfRefund = Math.Abs(item.QuantityOfRefund); } } this.dataGridViewPagingSumCtrl.BindingDataSource <DayBenefitReport>(DataGridViewUtil.ToDataTable(listPage)); foreach (DataGridViewRow row in dataGridView1.Rows) { DataRowView report = (DataRowView)row.DataBoundItem; if ("总计".Equals(report["ShopName"].ToString())) { row.DefaultCellStyle.Font = new Font(dataGridView1.Font, FontStyle.Bold); } } }
private void DoExport() { try { List <CostumeStore> unableStore = new List <CostumeStore>(); List <CostumeStore> stores = new List <CostumeStore>(); List <CostumeStore> dt = DataGridViewUtil.BindingListToList <CostumeStore>(dataGridView1.DataSource); System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (IsPos) { if (item.Index == CostPrice.Index || item.Index == SumCostMoney.Index) { continue; } } if (item.Visible) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(dt), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void Export(RetailOrder retailOrder) { // RefundOrderPrintUtil printHelper = new RefundOrderPrintUtil(); // List<RetailDetail> retailDetailList = CommonGlobalCache.ServerProxy.GetRetailDetailList(retailOrder.ID); //foreach (var item in retailDetailList) //{ // Costume costume = CommonGlobalCache.GetCostume(item.CostumeID); // // 显示自己设置的尺码组和对应的尺码列表 // item.SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(item.SizeName, CommonGlobalCache.GetSizeGroup(costume.SizeGroupName)); //} try { List <RetailDetail> retailDetailList = CommonGlobalCache.ServerProxy.GetRetailDetailList(retailOrder.ID); // System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); keys.Add("BusinessTime"); values.Add("业务日期"); keys.Add("SaleBillID"); values.Add("销售单号"); keys.Add("GuidId"); values.Add("整单导购员"); keys.Add("Shop"); values.Add("店铺"); keys.Add("VIPCard"); values.Add("VIP卡号"); keys.Add("VIPName"); values.Add("VIP姓名"); foreach (DataGridViewColumn item in dataGridView_RetailDetail.Columns) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } foreach (RetailDetail cItem in retailDetailList) { //cItem.CostumeName = CommonGlobalCache.GetCostumeName(cItem.CostumeID); Costume costume = CommonGlobalCache.GetCostume(cItem.CostumeID); cItem.CostumeName = costume.Name; cItem.SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(cItem.SizeName, CommonGlobalCache.GetSizeGroup(costume.SizeGroupName)); } /* List<CellType> cellList = new List<CellType>(); * NPOIHelper.hsRowCount = 4; * * * CellType curCellI = new CellType(); * curCellI.RowIndex = 0; * curCellI.CellName = ""; * if (ColNum % 2 == 0) * { * * curCellI.CellMergeNum = ColNum / 2 - 1; * } * else * { * curCellI.CellMergeNum = ColNum / 2; * } * cellList.Add(curCellI); * * * * CellType curCell = new CellType(); * curCell.RowIndex = 0; * curCell.CellName = retailOrder.ShopName; * if (ColNum % 2 == 0) * { * curCell.CellMergeNum = ColNum - (ColNum / 2) + 1; * } * else * { * curCell.CellMergeNum = ColNum - (ColNum / 2); * } * // curCell.CellMergeIndex = 12; * cellList.Add(curCell); * * CellType curCellOrder = new CellType(); * curCellOrder.RowIndex = 1; * curCellOrder.CellName = "单号:"; * curCellOrder.CellMergeNum = 1; * cellList.Add(curCellOrder); * * * * CellType curCellOrderValue = new CellType(); * curCellOrderValue.RowIndex = 1; * curCellOrderValue.CellName = retailOrder.ID; * curCellOrderValue.CellMergeNum = 2; * cellList.Add(curCellOrderValue); * * CellType curCellCreaterUser = new CellType(); * curCellCreaterUser.RowIndex = 1; * curCellCreaterUser.CellName = "日期"; * curCellCreaterUser.CellMergeNum = 1; * cellList.Add(curCellCreaterUser); * * CellType curCellCreaterUserValue = new CellType(); * curCellCreaterUserValue.RowIndex = 1; * curCellCreaterUserValue.CellName = retailOrder.CreateTime.GetDateTimeFormats('f')[0].ToString(); * curCellCreaterUserValue.CellMergeNum = 2; * cellList.Add(curCellCreaterUserValue); * * * * CellType curCellTime = new CellType(); * curCellTime.RowIndex = 2; * curCellTime.CellName = "电话"; * curCellTime.CellMergeNum = 1; * cellList.Add(curCellTime); * * CellType curCellTimeValue = new CellType(); * curCellTimeValue.RowIndex =2; * curCellTimeValue.CellName = CommonGlobalCache.CurrentShop?.PhoneNumber; * curCellTimeValue.CellMergeNum = 2; * cellList.Add(curCellTimeValue); * * * * CellType curCellSource = new CellType(); * curCellSource.RowIndex = 2; * curCellSource.CellName = "地址:"; * curCellSource.CellMergeNum = 1; * cellList.Add(curCellSource); * * * * CellType curCellSourceValue = new CellType(); * curCellSourceValue.RowIndex = 2; * curCellSourceValue.CellName = CommonGlobalCache.CurrentShop?.Address; * curCellSourceValue.CellMergeNum = 2; * cellList.Add(curCellSourceValue); * * * CellType curCellTarget = new CellType(); * curCellTarget.RowIndex = 3; * curCellTarget.CellName = "顾问:"; * curCellTarget.CellMergeNum = 1; * cellList.Add(curCellTarget); * * * * CellType curCellTargetValue = new CellType(); * curCellTargetValue.RowIndex = 3; * curCellTargetValue.CellName = CommonGlobalCache.GetUserName(retailOrder.GuideID); * curCellTargetValue.CellMergeNum = 2; * cellList.Add(curCellTargetValue); * * * NPOIHelper.CellValues = cellList;*/ DataTable dt = DataGridViewUtil.ToDataTable(retailDetailList); dt.Columns.Add("BusinessTime"); dt.Columns.Add("SaleBillID"); dt.Columns.Add("GuidId"); dt.Columns.Add("Shop"); dt.Columns.Add("VIPCard"); dt.Columns.Add("VIPName"); foreach (DataRow dr in dt.Rows) { dr["BusinessTime"] = retailOrder.EntryTime.GetDateTimeFormats('f')[0].ToString(); dr["SaleBillID"] = retailOrder.ID; dr["GuidId"] = retailOrder.GuideName; dr["Shop"] = retailOrder.ShopName; dr["VIPCard"] = retailOrder.MemeberID; dr["VIPName"] = retailOrder.MemeberID != null && retailOrder.MemeberID != "" ? CommonGlobalCache.ServerProxy.GetOneMember(retailOrder.MemeberID).Name:""; } List <CellType> cellList = new List <CellType>(); NPOIHelper.bottomHsRowCount = 1; CellType curCellIT = new CellType(); curCellIT.RowIndex = dt.Rows.Count + 1; curCellIT.CellName = "汇总:"; curCellIT.IsCollect = true; curCellIT.CellMergeNum = 1; cellList.Add(curCellIT); for (int k = 0; k < 11; k++) { CellType curCellI = new CellType(); curCellI.RowIndex = dt.Rows.Count + 1; curCellI.CellName = ""; curCellI.CellMergeNum = 1; cellList.Add(curCellI); } CellType curCellTotal = new CellType(); curCellTotal.RowIndex = dt.Rows.Count + 1;//1是要多加一行标题列 curCellTotal.CellName = retailOrder.TotalCount.ToString(); curCellTotal.IsCollect = true; curCellTotal.CellMergeNum = 1; cellList.Add(curCellTotal); CellType curCellTotalPrice = new CellType(); curCellTotalPrice.RowIndex = dt.Rows.Count + 1; curCellTotalPrice.CellName = retailOrder.TotalMoneyReceived.ToString(); curCellTotalPrice.CellMergeNum = 1; curCellTotalPrice.IsCollect = true; cellList.Add(curCellTotalPrice); NPOIHelper.BottomCellValues = cellList; NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(dt, path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void DoExport() { try { List <PfAccountContrastInfo> unableStore = new List <PfAccountContrastInfo>(); List <PfAccountContrastInfo> stores = new List <PfAccountContrastInfo>(); // List<PfAccountContrastInfo> list = DataGridViewUtil.BindingListToList<PfAccountContrastInfo>(dataGridView1.DataSource); List <PfAccountContrastInfo> list = (List <PfAccountContrastInfo>) this.dataGridView1.DataSource; System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { //if (IsPos) //{ // if (item.Index == CostPrice.Index || item.Index == SumCostMoney.Index) // { // continue; // } //} if (item.Visible) { if (item.DataPropertyName == "InCount") { keys.Add(item.DataPropertyName); // values.Add("发货\r\n" + item.HeaderText); values.Add("发货" + item.HeaderText); } else if (item.DataPropertyName == "InMoney") { keys.Add(item.DataPropertyName); // values.Add("发货\r\n" + item.HeaderText); values.Add("发货" + item.HeaderText); } else if (item.DataPropertyName == "OutCount") { keys.Add(item.DataPropertyName); //values.Add("退货\r\n" + item.HeaderText); values.Add("退货" + item.HeaderText); } else if (item.DataPropertyName == "OutMoney") { keys.Add(item.DataPropertyName); //values.Add("退货\r\n" + item.HeaderText); values.Add("退货" + item.HeaderText); } else { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } } List <CellType> cellList = new List <CellType>(); NPOIHelper.hsRowCount = 1; CellType curCell = new CellType(); curCell.RowIndex = 0; curCell.CellName = "客户:" + PfCustomerCache.PfCustomerList.Find(t => t.ID.Equals(ValidateUtil.CheckEmptyValue(skinComboBoxSupplier.SelectedValue))).Name; curCell.CellMergeNum = 4; cellList.Add(curCell); CellType curCellTime = new CellType(); curCellTime.RowIndex = 0; curCellTime.CellName = "业务时间:" + new CJBasic.Date(this.dateTimePicker_Start.Value) + "至" + new CJBasic.Date(this.dateTimePicker_End.Value); curCellTime.CellMergeNum = 6; cellList.Add(curCellTime); NPOIHelper.CellValues = cellList; NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); NPOIHelper.CellValues = null; GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
/// <summary> /// 绑定CostumeStore数据源 /// </summary> /// <param name="listPage"></param> private void BindingCostumeStoreDataSource(PfCustomerStorePage listPage) { this.dataGridView1.DataSource = null; this.costumeStoreList.Clear(); if (listPage != null && listPage.PfCustomerStores != null) { foreach (PfCustomerStore store in listPage.PfCustomerStores) { Costume costume = CommonGlobalCache.GetCostume(store.CostumeID); if (costume != null) { store.PfCustomerName = PfCustomerCache.GetPfCustomerName(store.PfCustomerID); store.CostumeName = costume.Name; store.Remarks = costume.Remarks; } this.costumeStoreList.Add(store); } if (this.costumeStoreList != null && this.costumeStoreList.Count > 0) { this.dataGridViewPagingSumCtrl.BindingDataSource <PfCustomerStore>(DataGridViewUtil.ToDataTable <PfCustomerStore>(costumeStoreList)); } } this.dataGridView1.Refresh(); }