private void button1_Click(object sender, EventArgs e) { Principal.CodigoPrincipalAbm = "31"; FrmVerReportePresupuesto frm = new FrmVerReportePresupuesto(); frm.Show(); }
private void btnImprimir_Click(object sender, EventArgs e) { if (Grilla.CurrentRow == null) { Mensaje("Debe seleccionar un registro"); return; } Principal.CodigoPrincipalAbm = Grilla.CurrentRow.Cells[0].Value.ToString(); FrmVerReportePresupuesto frm = new FrmVerReportePresupuesto(); frm.Show(); }
private void GrabarPresupuesto() { SqlTransaction Transaccion; SqlConnection con = new SqlConnection(cConexion.GetConexion()); con.Open(); Transaccion = con.BeginTransaction(); DateTime Fecha = Convert.ToDateTime(txtFecha.Text); Int32? CodVendedor = null; string Nombre = "", Apellido = ""; string NroDocumento = "", Telefono = ""; string Direccion = ""; Int32? CodCiudad = null; cVendedor vendedor = new cVendedor(); Nombre = txtNombre.Text; Apellido = txtApellido.Text; Telefono = txtTelefono.Text; NroDocumento = txtNroDocumento.Text; Direccion = txtDireccion.Text; string Ciudad = "", Provincia = ""; string DomicilioCompleto = ""; if (cmbCiudad.SelectedIndex > 0) { CodCiudad = Convert.ToInt32(cmbCiudad.SelectedValue); Ciudad = cmbCiudad.Text; } if (cmbProvincia.SelectedIndex > 0) { Provincia = cmbProvincia.Text; } if (Direccion != "") { DomicilioCompleto = Direccion; } if (Ciudad != "") { DomicilioCompleto = DomicilioCompleto + " " + Ciudad; } if (Provincia != "") { DomicilioCompleto = DomicilioCompleto + " " + Provincia; } Int32 CodPresupuesto = 0; Int32 CodJoya = 0; Double Precio = 0; Int32 Cantidad = 0; DateTime?FechaRendicion = null; Double SubTotal = 0; Double Total = 0; if (txtTotal.Text != "") { Total = Convert.ToDouble(txtTotal.Text); } if (txtFechaRendicion.Text != " / /") { FechaRendicion = Convert.ToDateTime(txtFechaRendicion.Text); } // string Col = "CodArticulo;Nombre;Precio;Cantidad;Subtotal"; int Orden = 1; cPresupuesto pre = new cPresupuesto(); try { if (txtCodVendedor.Text == "") { CodVendedor = (Int32)vendedor.InsertarVendedorTran(con, Transaccion, Apellido, Nombre, Telefono, NroDocumento, Direccion, CodCiudad, DomicilioCompleto); } else { CodVendedor = Convert.ToInt32(txtCodVendedor.Text); vendedor.ActualizarVendedor(con, Transaccion, Convert.ToInt32(CodVendedor), Apellido, Nombre, Telefono, NroDocumento, Direccion, CodCiudad, DomicilioCompleto); } CodPresupuesto = pre.InsertarPresupuesto(con, Transaccion, Total, Fecha , CodVendedor, FechaRendicion); Principal.CodigoSenia = CodPresupuesto.ToString(); string NroPresupuesto = GetNroPresupueto(CodPresupuesto.ToString()); pre.ActualizarNroPresupuesto(con, Transaccion, CodPresupuesto, NroPresupuesto); for (int i = 0; i < tbDetalle.Rows.Count; i++) { CodJoya = Convert.ToInt32(tbDetalle.Rows[i]["CodJoya"].ToString()); Precio = Convert.ToDouble(tbDetalle.Rows[i]["Precio"].ToString()); Cantidad = Convert.ToInt32(tbDetalle.Rows[i]["Cantidad"].ToString()); SubTotal = Convert.ToDouble(tbDetalle.Rows[i]["SubTotal"].ToString()); pre.InsertarDetalle(con, Transaccion, CodPresupuesto, Cantidad, Precio, CodJoya, SubTotal, Orden); Orden++; } Transaccion.Commit(); con.Close(); Mensaje("Datos grabados correctamente"); Principal.CodigoPrincipalAbm = CodPresupuesto.ToString(); FrmVerReportePresupuesto frm = new FrmVerReportePresupuesto(); frm.Show(); Limpiar(); // FrmReporte frm = new SistemaFact.FrmReporte(); // frm.Show(); // this.GetJugadorxCodigoTableAdapter.Fill(this.DataSet1.GetJugadorxCodigo, Codigo); } catch (Exception exa) { MessageBox.Show(exa.Message.ToString()); Transaccion.Rollback(); con.Close(); Mensaje("Hubo un error en el proceso de grabacion"); Mensaje(exa.Message); } }