//obtener datos para el datagrid de encabezado de movimiento
        public List <MovimientoEncabezado> llenarDGVMovimientoEncabezado()
        {
            SQL_TipoMovimiento          tipoMovimiento           = new SQL_TipoMovimiento();
            List <MovimientoEncabezado> movimientoEncabezadoList = new List <MovimientoEncabezado>();

            try
            {
                string sComando = string.Format("SELECT ID_MOVIMIENTO_INVENTARIO_ENCABEZADO, NOMBRE_MOVIMIENTO, ID_TIPO_MOVIMIENTO, ESTADO " +
                                                "FROM movimientos_inventario_encabezado;");

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        MovimientoEncabezado movimientoEncabezadoTmp = new MovimientoEncabezado();
                        movimientoEncabezadoTmp.ID_MOVIMIENTO_ENCABEZADO = reader.GetInt32(0);
                        movimientoEncabezadoTmp.NOMBRE_MOVIMIENTO        = reader.GetString(1);
                        movimientoEncabezadoTmp.TIPO_MOVIMIENTO          = tipoMovimiento.obtenerTipoMovimiento(reader.GetInt32(2));
                        movimientoEncabezadoTmp.ESTADO = reader.GetInt32(3);
                        movimientoEncabezadoList.Add(movimientoEncabezadoTmp);
                    }
                }
                return(movimientoEncabezadoList);
            }
            catch (OdbcException ex)
            {
                mensaje = new Mensaje("Error en la operacion con la Base de Datos: \n" + ex.Message);
                mensaje.Show();
                return(null);
            }
        }
예제 #2
0
        //obtener datos para los combobox de cotizaciones segun proveedor
        public List <TipoMovimiento> llenarComboTipoMovimiento(int id_proveedor)
        {
            List <TipoMovimiento> tipoMovimientoList = new List <TipoMovimiento>();

            try
            {
                string sComando = string.Format("SELECT id_cotizacion_encabezado, nombre_cotizacion " +
                                                "FROM cotizaciones_encabezado " +
                                                "WHERE id_proveedor = {0}" +
                                                "AND fecha_caducidad > NOW();");

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        TipoMovimiento tipoMovimientottmp = new TipoMovimiento();
                        tipoMovimientottmp.ID_TIPO_MOVIMIENTO     = reader.GetInt32(0);
                        tipoMovimientottmp.NOMBRE_TIPO_MOVIMIENTO = reader.GetString(1);
                        tipoMovimientottmp.SIGNO = reader.GetChar(2);
                        tipoMovimientoList.Add(tipoMovimientottmp);
                    }
                }
                return(tipoMovimientoList);
            }
            catch (OdbcException ex)
            {
                mensaje = new Mensaje("Error en la operacion con la Base de Datos: \n" + ex.Message);
                mensaje.Show();
                return(null);
            }
        }
예제 #3
0
        //obtener datos para los combobox del tipo de movimiento
        public List <TipoMovimiento> llenarComboTipoMovimiento()
        {
            tipoMovimientoList = new List <TipoMovimiento>();

            try
            {
                string sComando = string.Format("SELECT id_tipo_movimiento, nombre_tipo_movimiento, signo " +
                                                "FROM tipos_movimientos;");

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        TipoMovimiento tipoMovimientottmp = new TipoMovimiento();
                        tipoMovimientottmp.ID_TIPO_MOVIMIENTO     = reader.GetInt32(0);
                        tipoMovimientottmp.NOMBRE_TIPO_MOVIMIENTO = reader.GetString(1);
                        tipoMovimientottmp.SIGNO = reader.GetChar(2);
                        tipoMovimientoList.Add(tipoMovimientottmp);
                    }
                }
                return(tipoMovimientoList);
            }
            catch (OdbcException ex)
            {
                mensaje = new Mensaje("Error en la operacion con la Base de Datos: \n" + ex.Message);
                mensaje.Show();
                return(null);
            }

            return(null);
        }
예제 #4
0
        //obtener datos para consulta de detalles de movimientos
        public Producto obtenerProducto(int id_producto)
        {
            producto = new Producto();

            try
            {
                string sComando = string.Format("SELECT id_producto, nombre_producto " +
                                                "FROM productos " +
                                                "WHERE id_producto = {0} ;",
                                                id_producto);

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        producto.ID_PRODUCTO     = reader.GetInt32(0);
                        producto.NOMBRE_PRODUCTO = reader.GetString(1);
                    }
                }
                return(producto);
            }
            catch (OdbcException ex)
            {
                mensaje = new Mensaje("Error en la operacion con la Base de Datos: \n" + ex.Message);
                mensaje.Show();
                return(null);
            }
        }
