protected void generateFirstDefaultersExcell(string reportingdatefrom, string reportingdateto)
        {
            ReportingResultsManager reportingLogic = new ReportingResultsManager();
            DataTable dt = reportingLogic.getfirstdefaulters(Convert.ToDateTime(reportingdateto), 1, 30);

            //IQWebUtils theUtils = new IQWebUtils();
            //theUtils.ExporttoExcel(dt, Response);
            using (XLWorkbook wb = new XLWorkbook())
            {
                String timeStamp = GetTimestamp(DateTime.Now);
                var    ws        = wb.Worksheets.Add(dt, "1to30days");
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.Buffer      = true;
                HttpContext.Current.Response.Charset     = "";
                HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + "defaulters" + timeStamp + ".xlsx");
                using (MemoryStream MyMemoryStream = new MemoryStream())
                {
                    wb.SaveAs(MyMemoryStream);
                    MyMemoryStream.WriteTo(HttpContext.Current.Response.OutputStream);
                    HttpContext.Current.Response.Flush();
                    HttpContext.Current.Response.End();
                }
            }
        }
Beispiel #2
0
        public int getNumberOfTxcurr(string reportingdate)
        {
            ReportingResultsManager reportingLogic = new ReportingResultsManager();
            int       txcurrcount = 0;
            DataTable theDT       = reportingLogic.gettxcurr(Convert.ToDateTime(reportingdate));

            txcurrcount = theDT.Rows.Count;
            return(txcurrcount);
        }
Beispiel #3
0
        public int getFirstStageDefaulters(string reportingdate, int mindays, int maxdays)
        {
            ReportingResultsManager reportingLogic = new ReportingResultsManager();
            int       firstdefaulters = 0;
            DataTable theDT           = reportingLogic.getfirstdefaulters(Convert.ToDateTime(reportingdate), mindays, maxdays);

            firstdefaulters = theDT.Rows.Count;
            return(firstdefaulters);
        }
Beispiel #4
0
        public int getltfu(string fromdate, string todate)
        {
            ReportingResultsManager reportingLogic = new ReportingResultsManager();
            int       ltfu  = 0;
            DataTable theDT = reportingLogic.getltfu(Convert.ToDateTime(fromdate), Convert.ToDateTime(todate));

            ltfu = theDT.Rows.Count;
            return(ltfu);
        }
Beispiel #5
0
        public string gettracingdata(string visitid)
        {
            var RRM = new ReportingResultsManager();

            Tracing[] patientTracingData  = RRM.getTracingData(Convert.ToInt32(visitid)).ToArray();
            string    jsonScreeningObject = "[]";

            jsonScreeningObject = new JavaScriptSerializer().Serialize(patientTracingData);
            return(jsonScreeningObject);
        }
Beispiel #6
0
        public ArrayList getltfull(string fromdate, string todate)
        {
            ReportingResultsManager reportingLogic = new ReportingResultsManager();
            DataTable theDT = reportingLogic.getltfu(Convert.ToDateTime(fromdate), Convert.ToDateTime(todate));
            ArrayList rows  = new ArrayList();
            int       n     = 0;

            foreach (DataRow items in theDT.Rows)
            {
                string[] i = new string[13] {
                    n.ToString(), items["CCCNumber"].ToString(), items["FirstName"].ToString(), items["MiddleName"].ToString(), items["LastName"].ToString(), items["MobileNumber"].ToString(), Convert.ToDateTime(items["DispenseDate"]).ToString("dd-MMM-yyyy"), items["Drug"].ToString(), Convert.ToDateTime(items["ExpectedReturn"]).ToString("dd-MMM-yyyy"), items["DaysOverDue"].ToString(), items["Traced"].ToString(), items["PID"].ToString(), items["personid"].ToString()
                };
                rows.Add(i);
            }
            return(rows);
        }
Beispiel #7
0
        public ArrayList getseconddefaultersll(string reportingdate, int mindays, int maxdays)
        {
            ReportingResultsManager reportingLogic = new ReportingResultsManager();
            DataTable theDT = reportingLogic.getseconddefaulters(Convert.ToDateTime(reportingdate), mindays, maxdays);
            ArrayList rows  = new ArrayList();
            int       n     = 0;

            foreach (DataRow items in theDT.Rows)
            {
                n = n + 1;
                string[] i = new string[13] {
                    n.ToString(), items["CCCNumber"].ToString(), items["FirstName"].ToString(), items["MiddleName"].ToString(), items["LastName"].ToString(), items["MobileNumber"].ToString(), Convert.ToDateTime(items["DispenseDate"]).ToString("dd-MMM-yyyy"), items["Drug"].ToString(), Convert.ToDateTime(items["ExpectedReturn"]).ToString("dd-MMM-yyyy"), items["DaysOverDue"].ToString(), items["Traced"].ToString(), items["PID"].ToString(), items["personid"].ToString()
                };
                rows.Add(i);
            }
            return(rows);
        }
