Пример #1
0
        private void txtghdw_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                int     nkey    = Convert.ToInt32(e.KeyCode);
                Control control = (Control)sender;

                if (control.Text.Trim() == "")
                {
                    control.Text = "";
                    control.Tag  = "0";
                    _mzFlag      = "0";
                    _zyFlag      = "0";
                    _deptid      = "0";
                    return;
                }
                if ((nkey >= 65 && nkey <= 90) || (nkey >= 48 && nkey <= 57) || (nkey >= 96 && nkey <= 105) || nkey == 8 || nkey == 32 || nkey == 46 || (nkey == 13 && (Convert.ToString(control.Tag) == "0" || Convert.ToString(control.Tag) == "")))
                {
                }
                else
                {
                    return;
                }
                Point point = new Point(this.Location.X + control.Location.X, this.Location.Y + control.Location.Y + control.Height * 3);


                string[] GrdMappingName = new string[] { "科室", "拼音码", "五笔码", "DEPT_ID", "MZ_FLAG", "ZY_FLAG" };
                int[]    GrdWidth       = new int[] { 140, 60, 60, 0, 0, 0 };
                string[] sfield         = new string[] { "", "PY_CODE", "WB_CODE", "", "" };

                string    ssql = "select NAME ,PY_CODE ,WB_CODE ,DEPT_ID,MZ_FLAG,ZY_FLAG from JC_DEPT_PROPERTY where (MZ_FLAG=1 or ZY_FLAG=1) and DELETED=0";
                Fshowcard f    = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Text     = "科室";
                f.Width    = 500;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    (sender as Control).Tag  = row["DEPT_ID"].ToString();
                    (sender as Control).Text = row["NAME"].ToString();
                    _mzFlag = row["MZ_FLAG"].ToString();
                    _zyFlag = row["ZY_FLAG"].ToString();
                    _deptid = row["DEPT_ID"].ToString();
                    this.SelectNextControl((Control)sender, true, false, true, true);
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show("发生错误" + err.Message);
            }
        }
Пример #2
0
        private void txtksid_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                int     nkey    = Convert.ToInt32(e.KeyCode);
                Control control = (Control)sender;

                if (control.Text.Trim() == "")
                {
                    control.Text = "";
                    control.Tag  = "0";
                    return;
                }
                if ((nkey >= 65 && nkey <= 90) || (nkey >= 48 && nkey <= 57) || (nkey >= 96 && nkey <= 105) || nkey == 8 || nkey == 32 || nkey == 46 || (nkey == 13 && (Convert.ToString(control.Tag) == "0" || Convert.ToString(control.Tag) == "")))
                {
                }
                else
                {
                    return;
                }
                Point point = new Point(this.Location.X + control.Location.X, this.Location.Y + control.Location.Y + control.Height * 3);


                string[] GrdMappingName = new string[] { "科室", "拼音码", "五笔码", "DEPT_ID", "MZ_FLAG", "ZY_FLAG" };
                int[]    GrdWidth       = new int[] { 140, 60, 60, 0, 0, 0 };
                string[] sfield         = new string[] { "", "PY_CODE", "WB_CODE", "", "" };

                string    ssql = string.Format(@"select distinct  NAME ,PY_CODE ,WB_CODE ,a.DEPT_ID,MZ_FLAG,ZY_FLAG from (select * from(select distinct PBKSID,PBKS,YSID,YSXM from jc_mz_yspb a 
                                                inner join JC_DOCTOR_TYPE b on a.ZZJBID=b.[TYPE_ID] 
                                                group by PBKSID,PBKS,YSID,YSXM) a inner join JC_DEPT_PROPERTY b on a.PBKSID=b.DEPT_ID)a
                                                left join JC_MZ_KSDZWH c on a.YSID=c.emp_id and a.PBKSID=c.dept_id where ISZJMZ=1 and (YQID=0 or YQID='" + combbyq.SelectedValue + "')");
                Fshowcard f    = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Text     = "科室";
                f.Width    = 500;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    (sender as Control).Tag  = row["DEPT_ID"].ToString();
                    (sender as Control).Text = row["NAME"].ToString();
                    this.SelectNextControl((Control)sender, true, false, true, true);
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show("发生错误" + err.Message);
            }
        }
