示例#1
0
        private void ResetForm()
        {
            this.originalRetailCostume    = null;
            this.currentRetailCostume     = null;
            this.dataGridView1.DataSource = null;
            this.dataGridView1.Refresh();

            this.skinLabel_MemberName.Text             = "";
            this.skinLabel_MemberID.Text               = "";
            this.skinLabel_GuideID.Text                = "";
            this.skinLabel_SalesPromotion.Text         = "";
            this.retailOrderIDTextBox1.SkinTxt.Text    = "";
            this.skinTextBox_RefundReason.SkinTxt.Text = "";

            this.skinLabel_MoneyIntegration.Text   = string.Empty;
            this.skinLabel_MoneyStoredCard.Text    = string.Empty;
            this.skinLabel_TotalMoneyReceived.Text = string.Empty;
            this.skinLabel_SmallMoneyRemoved.Text  = string.Empty;
            this.skinLabel_MoneyCash.Text          = string.Empty;
            this.skinLabel_MoneyStoredCard.Text    = string.Empty;
            this.skinLabel_MoneyBankCard.Text      = string.Empty;
            this.skinLabel_MoneyWeiXin.Text        = string.Empty;
            this.skinLabel_MoneyAlipay.Text        = string.Empty;
            this.skinLabelOther.Text        = string.Empty;
            this.skinLabel_MoneyChange.Text = string.Empty;
            skinLabelGiftTicket.Text        = string.Empty;
            skinLabel_remark.Text           = string.Empty;
        }
示例#2
0
        /// <summary>
        /// 结算销售单的应收金额
        /// </summary>
        /// <param name="retailCostume"></param>
        /// <returns></returns>
        public decimal GetTotalMoneySupposed(RetailCostume retailCostume, SalesPromotion salesPromotion, decimal minDiscount)
        {
            Dictionary <string, RetailCostumeInfo>           retailDictionary     = new Dictionary <string, RetailCostumeInfo>();
            Dictionary <string, InSalesPromotionCostumeInfo> inSalesPromotionDict = new Dictionary <string, InSalesPromotionCostumeInfo>();

            this.GetRetailStatus(retailCostume, retailDictionary, inSalesPromotionDict);

            return(this.GetTotalMoneySupposed(retailDictionary, inSalesPromotionDict, salesPromotion, minDiscount));
        }
示例#3
0
        private void PrintRetail(RetailOrder retailOrder)
        {
            OrderPrintUtil      printHelper      = new OrderPrintUtil();
            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));
            }

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

            printHelper.Print(retailCostume, times, dgv);
        }
