public void ActualizarSaldo(CajaGeneral caja, decimal valor)
        {
            string vl = valor.ToString("N2");
            string vr = valor.ToString();

            decimal v1 = Convert.ToDecimal(vl, CultureInfo.CreateSpecificCulture("es-ES"));

            vl = vl.Replace(',', '.');
            vr = vr.Replace(',', '.');

            int retorno = 0;

            string[] data  = caja.FechaSaldo.Split('/');
            string   fecha = caja.FechaSaldo;

            if (data.Length > 1)
            {
                fecha = String.Format("{0}-{1}-{2}", data[2].Substring(0, 4), data[1], data[0]);
            }
            MySqlConnection conection = Conexion.ObtenerConexion();
            MySqlCommand    comando   = new MySqlCommand(string.Format("update cajageneral set saldo = (saldo + '{0}') where fechaSaldo >= '{1}'", vr, fecha), conection);

            retorno = comando.ExecuteNonQuery();

            comando.Dispose();
            conection.Close();

            return;
        }
        public CajaGeneral LocalizarNuevoSaldo(string de)
        {
            string[] data  = de.Split('/');
            string   fecha = de;

            if (data.Length > 1)
            {
                fecha = String.Format("{0}-{1}-{2}", data[2].Substring(0, 4), data[1], data[0]);
            }

            CajaGeneral cg = new CajaGeneral();

            MySqlConnection cmd = Conexion.ObtenerConexion();

            MySqlCommand    comando = new MySqlCommand(String.Format("select * from cajageneral where fechaSaldo >= '{0}' limit 1;", fecha), cmd);
            MySqlDataReader cods    = comando.ExecuteReader();

            while (cods.Read())
            {
                cg.IdCaja     = cods.GetInt32(0);
                cg.FechaSaldo = cods.GetString(1);
                cg.Saldo      = cods.GetDecimal(2);
            }

            cmd.Close();

            return(cg);
        }
        public int Insertar(CajaGeneral cg)
        {
            string vl = cg.Saldo.ToString("N2");
            string vr = cg.Saldo.ToString();

            decimal v1 = Convert.ToDecimal(vl, CultureInfo.CreateSpecificCulture("es-ES"));

            vl = vl.Replace(',', '.');
            vr = vr.Replace(',', '.');

            string f = String.Format("{0}-{1}-{2}", cg.FechaSaldo.Substring(6), cg.FechaSaldo.Substring(3, 2), cg.FechaSaldo.Substring(0, 2));

            MySqlConnection conection = Conexion.ObtenerConexion();
            MySqlCommand    comando   = new MySqlCommand(string.Format("Insert into cajageneral (fechaSaldo, saldo) values ('{0}','{1}')",
                                                                       f, vr), conection);

            int retorno = comando.ExecuteNonQuery();

            comando.Dispose();
            conection.Close();

            return(retorno);
        }