var override_queryfields = [
    {
        name: 'contract_number',
        queryexpression: "t1.contract_number = ${@contract_number}"
    },
    {
        name: 'bp_name',
        queryexpression: "t1.bp_name = ${@bp_name}"
    },
    {
        name: 'journal_date',
        queryexpression: "to_char(t1.journal_date,'yyyy-mm-dd') = ${@journal_date}"
    },
    {
        name: 'base_period',
        queryexpression: "to_char(t1.journal_date,'yyyymm') < ${@base_period}"
    }
];

var add_datafilters = [{
    name: 'base_period',
    expression: "t1.journal_date <= add_months(last_day(to_date(${@base_period},'yyyymm')),-1) and (t1.invoice_date is null or t1.invoice_date >= TRUNC(to_date(${@base_period},'yyyymm'),'dd'))"
}];

override();
add_datafilter();