using Newtonsoft.Json.Linq;
using PTMedicalInsurance.Forms;
using PTMedicalInsurance.Helper;
using PTMedicalInsurance.Variables;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PTMedicalInsurance.Business
{
    class SettleBillPrintProcess : AbstractProcess
    {
        public override CallResult Process(JObject joInParam)
        {
            //显示打印界面
            SettlementChecklist frmSettlList;
            string insuAdmObj = JsonHelper.getDestValue(joInParam, "insuAdmObj");
            if (insuAdmObj == "")
            {
                frmSettlList = new SettlementChecklist();
                frmSettlList.ShowDialog();
            }
            else
            {
                JObject joInsuAdmObj = JObject.Parse(insuAdmObj);
                frmSettlList = new SettlementChecklist(joInsuAdmObj);

                string groupID = JsonHelper.getDestValue((JObject)Global.curEvt.jaSession[0], "groupID");
                DataTable dt = (DataTable)frmSettlList.dgvSettlRecord.DataSource;

                if (dt.Rows.Count != 1)
                {
                    frmSettlList.ShowDialog();
                }
                else
                {
                    frmSettlList.btnPrint_Click(null, null);
                }
            }

            return IrisReturn("", null);
        }
    }
}
