public void PaymentEdit_Init_AutoSplitWithClaimPayments() //Legacy_TestFortyEight { string suffix = "48"; Patient pat = PatientT.CreatePatient(suffix); long patNum = pat.PatNum; InsPlan insPlan = InsPlanT.CreateInsPlan(CarrierT.CreateCarrier(suffix).CarrierNum); InsSub insSub = InsSubT.CreateInsSub(patNum, insPlan.PlanNum); PatPlan patPlan = PatPlanT.CreatePatPlan(1, patNum, insSub.InsSubNum); Procedure procedure1 = ProcedureT.CreateProcedure(pat, "D1110", ProcStat.C, "", 50, DateTime.Now.AddDays(-1)); Procedure procedure2 = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 40, DateTime.Now.AddDays(-2)); Procedure procedure3 = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 60, DateTime.Now.AddDays(-3)); ClaimProcT.AddInsPaid(patNum, insPlan.PlanNum, procedure1.ProcNum, 20, insSub.InsSubNum, 0, 0); ClaimProcT.AddInsPaid(patNum, insPlan.PlanNum, procedure2.ProcNum, 5, insSub.InsSubNum, 5, 0); ClaimProcT.AddInsPaid(patNum, insPlan.PlanNum, procedure3.ProcNum, 20, insSub.InsSubNum, 0, 10); Payment payment = PaymentT.MakePaymentNoSplits(patNum, 150, DateTime.Today); Family famForPat = Patients.GetFamily(patNum); List <Patient> listFamForPat = famForPat.ListPats.ToList(); PaymentEdit.InitData init = PaymentEdit.Init(listFamForPat, famForPat, new Family { }, payment, new List <PaySplit>(), new List <Procedure>(), patNum); //Auto Splits will be in opposite order from least recent to most recent. //ListSplitsCur should contain four splits, 30, 35, and 30, then one unallocated for the remainder of the payment 55. Assert.AreEqual(4, init.AutoSplitData.ListSplitsCur.Count); Assert.IsFalse(init.AutoSplitData.ListSplitsCur[0].SplitAmt != 40 || init.AutoSplitData.ListSplitsCur[0].ProcNum != procedure3.ProcNum || init.AutoSplitData.ListSplitsCur[0].PatNum != patNum); Assert.IsFalse(init.AutoSplitData.ListSplitsCur[1].SplitAmt != 35 || init.AutoSplitData.ListSplitsCur[1].ProcNum != procedure2.ProcNum || init.AutoSplitData.ListSplitsCur[1].PatNum != patNum); Assert.IsFalse(init.AutoSplitData.ListSplitsCur[2].SplitAmt != 30 || init.AutoSplitData.ListSplitsCur[2].ProcNum != procedure1.ProcNum || init.AutoSplitData.ListSplitsCur[2].PatNum != patNum); Assert.IsFalse(init.AutoSplitData.ListSplitsCur[3].SplitAmt != 45 || init.AutoSplitData.ListSplitsCur[3].ProcNum != 0); }
public void InsPlan_GetInsUsedDisplay_OrthoProcsNotAffectInsUsed() { string suffix = "13"; Patient pat = PatientT.CreatePatient(suffix); Carrier carrier = CarrierT.CreateCarrier(suffix); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum); InsSub sub = InsSubT.CreateInsSub(pat.PatNum, plan.PlanNum); long subNum = sub.InsSubNum; PatPlan patPlan = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum); BenefitT.CreateAnnualMax(plan.PlanNum, 100); BenefitT.CreateOrthoMax(plan.PlanNum, 500); BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Diagnostic, 100); BenefitT.CreateCategoryPercent(plan.PlanNum, EbenefitCategory.Orthodontics, 100); Procedure proc1 = ProcedureT.CreateProcedure(pat, "D0140", ProcStat.C, "", 59); //limEx Procedure proc2 = ProcedureT.CreateProcedure(pat, "D8090", ProcStat.C, "", 348); //Comprehensive ortho ClaimProcT.AddInsPaid(pat.PatNum, plan.PlanNum, proc1.ProcNum, 59, subNum, 0, 0); ClaimProcT.AddInsPaid(pat.PatNum, plan.PlanNum, proc2.ProcNum, 348, subNum, 0, 0); //Lists Family fam = Patients.GetFamily(pat.PatNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(pat.PatNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <ClaimProcHist> histList = ClaimProcs.GetHistList(pat.PatNum, benefitList, patPlans, planList, DateTime.Today, subList); //Validate double insUsed = InsPlans.GetInsUsedDisplay(histList, DateTime.Today, plan.PlanNum, patPlan.PatPlanNum, -1, planList, benefitList, pat.PatNum, subNum); Assert.AreEqual(59, insUsed); }
public void InsPlan_GetInsUsedDisplay_LimitationsOverride() { string suffix = "6"; Patient pat = PatientT.CreatePatient(suffix); long patNum = pat.PatNum; Carrier carrier = CarrierT.CreateCarrier(suffix); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum); long planNum = plan.PlanNum; InsSub sub = InsSubT.CreateInsSub(pat.PatNum, planNum); //guarantor is subscriber long subNum = sub.InsSubNum; long patPlanNum = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum).PatPlanNum; BenefitT.CreateAnnualMax(planNum, 1000); BenefitT.CreateLimitation(planNum, EbenefitCategory.Diagnostic, 1000); Procedure proc = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 50); //An exam long procNum = proc.ProcNum; Procedure proc2 = ProcedureT.CreateProcedure(pat, "D2750", ProcStat.C, "8", 830); //create a crown ClaimProcT.AddInsPaid(patNum, planNum, procNum, 50, subNum, 0, 0); ClaimProcT.AddInsPaid(patNum, planNum, proc2.ProcNum, 400, subNum, 0, 0); //Lists Family fam = Patients.GetFamily(patNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(patNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <ClaimProcHist> histList = ClaimProcs.GetHistList(patNum, benefitList, patPlans, planList, DateTime.Today, subList); //Validate double insUsed = InsPlans.GetInsUsedDisplay(histList, DateTime.Today, planNum, patPlanNum, -1, planList, benefitList, patNum, subNum); Assert.AreEqual(400, insUsed); }
public void InsPlan_GetDedRemainDisplay_IndividualAndFamilyDeductiblesInsRemaining() { string suffix = "20"; Patient pat = PatientT.CreatePatient(suffix); //guarantor long patNum = pat.PatNum; Patient pat2 = PatientT.CreatePatient(suffix); PatientT.SetGuarantor(pat2, pat.PatNum); Patient pat3 = PatientT.CreatePatient(suffix); PatientT.SetGuarantor(pat3, pat.PatNum); Carrier carrier = CarrierT.CreateCarrier(suffix); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum); long planNum = plan.PlanNum; InsSub sub = InsSubT.CreateInsSub(pat.PatNum, planNum); //guarantor is subscriber long subNum = sub.InsSubNum; PatPlan patPlan = PatPlanT.CreatePatPlan(1, pat.PatNum, subNum); //all three patients have the same plan PatPlan patPlan2 = PatPlanT.CreatePatPlan(1, pat2.PatNum, subNum); //all three patients have the same plan PatPlan patPlan3 = PatPlanT.CreatePatPlan(1, pat3.PatNum, subNum); //all three patients have the same plan BenefitT.CreateDeductibleGeneral(planNum, BenefitCoverageLevel.Individual, 75); BenefitT.CreateDeductibleGeneral(planNum, BenefitCoverageLevel.Family, 150); ClaimProcT.AddInsUsedAdjustment(pat3.PatNum, planNum, 0, subNum, 75); //Adjustment goes on the third patient Procedure proc = ProcedureT.CreateProcedure(pat2, "D2750", ProcStat.C, "20", 1280); //proc for second patient with a deductible already applied. ClaimProcT.AddInsPaid(pat2.PatNum, planNum, proc.ProcNum, 304, subNum, 50, 597); proc = ProcedureT.CreateProcedure(pat, "D4355", ProcStat.TP, "", 135); //proc is for the first patient long procNum = proc.ProcNum; //Lists List <ClaimProc> claimProcs = ClaimProcs.Refresh(patNum); Family fam = Patients.GetFamily(patNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(patNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <ClaimProcHist> histList = ClaimProcs.GetHistList(patNum, benefitList, patPlans, planList, DateTime.Today, subList); List <ClaimProcHist> loopList = new List <ClaimProcHist>(); //Validate List <ClaimProcHist> HistList = ClaimProcs.GetHistList(pat.PatNum, benefitList, patPlans, planList, DateTime.Today, subList); double dedFam = Benefits.GetDeductGeneralDisplay(benefitList, planNum, patPlan.PatPlanNum, BenefitCoverageLevel.Family); double ded = Benefits.GetDeductGeneralDisplay(benefitList, planNum, patPlan.PatPlanNum, BenefitCoverageLevel.Individual); double dedRem = InsPlans.GetDedRemainDisplay(HistList, DateTime.Today, planNum, patPlan.PatPlanNum, -1, planList, pat.PatNum, ded, dedFam); //test family and individual deductible together Assert.AreEqual(25, dedRem); dedRem = InsPlans.GetDedRemainDisplay(HistList, DateTime.Today, planNum, patPlan.PatPlanNum, -1, planList, pat.PatNum, ded, -1); //test individual deductible by itself Assert.AreEqual(75, dedRem); }