public void CreatePDF(string cCmpyCode, string cGBLNo, Int16 cRevNo) { try { QuotationRpt QuoteRpt = new QuotationRpt(); QuoteRpt.WindowState = FormWindowState.Minimized; QuoteRpt.CmpyCode = cCmpyCode; QuoteRpt.QuoteNo = cGBLNo; QuoteRpt.RevNo = cRevNo; QuoteRpt.nQ = 9; QuoteRpt.Show(); QuoteRpt.Close(); QuoteRpt.Dispose(); MessageBox.Show("PDF file created.", "PTS"); } catch { MessageBox.Show("Error in creating PDF file.", "PTS"); } }
private void btnPreview_Click(object sender, EventArgs e) { if (dgvReissue.Rows.Count == 0) { MessageBox.Show("No quotes to print preview.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } QuotationRpt rptQuotation = new QuotationRpt(); rptQuotation.WindowState = FormWindowState.Maximized; rptQuotation.nQ = 2; try { string strQNo = dgvReissue.Rows[dgvReissue.CurrentCell.RowIndex].Cells["QuoteNo"].Value.ToString();; // strQuote.Substring(0, 9); string strRevNo = dgvReissue.Rows[dgvReissue.CurrentCell.RowIndex].Cells["RevNo"].Value.ToString(); //strQuote.Substring(strQuote.IndexOf("R") + 1, strQuote.Length - (strQuote.IndexOf("R") + 1)); rptQuotation.QuoteNo = strQNo; rptQuotation.RevNo = Convert.ToInt16(strRevNo); rptQuotation.CmpyCode = dgvReissue.Rows[dgvReissue.CurrentCell.RowIndex].Cells["CmpyCode"].Value.ToString();; rptQuotation.Show(); } catch { } }