private void btnPreview_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmStockWithdrawal", "Preview")) { return; } if (dgvList.Rows.Count > 0) { loStockWithdrawalRpt.SetDataSource(GlobalVariables.DTCompanyLogo); loStockWithdrawalRpt.Database.Tables[1].SetDataSource(ldtInventory); loStockWithdrawalRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loStockWithdrawalRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loStockWithdrawalRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loStockWithdrawalRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loStockWithdrawalRpt.SetParameterValue("Title", "Stock Withdrawal"); loStockWithdrawalRpt.SetParameterValue("SubTitle", "Stock Withdrawal"); try { if (loSearches.lAlias == "") { loStockWithdrawalRpt.SetParameterValue("QueryString", loSearches.lQuery.Replace("WHERE ", "")); } else { loStockWithdrawalRpt.SetParameterValue("QueryString", loSearches.lQuery.Replace("WHERE ", "").Replace(loSearches.lAlias, "")); } } catch { loStockWithdrawalRpt.SetParameterValue("QueryString", ""); } loReportViewer.crystalReportViewer.ReportSource = loStockWithdrawalRpt; 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("tsmStockWithdrawal", "Preview")) { return; } try { loStockWithdrawalRpt.SetDataSource(GlobalVariables.DTCompanyLogo); loStockWithdrawalRpt.Database.Tables[1].SetDataSource(ldtHeader); loStockWithdrawalRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loStockWithdrawalRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loStockWithdrawalRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loStockWithdrawalRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loStockWithdrawalRpt.SetParameterValue("Title", "Stock Withdrawals"); loStockWithdrawalRpt.SetParameterValue("SubTitle", "Stock Withdrawals"); loReportViewer.crystalReportViewer.ReportSource = loStockWithdrawalRpt; loReportViewer.ShowDialog(); } catch { } }