public string DeletePreBalanceAmount(int PatientAccountRowID, string DeleteReason, String BillType, int RegNo, string SecurityDeposityID) { Connect(); string Result = null; try { SqlCommand cmd = new SqlCommand("DeletePreBalance", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@PatientAccountRowID", PatientAccountRowID); cmd.Parameters.AddWithValue("@DeleteReason", DeleteReason); con.Open(); Result = cmd.ExecuteNonQuery().ToString(); // con.Close(); if (BillType == "IPD SecurityDeposit PreBalanceBills") { cmd = new SqlCommand("update SecurityDepositeTPA set RowStatus=1 where PatientRegNo=" + RegNo + " and RowStatus=0 and HospitalID=" + HospitalID + " and LocationID=" + LocationID + " and BillType='IPDSecurityDeposit PreBalanceBills' and SecurityDeposityID=" + SecurityDeposityID + "", con); cmd.ExecuteNonQuery(); } con.Close(); #region ForAuthorization // int ForAuthorization = 0; // Aurthorise KeystoneProject.Buisness_Logic.Master.BL_MasterSetting obj4 = new Buisness_Logic.Master.BL_MasterSetting(); DataSet dsMasterSetting = new DataSet(); dsMasterSetting = obj4.GetMasterSetting(); KeystoneProject.Buisness_Logic.Hospital.BL_Users user = new Buisness_Logic.Hospital.BL_Users(); DataSet dsAuthorizationRights = new DataSet(); // List<Users> Search = new List<Users>(); dsAuthorizationRights = user.GetUsers(UserID); string chkAurthoriseUserWise = dsAuthorizationRights.Tables[0].Rows[0]["AuthorizationRights"].ToString(); string ForAuthorization = "0"; if (chkAurthoriseUserWise == "True") { dsMasterSetting.Tables[0].Rows[0]["ForAuthorization"] = false; ForAuthorization = "0"; } if (Convert.ToBoolean(dsMasterSetting.Tables[0].Rows[0]["ForAuthorization"]) == true) { ForAuthorization = "1"; con.Close(); SqlCommand cmdIUForAuthorization = new SqlCommand("IUForAuthorization", con); cmdIUForAuthorization.CommandType = CommandType.StoredProcedure; cmdIUForAuthorization.Parameters.AddWithValue("@HospitalID", HospitalID); cmdIUForAuthorization.Parameters.AddWithValue("@LocationID", LocationID); cmdIUForAuthorization.Parameters.AddWithValue("@PatientAccountRowID", PatientAccountRowID); cmdIUForAuthorization.Parameters.AddWithValue("@UserID", UserID); cmdIUForAuthorization.Parameters.AddWithValue("@AuthorationReason", "change"); cmdIUForAuthorization.Parameters.AddWithValue("@BillNo", 0); cmdIUForAuthorization.Parameters.AddWithValue("@BillType", BillType); cmdIUForAuthorization.Parameters.AddWithValue("@Date", DateTime.Now); cmdIUForAuthorization.Parameters.AddWithValue("@PatientRegNO", RegNo); cmdIUForAuthorization.Parameters.AddWithValue("@CreationID", UserID); cmdIUForAuthorization.Parameters.AddWithValue("@Mode", "Add"); con.Open(); cmdIUForAuthorization.ExecuteNonQuery(); } #endregion return(Result); } catch (Exception) { return(Result); } }
public ActionResult AjaxMethodDgv(string PatientRegNO) { Connect(); #region ForAuthorization int ForAuthorization = 0; // Aurthorise KeystoneProject.Buisness_Logic.Master.BL_MasterSetting obj4 = new Buisness_Logic.Master.BL_MasterSetting(); DataSet dsMasterSetting = new DataSet(); dsMasterSetting = obj4.GetMasterSetting(); KeystoneProject.Buisness_Logic.Hospital.BL_Users user = new Buisness_Logic.Hospital.BL_Users(); DataSet dsAuthorizationRights = new DataSet(); // List<Users> Search = new List<Users>(); Connect(); HospitlLocationID(); dsAuthorizationRights = user.GetUsers(CreationID); string chkAurthoriseUserWise = ""; if (dsAuthorizationRights.Tables[0].Rows.Count > 0) { chkAurthoriseUserWise = dsAuthorizationRights.Tables[0].Rows[0]["AuthorizationRights"].ToString(); } if (chkAurthoriseUserWise == "True") { chkAurthoriseUserWise = dsAuthorizationRights.Tables[0].Rows[0]["AuthorizationRights"].ToString(); if (chkAurthoriseUserWise == "True") { dsMasterSetting.Tables[0].Rows[0]["ForAuthorization"] = false; ForAuthorization = 0; } } if (Convert.ToBoolean(dsMasterSetting.Tables[0].Rows[0]["ForAuthorization"]) == true) { ForAuthorization = 1; } #endregion List <PreBalanceAmount> search = new List <PreBalanceAmount>(); DataSet ds1 = new DataSet(); DataSet ds2 = new DataSet(); DataSet ds = objblamt.GetPatientName(PatientRegNO); if (ForAuthorization == 0) { ds1 = objblamt.GetRefoundAmount(Convert.ToInt32(PatientRegNO)); } if (ForAuthorization == 1) { ds1 = objblamt.GetRefoundAmountPatientAccountModyFyModyFy(Convert.ToInt32(PatientRegNO)); } prebalamt.PreBalance = ds1.Tables[1].Rows[0]["PreBalance"].ToString(); //Session["OPDIPDNO1"] = ds1.Tables[2].Rows[0]["OPD/IPDID"].ToString(); if (ds1.Tables[2].Rows.Count > 0) { foreach (DataRow dr in ds1.Tables[2].Rows) { if (dr["TDSAmount"].ToString() == "" || dr["TPAOtherDeduction"].ToString() == "") { dr["TDSAmount"] = 0; dr["TPAOtherDeduction"] = 0; } search.Add(new PreBalanceAmount { OPDIPDNO = dr["OPDIPDNO"].ToString(), BillType = dr["BillType"].ToString(), DrAmount = Convert.ToDecimal(dr["DrAmount"].ToString()), P_BillNo = dr["P_BillNo"].ToString(), TDSAmount = Convert.ToDecimal(dr["TDSAmount"].ToString()), TPAOtherDeduction = Convert.ToDecimal(dr["TPAOtherDeduction"].ToString()), CrAmount = Convert.ToDecimal(dr["CrAmount"].ToString()), BillDate = Convert.ToDateTime(dr["Date"]).ToString("dd-MM-yyyy"), BillNo = dr["BillNo"].ToString(), P_RegNo = dr["PatientRegNO"].ToString(), PrintRegNo = dr["P_RegNo"].ToString(), PaymentType = dr["PaymentType"].ToString(), OPDIPDID = dr["OPD/IPDID"].ToString(), PreBalance = ds1.Tables[1].Rows[0]["PreBalance"].ToString(), PatientAccountRowID = Convert.ToInt32(dr["PatientAccountRowID"].ToString()), PatinetType = dr["PatientType"].ToString(), }); } } else { search.Add(new PreBalanceAmount { PreBalance = "0", }); } return(new JsonResult { Data = search, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }