Ejemplo n.º 1
0
 private void modificarbtn_Click(object sender, EventArgs e)
 {
     if (Numero_Factxt.Text == "" || Numero_Factxt.Text == "..." || Fecha_ventasdtp.Text == "" || estadocmbx.Text == "" || forma_pagocmbx.Text == "" || empleadotxt.Text == "" || clientetxt.Text == "")
     {
         obj_mensajes.Campos_vacios();
     }
     else
     {
         try
         {
             Lógica.Clase_Venta modificar = new Clase_Venta();
             int    nu_Fac           = int.Parse(Numero_Factxt.Text);
             string fecha_Fac        = Fecha_ventasdtp.Text;
             long   subtotal_v       = 0;
             long   iva_v            = 0;
             long   total_facv       = 0;
             int    id_clientefv     = int.Parse(clientetxt.SelectedValue.ToString());
             int    id_Estadofv      = int.Parse(estadocmbx.SelectedValue.ToString());
             int    id_empleadofv    = int.Parse(empleadotxt.SelectedValue.ToString());
             int    id_forma_pago_fv = int.Parse(forma_pagocmbx.SelectedValue.ToString());
             int    resultado        = modificar.modificar_Venta(nu_Fac, fecha_Fac, subtotal_v, iva_v, total_facv, id_clientefv, id_Estadofv, id_empleadofv, id_forma_pago_fv);
             if (resultado > 0)
             {
                 obj_mensajes.Modificar();
             }
         }
         catch (SqlException ex)
         {
             MessageBox.Show("" + ex);
         }
     }
 }
Ejemplo n.º 2
0
 private void guardarbtn_Click(object sender, EventArgs e)
 {
     if (Fecha_ventasdtp.Text == "" || estadocmbx.Text == "" || forma_pagocmbx.Text == "" || empleadotxt.Text == "" || clientetxt.Text == "")
     {
         obj_mensajes.Campos_vacios();
     }
     else
     {
         try
         {
             Lógica.Clase_Venta insertar  = new Clase_Venta();
             string             fecha_Fac = Fecha_ventasdtp.Text;
             long subtotal_v       = 0;
             long iva_v            = 0;
             long total_facv       = 0;
             int  id_clientefv     = int.Parse(clientetxt.SelectedValue.ToString());
             int  id_Estadofv      = int.Parse(estadocmbx.SelectedValue.ToString());
             int  id_empleadofv    = int.Parse(empleadotxt.SelectedValue.ToString());
             int  id_forma_pago_fv = int.Parse(forma_pagocmbx.SelectedValue.ToString());
             int  resultado        = insertar.ingresar_ventas(fecha_Fac, subtotal_v, iva_v, total_facv, id_clientefv, id_Estadofv, id_empleadofv, id_forma_pago_fv);
             if (resultado > 0)
             {
                 obj_mensajes.Agregar();
                 DataTable nu = Lógica.Clase_Venta.identityventa();
                 Numero_Factxt.Text      = nu.Rows[0][0].ToString();
                 detallepnl.Enabled      = true;
                 Detalle_dtgrdvw.Enabled = true;
             }
         }
         catch (SqlException ex)
         {
             MessageBox.Show("" + ex);
         }
     }
 }
Ejemplo n.º 3
0
 private void generar_facturabtn_Click(object sender, EventArgs e)
 {
     if (Numero_Factxt.Text == "" || Numero_Factxt.Text == "..." || Fecha_ventasdtp.Text == "" || estadocmbx.Text == "" || forma_pagocmbx.Text == "" || empleadotxt.Text == "" || clientetxt.Text == "" || subtotaltxt.Text == "..." || ivatxt.Text == "..." || Totaltxt.Text == "...")
     {
         obj_mensajes.Campos_vacios();
     }
     else
     {
         try
         {
             Lógica.Clase_Venta modificar = new Clase_Venta();
             int    nu_Fac           = int.Parse(Numero_Factxt.Text);
             string fecha_Fac        = Fecha_ventasdtp.Text;
             long   subtotal_v       = long.Parse(subtotaltxt.Text);
             long   iva_v            = long.Parse(ivatxt.Text);
             long   total_facv       = long.Parse(Totaltxt.Text);
             int    id_clientefv     = int.Parse(clientetxt.SelectedValue.ToString());
             int    id_Estadofv      = int.Parse(estadocmbx.SelectedValue.ToString());
             int    id_empleadofv    = int.Parse(empleadotxt.SelectedValue.ToString());
             int    id_forma_pago_fv = int.Parse(forma_pagocmbx.SelectedValue.ToString());
             int    resultado        = modificar.modificar_Venta(nu_Fac, fecha_Fac, subtotal_v, iva_v, total_facv, id_clientefv, id_Estadofv, id_empleadofv, id_forma_pago_fv);
             if (resultado > 0)
             {
                 MessageBox.Show("Factura Generada Con Éxito!");
                 DataTable venta = Lógica.Clase_Venta.llenarventa();
                 Ventasdtgrdvw.DataSource = venta;
                 limpiar_datos();
                 Detalle_dtgrdvw.Rows.Clear();
                 detallepnl.Enabled      = false;
                 Detalle_dtgrdvw.Enabled = false;
                 subtotaltxt.Text        = "...";
                 ivatxt.Text             = "...";
                 Totaltxt.Text           = "...";
             }
         }
         catch (SqlException ex)
         {
             MessageBox.Show("" + ex);
         }
     }
 }