Exemplo n.º 1
0
		///<summary></summary>
		public static long Insert(DashboardAR dashboardAR){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				dashboardAR.DashboardARNum=Meth.GetLong(MethodBase.GetCurrentMethod(),dashboardAR);
				return dashboardAR.DashboardARNum;
			}
			return Crud.DashboardARCrud.Insert(dashboardAR);
		}
Exemplo n.º 2
0
 ///<summary></summary>
 public static long Insert(DashboardAR dashboardAR)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         dashboardAR.DashboardARNum = Meth.GetLong(MethodBase.GetCurrentMethod(), dashboardAR);
         return(dashboardAR.DashboardARNum);
     }
     return(Crud.DashboardARCrud.Insert(dashboardAR));
 }
Exemplo n.º 3
0
        ///<summary>Only one dimension to the list for now.</summary>
        public static List <List <int> > GetAR(DateTime dateFrom, DateTime dateTo, List <DashboardAR> listDashAR)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <List <int> > >(MethodBase.GetCurrentMethod(), dateFrom, dateTo, listDashAR));
            }
            //assumes that dateFrom is the first of the month and that there are 12 periods
            //listDashAR may be empty, in which case, this routine will take about 18 seconds, but the user was warned.
            //listDashAR may also me incomplete, especially the most recent month(s).
            string     command;
            List <int> listInt;

            listInt = new List <int>();
            bool agingWasRun = false;

            for (int i = 0; i < 12; i++)
            {
                DateTime    dateLastOfMonth = dateFrom.AddMonths(i + 1).AddDays(-1);
                DashboardAR dash            = null;
                for (int d = 0; d < listDashAR.Count; d++)
                {
                    if (listDashAR[d].DateCalc != dateLastOfMonth)
                    {
                        continue;
                    }
                    dash = listDashAR[d];
                }
                if (dash != null)               //we found a DashboardAR object from the database for this month, so use it.
                {
                    listInt.Add((int)dash.BalTotal);
                    continue;
                }
                agingWasRun = true;
                //run historical aging on all patients based on the date entered.
                Ledgers.ComputeAging(0, dateLastOfMonth, true);
                command = @"SELECT SUM(Bal_0_30+Bal_31_60+Bal_61_90+BalOver90),SUM(InsEst) FROM patient";
                DataTable table = Db.GetTable(command);
                dash          = new DashboardAR();
                dash.DateCalc = dateLastOfMonth;
                dash.BalTotal = PIn.Double(table.Rows[0][0].ToString());
                dash.InsEst   = PIn.Double(table.Rows[0][1].ToString());
                DashboardARs.Insert(dash);                //save it to the db for later.
                listInt.Add((int)dash.BalTotal);          //and also use it now.
            }
            if (agingWasRun)
            {
                Ledgers.RunAging();                //set aging back to normal
            }
            List <List <int> > retVal = new List <List <int> >();

            retVal.Add(listInt);
            return(retVal);
        }
