Пример #1
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);
 }
 ///<summary>Creates micro-allocations intelligently based on most to least matching criteria of selected charges.</summary>
 private void CreateTransfers(List <AccountEntry> listPosCharges, List <AccountEntry> listNegCharges, List <AccountEntry> listAccountEntries)
 {
     //No logic that manipulates these lists should happen before the regular transfer. If necessary (like fixing incorrect unearned)
     //they will need to be made as DBMs instead or wait for another logic overhaul.
     #region transfer within payment plans first
     List <PayPlanCharge>           listCredits    = _results.ListPayPlanCharges.FindAll(x => x.ChargeType == PayPlanChargeType.Credit);
     PaymentEdit.IncomeTransferData payPlanResults = PaymentEdit.CreatePayplanLoop(listPosCharges, listNegCharges, listAccountEntries
                                                                                   , _paymentCur.PayNum, listCredits, DateTimeOD.Today);
     _listSplitsAssociated.AddRange(payPlanResults.ListSplitsAssociated);
     _listSplitsCur.AddRange(payPlanResults.ListSplitsCur);
     #endregion
     #region regular transfers
     PaymentEdit.IncomeTransferData results = PaymentEdit.CreateTransferLoop(listPosCharges, listNegCharges, listAccountEntries
                                                                             , _paymentCur.PayNum, listCredits, DateTimeOD.Today);
     _listSplitsAssociated.AddRange(results.ListSplitsAssociated);
     _listSplitsCur.AddRange(results.ListSplitsCur);
     #endregion
     if (results.HasInvalidSplits || payPlanResults.HasInvalidSplits)
     {
         MsgBox.Show(this, "Due to Rigorous Accounting, one or more invalid transactions have been cancelled.  Please fix those manually.");
     }
     else if (results.HasIvalidProcWithPayPlan || payPlanResults.HasIvalidProcWithPayPlan)
     {
         MsgBox.Show(this, "One or more over allocated paysplit was not able to be reversed.");
     }
 }
Пример #3
0
        ///<summary>Creates micro-allocations intelligently based on most to least matching criteria of selected charges.</summary>
        private string CreateTransfers(List <AccountEntry> listPosCharges, List <AccountEntry> listNegCharges, List <AccountEntry> listAccountEntries
                                       , FamilyAccount famAccount, Payment payCur)
        {
            PaymentEdit.IncomeTransferData transferResults = new PaymentEdit.IncomeTransferData();
            List <PayPlanCharge>           listCredits     = famAccount.Account.ListPayPlanCharges.FindAll(x => x.ChargeType == PayPlanChargeType.Credit);
            string retVal = "";

            transferResults = PaymentEdit.CreatePayplanLoop(listPosCharges, listNegCharges, listAccountEntries, payCur.PayNum, listCredits, datePicker.Value);
            transferResults.MergeIncomeTransferData(PaymentEdit.CreateTransferLoop(listPosCharges, listNegCharges, listAccountEntries, payCur.PayNum
                                                                                   , listCredits, datePicker.Value, famAccount.Guarantor.PatNum));
            famAccount.ListSplits.AddRange(transferResults.ListSplitsCur);
            famAccount.ListSplitsAssociated.AddRange(transferResults.ListSplitsAssociated);
            retVal += transferResults.SummaryText;
            return(retVal);
        }