using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PTMedicalInsurance.Business.Core.Forms.DischargeAudit
{
    public partial class AuditForm : Form
    {
        public string rtnResult;

        //审核状态 -1 审核被拒 0.暂存 1.审核通过 2.退结算状态 3冲正状态 
        public int auditStatus
        {
            get 
            {
                if (rbApproved.Checked) return 1;
                if (rbOnHold.Checked) return 0;
                if (rbRefused.Checked) return -1;
                return 0;
            }
            set
            {
                if (value == 1) rbApproved.Checked = true;
                if (value == 0) rbOnHold.Checked = true;
                if (value == -1) rbRefused.Checked = true;
            }
        }

        public EventHandler ConfirmClicked;

        public string memo
        {
            get { return rtbMemo.Text; }
            set { rtbMemo.Text = value; }
        }
        public AuditForm()
        {
            InitializeComponent();
            InitForm();
        }

        private void InitForm()
        {
            this.StartPosition = FormStartPosition.CenterParent;
            this.WindowState = FormWindowState.Maximized;

            rbOnHold.Checked = true;
        }

        public void AddForm(TabPage tabpage, Form frm)
        {
            tabpage.Controls.Add(frm);
            frm.Show();
        }

        public void AddForm(TabPage tabpage, Panel frm)
        {
            tabpage.Controls.Add(frm);
            frm.Show();
        }



        private void rbApproved_CheckedChanged(object sender, EventArgs e)
        {
            if (rbApproved.Checked) auditStatus = 1;
        }

        private void rbRefused_CheckedChanged(object sender, EventArgs e)
        {
            if (rbRefused.Checked) auditStatus = -1;
        }

        private void rbOnHold_CheckedChanged(object sender, EventArgs e)
        {
            if (rbOnHold.Checked) auditStatus = 0;
        }

        private void btCancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btConfirm_Click(object sender, EventArgs e)
        {
            ConfirmClicked?.Invoke(this, e);
        }
    }
}