Пример #3
0
        private void txtXm_KeyUp(object sender, KeyEventArgs e)
        {
            int     nkey    = Convert.ToInt32(e.KeyCode);
            Control control = (Control)sender;

            if (control.Text.Trim() == "")
            {
                control.Text             = "";
                control.Tag              = "0";
                dataGridView1.DataSource = null;
            }

            if ((nkey >= 65 && nkey <= 90) || (nkey >= 48 && nkey <= 57) || (nkey >= 96 && nkey <= 105) || nkey == 32 || (nkey == 13 && (Convert.ToString(control.Tag) == "0" || Convert.ToString(control.Tag) == "")))
            {
            }
            else
            {
                return;
            }

            string[] mappName     = new string[] { "项目代码", "项目名称", "单价", "拼音码", "五笔码", "数字码", "国家编码" };
            int[]    colWidth     = new int[] { 50, 100, 70, 50, 50, 50, 50 };
            string[] searchFields = new string[] { "py_code", "wb_code", "", "", "" };
            string   sSql         = "select item_id 项目代码,item_name 项目名称,cost_price 单价,py_code 拼音码,wb_code 五笔码,'' 数字码,std_code 国家编码 from jc_hsitemdiction where jgbm=" + FrmMdiMain.Jgbm;

            try
            {
                Fshowcard fshowcard = new Fshowcard(mappName, colWidth, searchFields, FilterType.智能, txtXm.Text.Trim(), sSql);
                fshowcard.StartPosition = FormStartPosition.Manual;
                fshowcard.Location      = new Point(txtXm.Location.X + txtXm.Parent.Location.X, txtXm.Location.Y + txtXm.Parent.Location.Y + txtXm.Height * 3);

                fshowcard.ShowDialog();

                DataRow dr = fshowcard.dataRow;

                if (dr == null)
                {
                    return;
                }

                txtXm.Text = dr["项目名称"].ToString().Trim();
                txtXm.Tag  = Convert.ToInt32(dr["项目代码"]);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Пример #4
0
        private void textBox1_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                int     nkey    = Convert.ToInt32(e.KeyCode);
                Control control = (Control)sender;

                if (control.Text.Trim() == "")
                {
                    control.Text = "";
                    control.Tag  = "0";
                    return;
                }
                if ((nkey >= 65 && nkey <= 90) || (nkey >= 48 && nkey <= 57) || (nkey >= 96 && nkey <= 105) || nkey == 8 || nkey == 32 || nkey == 46 || (nkey == 13 && (Convert.ToString(control.Tag) == "0" || Convert.ToString(control.Tag) == "")))
                {
                }
                else
                {
                    return;
                }
                Point point = new Point(this.Location.X + control.Location.X, this.Location.Y + control.Location.Y + control.Height * 3);


                string[] GrdMappingName = new string[] { "科室", "PYM", "flm", "fflm", "jc", "F5", "ksdz" };
                int[]    GrdWidth       = new int[] { 140, 60, 60, 0, 0, 0, 0 };
                string[] sfield         = new string[] { "", "PYM ", " ", "", " " };

                string    ssql = " select *  from (select flmc, PYM,flm,fflm ,jc,F5,1 as ksdz from  jc_Dept_FZKS ) as t   where t.ksdz=1";
                Fshowcard f    = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Text     = "科室";
                f.Width    = 500;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    (sender as Control).Tag  = row["flm"].ToString();
                    (sender as Control).Text = row["flmc"].ToString();
                    this.SelectNextControl((Control)sender, true, false, true, true);
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show("发生错误" + err.Message);
            }
        }
Пример #5
0
        private void txtQuery_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                int     nkey    = Convert.ToInt32(e.KeyCode);
                Control control = (Control)sender;

                if (control.Text.Trim() == "")
                {
                    control.Text = "";
                    control.Tag  = "0";
                    return;
                }
                if ((nkey >= 65 && nkey <= 90) || (nkey >= 48 && nkey <= 57) || (nkey >= 96 && nkey <= 105) || nkey == 8 || nkey == 32 || nkey == 46 || (nkey == 13 && (Convert.ToString(control.Tag) == "0" || Convert.ToString(control.Tag) == "")))
                {
                }
                else
                {
                    return;
                }
                Point point = new Point(this.Location.X + control.Location.X, this.Location.Y + control.Location.Y + control.Height * 3);


                string[] GrdMappingName = new string[] { "姓名", "拼音码", "D_CODE", "医生编号" };
                int[]    GrdWidth       = new int[] { 140, 60, 60, 60 };
                string[] sfield         = new string[] { "", "c.PY_CODE", "", "", "" };

                string    ssql = string.Format(@"select c.NAME,c.PY_CODE,c.D_CODE,a.EMPLOYEE_ID from JC_EMP_DEPT_ROLE a inner join JC_DEPT_PROPERTY b on a.DEPT_ID=b.DEPT_ID inner join JC_EMPLOYEE_PROPERTY c on a.EMPLOYEE_ID=c.EMPLOYEE_ID where b.DEPT_ID='{0}'", txtksidQuery.Tag);
                Fshowcard f    = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Text     = "医生信息";
                f.Width    = 500;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    (sender as Control).Tag  = row["EMPLOYEE_ID"].ToString();
                    (sender as Control).Text = row["NAME"].ToString();
                    this.SelectNextControl((Control)sender, true, false, true, true);
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show("发生错误" + err.Message);
            }
        }