예제 #5
0
        //obtener datos para el datagrid de encabezados de ordenes de compra
        public List <OrdenCompraEncabezado> llenarDGVOrdenCompraEncabezado()
        {
            List <OrdenCompraEncabezado> ordenCompraEncabezadoList = new List <OrdenCompraEncabezado>();

            try
            {
                string sComando = string.Format("SELECT id_orden_compra_encabezado, nombre_orden_compra, fecha_emision, ESTADO " +
                                                "FROM ordenes_compras_encabezado;");

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrdenCompraEncabezado movimientoEncabezadoTmp = new OrdenCompraEncabezado();
                        movimientoEncabezadoTmp.ID_ORDEN_COMPRA_ENCABEZADO = reader.GetInt32(0);
                        movimientoEncabezadoTmp.NOMBRE_ORDEN_COMPRA        = reader.GetString(1);
                        movimientoEncabezadoTmp.FECHA_EMISION = reader.GetDate(2);
                        movimientoEncabezadoTmp.ESTADO        = reader.GetInt32(3);
                        ordenCompraEncabezadoList.Add(movimientoEncabezadoTmp);
                    }
                }
                return(ordenCompraEncabezadoList);
            }
            catch (OdbcException ex)
            {
                mensaje = new Mensaje("Error en la operacion con la Base de Datos: \n" + ex.Message);
                mensaje.Show();
                return(null);
            }
        }
예제 #6
0
        public Impuesto obtenerImpuestos(int id_impuesto)
        {
            Impuesto impuesto = new Impuesto();

            try
            {
                string sComando = string.Format(
                    "SELECT tasa_impuesto " +
                    "FROM impuestos " +
                    "WHERE id_impuesto = {0};",
                    id_impuesto);

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        impuesto.TASA_IMPUESTO = reader.GetDouble(0);
                    }
                }
                return(impuesto);
            }
            catch (OdbcException ex)
            {
                mensaje = new Mensaje("Error en la operacion con la Base de Datos: \n" + ex.Message);
                mensaje.Show();
                return(null);
            }
        }
예제 #7
0
        //obtener la cantidad de producto posible en la cotizacion
        public int obtenerCantidadProducto(int id_producto, int id_cotizacion_encabezado)
        {
            int dato = 0;

            try
            {
                string sComando = string.Format(
                    "SELECT " +
                    "cantidad_cotizacion " +
                    "FROM cotizaciones_detalle " +
                    "WHERE id_cotizacion_encabezado = {0} AND id_producto = {1};",
                    id_cotizacion_encabezado, id_producto);

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        dato = reader.GetInt32(0);
                    }
                }
                return(dato);
            }
            catch (OdbcException ex)
            {
                mensaje = new Mensaje("Error en la operacion con la Base de Datos: \n" + ex.Message);
                mensaje.Show();
                return(dato);
            }
        }
예제 #8
0
        public void obtenerPrecio(int idMaterial, TextBox txt, string prod)
        {
            try
            {
                string sComando = string.Format("SELECT PRECIO, NOMBRE " +
                                                "FROM material " +
                                                "WHERE material = {0};", idMaterial);

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        txt.Text = reader.GetInt32(0).ToString();
                        prod     = reader.GetString(1);
                    }
                }
                return;
            }
            catch (OdbcException ex)
            {
                MessageBox.Show(ex.ToString(), "Error al obtener reporte");
                return;
            }
        }
예제 #9
0
        //obtener el total de existencias de un producto
        public int obtenerTotalExistenciasPorProducto(int id_producto)
        {
            int dato = 0;

            try
            {
                string sComando = string.Format(
                    "SELECT " +
                    "SUM(existencia_inventario) " +
                    "FROM inventarios " +
                    "WHERE id_producto = {0};",
                    id_producto);

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        dato = reader.GetInt32(0);
                    }
                }
                return(dato);
            }
            catch (OdbcException ex)
            {
                mensaje = new Mensaje("Error en la operacion con la Base de Datos: \n" + ex.Message);
                mensaje.Show();
                return(dato);
            }
        }
예제 #10
0
        public void obtenerAllEncabezados(DataGridView dgv)
        {
            transaccion transaccion = new transaccion();

            try
            {
                string sComando = string.Format("SELECT ID_ENCABEZADO, MEMBRESIA, FECHA_INICIO, ESTADO " +
                                                "FROM renta_encabezado;");

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);
                int            fila   = 0;
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        dgv.Rows.Add();
                        dgv.Rows[fila].Cells[0].Value = reader.GetInt32(0);
                        dgv.Rows[fila].Cells[1].Value = reader.GetInt32(1);
                        dgv.Rows[fila].Cells[2].Value = reader.GetDate(2);
                        dgv.Rows[fila].Cells[3].Value = reader.GetInt32(3);
                        fila++;
                    }
                }
                return;
            }
            catch (OdbcException ex)
            {
                MessageBox.Show(ex.ToString(), "Error al obtener Renta");
                return;
            }
        }
        //obtener datos para el datagrid de detalle de movimiento
        public List <MovimientoDetalle> llenarDGVMovimientoDetalle(int id_movimiento_inventario_encabezado)
        {
            SQL_Producto             producto = new SQL_Producto();
            List <MovimientoDetalle> movimientoDetalleList = new List <MovimientoDetalle>();

            try
            {
                string sComando = string.Format("" +
                                                "SELECT " +
                                                "id_movimiento_inventario_detalle, " +
                                                "id_producto, " +
                                                "cantidad_movimiento, " +
                                                "costo_producto, " +
                                                "precio_producto " +
                                                "FROM movimientos_inventario_detalle " +
                                                "WHERE id_movimiento_inventario_encabezado = {0}; ",
                                                id_movimiento_inventario_encabezado);

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        MovimientoDetalle movimientoDetalleTmp = new MovimientoDetalle();
                        movimientoDetalleTmp.ID_MOVIMIENTO_INVENTARIO_DETALLE = reader.GetInt32(0);
                        movimientoDetalleTmp.PRODUCTO = producto.obtenerProducto(reader.GetInt32(1));
                        movimientoDetalleTmp.CANTIDAD = reader.GetInt32(2);
                        movimientoDetalleTmp.COSTO    = reader.GetDouble(3);
                        movimientoDetalleTmp.PRECIO   = reader.GetDouble(4);
                        movimientoDetalleList.Add(movimientoDetalleTmp);
                    }
                }
                return(movimientoDetalleList);
            }
            catch (OdbcException ex)
            {
                mensaje = new Mensaje("Error en la operacion con la Base de Datos: \n" + ex.Message);
                mensaje.Show();
                return(null);
            }

            return(null);
        }
        //obtener datos para el datagrid de detalle de movimiento
        public List <OrdenCompraDetalle> llenarDGVOrdenDetalle(int id_orden_compra_encabezado)
        {
            SQL_Producto              sql_Producto              = new SQL_Producto();
            SQL_Proveedor             sql_Proveedor             = new SQL_Proveedor();
            SQL_OrdenCompraEncabezado sql_OrdenCompraEncabezado = new SQL_OrdenCompraEncabezado();
            List <OrdenCompraDetalle> ordenCompraDetalle        = new List <OrdenCompraDetalle>();

            try
            {
                string sComando = string.Format("" +
                                                "SELECT " +
                                                "id_orden_compra_detalle, " +
                                                "id_orden_compra_encabezado, " +
                                                "id_proveedor, " +
                                                "id_producto, " +
                                                "cantidad, " +
                                                "precio_unitario " +
                                                "FROM ordenes_compras_detalle " +
                                                "WHERE id_orden_compra_encabezado = {0}; ",
                                                id_orden_compra_encabezado);

                OdbcDataReader reader = transaccion.ConsultarDatos(sComando);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrdenCompraDetalle ordenCompraDetalleTmp = new OrdenCompraDetalle();
                        ordenCompraDetalleTmp.ID_ORDEN_COMPRA_DETALLE    = reader.GetInt32(0);
                        ordenCompraDetalleTmp.ID_ORDEN_COMPRA_ENCABEZADO = sql_OrdenCompraEncabezado.obtenerOrdenEncabezado(reader.GetInt32(1));
                        ordenCompraDetalleTmp.PROVEEDOR       = sql_Proveedor.obtenerProveedor(reader.GetInt32(2));
                        ordenCompraDetalleTmp.PRODUCTO        = sql_Producto.obtenerProducto(reader.GetInt32(3));
                        ordenCompraDetalleTmp.CANTIDAD        = reader.GetInt32(4);
                        ordenCompraDetalleTmp.PRECIO_UNITARIO = reader.GetDouble(5);
                        ordenCompraDetalle.Add(ordenCompraDetalleTmp);
                    }
                }
                return(ordenCompraDetalle);
            }
            catch (OdbcException ex)
            {
                mensaje = new Mensaje("Error en la operacion con la Base de Datos: \n" + ex.Message);
                mensaje.Show();
                return(null);
            }
        }