Exemplo n.º 1
0
        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)));
        }
Exemplo n.º 2
0
        public void PaymentEdit_AutoSplitForPayment_NoNegativeAutoSplits()
        {
            long      provNumA = ProviderT.CreateProvider("provA");
            Patient   pat      = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name);
            Procedure proc1    = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 70);
            Procedure proc2    = ProcedureT.CreateProcedure(pat, "D0150", ProcStat.C, "", 20);
            //make an overpayment for one of the procedures so it spills over.
            DateTime payDate = DateTime.Today;
            Payment  pay     = PaymentT.MakePayment(pat.PatNum, 71, payDate, procNum: proc1.ProcNum); //pre-existing payment
            //attempt to make another payment. Auto splits should not suggest a negative split.
            Payment newPayment = PaymentT.MakePaymentNoSplits(pat.PatNum, 2, payDate, isNew: true,
                                                              payType: Defs.GetDefsForCategory(DefCat.PaymentTypes, true)[0].DefNum);//current payment we're trying to make

            PaymentEdit.LoadData loadData = PaymentEdit.GetLoadData(pat, newPayment, new List <long>()
            {
                pat.PatNum
            }, true, false);
            PaymentEdit.ConstructChargesData chargeData = PaymentEdit.GetConstructChargesData(new List <long> {
                pat.PatNum
            }, pat.PatNum,
                                                                                              PaySplits.GetForPayment(pay.PayNum), pay.PayNum, false);
            PaymentEdit.ConstructResults constructResults = PaymentEdit.ConstructAndLinkChargeCredits(new List <long> {
                pat.PatNum
            }, pat.PatNum
                                                                                                      , chargeData.ListPaySplits, newPayment, new List <Procedure> ());
            PaymentEdit.AutoSplit autoSplits = PaymentEdit.AutoSplitForPayment(constructResults);
            Assert.AreEqual(0, autoSplits.ListAutoSplits.FindAll(x => x.SplitAmt < 0).Count);        //assert no negative auto splits were made.
            Assert.AreEqual(0, autoSplits.ListSplitsCur.FindAll(x => x.SplitAmt < 0).Count);         //auto splits not catching everything
        }
Exemplo n.º 3
0
        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)));
        }
Exemplo n.º 4
0
        public void PaymentEdit_Init_AttachedAdjustment()
        {
            Patient    pat        = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name);
            long       provNum    = ProviderT.CreateProvider("prov1");
            Procedure  proc       = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 135, DateTime.Today.AddMonths(-1).AddDays(1), provNum: provNum);
            Adjustment adjustment = AdjustmentT.MakeAdjustment(pat.PatNum, 20, DateTime.Today.AddDays(-15), provNum: provNum, procNum: proc.ProcNum);
            Payment    payCur     = PaymentT.MakePaymentNoSplits(pat.PatNum, 20);

            PaymentEdit.LoadData loadData = PaymentEdit.GetLoadData(pat, payCur, new List <long> {
                pat.PatNum
            }, true, false);
            PaymentEdit.InitData initData = PaymentEdit.Init(loadData.ListAssociatedPatients, Patients.GetFamily(pat.PatNum), new Family {
            }, payCur
                                                             , loadData.ListSplits, new List <Procedure>(), pat.PatNum, loadData: loadData);
            //Verify there is only one charge (the procedure's charge + the adjustment for the amount original)
            Assert.AreEqual(1, initData.AutoSplitData.ListAccountCharges.Count);
            Assert.AreEqual(typeof(Procedure), initData.AutoSplitData.ListAccountCharges[0].Tag.GetType());
            Assert.AreEqual(155, initData.AutoSplitData.ListAccountCharges[0].AmountOriginal);
        }
