Example #1
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 <APInvoiceEntry>(
                delegate(APInvoiceEntry graph, APInvoiceExt item)
            {
                ReleaseRetainage(graph, item, filter, isAutoRelease);
            });
        }
Example #2
0
        protected virtual void APRetainageFilter_RefNbr_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            APRetainageFilter filter = e.Row as APRetainageFilter;

            if (filter == null)
            {
                return;
            }

            var document = PXSelectorAttribute.Select <APRetainageFilter.refNbr>(sender, filter, e.NewValue);

            if (document is null)
            {
                e.NewValue = null;
                e.Cancel   = true;
            }
        }
Example #3
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);
            });
        }
Example #4
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);
                }
            }
        }