Exemplo 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);
 }
Exemplo n.º 3
0
        private void CreateZeroAmountJointPayeePayments(IDocumentKey payment, IEnumerable <int?> jointPayeeIds)
        {
            var jointPayeePayments = jointPayeeIds
                                     .Select(jointPayeeId => CreateJointPayeePayment(jointPayeeId, payment, 0));

            JointPayeePayments.Cache.InsertAll(jointPayeePayments);
        }
Exemplo 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());
        }
Exemplo 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)));
        }
Exemplo n.º 6
0
 private void ValidateEmptyInvoiceJointPayees(IDocumentKey document)
 {
     if (document.DocType == APDocType.Invoice && IsJointPayeesInvoice(document) &&
         !DoesAnyInvoiceJointPayeeExist(document))
     {
         throw new PXException(JointCheckMessages.JointPayeesRequired);
     }
 }
Exemplo n.º 7
0
 private static void InsertCashAccountId(PXFieldDefaultingEventArgs args, IDocumentKey invoice)
 {
     if (invoice.DocType != APDocType.Prepayment)
     {
         return;
     }
     args.NewValue = null;
     args.Cancel   = true;
 }
Exemplo n.º 8
0
 public bool Equals(IDocumentKey other)
 {
     var otherPie = other as PieDocumentKey;
     if (otherPie != null)
     {
         return otherPie._pieId == this._pieId;
     }
     return false;
 }
Exemplo n.º 9
0
        public bool Equals(IDocumentKey other)
        {
            var otherPie = other as Key;

            if (otherPie != null)
            {
                return(otherPie._key == this._key);
            }
            return(false);
        }
Exemplo 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));
 }
Exemplo 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);
            }
        }
Exemplo 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));
            }
Exemplo 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));
        }
Exemplo 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
     });
 }
Exemplo n.º 17
0
 public SessionOperationIntent(IDocumentKey key, bool shouldDelete = true)
 {
     Key          = key;
     ShouldDelete = shouldDelete;
 }
Exemplo 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));
 }
Exemplo n.º 19
0
        private void CreateZeroAmountJointPayeePaymentsForVendorCheck(IDocumentKey vendorCheck)
        {
            var jointPayeeIds = InvoiceJointPayeePayments.Select(jpp => jpp.JointPayeeId);

            CreateZeroAmountJointPayeePayments(vendorCheck, jointPayeeIds);
        }
Exemplo n.º 20
0
 internal TrackedDocument(T document, T hiddenCopy, IDocumentKey key)
 {
     this.document   = document;
     this.hiddenCopy = hiddenCopy;
     this.key        = key;
 }
Exemplo n.º 21
0
 private bool IsExistingOrderSelected(IDocumentKey salesOrder)
 {
     return(Base.Document.Cache.GetStatus(salesOrder) != PXEntryStatus.Inserted);
 }
Exemplo 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);
Exemplo 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;
Exemplo 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;
Exemplo n.º 25
0
 public void MarkForDeletion(IDocumentKey key)
 {
     deletedKeys.Add(key);
 }
Exemplo n.º 26
0
 public bool IsMarkedForDeletion(IDocumentKey key)
 {
     return(deletedKeys.Contains(key));
 }
Exemplo 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);
 }
Exemplo n.º 29
0
 private static bool IsCheckOrVoidCheck(IDocumentKey document)
 {
     return(document.DocType.IsIn(APDocType.Check, APDocType.VoidCheck));
 }
Exemplo n.º 30
0
 public bool Equals(IDocumentKey other)
 {
     return(Equals((object)other));
 }
Exemplo n.º 31
0
 internal TrackedDocument(T item, Document document, IDocumentKey key)
 {
     this.item     = item;
     this.document = document;
     this.key      = key;
 }