Esempio n. 1
0
        private bool IsJointPayeesInvoice(IDocumentKey document)
        {
            var invoice          = InvoiceDataProvider.GetInvoice(Base, document.DocType, document.RefNbr);
            var invoiceExtension = PXCache <APInvoice> .GetExtension <APInvoiceJCExt>(invoice);

            return(invoiceExtension?.IsJointPayees == true);
        }
 private IEnumerable <APAdjust> GetAdjustments(IDocumentKey payment)
 {
     return(SelectFrom <APAdjust>
            .Where <APAdjust.adjgDocType.IsEqual <P.AsString>
                    .And <APAdjust.adjgRefNbr.IsEqual <P.AsString> > > .View
            .Select(Base, payment.DocType, payment.RefNbr).FirstTableItems);
 }
Esempio n. 3
0
        private void CreateZeroAmountJointPayeePayments(IDocumentKey payment, IEnumerable <int?> jointPayeeIds)
        {
            var jointPayeePayments = jointPayeeIds
                                     .Select(jointPayeeId => CreateJointPayeePayment(jointPayeeId, payment, 0));

            JointPayeePayments.Cache.InsertAll(jointPayeePayments);
        }
Esempio n. 4
0
        private bool DoesAnyInvoiceJointPayeeExist(IDocumentKey document)
        {
            var noteId = InvoiceDataProvider.GetOriginalInvoice(Base, document.RefNbr, document.DocType)?.NoteID;

            return(SelectFrom <JointPayee>
                   .Where <JointPayee.billId.IsEqual <P.AsGuid> > .View
                   .Select(Base, noteId).Any());
        }
Esempio n. 5
0
        private bool IsPaymentCycleWorkflow(IDocumentKey invoice)
        {
            var allRelatedBills =
                InvoiceDataProvider.GetAllBillsFromRetainageGroup(Base, invoice.RefNbr, invoice.DocType);

            return(allRelatedBills.Any(inv =>
                                       JointPayeePaymentDataProvider.DoesAnyNonReleasedJointPayeePaymentExist(Base, inv)));
        }
Esempio n. 6
0
 private void ValidateEmptyInvoiceJointPayees(IDocumentKey document)
 {
     if (document.DocType == APDocType.Invoice && IsJointPayeesInvoice(document) &&
         !DoesAnyInvoiceJointPayeeExist(document))
     {
         throw new PXException(JointCheckMessages.JointPayeesRequired);
     }
 }
Esempio n. 7
0
 private static void InsertCashAccountId(PXFieldDefaultingEventArgs args, IDocumentKey invoice)
 {
     if (invoice.DocType != APDocType.Prepayment)
     {
         return;
     }
     args.NewValue = null;
     args.Cancel   = true;
 }
Esempio n. 8
0
 public bool Equals(IDocumentKey other)
 {
     var otherPie = other as PieDocumentKey;
     if (otherPie != null)
     {
         return otherPie._pieId == this._pieId;
     }
     return false;
 }
Esempio n. 9
0
        public bool Equals(IDocumentKey other)
        {
            var otherPie = other as Key;

            if (otherPie != null)
            {
                return(otherPie._key == this._key);
            }
            return(false);
        }
Esempio n. 10
0
        public bool Equals(IDocumentKey other)
        {
            var otherPie = other as PieDocumentKey;

            if (otherPie != null)
            {
                return(otherPie._pieId == this._pieId);
            }
            return(false);
        }
 public static ComplianceDocumentReference GetComplianceDocumentReference(PXGraph graph,
                                                                          IDocumentKey documentKey)
 {
     return(new PXSelect <ComplianceDocumentReference,
                          Where <ComplianceDocumentReference.type,
                                 Equal <Required <ComplianceDocumentReference.type> >,
                                 And <ComplianceDocumentReference.referenceNumber,
                                      Equal <Required <ComplianceDocumentReference.referenceNumber> > > > >(graph)
            .SelectSingle(documentKey.DocType, documentKey.RefNbr));
 }
Esempio n. 12
0
        private void UpdatePayment(PXSelectBase <APPayment> paymentView, IDocumentKey payment)
        {
            var resultPayment = (APPayment)paymentView
                                .Search <APPayment.docType, APPayment.refNbr>(payment.DocType, payment.RefNbr);

            if (resultPayment != null)
            {
                resultPayment.Selected = true;
                paymentView.Cache.Update(resultPayment);
            }
        }
        private void VoidJointPayeePayments(IDocumentKey check)
        {
            var checkAdjustments     = GetAdjustments(check).ToList();
            var voidCheckAdjustments = GetAdjustments(Base.Document.Current);

            foreach (var voidCheckAdjustment in voidCheckAdjustments)
            {
                var checkAdjustment = checkAdjustments.Single(adj => IsSameAdjustment(adj, voidCheckAdjustment));
                AddRevertingJointPayeePayments(checkAdjustment, voidCheckAdjustment);
            }
        }
Esempio n. 14
0
            public bool TryGetTrackedDocument(IDocumentKey key, out T tracked)
            {
                tracked = default(T);

                if (key.Empty)
                {
                    return(false);
                }

                return(byKey.TryGetValue(key, out tracked));
            }
