Exemplo n.º 1
0
        /// <summary>
        /// 将分类绑定到树上
        /// </summary>
        private void BindClass()
        {
            gsClass = new VipSoft.BLL.GoodsClass();
            dtClass = gsClass.GetList("ShopID="+PublicState.Master.ShopID).Tables[0];

            this.treeView_Class.Nodes.Clear();
            Function.BindGoodsClass(this.treeView_Class, dtClass);
        }
Exemplo n.º 2
0
 private void button_Add_Click(object sender, EventArgs e)
 {
     VipSoft.BLL.GoodsClass gc = new VipSoft.BLL.GoodsClass();
     if (this.textBox_ClassName.Text == "新类别" || this.textBox_ClassName.Text == "")
     {
         MessageBox.Show("请输入分类名称。");
         return;
     }
     if (this.label_ID.Text == "label_ID" && this.label_ParentID.Text == "label_ParentID")
     {
         MessageBox.Show("请先在左侧列表中选择对应操作!");
         return;
     }
     if (this.button_Add.Text == "增加分类")
     {
         if (this.label_ParentID.Text == "")
         {
             MessageBox.Show("请先在左侧列表中选择对应操作!");
             return;
         }
         VipSoft.Model.GoodsClass model = new Model.GoodsClass();
         model.ClassName = this.textBox_ClassName.Text;
         model.ParentID = int.Parse(this.label_ParentID.Text);
         model.ShopID = PublicState.Master.ShopID;
         model.ShopName = PublicState.Master.ShopName;
         gc.Add(model);
         // 写入日志
         VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog();
         log.Add(new VipSoft.Model.SysLog(PublicState.Master, "商品分类管理",
             string.Format("增加分类成功,名称:{0}父类:{1}", this.textBox_ClassName.Text, this.textBox_Parent.Text),
             DateTime.Now));
         // 文本框清空
         this.label_ID.Text = "";
         this.label_ParentID.Text = "";
         this.textBox_Parent.Text = "";
         this.textBox_ClassName.Text = "";
     }
     else
     {
         VipSoft.Model.GoodsClass gci = new VipSoft.Model.GoodsClass();
         gci.ClassName = this.textBox_ClassName.Text.Trim();
         gci.ID = int.Parse(this.label_ID.Text);
         gc.Update(gci);
         // 写入日志
         VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog();
         log.Add(new VipSoft.Model.SysLog(PublicState.Master, "商品分类管理",
             string.Format("修改分类成功,名称:{0}父类:{1}", this.textBox_ClassName.Text, this.textBox_Parent.Text),
             DateTime.Now));
     }
     // 重新绑定
     BindClass();
 }
