public WIPDataSet GetWIPSereas(int wipID, string query) { WIPDataSet getWIPSeries = new WIPDataSet(); try { if (conn.State.ToString() == "Closed") { conn.Open(); } using (SqlCommand cmd = new SqlCommand(@"SELECT WIPM.ITINERARY_MST_ID, IPST.WIP_CODE, CONVERT(VARCHAR, CAST(WIPM.ITINERARY_MST_DATE AS DATETIME), 106) AS ITINERARY_MST_DATE_Order, FL.FAR_LOC_MST_NAME, FHM.FAR_HDR_MST_CODE, FHM.FAR_HDR_MST_NAME, BCH.BAT_CRT_CODE, BCH.BAT_CRT_NO_CHICKS, FOM.FLD_OFF_MST_NAME, dbo.GET_FRM_PRE_BROO_STATUS(WIPM.ITINERARY_PB_STSTUS) AS P_B_Status FROM WEEKLY_ITINERARY_PLAN_MASTER AS WIPM INNER JOIN ITINERARY_PLAN_SERIES_TBL AS IPST ON WIPM.ITINERARY_ID_FK = IPST.ITINERARY_ID INNER JOIN FARMER_MASTER_FARM_DETAILS AS FMFD ON WIPM.FAR_HDR_MST_FAR_NO_FK = 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 FIELD_OFFICER_MASTER AS FOM ON FMFD.FAR_MST_FAM_DET_FIELD_OFFICER = FOM.FLD_OFF_MST_CODE INNER JOIN FARMER_LOCATION AS FL ON FMFD.FAR_MST_FAM_DET_LOCATION_CODE = FL.FAR_LOC_MST_CODE INNER JOIN BATCH_CREATE_HEADER AS BCH ON WIPM.BAT_CRT_NO_FK = BCH.BAT_CRT_NO WHERE (IPST.ITINERARY_ID = " + wipID + ") " + query + " ORDER BY FOM.FLD_OFF_MST_NAME,ITINERARY_MST_DATE")) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = conn; sda.SelectCommand = cmd; sda.Fill(getWIPSeries, "WIPDT"); } } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "GetItinaryPlanActual()", MessageBoxButtons.OK, MessageBoxIcon.Hand); } finally { conn.Close(); } return(getWIPSeries); }
public void LoadReportWIPSeries() { WIPSeriesCR crystalReport = new WIPSeriesCR(); try { WIPDataSet wipSeriesDataSet = new WIPDataSet(); wipSeriesDataSet = itinerary.GetWIPSereas(_wipID, _query); crystalReport.SetDataSource(wipSeriesDataSet); this.CRViewerGeo.ReportSource = crystalReport; TextObject yr = (TextObject)crystalReport.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 + " ]"; DataTable table = db.FillReportHeader(); DataRow row = table.Rows[0]; TextObject heder = (TextObject)crystalReport.ReportDefinition.Sections["Section1"].ReportObjects["TxtCRName"]; heder.Text = row[0].ToString(); TextObject heder2 = (TextObject)crystalReport.ReportDefinition.Sections["Section1"].ReportObjects["TxtCrAddr"]; heder2.Text = row[1].ToString(); TextObject heder3 = (TextObject)crystalReport.ReportDefinition.Sections["Section1"].ReportObjects["TxtCRTPNo"]; heder3.Text = "Tel : " + row[2].ToString() + " / Fax : " + row[3].ToString(); TextObject heder4 = (TextObject)crystalReport.ReportDefinition.Sections["Section1"].ReportObjects["TxtCREmailWeb"]; heder4.Text = "E-Mail : " + row[4].ToString() + " / Web Address : " + row[5].ToString(); TextObject heder5 = (TextObject)crystalReport.ReportDefinition.Sections["Section1"].ReportObjects["TxtHoLine"]; heder5.Text = "Hot Line : 0774410500 / " + row[2].ToString(); //TextObject fromD = (TextObject)crystalReport.ReportDefinition.Sections["Section1"].ReportObjects["CrFromDatTxt"]; //fromD.Text = wipFromD; //TextObject toDay = (TextObject)crystalReport.ReportDefinition.Sections["Section1"].ReportObjects["CrToDatTxt"]; //toDay.Text = wipToD; TextObject headerTxt = (TextObject)crystalReport.ReportDefinition.Sections["Section1"].ReportObjects["VisitHeader"]; headerTxt.Text = "Extension Officers Week Itinerary Plan Series Report " + _wipCode; } catch { MessageBox.Show("Error loading with the report header...", "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.CRViewerGeo.RefreshReport(); }