Skip to content

Instantly share code, notes, and snippets.

@russellkt
Created December 17, 2008 19:38
Show Gist options
  • Save russellkt/37183 to your computer and use it in GitHub Desktop.
Save russellkt/37183 to your computer and use it in GitHub Desktop.
def self.policies_with_balance start_date, end_date
cond = []
cond << "(policies.delete_code is null OR policies.delete_code = '')"
cond << "expires_on BETWEEN ? AND ?"
cond << "total_premium - payment_amount > 0.00"
find( :all,
:conditions => [ cond.join(" AND "), start_date, end_date ],
:order => 'policies.policy_number ASC' )
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment