public static void Process(PMProforma doc) { List <PMProforma> list = new List <PMProforma>(); list.Add(doc); Process(list, false); }
protected virtual void _(Events.RowDeleted <ARInvoice> e) { var select = new PXSelectJoin <PMBillingRecord, LeftJoin <PMProforma, On <PMBillingRecord.proformaRefNbr, Equal <PMProforma.refNbr> > >, Where <PMBillingRecord.aRDocType, Equal <Required <PMBillingRecord.aRDocType> >, And <PMBillingRecord.aRRefNbr, Equal <Required <PMBillingRecord.aRRefNbr> > > > >(Base); var resultset = select.Select(e.Row.DocType, e.Row.RefNbr); if (resultset.Count > 0) { PMBillingRecord billingRecord = PXResult.Unwrap <PMBillingRecord>(resultset[0]); if (billingRecord != null) { if (billingRecord.ProformaRefNbr != null) { billingRecord.ARDocType = null; billingRecord.ARRefNbr = null; ProjectBillingRecord.Update(billingRecord); PMProforma proforma = PXResult.Unwrap <PMProforma>(resultset[0]); if (proforma != null && !string.IsNullOrEmpty(proforma.RefNbr)) { proforma.ARInvoiceDocType = null; proforma.ARInvoiceRefNbr = null; proforma.Released = false; proforma.Status = ProformaStatus.Open; ProjectProforma.Update(proforma); } } else { ProjectBillingRecord.Delete(billingRecord); } } PMRegister allocationReversal = PXSelect <PMRegister, Where <PMRegister.origDocType, Equal <PMOrigDocType.allocationReversal>, And <PMRegister.origNoteID, Equal <Required <ARInvoice.noteID> >, And <PMRegister.released, Equal <False> > > > > .Select(Base, e.Row.NoteID); if (allocationReversal != null) { ProjectRegister.Delete(allocationReversal); } } AddToUnbilledSummary(e.Row); }
public virtual IEnumerable items() { if (Filter.Current.Action == "<SELECT>") { yield break; } ProFormaFilter filter = Filter.Current; string actionID = Filter.Current.Action; if (_ActionChanged) { Items.Cache.Clear(); } PXSelectBase <PMProforma> cmd; switch (actionID) { case "Release": cmd = new PXSelectJoin <PMProforma, InnerJoinSingleTable <Customer, On <PMProforma.customerID, Equal <Customer.bAccountID> > >, Where <PMProforma.hold, Equal <False>, And <PMProforma.released, Equal <False>, And <PMProforma.status, Equal <ProformaStatus.open>, And <Match <Customer, Current <AccessInfo.userName> > > > > > >(this); break; default: cmd = new PXSelectJoin <PMProforma, InnerJoinSingleTable <Customer, On <PMProforma.customerID, Equal <Customer.bAccountID> > >, Where <Match <Customer, Current <AccessInfo.userName> > > >(this); break; } cmd.WhereAnd <Where <PMProforma.invoiceDate, LessEqual <Current <ProFormaFilter.endDate> > > >(); if (filter.BeginDate != null) { cmd.WhereAnd <Where <PMProforma.invoiceDate, GreaterEqual <Current <ProFormaFilter.beginDate> > > >(); } if (filter.OwnerID != null) { cmd.WhereAnd <Where <PMProforma.ownerID, Equal <Current <ProFormaFilter.currentOwnerID> > > >(); } if (filter.WorkGroupID != null) { cmd.WhereAnd <Where <PMProforma.workgroupID, Equal <Current <ProFormaFilter.workGroupID> > > >(); } if (Filter.Current.ShowAll == true) { cmd.WhereAnd <Where <PMProforma.hold, Equal <False> > > (); } int startRow = PXView.StartRow; int totalRows = 0; foreach (PXResult <PMProforma> res in cmd.View.Select(PXView.Currents, null, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows)) { PMProforma item = res; PMProforma cached = (PMProforma)Items.Cache.Locate(item); if (cached != null) { item.Selected = cached.Selected; } yield return(item); PXView.StartRow = 0; } }