示例#1
0
        ///<summary>Transfers unallocated to unearned (if present) and inserts those results into the database. Then performs transfer.
        ///This is the best representation of what the income transfer window currently does.</summary>
        public static PaymentEdit.IncomeTransferData BalanceAndIncomeTransfer(long patNum, Family fam, Payment regularTransferPayment
                                                                              , List <PayPlanCharge> payPlanCharges = null)
        {
            //get all paysplits associated to the family passed in
            List <PaySplit> listSplitsForPat = PaySplits.GetForPats(fam.ListPats.Select(x => x.PatNum).ToList());
            //perform unallocated transfer
            Payment unallocatedTransfer = MakePaymentNoSplits(patNum, 0, payDate: DateTime.Today);

            PaymentEdit.IncomeTransferData unallocatedResults = PaymentEdit.TransferUnallocatedSplitToUnearned(listSplitsForPat, unallocatedTransfer.PayNum);
            foreach (PaySplit split in unallocatedResults.ListSplitsCur)
            {
                if (split.SplitAmt.IsZero())
                {
                    continue;
                }
                PaySplits.Insert(split);
            }
            foreach (PaySplits.PaySplitAssociated splitAssociated in unallocatedResults.ListSplitsAssociated)
            {
                if (splitAssociated.PaySplitOrig != null && splitAssociated.PaySplitLinked != null)
                {
                    PaySplits.UpdateFSplitNum(splitAssociated.PaySplitOrig.SplitNum, splitAssociated.PaySplitLinked.SplitNum);
                }
            }
            if (payPlanCharges == null)
            {
                payPlanCharges = new List <PayPlanCharge>();
            }
            #region claim fix and transfer
            //both of these methods have objects that get immediately inserted into the database. While testing, a spcific call wil need to be made to delete.
            ClaimProcs.FixClaimsNoProcedures(fam.ListPats.Select(x => x.PatNum).ToList());             //make dummy procedures and claimprocs for claims missing procs.
            ClaimProcs.TransferClaimsAsTotalToProcedures(fam.ListPats.Select(x => x.PatNum).ToList()); //transfer AsTotals into claim procedures
            #endregion
            return(IncomeTransfer(patNum, fam, regularTransferPayment, payPlanCharges));
        }