Пример #1
0
        private void Print(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));
            }

            RefundCostume retailCostume = new RefundCostume()
            {
                RefundDetailList = retailDetailList,
                RefundOrder      = retailOrder,
            };
            int          times = CommonGlobalUtil.ConvertToInt32(CommonGlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue);
            DataGridView dgv   = deepCopyDataGridView();

            printHelper.Print(retailCostume, times, dgv);
        }
Пример #2
0
        private void BaseButton_OK_Click(object sender, EventArgs e)
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                if (this.refundCostume.RefundOrder.TotalCount == 0)
                {
                    GlobalMessageBox.Show("退货数量为0,不能退货");
                    return;
                }

                if (Math.Abs(skinLabel_TotalMoney.Value) != (skinLabel_RefundIntegration.Value + skinLabel_RefundStoredCard.Value + skinLabel_RefundCash.Value +
                                                             this.numericTextBoxBankCard.Value +
                                                             this.numericTextBoxWeixin.Value +
                                                             this.numericTextBoxAlipay.Value +
                                                             this.numericTextBoxElse.Value
                                                             ))
                {
                    GlobalMessageBox.Show("退款总额必须与总计相等!");
                    return;
                }


                this.refundCostume.RefundOrder.MoneyIntegration = skinLabel_RefundIntegration.Value * -1;
                this.refundCostume.RefundOrder.MoneyVipCard     = skinLabel_RefundStoredCard.Value * -1;
                this.refundCostume.RefundOrder.MoneyCash        = skinLabel_RefundCash.Value * -1;
                this.refundCostume.RefundOrder.MoneyAlipay      = numericTextBoxAlipay.Value * -1;
                this.refundCostume.RefundOrder.MoneyOther       = numericTextBoxElse.Value * -1;
                this.refundCostume.RefundOrder.MoneyWeiXin      = numericTextBoxWeixin.Value * -1;
                this.refundCostume.RefundOrder.MoneyBankCard    = numericTextBoxBankCard.Value * -1;
                //  decimal moneyVipCardDonate = this.refundCostume.RefundOrder.MoneyVipCard * (decimal)member.DonateCoef;
                //  decimal moneyVipCardMain = this.refundCostume.RefundOrder.MoneyVipCard * (1 - (decimal)member.DonateCoef);
                if (!String.IsNullOrEmpty(refundCostume.RefundOrder.MemeberID))
                {
                    Member member = CommonGlobalCache.ServerProxy.GetOneMember(refundCostume.RefundOrder.MemeberID);
                    if (member != null)
                    {
                        decimal moneyVipCardMain = refundCostume.RefundOrder.MoneyVipCard * (decimal)(1.0 - member.DonateCoef);
                        refundCostume.RefundOrder.MoneyCash2         = refundCostume.RefundOrder.MoneyCash;
                        refundCostume.RefundOrder.MoneyVipCardMain   = moneyVipCardMain;
                        refundCostume.RefundOrder.MoneyVipCardDonate = refundCostume.RefundOrder.MoneyVipCard * (decimal)(member.DonateCoef);
                    }
                }
                else
                {
                    refundCostume.RefundOrder.MoneyCash2         = refundCostume.RefundOrder.MoneyCash;
                    refundCostume.RefundOrder.MoneyVipCardMain   = 0;
                    refundCostume.RefundOrder.MoneyVipCardDonate = 0;
                }
                if (refundCostume.RefundOrder.IsNotPay)
                {
                    decimal total = 0;
                    foreach (RetailDetail curDetail in this.refundCostume.RefundDetailList)
                    {
                        foreach (RetailDetail keepDetail in keepCostume.RefundDetailList)
                        {
                            if (curDetail.RetailOrderID == keepDetail.RetailOrderID && curDetail.CostumeID == keepDetail.CostumeID && curDetail.ColorName == keepDetail.ColorName && curDetail.SizeName == keepDetail.SizeName)
                            {
                                curDetail.SumMoney = keepDetail.SumMoney;
                                total += keepDetail.SumMoney;
                            }
                        }
                    }

                    refundCostume.RefundOrder.TotalMoneyReceived = total * -1;
                }
                else
                {
                    //总计=现金+积分+VIP卡+优惠券
                    //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券
                    refundCostume.RefundOrder.TotalMoneyReceived = refundCostume.RefundOrder.MoneyCash + refundCostume.RefundOrder.MoneyIntegration + refundCostume.RefundOrder.MoneyVipCard
                                                                   + this.refundCostume.RefundOrder.MoneyAlipay + this.refundCostume.RefundOrder.MoneyOther +
                                                                   this.refundCostume.RefundOrder.MoneyWeiXin +
                                                                   this.refundCostume.RefundOrder.MoneyBankCard;
                    refundCostume.RefundOrder.TotalMoneyReceivedActual = refundCostume.RefundOrder.MoneyCash
                                                                         + this.refundCostume.RefundOrder.MoneyAlipay + this.refundCostume.RefundOrder.MoneyOther +
                                                                         this.refundCostume.RefundOrder.MoneyWeiXin +
                                                                         this.refundCostume.RefundOrder.MoneyBankCard
                                                                         + refundCostume.RefundOrder.MoneyVipCardMain + (refundCostume.RefundOrder.RetailMoneyDeductedByTicket - refundCostume.RefundOrder.MoneyDeductedByTicket);
                    refundCostume.RefundOrder.Benefit = refundCostume.RefundOrder.TotalMoneyReceivedActual - refundCostume.RefundOrder.TotalCost;



                    //平摊
                    if (refundCostume.RefundDetailList != null)
                    {
                        CalcDirectly();
                    }

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

                refundCostume.RefundOrder.ShopID = this.ShopID;
                InteractResult result = GlobalCache.ServerProxy.RefundCostume(this.refundCostume);

                if (result.ExeResult == ExeResult.Success)
                {
                    GlobalMessageBox.Show("退货成功!");
                    this.DialogResult = DialogResult.OK;
                    if (skinCheckBoxPrint.Checked)
                    {
                        RefundOrderPrintUtil printHelper = new RefundOrderPrintUtil();
                        int          times = CommonGlobalUtil.ConvertToInt32(CommonGlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue);
                        DataGridView dgv   = deepCopyDataGridView();
                        printHelper.Print(refundCostume, times, dgv);
                    }
                }
                else if (result.ExeResult == ExeResult.Error)
                {
                    GlobalMessageBox.Show(result.Msg);
                }
            }
            catch (Exception ee)
            {
                GlobalUtil.WriteLog(ee);
                GlobalMessageBox.Show("内部错误,退货失败!");
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }