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