Пример #6
0
        private void TextKeyUp(object sender, KeyEventArgs e)
        {
            int     num     = Convert.ToInt32(e.KeyCode);
            Control control = (Control)sender;

            if (control.Text.Trim() == "")
            {
                control.Text = "";
                control.Tag  = "0";
            }
            if ((((((num >= 0x41) && (num <= 90)) || ((num >= 0x30) && (num <= 0x39))) || (((num >= 0x60) && (num <= 0x69)) || (((num == 8) || (num == 0x20)) || (num == 0x2e)))) || ((num == 13) && ((Convert.ToString(control.Tag) == "0") || (Convert.ToString(control.Tag) == "")))) && ((this.xtorsd != 1) && (num != 13)))
            {
                string ssql = "";
                try
                {
                    Point point = new Point(base.Location.X + control.Location.X, (base.Location.Y + control.Location.Y) + (control.Height * 2));
                    if (control.TabIndex == 0)
                    {
                        string[] grdMappingName = new string[] { "id", "行号", "名称", "拼音码", "五笔码" };
                        int[]    grdWidth       = new int[] { 0, 50, 200, 100, 100 };
                        string[] sfield         = new string[] { "wb_code", "py_code", "", "", "" };
                        ssql = "select coding as id, ROW_NUMBER() OVER(order by  id) rowno ,name as mc,wb_code as wbm,py_code as pym from  jc_DISEASE where id<>0  ";
                        string text = control.Text;
                        if (text == "")
                        {
                            text = "";
                        }
                        Fshowcard fshowcard = new Fshowcard(grdMappingName, grdWidth, sfield, FilterType.拼音, text.Trim(), ssql);
                        fshowcard.Location = point;
                        fshowcard.ShowDialog(this);
                        DataRow dataRow = fshowcard.dataRow;
                        if (dataRow != null)
                        {
                            control.Text = dataRow["mc"].ToString();
                            control.Tag  = dataRow["id"].ToString();
                            base.SelectNextControl((Control)sender, true, false, true, true);
                        }
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show("发生错误" + exception.Message);
                }
            }
        }
Пример #7
0
        /// <summary>
        /// FrmShowCard查询窗口
        /// </summary>
        /// <param name="sender">引发的控件</param>
        /// <param name="_ShowCardType">查询类型权举</param>
        /// <param name="Fid">其它条件ID</param>
        /// <param name="point">位置 </param>
        public static void frmShowCard(object sender, ShowCardType _ShowCardType, string functionName, long Fid, Point point, int deptid, RelationalDatabase _DataBase)
        {
            //SystemCfg sc = new SystemCfg(8201);
            //if (sc.Config == "0")
            //{
            //    frmShowCard(sender, _ShowCardType, Fid, point, deptid, _DataBase);
            //    return;
            //}

            Control control = (Control)sender;

            if (control.Text.Trim() == "")
            {
                control.Text = "";
                control.Tag  = "0";
            }
            string[]  GrdMappingName;
            int[]     GrdWidth;
            string[]  sfield;
            string    ssql = "";
            Fshowcard f;

            if (_ShowCardType == ShowCardType.库存药品)
            {
                GrdMappingName = new string[] { "ggid", "cjid", "行号", "品名", "规格", "厂家", "库存", "单位", "DWBL", "批发价", "零售价", "货号" };
                GrdWidth       = new int[] { 0, 0, 30, 140, 90, 90, 60, 30, 0, 60, 60, 100 };
                sfield         = new string[] { "wbm", "pym", "szm", "ywm", "ypbm" };

                /*
                 * update code by pengy 7-2 10:17
                 * 按系统参数设置获取库存是否大于等于0的数据
                 */
                ssql = "select config from jc_config where id = '8200'";
                DataTable paramTable = _DataBase.GetDataTable(ssql);
                bool      ypkc       = paramTable != null && paramTable.Rows.Count > 0 && paramTable.Rows[0][0].ToString().Trim() == "1" ? true : false;
                if (YpConfig.是否药库(deptid, _DataBase) == true)
                {
                    if (ypkc)
                    {
                        ssql = string.Format(@"select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yK_kcmx a,yp_ypbm b where 
                        a.ggid=b.ggid and KCL >= 0 and deptid={0} and bdelete_kc=0 and YPLX in (select distinct YPLX from YP_GLLX a left join YP_YPLX b on a.YPLX = b.ID
                        where DEPTID = {0}) and cjid in (select cjid from YP_YPCJD where iswbyp =1)", deptid);
                    }
                    else
                    {
                        ssql = string.Format(@"select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yK_kcmx a,yp_ypbm b where 
                        a.ggid=b.ggid and KCL > 0 and deptid={0} and bdelete_kc=0 and YPLX in (select distinct YPLX from YP_GLLX a left join YP_YPLX b on a.YPLX = b.ID
                        where DEPTID = {0}) and cjid in (select cjid from YP_YPCJD where iswbyp =1)", deptid);
                    }
                }
                else
                {
                    if (ypkc)
                    {
                        ssql = string.Format(@"select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl/dwbl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yf_kcmx a,yp_ypbm b where 
                        a.ggid=b.ggid and KCL >= 0 and deptid={0} and bdelete_kc=0 and YPLX in (select distinct YPLX from YP_GLLX a left join YP_YPLX b on a.YPLX = b.ID
                        where DEPTID = {0}) and cjid in (select cjid from YP_YPCJD where iswbyp =1)", deptid);
                    }
                    else
                    {
                        ssql = string.Format(@"select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl/dwbl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yf_kcmx a,yp_ypbm b where 
                        a.ggid=b.ggid and KCL > 0 and deptid={0} and bdelete_kc=0 and YPLX in (select distinct YPLX from YP_GLLX a left join YP_YPLX b on a.YPLX = b.ID
                        where DEPTID = {0}) and cjid in (select cjid from YP_YPCJD where iswbyp =1)", deptid);
                    }
                }
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql, _DataBase);
                f.Location = point;
                f.Text     = "库存药品";
                f.Width    = 700;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Tag = row["cjid"].ToString();
                }
            }
            else if (_ShowCardType == ShowCardType.库存药品_不区分禁用)
            {
                GrdMappingName = new string[] { "ggid", "cjid", "行号", "品名", "规格", "厂家", "库存", "单位", "DWBL", "批发价", "零售价", "货号" };
                GrdWidth       = new int[] { 0, 0, 30, 140, 90, 90, 60, 30, 0, 60, 60, 100 };
                sfield         = new string[] { "wbm", "pym", "szm", "ywm", "ypbm" };
                if (YpConfig.是否药库(deptid, _DataBase) == true)
                {
                    ssql = string.Format(@"select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yK_kcmx a,yp_ypbm b where 
                    a.ggid=b.ggid and KCL > 0  and deptid={0}  and YPLX in (select distinct YPLX from YP_GLLX a left join YP_YPLX b on a.YPLX = b.ID
                        where DEPTID = {0})", deptid);
                }
                else
                {
                    ssql = string.Format(@"select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl/dwbl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yf_kcmx a,yp_ypbm b 
                    where a.ggid=b.ggid and KCL > 0 and deptid={0}  and YPLX in (select distinct YPLX from YP_GLLX a left join YP_YPLX b on a.YPLX = b.ID
                        where DEPTID = {0})", deptid);
                }
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql, _DataBase);
                f.Location = point;
                f.Text     = "库存药品";
                f.Width    = 700;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Tag = row["cjid"].ToString();
                }
            }
            else if (_ShowCardType == ShowCardType.库存药品_外用药品)
            {
                GrdMappingName = new string[] { "ggid", "cjid", "行号", "品名", "规格", "厂家", "单位", "DWBL", "批发价", "零售价", "货号" };
                GrdWidth       = new int[] { 0, 0, 30, 140, 90, 90, 30, 0, 60, 60, 100 };
                sfield         = new string[] { "wbm", "pym", "szm", "ywm", "ypbm" };
                if (YpConfig.是否药库(deptid, _DataBase) == true)
                {
                    ssql = string.Format(@"select distinct top 100 a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yK_kcmx a,yp_ypbm b where 
                          a.ggid=b.ggid and wyyp=1   and deptid={0} and bdelete_kc=0 and YPLX in (select distinct YPLX from YP_GLLX a left join YP_YPLX b on a.YPLX = b.ID
                          where DEPTID = {0})  ", deptid);
                }
                else
                {
                    ssql = string.Format(@"select distinct top 100 a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yf_kcmx a,yp_ypbm b where 
                          a.ggid=b.ggid  and wyyp=1 and deptid={0} and bdelete_kc=0 and YPLX in (select distinct YPLX from YP_GLLX a left join YP_YPLX b on a.YPLX = b.ID                           
                          where DEPTID = {0})", deptid);
                }
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql, _DataBase);
                f.Location = point;
                f.Text     = "外用药品";
                f.Width    = 700;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Tag = row["cjid"].ToString();
                }
            }
        }
Пример #8
0
        /// <summary>
        /// FrmShowCard查询窗口
        /// </summary>
        /// <param name="sender">引发的控件</param>
        /// <param name="_ShowCardType">查询类型权举</param>
        /// <param name="Fid">其它条件ID</param>
        /// <param name="point">位置 </param>
        public static void frmShowCard_wbks(object sender, ShowCardType _ShowCardType, long Fid, Point point, int deptid, RelationalDatabase _DataBase)
        {
            Control control = (Control)sender;

            if (control.Text.Trim() == "")
            {
                control.Text = "";
                control.Tag  = "0";
            }


            string[]  GrdMappingName;
            int[]     GrdWidth;
            string[]  sfield;
            string    ssql = "";
            Fshowcard f;

            if (_ShowCardType == ShowCardType.剂型)
            {
                GrdMappingName = new string[] { "id", "药品剂型", "拼音码", "五笔码" };
                GrdWidth       = new int[] { 0, 150, 100, 100 };
                //if (Convertor.IsNull(control.Tag.ToString(),"0")!="0")
                sfield = new string[] { "wbm", "pym", "", "", "" };
                //else
                //	sfield=new string[] {"","","","",""};
                ssql       = "select id,mc,pym,wbm from yp_ypjx where id<>0 ";//yplx="+Convert.ToInt32(Convertor.IsNull(Fid,"0"))+" ";
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Text     = "药品剂型";
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Text = row["mc"].ToString();
                    control.Tag  = row["id"].ToString();
                }
            }

            if (_ShowCardType == ShowCardType.单位)
            {
                GrdMappingName = new string[] { "标识", "名称" };
                GrdWidth       = new int[] { 100, 200 };
                //if (Convertor.IsNull(control.Tag.ToString(),"0")!="0")
                sfield = new string[] { "wbm", "pym", "", "", "" };
                //else
                //	sfield=new string[] {"","","","",""};
                ssql       = "select id,dwmc from yp_ypdw where id<>0 ";
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Text     = "药品单位";
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Text = row["dwmc"].ToString();
                    control.Tag  = row["ID"].ToString();
                }
            }
            if (_ShowCardType == ShowCardType.厂家)
            {
                GrdMappingName = new string[] { "id", "生产厂家", "拼音码", "五笔码" };
                GrdWidth       = new int[] { 0, 150, 100, 100 };
                sfield         = new string[] { "wbm", "pym", "", "", "" };
                ssql           = "select id,sccj,pym,wbm from yp_sccj where id<>0 ";
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Text     = "生产厂家";
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Text = row["sccj"].ToString();
                    control.Tag  = row["id"].ToString();
                }
            }
            if (_ShowCardType == ShowCardType.用法)
            {
                GrdMappingName = new string[] { "id", "使用方法", "拼音码", "五笔码" };
                GrdWidth       = new int[] { 0, 150, 100, 100 };
                //if (Convertor.IsNull(control.Tag.ToString(),"0")!="0")
                sfield = new string[] { "wb_code", "py_code", "", "", "" };
                //else
                //	sfield=new string[] {"","","","",""};
                ssql       = "select id,name,py_code,wb_code from jc_usagediction where name is not null ";
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Text     = "药品用法";
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Text = row["name"].ToString();
                    control.Tag  = row["id"].ToString();
                }
            }

            if (_ShowCardType == ShowCardType.药理分类)
            {
                GrdMappingName = new string[] { "id", "货位编号", "药品分类", "父分类", "拼音码", "五笔码" };
                GrdWidth       = new int[] { 0, 60, 150, 150, 100, 100 };
                //				if (Convertor.IsNull(control.Tag.ToString(),"0")!="0")
                sfield = new string[] { "wbm", "pym", "", "", "" };
                //				else
                //					sfield=new string[] {"","","","",""};
                ssql       = "select id,hwbh,flmc,(select flmc from yp_ylfl where id=a.fid),pym,wbm from yp_ylfl a where yjdbz=1 ";
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Width    = 600;
                f.Text     = "药理分类";
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Text = row["flmc"].ToString();
                    control.Tag  = row["id"].ToString();
                }
            }

            if (_ShowCardType == ShowCardType.供货单位)
            {
                GrdMappingName = new string[] { "id", "供货商", "拼音码", "五笔码" };
                GrdWidth       = new int[] { 0, 150, 100, 100 };
                sfield         = new string[] { "wbm", "pym", "", "", "" };
                ssql           = "select ID,ghdwmc,pym,wbm from yp_ghdw WHERE ID<>0 ";
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Text     = "供货单位";
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Text = row["ghdwmc"].ToString();
                    control.Tag  = row["id"].ToString();
                }
            }

            if (_ShowCardType == ShowCardType.包含在科室管理类型中的药品字典)
            {
                //SystemCfg cfg = new SystemCfg(8002, _DataBase);
                //string tablename = "YK_KCMX";
                //if (cfg.Config == "1")
                string tablename = Yp.Seek_kcmx_table(deptid, _DataBase);

                GrdMappingName = new string[] { "ggid", "cjid", "行号", "品名", "规格", "厂家", "单位", "DWBL", "上次进价", "进货价", "批发价", "零售价", "货号", "基药" };
                GrdWidth       = new int[] { 0, 0, 0, 140, 90, 90, 30, 0, 70, 60, 60, 60, 100, 45 };
                sfield         = new string[] { "b.wbm", "b.pym", "szm", "ywm", "ypbm" };

                ssql = @"select distinct top 100  a.ggid,a.cjid,0 rowno,s_yppm,s_ypgg,s_sccj,s_ypdw,1 dwbl,
                (case when scjj=0 or scjj is null then '' else cast(scjj as varchar(50)) end) scjj,
                a.mrjj,
                pfj,lsj,shh,(case when GJJBYW=1 then '是' else '' end) 基药 from vi_yp_ypcd a inner join yp_ypbm b " +
                       " on a.ggid=b.ggid left join " + tablename + " c on a.cjid=c.cjid and c.deptid=" + deptid + "  where cjbdelete=0  and a.n_ypzlx in(select ypzlx from yp_gllx where deptid=" + deptid + ") ";
                f = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);

                f.Location = point;
                f.Text     = "药品输入";
                f.Width    = 800;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Tag = row["cjid"].ToString();
                }
            }

            if (_ShowCardType == ShowCardType.所有药品字典)
            {
                GrdMappingName = new string[] { "ggid", "cjid", "行号", "品名", "规格", "厂家", "单位", "DWBL", "批发价", "零售价", "货号" };
                GrdWidth       = new int[] { 0, 0, 0, 140, 90, 90, 30, 0, 70, 60, 60, 100 };
                sfield         = new string[] { "b.wbm", "b.pym", "szm", "ywm", "ypbm" };

                ssql = "select distinct top 100  a.ggid,a.cjid,0 rowno,s_yppm,s_ypgg,s_sccj,s_ypdw,1 dwbl,pfj,lsj,shh from yp_ypcjd a inner join yp_ypbm b " +
                       " on a.ggid=b.ggid  ";
                f = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);

                f.Location = point;
                f.Text     = "药品输入";
                f.Width    = 700;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Tag = row["cjid"].ToString();
                }
            }

            if (_ShowCardType == ShowCardType.库存批号列表)
            {
                GrdMappingName = new string[] { "行号", "库存量", "单位", "批号", "效期", "库位", "kwid" };
                GrdWidth       = new int[] { 0, 80, 40, 75, 100, 0, 0 };
                sfield         = new string[] { "", "", "", "", "" };

                if (YpConfig.是否药库(deptid, _DataBase) == true)
                {
                    ssql = "select 0, kcl,dbo.fun_yp_ypdw(zxdw),ypph,ypxq,'' kwmc,kwid  from yk_kcph " +
                           " where deptid=" + deptid + " and cjid=" + Fid + " and bdelete=0 ";
                }
                else
                {
                    ssql = "select 0, kcl,dbo.fun_yp_ypdw(zxdw),ypph,ypxq,'' kwmc,kwid  from yf_kcph " +
                           " where deptid=" + deptid + " and cjid=" + Fid + " and bdelete=0 ";
                }

                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, "", ssql, _DataBase);
                f.Location = point;
                f.Text     = "批号列表";
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Text = row["ypph"].ToString();
                }
            }

            if (_ShowCardType == ShowCardType.库存药品)
            {
                GrdMappingName = new string[] { "ggid", "cjid", "行号", "品名", "规格", "厂家", "库存", "单位", "DWBL", "批发价", "零售价", "货号" };
                GrdWidth       = new int[] { 0, 0, 30, 140, 90, 90, 60, 30, 0, 60, 60, 100 };
                sfield         = new string[] { "wbm", "pym", "szm", "ywm", "ypbm" };

                /*
                 * update code by pengy 7-2 10:17
                 * 按系统参数设置获取库存是否大于等于0的数据
                 */
                ssql = "select config from jc_config where id = '8200'";
                DataTable paramTable = _DataBase.GetDataTable(ssql);
                bool      ypkc       = paramTable != null && paramTable.Rows.Count > 0 && paramTable.Rows[0][0].ToString().Trim() == "1" ? true : false;
                if (YpConfig.是否药库(deptid, _DataBase) == true)
                {
                    if (ypkc)
                    {
                        ssql = @"select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh 
                                 from vi_yK_kcmx a,yp_ypbm b
                                 where a.ggid=b.ggid and KCL >= 0 and deptid=" + deptid + " and bdelete_kc=0 and a.cjid in (select cjid from YP_YPCJD where iswbyp =1)";
                    }

                    else
                    {
                        ssql = @"select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yK_kcmx a,yp_ypbm b where a.ggid=b.ggid and KCL > 0 and deptid=" + deptid + " and bdelete_kc=0  and a.cjid in (select cjid from YP_YPCJD where iswbyp =1)";
                    }
                }
                else
                {
                    if (ypkc)
                    {
                        ssql = @"select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl/dwbl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yf_kcmx a,yp_ypbm b where a.ggid=b.ggid and KCL >= 0 and deptid=" + deptid + " and bdelete_kc=0  and a.cjid in (select cjid from YP_YPCJD where iswbyp =1)";
                    }
                    else
                    {
                        ssql = @"select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl/dwbl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yf_kcmx a,yp_ypbm b where a.ggid=b.ggid and KCL > 0 and deptid=" + deptid + " and bdelete_kc=0  and a.cjid in (select cjid from YP_YPCJD where iswbyp =1)";
                    }
                }
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql, _DataBase);
                f.Location = point;
                f.Text     = "库存药品";
                f.Width    = 700;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Tag = row["cjid"].ToString();
                }
            }

            if (_ShowCardType == ShowCardType.库存药品_不区分禁用)
            {
                GrdMappingName = new string[] { "ggid", "cjid", "行号", "品名", "规格", "厂家", "库存", "单位", "DWBL", "批发价", "零售价", "货号" };
                GrdWidth       = new int[] { 0, 0, 30, 140, 90, 90, 60, 30, 0, 60, 60, 100 };
                sfield         = new string[] { "wbm", "pym", "szm", "ywm", "ypbm" };
                if (YpConfig.是否药库(deptid, _DataBase) == true)
                {
                    ssql = "select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yK_kcmx a,yp_ypbm b where a.ggid=b.ggid and KCL > 0  and deptid=" + deptid + " ";
                }
                else
                {
                    ssql = "select distinct top 100  a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,cast(kcl/dwbl as float) kcl,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yf_kcmx a,yp_ypbm b where a.ggid=b.ggid and KCL > 0 and deptid=" + deptid + "  ";
                }
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql, _DataBase);
                f.Location = point;
                f.Text     = "库存药品";
                f.Width    = 700;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Tag = row["cjid"].ToString();
                }
            }

            if (_ShowCardType == ShowCardType.库存药品_外用药品)
            {
                GrdMappingName = new string[] { "ggid", "cjid", "行号", "品名", "规格", "厂家", "单位", "DWBL", "批发价", "零售价", "货号" };
                GrdWidth       = new int[] { 0, 0, 30, 140, 90, 90, 30, 0, 60, 60, 100 };
                sfield         = new string[] { "wbm", "pym", "szm", "ywm", "ypbm" };
                if (YpConfig.是否药库(deptid, _DataBase) == true)
                {
                    ssql = "select distinct top 100 a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yK_kcmx a,yp_ypbm b where a.ggid=b.ggid and wyyp=1   and deptid=" + deptid + " and bdelete_kc=0 ";
                }
                else
                {
                    ssql = "select distinct top 100 a.ggid,cjid,0 rowno,yppm,ypgg,s_sccj,s_ypdw,1 dwbl,pfj,lsj,shh from vi_yf_kcmx a,yp_ypbm b where a.ggid=b.ggid  and wyyp=1 and deptid=" + deptid + " and bdelete_kc=0 ";
                }
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql, _DataBase);
                f.Location = point;
                f.Text     = "外用药品";
                f.Width    = 700;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Tag = row["cjid"].ToString();
                }
            }

            #region 加工成品的药品字典
            if (_ShowCardType == ShowCardType.加工成品的药品字典)
            {
                //SystemCfg cfg = new SystemCfg(8002, _DataBase);
                //string tablename = "YK_KCMX";
                //if (cfg.Config == "1")
                string tablename = Yp.Seek_kcmx_table(deptid, _DataBase);

                GrdMappingName = new string[] { "ggid", "cjid", "行号", "品名", "规格", "厂家", "单位", "子类型", "DWBL", "上次进价", "批发价", "零售价", "货号", "基药" };
                GrdWidth       = new int[] { 0, 0, 0, 140, 90, 90, 30, 60, 0, 70, 60, 60, 100, 45 };
                sfield         = new string[] { "b.wbm", "b.pym", "szm", "ywm", "ypbm" };

                string    strWhere = "";
                DataTable dtConfig = _DataBase.GetDataTable(string.Format(" select config from jc_config where id = 8042 ", 8042));
                if (dtConfig.Rows.Count > 0)
                {
                    string strCfg = dtConfig.Rows[0][0].ToString();

                    string[] strs  = strCfg.Split('|');
                    string   strCp = strs[0];
                    string[] scps  = strCp.Split(',');


                    for (int i = 0; i < scps.Length; i++)
                    {
                        if (i == 0)
                        {
                            strWhere += string.Format(" and a.n_ypzlx in ({0},", scps[i]);
                        }
                        else
                        {
                            strWhere += string.Format("{0},", scps[i]);
                        }
                        if (i == scps.Length - 1)
                        {
                            strWhere = (strWhere.Substring(0, strWhere.Length - 1)) + ") ";
                        }
                    }
                }

                ssql = "select distinct top 80  a.ggid,a.cjid,0 rowno,s_yppm,s_ypgg,s_sccj,s_ypdw, d.mc zlxmc, 1 dwbl,(case when scjj=0 or scjj is null then '' else cast(scjj as varchar(50)) end) scjj,pfj,lsj,shh,(case when GJJBYW=1 then '是' else '' end) 基药 from vi_yp_ypcd a inner join yp_ypbm b " +
                       " on a.ggid=b.ggid left join " + tablename + " c on a.cjid=c.cjid and c.deptid=" + deptid + " inner join yp_ypzlx d on a.ypzlx=d.id  where cjbdelete=0" + strWhere + "  and a.n_ypzlx in(select ypzlx from yp_gllx where deptid=" + deptid + ") ";
                try
                {
                    f = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                }
                catch
                {
                    throw new Exception(" 8042参数设置有误! ");
                    return;
                }

                f.Location = point;
                f.Text     = "药品输入";
                f.Width    = 750;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Tag = row["cjid"].ToString();
                }
            }
            #endregion

            #region 制剂成品的药品字典
            if (_ShowCardType == ShowCardType.制剂成品的药品字典)
            {
                string tablename = Yp.Seek_kcmx_table(deptid, _DataBase);
                GrdMappingName = new string[] { "ggid", "cjid", "行号", "品名", "规格", "厂家", "单位", "子类型", "DWBL", "上次进价", "批发价", "零售价", "货号", "基药" };
                GrdWidth       = new int[] { 0, 0, 0, 140, 90, 90, 30, 60, 0, 70, 60, 60, 100, 45 };
                sfield         = new string[] { "b.wbm", "b.pym", "szm", "ywm", "ypbm" };
                string strWhere = "";

                ssql = "select distinct top 80  a.ggid,a.cjid,0 rowno,s_yppm,s_ypgg,s_sccj,s_ypdw, d.mc zlxmc, 1 dwbl,(case when scjj=0 or scjj is null then '' else cast(scjj as varchar(50)) end) scjj,pfj,lsj,shh,(case when GJJBYW=1 then '是' else '' end) 基药 from vi_yp_ypcd a inner join yp_ypbm b " +
                       " on a.ggid=b.ggid left join " + tablename + " c on a.cjid=c.cjid and c.deptid=" + deptid + " inner join yp_ypzlx d on a.ypzlx=d.id  where cjbdelete=0" + strWhere + "  and a.n_ypzlx in(select ypzlx from yp_gllx where deptid=" + deptid + ") ";
                f          = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), ssql);
                f.Location = point;
                f.Text     = "药品输入";
                f.Width    = 750;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    control.Tag = row["cjid"].ToString();
                }
            }
            #endregion
        }
