Пример #1
0
        private void butsave_Click(object sender, EventArgs e)
        {
            SystemCfg cfg1121 = new SystemCfg(1121);

            if (cfg1121.Config == "1")
            {
                int    out_code = 0;
                string out_text = "";
                Fun.Isjz(InstanceForm.BCurrentUser.EmployeeId, out out_code, out out_text, InstanceForm.BDatabase);
                if (out_code == -1)
                {
                    MessageBox.Show(out_text);
                    return;
                }
            }
            mz_card card;

            try
            {
                if (cfg1111.Config.Trim() == "1" && lblfph.Text.ToString().Trim() == "")
                {
                    MessageBox.Show("没有可用发票段,不能收费!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
                }
                if (Kdjid == Guid.Empty)
                {
                    MessageBox.Show("请输入卡信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
                }
                //提示存入金额
                card = new mz_card(Convert.ToInt32(cmbklx.SelectedValue), InstanceForm.BDatabase);
                if (txtkh.Text.Length != card.kcd)
                {
                    MessageBox.Show("卡位数必须符合系统设定长度", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                ReadCard readcard = new ReadCard(Convert.ToInt32(cmbklx.SelectedValue), txtkh.Text.Trim(), InstanceForm.BDatabase);
                if (readcard.kdjid != Kdjid)
                {
                    MessageBox.Show("效验卡信息时出错,请重新读卡", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (card.bjebz == false)
                {
                    MessageBox.Show("此卡不能存入金额,请参见卡类型设置", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (readcard.sdbz == 1)
                {
                    MessageBox.Show("病人卡已冻结,暂不能消费。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (readcard.sdbz == 2)
                {
                    MessageBox.Show("病人卡已挂失,暂不能消费。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }



            if (Convertor.IsNumeric(txtje.Text.Trim()) == false || txtje.Text.Trim() == "0")
            {
                MessageBox.Show("金额请输入正数的数字", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtje.SelectAll();
                txtje.Focus();
                return;
            }

            decimal Crje = Convert.ToDecimal(Convertor.IsNull(txtje.Text, "0"));

            string    ssql = "select * from YY_KDJB where kdjid='" + Kdjid + "'";
            DataTable tbk  = InstanceForm.BDatabase.GetDataTable(ssql);

            if (Convert.ToDecimal(tbk.Rows[0]["kye"]) + Crje < 0)
            {
                MessageBox.Show("存入此笔金额后,卡余额将为负数。请重新输入金额", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (Crje < 0)
            {
                if (MessageBox.Show("您确定要退款" + Crje.ToString() + "吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                //Add By Zj 2012-04-19 退款增加密码验证
                if (cfg1059.Config == "1")
                {
                    ts_mz_class.FrmPassWord fPassword = new FrmPassWord(InstanceForm._menuTag, "退款密码验证", this, InstanceForm.BDatabase);
                    fPassword.Kdjid = Kdjid;
                    if (fPassword.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                }
            }

            string djsj = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();

            Guid   _kjeid   = Guid.Empty;
            int    err_code = -1;
            string err_text = "";
            int    fkfs     = Convert.ToInt32(cmbfkfs.SelectedValue);

            if (fkfs == 2)
            {
                if (txtzph.Text.Trim() == "")
                {
                    MessageBox.Show("请输入支票号", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
                }
                if (txtdw.Text.Trim() == "")
                {
                    MessageBox.Show("请输入开户单位", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
                }
                if (cmbyh.Text.Trim() == "")
                {
                    MessageBox.Show("请输入开户银行", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
                }
            }


            try
            {
                InstanceForm.BDatabase.BeginTransaction();

                //登记交款
                mz_kdj.Kdj_je(Guid.Empty, Kdjid, Brxxid, fkfs, lblfph.Text, Crje, InstanceForm.BCurrentUser.EmployeeId, djsj, txtbz.Text.Trim(), txtzph.Text.Trim(), txtdw.Text.Trim(), cmbyh.Text.Trim(), out _kjeid, out err_code, out err_text, InstanceForm.BDatabase);
                if (_kjeid == Guid.Empty || err_code != 0)
                {
                    throw new Exception(err_text);
                }
                //到帐
                if (checkBox1.Checked == true)
                {
                    mz_kdj.Kdj_je_zpdz(_kjeid, Kdjid, Brxxid, fkfs, Crje, djsj, InstanceForm.BCurrentUser.EmployeeId, InstanceForm.BDatabase);
                }

                //更新预交金发票领用表的当前发票号码
                string Msg = "";
                if (cfg1111.Config.Trim() == "1")
                {
                    mz_sf.UpdateDqfph(new Guid(tbfp.Rows[0]["fpid"].ToString()), tbfp.Rows[0]["fph"].ToString().Trim(), tbfp.Rows[tbfp.Rows.Count - 1]["fph"].ToString().Trim(), out Msg, InstanceForm.BDatabase);
                }

                InstanceForm.BDatabase.CommitTransaction();

                Print(_kjeid);

                radioButton1.Checked = true;

                Fill(Kdjid);

                //提示发票段已经用完 --ADD jiangzf 2014-2-25
                if (Msg.Trim() != "")
                {
                    MessageBox.Show(Msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                txtzph.Text = "";
                txtdw.Text  = "";
                cmbyh.Text  = "";
                txtje.Text  = "";
                txtbz.Text  = "";
                txtkh.SelectAll();
                txtkh.Focus();
                MessageBox.Show("成功", "提示");
                this.txtkh.Text   = "";
                this.lblbrxm.Text = "";
                lblye.Text        = "";
                lblgzdw.Text      = "";
                lblsfzh.Text      = "";
                lblxb.Text        = "";
                lblnl.Text        = "";

                //重新获取预交金发票号
                if (cfg1111.Config.Trim() == "1")
                {
                    getYjjFph();
                }

                //txtkh_KeyPress(null,new KeyPressEventArgs('\r'));

                if (bqybjq == "true" && bjqxh == "上海通导语音报价器型号Ⅳ")
                {
                    ts_call.Icall call = ts_call.CallFactory.NewCall(bjqxh);
                    call.Call(ts_call.DmType.卡充值, Crje.ToString("0.00"));
                }
                else if (bqybjq == "true" && bjqxh == "上海通导语音报价器邵阳第一人民医院")
                {
                    //ADD BY TCK 2013-11-21
                    ts_call.Icall call = ts_call.CallFactory.NewCall(bjqxh);
                    call.Call(ts_call.DmType.卡充值, Crje.ToString("0.00"));
                }
                if (AfterRechargeSuccess != null)
                {
                    AfterRechargeSuccess();
                }
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void changepasswordMenuItem_Click(object sender, EventArgs e)
        {
            FrmPassWord frmword = new FrmPassWord();

            frmword.ShowDialog();
        }