Exemple #1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            DataSet dy = new DataSet();

            dy.Tables.Add(SSP.MainTable.Copy());
            MyDLL.TakeOver(dy);
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.RowCount <= 0)
            {
                MessageBox.Show("没有要打印的内容");
                return;
            }
            /////////////////////////////////////////////////////打印模块
            System.Data.DataTable dt = new System.Data.DataTable();
            DataRow dr;

            //设置列表头
            foreach (DataGridViewColumn headerCell in dataGridView1.Columns)
            {
                dt.Columns.Add(headerCell.HeaderText);
            }
            foreach (DataGridViewRow item in dataGridView1.Rows)
            {
                dr = dt.NewRow();
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    dr[i] = item.Cells[i].Value;
                }
                dt.Rows.Add(dr);
            }
            DataSet dy = new DataSet();

            dy.Tables.Add(dt);
            MyDLL.TakeOver(dy);
            //////////////////////////////////////////////////////
        }
Exemple #3
0
        private void button3_Click(object sender, EventArgs e)
        {//入库按钮事件处理
            if (dataGridView1.RowCount > 0)
            {
                insert_inlib(); //添加入库记录
                update_lib();   // 修改库存

                if (MessageBox.Show("入库完成,是否需要打印?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    /////////////////////////////////////////////////////打印模块
                    datato3();
                    System.Data.DataTable dt = new System.Data.DataTable();
                    DataRow dr;
                    //设置列表头
                    foreach (DataGridViewColumn headerCell in dataGridView3.Columns)
                    {
                        dt.Columns.Add(headerCell.HeaderText);
                    }
                    foreach (DataGridViewRow item in dataGridView3.Rows)
                    {
                        dr = dt.NewRow();
                        for (int i = 0; i < dt.Columns.Count; i++)
                        {
                            dr[i] = item.Cells[i].Value;
                        }
                        dt.Rows.Add(dr);
                    }
                    DataSet dy = new DataSet();
                    dy.Tables.Add(dt);
                    MyDLL.TakeOver(dy);
                }
                dataGridView3.Rows.Clear();   //打印完成后清空表格中数据
                dataGridView1.Rows.Clear();
                //////////////////////////////////////////////////////
            }
            else
            {
                MessageBox.Show("待入库药品为空!");
            }
        }
Exemple #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            DataRow dr;

            //设置列表头
            foreach (DataGridViewColumn headerCell in dataGridView1.Columns)
            {
                dt.Columns.Add(headerCell.HeaderText);
            }
            foreach (DataGridViewRow item in dataGridView1.Rows)
            {
                dr = dt.NewRow();
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    dr[i] = item.Cells[i].Value.ToString();
                }
                dt.Rows.Add(dr);
            }
            DataSet dy = new DataSet();

            dy.Tables.Add(dt);
            MyDLL.TakeOver(dy);
        }
