Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        private void CalcInstrumentDetailsAndControls()
        {
            int    noofControls;
            int    noofTestdays = ArtSite.Site.ChemistryTestingDaysPerMonth;
            double testRunpercent;
            double controlTest = 0;

            foreach (SiteInstrument ins in ArtSite.Site.GetInstrumentByPlatform(ClassOfMorbidityTestEnum.Chemistry))
            {
                ChemistryPlatformTests chemPlat = new ChemistryPlatformTests();
                chemPlat.InstrumentId = ins.Instrument.Id;
                chemPlat.Quantity     = ins.Quantity;
                testRunpercent        = Convert.ToDouble(ins.TestRunPercentage) / 100d;

                int currentQuarter = PeriodInfo.FirstMonth;

                for (int i = 1; i <= 12; i++)
                {
                    ChemistryTestsAndControls ctc = new ChemistryTestsAndControls(i);
                    foreach (ChemistrySymptomDirectedTest csdt in _chemMonthlyOutputs[i].ChemSymptomDirectedTest)
                    {
                        ChemistryTestOnInstrument cti = new ChemistryTestOnInstrument();
                        cti.TestId = csdt.TestId;
                        cti.TestsonInstrumentForecastPeriod = csdt.SubtotalOfTestBasedonProtocol * testRunpercent;
                        cti.TestsonInstrumentBufferStock    = csdt.SubtotalOfTestForBufferStock * testRunpercent;

                        //Samples Referred from Elsewhere
                        cti.SampleReferredTestsForecastPeriod = csdt.TestsonInstrumentForecastPeriodFromReferringSites * testRunpercent;
                        cti.SampleReferredTestsBufferStock    = csdt.TestsonInstrumentBufferStockFromReferringSites * testRunpercent;

                        ctc.ChemTestsOnInstrument.Add(cti);
                    }

                    noofControls = ins.Instrument.MaxTestBeforeCtrlTest;
                    if (noofControls > 0)
                    {
                        ctc.ControlsPerNoOfTests       = (_chemMonthlyOutputs[i].TotalChemistrySamplesWithinForecastPeriod / noofControls);
                        ctc.ControlsPerNoOfTestsBuffer = (_chemMonthlyOutputs[i].TotalChemistrySamplesWithinBufferStock / noofControls);
                    }

                    noofControls = ins.Instrument.DailyCtrlTest;
                    controlTest  = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * ins.Quantity) * noofTestdays;
                    if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                    {
                        ctc.ControlsPerDay = controlTest;
                    }
                    if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                    {
                        ctc.ControlsPerDayBuffer = controlTest;
                    }

                    noofControls = ins.Instrument.WeeklyCtrlTest;
                    controlTest  = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * ins.Quantity) * 4;
                    if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                    {
                        ctc.ControlsPerWeek = controlTest;
                    }
                    if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                    {
                        ctc.ControlsPerWeekBuffer = controlTest;
                    }

                    noofControls = ins.Instrument.MonthlyCtrlTest;
                    controlTest  = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * ins.Quantity) * 1;
                    if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                    {
                        ctc.ControlsPerMonth = controlTest;
                    }
                    if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                    {
                        ctc.ControlsPerMonthBuffer = controlTest;
                    }

                    noofControls = ins.Instrument.QuarterlyCtrlTest;
                    controlTest  = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * ins.Quantity);
                    if (i == currentQuarter)
                    {
                        currentQuarter += 3;
                        if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                        {
                            ctc.ControlsPerQuarter = controlTest;
                        }
                        if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                        {
                            ctc.ControlsPerQuarterBuffer = controlTest;
                        }
                    }

                    ctc.TotalSamplesFP = _chemMonthlyOutputs[i].TotalChemistrySamplesWithinForecastPeriod * testRunpercent;
                    ctc.TotalSamplesBS = _chemMonthlyOutputs[i].TotalChemistrySamplesWithinBufferStock * testRunpercent;

                    ctc.SampleReferredTotalSamplesFP = _chemMonthlyOutputs[i].TotalSampleForecastPeriodRecivedFromReferrSites * testRunpercent;
                    ctc.SampleReferredTotalSamplesBS = _chemMonthlyOutputs[i].TotalSampleBufferStockRecivedFromReferrSites * testRunpercent;

                    noofControls = ins.Instrument.MaxTestBeforeCtrlTest;
                    if (noofControls > 0)
                    {
                        ctc.SampleReferredControlsPerNoOfTests       = _chemMonthlyOutputs[i].TotalSampleForecastPeriodRecivedFromReferrSites / noofControls;
                        ctc.SampleReferredControlsPerNoOfTestsBuffer = _chemMonthlyOutputs[i].TotalSampleBufferStockRecivedFromReferrSites / noofControls;
                    }
                    chemPlat.AddTestAndControl(ctc);
                }

                chemPlat.AddTestAndControl(DoByondForcastCalc(ins, noofTestdays, currentQuarter));
                _chemPlatformTests.Add(chemPlat);
            }
        }
Exemplo n.º 3
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.TestName = csdt.TestName;
                cti.TestsonInstrumentForecastPeriod = 0;
                cti.TestsonInstrumentBufferStock = SubtotalBufferTestBeyondForecast(csdt.TestName) * testRunpercent;

                //Samples Referred from Elsewhere
                cti.SampleReferredTestsForecastPeriod = 0;
                cti.SampleReferredTestsBufferStock = _testsReceivedFromReferringSitesBeyondForecast.GetChemTestValue(csdt.TestName) * 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;
        }
