コード例 #1
0
        private ClassOfChemistryTests[] GetCalculatedReferredForChemistry(IList <int> siteIds)
        {
            ClassOfChemistryTests[] result = new ClassOfChemistryTests[13];
            for (int i = 0; i <= 12; i++)
            {
                result[i] = new ClassOfChemistryTests();
            }
            foreach (int id in siteIds)
            {
                MorbidityCalcContainer m = _listOfMorbidityCalcContainers[id];
                for (int i = 1; i <= 12; i++)
                {
                    ClassOfChemistryTests ctest = result[i - 1];
                    foreach (ChemistrySymptomDirectedTest csdt in m.ChemistryCalculation.GetChemistryTestOutputs[i].ChemSymptomDirectedTest)
                    {
                        ctest.SetChemTestValue(csdt.TestId, ctest.GetChemTestValue(csdt.TestId) + csdt.TestsReferredtoAnotherFacility);
                    }
                    ctest.TotalSamples += m.ChemistryCalculation.GetChemistryTestOutputs[i].TotalChemistrySamples;
                }

                ClassOfChemistryTests cbeyond = result[12];
                foreach (ChemistrySymptomDirectedTest csdt in m.ChemistryCalculation.GetChemistryTestOutputs[1].ChemSymptomDirectedTest)
                {
                    cbeyond.SetChemTestValue(csdt.TestId, cbeyond.GetChemTestValue(csdt.TestId) + m.ChemistryCalculation.SubtotalBufferTestBeyondForecast(csdt.TestId));
                }
                cbeyond.TotalSamples += m.ChemistryCalculation.TotalChemistrySamplesBeyoundForecast();
            }
            return(result);
        }
コード例 #2
0
        private ChemistryTestsAndControls DoByondForcastCalc(SiteInstrument ins, int noofTestdays, int currentQuarter)
        {
            double testRunpercent         = Convert.ToDouble(ins.TestRunPercentage) / 100d;
            ChemistryTestsAndControls ctc = new ChemistryTestsAndControls(13);

            foreach (ChemistrySymptomDirectedTest csdt in _chemMonthlyOutputs[12].ChemSymptomDirectedTest)
            {
                ChemistryTestOnInstrument cti = new ChemistryTestOnInstrument();
                cti.TestId = csdt.TestId;
                cti.TestsonInstrumentForecastPeriod = 0;
                cti.TestsonInstrumentBufferStock    = SubtotalBufferTestBeyondForecast(csdt.TestId) * testRunpercent;

                //Samples Referred from Elsewhere
                cti.SampleReferredTestsForecastPeriod = 0;
                cti.SampleReferredTestsBufferStock    = _testsReceivedFromReferringSitesBeyondForecast.GetChemTestValue(csdt.TestId) * testRunpercent;

                ctc.ChemTestsOnInstrument.Add(cti);
            }

            double noofControls = ins.Instrument.MaxTestBeforeCtrlTest;

            if (noofControls > 0)
            {
                ctc.ControlsPerNoOfTests       = 0;
                ctc.ControlsPerNoOfTestsBuffer = (TotalChemistrySamplesBeyoundForecast() / noofControls);
            }

            noofControls = ins.Instrument.DailyCtrlTest;
            double controlTest = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * testRunpercent) * noofTestdays;

            ctc.ControlsPerDay       = 0;
            ctc.ControlsPerDayBuffer = controlTest * PeriodInfo.NumberofBufferMonthsBeyondForecast;

            noofControls              = ins.Instrument.WeeklyCtrlTest;
            controlTest               = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * testRunpercent) * 4;
            ctc.ControlsPerWeek       = 0;
            ctc.ControlsPerWeekBuffer = controlTest * PeriodInfo.NumberofBufferMonthsBeyondForecast;

            noofControls               = ins.Instrument.MonthlyCtrlTest;
            controlTest                = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * testRunpercent) * 1;
            ctc.ControlsPerMonth       = 0;
            ctc.ControlsPerMonthBuffer = controlTest * PeriodInfo.NumberofBufferMonthsBeyondForecast;

            noofControls = ins.Instrument.QuarterlyCtrlTest;
            controlTest  = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * testRunpercent);

            int quarter = 0;

            if (currentQuarter == 12)
            {
                quarter = 2;
            }
            else if (currentQuarter == 11)
            {
                quarter = 1;
            }
            else if (currentQuarter == 10)
            {
                quarter = 0;
            }

            ctc.ControlsPerQuarter       = 0;
            ctc.ControlsPerQuarterBuffer = ((PeriodInfo.NumberofBufferMonthsBeyondForecast - quarter) / 3) * controlTest;

            ctc.TotalSamplesFP = 0;
            ctc.TotalSamplesBS = TotalChemistrySamplesBeyoundForecast() * testRunpercent;

            ctc.SampleReferredTotalSamplesFP = 0;
            ctc.SampleReferredTotalSamplesBS = _testsReceivedFromReferringSitesBeyondForecast.TotalSamples * testRunpercent;

            ctc.SampleReferredControlsPerNoOfTests = 0;
            noofControls = ins.Instrument.MaxTestBeforeCtrlTest;
            if (noofControls > 0)
            {
                ctc.SampleReferredControlsPerNoOfTestsBuffer = ctc.SampleReferredTotalSamplesBS / noofControls;
            }
            return(ctc);
        }