public frmInsertarLibroCompras(int idUser, int pkLibro) { InitializeComponent(); this.Text = "Actualizar Libro de Compras"; user = idUser; idLibro = pkLibro; libro = LibroComprasBLL.GetLibroComprasById(idLibro); txtMonth.Text = libro.txtMes; txtYear.Text = libro.txtAño; cargarDatosTabla(); gdDetalleLibroCompras.Refresh(); }
private void frmReporteLibroCompra_Load(object sender, EventArgs e) { ; // TODO: This line of code loads data into the 'detalleLibroComprasDS.DetalleLibroCompras' table. You can move, or remove it, as needed. libro = LibroComprasBLL.GetLibroComprasById(idLibro); List <DetalleLibroCompras> detalles = DetalleLibroComprasBLL.GetDetalleLibroComprasByIdLibro(libro.pkLibro); ReportDataSource dt = new ReportDataSource("LC", detalles); ReportParameter pYear = new ReportParameter("Year", libro.txtAño); ReportParameter pMonth = new ReportParameter("Month", libro.txtMes); this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { pYear }); this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { pMonth }); this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(dt); this.reportViewer1.RefreshReport(); }
private void btnGuardar_Click(object sender, EventArgs e) { if (idLibro != 0) { foreach (DataGridViewRow fila in gdDetalleLibroCompras.Rows) { double total = Convert.ToDouble(fila.Cells["txtImporteTotal"].Value); double noSujeto = Convert.ToDouble(fila.Cells["txtImporteNOSujeto"].Value); double subtotal = Convert.ToDouble(fila.Cells["txtSubTotal"].Value); double descuentos = Convert.ToDouble(fila.Cells["txtDescuentos"].Value); double baseCF = Convert.ToDouble(fila.Cells["txtImporteBaseCF"].Value); double creditoFiscal = Convert.ToDouble(fila.Cells["txtCreditoFiscal"].Value); if (fila.Cells["txtIdRegistro"].Value.ToString() != "-1") { DetalleLibroComprasBLL.UpdateDetalle(Convert.ToInt32(fila.Cells["txtIdRegistro"].Value), Convert.ToInt32(fila.Cells["txtNro"].Value), Convert.ToDateTime(fila.Cells["dateFechaFactura"].Value), fila.Cells["txtNitProveedor"].Value.ToString(), fila.Cells["txtNombreRazon"].Value.ToString(), fila.Cells["txtNroFactura"].Value.ToString(), fila.Cells["txtNroDUI"].Value.ToString(), fila.Cells["txtNroAutorizacion"].Value.ToString(), Convert.ToDecimal(total), Convert.ToDecimal(noSujeto), Convert.ToDecimal(subtotal), Convert.ToDecimal(descuentos), Convert.ToDecimal(baseCF), Convert.ToDecimal(creditoFiscal), fila.Cells["txtCodigoControl"].Value.ToString(), fila.Cells["txtTipoCompra"].Value.ToString(), idLibro, user); } else { DetalleLibroComprasBLL.InsertDatosDetalleLibroCompras(Convert.ToInt32(fila.Cells["txtNro"].Value), Convert.ToDateTime(fila.Cells["dateFechaFactura"].Value), fila.Cells["txtNitProveedor"].Value.ToString(), fila.Cells["txtNombreRazon"].Value.ToString(), fila.Cells["txtNroFactura"].Value.ToString(), fila.Cells["txtNroDUI"].Value.ToString(), fila.Cells["txtNroAutorizacion"].Value.ToString(), Convert.ToDecimal(total), Convert.ToDecimal(noSujeto), Convert.ToDecimal(subtotal), Convert.ToDecimal(descuentos), Convert.ToDecimal(baseCF), Convert.ToDecimal(creditoFiscal), fila.Cells["txtCodigoControl"].Value.ToString(), fila.Cells["txtTipoCompra"].Value.ToString(), idLibro, user); } } } else { idLibro = LibroComprasBLL.InsertDatosLibroCompras(txtMonth.Text, txtYear.Text); foreach (DataGridViewRow fila in gdDetalleLibroCompras.Rows) { double total = Convert.ToDouble(fila.Cells["txtImporteTotal"].Value); double noSujeto = Convert.ToDouble(fila.Cells["txtImporteNOSujeto"].Value); double subtotal = Convert.ToDouble(fila.Cells["txtSubTotal"].Value); double descuentos = Convert.ToDouble(fila.Cells["txtDescuentos"].Value); double baseCF = Convert.ToDouble(fila.Cells["txtImporteBaseCF"].Value); double creditoFiscal = Convert.ToDouble(fila.Cells["txtCreditoFiscal"].Value); DetalleLibroComprasBLL.InsertDatosDetalleLibroCompras(Convert.ToInt32(fila.Cells["txtNro"].Value), Convert.ToDateTime(fila.Cells["dateFechaFactura"].Value), fila.Cells["txtNitProveedor"].Value.ToString(), fila.Cells["txtNombreRazon"].Value.ToString(), fila.Cells["txtNroFactura"].Value.ToString(), fila.Cells["txtNroDUI"].Value.ToString(), fila.Cells["txtNroAutorizacion"].Value.ToString(), Convert.ToDecimal(total), Convert.ToDecimal(noSujeto), Convert.ToDecimal(subtotal), Convert.ToDecimal(descuentos), Convert.ToDecimal(baseCF), Convert.ToDecimal(creditoFiscal), fila.Cells["txtCodigoControl"].Value.ToString(), fila.Cells["txtTipoCompra"].Value.ToString(), idLibro, user); } MessageBox.Show("Se agregó correctamente el Libro de Compras"); } }
public void cargarDatosToGrid() { gdLibrosCompras.DataSource = LibroComprasBLL.SelectAll(); }