Esempio n. 15
0
        private APPayment CreateApPayment(IDocumentKey invoice)
        {
            var documentType = invoice.DocType == APDocType.DebitAdj
                ? APDocType.Refund
                : APDocType.Check;
            var payment = new APPayment
            {
                DocType = documentType
            };

            return(PaymentEntry.Document.Insert(payment));
        }
Esempio n. 16
0
 private JointPayeePayment CreateJointPayeePayment(int?payeeId, IDocumentKey payment, decimal?amount)
 {
     return(new JointPayeePayment
     {
         JointPayeeId = payeeId,
         PaymentDocType = payment.DocType,
         PaymentRefNbr = payment.RefNbr,
         InvoiceDocType = InvoiceEntry.Document.Current.DocType,
         InvoiceRefNbr = InvoiceEntry.Document.Current.RefNbr,
         JointAmountToPay = amount,
         AdjustmentNumber = 0
     });
 }
Esempio n. 17
0
 public SessionOperationIntent(IDocumentKey key, bool shouldDelete = true)
 {
     Key          = key;
     ShouldDelete = shouldDelete;
 }
Esempio n. 18
0
 private void SuppressDefaultEvents(IDocumentKey invoice)
 {
     PaymentEntry.FieldDefaulting.AddHandler <APPayment.cashAccountID>(
         (cache, args) => InsertCashAccountId(args, invoice));
     PaymentEntry.FieldDefaulting.AddHandler <CurrencyInfo.curyID>((cache, args) => InsertCurrencyId(args));
 }
Esempio n. 19
0
        private void CreateZeroAmountJointPayeePaymentsForVendorCheck(IDocumentKey vendorCheck)
        {
            var jointPayeeIds = InvoiceJointPayeePayments.Select(jpp => jpp.JointPayeeId);

            CreateZeroAmountJointPayeePayments(vendorCheck, jointPayeeIds);
        }
Esempio n. 20
0
 internal TrackedDocument(T document, T hiddenCopy, IDocumentKey key)
 {
     this.document   = document;
     this.hiddenCopy = hiddenCopy;
     this.key        = key;
 }
Esempio n. 21
0
 private bool IsExistingOrderSelected(IDocumentKey salesOrder)
 {
     return(Base.Document.Cache.GetStatus(salesOrder) != PXEntryStatus.Inserted);
 }
Esempio n. 22
0
 /// <summary>
 /// Returns <c>true</c> if and only if the calling application corresponds to the
 /// specified document (on either the adjusting or the adjusted side).
 /// </summary>
 public static bool IsApplicationFor(this IDocumentAdjustment application, IDocumentKey document)
 => application.IsOutgoingApplicationFor(document) ||
 application.IsIncomingApplicationFor(document);
Esempio n. 23
0
 /// <summary>
 /// Returns <c>true</c> if the specified document is on the adjusted side of the
 /// specified application, <c>false</c> otherwise. For example, this method will
 /// return <c>true</c> if you call it on an application of a payment to an invoice,
 /// and specify the invoice as the argument.
 /// </summary>
 public static bool IsIncomingApplicationFor(this IDocumentAdjustment application, IDocumentKey document)
 => document.DocType == application.AdjdDocType &&
 document.RefNbr == application.AdjdRefNbr;
Esempio n. 24
0
 /// <summary>
 /// Returns <c>true</c> if the specified document is on the adjusting side of the
 /// specified application, <c>false</c> otherwise. For example, this method will
 /// return <c>true</c> if you call it on an application of a payment to an invoice,
 /// and specify the payment as the argument.
 /// </summary>
 public static bool IsOutgoingApplicationFor(this IDocumentAdjustment application, IDocumentKey document)
 => document.DocType == application.AdjgDocType &&
 document.RefNbr == application.AdjgRefNbr;
Esempio n. 25
0
 public void MarkForDeletion(IDocumentKey key)
 {
     deletedKeys.Add(key);
 }
Esempio n. 26
0
 public bool IsMarkedForDeletion(IDocumentKey key)
 {
     return(deletedKeys.Contains(key));
 }
Esempio n. 27
0
 public void TrackDocument(IDocumentKey key, T item, Document doc)
 {
     byKey.Add(key, item);
     items.Add(new TrackedDocument(item, doc, key));
 }
 public static Guid?GetComplianceDocumentReferenceId(PXGraph graph, IDocumentKey documentKey)
 {
     return(GetComplianceDocumentReference(graph, documentKey)?.ComplianceDocumentReferenceId);
 }
Esempio n. 29
0
 private static bool IsCheckOrVoidCheck(IDocumentKey document)
 {
     return(document.DocType.IsIn(APDocType.Check, APDocType.VoidCheck));
 }
Esempio n. 30
0
 public bool Equals(IDocumentKey other)
 {
     return(Equals((object)other));
 }
Esempio n. 31
0
 internal TrackedDocument(T item, Document document, IDocumentKey key)
 {
     this.item     = item;
     this.document = document;
     this.key      = key;
 }