public virtual IEnumerable transactions() { PXSelectBase <PMTran> select = new PXSelectJoin <PMTran, LeftJoin <Account, On <Account.accountID, Equal <PMTran.offsetAccountID> >, LeftJoin <PMRegister, On <PMTran.tranType, Equal <PMRegister.module>, And <PMTran.refNbr, Equal <PMRegister.refNbr> > >, LeftJoin <ARTran, On <ARTran.tranType, Equal <PMTran.aRTranType>, And <ARTran.refNbr, Equal <PMTran.aRRefNbr>, And <ARTran.lineNbr, Equal <PMTran.refLineNbr> > > > > > >, Where <PMTran.projectID, Equal <Current <TranFilter.projectID> > > >(this); TranFilter filter = this.Filter.Current; if (filter != null) { if (filter.AccountGroupID != null) { select.WhereAnd <Where <PMTran.accountGroupID, Equal <Current <TranFilter.accountGroupID> >, Or <Account.accountGroupID, Equal <Current <TranFilter.accountGroupID> > > > >(); } if (filter.ProjectTaskID != null) { select.WhereAnd <Where <PMTran.taskID, Equal <Current <TranFilter.projectTaskID> > > >(); } if (filter.CostCode != null) { select.WhereAnd <Where <PMTran.costCodeID, Equal <Current <TranFilter.costCode> > > >(); } if (filter.InventoryID != null) { select.WhereAnd <Where <PMTran.inventoryID, Equal <Current <TranFilter.inventoryID> > > >(); } if (filter.ResourceID != null) { select.WhereAnd <Where <PMTran.resourceID, Equal <Current <TranFilter.resourceID> > > >(); } if (filter.OnlyAllocation == true) { select.WhereAnd <Where <PMRegister.isAllocation, Equal <True> > >(); } if (filter.DateFrom != null && filter.DateTo != null) { if (filter.DateFrom == filter.DateTo) { select.WhereAnd <Where <PMTran.date, Equal <Current <TranFilter.dateFrom> > > >(); } else { select.WhereAnd <Where <PMTran.date, Between <Current <TranFilter.dateFrom>, Current <TranFilter.dateTo> > > >(); } } else if (filter.DateFrom != null) { select.WhereAnd <Where <PMTran.date, GreaterEqual <Current <TranFilter.dateFrom> > > >(); } else if (filter.DateTo != null) { select.WhereAnd <Where <PMTran.date, LessEqual <Current <TranFilter.dateTo> > > >(); } } return(TimeCardMaint.QSelect(this, select.View.BqlSelect)); }
public virtual IEnumerable transactions() { TranFilter filter = this.Filter.Current; if (filter != null && ( filter.ProjectID != null || filter.AccountID != null || filter.AccountGroupID != null || filter.ARRefNbr != null || filter.TranID != null)) { var parameters = new List <object>(); PXSelectBase <PMTran> select = new PXSelectJoin <PMTran, LeftJoin <Account, On <Account.accountID, Equal <PMTran.offsetAccountID> >, LeftJoin <PMRegister, On <PMTran.tranType, Equal <PMRegister.module>, And <PMTran.refNbr, Equal <PMRegister.refNbr> > > > >, Where <True, Equal <True> > >(this); if (filter.ARRefNbr != null) { //nbrs of batches originated from invoice var refNbrs = PXSelectJoin <ARInvoice, InnerJoin <PMRegister, On <PMRegister.origNoteID, Equal <ARInvoice.noteID> > >, Where <ARRegister.docType, Equal <Current <TranFilter.aRDocType> >, And <ARRegister.refNbr, Equal <Current <TranFilter.aRRefNbr> > > > > .Select(this) .Select(r => ((PMRegister)(PXResult <ARInvoice, PMRegister>)r).RefNbr).ToArray(); if (refNbrs.Any()) { parameters.Add(refNbrs); select.WhereAnd <Where2 <Where <PMTran.aRTranType, Equal <Current <TranFilter.aRDocType> >, And <PMTran.aRRefNbr, Equal <Current <TranFilter.aRRefNbr> > > >, Or <Where <PMTran.refNbr, In <Required <PMTran.refNbr> > > > > >(); } else { select.WhereAnd <Where <PMTran.aRTranType, Equal <Current <TranFilter.aRDocType> >, And <PMTran.aRRefNbr, Equal <Current <TranFilter.aRRefNbr> > > > >(); } } if (filter.TranID != null) { select.WhereAnd <Where <PMTran.tranID, Equal <Current <TranFilter.tranID> > > >(); } if (filter.ProjectID != null) { select.WhereAnd <Where <PMTran.projectID, Equal <Current <TranFilter.projectID> > > >(); } if (filter.AccountGroupID != null) { select.WhereAnd <Where <PMTran.accountGroupID, Equal <Current <TranFilter.accountGroupID> >, Or <Account.accountGroupID, Equal <Current <TranFilter.accountGroupID> > > > >(); } if (filter.AccountID != null) { select.WhereAnd <Where <PMTran.accountID, Equal <Current <TranFilter.accountID> >, Or <Account.accountID, Equal <Current <TranFilter.accountID> > > > >(); } if (filter.ProjectTaskID != null) { select.WhereAnd <Where <PMTran.taskID, Equal <Current <TranFilter.projectTaskID> > > >(); } if (filter.CostCode != null) { select.WhereAnd <Where <PMTran.costCodeID, Equal <Current <TranFilter.costCode> > > >(); } if (filter.InventoryID != null) { select.WhereAnd <Where <PMTran.inventoryID, Equal <Current <TranFilter.inventoryID> > > >(); } if (filter.ResourceID != null) { select.WhereAnd <Where <PMTran.resourceID, Equal <Current <TranFilter.resourceID> > > >(); } if (filter.OnlyAllocation == true) { select.WhereAnd <Where <PMRegister.isAllocation, Equal <True> > >(); } if (filter.IncludeUnreleased.GetValueOrDefault() == false) { select.WhereAnd <Where <PMRegister.released, Equal <True> > >(); } if (filter.DateFrom != null && filter.DateTo != null) { if (filter.DateFrom == filter.DateTo) { select.WhereAnd <Where <PMTran.date, Equal <Current <TranFilter.dateFrom> > > >(); } else { select.WhereAnd <Where <PMTran.date, Between <Current <TranFilter.dateFrom>, Current <TranFilter.dateTo> > > >(); } } else if (filter.DateFrom != null) { select.WhereAnd <Where <PMTran.date, GreaterEqual <Current <TranFilter.dateFrom> > > >(); } else if (filter.DateTo != null) { select.WhereAnd <Where <PMTran.date, LessEqual <Current <TranFilter.dateTo> > > >(); } return(TimeCardMaint.QSelect(this, select.View.BqlSelect, parameters.ToArray())); } return(Enumerable.Empty <PMTran>()); }