예제 #1
0
        protected override decimal?GetOpenBalanceByAllBillsFromRetainageGroup(APInvoice invoice)
        {
            var originalInvoice                  = InvoiceDataProvider.GetOriginalInvoice(Graph, invoice.RefNbr, invoice.DocType);
            var billLineNumbers                  = JointPayees.Select(jp => jp.BillLineNumber).ToList();
            var unreleasedRetainageAmount        = GetUnreleasedRetainageAmount(originalInvoice, billLineNumbers);
            var releasedAmountFromRetainageGroup = GeReleasedAmountFromRetainageGroup(invoice, billLineNumbers);

            return(invoice.CuryDocBal + unreleasedRetainageAmount + releasedAmountFromRetainageGroup);
        }
예제 #2
0
        public decimal GetVendorBalancePerLine(APAdjust adjustment)
        {
            var jointPayeesTotalBalanceForLine = JointPayees
                                                 .Where(jp => jp.BillLineNumber == adjustment.AdjdLineNbr)
                                                 .Sum(jp => jp.JointBalance);
            var transactionBalance = TransactionDataProvider.GetTransaction(
                Graph, adjustment.AdjdDocType, adjustment.AdjdRefNbr, adjustment.AdjdLineNbr).CuryTranBal;
            var openBalancePerLine   = GetOpenBalanceByAllBillsFromRetainageGroupPerLine(adjustment, transactionBalance);
            var vendorBalancePerLine = openBalancePerLine - jointPayeesTotalBalanceForLine;

            return(Math.Min(transactionBalance.GetValueOrDefault(), vendorBalancePerLine.GetValueOrDefault()));
        }
        public override void RecalculateTotalJointAmount()
        {
            var jointPayeesByLineGroups = JointPayees.SelectMain().GroupBy(jp => jp.BillLineNumber)
                                          .Where(jp => jp.Key != null);

            foreach (var jointPayeesByLine in jointPayeesByLineGroups)
            {
                var transaction = TransactionDataProvider.GetTransaction(Graph, CurrentBill.DocType, CurrentBill.RefNbr,
                                                                         jointPayeesByLine.Key);
                transactionExtension = PXCache <APTran> .GetExtension <ApTranExt>(transaction);

                transactionExtension.TotalJointAmountPerLine = jointPayeesByLine.Sum(jp => jp.JointAmountOwed);
            }
        }