protected virtual IEnumerable customers() { BillingFilter filter = Filter.Current; if (filter == null) { yield break; } bool found = false; foreach (CustomersList item in Customers.Cache.Inserted) { found = true; yield return(item); } if (found) { yield break; } PXSelectBase <EPExpenseClaimDetails> sel = new PXSelectJoinGroupBy <EPExpenseClaimDetails, InnerJoin <Customer, On <EPExpenseClaimDetails.customerID, Equal <Customer.bAccountID> >, LeftJoin <Contract, On <EPExpenseClaimDetails.contractID, Equal <Contract.contractID> > > >, Where <EPExpenseClaimDetails.released, Equal <boolTrue>, And <EPExpenseClaimDetails.billable, Equal <boolTrue>, And <EPExpenseClaimDetails.billed, Equal <boolFalse>, And <EPExpenseClaimDetails.expenseDate, LessEqual <Current <BillingFilter.endDate> > > > > >, Aggregate <GroupBy <EPExpenseClaimDetails.customerID, GroupBy <EPExpenseClaimDetails.customerLocationID> > > >(this); if (filter.CustomerClassID != null) { sel.WhereAnd <Where <Customer.customerClassID, Equal <Current <BillingFilter.customerClassID> > > >(); } if (filter.CustomerID != null) { sel.WhereAnd <Where <Customer.bAccountID, Equal <Current <BillingFilter.customerID> > > >(); } foreach (PXResult <EPExpenseClaimDetails, Customer, Contract> res in sel.Select()) { CustomersList retitem = new CustomersList(); Customer customer = res; EPExpenseClaimDetails claimdetaisl = res; Contract contract = (Contract)res; if (contract.BaseType == PMProject.ProjectBaseType.Project) { continue; } retitem.CustomerID = customer.BAccountID; retitem.LocationID = claimdetaisl.CustomerLocationID; retitem.CustomerClassID = customer.CustomerClassID; retitem.Selected = false; yield return(Customers.Insert(retitem)); } }
protected virtual void BillingFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { BillingFilter filter = Filter.Current; Customers.SetProcessDelegate <EPCustomerBillingProcess>( delegate(EPCustomerBillingProcess docgraph, CustomersList customer) { EPCustomerBilling.Bill(docgraph, customer, filter); }); }
protected virtual void BillingFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { BillingFilter filter = Filter.Current; Items.SetProcessDelegate <PMBillEngine>( delegate(PMBillEngine engine, ProjectsList item) { if (!engine.Bill(item.ProjectID, filter.InvoiceDate, filter.InvFinPeriodID)) { throw new PXSetPropertyException(Warnings.NothingToBill, PXErrorLevel.RowWarning); } }); }
protected virtual void BillingFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { BillingFilter filter = (BillingFilter)e.Row; Items.SetProcessDelegate( delegate(Contract item) { CTBillEngine engine = PXGraph.CreateInstance <CTBillEngine>(); ContractBillingSchedule schedule = PXSelect <ContractBillingSchedule, Where <ContractBillingSchedule.contractID, Equal <Required <Contract.contractID> > > > .Select(engine, item.ContractID); if (schedule.Type == BillingType.OnDemand) { engine.Bill(item.ContractID, filter.InvoiceDate); } else { engine.Bill(item.ContractID); } }); }
public static void Bill(EPCustomerBillingProcess docgraph, CustomersList customer, BillingFilter filter) { docgraph.Bill(customer, filter); }
protected virtual void BillingFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { BillingFilter filter = Filter.Current; Customers.SetProcessDelegate <EPCustomerBillingProcess>((docgraph, customer) => docgraph.Bill(customer, filter)); }
protected virtual IEnumerable items() { BillingFilter filter = Filter.Current; if (filter == null) { yield break; } bool found = false; foreach (ProjectsList item in Items.Cache.Inserted) { found = true; yield return(item); } if (found) { yield break; } PXSelectBase <PMProject> select = new PXSelectJoin <PMProject, InnerJoin <ContractBillingSchedule, On <PMProject.contractID, Equal <ContractBillingSchedule.contractID> >, InnerJoin <Customer, On <PMProject.customerID, Equal <Customer.bAccountID> > > >, Where2 <Where <ContractBillingSchedule.nextDate, LessEqual <Current <BillingFilter.invoiceDate> >, Or <ContractBillingSchedule.type, Equal <BillingType.BillingOnDemand> > >, And <PMProject.baseType, Equal <PMProject.ProjectBaseType>, And <PMProject.nonProject, Equal <False>, And <PMProject.isTemplate, Equal <False> > > > > >(this); if (filter.StatementCycleId != null) { select.WhereAnd <Where <Customer.statementCycleId, Equal <Current <BillingFilter.statementCycleId> > > >(); } if (filter.CustomerClassID != null) { select.WhereAnd <Where <Customer.customerClassID, Equal <Current <BillingFilter.customerClassID> > > >(); } if (filter.CustomerID != null) { select.WhereAnd <Where <Customer.bAccountID, Equal <Current <BillingFilter.customerID> > > >(); } if (filter.TemplateID != null) { select.WhereAnd <Where <PMProject.templateID, Equal <Current <BillingFilter.templateID> > > >(); } foreach (PXResult <PMProject, ContractBillingSchedule, Customer> item in select.Select()) { PMProject project = (PMProject)item; ContractBillingSchedule schedule = (ContractBillingSchedule)item; Customer customer = (Customer)item; ProjectsList result = new ProjectsList(); result.ProjectID = project.ContractID; result.ProjectCD = project.ContractCD; result.Description = project.Description; result.CustomerID = project.CustomerID; result.CustomerName = customer.AcctName; result.LastDate = schedule.LastDate; DateTime?fromDate = null; if (schedule.NextDate != null) { switch (schedule.Type) { case BillingType.Annual: fromDate = schedule.NextDate.Value.AddYears(-1); break; case BillingType.Monthly: fromDate = schedule.NextDate.Value.AddMonths(-1); break; case BillingType.Weekly: fromDate = schedule.NextDate.Value.AddDays(-7); break; case BillingType.Quarterly: fromDate = schedule.NextDate.Value.AddMonths(-3); break; } } result.FromDate = fromDate; result.NextDate = schedule.NextDate; yield return(Items.Insert(result)); } Items.Cache.IsDirty = false; }
protected virtual IEnumerable items() { BillingFilter filter = Filter.Current; if (filter == null) { yield break; } bool found = false; foreach (ProjectsList item in Items.Cache.Inserted) { found = true; yield return(item); } if (found) { yield break; } PXSelectBase <PMProject> selectUnbilled = new PXSelectJoinGroupBy <PMProject, InnerJoin <PMUnbilledDailySummary, On <PMUnbilledDailySummary.projectID, Equal <PMProject.contractID> >, InnerJoin <ContractBillingSchedule, On <PMProject.contractID, Equal <ContractBillingSchedule.contractID> >, InnerJoin <Customer, On <PMProject.customerID, Equal <Customer.bAccountID> >, InnerJoin <PMTask, On <PMTask.projectID, Equal <PMUnbilledDailySummary.projectID>, And <PMTask.isActive, Equal <True>, And <PMTask.taskID, Equal <PMUnbilledDailySummary.taskID>, And <Where <PMTask.billingOption, Equal <PMBillingOption.onBilling>, Or2 <Where <PMTask.billingOption, Equal <PMBillingOption.onTaskCompletion>, And <PMTask.isCompleted, Equal <True> > >, Or <Where <PMTask.billingOption, Equal <PMBillingOption.onProjectCompetion>, And <PMProject.isCompleted, Equal <True> > > > > > > > > >, InnerJoin <PMBillingRule, On <PMBillingRule.billingID, Equal <PMTask.billingID>, And <PMBillingRule.accountGroupID, Equal <PMUnbilledDailySummary.accountGroupID> > > > > > > >, Where2 <Where <ContractBillingSchedule.nextDate, LessEqual <Current <BillingFilter.invoiceDate> >, Or <ContractBillingSchedule.type, Equal <BillingType.BillingOnDemand> > >, And2 <Where <PMBillingRule.includeNonBillable, Equal <False>, And <PMUnbilledDailySummary.billable, Greater <int0>, Or <Where <PMBillingRule.includeNonBillable, Equal <True>, And <Where <PMUnbilledDailySummary.nonBillable, Greater <int0>, Or <PMUnbilledDailySummary.billable, Greater <int0> > > > > > > >, And2 <Where <PMUnbilledDailySummary.date, LessEqual <Current <BillingFilter.invoiceDate> > >, And <Match <Current <AccessInfo.userName> > > > > >, Aggregate <GroupBy <PMProject.contractID> > >(this); if (Setup.Current.CutoffDate == PMCutOffDate.Excluded) { selectUnbilled = new PXSelectJoinGroupBy <PMProject, InnerJoin <PMUnbilledDailySummary, On <PMUnbilledDailySummary.projectID, Equal <PMProject.contractID> >, InnerJoin <ContractBillingSchedule, On <PMProject.contractID, Equal <ContractBillingSchedule.contractID> >, InnerJoin <Customer, On <PMProject.customerID, Equal <Customer.bAccountID> >, InnerJoin <PMTask, On <PMTask.projectID, Equal <PMUnbilledDailySummary.projectID>, And <PMTask.isActive, Equal <True>, And <PMTask.taskID, Equal <PMUnbilledDailySummary.taskID>, And <Where <PMTask.billingOption, Equal <PMBillingOption.onBilling>, Or2 <Where <PMTask.billingOption, Equal <PMBillingOption.onTaskCompletion>, And <PMTask.isCompleted, Equal <True> > >, Or <Where <PMTask.billingOption, Equal <PMBillingOption.onProjectCompetion>, And <PMProject.isCompleted, Equal <True> > > > > > > > > >, InnerJoin <PMBillingRule, On <PMBillingRule.billingID, Equal <PMTask.billingID>, And <PMBillingRule.accountGroupID, Equal <PMUnbilledDailySummary.accountGroupID> > > > > > > >, Where2 <Where <ContractBillingSchedule.nextDate, LessEqual <Current <BillingFilter.invoiceDate> >, Or <ContractBillingSchedule.type, Equal <BillingType.BillingOnDemand> > >, And2 <Where <PMBillingRule.includeNonBillable, Equal <False>, And <PMUnbilledDailySummary.billable, Greater <int0>, Or <Where <PMBillingRule.includeNonBillable, Equal <True>, And <Where <PMUnbilledDailySummary.nonBillable, Greater <int0>, Or <PMUnbilledDailySummary.billable, Greater <int0> > > > > > > >, And2 <Where <PMUnbilledDailySummary.date, Less <Current <BillingFilter.invoiceDate> > >, And <Match <Current <AccessInfo.userName> > > > > >, Aggregate <GroupBy <PMProject.contractID> > >(this); } PXSelectBase <PMProject> selectRecurring = new PXSelectJoinGroupBy <PMProject, InnerJoin <ContractBillingSchedule, On <PMProject.contractID, Equal <ContractBillingSchedule.contractID> >, InnerJoin <Customer, On <PMProject.customerID, Equal <Customer.bAccountID> >, InnerJoin <PMTask, On <PMTask.projectID, Equal <PMProject.contractID> >, InnerJoin <PMBillingRule, On <PMBillingRule.billingID, Equal <PMTask.billingID> >, InnerJoin <PMRecurringItem, On <PMTask.projectID, Equal <PMRecurringItem.projectID>, And <PMTask.taskID, Equal <PMRecurringItem.taskID>, And <PMTask.isCompleted, Equal <False> > > > > > > > >, Where2 <Where <ContractBillingSchedule.nextDate, LessEqual <Current <BillingFilter.invoiceDate> >, Or <ContractBillingSchedule.type, Equal <BillingType.BillingOnDemand> > >, And <Match <Current <AccessInfo.userName> > > >, Aggregate <GroupBy <PMProject.contractID> > >(this); PXSelectBase <PMProject> selectProgressive = new PXSelectJoinGroupBy <PMProject, InnerJoin <ContractBillingSchedule, On <PMProject.contractID, Equal <ContractBillingSchedule.contractID> >, InnerJoin <Customer, On <PMProject.customerID, Equal <Customer.bAccountID> >, InnerJoin <PMTask, On <PMTask.projectID, Equal <PMProject.contractID> >, InnerJoin <PMBillingRule, On <PMBillingRule.billingID, Equal <PMTask.billingID> >, InnerJoin <PMBudget, On <PMTask.projectID, Equal <PMBudget.projectID>, And <PMTask.taskID, Equal <PMBudget.projectTaskID>, And <PMBudget.type, Equal <GL.AccountType.income>, And <PMBudget.amountToInvoice, NotEqual <decimal0> > > > > > > > > >, Where <Match <Current <AccessInfo.userName> > >, Aggregate <GroupBy <PMProject.contractID> > >(this); if (filter.StatementCycleId != null) { selectUnbilled.WhereAnd <Where <Customer.statementCycleId, Equal <Current <BillingFilter.statementCycleId> > > >(); selectRecurring.WhereAnd <Where <Customer.statementCycleId, Equal <Current <BillingFilter.statementCycleId> > > >(); selectProgressive.WhereAnd <Where <Customer.statementCycleId, Equal <Current <BillingFilter.statementCycleId> > > >(); } if (filter.CustomerClassID != null) { selectUnbilled.WhereAnd <Where <Customer.customerClassID, Equal <Current <BillingFilter.customerClassID> > > >(); selectRecurring.WhereAnd <Where <Customer.customerClassID, Equal <Current <BillingFilter.customerClassID> > > >(); selectProgressive.WhereAnd <Where <Customer.customerClassID, Equal <Current <BillingFilter.customerClassID> > > >(); } if (filter.CustomerID != null) { selectUnbilled.WhereAnd <Where <Customer.bAccountID, Equal <Current <BillingFilter.customerID> > > >(); selectRecurring.WhereAnd <Where <Customer.bAccountID, Equal <Current <BillingFilter.customerID> > > >(); selectProgressive.WhereAnd <Where <Customer.bAccountID, Equal <Current <BillingFilter.customerID> > > >(); } if (filter.TemplateID != null) { selectUnbilled.WhereAnd <Where <PMProject.templateID, Equal <Current <BillingFilter.templateID> > > >(); selectRecurring.WhereAnd <Where <PMProject.templateID, Equal <Current <BillingFilter.templateID> > > >(); selectProgressive.WhereAnd <Where <PMProject.templateID, Equal <Current <BillingFilter.templateID> > > >(); } foreach (PXResult item in selectUnbilled.Select().Union(selectRecurring.Select()).Union(selectProgressive.Select())) { PMProject project = PXResult.Unwrap <PMProject>(item); ContractBillingSchedule schedule = PXResult.Unwrap <ContractBillingSchedule>(item); Customer customer = PXResult.Unwrap <Customer>(item); ProjectsList result = new ProjectsList(); result.ProjectID = project.ContractID; result.ProjectCD = project.ContractCD; result.Description = project.Description; result.CustomerID = project.CustomerID; result.CustomerName = customer.AcctName; result.LastDate = schedule.LastDate; DateTime?fromDate = null; if (schedule.NextDate != null) { switch (schedule.Type) { case BillingType.Annual: fromDate = schedule.NextDate.Value.AddYears(-1); break; case BillingType.Monthly: fromDate = schedule.NextDate.Value.AddMonths(-1); break; case BillingType.Weekly: fromDate = schedule.NextDate.Value.AddDays(-7); break; case BillingType.Quarterly: fromDate = schedule.NextDate.Value.AddMonths(-3); break; } } result.FromDate = fromDate; result.NextDate = schedule.NextDate; if (Items.Locate(result) == null) { yield return(Items.Insert(result)); } } Items.Cache.IsDirty = false; }
protected virtual IEnumerable items() { BillingFilter filter = Filter.Current; if (filter == null) { yield break; } bool found = false; foreach (ProjectsList item in Items.Cache.Inserted) { found = true; yield return(item); } if (found) { yield break; } PXSelectBase <PMProject> selectUnbilled = new PXSelectJoinGroupBy <PMProject, InnerJoin <PMUnbilledDailySummary, On <PMUnbilledDailySummary.projectID, Equal <PMProject.contractID> >, InnerJoin <ContractBillingSchedule, On <PMProject.contractID, Equal <ContractBillingSchedule.contractID> >, InnerJoin <Customer, On <PMProject.customerID, Equal <Customer.bAccountID> >, InnerJoin <PMTask, On <PMTask.projectID, Equal <PMUnbilledDailySummary.projectID>, And <PMTask.isActive, Equal <True>, And <PMTask.taskID, Equal <PMUnbilledDailySummary.taskID>, And <Where <PMTask.billingOption, Equal <PMBillingOption.onBilling>, Or2 <Where <PMTask.billingOption, Equal <PMBillingOption.onTaskCompletion>, And <PMTask.isCompleted, Equal <True> > >, Or <Where <PMTask.billingOption, Equal <PMBillingOption.onProjectCompetion>, And <PMProject.isCompleted, Equal <True> > > > > > > > > >, InnerJoin <PMBillingRule, On <PMBillingRule.billingID, Equal <PMTask.billingID>, And <PMBillingRule.accountGroupID, Equal <PMUnbilledDailySummary.accountGroupID> > > > > > > >, Where2 <Where <ContractBillingSchedule.nextDate, LessEqual <Current <BillingFilter.invoiceDate> >, Or <ContractBillingSchedule.type, Equal <BillingType.BillingOnDemand> > >, And2 <Where <PMBillingRule.includeNonBillable, Equal <False>, And <PMUnbilledDailySummary.billable, Greater <int0>, Or <Where <PMBillingRule.includeNonBillable, Equal <True>, And <Where <PMUnbilledDailySummary.nonBillable, Greater <int0>, Or <PMUnbilledDailySummary.billable, Greater <int0> > > > > > > >, And2 <Where <PMUnbilledDailySummary.date, LessEqual <Current <BillingFilter.invoiceDate> > >, And <Match <Current <AccessInfo.userName> > > > > >, Aggregate <GroupBy <PMProject.contractID> > >(this); if (Setup.Current.CutoffDate == PMCutOffDate.Excluded) { selectUnbilled = new PXSelectJoinGroupBy <PMProject, InnerJoin <PMUnbilledDailySummary, On <PMUnbilledDailySummary.projectID, Equal <PMProject.contractID> >, InnerJoin <ContractBillingSchedule, On <PMProject.contractID, Equal <ContractBillingSchedule.contractID> >, InnerJoin <Customer, On <PMProject.customerID, Equal <Customer.bAccountID> >, InnerJoin <PMTask, On <PMTask.projectID, Equal <PMUnbilledDailySummary.projectID>, And <PMTask.isActive, Equal <True>, And <PMTask.taskID, Equal <PMUnbilledDailySummary.taskID>, And <Where <PMTask.billingOption, Equal <PMBillingOption.onBilling>, Or2 <Where <PMTask.billingOption, Equal <PMBillingOption.onTaskCompletion>, And <PMTask.isCompleted, Equal <True> > >, Or <Where <PMTask.billingOption, Equal <PMBillingOption.onProjectCompetion>, And <PMProject.isCompleted, Equal <True> > > > > > > > > >, InnerJoin <PMBillingRule, On <PMBillingRule.billingID, Equal <PMTask.billingID>, And <PMBillingRule.accountGroupID, Equal <PMUnbilledDailySummary.accountGroupID> > > > > > > >, Where2 <Where <ContractBillingSchedule.nextDate, LessEqual <Current <BillingFilter.invoiceDate> >, Or <ContractBillingSchedule.type, Equal <BillingType.BillingOnDemand> > >, And2 <Where <PMBillingRule.includeNonBillable, Equal <False>, And <PMUnbilledDailySummary.billable, Greater <int0>, Or <Where <PMBillingRule.includeNonBillable, Equal <True>, And <Where <PMUnbilledDailySummary.nonBillable, Greater <int0>, Or <PMUnbilledDailySummary.billable, Greater <int0> > > > > > > >, And2 <Where <PMUnbilledDailySummary.date, Less <Current <BillingFilter.invoiceDate> > >, And <Match <Current <AccessInfo.userName> > > > > >, Aggregate <GroupBy <PMProject.contractID> > >(this); } PXSelectBase <PMProject> selectRecurring = new PXSelectJoinGroupBy <PMProject, InnerJoin <ContractBillingSchedule, On <PMProject.contractID, Equal <ContractBillingSchedule.contractID> >, InnerJoin <Customer, On <PMProject.customerID, Equal <Customer.bAccountID> >, InnerJoin <PMTask, On <PMTask.projectID, Equal <PMProject.contractID> >, InnerJoin <PMBillingRule, On <PMBillingRule.billingID, Equal <PMTask.billingID> >, InnerJoin <PMRecurringItem, On <PMTask.projectID, Equal <PMRecurringItem.projectID>, And <PMTask.taskID, Equal <PMRecurringItem.taskID>, And <PMTask.isCompleted, Equal <False> > > > > > > > >, Where2 <Where <ContractBillingSchedule.nextDate, LessEqual <Current <BillingFilter.invoiceDate> >, Or <ContractBillingSchedule.type, Equal <BillingType.BillingOnDemand> > >, And <Match <Current <AccessInfo.userName> > > >, Aggregate <GroupBy <PMProject.contractID> > >(this); PXSelectBase <PMProject> selectProgressive = new PXSelectJoinGroupBy <PMProject, InnerJoin <ContractBillingSchedule, On <PMProject.contractID, Equal <ContractBillingSchedule.contractID> >, InnerJoin <Customer, On <PMProject.customerID, Equal <Customer.bAccountID> >, InnerJoin <PMTask, On <PMTask.projectID, Equal <PMProject.contractID> >, InnerJoin <PMBillingRule, On <PMBillingRule.billingID, Equal <PMTask.billingID> >, InnerJoin <PMBudget, On <PMTask.projectID, Equal <PMBudget.projectID>, And <PMTask.taskID, Equal <PMBudget.projectTaskID>, And <PMBudget.type, Equal <GL.AccountType.income>, And <PMBudget.curyAmountToInvoice, NotEqual <decimal0> > > > > > > > > >, Where <Match <Current <AccessInfo.userName> > >, Aggregate <GroupBy <PMProject.contractID> > >(this); if (filter.StatementCycleId != null) { selectUnbilled.WhereAnd <Where <Customer.statementCycleId, Equal <Current <BillingFilter.statementCycleId> > > >(); selectRecurring.WhereAnd <Where <Customer.statementCycleId, Equal <Current <BillingFilter.statementCycleId> > > >(); selectProgressive.WhereAnd <Where <Customer.statementCycleId, Equal <Current <BillingFilter.statementCycleId> > > >(); } if (filter.CustomerClassID != null) { selectUnbilled.WhereAnd <Where <Customer.customerClassID, Equal <Current <BillingFilter.customerClassID> > > >(); selectRecurring.WhereAnd <Where <Customer.customerClassID, Equal <Current <BillingFilter.customerClassID> > > >(); selectProgressive.WhereAnd <Where <Customer.customerClassID, Equal <Current <BillingFilter.customerClassID> > > >(); } if (filter.CustomerID != null) { selectUnbilled.WhereAnd <Where <Customer.bAccountID, Equal <Current <BillingFilter.customerID> > > >(); selectRecurring.WhereAnd <Where <Customer.bAccountID, Equal <Current <BillingFilter.customerID> > > >(); selectProgressive.WhereAnd <Where <Customer.bAccountID, Equal <Current <BillingFilter.customerID> > > >(); } if (filter.TemplateID != null) { selectUnbilled.WhereAnd <Where <PMProject.templateID, Equal <Current <BillingFilter.templateID> > > >(); selectRecurring.WhereAnd <Where <PMProject.templateID, Equal <Current <BillingFilter.templateID> > > >(); selectProgressive.WhereAnd <Where <PMProject.templateID, Equal <Current <BillingFilter.templateID> > > >(); } using (new PXFieldScope(selectUnbilled.View, typeof(PMProject.contractID), typeof(PMProject.contractCD), typeof(PMProject.description), typeof(PMProject.customerID), typeof(ContractBillingSchedule.contractID), typeof(ContractBillingSchedule.lastDate), typeof(ContractBillingSchedule.nextDate))) { foreach (PXResult item in selectUnbilled.Select()) { var result = CreateListItem(item); if (Items.Locate(result) == null) { yield return(Items.Insert(result)); } } } using (new PXFieldScope(selectRecurring.View, typeof(PMProject.contractID), typeof(PMProject.contractCD), typeof(PMProject.description), typeof(PMProject.customerID), typeof(ContractBillingSchedule.contractID), typeof(ContractBillingSchedule.lastDate), typeof(ContractBillingSchedule.nextDate))) { foreach (PXResult item in selectRecurring.Select()) { var result = CreateListItem(item); if (Items.Locate(result) == null) { yield return(Items.Insert(result)); } } } using (new PXFieldScope(selectProgressive.View, typeof(PMProject.contractID), typeof(PMProject.contractCD), typeof(PMProject.description), typeof(PMProject.customerID), typeof(ContractBillingSchedule.contractID), typeof(ContractBillingSchedule.lastDate), typeof(ContractBillingSchedule.nextDate) )) { foreach (PXResult item in selectProgressive.Select()) { var result = CreateListItem(item); if (Items.Locate(result) == null) { yield return(Items.Insert(result)); } } } Items.Cache.IsDirty = false; }