private void lstFirst_DoubleClick(object sender, EventArgs e) { if (lstFirst.SelectedIndex > -1) { objData.OpenConnection("AatickPC-Office", ref strErr); var sql = ""; if (lstFirst.SelectedValue.ToString() == "1") { sql = "USP_Admission_DischageList '" + dateFrom.Value.ToShortDateString() + "','" + dateTo.Value.AddDays(1).ToShortDateString() + "'"; } else if (lstFirst.SelectedValue.ToString() == "2") { sql = "rpt_USP_Hospital_Monthly_Collection '" + dateFrom.Value.ToShortDateString() + "','" + dateTo.Value.AddDays(0).ToShortDateString() + "'"; } else if (lstFirst.SelectedValue.ToString() == "3") { sql = "rpt_USP_Hospital_Marketing_Total_sales_Commission '" + dateFrom.Value.ToShortDateString() + "','" + dateTo.Value.AddDays(0).ToShortDateString() + "'"; } var dtReport = objData.RetriveData(sql, ref strErr); objData.CloseConnection(); if (strErr == "" && dtReport.Rows.Count > 0) { var rptpath = Utility.ReportPath; if (lstFirst.SelectedValue.ToString() == "1") { rptpath += "rptDischargedPatientList.rpt"; } else if (lstFirst.SelectedValue.ToString() == "2") { rptpath += "rptHospitalMonthlyCollection.rpt"; } else if (lstFirst.SelectedValue.ToString() == "3") { rptpath += "rptAPTotalSalesCommistionMarketing.rpt"; } var dataset = new DataSet(); dataset.Tables.Add(dtReport); var reportviewer = new frmReport { ReportPath = rptpath, Reportds = dataset }; reportviewer.Show(this); } } //if (lstFirst.SelectedIndex > -2) //{ // objData.OpenConnection("AatickPC-Office", ref strErr); // var sql = ""; // if (lstFirst.SelectedValue.ToString() == "2") // sql = "rpt_USP_Hospital_Monthly_Collection '" + dateFrom.Value.ToShortDateString() + "','" + dateTo.Value.AddDays(1).ToShortDateString() + "'"; // var dtReport = objData.RetriveData(sql, ref strErr); // objData.CloseConnection(); // if (strErr == "" && dtReport.Rows.Count > 0) // { // var rptpath = Utility.ReportPath; // if (lstFirst.SelectedValue.ToString() == "2") // rptpath += "rptHospitalMonthlyCollection.rpt"; // var dataset = new DataSet(); // dataset.Tables.Add(dtReport); // var reportviewer = new frmReport { ReportPath = rptpath, Reportds = dataset }; // reportviewer.Show(this); // } //} }