Exemple #1
0
        public void Setdgvmx(string rec_key)
        {
            String    str = "select cpmc,unitprice,qy,je from t_cp_yd where rec_key='" + rec_key + "'";
            Gtsql     r1  = new Gtsql();
            DataTable d1  = new DataTable();

            d1 = r1.ExecuteQuery(str);
            if (d1 != null && d1.Rows.Count > 0)
            {
                dataGridView2.DataSource = d1;   //将查询结果放入到dataGridView;

                dataGridView2.Columns[0].HeaderText = "商品名称";
                dataGridView2.Columns[1].HeaderText = "单价";
                dataGridView2.Columns[2].HeaderText = "数量";
                dataGridView2.Columns[3].HeaderText = "金额";

                dataGridView2.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;       //列表居中

                dataGridView2.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
                dataGridView2.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                dataGridView2.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                dataGridView2.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;


                dataGridView2.Columns[0].Width = 180;
                dataGridView2.Columns[1].Width = 60;
                dataGridView2.Columns[2].Width = 60;
                dataGridView2.Columns[3].Width = 60;

                dataGridView2.ReadOnly = true;
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //登录
            if (tbPwd.Text == "" || cbUserid.Text == "")
            {
                MessageBox.Show("请输入登录口令!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tbPwd.SelectAll();
                return;
            }
            String    str1 = "select dh,xm,pw,bm FROM t_pwd WHERE dh='" + cbUserid.Text + "'AND pw='" + tbPwd.Text + "'"; //编写sql语句;
            Gtsql     r1   = new Gtsql();
            DataTable d1   = new DataTable();

            d1 = r1.ExecuteQuery(str1);          //使用ExecuteQuery()执行sql语句;
            if (d1 != null && d1.Rows.Count > 0) //查询有结果
            {
                Global.s_dh  = cbUserid.Text;
                Global.s_xm  = d1.Rows[0]["xm"].ToString();
                Global.s_bm  = d1.Rows[0]["bm"].ToString();
                Global.s_mac = Gt.GetNetworkAdpaterID();

                w_Main frm = new w_Main(); //这三行代码是实现界面跳转;
                frm.Show();
                this.Visible = false;
            }
            else
            {
                MessageBox.Show("您输入的口令不正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tbPwd.SelectAll();
            }
        }
Exemple #3
0
        public void taocan(string tcdh)                                                                 //套餐
        {
            String    str1 = "select v_cpdh,v_cpqy FROM t_cp_taocuan_pack WHERE v_tcdh='" + tcdh + "'"; //编写sql语句;
            Gtsql     r1   = new Gtsql();
            DataTable d1   = new DataTable();

            d1 = r1.ExecuteQuery(str1);          //使用ExecuteQuery()执行sql语句;
            if (d1 != null && d1.Rows.Count > 0) //查询有结果
            {
                for (int i = 0; i < d1.Rows.Count; i++)
                {
                    String    str2 = "select cpdh,cpmc,unitprice FROM t_cp WHERE cpdh='" + d1.Rows[i]["v_cpdh"].ToString() + "'"; //编写sql语句;
                    Gtsql     r2   = new Gtsql();
                    DataTable d2   = new DataTable();
                    d2 = r2.ExecuteQuery(str2);          //使用ExecuteQuery()执行sql语句;
                    if (d2 != null && d2.Rows.Count > 0) //查询有结果
                    {
                        DataGridViewRow row = new DataGridViewRow();
                        row.CreateCells(dGV);
                        row.Cells[0].Value = d2.Rows[0]["cpdh"].ToString();
                        row.Cells[1].Value = d2.Rows[0]["cpmc"].ToString();
                        row.Cells[2].Value = 0;
                        row.Cells[3].Value = d1.Rows[i]["v_cpqy"].ToString();
                        row.Cells[4].Value = 0;
                        row.Cells[5].Value = 1;
                        dGV.Rows.Add(row);
                        row.Selected = true;
                    }
                }
            }
        }
Exemple #4
0
        public static string Getjetxt(string str)
        {
            String s_sum = "合计:";

            Gtsql     r2 = new Gtsql();
            DataTable d2 = new DataTable();

            d2 = r2.ExecuteQuery(str);          //使用ExecuteQuery()执行sql语句;

            if (d2 != null && d2.Rows.Count > 0 && !d2.Rows[0].IsNull("cash"))
            {
                if (decimal.Parse(d2.Rows[0]["cash"].ToString()) > 0)
                {
                    s_sum = s_sum + " [现金]" + Decimal.Parse(d2.Rows[0]["cash"].ToString()).ToString("F1");
                }
                if (decimal.Parse(d2.Rows[0]["hy_card"].ToString()) > 0)
                {
                    s_sum = s_sum + " [会员卡]" + Decimal.Parse(d2.Rows[0]["hy_card"].ToString()).ToString("F1");
                }
                if (decimal.Parse(d2.Rows[0]["hlq"].ToString()) > 0)
                {
                    s_sum = s_sum + " [代金券]" + Decimal.Parse(d2.Rows[0]["hlq"].ToString()).ToString("F1");
                }
                if (decimal.Parse(d2.Rows[0]["wx"].ToString()) > 0)
                {
                    s_sum = s_sum + " [微信]" + Decimal.Parse(d2.Rows[0]["wx"].ToString()).ToString("F1");
                }
                if (decimal.Parse(d2.Rows[0]["zfb"].ToString()) > 0)
                {
                    s_sum = s_sum + " [支付]" + Decimal.Parse(d2.Rows[0]["zfb"].ToString()).ToString("F1");
                }
            }
            return(s_sum);
        }
Exemple #5
0
        private void tbCode_TextChanged(object sender, EventArgs e)
        {
            char chr;

            if (tbCode.Text.Trim().Length > 0 && (char.IsLetter(chr = tbCode.Text[0])))
            {
                listBox1.Visible = true;
                string    str1 = "select cpmc FROM t_cp WHERE fastdh LIKE '%" + tbCode.Text + "%'"; //编写sql语句;
                Gtsql     r1   = new Gtsql();
                DataTable d1   = new DataTable();
                d1 = r1.ExecuteQuery(str1);          //使用ExecuteQuery()执行sql语句;
                if (d1 != null && d1.Rows.Count > 0)
                {
                    foreach (DataRow dr in d1.Rows)
                    {
                        listBox1.DisplayMember = "cpmc";
                        listBox1.ValueMember   = "cpmc";
                        listBox1.DataSource    = d1;
                    }
                }
            }
            else
            {
                listBox1.Visible = false;
            }
        }
Exemple #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string s_time = "07:00:00";
            string s_bc, s_Height = "0";
            string s_sum;


            DateTime dt_1 = DateTime.Parse(dp1.Text + s_time);
            DateTime dt_2 = dt_1.AddDays(1);

            s_bc = Gt.GetBc(textBox1.Text, dp1.Value.ToString("yyyy-MM-dd")).ToString();
            String str = "SELECT  SUM(cash)AS cash, SUM(hy_card) AS hy_card,SUM(hlq)AS hlq, SUM(wx) AS wx,SUM(zfb) AS zfb  FROM t_pos_bill WHERE bc = '" + s_bc + "' and dh_who_receive='" + textBox1.Text + "' and pos_date >= '" + dt_1 + "' and pos_date < '" + dt_2 + "'";

            s_sum = Gt.Getjetxt(str);


            String    str1 = "SELECT cpmc,  SUM(qy)AS qy, SUM(je) AS je  FROM t_cp_yd  WHERE (rec_key IN(SELECT rec_key  FROM t_pos_bill WHERE bc = '" + s_bc + "' and dh_who_receive='" + textBox1.Text + "' and pos_date >= '" + dt_1 + "' and pos_date < '" + dt_2 + "')) GROUP BY cpdh,cpmc ORDER BY cpdh";
            Gtsql     r1   = new Gtsql();
            DataTable d1   = new DataTable();

            d1 = r1.ExecuteQuery(str1); //使用ExecuteQuery()执行sql语句;
            if (d1 != null && d1.Rows.Count > 0)
            {                           //65为表头高度,7.5 为单行高度
                s_Height = (Convert.ToUInt32(d1.Rows.Count * 7.5) + 85).ToString();
            }
            // 报表路径
            string path = Application.StartupPath + "\\Report\\Report_jb.frx";

            //Report report = new Report();
            report.Load(path);



            report.SetParameterValue("dt_1", dt_1);
            report.SetParameterValue("dt_2", dt_2);

            report.SetParameterValue("s_xm", Global.s_xm);
            report.SetParameterValue("s_jbdate", dp1.Text);
            report.SetParameterValue("s_bc", s_bc);
            report.SetParameterValue("s_Height", s_Height);

            report.SetParameterValue("s_sum", s_sum); //合计

            //report.PrintSettings.Printer = "Foxit Reader PDF Printer";
            //设置打印页码
            //report.PrintSettings.PageNumbers = "1-3";
            //report.PrintSettings.PageNumbers = "1";

            //打印对话框
            // report.PrintSettings.ShowDialog = false;

            report.Preview = previewControl1;

            report.RegisterData(d1, "t_cp_yd");

            report.Show();
        }
Exemple #7
0
        public void addmc()
        {
            string    str = "select dhid FROM t_cp WHERE cpmc ='" + listBox1.Text + "'"; //编写sql语句;
            Gtsql     r1  = new Gtsql();
            DataTable d1  = new DataTable();

            d1 = r1.ExecuteQuery(str);
            if (d1 != null && d1.Rows.Count > 0)
            {
                addGoods(d1.Rows[0][0].ToString());
            }
        }
Exemple #8
0
        public static string GetViptxt(string s_rec_key)
        {
            string    str   = "select  carddh,cardvalue,dz_ratio,dz_cost from t_pos_bill where rec_key = '" + s_rec_key + "'";
            string    s_sum = "";
            Gtsql     r2    = new Gtsql();
            DataTable d2    = new DataTable();

            d2 = r2.ExecuteQuery(str);          //使用ExecuteQuery()执行sql语句;
            if (d2 != null && d2.Rows.Count > 0)
            {
                s_sum = "会员卡:" + d2.Rows[0]["carddh"].ToString() + "  扣款前:" + decimal.Parse(d2.Rows[0]["cardvalue"].ToString()).ToString("F1") + "\n扣款后:" + (decimal.Parse(d2.Rows[0]["cardvalue"].ToString()) - decimal.Parse(d2.Rows[0]["dz_cost"].ToString())).ToString("F1");
            }
            return(s_sum);
        }
Exemple #9
0
        public void showPre()
        {
            String    str1 = "select top 1 mc,total_cost,pos_date  FROM t_pos_bill  WHERE dh_who_receive ='" + Global.s_dh + "'" + " order by pos_date DESC"; //编写sql语
            Gtsql     r1   = new Gtsql();
            DataTable d1   = new DataTable();

            d1 = r1.ExecuteQuery(str1);
            if (d1 != null && d1.Rows.Count > 0)    //查询有结果
            {
                lblPreBillNo.Text   = d1.Rows[0]["mc"].ToString();
                lblPreBillCash.Text = string.Format("{0:F2}", d1.Rows[0]["total_cost"].ToString());
                lblPreTime.Text     = d1.Rows[0]["pos_date"].ToString();
            }
        }
Exemple #10
0
        public static int GetBc(string s_dh, string s_jbdate)  //班次
        {
            int i_bc = 0;

            String    str = "select top 1 bc from t_pos_bill where dh_who_receive='" + s_dh + "'" + " and jbdate ='" + s_jbdate + "'";
            Gtsql     r1  = new Gtsql();
            DataTable d1  = new DataTable();

            d1 = r1.ExecuteQuery(str);
            if (d1 != null && d1.Rows.Count > 0)    //查询有结果
            {
                i_bc = int.Parse(d1.Rows[0]["bc"].ToString());
            }


            return(i_bc);
        }
Exemple #11
0
        private void w_login_Load(object sender, EventArgs e)
        {
            //配置服务器
            Global.serverName    = ConfigurationManager.AppSettings["serverName"];
            Global.serverNamevip = ConfigurationManager.AppSettings["serverNamevip"];



            String    str1 = "select dh FROM t_pwd";
            Gtsql     r1   = new Gtsql(); //我写的那个用来连接数据库的类是Gtsql,所以用其创建对象;
            DataTable d1   = new DataTable();

            d1 = r1.ExecuteQuery(str1);
            if (d1 != null && d1.Rows.Count > 0)
            {
                cbUserid.ValueMember   = "dh";
                cbUserid.DisplayMember = "dh";
                cbUserid.DataSource    = d1;
            }
        }
Exemple #12
0
        private void w_Money_Load(object sender, EventArgs e)
        {
            this.Show();
            this.TopMost = true;
            tbYS.Text    = string.Format("{0:F2}", double.Parse(this.Tag.ToString()));
            tbSSJE.Focus();


            String    str2 = "select jzfs,je FROM t_jzfs";
            Gtsql     r1   = new Gtsql();
            DataTable d1   = new DataTable();

            d1 = r1.ExecuteQuery(str2);
            if (d1 != null && d1.Rows.Count > 0)
            {
                dataGridView2.DataSource = d1;   //将查询结果放入到dataGridView;

                this.dataGridView2.Columns[0].HeaderText = "付款方式";
                this.dataGridView2.Columns[1].HeaderText = "金额";

                dataGridView2.Columns[0].ReadOnly = true;

                dataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
                dataGridView2.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;

                // 调整字体
                dataGridView2.Font             = new Font("宋体", 15);
                dataGridView2.Columns[0].Width = 150;
                dataGridView2.Columns[1].Width = 130;

                if (Global.d_svipje >= decimal.Parse(tbYS.Text))
                {
                    dataGridView2.Rows[1].Cells[1].Value = double.Parse(this.Tag.ToString()).ToString("F2");
                }
                else
                {
                    dataGridView2.Rows[0].Cells[1].Value = double.Parse(this.Tag.ToString()).ToString("F2");
                }
            }
        }
Exemple #13
0
        private void w_Xf_Load(object sender, EventArgs e)
        {
            String    str = "select dh,mc,total_cost,pos_date,rec_key,carddh from t_pos_bill where bc = 0 and dh_who_receive ='" + Global.s_dh + "' order by pos_date";
            Gtsql     r1  = new Gtsql();
            DataTable d1  = new DataTable();

            d1 = r1.ExecuteQuery(str);
            if (d1 != null && d1.Rows.Count > 0)
            {
                dataGridView1.DataSource = d1;   //将查询结果放入到dataGridView;

                dataGridView1.Columns[0].HeaderText = "房号";
                dataGridView1.Columns[1].HeaderText = "单号";
                dataGridView1.Columns[2].HeaderText = "包厢消费";
                dataGridView1.Columns[3].HeaderText = "日期";

                dataGridView1.Columns[0].Width = 60;
                dataGridView1.Columns[1].Width = 80;
                dataGridView1.Columns[2].Width = 60;
                dataGridView1.Columns[3].Width = 160;


                dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;       //列表居中

                dataGridView1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;


                dataGridView1.ReadOnly           = true;
                dataGridView1.Columns[4].Visible = false;
                dataGridView1.Columns[5].Visible = false;

                Setdgvmx(dataGridView1.Rows[0].Cells[4].Value.ToString());
            }
        }
Exemple #14
0
        protected void Cash()
        {
            String s_dh = "", s_mc = "", s_cash = "0.0", s_vip = "0.0", s_hlq = "0.0", s_wx = "0.0", s_zfb = "0.0", s_bf_consume_dh, s_rec_key;
            string s_cardtxt = "";
            int    i_flag    = 0;

            if (tbZL.Text.Trim() == "")
            {
                tbZL.Text = string.Format("{0:F2}", (double.Parse(tbSSJE.Text.Trim()) - double.Parse(tbYS.Text.Trim())));
            }
            else
            {
                w_Main       frmP = (w_Main)this.Owner;
                DataGridView dgv  = (DataGridView)frmP.Controls.Find("dGV", true)[0];
                //消费总记录
                //insert into t_pos_bill(dh, mc, bf_consume_dh, total_cost, cash, djq, hy_card, hlq, dh_who_receive, mc_who_receive, rec_key, bc, carddh, dz_ratio, dz_cost, cardvalue)
                //values(:s_dh,:s_mc,:s_bf_consume_dh,:c_last,:c_xian,:c_djq,:c_card,:c_hlq,:s_user.dh,:s_user.xm,:s_rec_key, 0,:s_card.dh,:s_card.zl,:c_djq,:s_card.je) using sqlca;

                s_dh = Global.s_fh;
                if ((s_dh == "") || (s_dh == null))
                {
                    s_dh = "K000";
                }


                s_mc            = Gt.GetListno(1);
                s_bf_consume_dh = s_dh + Gt.GetStime().ToString("yyyyMMddHHmmssfff");

                s_cash = dataGridView2.Rows[0].Cells[1].Value.ToString();
                s_vip  = dataGridView2.Rows[1].Cells[1].Value.ToString();
                s_hlq  = dataGridView2.Rows[2].Cells[1].Value.ToString();
                s_wx   = dataGridView2.Rows[3].Cells[1].Value.ToString();
                s_zfb  = dataGridView2.Rows[4].Cells[1].Value.ToString();

                s_rec_key = "CS" + Gt.GetStime().ToString("yyMMddHHmmssfff");//超市与包房识别号

                String str1 = "insert into t_pos_bill(dh,mc,bf_consume_dh,total_cost,cash,hy_card,hlq,wx,zfb,dh_who_receive, mc_who_receive,rec_key,bc,carddh,dz_ratio,dz_cost,cardvalue) values('" + s_dh + "','" + s_mc + "','" + s_bf_consume_dh + "','" + tbYS.Text + "','" + s_cash
                              + "','" + s_vip + "','" + s_hlq + "','" + s_wx + "','" + s_zfb + "','" + Global.s_dh + "','" + Global.s_xm + "','" + s_rec_key + "','" + "0"
                              + "','" + Global.s_vip + "','" + Gt.GetVipinfo(Global.s_vip, 1) + "','" + s_vip + "','" + Gt.GetVipinfo(Global.s_vip, 2)
                              + "')";

                Gtsql r1 = new Gtsql();   //我写的那个用来连接数据库的类是ResM,所以用其创建对象;
                i_flag = r1.ExecuteUpdate(str1);
                if (i_flag == 0)
                {
                    //执行成功
                }
                //添加详单	insert into t_cp_yd(dh,mc,xldh,xlmc,cpdh,cpmc,fastdh,unit,unitprice,nowprice,isnow,is_dz,dzbl,kedian,qy,je,bfdh,is_free,printdh,printname,sequen_kf,rec_key,share_ratio,is_stock,dhid,in_price,printed,is_tc)
                //select dh, mc, xldh, xlmc, cpdh, cpmc, fastdh, unit, unitprice, nowprice,:i_isnow,is_dz,dzbl,kedian,:c_qy,:c_je,:sle_bf.text,:i_isfree,printdh,printname,:s_bf_consume_dh,:s_rec_key,share_ratio,is_stock,dhid,in_price,1,:i_istc from t_cp
                //         where cpdh = :s_cpdh using sqlca;

                for (int i = 0; i < dgv.RowCount; i++)
                {
                    //添加销售记录
                    string s_cpdh = dgv.Rows[i].Cells[0].Value.ToString();
                    string s_qy   = dgv.Rows[i].Cells[3].Value.ToString();
                    string s_je   = dgv.Rows[i].Cells[4].Value.ToString();
                    string i_istc = dgv.Rows[i].Cells[5].Value.ToString();

                    String str2 = "insert into t_cp_yd(dh,mc,xldh,xlmc,cpdh,cpmc,fastdh,unit,unitprice,nowprice,qy,je,bfdh,sequen_kf,rec_key,is_tc)"
                                  + " select dh,mc,xldh,xlmc,cpdh,cpmc,fastdh,unit,unitprice,nowprice,'" + s_qy + "','" + s_je + "','" + s_dh + "','" + s_bf_consume_dh + "','" + s_rec_key + "','" + i_istc + "'" + " from t_cp" + " where cpdh = '" + s_cpdh + "'";
                    Gtsql r2 = new Gtsql();
                    i_flag = r2.ExecuteUpdate(str2);
                }
                // 扣会员卡款
                if (Global.s_vip != null)
                {
                    int i_Vipflag;
                    i_Vipflag = Gt.UpdateVip(Global.s_vip, decimal.Parse(s_vip), s_rec_key, 3, "消费");

                    if (i_Vipflag == 1)
                    {
                        s_cardtxt = "会员卡:" + Global.s_vip + "  扣款前:" + Global.d_svipje.ToString("F1") + "\n扣款后:" + (Global.d_svipje - decimal.Parse(s_vip)).ToString("F1");
                        MessageBox.Show(s_cardtxt, "会员卡扣款", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("会员卡扣款失败!");
                    }
                }


                String str3       = "SELECT cpmc, qy,unitprice,je FROM t_cp_yd WHERE  rec_key ='" + s_rec_key + "'";
                String s_sumjetxt = "select cash,hy_card,hlq,wx,zfb from t_pos_bill where rec_key='" + s_rec_key + "'";

                Gtsql     r3       = new Gtsql();
                DataTable d3       = new DataTable();
                string    s_Height = "65";
                d3 = r3.ExecuteQuery(str3);          //使用ExecuteQuery()执行sql语句;
                if (d3 != null && d3.Rows.Count > 0)
                {
                    s_Height = (Convert.ToUInt32(d3.Rows.Count * 7.5) + 85).ToString();
                }
                // 报表路径
                string path   = Application.StartupPath + "\\Report\\Report_mx.frx";
                Report report = new Report();

                report.Load(path);
                report.SetParameterValue("s_xm", Global.s_xm);
                report.SetParameterValue("s_posdate", Gt.GetStime().ToString("yy/MM/dd hh:mm"));
                report.SetParameterValue("s_mc", s_mc);
                report.SetParameterValue("s_dh", s_dh);
                report.SetParameterValue("s_Height", s_Height);

                report.SetParameterValue("s_sumje", Gt.Getjetxt(s_sumjetxt));
                report.SetParameterValue("s_card", s_cardtxt);


                report.RegisterData(d3, "t_cp_yd");

                eSet.ReportSettings.ShowProgress = false;

                report.PrintSettings.ShowDialog = false;


                report.Print();

                //    //减少货物质量
                //    bGoods.UpdateCount(int.Parse(dgv.Rows[i].Cells[3].Value.ToString()), dgv.Rows[i].Cells[0].Value.ToString());
                //}

                frmP.ClearForm();
                frmP.showPre();
                this.Close();
            }
        }
Exemple #15
0
        public static string GetListno(int i_set)  //返回流水号 0不更新 1更新
        {
            DateTime dt = Gt.GetStime();
            String   str;
            long     l_listno = 0;
            string   s_listno;
            int      i_flag = 0;

            if (int.Parse(dt.Hour.ToString()) > 6)
            {
                str = "SELECT listno FROM t_pos_bill_number WITH ( TABLOCKX ) where listdate ='" + dt.Date + "'";
                Gtsql     r1 = new Gtsql();
                DataTable d1 = new DataTable();
                d1 = r1.ExecuteQuery(str);
                if (d1 != null && d1.Rows.Count > 0)
                {
                    l_listno = long.Parse(d1.Rows[0]["listno"].ToString());
                    i_flag   = 1;
                }
            }
            else
            {
                str = "select listno from t_pos_bill_number with(tablockx)";
                Gtsql     r1 = new Gtsql();
                DataTable d1 = new DataTable();
                d1 = r1.ExecuteQuery(str);
                if (d1 != null && d1.Rows.Count > 0)
                {
                    l_listno = long.Parse(d1.Rows[0]["listno"].ToString());
                    dt       = dt.AddDays(-1);
                    i_flag   = 1;
                }
            }
            if (i_set == 1)
            {
                if (i_flag == 1)
                {
                    l_listno++;
                    str = "update t_pos_bill_number set listno ='" + l_listno + "'";
                    Gtsql r2 = new Gtsql();
                    r2.ExecuteUpdate(str);
                }
                else
                {
                    l_listno = 1;
                    str      = "update t_pos_bill_number set listno ='" + l_listno + "'" + "," + "listdate = '" + dt.Date + "'";
                    Gtsql r3 = new Gtsql();
                    r3.ExecuteUpdate(str);
                }
            }
            else
            {
                if (i_flag == 1)
                {
                    l_listno++;
                }
                else
                {
                    l_listno = 1;
                }
            }

            s_listno = dt.ToString("MMdd") + "-" + l_listno.ToString("d3");
            return(s_listno);
        }
Exemple #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (dataGridView1.RowCount == 0)
            {
                MessageBox.Show("无记录可打印!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            int    i_row      = int.Parse(dataGridView1.CurrentRow.Index.ToString());
            string s_rec_key  = dataGridView1.Rows[i_row].Cells["rec_key"].Value.ToString();
            string str3       = "SELECT cpmc, qy,unitprice,je FROM t_cp_yd WHERE  rec_key ='" + s_rec_key + "'";
            string s_sumjetxt = "select cash,hy_card,hlq,wx,zfb from t_pos_bill where rec_key='" + s_rec_key + "'";
            string s_carddh   = dataGridView1.Rows[i_row].Cells["carddh"].Value.ToString();
            string s_cardtxt;


            if (s_carddh == "")
            {
                s_cardtxt = "";
            }
            else
            {
                s_cardtxt = Gt.GetViptxt(s_rec_key);
            }


            Gtsql     r3       = new Gtsql();
            DataTable d3       = new DataTable();
            string    s_Height = "65";

            d3 = r3.ExecuteQuery(str3);          //使用ExecuteQuery()执行sql语句;
            if (d3 != null && d3.Rows.Count > 0)
            {
                s_Height = (Convert.ToUInt32(d3.Rows.Count * 7.5) + 85).ToString();
            }


            // 报表路径
            string path   = Application.StartupPath + "/Report/Report_mx.frx";
            Report report = new Report();

            report.Load(path);
            report.SetParameterValue("s_xm", Global.s_xm);
            report.SetParameterValue("s_posdate", DateTime.Parse(dataGridView1.Rows[i_row].Cells[3].Value.ToString()).ToString("yy/MM/dd hh:mm"));
            report.SetParameterValue("s_mc", dataGridView1.Rows[i_row].Cells[1].Value.ToString());  //流水号
            report.SetParameterValue("s_dh", dataGridView1.Rows[i_row].Cells[0].Value.ToString());
            report.SetParameterValue("s_Height", s_Height);

            report.SetParameterValue("s_sumje", Gt.Getjetxt(s_sumjetxt));
            report.SetParameterValue("s_card", s_cardtxt);


            report.RegisterData(d3, "t_cp_yd");

            eSet.ReportSettings.ShowProgress = false;

            report.PrintSettings.ShowDialog = false;


            report.Print();
        }
Exemple #17
0
        protected void addGoods(string s_code)  //增加商品
        {
            s_code = s_code.Trim();
            string pattern = @"^\d+(\.\d)?$";

            if (s_code != "")
            {
                if (!Regex.IsMatch(s_code, pattern))
                {
                    //dGV1.Visible = false;
                }
                else
                {
                    //检测是否为多码
                    String    str = "select dhno,dhid FROM t_cp_dhid WHERE dhid='" + s_code + "'"; //编写sql语句;
                    Gtsql     r   = new Gtsql();
                    DataTable d   = new DataTable();
                    d = r.ExecuteQuery(str);           //使用ExecuteQuery()执行sql语句;
                    if (d != null && d.Rows.Count > 0) //查询有结果
                    {
                        s_code = d.Rows[0]["dhno"].ToString();
                    }

                    //添加商品
                    string    str1 = "select cpdh,cpmc,unitprice,nowprice FROM t_cp WHERE dhid='" + s_code + "'"; //编写sql语句;
                    Gtsql     r1   = new Gtsql();
                    DataTable d1   = new DataTable();
                    d1 = r1.ExecuteQuery(str1);          //使用ExecuteQuery()执行sql语句;
                    if (d1 != null && d1.Rows.Count > 0) //查询有结果
                    {
                        DataGridViewRow row = new DataGridViewRow();
                        row.CreateCells(dGV);
                        row.Cells[0].Value = d1.Rows[0]["cpdh"].ToString();
                        row.Cells[1].Value = d1.Rows[0]["cpmc"].ToString();
                        if (Global.s_vip == "" || Global.s_vip == null)
                        {
                            row.Cells[2].Value = string.Format("{0:F2}", Convert.ToDecimal(d1.Rows[0]["unitprice"].ToString()));
                        }
                        else
                        {
                            row.Cells[2].Value = string.Format("{0:F2}", Convert.ToDecimal(d1.Rows[0]["nowprice"].ToString()));
                        }

                        row.Cells[3].Value = "1";
                        row.Cells[4].Value = string.Format("{0:F2}", decimal.Parse(row.Cells[2].Value.ToString()) * decimal.Parse(row.Cells[3].Value.ToString()));
                        row.Cells[5].Value = "0";
                        dGV.Rows.Add(row);
                        row.Selected = true;
                        tbCode.Text  = "";


                        //计算总钱数
                        sumCash();
                        lblGoodsName.Text = d1.Rows[0]["cpmc"].ToString();

                        taocan(d1.Rows[0]["cpdh"].ToString()); //检察套餐
                        //lblStock.Text = mGoods.Counts.ToString();
                    }
                    else
                    {
                        MessageBox.Show("对不起,此商品缺货!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        tbCode.SelectAll();
                    }
                }
            }
        }