private void btnFacturar_Click(object sender, EventArgs e) { if (cont_fila != 0) { total = Convert.ToDouble(lblTotal.Text); try { string cmd = string.Format("Exec ActualizarFacturas '{0}'", Obtener_Id_Cliente(tbDniCliente.Text)); DataSet ds = Utilidades.Ejecutar(cmd); string num_factura = ds.Tables[0].Rows[0]["num_factura"].ToString().Trim(); foreach (DataGridViewRow fila in dgvFacturacion.Rows) { cmd = string.Format("Exec ActualizarDetalles '{0}','{1}','{2}','{3}','{4}'", Convert.ToInt32(num_factura), Convert.ToInt32(fila.Cells[0].Value.ToString()), fila.Cells[2].Value.ToString(), fila.Cells[3].Value.ToString(), fila.Cells[4].Value.ToString()); ds = Utilidades.Ejecutar(cmd); NRegistro_Acciones.Insertar(NProducto.RestarStock(NProducto.Obtener_Id_Producto(fila.Cells[0].Value.ToString()), Convert.ToInt32(fila.Cells[3].Value.ToString()))); //Convert.ToDouble(fila.Cells[2].Value.ToString()) Convert.ToDouble(fila.Cells[4].Value.ToString()) } cmd = "Exec DatosFactura " + num_factura; ds = Utilidades.Ejecutar(cmd); FrmReporte rp = new FrmReporte(); rp.reportViewer1.LocalReport.DataSources[0].Value = ds.Tables[0]; rp.reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout); rp.ShowDialog(); Nuevo(); cont_fila = 0; } catch (SqlException ex) { MessageBox.Show(ex.Message); } } }
private void frmRegistroAcciones_Load(object sender, EventArgs e) { NRegistro_Acciones.Mostrar(dgvRegistroAcciones); }