Esempio n. 1
0
        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
        }
Esempio n. 2
0
        private void btnSf_Click(object sender, EventArgs e)
        {
            #region 输入检查
            if (str_tjbh == "")
            {
                MessageBox.Show("请选择一条人员信息!", "提示");
                return;
            }
            if (str_tjcs == "")
            {
                MessageBox.Show("请选择一条人员信息!", "提示");
                return;
            }

            Common.Common comn = new Common.Common();
            if (rbt_je.Checked == true)
            {
                if (comn.DoubleYz(txt_je.Text.Trim()) == -1 || comn.Szyz(txt_je.Text.Trim()) == -1)  //既不是双精度又不是数字
                {
                    MessageBox.Show("请输入正确的金额格式,如:100.5或100", "提示");
                    txt_je.Focus();
                    return;
                }
                if (Convert.ToDecimal(txt_je.Text.Trim()) > ysje)
                {
                    MessageBox.Show("最大金额优惠不能大于应收金额!", "提示");
                    txt_je.Focus();
                    return;
                }
                if (txt_yhbz.Text == "")
                {
                    MessageBox.Show("请输入优惠备注信息!", "提示");
                    txt_yhbz.Focus();
                    return;
                }
            }
            if (rbt_bl.Checked == true)
            {
                if (comn.DoubleYz(txt_bl.Text.Trim()) == -1 || comn.Szyz(txt_bl.Text.Trim()) == -1)  //既不是双精度又不是数字
                {
                    MessageBox.Show("请输入正确的比例格式,如:9或9.5", "提示");
                    txt_bl.Focus();
                    return;
                }
                if (Convert.ToDecimal(txt_bl.Text.Trim()) > 100)
                {
                    MessageBox.Show("优惠比例不能大于或等于100!", "提示");
                    txt_je.Focus();
                    return;
                }
                if (txt_yhbz.Text == "")
                {
                    MessageBox.Show("请输入优惠备注信息!", "提示");
                    txt_yhbz.Focus();
                    return;
                }
            }
            #endregion

            string sfh = xtbiz.GetHmz("tj_sjh", 1);
            str_sfhdy = sfh;
            #region 优惠处理
            int     yhlx = 0;
            decimal ssje = 0;
            decimal yhxx = 0;

            if (rbt_je.Checked == true || txt_je.Text.Trim() != "")
            {
                yhlx = 1;                                     //金额优惠
                yhxx = Convert.ToDecimal(txt_je.Text.Trim()); //优惠信息
                ssje = ysje - yhxx;                           //应收-优惠金额
            }

            if (rbt_bl.Checked == true || txt_bl.Text.Trim() != "")
            {
                yhlx = 2;                          //比例优惠
                yhxx = Convert.ToDecimal(txt_bl.Text.Trim());
                ssje = ysje - ysje * (yhxx / 100); //应收-应收*优惠比例
            }

            if (rbt_bl.Checked == false && rbt_je.Checked == false)
            {
                ssje = ysje;
            }

            #endregion

            #region 收费保存,打印
            try
            {
                int k = tjdjbiz.TjSf(sfh, str_tjbh, str_tjcs, Program.userid, ysje, ssje, yhlx, yhxx, sfh, txt_yhbz.Text.Trim());
                if (k > 0)
                {
                    MessageBox.Show("收费成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    #region 日志记录
                    loginbiz.WriteLog(this.Name.Trim(), "【" + Program.username + "】" + "在电脑【" + ma.HostName() + "】上收费成功,收费号是:" + sfh + ",IP:" + Program.hostip, Program.username);
                    #endregion

                    txt_bl.Text = "";
                    txt_je.Text = "";
                    btn_query_Click(null, null);
                    dgvFyxx.DataSource = tjdjbiz.GetTjfyxx("", "");;
                    btnSf.Enabled      = false;
                    string sfdyfp = xtbiz.GetXtCsz("sfdyfp"); //是否打印收费发票
                    if (sfdyfp == "1")                        //1打印,0不打印
                    {
                        PrintRdlc(str_tjbh, str_tjcs, sfh);
                    }
                }
            }
            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
        }