private void skinComboBoxShopID_SelectedIndexChanged(object sender, EventArgs e) { string supplierId = ValidateUtil.CheckEmptyValue(skinComboBox_PfCustomer.SelectedValue); if (!String.IsNullOrEmpty(selectedSupplierID) && selectedSupplierID != supplierId && curInboundDetailList != null && curInboundDetailList.Count > 0) { List <PfOrderDetail> pfDetails = new List <PfOrderDetail>(); foreach (var item in curInboundDetailList) { item.CustomerID = supplierId; //item.CustomerName = GlobalCache(item.CustomerID); Costume citem = GlobalCache.GetCostume(item.CostumeID); if (pfCustomer != null) { item.CustomerName = pfCustomer.Name; item.PfPrice = citem.Price == 0 ? 0 : Math.Round(citem.Price * pfCustomer.PfDiscount * (decimal)0.01, 2, MidpointRounding.AwayFromZero); } pfDetails.Add(item); } this.curInboundDetailList.Clear(); this.curInboundDetailList = pfDetails; // dataGridViewPagingSumCtrl3.BindingDataSource<PfOrderDetail>(this.curInboundDetailList); dataGridViewPagingSumCtrl2.BindingDataSource <PfOrderDetail>(this.curInboundDetailList); dataGridViewPagingSumCtrl2.ScrollToEnd(); } if (skinComboBox_PfCustomer.SelectedItem != null) { skinLabel1Account.Text = "账套:" + (skinComboBox_PfCustomer.SelectedItem as PfCustomer)?.BusinessAccountID; } selectedSupplierID = supplierId; }
/// <summary> /// 绑定RetailDetail数据源并设置下方的Label值 /// </summary> private void BindingDataSource( CostumeRetailAnalysisPage listPage) { this.dataGridViewDetail.DataSource = null; if (listPage != null && listPage.CostumeRetailAnalysisList != null) { foreach (CostumeRetailAnalysis item in listPage.CostumeRetailAnalysisList) { Costume costume = GlobalCache.GetCostume(item.CostumeID); //按款查询需要前端补充颜色信息 if (string.IsNullOrEmpty(item.ColorName)) { item.ColorName = costume.Colors; } item.Price = costume.Price; item.BigClass = costume.BigClass; item.SmallClass = costume.SmallClass; item.Season = costume.Season; item.Year = costume.Year; item.CostumeName = costume.Name; item.BrandName = GlobalCache.GetBrandName(costume.BrandID); item.ShopName = GlobalCache.GetShopName(item.ShopID); decimal totalPrice = item.Price * item.QuantityOfSale; if (totalPrice == 0) { item.AvgDiscount = 100; } else { item.AvgDiscount = MathHelper.Rounded(item.MoneyOfSale / totalPrice, 2); } } this.dataGridViewDetail.DataSource = listPage?.CostumeRetailAnalysisList; } }
private void skinComboBoxShopID_SelectedIndexChanged(object sender, EventArgs e) { string supplierId = ValidateUtil.CheckEmptyValue(skinComboBox_PfCustomer.SelectedValue); if (!String.IsNullOrEmpty(selectedSupplierID) && selectedSupplierID != supplierId && curInboundDetailList != null && curInboundDetailList.Count > 0) { List <PfOrderDetail> pfDetails = new List <PfOrderDetail>(); foreach (var item in curInboundDetailList) { item.CustomerID = supplierId; item.CustomerName = pfCustomer.Name; Costume citem = GlobalCache.GetCostume(item.CostumeID); item.PfPrice = citem.Price == 0 ? 0 : Math.Round(citem.Price * pfCustomer.PfDiscount * (decimal)0.01, 2, MidpointRounding.AwayFromZero); pfDetails.Add(item); } this.curInboundDetailList.Clear(); this.curInboundDetailList = pfDetails; dataGridViewPagingSumCtrl2.BindingDataSource <PfOrderDetail>(DataGridViewUtil.ListToBindingList(this.curInboundDetailList)); // dataGridViewPagingSumCtrl3.BindingDataSource<PfOrderDetail>(DataGridViewUtil.ListToBindingList(this.curInboundDetailList)); dataGridViewPagingSumCtrl2.ScrollToEnd(); /* GlobalMessageBox.Show("请选择相同的客户!"); * skinComboBox_PfCustomer.SelectedValue = selectedSupplierID; * return;*/ } selectedSupplierID = supplierId; // this.costumeFromSupplierTextBox1.SupplierID = supplierId; }
private BoundDetail CostumeStoreConvertToOutboundDetail(CostumeStore store, string replenishOrderID) { if (store == null) { return(null); } Costume costume = GlobalCache.GetCostume(store.CostumeID); BoundDetail boundDetail = new BoundDetail(); ReflectionHelper.CopyProperty(costume, boundDetail); ReflectionHelper.CopyProperty(store, boundDetail); boundDetail.SupplierID = ValidateUtil.CheckEmptyValue(this.skinComboBoxSupplierID.SelectedValue); return(boundDetail); }
private void BindingOutboundDetailSource() { if (this.curDetailList != null && this.curDetailList.Count > 0) { foreach (BoundDetail detail in this.curDetailList) { Costume curCostume = GlobalCache.GetCostume(detail.CostumeID); detail.CostumeName = curCostume.Name; detail.BrandName = GlobalCache.GetBrandName(curCostume.BrandID); detail.Year = curCostume.Year; detail.Season = curCostume.Season; } } dataGridViewPagingSumCtrl2.BindingDataSource <BoundDetail>(DataGridViewUtil.ListToBindingList(curDetailList)); }
/// <summary> /// 绑定RetailDetail数据源并设置下方的Label值 /// </summary> private void BindingDataSource(List <SalesQuantityRanking> retailDetailList) { this.dataGridViewDetail.DataSource = null; if (retailDetailList != null && retailDetailList.Count > 0) { foreach (SalesQuantityRanking 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; } }
private void BaseButton_Add_Click(object sender, EventArgs e) { try { if (this.curSelectedCostumeStoreList == null || this.curSelectedCostumeStoreList.Count == 0) { return; } List <CostumeStore> costumeStoreList = this.curSelectedCostumeStoreList.FindAll((x) => x.Title == "退货"); AddStoreCache(this.curSelectedCostumeStoreList.FindAll((x) => x.Title == "库存")); foreach (CostumeStore store in costumeStoreList) { if (store.SumCount == 0) { continue; } if (store.Remarks == null) { store.Remarks = ""; } BoundDetail detail = this.CostumeStoreConvertToOutboundDetail(store, ""); detail.Comment = store.Remarks; detail.Year = GlobalCache.GetCostume(store.CostumeID).Year; detail.Season = GlobalCache.GetCostume(store.CostumeID).Season; this.OutboundDetailListAddItem(detail); } //清空dataGirdView1的绑定源 this.SetCostumeDetails(null); this.BindingOutboundDetailSource(); this.CostumeCurrentShopTextBox1.Focus(); } catch (Exception ex) { GlobalUtil.ShowError(ex); } }