public void PaymentEdit_ConstructAndLinkChargeCredits_ChargesWithAttachedPayPlanCreditsWithPreviousPayments() { //new payplan Patient pat = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); Procedure proc1 = ProcedureT.CreateProcedure(pat, "D1120", ProcStat.C, "", 135, DateTime.Today.AddMonths(-4)); Procedure proc2 = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 60, DateTime.Today.AddMonths(-4)); PayPlan payplan = PayPlanT.CreatePayPlanWithCredits(pat.PatNum, 30, DateTime.Today.AddMonths(-3), 0, new List <Procedure>() { proc1, proc2 }); //Procedures's amount start should now be 0 from being attached. Make initial payments. PaymentT.MakePayment(pat.PatNum, 30, DateTime.Today.AddMonths(-2), payplan.PayPlanNum, procNum: proc1.ProcNum); PaymentT.MakePayment(pat.PatNum, 30, DateTime.Today.AddMonths(-1), payplan.PayPlanNum, procNum: proc1.ProcNum); //2 pay plan charges should have been removed from being paid. Make a new payment. Payment pay = PaymentT.MakePaymentNoSplits(pat.PatNum, 30, DateTime.Today, isNew: true, payType: 1); PaymentEdit.LoadData loadData = PaymentEdit.GetLoadData(pat, pay, new List <long> { pat.PatNum }, true, false); PaymentEdit.InitData initData = PaymentEdit.Init(loadData.ListAssociatedPatients, Patients.GetFamily(pat.PatNum), new Family { }, pay , loadData.ListSplits, new List <Procedure>(), pat.PatNum, loadData: loadData); //should only see 2 pay plan charges that have not been paid, along with 2 pay plan charges that have been paid. Assert.AreEqual(2, initData.AutoSplitData.ListAccountCharges.FindAll(x => x.AmountStart > 0).Count); Assert.AreEqual(4, initData.AutoSplitData.ListAccountCharges.Count(x => x.Tag.GetType() == typeof(PayPlanCharge))); }
public void PaymentEdit_Init_ChargesWithUnattachedPayPlanCreditsWithPreviousPayments() { //new payplan Patient pat = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); long prov = ProviderT.CreateProvider("ProvA"); Procedure proc1 = ProcedureT.CreateProcedure(pat, "D1120", ProcStat.C, "", 135, DateTime.Today.AddMonths(-4), provNum: prov); Procedure proc2 = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 60, DateTime.Today.AddMonths(-4).AddDays(1), provNum: prov); PayPlan payplan = PayPlanT.CreatePayPlanWithCredits(pat.PatNum, 30, DateTime.Today.AddMonths(-3), prov, totalAmt: 195); //totalAmt since unattached credits //Make initial payments. PaymentT.MakePayment(pat.PatNum, 30, DateTime.Today.AddMonths(-2), payplan.PayPlanNum, prov, 0, 1); PaymentT.MakePayment(pat.PatNum, 30, DateTime.Today.AddMonths(-1), payplan.PayPlanNum, prov, 0, 1); //Go to make another payment. 2 pay plan charges should have been "removed" (amtStart to 0) from being paid. Payment pay = PaymentT.MakePaymentNoSplits(pat.PatNum, 30, DateTime.Today); PaymentEdit.LoadData loadData = PaymentEdit.GetLoadData(pat, pay, new List <long> { pat.PatNum }, true, false); PaymentEdit.InitData initData = PaymentEdit.Init(loadData.ListAssociatedPatients, Patients.GetFamily(pat.PatNum), new Family { }, pay , loadData.ListSplits, new List <Procedure>(), pat.PatNum, loadData: loadData); //2 procs and 2 pp charges Assert.AreEqual(4, initData.AutoSplitData.ListAccountCharges.FindAll(x => x.AmountStart > 0).Count); Assert.AreEqual(2, initData.AutoSplitData.ListAccountCharges.Count(x => x.Tag.GetType() == typeof(Procedure))); Assert.AreEqual(4, initData.AutoSplitData.ListAccountCharges.Count(x => x.Tag.GetType() == typeof(PayPlanCharge))); }
public void PaymentEdit_Init_PayPlanChargesWithUnattachedCredits() { //new payplan Patient pat = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); Procedure proc1 = ProcedureT.CreateProcedure(pat, "D1120", ProcStat.C, "", 135, DateTime.Today.AddMonths(-4)); Procedure proc2 = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 60, DateTime.Today.AddMonths(-4)); PayPlan payplan = PayPlanT.CreatePayPlanWithCredits(pat.PatNum, 30, DateTime.Today.AddMonths(-3), 0, totalAmt: 195); //Go to make a payment for the charges due Payment pay = PaymentT.MakePaymentNoSplits(pat.PatNum, 60, DateTime.Today); PaymentEdit.LoadData loadData = PaymentEdit.GetLoadData(pat, pay, new List <long> { pat.PatNum }, true, false); PaymentEdit.ConstructResults constructResults = PaymentEdit.ConstructAndLinkChargeCredits(new List <long> { pat.PatNum }, pat.PatNum , loadData.ConstructChargesData.ListPaySplits, pay, new List <Procedure> (), loadData: loadData); Assert.AreEqual(6, constructResults.ListAccountCharges.Count); //2 procedures and 4 months of charges since unattached credits. Assert.AreEqual(2, constructResults.ListAccountCharges.Count(x => x.Tag.GetType() == typeof(Procedure))); Assert.AreEqual(4, constructResults.ListAccountCharges.Count(x => x.Tag.GetType() == typeof(PayPlanCharge))); }
public void PaymentEdit_Init_PayPlanChargesWithAttachedCredits() { //new payplan Patient pat = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); Procedure proc1 = ProcedureT.CreateProcedure(pat, "D1120", ProcStat.C, "", 135, DateTime.Today.AddMonths(-4)); Procedure proc2 = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 60, DateTime.Today.AddMonths(-4)); PayPlan payplan = PayPlanT.CreatePayPlanWithCredits(pat.PatNum, 30, DateTime.Today.AddMonths(-3), 0, new List <Procedure>() { proc1, proc2 }); //Go to make a payment for the charges that are due Payment pay = PaymentT.MakePaymentNoSplits(pat.PatNum, 60, DateTime.Today); PaymentEdit.LoadData loadData = PaymentEdit.GetLoadData(pat, pay, new List <long> { pat.PatNum }, true, false); PaymentEdit.ConstructResults constructResults = PaymentEdit.ConstructAndLinkChargeCredits(new List <long> { pat.PatNum }, pat.PatNum , loadData.ConstructChargesData.ListPaySplits, pay, new List <Procedure> (), loadData: loadData); Assert.AreEqual(4, constructResults.ListAccountCharges.FindAll(x => x.AmountStart > 0).Count); //Procs shouldn't show - only the 4 pay plan charges Assert.AreEqual(4, constructResults.ListAccountCharges.Count(x => x.Tag.GetType() == typeof(PayPlanCharge))); }