Esempio n. 1
0
        private void 修改组名ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string fzmc = this.treeView1.SelectedNode.Text.Trim();
                string id   = this.treeView1.SelectedNode.Tag.ToString();

                DlgInputBox Inputbox = new DlgInputBox("", "请输入[" + fzmc + "] 修改后的名称", "修改");
                Inputbox.ShowDialog();
                if (!DlgInputBox.DlgResult)
                {
                    return;
                }
                fzmc = DlgInputBox.DlgValue.Trim();

                string ssql = "update JC_JYBBFL set flmc='" + fzmc + "' where id=" + id + "";
                InstanceForm.BDatabase.DoCommand(ssql);


                MessageBox.Show("修改成功");

                lblfzmc.Text = fzmc;

                treeView1.SelectedNode.Text = fzmc;
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void 新增分组ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                DlgInputBox Inputbox = new DlgInputBox("", "请输入分组名称", "新增");
                Inputbox.ShowDialog();
                if (!DlgInputBox.DlgResult)
                {
                    return;
                }
                string fzmc = DlgInputBox.DlgValue.Trim();
                string ssql = "insert into JC_JYBBFL(flmc)values('" + fzmc + "')";
                InstanceForm.BDatabase.DoCommand(ssql);

                string id = InstanceForm.BDatabase.GetDataResult("select @@IDENTITY ").ToString();
                MessageBox.Show("新增成功");

                TreeNode Cnode = treeView1.Nodes[0].Nodes.Add(fzmc);
                Cnode.Tag = "" + id + "";

                Cnode.ImageIndex = 1;

                lblfzmc.Text = fzmc;
                lblfzmc.Tag  = id;
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode == null)
            {
                MessageBox.Show("请选择分类节点再添加模板!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string _mbmc = "";
            string _pym  = "";
            string _wbm  = "";
            string _bz   = "";
            string _djsj = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();
            string _fid  = "";

            if (treeView1.SelectedNode.ToolTipText == "1" || treeView1.SelectedNode.Tag.ToString() == Guid.Empty.ToString())
            {
                _fid = treeView1.SelectedNode.Tag.ToString();
            }
            else
            {
                _fid = Guid.Empty.ToString();
            }
            Guid _NewMbid = Guid.Empty;//新建模板Guid
            //返回变量
            int    _err_code = -1;
            string _err_text = "";

            Guid        _Mbid    = new Guid(Guid.Empty.ToString());//模板ID
            DlgInputBox Inputbox = new DlgInputBox("", "请输入中药煎法模板名称                    模板将添加在<" + treeView1.SelectedNode.Text + ">节点下!", "保存模板");

            Inputbox.NumCtrl = false;
            Inputbox.ShowDialog();
            if (!DlgInputBox.DlgResult)
            {
                return;
            }
            _mbmc = DlgInputBox.DlgValue.ToString();
            if (_mbmc == "")
            {
                return;
            }
            _pym = TrasenClasses.GeneralClasses.PubStaticFun.GetPYWBM(_mbmc, 0);
            _wbm = TrasenClasses.GeneralClasses.PubStaticFun.GetPYWBM(_mbmc, 1);
            ts_mz_class.jc_mb.SaveZyCfMb(_Mbid, TrasenFrame.Forms.FrmMdiMain.Jgbm,
                                         _mbmc, _pym, _wbm, _bz, 0, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, _djsj, InstanceForm.BCurrentUser.EmployeeId,
                                         _fid, 0, ref _NewMbid, ref _err_code, ref _err_text, InstanceForm.BDatabase);
            if (_err_code != 0)
            {
                throw new Exception(_err_text);
            }
            MessageBox.Show(_err_text, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Bind();
        }
Esempio n. 4
0
        private void 修改煎分类ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode == null)
            {
                return;
            }
            if (treeView1.SelectedNode.Text == "全部分类")
            {
                return;
            }
            if (treeView1.SelectedNode.ToolTipText == "0")
            {
                MessageBox.Show("该节点是模板节点,不能够修改分类!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string _mbmc    = "";
            string _pym     = "";
            string _wbm     = "";
            string _bz      = "中药处方分类";
            string _djsj    = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();
            string _fid     = treeView1.SelectedNode.Parent.Tag.ToString();
            Guid   _NewMbid = Guid.Empty;//新建模板Guid
            //返回变量
            int    _err_code = -1;
            string _err_text = "";

            Guid        _Mbid    = new Guid(Convertor.IsNull(treeView1.SelectedNode.Tag.ToString(), Guid.Empty.ToString()));//模板ID
            DlgInputBox Inputbox = new DlgInputBox(treeView1.SelectedNode.Text, "请输入需要修改的中药分类名称              分类将保存在<" + treeView1.SelectedNode.Text + ">节点下!", "保存模板");

            Inputbox.NumCtrl = false;
            Inputbox.ShowDialog();
            if (!DlgInputBox.DlgResult)
            {
                return;
            }
            _mbmc = DlgInputBox.DlgValue.ToString();
            if (_mbmc == "")
            {
                return;
            }
            _pym = TrasenClasses.GeneralClasses.PubStaticFun.GetPYWBM(_mbmc, 0);
            _wbm = TrasenClasses.GeneralClasses.PubStaticFun.GetPYWBM(_mbmc, 1);
            ts_mz_class.jc_mb.SaveZyCfMb(_Mbid, TrasenFrame.Forms.FrmMdiMain.Jgbm,
                                         _mbmc, _pym, _wbm, _bz, 0, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, _djsj, InstanceForm.BCurrentUser.EmployeeId,
                                         _fid, 1, ref _NewMbid, ref _err_code, ref _err_text, InstanceForm.BDatabase);
            if (_err_code != 0)
            {
                throw new Exception(_err_text);
            }
            MessageBox.Show(_err_text, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Bind();
        }
Esempio n. 5
0
        private void 修改模板名称ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode == null)
            {
                return;
            }
            string      _mbmc    = "";
            DlgInputBox Inputbox = new DlgInputBox(treeView1.SelectedNode.Text, "请输入需要修改的模板名称", "保存模板");

            Inputbox.NumCtrl = false;
            Inputbox.ShowDialog();
            if (!DlgInputBox.DlgResult)
            {
                return;
            }
            _mbmc = DlgInputBox.DlgValue.ToString();
            if (_mbmc == "")
            {
                return;
            }
            ts_mz_class.jc_mb.UpdateZyCfMbMc(treeView1.SelectedNode.Tag.ToString(), _mbmc, InstanceForm.BDatabase);
            MessageBox.Show("修改模板成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Bind();
        }
Esempio n. 6
0
        private void btRefuse_Click(object sender, EventArgs e)
        {
            if (!(_functionName == "Fun_ts_zy_czgl_sh" || _functionName == "Fun_ts_zy_czgl_sh_all"))
            {
                //7079冲正额度管理是否需要审核后才能确认 0=不是 1=是
                if (new SystemCfg(7079).Config == "1")
                {
                    MessageBox.Show("拒绝申请需要审核模块操作,当前模块不能使用该功能!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            try
            {
                DataTable tb   = (DataTable)dgvData.DataSource;
                DataRow[] rows = tb.Select("选择=1");
                if (rows.Length == 0)
                {
                    MessageBox.Show("请选择申请记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                DataTable newtb = tb.Clone();
                for (int i = 0; i <= rows.Length - 1; i++)
                {
                    newtb.ImportRow(rows[i]);
                }

                if (MessageBox.Show("是否要拒绝这些申请记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }

                DlgInputBox Inputbox = new DlgInputBox("", "请输入拒绝申请的原因", "");
                Inputbox.ShowDialog();
                string _yy = Convertor.IsNull(DlgInputBox.DlgValue, "无");

                try
                {
                    InstanceForm.BDatabase.BeginTransaction();
                    System.Collections.ArrayList arrList = new System.Collections.ArrayList();
                    for (int i = 0; i <= newtb.Rows.Count - 1; i++)
                    {
                        Guid feeid = new Guid(newtb.Rows[i]["feeid"].ToString());
                        //InstanceForm.BDatabase.DoCommand("delete from zy_czsh where feeid='" + feeid + "'");
                        //InstanceForm.BDatabase.DoCommand("insert into zy_czsh(FEEID, SHBZ, SHR, SHRQ, BZ) values('" + feeid + "',0," + InstanceForm.BCurrentUser.EmployeeId + ",getdate(),'" + _yy + "')");
                        //InstanceForm.BDatabase.DoCommand("update zy_fee_speci set delete_bit=1,bz='申请被拒绝:" + _yy + "' where id='" + feeid + "' and charge_bit=0 and delete_bit=0");

                        //Modify By Kevin 2013-09-23 改成调用数据库操作类中的SQL执行方法
                        arrList.Clear();
                        arrList.Add(feeid);
                        arrList.Add(InstanceForm.BCurrentUser.EmployeeId);
                        arrList.Add(_yy);

                        //TszyHIS.DataBaseAccess.ZyRefuseAudit(feeid, InstanceForm.BCurrentUser.EmployeeId, _yy, dataBase);
                        Ts_Zygl_Classes.ComManageDataBaseAccessClass.ZyRefuseAudit(arrList, InstanceForm.BDatabase, false);
                    }

                    InstanceForm.BDatabase.CommitTransaction();
                }
                catch (Exception err)
                {
                    InstanceForm.BDatabase.RollbackTransaction();
                    throw err;
                }

                btRefresh_Click(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 7
0
        private void btAffirm_Click(object sender, EventArgs e)
        {
            DataTable tb = (DataTable)dgvData.DataSource;

            DataRow[] rows = tb.Select("选择=1");
            if (rows.Length == 0)
            {
                MessageBox.Show("请选择申请记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            DataTable newtb = tb.Clone();

            for (int i = 0; i <= rows.Length - 1; i++)
            {
                newtb.ImportRow(rows[i]);
            }

            if (_functionName == "Fun_ts_zy_czgl_sh" || _functionName == "Fun_ts_zy_czgl_sh_all")
            {
                //审核
                try
                {
                    if (MessageBox.Show("是否要审核通过这些申请记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                    {
                        return;
                    }

                    DlgInputBox Inputbox = new DlgInputBox("", "请输入审核通过申请的原因", "");
                    Inputbox.ShowDialog();
                    string _yy = Convertor.IsNull(DlgInputBox.DlgValue, "无");

                    try
                    {
                        InstanceForm.BDatabase.BeginTransaction();
                        System.Collections.ArrayList arrList = new System.Collections.ArrayList();
                        for (int i = 0; i <= newtb.Rows.Count - 1; i++)
                        {
                            Guid feeid = new Guid(newtb.Rows[i]["feeid"].ToString());
                            //InstanceForm.BDatabase.DoCommand("delete from zy_czsh where feeid='" + feeid + "'");
                            //InstanceForm.BDatabase.DoCommand("insert into zy_czsh(FEEID, SHBZ, SHR, SHRQ, BZ) values('" + feeid + "',1," + InstanceForm.BCurrentUser.EmployeeId + ",getdate(),'" + _yy + "')");

                            //Modify By Kevin 2013-09-23 改成调用数据库操作类中的SQL执行方法
                            arrList.Clear();
                            arrList.Add(feeid);
                            arrList.Add(InstanceForm.BCurrentUser.EmployeeId);
                            arrList.Add(_yy);
                            //TszyHIS.DataBaseAccess.ZyHedgeAudit(feeid, InstanceForm.BCurrentUser.EmployeeId, _yy, dataBase);
                            Ts_Zygl_Classes.ComManageDataBaseAccessClass.ZyHedgeAudit(arrList, InstanceForm.BDatabase, false);
                        }

                        InstanceForm.BDatabase.CommitTransaction();
                    }
                    catch (Exception err)
                    {
                        InstanceForm.BDatabase.RollbackTransaction();
                        throw err;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                //确认
                try
                {
                    bool   isSH = true;
                    string sql  = "";
                    string tj   = "";
                    //7079冲正额度管理是否需要审核后才能确认 0=不是 1=是
                    if (new SystemCfg(7079).Config == "0")
                    {
                        isSH = false;
                    }

                    if (MessageBox.Show("是否要确认这些申请记录?" + (isSH ? "\n\n注意:审核状态为 X 的项目将自动被忽略,不能被确认!" : ""), "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                    {
                        return;
                    }

                    System.Collections.ArrayList arrList = new System.Collections.ArrayList();

                    for (int i = 0; i <= newtb.Rows.Count - 1; i++)
                    {
                        Guid feeid = new Guid(newtb.Rows[i]["feeid"].ToString());
                        //if (isSH)
                        //{
                        //    tj = " inner join zy_czsh b on a.id=b.feeid and b.shbz=1 ";
                        //}
                        //else
                        //{
                        //    tj = "";
                        //}
                        //sql = "update a set a.charge_bit=1,a.charge_date=getdate(),a.charge_user="******" from zy_fee_speci a " + tj + " where a.id='" + feeid + "' and a.charge_bit=0 and a.delete_bit=0";
                        //InstanceForm.BDatabase.DoCommand(sql);

                        //Modify By Kevin 2013-09-23 改成调用数据库操作类中的SQL执行方法
                        arrList.Clear();
                        arrList.Add(feeid);
                        arrList.Add(InstanceForm.BCurrentUser.EmployeeId);
                        arrList.Add(isSH);

                        //TszyHIS.DataBaseAccess.ZyConfirmAudit(feeid, InstanceForm.BCurrentUser.EmployeeId, isSH, dataBase);
                        Ts_Zygl_Classes.ComManageDataBaseAccessClass.ZyConfirmAudit(arrList, InstanceForm.BDatabase);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            btRefresh_Click(null, null);
        }
Esempio n. 8
0
        private void mnudqhm_Click(object sender, EventArgs e)
        {
            DataTable tb = (DataTable)dataGridView1.DataSource;

            //Add By Zj 2012-02-27
            if (tb.Rows.Count == 0)
            {
                return;
            }
            int nrow = dataGridView1.CurrentCell.RowIndex;

            string yfphm  = tb.Rows[nrow]["当前在用号码"].ToString();
            Guid   fplyid = new Guid(tb.Rows[nrow]["领用id"].ToString());
            //Modify By zp 2014-02-11 通过参数控制是否需要记录调号原因 平台号:5632
            string dqfph = "";
            string bz    = "";

            if (_cfg1108.Config.Trim() == "0")
            {
                DlgInputBox dlgInputBox = new DlgInputBox(yfphm, "请确认开始使用的号码", "修改当前号码");
                dlgInputBox.ShowDialog();
                if (DlgInputBox.DlgResult == false)
                {
                    return;
                }
                if (DlgInputBox.DlgResult && DlgInputBox.DlgValue == "")
                {
                    MessageBox.Show("请输入正确的号码", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                //if (DlgInputBox.DlgResult == false) return;
                dqfph = Convertor.IsNull(DlgInputBox.DlgValue, "0");
                dqfph = ToDBC(dqfph);
            }
            else
            {
                Frm_XgFpd frm = new Frm_XgFpd(yfphm);
                frm.ShowDialog();
                if (frm.DlgResult == false)
                {
                    return;
                }
                if (frm.DlgResult && frm.DlgValue == "")
                {
                    MessageBox.Show("请输入正确的号码", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (string.IsNullOrEmpty(frm.bz))
                {
                    MessageBox.Show("请输入调号原因", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                dqfph = Convertor.IsNull(frm.DlgValue, "0");
                dqfph = ToDBC(dqfph);
                bz    = frm.bz;
            }
            //string ssql = "select * from mz_fplyb where '" + dqfph + "' >=qshm and '" + dqfph + "' <=jshm and fplyid=" + fplyid + " and bscbz=0 ";
            //Modify By Tany 2008-12-20 重新启用发票号的时候判断当前发票号
            string    ssql = "select * from mz_fplyb where '" + dqfph + "' >=case when dqhm is null or dqhm='' then qshm else dqhm end and '" + dqfph + "' <=jshm and fplyid='" + fplyid + "' and bscbz=0 ";
            DataTable tab  = InstanceForm.BDatabase.GetDataTable(ssql);

            if (tab.Rows.Count == 0)
            {
                MessageBox.Show("当前发票号要求在领用段内并且不能小于当前发票号", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //string ss = Fun.returnFph(dqfph);
            if (yfphm.Length != dqfph.Trim().Length)
            {
                MessageBox.Show("发票号要求长度为" + yfphm.Length.ToString() + "位", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (Convert.ToInt64(yfphm) > Convert.ToInt64(dqfph) && _menuTag.Function_Name.Trim() == "Fun_ts_mz_xtsz_fpgl_grsz")
            {
                MessageBox.Show("您只能向后调整发票号,请确认", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //begin add by wangzhi 增加调号提示
            int     thfps      = Convert.ToInt32(Convert.ToInt64(dqfph) - Convert.ToInt64(yfphm));
            long    last_thfph = Convert.ToInt64(dqfph) - 1;//调号发票段内最后一张发票号码
            DataRow drFpxx     = InstanceForm.BDatabase.GetDataRow("select * from mz_fplyb where fplyid='" + fplyid.ToString() + "'");

            if (drFpxx == null)
            {
                throw new Exception("没有找到发票领用记录,请刷新后重试或者联系系统管理员");
            }
            int      _fplx = Convert.ToInt32(drFpxx["fplx"]);
            int      _lyr  = Convert.ToInt32(drFpxx["lyr"]);
            int      _thr  = InstanceForm.BCurrentUser.EmployeeId;
            string   _fpqz = Convert.IsDBNull(drFpxx["fpqz"]) ? "" : drFpxx["fpqz"].ToString().Trim();
            DateTime _thsj = TrasenClasses.GeneralClasses.DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase);

            if (_menuTag.Function_Name.Trim() == "Fun_ts_mz_xtsz_fpgl_grsz")
            {
                if (dqfph.Trim() == yfphm.Trim())
                {
                    MessageBox.Show("要调整的号码与当前号码一致,不需要调整", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                string msg = "本次调号段为:" + yfphm + "~" + last_thfph.ToString() + ",共" + thfps.ToString() + "张,调整后将从" + dqfph + "开始使用,确定要调整号码吗?";
                if (MessageBox.Show(msg, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }
            //end add

            try
            {
                InstanceForm.BDatabase.BeginTransaction();
                //更新发票领用表
                ssql = "update mz_fplyb set dqhm='" + dqfph + "' where fplyid='" + fplyid + "' and lyr=" + InstanceForm.BCurrentUser.EmployeeId + " and bzybz=1 and bscbz=0";
                int xx = InstanceForm.BDatabase.DoCommand(ssql);
                if (xx != 1)
                {
                    //begin modify wangzhi 2010-09-25
                    throw new Exception("没有成功,更新到" + xx.ToString() + "行,请确认");
                    //MessageBox.Show("没有成功,更新到"+xx.ToString()+"行,请确认", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //return;
                    //end modify
                }

                //begin add by wangzhi 增加调号记录
                ssql  = "insert into mz_fpthb(fplyid,fplx,fpqz,ksh,jsh,zs,lyr,thr,tzsj,qxbz,jkid,bz)";
                ssql += " values ('" + fplyid.ToString() + "'," + _fplx + ",'" + _fpqz + "'," + yfphm + "," + last_thfph + "," + thfps + "," + _lyr + "," + _thr + ",'" + _thsj.ToString("yyyy-MM-dd HH:mm:ss") + "',0,null,'" + bz + "')";
                InstanceForm.BDatabase.DoCommand(ssql);

                InstanceForm.BDatabase.CommitTransaction();
                //end add

                MessageBox.Show("修改成功");
                cmbsyzt_SelectedIndexChanged(sender, e);
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();

                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Esempio n. 9
0
        private void mnuqy_Click(object sender, EventArgs e)
        {
            DataTable tb   = (DataTable)dataGridView1.DataSource;
            int       nrow = dataGridView1.CurrentCell.RowIndex;


            if (new SystemCfg(1071).Config == "1")//Add By Zj 2013-01-19 控制操作员如果未使用完当前在用发票 不允许启用另外的发票段
            {
                string    sql   = "select * from MZ_FPLYB where BZYBZ=1 and BWCBZ=0 and bscbz=0 and lyr=" + InstanceForm.BCurrentUser.EmployeeId.ToString();
                DataTable sqltb = InstanceForm.BDatabase.GetDataTable(sql);
                if (sqltb.Rows.Count > 0)
                {
                    MessageBox.Show("在用发票还未使用完,不能启用另一段发票。", "提示");
                    return;
                }
            }

            if (MessageBox.Show(this, "您确定要启用" + tb.Rows[nrow]["起始号码"].ToString() + "到" + tb.Rows[nrow]["结束号码"].ToString() + " 这段发票吗", "确认", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            string kshm   = tb.Rows[nrow]["当前在用号码"].ToString().Trim() == "" ? tb.Rows[nrow]["起始号码"].ToString().Trim() : tb.Rows[nrow]["当前在用号码"].ToString().Trim();
            Guid   fplyid = new Guid(tb.Rows[nrow]["领用id"].ToString());
            int    fplx   = Convert.ToInt32(tb.Rows[nrow]["fplx"]);

            DlgInputBox dlgInputBox = new DlgInputBox(kshm, "请确认开始使用的号码", "输入启用有效号码");

            dlgInputBox.ShowDialog();
            if (DlgInputBox.DlgResult && DlgInputBox.DlgValue == "")
            {
                MessageBox.Show("请输入正确的号码", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (DlgInputBox.DlgResult == false)
            {
                return;
            }

            string    dqfph = Convertor.IsNull(DlgInputBox.DlgValue, "0");
            string    ssql  = "select * from mz_fplyb where '" + dqfph + "' >=case when dqhm is null or dqhm='' then qshm else dqhm end and '" + dqfph + "' <=jshm and fplyid='" + fplyid + "' and bscbz=0 ";
            DataTable tab   = InstanceForm.BDatabase.GetDataTable(ssql);

            if (tab.Rows.Count == 0)
            {
                MessageBox.Show("当前发票号要求在领用段内并且不能小于当前发票号", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //string ssql = "select * from mz_fplyb where fplyid='" + fplyid + "' and bscbz=0 ";
            //DataRow row = InstanceForm.BDatabase.GetDataRow( ssql );
            //if ( Convert.ToInt64( dqfph ) < Convert.ToInt64( Convertor.IsNull( row["qshm"] , "0" ) )
            //   || Convert.ToInt64( dqfph ) > Convert.ToInt64( Convertor.IsNull( row["jshm"] , "0" ) ) )
            //{
            //    MessageBox.Show( "当前发票号要求在领用段内并且不能小于当前发票号" , "错误" , MessageBoxButtons.OK , MessageBoxIcon.Error );
            //    return;
            //}

            string ss = Fun.returnFph(dqfph, InstanceForm.BDatabase);

            if (kshm.Length != dqfph.Trim().Length)
            {
                MessageBox.Show("发票号要求长度为" + kshm.Length.ToString() + "位", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                InstanceForm.BDatabase.BeginTransaction();
                //ssql = "update mz_fplyb set bzybz=0,dqhm='' where bwcbz=0 and lyr=" + InstanceForm.BCurrentUser.EmployeeId + " and bscbz=0";
                //Modify By Tany 2008-12-20 当前号码不能随便清空,并且只更改同种发票类型
                ssql = "update mz_fplyb set bzybz=0 where bwcbz=0 and lyr=" + InstanceForm.BCurrentUser.EmployeeId + " and bscbz=0 and fplx=" + fplx;
                int x = InstanceForm.BDatabase.DoCommand(ssql);

                ssql = "update mz_fplyb set bzybz=1,dqhm='" + dqfph + "' where fplyid='" + fplyid + "' and lyr=" + InstanceForm.BCurrentUser.EmployeeId + " and bscbz=0 and fplx=" + fplx;
                int xx = InstanceForm.BDatabase.DoCommand(ssql);
                if (xx != 1)
                {
                    MessageBox.Show("没有成功,更新到" + xx.ToString() + "行,请确认启用人为操作员本人!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                InstanceForm.BDatabase.CommitTransaction();
                MessageBox.Show("启用成功");
                cmbsyzt_SelectedIndexChanged(sender, e);
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                MessageBox.Show("当前发票号要求在领用段内", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Esempio n. 10
0
        private void mnucwmb_Click(object sender, EventArgs e)
        {
            DataTable tb = (DataTable)dataGridView1.DataSource;

            try
            {
                if (dataGridView1.CurrentCell == null)
                {
                    return;
                }
                int nrow = dataGridView1.CurrentCell.RowIndex;
                if (tb.Rows.Count == 0)
                {
                    return;
                }
                Guid _hjID = new Guid(Convertor.IsNull(tb.Rows[nrow]["hjid"], Guid.Empty.ToString()));

                //分组处方
                string[] GroupbyField1           = { "HJID", "执行科室ID" };
                string[] ComputeField1           = { "金额" };
                string[] CField1                 = { "sum" };
                TrasenFrame.Classes.TsSet xcset1 = new TrasenFrame.Classes.TsSet();
                xcset1.TsDataTable = tb;
                DataTable tbcf1 = xcset1.GroupTable(GroupbyField1, ComputeField1, CField1, "hjid='" + _hjID + "' and 项目id>0");
                if (tbcf1.Rows.Count == 0)
                {
                    return;
                }

                string[] GroupbyField           = { "HJID", "执行科室ID", "项目来源", "剂数" };
                string[] ComputeField           = { "金额" };
                string[] CField                 = { "sum" };
                TrasenFrame.Classes.TsSet xcset = new TrasenFrame.Classes.TsSet();
                xcset.TsDataTable = tb;
                DataTable tbcf = xcset.GroupTable(GroupbyField, ComputeField, CField, "hjid='" + _hjID + "' and 项目id>0");
                if (tbcf.Rows.Count == 0)
                {
                    return;
                }

                if (tbcf1.Rows.Count != tbcf.Rows.Count)
                {
                    MessageBox.Show("请检查处方的数据是否正确,可能存在同一张处方有不同的执行科室或不同的医生或不同的开单科室的情况", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                //返回变量
                int    _err_code = -1;
                string _err_text = "";
                //时间
                string _sDate = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();

                Guid   _Mbid    = Guid.Empty;
                string _mbmc    = "";
                string _pym     = "";
                string _wbm     = "";
                string _bz      = "";
                int    _mbjb    = 2;
                int    _ksdm    = 0;
                int    _ysdm    = TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId;
                int    _zxks    = Convert.ToInt32(Convertor.IsNull(tbcf.Rows[0]["执行科室ID"], "0"));
                string _djsj    = _sDate;
                int    _djy     = TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId;
                string fid      = "";
                Guid   _NewMbid = Guid.Empty;
                int    _xmly    = Convert.ToInt32(tbcf.Rows[0]["项目来源"]);
                int    _js      = Convert.ToInt32(tbcf.Rows[0]["剂数"]);


                DlgInputBox Inputbox = new DlgInputBox("", "请输入模板名称", "保存模板");
                Inputbox.NumCtrl = false;
                Inputbox.ShowDialog();
                if (!DlgInputBox.DlgResult)
                {
                    return;
                }
                //Add By Zj 2012-03-15
                frmmbwh frmmbwh = new frmmbwh(_menuTag, _mbjb);
                frmmbwh.Text              = "选择模板所属分类.";
                frmmbwh.panel1.Visible    = false;
                frmmbwh.btnselect.Visible = true;
                frmmbwh.ShowDialog();
                if (frmmbwh.fid == "")
                {
                    return;
                }
                else
                {
                    fid = frmmbwh.fid;
                }
                _mbmc = DlgInputBox.DlgValue.ToString();
                if (_mbmc.Trim() == "")
                {
                    return;
                }


                InstanceForm.BDatabase.BeginTransaction();

                //查找当前处方
                DataRow[] rows = tb.Select("HJID='" + _hjID + "' and 执行科室ID=" + _zxks + "  and 项目id>0 ");

                jc_mb.SaveMb(_Mbid, TrasenFrame.Forms.FrmMdiMain.Jgbm, _mbmc, _pym, _wbm, _bz, _mbjb, _ksdm, _ysdm, _zxks, _djsj, _djy, fid, out _NewMbid, out _err_code, out _err_text, InstanceForm.BDatabase);
                if ((_NewMbid == Guid.Empty && _Mbid == Guid.Empty) || _err_code != 0)
                {
                    throw new Exception(_err_text);
                }

                if (rows == null)
                {
                    throw new Exception("没有找到行,请刷新数据");
                }
                if (rows.Length == 0 && _Mbid != Guid.Empty)
                {
                    throw new Exception("没有需要保存的行");
                }
                //插处方明细表
                for (int j = 0; j <= rows.Length - 1; j++)
                {
                    #region 保存明细
                    Guid    _NewMbmxid = Guid.Empty;
                    Guid    _mbmxid    = Guid.Empty;
                    string  _pm        = Convertor.IsNull(rows[j]["医嘱内容"], "");
                    decimal _dj        = Convert.ToDecimal(Convertor.IsNull(rows[j]["单价"], "0"));
                    decimal _sl        = Convert.ToDecimal(Convertor.IsNull(rows[j]["数量"], "0"));
                    decimal _je        = Convert.ToDecimal(Convertor.IsNull(rows[j]["金额"], "0"));
                    long    _xmid      = Convert.ToInt64(Convertor.IsNull(rows[j]["yzid"], "0"));
                    int     _bzby      = Convert.ToInt32(Convertor.IsNull(rows[j]["自备药"], "0"));
                    decimal _yl        = Convert.ToDecimal(Convertor.IsNull(rows[j]["剂量"], "0"));
                    string  _yldw      = Convertor.IsNull(rows[j]["剂量单位"], "");
                    int     _yldwid    = Convert.ToInt32(Convertor.IsNull(rows[j]["剂量单位id"], "0"));
                    int     _dwlx      = Convert.ToInt32(Convertor.IsNull(rows[j]["dwlx"], "0"));
                    int     _yfid      = Convert.ToInt32(Convertor.IsNull(rows[j]["用法id"], "0"));
                    int     _pcid      = Convert.ToInt32(Convertor.IsNull(rows[j]["频次id"], "0"));
                    decimal _ts        = Convert.ToDecimal(Convertor.IsNull(rows[j]["天数"], "0"));
                    string  _zt        = Convert.ToString(Convertor.IsNull(rows[j]["嘱托"], ""));
                    int     _fzxh      = Convert.ToInt32(Convertor.IsNull(rows[j]["处方分组序号"], "0"));
                    int     _pxxh      = Convert.ToInt32(Convertor.IsNull(rows[j]["排序序号"], "0"));
                    int     _cjid      = 0;
                    if (_xmly == 1)
                    {
                        _cjid = Convert.ToInt32(Convertor.IsNull(rows[j]["项目ID"], "0"));
                        Ypcj cj = new Ypcj(_cjid, InstanceForm.BDatabase);
                        _xmid = cj.GGID;
                    }
                    if ((_sl == 0 || _js == 0 || _je == 0) && _bzby == 0)
                    {
                        throw new Exception(_pm + " 没有数量或金额");
                    }
                    jc_mb.SaveMbmx(_mbmxid, _NewMbid, _xmid, _xmly, _yl, _yldw, _yldwid, _dwlx, _yfid, _pcid, _zt,
                                   _ts, _fzxh, _pxxh, _bzby, _cjid, _js, out _NewMbmxid, out _err_code, out _err_text, _hjID, _zxks, InstanceForm.BDatabase);
                    if ((_NewMbmxid == Guid.Empty && _mbmxid == Guid.Empty) || _err_code != 0)
                    {
                        throw new Exception(_err_text);
                    }

                    #endregion 保存明细
                }
                InstanceForm.BDatabase.CommitTransaction();

                MessageBox.Show("保存成功");
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Esempio n. 11
0
        private void Dgv_Ysf_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (Dgv_Ysf.CurrentCell == null)
                {
                    return;
                }
                if (e.RowIndex <= -1)
                {
                    return;
                }
                if (Dgv_Ysf.Columns[Dgv_Ysf.CurrentCell.ColumnIndex].Name == "申请退费")
                {
                    /*如果项目的数量大于1 则show出窗体选择需退数量,否则直接向退费申请表插入记录*/
                    DataTable    dt       = (DataTable)Dgv_Ysf.DataSource;
                    int          rowindex = Dgv_Ysf.CurrentCell.RowIndex;
                    int          xmly     = Convert.ToInt32(dt.Rows[rowindex]["项目来源"]);
                    MZ_TF_Record tf_apply = new MZ_TF_Record();
                    tf_apply.TFSQID = Guid.Empty;
                    tf_apply.CFID   = new Guid(dt.Rows[rowindex]["CFID"].ToString());
                    tf_apply.CFMXID = new Guid(Convertor.IsNull(dt.Rows[rowindex]["cfmxid"].ToString(), Guid.Empty.ToString()));
                    tf_apply.XMMC   = Convertor.IsNull(dt.Rows[rowindex]["项目名称"], "");
                    tf_apply.XMID   = Convert.ToInt32(dt.Rows[rowindex]["项目编号"]);
                    tf_apply.TCID   = Convert.ToInt32(Convertor.IsNull(dt.Rows[rowindex]["套餐编号"], "0"));
                    tf_apply.XMGG   = Convertor.IsNull(dt.Rows[rowindex]["规格"], "");
                    tf_apply.XMDW   = Convertor.IsNull(dt.Rows[rowindex]["单位"], "");
                    tf_apply.YDJ    = Convert.ToDecimal(dt.Rows[rowindex]["单价"]);
                    tf_apply.YSL    = Convert.ToDecimal(dt.Rows[rowindex]["数量"]);
                    tf_apply.YJE    = Convert.ToDecimal(dt.Rows[rowindex]["金额"]);
                    tf_apply.KDKS   = Convert.ToInt32(Convertor.IsNull(dt.Rows[rowindex]["科室编号"], "0"));
                    tf_apply.TFSQKS = InstanceForm.BCurrentDept.DeptId;
                    tf_apply.DJY    = InstanceForm.BCurrentUser.EmployeeId;
                    tf_apply.KH     = txtkh.Text.Trim();
                    tf_apply.GHXXID = ghxxid;
                    tf_apply.FPID   = new Guid(dt.Rows[rowindex]["FPID"].ToString());
                    tf_apply.YZID   = Convert.ToInt32(Convertor.IsNull(dt.Rows[rowindex]["yzid"], "0"));
                    string sffy = Convert.ToString(dt.Rows[rowindex]["是否发药"]);
                    if (Convert.ToString(dt.Rows[rowindex]["是否发药"]) == "1" || Convert.ToString(dt.Rows[rowindex]["是否确认"]) == "1")
                    {
                        tf_apply.SHBZ = 0;
                        tf_apply.SHY  = 0;
                        tf_apply.SHSJ = System.DateTime.Now.ToString();
                    }
                    else
                    {
                        tf_apply.SHBZ = 1;
                        tf_apply.SHY  = InstanceForm.BCurrentUser.EmployeeId;
                        tf_apply.SHSJ = System.DateTime.Now.ToString();
                    }
                    tf_apply.TSL = Convert.ToDecimal(dt.Rows[rowindex]["可退数量"]);

                    #region  MODIFY BY CC 可以部分退费
                    /*在进行退费申请前 需要验证当前费用是否已在退费申请表有了记录*/
                    if (!MZ_TF_Record.CheckIsYFy(tf_apply, dt.Rows[rowindex], InstanceForm.BDatabase))
                    {
                        MessageBox.Show("当前记录已经进行了申请退费,可在待退费记录中查询!", "提示");
                        return;
                    }

                    if (Convert.ToInt32(dt.Rows[rowindex]["可退数量"]) == 1)
                    {
                        tf_apply.TSL = Convert.ToDecimal(dt.Rows[rowindex]["可退数量"]);
                        /*在进行退费申请前 需要验证当前费用是否已在退费申请表有了记录*/
                        if (!MZ_TF_Record.CheckIsYFy(tf_apply, dt.Rows[rowindex], InstanceForm.BDatabase))
                        {
                            MessageBox.Show("当前记录已经进行了申请退费,可在待退费记录中查询!", "提示");
                            return;
                        }
                    }
                    else
                    {
                        /*弹出选择框 进行输入数量*/
                        decimal     _ysl    = Convert.ToDecimal(dt.Rows[rowindex]["可退数量"]);
                        DlgInputBox Dlg_Add = new DlgInputBox("0", "退费数量", "退费数量");
                        Dlg_Add.ShowDialog();
                        // if(Dlg_Add.DialogResult!= DialogResult.OK)return;
                        decimal tfs = 0;

                        if (!decimal.TryParse(DlgInputBox.DlgValue, out tfs))
                        {
                            MessageBox.Show("退费数必须为数值类型!", "提示");
                            return;
                        }
                        if (tfs != _ysl && xmly != 1)//如果退费数不等于原数量同时不为药品 则必须退费数为整数
                        {
                            int _value = 0;
                            if (!int.TryParse(DlgInputBox.DlgValue, out _value))
                            {
                                MessageBox.Show("退费数必须为整数类型!", "提示");
                                return;
                            }
                        }
                        if (tfs < 0)// Add by zp 2013-12-27
                        {
                            MessageBox.Show("退费数必须大于0!", "提示");
                            return;
                        }
                        if (tfs == 0)
                        {
                            //MessageBox.Show("退费数不能为0!", "提示");
                            return;
                        }
                        if (tfs > _ysl)
                        {
                            MessageBox.Show("退费数不能大于收费原数量!", "提示");
                            return;
                        }
                        tf_apply.TSL = tfs;
                    }
                    #endregion

                    try
                    {
                        bool isQr = false;

                        //if (dt.Rows[rowindex]["执行科室编号"].ToString() == InstanceForm.BCurrentDept.DeptId.ToString())
                        //{
                        //    isQr = true;
                        //}
                        // bool isQr = Fun.IsQr(new Guid(Convertor.IsNull(dt.Rows[rowindex]["cfmxid"].ToString(), Guid.Empty.ToString())),Convert.ToInt32(Convertor.IsNull(dt.Rows[rowindex]["套餐编号"], "0")), InstanceForm.BDatabase);
                        MZ_TF_Record.Save(ref tf_apply, isQr, InstanceForm.BDatabase);

                        #region 注释代码 MODIFY BY CC
                        if (xmly == 1 && sffy == "1") //如果是退药 则需要向yf_fymx插入记录
                        {
                            long      fph      = Convert.ToInt64(Convertor.IsNull(dt.Rows[rowindex]["发票号"], "0"));
                            string    bm       = Convertor.IsNull(dt.Rows[rowindex]["编码"], "");
                            string    pm       = Convertor.IsNull(dt.Rows[rowindex]["项目名称"], "");
                            string    spm      = Convertor.IsNull(dt.Rows[rowindex]["商品名"], "");
                            string    cj       = Convertor.IsNull(dt.Rows[rowindex]["厂家"], "");
                            decimal   ydwbl    = Convert.ToDecimal(Convertor.IsNull(dt.Rows[rowindex]["YDWBL"], "1"));
                            decimal   tyl      = tf_apply.YSL * -1;
                            int       ts       = Convert.ToInt32(dt.Rows[rowindex]["天数"]);
                            decimal   pfj      = Convert.ToDecimal(Convertor.IsNull(dt.Rows[rowindex]["批发价"], "0"));
                            decimal   pfje     = Convert.ToDecimal(Convertor.IsNull(dt.Rows[rowindex]["批发金额"], "0"));
                            decimal   lsj      = Convert.ToDecimal(Convertor.IsNull(dt.Rows[rowindex]["单价"], "0"));
                            long      yfid     = Convert.ToInt32(dt.Rows[rowindex]["执行科室编号"]);
                            string    ps       = Convertor.IsNull(dt.Rows[rowindex]["皮试"], "");
                            string    yf       = Convertor.IsNull(dt.Rows[rowindex]["用法"], "");
                            DataTable dt_fyxx  = MZ_TF_Record.GetFymxInfo(tf_apply.CFID, tf_apply.CFMXID, InstanceForm.BDatabase);
                            Guid      _fymxid  = Guid.Empty;
                            string    pc       = "";
                            Guid      NewFyid  = Guid.Empty;
                            int       err_code = 0;
                            string    err_text = "";
                            if (dt_fyxx.Rows.Count > 0)
                            {
                                pc = MZYF.SeekFymxPh(_fymxid, InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase);
                                YpClass.MZYF.SaveFymx(Guid.Empty, fph, tf_apply.CFID, tf_apply.XMID, bm, pm, spm,
                                                      tf_apply.XMGG, cj, tf_apply.XMDW, ydwbl, tyl,
                                                      ts,
                                                      pfj,
                                                      pfj * tyl * ts,
                                                      lsj,
                                                      Math.Round(lsj * tyl * ts, 2), 0, 0, yfid, Guid.Empty, "", Guid.Empty, tf_apply.CFMXID, ps, yf, "",
                                                      "",
                                                      "",
                                                      "",
                                                      "",
                                                      0,
                                                      0,
                                                      0, "sp_yf_fymx", out NewFyid, out err_code, out err_text, InstanceForm.BDatabase);
                            }
                        }
                        #endregion

                        KeyPressEventArgs ee = new KeyPressEventArgs((char)Keys.Enter);
                        object            o  = this.txtmzh;
                        txtkh_KeyPress(o, ee);
                    }
                    catch (Exception ea)
                    {
                        InstanceForm.BDatabase.RollbackTransaction();
                        throw ea;
                    }
                }
            }
            catch (Exception ea)
            {
                MessageBox.Show("出现异常!原因:" + ea.Message, "提示");
            }
        }