Exemple #1
0
        private void DoQuantification()
        {
            //DOES THIS SITE RECEIVE Chemistry SUPPLIES?
            if (ArtSite.ForecastVCT)
            {
                double value;
                foreach (QuantifyMenu qm in _platformObject.GeneralQuantifyMenus)
                {
                    value = 0;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Rapid_Tests.ToString())
                        value = _s1 + _s2 + _s3 + _c1 + _c2 + _c3 + _t1 + _t2 + _t3;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Screenings.ToString())
                        value = _s1 + _s2 + _s3;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Confirmatory_Tests.ToString())
                        value = _c1 + _c2 + _c3;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Tie_Breaker_Tests.ToString())
                        value = _t1 + _t2 + _t3;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Screenings_Plus_Confirmatory.ToString())
                        value = _s1 + _s2 + _s3 + _c1 + _c2 + _c3;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Screenings_Plus_Tie_Breaker.ToString())
                        value = _s1 + _s2 + _s3 + _t1 + _t2 + _t3;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Confirmatory_Plus_Tie_Breaker.ToString())
                        value = _c1 + _c2 + _c3 + _t1 + _t2 + _t3;

                    if (value > 0)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId = qm.Id;
                        qval.SiteValue = value;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);
                    }
                }

                for (int i = 1; i <= 3; i++)
                {
                    int prodcutId = RTestAlgorithm.GetProductId(TestingSpecificationGroup.Screening, i);
                    if (prodcutId > 0)
                    {
                        QuantifyMenu pqm = _platformObject.GetQuantifyMenuByProductId(prodcutId);
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId = pqm.Id;
                        qval.ReferalSiteValue = 0;

                        if (i == 1)
                            qval.SiteValue = _s1;
                        else if (i == 2)
                            qval.SiteValue = _s2;
                        else
                            qval.SiteValue = _s3;
                        _listOfQMenuWithValue.Add(qval);
                    }

                    prodcutId = RTestAlgorithm.GetProductId(TestingSpecificationGroup.Confirmatory, i);
                    if (prodcutId > 0)
                    {
                        QuantifyMenu pqmC = _platformObject.GetQuantifyMenuByProductId(prodcutId);
                        QMenuWithValue qvalC = new QMenuWithValue();
                        qvalC.QuantifyMenuId = pqmC.Id;
                        qvalC.ReferalSiteValue = 0;

                        if (i == 1)
                            qvalC.SiteValue = _c1;
                        else if (i == 2)
                            qvalC.SiteValue = _c2;
                        else
                            qvalC.SiteValue = _c3;
                        _listOfQMenuWithValue.Add(qvalC);
                    }

                    prodcutId = RTestAlgorithm.GetProductId(TestingSpecificationGroup.Tie_Breaker, i);
                    if (prodcutId > 0)
                    {
                        QuantifyMenu pqmT = _platformObject.GetQuantifyMenuByProductId(prodcutId);
                        QMenuWithValue qvalT = new QMenuWithValue();
                        qvalT.QuantifyMenuId = pqmT.Id;
                        qvalT.ReferalSiteValue = 0;

                        if (i == 1)
                            qvalT.SiteValue = _t1;
                        else if (i == 2)
                            qvalT.SiteValue = _t2;
                        else
                            qvalT.SiteValue = _t3;
                        _listOfQMenuWithValue.Add(qvalT);
                    }
                }

                foreach (QMenuWithValue qm in _listOfQMenuWithValue)
                {
                    IList<QuantificationMetric> list = _platformObject.GetQuanMetricByQuanMenuId(qm.QuantifyMenuId);

                    foreach (QuantificationMetric r in list)
                    {
                        PrimeryQuantifyedReagent pqr = new PrimeryQuantifyedReagent();
                        pqr.ProductId = r.Product.Id;
                        pqr.UnitCost = r.Product.GetActiveProductPrice(DateTime.Now).Price;
                        pqr.PackSize = r.Product.GetActiveProductPrice(DateTime.Now).PackSize;
                        pqr.Unit = r.Product.BasicUnit;

                        double testperpack = r.Product.GetActiveProductPrice(DateTime.Now).PackSize / r.UsageRate;
                        double valueofmetric = r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Collection.ToString() ? qm.SiteValue : qm.TotalValue;
                        if (ArtSite.Site.CD4RefSite > 0 && r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Testing.ToString())
                            valueofmetric = 0;
                        pqr.Value = testperpack > 0 ? valueofmetric / testperpack : 0;
                        pqr.MinimumQuantity = r.Product.MinimumPackSize;
                        _lstPrimaryQuanReagents.AddPrimeryQR(pqr);
                    }
                }
            }
        }
Exemple #2
0
        private void DoQuantification()
        {
            //DOES THIS SITE RECEIVE Chemistry SUPPLIES?
            if (ArtSite.ForecastOtherTest)
            {
                double value;

                foreach (QuantifyMenu qm in _platformObject.GeneralQuantifyMenus)
                {
                    value = 0;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Syphilis_RPR_Test.ToString())
                    {
                        value = GetSumofTest(OtherTestNameEnum.Syphilis_RPR);
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_TB_AFB_Test.ToString())
                    {
                        value = GetSumofTest(OtherTestNameEnum.TB_AFB);
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Hepatitis_HBsAG_Test.ToString())
                    {
                        value = GetSumofTest(OtherTestNameEnum.Hepatitis_HBsAG);
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Hepatitis_Anti_HCV_Test.ToString())
                    {
                        value = GetSumofTest(OtherTestNameEnum.Hepatitis_Anti_HCV);
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_TB_Culture_Test.ToString())
                    {
                        value = GetSumofTest(OtherTestNameEnum.TB_Culture);
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_TB_DST_Test.ToString())
                    {
                        value = GetSumofTest(OtherTestNameEnum.TB_DST);
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_PAP_Smear_Test.ToString())
                    {
                        value = GetSumofTest(OtherTestNameEnum.PAP_Smear);
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Genotype_Resistance_Testing_Test.ToString())
                    {
                        value = GetSumofTest(OtherTestNameEnum.Genotype_Resistance_Testing);
                    }
                    if (value > 0)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = qm.Id;
                        qval.SiteValue        = value;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);
                    }
                }

                double testperpack;
                foreach (QMenuWithValue qm in _listOfQMenuWithValue)
                {
                    IList <QuantificationMetric> list = _platformObject.GetQuanMetricByQuanMenuId(qm.QuantifyMenuId);
                    foreach (QuantificationMetric r in list)
                    {
                        PrimeryQuantifyedReagent pqr = new PrimeryQuantifyedReagent();
                        pqr.ProductId = r.Product.Id;
                        pqr.UnitCost  = r.Product.GetActiveProductPrice(DateTime.Now).Price;
                        pqr.PackSize  = r.Product.GetActiveProductPrice(DateTime.Now).PackSize;
                        pqr.Unit      = r.Product.BasicUnit;

                        testperpack         = r.Product.GetActiveProductPrice(DateTime.Now).PackSize / r.UsageRate;
                        pqr.Value           = testperpack > 0 ? qm.TotalValue / testperpack : 0;
                        pqr.MinimumQuantity = r.Product.MinimumPackSize;
                        _lstPrimaryQuanReagents.AddPrimeryQR(pqr);
                    }
                }
            }
        }
        private void DoQuantification()
        {
            //DOES THIS SITE RECEIVE Chemistry SUPPLIES?
            if (ArtSite.ForecastVCT)
            {
                double value;
                foreach (QuantifyMenu qm in _platformObject.GeneralQuantifyMenus)
                {
                    value = 0;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Rapid_Tests.ToString())
                    {
                        value = _s1 + _s2 + _s3 + _c1 + _c2 + _c3 + _t1 + _t2 + _t3;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Screenings.ToString())
                    {
                        value = _s1 + _s2 + _s3;
                    }
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Confirmatory_Tests.ToString())
                    {
                        value = _c1 + _c2 + _c3;
                    }
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Tie_Breaker_Tests.ToString())
                    {
                        value = _t1 + _t2 + _t3;
                    }
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Screenings_Plus_Confirmatory.ToString())
                    {
                        value = _s1 + _s2 + _s3 + _c1 + _c2 + _c3;
                    }
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Screenings_Plus_Tie_Breaker.ToString())
                    {
                        value = _s1 + _s2 + _s3 + _t1 + _t2 + _t3;
                    }
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Confirmatory_Plus_Tie_Breaker.ToString())
                    {
                        value = _c1 + _c2 + _c3 + _t1 + _t2 + _t3;
                    }

                    if (value > 0)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = qm.Id;
                        qval.SiteValue        = value;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);
                    }
                }

                for (int i = 1; i <= 3; i++)
                {
                    int prodcutId = RTestAlgorithm.GetProductId(TestingSpecificationGroup.Screening, i);
                    if (prodcutId > 0)
                    {
                        QuantifyMenu   pqm  = _platformObject.GetQuantifyMenuByProductId(prodcutId);
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = pqm.Id;
                        qval.ReferalSiteValue = 0;

                        if (i == 1)
                        {
                            qval.SiteValue = _s1;
                        }
                        else if (i == 2)
                        {
                            qval.SiteValue = _s2;
                        }
                        else
                        {
                            qval.SiteValue = _s3;
                        }
                        _listOfQMenuWithValue.Add(qval);
                    }

                    prodcutId = RTestAlgorithm.GetProductId(TestingSpecificationGroup.Confirmatory, i);
                    if (prodcutId > 0)
                    {
                        QuantifyMenu   pqmC  = _platformObject.GetQuantifyMenuByProductId(prodcutId);
                        QMenuWithValue qvalC = new QMenuWithValue();
                        qvalC.QuantifyMenuId   = pqmC.Id;
                        qvalC.ReferalSiteValue = 0;

                        if (i == 1)
                        {
                            qvalC.SiteValue = _c1;
                        }
                        else if (i == 2)
                        {
                            qvalC.SiteValue = _c2;
                        }
                        else
                        {
                            qvalC.SiteValue = _c3;
                        }
                        _listOfQMenuWithValue.Add(qvalC);
                    }

                    prodcutId = RTestAlgorithm.GetProductId(TestingSpecificationGroup.Tie_Breaker, i);
                    if (prodcutId > 0)
                    {
                        QuantifyMenu   pqmT  = _platformObject.GetQuantifyMenuByProductId(prodcutId);
                        QMenuWithValue qvalT = new QMenuWithValue();
                        qvalT.QuantifyMenuId   = pqmT.Id;
                        qvalT.ReferalSiteValue = 0;

                        if (i == 1)
                        {
                            qvalT.SiteValue = _t1;
                        }
                        else if (i == 2)
                        {
                            qvalT.SiteValue = _t2;
                        }
                        else
                        {
                            qvalT.SiteValue = _t3;
                        }
                        _listOfQMenuWithValue.Add(qvalT);
                    }
                }

                foreach (QMenuWithValue qm in _listOfQMenuWithValue)
                {
                    IList <QuantificationMetric> list = _platformObject.GetQuanMetricByQuanMenuId(qm.QuantifyMenuId);

                    foreach (QuantificationMetric r in list)
                    {
                        PrimeryQuantifyedReagent pqr = new PrimeryQuantifyedReagent();
                        pqr.ProductId = r.Product.Id;
                        pqr.UnitCost  = r.Product.GetActiveProductPrice(DateTime.Now).Price;
                        pqr.PackSize  = r.Product.GetActiveProductPrice(DateTime.Now).PackSize;
                        pqr.Unit      = r.Product.BasicUnit;

                        double testperpack   = r.Product.GetActiveProductPrice(DateTime.Now).PackSize / r.UsageRate;
                        double valueofmetric = r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Collection.ToString() ? qm.SiteValue : qm.TotalValue;
                        if (ArtSite.Site.CD4RefSite > 0 && r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Testing.ToString())
                        {
                            valueofmetric = 0;
                        }
                        pqr.Value           = testperpack > 0 ? valueofmetric / testperpack : 0;
                        pqr.MinimumQuantity = r.Product.MinimumPackSize;
                        _lstPrimaryQuanReagents.AddPrimeryQR(pqr);
                    }
                }
            }
        }
Exemple #4
0
        private void DoQuantification()
        {
            //DOES THIS SITE RECEIVE Chemistry SUPPLIES?
            if (ArtSite.ForecastViralLoad)
            {
                int allHemQMid = 0;
                double value, allHemInsQty = 0;
                double referralValue;
                foreach (QuantifyMenu qm in _platformObject.GeneralQuantifyMenus)
                {
                    value = 0;
                    referralValue = 0;

                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Viral_Load_Tests.ToString())
                    {
                        value = GetTotalVLTestForSite();
                        referralValue = GetTotalVLTestForReferral();
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Per_Instrument_All_Viral_Load_Instruments.ToString())
                        allHemQMid = qm.Id;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Per_Day_All_Viral_Load_Instruments.ToString() && _vlPlatformTests.Count > 0)
                        value = ArtSite.Site.ViralLoadTestingDaysPerMonth * (PeriodInfo.NumberofBufferMonthsBeyondForecast + PeriodInfo.NumberofMonthsinBudgetPeriod);

                    if (value > 0)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId = qm.Id;
                        qval.SiteValue = value;
                        qval.ReferalSiteValue = referralValue;
                        _listOfQMenuWithValue.Add(qval);
                    }
                }

                TestingDurationEnum[] tduration = LqtUtil.EnumToArray<TestingDurationEnum>();

                foreach (PlatformTestsAndControls cpt in _vlPlatformTests)
                {
                    allHemInsQty += cpt.Quantity;

                    PlatformQuantifyMenu pqm = (PlatformQuantifyMenu)_platformObject.GetPlatformQuantifyMenuByInsId(cpt.InstrumentId);
                    if (pqm != null)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId = pqm.GetQuantifyMenuId(TestTypeEnum.Test);
                        qval.SiteValue = cpt.TotalSumOfTestOnInstrument();
                        qval.ReferalSiteValue = cpt.TotalSumOfSampleReferredTestOnInstrumanet();
                        _listOfQMenuWithValue.Add(qval);

                        qval = new QMenuWithValue();
                        qval.QuantifyMenuId = pqm.GetQuantifyMenuId(TestTypeEnum.PerInstrument);
                        qval.SiteValue = cpt.Quantity;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);

                        qval = new QMenuWithValue();
                        qval.QuantifyMenuId = pqm.GetQuantifyMenuId(TestTypeEnum.PerDay);
                        qval.SiteValue = ArtSite.Site.CD4TestingDaysPerMonth * (PeriodInfo.NumberofBufferMonthsBeyondForecast + PeriodInfo.NumberofMonthsinBudgetPeriod);
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);

                        for (int i = 0; i < tduration.Length; i++)
                        {
                            qval = new QMenuWithValue();
                            qval.QuantifyMenuId = pqm.GetQuantifyMenuId(tduration[i]);
                            qval.SiteValue = cpt.GetSumOfControlsByDuration(tduration[i]);
                            if (tduration[i] == TestingDurationEnum.TotalControl || tduration[i] == TestingDurationEnum.PerTest)
                                qval.ReferalSiteValue = cpt.SampleReferredTotalControls();
                            else
                                qval.ReferalSiteValue = 0;
                            _listOfQMenuWithValue.Add(qval);
                        }
                    }
                }

                //Per Instrument - All Chemistry Instruments
                QMenuWithValue qv = new QMenuWithValue();
                qv.QuantifyMenuId = allHemQMid;
                qv.SiteValue = allHemInsQty;
                qv.ReferalSiteValue = 0;
                _listOfQMenuWithValue.Add(qv);

                foreach (QMenuWithValue qm in _listOfQMenuWithValue)
                {
                    IList<QuantificationMetric> list = _platformObject.GetQuanMetricByQuanMenuId(qm.QuantifyMenuId);

                    foreach (QuantificationMetric r in list)
                    {
                        PrimeryQuantifyedReagent pqr = new PrimeryQuantifyedReagent();
                        pqr.ProductId = r.Product.Id;
                        pqr.UnitCost = r.Product.GetActiveProductPrice(DateTime.Now).Price;
                        pqr.PackSize = r.Product.GetActiveProductPrice(DateTime.Now).PackSize;
                        pqr.Unit = r.Product.BasicUnit;

                        double testperpack = r.Product.GetActiveProductPrice(DateTime.Now).PackSize / r.UsageRate;
                        double valueofmetric = r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Collection.ToString() ? qm.SiteValue : qm.TotalValue;
                        if (ArtSite.Site.ViralLoadRefSite > 0 && r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Testing.ToString())
                            valueofmetric = 0;
                        pqr.Value = testperpack > 0 ? valueofmetric / testperpack : 0;
                        pqr.MinimumQuantity = r.Product.MinimumPackSize;
                        _lstPrimaryQuanReagents.AddPrimeryQR(pqr);
                    }
                }
            }
        }
Exemple #5
0
        private void DoQuantification()
        {
            //DOES THIS SITE RECEIVE Chemistry SUPPLIES?
            if (ArtSite.ForecastViralLoad)
            {
                int    allHemQMid = 0;
                double value, allHemInsQty = 0;
                double referralValue;
                foreach (QuantifyMenu qm in _platformObject.GeneralQuantifyMenus)
                {
                    value         = 0;
                    referralValue = 0;

                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Viral_Load_Tests.ToString())
                    {
                        value         = GetTotalVLTestForSite();
                        referralValue = GetTotalVLTestForReferral();
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Per_Instrument_All_Viral_Load_Instruments.ToString())
                    {
                        allHemQMid = qm.Id;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Per_Day_All_Viral_Load_Instruments.ToString() && _vlPlatformTests.Count > 0)
                    {
                        value = ArtSite.Site.ViralLoadTestingDaysPerMonth * (PeriodInfo.NumberofBufferMonthsBeyondForecast + PeriodInfo.NumberofMonthsinBudgetPeriod);
                    }

                    if (value > 0)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = qm.Id;
                        qval.SiteValue        = value;
                        qval.ReferalSiteValue = referralValue;
                        _listOfQMenuWithValue.Add(qval);
                    }
                }

                TestingDurationEnum[] tduration = LqtUtil.EnumToArray <TestingDurationEnum>();

                foreach (PlatformTestsAndControls cpt in _vlPlatformTests)
                {
                    allHemInsQty += cpt.Quantity;

                    PlatformQuantifyMenu pqm = (PlatformQuantifyMenu)_platformObject.GetPlatformQuantifyMenuByInsId(cpt.InstrumentId);
                    if (pqm != null)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = pqm.GetQuantifyMenuId(TestTypeEnum.Test);
                        qval.SiteValue        = cpt.TotalSumOfTestOnInstrument();
                        qval.ReferalSiteValue = cpt.TotalSumOfSampleReferredTestOnInstrumanet();
                        _listOfQMenuWithValue.Add(qval);

                        qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = pqm.GetQuantifyMenuId(TestTypeEnum.PerInstrument);
                        qval.SiteValue        = cpt.Quantity;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);

                        qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = pqm.GetQuantifyMenuId(TestTypeEnum.PerDay);
                        qval.SiteValue        = ArtSite.Site.CD4TestingDaysPerMonth * (PeriodInfo.NumberofBufferMonthsBeyondForecast + PeriodInfo.NumberofMonthsinBudgetPeriod);
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);

                        for (int i = 0; i < tduration.Length; i++)
                        {
                            qval = new QMenuWithValue();
                            qval.QuantifyMenuId = pqm.GetQuantifyMenuId(tduration[i]);
                            qval.SiteValue      = cpt.GetSumOfControlsByDuration(tduration[i]);
                            if (tduration[i] == TestingDurationEnum.TotalControl || tduration[i] == TestingDurationEnum.PerTest)
                            {
                                qval.ReferalSiteValue = cpt.SampleReferredTotalControls();
                            }
                            else
                            {
                                qval.ReferalSiteValue = 0;
                            }
                            _listOfQMenuWithValue.Add(qval);
                        }
                    }
                }

                //Per Instrument - All Chemistry Instruments
                QMenuWithValue qv = new QMenuWithValue();
                qv.QuantifyMenuId   = allHemQMid;
                qv.SiteValue        = allHemInsQty;
                qv.ReferalSiteValue = 0;
                _listOfQMenuWithValue.Add(qv);

                foreach (QMenuWithValue qm in _listOfQMenuWithValue)
                {
                    IList <QuantificationMetric> list = _platformObject.GetQuanMetricByQuanMenuId(qm.QuantifyMenuId);

                    foreach (QuantificationMetric r in list)
                    {
                        PrimeryQuantifyedReagent pqr = new PrimeryQuantifyedReagent();
                        pqr.ProductId = r.Product.Id;
                        pqr.UnitCost  = r.Product.GetActiveProductPrice(DateTime.Now).Price;
                        pqr.PackSize  = r.Product.GetActiveProductPrice(DateTime.Now).PackSize;
                        pqr.Unit      = r.Product.BasicUnit;

                        double testperpack   = r.Product.GetActiveProductPrice(DateTime.Now).PackSize / r.UsageRate;
                        double valueofmetric = r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Collection.ToString() ? qm.SiteValue : qm.TotalValue;
                        if (ArtSite.Site.ViralLoadRefSite > 0 && r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Testing.ToString())
                        {
                            valueofmetric = 0;
                        }
                        pqr.Value           = testperpack > 0 ? valueofmetric / testperpack : 0;
                        pqr.MinimumQuantity = r.Product.MinimumPackSize;
                        _lstPrimaryQuanReagents.AddPrimeryQR(pqr);
                    }
                }
            }
        }
Exemple #6
0
        private void CalculateOtherTest()
        {
            _adultArtNewPatientBloodDraws         = ArtSite.AITNewPatientBloodDraws;
            _adultArtExistingPatientBloodDraws    = ArtSite.AITExistingPatientBloodDraws;
            _adultPreArtNewPatientBloodDraws      = ArtSite.AIPNewPatientBloodDraws;
            _adultPreArtExistingPatientBloodDraws = ArtSite.AIPExistingPatientBloodDraws;

            _pedArtNewPatientBloodDraws         = ArtSite.PITNewPatientBloodDraws;
            _pedArtExistingPatientBloodDraws    = ArtSite.PITExistingPatientBloodDraws;
            _pedPreArtNewPatientBloodDraws      = ArtSite.PIPNewPatientBloodDraws;
            _pedPreArtExistingPatientBloodDraws = ArtSite.PIPExistingPatientBloodDraws;


            for (int i = 1; i <= 12; i++)
            {
                MOutputConsumable otherOut = new MOutputConsumable();
                otherOut.Month = i;
                otherOut.AdultArtExistingPatientBloodDraws    = (CalculatedPatientNos[i].ArtAdultPreExistingPatients * (_adultArtExistingPatientBloodDraws / 12d));
                otherOut.AdultArtNewPatientBloodDraws         = (CalculatedPatientNos[i].TotalArtAdultPatientsEntering() * (_adultArtNewPatientBloodDraws / 12d));
                otherOut.AdultPreArtExistingPatientBloodDraws = (CalculatedPatientNos[i].PreArtAdultPreExistingPatients * (_adultPreArtExistingPatientBloodDraws / 12d));
                otherOut.AdultPreArtNewPatientBloodDraws      = (CalculatedPatientNos[i].TotalPreArtAdultPatientsEntering() * (_adultPreArtNewPatientBloodDraws / 12d));

                otherOut.PediatricArtExistingPatientBloodDraws    = (CalculatedPatientNos[i].ArtPediatricPreExistingPatients * (_pedArtExistingPatientBloodDraws / 12d));
                otherOut.PediatricArtNewPatientBloodDraws         = (CalculatedPatientNos[i].TotalArtPediatricPatientsEntering() * (_pedArtNewPatientBloodDraws / 12d));
                otherOut.PediatricPreArtExistingPatientBloodDraws = (CalculatedPatientNos[i].PreArtPediatricPreExistingPatients * (_pedPreArtExistingPatientBloodDraws / 12d));
                otherOut.PediatricPreArtNewPatientBloodDraws      = (CalculatedPatientNos[i].TotalPreArtPediatricPatientsEntering() * (_pedPreArtNewPatientBloodDraws / 12d));

                if ((i + 1 >= PeriodInfo.BeginsOnmonth) && (i + 1 <= PeriodInfo.EndOnMonth))
                {
                    otherOut.TotalAdultBloodDrawsBeyondForecastPeriod     = otherOut.GetSumOfAdultBloodDraws();
                    otherOut.TotalPediatricBloodDrawsBeyondForecastPeriod = otherOut.GetSumOfPediatricBloodDraws();
                    otherOut.TotalBloodDrawsBeyondForecastPeriod          = otherOut.GetSumOfAdultBloodDraws() + otherOut.GetSumOfPediatricBloodDraws();
                }
                else
                {
                    otherOut.TotalAdultBloodDrawsBeyondForecastPeriod     = 0;
                    otherOut.TotalPediatricBloodDrawsBeyondForecastPeriod = 0;
                    otherOut.TotalBloodDrawsBeyondForecastPeriod          = 0;
                }

                if ((i + 1 >= PeriodInfo.FirstMonth) && (i + 1 <= PeriodInfo.LastMonth))
                {
                    otherOut.TotalAdultBloodDraws     = otherOut.GetSumOfAdultBloodDraws();
                    otherOut.TotalPediatricBloodDraws = otherOut.GetSumOfPediatricBloodDraws();

                    otherOut.PositiveDiagnoses                        = RapidTestOutputs[i].AdultsPositiveDiagnoses + RapidTestOutputs[i].PediatricsPositiveDiagnoses;
                    otherOut.PositiveDiagnosesToReceiveCD4            = CD4MonthlyOutputs[i].TotalReceivingCD4Test();
                    otherOut.PositiveDiagnosesBufferStock             = 0;
                    otherOut.PositiveDiagnosesToReceiveCD4BufferStock = 0;
                }
                else
                {
                    otherOut.TotalAdultBloodDraws     = 0;
                    otherOut.TotalPediatricBloodDraws = 0;

                    otherOut.PositiveDiagnoses                        = 0;
                    otherOut.PositiveDiagnosesToReceiveCD4            = 0;
                    otherOut.PositiveDiagnosesBufferStock             = RapidTestOutputs[i].AdultsPositiveDiagnoses + RapidTestOutputs[i].PediatricsPositiveDiagnoses;
                    otherOut.PositiveDiagnosesToReceiveCD4BufferStock = CD4MonthlyOutputs[i].TotalReceivingCD4Test();
                }
                _othMonthlyOutputs.Add(i, otherOut);
            }

            _adultTotalBufferBeyondForecastPeriod              = _othMonthlyOutputs[12].GetSumOfAdultBloodDraws() * PeriodInfo.NumberofBufferMonthsBeyondForecast;
            _pedTotalBufferBeyondForecastPeriod                = _othMonthlyOutputs[12].GetSumOfPediatricBloodDraws() * PeriodInfo.NumberofBufferMonthsBeyondForecast;
            _PositiveDiagnosesBeyondForecastPeriod             = (RapidTestOutputs[12].AdultsPositiveDiagnoses + RapidTestOutputs[12].PediatricsPositiveDiagnoses) * PeriodInfo.NumberofBufferMonthsBeyondForecast;
            _PositiveDiagnosesToReceiveCD4BeyondForecastPeriod = CD4MonthlyOutputs[12].TotalReceivingCD4Test() * PeriodInfo.NumberofBufferMonthsBeyondForecast;

            QMenuWithValue qvalue;

            //DOES THIS SITE RECEIVE CONSUMMABLE SUPPLIES?
            if (ArtSite.ForecastConsumable)
            {
                foreach (QuantifyMenu qm in _platformObject.GeneralQuantifyMenus)
                {
                    double value = 0;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Positive_Diagnoses.ToString())
                    {
                        value = TotalPositiveDiagnoses();
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Positive_Diagnoses_to_Receive_CD4.ToString())
                    {
                        value = TotalPositiveDiagnosestoReceiveCD4();
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Blood_Draws.ToString())
                    {
                        value = TOTALBloodDraws();
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Blood_Draws_Adult.ToString())
                    {
                        value = TotalAdultBloodDraws();
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Blood_Draws_Pediatric.ToString())
                    {
                        value = TotalPediatricBloodDraws();
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.PerDay_PerSite.ToString())
                    {
                        value = PeriodInfo.WorkingDaysinBudgetPeriod;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.PerWeek_PerSite.ToString())
                    {
                        value = PeriodInfo.WeeksinBudgetPeriod;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.PerMonth_PerSite.ToString())
                    {
                        value = PeriodInfo.NumberofMonthsinBudgetPeriod;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.PerQuarter_PerSite.ToString())
                    {
                        value = PeriodInfo.QuartersinBudgetPeriod;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.PerYear_PerSite.ToString())
                    {
                        value = 1;
                    }
                    else
                    {
                        qvalue = null;
                        switch (qm.ClassOfTestToEnum)
                        {
                        case ClassOfMorbidityTestEnum.CD4:
                            qvalue = CD4TestCalculator.GetQMenuWithValueByQuantifyMenuId(qm.Id);
                            break;

                        case ClassOfMorbidityTestEnum.Chemistry:
                            qvalue = ChemistryTestCalculator.GetQMenuWithValueByQuantifyMenuId(qm.Id);
                            break;

                        case ClassOfMorbidityTestEnum.Hematology:
                            qvalue = HematologyTestCalculator.GetQMenuWithValueByQuantifyMenuId(qm.Id);
                            break;

                        case ClassOfMorbidityTestEnum.ViralLoad:
                            qvalue = ViralTestCalculator.GetQMenuWithValueByQuantifyMenuId(qm.Id);
                            break;

                        case ClassOfMorbidityTestEnum.RapidTest:
                            qvalue = RapidTestCalculator.GetQMenuWithValueByQuantifyMenuId(qm.Id);
                            break;
                        }
                        if (qvalue != null)
                        {
                            value = qvalue.SiteValue;
                        }
                    }

                    if (value > 0)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = qm.Id;
                        qval.SiteValue        = value;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);
                    }
                }

                foreach (QMenuWithValue qm in _listOfQMenuWithValue)
                {
                    IList <QuantificationMetric> list = _platformObject.GetQuanMetricByQuanMenuId(qm.QuantifyMenuId);
                    foreach (QuantificationMetric r in list)
                    {
                        PrimeryQuantifyedReagent pqr = new PrimeryQuantifyedReagent();
                        pqr.ProductId = r.Product.Id;
                        pqr.UnitCost  = r.Product.GetActiveProductPrice(DateTime.Now).Price;
                        pqr.PackSize  = r.Product.GetActiveProductPrice(DateTime.Now).PackSize;
                        pqr.Unit      = r.Product.BasicUnit;

                        double testperpack = r.Product.GetActiveProductPrice(DateTime.Now).PackSize / r.UsageRate;
                        pqr.Value           = testperpack > 0 ? qm.SiteValue / testperpack : 0;
                        pqr.MinimumQuantity = r.Product.MinimumPackSize;
                        _lstPrimaryQuanReagents.AddPrimeryQR(pqr);
                    }
                }
            }
        }
Exemple #7
0
        private void DoQuantification()
        {
            //DOES THIS SITE RECEIVE Chemistry SUPPLIES?
            if (ArtSite.ForecastChemistry)
            {
                InitTotalValues();
                int    allChemQMid = 0;
                double value, allChemInsQty = 0;
                foreach (QuantifyMenu qm in _platformObject.GeneralQuantifyMenus)
                {
                    value = 0;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Chemistry_Patient_Samples_Run_On_All_Instruments.ToString())
                    {
                        value = TotalPatientSamples;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Chemistry_controls_for_all_instruments.ToString())
                    {
                        value = TotalControls;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_ALP_Tests_on_all_instruments.ToString())
                    {
                        value = TotalALP;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_ALT_Tests_on_all_instruments.ToString())
                    {
                        value = TotalALT;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_AMY_Tests_on_all_instruments.ToString())
                    {
                        value = TotalAMY;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_AST_Tests_on_all_instruments.ToString())
                    {
                        value = TotalAST;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_CHO_Tests_on_all_instruments.ToString())
                    {
                        value = TotalCHO;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_CO2_Tests_on_all_instruments.ToString())
                    {
                        value = TotalCO2;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_CRE_Tests_on_all_instruments.ToString())
                    {
                        value = TotalCRE;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Electrolyte_Panel_tests_on_all_instruments.ToString())
                    {
                        value = TotalElectrolyte;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_GGT_Tests_on_all_instruments.ToString())
                    {
                        value = TotalGGT;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_GLC_Tests_on_all_instruments.ToString())
                    {
                        value = TotalGLC;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_TG_Tests_on_all_instruments.ToString())
                    {
                        value = TotalTG;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Urea_tests_on_all_instruments.ToString())
                    {
                        value = TotalUrea;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Per_Instrument_All_Chemistry_Instruments.ToString())
                    {
                        allChemQMid = qm.Id;
                    }
                    else if (qm.Title == GeneralQuantifyMenuEnum.Per_Day_All_Chemistry_Instruments.ToString() && _chemPlatformTests.Count > 0)
                    {
                        value = ArtSite.Site.ChemistryTestingDaysPerMonth * (PeriodInfo.NumberofBufferMonthsBeyondForecast + PeriodInfo.NumberofMonthsinBudgetPeriod);
                    }

                    if (value > 0)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = qm.Id;
                        qval.SiteValue        = value;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);
                    }
                }

                ChemistryTestNameEnum[] chemTests = LqtUtil.EnumToArray <ChemistryTestNameEnum>();
                TestingDurationEnum[]   tduration = LqtUtil.EnumToArray <TestingDurationEnum>();

                foreach (ChemistryPlatformTests cpt in _chemPlatformTests)
                {
                    allChemInsQty += cpt.Quantity;

                    CTestPlatformQuantifyMenu pqm = (CTestPlatformQuantifyMenu)_platformObject.GetPlatformQuantifyMenuByInsId(cpt.InstrumentId);
                    if (pqm != null)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = pqm.TotalPatientSamplesRunOnIns;
                        qval.SiteValue        = cpt.TotalSmaples();
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);

                        qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = pqm.GetQuantifyMenuId(TestTypeEnum.PerInstrument);
                        qval.SiteValue        = cpt.Quantity;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);

                        qval = new QMenuWithValue();
                        qval.QuantifyMenuId   = pqm.GetQuantifyMenuId(TestTypeEnum.PerDay);
                        qval.SiteValue        = ArtSite.Site.ChemistryTestingDaysPerMonth * (PeriodInfo.NumberofBufferMonthsBeyondForecast + PeriodInfo.NumberofMonthsinBudgetPeriod);
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);

                        for (int i = 0; i < chemTests.Length; i++)
                        {
                            if (ParameterIncluded(chemTests[i]))
                            {
                                qval = new QMenuWithValue();
                                qval.QuantifyMenuId   = pqm.GetChemQuantifyMenuId(chemTests[i]);
                                qval.SiteValue        = cpt.TotalTestsOnInstrument(chemTests[i]);
                                qval.ReferalSiteValue = 0;
                                _listOfQMenuWithValue.Add(qval);
                            }
                        }

                        for (int i = 0; i < tduration.Length; i++)
                        {
                            qval = new QMenuWithValue();
                            qval.QuantifyMenuId   = pqm.GetQuantifyMenuId(tduration[i]);
                            qval.SiteValue        = cpt.GetSumOfControlsByDuration(tduration[i]);
                            qval.ReferalSiteValue = 0;
                            _listOfQMenuWithValue.Add(qval);
                        }
                    }
                }

                //Per Instrument - All Chemistry Instruments
                QMenuWithValue qv = new QMenuWithValue();
                qv.QuantifyMenuId   = allChemQMid;
                qv.SiteValue        = allChemInsQty;
                qv.ReferalSiteValue = 0;
                _listOfQMenuWithValue.Add(qv);

                foreach (QMenuWithValue qm in _listOfQMenuWithValue)
                {
                    IList <QuantificationMetric> list = _platformObject.GetQuanMetricByQuanMenuId(qm.QuantifyMenuId);

                    foreach (QuantificationMetric r in list)
                    {
                        PrimeryQuantifyedReagent pqr = new PrimeryQuantifyedReagent();
                        pqr.ProductId = r.Product.Id;
                        pqr.UnitCost  = r.Product.GetActiveProductPrice(DateTime.Now).Price;
                        pqr.PackSize  = r.Product.GetActiveProductPrice(DateTime.Now).PackSize;
                        pqr.Unit      = r.Product.BasicUnit;

                        double testperpack   = r.Product.GetActiveProductPrice(DateTime.Now).PackSize / r.UsageRate;
                        double valueofmetric = r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Collection.ToString() ? qm.SiteValue : qm.TotalValue;
                        if (ArtSite.Site.ChemistryRefSite > 0 && r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Testing.ToString())
                        {
                            valueofmetric = 0;
                        }
                        pqr.Value           = testperpack > 0 ? valueofmetric / testperpack : 0;
                        pqr.MinimumQuantity = r.Product.MinimumPackSize;
                        _lstPrimaryQuanReagents.AddPrimeryQR(pqr);
                    }
                }
            }
        }
        private void DoQuantification()
        {
            //DOES THIS SITE RECEIVE Chemistry SUPPLIES?
            if (ArtSite.ForecastChemistry)
            {
                InitTotalValues();
                int allChemQMid = 0;
                double value, allChemInsQty = 0;
                foreach (QuantifyMenu qm in _platformObject.GeneralQuantifyMenus)
                {
                    value = 0;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Chemistry_Patient_Samples_Run_On_All_Instruments.ToString())
                        value = TotalPatientSamples;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Chemistry_controls_for_all_instruments.ToString())
                        value = TotalControls;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_ALP_Tests_on_all_instruments.ToString())
                        value = TotalALP;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_ALT_Tests_on_all_instruments.ToString())
                        value = TotalALT;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_AMY_Tests_on_all_instruments.ToString())
                        value = TotalAMY;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_AST_Tests_on_all_instruments.ToString())
                        value = TotalAST;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_CHO_Tests_on_all_instruments.ToString())
                        value = TotalCHO;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_CO2_Tests_on_all_instruments.ToString())
                        value = TotalCO2;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_CRE_Tests_on_all_instruments.ToString())
                        value = TotalCRE;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Electrolyte_Panel_tests_on_all_instruments.ToString())
                        value = TotalElectrolyte;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_GGT_Tests_on_all_instruments.ToString())
                        value = TotalGGT;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_GLC_Tests_on_all_instruments.ToString())
                        value = TotalGLC;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_TG_Tests_on_all_instruments.ToString())
                        value = TotalTG;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Urea_tests_on_all_instruments.ToString())
                        value = TotalUrea;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Per_Instrument_All_Chemistry_Instruments.ToString())
                        allChemQMid = qm.Id;
                    else if (qm.Title == GeneralQuantifyMenuEnum.Per_Day_All_Chemistry_Instruments.ToString() && _chemPlatformTests.Count > 0)
                        value = ArtSite.Site.ChemistryTestingDaysPerMonth * (PeriodInfo.NumberofBufferMonthsBeyondForecast + PeriodInfo.NumberofMonthsinBudgetPeriod);

                    if (value > 0)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId = qm.Id;
                        qval.SiteValue = value;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);
                    }
                }

                ChemistryTestNameEnum[] chemTests = LqtUtil.EnumToArray<ChemistryTestNameEnum>();
                TestingDurationEnum[] tduration = LqtUtil.EnumToArray<TestingDurationEnum>();

                foreach(ChemistryPlatformTests cpt in _chemPlatformTests)
                {
                    allChemInsQty += cpt.Quantity;

                    CTestPlatformQuantifyMenu pqm = (CTestPlatformQuantifyMenu)_platformObject.GetPlatformQuantifyMenuByInsId(cpt.InstrumentId);
                    if (pqm != null)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId = pqm.TotalPatientSamplesRunOnIns;
                        qval.SiteValue = cpt.TotalSmaples();
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);

                        qval = new QMenuWithValue();
                        qval.QuantifyMenuId = pqm.GetQuantifyMenuId(TestTypeEnum.PerInstrument);
                        qval.SiteValue = cpt.Quantity;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);

                        qval = new QMenuWithValue();
                        qval.QuantifyMenuId = pqm.GetQuantifyMenuId(TestTypeEnum.PerDay);
                        qval.SiteValue = ArtSite.Site.ChemistryTestingDaysPerMonth * (PeriodInfo.NumberofBufferMonthsBeyondForecast + PeriodInfo.NumberofMonthsinBudgetPeriod);
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);

                        for (int i = 0; i < chemTests.Length; i++)
                        {
                            if (ParameterIncluded(chemTests[i]))
                            {
                                qval = new QMenuWithValue();
                                qval.QuantifyMenuId = pqm.GetChemQuantifyMenuId(chemTests[i]);
                                qval.SiteValue = cpt.TotalTestsOnInstrument(chemTests[i]);
                                qval.ReferalSiteValue = 0;
                                _listOfQMenuWithValue.Add(qval);
                            }
                        }

                        for (int i = 0; i < tduration.Length; i++)
                        {
                            qval = new QMenuWithValue();
                            qval.QuantifyMenuId = pqm.GetQuantifyMenuId(tduration[i]);
                            qval.SiteValue = cpt.GetSumOfControlsByDuration(tduration[i]);
                            qval.ReferalSiteValue = 0;
                            _listOfQMenuWithValue.Add(qval);
                        }
                    }
                }

                //Per Instrument - All Chemistry Instruments
                QMenuWithValue qv = new QMenuWithValue();
                qv.QuantifyMenuId = allChemQMid;
                qv.SiteValue = allChemInsQty;
                qv.ReferalSiteValue = 0;
                _listOfQMenuWithValue.Add(qv);

                foreach (QMenuWithValue qm in _listOfQMenuWithValue)
                {
                    IList<QuantificationMetric> list = _platformObject.GetQuanMetricByQuanMenuId(qm.QuantifyMenuId);

                    foreach (QuantificationMetric r in list)
                    {
                        PrimeryQuantifyedReagent pqr = new PrimeryQuantifyedReagent();
                        pqr.ProductId = r.Product.Id;
                        pqr.UnitCost = r.Product.GetActiveProductPrice(DateTime.Now).Price;
                        pqr.PackSize = r.Product.GetActiveProductPrice(DateTime.Now).PackSize;
                        pqr.Unit = r.Product.BasicUnit;

                        double testperpack = r.Product.GetActiveProductPrice(DateTime.Now).PackSize / r.UsageRate;
                        double valueofmetric = r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Collection.ToString() ? qm.SiteValue : qm.TotalValue;
                        if (ArtSite.Site.ChemistryRefSite > 0 && r.CollectionSupplieAppliedTo == CollectionSupplieAppliedToEnum.Testing.ToString())
                            valueofmetric = 0;
                        pqr.Value = testperpack > 0 ? valueofmetric / testperpack : 0;
                        pqr.MinimumQuantity = r.Product.MinimumPackSize;
                        _lstPrimaryQuanReagents.AddPrimeryQR(pqr);
                    }
                }
            }
        }
Exemple #9
0
        private void DoQuantification()
        {
            //DOES THIS SITE RECEIVE Chemistry SUPPLIES?
            if (ArtSite.ForecastOtherTest)
            {
                double value;

                foreach (QuantifyMenu qm in _platformObject.GeneralQuantifyMenus)
                {
                    value = 0;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Syphilis_RPR_Test.ToString())
                        value = GetSumofTest(OtherTestNameEnum.Syphilis_RPR);
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_TB_AFB_Test.ToString())
                        value = GetSumofTest(OtherTestNameEnum.TB_AFB);
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Hepatitis_HBsAG_Test.ToString())
                        value = GetSumofTest(OtherTestNameEnum.Hepatitis_HBsAG);
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Hepatitis_Anti_HCV_Test.ToString())
                        value = GetSumofTest(OtherTestNameEnum.Hepatitis_Anti_HCV);
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_TB_Culture_Test.ToString())
                        value = GetSumofTest(OtherTestNameEnum.TB_Culture);
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_TB_DST_Test.ToString())
                        value = GetSumofTest(OtherTestNameEnum.TB_DST);
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_PAP_Smear_Test.ToString())
                        value = GetSumofTest(OtherTestNameEnum.PAP_Smear);
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Genotype_Resistance_Testing_Test.ToString())
                        value = GetSumofTest(OtherTestNameEnum.Genotype_Resistance_Testing);
                    if (value > 0)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId = qm.Id;
                        qval.SiteValue = value;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);
                    }
                }

                double testperpack;
                foreach (QMenuWithValue qm in _listOfQMenuWithValue)
                {
                    IList<QuantificationMetric> list = _platformObject.GetQuanMetricByQuanMenuId(qm.QuantifyMenuId);
                    foreach (QuantificationMetric r in list)
                    {
                        PrimeryQuantifyedReagent pqr = new PrimeryQuantifyedReagent();
                        pqr.ProductId = r.Product.Id;
                        pqr.UnitCost = r.Product.GetActiveProductPrice(DateTime.Now).Price;
                        pqr.PackSize = r.Product.GetActiveProductPrice(DateTime.Now).PackSize;
                        pqr.Unit = r.Product.BasicUnit;

                        testperpack = r.Product.GetActiveProductPrice(DateTime.Now).PackSize / r.UsageRate;
                        pqr.Value = testperpack > 0 ? qm.TotalValue / testperpack : 0;
                        pqr.MinimumQuantity = r.Product.MinimumPackSize;
                        _lstPrimaryQuanReagents.AddPrimeryQR(pqr);
                    }
                }
            }
        }
Exemple #10
0
        private void CalculateOtherTest()
        {
            _adultArtNewPatientBloodDraws = ArtSite.AITNewPatientBloodDraws;
            _adultArtExistingPatientBloodDraws = ArtSite.AITExistingPatientBloodDraws;
            _adultPreArtNewPatientBloodDraws = ArtSite.AIPNewPatientBloodDraws;
            _adultPreArtExistingPatientBloodDraws = ArtSite.AIPExistingPatientBloodDraws;

            _pedArtNewPatientBloodDraws = ArtSite.PITNewPatientBloodDraws;
            _pedArtExistingPatientBloodDraws = ArtSite.PITExistingPatientBloodDraws;
            _pedPreArtNewPatientBloodDraws = ArtSite.PIPNewPatientBloodDraws;
            _pedPreArtExistingPatientBloodDraws = ArtSite.PIPExistingPatientBloodDraws;

            for (int i = 1; i <= 12; i++)
            {
                MOutputConsumable otherOut = new MOutputConsumable();
                otherOut.Month = i;
                otherOut.AdultArtExistingPatientBloodDraws = (CalculatedPatientNos[i].ArtAdultPreExistingPatients * (_adultArtExistingPatientBloodDraws / 12d));
                otherOut.AdultArtNewPatientBloodDraws = (CalculatedPatientNos[i].TotalArtAdultPatientsEntering() * (_adultArtNewPatientBloodDraws / 12d));
                otherOut.AdultPreArtExistingPatientBloodDraws = (CalculatedPatientNos[i].PreArtAdultPreExistingPatients * (_adultPreArtExistingPatientBloodDraws / 12d));
                otherOut.AdultPreArtNewPatientBloodDraws = (CalculatedPatientNos[i].TotalPreArtAdultPatientsEntering() * (_adultPreArtNewPatientBloodDraws / 12d));

                otherOut.PediatricArtExistingPatientBloodDraws = (CalculatedPatientNos[i].ArtPediatricPreExistingPatients * (_pedArtExistingPatientBloodDraws / 12d));
                otherOut.PediatricArtNewPatientBloodDraws = (CalculatedPatientNos[i].TotalArtPediatricPatientsEntering() * (_pedArtNewPatientBloodDraws / 12d));
                otherOut.PediatricPreArtExistingPatientBloodDraws = (CalculatedPatientNos[i].PreArtPediatricPreExistingPatients * (_pedPreArtExistingPatientBloodDraws / 12d));
                otherOut.PediatricPreArtNewPatientBloodDraws = (CalculatedPatientNos[i].TotalPreArtPediatricPatientsEntering() * (_pedPreArtNewPatientBloodDraws / 12d));

                if ((i + 1 >= PeriodInfo.BeginsOnmonth) && (i + 1 <= PeriodInfo.EndOnMonth))
                {
                    otherOut.TotalAdultBloodDrawsBeyondForecastPeriod = otherOut.GetSumOfAdultBloodDraws();
                    otherOut.TotalPediatricBloodDrawsBeyondForecastPeriod = otherOut.GetSumOfPediatricBloodDraws();
                    otherOut.TotalBloodDrawsBeyondForecastPeriod = otherOut.GetSumOfAdultBloodDraws() + otherOut.GetSumOfPediatricBloodDraws();
                }
                else
                {
                    otherOut.TotalAdultBloodDrawsBeyondForecastPeriod = 0;
                    otherOut.TotalPediatricBloodDrawsBeyondForecastPeriod = 0;
                    otherOut.TotalBloodDrawsBeyondForecastPeriod = 0;
                }

                if ((i + 1 >= PeriodInfo.FirstMonth) && (i + 1 <= PeriodInfo.LastMonth))
                {
                    otherOut.TotalAdultBloodDraws = otherOut.GetSumOfAdultBloodDraws();
                    otherOut.TotalPediatricBloodDraws = otherOut.GetSumOfPediatricBloodDraws();

                    otherOut.PositiveDiagnoses = RapidTestOutputs[i].AdultsPositiveDiagnoses + RapidTestOutputs[i].PediatricsPositiveDiagnoses;
                    otherOut.PositiveDiagnosesToReceiveCD4 = CD4MonthlyOutputs[i].TotalReceivingCD4Test();
                    otherOut.PositiveDiagnosesBufferStock = 0;
                    otherOut.PositiveDiagnosesToReceiveCD4BufferStock = 0;
                }
                else
                {
                    otherOut.TotalAdultBloodDraws = 0;
                    otherOut.TotalPediatricBloodDraws = 0;

                    otherOut.PositiveDiagnoses = 0;
                    otherOut.PositiveDiagnosesToReceiveCD4 = 0;
                    otherOut.PositiveDiagnosesBufferStock = RapidTestOutputs[i].AdultsPositiveDiagnoses + RapidTestOutputs[i].PediatricsPositiveDiagnoses;
                    otherOut.PositiveDiagnosesToReceiveCD4BufferStock = CD4MonthlyOutputs[i].TotalReceivingCD4Test();
                }
                _othMonthlyOutputs.Add(i, otherOut);
            }

            _adultTotalBufferBeyondForecastPeriod = _othMonthlyOutputs[12].GetSumOfAdultBloodDraws() * PeriodInfo.NumberofBufferMonthsBeyondForecast;
            _pedTotalBufferBeyondForecastPeriod = _othMonthlyOutputs[12].GetSumOfPediatricBloodDraws() * PeriodInfo.NumberofBufferMonthsBeyondForecast;
            _PositiveDiagnosesBeyondForecastPeriod = (RapidTestOutputs[12].AdultsPositiveDiagnoses + RapidTestOutputs[12].PediatricsPositiveDiagnoses) * PeriodInfo.NumberofBufferMonthsBeyondForecast;
            _PositiveDiagnosesToReceiveCD4BeyondForecastPeriod = CD4MonthlyOutputs[12].TotalReceivingCD4Test() * PeriodInfo.NumberofBufferMonthsBeyondForecast;

            QMenuWithValue qvalue;
            //DOES THIS SITE RECEIVE CONSUMMABLE SUPPLIES?
            if (ArtSite.ForecastConsumable)
            {
                foreach (QuantifyMenu qm in _platformObject.GeneralQuantifyMenus)
                {
                    double value = 0;
                    if (qm.Title == GeneralQuantifyMenuEnum.Total_Positive_Diagnoses.ToString())
                        value = TotalPositiveDiagnoses();
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Positive_Diagnoses_to_Receive_CD4.ToString())
                        value = TotalPositiveDiagnosestoReceiveCD4();
                    else if (qm.Title == GeneralQuantifyMenuEnum.Total_Blood_Draws.ToString())
                        value = TOTALBloodDraws();
                    else if (qm.Title == GeneralQuantifyMenuEnum.Blood_Draws_Adult.ToString())
                        value = TotalAdultBloodDraws();
                    else if (qm.Title == GeneralQuantifyMenuEnum.Blood_Draws_Pediatric.ToString())
                        value = TotalPediatricBloodDraws();
                    else if (qm.Title == GeneralQuantifyMenuEnum.PerDay_PerSite.ToString())
                        value = PeriodInfo.WorkingDaysinBudgetPeriod;
                    else if (qm.Title == GeneralQuantifyMenuEnum.PerWeek_PerSite.ToString())
                        value = PeriodInfo.WeeksinBudgetPeriod;
                    else if (qm.Title == GeneralQuantifyMenuEnum.PerMonth_PerSite.ToString())
                        value = PeriodInfo.NumberofMonthsinBudgetPeriod;
                    else if (qm.Title == GeneralQuantifyMenuEnum.PerQuarter_PerSite.ToString())
                        value = PeriodInfo.QuartersinBudgetPeriod;
                    else if (qm.Title == GeneralQuantifyMenuEnum.PerYear_PerSite.ToString())
                        value = 1;
                    else
                    {
                        qvalue = null;
                        switch (qm.ClassOfTestToEnum)
                        {
                            case ClassOfMorbidityTestEnum.CD4:
                                qvalue = CD4TestCalculator.GetQMenuWithValueByQuantifyMenuId(qm.Id);
                                break;
                            case ClassOfMorbidityTestEnum.Chemistry:
                                qvalue = ChemistryTestCalculator.GetQMenuWithValueByQuantifyMenuId(qm.Id);
                                break;
                            case ClassOfMorbidityTestEnum.Hematology:
                                qvalue = HematologyTestCalculator.GetQMenuWithValueByQuantifyMenuId(qm.Id);
                                break;
                            case ClassOfMorbidityTestEnum.ViralLoad:
                                qvalue = ViralTestCalculator.GetQMenuWithValueByQuantifyMenuId(qm.Id);
                                break;
                            case ClassOfMorbidityTestEnum.RapidTest:
                                qvalue = RapidTestCalculator.GetQMenuWithValueByQuantifyMenuId(qm.Id);
                                break;
                        }
                        if (qvalue != null)
                            value = qvalue.SiteValue;
                    }

                    if (value > 0)
                    {
                        QMenuWithValue qval = new QMenuWithValue();
                        qval.QuantifyMenuId = qm.Id;
                        qval.SiteValue = value;
                        qval.ReferalSiteValue = 0;
                        _listOfQMenuWithValue.Add(qval);
                    }
                }

                foreach (QMenuWithValue qm in _listOfQMenuWithValue)
                {
                    IList<QuantificationMetric> list = _platformObject.GetQuanMetricByQuanMenuId(qm.QuantifyMenuId);
                    foreach (QuantificationMetric r in list)
                    {
                        PrimeryQuantifyedReagent pqr = new PrimeryQuantifyedReagent();
                        pqr.ProductId = r.Product.Id;
                        pqr.UnitCost = r.Product.GetActiveProductPrice(DateTime.Now).Price;
                        pqr.PackSize = r.Product.GetActiveProductPrice(DateTime.Now).PackSize;
                        pqr.Unit = r.Product.BasicUnit;

                        double testperpack = r.Product.GetActiveProductPrice(DateTime.Now).PackSize / r.UsageRate;
                        pqr.Value = testperpack > 0 ? qm.SiteValue / testperpack : 0;
                        pqr.MinimumQuantity = r.Product.MinimumPackSize;
                        _lstPrimaryQuanReagents.AddPrimeryQR(pqr);
                    }
                }
            }
        }