Esempio n. 1
0
        private TestsAndControls DoByondForcastCalc(SiteInstrument ins, int noofTestdays, int currentQuarter)
        {
            double testRunpercent = Convert.ToDouble(ins.TestRunPercentage) / 100d;
            TestsAndControls ctc = new TestsAndControls(13);

            ctc.TestsonInstrumentForecastPeriod = 0;
            ctc.TestsonInstrumentBufferStock = SubtotalBufferTestBeyondForecast() * testRunpercent;

            //Samples Referred from Elsewhere
            ctc.SampleReferredTestsForecastPeriod = 0;
            ctc.SampleReferredTestsBufferStock = _vlTestsReceivedFromReferringSitesBeyondForecast * testRunpercent;

            double noofControls = ins.Instrument.MaxTestBeforeCtrlTest;
            if (noofControls > 0)
            {
                ctc.ControlsPerNoOfTests = 0;
                ctc.ControlsPerNoOfTestsBuffer = (ctc.TestsonInstrumentBufferStock / noofControls);
            }

            noofControls = ins.Instrument.DailyCtrlTest;
            double controlTest = ((noofControls / (1 - _vlAdditionalTestsDuetoWastage)) * testRunpercent) * noofTestdays;
            ctc.ControlsPerDay = 0;
            ctc.ControlsPerDayBuffer = controlTest * PeriodInfo.NumberofBufferMonthsBeyondForecast;

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

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

            noofControls = ins.Instrument.QuarterlyCtrlTest;
            controlTest = ((noofControls / (1 - _vlAdditionalTestsDuetoWastage)) * 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 = Math.Round((PeriodInfo.NumberofBufferMonthsBeyondForecast - quarter) / 3d) * controlTest;

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

            return ctc;
        }
Esempio n. 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.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;
        }
Esempio n. 3
0
        private void lbtAddins_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FrmSelectInstrument frm = new FrmSelectInstrument(_site.SiteInstruments);
            frm.ShowDialog();

            if (frm.DialogResult == DialogResult.OK)
            {
                List<TestingArea> TaInSelectedIns = new List<TestingArea>();

                foreach (Instrument i in frm.SelectedInstruments)
                {

                    SiteInstrument si = new SiteInstrument();
                    si.Instrument = i;
                    si.Quantity = 1;
                    si.TestRunPercentage = 100;
                    _site.SiteInstruments.Add(si);
                    TaInSelectedIns.Add(i.TestingArea);

                }

                //AddTestingAreaInDemography(TaInSelectedIns);

                PopInstruments();

                if (OnDataUsageEdit != null)
                {
                    OnDataUsageEdit(this, new EventArgs());
                }
            }
        }
        private void SaveInstrument()
        {
            instcount = 0;
            IList<SiteInstrument> resultin = new List<SiteInstrument>();
            result = DataRepository.GetAllSite();
            try
            {
                foreach (SiteInstrumentImportData rd in _siteinstrumentdata)
                {
                    try
                    {
                        if (!rd.IsExist && !rd.HasError)
                        {
                            SiteInstrument sitein = new SiteInstrument();
                            ForlabRegion Inregion = DataRepository.GetRegionByName(rd.RegionName);
                            if (Inregion == null)
                                rd.HasError = true;
                            ForlabSite site = DataRepository.GetSiteByName(rd.SiteName, Inregion.Id);
                            if (site == null)
                                rd.HasError = true;
                            TestingArea ta = DataRepository.GetTestingAreaByName(rd.TestingArea);
                            if (ta == null)
                                rd.HasError = true;
                            Instrument Inst = DataRepository.GetInstrumentByNameAndTestingArea(rd.InstrumentName, ta.Id);
                            sitein.Site = site;
                            sitein.Instrument = Inst;
                            sitein.Quantity = rd.Quantity;
                            sitein.TestRunPercentage = rd.PecentRun;
                            //   DataRepository.SaveOrUpdateSite(site);

                            foreach (ForlabSite sitei in result)
                            {
                                if (sitei.SiteName == rd.SiteName && !sitei.SiteInstruments.Contains(sitein))
                                {
                                    sitein.Site = sitei;
                                    sitei.SiteInstruments.Add(sitein);
                                    instcount++;
                                }

                            }
                        }

                    }
                    catch (Exception ex)
                    {
                        rd.HasError = true;
                    }

                }
                   //
                //  SaveAll();
                // MessageBox.Show(instcount + " Site Instrument are imported successfully.", "Importing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                // this.DialogResult = System.Windows.Forms.DialogResult.OK;
                //this.Close();

            }
            catch
            {
                MessageBox.Show("Error: Unable to import Site Instrument data.", "Importing", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // DataRepository.CloseSession();
            }
        }