Esempio n. 1
0
 private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
 {
     c = new Consultas();
     try
     {
         if (e.KeyChar == (char)Keys.Return)
         {
             em = c.ConsutarFactura(int.Parse(txtSucursal.Text), int.Parse(txtCaja.Text), int.Parse(txtNumFact.Text), 2);
             if (em != null)
             {
                 product = c.detalleFact;
                 if (product.Count > 0)
                 {
                     limpiarDGV();
                     llenarDgV();
                     lblUsuario.Text            = "Usuario: " + em.NombreUsuario;
                     txtCliente.Text            = em.NombresCliente;
                     DgvDetalleFact.CurrentCell = DgvDetalleFact.Rows[0].Cells[0];
                     DgvDetalleFact.BeginEdit(true);
                 }
                 else
                 {
                     MessageBox.Show("Todos los Items de esta factura ya Fueron dados de baja.");
                     LimpiarTodo();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("" + ex.Message);
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         c = new Consultas();
         if (txtSucursal.Text != "" && txtCaja.Text != "" && txtNumFact.Text != "")
         {
             em = c.ConsutarFactura(int.Parse(txtSucursal.Text), int.Parse(txtCaja.Text), int.Parse(txtNumFact.Text), 1);
             if (em != null)
             {
                 p        = c.detalleFact;
                 detapago = c.detallepagoreim;
                 if (p.Count > 0)
                 {
                     Imprimirfact();
                     FrmFactura.verificadorfrm = 4;
                     this.Close();
                 }
                 //MessageBox.Show("Cantidad Productos: "+p.Count);
             }
             else
             {
                 MessageBox.Show("No se pudo encontrar una factura con esa serie.");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void txtNumFact_KeyPress(object sender, KeyPressEventArgs e)
 {
     try
     {
         c = new Consultas();
         if (e.KeyChar == (char)Keys.Return)
         {
             if (txtNumFact.Text != "")
             {
                 em = c.ConsutarFactura(int.Parse(txtSucursal.Text), int.Parse(txtCaja.Text), int.Parse(txtNumFact.Text), 1);
                 if (em != null)
                 {
                     p        = c.detalleFact;
                     detapago = c.detallepagoreim;
                     if (p.Count > 0)
                     {
                         Imprimirfact();
                         FrmFactura.verificadorfrm = 4;
                         this.Close();
                     }
                 }
                 else
                 {
                     //MessageBox.Show("No se pudo encontrar una factura con esa serie.");
                 }
             }
         }
         else
         {
             Funcion.Validar_Numeros(e);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 4
0
        private void txtModificarVer_Click(object sender, EventArgs e)
        {
            if (dgvDatosProducto.RowCount > 0 && dgvDatosProducto.CurrentRow.Cells[1].Value != null)
            {
                modificar                  = true;
                BtnGuardar.Text            = "Modificar";
                encabezadoNotaCreditoVenta = Convert.ToInt32(dgvDatosProducto.CurrentRow.Cells[6].Value);
                tabControl1.SelectedIndex  = 0;
                DataTable encabezadoPie = c.BoolDataTable("select * from TbEncabezadoNotaDebito where IDENCABEZADONOTADEBITO = " + encabezadoNotaCreditoVenta);
                if (encabezadoPie.Rows.Count > 0)
                {
                    DataRow rowEncabezado = encabezadoPie.Rows[0];
                    txtSerie1ND.Text = rowEncabezado["SERIE1"].ToString();
                    txtSerie2ND.Text = rowEncabezado["SERIE2"].ToString();
                    txtNumeroND.Text = rowEncabezado["NUMERO"].ToString();

                    string seriefactura = dgvDatosProducto.CurrentRow.Cells[2].Value.ToString();
                    txtSucursal.Text = seriefactura.Substring(0, 3);
                    txtCaja.Text     = seriefactura.Substring(3, 3);
                    txtNumFact.Text  = seriefactura.Substring(6, 9);

                    txtCliente.Text         = dgvDatosProducto.CurrentRow.Cells[3].Value.ToString();
                    txtTotalDevolucion.Text = dgvDatosProducto.CurrentRow.Cells[4].Value.ToString();
                    txtTotalFactura.Text    = dgvDatosProducto.CurrentRow.Cells[5].Value.ToString();
                    DataTable detalleNotaCreditoVentas = c.BoolDataTable("select * from TbDetalleNotaDebito where IDENCABEZADONOTADEBITO = " + dgvDatosProducto.CurrentRow.Cells[6].Value);
                    if (detalleNotaCreditoVentas.Rows.Count > 0)
                    {
                        em = c.ConsutarFactura(int.Parse(txtSucursal.Text), int.Parse(txtCaja.Text), int.Parse(txtNumFact.Text), 2);
                        if (em != null)
                        {
                            product = c.detalleFact;
                            if (product.Count > 0)
                            {
                                limpiarDGV();
                                llenarDgV();
                                lblUsuario.Text            = "Usuario: " + em.NombreUsuario;
                                txtCliente.Text            = em.NombresCliente;
                                DgvDetalleFact.CurrentCell = DgvDetalleFact.Rows[0].Cells[0];
                                DgvDetalleFact.BeginEdit(true);
                            }
                            else
                            {
                                MessageBox.Show("Todos los Items de esta factura ya Fueron dados de baja.");
                                LimpiarTodo();
                            }
                        }

                        for (int i = 0; i < detalleNotaCreditoVentas.Rows.Count; i++)
                        {
                            DataRow rowDetalleCredito = detalleNotaCreditoVentas.Rows[i];
                            if (DgvDetalleFact.Rows[i].Cells[0].Value != null)
                            {
                                if (DgvDetalleFact.Rows[i].Cells[0].Value.ToString() == rowDetalleCredito["CODIGOBARRA"].ToString())
                                {
                                    DgvDetalleFact.Rows[i].Cells[6].Value = rowDetalleCredito["CANTIDAD"].ToString();
                                }
                                if (DgvDetalleFact.Rows[i].Cells[6].Value.ToString() != "0")
                                {
                                    DgvDetalleFact.Rows[i].Cells[7].Value = true;
                                }
                            }
                        }
                    }
                }
            }
        }