Exemplo n.º 4
0
        private void CalcInstrumentDetailsAndControls()
        {
            int noofControls;
            int noofTestdays = ArtSite.Site.ChemistryTestingDaysPerMonth;
            double testRunpercent;
            double controlTest = 0;

            foreach (SiteInstrument ins in ArtSite.Site.GetInstrumentByPlatform(ClassOfMorbidityTestEnum.Chemistry))
            {
                ChemistryPlatformTests chemPlat = new ChemistryPlatformTests();
                chemPlat.InstrumentId = ins.Instrument.Id;
                chemPlat.Quantity = ins.Quantity;
                testRunpercent = Convert.ToDouble(ins.TestRunPercentage) / 100d;

                int currentQuarter = PeriodInfo.FirstMonth;

                for (int i = 1; i <= 12; i++)
                {
                    ChemistryTestsAndControls ctc = new ChemistryTestsAndControls(i);
                    foreach (ChemistrySymptomDirectedTest csdt in _chemMonthlyOutputs[i].ChemSymptomDirectedTest)
                    {
                        ChemistryTestOnInstrument cti = new ChemistryTestOnInstrument();
                        cti.TestName = csdt.TestName;
                        cti.TestsonInstrumentForecastPeriod = csdt.SubtotalOfTestBasedonProtocol* testRunpercent;
                        cti.TestsonInstrumentBufferStock = csdt.SubtotalOfTestForBufferStock * testRunpercent;

                        //Samples Referred from Elsewhere
                        cti.SampleReferredTestsForecastPeriod = csdt.TestsonInstrumentForecastPeriodFromReferringSites * testRunpercent;
                        cti.SampleReferredTestsBufferStock = csdt.TestsonInstrumentBufferStockFromReferringSites * testRunpercent;

                        ctc.ChemTestsOnInstrument.Add(cti);
                    }

                    noofControls = ins.Instrument.MaxTestBeforeCtrlTest;
                    if (noofControls > 0)
                    {
                        ctc.ControlsPerNoOfTests = (_chemMonthlyOutputs[i].TotalChemistrySamplesWithinForecastPeriod / noofControls);
                        ctc.ControlsPerNoOfTestsBuffer = (_chemMonthlyOutputs[i].TotalChemistrySamplesWithinBufferStock / noofControls);
                    }

                    noofControls = ins.Instrument.DailyCtrlTest;
                    controlTest = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * ins.Quantity) * noofTestdays;
                    if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                        ctc.ControlsPerDay = controlTest;
                    if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                        ctc.ControlsPerDayBuffer = controlTest;

                    noofControls = ins.Instrument.WeeklyCtrlTest;
                    controlTest = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * ins.Quantity) * 4;
                    if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                        ctc.ControlsPerWeek = controlTest;
                    if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                        ctc.ControlsPerWeekBuffer = controlTest;

                    noofControls = ins.Instrument.MonthlyCtrlTest;
                    controlTest = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * ins.Quantity) * 1;
                    if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                        ctc.ControlsPerMonth = controlTest;
                    if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                        ctc.ControlsPerMonthBuffer = controlTest;

                    noofControls = ins.Instrument.QuarterlyCtrlTest;
                    controlTest = ((noofControls / (1 - _chemAdditionalTestsDuetoWastage)) * ins.Quantity);
                    if (i == currentQuarter)
                    {
                        currentQuarter += 3;
                        if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                            ctc.ControlsPerQuarter = controlTest;
                        if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                            ctc.ControlsPerQuarterBuffer = controlTest;
                    }

                    ctc.TotalSamplesFP = _chemMonthlyOutputs[i].TotalChemistrySamplesWithinForecastPeriod * testRunpercent;
                    ctc.TotalSamplesBS = _chemMonthlyOutputs[i].TotalChemistrySamplesWithinBufferStock * testRunpercent;

                    ctc.SampleReferredTotalSamplesFP = _chemMonthlyOutputs[i].TotalSampleForecastPeriodRecivedFromReferrSites * testRunpercent;
                    ctc.SampleReferredTotalSamplesBS = _chemMonthlyOutputs[i].TotalSampleBufferStockRecivedFromReferrSites * testRunpercent;

                    noofControls = ins.Instrument.MaxTestBeforeCtrlTest;
                    if (noofControls > 0)
                    {
                        ctc.SampleReferredControlsPerNoOfTests = _chemMonthlyOutputs[i].TotalSampleForecastPeriodRecivedFromReferrSites / noofControls;
                        ctc.SampleReferredControlsPerNoOfTestsBuffer = _chemMonthlyOutputs[i].TotalSampleBufferStockRecivedFromReferrSites / noofControls;
                    }
                    chemPlat.AddTestAndControl(ctc);
                }

                chemPlat.AddTestAndControl(DoByondForcastCalc(ins, noofTestdays, currentQuarter));
                _chemPlatformTests.Add(chemPlat);
            }
        }
Exemplo n.º 5
0
 public void AddTestAndControl(ChemistryTestsAndControls ctc)
 {
     _testsAndControls.Add(ctc.Month, ctc);
 }
Exemplo n.º 6
0
 public void AddTestAndControl(ChemistryTestsAndControls ctc)
 {
     _testsAndControls.Add(ctc.Month, ctc);
 }