Example #1
0
        ///<summary>This method converts the AccountEntry objects we get back from AccountModules.GetListUnpaidAccountCharges() to MultiAdjEntry objects.
        ///These are used to fill the grid and do all relevant logic in this form. This method will return a fresh list of procedures and will not show
        ///any existing adjustments that may have been made in this form already. Called on load and when checkShowImplicit is clicked.
        ///When called from checkShowImplicit any existing adjustments made will not be shown.(Ask Andrew about this functionality)</summary>
        private List <MultiAdjEntry> FillListGridEntries(CreditCalcType calc)
        {
            List <MultiAdjEntry> retVal = new List <MultiAdjEntry>();

            #region Get required data
            List <Procedure> listProcedures = Procedures.GetCompleteForPats(new List <long> {
                _patCur.PatNum
            });
            //Does not get charges for the future.
            List <PaySplit> listPaySplits = PaySplits.GetForPats(new List <long> {
                _patCur.PatNum
            }).Where(x => x.UnearnedType == 0).ToList();
            List <Adjustment> listAdjustments = Adjustments.GetAdjustForPats(new List <long> {
                _patCur.PatNum
            });
            //Might contain payplan payments. Do not include unearned.
            List <PayPlanCharge> listPayPlanCharges = PayPlanCharges.GetDueForPayPlans(PayPlans.GetForPats(null, _patCur.PatNum), _patCur.PatNum).ToList();
            List <ClaimProc>     listInsPayAsTotal  = ClaimProcs.GetByTotForPats(new List <long> {
                _patCur.PatNum
            });
            List <ClaimProc> listClaimProcs = ClaimProcs.GetForProcs(listProcedures.Select(x => x.ProcNum).ToList());
            #endregion
            List <AccountEntry> listAccountCharges = AccountModules.GetListUnpaidAccountCharges(listProcedures, listAdjustments
                                                                                                , listPaySplits, listClaimProcs, listPayPlanCharges, listInsPayAsTotal, calc, new List <PaySplit>());
            List <AccountEntry> listAccountChargesIncludeAll = null;
            if (calc == CreditCalcType.ExcludeAll)
            {
                //We need to get all credits so that our AmtRemBefore can reflect what has truly been allocated to the procedure.
                listAccountChargesIncludeAll = AccountModules.GetListUnpaidAccountCharges(listProcedures, listAdjustments
                                                                                          , listPaySplits, listClaimProcs, listPayPlanCharges, listInsPayAsTotal, CreditCalcType.IncludeAll, new List <PaySplit>());
            }
            MultiAdjEntry multiEntry = null;
            foreach (AccountEntry entry in listAccountCharges)
            {
                //We only want AccountEntries that are completed procedures.
                if (entry.GetType() != typeof(ProcExtended))
                {
                    continue;
                }
                ProcExtended procEntry = (ProcExtended)entry.Tag;
                if ((_listSelectedProcs != null && _listSelectedProcs.Any(x => x.ProcNum == procEntry.Proc.ProcNum)) ||        //Allow selected procs to show if paid off
                    entry.AmountEnd != 0)                     //All unpaid procedures should always show up per Nathan
                {
                    double amtRemBefore = (double)(listAccountChargesIncludeAll?.FirstOrDefault(x => x.Tag.GetType() == typeof(ProcExtended) &&
                                                                                                ((ProcExtended)x.Tag).Proc.ProcNum == procEntry.Proc.ProcNum) ?? entry).AmountStart;
                    multiEntry = new MultiAdjEntry(procEntry.Proc, (double)entry.AmountStart, (double)entry.AmountEnd, amtRemBefore);
                    retVal.Add(multiEntry);
                }
            }
            OrderListGridEntries();
            return(retVal);
        }
Example #2
0
        ///<summary>This method converts the AccountEntry objects we get back from AccountModules.GetListUnpaidAccountCharges() to MultiAdjEntry objects.
        ///These are used to fill the grid and do all relevant logic in this form. This method will return a fresh list of procedures and will not show
        ///any existing adjustments that may have been made in this form already. Called on load and when checkShowImplicit is clicked.
        ///When called from checkShowImplicit any existing adjustments made will not be shown.(Ask Andrew about this functionality)</summary>
        private List <MultiAdjEntry> FillListGridEntries(CreditCalcType calc)
        {
            //CONSIDER ANY CHANGES MADE HERE MAY ALSO NEED TO BE ADDED TO FormProcSelect.
            List <MultiAdjEntry> retVal = new List <MultiAdjEntry>();

            #region Get required data
            List <Procedure> listProcedures = Procedures.GetCompleteForPats(new List <long> {
                _patCur.PatNum
            });
            //Does not get charges for the future.
            List <PaySplit> listPaySplits = PaySplits.GetForPats(new List <long> {
                _patCur.PatNum
            }).Where(x => x.UnearnedType == 0).ToList();
            List <Adjustment> listAdjustments = Adjustments.GetAdjustForPats(new List <long> {
                _patCur.PatNum
            });
            //Might contain payplan payments. Do not include unearned.
            List <PayPlanCharge> listPayPlanCharges = PayPlanCharges.GetDueForPayPlans(PayPlans.GetForPats(null, _patCur.PatNum), _patCur.PatNum).ToList();
            List <ClaimProc>     listInsPayAsTotal  = ClaimProcs.GetByTotForPats(new List <long> {
                _patCur.PatNum
            });
            List <ClaimProc> listClaimProcs = ClaimProcs.GetForProcs(listProcedures.Select(x => x.ProcNum).ToList());
            #endregion
            List <AccountEntry> listAccountCharges = AccountModules.GetListUnpaidAccountCharges(listProcedures, listAdjustments, listPaySplits, listClaimProcs
                                                                                                , listPayPlanCharges, listInsPayAsTotal, calc, new List <PaySplit>());
            List <AccountEntry> listAccountChargesIncludeAll = null;
            if (calc == CreditCalcType.ExcludeAll)
            {
                //We need to get all credits so that our AmtRemBefore can reflect what has truly been allocated to the procedure.
                listAccountChargesIncludeAll = AccountModules.GetListUnpaidAccountCharges(listProcedures, listAdjustments
                                                                                          , listPaySplits, listClaimProcs, listPayPlanCharges, listInsPayAsTotal, CreditCalcType.IncludeAll, new List <PaySplit>());
            }
            MultiAdjEntry multiEntry = null;
            foreach (AccountEntry entry in listAccountCharges)
            {
                //We only want AccountEntries that are completed procedures.
                if (entry.GetType() != typeof(ProcExtended))
                {
                    continue;
                }
                ProcExtended procEntry = (ProcExtended)entry.Tag;
                bool         isProcSelectedInAccount = false;
                if (_listSelectedProcs != null && _listSelectedProcs.Any(x => x.ProcNum == procEntry.Proc.ProcNum))
                {
                    isProcSelectedInAccount = true;
                }
                if (calc == CreditCalcType.ExcludeAll)               //show everything. Regardless of procs loading window or amount remaining.
                {
                    double amtRemBefore = (double)(listAccountChargesIncludeAll?.FirstOrDefault(x => x.Tag.GetType() == typeof(ProcExtended) &&
                                                                                                ((ProcExtended)x.Tag).Proc.ProcNum == procEntry.Proc.ProcNum) ?? entry).AmountStart;
                    multiEntry = new MultiAdjEntry(procEntry.Proc, (double)entry.AmountStart, (double)entry.AmountEnd, amtRemBefore);
                    retVal.Add(multiEntry);
                }
                else if (calc.In(CreditCalcType.IncludeAll, CreditCalcType.AllocatedOnly) && (entry.AmountEnd != 0 || isProcSelectedInAccount))
                {
                    //Unpaid procedures should always show per Nathan. If proc was specifically selected before entering window, show it anyways.
                    multiEntry = new MultiAdjEntry(procEntry.Proc, (double)entry.AmountStart, (double)entry.AmountEnd, (double)entry.AmountStart);
                    retVal.Add(multiEntry);
                }
            }
            OrderListGridEntries();
            return(retVal);
        }