Ejemplo n.º 1
0
        //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() + "]");
            }
        }
Ejemplo n.º 2
0
Archivo: Caja.cs Proyecto: rrromano/BSP
        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() + "]");
            }
        }
Ejemplo n.º 3
0
        public DateTime appFechaSistema()
        {
            try
            {
                ConectarBD Conex = new ConectarBD();
                FuncionesGenerales fg = new FuncionesGenerales();
                DataSet Ds = new DataSet();
                String ssQL = "EXEC dbo.adp_FecSis";

                Ds = Conex.ejecutarQuerySelect(ssQL);
                return DateTime.Parse(Ds.Tables[0].Rows[0]["FECHA_SISTEMA"].ToString());
            }
            catch (Exception e)
            {
                throw new System.ArgumentException("[Error] -  [" + e.Message.ToString() + "]");
            }
        }
Ejemplo n.º 4
0
        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() + "]");
            }
        }
Ejemplo n.º 5
0
        private void obtenerCodigoNuevoMovimiento()
        {
            try
            {
                String cadenaSql = "EXEC adp_maximo_TipoMovimiento_Caja";
                ConectarBD Conex = new ConectarBD();
                DataSet Ds = new DataSet();
                Ds = Conex.ejecutarQuerySelect(cadenaSql);

                if (Ds.Tables[0].Rows.Count > 0)
                {
                    txtCodigo.Text = Ds.Tables[0].Rows[0]["MAXIMO"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 6
0
Archivo: Caja.cs Proyecto: furrutia/BSP
        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() + "]");
            }
        }
Ejemplo n.º 7
0
        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() + "]");
            }
        }
Ejemplo n.º 8
0
Archivo: Caja.cs Proyecto: furrutia/BSP
        public string obtenerFechaCajaAbierta()
        {
            try
            {
                ConectarBD con = new ConectarBD();
                DataSet dataSet = new DataSet();
                string ssQL;

                ssQL = "exec adp_obtener_ultimaFechaCajaAbierta";
                dataSet.Reset();
                dataSet = con.ejecutarQuerySelect(ssQL);

                if (dataSet.Tables[0].Rows.Count == 0)
                {
                    throw new System.ArgumentException("No se pudo obtener la última fecha de caja abierta. Consulte con el administrador.", "Estado del sistema");
                }

                return (dataSet.Tables[0].Rows[0]["FechaCajaAbierta"].ToString());
            }
            catch (Exception e)
            {
                throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]");
            }
        }
Ejemplo n.º 9
0
        private bool existeTipoMovimientoCaja()
        {
            try
            {
                ConectarBD Conex = new ConectarBD();
                DataSet Ds = new DataSet();
                String CadenaSql;

                CadenaSql = "EXEC adp_verificoExistencia_TipoMovCaja";
                CadenaSql = CadenaSql + " @Codigo = " + fg.fcSql(txtCodigo.Text, "INTEGER");
                CadenaSql = CadenaSql + " ,@Descripcion = " + fg.fcSql(txtTipoMovimiento.Text, "STRING");
                Ds = Conex.ejecutarQuerySelect(CadenaSql);

                if (Ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("Ya existe un Tipo de Movimiento " + fg.fcSql(txtTipoMovimiento.Text, "STRING") + ".", "Alta de Tipo de Movimiento Caja.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtTipoMovimiento.Focus();
                    return true;
                }

                return false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return true;
            }
        }
Ejemplo n.º 10
0
        private void cargarArticulosEnGrilla()
        {
            try
            {
                ConectarBD Conex = new ConectarBD();
                DataSet DsArticulosVenta = new DataSet();
                String sSQL;
                DataGridView aux = new DataGridView();

                sSQL = "EXEC dbo.adp_obtenerArticulosVenta_Temporal ";
                DsArticulosVenta = Conex.ejecutarQuerySelect(sSQL);

                if (DsArticulosVenta.Tables[0].Rows.Count > 0)
                {
                    if (grdItemsVenta.Rows.Count != 0)
                    {
                        aux.DataSource = grdItemsVenta.DataSource;
                    }

                    grdItemsVenta.DataSource = null;
                    grdItemsVenta = fg.agregarBotones(grdItemsVenta, "SELECCIONAR");
                    grdItemsVenta.DataSource = DsArticulosVenta.Tables[0];

                    for (int i = 0; i <= grdItemsVenta.Rows.Count - 1; i++)
                    {
                        grdItemsVenta.Rows[i].Cells["SELECCIONAR"].ReadOnly = false;
                    }
                }
                else
                {
                    grdItemsVenta = fg.eliminarBotones(grdItemsVenta, "SELECCIONAR");
                    grdItemsVenta.DataSource = null;
                }

                actualizarPrecioTotalVenta();
            }
            catch (Exception ex)
            {
                fg.mostrarErrorTryCatch(ex);
            }
        }
Ejemplo n.º 11
0
        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() + "]");
            }
        }