示例#4
0
        /// <summary>
        /// 获取每件款号颜色的销售件数
        /// </summary>
        /// <param name="retailCostume"></param>
        /// <param name="dictionary">key:"ShopID_CostumeID_ColorName_SizeName", value:销售件数</param>
        /// <param name="inSalesPromotionDict">key:"ShopID_CostumeID_ColorName_SizeName", value:销售件数</param>
        private void GetRetailStatus(RetailCostume retailCostume, Dictionary <string, RetailCostumeInfo> dictionary, Dictionary <string, InSalesPromotionCostumeInfo> inSalesPromotionDict)
        {
            List <RetailDetail> list = retailCostume.RetailDetailList;

            foreach (RetailDetail detail in list)
            {
                string key = string.Format("{0}_{1}_{2}_{3}_{4}_{5}_{6}", retailCostume.RetailOrder.ShopID, detail.CostumeID, detail.ColorName, detail.SizeName, detail.Discount, detail.InSalesPromotion, detail.GiftTickets);
                if (!detail.InSalesPromotion)
                {
                    if (!dictionary.ContainsKey(key))
                    {
                        //按折扣算,存在小数点,误差问题,直接用小计金额得出每件衣服价格
                        dictionary.Add(key, new RetailCostumeInfo()
                        {
                            BuyCount = detail.BuyCount, Price = detail.SumMoney / detail.BuyCount
                        });
                    }
                    else
                    {
                        dictionary[key].BuyCount += detail.BuyCount;
                    }
                }
                else
                {
                    if (!inSalesPromotionDict.ContainsKey(key))
                    {
                        //促销活动的衣服没有折扣
                        inSalesPromotionDict.Add(key, new InSalesPromotionCostumeInfo()
                        {
                            BuyCount = detail.BuyCount, Price = detail.SalePrice
                        });
                    }
                    else
                    {
                        inSalesPromotionDict[key].BuyCount += detail.BuyCount;
                    }
                }
            }
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="retailCostume"></param>
        /// <param name="times">打印次数</param>
        public void Print(RetailCostume retailCostume, int times, DataGridView dataGridView)
        {
            this.retailCostume = retailCostume;
            InteractResult <RetailPrintType> rPrintType = CommonGlobalCache.ServerProxy.GetRetailPrintType();

            if (rPrintType.ExeResult == ExeResult.Success)
            {
                if (rPrintType.Data == RetailPrintType.SmallTickets)
                {
                    InteractResult <PrintTemplateInfo> result = CommonGlobalCache.ServerProxy.GetPrintTemplateInfo(PrintTemplateType.Retail);
                    if (result.ExeResult == ExeResult.Success)
                    {
                        PrintTemplateInfo PTemplateInfo = result.Data;
                        this.CurrentPTemplate = PTemplateInfo;
                        PrintHelper printer = new PrintHelper(RetailCostume_PrintPage2);
                        printer.printDocument.DefaultPageSettings.Margins   = new Margins(1, 1, 5, 1);
                        printer.printDocument.DefaultPageSettings.PaperSize = new PaperSize(retailCostume.RetailOrder.ID, PrintHelper.GetInch(8), 600);
                        printer.DirectlyPrint(this.CurrentPTemplate.PrintCount);
                    }
                }
                else
                {
                    setPrintDataGridView(retailCostume, dataGridView, PrintTemplateType.RetailOrder);
                }
            }
            else
            {
            }
            /**/
        }

        private static void setPrintDataGridView(RetailCostume item, DataGridView dataGridView2, PrintTemplateType type)
        {
            InteractResult <PrintTemplateInfo> result = CommonGlobalCache.ServerProxy.GetPrintTemplateInfo(type);

            //行列数基本不受限制,但超过一页失去意义,因为以Body为主,以其它为辅
            //   Header header = new Header(4, 2);
            //可以指定每页是否重复打印
            if (result.ExeResult == ExeResult.Success)
            {
                PrintTemplateInfo CurrentPTemplate = result.Data;
                for (int c = 0; c < CurrentPTemplate.PrintCount; c++)
                {
                    MisGoldPrinterOfReWrite misGoldPrinter = new MisGoldPrinterOfReWrite(false, new PrinterMargins(20, 20, 20, 20, 800, 1129));


                    misGoldPrinter.Title = CurrentPTemplate.OrderName; //主标题(C#用\n表示换行)	}

                    misGoldPrinter.Caption = "";

                    double headRow = Math.Round(Convert.ToSingle(CurrentPTemplate.SystemVariables.Count / 2));

                    Header header = new Header(Convert.ToInt32(headRow) + 1, 2);
                    // CommonGlobalUtil.WriteLog("变量总数=" + CurrentPTemplate.SystemVariables.Count + "\r\n" + "应显示行号=" + headRow);
                    header.IsDrawAllPage = true;
                    #region
                    Member _member = null;
                    if (item.RetailOrder.MemeberID != null)
                    {
                        _member = CommonGlobalCache.ServerProxy.GetOneMember(item.RetailOrder.MemeberID);
                    }
                    for (int i = 0; i < CurrentPTemplate.SystemVariables.Count; i++)
                    {
                        int curR = 0;
                        if (i < 2)
                        {
                            curR = 0;
                        }
                        else
                        {
                            double resRow = i / 2;
                            curR = Convert.ToInt32(Math.Round(resRow));
                        }
                        string KeyStr = "";
                        if (CurrentPTemplate.SystemVariables[i] == "销售单号")
                        {
                            KeyStr = "销售单号:";
                            header.SetText(curR, i % 2, CurrentPTemplate.SystemVariables[i] + ":" + item.RetailOrder.ID);
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "单据日期")
                        {
                            KeyStr = "单据日期:";
                            header.SetText(curR, i % 2, KeyStr + item.RetailOrder.CreateTime.GetDateTimeFormats('f')[0].ToString());
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "客户名称")
                        {
                            KeyStr = "客户名称:";
                            if (_member != null)
                            {
                                header.SetText(curR, i % 2, KeyStr + _member.Name);
                            }
                            else
                            {
                                header.SetText(curR, i % 2, KeyStr);
                            }
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "客户电话")
                        {
                            KeyStr = "客户电话:";
                            if (_member != null)
                            {
                                header.SetText(curR, i % 2, KeyStr + _member.PhoneNumber);
                            }
                            else
                            {
                                header.SetText(curR, i % 2, KeyStr);
                            }
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "客户地址")
                        {
                            KeyStr = "客户地址:";
                            if (_member != null)
                            {
                                header.SetText(curR, i % 2, KeyStr + _member.DetailAddress);
                            }
                            else
                            {
                                header.SetText(curR, i % 2, KeyStr);
                            }
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "操作人")
                        {
                            KeyStr = "操 作 人:";
                            header.SetText(curR, i % 2, KeyStr + CommonGlobalCache.GetUserName(item.RetailOrder.GuideID));
                        }
                        else if (CurrentPTemplate.SystemVariables[i] == "单据备注")
                        {
                            KeyStr = "备    注:";
                            header.SetText(curR, i % 2, KeyStr + item.RetailOrder.Remarks.ToString());
                        }
                    }
                    #endregion

                    misGoldPrinter.Header = header;

                    // List<PrintColumnInfo> allPrintColumnInfos=new List<PrintColumnInfo>();

                    List <PrintColumnInfo> dataGV           = new List <PrintColumnInfo>();
                    PrintColumnInfo        prinAutoIDColumn = new PrintColumnInfo();
                    prinAutoIDColumn.Name = "序列号";
                    prinAutoIDColumn.Rate = 5;
                    dataGV.Add(prinAutoIDColumn);
                    dataGV.AddRange(CurrentPTemplate.PrintColumnInfos);
                    //  allPrintColumnInfos = dataGV;

                    string ColumnsList = string.Empty;
                    foreach (PrintColumnInfo itemC in dataGV)
                    {
                        ColumnsList += itemC.Name + ",";
                    }
                    CommonGlobalUtil.WriteLog("模板设置打印列表头为=" + ColumnsList + "\r\n");
                    //表格是否为零条记录
                    bool isflag = false;
                    if (dataGV.Count == 0)
                    {
                        isflag = true;
                    }

                    List <int> columnCount         = new List <int>();
                    int        pinrtColNum         = 0;
                    string     dataGridColumnsList = string.Empty;
                    if (dataGridView2.Columns.Count > 0)
                    {
                        for (int i = 0; i < dataGridView2.Columns.Count; i++)
                        {
                            DataGridViewColumn column = dataGridView2.Columns[i];

                            if (dataGV.FindAll(t => t.Name == column.HeaderText).Count > 0)
                            {
                                columnCount.Add(i);
                                dataGridColumnsList += column.HeaderText + ",";
                                pinrtColNum++;
                            }
                            else
                            {
                                if (dataGV.FindAll(t => t.Name == column.DataPropertyName).Count > 0)
                                {
                                    columnCount.Add(i);
                                    column.HeaderText    = column.HeaderText.Replace("\r\n", " ");
                                    dataGridColumnsList += column.DataPropertyName + ",";
                                    pinrtColNum++;
                                }
                                else
                                {
                                    if (column.DataPropertyName.Contains("XL"))
                                    {
                                        string name = column.DataPropertyName;  //XL3
                                                                                //3XL
                                        string newname  = name.Replace("XL", "");
                                        string checkstr = newname + "XL";
                                        if (dataGV.FindAll(t => t.Name == checkstr).Count > 0)
                                        {
                                            columnCount.Add(i);
                                            column.HeaderText    = column.HeaderText.Replace("\r\n", " ");
                                            dataGridColumnsList += column.DataPropertyName + ",";
                                            pinrtColNum++;
                                        }
                                        else
                                        {
                                            column.Visible = false;
                                        }
                                    }
                                    else
                                    {
                                        column.Visible = false;
                                    }
                                }
                            }
                            if (isflag)
                            {
                                if (i == 0)
                                {
                                    //打印设置模板不设置任何列,但由于MisGoldPrinter这个类的打印主体为DataGridView,所有必须设置一列默认空的
                                    columnCount.Add(i);
                                    column.Visible    = true;
                                    column.HeaderText = "";

                                    DataTable  dt = new DataTable();
                                    DataColumn c1 = new DataColumn();
                                    c1.ColumnName = "HeaderText";

                                    dt.Columns.Add(c1);
                                    dataGridView2.DataSource = null;
                                    dataGridView2.DataSource = dt;
                                }
                            }
                            //}
                        }

                        CommonGlobalUtil.WriteLog("DataGridView能打印的列为=" + dataGridColumnsList);


                        MultiHeader multiHeader = new MultiHeader(1, dataGV.Count);
                        for (int a = 0; a < dataGV.Count; a++)
                        {
                            multiHeader.SetText(0, a, dataGV[a].Name);
                        }

                        misGoldPrinter.IsTotalIsDrawAllPage = false;


                        misGoldPrinter.DataSource = DataGridViewUtil.ToStringArray(dataGridView2, false, true);

                        misGoldPrinter.RowsPerPage       = CurrentPTemplate.Rows + 1; //根据设置传值
                        misGoldPrinter.IsSubTotalPerPage = true;

                        int footerRowsNum = 0;
                        if (((GoldPrinter.Body)(misGoldPrinter.Body)).Rows >= 2)
                        {
                            footerRowsNum = ((GoldPrinter.Body)(misGoldPrinter.Body)).Rows;
                        }
                        else
                        {
                            footerRowsNum = 2;
                        }

                        Footer footer         = new Footer(footerRowsNum, dataGV.Count);
                        int    colIndex       = -1;
                        int    colIndexSecond = -1;
                        for (int b = 0; b < dataGV.Count; b++)
                        {
                            if (dataGV[b].Name == "金额")
                            {
                                colIndex = b;
                            }
                            if (dataGV[b].Name == "数量")
                            {
                                colIndexSecond = b;
                            }
                        }

                        string addressStr = string.Empty;
                        for (int a = 0; a < CurrentPTemplate.SystemVariables.Count; a++)
                        {
                            //if (dataGridView2.Rows.Count >= 2)
                            //{
                            if (CurrentPTemplate.SystemVariables[a] == "店铺地址")
                            {
                                Shop curShop = CommonGlobalCache.GetShop(item.RetailOrder.ShopID);
                                if (curShop != null)
                                {
                                    footer.SetText(0, 0, "店铺地址:" + curShop.Address);
                                }
                            }
                            if (CurrentPTemplate.SystemVariables[a] == "联系电话")
                            {
                                Shop curShop = CommonGlobalCache.GetShop(item.RetailOrder.ShopID);
                                if (curShop != null)
                                {
                                    footer.SetText(1, 0, "联系电话:" + curShop.PhoneNumber);
                                }
                            }
                            //}
                            //else if(dataGridView2.Rows.Count >= 1)
                            //{
                            //    if (CurrentPTemplate.SystemVariables[a] == "店铺地址")
                            //    {
                            //        if (item.RetailOrder.ShopID != null && item.RetailOrder.ShopID != "_online")
                            //        {
                            //            addressStr += "店铺地址:" + CommonGlobalCache.GetShop(item.RetailOrder.ShopID).Address;
                            //        }
                            //    }
                            //    if (CurrentPTemplate.SystemVariables[a] == "联系电话")
                            //    {
                            //        if (addressStr != string.Empty)
                            //        {
                            //            addressStr += "       ";
                            //        }
                            //        if (item.RetailOrder.ShopID != null && item.RetailOrder.ShopID != "_online")
                            //        {
                            //            addressStr += "联系电话:" + CommonGlobalCache.GetShop(item.RetailOrder.ShopID).PhoneNumber;
                            //        }
                            //    }
                            //}
                        }
                        //if (dataGridView2.Rows.Count == 1)
                        //{
                        //    footer.SetText(0, 0, addressStr);
                        //}

                        MoneyConvertChinese MConvertC = new MoneyConvertChinese();

                        /*  if (dataGridView2.Rows.Count > 1)
                         * {
                         *    footer.SetText(0, 0, "合计 金额大写 " + MConvertC.MoneyToChinese(item.RetailOrder.TotalMoneyReceived.ToString()));
                         *
                         * }
                         * else
                         * {
                         *    footer.SetText(0, 0, addressStr + " 合计 金额大写 " + MConvertC.MoneyToChinese(item.RetailOrder.TotalMoneyReceived.ToString()));
                         *
                         * }*/
                        misGoldPrinter.EndSubTotalColsList = MConvertC.MoneyToChinese(item.RetailOrder.TotalMoneyReceived.ToString()) + ":" + item.RetailOrder.TotalMoneyReceived.ToString();
                        // footer.SetText(0, 1, "合计:" + item.RetailOrder.TotalMoneyReceived);

                        //  PrinterBase pbase = footer.CalculatePageInfo();

                        /* if (Math.Ceiling((decimal)dataGridView2.Rows.Count / CurrentPTemplate.Rows) > 1)
                         * {
                         *     footer.IsDrawAllPage = false;
                         * }
                         * else
                         * {
                         *
                         *     footer.IsDrawAllPage = true;
                         * }*/

                        footer.IsDrawAllPage = false;

                        Bottom bottom = new Bottom();

                        bottom.IsDrawAllPage            = true;
                        misGoldPrinter.SubTotalColsList = (colIndex).ToString() + ";" + (colIndexSecond).ToString();      //用分号分隔的要求小计的列

                        /*   if (!Directory.Exists(CommonGlobalUtil.SystemDir + "EXPORTS\\"))
                         * {
                         *  Directory.CreateDirectory(CommonGlobalUtil.SystemDir + "EXPORTS\\");
                         * }
                         *  misGoldPrinter.FileName = CommonGlobalUtil.SystemDir + "EXPORTS\\" + item.RetailOrder.ID + ".jpg";*/
                        ((GoldPrinter.Body)(misGoldPrinter.Body)).Font = dataGridView2.Font;

                        int[] widths = new int[dataGV.Count];
                        for (int j = 0; j < dataGV.Count; j++)
                        {
                            widths[j] = Convert.ToInt32(dataGV[j].Rate);
                        }

                        List <int> widthList = new List <int>();

                        /*   for (int i = 0; i < dataGV.Count; i++)
                         * {
                         *     DataGridViewColumn column = dataGridView2.Columns[columnCount[i]];
                         *     if (column.Visible && !String.IsNullOrEmpty(column.HeaderText))
                         *     {
                         *         widthList.Add(widths[i]);
                         *     }
                         *
                         * }*/
                        if (isflag)
                        {
                            widths    = new int[1];
                            widths[0] = 100;
                            // widthList.Add(widths[0]);
                        }

                        //   widths = widthList.ToArray();
                        int newWidth = 800;

                        /*  int totalWidth = 0;
                         * for (int i = 0; i < widths.Length; i++)
                         * {
                         *    totalWidth += widths[i];
                         * }*/
                        //if (dataGridView2.Columns.Count > 0)
                        //{
                        for (int i = 0; i < widths.Length; i++)
                        {
                            widths[i] = decimal.ToInt32(Math.Round((widths[i] * newWidth * (decimal)0.1), 0, MidpointRounding.AwayFromZero));
                            // widths[i] = decimal.ToInt32(Math.Round((widths[i] * newWidth * (decimal)1.0 / totalWidth), 0, MidpointRounding.AwayFromZero));
                        }
                        CommonGlobalUtil.WriteLog("实际打印数量=" + pinrtColNum + "\r\n" + "设置能打印的列数量=" + widths.Length.ToString());

                        /*   bottomFooter.ColsWidth = widths;*/
                        footer.ColsWidth      = widths;
                        misGoldPrinter.Footer = footer;
                        /*  misGoldPrinter.BottomFooter = bottomFooter;*/
                        misGoldPrinter.Bottom      = bottom;
                        multiHeader.ColsWidth      = widths;
                        misGoldPrinter.MultiHeader = multiHeader;
                        multiHeader.ColsWidth      = widths;
                        ((GoldPrinter.Body)(misGoldPrinter.Body)).IsAverageColsWidth = false;
                        ((GoldPrinter.Body)(misGoldPrinter.Body)).ColsWidth          = widths;
                        misGoldPrinter.Preview();
                        misGoldPrinter.Dispose();
                        misGoldPrinter = null;
                    }
示例#6
0
        private void BaseButton_Submit_Click(object sender, EventArgs e)
        {
            try
            {
                BaseButton_Submit.Enabled = false;
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                if (this.member != null && this.m_MoneyStoredCard > this.member.Balance)
                {
                    GlobalMessageBox.Show("卡余额不足!");
                    return;
                }
                decimal moneyIntegration = string.IsNullOrEmpty(this.skinLabel_JFToMoeny.Text) ? 0 : decimal.Parse(this.skinLabel_JFToMoeny.Text);

                if (m_MoneyIntegration != 0)
                {
                    if (moneyIntegration < this.m_MoneyIntegration)
                    {
                        GlobalMessageBox.Show("积分不足!");
                        return;
                    }
                }

                if (this.m_MoneyStoredCard + this.m_MoneyIntegration > this.totalMoneyReceived)
                {
                    GlobalMessageBox.Show("输入的积分返现金额与卡余额之和不能大于应收金额!");
                    return;
                }
                decimal refundAmount = decimal.Parse(this.skinLabel_MoneyChange.Text);
                if (!skinCheckBoxNew.Checked)
                {
                    if (refundAmount < 0)
                    {
                        GlobalMessageBox.Show("付款金额不足!");
                        return;
                    }
                }
                string  id = GlobalCache.ServerProxy.GetRetailOrderID(); //IDHelper.GetID(OrderPrefix.RetailOrder, GlobalCache.GetShop(GlobalCache.CurrentShopID).AutoCode);
                decimal moneyVipCardMain   = this.member == null ? this.m_MoneyStoredCard : this.m_MoneyStoredCard * (1 - (decimal)this.member.DonateCoef);
                decimal moneyVipCardDonate = this.member == null ? 0 : this.m_MoneyStoredCard * (decimal)this.member.DonateCoef;
                this.totalMoneyReceivedActual = this.totalMoneyReceived - this.m_MoneyIntegration - moneyVipCardDonate - this.discountMoney;

                CommonGlobalUtil.WriteLog("应收总金额:" + totalMoneyReceived);
                CommonGlobalUtil.WriteLog("积分:" + m_MoneyIntegration);
                CommonGlobalUtil.WriteLog("vip赠送金额:" + moneyVipCardDonate);
                CommonGlobalUtil.WriteLog("优惠券:" + discountMoney);
                CommonGlobalUtil.WriteLog("满减金额:" + this.mjMoney);
                CommonGlobalUtil.WriteLog("实收总金额:" + totalMoneyReceivedActual);
                if (this.skinCheckBoxNew.Checked)
                {
                    if (this.salesPromotion != null)
                    {
                        this.salesPromotion.ID = String.Empty;
                    }
                    this.discountMoney            = 0;
                    this.totalMoneyReceivedActual = 0;
                    this.totalMoneyReceived       = Convert.ToDecimal(this.skinLabel_TotalMoneySupposed.Text);
                    this.promotionText            = "未付款,不参与任何促销优惠";
                }
                //  String orderId =
                //重新获取订单编号
                //  bool isNotPay = this.skinCheckBoxNew.Checked;

                retailOrder = new RetailOrder()
                {
                    ID                       = id,
                    MemeberID                = this.member == null ? string.Empty : this.member.PhoneNumber,
                    MoneyCash                = this.m_MoneyCash,
                    MoneyCash2               = this.m_MoneyCash - this.moneyChange,
                    MoneyVipCard             = this.m_MoneyStoredCard,
                    MoneyVipCardMain         = moneyVipCardMain,
                    MoneyVipCardDonate       = moneyVipCardDonate,
                    MoneyBankCard            = this.m_MoneyBankCard,
                    MoneyWeiXin              = this.m_MoneyWeiXin,
                    MoneyAlipay              = this.m_MoneyAlipay,
                    MoneyOther               = this.m_MoneyElse,
                    MoneyIntegration         = this.m_MoneyIntegration,
                    SmallMoneyRemoved        = this.m_SmallMoneyRemoved,
                    TotalPrice               = this.totalOriginalAmount,
                    MoneyDiscounted          = this.moneyDiscounted,
                    TotalMoneyReceived       = this.totalMoneyReceived,
                    TotalMoneyReceivedActual = this.totalMoneyReceivedActual,
                    ShopID                   = shopID,
                    Remarks                  = this.rtfRichTextBox_Remarks.Text,
                    TotalCount               = this.totalCount,
                    CreateTime               = createTime,

                    EntryTime        = DateTime.Now,
                    EntryUserID      = CommonGlobalCache.CurrentUserID,
                    MoneyChange      = this.moneyChange,
                    SalesPromotionID = this.salesPromotion == null ? String.Empty : this.salesPromotion.ID,
                    GuideID          = this.guideID,
                    TotalCost        = this.totalCost,
                    //已经满减了
                    Benefit               = this.totalMoneyReceivedActual - this.totalCost,
                    PromotionText         = this.promotionText,
                    IsRefundOrder         = false,
                    OperateGuideID        = this.guideID,
                    MoneyDeductedByTicket = this.discountMoney,
                    IsNotPay              = this.skinCheckBoxNew.Checked,
                    GiftTicket            = this.giftTicketList,
                };


                List <RetailDetail> retailDetailListWithoutBuyout = retailDetailList.FindAll(t => !t.IsBuyout);
                List <RetailDetail> retailDetailListBuyout        = retailDetailList.FindAll(t => t.IsBuyout);

                if (skinCheckBoxNew.Checked)

                {
                    foreach (RetailDetail detail in retailDetailListWithoutBuyout)
                    {
                        List <CostumeItem> resultList = CommonGlobalCache.ServerProxy.GetCostumeStoreList(
                            new CostumeStoreListPara()
                        {
                            CostumeID       = detail.CostumeID,
                            ShopID          = shopID,
                            IsOnlyShowValid = true,
                            IsAccurateQuery = true,
                        });
                        decimal      saleprice  = 0;
                        CostumeStore reslutList = new CostumeStore();
                        if (resultList != null && resultList.Count > 0)
                        {
                            List <CostumeStore> lStore = resultList[0].CostumeStoreList;
                            reslutList = lStore.Find(t => t.ColorName == detail.ColorName);
                            if (reslutList.SalePrice < reslutList.Price)
                            {
                                saleprice = reslutList.Price;
                            }
                            else
                            {
                                saleprice = reslutList.SalePrice;
                            }
                            //saleprice = resultList[0].CostumeStoreList[].Price;
                        }
                        detail.Price    = saleprice;
                        detail.Discount = saleprice / reslutList.Price * 100;

                        detail.SumMoney = detail.Price * detail.BuyCount;
                    }
                }
                RetailCostume retailCostume = new RetailCostume()
                {
                    RetailDetailList = this.retailDetailList,
                    RetailOrder      = retailOrder
                };

                foreach (var item in retailDetailList)
                {
                    item.RetailOrderID = id;
                    CostumeSalePriceConfiguration costumeSalePrice = new CostumeSalePriceConfiguration();
                    costumeSalePrice.price = item.SinglePrice;
                    //  item.SalePrice = item.SinglePrice;
                    costumeSalePrice.Save(CommonGlobalUtil.AgileConfiguration("Pos//SalePrice//" + GlobalCache.CurrentShopID + "//" + item.CostumeID));
                }



                InteractResult result = GlobalCache.ServerProxy.RetailCostume(retailCostume);

                switch (result.ExeResult)
                {
                case ExeResult.Success:
                    GlobalMessageBox.Show("结算成功!");
                    this.DialogResult = DialogResult.OK;
                    if (skinCheckBoxPrint.Checked)
                    {
                        OrderPrintUtil printHelper = new OrderPrintUtil();
                        int            times       = CommonGlobalUtil.ConvertToInt32(GlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue);
                        DataGridView   dgv         = deepCopyDataGridView();
                        printHelper.Print(retailCostume, times, dgv);
                    }

                    break;

                case ExeResult.Error:
                    GlobalMessageBox.Show(result.Msg);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ee)
            {
                GlobalUtil.ShowError(ee);
            }
            finally
            {
                BaseButton_Submit.Enabled = true;
                GlobalUtil.UnLockPage(this);
            }
        }
示例#7
0
        private void RetailOrderIDTextBox1_OrderSelected(RetailOrder retailOrder)
        {
            try
            {
                if (retailOrder == null)
                {
                    return;
                }
                this.retailOrderIDTextBox1.SkinTxt.Text = retailOrder.ID;
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                this.originalRetailCostume = GlobalCache.ServerProxy.GetOneRetailCostume(retailOrder.ID);
                if (this.originalRetailCostume == null)
                {
                    return;
                }
                this.currentRetailCostume = this.originalRetailCostume;
                RetailOrder order = this.currentRetailCostume.RetailOrder;
                foreach (RetailDetail detail in this.currentRetailCostume.RetailDetailList)
                {
                    detail.IsRefund    = true;
                    detail.RefundCount = detail.BuyCount;
                }
                #region 设置标签信息
                Member member = GlobalCache.ServerProxy.GetOneMember(order.MemeberID);
                if (member != null)
                {
                    this.skinLabel_MemberName.Text = member.Name;
                }
                else
                {
                    this.skinLabel_MemberName.Text = "";
                }
                this.skinLabel_MemberID.Text = order.MemeberID;
                this.skinLabel_GuideID.Text  = GlobalCache.GetUserName(order.GuideID);
                // SalesPromotion salesPromotion = GlobalCache.ServerProxy.GetOneSalesPromotion(order.SalesPromotionID);
                //  if (salesPromotion != null)
                // {
                //  this.skinLabel_SalesPromotion.Text = salesPromotion.Name;
                // }
                // else
                //  {
                //   this.skinLabel_SalesPromotion.Text = "";
                // }
                this.skinLabel_SalesPromotion.Text = order.PromotionText;

                this.skinLabel_MoneyIntegration.Text   = order.MoneyIntegration.ToString();
                this.skinLabel_MoneyStoredCard.Text    = order.MoneyVipCard.ToString();
                this.skinLabel_TotalMoneyReceived.Text = order.TotalMoneyReceived.ToString();
                skinLabel_SmallMoneyRemoved.Text       = retailOrder.SmallMoneyRemoved.ToString();
                this.skinLabel_MoneyCash.Text          = retailOrder.MoneyCash.ToString();
                this.skinLabel_MoneyStoredCard.Text    = retailOrder.MoneyVipCard.ToString();
                this.skinLabel_MoneyBankCard.Text      = retailOrder.MoneyBankCard.ToString();
                this.skinLabel_MoneyWeiXin.Text        = retailOrder.MoneyWeiXin.ToString();
                this.skinLabel_MoneyAlipay.Text        = retailOrder.MoneyAlipay.ToString();
                this.skinLabelOther.Text        = retailOrder.MoneyOther.ToString();
                this.skinLabel_MoneyChange.Text = retailOrder.MoneyChange.ToString();
                this.skinLabelGiftTicket.Text   = retailOrder.MoneyDeductedByTicket.ToString();
                skinLabel_remark.Text           = retailOrder.Remarks;

                #endregion

                #region 绑定数据源
                this.BindingRetailCostumeSource();
                #endregion
            }
            catch (Exception ee)
            {
                GlobalUtil.WriteLog(ee);
                GlobalMessageBox.Show("查询失败!");
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
示例#8
0
        /// <summary>
        /// 获取退货后退款情况
        /// </summary>
        /// <param name="retailCostume"></param>
        /// <param name="refundCostume"></param>
        /// <param name="salesPromotion"></param>
        /// <returns></returns>
        public RefundMoney GetRefundMoney(RetailCostume retailCostume, RefundCostume refundCostume, decimal moneyBuyByTicket, SalesPromotion salesPromotion, decimal minDiscount)
        {
            if (retailCostume.RetailOrder.ID != refundCostume.RefundOrder.OriginOrderID)
            {
                throw new Exception("销售单的id与退货单id不一致");
            }
            else
            {
                /* foreach (RetailDetail rDetailSource in retailCostume.RetailDetailList)
                 * {
                 *   foreach (RetailDetail rDetailRe in refundCostume.RefundDetailList)
                 *   {
                 *       if (rDetailSource.RetailOrderID == refundCostume.RefundOrder.OriginOrderID  && rDetailSource.CostumeID == rDetailRe.CostumeID
                 *           && rDetailSource.ColorName==rDetailRe.ColorName && rDetailSource.BrandName==rDetailRe.BrandName && rDetailSource.SizeName==rDetailRe.SizeName)
                 *       {
                 *           rDetailSource.SalePrice = rDetailRe.SalePrice;
                 *       }
                 *   }
                 * }*/
            }
            if (retailCostume.RetailOrder.IsNotPay)
            {
                return(new RefundMoney());
            }

            Dictionary <string, RetailCostumeInfo>           retailDictionary     = new Dictionary <string, RetailCostumeInfo>();
            Dictionary <string, InSalesPromotionCostumeInfo> inSalesPromotionDict = new Dictionary <string, InSalesPromotionCostumeInfo>();

            //有活动的时候没有打折
            this.GetRetailStatus(retailCostume, retailDictionary, inSalesPromotionDict);

            Dictionary <string, int> refundDict = this.GetRefundStatus(refundCostume);

            foreach (KeyValuePair <string, int> kvp in refundDict)
            {
                if (retailDictionary.ContainsKey(kvp.Key))
                {
                    retailDictionary[kvp.Key].BuyCount += kvp.Value;
                }
                else if (inSalesPromotionDict.ContainsKey(kvp.Key))
                {
                    inSalesPromotionDict[kvp.Key].BuyCount += kvp.Value;
                }
            }

            decimal supporedMoney = this.GetTotalMoneySupposed(retailDictionary, inSalesPromotionDict, salesPromotion, minDiscount);
            // 应收金额(因为要退积分,不能去掉)+要买的那件衣服的优惠券-总的优惠金额-结算销售单的应收金额-运费
            decimal refundMoney = retailCostume.RetailOrder.TotalMoneyReceived + moneyBuyByTicket - retailCostume.RetailOrder.MoneyDeductedByTicket
                                  - supporedMoney - retailCostume.RetailOrder.CarriageCost;

            if (refundMoney <= 0)
            {
                return(new RefundMoney());
            }

            if (refundMoney <= retailCostume.RetailOrder.MoneyIntegration)
            {
                return(new RefundMoney()
                {
                    RefundIntegration = refundMoney,
                    RefundStoredCard = 0,
                    RefundCash = 0
                });
            }
            else
            {
                refundMoney -= retailCostume.RetailOrder.MoneyIntegration;
                if (refundMoney <= retailCostume.RetailOrder.MoneyVipCard)
                {
                    return(new RefundMoney()
                    {
                        RefundIntegration = retailCostume.RetailOrder.MoneyIntegration,
                        RefundStoredCard = refundMoney,
                        RefundCash = 0
                    });
                }
                else
                {
                    refundMoney -= retailCostume.RetailOrder.MoneyVipCard;
                    return(new RefundMoney()
                    {
                        RefundIntegration = retailCostume.RetailOrder.MoneyIntegration,
                        RefundStoredCard = retailCostume.RetailOrder.MoneyVipCard,
                        RefundCash = refundMoney
                    });
                }
            }
        }