private void btn_bztf_Click(object sender, EventArgs e) { #region 办证退费输入检查 if (str_tjbh_bz == "") { MessageBox.Show("请选择一条人员信息!", "提示"); return; } if (str_tjcs_bz == "") { MessageBox.Show("请选择一条人员信息!", "提示"); return; } if (txt_tfyy_bz.Text.Trim() == "") { MessageBox.Show("请输入办证退费原因!", "提示"); txt_tfyy_bz.Focus(); return; } if (sfjlbz_bz == "0") { MessageBox.Show("该记录没有收费,不需要退费!", "提示"); return; } #endregion DialogResult dlg = MessageBox.Show("确定要退费吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (dlg == DialogResult.No) { return; } #region 办证退费金额检查 //实际退金额 DataTable dttf = tjdjbiz.GetSsje(sfjlbz_bz, str_tjbh_bz, str_tjcs_bz); if (dttf.Rows.Count == 0) { return; } string stje = dttf.Rows[0]["ssje"].ToString(); string yhlx = dttf.Rows[0]["yhlx"].ToString(); string yhxx = dttf.Rows[0]["yhxx"].ToString(); #endregion #region 退费 //未收费时,退费功能不可用 if (Convert.ToInt16(sfjlbz_bz) > 0) { //退费单号 try { tjdjBiz tjdjbiz2 = new tjdjBiz(); string tfdh = xtbiz.GetHmz("tj_tfdh", 1); tjdjbiz2.TjTf(tfdh, Program.userid, Convert.ToDecimal(stje), txt_tfyy_bz.Text.Trim(), sfjlbz_bz); string sfh = xtbiz.GetHmz("tj_sjh", 1); tjdjbiz2.TjSf(sfh, str_tjbh_bz, str_tjcs_bz, Program.userid, -Convert.ToDecimal(stje), -Convert.ToDecimal(stje), Convert.ToInt16(yhlx), 0, sfjlbz_bz, txt_tfyy.Text.Trim()); tjdjbiz2.UpdateSfb(sfjlbz_bz, str_tjbh_bz, str_tjcs_bz, sfh); int i = tjdjbiz2.Exec_ArryList(); //if (i > 0) //{ MessageBox.Show("退费成功!金额" + stje.ToString() + "请收回原发票!", "提示"); #region 日志记录 loginbiz.WriteLog(this.Name.Trim(), "【" + Program.username + "】" + "在电脑【" + ma.HostName() + "】上退补证费成功,退费单号是:" + tfdh + ",IP:" + Program.hostip, Program.username); #endregion button1_Click(null, null); //} } catch (Exception ex) { #region 错误日志 loginbiz.WriteLogErr(this.Name.Trim(), "【" + Program.username + "】" + "在电脑【" + ma.HostName() + "】上退补证费出现异常,错误原因:" + ex.ToString() + ",IP:" + Program.hostip, Program.username); #endregion MessageBox.Show(ex.ToString()); return; } } #endregion }