//将绑定的RetailDetail源转换成RefundDetail private RetailDetail RetailDetailToRefundDetail(RetailDetail retailDetail, string orderID) { return(new RetailDetail() { RetailOrderID = orderID, CostumeID = retailDetail.CostumeID, CostumeName = GlobalCache.GetCostumeName(retailDetail.CostumeID), ColorName = retailDetail.ColorName, SizeName = retailDetail.SizeName, Discount = retailDetail.Discount, DiscountOrigin = retailDetail.DiscountOrigin, IsRefund = true, Price = retailDetail.Price, BuyCount = retailDetail.RefundCount * -1, IsBuyout = retailDetail.IsBuyout, BrandName = ValidateUtil.CheckNotNullValue(retailDetail.BrandName), GiftTicketMoney = retailDetail.GiftTicketMoney, //268 畅滞排行榜:商品退货后,零售金额变成0 //20180820 summoney 修改为除以购买数量再乘以退货数量 SalePrice = Math.Round((retailDetail.SumMoney / retailDetail.BuyCount) * -1, 1, MidpointRounding.AwayFromZero),//每件商品退货单价 SumMoney = Math.Round(retailDetail.RefundCount * (retailDetail.SumMoney / retailDetail.BuyCount) * -1, 1, MidpointRounding.AwayFromZero), SumMoneyActual = Math.Round(retailDetail.RefundCount * retailDetail.Price * -1, 1, MidpointRounding.AwayFromZero), SizeDisplayName = retailDetail.SizeDisplayName, //retailDetail.RefundCount * retailDetail.Price * -1, CostPrice = retailDetail.CostPrice * -1, SumCost = retailDetail.RefundCount * retailDetail.CostPrice * -1, Remarks = retailDetail.Remarks, InSalesPromotion = retailDetail.InSalesPromotion, GiftTickets = retailDetail.GiftTickets, RefundCount = retailDetail.RefundCount, OccureTime = dateTimePicker_Start.Value, GuideID = retailDetail.GuideID, }); }
private void BaseButton_AddCostume_Click(object sender, EventArgs e) { try { int buyCount = int.Parse(this.skinTextBox_bugCount.SkinTxt.Text); if (buyCount <= 0) { GlobalMessageBox.Show("退货数量必须大于0!"); return; } string selectShopid = ValidateUtil.CheckEmptyValue(this.skinComboBoxShopID.SelectedValue); List <Guide> guideList = CommonGlobalCache.GuideList.FindAll(t => t.State == 0 && t.ShopID == selectShopid); this.GuideName.DataSource = guideList; this.GuideName.DisplayMember = "Name"; this.GuideName.ValueMember = "ID"; string defaultGuid = string.Empty; if (this.guideComboBox1.SelectedIndex > 0) { defaultGuid = ValidateUtil.CheckEmptyValue(this.guideComboBox1.SelectedValue); } RetailDetail detail = new RetailDetail() { Costume = this.currentSelectedItem.Costume, CostumeID = this.currentSelectedItem.Costume.ID, CostumeName = this.currentSelectedItem.Costume.Name, ColorName = this.skinComboBox_Color.Text, SizeName = ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue), GuideID = defaultGuid, // 显示自己设置的尺码组和对应的尺码列表 SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue), CommonGlobalCache.GetSizeGroup(this.currentSelectedItem.Costume.SizeGroupName)), IsRefund = true, RefundCount = buyCount, BuyCount = buyCount, Price = this.currentSelectedItem.Costume.Price, SumMoney = this.currentSelectedItem.Costume.Price * buyCount, SumMoneyActual = this.currentSelectedItem.Costume.Price * buyCount, BrandName = ValidateUtil.CheckNotNullValue(currentSelectedItem.Costume.BrandName), // SinglePrice = this.currentSelectedItem.Costume.Price, IsUseTickets = false, ///288 收银时,商品的备注显示的是商品的备注 //Remarks = this.currentSelectedItem.Costume.Remarks, Discount = 100, DiscountOrigin = 100, AllowReviseDiscount = true,//this.currentSelectedStore.AllowReviseDiscount, CostPrice = this.currentSelectedItem.Costume.CostPrice, SumCost = this.currentSelectedItem.Costume.CostPrice * buyCount, }; if (!this.AddSelectedCostumeToList(detail)) { return; } dataGridViewPagingSumCtrl.BindingDataSource(DataGridViewUtil.ListToBindingList(this.retailDetailList)); this.skinTextBox_bugCount.SkinTxt.Text = "1"; } catch (Exception ee) { CommonGlobalUtil.WriteLog(ee); GlobalMessageBox.Show("添加失败!"); } }