Exemplo n.º 4
0
 ///<summary>Only one dimension to the list for now.</summary>
 public static List<List<int>> GetAR(DateTime dateFrom,DateTime dateTo,List<DashboardAR> listDashAR)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
         return Meth.GetObject<List<List<int>>>(MethodBase.GetCurrentMethod(),dateFrom,dateTo,listDashAR);
     }
     //assumes that dateFrom is the first of the month and that there are 12 periods
     //listDashAR may be empty, in which case, this routine will take about 18 seconds, but the user was warned.
     //listDashAR may also me incomplete, especially the most recent month(s).
     string command;
     List<int> listInt;
     listInt=new List<int>();
     bool agingWasRun=false;
     for(int i=0;i<12;i++) {
         DateTime dateLastOfMonth=dateFrom.AddMonths(i+1).AddDays(-1);
         DashboardAR dash=null;
         for(int d=0;d<listDashAR.Count;d++) {
             if(listDashAR[d].DateCalc!=dateLastOfMonth) {
                 continue;
             }
             dash=listDashAR[d];
         }
         if(dash!=null) {//we found a DashboardAR object from the database for this month, so use it.
             listInt.Add((int)dash.BalTotal);
             continue;
         }
         agingWasRun=true;
         //run historical aging on all patients based on the date entered.
         Ledgers.ComputeAging(0,dateLastOfMonth,true);
         command=@"SELECT SUM(Bal_0_30+Bal_31_60+Bal_61_90+BalOver90),SUM(InsEst) FROM patient";
         DataTable table=Db.GetTable(command);
         dash=new DashboardAR();
         dash.DateCalc=dateLastOfMonth;
         dash.BalTotal=PIn.Double(table.Rows[0][0].ToString());
         dash.InsEst=PIn.Double(table.Rows[0][1].ToString());
         DashboardARs.Insert(dash);//save it to the db for later.
         listInt.Add((int)dash.BalTotal);//and also use it now.
     }
     if(agingWasRun) {
         Ledgers.RunAging();//set aging back to normal
     }
     List<List<int>> retVal=new List<List<int>>();
     retVal.Add(listInt);
     return retVal;
 }
Exemplo n.º 5
0
		///<summary>Only one dimension to the list for now.</summary>
		public static List<List<int>> GetAR(DateTime dateFrom,DateTime dateTo,List<DashboardAR> listDashAR) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetObject<List<List<int>>>(MethodBase.GetCurrentMethod(),dateFrom,dateTo,listDashAR);
			}
			//assumes that dateFrom is the first of the month and that there are 12 periods
			//listDashAR may be empty, in which case, this routine will take about 18 seconds, but the user was warned.
			//listDashAR may also me incomplete, especially the most recent month(s).
			string command;
			List<int> listInt;
			listInt=new List<int>();
			bool agingWasRun=false;
#if DEBUG
			_elapsedTimeAR="";
			System.Diagnostics.Stopwatch stopWatch=new System.Diagnostics.Stopwatch();
			System.Diagnostics.Stopwatch stopWatchTotal=new System.Diagnostics.Stopwatch();
			_elapsedTimeAR="Elapsed time for GetAR:\r\n";
			stopWatch.Restart();
			stopWatchTotal.Restart();
#endif
			for(int i=0;i<12;i++) {
				DateTime dateLastOfMonth=dateFrom.AddMonths(i+1).AddDays(-1);
				DashboardAR dash=null;
				for(int d=0;d<listDashAR.Count;d++) {
					if(listDashAR[d].DateCalc!=dateLastOfMonth) {
						continue;
					}
					dash=listDashAR[d];
				}
				if(dash!=null) {//we found a DashboardAR object from the database for this month, so use it.
					listInt.Add((int)dash.BalTotal);
					continue;
				}
				agingWasRun=true;
#if DEBUG
				stopWatch.Restart();
#endif
				//run historical aging on all patients based on the date entered.
				Ledgers.ComputeAging(0,dateLastOfMonth,true);
				command=@"SELECT SUM(Bal_0_30+Bal_31_60+Bal_61_90+BalOver90),SUM(InsEst) FROM patient";
				DataTable table=Db.GetTable(command);
#if DEBUG
				stopWatch.Stop();
				_elapsedTimeAR+="Ledgers.ComputeAging() #"+i+" : "+stopWatch.Elapsed.ToString()+"\r\n";
				stopWatch.Restart();
#endif
				dash=new DashboardAR();
				dash.DateCalc=dateLastOfMonth;
				dash.BalTotal=PIn.Double(table.Rows[0][0].ToString());
				dash.InsEst=PIn.Double(table.Rows[0][1].ToString());
				DashboardARs.Insert(dash);//save it to the db for later.
				listInt.Add((int)dash.BalTotal);//and also use it now.
			}
			if(agingWasRun) {
#if DEBUG
				stopWatch.Restart();
#endif
				Ledgers.RunAging();//set aging back to normal
#if DEBUG
				stopWatch.Stop();
				_elapsedTimeAR+="set aging back to normal: "+stopWatch.Elapsed.ToString()+"\r\n";
				stopWatch.Restart();
#endif
			}
