private Query buidDynamicsQuery(Query _query)
{
this.retrieveQueryFilters(_query);
QueryBuildDataSource qbdsPriceDiscAdmTrans = _query.dataSourceTable(tableNum(PriceDiscAdmTrans));
qbdsPriceDiscAdmTrans.addRange(fieldNum(PriceDiscAdmTrans, AccountCode)).value(queryValue(PriceDiscProductCodeType::All));
qbdsPriceDiscAdmTrans.addRange(fieldNum(PriceDiscAdmTrans, relation)).value(queryValue(PriceType::PriceSales));
if (currencyCode)
{
qbdsPriceDiscAdmTrans.addRange(fieldNum(PriceDiscAdmTrans, Currency)).value(queryValue(currencyCode));
}
if (toDate)
{
qbdsPriceDiscAdmTrans.addRange(fieldNum(PriceDiscAdmTrans, FromDate)).value(queryRange(null, toDate));
}
if (fromDate)
{
qbdsPriceDiscAdmTrans.addRange(fieldNum(PriceDiscAdmTrans, ToDate)).value(queryRange(fromDate, null));
qbdsPriceDiscAdmTrans.addRange(fieldNum(PriceDiscAdmTrans, ToDate)).value(queryValue(dateNull()));
}
return _query;
}