开发者

This should be easy, but I can't figure it out

I'm usually a lot better than this, I promise.

Back story here: At my job, if you are late/absent, you get attendance points. One way to work attendance points off is to work weekend hours. For every 12 weekend hours you work, you get 2 attendance po开发者_如何学Goints removed.

For example, if an employee has 26 weekend hours built up, I need to subtract 24 hours, leaving a 2 hour remainder, and remove 4 points.

Right now I have all of this in Excel, but I could probably just as easily create a quick php/mysql, but that's be a pain. What's my best approach here? I was think mod functions, but... yeah. My head hurts. Someone point me in the right direction?


Perhaps:

attendance_points -= (hours / 12) * 2 This assumes integer arithmetic.

then

hours = hours % 12

Does that help?

Are you allowed to use 6 hours in a chunk?


Basic update for each employee would look something like:

attendance_points -= weekend_hours / 12 * 2
weekend_hours %= 12

where / is integer division.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