#if DEBUG
			stopWatch.Stop();
			stopWatchTotal.Stop();
			_elapsedTimeAR+="Total: "+stopWatchTotal.Elapsed.ToString();
			if(_showElapsedTimesForDebug) {
				System.Windows.Forms.MessageBox.Show(_elapsedTimeAR);
			}
#endif
			List<List<int>> retVal=new List<List<int>>();
			retVal.Add(listInt);
			return retVal;
		}
Exemplo n.º 6
0
        ///<summary>Returns all DashbaordAR(s) for the given time period. Caution, this will run aging and calculate a/r if a month within the given range is missing.
        ///This can take several seconds per month missing.</summary>
        public static List <DashboardAR> GetAR(DateTime dateFrom, DateTime dateTo, List <DashboardAR> listDashAR)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <DashboardAR> >(MethodBase.GetCurrentMethod(), dateFrom, dateTo, listDashAR));
            }
            //assumes that dateFrom is the first of the month.
            string             command;
            List <DashboardAR> listRet = new List <DashboardAR>();

#if DEBUG
            _elapsedTimeAR = "";
            System.Diagnostics.Stopwatch stopWatch      = new System.Diagnostics.Stopwatch();
            System.Diagnostics.Stopwatch stopWatchTotal = new System.Diagnostics.Stopwatch();
            _elapsedTimeAR = "Elapsed time for GetAR:\r\n";
            stopWatchTotal.Start();
#endif
            int months = 0;
            while (dateTo >= dateFrom.AddMonths(months))             //calculate the number of months between the two dates.
            {
                months++;
            }
            for (int i = 0; i < months; i++)
            {
                DateTime    dateLastOfMonth = dateFrom.AddMonths(i + 1).AddDays(-1);
                DashboardAR dash            = null;
                for (int d = 0; d < listDashAR.Count; d++)
                {
                    if (listDashAR[d].DateCalc != dateLastOfMonth)
                    {
                        continue;
                    }
                    dash = listDashAR[d];
                }
                if (dash != null)               //we found a DashboardAR object from the database for this month, so use it.
                {
                    listRet.Add(dash);
                    continue;
                }
#if DEBUG
                stopWatch.Restart();
#endif
                //run historical aging on all patients based on the date entered.
                command = "SELECT SUM(Bal_0_30+Bal_31_60+Bal_61_90+BalOver90),SUM(InsEst) "
                          + "FROM (" + Ledgers.GetAgingQueryString(dateLastOfMonth, isHistoric: true) + ") guarBals";
                DataTable table = ReportsComplex.RunFuncOnReportServer(() => Db.GetTable(command));
#if DEBUG
                stopWatch.Stop();
                _elapsedTimeAR += "Aging using Ledgers.GetHistoricAgingQueryString() #" + i + " : " + stopWatch.Elapsed.ToString() + "\r\n";
#endif
                dash          = new DashboardAR();
                dash.DateCalc = dateLastOfMonth;
                dash.BalTotal = PIn.Double(table.Rows[0][0].ToString());
                dash.InsEst   = PIn.Double(table.Rows[0][1].ToString());
                DashboardARs.Insert(dash);                                                   //save it to the db for later.
                if (!string.IsNullOrEmpty(PrefC.ReportingServer.Server))                     //only attempt to insert into the reporting server if the reporting server is set up.
                {
                    ReportsComplex.RunFuncOnReportServer(() => (DashboardARs.Insert(dash))); //save it to the db for later.
                }
                listRet.Add(dash);                                                           //and also use it now.
            }
#if DEBUG
            stopWatchTotal.Stop();
            _elapsedTimeAR += "Total: " + stopWatchTotal.Elapsed.ToString();
            if (_showElapsedTimesForDebug)
            {
                System.Windows.Forms.MessageBox.Show(_elapsedTimeAR);
            }
#endif
            return(listRet);
        }