public DSFeedIssueWeekPlan FeedReqDateRangeReport(string fromDate, string toDate) { DSFeedIssueWeekPlan feedSche = new DSFeedIssueWeekPlan(); int userID = Properties.Settings.Default.UserID; try { if (conn.State.ToString() == "Closed") { conn.Open(); } using (SqlCommand cmd = new SqlCommand(@"SELECT ID,FHM.FAR_HDR_MST_CODE,FHM.FAR_HDR_MST_NAME,FL.FAR_LOC_MST_NAME, substring(dateVar,4,3) + substring(dateVar,1,3)+substring(dateVar,7,4) as dateVara,dateVar, weekI, InputI,cc.COM_CAT_NAME, BCH.BAT_CRT_NO_CHICKS FROM FEED_ISSUE_SCHEDULE_TEMP_SUB as FISTS INNER JOIN BATCH_CREATE_HEADER as BCH ON FISTS.ID = BCH.BAT_CRT_NO INNER JOIN FARMER_MASTER_FARM_DETAILS as FMFD on BCH.BAT_CRT_FARMER_CODE=FMFD.FAR_MST_FAM_DET_CODE inner join FARMER_HEADER_MASTER as FHM ON FMFD.FAR_MST_FAM_DET_CODE = FHM.FAR_HDR_MST_FAR_NO INNER JOIN FARMER_LOCATION as FL ON FMFD.FAR_MST_FAM_DET_LOCATION_CODE = FL.FAR_LOC_MST_CODE inner join COMMON_CATEGORY as CC ON FISTS.ItemI = cc.COM_CAT_CODE where CAST(dateVar AS datetime) >= '" + fromDate + "' and CAST(dateVar AS datetime) <='" + toDate + "' and UserName="******" order by CAST(dateVar AS datetime)")) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = conn; sda.SelectCommand = cmd; sda.Fill(feedSche, "DTFeedIssue"); } } } catch (Exception ex) { MessageBox.Show("Report Filter\n" + ex.Message.ToString(), "GetFeildOffVisitation()", MessageBoxButtons.OK, MessageBoxIcon.Hand); } finally { conn.Close(); } return(feedSche); }
public void ScheduleVisitToReportByRange() { ScheduleDateToItemCR scheduleReport = new ScheduleDateToItemCR(); try { DSFeedIssueWeekPlan VisitDataSet = db.FeedReqDateRangeReport(_fromDate, _toDate);//Get report data from GPSCUStemp scheduleReport.SetDataSource(VisitDataSet); this.CRFeed.ReportSource = scheduleReport; TextObject yr = (TextObject)scheduleReport.ReportDefinition.Sections["Section5"].ReportObjects["TxtObjLogUser"]; yr.Text = "[ Copyright \u00A9 " + DateTime.Now.Year.ToString() + " Delmo IT " + " PD : " + DateTime.Now.ToString("dd/MM/yyyy") + " PT : " + DateTime.Now.ToString("hh:mm:ss tt") + " Com : " + System.Environment.MachineName.ToString() + " UN : " + Settings.Default.LastUser + " ]"; } catch { MessageBox.Show("Error loading with the report...", "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } try { DataTable table = db.FillReportHeader(); DataRow row = table.Rows[0]; TextObject heder = (TextObject)scheduleReport.ReportDefinition.Sections["Section1"].ReportObjects["TxtCRName"]; heder.Text = row[0].ToString(); TextObject heder2 = (TextObject)scheduleReport.ReportDefinition.Sections["Section1"].ReportObjects["TxtCrAddr"]; heder2.Text = row[1].ToString(); TextObject heder3 = (TextObject)scheduleReport.ReportDefinition.Sections["Section1"].ReportObjects["TxtCRTPNo"]; heder3.Text = "Tel : " + row[2].ToString() + " / Fax : " + row[3].ToString(); TextObject heder4 = (TextObject)scheduleReport.ReportDefinition.Sections["Section1"].ReportObjects["TxtCREmailWeb"]; heder4.Text = "E-Mail : " + row[4].ToString() + " / Web Address : " + row[5].ToString(); TextObject heder5 = (TextObject)scheduleReport.ReportDefinition.Sections["Section1"].ReportObjects["TxtHoLine"]; heder5.Text = "Hot Line : 0774410500 / " + row[2].ToString(); TextObject fromD = (TextObject)scheduleReport.ReportDefinition.Sections["Section1"].ReportObjects["CrFromDatTxt"]; fromD.Text = _fromDate; TextObject toDay = (TextObject)scheduleReport.ReportDefinition.Sections["Section1"].ReportObjects["CrToDatTxt"]; toDay.Text = _toDate; TextObject headerTxt = (TextObject)scheduleReport.ReportDefinition.Sections["Section1"].ReportObjects["VisitHeader"]; headerTxt.Text = "Feed Issue Schedule For " + _area + " Area"; } catch { MessageBox.Show("Error loading with the report header...", "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.CRFeed.RefreshReport(); }