Exemplo n.º 1
0
        public ActionResult AjaxMethod(string PatientRegNO)
        {
            string type = "";
            List <PreBalanceAmount> searchList = new List <PreBalanceAmount>();
            int     a;
            DataSet ds1 = objblamt.GetPatientName1(PatientRegNO);

            //List<string> searchList = new List<string>();
            HospitlLocationID();
            // DataSet ds2 =objblamt.GetIPDOPDIDForPrintIPDNo(PatientRegNO,a) ;
            DataSet dsPatientPrintIPDOpdID = new DataSet();

            DataSet ds = objblamt.GetPatientName1(PatientRegNO);

            ds1 = objblamt.GetRefoundAmount(Convert.ToInt32(PatientRegNO));
            if (ds.Tables[0].Rows.Count > 0)
            {
                type = ds.Tables[0].Rows[0]["PatientType"].ToString();
            }

            string opdipd = "0";

            if (ds1.Tables[2].Rows.Count > 0)
            {
                opdipd = ds1.Tables[2].Rows[0]["OPDIPDNO"].ToString();
                if (opdipd == "")
                {
                    opdipd = "0";
                }
            }
            else if (ds1.Tables[4].Rows.Count > 0)
            {
                if (ds1.Tables[4].Rows.Count > 0)
                {
                    opdipd = ds1.Tables[4].Rows[0]["OPDIPDNO"].ToString();
                    if (opdipd == "")
                    {
                        opdipd = "0";
                    }
                }
            }
            else
            {
                if (ds1.Tables[5].Rows.Count > 0)
                {
                    opdipd = ds1.Tables[5].Rows[0]["OPDIPDNO"].ToString();
                    if (opdipd == "")
                    {
                        opdipd = "0";
                    }
                }
            }

            //int opdipd= Convert.ToInt32(ds1.Tables[2].Rows[0]["OPDIPDNO"].ToString());
            DataSet ds2 = new DataSet();

            ds2 = objblamt.GetIPDOPDIDForPrintIPDNo(Convert.ToInt32(PatientRegNO), Convert.ToInt32(opdipd), type);
            if (ds1.Tables[0].Rows.Count > 0)
            {
                dsPatientPrintIPDOpdID        = objblamt.GetRefoundIPDOPDID(Convert.ToInt32(PatientRegNO));
                prebalamt.SecurityDeposityAmt = Convert.ToDecimal(ds1.Tables[1].Rows[0]["SecurityDeposityAmt"]);
                if (ds1.Tables[3].Rows.Count > 0)
                {
                    prebalamt.SecurityDeposityID = ds1.Tables[3].Rows[0]["SecurityDeposityID"].ToString();
                }
                else
                {
                    prebalamt.SecurityDeposityID = "0";
                }
                prebalamt.PreBalance = ds1.Tables[1].Rows[0]["PreBalance"].ToString();
                if (dsPatientPrintIPDOpdID.Tables[1].Rows.Count > 0)
                {
                    prebalamt.OPDIPDNO = dsPatientPrintIPDOpdID.Tables[1].Rows[0]["OPDIPDNO"].ToString();
                }
                if (ds2.Tables.Count > 0)
                {
                    if (ds2.Tables[0].Rows.Count > 0)
                    {
                        if (type == "OPD")
                        {
                            if (ds2.Tables[0].Rows[0]["TPA_ID"].ToString() != "0")
                            {
                                prebalamt.chkTPA      = "True";
                                prebalamt.PatinetType = type;
                            }
                            else
                            {
                                prebalamt.chkTPA      = "False";
                                prebalamt.PatinetType = type;
                            }
                        }
                        if (type == "IPD")
                        {
                            if (ds2.Tables[0].Rows[0]["TPAStatus"].ToString() != "False")
                            {
                                prebalamt.chkTPA      = "True";
                                prebalamt.PatinetType = type;
                            }
                            else
                            {
                                prebalamt.chkTPA      = "False";
                                prebalamt.PatinetType = type;
                            }
                        }
                    }
                }
            }
            searchList.Add(prebalamt);
            //searchList.Add(prebalamt);
            return(Json(searchList));
        }