protected virtual IEnumerable spdocs() { List <ARSPCommnDocResult> res = new List <ARSPCommnDocResult>(); SPDocFilter filter = (SPDocFilter)this.Filter.Current; if (filter != null && filter.SalesPersonID != null && filter.CommnPeriod != null) { PXSelectBase <ARSalesPerTran> sel = new PXSelectJoin <ARSalesPerTran, InnerJoin <ARRegister, On <ARSalesPerTran.docType, Equal <ARRegister.docType>, And <ARSalesPerTran.refNbr, Equal <ARRegister.refNbr> > >, InnerJoinSingleTable <Customer, On <Customer.bAccountID, Equal <ARRegister.customerID>, And <Match <Customer, Current <AccessInfo.userName> > > > > >, Where <ARSalesPerTran.salespersonID, Equal <Current <SPDocFilter.salesPersonID> >, And <ARSalesPerTran.commnPaymntPeriod, Equal <Current <SPDocFilter.commnPeriod> >, And <ARSalesPerTran.actuallyUsed, Equal <BQLConstants.BitOn> > > > >(this); if (filter.CustomerID != null) { sel.WhereAnd <Where <ARRegister.customerID, Equal <Current <SPDocFilter.customerID> > > >(); } if (filter.LocationID != null) { sel.WhereAnd <Where <ARRegister.customerLocationID, Equal <Current <SPDocFilter.locationID> > > >(); } foreach (PXResult <ARSalesPerTran, ARRegister, Customer> it in sel.Select()) { ARSPCommnDocResult m = new ARSPCommnDocResult(); Copy(m, ((ARSalesPerTran)it)); Copy(m, ((ARRegister)it)); res.Add(m); } } return(res); }
protected virtual void Copy(ARSPCommnDocResult aDst, ARSalesPerTran aSrc) { aDst.RefNbr = aSrc.RefNbr; aDst.DocType = aSrc.DocType; aDst.AdjdDocType = (aSrc.AdjdDocType != ARDocType.Undefined)? aSrc.AdjdDocType: String.Empty; aDst.AdjdRefNbr = aSrc.AdjdRefNbr; aDst.AdjNbr = aSrc.AdjNbr; aDst.CommnPct = aSrc.CommnPct; aDst.CommnAmt = aSrc.CommnAmt; aDst.CommnblAmt = aSrc.CommnblAmt; }
protected virtual IEnumerable spdocs() { List <ARSPCommnDocResult> res = new List <ARSPCommnDocResult>(); SPDocFilter filter = Filter.Current; if (filter?.CommnPeriod != null) { PXSelectBase <ARSalesPerTran> sel = new PXSelectJoin <ARSalesPerTran, InnerJoin <ARRegister, On <ARSalesPerTran.docType, Equal <ARRegister.docType>, And <ARSalesPerTran.refNbr, Equal <ARRegister.refNbr> > >, InnerJoinSingleTable <Customer, On <Customer.bAccountID, Equal <ARRegister.customerID>, And <Match <Customer, Current <AccessInfo.userName> > > > > >, Where <ARSalesPerTran.actuallyUsed, Equal <BQLConstants.BitOn> > >(this); if (filter.SalesPersonID != null) { sel.WhereAnd <Where <ARSalesPerTran.salespersonID, Equal <Current <SPDocFilter.salesPersonID> > > >(); } if (filter.CommnPeriod != null) { sel.WhereAnd <Where <ARSalesPerTran.commnPaymntPeriod, Equal <Current <SPDocFilter.commnPeriod> > > >(); } if (filter.CustomerID != null) { sel.WhereAnd <Where <ARRegister.customerID, Equal <Current <SPDocFilter.customerID> > > >(); } if (filter.LocationID != null) { sel.WhereAnd <Where <ARRegister.customerLocationID, Equal <Current <SPDocFilter.locationID> > > >(); } PXView view = sel.View; int startRow = PXView.StartRow; int totalRows = 0; List <object> windowedSelection = view.Select(PXView.Currents, PXView.Parameters, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows); PXView.StartRow = 0; foreach (PXResult <ARSalesPerTran, ARRegister, Customer> it in windowedSelection) { ARSPCommnDocResult m = new ARSPCommnDocResult(); Copy(m, ((ARSalesPerTran)it)); Copy(m, ((ARRegister)it)); res.Add(m); } } return(res); }
public virtual IEnumerable ViewOrigDocument(PXAdapter adapter) { if (SPDocs.Current != null) { ARSPCommnDocResult current = SPDocs.Current; if (current.DocType == ARDocType.CreditMemo && string.IsNullOrEmpty(current.AdjdDocType)) { RedirectToDoc(current.DocType, current.RefNbr); } if (string.IsNullOrEmpty(current.AdjdDocType) == false) { RedirectToDoc(current.AdjdDocType, current.AdjdRefNbr); } throw new PXException(Messages.OriginalDocumentIsNotSet); } return(Filter.Select()); }
protected virtual void Copy(ARSPCommnDocResult aDst, ARRegister aSrc) { aDst.CustomerID = aSrc.CustomerID; aDst.CustomerLocationID = aSrc.CustomerLocationID; aDst.OrigDocAmt = aSrc.OrigDocAmt; }