Exemplo n.º 3
0
        private void OrderReport_Load(object sender, EventArgs e)
        {
            this.comboBox_PayType.Items.Add(new DictionaryEntry("所有类型", ""));
            this.comboBox_PayType.Items.Add(new DictionaryEntry("储值卡余额消费", "1"));
            this.comboBox_PayType.Items.Add(new DictionaryEntry("现金消费", "2"));
            this.comboBox_PayType.Items.Add(new DictionaryEntry("信用卡支付", "3"));
            this.comboBox_PayType.Items.Add(new DictionaryEntry("代金券支付", "4"));
            this.comboBox_PayType.Items.Add(new DictionaryEntry("联合支付", "5"));
            this.comboBox_PayType.DisplayMember = "Key";
            this.comboBox_PayType.ValueMember = "Value";
            this.comboBox_G_PayType.Items.Add(new DictionaryEntry("所有类型", ""));
            this.comboBox_G_PayType.Items.Add(new DictionaryEntry("储值卡余额消费", "1"));
            this.comboBox_G_PayType.Items.Add(new DictionaryEntry("现金消费", "2"));
            this.comboBox_G_PayType.Items.Add(new DictionaryEntry("联合消费", "3"));
            this.comboBox_G_PayType.DisplayMember = "Key";
            this.comboBox_G_PayType.ValueMember = "Value";

            // 会员等级
            DataTable dtLevel = new VipSoft.BLL.CardLevel().GetAllList().Tables[0];
            this.comboBox_CardLevel.Items.Add(new DictionaryEntry("所有等级", "0"));
            foreach (DataRow dr in dtLevel.Rows)
                this.comboBox_CardLevel.Items.Add(new DictionaryEntry(dr["LevelName"].ToString(), dr["ID"].ToString()));
            this.comboBox_CardLevel.DisplayMember = "Key";
            this.comboBox_CardLevel.ValueMember = "Value";

            this.comboBox_B_CardLevel.Items.Add(new DictionaryEntry("所有等级", "0"));
            foreach (DataRow dr in dtLevel.Rows)
                this.comboBox_B_CardLevel.Items.Add(new DictionaryEntry(dr["LevelName"].ToString(), dr["ID"].ToString()));
            this.comboBox_B_CardLevel.DisplayMember = "Key";
            this.comboBox_B_CardLevel.ValueMember = "Value";

            this.comboBox_P_CardLevel.Items.Add(new DictionaryEntry("所有等级", "0"));
            foreach (DataRow dr in dtLevel.Rows)
                this.comboBox_P_CardLevel.Items.Add(new DictionaryEntry(dr["LevelName"].ToString(), dr["ID"].ToString()));
            this.comboBox_P_CardLevel.DisplayMember = "Key";

            this.comboBox_P_CardLevel.ValueMember = "Value";

            DataTable dtClass;
            // 产品分类
            dtClass = new VipSoft.BLL.GoodsClass().GetList("ShopID="+PublicState.Master.ShopID).Tables[0];
            Function.BindGoodsClass(this.comboBox_G_Class, dtClass);
            Function.BindGoodsClass(this.comboBox_M_Class, dtClass);
            DataTable dt = (DataTable)this.comboBox_G_Class.DataSource;
            this.comboBox_G_Class.DataSource = dt;
            this.comboBox_M_Class.DataSource = dt;

            this.comboBox_Sign.SelectedIndex = 0;
            this.comboBox_B_Sign.SelectedIndex = 0;
            this.comboBox_OrderType.SelectedIndex = 0;
            this.comboBox_PayType.SelectedIndex = 0;
            this.comboBox_G_Sign.SelectedIndex = 0;
            this.comboBox_G_OrderType.SelectedIndex = 0;
            this.comboBox_G_PayType.SelectedIndex = 0;
            this.comboBox_G_Class.SelectedIndex = 0;
            this.comboBox_M_Sign.SelectedIndex = 0;
            this.comboBox_M_OrderType.SelectedIndex = 0;
            this.comboBox_M_Class.SelectedIndex = 0;
            this.comboBox_P_Sign.SelectedIndex = 0;

            this.dateTimePicker_Start.Text = DateTime.Now.ToShortDateString();
            this.dateTimePicker_End.Text = DateTime.Now.ToShortDateString();
            this.dateTimePicker_G_Start.Text = DateTime.Now.ToShortDateString();
            this.dateTimePicker_G_End.Text = DateTime.Now.ToShortDateString();
            this.dateTimePicker_M_Start.Text = DateTime.Now.ToShortDateString();
            this.dateTimePicker_M_End.Text = DateTime.Now.ToShortDateString();
            this.dateTimePicker_B_Start.Text = DateTime.Now.ToShortDateString();
            this.dateTimePicker_P_Start.Text = DateTime.Now.ToShortDateString();
            this.dateTimePicker_P_End.Text = DateTime.Now.ToShortDateString();

            this.maskedTextBox_B_Start.Text = "00:00:00";
            this.maskedTextBox_P_Start.Text = "00:00:00";
            this.maskedTextBox_P_End.Text = "00:00:00";
            this.maskedTextBox_B_End.Text = "23:59:59";
            this.maskedTextBox_End.Text = "23:59:59";
            this.maskedTextBox_G_Start.Text = "00:00:00";
            this.maskedTextBox_G_End.Text = "23:59:59";
            this.maskedTextBox_M_Start.Text = "00:00:00";
            this.maskedTextBox_M_End.Text = "23:59:59";
            this.maskedTextBox5.Text = "00:00:00";
        }
Exemplo n.º 4
0
        private void dgvMCollect_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            this.dgvMWater.Rows.Clear();
            if (this.dgvMCollect.SelectedRows.Count == 0)
                return;
            StringBuilder sb = new StringBuilder();
            sb.Append("1=1");
            if (this.dateTimePicker_M_Start.Checked)
            {
                DateTime time1;
                string t1 = this.dateTimePicker_M_Start.Value.ToShortDateString() + " " + this.maskedTextBox_M_Start.Text;
                if (!DateTime.TryParse(t1, out time1))
                {
                    MessageBox.Show("开始时间输入错误!");
                    return;
                }
                sb.Append(" and CreateDateTime >= '" + time1.ToString() + "'");
            }

            if (this.dateTimePicker_M_End.Checked)
            {
                DateTime time2;
                string t2 = this.dateTimePicker_M_End.Value.ToShortDateString() + " " + this.maskedTextBox_M_End.Text;
                if (!DateTime.TryParse(t2, out time2))
                {
                    MessageBox.Show("结束时间输入错误!");
                    return;
                }
                sb.Append("CreateDateTime <= '" + time2.ToString() + "'");
            }

            if (this.comboBox_M_OrderType.SelectedIndex == 1)
                sb.Append(" and OrderType=0");// 余额消费
            else if (this.comboBox_M_OrderType.SelectedIndex == 2)
                sb.Append(" and OrderType=1");// 记次

            if (this.comboBox_M_Class.SelectedIndex != 0)
            {
                string classID = ((DataRowView)this.comboBox_M_Class.SelectedItem)["Value"].ToString();
                DataTable dtClass = new VipSoft.BLL.GoodsClass().GetList("ShopID=" + PublicState.Master.ShopID).Tables[0];
                string ids = Function.GetChildClassListStr(dtClass, classID);
                if (ids != "")
                    sb.Append(" and GoodsID in (select ID from Goods where ClassID in (" + ids + "))");
                else
                    sb.Append(" and GoodsID in (select ID from Goods where ClassID = " + classID + ")");
            }
            if (this.textBox_M_Price.Text != "¥0.00" && this.textBox_M_Price.Text != "")
                sb.Append(" and Price" + this.comboBox_M_Sign.Text + this.textBox_M_Price.Text.Replace("¥", ""));

            if (this.searchMember4.CardID != "")
            {
                searchMember4.GetSearchMember();
                sb.Append(" and MemID=" + this.searchMember4.MemID);
            }

            string cardID = this.dgvMCollect.SelectedRows[0].Cells[0].Value.ToString();

            DataSet dst = null;
            //单据表
            if (sb.ToString() != "")
            {
                dst = new VipSoft.BLL.OrderLog().GetListCollect("SELECT  CardID,GoodsCode,GoodsName,sum(Number) as Numbers,Price, sum(DiscountPrice) as sumMoneys  from orderLog  left join orderDetail on orderLog.orderCode=orderDetail.orderCode  where " + sb.ToString() + " and CardID='" + cardID + "' and  orderType not in (2,3,8)  group by GoodsCode,GoodsName,Price,DiscountPrice,cardID");
            }
            else
            {
                dst = new VipSoft.BLL.OrderLog().GetListCollect("SELECT  CardID,GoodsCode,GoodsName,sum(Number) as Numbers,Price, sum(DiscountPrice) as sumMoneys  from orderLog  left join orderDetail on orderLog.orderCode=orderDetail.orderCode  where " + sb.ToString() + "  CardID='" + cardID + "' and  orderType not in (2,3,8)  group by GoodsCode,GoodsName,Price,DiscountPrice,cardID");
            }

            foreach (DataRow drst in dst.Tables[0].Rows)
            {
                this.dgvMWater.Rows.Add(drst["GoodsCode"], drst["GoodsName"], drst["Price"], drst["sumMoneys"], drst["Numbers"], drst["sumMoneys"]);
            }
        }
