예제 #1
0
        private void b_ok_Click(object sender, EventArgs e)
        {
            if (rc001 == null)
            {
                XtraMessageBox.Show("数据传递错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txtEdit_oc003.EditValue == null || txtEdit_oc003.EditValue is System.DBNull)
            {
                txtEdit_oc003.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                txtEdit_oc003.ErrorText = "请输入迁出办理人!";
                return;
            }
            if (mem_oc005.EditValue == null)
            {
                mem_oc005.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                mem_oc005.ErrorText = "请输入迁出原因!";
                return;
            }
            string s_oc003 = txtEdit_oc003.Text;               //迁出人
            string s_oc005 = mem_oc005.Text;                   //迁出原因
            string s_oc004 = txtEdit_oc004.Text;               //迁出人身份证号

            int     diff       = int.Parse(txtEdit_diff.EditValue.ToString());
            decimal nums       = decimal.Zero;
            string  fa001      = Tools.GetEntityPK("FA01");
            string  last_fa001 = RegisterAction.GetREGLastSettleId(rc001);                //获取最后一次缴费 结算流水号

            //补退情况
            if (checkEdit1.Checked)
            {
                nums = decimal.Parse(txtEdit_nums.Text);
            }
            else
            {
                nums = 0;
            }

            if (XtraMessageBox.Show("确认要继续办理迁出吗?本业务将不能回退!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }
            if (checkEdit1.Checked && Math.Abs(regfee) > 0)
            {
                if (XtraMessageBox.Show("迁出需要补退费" + regfee.ToString("##,##0.00") + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }

            if ((!string.IsNullOrEmpty(txtEdit_fee.Text)) && Convert.ToDecimal(txtEdit_fee.Text) > 0 && Envior.cur_userId != AppInfo.ROOTID && !isrefund)
            {
                XtraMessageBox.Show("当前记录已经欠费,不能迁出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }



            int re = RegisterAction.RegisterOut(rc001,
                                                s_oc003,
                                                s_oc004,
                                                s_oc005,
                                                diff,
                                                fa001,
                                                price,
                                                isrefund ? 0 - nums : nums,
                                                isrefund ? 0 - Math.Abs(regfee) : Math.Abs(regfee),
                                                Envior.cur_userId
                                                );

            if (re > 0)
            {
                //保存迁出人信息
                if (IDC_FLAG)
                {
                    ic01_dao.Insert(ic01);
                    ///更新身份证照片
                    if (ic01 != null)
                    {
                        FileStream file    = new FileStream("zp.bmp", FileMode.Open, FileAccess.Read);
                        Byte[]     imgByte = new Byte[file.Length];                   //把图片转成 Byte型 二进制流
                        file.Read(imgByte, 0, imgByte.Length);                        //把二进制流读入缓冲区
                        file.Close();
                        MiscAction.Update_IDC_Photo(ic01.ic001, imgByte);
                    }
                }

                XtraMessageBox.Show("迁出办理成功!现在打印【迁出通知单】", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PrtServAction.PrtRegisterOutNotice(rc001, this.Handle.ToInt32());

                if (!isrefund && nums > 0)
                {
                    if (XtraMessageBox.Show("现在开具【发票】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        if (FinInvoice.GetCurrentPh() > 0)
                        {
                            if (XtraMessageBox.Show("下一张财政发票号码:" + Envior.FIN_NEXT_BILL_NO + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                FinInvoice.Invoice(fa001);
                            }
                        }
                    }
                }
                else if (isrefund && Math.Abs(nums) > 0)                    //退费发票
                {
                    //如果是新版接口上线前开具的原发票
                    if (MiscAction.FinRefundBeforeOnline(fa001))
                    {
                        XtraMessageBox.Show("原发票在财政新接口上线前开具,不能开具对应退费发票,请在财政发票系统内完成发票开具.\r\n 开具成功后请更新发票号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (FinInvoice.GetCurrentPh() > 0)
                    {
                        if (XtraMessageBox.Show("下一张财政发票号码:" + Envior.FIN_NEXT_BILL_NO + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            FinInvoice.Refund(fa001);
                        }
                    }
                }
            }
            DialogResult = DialogResult.OK;
            this.Close();
        }
예제 #2
0
        private void b_ok_Click(object sender, EventArgs e)
        {
            if (rc001 == null)
            {
                XtraMessageBox.Show("数据传递错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txtEdit_oc003.EditValue == null || txtEdit_oc003.EditValue is System.DBNull)
            {
                txtEdit_oc003.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                txtEdit_oc003.ErrorText = "请输入迁出办理人!";
                return;
            }
            if (mem_oc005.EditValue == null)
            {
                mem_oc005.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                mem_oc005.ErrorText = "请输入迁出原因!";
                return;
            }
            string s_oc003 = txtEdit_oc003.Text;               //迁出人
            string s_oc005 = mem_oc005.Text;                   //迁出原因
            string s_oc004 = txtEdit_oc004.Text;               //迁出人身份证号

            int     diff       = int.Parse(txtEdit_diff.EditValue.ToString());
            decimal nums       = decimal.Zero;
            string  fa001      = Tools.GetEntityPK("FA01");
            string  last_fa001 = RegisterAction.GetREGLastSettleId(rc001);                //获取最后一次缴费 结算流水号

            //补退情况
            if (checkEdit1.Checked && (!string.IsNullOrEmpty(txtEdit_nums.Text)))
            {
                nums = decimal.Parse(txtEdit_nums.Text);
            }
            else
            {
                nums = 0;
            }

            if (XtraMessageBox.Show("确认要继续办理迁出吗?本业务将不能回退!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }
            //if ((!string.IsNullOrEmpty(txtEdit_fee.Text)) && Convert.ToDecimal(txtEdit_fee.Text) > 0 && Envior.cur_userId != AppInfo.ROOTID && !isrefund )
            //{
            //	XtraMessageBox.Show("当前记录已经欠费,不能迁出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //	return;
            //}

            int re = RegisterAction.RegisterOut(rc001,
                                                s_oc003,
                                                s_oc004,
                                                s_oc005,
                                                diff,
                                                fa001,
                                                price,
                                                isrefund ? 0 - nums : nums,
                                                Envior.cur_userId
                                                );

            if (re > 0)
            {
                XtraMessageBox.Show("迁出办理成功!现在打印【迁出通知单】", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PrtServAction.PrtRegisterOutNotice(rc001, this.Handle.ToInt32());

                if (!isrefund && nums > 0)
                {
                    if (XtraMessageBox.Show("现在开具【发票】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        if (FinInvoice.GetCurrentPh() > 0)
                        {
                            if (XtraMessageBox.Show("下一张财政发票号码:" + Envior.FIN_NEXT_BILL_NO + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                FinInvoice.Invoice(fa001);
                            }
                        }
                    }
                }
                else if (isrefund && Math.Abs(nums) > 0)                   //退费发票
                {
                    string           s_old_pjlx = string.Empty;
                    string           s_old_pjh  = string.Empty;
                    string           s_old_zch  = string.Empty;
                    OracleDataReader reader_log = SqlAssist.ExecuteReader("select * from fin_log where settleId ='" + last_fa001 + "'");
                    reader_log.Read();
                    if (reader_log.HasRows)
                    {
                        s_old_pjlx = reader_log["INVOICEKIND"].ToString();                            //票据类型
                        s_old_pjh  = reader_log["INVOICENO"].ToString();                              //票据号
                        s_old_zch  = reader_log["INVOICEZCH"].ToString();                             //注册号
                    }
                    else
                    {
                        XtraMessageBox.Show("读取缴费发票信息出错!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    reader_log.Dispose();
                    Frm_refundInfo frm_refund = new Frm_refundInfo(s_old_pjlx, s_old_pjh, s_old_zch);
                    if (frm_refund.ShowDialog() == DialogResult.OK)
                    {
                        s_old_zch = frm_refund.swapdata["zch"].ToString();                         //注册号
                        //if (!Envior.FIN_READY)
                        //	XtraMessageBox.Show("未连接到博思开票服务器!请稍后补开!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        //else
                        //{
                        //	string s_newpjh = FinInvoice.GetCurrentPh(Envior.FIN_INVOICE_TYPE);
                        //	if (String.IsNullOrEmpty(s_newpjh))
                        //		XtraMessageBox.Show("未获取到下一张财政发票号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        //	else
                        //	{
                        //		if (XtraMessageBox.Show("下一张财政发票号码:" + s_newpjh + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        //		{
                        //			string s_tkitem = MiscAction.GetItemInvoiceCode("08", "") + "	" + Math.Abs(nums * price) + "	";
                        //			FinInvoice.Refund(s_old_pjlx, s_old_pjh, s_old_zch, s_tkitem, "F_Qt1=xxx|F_Qt2=xxx|F_Qt3=xxx",fa001, s_newpjh,nums * price);
                        //		}
                        //	}
                        //}
                    }
                    frm_refund.Dispose();
                }
            }
            DialogResult = DialogResult.OK;
            this.Close();
        }