Ejemplo n.º 12
0
        public void cargarDatosVenta()
        {
            try
            {
                ConectarBD conect = new ConectarBD();
                DataSet dataSet = new DataSet();
                String sSQL;

                sSQL = "EXEC dbo.adp_obtenerDatosVenta ";
                sSQL = sSQL + " @Id_Venta = " + fg.fcSql(this.m_Id_Venta.ToString(), "INTEGER");

                dataSet = conect.ejecutarQuerySelect(sSQL);

                foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                {
                    Articulo_Venta articulo_venta = new Articulo_Venta();

                    this.m_cantidad_articulos = Int32.Parse(dataRow["CANTIDAD_ARTICULOS"].ToString());
                    this.m_importe = Double.Parse(dataRow["IMPORTE"].ToString());
                    this.m_estado = Int32.Parse(dataRow["ESTADO"].ToString());
                    this.m_fecha_venta = DateTime.Parse(dataRow["FECHA_VENTA"].ToString());
                    this.m_hora_venta = dataRow["HORA_VENTA"].ToString();
                    this.cargarArticulosVenta();
                }

            }
            catch (Exception e)
            {
                throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]");
            }
        }
Ejemplo n.º 13
0
        public void cargarArticulosVenta()
        {
            try
            {
                ConectarBD conect = new ConectarBD();
                DataSet dataSet = new DataSet();
                String sSQL;

                sSQL = "EXEC dbo.adp_obtenerArticulosVenta2 ";
                sSQL = sSQL + " @Id_Venta = " + fg.fcSql(this.m_Id_Venta.ToString(), "INTEGER");

                dataSet = conect.ejecutarQuerySelect(sSQL);

                this.m_articulos_venta = new List<Articulo_Venta>();

                foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                {
                    Articulo_Venta articulo_venta = new Articulo_Venta();

                    articulo_venta.m_id_venta = UInt64.Parse(dataRow["ID_VENTA"].ToString());
                    articulo_venta.m_id_item_venta = UInt64.Parse(dataRow["ID_ITEM_VENTA"].ToString());
                    articulo_venta.m_id_articulo = UInt64.Parse(dataRow["ID_ARTICULO"].ToString());
                    articulo_venta.m_cantidad = Int32.Parse(dataRow["CANTIDAD"].ToString());
                    articulo_venta.m_precio_venta = Double.Parse(dataRow["PRECIO_VENTA"].ToString());

                    this.m_articulos_venta.Add(articulo_venta);
                }

            }
            catch (Exception e)
            {
                throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]");
            }
        }
Ejemplo n.º 14
0
        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());
            }
        }
Ejemplo n.º 15
0
Archivo: Caja.cs Proyecto: furrutia/BSP
        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() + "]");
            }
        }
Ejemplo n.º 16
0
Archivo: Caja.cs Proyecto: furrutia/BSP
 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() + "]");
     }
 }
Ejemplo n.º 17
0
Archivo: Caja.cs Proyecto: furrutia/BSP
        public int obtenerEstado()
        {
            try
            {
                ConectarBD Conex = new ConectarBD();
                DataSet Ds = new DataSet();
                string ssQL;

                ssQL = "SELECT Estado_Caja FROM PARAMETROS_GENERALES";
                Ds.Reset();
                Ds = Conex.ejecutarQuerySelect(ssQL);

                if (Ds.Tables[0].Rows.Count == 0)
                {
                    throw new System.ArgumentException("No se pudo obtener el estado actual del Sistema. Consulte con el administrador.", "Estado del sistema");
                }

                return int.Parse(Ds.Tables[0].Rows[0]["Estado_Caja"].ToString());

            }
            catch (Exception e)
            {
                throw new System.ArgumentException("[Error] - [" + e.Message.ToString() + "]");
            }

        }