Пример #9
0
        private void textBox1_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                int     nkey    = Convert.ToInt32(e.KeyCode);
                Control control = (Control)sender;

                // Add By Mr.Chan 2017-09-12
                if (e.KeyCode == Keys.Back)
                {
                    if (string.IsNullOrEmpty(textBox1.Text.Trim()))
                    {
                        button1.Focus();
                        button1.PerformClick();
                    }
                }

                if (control.Text.Trim() == "")
                {
                    control.Text = "";
                    control.Tag  = "0";
                    return;
                }
                if ((nkey >= 65 && nkey <= 90) || (nkey >= 48 && nkey <= 57) || (nkey >= 96 && nkey <= 105) || nkey == 8 || nkey == 32 || nkey == 46 || (nkey == 13 && (Convert.ToString(control.Tag) == "0" || Convert.ToString(control.Tag) == "")))
                {
                }
                else
                {
                    return;
                }
                Point point = new Point(this.Location.X + control.Location.X, this.Location.Y + control.Location.Y + control.Height * 3);


                string[] GrdMappingName = new string[] { "科室", "拼音码", "五笔码", "DEPT_ID", "MZ_FLAG", "ZY_FLAG" };
                int[]    GrdWidth       = new int[] { 140, 60, 60, 0, 0, 0 };
                string[] sfield         = new string[] { "", "PY_CODE", "WB_CODE", "", "" };

                string sqlString = string.Format(@"SELECT DISTINCT a.PBKS as NAME, PY_CODE, WB_CODE, a.PBKSID as DEPT_ID, MZ_FLAG,ZY_FLAG
                                                FROM dbo.jc_mz_yspb a 
	                                                INNER JOIN dbo.JC_DEPT_PROPERTY b ON a.PBKSID = b.DEPT_ID
	                                                LEFT JOIN dbo.jc_mz_ksdzwh_b c ON a.PBKSID = c.dept_id
                                                WHERE b.ISZJMZ = 0 and (YQID=0 or YQID='" + comboBox1.SelectedValue + "')");
                //sqlString += @"ORDER BY a.PBKSID ASC ";
                Fshowcard f = new Fshowcard(GrdMappingName, GrdWidth, sfield, FilterType.拼音, control.Text.Trim(), sqlString);
                f.Location = point;
                f.Text     = "科室";
                f.Width    = 500;
                f.ShowDialog();
                DataRow row = f.dataRow;
                if (row != null)
                {
                    (sender as Control).Tag  = row["DEPT_ID"].ToString();
                    (sender as Control).Text = row["NAME"].ToString();
                    this.SelectNextControl((Control)sender, true, false, true, true);
                    // Add By Mr.Chan 2017-09-12
                    button1.Focus();
                    button1.PerformClick();
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show("发生错误" + err.Message);
            }
        }