Exemplo n.º 5
0
        private void dgvGCollect_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            this.dgvGWater.Rows.Clear();
            if (this.dgvGCollect.SelectedRows.Count == 0)
                return;
            string goodsCode = this.dgvGCollect.SelectedRows[0].Cells[0].Value.ToString();
            DataSet dt = null;
            StringBuilder sb = new StringBuilder();
            if (this.dateTimePicker_G_Start.Checked)
            {
                DateTime time1;
                string t1 = this.dateTimePicker_G_Start.Value.ToShortDateString() + " " + this.maskedTextBox_G_Start.Text;
                if (!DateTime.TryParse(t1, out time1))
                {
                    MessageBox.Show("开始时间输入错误!");
                    return;
                }
                sb.Append(" a.CreateDateTime >= '" + time1.ToString() + "'");
            }

            if (this.dateTimePicker_G_End.Checked)
            {
                DateTime time2;
                string t2 = this.dateTimePicker_G_End.Value.ToShortDateString() + " " + this.maskedTextBox_G_End.Text;
                if (!DateTime.TryParse(t2, out time2))
                {
                    MessageBox.Show("结束时间输入错误!");
                    return;
                }
                sb.Append(" a.CreateDateTime <= '" + time2.ToString() + "'");
            }

            string type;
            if (this.comboBox_G_OrderType.SelectedIndex == 1)
            {
                sb.Append(" and a.OrderType=0");// 余额消费
                if (this.comboBox_G_PayType.SelectedIndex != -1 && this.comboBox_G_PayType.SelectedIndex != 0)
                {
                    type = ((DictionaryEntry)this.comboBox_G_PayType.SelectedItem).Value.ToString();
                    sb.Append(" and a.PayType=" + type);
                }
            }
            else if (this.comboBox_G_OrderType.SelectedIndex == 2)
                sb.Append(" and a.OrderType=1");// 记次
            else if (this.comboBox_G_OrderType.SelectedIndex == 3)
                sb.Append(" and a.OrderType=2");// 退货

            DataTable dtClass = new VipSoft.BLL.GoodsClass().GetList("ShopID=" + PublicState.Master.ShopID).Tables[0];
            if (this.comboBox_G_Class.SelectedIndex != 0)
            {
                string classID = ((DataRowView)this.comboBox_G_Class.SelectedItem)["Value"].ToString();
                string ids = Function.GetChildClassListStr(dtClass, classID);
                if (ids != "")
                    sb.Append(" b.GoodsID in (select ID from Goods where ClassID in (" + ids + "))");
                else
                    sb.Append(" b.GoodsID in (select ID from Goods where ClassID = " + classID + ")");
            }

            if (this.TextBox_G_Key.Text != "")
                sb.Append(" b.GoodsCode='" + this.TextBox_G_Key.Text + "' or b.GoodsName like '%" + this.TextBox_G_Key.Text + "%'");
            if (this.textBox_G_Price.Text != "¥0.00" && this.textBox_G_Price.Text != "")
                sb.Append(" b.Price" + this.comboBox_G_Sign.Text + this.textBox_G_Price.Text.Replace("¥", ""));
            if (this.searchMember4.CardID != "")
            {
                searchMember4.GetSearchMember();
                sb.Append("MemID=" + this.searchMember4.MemID);
            }

            if (sb.ToString() != "")
            {
                dt = new VipSoft.BLL.OrderLog().GetListCollect("SELECT a.OrderCode,a.CardID,a.MemName,b.Number,b.DiscountPrice,a.DiscountMoney,a.OrderType,a.CreateTime,b.GoodsCode ,b.GoodsName,b.GoodsID,b.OrderCode from OrderLog as a  left join OrderDetail as b on a.OrderCode=b.OrderCode  where  " + sb.ToString() + " and b.GoodsCode='" + goodsCode + "' and a.OrderType not in (2,3,8)");
            }
            else
            {
                dt = new VipSoft.BLL.OrderLog().GetListCollect("SELECT a.OrderCode,a.CardID,a.MemName,b.Number,b.DiscountPrice,a.DiscountMoney,a.OrderType,a.CreateTime ,a.GoodsCode,a.GoodsName,b.GoodsCode,b.OrderCode from OrderLog as a  left join OrderDetail as b on a.GoodsCode=b.GoodsCode  where  " + sb.ToString() + "  b.GoodsCode='" + goodsCode + "' and a.OrderType not in (2,3,8)");
            }
            // todo   ddddddsssssss
            foreach (DataRow dr in dt.Tables[0].Rows)
            {
                this.dgvGWater.Rows.Add(dr["a.OrderCode"], dr["CardID"], dr["MemName"], dr["Number"], dr["DiscountPrice"], dr["DiscountMoney"], dr["OrderType"].ToString() == "0" ? "储值消费" : (dr["OrderType"].ToString() == "1" ? "记次消费" : (dr["OrderType"].ToString() == "2" ? "退货" : "累计积分")), dr["CreateTime"]);
            }
        }
