Apart from individual DDL and test data, your logic seems incomplete. I would revisit this and better explain what the process is for computation.
You can use CASE for some of this.
CASE when day = 1 and month = 'Jan' then 0
when day > 1 and month = 'Jan' then hours * rate
end