示例#1
0
 private void BtnSeleccionar_Click(object sender, EventArgs e)
 {
     if (DgvCliente.SelectedRows.Count > 0)
     {
         int rowindex = DgvCliente.CurrentRow.Index;
         if (rowindex != -1)
         {
             try
             {
                 Frm_Registrar_Venta frm = Owner as Frm_Registrar_Venta;
                 frm.LblIDCliente.Text       = DgvCliente.CurrentRow.Cells[0].Value.ToString();
                 frm.TxtNumeroDocumento.Text = DgvCliente.CurrentRow.Cells[2].Value.ToString();
                 frm.TxtNombres.Text         = DgvCliente.CurrentRow.Cells[3].Value.ToString() + " " + DgvCliente.CurrentRow.Cells[4].Value.ToString();
                 string direccion = DgvCliente.CurrentRow.Cells[8].Value.ToString() + ", " + DgvCliente.CurrentRow.Cells[7].Value.ToString();
                 frm.TxtDireccion.Text = direccion;
                 Close();
             }
             catch
             {
                 //
             }
         }
     }
     else
     {
         MessageBox.Show("Seleccione un registro");
     }
 }
        private void BtnNuevaVenta_Click(object sender, EventArgs e)
        {
            Frm_Registrar_Venta frm = new Frm_Registrar_Venta();

            AddOwnedForm(frm);
            frm.ShowDialog();
        }
示例#3
0
 private void BtnSeleccionar_Click(object sender, EventArgs e)
 {
     if (DgvProducto.SelectedRows.Count > 0)
     {
         int rowindex = DgvProducto.CurrentRow.Index;
         if (rowindex != -1)
         {
             try
             {
                 Frm_Registrar_Venta frm = Owner as Frm_Registrar_Venta;
                 string codigoproducto   = DgvProducto.CurrentRow.Cells[3].Value.ToString();
                 frm.TxtProducto.Text = codigoproducto;
                 NProducto boProducto = new NProducto();
                 EProducto producto   = boProducto.Seleccionar(codigoproducto);
                 if (string.IsNullOrEmpty(producto.Codigo))
                 {
                     MessageBox.Show("No Existe Producto", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 }
                 else
                 {
                     NInventario boInventario = new NInventario();
                     EInventario inventario   = boInventario.Seleccionar(producto.Codigo);
                     if (!string.IsNullOrEmpty(inventario.Producto))
                     {
                         if (inventario.Existencias > 0)
                         {
                             double utilidad    = Frm_Principal.ValorUtilidad;
                             double precioventa = Math.Round((inventario.ValorUnitario * utilidad), 2);
                             frm.AddItems(producto, 1, precioventa);
                             //Mostrar imagen
                             if (!string.IsNullOrEmpty(producto.Imagen))
                             {
                                 frm.PbxImgProducto.Image = Image.FromFile(CarpetaImagen + "/" + producto.Imagen);
                             }
                         }
                         else
                         {
                             MessageBox.Show("No hay Cantidad Suficiente");
                         }
                     }
                 }
                 Close();
             }
             catch
             {
                 //
             }
         }
     }
     else
     {
         MessageBox.Show("Seleccione un registro");
     }
 }