$args['searchWhere'][]='res_id in (select DISTINCT res_id_master from res_attachments where attachment_type in (?) and status in (\'TRA\', \'A_TRA\', \'FRZ\'))';
$args['searchWhere'][]='res_id in (select DISTINCT res_id_master from res_attachments where attachment_type in (?) and status not in (\'DEL\', \'OBS\'))';
$args['searchWhere'][]='res_id in (select DISTINCT res_id_master from res_attachments where creation_date >= ? and attachment_type not in (?) and status in (\'TRA\', \'A_TRA\', \'FRZ\'))';
$args['searchWhere'][]='res_id in (select DISTINCT res_id_master from res_attachments where creation_date >= ? and attachment_type not in (?) and status not in (\'DEL\', \'OBS\'))';
$args['searchWhere'][]='res_id in (select DISTINCT res_id_master from res_attachments where creation_date <= ? and attachment_type not in (?) and status in (\'TRA\', \'A_TRA\', \'FRZ\'))';
$args['searchWhere'][]='res_id in (select DISTINCT res_id_master from res_attachments where creation_date <= ? and attachment_type not in (?) and status not in (\'DEL\', \'OBS\'))';