[quote="ajb":fhuktkt3]Didn't know you've got company or contact fields. That's fine what you've done. But please - use code tags on forum - it's easier to read.
Just enable filter option in the RB for the date field. You can do this from gui or code. ($field->set_filter() or 'filter' => true for the old RB)
If you use 'show_data' then filters may not show - I'm not sure. Then try to use body method instead. You'll get some additional header, but it should be the easiest way to achieve what you need. Remember that show_data and body has different order of arguments (crits, cols, etc).[/quote:fhuktkt3]
thanks, but this is not what i need. I need, that this calculated field shows number of active contracts, which are active only before expiration date 🙂. Now it counts all contracts tied to this contact or company, no matter if they're expired or no. hut I think I've found solution:
return $rs->get_records_count(array('contract_holder' => "C:" . $company['id'],'(>=end_date'=>date('Y-m-d',strtotime('today')),'cancelled'=>0,'archived'=>0));
It works for now, but is it OK? 'cancelled' and 'archived' fields are checkboxes. It counts records when all conditions are met. I have doubts about checkbox value, is it good.