private void dgvDatos_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (IndexColumna("clmVer") == e.ColumnIndex) { if (cmbTipo.Text == "Ventas") { PDFInvoice.CreatePDF(TipoInvoice.Venta, ValorCelda(e.RowIndex, "clmFolio"), ValorCelda(e.RowIndex, "clmFecha"), obtenerProductos(ValorCelda(e.RowIndex, "clmFolio")), c, impuesto); PDFFile.Ver(Application.StartupPath + "\\Invoice.pdf"); } else { PDFInvoice.CreatePDF(TipoInvoice.Cotizacions, ValorCelda(e.RowIndex, "clmFolio"), ValorCelda(e.RowIndex, "clmFecha"), obtenerProductosCo(ValorCelda(e.RowIndex, "clmFolio")), c, impuesto); PDFFile.Ver(Application.StartupPath + "\\Invoice.pdf"); } } else if (IndexColumna("clmImprimir") == e.ColumnIndex) { if (cmbTipo.Text == "Ventas") { PDFInvoice.CreatePDF(TipoInvoice.Venta, ValorCelda(e.RowIndex, "clmFolio"), ValorCelda(e.RowIndex, "clmFecha"), obtenerProductos(ValorCelda(e.RowIndex, "clmFolio")), c, impuesto); PDFFile.Imprimir(this, Application.StartupPath + "\\Invoice.pdf"); } else { PDFInvoice.CreatePDF(TipoInvoice.Cotizacions, ValorCelda(e.RowIndex, "clmFolio"), ValorCelda(e.RowIndex, "clmFecha"), obtenerProductosCo(ValorCelda(e.RowIndex, "clmFolio")), c, impuesto); PDFFile.Imprimir(this, Application.StartupPath + "\\Invoice.pdf"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void rbnBtnReporteImprimir_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.CheckFileExists = true; ofd.CheckPathExists = true; ofd.Multiselect = false; ofd.ShowReadOnly = true; ofd.Title = "Ver archivo reciente"; ofd.Filter = "Archivo PDF (*.pdf)|"; ofd.RestoreDirectory = true; ofd.InitialDirectory = Application.StartupPath + "\\reportes\\"; DialogResult dr = ofd.ShowDialog(); if (dr == DialogResult.OK) { PDFFile.Imprimir(this, ofd.FileName); } }