Skip to content

Instantly share code, notes, and snippets.

@smarenich
Created June 7, 2016 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarenich/3bda67553bb394d443db30f2959bc6eb to your computer and use it in GitHub Desktop.
Save smarenich/3bda67553bb394d443db30f2959bc6eb to your computer and use it in GitHub Desktop.
public PXSelectReadonly2<Contract,
InnerJoin<ContractBillingSchedule, On<ContractBillingSchedule.contractID, Equal<Contract.contractID>>,
InnerJoin<CSAnswers,
On<CSAnswers.entityType, Equal<CSAnswerType.contractAnswerType>,
And<CSAnswers.entityID, Equal<Contract.contractID>,
And<CSAnswers.attributeID, Equal<AttributesConst.RevTypeAttribute>>>>,
InnerJoin<CSAttributeDetail,
On<CSAttributeDetail.attributeID, Equal<AttributesConst.RevTypeAttribute>,
And<CSAttributeDetail.valueID, Equal<CSAnswers.value>>>,
>>>,
Where<Contract.baseType, Equal<Contract.ContractBaseType>,
And2<Where<CSAnswers.value, Equal<LicenseTypes.pcp>, Or<CSAnswers.value, Equal<LicenseTypes.pcs>, Or<CSAnswers.value, Equal<LicenseTypes.saas>>>>,
And<Contract.status, NotEqual<Contract.status.canceled>, And<Contract.status, NotEqual<Contract.status.draft>, And<Contract.status, NotEqual<Contract.status.expired>,
And<Where<ContractBillingSchedule.accountID, Equal<Current<PartnerFilter.currentPartner>>>>>>>>>,
OrderBy<Asc<CSAttributeDetail.description, Asc<Contract.contractCD>>>> Renewals;
public IEnumerable renewals()
{
PXView select = new PXView(this, true, Renewals.View.BqlSelect);
Int32 totalrow = 0;
Int32 startrow = PXView.StartRow;
List<object> result = select.Select(PXView.Currents, PXView.Parameters, PXView.Searches,
PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startrow, PXView.MaximumRows, ref totalrow);
PXView.StartRow = 0;
foreach (PXResult<Contract, ContractBillingSchedule, CSAnswers> row in result)
{
Contract contract = (Contract)row;
ContractExt contractExt = Renewals.Cache.GetExtension<ContractExt>(contract);
ContractBillingSchedule schedule = (ContractBillingSchedule)row;
contractExt.Renewed = schedule.LastDate > new DateTime(DateTime.Now.Year, 1, 1);
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment