Esempio n. 1
0
        ///<summary>Computes balance for a single patient without making any calls to the database. If the balance doesn't match the stored patient balance, then it makes one update to the database and returns true to trigger calculation of aging.</summary>
        public static bool ComputeBalances(Procedure[] procList, ClaimProc[] claimProcList, Patient PatCur, PaySplit[] paySplitList, Adjustment[] AdjustmentList, PayPlan[] payPlanList, PayPlanCharge[] payPlanChargeList)
        {
            //must have refreshed all 5 first
            double calcBal
                = Procedures.ComputeBal(procList)
                  + ClaimProcs.ComputeBal(claimProcList)
                  + Adjustments.ComputeBal(AdjustmentList)
                  - PaySplits.ComputeBal(paySplitList)
                  + PayPlans.ComputeBal(PatCur.PatNum, payPlanList, payPlanChargeList);

            if (calcBal != PatCur.EstBalance)
            {
                Patient PatOld = PatCur.Copy();
                PatCur.EstBalance = calcBal;
                Patients.Update(PatCur, PatOld);
                return(true);
            }
            return(false);
        }