Exemplo n.º 6
0
        private void Button_M_Query_Click(object sender, EventArgs e)
        {
            this.dgvMWater.Rows.Clear();
            this.dgvMCollect.Rows.Clear();
            StringBuilder sb = new StringBuilder();
            sb.Append("1=1");
            if (this.dateTimePicker_M_Start.Checked)
            {
                DateTime time1;
                string t1 = this.dateTimePicker_M_Start.Value.ToShortDateString() + " " + this.maskedTextBox_M_Start.Text;
                if (!DateTime.TryParse(t1, out time1))
                {
                    MessageBox.Show("开始时间输入错误!");
                    return;
                }
                sb.Append(" and CreateDateTime >= '" + time1.ToString() + "'");
            }

            if (this.dateTimePicker_M_End.Checked)
            {
                DateTime time2;
                string t2 = this.dateTimePicker_M_End.Value.ToShortDateString() + " " + this.maskedTextBox_M_End.Text;
                if (!DateTime.TryParse(t2, out time2))
                {
                    MessageBox.Show("结束时间输入错误!");
                    return;
                }
                sb.Append("CreateDateTime <= '" + time2.ToString() + "'");
            }

            if (this.comboBox_M_OrderType.SelectedIndex == 1)
                sb.Append(" and OrderType=0");// 余额消费
            else if (this.comboBox_M_OrderType.SelectedIndex == 2)
                sb.Append(" and OrderType=1");// 记次

            if (this.comboBox_M_Class.SelectedIndex != 0)
            {
                string classID = ((DataRowView)this.comboBox_M_Class.SelectedItem)["Value"].ToString();
                DataTable dtClass = new VipSoft.BLL.GoodsClass().GetList("ShopID=" + PublicState.Master.ShopID).Tables[0];
                string ids = Function.GetChildClassListStr(dtClass, classID);
                if (ids != "")
                    sb.Append(" and GoodsID in (select ID from Goods where ClassID in (" + ids + "))");
                else
                    sb.Append(" and GoodsID in (select ID from Goods where ClassID = " + classID + ")");
            }
            if (this.textBox_M_Price.Text != "¥0.00" && this.textBox_M_Price.Text != "")
                sb.Append(" and Price" + this.comboBox_M_Sign.Text + this.textBox_M_Price.Text.Replace("¥", ""));

            if (this.searchMember4.CardID != "")
            {
                searchMember4.GetSearchMember();
                sb.Append(" and MemID=" + this.searchMember4.MemID);
            }

            //汇总表
            int Mnum = 0;
            decimal Money = 0;
            DataSet ds = null;
            if (sb.ToString() == "")
            {
                ds = new VipSoft.BLL.OrderLog().GetListCollect("SELECT  MemID,CardID,MemName,sum(Number) as TotalNumbers,sum(DiscountPrice) as DiscountMoneys from OrderLog left join OrderDetail on OrderLog.OrderCode=OrderDetail.OrderCode   where " + sb.ToString() + " OrderType not int (2,3,8) group by MemID,CardID,MemName");
            }
            else
            {
                ds = new VipSoft.BLL.OrderLog().GetListCollect("SELECT  MemID,CardID,MemName,sum(Number) as TotalNumbers,sum(DiscountPrice) as DiscountMoneys from OrderLog left join OrderDetail on OrderLog.OrderCode=OrderDetail.OrderCode   where " + sb.ToString() + " and OrderType not in (2,3,8) group by MemID,CardID,MemName");
            }

            if (ds.Tables[0].Rows.Count > 0)
            {
                this.lblM_Ing.Visible = false;
            }
            else
            {
                this.lblM_Ing.Visible = true;
            }

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                Mnum += int.Parse(dr["TotalNumbers"].ToString());
                Money += Math.Round(decimal.Parse(dr["DiscountMoneys"].ToString()), 2);
                this.dgvMCollect.Rows.Add(dr["CardID"], dr["MemName"], dr["TotalNumbers"], dr["DiscountMoneys"]);
            }

            this.lbl_num.Text = Mnum.ToString();
            this.lmoney.Text = Money.ToString("#0.00");
        }