Beispiel #8
0
        public string saveTracingData(int PatientId, int PersonId, string tracingdate, int tracingmethod, int tracingoutcome, string othertracingoutcome, string tracingdateofdeath,
                                      string tracingdateoftransfer, string transferfacility, string tracingnotes, string tracingstatus, int?visitid)
        {
            ILookupManager mgr     = (ILookupManager)ObjectFactory.CreateInstance("BusinessProcess.CCC.BLookupManager, BusinessProcess.CCC");
            var            tracing = new ReportingResultsManager();
            int            userId  = Convert.ToInt32(Session["AppUserId"]);
            int            patientmastervisitresult = 0;
            int            EncounterResult          = 0;
            string         savestatus       = "";
            DateTime?      deathTracingDate = new DateTime();
            int            CheckoutResult   = 0;

            //save tracing data
            if (tracingdateofdeath == "")
            {
                deathTracingDate = null;
            }
            else
            {
                deathTracingDate = Convert.ToDateTime(tracingdateofdeath);
            }

            DateTime?transferTracingDate = new DateTime();

            if (tracingdateoftransfer == "")
            {
                transferTracingDate = null;
            }
            else
            {
                transferTracingDate = Convert.ToDateTime(tracingdateoftransfer);
            }

            try
            {
                //create patient master visit id
                PatientMasterVisitManager patientMasterVisit = new PatientMasterVisitManager();
                LookupLogic lookupLogic     = new LookupLogic();
                var         currentfacility = lookupLogic.GetFacility(Session["AppPosID"].ToString());
                if (currentfacility == null)
                {
                    currentfacility = lookupLogic.GetFacility();
                }

                if (visitid.HasValue && visitid.Value > 0)
                {
                    Tracing[] patientTracingData = tracing.getTracingData(visitid.Value).ToArray();
                    if (patientTracingData.Length > 0)
                    {
                        patientTracingData[0].Mode                    = tracingmethod;
                        patientTracingData[0].Outcome                 = tracingoutcome;
                        patientTracingData[0].DateTracingDone         = Convert.ToDateTime(tracingdate);
                        patientTracingData[0].TracingDateOfDeath      = deathTracingDate;
                        patientTracingData[0].TracingTransferFacility = transferfacility;
                        patientTracingData[0].TracingTransferDate     = transferTracingDate;
                        patientTracingData[0].Remarks                 = tracingnotes;

                        tracing.UpdatePatientTracing(patientTracingData[0]);
                        Session["PatientTrace"] = "";
                    }
                }
                else
                {
                    patientmastervisitresult = patientMasterVisit.PatientMasterVisitCheckin(PatientId, userId, currentfacility.FacilityID);

                    //create encounter
                    PatientEncounterManager patientEncounterManager = new PatientEncounterManager();
                    EncounterResult = patientEncounterManager.AddpatientEncounterTracing(Convert.ToInt32(PatientId), Convert.ToInt32(patientmastervisitresult),
                                                                                         patientEncounterManager.GetPatientEncounterId("EncounterType", "Patient-Tracing"), 203, userId, Convert.ToDateTime(tracingdate), Convert.ToDateTime(tracingdate));
                    int tracingType = Convert.ToInt32(mgr.GetLookupItemId("DefaulterTracing"));
                    //save tracing data
                    Tracing patientTracing = new Tracing()
                    {
                        PersonID             = PersonId,
                        TracingType          = tracingType,
                        PatientMasterVisitId = patientmastervisitresult,
                        DateTracingDone      = Convert.ToDateTime(tracingdate),
                        Mode                    = tracingmethod,
                        Outcome                 = tracingoutcome,
                        TracingDateOfDeath      = deathTracingDate,
                        TracingTransferFacility = transferfacility,
                        TracingTransferDate     = transferTracingDate,
                        Remarks                 = tracingnotes,
                        CreateDate              = DateTime.Now,
                        CreatedBy               = Convert.ToInt32(Session["AppUserId"])
                    };

                    Result = tracing.AddPatientTracing(patientTracing);

                    //checkout patient master visit
                    PatientMasterVisitManager patientMasterVisitcheckout = new PatientMasterVisitManager();
                    CheckoutResult = patientMasterVisit.PatientMasterVisitCheckout(patientmastervisitresult, PatientId, 0, 0, 0, Convert.ToDateTime(tracingdate));

                    Session["EncounterStatusId"] = 0;
                    Session["PatientEditId"]     = 0;
                    Session["PatientPK"]         = 0;
                    Session["PatientTrace"]      = "";

                    if (Result > 0 && CheckoutResult > 0)
                    {
                        Msg = "Patient appointment Added Successfully!";
                    }
                }
            }
            catch (Exception e)
            {
                Msg = e.Message;
            }
            return(savestatus);
        }