public static void ReleaseRetainage(ARInvoiceEntry graph, ARInvoiceExt invoice, ARRetainageFilter 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;

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

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

            graph.Save.Press();

            if (isAutoRelease)
            {
                List <ARRegister> toRelease = new List <ARRegister>()
                {
                    retainageInvoice
                };
                using (new PXTimeStampScope(null))
                {
                    ARDocumentRelease.ReleaseDoc(toRelease, true);
                }
            }
        }
Beispiel #2
0
        protected virtual void ARRetainageFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            ARRetainageFilter filter = e.Row as ARRetainageFilter;

            if (filter == null)
            {
                return;
            }

            bool isAutoRelease = ARSetup.Current.RetainageInvoicesAutoRelease == true;

            DocumentList.SetProcessDelegate(delegate(List <ARInvoiceExt> list)
            {
                ARInvoiceEntry graph = CreateInstance <ARInvoiceEntry>();
                ARInvoiceEntryRetainage retainageExt = graph.GetExtension <ARInvoiceEntryRetainage>();

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

                retainageExt.ReleaseRetainageProc(list, retainageOptions, isAutoRelease);
            });
        }