Exemplo n.º 7
0
        private void Button_G_Query_Click(object sender, EventArgs e)
        {
            this.dgvGCollect.Rows.Clear();
            this.dgvGWater.Rows.Clear();
            StringBuilder sb = new StringBuilder();
            sb.Append("1=1");
            if (this.dateTimePicker_G_Start.Checked)
            {
                DateTime time1;
                string t1 = this.dateTimePicker_G_Start.Value.ToShortDateString() + " " + this.maskedTextBox_G_Start.Text;
                if (!DateTime.TryParse(t1, out time1))
                {
                    MessageBox.Show("开始时间输入错误!");
                    this.maskedTextBox_G_Start.Text = "00:00:00";
                    t1 = this.dateTimePicker_G_Start.Value.ToShortDateString() + " " + "00:00:00";
                    DateTime.TryParse(t1, out time1);
                }
                sb.Append(" a.CreateDateTime >= '" + time1.ToString() + "'");
            }

            if (this.dateTimePicker_G_End.Checked)
            {
                DateTime time2;
                string t2 = this.dateTimePicker_G_End.Value.ToShortDateString() + " " + this.maskedTextBox_G_End.Text;
                if (!DateTime.TryParse(t2, out time2))
                {
                    MessageBox.Show("结束时间输入错误!");
                    this.maskedTextBox_G_End.Text = "23:59:59";
                    t2 = this.dateTimePicker_G_End.Value.ToShortDateString() + " " + "23:59:59";
                    DateTime.TryParse(t2, out time2);
                }
                sb.Append(" a.CreateDateTime <= '" + time2.ToString() + "'");
            }

            string type;
            if (this.comboBox_G_OrderType.SelectedIndex == 1)
            {
                sb.Append(" and a.OrderType=0");// 余额消费
                if (this.comboBox_G_PayType.SelectedIndex != -1 && this.comboBox_G_PayType.SelectedIndex != 0)
                {
                    type = ((DictionaryEntry)this.comboBox_G_PayType.SelectedItem).Value.ToString();
                    sb.Append(" and a.PayType=" + type);
                }
            }
            else if (this.comboBox_G_OrderType.SelectedIndex == 2)
                sb.Append(" and a.OrderType=1");// 记次

            if (this.comboBox_G_Class.SelectedIndex != 0)
            {
                string classID = ((DataRowView)this.comboBox_G_Class.SelectedItem)["Value"].ToString();
                DataTable dtClass = new VipSoft.BLL.GoodsClass().GetList("ShopID=" + PublicState.Master.ShopID).Tables[0];
                string ids = Function.GetChildClassListStr(dtClass, classID);
                if (ids != "")
                    sb.Append(" b.ID in (select ID from Goods where ClassID in (" + ids + "))");
                else
                    sb.Append(" b.ID in (select ID from Goods where ClassID = " + classID + ")");
            }
            if (this.TextBox_G_Key.Text != "")
                sb.Append(" a.GoodsCode='" + this.TextBox_G_Key.Text + "' or a.GoodsName like '%" + this.TextBox_G_Key.Text + "%'");
            if (this.textBox_G_Price.Text != "¥0.00" && this.textBox_G_Price.Text != "")
                sb.Append(" a.Price" + this.comboBox_G_Sign.Text + this.textBox_G_Price.Text.Replace("¥", ""));

            if (this.searchMember3.CardID != "")
            {
                searchMember3.GetSearchMember();
                sb.Append("MemID=" + this.searchMember3.MemID);
            }

            decimal gmoney = 0M;
            decimal danprice = 0M;
            decimal jinhuoprice = 0M;
            int xinums = 0;
            decimal lirun = 0M;
            decimal Zprice = 0M;
            decimal Cprice = 0M;
            int SumN = 0;
            //汇总表
            DataSet ds = new VipSoft.BLL.OrderDetail().GetListCollect("SELECT a.GoodsCode,a.GoodsName,a.price,sum(a.Number) as numbers,sum(DiscountPrice) as sumMoneys,b.buyprice,(sum(b.price*a.Number)-sum(b.buyprice*a.Number)) as buyprices from (select orderDetail.GoodsCode,orderDetail.GoodsName,orderDetail.price,orderDetail.Number,OrderLog.PayType,OrderLog.MemID,OrderLog.CreateDateTime,OrderLog.OrderType,orderDetail.DiscountPrice from orderLog  left join orderDetail on orderLog.orderCode=orderDetail.orderCode ) as a  left join goods as b on b.goodscode=a.goodscode where  " + sb.ToString() + " and a.OrderType not in (2,3,8) group by  a.goodsCode,a.goodsName,a.price,b.buyprice");
            if (ds.Tables[0].Rows.Count > 0)
            {
                this.lbl_G_Loading.Visible = false;
            }
            else
            {
                this.lbl_G_Loading.Visible = true;
            }

            foreach (DataRow drt in ds.Tables[0].Rows)
            {
                gmoney += Math.Round(decimal.Parse(drt["sumMoneys"].ToString()), 2);
                danprice = Math.Round(decimal.Parse(drt["price"].ToString()), 2);
                jinhuoprice = Math.Round(decimal.Parse(drt["buyprice"].ToString()), 2);
                xinums = int.Parse(drt["Numbers"].ToString());
                SumN += int.Parse(drt["Numbers"].ToString());
                Zprice += xinums * danprice;
                Cprice += xinums * jinhuoprice;
                lirun += Math.Round(decimal.Parse(drt["buyprices"].ToString()), 2);
                try
                {
                    decimal sumMoney = Convert.ToDecimal(drt["price"].ToString()) * int.Parse(drt["numbers"].ToString());
                    if (sumMoney != 0)
                        this.dgvGCollect.Rows.Add(drt["GoodsCode"], drt["GoodsName"], drt["price"], drt["buyprice"], drt["numbers"], drt["sumMoneys"], Convert.ToDecimal(drt["buyprices"].ToString()), (Convert.ToDecimal(drt["buyprices"].ToString()) / sumMoney * 100).ToString("0.00") + "%");
                    else
                        this.dgvGCollect.Rows.Add(drt["GoodsCode"], drt["GoodsName"], drt["price"], drt["buyprice"], drt["numbers"], drt["sumMoneys"], Convert.ToDecimal(drt["buyprices"].ToString()), "0");
                }
                catch
                {

                }
            }

            lirun = (Zprice - Cprice);
            this.lbl_g.Text = gmoney.ToString("¥0.00");
            this.lbl_danprice.Text = Zprice.ToString("¥0.00");
            this.lbl_jinprice.Text = Cprice.ToString("¥0.00");
            this.lbl_lirun.Text = lirun.ToString("¥0.00");
            this.lbl_xnum.Text = SumN.ToString();
        }
