Пример #1
0
        private void BaseButton_TakeInteger_Click(object sender, EventArgs e)
        {
            try
            {
                decimal newSmallMoneyRemoved = decimal.Parse(this.skinTextBox_TakeInteger.SkinTxt.Text);
                if (newSmallMoneyRemoved > GlobalCache.GetShop(this.shopID).MaxChangeRemoved)
                {
                    GlobalMessageBox.Show(string.Format("抹零金额不能大于店铺的最大抹零金额:{0}元", GlobalCache.GetShop(this.shopID).MaxChangeRemoved));
                    return;
                }

                decimal oldSmallMoneyRemoved = 0;
                if (this.m_SmallMoneyRemoved != 0)
                {
                    oldSmallMoneyRemoved = this.m_SmallMoneyRemoved;
                }
                this.m_SmallMoneyRemoved = newSmallMoneyRemoved;

                this.skinLabel_TakeIntegerMoney.Text = this.m_SmallMoneyRemoved.ToString();
                this.totalMoneyReceived = this.totalMoneyReceived + oldSmallMoneyRemoved - this.m_SmallMoneyRemoved;
                this.skinLabel_TotalMoneySupposed.Text = this.totalMoneyReceived.ToString();
                this.skinLabel_MoneyChange.Text        = this.moneyChange.ToString();
                this.moneyChange = this.moneyChange - oldSmallMoneyRemoved + this.m_SmallMoneyRemoved;
                this.skinTextBox_TakeInteger.SkinTxt.Text = "";
                UpdateMoneyValue();
            }
            catch (Exception ee)
            {
                GlobalUtil.WriteLog(ee);
                GlobalMessageBox.Show("抹零金额格式不正确");
            }
        }
Пример #2
0
        /// <summary>
        /// 生成ReplenishCostume对象
        /// </summary>
        /// <returns></returns>
        private ReplenishCostume BuildReplenishCostume()
        {
            if (this.curReplenishDetailList == null || this.curReplenishDetailList.Count == 0)
            {
                return(null);
            }

            string id = IDHelper.GetID(OrderPrefix.ReplenishOrder, GlobalCache.GetShop(shopID).AutoCode);

            if (action == OperationEnum.Pick)
            {
                id = this.order?.ID;
            }
            int     totalCount          = 0;
            decimal totalMoney          = 0;
            List <ReplenishDetail> list = new List <ReplenishDetail>();

            for (int i = 0; i < this.curReplenishDetailList.Count; i++)
            {
                if (this.curReplenishDetailList[i].SumCount == 0)
                {
                    continue;
                }
                list.Add(this.curReplenishDetailList[i]);
                totalCount += this.curReplenishDetailList[i].SumCount;
                totalMoney += this.curReplenishDetailList[i].SumMoney;
                this.curReplenishDetailList[i].ReplenishOrderID = id;
            }

            ReplenishOrder replenishOrder = new ReplenishOrder()
            {
                ID             = id,
                RequestGuideID = GlobalCache.CurrentUserID,// (string)this.guideComboBox1.SelectedValue,
                ShopID         = shopID,
                Remarks        = this.skinTextBox_Remarks.SkinTxt.Text,
                State          = (byte)ReplenishOrderState.NotProcessing,
                TotalCount     = totalCount,
                TotalPrice     = totalMoney,
                CreateTime     = DateTime.Now,
                FinishedTime   = SystemDefault.DateTimeNull,
            };

            return(new ReplenishCostume()
            {
                ReplenishOrder = replenishOrder,
                ReplenishDetailList = list
            });
        }
