Exemple #1
0
 private void NumericUpDownCantidad_Llenar(object sender, EventArgs e)
 {
     if (this.NumericUpDownCantidad.Enabled)
     {
         this.NumericUpDownCantidad.Maximum = (decimal)(ConsultasBaseDeDatos.ObtenerValorFloatDeBDLuiguiBaretta("Select Cantidad From Producto Where Descripcion Like '"
                                                                                                                + this.ComboBoxDescripcionDelProducto.Text + "' And Talla Like '" + this.ComboBoxTalla.Text + "'") - Valor_paraNumericdecimal());
         if (this.NumericUpDownCantidad.Maximum > 0)
         {
             this.NumericUpDownCantidad.Minimum = 1;
             this.LabelCantidadMax.Text         = "Max " + this.NumericUpDownCantidad.Maximum;
             this.LabelError.Visible            = false;
             this.ButtonAnadirVenta.Enabled     = true;
         }
         else
         {
             this.LabelError.Text           = "La cantidad del producto seleccionado es 0";
             this.LabelCantidadMax.Text     = "Max 0";
             this.LabelError.Visible        = true;
             this.ButtonAnadirVenta.Enabled = false;
         }
     }
     else
     {
         this.NumericUpDownCantidad.Maximum = 0;
     }
 }
