Esempio n. 1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            if (mSaleFlowBindingSource.Current == null)
            {
                return;
            }
            MSaleFlow saleFlow = mSaleFlowBindingSource.Current as MSaleFlow;

            if (MessageBox.Show("确认删除【" + saleFlow.Fname + "】?", string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Question
                                , MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                PubGlobal.BussinessVar.saleFlowList.Remove(saleFlow);
                //重写RowNo
                for (int i = 0; i < PubGlobal.BussinessVar.saleFlowList.Count; i++)
                {
                    PubGlobal.BussinessVar.saleFlowList[i].RowNo = i + 1;
                }
                mSaleFlowBindingSource.ResetBindings(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            int index = dgSaleFlow.CurrentRowIndex;

            if (index < 0)
            {
                return;
            }
            if (frmInputQty.ShowDialog() == DialogResult.OK)
            {
                MSaleFlow saleFlow = PubGlobal.BussinessVar.saleFlowList[index];

                saleFlow.Qty       = frmInputQty.Qty * (PubGlobal.BussinessVar.isReturn?(-1):1);
                saleFlow.PreTotal  = saleFlow.Price * saleFlow.Qty;
                saleFlow.RealTotal = saleFlow.Price * saleFlow.Qty;
                saleFlow.Total     = saleFlow.Price * saleFlow.Qty;

                mSaleFlowBindingSource.ResetBindings(false);
                SelectSaleFlow(index);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 激活菜品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lvGoods_ItemActivate(object sender, EventArgs e)
        {
            MGoods    goods = lvGoods.FocusedItem.Tag as MGoods;
            MSaleFlow saleFlow;
            int       index = PubGlobal.BussinessVar.saleFlowList.FindIndex(a => a.Incode == goods.Incode);

            if (index >= 0)
            {
                saleFlow           = PubGlobal.BussinessVar.saleFlowList[index];
                saleFlow.Qty      += PubGlobal.BussinessVar.isReturn?(-1):1;
                saleFlow.PreTotal  = saleFlow.Price * saleFlow.Qty;
                saleFlow.RealTotal = saleFlow.Price * saleFlow.Qty;
                saleFlow.Total     = saleFlow.Price * saleFlow.Qty;
            }
            else
            {
                saleFlow           = new MSaleFlow();
                saleFlow.Incode    = goods.Incode;
                saleFlow.DeptCode  = PubGlobal.SysConfig.DeptCode;
                saleFlow.Disc      = 100;
                saleFlow.Fname     = goods.Fname;
                saleFlow.Operater  = PubGlobal.SysConfig.User.UserCode;
                saleFlow.PosNo     = PubGlobal.SysConfig.PosNO;
                saleFlow.Price     = goods.Price;
                saleFlow.Qty       = PubGlobal.BussinessVar.isReturn?(-1):1;
                saleFlow.PreTotal  = goods.Price * saleFlow.Qty;
                saleFlow.RealTotal = goods.Price * saleFlow.Qty;
                saleFlow.RowNo     = PubGlobal.BussinessVar.saleFlowList.Count + 1;
                saleFlow.SquadNO   = "1";
                saleFlow.Total     = goods.Price * saleFlow.Qty;
                PubGlobal.BussinessVar.saleFlowList.Add(saleFlow);
                index = PubGlobal.BussinessVar.saleFlowList.Count - 1;
            }
            mSaleFlowBindingSource.ResetBindings(false);
            SelectSaleFlow(index);
        }
Esempio n. 4
0
        /// <summary>
        /// 查询交易
        /// </summary>
        /// <param name="DeptNo"></param>
        /// <param name="saleFlow"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool QueryTrade(string PosNo, out ICollection <MSaleFlow> saleFlows, out string msg)
        {
            SqlDataReader rd = null;
            StringBuilder sb = new StringBuilder();

            sb.Append(" select a.sgroup,a.operater,a.serial_no,a.PosNo,a.code,b.Fname ");
            sb.Append(",a.Price,a.qty,a.pre_total,a.disc,a.TOTAL,a.real_total ");
            sb.Append(" ,a.sa_date,a.sa_time,a.Squadno ,a.RowNo");
            sb.Append("  from pos_Sales a left join pos_goods b on a.code=b.incode ");
            sb.AppendFormat(" where PosNo='{0}'", PosNo);
            try
            {
                if (!DBTool.ExecSql(sb.ToString(), out rd, out msg))
                {
                    saleFlows = null;
                    return(false);
                }
                else
                {
                    saleFlows = new List <MSaleFlow>();
                    while (rd.Read())
                    {
                        MSaleFlow saleFlow = new MSaleFlow();
                        saleFlow.DeptCode  = Convert.ToString(rd["sgroup"]);
                        saleFlow.Disc      = Convert.ToInt16(rd["disc"]);
                        saleFlow.Fname     = Convert.ToString(rd["Fname"]);
                        saleFlow.Incode    = Convert.ToString(rd["code"]);
                        saleFlow.Operater  = Convert.ToString(rd["operater"]);
                        saleFlow.PosNo     = Convert.ToString(rd["PosNo"]);
                        saleFlow.PreTotal  = Convert.ToDecimal(rd["pre_total"]);
                        saleFlow.Price     = Convert.ToDecimal(rd["Price"]);
                        saleFlow.Qty       = Convert.ToDecimal(rd["qty"]);
                        saleFlow.RealTotal = Convert.ToDecimal(rd["real_total"]);
                        saleFlow.RowNo     = Convert.ToInt16(rd["RowNo"]);
                        saleFlow.Sa_date   = Convert.ToDateTime(rd["sa_date"]);
                        saleFlow.Sa_time   = Convert.ToString(rd["sa_time"]);
                        saleFlow.SerialNo  = Convert.ToString(rd["serial_no"]);
                        saleFlow.SquadNO   = Convert.ToString(rd["Squadno"]);
                        saleFlow.Total     = Convert.ToDecimal(rd["TOTAL"]);
                        saleFlows.Add(saleFlow);
                    }
                    rd.Close();
                    if (saleFlows.Count > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        msg = "未查询到流水";
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                if (rd != null && !rd.IsClosed)
                {
                    rd.Close();
                }
                msg       = "系统异常:" + ex.Message;
                saleFlows = null;
                return(false);
            }
        }