Exemplo n.º 5
0
        public void PaymentEdit_Init_AdjustmentPreferWithPosAdjustment()
        {
            PrefT.UpdateInt(PrefName.AutoSplitLogic, (int)AutoSplitPreference.Adjustments);
            Patient    pat        = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name);
            long       provNum    = ProviderT.CreateProvider("prov1");
            Procedure  proc1      = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 75, DateTime.Today.AddMonths(-1), provNum: provNum);
            Procedure  proc2      = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 135, DateTime.Today.AddMonths(-1).AddDays(1), provNum: provNum);
            Adjustment adjustment = AdjustmentT.MakeAdjustment(pat.PatNum, 20, DateTime.Today.AddDays(-15), provNum: provNum);
            Payment    payCur     = PaymentT.MakePaymentNoSplits(pat.PatNum, 20);

            PaymentEdit.LoadData loadData = PaymentEdit.GetLoadData(pat, payCur, new List <long> {
                pat.PatNum
            }, true, false);
            PaymentEdit.InitData initData = PaymentEdit.Init(loadData.ListAssociatedPatients, Patients.GetFamily(pat.PatNum), new Family {
            }, payCur
                                                             , loadData.ListSplits, new List <Procedure>(), pat.PatNum, loadData: loadData);
            //Verify the logic chooses to pay off the adjustment first
            Assert.AreEqual(1, initData.AutoSplitData.ListAccountCharges.Count(x => x.Tag.GetType() == typeof(Adjustment) && x.AmountEnd == 0));
        }
Exemplo n.º 6
0
        public void PaymentEdit_AutoSplitForPayment_SplitForPaymentLessThanTotalofProcs()
        {
            Patient   pat   = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name);
            Procedure proc1 = ProcedureT.CreateProcedure(pat, "D1110", ProcStat.C, "", 40);
            Procedure proc2 = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 40);
            Payment   pay   = PaymentT.MakePaymentNoSplits(pat.PatNum, 50);

            PaymentEdit.LoadData loadData = PaymentEdit.GetLoadData(pat, pay, new List <long> {
                pat.PatNum
            }, true, false);
            PaymentEdit.ConstructResults chargeResult = PaymentEdit.ConstructAndLinkChargeCredits(new List <long> {
                pat.PatNum
            }, pat.PatNum
                                                                                                  , loadData.ConstructChargesData.ListPaySplits, pay, new List <Procedure>());
            PaymentEdit.AutoSplit autoSplit = PaymentEdit.AutoSplitForPayment(chargeResult);
            Assert.AreEqual(2, autoSplit.ListAutoSplits.Count);
            Assert.AreEqual(1, autoSplit.ListAutoSplits.Count(x => x.SplitAmt.IsEqual(40)));
            Assert.AreEqual(1, autoSplit.ListAutoSplits.Count(x => x.SplitAmt.IsEqual(10)));
        }
Exemplo n.º 7
0
        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)));
        }
Exemplo n.º 8
0
        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)));
        }
Exemplo n.º 9
0
        public void PaymentEdit_Init_IncomeTransferWhenIncomeIncorrectlyAllocatedToOneProvider()
        {
            Patient   pat              = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name);
            long      provNum1         = ProviderT.CreateProvider("prov1");
            long      provNum2         = ProviderT.CreateProvider("prov2");
            Procedure procByProv1      = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 100, DateTime.Today.AddMonths(-1), provNum: provNum1);
            Procedure procByProv2      = ProcedureT.CreateProcedure(pat, "D0220", ProcStat.C, "", 50, DateTime.Today.AddMonths(-1), provNum: provNum2);
            Payment   payAllForOneProv = PaymentT.MakePayment(pat.PatNum, 150, DateTime.Today.AddDays(-1), provNum: provNum1, payType: 1);  //make entire payment to prov1
            //make an income transfer and see if it catches the over and underallocations
            Payment incomeTransfer = PaymentT.MakePaymentNoSplits(pat.PatNum, 0, isNew: true);

            PaymentEdit.LoadData loadData = PaymentEdit.GetLoadData(pat, incomeTransfer, new List <long> {
                pat.PatNum
            }, true);
            PaymentEdit.InitData initData = PaymentEdit.Init(loadData.ListAssociatedPatients, Patients.GetFamily(pat.PatNum), new Family {
            }, incomeTransfer
                                                             , loadData.ListSplits, new List <Procedure>(), pat.PatNum, isIncomeTxfr: true, loadData: loadData);
            //Assert there the appropriate amounts going to the correct providers.
            Assert.AreEqual(2, initData.AutoSplitData.ListAccountCharges.FindAll(x => x.Tag.GetType() == typeof(Procedure)).Count);
            Assert.AreEqual(1, initData.AutoSplitData.ListAccountCharges.FindAll(x => x.Tag.GetType() == typeof(PaySplit)).Count);
            //FormPayment.FillGridCharges will sum up the charges depending on what grouping is selected. Here we are just going to validate the output of
            //PaymentEdit.Init is as it should be.
            Assert.AreEqual(1, initData.AutoSplitData.ListAccountCharges.FindAll(x => x.AmountStart == -150 && x.ProvNum == provNum1).Count);
        }