Пример #3
0
        private void Initialize()
        {
            try
            {
                ResetAll(false);

                skinComboBox_PfCustomer.Initialize(true, true);
                //默认选择总仓
                shop = GlobalCache.GetShop(GlobalCache.GeneralStoreShopID);
                LoadOrder(order);

                DataGridViewUtil.SetAlternatingColor(dataGridView1, Color.Gainsboro, Color.White);
                balanceRound = GlobalCache.GetParameter(ParameterConfigKey.PfPriceRound).ParaValue == "1";
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
        }
Пример #4
0
        private void BaseButton_OK_Click(object sender, EventArgs e)
        {
            try
            {
                int discount = int.Parse(this.skinTextBox_Discount.SkinTxt.Text.Trim());
                if (discount > 100)
                {
                    GlobalMessageBox.Show("折扣值不能大于100");
                    return;
                }
                if (discount < GlobalCache.GetShop(curShopId).MinDiscount)
                {
                    GlobalMessageBox.Show(string.Format("本店最低折扣值{0},输入值不能低于它", GlobalCache.GetShop(curShopId).MinDiscount));
                    return;
                }

                this.DiscountConfirm(discount, "");
                this.DialogResult = DialogResult.OK;
            }
            catch
            {
                GlobalMessageBox.Show("折扣格式不正确!");
            }
        }
Пример #5
0
        internal static InsertShopResult Shop_OnInsert(Shop shop)
        {
            InsertShopResult result = InsertShopResult.GeneralStoreIsExist;

            //如果标识为总仓,则更新原有的默认仓库

            if (shop.IsGeneralStore && GlobalCache.ShopList != null && GlobalCache.ShopList.Count > 0)
            {
                //

                Shop store = GlobalCache.GetShop(GlobalCache.GeneralStoreShopID);
                if (store != null)
                {
                    if (GlobalMessageBox.Show("总仓已存在,是否覆盖?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        store.IsGeneralStore = false;
                        UpdateShopResult updateShopResult = GlobalCache.ServerProxy.UpdateShop(store);
                        if (updateShopResult != UpdateShopResult.Success)
                        {
                            store.IsGeneralStore = true;
                            return(result);
                        }
                    }
                    else
                    {
                        return(result);
                    }
                }
            }

            InsertShopGetAutoCode insertShopGetAutoCode = GlobalCache.ServerProxy.InsertShop(shop);

            result = insertShopGetAutoCode.InsertShopResult;
            switch (result)
            {
            case InsertShopResult.Success:
                shop.AutoCode = insertShopGetAutoCode.AutoCode;
                //if (GlobalCache.ShopList == null)
                //{
                //    GlobalCache.ShopList = new List<Shop>();
                //}

                //ShopList必须是属性,不要改成从字典GET
                GlobalCache.ShopList.Add(shop);
                if (shop.IsGeneralStore)
                {
                    GlobalCache.currentShopID = GlobalCache.generalStoreShopID = shop.ID;
                }
                break;

            case InsertShopResult.GeneralStoreIsExist:
                break;

            case InsertShopResult.Error:
                break;

            default:
                break;
            }
            return(result);
        }
Пример #6
0
        private void BaseButton_ConfirmRefund_Click(object sender, EventArgs e)
        {
            try
            {
                if (originalRetailCostume == null)
                {
                    GlobalMessageBox.Show("请选择销售单!");
                    return;
                }
                if (!string.IsNullOrEmpty(this.originalRetailCostume.RetailOrder.RefundOrderID))
                {
                    GlobalMessageBox.Show("该销售单号已经退过货,不能再次退货!");
                    return;
                }
                if (this.originalRetailCostume.RetailOrder.IsCancel)
                {
                    GlobalMessageBox.Show("该销售单号已被冲单!");
                    return;
                }

                if (this.guideComboBox1.SelectedIndex == 0)
                {
                    GlobalMessageBox.Show("该笔单的导购员不能为空!");
                    return;
                }
                string id = IDHelper.GetID(OrderPrefix.RefundOrder, GlobalCache.GetShop(shopID).AutoCode);

                //if (this.currentRetailCostume.RetailOrder.ShopID != shopID || this.currentRetailCostume.RetailOrder.EmOnline)
                //{
                //    GlobalMessageBox.Show("该商品不是在本店销售的,不能退货!");
                //    return;
                //}
                bool isNoHasGuidFlag = false;
                if (this.currentRetailCostume.RetailDetailList != null && this.currentRetailCostume.RetailDetailList.Count > 0)
                {
                    foreach (RetailDetail detail in this.currentRetailCostume.RetailDetailList)
                    {
                        if (detail.GuideID == null || detail.GuideID == "")
                        {
                            isNoHasGuidFlag = true;
                            break;
                        }
                    }
                }
                if (isNoHasGuidFlag)
                {
                    GlobalMessageBox.Show("导购员不能为空,请检查列表里所有款号的导购员!");
                    return;
                }

                #region 创建RefundCostume对象


                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";

                RefundCostume costume = new RefundCostume()
                {
                    RefundOrder      = null,
                    RefundDetailList = new List <RetailDetail>()
                };
                int     totalCount = 0;
                decimal totalPrice = 0;
                decimal totalCost  = 0;
                foreach (RetailDetail detail in this.currentRetailCostume.RetailDetailList)
                {
                    if (detail.IsRefund && detail.RefundCount > 0)
                    {
                        totalCount += detail.RefundCount;
                        totalPrice += detail.RefundCount * detail.Price;
                        totalCost  += detail.RefundCount * detail.CostPrice;

                        costume.RefundDetailList.Add(this.RetailDetailToRefundDetail(detail, id));
                    }
                }
                List <String> costumeIds = new List <string>();
                foreach (var item in costume.RefundDetailList)
                {
                    if (!costumeIds.Contains(item.CostumeID))
                    {
                        costumeIds.Add(item.CostumeID);
                    }
                }

                if (costumeIds != null && costumeIds.Count > 0)
                {
                    //判断是否又禁用的商品,并提示返回
                    InteractResult interactResult = GlobalCache.ServerProxy.IsCostumeValid(costumeIds);
                    if (interactResult.ExeResult == ExeResult.Error)
                    {
                        GlobalMessageBox.Show(interactResult.Msg);
                        return;
                    }
                }

                RetailOrder refundOrder = new RetailOrder()
                {
                    ID            = id,
                    IsRefundOrder = true,
                    OriginOrderID = this.currentRetailCostume.RetailOrder.ID,
                    // GuideID = this.currentRetailCostume.RetailOrder.GuideID,
                    //  OperateGuideID = this.currentRetailCostume.RetailOrder.GuideID,
                    GuideID          = (string)this.guideComboBox1.SelectedValue,
                    ShopID           = shopID,
                    MemeberID        = this.currentRetailCostume.RetailOrder.MemeberID,
                    SalesPromotionID = this.currentRetailCostume.RetailOrder.SalesPromotionID,
                    PromotionText    = this.currentRetailCostume.RetailOrder.PromotionText,
                    EntryUserID      = CommonGlobalCache.CurrentUserID,
                    //   TotalMoneyReceived = this.currentRetailCostume.RetailOrder.TotalMoneyReceived,
                    // TotalMoneyReceivedActual = this.currentRetailCostume.RetailOrder.TotalMoneyReceivedActual,
                    MoneyBankCard     = 0,
                    MoneyWeiXin       = 0,
                    MoneyAlipay       = 0,
                    MoneyOther        = 0,
                    SmallMoneyRemoved = 0,
                    MoneyChange       = 0,
                    TotalCount        = totalCount * -1,
                    TotalCost         = totalCost * -1,
                    TotalPrice        = totalPrice * -1,
                    MoneyDiscounted   = -totalCount == this.originalRetailCostume.RetailOrder.TotalCount ? this.originalRetailCostume.RetailOrder.MoneyDiscounted * -1 : 0,//若是全部退款,折扣金额为原始折扣金额,否则为0
                    Remarks           = this.skinTextBox_RefundReason.SkinTxt.Text.Trim(),
                    CreateTime        = dateTimePicker_Start.Value,
                    EntryTime         = DateTime.Now,
                    IsNotPay          = this.currentRetailCostume.RetailOrder.IsNotPay,
                };
                costume.RefundOrder = refundOrder;
                #endregion
                decimal sourceTotalMoneyReceived = this.currentRetailCostume.RetailOrder.TotalMoneyReceived;

                #region 根据活动获取退款的金额,并赋值给RefundCostume
                decimal originalDonate = 0;
                if (this.originalRetailCostume.RetailOrder.MoneyVipCard != 0)
                {
                    originalDonate = this.originalRetailCostume.RetailOrder.MoneyVipCardDonate / this.originalRetailCostume.RetailOrder.MoneyVipCard;
                }
                //应该退还的金额

                decimal moneyBuyByTicket = CalGiftTicket(costume);

                SettlementMoney settlementMoney = new SettlementMoney(balanceRound);

                RefundMoney refundMoney = settlementMoney.GetRefundMoney(this.originalRetailCostume, costume, moneyBuyByTicket, GlobalCache.GetSalesPromotionFromAll(this.originalRetailCostume.RetailOrder.SalesPromotionID), GlobalCache.CurrentShop.MinDiscount);
                costume.RefundOrder.MoneyCash          = refundMoney.RefundCash * -1;
                costume.RefundOrder.MoneyCash2         = costume.RefundOrder.MoneyCash;
                costume.RefundOrder.MoneyIntegration   = refundMoney.RefundIntegration * -1;
                costume.RefundOrder.MoneyVipCard       = refundMoney.RefundStoredCard * -1;
                costume.RefundOrder.MoneyVipCardMain   = refundMoney.RefundStoredCard * (1 - originalDonate) * -1;
                costume.RefundOrder.MoneyVipCardDonate = refundMoney.RefundStoredCard * originalDonate * -1;
                //costume.RefundOrder.MoneyBuyByTicket = moneyBuyByTicket;
                costume.RefundOrder.RetailMoneyDeductedByTicket = originalRetailCostume.RetailOrder.MoneyDeductedByTicket;
                costume.RefundOrder.MoneyDeductedByTicket       = moneyBuyByTicket;

                //总计=现金+积分+VIP卡+优惠券
                //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券
                costume.RefundOrder.TotalMoneyReceived       = costume.RefundOrder.MoneyCash + costume.RefundOrder.MoneyIntegration + costume.RefundOrder.MoneyVipCard;
                costume.RefundOrder.TotalMoneyReceivedActual = costume.RefundOrder.MoneyCash + costume.RefundOrder.MoneyVipCardMain;
                costume.RefundOrder.Benefit = costume.RefundOrder.TotalMoneyReceivedActual - costume.RefundOrder.TotalCost;
                ////平摊

                #endregion
                if (Math.Abs(costume.RefundOrder.TotalCount) < 1)
                {
                    GlobalMessageBox.Show("退货数量不能小于1");
                    return;
                }


                //foreach (RetailDetail detail in costume.RefundDetailList)
                //{
                //    if (detail.IsRefund && detail.RefundCount > 0)
                //    {
                //        detail.SinglePrice = detail.SumMoney / detail.BuyCount * -1;
                //    }
                //}

                ConfirmRefundForm confirmRefundForm = new ConfirmRefundForm(costume, shopID, this.dataGridView1, sourceTotalMoneyReceived, 1);
                DialogResult      result            = confirmRefundForm.ShowDialog();
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                this.ResetForm();
            }
            catch (Exception ee)
            {
                GlobalUtil.ShowError(ee);
            }
        }