예제 #1
0
        private void btnRefundment_Click(object sender, EventArgs e)
        {
            if (CurrChargeNo == "")
            {
                MessageBox.Show("请选择发票号。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (CurrStatus == "2")
            {
                MessageBox.Show("该发票已办理退款。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string       ConfirmEmpID = "";
            DialogResult dlg          = clsPublic.m_dlgConfirm(out ConfirmEmpID);

            if (dlg == DialogResult.Yes)
            {
                int PayMode          = 0;
                frmInvoicePayMode fp = new frmInvoicePayMode();
                if (fp.ShowDialog() == DialogResult.OK)
                {
                    PayMode = int.Parse(fp.CuyCate);
                }

                frmInvoiceRefundReason frmR = new frmInvoiceRefundReason(2, CurrInvoNo, ConfirmEmpID);
                if (frmR.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                this.Cursor = Cursors.WaitCursor;
                try
                {
                    clsDcl_Charge objCharge = new clsDcl_Charge();
                    long          l         = objCharge.m_lngRefundment(CurrChargeNo, CurrInvoNo, this.LoginInfo.m_strEmpID, ChrgType, PayMode);
                    if (l > 0)
                    {
                        this.m_mthShowInvonoInfo();
                        this.isrefundment = true;
                        CurrStatus        = "2";
                    }
                    else
                    {
                        MessageBox.Show("退款失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
                catch
                {
                    this.Cursor = Cursors.Default;
                }
                this.Cursor = Cursors.Default;
            }
        }
예제 #2
0
        /// <summary>
        /// 退款与恢复
        /// </summary>
        /// <param name="type">类型 2 退款 3 恢复 4 冲单</param>
        public void m_mthRefundmentAndResumeAndStrike(int type)
        {
            if (this.m_objViewer.dtgHistory.Rows.Count == 0)
            {
                return;
            }

            string msg = "";

            if (type == 2)
            {
                msg = "退款";
            }
            else if (type == 3)
            {
                msg = "恢复";
            }
            else if (type == 4)
            {
                msg = "冲单";
            }

            if (this.m_objViewer.dtgHistory.SelectedRows.Count == 0)
            {
                MessageBox.Show("请选择需要" + msg + "的按金单据!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DataRow dr = this.m_objViewer.dtgHistory.SelectedRows[0].Tag as DataRow;

            if (dr["isclear_int"].ToString() == "1")
            {
                MessageBox.Show("该笔预交金已冲帐,请重新选择。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string prepayno = dr["prepayinv_vchr"].ToString(); //票号
            string prepayid = "";                              //ID

            //该笔预交金状态 1 正常 2 退款 3 恢复 4 冲单
            int status = 1;

            if (type == 2)
            {
                for (int i = 0; i < this.m_objViewer.dtgHistory.Rows.Count; i++)
                {
                    DataRow tmpdr = this.m_objViewer.dtgHistory.Rows[i].Tag as DataRow;

                    if (prepayno == tmpdr["prepayinv_vchr"].ToString() && tmpdr["paytype_int"].ToString() == "2")
                    {
                        status = 2;
                        break;
                    }
                }

                if (status == 2)
                {
                    MessageBox.Show("该笔预交金已办理退款手续。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                prepayid = dr["prepayid_chr"].ToString();
            }
            else if (type == 3)
            {
                for (int i = 0; i < this.m_objViewer.dtgHistory.Rows.Count; i++)
                {
                    DataRow tmpdr = this.m_objViewer.dtgHistory.Rows[i].Tag as DataRow;

                    if (prepayno == tmpdr["prepayinv_vchr"].ToString() && tmpdr["paytype_int"].ToString() == "2")
                    {
                        prepayid = tmpdr["prepayid_chr"].ToString();
                        status   = 2;
                    }
                    else if (prepayno == tmpdr["prepayinv_vchr"].ToString() && tmpdr["paytype_int"].ToString() == "3")
                    {
                        status = 3;
                        break;
                    }
                    else if (prepayno == tmpdr["prepayinv_vchr"].ToString() && tmpdr["paytype_int"].ToString() == "4")
                    {
                        status = 4;
                        break;
                    }
                }

                if (status == 1)
                {
                    MessageBox.Show("该笔预交金为正常收费(未退款),不能办理恢复手续。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else if (status == 3)
                {
                    MessageBox.Show("该笔预交金已办理恢复手续。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else if (status == 4)
                {
                    MessageBox.Show("该笔预交金已办理冲单手续。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            else if (type == 4)
            {
                for (int i = 0; i < this.m_objViewer.dtgHistory.Rows.Count; i++)
                {
                    DataRow tmpdr = this.m_objViewer.dtgHistory.Rows[i].Tag as DataRow;

                    if (prepayno == tmpdr["prepayinv_vchr"].ToString() && tmpdr["paytype_int"].ToString() == "2")
                    {
                        status = 2;
                        break;
                    }
                    else if ((prepayno == tmpdr["prepayinv_vchr"].ToString() || prepayno == tmpdr["originvono_vchr"].ToString()) && tmpdr["paytype_int"].ToString() == "4")
                    {
                        status = 4;
                        break;
                    }
                }

                if (status == 2)
                {
                    MessageBox.Show("该笔预交金已办理退款手续。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else if (status == 4)
                {
                    MessageBox.Show("该笔预交金已办理冲单手续。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                prepayid = dr["prepayid_chr"].ToString();
            }

            //string prepayid = dr["prepayid_chr"].ToString();

            string       ConfirmEmpID = "";
            DialogResult dlg          = clsPublic.m_dlgConfirm(out ConfirmEmpID);

            if (dlg == DialogResult.Yes)
            {
                string BillNo  = "";
                string CuyCate = "1";
                if (type == 4)
                {
                    frmPrePayNoInput fpp = new frmPrePayNoInput();
                    fpp.NewNo = PrepayBillNo;
                    if (fpp.ShowDialog() == DialogResult.OK)
                    {
                        BillNo  = fpp.NewNo;
                        CuyCate = fpp.CuyCate;
                    }
                    else
                    {
                        MessageBox.Show("冲单必须输入单号。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }
                }

                // 退款
                if (type == 2)
                {
                    frmInvoiceRefundReason frmR = new frmInvoiceRefundReason(3, prepayno, ConfirmEmpID);
                    if (frmR.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                }

                string NewPrePayID = "";
                long   l           = this.objSvc.m_lngRefundAndResumeAndStrikePrePay(prepayid, BillNo, this.m_objViewer.LoginInfo.m_strEmpID, ConfirmEmpID, type, CuyCate, out NewPrePayID);
                if (l > 0)
                {
                    if (type == 4)
                    {
                        clsPublic.m_blnSaveCurrInvoiceNo(this.m_objViewer.LoginInfo.m_strEmpID, BillNo, 2);
                        this.m_blnSavePrePayBillNo(BillNo);
                        this.m_objViewer.txtprebillno.Text = Convert.ToString(int.Parse(BillNo) + 1);

                        this.m_mthInit();
                        clsPBNetPrint.m_mthPrintPrepayBill(NewPrePayID, "");
                    }
                    else
                    {
                        MessageBox.Show(msg + "成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    this.m_mthGetPrePayHistoryInfo();
                    this.m_objViewer.ucPatientInfo.m_mthFind(this.m_objViewer.ucPatientInfo.BihPatient_VO.Zyh, 2);
                }
                else
                {
                    MessageBox.Show(msg + "失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }