コード例 #1
0
        public static void ReleaseRetainage(APInvoiceEntry graph, APInvoiceExt invoice, APRetainageFilter filter, bool isAutoRelease)
        {
            graph.Clear(PXClearOption.ClearAll);
            PXUIFieldAttribute.SetError(graph.Document.Cache, null, null, null);

            RetainageOptions retainageOptions = new RetainageOptions();

            retainageOptions.DocDate          = filter.DocDate;
            retainageOptions.FinPeriodID      = filter.FinPeriodID;
            retainageOptions.CuryRetainageAmt = invoice.CuryRetainageReleasedAmt;
            retainageOptions.InvoiceNbr       = invoice.RetainageVendorRef;

            APInvoiceEntryRetainage retainageExt = graph.GetExtension <APInvoiceEntryRetainage>();

            APInvoice retainageInvoice = retainageExt.ReleaseRetainageProc(invoice, retainageOptions, isAutoRelease);

            graph.Save.Press();

            if (isAutoRelease && retainageInvoice.Hold != true)
            {
                List <APRegister> toRelease = new List <APRegister>()
                {
                    retainageInvoice
                };
                using (new PXTimeStampScope(null))
                {
                    APDocumentRelease.ReleaseDoc(toRelease, true);
                }
            }
        }
コード例 #2
0
        public List <ComplianceDocument> GetComplianceDocumentsToLink()
        {
            var complianceExtension = graph.GetExtension <ApInvoiceEntryExt>();

            return(complianceExtension.ComplianceDocuments.Select().FirstTableItems
                   .Where(cd => cd.LinkToPayment == true).ToList());
        }
コード例 #3
0
 public void ShowWarningIfNeeded()
 {
     if (lienWaiverSetup.ShouldStopPayments == true ||
         lienWaiverSetup.ShouldWarnOnPayment == true)
     {
         var jointPayees = graph.GetExtension <ApInvoiceEntryExt>().JointPayees.SelectMain();
         var doesOutstandingComplianceExistForPrimaryVendor =
             DoesAnyOutstandingComplianceExistForPrimaryVendor();
         var doesOutstandingComplianceExistForJointCheck =
             jointPayees.Any(DoesAnyOutstandingComplianceExistForJointCheck);
         ShowWarningIfNeeded(doesOutstandingComplianceExistForPrimaryVendor,
                             doesOutstandingComplianceExistForJointCheck);
     }
 }
コード例 #4
0
        protected virtual void APRetainageFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            APRetainageFilter filter = e.Row as APRetainageFilter;

            if (filter == null)
            {
                return;
            }

            bool isAutoRelease = APSetup.Current?.RetainageBillsAutoRelease == true;

            DocumentList.SetProcessDelegate(delegate(List <APInvoiceExt> list)
            {
                APInvoiceEntry graph = CreateInstance <APInvoiceEntry>();
                APInvoiceEntryRetainage retainageExt = graph.GetExtension <APInvoiceEntryRetainage>();

                RetainageOptions retainageOptions  = new RetainageOptions();
                retainageOptions.DocDate           = filter.DocDate;
                retainageOptions.MasterFinPeriodID = FinPeriodIDAttribute.CalcMasterPeriodID <APRetainageFilter.finPeriodID>(graph.Caches[typeof(APRetainageFilter)], filter);


                retainageExt.ReleaseRetainageProc(list, retainageOptions, isAutoRelease);
            });
        }
コード例 #5
0
        public static void ProcessMethod(USSimpleInvoice header)
        {
            try
            {
                //Only for accessing virtual methods
                //You should not use the instance of the Graph from the UI in long operations, because they will not be run asynchronously, and could hang-up/timeout
                APInvoiceEntry          apInvoiceEntry          = PXGraph.CreateInstance <APInvoiceEntry>();
                APInvoiceEntryExtension aPInvoiceEntryExtension = apInvoiceEntry.GetExtension <APInvoiceEntryExtension>();
                //Logic for creating the APInvoice here
                APTran apTran;

                APInvoice invoice = apInvoiceEntry.Document.Insert();
                invoice.DocDesc    = header.Description;
                invoice.DocDate    = header.Date;
                invoice.VendorID   = aPInvoiceEntryExtension?.USSetup?.Current?.VendorID;
                invoice.InvoiceNbr = header.ScoutID.ToString();
                invoice            = apInvoiceEntry.Document.Update(invoice);

                foreach (USSimpleInvoiceLine detail in PXSelectReadonly <USSimpleInvoiceLine,
                                                                         Where <USSimpleInvoiceLine.refNbr, Equal <Required <USSimpleInvoice.refNbr> > > > .Select(apInvoiceEntry, header.RefNbr))
                {
                    apTran = aPInvoiceEntryExtension.GenerateAPTran(detail);

                    apInvoiceEntry.Transactions.Insert(apTran);
                }
                apInvoiceEntry.Save.Press();
                header.InvoiceRef = apInvoiceEntry.Document.Current.RefNbr;
                header.Status     = USSimpleInvoiceStatus.Created;
                aPInvoiceEntryExtension.USSimpleInvoices.Update(header);
                apInvoiceEntry.Save.Press();
            }
            catch (Exception e)
            {
                throw new PXException("An error occured while processing the record : " + e.Message);
            }
        }
コード例 #6
0
 public JointChecksCreator(APInvoiceEntry graph)
     : this(graph, graph.GetExtension <ApInvoiceEntryPayBillExtension>().JointPayeePayments)
 {
 }