public Double obtenerImporteCajaActual(DateTime fecha) { try { FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD con = new ConectarBD(); DataSet Ds = new DataSet(); Double importe = 0.00; String sSQL = ""; sSQL = "EXEC dbo.ObtenerImporteCajaActual "; sSQL = sSQL + " @fecha_mov = " + fg.fcSql(fecha.ToString(), "DATETIME"); Ds.Reset(); Ds = con.ejecutarQuerySelect(sSQL); if (Ds.Tables[0].Rows.Count > 0) { importe = Double.Parse(Ds.Tables[0].Rows[0]["TOTAL"].ToString()); } return(importe); } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
//internal List<Venta> obtenerVentas(DateTime Fecha) internal DataSet obtenerVentas (DateTime Fecha) { try { String cadenaSql = ""; DataSet Ds = new DataSet(); ConectarBD objConect = new ConectarBD(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); //List<Venta> VentasDelDia = new List<Venta>(); cadenaSql = "EXEC dbo.adp_obtener_ventas @d_16_fecha = " + fg.fcSql(Fecha.ToString(), "DATETIME"); Ds = objConect.ejecutarQuerySelect(cadenaSql); return Ds; //foreach(DataRow dataRow in Ds.Tables[0].Rows) //{ // Venta venta = new Venta(); // // venta.id = Int32.Parse(dataRow["ID_VENTA"].ToString()); // venta.cantidad_Articulos = Int32.Parse(dataRow["CANTIDAD_ARTICULOS"].ToString()); // venta.importe = double.Parse(dataRow["IMPORTE"].ToString()); // venta.fecha_Venta = DateTime.Parse(dataRow["FECHA_VENTA"].ToString()); // venta.hora_Venta = dataRow["HORA_VENTA"].ToString(); // // VentasDelDia.Add(venta); //} //return VentasDelDia; } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
internal int ObtenerId_TipoMovimiento(int Id_Movimiento) { try { FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD con = new ConectarBD(); DataSet Ds = new DataSet(); String sSQL; int ID; sSQL = "exec dbo.adp_obtenerId_TipoMovimientoCaja "; sSQL = sSQL + " @ID_Movimiento = " + Id_Movimiento; Ds.Reset(); Ds = con.ejecutarQuerySelect(sSQL); if (Ds.Tables[0].Rows.Count > 0) { ID = int.Parse(Ds.Tables[0].Rows[0]["ID_TipoMovimiento"].ToString()); } else { throw new System.ArgumentException("Error al intentar obtener el ID tipo Movimiento Caja"); } return(ID); } catch (Exception ex) { throw new System.ArgumentException(ex.Message.ToString()); } }
public Double obtenerCajaActual(DateTime fecha) { try { FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD con = new ConectarBD(); DataSet Ds = new DataSet(); Double importe = 0.00; String sSQL = ""; sSQL = "EXEC dbo.adp_ObtenerCajaActual"; sSQL = sSQL + " @fecha_mov = " + fg.fcSql(fecha.ToString(), "DATETIME"); Ds.Reset(); Ds = con.ejecutarQuerySelect(sSQL); if (Ds.Tables[0].Rows.Count > 0) { importe = Double.Parse(Ds.Tables[0].Rows[0]["TOTAL"].ToString()); } return importe; } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
//internal List<Venta> obtenerVentas(DateTime Fecha) internal DataSet obtenerVentas(DateTime Fecha) { try { String cadenaSql = ""; DataSet Ds = new DataSet(); ConectarBD objConect = new ConectarBD(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); //List<Venta> VentasDelDia = new List<Venta>(); cadenaSql = "EXEC dbo.adp_obtener_ventas @d_16_fecha = " + fg.fcSql(Fecha.ToString(), "DATETIME"); Ds = objConect.ejecutarQuerySelect(cadenaSql); return(Ds); //foreach(DataRow dataRow in Ds.Tables[0].Rows) //{ // Venta venta = new Venta(); // // venta.id = Int32.Parse(dataRow["ID_VENTA"].ToString()); // venta.cantidad_Articulos = Int32.Parse(dataRow["CANTIDAD_ARTICULOS"].ToString()); // venta.importe = double.Parse(dataRow["IMPORTE"].ToString()); // venta.fecha_Venta = DateTime.Parse(dataRow["FECHA_VENTA"].ToString()); // venta.hora_Venta = dataRow["HORA_VENTA"].ToString(); // // VentasDelDia.Add(venta); //} //return VentasDelDia; } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
internal void eliminarMovCajaPorFecha(DateTime fecha_mov) { try { FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD Conex = new ConectarBD(); String sSQL = "EXEC dbo.adp_eliminarTodosMovCajaDeHoy @fecha_mov = " + fg.fcSql(fecha_mov.ToString(), "DATETIME"); Conex.ejecutarQuery(sSQL); } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
public DataSet obtenerCierreParcialCaja(DateTime fecha) { try { ConectarBD con = new ConectarBD(); DataSet ds = new DataSet(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); String cadenaSql = ""; cadenaSql = "EXEC adp_cierre_parcial @FECHA = " + fg.fcSql(fecha.ToString(), "DATETIME"); ds = con.ejecutarQuerySelect(cadenaSql); return(ds); } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
public void registrarMovimientosCaja(DateTime Fecha, String Hora) { try { FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD con = new ConectarBD(); String sSQL; sSQL = "exec adp_registrar_movimientosCaja "; sSQL = sSQL + " @fecha = " + fg.fcSql(Fecha.ToString(), "DATETIME"); sSQL = sSQL + ",@hora = " + fg.fcSql(Hora, "STRING"); con.ejecutarQuery(sSQL); } catch (Exception e) { throw new System.ArgumentException(e.Message.ToString()); } }
public DataSet obtenerCamposTiposDeMovimientosCaja() { try { ConectarBD con = new ConectarBD(); DataSet ds = new DataSet(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); String cadenaSql = ""; cadenaSql = "EXEC adp_cbobusqueda_tipoMovimientos_caja"; ds = con.ejecutarQuerySelect(cadenaSql); return(ds); } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
public DataSet obtenerCamposMovimientosCaja() { try { ConectarBD con = new ConectarBD(); DataSet ds = new DataSet(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); String cadenaSql = ""; cadenaSql = "EXEC adp_cbobusqueda_movimientos_caja"; ds = con.ejecutarQuerySelect(cadenaSql); return ds; } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
public void modificarCajaInicial(DateTime Fecha, String Valor) { try { FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD con = new ConectarBD(); String sSQL; sSQL = "exec adp_modificarCajaInicial "; sSQL = sSQL + " @fecha = " + fg.fcSql(Fecha.ToString(), "DATETIME"); sSQL = sSQL + " ,@Valor = " + fg.fcSql(Valor, "DOUBLE"); con.ejecutarQuery(sSQL); } catch (Exception e) { throw new System.ArgumentException(e.Message.ToString()); } }
internal DataSet obtenerTiposMovimientosCaja() { try { ConectarBD con = new ConectarBD(); DataSet Ds = new DataSet(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); String sSQL = ""; sSQL = "EXEC dbo.adp_obtenerTiposMovsCaja"; Ds.Reset(); Ds = con.ejecutarQuerySelect(sSQL); return(Ds); } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
public DataSet obtenerMovimientosCaja(DateTime fecha) { try { ConectarBD con = new ConectarBD(); DataSet Ds = new DataSet(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); String sSQL = ""; sSQL = "EXEC dbo.adp_ObtenerMovimientosCaja @fecha_mov = " + fg.fcSql(fecha.ToString(),"DATETIME"); Ds.Reset(); Ds = con.ejecutarQuerySelect(sSQL); return Ds; } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
public DataSet obtenerMovimientosCaja(DateTime fecha) { try { ConectarBD con = new ConectarBD(); DataSet Ds = new DataSet(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); String sSQL = ""; sSQL = "EXEC dbo.adp_ObtenerMovimientosCaja @fecha_mov = " + fg.fcSql(fecha.ToString(), "DATETIME"); Ds.Reset(); Ds = con.ejecutarQuerySelect(sSQL); return(Ds); } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
internal DataSet obtenerTiposMovimientosCaja() { try { ConectarBD con = new ConectarBD(); DataSet Ds = new DataSet(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); String sSQL = ""; sSQL = "EXEC dbo.adp_obtenerTiposMovsCaja"; Ds.Reset(); Ds = con.ejecutarQuerySelect(sSQL); return Ds; } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
public void registrarMovimientoCaja(int tipoMovimiento, String descripcion, Double valor, DateTime fecha, String hora) { try { FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD con = new ConectarBD(); String sSQL; sSQL = "exec dbo.adp_registrar_mov_caja "; sSQL = sSQL + " @Tipo_Movimiento = " + fg.fcSql(tipoMovimiento.ToString(), "STRING"); sSQL = sSQL + " ,@Valor = " + fg.fcSql(valor.ToString(), "DOUBLE").Replace(",", "."); sSQL = sSQL + " ,@fecha = " + fg.fcSql(fecha.ToString(), "DATETIME"); sSQL = sSQL + " ,@hora = " + fg.fcSql(hora, "STRING"); con.ejecutarQuery(sSQL); } catch (Exception e) { throw new System.ArgumentException(e.Message.ToString()); } }
internal bool verificarExistenciaMovCajaSegunFecha(DateTime fecha_mov) { try { FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD Conex = new ConectarBD(); DataSet Ds = new DataSet(); String sSQL = "EXEC dbo.adp_VerificoExistenciaMovCaja @fecha_mov = " + fg.fcSql(fecha_mov.ToString(), "DATETIME"); Ds = Conex.ejecutarQuerySelect(sSQL); if (Ds.Tables[0].Rows.Count == 0) { return(false); } else { return(true); } } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
internal void eliminarMovCajaPorFecha(DateTime fecha_mov) { try { string usuario = Properties.Settings.Default.UsuarioLogueado.ToString(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD Conex = new ConectarBD(); String sSQL = "EXEC dbo.adp_eliminarTodosMovCajaDeHoy @fecha_mov = " + fg.fcSql(fecha_mov.ToString(), "DATETIME"); if (usuario != "") { sSQL = sSQL + ",@Login = "******"String"); } Conex.ejecutarQuery(sSQL); } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
public DataSet obtenerGanancia(DateTime fechaDesde, DateTime fechaHasta) { try { ConectarBD con = new ConectarBD(); DataSet ds = new DataSet(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); String cadenaSql = ""; cadenaSql = "EXEC adp_obtener_ganancia @FECHA_DESDE = " + fg.fcSql(fechaDesde.ToString(), "DATETIME"); cadenaSql = cadenaSql + ", @FECHA_HASTA = " + fg.fcSql(fechaHasta.ToString(), "DATETIME"); ds = con.ejecutarQuerySelect(cadenaSql); return ds; } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
public DataSet obtenerCierreParcialCaja(DateTime fecha) { try { ConectarBD con = new ConectarBD(); DataSet ds = new DataSet(); FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); String cadenaSql = ""; cadenaSql = "EXEC adp_cierre_parcial @FECHA = " + fg.fcSql(fecha.ToString(), "DATETIME"); ds = con.ejecutarQuerySelect(cadenaSql); return ds; } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
internal bool verificarExistenciaMovCajaSegunFecha(DateTime fecha_mov) { try { FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD Conex = new ConectarBD(); DataSet Ds = new DataSet(); String sSQL = "EXEC dbo.adp_VerificoExistenciaMovCaja @fecha_mov = " + fg.fcSql(fecha_mov.ToString(),"DATETIME"); Ds = Conex.ejecutarQuerySelect(sSQL); if (Ds.Tables[0].Rows.Count == 0) { return false; } else { return true; } } catch (Exception e) { throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]"); } }
internal int ObtenerId_TipoMovimiento(int Id_Movimiento) { try { FuncionesGenerales.FuncionesGenerales fg = new FuncionesGenerales.FuncionesGenerales(); ConectarBD con = new ConectarBD(); DataSet Ds = new DataSet(); String sSQL; int ID; sSQL = "exec dbo.adp_obtenerId_TipoMovimientoCaja "; sSQL = sSQL + " @ID_Movimiento = " + Id_Movimiento; Ds.Reset(); Ds = con.ejecutarQuerySelect(sSQL); if (Ds.Tables[0].Rows.Count > 0) { ID = int.Parse(Ds.Tables[0].Rows[0]["ID_TipoMovimiento"].ToString()); } else { throw new System.ArgumentException("Error al intentar obtener el ID tipo Movimiento Caja"); } return ID; } catch (Exception ex) { throw new System.ArgumentException(ex.Message.ToString()); } }