Пример #1
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
        }
Пример #2
0
 public static PaymentEdit.IncomeTransferData IncomeTransfer(long patNum, Family fam, Payment payCur, List <PayPlanCharge> listPayPlanCredits,
                                                             bool doIncludeHidden = false)
 {
     #region generate charges and credits for account
     //go through the logic that constructs the charges for the income transfer manager
     PaymentEdit.ConstructResults results = PaymentEdit.ConstructAndLinkChargeCredits(fam.ListPats.Select(x => x.PatNum).ToList(),
                                                                                      patNum, new List <PaySplit>(), payCur, new List <AccountEntry>(), true, false, doShowHiddenSplits: doIncludeHidden);
     PaymentEdit.IncomeTransferData transfers      = new PaymentEdit.IncomeTransferData();
     List <AccountEntry>            listPosCharges = results.ListAccountCharges.FindAll(x => x.AmountEnd > 0).OrderBy(x => x.Date).ToList();
     List <AccountEntry>            listNegCharges = results.ListAccountCharges.FindAll(x => x.AmountEnd < 0).OrderBy(x => x.Date).ToList();
     List <long>         listPatsWithPosCharges    = listPosCharges.Select(y => y.PatNum).Distinct().ToList();
     List <AccountEntry> listAccountEntries        = results.ListAccountCharges.FindAll(x => x.PatNum.In(listPatsWithPosCharges));
     #endregion
     //begin transfer loops
     #region transfer within payplans first
     PaymentEdit.IncomeTransferData payPlanResults = PaymentEdit.CreatePayplanLoop(listPosCharges, listNegCharges, listAccountEntries
                                                                                   , payCur.PayNum, listPayPlanCredits, DateTimeOD.Today);
     transfers.MergeIncomeTransferData(payPlanResults);
     #endregion
     #region regular transfers
     PaymentEdit.IncomeTransferData txfrResults = PaymentEdit.CreateTransferLoop(listPosCharges, listNegCharges, listAccountEntries
                                                                                 , payCur.PayNum, listPayPlanCredits, DateTimeOD.Today);
     transfers.MergeIncomeTransferData(txfrResults);
     #endregion
     return(transfers);
 }
Пример #3
0
 public FamilyAccount(List <Patient> listFamily, Patient guar)
 {
     ListFamilyMembers    = listFamily;
     Guarantor            = guar;
     ListSplitsAssociated = new List <PaySplits.PaySplitAssociated>();
     ListSplits           = new List <PaySplit>();
     Account = new PaymentEdit.ConstructResults();
 }
 ///<summary>Performs all of the Load functionality.</summary>
 private void Init()
 {
     _listSplitsCur        = new List <PaySplit>();
     _listSplitsAssociated = new List <PaySplits.PaySplitAssociated>();
     _dictPatients         = Patients.GetAssociatedPatients(_patCur.PatNum).ToDictionary(x => x.PatNum, x => x);
     _results = PaymentEdit.ConstructAndLinkChargeCredits(_famCur.ListPats.Select(x => x.PatNum).ToList(), _patCur.PatNum, new List <PaySplit>(),
                                                          _paymentCur, new List <AccountEntry>(), true, false);
     FillGridSplits();
 }
 ///<summary>Only change checked state if there are zero transfer splits.</summary>
 private void checkIncludeHiddenSplits_Click(object sender, EventArgs e)
 {
     if (_listSplitsCur.Count > 0)
     {
         MsgBox.Show("You must delete all splits before including or excluding hidden payment splits.");
         checkIncludeHiddenSplits.Checked = !checkIncludeHiddenSplits.Checked;
         return;
     }
     _results = PaymentEdit.ConstructAndLinkChargeCredits(_famCur.ListPats.Select(x => x.PatNum).ToList(), _patCur.PatNum, new List <PaySplit>(),
                                                          _paymentCur, new List <AccountEntry>(), true, false, doShowHiddenSplits: checkIncludeHiddenSplits.Checked);
     FillGridSplits();
 }
Пример #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)));
        }
Пример #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)));
        }
Пример #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)));
        }