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); } } }
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); }); }