Exemplo n.º 1
0
        public CreateVIP()
        {
            InitializeComponent();

            this.KeyPreview = true;
            this.KeyPress += Comdata.textBox_KeyPressDBC;

            textBox1.KeyPress += Comdata.textBox_KeyPress;
            textBox7.KeyPress += Comdata.textBox_KeyPress;

            this.Font = new System.Drawing.Font("宋体", Comdata.iniShop.FileObj.font_size);
            comboBox2.Text = "10";
            BuKa = false;
            VipMod = new Mwa_vip();
        }
Exemplo n.º 2
0
 public CreateVIP(Mwa_vip vipM)
 {
     InitializeComponent();
     this.Font = new System.Drawing.Font("宋体", Comdata.iniShop.FileObj.font_size);
     textBox2.Text = vipM.vipid;
     textBox3.Text = vipM.Telphone;
     comboBox2.Text = vipM.discount.ToString();
     textBox4.Text = vipM.ShenFenHao;
     textBox9.Text = vipM.mark + "(补卡)";
     comboBox1.Text = vipM.XianJin.ToString();
     textBox7.Text = vipM.ChunKuan.ToString();
     VipMod = vipM;
     BuKa = true;
     comboBox1.Enabled = false;
     textBox7.Enabled = false;
 }
Exemplo n.º 3
0
        /// <summary>
        /// vip刷卡
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton3.Checked)
            {
                try
                {
                    if (Mysqlcom.Myopen())
                    {
                        radioButton3.Checked = false;
                        return;
                    }

                    input getcardid = new input("输入卡号", "请输入卡号:", false);
                    getcardid.ShowDialog();

                    if (getcardid.value == "" || getcardid.value == "-1")
                    {
                        radioButton3.Checked = false;
                        return;
                    }

                    input getpw = new input("输入密码", "请输入密码:", true);
                    getpw.ShowDialog();

                    vipMod = sql.VIP.GetByPW(getcardid.value, getpw.value);
                    if (vipMod == null)
                        throw new Exception("卡号或密码错误!");

                    if (vipMod.state == 2)
                        throw new Exception("此卡已挂失!");

                    textBox10.Text = vipMod.vipid;
                    textBox11.Text = vipMod.Telphone;
                    textBox13.Text = vipMod.ChunKuan.ToString();
                    comboBox3.Text = vipMod.discount.ToString();
                    textBox10.ReadOnly = true;
                    textBox11.ReadOnly = true;
                }
                catch (Exception ce)
                {
                    vipMod = null;
                    radioButton3.Checked = false;
                    MessageBox.Show(ce.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                textBox10.ReadOnly = false;
                textBox11.ReadOnly = false;
                textBox13.Text = "";
                comboBox3.Text = "10";
            }
        }
Exemplo n.º 4
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (Mysqlcom.Myopen())
                return;

            if (dataGridView1.Rows.Count < 1)
            {
                MessageBox.Show("请先添加服装!", "错误");
                return;
            }
            if (textBox10.Text == "" && textBox11.Text == "")
            {
                MessageBox.Show("姓名和电话不能全为空!", "错误");
                return;
            }

            //付款方式
            String fumo = "";
            if (radioButton1.Checked) fumo = radioButton1.Text;
            else if (radioButton2.Checked) fumo = radioButton2.Text;
            else if (radioButton3.Checked) fumo = radioButton3.Text;
            if (fumo == "")
            {
                MessageBox.Show("请选择付款方式!", "错误");
                return;
            }

            ///卡号
            String cardId = "-1";
            if (radioButton3.Checked)
            {
                if (vipMod == null)
                {
                    radioButton3.Checked = false;
                    MessageBox.Show("请选择付款方式!", "错误");
                    return;
                }
                else
                    cardId = vipMod.Card;

                if (vipMod.ChunKuan - double.Parse(label14.Text) < 0)
                {
                    if (MessageBox.Show("此卡余额不足,是否继续使用?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.No)
                    {
                        radioButton3.Checked = false;
                        return;
                    }
                }
            }

            //////生成小票
            mod.Code NewCode = new mod.Code();
            NewCode.cardid = cardId;
            NewCode.Wname = textBox10.Text;
            NewCode.Wphone = textBox11.Text;
            NewCode.Wjifen = textBox12.Text;
            NewCode.fromID = Comdata.loginid;
            NewCode.totpri = label14.Text;
            NewCode.shopID = Comdata.shopnum;
            if (!sql.Code.ClothInit(NewCode))
            {
                MessageBox.Show("洗衣记录添加失败!", "错误");
                return;
            }

            ////添加洗衣记录
            mod.Wash NewWash = new mod.Wash();

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                NewWash.XiangMu = dataGridView1.Rows[i].Cells[0].Value.ToString();
                NewWash.YangShi = dataGridView1.Rows[i].Cells[1].Value.ToString();
                NewWash.color = dataGridView1.Rows[i].Cells[2].Value.ToString();
                NewWash.XiaCi = dataGridView1.Rows[i].Cells[5].Value.ToString();
                NewWash.JiaGe = dataGridView1.Rows[i].Cells[4].Value.ToString();
                NewWash.number = dataGridView1.Rows[i].Cells[3].Value.ToString();
                NewWash.FuKuan = fumo;
                NewWash.todate = dateTimePicker1.Value.ToString();
                NewWash.discount = comboBox3.Text;
                NewWash.mark = dataGridView1.Rows[i].Cells[7].Value.ToString();
                NewWash.CPay = dataGridView1.Rows[i].Cells[6].Value.ToString();

                sql.Code.ClothAdd(NewWash);

            }

            int maxid = sql.Code.ClothExec();

            if (maxid < 1)
            {
                MessageBox.Show("洗衣记录添加失败!", "错误");
                return;
            }

            label23.Text = "上次编号:" + maxid + " " + textBox10.Text;

            ///打印洗衣记录
            if (!checkBox1.Checked)
            {

                DateTime dt = DateTime.Now;

                printline = "          取衣单\r\n";
                printline += "     %%%%%%%%%%%%%%%%%%\r\n\r\n";
                printline += "洗衣编号:  " + maxid + "\r\n";
                printline += "顾客姓名:  " + textBox10.Text + "\r\n";
                printline += "顾客电话:  " + textBox11.Text + "\r\n";
                //if (getcardid.value == "-1") printline += "会员卡号:  无\r\n";
                if (cardId != "-1")
                {
                    printline += "会员卡号:  " + cardId + "\r\n";
                    printline += "累计积分:  " + (vipMod.JiFen + int.Parse(textBox12.Text)) + "\r\n";
                }

                printline += "付款方式:  " + fumo + "\r\n";
                printline += "洗衣日期:  " + dt.Year + "-" + dt.Month + "-" + dt.Day + "\r\n";
                printline += "取衣日期:  " + dateTimePicker1.Value.Year + "-" + dateTimePicker1.Value.Month + "-" + dateTimePicker1.Value.Day + "\r\n";

                if (comboBox3.Text == "10")
                    printline += "全单折扣:  无打折\r\n";
                else
                    printline += "全单折扣:  " + comboBox3.Text + "折\r\n";

                if (cardId != "-1")
                {
                    printline += "\r\n卡内余额:" + (vipMod.ChunKuan - double.Parse(label14.Text)) + "元\r\n";
                }

                printline += "\r\n洗涤方式  服装信息  数量 金额\r\n";
                printline += "==============================\r\n";

                string markTXT;
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    printline += dataGridView1.Rows[i].Cells[0].Value + "  " + dataGridView1.Rows[i].Cells[2].Value + dataGridView1.Rows[i].Cells[1].Value + "  " + dataGridView1.Rows[i].Cells[3].Value + "  ¥ " + dataGridView1.Rows[i].Cells[6].Value + "\r\n";

                    //瑕疵
                    markTXT = "备注:" + dataGridView1.Rows[i].Cells[5].Value + "\r\n";
                    if (markTXT.Length > 14)
                    {
                        markTXT = markTXT.Substring(0, 14) + "\r\n" + markTXT.Substring(14);
                    }
                    printline += markTXT;

                    ///品牌
                    if (dataGridView1.Rows[i].Cells[7].Value.ToString() != "")
                        printline += dataGridView1.Rows[i].Cells[7].Value + "\r\n";

                    printline += "--------------------\r\n";

                }

                printline += "--------------------\r\n合计:  " + label14.Text + "元\r\n\r\n\r\n";

                printline += Comdata.PrintFooter();

                try
                {
                    pn.printTEXT(printline);
                }
                catch (Exception ce)
                {

                    MessageBox.Show(ce.Message, "错误");
                }
            }

            //记录客户名和电话
            if (textBox10.Text != "" && textBox11.Text != "")
            {
                Spho.phone = textBox11.Text;
                if (!Spho.GetNameByPhone())
                {
                    Spho.name = textBox10.Text;
                    if (!Spho.Insert())
                        MessageBox.Show("数据库访问出错!", "错误");
                }
                else if (textBox10.Text != Spho.name)
                {
                    Spho.name = textBox10.Text;
                    if (!Spho.Update())
                        MessageBox.Show("数据库访问出错!", "错误");
                }
            }

            dataGridView1.Rows.Clear();
            textBox10.ReadOnly = false;
            textBox11.ReadOnly = false;
            radioButton1.Checked = false;
            radioButton2.Checked = false;
            radioButton3.Checked = false;
            textBox10.Text = "";
            textBox11.Text = "";
            textBox12.Text = "0";
            textBox13.Text = "";
            comboBox3.Text = "10";
            vipMod = null;
            fumo = "";
        }