Ejemplo n.º 1
0
        private void cargarDatosTabla()
        {
            List <DetalleLibroCompras> lista = DetalleLibroComprasBLL.GetDetalleLibroComprasByIdLibro(idLibro);

            foreach (DetalleLibroCompras compra in lista)
            {
                Object[] row = { compra.pkRegistro, compra.intNro, compra.dateFechaFactura, compra.txtNitProeveedor, compra.txtNombreRazon, compra.txtNroFactura, compra.txtNroDUI, compra.txtNroAutorizacion, compra.decImporteTotal, compra.decImporteNOSujeto, compra.decSubTotal, compra.decDescuentos, compra.decImporteBaseCF, compra.decCreditoFiscal, compra.txtCodigoControl, compra.txtTipoCompra };
                gdDetalleLibroCompras.Rows.Add(row);
            }
            gdDetalleLibroCompras.Refresh();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
 private void gdLibrosCompras_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == btnEditar.Index)
     {
         frmInsertarLibroCompras frm = new frmInsertarLibroCompras(Convert.ToInt32(gdLibrosCompras.Rows[e.RowIndex].Cells[0].Value), 1);
         frm.MdiParent   = this.MdiParent;
         frm.WindowState = FormWindowState.Maximized;
         frm.Show();
         this.Dispose();
     }
     if (e.ColumnIndex == btnExportar.Index)
     {
         FolderBrowserDialog sf = new FolderBrowserDialog();
         // Feed the dummy name to the save dialog
         DialogResult result = sf.ShowDialog();
         if (result == DialogResult.OK)
         {
             string savePath = sf.SelectedPath + "\\" + gdLibrosCompras.Rows[e.RowIndex].Cells[1].Value.ToString() + gdLibrosCompras.Rows[e.RowIndex].Cells[2].Value.ToString() + "LC.txt";
             using (StreamWriter writer = new StreamWriter(savePath, false))
             {
                 List <DetalleLibroCompras> detalles = DetalleLibroComprasBLL.GetDetalleLibroComprasByIdLibro(Convert.ToInt32(gdLibrosCompras.Rows[e.RowIndex].Cells[0].Value.ToString()));
                 foreach (DetalleLibroCompras detalle in detalles)
                 {
                     writer.WriteLine(detalle.intEspecificacion + "|" + detalle.intNro + "|" + detalle.dateFechaFactura.ToShortDateString() + "|" + detalle.txtNitProeveedor + "|" + detalle.txtNombreRazon + "|" + detalle.txtNroFactura + "|" +
                                      detalle.txtNroDUI + "|" + detalle.txtNroAutorizacion + "|" + detalle.decImporteTotal.ToString().Replace(',', '.') + "|" + detalle.decImporteNOSujeto.ToString().Replace(',', '.') + "|" + detalle.decSubTotal.ToString().Replace(',', '.') + "|" + detalle.decDescuentos.ToString().Replace(',', '.') + "|" +
                                      detalle.decImporteBaseCF.ToString().Replace(',', '.') + "|" + detalle.decCreditoFiscal.ToString().Replace(',', '.') + "|" + detalle.txtCodigoControl + "|" + detalle.txtTipoCompra + "\n");
                 }
             }
             MessageBox.Show("El archivo se guardó en la ruta " + savePath);
         }
     }
     if (e.ColumnIndex == btnImprimir.Index)
     {
         frmReporteLibroCompra frm = new frmReporteLibroCompra();
         frm.IdLibro     = Convert.ToInt32(gdLibrosCompras.Rows[e.RowIndex].Cells[0].Value);
         frm.MdiParent   = this.MdiParent;
         frm.WindowState = FormWindowState.Maximized;
         frm.Show();
         this.Dispose();
     }
 }