Beispiel #1
0
        public static APTran GetTransaction(PXGraph graph, JointPayee jointPayee)
        {
            var jointPayeePayment = JointPayeePaymentDataProvider.GetJointPayeePayment(graph, jointPayee.JointPayeeId);

            return(GetTransaction(graph, jointPayeePayment.InvoiceDocType ?? jointPayeePayment.PaymentDocType,
                                  jointPayeePayment.InvoiceRefNbr ?? jointPayeePayment.PaymentRefNbr, jointPayee.BillLineNumber));
        }
 private List <PXResult <JointPayeePayment> > GetJointPayeePaymentsAndJointPayees(APAdjust adjustment)
 {
     return(adjustment.AdjdDocType == APDocType.Invoice
         ? JointPayeePaymentDataProvider.GetJointPayeePaymentsAndJointPayees(graph, adjustment)
            .Where(x => x.GetItem <JointPayeePayment>().JointAmountToPay > 0).ToList()
         : new List <PXResult <JointPayeePayment> >());
 }
Beispiel #3
0
        private bool IsPaymentCycleWorkflow(IDocumentKey invoice)
        {
            var allRelatedBills =
                InvoiceDataProvider.GetAllBillsFromRetainageGroup(Base, invoice.RefNbr, invoice.DocType);

            return(allRelatedBills.Any(inv =>
                                       JointPayeePaymentDataProvider.DoesAnyNonReleasedJointPayeePaymentExist(Base, inv)));
        }
        public void ClosePaymentCycleWorkflowIfNeeded(APAdjust adjustment)
        {
            var invoice = InvoiceDataProvider.GetInvoice(graph, adjustment.AdjdDocType, adjustment.AdjdRefNbr);

            if (!JointPayeePaymentDataProvider.DoesAnyNonReleasedJointPayeePaymentExist(graph, invoice))
            {
                UpdateIsPaymentCycleWorkflow(invoice, false);
            }
        }
Beispiel #5
0
        private bool DoesAnyOutstandingLienWaiverExistForJointPayees(APAdjust adjustment, List <int?> projectsIds)
        {
            var jointPayeePayments = JointPayeePaymentDataProvider.GetJointPayeePayments(Base, adjustment.AdjdRefNbr,
                                                                                         adjustment.AdjdDocType, adjustment.AdjdLineNbr);
            var jointPayees = JointPayeeDataProvider.GetJointPayees(Base, jointPayeePayments, adjustment.AdjdLineNbr);

            return(jointPayees.Any(jp => lienWaiverDataProvider
                                   .DoesAnyOutstandingComplianceExistForJointVendor(jp, projectsIds)));
        }
        protected void AddRevertingJointPayeePayments(APAdjust originalAdjustment, APAdjust revertedAdjustment)
        {
            var originalJointPayeePayments =
                JointPayeePaymentDataProvider.GetJointPayeePayments(Base, originalAdjustment);

            foreach (var jointPayeePayment in originalJointPayeePayments)
            {
                AddRevertingJointPayeePayment(jointPayeePayment, revertedAdjustment);
            }
        }
        private IEnumerable <PXResult <JointPayeePayment> > GetJointPayeePaymentsWithJointPayees(APRegister payment)
        {
            var insertedJointPayeePayments = Graph.Caches <JointPayeePayment>().Inserted.RowCast <JointPayeePayment>();
            var insertedJointPayeePaymentsAndJointPayees =
                insertedJointPayeePayments.Select(GetInsertedJointPayeePaymentsWithJointPayees);
            var jointPayeePaymentsAndJointPayees =
                JointPayeePaymentDataProvider.GetJointPayeePaymentsAndJointPayees(Graph, payment);

            return(jointPayeePaymentsAndJointPayees.Concat(insertedJointPayeePaymentsAndJointPayees).AsEnumerable()
                   .Where(DoesJointPayeeInternalIdMatchGenerationKey));
        }
Beispiel #8
0
        private IEnumerable <JointPayeePayment> GetNonReleasedJointPayeePayments(JointPayee jointPayee,
                                                                                 string referenceNumber, int?lineNumber)
        {
            var nonReleasedJointPayeePayments = JointPayeePaymentDataProvider
                                                .GetNonReleasedJointPayeePayments(Graph, jointPayee);

            return(referenceNumber == null
                ? nonReleasedJointPayeePayments
                : nonReleasedJointPayeePayments.Where(jpp =>
                                                      jpp.InvoiceRefNbr == referenceNumber && jpp.BillLineNumber == lineNumber));
        }
        public void Validate()
        {
            var atLeastOneVoidAdjustmentExist = Adjustments.Any(adjustment => adjustment.Voided == true);

            if (atLeastOneVoidAdjustmentExist)
            {
                var showErrorOnPersist = JointPayeePaymentDataProvider
                                         .GetCurrentJointPayeePaymentsByVendorGroups(Graph, Graph.Document.Current)
                                         .Select(ValidateReversedJointPayeePayments).Any(isValid => !isValid);
                ShowErrorOnPersistIfRequired(Graph.Caches[typeof(JointPayeePayment)], showErrorOnPersist);
            }
        }
Beispiel #10
0
        private void ReleaseJointPayeePayments(APRegister document)
        {
            var jointPayeePaymentsAndJointPayees = JointPayeePaymentDataProvider
                                                   .GetNonReleasedJointPayeePaymentsAndJointPayees(Base, document).ToList();

            foreach (var jointPayeePaymentAndJointPayee in jointPayeePaymentsAndJointPayees)
            {
                var jointPayee         = jointPayeePaymentAndJointPayee.GetItem <JointPayee>();
                var jointPayeePayments = jointPayeePaymentsAndJointPayees.RowCast <JointPayeePayment>()
                                         .Where(jpp => jpp.JointPayeeId == jointPayee.JointPayeeId);
                RecalculateJointPayee(jointPayeePayments, jointPayee);
            }
        }
Beispiel #11
0
        private void CheckJointVendorsForOutstandingLienWaivers(APAdjust adjustment, List <int?> projectIds)
        {
            var jointPayeePayments = JointPayeePaymentDataProvider.GetJointPayeePayments(graph, adjustment)
                                     .Where(jpp => jpp.JointAmountToPay > 0);
            var jointPayees =
                JointPayeeDataProvider.GetJointPayees(graph, jointPayeePayments);

            if (jointPayees.Any(jp =>
                                lienWaiverDataProvider.DoesAnyOutstandingComplianceExistForJointVendor(jp, projectIds)))
            {
                throw new PXException(exceptionMessage);
            }
        }
        public void ValidateJointAmountToPayExceedBalance()
        {
            var actualJointPayeePayments = ActualAdjustments
                                           .SelectMany(adjustment => JointPayeePaymentDataProvider.GetJointPayeePayments(Graph, adjustment))
                                           .ToList();

            foreach (var jointPayeePayment in actualJointPayeePayments)
            {
                ValidateJointAmountToPayExceedJointBalance(jointPayeePayment);
                ValidateJointAmountToPayExceedBillBalance(jointPayeePayment);
                ValidateJointAmountToPayExceedJointPreparedBalance(jointPayeePayment);
                ValidateJointPayeePaymentTotalAmountToPayExceedBillAmount(actualJointPayeePayments, jointPayeePayment);
            }
        }
        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);
            }
        }
 public IEnumerable PayInvoice(PXAdapter adapter, Func <PXAdapter, IEnumerable> baseMethod)
 {
     InvoiceExtension.IsPaymentCycleWorkflow = JointPayeePaymentDataProvider
                                               .DoesAnyNonReleasedJointPayeePaymentExist(Base, Base.Document.Current);
     if (!IsPayInvoiceAvailable())
     {
         return(adapter.Get());
     }
     lienWaiverWarningDialogService.ShowWarningIfNeeded();
     if (InvoiceExtension.IsJointPayees == false)
     {
         return(PayBillWithoutJointPayees(adapter, baseMethod));
     }
     PayBillWithJointPayees();
     return(adapter.Get());
 }
        public void DeleteJointPayeePayments(APAdjust adjustment)
        {
            var jointPayeePayments = JointPayeePaymentDataProvider.GetJointPayeePayments(graph, adjustment);

            graph.Caches <JointPayeePayment>().DeleteAll(jointPayeePayments);
        }
Beispiel #16
0
 public decimal?GetTotalJointAmountToPay(APAdjust apAdjust)
 {
     return(JointPayeePaymentDataProvider.GetJointPayeePayments(Graph, apAdjust)
            .Sum(x => x.JointAmountToPay));
 }
 private PXResultset <JointPayeePayment> GetCurrentJointPayeePayments()
 {
     return(OriginalInvoice == null
         ? new PXResultset <JointPayeePayment, JointPayee>()
         : JointPayeePaymentDataProvider.GetCurrentJointPayeePayments(Base, OriginalInvoice, CurrentInvoice));
 }