Jump to content

Staff 4 on 4 off Rota


TEENFRONT

Recommended Posts

Hi Everyone!

 

Really stuck with this one.. Im midway through creating a "rota" for staff at work.. and it shows whos working that day, and who isnt.

 

For a "base" rota (unedited with no holidays/sickness etc) i need to populate the calendar i made with staff names on a 4 on 4 off basis. I was hoping php could loop round and pop the names in for me.

 

Here's whats i have so far:

 

$shifts1 = array("Day", "Night");
$shifts2 = array("Night", "Day");
$staffPair1 = array("Adam", "Ashley");
$staffPair2 = array("Dave", "Terry");

$thisMonth = date("F");
$daysThisMonth = date("t");

for ($i = 1; $i <= $daysThisMonth; $i++) {
$calGen .= "<div id=\"calendarDays\"><div>$i</div><div>$STAFF_ON_SHIFT</div></div>";
}

 

 

Pair1 work together, one is on DAYS, one is on NIGHTS for 4 days/nights then both are off for 4 days, Pair2 then steps in and works the same for 4 days/nights, then off for 4 days etc etc.

 

I need to echo $STAFF_ON_SHIFT which is who is on what shift on what date.

 

So for example a month would be like this:

 

Adam (D)

Ashley (N)

Terry (OFF)

Dave (OFF)

 

above x4 days - then

 

Adam (OFF)

Ashley (OFF)

Terry (D)

Dave (N)

 

above x4 days - then

 

Adam (N)

Ashley (D)

Terry (OFF)

Dave (OFF)

 

above x4 days - then

 

Adam (OFF)

Ashley (OFF)

Terry (N)

Dave (D)

 

First pair switches shifts round every other 4 so Adam is on nights and Ashley on Days then off for 4 days, then Adam is on days and Ashley on nights, same for pair2 (shift switch around)..

 

I know thats a lot to ask, but breaking it down looks "simple" lol.

 

Assign a shift to pair1 for 4 days

Pair 2 off for 4 days

 

Assign a shift to pair2 for 4 days

Pair 1 off for 4 days

 

Repeat above but swap shifts round for each pair (nights, days)

 

Any help? :P

 

MANY MANY THANKS!!!!!!

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.