Logging Negative time: Time Bank / Holiday

Added by snow windwaves almost 7 years ago

Is there any way (plugin?) to log negative hours, or have an issue which subtracts its time from totals?

My use case is a time bank for salaried employees: If they work overtime but do not wish to be paid for it immediately, they can put the time in the time bank, up to a maximum of say 40 hours. The time can then be taken out of the time bank in lieu of holiday time when the employee takes time off.

The time in the time bank issue would have to be subtracted from any totals in reports. If I could log negative time I feel this might be the simplest solution.

Thanks for any thoughts or ideas on how to achieve this.

Replies (3)

RE: Logging Negative time: Time Bank / Holiday - Added by Felix Schäfer almost 7 years ago

Have you tried logging negative time?

RE: Logging Negative time: Time Bank / Holiday - Added by snow windwaves almost 7 years ago

yes it says invalid entry.

This would pretty much solve the problem for the short term.

For the long term, it would need further improvement as time put in the time bank (instead of 'invoiced' to the employer) needs to be tracked, limited, and withdrawn.

RE: Logging Negative time: Time Bank / Holiday - Added by Felix Schäfer almost 7 years ago

snow windwaves wrote:

yes it says invalid entry.

This would pretty much solve the problem for the short term.

I think you could make it take negative times by mucking around with the TimeEntry validation, see source:/trunk/app/models/time_entry.rb#L55, from a (very) quick check that should be enough and not break anything. YMMV, the change may kill your dog and so on, so take the necessary precautions :-)

For the long term, it would need further improvement as time put in the time bank (instead of 'invoiced' to the employer) needs to be tracked, limited, and withdrawn.

Well, that's a pretty specific use-case, so I don't think it would get into core. It would be possible to do this in plugin though, but that's up to you to either do it or find someone to do it for you.

(1-3/3)