// Approve Receipt
        public bool ApproveReceiptRecord(string RECEIPT_ID, Remit_ReceiptRepo ReceiptRepo)
        {
            AppSettings app = new AppSettings();

            TransactionOptions tsOp = new TransactionOptions();

            tsOp.IsolationLevel = System.Transactions.IsolationLevel.Snapshot;
            TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew, tsOp);

            tsOp.Timeout = TimeSpan.FromMinutes(20);

            try
            {
                //go off
                //Get Connection

                con = app.GetConnection();
                DynamicParameters param = new DynamicParameters();
                param.Add(name: "P_RECEIPT_ID", value: RECEIPT_ID, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_RECEIPT_STATUS", value: "ACTIVE", dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_AUTH_STATUS", value: "AUTHORIZED", dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_AUTH_ID", value: GlobalValue.User_ID, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_AUTH_DATE", value: GlobalValue.Scheme_Today_Date, dbType: DbType.Date, direction: ParameterDirection.Input);
                con.Execute("APP_REMIT_RECEIPT", param, commandType: CommandType.StoredProcedure);
                ts.Complete();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
                //return true;
            }
            finally
            {
                ts.Dispose();
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                    if (con != null)
                    {
                        con = null;
                    }
                }
            }
        }
        //public List<Remit_ReceiptRepo> GetReceiptESListBTE(Remit_ReceiptRepo rr)
        //{
        //    try
        //    {
        //        //Get connection
        //        var app = new AppSettings();
        //        con = app.GetConnection();

        //        DataSet ds = new DataSet();

        //        OracleDataAdapter da = new OracleDataAdapter();
        //        OracleCommand cmd = new OracleCommand();


        //        cmd.CommandText = "SEL_REMIT_BTE_EMPLOYER";
        //        cmd.CommandType = CommandType.StoredProcedure;
        //        cmd.Connection = (OracleConnection)con;

        //        //Input param
        //        OracleParameter paramemployer_Id = new OracleParameter("DID", OracleDbType.Varchar2, rr.Scheme_Id, ParameterDirection.Input);
        //        cmd.Parameters.Add(paramemployer_Id);
        //        OracleParameter param2 = new OracleParameter("cur", OracleDbType.RefCursor, ParameterDirection.Output);
        //        cmd.Parameters.Add(param2);

        //        da = new OracleDataAdapter(cmd);
        //        da.Fill(ds, "employee");


        //        var eList = ds.Tables[0].AsEnumerable().Select(row => new Remit_ReceiptRepo
        //        {
        //            ES_Id = row.Field<string>("ES_ID"),
        //            Scheme_Id_2 = row.Field<string>("SCHEME_ID"),
        //            Scheme_Name_2 = row.Field<string>("SCHEME_NAME"),
        //            Employer_Id = row.Field<string>("EMPLOYER_ID"),
        //            Employer_Name = row.Field<string>("Employer_Name"),
        //            Cash_Balance = row.Field<decimal>("CASH_BALANCE")

        //        }).ToList();

        //        return eList;

        //    }
        //    catch (Exception EX)
        //    {

        //        throw EX;
        //    }

        //    finally
        //    {
        //        if (con.State == ConnectionState.Open)
        //        {
        //            con.Close();
        //            if (con != null) { con = null; }
        //        }
        //    }

        //}
        public decimal getConBalance(Remit_ReceiptRepo ReceiptRepo)
        {
            try
            {
                //Get connection
                var con   = new AppSettings();
                var param = new DynamicParameters();
                param.Add("P_ES_ID", ReceiptRepo.ES_Id, DbType.String, ParameterDirection.Input);
                param.Add("P_CON_TOTAL", null, DbType.Decimal, ParameterDirection.Output);
                con.GetConnection().Execute("SEL_CON_TOTAL", param, commandType: CommandType.StoredProcedure);
                ReceiptRepo.Con_Total = param.Get <decimal>("P_CON_TOTAL");
                return(this.Con_Total);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        // FOR PENDING RECEIPTS
        public List <Remit_ReceiptRepo> GetEMPLOYERList(Remit_ReceiptRepo ReceiptRepo)
        {
            try
            {
                AppSettings app = new AppSettings();
                con = app.GetConnection();
                List <Remit_ReceiptRepo> bn = new List <Remit_ReceiptRepo>();

                string query = "Select * from crm_EMPLOYER";
                return(bn = con.Query <Remit_ReceiptRepo>(query).ToList());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Dispose();
            }
        }
        // FOR PENDING RECEIPTS
        public List <Remit_ReceiptRepo> GetERPENDList(Remit_ReceiptRepo ReceiptRepo)
        {
            try
            {
                AppSettings app = new AppSettings();
                con = app.GetConnection();
                List <Remit_ReceiptRepo> bn = new List <Remit_ReceiptRepo>();

                string query = "Select * from VW_RECEIPT_EMPLOYER WHERE EMPLOYER_ID = '" + Receipt_Id + "'   AND RECEIPT_STATUS = 'PENDING'";
                return(bn = con.Query <Remit_ReceiptRepo>(query).ToList());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Dispose();
            }
        }
        public List <Remit_ReceiptRepo> GetReceiptESListBTE(Remit_ReceiptRepo rr)
        {
            AppSettings db = new AppSettings();

            con = db.GetConnection();
            try
            {
                List <Remit_ReceiptRepo> ObjFund = new List <Remit_ReceiptRepo>();

                return(ObjFund = db.GetConnection().Query <Remit_ReceiptRepo>("Select * from VW_EMPLOYER_ES where scheme_id = '" + rr.Scheme_Id + "'").ToList());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.Dispose();
            }
        }
        // FOR ACTIVE RECEIPTS
        public List <Remit_ReceiptRepo> GetERList(Remit_ReceiptRepo ReceiptRepo)
        {
            try
            {
                AppSettings app = new AppSettings();
                con = app.GetConnection();
                List <Remit_ReceiptRepo> bn = new List <Remit_ReceiptRepo>();

                string query = "Select * from VW_RECEIPT_EMPLOYER WHERE EMPLOYER_ID = '" + Employer_Id + "' and  (ACTUAL_RECEIPT_DATE between '" + From_Date.ToString("dd-MMM-yyyy") + "' and '" + To_Date.ToString("dd-MMM-yyyy") + "')   AND RECEIPT_STATUS = 'ACTIVE'";
                return(bn = con.Query <Remit_ReceiptRepo>(query).ToList());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Dispose();
            }
        }
        public void SaveRecord(Remit_ReceiptRepo ReceiptRepo)
        {
            GlobalValue.Get_Scheme_Today_Date(ReceiptRepo.Scheme_Id);
            //put trans scope here

            try
            {
                //Get Connection
                AppSettings app = new AppSettings();
                con = app.GetConnection();
                DynamicParameters param = new DynamicParameters();

                param.Add(name: "P_RECEIPT_ID", value: ReceiptRepo.Receipt_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_ES_ID", value: ReceiptRepo.ES_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_TRANS_AMOUNT", value: ReceiptRepo.Trans_Amount, dbType: DbType.Decimal, direction: ParameterDirection.Input);
                param.Add(name: "P_ACTUAL_RECEIPT_DATE", value: ReceiptRepo.Actual_Receipt_Date, dbType: DbType.DateTime, direction: ParameterDirection.Input);
                param.Add(name: "P_NARRATION", value: ReceiptRepo.Narration, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_NARRATION_SYSTEM", value: ReceiptRepo.Narration, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_PAYMENT_MODE", value: ReceiptRepo.Payment_Mode, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_INSTRUMENT_NO", value: ReceiptRepo.Instrument_No, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_MAKER_ID", value: GlobalValue.User_ID, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_MAKE_DATE", value: GlobalValue.Scheme_Today_Date, dbType: DbType.DateTime, direction: ParameterDirection.Input);

                con.Execute("MIX_REMIT_RECEIPT", param, commandType: CommandType.StoredProcedure);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                    if (con != null)
                    {
                        con = null;
                    }
                }
            }
        }