Exemple #2
0
        private void ButtonPagar_Click(object sender, EventArgs e)
        {
            try
            {
                ConsultasBaseDeDatos.EjecutarProcedimientoEnBDLuiguiBaretta("Exec RegistrarVenta '" +
                                                                            this.ComboBoxAlmacen.Text + "', '" +
                                                                            this.ComboBoxDireccion.Text + "', '" +
                                                                            DateTime.Now.ToString("yyyy-MM-dd") + "', " +
                                                                            this.LabelTotalNum.Text + ", " +
                                                                            this.TextBoxPagar.Text);

                int ID_Venta = (int)ConsultasBaseDeDatos.ObtenerValorEnteroDeBDLuiguiBaretta("Select Max(ID_Venta) from Venta");
                for (int x = 0; x < this.DataGridViewVentas.Rows.Count; x++)
                {
                    ConsultasBaseDeDatos.EjecutarProcedimientoEnBDLuiguiBaretta("Exec RegistrarVentaProducto " +
                                                                                ID_Venta + ", '" +
                                                                                this.DataGridViewVentas.Rows[x].Cells[0].Value + "', " +
                                                                                this.DataGridViewVentas.Rows[x].Cells[1].Value + ", " +
                                                                                this.DataGridViewVentas.Rows[x].Cells[2].Value);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "A ocurrido un Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                MessageBox.Show("Venta terminada con éxito", "Venta", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LimpiarVenta();
            }
        }
        public void EstablecerFiltro(ref DataGridView vacio, String Cadena)
        {
            string salida_de_datos = "";

            string[] palabras_busqueda = Cadena.Split(' ');
            foreach (string palabra in palabras_busqueda)
            {
                if (salida_de_datos.Length == 0)
                {
                    salida_de_datos = "(Cast(ID_Venta As varchar(30)) Like '%" + palabra + "%' OR " +
                                      "Almacen Like '%" + palabra + "%' OR " +
                                      "Direccion Like '%" + palabra + "%' OR " +
                                      "Fecha Like '%" + palabra + "%' OR " +
                                      "Cast(Total As varchar(30)) Like '%" + palabra + "%' OR " +
                                      "Cast(Pago As varchar(30)) Like '%" + palabra + "%')";
                }
                else
                {
                    salida_de_datos += " And (Cast(ID_Venta As varchar(30)) Like '%" + palabra + "%' OR " +
                                       "Almacen Like '%" + palabra + "%' OR " +
                                       "Direccion Like '%" + palabra + "%' OR " +
                                       "Fecha Like '%" + palabra + "%' OR " +
                                       "Cast(Total As varchar(30)) Like '%" + palabra + "%' OR " +
                                       "Cast(Pago As varchar(30)) Like '%" + palabra + "%')";
                }
            }
            Filtro           = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select * from VistaVenta where " + salida_de_datos);
            vacio.DataSource = Filtro;
            PintarDeudores(ref vacio);
        }
 public void EstableceProductos(ref DataGridView dataGridView, int id_Venta)
 {
     Productos = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("SELECT dbo.Producto.Descripcion, dbo.VentaProducto.Cantidad FROM dbo.Producto " +
                                                                    "INNER JOIN dbo.VentaProducto ON dbo.Producto.Id_Producto = dbo.VentaProducto.ID_Producto and ID_Venta = " + id_Venta);
     dataGridView.DataSource       = Productos;
     dataGridView.Columns[0].Width = 147;
     dataGridView.Columns[1].Width = 45;
 }
 private void ButtonActualizarPago_Click(object sender, EventArgs e)
 {
     ConsultasBaseDeDatos.EjecutarProcedimientoEnBDLuiguiBaretta("exec pago_opc1 '" +
                                                                 TextBoxNuevoPago.Text + "', '" +
                                                                 DatagridViewRegistroDeVentas.CurrentRow.Cells[0].Value.ToString() + "', '" +
                                                                 LabelNumDeuda.Text + "'");
     Registro_De_Ventas.EstablecerDatos(ref DatagridViewRegistroDeVentas);
     MessageBox.Show("Pago Realizado con éxito", "Pago Realizado", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Exemple #6
0
        private void ButtonAnadirVenta_Click(object sender, EventArgs e)
        {
            float Precio = ConsultasBaseDeDatos.ObtenerValorFloatDeBDLuiguiBaretta("Select (PrecioVenta * GrupoPaquete) From Producto Where Descripcion Like '" +
                                                                                   ComboBoxDescripcionDelProducto.Text + "' And Talla Like '" + ComboBoxTalla.Text + "'");

            Precio *= (float)NumericUpDownCantidad.Value;
            this.DataGridViewVentas.Rows.Add(ComboBoxDescripcionDelProducto.Text, ComboBoxTalla.Text, NumericUpDownCantidad.Value, Precio);
            this.ButtonDeshacer.Enabled = true;
            this.TextBoxPagar.Enabled   = true;
            EstablecerValoresTotales();
        }
Exemple #7
0
 private void ComboBoxDescripcionDelProducto_Llenar(object sender, EventArgs e)
 {
     if (this.ComboBoxDescripcionDelProducto.Enabled)
     {
         this.ComboBoxDescripcionDelProducto.DataSource    = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select Descripcion From Producto Group By Descripcion");
         this.ComboBoxDescripcionDelProducto.DisplayMember = "Descripcion";
     }
     else
     {
         this.ComboBoxDescripcionDelProducto.DataSource = null;
     }
 }
Exemple #8
0
 private void ComboBoxAlmacen_Llenar(object sender, EventArgs e)
 {
     if (this.ComboBoxAlmacen.Enabled)
     {
         this.ComboBoxAlmacen.DataSource    = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select Almacen From Cliente Group By Almacen");
         this.ComboBoxAlmacen.DisplayMember = "Almacen";
     }
     else
     {
         this.ComboBoxAlmacen.DataSource = null;
     }
 }
Exemple #9
0
 private void ComboBoxTalla_Llenar(object sender, EventArgs e)
 {
     if (this.ComboBoxTalla.Enabled)
     {
         this.ComboBoxTalla.DataSource = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select Talla From Producto Where Descripcion Like '" +
                                                                                            this.ComboBoxDescripcionDelProducto.Text + "'");
         this.ComboBoxTalla.DisplayMember = "Talla";
     }
     else
     {
         this.ComboBoxTalla.DataSource = null;
     }
 }
Exemple #10
0
 private void ComboBoxDireccion_Llenar(object sender, EventArgs e)
 {
     if (this.ComboBoxDireccion.Enabled)
     {
         this.ComboBoxDireccion.DataSource = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select Direccion From Cliente Where Almacen Like '" +
                                                                                                this.ComboBoxAlmacen.Text + "'");
         this.ComboBoxDireccion.DisplayMember = "Direccion";
     }
     else
     {
         this.ComboBoxDireccion.DataSource = null;
     }
 }
 public void EstablecerRango_fecha(ref DataGridView vacio, string fecha1, string fecha2)
 {
     Rango            = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select * from VistaVenta where fecha between '" + fecha1 + "' and '" + fecha2 + "'");
     vacio.DataSource = Rango;
     PintarDeudores(ref vacio);
 }