Exemplo n.º 8
0
        private void toolStripMenuItem_Item_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)sender;
            TreeNode node = this.treeView_Class.SelectedNode;
            int id = int.Parse(node.Name.Replace("class_", ""));
            switch (item.Name)
            {
                case "toolStripMenuItem_Edit":
                    this.label_ID.Text = node.Name.Replace("class_", "");
                    this.textBox_Parent.Text = node.Parent != null ? node.Parent.Text : "根类别";
                    this.textBox_ClassName.Text = node.Text;

                    this.button_Add.Text = "修改类别";
                    this.groupBox_manage.Text = "修改类别";

                    break;
                case "toolStripMenuItem_Delete":
                    if (this.treeView_Class.SelectedNode.Text == "根类别")
                        return;
                    DialogResult res = MessageBox.Show("您确定要删除这个分类么?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (res == DialogResult.Yes)
                    {
                        VipSoft.BLL.GoodsClass gc = new VipSoft.BLL.GoodsClass();
                        DataTable listClass = gc.GetList("[ShopID]="+PublicState.Master.ShopID).Tables[0];
                        CheckHasGoods hasGoods = new CheckHasGoods();
                        if (hasGoods.Exist(listClass, id.ToString()) != 0)
                        {
                            MessageBox.Show("当前分类下面还有商品,要删除分类,请首先删除该分类下面的全部商品。");
                            return;
                        }
                        if (gc.Delete(id))
                        {
                            MessageBox.Show("分类删除成功。");
                            // 移除节点
                            node.Remove();
                            // 写入日志
                            VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog();
                            log.Add(new VipSoft.Model.SysLog(PublicState.Master, "商品分类管理",
                                string.Format("删除分类成功,名称:{0}父类:{1}", this.textBox_ClassName.Text, this.textBox_Parent.Text),
                                DateTime.Now));
                        }
                        else
                            MessageBox.Show("删除失败,请重试。");
                    }
                    break;
                case "toolStripMenuItem_Add":
                    this.label_ParentID.Text = id.ToString();

                    //查询该类别下是否有产品,如果有则不能再增加子类别
                    DataSet ds = new VipSoft.BLL.Goods().GetList("ClassId=" + id + "");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        MessageBox.Show("该类别下已有产品!不能再添加子类别");
                        return;
                    }

                    this.textBox_Parent.Text = node.Text;
                    this.textBox_ClassName.Text = "新类别";
                    this.button_Add.Text = "增加分类";
                    this.groupBox_manage.Text = "增加下级分类";
                    break;
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// 绑定产品分类树形菜单
 /// </summary>
 private void BindTree()
 {
     VipSoft.BLL.GoodsClass gc = new VipSoft.BLL.GoodsClass();
     listClass = gc.GetList("ShopID="+PublicState.Master.ShopID).Tables[0];
     Function.BindGoodsClass(this.treeView_Class, listClass);
 }
Exemplo n.º 10
0
 /// <summary>
 /// 绑定商品分类
 /// </summary>
 private void LoadGoodsClass()
 {
     DataSet ds = new VipSoft.BLL.GoodsClass().GetList("[ShopID]="+PublicState.Master.ShopID);
     Function.BindGoodsClass(this.comboBox_Class, ds.Tables[0]);
 }
Exemplo n.º 11
0
        /// <summary>
        /// 绑定商品树
        /// </summary>
        private void BindGoodsTreeThread()
        {
            Thread.Sleep(50);    //延时100毫秒
            VipSoft.BLL.GoodsClass goodsC = new VipSoft.BLL.GoodsClass();
            VipSoft.BLL.Goods goods = new VipSoft.BLL.Goods();
            string where = "ShopID="+PublicState.Master.ID;
            DataTable dtClass = goodsC.GetList(where).Tables[0];
            DataTable dtGoods = goods.GetList(where).Tables[0];

            ExpenseGoodsTreeShowHandler goodsTreeHandler = new ExpenseGoodsTreeShowHandler(BindGoodsTreeInvoke);
            this.BeginInvoke(goodsTreeHandler, dtClass, dtGoods);
        }