Exemple #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            int          dadan = 0;
            bool         flag  = false;
            int          count = dataGridView1.Rows.Count;
            double       sum   = 0;//每一行的总金
            DialogResult MsgBoxResult;

            MsgBoxResult = MessageBox.Show("你确定出库吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);
            if (MsgBoxResult == DialogResult.Yes)  //确认出库;
            {
                string nowtime = dateTimePicker1.Value.ToString();
                MsgBoxResult = MessageBox.Show("系统当前的时间是" + nowtime, "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);
                if (MsgBoxResult == DialogResult.No)
                {
                    nowtime = Interaction.InputBox("请输入时间格式为" + nowtime);
                }
                MsgBoxResult = MessageBox.Show("是否打印出库单", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);
                if (MsgBoxResult == DialogResult.Yes)
                {
                    dadan = 1;
                    flag  = true;
                }
                if (flag)
                {
                    //需要打印出库单,开始打印出库单。
                    //出库单内容,药名,规格,数量,平均单价,金额合计
                    for (int i = 0; i < count - 1; ++i)
                    {
                        sum   = Convert.ToDouble(dataGridView1.Rows[i].Cells["Column12"].Value);
                        sumJ += sum;
                        dataGridView3.Rows.Add(dataGridView1.Rows[i].Cells["Column2"].Value, dataGridView1.Rows[i].Cells["Column3"].Value, dataGridView1.Rows[i].Cells["Column5"].Value, dataGridView1.Rows[i].Cells["Column10"].Value, dataGridView1.Rows[i].Cells["Column12"].Value);
                    }
                    dataGridView3.Rows.Add(null, null, null, null, sumJ);
                    //打印
                    System.Data.DataTable dt = new System.Data.DataTable();
                    DataRow dr;
                    foreach (DataGridViewColumn headerCell in dataGridView3.Columns)
                    {
                        dt.Columns.Add(headerCell.HeaderText);
                    }
                    foreach (DataGridViewRow item in dataGridView3.Rows)
                    {
                        dr = dt.NewRow();
                        for (int i = 0; i < dt.Columns.Count; i++)
                        {
                            dr[i] = item.Cells[i].Value;
                        }
                        dt.Rows.Add(dr);
                    }
                    DataSet dy = new DataSet();
                    dy.Tables.Add(dt);
                    MyDLL.TakeOver(dy);
                }
                //       DB db = new DB();
                db.close();
                if (db.connect())
                {
                    shijian = nowtime;
                    for (int i = 0; i < count - 1; ++i)
                    {
                        //     MessageBox.Show((string)dataGridView1.Rows[i].Cells["Column5"].Value);
                        string shu = (string)dataGridView1.Rows[i].Cells["Column5"].Value;
                        shuliang = System.Convert.ToDouble(shu);
                        keshi    = (String)dataGridView1.Rows[i].Cells["Column8"].Value;
                        yaohao   = (String)dataGridView1.Rows[i].Cells["Column1"].Value;

                        jinjia = (Double)dataGridView1.Rows[i].Cells["Column10"].Value;
                        //   yaokujingshou= (String)dataGridView1.Rows[i].Cells["Column4"].Value;
                        keshijingshou = (String)dataGridView1.Rows[i].Cells["Column9"].Value;
                        //yaofangjingshou = null;
                        //       string shou = (string)dataGridView1.Rows[i].Cells["Column11"].Value;
                        shoujia           = (Double)dataGridView1.Rows[i].Cells["Column11"].Value;
                        yaofangshangzhang = 1;
                        yaokujingshou     = "zhang";
                        string str = "insert into 出库记录(科室,药号,数量,进价,日期,药库经手,科室经手,药房上账,售价,是否打单) values('" + keshi + "','" + yaohao + "'," + shuliang + "," + jinjia + ",'" + shijian + "','" + yaokujingshou + "','" + keshijingshou + "'," + yaofangshangzhang + "," + shoujia + "," + dadan + ")";
                        string sql = "update  药库库存 set  本期出库 =本期出库 +" + shuliang + " where 药号='" + yaohao + "'";

                        /*   string sql2 = null;
                         * if(keshi.Equals("门诊"))
                         * {
                         *     sql2="update 药房库存 set  门诊领药 ="+shuliang;
                         * }
                         * if(keshi.Equals("病房"))
                         * {
                         *     sql2 = "update 药房库存 set  药房领药 =" + shuliang;
                         * }
                         * if(keshi.Equals("门诊"))
                         * {
                         *     sql2 = "update 药房库存 set  科室领药 =" + shuliang;
                         * }*/
                        if (db.change(sql))
                        {
                            MessageBox.Show("update success" + sql);
                        }
                        //    MessageBox.Show(str);
                        if (db.change(str) == false)
                        {
                            return;
                        }
                    }
                }
                dataGridView3.Rows.Clear();
                dataGridView1.Rows.Clear();
                sumJ = 0;
                db.close();
                return;
            }
        }