private void frmPatientClinicalSummary_Load(object sender, EventArgs e) { //rptDocument = new ReportDocument(); //IQCareUtils theUtil = new IQCareUtils(); //IPatientHome ReportDetails = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome,BusinessProcess.Clinical"); //DataSet theDS = (DataSet)ReportDetails.GetPatientSummaryInformation(GblIQCare.patientID, GblIQCare.ModuleId); //string filename = GblIQCare.GetXMLPath() + "PatientClinicalSummary.xml"; //System.IO.FileStream myFileStream = new System.IO.FileStream(filename, System.IO.FileMode.Create); //System.Xml.XmlTextWriter MyXmlTextWriter = new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode); //theDS.WriteXmlSchema(MyXmlTextWriter); //MyXmlTextWriter.Close(); //ReportDetails = null; //theReportSource = GblIQCare.GetReportPath() + "rptPatientClinicalSummary.rpt"; //rptDocument.Load(theReportSource); //rptDocument.SetDataSource(theDS); //crViewer.ReportSource = rptDocument; //crViewer.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None; rptDocument = new ReportDocument(); IQCareUtils theUtil = new IQCareUtils(); IPatientHome ReportDetails = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome,BusinessProcess.Clinical"); DataSet theDS = (DataSet)ReportDetails.GetPatientSummaryInformation(GblIQCare.patientID, GblIQCare.ModuleId); theDS.WriteXmlSchema(GblIQCare.GetXMLPath() + "\\PatientClinicalSummary.xml"); rptPatientClinicalSummary rep = new rptPatientClinicalSummary(); rep.SetDataSource(theDS); frmReportViewer theRepViewer = new frmReportViewer(); theRepViewer.MdiParent = this.MdiParent; theRepViewer.Location = new Point(0, 0); theRepViewer.crViewer.ReportSource = rep; theRepViewer.crViewer.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None; theRepViewer.Width = 902; theRepViewer.Height = 650; theRepViewer.crViewer.Width = 880; theRepViewer.crViewer.Height = 600; theRepViewer.crViewer.Location = new Point(11, 11); theRepViewer.btnExit_position(451, 615); theRepViewer.Show(); this.Close(); }
private void dgwStockSummary_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dgwStockSummary.Columns["BinCard"].Index) { int storeid = Convert.ToInt32(ddlStore.SelectedValue.ToString()); int itemid = Convert.ToInt32(dgwStockSummary.Rows[e.RowIndex].Cells["ItemId"].Value.ToString()); DateTime dateFrom = Convert.ToDateTime(dtpFrom.Value.ToString("yyyy-MM-dd")); DateTime dateTo = Convert.ToDateTime(dtpTo.Value.ToString("yyyy-MM-dd")); ReportDocument objRptDoc = new ReportDocument(); DataSet theDS = GetBINCard(storeid, itemid, dateFrom, dateTo); //////////////////////////////////////////////////////////////// //Image Streaming DataTable dtFacility = new DataTable(); // object of data row DataRow drow = null; // add the column in table to store the image of Byte array type dtFacility.Columns.Add("FacilityImage", System.Type.GetType("System.Byte[]")); drow = dtFacility.NewRow(); // define the filestream object to read the image FileStream fs = default(FileStream); // define te binary reader to read the bytes of image BinaryReader br = default(BinaryReader); int ImageFlag = 0; // check the existance of image if (File.Exists(GblIQCare.PresentationImagePath() + theDS.Tables[3].Rows[0]["FacilityLogo"].ToString())) { // open image in file stream fs = new FileStream(GblIQCare.PresentationImagePath() + theDS.Tables[3].Rows[0]["FacilityLogo"].ToString(), FileMode.Open); // initialise the binary reader from file streamobject br = new BinaryReader(fs); // define the byte array of filelength byte[] imgbyte = new byte[fs.Length + 1]; // read the bytes from the binary reader imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length))); drow[0] = imgbyte; // add the image in bytearray dtFacility.Rows.Add(drow); ImageFlag = 1; // add row into the datatable br.Close(); // close the binary reader fs.Close(); // close the file stream } theDS.Tables.Add(dtFacility); //////////////////////////////////////// theDS.WriteXmlSchema(GblIQCare.GetXMLPath() + "\\BinCard.xml"); rptBinCard rep = new rptBinCard(); rep.SetDataSource(theDS); // rep.ParameterFields["FormDate","1"]; rep.SetParameterValue("facilityname", GblIQCare.AppLocation); frmReportViewer theRepViewer = new frmReportViewer(); theRepViewer.MdiParent = this.MdiParent; theRepViewer.Location = new Point(0, 0); theRepViewer.crViewer.ReportSource = rep; theRepViewer.Show(); this.Close(); } }