private void btnDisplay_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); Int32 wrkType = 1; Boolean boolBlockPlk = false; if (rbGeneral.Checked) { wrkType = 1; boolBlockPlk = false; } else if (rbCashwork.Checked) { wrkType = 2; boolBlockPlk = false; } else { wrkType = 2; boolBlockPlk = true; } if (settings.IsCashOverKgsAvailable() && wrkType == 2) { ds = myreport.getHarvestRegisterCashOkg((cmbDivision.SelectedValue.ToString()), (dtDate.Value.Date), wrkType); ds.WriteXml("DailyHarvestRegisterCashOkgRep.xml"); } else { if (chkEmpRange.Checked) { ds = myreport.getHarvestRegister((cmbDivision.SelectedValue.ToString()), (dtDate.Value.Date), wrkType, txtEmpNoFrom.Text, txtEmpNoTo.Text, boolBlockPlk); ds.WriteXml("DailyHarvestRegisterRep.xml"); } else { ds = myreport.getHarvestRegister((cmbDivision.SelectedValue.ToString()), (dtDate.Value.Date), wrkType, boolBlockPlk); ds.WriteXml("DailyHarvestRegisterRep.xml"); } } if (ds.Tables[0].Rows.Count > 0) { if (settings.IsCashOverKgsAvailable() && wrkType == 2) { DailyHarvestRegisterCashOKgRPT myDailyRep = new DailyHarvestRegisterCashOKgRPT(); myDailyRep.SetDataSource(ds); ReportViewer myReportViewer = new ReportViewer(); myDailyRep.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName()); myDailyRep.SetParameterValue("Date", dtDate.Value.Date.ToShortDateString()); myDailyRep.SetParameterValue("Division", "Division : " + cmbDivision.Text); if (wrkType == 1) { myDailyRep.SetParameterValue("General", "For Normal Work"); } else { myDailyRep.SetParameterValue("General", "For Cash Work"); } myDailyRep.SetParameterValue("CashWork", ""); try { if (myEntries.IsDayExistsInCHKDateConfirmations(dtDate.Value.Date)) { if (Convert.ToBoolean(myEntries.IsDailyEntryConfirmed(dtDate.Value.Date).Rows[0][0].ToString()) == true) { myDailyRep.SetParameterValue("ConfirmYesNo", "Entries Confirmed"); } else { myDailyRep.SetParameterValue("ConfirmYesNo", "Confirmation Pending"); } } else { myDailyRep.SetParameterValue("ConfirmYesNo", "Confirmation Pending"); } } catch (Exception ex) { } myReportViewer.crystalReportViewer1.ReportSource = myDailyRep; myReportViewer.Show(); } else { DailyHarvestRegisterRep myDailyRep = new DailyHarvestRegisterRep(); myDailyRep.SetDataSource(ds); ReportViewer myReportViewer = new ReportViewer(); myDailyRep.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName()); myDailyRep.SetParameterValue("Date", dtDate.Value.Date.ToShortDateString()); myDailyRep.SetParameterValue("Division", "Division : " + cmbDivision.Text); if (wrkType == 1) { myDailyRep.SetParameterValue("General", "For Normal Work"); } else { if (boolBlockPlk == false) { myDailyRep.SetParameterValue("General", "For Cash Work"); } else { myDailyRep.SetParameterValue("General", "For Cash Work-Block Plucking"); } } myDailyRep.SetParameterValue("CashWork", ""); try { if (myEntries.IsDayExistsInCHKDateConfirmations(dtDate.Value.Date)) { if (Convert.ToBoolean(myEntries.IsDailyEntryConfirmed(dtDate.Value.Date).Rows[0][0].ToString()) == true) { myDailyRep.SetParameterValue("ConfirmYesNo", "Entries Confirmed"); } else { myDailyRep.SetParameterValue("ConfirmYesNo", "Confirmation Pending"); } } else { myDailyRep.SetParameterValue("ConfirmYesNo", "Confirmation Pending"); } } catch (Exception ex) { } myReportViewer.crystalReportViewer1.ReportSource = myDailyRep; myReportViewer.Show(); } } else { MessageBox.Show("No Data to Preview..!"); } }