private void btnPreview_Click(object sender, EventArgs e)
 {
     if (!GlobalFunctions.checkRights("tsmReorderLevelReport", "Preview"))
     {
         return;
     }
     try
     {
         loReorderLevelRpt.SetDataSource(GlobalVariables.DTCompanyLogo);
         loReorderLevelRpt.Database.Tables[1].SetDataSource(ldtReports);
         loReorderLevelRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName);
         loReorderLevelRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
         loReorderLevelRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);
         loReorderLevelRpt.SetParameterValue("Username", GlobalVariables.Userfullname);
         loReorderLevelRpt.SetParameterValue("Title", "Reorder Level");
         loReorderLevelRpt.SetParameterValue("SubTitle", "Reorder Level");
         loReportViewer.crystalReportViewer.ReportSource = loReorderLevelRpt;
         loReportViewer.ShowDialog();
     }
     catch { }
 }
 private void btnPreview_Click(object sender, EventArgs e)
 {
     if (!GlobalFunctions.checkRights("tsmSalesReport", "Preview"))
     {
         return;
     }
     try
     {
         loStockCardRpt.SetDataSource(GlobalVariables.DTCompanyLogo);
         loStockCardRpt.Database.Tables[1].SetDataSource(ldtReports);
         loStockCardRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName);
         loStockCardRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
         loStockCardRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);
         loStockCardRpt.SetParameterValue("Username", GlobalVariables.Userfullname);
         loStockCardRpt.SetParameterValue("Title", "Stock Card");
         loStockCardRpt.SetParameterValue("SubTitle", "Stock Card");
         loStockCardRpt.SetParameterValue("ItemDescription", dgvStockList.CurrentRow.Cells[1].Value.ToString());
         loStockCardRpt.SetParameterValue("Unit", dgvStockList.CurrentRow.Cells[4].Value.ToString());
         loStockCardRpt.SetParameterValue("QtyOnHand",string.Format("{0:n}", decimal.Parse(dgvStockList.CurrentRow.Cells[5].Value.ToString())));
         loReportViewer.crystalReportViewer.ReportSource = loStockCardRpt;
         loReportViewer.ShowDialog();
     }
     catch { }
 }