コード例 #1
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);
            }
        }
コード例 #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.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);
            }
        }