Exemplo n.º 1
0
 private void FindSplits(bool isShowAll)
 {
     ListSelectedSplits = new List <PaySplit>();
     if (IsPrePay)
     {
         if (isShowAll)                 //this will find all splits for the family, even if they have already been allocated.
         {
             GetSplitsForPats(isShowAll);
             return;
         }
         if (ListUnallocatedSplits == null)
         {
             _listPaySplits = PaySplits.GetPrepayForFam(Patients.GetFamily(_patNum));
             List <PaySplit> listSplitsForSplits = PaySplits.GetSplitsForPrepay(_listPaySplits);
             for (int i = _listPaySplits.Count - 1; i >= 0; i--)
             {
                 PaySplit        split = _listPaySplits[i];
                 List <PaySplit> listSplitsForSplit = listSplitsForSplits.FindAll(x => x.FSplitNum == split.SplitNum);
                 decimal         splitTotal         = 0;
                 foreach (PaySplits.PaySplitAssociated splitAssociated in ListPaySplitAssociated)
                 {
                     if (splitAssociated.PaySplitOrig.SplitNum == split.SplitNum && splitAssociated != SplitAssociatedDetached)
                     {
                         //add in amounts for assoications just made within payment window
                         splitTotal += (decimal)splitAssociated.PaySplitLinked.SplitAmt;
                     }
                 }
                 foreach (PaySplit paySplit in listSplitsForSplit)
                 {
                     if (paySplit.SplitNum == SplitNumCur)
                     {
                         continue;
                     }
                     splitTotal += (decimal)paySplit.SplitAmt;                          //add in amounts associated from previous payments
                 }
                 decimal leftOverAmt = (decimal)split.SplitAmt + splitTotal;            //splitTotal should be negative.
                 if (leftOverAmt <= 0)
                 {
                     _listPaySplits.Remove(split);
                 }
                 else
                 {
                     _dictLeftOverAmounts[split.SplitNum] = leftOverAmt;
                 }
             }
         }
         else
         {
             _listPaySplits = ListUnallocatedSplits;
         }
     }
     else
     {
         GetSplitsForPats(isShowAll);
     }
 }
Exemplo n.º 2
0
 private void FindSplits(bool isShowAll)
 {
     ListSelectedSplits = new List <PaySplit>();
     if (IsPrePay)
     {
         if (isShowAll)                 //this will find all splits for the family, even if they have already been allocated.
         {
             GetSplitsForPats(isShowAll);
             return;
         }
         if (ListUnallocatedSplits == null)
         {
             _listPaySplits = PaySplits.GetPrepayForFam(Patients.GetFamily(_patNum));
             List <PaySplit> listSplitsForSplits = PaySplits.GetSplitsForPrepay(_listPaySplits);
             for (int i = _listPaySplits.Count - 1; i >= 0; i--)
             {
                 PaySplit        split = _listPaySplits[i];
                 List <PaySplit> listSplitsForSplit = listSplitsForSplits.FindAll(x => x.FSplitNum == split.SplitNum);
                 decimal         splitTotal         = 0;
                 foreach (PaySplit paySplit in listSplitsForSplit)
                 {
                     if (paySplit.SplitNum == SplitNumCur)
                     {
                         continue;
                     }
                     splitTotal += (decimal)paySplit.SplitAmt;
                 }
                 decimal leftOverAmt = (decimal)split.SplitAmt + splitTotal + AmtAllocated;                   //splitTotal should be negative.
                 if (leftOverAmt <= 0)
                 {
                     _listPaySplits.Remove(split);
                 }
                 else
                 {
                     split.SplitAmt = (double)leftOverAmt;                          //This will cause the left over amount to show up in the grid.  We don't do any saving in this form.
                 }
             }
         }
         else
         {
             _listPaySplits = ListUnallocatedSplits;
         }
     }
     else
     {
         GetSplitsForPats(isShowAll);
     }
 }