Example #1
0
 //刷新
 private void butref_Click(object sender, EventArgs e)
 {
     try
     {
         if (rdo2.Checked && chkdjsj.Checked == false)
         {
             MessageBox.Show("查询的时间过长!");
             return;
         }
         string ssql  = " ";
         int    bshbz = rdo2.Checked ? 1 : 0;
         ssql += string.Format(" and a.bshbz ={0} ", bshbz);
         int deptid = Convert.ToInt32(Convertor.IsNull(cmbck.SelectedValue, "0"));//库房id
         ssql += string.Format(" and a.deptid ={0}", deptid);
         if (chkdjsj.Checked)
         {
             string t1 = dtp1.Value.ToShortDateString() + " 00:00:01";
             string t2 = dtp2.Value.ToShortDateString() + " 23:59:59";
             ssql += string.Format(" and a.djrq>='{0}' and a.djrq<='{1}' ", t1, t2);
         }
         ssql += string.Format(" and bscbz <>1 and a.ywlx='{0}'", Convertor.IsNull(cmbYwlx.SelectedValue, "")); //制剂 加工
         DataTable dt = YK_ZJJG_JH.GetJhDataTable(ssql, " order by a.shrq,a.djrq ", db);
         dataGridView1.DataSource = dt;
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }