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); } } } }
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); } } } }