public List <CashMovement> GetCashMovements()
        {
            //...Create New Instance of Object...
            List <CashMovement> list = new List <CashMovement>();
            CashMovement        ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();
            SqlCommand         cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT cm.*, mu.MoneyUnit, mt.MovementType, (e.Name + ' ' + e.Surname) as Employee "
                                  + " FROM t_CashMovement cm INNER JOIN l_MoneyUnit mu on cm.MoneyUnitID = mu.MoneyUnitID "
                                  + " INNER JOIN l_MovementType mt ON cm.MovementTypeID = mt.MovementTypeID "
                                  + " INNER JOIN Employee e on cm.EmployeeID = e.EmployeeID "
                                  + " WHERE cm.Removed = 0", con);

            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins                = new CashMovement();
                    ins.ActualDate     = Convert.ToDateTime(drI["ActualDate"]);
                    ins.Amount         = Convert.ToDecimal(drI["Amount"]);
                    ins.CashMovementID = Convert.ToInt32(drI["CashMovementID"]);
                    ins.employee       = drI["Employee"].ToString();
                    ins.EmployeeID     = Convert.ToInt32(drI["EmployeeID"]);
                    ins.ModifiedDate   = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.moneyunit      = drI["MoneyUnit"].ToString();
                    ins.MoneyUnitID    = Convert.ToInt32(drI["MoneyUnitID"]);
                    ins.movementtype   = drI["MovementType"].ToString();
                    ins.MovementTypeID = Convert.ToInt32(drI["MovementTypeID"]);
                    ins.ModifiedBy     = drI["ModifiedBy"].ToString();
                    ins.Count          = (int)(ins.Amount / murep.GetMoneyUnitValue(ins.MoneyUnitID));
                    list.Add(ins);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();


            //...Return...
            return(list);
        }
        public List<CashMovement> GetCashMovements()
        {
            //...Create New Instance of Object...
            List<CashMovement> list = new List<CashMovement>();
            CashMovement ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            SqlCommand cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT cm.*, mu.MoneyUnit, mt.MovementType, (e.Name + ' ' + e.Surname) as Employee "
            + " FROM t_CashMovement cm INNER JOIN l_MoneyUnit mu on cm.MoneyUnitID = mu.MoneyUnitID "
            + " INNER JOIN l_MovementType mt ON cm.MovementTypeID = mt.MovementTypeID "
            + " INNER JOIN Employee e on cm.EmployeeID = e.EmployeeID "
            + " WHERE cm.Removed = 0", con);

            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins = new CashMovement();
                    ins.ActualDate = Convert.ToDateTime(drI["ActualDate"]);
                    ins.Amount = Convert.ToDecimal(drI["Amount"]);
                    ins.CashMovementID = Convert.ToInt32(drI["CashMovementID"]);
                    ins.employee = drI["Employee"].ToString();
                    ins.EmployeeID = Convert.ToInt32(drI["EmployeeID"]);
                    ins.ModifiedDate = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.moneyunit = drI["MoneyUnit"].ToString();
                    ins.MoneyUnitID = Convert.ToInt32(drI["MoneyUnitID"]);
                    ins.movementtype = drI["MovementType"].ToString();
                    ins.MovementTypeID = Convert.ToInt32(drI["MovementTypeID"]);
                    ins.ModifiedBy = drI["ModifiedBy"].ToString();
                    ins.Count = (int)(ins.Amount / murep.GetMoneyUnitValue(ins.MoneyUnitID));
                    list.Add(ins);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();

            //...Return...
            return list;
        }
        public List <CashMovement> GetCashMovementsPerEmployeeReport(int EmployeeID, DateTime date, int MovementType)
        {
            //...Create New Instance of Object...
            List <CashMovement> list = new List <CashMovement>();
            CashMovement        ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();
            SqlCommand         cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT SUM(Amount) as Amount, ActualDate, MovementTypeID, c.MoneyUnitID, EmployeeID, m.MoneyUnit, (SUM(Amount) / m.Value) as Value "
                                  + " FROM t_CashMovement c INNER JOIN l_MoneyUnit m on c.MoneyUnitID = m.MoneyUnitID WHERE EmployeeID = "
                                  + EmployeeID + " AND ActualDate = '" + date.ToShortDateString() + "' AND c.Removed=0 AND c.MovementTypeID = " + MovementType
                                  + " GROUP BY c.MoneyUnitID, MovementTypeID, ActualDate, EmployeeID, m.MoneyUnit, m.Value", con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins = new CashMovement();
                    //ins.CashMovementID = Convert.ToInt32(drI["CashMovementID"]);
                    ins.ActualDate = Convert.ToDateTime(drI["ActualDate"]);
                    //ins.ModifiedDate = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.Amount         = Convert.ToDecimal(drI["Amount"]);
                    ins.EmployeeID     = Convert.ToInt32(drI["EmployeeID"]);
                    ins.MovementTypeID = Convert.ToInt32(drI["MovementTypeID"]);
                    ins.MoneyUnitID    = Convert.ToInt32(drI["MoneyUnitID"]);
                    ins.moneyunit      = drI["MoneyUnit"].ToString();
                    ins.Count          = Convert.ToInt32(drI["Value"]);
                    list.Add(ins);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();


            //...Return...
            return(list);
        }
        public List <CashMovement> GetAllCashMovement()
        {
            //...Create New Instance of Object...
            List <CashMovement> list = new List <CashMovement>();
            CashMovement        ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();
            SqlCommand         cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT cm.*,m.MoneyUnit,mt.MovementType FROM t_CashMovement cm inner join l_MoneyUnit m on cm.MoneyUnitID=m.MoneyUnitID inner join l_MovementType mt on cm.MovementTypeID=mt.MovementTypeID", con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins = new CashMovement();
                    ins.CashMovementID = Convert.ToInt32(drI["CashMovementID"]);
                    ins.ActualDate     = Convert.ToDateTime(drI["ActualDate"]);
                    ins.ModifiedDate   = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.Amount         = Convert.ToDecimal(drI["Amount"]);
                    ins.EmployeeID     = Convert.ToInt32(drI["EmployeeID"]);
                    ins.MovementTypeID = Convert.ToInt32(drI["MovementTypeID"]);
                    ins.movementtype   = drI["MovementType"].ToString();
                    ins.MoneyUnitID    = Convert.ToInt32(drI["MoneyUnitID"]);
                    ins.moneyunit      = drI["MoneyUnit"].ToString();
                    list.Add(ins);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();


            //...Return...
            return(list);
        }
        public List <CashMovement> GetCashMovementsPerCashType(int MovementTypeID, string UserID)
        {
            //...Create New Instance of Object...
            List <CashMovement> list = new List <CashMovement>();
            CashMovement        ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();
            SqlCommand         cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT * FROM t_CashMovement WHERE MovementTypeID = " + MovementTypeID + " Where Removed=0 and UserID= " + UserID, con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins = new CashMovement();
                    ins.CashMovementID = Convert.ToInt32(drI["CashMovementID"]);
                    ins.ActualDate     = Convert.ToDateTime(drI["ActualDate"]);
                    ins.ModifiedDate   = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.Amount         = Convert.ToDecimal(drI["Amount"]);
                    ins.EmployeeID     = Convert.ToInt32(drI["EmployeeID"]);
                    ins.MovementTypeID = Convert.ToInt32(drI["MovementTypeID"]);
                    ins.MoneyUnitID    = Convert.ToInt32(drI["MoneyUnitID"]);

                    list.Add(ins);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();


            //...Return...
            return(list);
        }
        public List<CashMovement> GetAllCashMovement()
        {
            //...Create New Instance of Object...
            List<CashMovement> list = new List<CashMovement>();
            CashMovement ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            SqlCommand cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT cm.*,m.MoneyUnit,mt.MovementType FROM t_CashMovement cm inner join l_MoneyUnit m on cm.MoneyUnitID=m.MoneyUnitID inner join l_MovementType mt on cm.MovementTypeID=mt.MovementTypeID", con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins = new CashMovement();
                    ins.CashMovementID = Convert.ToInt32(drI["CashMovementID"]);
                    ins.ActualDate = Convert.ToDateTime(drI["ActualDate"]);
                    ins.ModifiedDate = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.Amount = Convert.ToDecimal(drI["Amount"]);
                    ins.EmployeeID = Convert.ToInt32(drI["EmployeeID"]);
                    ins.MovementTypeID = Convert.ToInt32(drI["MovementTypeID"]);
                    ins.movementtype = drI["MovementType"].ToString();
                    ins.MoneyUnitID = Convert.ToInt32(drI["MoneyUnitID"]);
                    ins.moneyunit = drI["MoneyUnit"].ToString();
                    list.Add(ins);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();

            //...Return...
            return list;
        }
        public CashMovement GetCashMovement(int CashMovementID)
        {
            //...Create New Instance of Object...
            CashMovement ins = new CashMovement();

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();
            SqlCommand         cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT * FROM t_CashMovement WHERE CashMovementID =" + CashMovementID, con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins.CashMovementID = Convert.ToInt32(drI["CashMovementID"]);
                    ins.ActualDate     = Convert.ToDateTime(drI["ActualDate"]);
                    ins.ModifiedDate   = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.Amount         = Convert.ToDecimal(drI["Amount"]);
                    ins.EmployeeID     = Convert.ToInt32(drI["EmployeeID"]);
                    ins.MovementTypeID = Convert.ToInt32(drI["MovementTypeID"]);
                    ins.MoneyUnitID    = Convert.ToInt32(drI["MoneyUnitID"]);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();


            //...Return...
            return(ins);
        }
        public CashMovement GetCashMovement(int CashMovementID)
        {
            //...Create New Instance of Object...
            CashMovement ins = new CashMovement();

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            SqlCommand cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT * FROM t_CashMovement WHERE CashMovementID =" + CashMovementID, con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins.CashMovementID = Convert.ToInt32(drI["CashMovementID"]);
                    ins.ActualDate = Convert.ToDateTime(drI["ActualDate"]);
                    ins.ModifiedDate = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.Amount = Convert.ToDecimal(drI["Amount"]);
                    ins.EmployeeID = Convert.ToInt32(drI["EmployeeID"]);
                    ins.MovementTypeID = Convert.ToInt32(drI["MovementTypeID"]);
                    ins.MoneyUnitID = Convert.ToInt32(drI["MoneyUnitID"]);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();

            //...Return...
            return ins;
        }
        public CashMovement Update(CashMovement ins)
        {
            //...Get User and Date Data...
            string ModifiedDate = string.Format("{0:yyyy-MM-dd hh:mm:ss}", DateTime.Now);
            string EmployeeId   = Convert.ToString(HttpContext.Current.Session["Username"]);

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();

            con.Open();
            SqlCommand cmdI = con.CreateCommand();

            cmdI.Connection = con;

            //...Update Record...
            cmdI.Parameters.Clear();
            cmdI.CommandText = StoredProcedures.CashMovementUpdate;
            cmdI.CommandType = System.Data.CommandType.StoredProcedure;
            cmdI.Parameters.AddWithValue("@CashMovementID", ins.CashMovementID);
            cmdI.Parameters.AddWithValue("@ActualDate", ins.ActualDate);
            cmdI.Parameters.AddWithValue("@ModifiedDate", ModifiedDate);
            cmdI.Parameters.AddWithValue("@Amount", ins.Amount);
            cmdI.Parameters.AddWithValue("@EmployeeID", ins.EmployeeID);
            cmdI.Parameters.AddWithValue("@CreatedDate", DateTime.Now);
            cmdI.Parameters.AddWithValue("@CompanyID", 0);
            cmdI.Parameters.AddWithValue("@MovementTypeID", ins.MovementTypeID);
            cmdI.Parameters.AddWithValue("@MoneyUnitID", ins.MoneyUnitID);
            cmdI.Parameters.AddWithValue("@UserID", 0);
            cmdI.Parameters.AddWithValue("@ModifiedBy", EmployeeId);

            cmdI.ExecuteNonQuery();
            cmdI.Connection.Close();

            return(ins);
        }
        public CashMovement Update(CashMovement ins)
        {
            //...Get User and Date Data...
            string ModifiedDate = string.Format("{0:yyyy-MM-dd hh:mm:ss}", DateTime.Now);
            string EmployeeId = Convert.ToString(HttpContext.Current.Session["Username"]);

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            con.Open();
            SqlCommand cmdI = con.CreateCommand();
            cmdI.Connection = con;

            //...Update Record...
            cmdI.Parameters.Clear();
            cmdI.CommandText = StoredProcedures.CashMovementUpdate;
            cmdI.CommandType = System.Data.CommandType.StoredProcedure;
            cmdI.Parameters.AddWithValue("@CashMovementID", ins.CashMovementID);
            cmdI.Parameters.AddWithValue("@ActualDate", ins.ActualDate);
            cmdI.Parameters.AddWithValue("@ModifiedDate", ModifiedDate);
            cmdI.Parameters.AddWithValue("@Amount", ins.Amount);
            cmdI.Parameters.AddWithValue("@EmployeeID", ins.EmployeeID);
            cmdI.Parameters.AddWithValue("@CreatedDate", DateTime.Now);
            cmdI.Parameters.AddWithValue("@CompanyID", 0);
            cmdI.Parameters.AddWithValue("@MovementTypeID", ins.MovementTypeID);
            cmdI.Parameters.AddWithValue("@MoneyUnitID", ins.MoneyUnitID);
            cmdI.Parameters.AddWithValue("@UserID", 0);
            cmdI.Parameters.AddWithValue("@ModifiedBy", EmployeeId);

            cmdI.ExecuteNonQuery();
            cmdI.Connection.Close();

            return ins;
        }
        public CashMovement Insert(CashMovement ins)
        {
            //...Get User and Date Data...
            string ModifiedDate = string.Format("{0:yyyy-MM-dd hh:mm:ss}", DateTime.Now);
            string UserID = HttpContext.Current.Session["Username"].ToString();
            string strTrx = "CashMovementIns_" + UserID;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            con.Open();

            //...Command Interface...
            SqlCommand cmdI = con.CreateCommand();
            SqlTransaction trx;
            trx = con.BeginTransaction(strTrx);
            cmdI.Connection = con;
            cmdI.Transaction = trx;

            try
            {
                //...Insert Record...
                cmdI.CommandText = StoredProcedures.CashMovementInsert;
                cmdI.CommandType = System.Data.CommandType.StoredProcedure;
                cmdI.Parameters.AddWithValue("@ActualDate", ins.ActualDate);
                cmdI.Parameters.AddWithValue("@ModifiedDate", ModifiedDate);
                cmdI.Parameters.AddWithValue("@Amount", ins.Amount);
                cmdI.Parameters.AddWithValue("@EmployeeID", ins.EmployeeID);
                cmdI.Parameters.AddWithValue("@CreatedDate", DateTime.Now);
                cmdI.Parameters.AddWithValue("@CompanyID", 0);
                cmdI.Parameters.AddWithValue("@MovementTypeID", ins.MovementTypeID);
                cmdI.Parameters.AddWithValue("@MoneyUnitID", ins.MoneyUnitID);
                cmdI.Parameters.AddWithValue("@UserID", 0);
                cmdI.Parameters.AddWithValue("@ModifiedBy", UserID);
                cmdI.Parameters.AddWithValue("@Removed", 0);

                //...Return new ID
                ins.CashMovementID = (int)cmdI.ExecuteScalar();

                trx.Commit();
                cmdI.Connection.Close();
            }
            catch (SqlException ex)
            {
                if (trx != null) trx.Rollback();
            }
            finally
            {
                //Check for close and respond accordingly
                if (con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
                //Clean up
                con.Dispose();
                cmdI.Dispose();
                trx.Dispose();
            }
            return ins;
        }
        public CashMovement Insert(CashMovement ins)
        {
            //...Get User and Date Data...
            string ModifiedDate = string.Format("{0:yyyy-MM-dd hh:mm:ss}", DateTime.Now);
            string UserID       = HttpContext.Current.Session["Username"].ToString();
            string strTrx       = "CashMovementIns_" + UserID;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();

            con.Open();

            //...Command Interface...
            SqlCommand     cmdI = con.CreateCommand();
            SqlTransaction trx;

            trx              = con.BeginTransaction(strTrx);
            cmdI.Connection  = con;
            cmdI.Transaction = trx;

            try
            {
                //...Insert Record...
                cmdI.CommandText = StoredProcedures.CashMovementInsert;
                cmdI.CommandType = System.Data.CommandType.StoredProcedure;
                cmdI.Parameters.AddWithValue("@ActualDate", ins.ActualDate);
                cmdI.Parameters.AddWithValue("@ModifiedDate", ModifiedDate);
                cmdI.Parameters.AddWithValue("@Amount", ins.Amount);
                cmdI.Parameters.AddWithValue("@EmployeeID", ins.EmployeeID);
                cmdI.Parameters.AddWithValue("@CreatedDate", DateTime.Now);
                cmdI.Parameters.AddWithValue("@CompanyID", 0);
                cmdI.Parameters.AddWithValue("@MovementTypeID", ins.MovementTypeID);
                cmdI.Parameters.AddWithValue("@MoneyUnitID", ins.MoneyUnitID);
                cmdI.Parameters.AddWithValue("@UserID", 0);
                cmdI.Parameters.AddWithValue("@ModifiedBy", UserID);
                cmdI.Parameters.AddWithValue("@Removed", 0);

                //...Return new ID
                ins.CashMovementID = (int)cmdI.ExecuteScalar();

                trx.Commit();
                cmdI.Connection.Close();
            }
            catch (SqlException ex)
            {
                if (trx != null)
                {
                    trx.Rollback();
                }
            }
            finally
            {
                //Check for close and respond accordingly
                if (con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
                //Clean up
                con.Dispose();
                cmdI.Dispose();
                trx.Dispose();
            }
            return(ins);
        }
        public JsonResult _UpdateCash(CashMovement ins)
        {
            ins.Amount = ins.Count * MuRep.GetMoneyUnitValue(ins.MoneyUnitID);
            CashMovement ins2 = CashRep.Update(ins);

            //...Repopulate Grid...
            return Json(new GridModel(MRep.GetCashMovements()));
        }
        public List<CashMovement> GetCashMovementsPerCashType(int MovementTypeID, string UserID)
        {
            //...Create New Instance of Object...
            List<CashMovement> list = new List<CashMovement>();
            CashMovement ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            SqlCommand cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT * FROM t_CashMovement WHERE MovementTypeID = " + MovementTypeID + " Where Removed=0 and UserID= " + UserID, con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins = new CashMovement();
                    ins.CashMovementID = Convert.ToInt32(drI["CashMovementID"]);
                    ins.ActualDate = Convert.ToDateTime(drI["ActualDate"]);
                    ins.ModifiedDate = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.Amount = Convert.ToDecimal(drI["Amount"]);
                    ins.EmployeeID = Convert.ToInt32(drI["EmployeeID"]);
                    ins.MovementTypeID = Convert.ToInt32(drI["MovementTypeID"]);
                    ins.MoneyUnitID = Convert.ToInt32(drI["MoneyUnitID"]);

                    list.Add(ins);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();

            //...Return...
            return list;
        }
        public List<CashMovement> GetCashMovementsPerEmployeeReport(int EmployeeID, DateTime date, int MovementType)
        {
            //...Create New Instance of Object...
            List<CashMovement> list = new List<CashMovement>();
            CashMovement ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            SqlCommand cmdI;

            //...SQL Commands...
            cmdI = new SqlCommand("SELECT SUM(Amount) as Amount, ActualDate, MovementTypeID, c.MoneyUnitID, EmployeeID, m.MoneyUnit, (SUM(Amount) / m.Value) as Value "
                + " FROM t_CashMovement c INNER JOIN l_MoneyUnit m on c.MoneyUnitID = m.MoneyUnitID WHERE EmployeeID = "
                + EmployeeID + " AND ActualDate = '" + date.ToShortDateString() + "' AND c.Removed=0 AND c.MovementTypeID = " + MovementType
                + " GROUP BY c.MoneyUnitID, MovementTypeID, ActualDate, EmployeeID, m.MoneyUnit, m.Value", con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins = new CashMovement();
                    //ins.CashMovementID = Convert.ToInt32(drI["CashMovementID"]);
                    ins.ActualDate = Convert.ToDateTime(drI["ActualDate"]);
                    //ins.ModifiedDate = Convert.ToDateTime(drI["ModifiedDate"]);
                    ins.Amount = Convert.ToDecimal(drI["Amount"]);
                    ins.EmployeeID = Convert.ToInt32(drI["EmployeeID"]);
                    ins.MovementTypeID = Convert.ToInt32(drI["MovementTypeID"]);
                    ins.MoneyUnitID = Convert.ToInt32(drI["MoneyUnitID"]);
                    ins.moneyunit = drI["MoneyUnit"].ToString();
                    ins.Count = Convert.ToInt32(drI["Value"]);
                    list.Add(ins);
                }
            }

            //...Close Connections...
            drI.Close();
            con.Close();

            //...Return...
            return list;
        }