コード例 #1
0
        private void CheckPaymentForOutstandingLienWaivers(APRegister document)
        {
            var adjustments = AdjustmentDataProvider.GetPaymentAdjustments(graph, document.RefNbr, document.DocType).ToList();
            var projectIds  = LienWaiverProjectDataProvider.GetProjectIds(graph, adjustments).ToList();

            CheckPrimaryVendorForOutstandingLienWaivers(document, projectIds);
            adjustments.ForEach(adjust => CheckJointVendorsForOutstandingLienWaivers(adjust, projectIds));
        }
コード例 #2
0
 protected override decimal?GetTotalVendorPaymentAmount(APAdjust adjustment, string referenceNumber,
                                                        int?origLineNbr)
 {
     return(AdjustmentDataProvider
            .GetAdjustmentsForInvoiceGroup(Graph, referenceNumber, origLineNbr)
            .Where(adj => adj.AdjdRefNbr == adjustment.AdjdRefNbr && adj.AdjdLineNbr == adjustment.AdjdLineNbr)
            .Sum(adj => GetVendorPaymentAmount(adj).GetValueOrDefault()));
 }
コード例 #3
0
        public virtual decimal?GetNonReleasedCashDiscountTakenExceptCurrentAdjustment(APAdjust apAdjust)
        {
            var adjustments = AdjustmentDataProvider.GetInvoiceAdjustments(Graph, apAdjust.AdjdRefNbr);
            var releasedCashDiscountTaken = InvoiceDataProvider
                                            .GetInvoice(Graph, apAdjust.AdjdDocType, apAdjust.AdjdRefNbr).CuryDiscTaken;
            var totalCashDiscountTaken = adjustments.Sum(adjustment => adjustment.CuryAdjgPPDAmt);

            return(totalCashDiscountTaken - releasedCashDiscountTaken - apAdjust.CuryAdjgPPDAmt);
        }
コード例 #4
0
        private IEnumerable <LienWaiverGenerationKey> CreateLienWaiverGroupingKeys(
            IReadOnlyCollection <JointPayee> jointPayees, APRegister payment, APTran transaction)
        {
            var adjustments = AdjustmentDataProvider.GetInvoiceAdjustments(Graph, transaction.RefNbr);

            return(adjustments.Any()
                ? CreateGroupingKeys(jointPayees, payment, transaction)
                : CreateGroupingKeysForPaymentByLines(jointPayees, payment, transaction));
        }
コード例 #5
0
        public override decimal?GetNonReleasedCashDiscountTakenExceptCurrentAdjustment(APAdjust apAdjust)
        {
            var nonReleasedCashDiscountTaken = AdjustmentDataProvider
                                               .GetAdjustmentsForInvoiceGroup(Graph, apAdjust.AdjdRefNbr, apAdjust.AdjdLineNbr)
                                               .Where(adjust => !adjust.Released.GetValueOrDefault())
                                               .Sum(adjust => adjust.CuryAdjgPPDAmt);

            return(nonReleasedCashDiscountTaken - apAdjust.CuryAdjgPPDAmt);
        }
コード例 #6
0
        protected virtual decimal GetAllowableCashDiscountConsiderBillBalance(APAdjust apAdjust)
        {
            var invoiceAdjustments = AdjustmentDataProvider.GetInvoiceAdjustments(Graph, apAdjust.AdjdRefNbr);
            var unappliedBalance   = invoiceAdjustments
                                     .Sum(adjustment => adjustment.CuryAdjgAmt + adjustment.CuryAdjgPPDAmt);
            var billBalance = InvoiceDataProvider.GetInvoice(Graph, apAdjust.AdjdDocType, apAdjust.AdjdRefNbr)
                              .CuryOrigDocAmt;
            var cashDiscount = billBalance - unappliedBalance + apAdjust.CuryAdjgPPDAmt;

            return(Math.Max(cashDiscount.GetValueOrDefault(), 0));
        }
コード例 #7
0
        private void UpdateJointAmountToPayAvailability(JointPayeePayment jointPayeePayment)
        {
            var jointPayee             = JointPayeeDataProvider.GetJointPayee(Base, jointPayeePayment);
            var adjustment             = AdjustmentDataProvider.GetAdjustment(Base, jointPayeePayment);
            var hasReversedAdjustments = DoesCheckContainReversedAdjustments(jointPayeePayment);
            var isZeroJointBalance     = jointPayee.JointBalance == 0 && !hasReversedAdjustments;
            var isReleased             = adjustment?.Released == true;
            var isVoidAdjustment       = !IsVoidCheck() && adjustment?.Voided == true;
            var isReadOnly             = isZeroJointBalance || isReleased || isVoidAdjustment;

            PXUIFieldAttribute.SetReadOnly <JointPayeePayment.jointAmountToPay>(
                JointPayeePayments.Cache, jointPayeePayment, isReadOnly);
        }
コード例 #8
0
        private void ReverseJointPayeePayments(APAdjust originalAdjustment)
        {
            var reversedAdjustment = AdjustmentDataProvider.GetReversedAdjustment(Base, originalAdjustment);

            if (reversedAdjustment == null)
            {
                return;
            }
            var jointPayeePayments = JointPayeePaymentDataProvider.GetJointPayeePayments(Base, reversedAdjustment);

            if (jointPayeePayments.IsEmpty())
            {
                AddRevertingJointPayeePayments(originalAdjustment, reversedAdjustment);
            }
        }
コード例 #9
0
        private void ValidateAmountPaidExceedsBillBalance(APAdjust adjustment, decimal?amountPaid,
                                                          bool doNeedShowErrorOnPersist)
        {
            var invoiceAdjustments = AdjustmentDataProvider.GetInvoiceAdjustments(Graph, adjustment.AdjdRefNbr);
            var unappliedBalance   = invoiceAdjustments
                                     .Sum(adjust => adjust.CuryAdjgAmt + adjust.CuryAdjgPPDAmt);
            var billBalance = InvoiceDataProvider.GetInvoice(Graph, adjustment.AdjdDocType, adjustment.AdjdRefNbr)
                              .CuryOrigDocAmt.GetValueOrDefault();
            var allowableAmountPaid = billBalance - unappliedBalance + amountPaid;

            if (amountPaid > allowableAmountPaid)
            {
                ShowErrorMessage <APAdjust.curyAdjgAmt>(adjustment, amountPaid, adjustment.AdjdLineNbr != 0
                    ? JointCheckMessages.AmountPaidExceedsBillLineBalance
                    : JointCheckMessages.AmountPaidExceedsBillBalance, allowableAmountPaid);
                ShowErrorOnPersistIfRequired(Graph.Adjustments.Cache, doNeedShowErrorOnPersist);
            }
        }
 protected virtual decimal?GetTotalVendorPaymentAmount(APAdjust adjustment, string origRefNbr, int?origLineNbr)
 {
     return(AdjustmentDataProvider
            .GetAdjustmentsForInvoiceGroup(Graph, origRefNbr, origLineNbr)
            .Sum(adj => GetVendorPaymentAmount(adj).GetValueOrDefault()));
 }