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); } } }
public virtual void InsertDetails(ARInvoiceEntry docgraph, ARInvoice ardoc, ARInvoice new_ardoc, InsertDetailsDelegate baseMethod) { docgraph.FieldUpdated.RemoveHandler <ARTran.inventoryID>(docgraph.GetExtension <ARInvoiceEntryRUTROT>().ARTran_InventoryID_FieldUpdated); baseMethod(docgraph, ardoc, new_ardoc); if (PXCache <ARInvoice> .GetExtension <ARInvoiceRUTROT>(ardoc)?.IsRUTROTDeductible == true) { foreach (RUTROTDistribution rrDetail in PXSelect <RUTROTDistribution, Where <RUTROTDistribution.docType, Equal <Required <ARInvoice.docType> >, And <RUTROTDistribution.refNbr, Equal <Required <ARInvoice.refNbr> > > > > .Select(docgraph, ardoc.DocType, ardoc.RefNbr)) { RUTROTDistribution new_rrDetail = PXCache <RUTROTDistribution> .CreateCopy(rrDetail); new_rrDetail.RefNbr = null; new_rrDetail.CuryInfoID = null; new_rrDetail.LineNbr = null; new_rrDetail.CuryAmount = 0m; new_rrDetail.Amount = 0m; docgraph.RRDistribution.Insert(new_rrDetail); } } }
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); }); }