private byte[] getLogo(String facilityLogo) { // 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); // check the existance of image if (File.Exists(GblIQCare.GetPath() + facilityLogo)) { // open image in file stream fs = new FileStream(GblIQCare.GetPath() + facilityLogo, 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))); br.Close(); // close the binary reader fs.Close(); // close the file stream return(imgbyte); } return(null); }
public void BindGrid() { try { IManageForms objFormDetail; objFormDetail = (IManageForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BManageForms,BusinessProcess.FormBuilder"); objDsFormDetails = objFormDetail.GetFormDetail(cmbFormStatus.SelectedIndex.ToString(), Convert.ToInt16(GblIQCare.AppCountryId)); if (objDsFormDetails.Tables[0].Rows.Count > 0) { ClearGrid(); string strGetPath = GblIQCare.GetPath(); imgPublished = Image.FromFile(strGetPath + "\\Published1.bmp"); imgUnpublished = Image.FromFile(strGetPath + "\\Unpublished11.bmp"); imgInprocess = Image.FromFile(strGetPath + "\\Inprocess11.bmp"); ShowGrid(objDsFormDetails.Tables[0]); } if (objDsFormDetails.Tables[1].Rows.Count > 0 && Convert.ToInt32(objDsFormDetails.Tables[1].Rows[0]["Exist"]) > 0) { btnAdd.Enabled = false; } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
/// <summary> /// Init_pages this instance. /// </summary> private void init_page() { IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); this.rptDocument = new ReportDocument(); DataSet theDataSet; theDataSet = BManager.GetInvoice(Convert.ToInt32(Request.QueryString["BillRefCode"]), Convert.ToInt32(Session["AppLocationId"]), this.PatientId); theDataSet.Tables[0].TableName = "Command_3"; theDataSet.Tables[1].TableName = "Command_2"; theDataSet.Tables[2].TableName = "Command_1"; theDataSet.Tables[3].TableName = "Command"; rptDocument.Load(MapPath("..\\Billing\\Reports\\rptInvoice.rpt")); rptDocument.SetDataSource(theDataSet); rptDocument.SetParameterValue("Currency", "KES"); rptDocument.SetParameterValue("userName", Session["AppUserName"]); String facilityName = (String)theDataSet.Tables[1].Rows[0]["FacilityName"]; rptDocument.SetParameterValue("FacilityName", facilityName); String facilityLogo = (String)theDataSet.Tables[1].Rows[0]["FacilityLogo"]; rptDocument.SetParameterValue("PicturePath", GblIQCare.GetPath() + facilityLogo); billingRptViewer.EnableParameterPrompt = false; billingRptViewer.ReportSource = rptDocument; billingRptViewer.HasToggleGroupTreeButton = false; billingRptViewer.DataBind(); }
//Stock Summary private DataSet StockSummary() { int storeid = Convert.ToInt32(Request.QueryString["storeid"]); int itemid = Convert.ToInt32(Request.QueryString["itemid"]); DateTime dateFrom = Convert.ToDateTime(theFromDate); DateTime dateTo = Convert.ToDateTime(theToDate); 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.GetPath() + theDS.Tables[3].Rows[0]["FacilityLogo"].ToString())) { // open image in file stream fs = new FileStream(GblIQCare.GetPath() + 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); return(theDS); //IPatientHome ReportDetails = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome,BusinessProcess.Clinical"); //DataSet dsPatientSummary = (DataSet)ReportDetails.GetPatientSummaryInformation(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["TechnicalAreaId"])); //ReportDetails = null; //dsPatientSummary.WriteXmlSchema(Server.MapPath("..\\XMLFiles\\PatientClinicalSummary.xml")); //return dsPatientSummary; }
private DataSet GetDSPrintPrescription() { IDrug PediatricManager = (IDrug)ObjectFactory.CreateInstance("BusinessProcess.Pharmacy.BDrug, BusinessProcess.Pharmacy"); //int PharmacyID = Convert.ToInt32(Session["PatientVisitId"]); int PharmacyID = Convert.ToInt32(Session["ptnPharmacyPK"]); int PatientID = Convert.ToInt32(Session["PatientId"]); ViewState["PatientId"] = PatientID; DataSet theDS = PediatricManager.GetPharmacyPrescriptionDetails(PharmacyID, PatientID, 1); //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); // check the existance of image if (File.Exists(GblIQCare.GetPath() + theDS.Tables[3].Rows[0]["FacilityLogo"].ToString())) { // open image in file stream fs = new FileStream(GblIQCare.GetPath() + 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; ImageFlag = 1; // add the image in bytearray dtFacility.Rows.Add(drow); // add row into the datatable br.Close(); // close the binary reader fs.Close(); // close the file stream } theDS.Tables.Add(dtFacility); //////////////////////////////////////// theDS.WriteXmlSchema(Server.MapPath("..\\XMLFiles\\PatientPharmacyPrescription.xml")); PediatricManager = null; return(theDS); }
private void BindGrid() { DataSet dsQueryIndicaterDetails = new DataSet(); try { int intModuleID = 0; int intPublished = -1; string strPublished = ""; if (cmbTechnicalArea1.SelectedIndex != 0) { intModuleID = Convert.ToInt32(cmbTechnicalArea1.SelectedValue); } if (cmbFormStatus.SelectedIndex != -1) { strPublished = cmbFormStatus.SelectedItem.ToString(); } if (strPublished == "All") { intPublished = -1; } else if (strPublished == "Published") { intPublished = 2; } else if (strPublished == "Un-Published") { intPublished = 1; } objTechArea = (IHomePageConfiguration)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BHomePageConfiguration,BusinessProcess.FormBuilder"); dsQueryIndicaterDetails = objTechArea.GetHomePageIndicatorQuery(intModuleID, intPublished); dgwFormDetails.DataSource = null; if (dsQueryIndicaterDetails.Tables[0].Rows.Count > 0) { string strGetPath = GblIQCare.GetPath(); ShowGrid(dsQueryIndicaterDetails.Tables[0]); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
// private void btnAdd_Click(object sender, EventArgs e) //{ // GblIQCare.iHomePageId = 0; // Form theForm = (Form)Activator.CreateInstance(Type.GetType("IQCare.FormBuilder.frm, IQCare.FormBuilder")); // theForm.MdiParent = this.MdiParent; // theForm.Left = 0; // theForm.Top = 2; // this.Close(); // theForm.Show(); //} private void BindGrid() { DataSet dsQueryCareEndDetails = new DataSet(); try { int intPublished = -1; if (cmbFormStatus.Text == "All") { intPublished = -1; } else if (cmbFormStatus.Text == "Published") { intPublished = 2; } else if (cmbFormStatus.Text == "UnPublished") { intPublished = 1; } if (cmbTechnicalArea.SelectedValue != null && Convert.ToInt32(cmbTechnicalArea.SelectedValue) > -1) { objCareEnd = (ICareEndedConfiguration)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BCareEndedConfiguration,BusinessProcess.FormBuilder"); dsQueryCareEndDetails = objCareEnd.GetCareEndQuery(Convert.ToInt32(cmbTechnicalArea.SelectedValue), intPublished); dgwFormDetails.DataSource = null; string strGetPath = GblIQCare.GetPath(); ShowGrid(dsQueryCareEndDetails.Tables[0]); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void dgwQueryDetails_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { Image imgQuery; if (e.ColumnIndex != -1 && e.RowIndex != -1) { if (dgwQueryDetails.Columns[e.ColumnIndex].Name == "Query") { dgwQueryDetails.Rows[e.RowIndex].Cells[3].Style.Alignment = DataGridViewContentAlignment.MiddleCenter; if (Convert.ToString(dgwQueryDetails.Rows[e.RowIndex].Cells[3].Value) == "") { imgQuery = Image.FromFile(GblIQCare.GetPath() + "\\redrule.bmp"); } else { imgQuery = Image.FromFile(GblIQCare.GetPath() + "\\brule.bmp"); } e.Value = imgQuery; } } }
private void LoadTreeView(int ModuleId) { tvCustomlist.Nodes.Clear(); tvCustomlist.ShowLines = true; DataTable theRptDT; DataTable objTable; //DataTable dtfiltertab; DataTable dtDetail; // DataTable dtData ; TreeNode root = new TreeNode(); TreeNode theChildRoot; int theImageIndex; string strImageFilePath = GblIQCare.GetPath(); // Load the images in an ImageList. ImageList myImageList = new ImageList(); myImageList.Images.Add(Image.FromFile(strImageFilePath + "\\blank.gif")); myImageList.Images.Add(Image.FromFile(strImageFilePath + "\\15px-Yes_check.svg.png")); myImageList.Images.Add(Image.FromFile(strImageFilePath + "\\No_16x.ico")); tvCustomlist.ImageList = myImageList; string strXmlFilePath = GblIQCare.GetFieldvalidationReportPath(); string XmlFile = strXmlFilePath + "rptFieldValidationXml.xml"; dsRptReportValidation = new DataSet(); dsRptReportValidation.ReadXml(XmlFile); theRptDT = dsRptReportValidation.Tables[0]; objTable = dsRptReportValidation.Tables[1]; string strRpName = string.Empty; string strfilterRpName = string.Empty; //if (ModuleId > 0) //{ // DataView theDVModName = new DataView(objTable); // theDVModName.RowFilter = "ModuleId ='" + Convert.ToString(ModuleId) + "'"; // theDVModName.Sort = "ListName asc"; // dtModfiltertab = theDVModName.ToTable(); // if (dtModfiltertab.Rows.Count > 0) // { // foreach (DataRow rpname in dtModfiltertab.Rows) // { // strRpName += "'" + rpname["ReportName"].ToString() + "',"; // } // strfilterRpName = strRpName.Remove(strRpName.Length - 1); // DataView theDVRpName = new DataView(theRptDT); // theDVRpName.RowFilter = "ReportName in (" + Convert.ToString(strfilterRpName) + ")"; // //theDVRpName.Sort = "ListName asc"; // dtRpfiltertab = theDVRpName.ToTable(); // } //} //else //{ dtModfiltertab = objTable; dtRpfiltertab = theRptDT; //} MemoryStream s = new MemoryStream(); dtModfiltertab.WriteXml(s, true); //Retrieve the text from the stream s.Seek(0, SeekOrigin.Begin); StreamReader sr = new StreamReader(s); string xmlString = null; xmlString = sr.ReadToEnd(); //close sr.Close(); sr.Dispose(); objRptFields = (IRptFieldValidations)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BRptFieldValidations,BusinessProcess.FormBuilder"); DataTable dtxml = objRptFields.ParseXml(xmlString, Convert.ToInt32(GblIQCare.AppLocationId), Convert.ToInt32(ModuleId)); if (Convert.ToInt32(ModuleId) > 0) { DataView theDVRptName1 = new DataView(dtxml); theDVRptName1.RowFilter = "ModuleID IN(0," + Convert.ToInt32(ModuleId) + ")"; theDVRptName1.Sort = "FieldName asc"; dtxml = theDVRptName1.ToTable(); } if (dtRpfiltertab.Rows.Count > 0) { foreach (DataRow drrptname in dtRpfiltertab.Rows) { bool flagroot = true; if (flagroot) { root.Expand(); flagroot = false; } else { //root.Expand(); root.Collapse(); } root = tvCustomlist.Nodes.Add(drrptname["ReportName"].ToString()); DataView theDVRptName = new DataView(dtxml); theDVRptName.RowFilter = "ReportName ='" + Convert.ToString(drrptname["ReportName"]) + "'"; theDVRptName.Sort = "FieldName asc"; dtDetail = theDVRptName.ToTable(); foreach (DataRow theDR in dtDetail.Rows) { //Query = "select " + theDR["ListName"].ToString() + " from " + theDR["TableName"].ToString() + " where " + theDR["ListName"].ToString() + " IS NOT NULL"; //dtData = objRptFields.ReturnDatatableQueryResult(Query); if (Convert.ToInt32(theDR["Status"]) > 0) { theImageIndex = 1; } else { theImageIndex = 2; } theChildRoot = new TreeNode(); theChildRoot.Text = theDR["FieldName"].ToString(); theChildRoot.ImageIndex = theImageIndex; root.Nodes.Add(theChildRoot); } } } }
private void ShowGrid(DataTable theDT) { try { dgwStockSummary.Columns.Clear(); dgwStockSummary.DataSource = null; DataGridViewTextBoxColumn ItemCode = new DataGridViewTextBoxColumn(); ItemCode.HeaderText = "Item Code"; ItemCode.DataPropertyName = "ItemId"; ItemCode.Name = "ItemId"; ItemCode.Width = 100; ItemCode.ReadOnly = true; ItemCode.Visible = false; DataGridViewTextBoxColumn ItemName = new DataGridViewTextBoxColumn(); ItemName.HeaderText = "Item Description"; ItemName.DataPropertyName = "ItemName"; ItemName.Width = 280; ItemName.ReadOnly = true; DataGridViewTextBoxColumn Unit = new DataGridViewTextBoxColumn(); Unit.HeaderText = "Unit"; Unit.DataPropertyName = "DispensingUnit"; Unit.Width = 86; Unit.ReadOnly = true; DataGridViewTextBoxColumn OpeningQty = new DataGridViewTextBoxColumn(); OpeningQty.HeaderText = "Opening Stock"; OpeningQty.DataPropertyName = "OpeningStock"; OpeningQty.Width = 90; OpeningQty.ReadOnly = true; DataGridViewTextBoxColumn QtyRecieved = new DataGridViewTextBoxColumn(); QtyRecieved.HeaderText = "Recieved Quantity"; QtyRecieved.DataPropertyName = "QtyRecieved"; QtyRecieved.Width = 90; QtyRecieved.ReadOnly = true; DataGridViewTextBoxColumn InterStoreIss = new DataGridViewTextBoxColumn(); InterStoreIss.HeaderText = "Inter Store Issue"; InterStoreIss.DataPropertyName = "InterStoreIssueQty"; InterStoreIss.Width = 90; InterStoreIss.ReadOnly = true; DataGridViewTextBoxColumn QtyDispensed = new DataGridViewTextBoxColumn(); QtyDispensed.HeaderText = "Quantity Dispensed"; QtyDispensed.DataPropertyName = "QtyDispensed"; QtyDispensed.Width = 80; QtyDispensed.ReadOnly = true; DataGridViewTextBoxColumn AdjustedQty = new DataGridViewTextBoxColumn(); AdjustedQty.HeaderText = "Adjusted Quantity"; AdjustedQty.DataPropertyName = "AdjustmentQuantity"; AdjustedQty.Width = 75; AdjustedQty.ReadOnly = true; DataGridViewTextBoxColumn ClosingQty = new DataGridViewTextBoxColumn(); ClosingQty.HeaderText = "Closing Quantity"; ClosingQty.DataPropertyName = "ClosingQty"; ClosingQty.Width = 75; ClosingQty.ReadOnly = true; DataGridViewImageColumn BinCard = new DataGridViewImageColumn(); BinCard.HeaderText = "Bin Card"; BinCard.DataPropertyName = "BinCard"; BinCard.Name = "BinCard"; BinCard.Width = 40; BinCard.Image = Image.FromFile(GblIQCare.GetPath() + "\\bincard.jpg"); dgwStockSummary.Columns.Add(ItemCode); dgwStockSummary.Columns.Add(ItemName); dgwStockSummary.Columns.Add(Unit); dgwStockSummary.Columns.Add(OpeningQty); dgwStockSummary.Columns.Add(QtyRecieved); dgwStockSummary.Columns.Add(InterStoreIss); dgwStockSummary.Columns.Add(QtyDispensed); dgwStockSummary.Columns.Add(AdjustedQty); dgwStockSummary.Columns.Add(ClosingQty); dgwStockSummary.Columns.Add(BinCard); dgwStockSummary.AutoGenerateColumns = false; dgwStockSummary.DataSource = theDT; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
/// <summary> /// Init_pages this instance. /// </summary> private void init_page() { IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); this.rptDocument = new ReportDocument(); DateTime fromDate; DateTime.TryParse(Request.QueryString["sDt"], out fromDate); DateTime toDate; DateTime.TryParse(Request.QueryString["eDt"], out toDate); DataSet theDataSet; if (Request.QueryString["RptCd"] == "Invoice") { CurrentSession session = CurrentSession.Current; if (session == null) { string theUrl = string.Format("{0}", "~/frmLogin.aspx"); //Response.Redirect(theUrl); System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest(); Response.Redirect(theUrl, true); } theDataSet = BManager.GetInvoice(Convert.ToInt32(Request.QueryString["BillRefCode"]), Convert.ToInt32(Session["AppLocationId"]), session.CurrentPatient.Id); theDataSet.Tables[0].TableName = "Command_3"; theDataSet.Tables[1].TableName = "Command_2"; theDataSet.Tables[2].TableName = "Command_1"; theDataSet.Tables[3].TableName = "Command"; rptDocument.Load(MapPath("..\\Billing\\Reports\\rptInvoice.rpt")); rptDocument.SetDataSource(theDataSet); rptDocument.SetParameterValue("Currency", "KES"); rptDocument.SetParameterValue("userName", Session["AppUserName"]); String facilityName = (String)theDataSet.Tables[1].Rows[0]["FacilityName"]; //GblIQCare gl = new GblIQCare(); rptDocument.SetParameterValue("FacilityName", facilityName); String facilityLogo = (String)theDataSet.Tables[1].Rows[0]["FacilityLogo"]; rptDocument.SetParameterValue("PicturePath", GblIQCare.GetPath() + facilityLogo); } else { Hashtable ht = (Hashtable)Session["BREPORTS_XRFS"]; string ReportQuery = ht["ReportQuery"].ToString(); string TableNames = ht["TableNames"].ToString(); bool hasPatientData = ht["PatientData"].ToString() == "TRUE"; theDataSet = BManager.GetBillingReport(fromDate, toDate, Convert.ToInt32(Session["AppLocationId"]), ReportQuery, hasPatientData); rptDocument.Load(MapPath(String.Format("..\\Billing\\Reports\\{0}.rpt", Request.QueryString["RptNm"]))); try { string[] parts = TableNames.Split(','); for (int i = 0; i < parts.Length; i++) { theDataSet.Tables[i].TableName = parts[i]; } } catch { } // theDataSet.Tables[0].TableName = "collectionsummary"; // theDataSet.Tables[1].TableName = "Facility"; rptDocument.SetDataSource(theDataSet); rptDocument.SetParameterValue("StartDate", fromDate); rptDocument.SetParameterValue("EndDate", toDate); rptDocument.SetParameterValue("currentuser", Session["AppUserName"]); String facilityName = (String)theDataSet.Tables[1].Rows[0]["Name"]; rptDocument.SetParameterValue("FacilityName", facilityName); String facilityLogo = (String)theDataSet.Tables[1].Rows[0]["logo"]; rptDocument.SetParameterValue("PicturePath", GblIQCare.GetPath() + facilityLogo); //rptDocument.FileName = Request.QueryString["RptNm"]; } Session["rptDoc"] = rptDocument; billingRptViewer.EnableDatabaseLogonPrompt = false; billingRptViewer.EnableParameterPrompt = false; billingRptViewer.ReportSource = rptDocument; billingRptViewer.HasToggleGroupTreeButton = false; billingRptViewer.DataBind(); }
/// <summary> /// Init_pages this instance. /// </summary> private void init_page() { IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); this.rptDocument = new ReportDocument(); DateTime fromDate; DateTime.TryParse(Request.QueryString["sDt"], out fromDate); DateTime toDate; DateTime.TryParse(Request.QueryString["eDt"], out toDate); DataSet theDataSet; if (Request.QueryString["RptCd"] == "CollectionSummary") { theDataSet = BManager.getDailyCollectionSummaryReport(fromDate, toDate, Convert.ToInt32(Session["AppLocationId"])); //theDataSet.WriteXmlSchema("C:\\Projects\\BillingReciept.xml"); theDataSet.Tables[0].TableName = "CollectionSummary"; theDataSet.Tables[1].TableName = "Facility"; rptDocument.Load(MapPath(String.Format("..\\Reports\\Billing\\{0}.rpt", Request.QueryString["RptNm"]))); rptDocument.SetDataSource(theDataSet); rptDocument.SetParameterValue("StartDate", fromDate); rptDocument.SetParameterValue("EndDate", toDate); rptDocument.SetParameterValue("currentuser", Session["AppUserName"]); String facilityName = (String)theDataSet.Tables[1].Rows[0]["Name"]; rptDocument.SetParameterValue("FacilityName", facilityName); String facilityLogo = (String)theDataSet.Tables[1].Rows[0]["logo"]; rptDocument.SetParameterValue("PicturePath", GblIQCare.GetPath() + facilityLogo); } else if (Request.QueryString["RptCd"] == "CashierSummary") { theDataSet = BManager.getDailyCashiersSummaryReport(fromDate, toDate, Convert.ToInt32(Session["AppLocationId"])); theDataSet.Tables[0].TableName = "CollectionSummary"; theDataSet.Tables[1].TableName = "Facility"; rptDocument.Load(MapPath(String.Format("..\\Reports\\Billing\\{0}.rpt", Request.QueryString["RptNm"]))); rptDocument.SetDataSource(theDataSet); rptDocument.SetParameterValue("StartDate", fromDate); rptDocument.SetParameterValue("EndDate", toDate); rptDocument.SetParameterValue("currentuser", Session["AppUserName"]); String facilityName = (String)theDataSet.Tables[1].Rows[0]["Name"]; rptDocument.SetParameterValue("FacilityName", facilityName); String facilityLogo = (String)theDataSet.Tables[1].Rows[0]["logo"]; rptDocument.SetParameterValue("PicturePath", GblIQCare.GetPath() + facilityLogo); } else if (Request.QueryString["RptCd"] == "DailyDepartmentalCollection") { theDataSet = BManager.getDailyDeptCollectionsReport(fromDate, toDate, Convert.ToInt32(Session["AppLocationId"])); theDataSet.Tables[0].TableName = "DailyCollection"; theDataSet.Tables[1].TableName = "Facility"; rptDocument.Load(MapPath(String.Format("..\\Reports\\Billing\\{0}.rpt", Request.QueryString["RptNm"]))); rptDocument.SetDataSource(theDataSet); rptDocument.SetParameterValue("StartDate", fromDate); rptDocument.SetParameterValue("EndDate", toDate); rptDocument.SetParameterValue("currentuser", Session["AppUserName"]); String facilityName = (String)theDataSet.Tables[1].Rows[0]["Name"]; rptDocument.SetParameterValue("FacilityName", facilityName); String facilityLogo = (String)theDataSet.Tables[1].Rows[0]["logo"]; rptDocument.SetParameterValue("PicturePath", GblIQCare.GetPath() + facilityLogo); } else if (Request.QueryString["RptCd"] == "Invoice") { theDataSet = BManager.GetInvoice(Convert.ToInt32(Request.QueryString["BillRefCode"]), Convert.ToInt32(Session["AppLocationId"]), Convert.ToInt32(Session["PatientId"])); theDataSet.Tables[0].TableName = "Command_3"; theDataSet.Tables[1].TableName = "Command_2"; theDataSet.Tables[2].TableName = "Command_1"; theDataSet.Tables[3].TableName = "Command"; rptDocument.Load(MapPath("..\\Reports\\Billing\\rptInvoice.rpt")); rptDocument.SetDataSource(theDataSet); rptDocument.SetParameterValue("Currency", "KES"); rptDocument.SetParameterValue("userName", Session["AppUserName"]); String facilityName = (String)theDataSet.Tables[1].Rows[0]["FacilityName"]; rptDocument.SetParameterValue("FacilityName", facilityName); String facilityLogo = (String)theDataSet.Tables[1].Rows[0]["FacilityLogo"]; rptDocument.SetParameterValue("PicturePath", GblIQCare.GetPath() + facilityLogo); } else if (Request.QueryString["RptCd"] == "SalesSummary") { theDataSet = BManager.getSalesSummary(fromDate, toDate, Convert.ToInt32(Session["AppLocationId"])); // theDataSet.Tables[0].TableName = "CollectionSummary"; // theDataSet.Tables[1].TableName = "Facility"; rptDocument.Load(MapPath(String.Format("..\\Reports\\Billing\\{0}.rpt", Request.QueryString["RptNm"]))); rptDocument.SetDataSource(theDataSet); rptDocument.SetParameterValue("StartDate", fromDate); rptDocument.SetParameterValue("EndDate", toDate); rptDocument.SetParameterValue("currentuser", Session["AppUserName"]); String facilityName = (String)theDataSet.Tables[1].Rows[0]["Name"]; rptDocument.SetParameterValue("FacilityName", facilityName); String facilityLogo = (String)theDataSet.Tables[1].Rows[0]["logo"]; rptDocument.SetParameterValue("PicturePath", GblIQCare.GetPath() + facilityLogo); } // if (theDataSet.Tables[0].Rows.Count == 0) Session["rptDoc"] = rptDocument; billingRptViewer.EnableParameterPrompt = false; billingRptViewer.ReportSource = rptDocument; // billingRptViewer.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None; // billingRptViewer.DisplayToolbar = false; billingRptViewer.HasToggleGroupTreeButton = false; billingRptViewer.DataBind(); // rptDocument.Close(); // rptDocument.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { int storeid = Convert.ToInt32(Request.QueryString["storeid"]); int itemid = Convert.ToInt32(Request.QueryString["itemid"]); DateTime dateFrom = Convert.ToDateTime(Request.QueryString["dtFrom"]); DateTime dateTo = Convert.ToDateTime(Request.QueryString["dtTo"]); 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.GetPath() + theDS.Tables[3].Rows[0]["FacilityLogo"].ToString())) { // open image in file stream fs = new FileStream(GblIQCare.GetPath() + 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"]; if (Session["AppLocation"] != null) { rep.SetParameterValue("facilityname", Session["AppLocation"].ToString()); } crViewer.ToolPanelView = ToolPanelViewType.None; crViewer.ReportSource = rep; crViewer.DataBind(); }
/// <summary> /// Init_pages this instance. /// </summary> private void init_page() { ReceiptType defaultType = ReceiptType.BillPayment; if (Request.QueryString.Count > 0) { if (this.Request.QueryString["ReceiptTrxCode"] != null) { //Application.Common.Utility objUtil = new Application.Common.Utility(); Session["transactionID"] = this.Request.QueryString["ReceiptTrxCode"];// objUtil.Decrypt(this.Request.QueryString["ReceiptTrxCode"]); } if (this.Request.QueryString["TranXORType"] != null) { string transOX = this.Request.QueryString["TranXORType"].ToString(); if (transOX == "9") { defaultType = ReceiptType.DepositTransaction; } else if (transOX == "17") { defaultType = ReceiptType.ReversalTransaction; } } } IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); DataSet theDataSet = BManager.GetReceipt(Convert.ToInt32(Session["transactionID"]), Convert.ToInt32(Session["AppLocationId"]), defaultType); this.rptDocument = new ReportDocument(); DataTable theDT = theDataSet.Tables[1]; if (this.PrintOnThermal) { rptDocument.Load(MapPath("..\\Reports\\Billing\\rptBillingRecieptThermal.rpt")); } else { rptDocument.Load(MapPath("..\\Reports\\Billing\\rptBillingReciept.rpt")); } String facilityName = (String)theDT.Rows[0]["FacilityName"]; String dupl; if (Request.QueryString["reprint"] != null && Request.QueryString["RePrint"] == "true") { dupl = "DUPLICATE"; } else { dupl = ""; } rptDocument.SetDataSource(theDataSet); rptDocument.SetParameterValue("FacilityName", facilityName); rptDocument.SetParameterValue("Currency", "KES"); rptDocument.SetParameterValue("DuplicateReceipt", dupl); if (!this.PrintOnThermal) { String facilityLogo = (String)theDT.Rows[0]["FacilityLogo"]; string f = GblIQCare.GetPath() + facilityLogo; string p = Server.MapPath("~/Images/" + facilityLogo); rptDocument.SetParameterValue("PicturePath", p); } billingRptViewer.EnableParameterPrompt = false; billingRptViewer.ReportSource = rptDocument; billingRptViewer.DataBind(); }