private void btnPreview_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmStockReceiving", "Preview")) { return; } if (dgvList.Rows.Count > 0) { loStockReceivingRpt.SetDataSource(GlobalVariables.DTCompanyLogo); loStockReceivingRpt.Database.Tables[1].SetDataSource(ldtInventory); loStockReceivingRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loStockReceivingRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loStockReceivingRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loStockReceivingRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loStockReceivingRpt.SetParameterValue("Title", "Stock Receiving"); loStockReceivingRpt.SetParameterValue("SubTitle", "Stock Receiving"); try { if (loSearches.lAlias == "") { loStockReceivingRpt.SetParameterValue("QueryString", loSearches.lQuery.Replace("WHERE ", "")); } else { loStockReceivingRpt.SetParameterValue("QueryString", loSearches.lQuery.Replace("WHERE ", "").Replace(loSearches.lAlias, "")); } } catch { loStockReceivingRpt.SetParameterValue("QueryString", ""); } loReportViewer.crystalReportViewer.ReportSource = loStockReceivingRpt; loReportViewer.ShowDialog(); } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnPreview_Click"); em.ShowDialog(); return; } }
private void btnPreview_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmStockReceiving", "Preview")) { return; } try { loStockReceivingRpt.SetDataSource(GlobalVariables.DTCompanyLogo); loStockReceivingRpt.Database.Tables[1].SetDataSource(ldtStockReceiving); loStockReceivingRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loStockReceivingRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loStockReceivingRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loStockReceivingRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loStockReceivingRpt.SetParameterValue("Title", "Stock Receiving"); loStockReceivingRpt.SetParameterValue("SubTitle", "Stock Receiving"); loReportViewer.crystalReportViewer.ReportSource = loStockReceivingRpt; loReportViewer.ShowDialog(); } catch { } }