<?php

use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model modules\forms\models\Dt058 */
$excesscodes = [
'A' => 'More than thirteen turns of duty in any fourteen day period.',
'B' => 'More than twelve hours of work per turn of duty (Including Travel Time)',
'C' => 'More than seventy-two hours of work per week',
'D' => 'Less than twelve hours between booking off from a turn of duty and booking on for the next turn of duty',
'E' => 'For regular shift patterns which rotate or alternate on a weekly basis, with less than eight hours of rest during the weekly shift changeover',

];
$method = ['1' => 'Adverse weather conditions.', '2' => 'Equipment failure.', '3' => 'Emergency Site Requirements', '4'=>'Accident or Incident.'];
$reason = ['W' => 'Written (letter,Text, Email etc)', 'O' => 'Oral', 'R' => 'Retrospective'];

?>
<div class="dt058-view">
    <table class="Table notbb nolb norb">
        <tr>
            <td colspan="4" rowspan="2" style="padding:none">
                <?= $this->render('//common/_viewheader', ['title' => 'Excess Hours Form DT058']) ?>
            </td>
            <td class="DarkerBlue">Pad no</td>
            <td class="DarkerBlue">Job No</td>
        </tr>
        <tr>
            <td><?= $model->padno ?></td>
            <td><?= $model->jobno ?></td>
        </tr>

        <tr>
            <td colspan="6" align="left" class="nolb norb notbb">
                Part 1 of this form is to be completed by an Inline employee. <BR />
                (Permission from the Inline on call manager must be given at all times).<BR />
                Part 2 is to be completed by the clients site representative and NOT an Inline Employee.<BR />
            </td>
        </tr>
        <tr>
            <th colspan="3">PART 1</th>
            <th class="DarkerBlue">TimeSheet ID</th>
            <td colspan="2"><?= $model->tspadno ?></td>
        </tr>
        <tr>
            <th class="DarkerBlue">Site</th>
            <td colspan="2"><?= $model->site ?></td>
            <th class="DarkerBlue">Client Company Name</th>
            <td colspan="2"><?= $model->clientl ? $model->clientl->account_name : false ?></td>

        </tr>
        <tr>
            <th class="DarkerBlue">EMPLOYEE'S NAME</th>
            <th class="DarkerBlue">EXCESS CODE</th>
            <th class="DarkerBlue">PERSON REQUESTING<BR /> AUTHORISING EXCESS</th>
            <th class="DarkerBlue">METHOD OF REQUEST<BR /> AUTHORISATION</th>
            <th colspan="2" class="DarkerBlue">REASON CODE </th>
        </tr>
        <tr>
            <td><?= $model->emp1 ? $model->emp1->fullname : '&nbsp;' ?></td>

            <td><?= $model->excesscode1 ?></td>
            <td><?= $model->requestor1 ?></td>
            <td><?= $model->methodofrequest1 ?></td>
            <td colspan="2"><?= $model->reasoncode1 ?></td>
        </tr>
        <tr>
            <td><?= $model->emp2 ? $model->emp2->fullname : '&nbsp;' ?></td>
            <td><?= $model->excesscode2 ?></td>
            <td><?= $model->requestor2 ?></td>
            <td><?= $model->methodofrequest2 ?></td>
            <td colspan="2"><?= $model->reasoncode2 ?></td>
        </tr>
        <tr>
            <td><?= $model->emp3 ?  $model->emp3->fullname : '&nbsp;' ?></td>
            <td><?= $model->excesscode3 ?></td>
            <td><?= $model->requestor3 ?></td>
            <td><?= $model->methodofrequest3?></td>
            <td colspan="2"> <?= $model->reasoncode3 ?></td>
        </tr>
        <tr>
            <td colspan="1" rowspan="5" valign="middle">Excess Code</td>
            <td>A</td>
            <td colspan="4">More than thirteen turns of duty in any fourteen day period.</td>
        </tr>
        <tr>
            <td>B</td>
            <td colspan="4">More than twelve hours of work per turn of duty (Including Travel Time))</td>
        </tr>
        <tr>
            <td>C</td>
            <td colspan="4">More than seventy-two hours of work per week.</td>
        </tr>
        <tr>
            <td>D</td>
            <td colspan="4">Less than twelve hours between booking off from a turn of duty and booking on for the next
                turn of duty.
            </td>
        </tr>
        <tr>
            <td>E</td>
            <td colspan="4">For regular shift patterns which rotate or alternate on a weekly basis, with less than eight
                hours of
                rest during the weekly shift changeover.</td>
        </tr>
        <tr>
            <td colspan="6" class="nolb norb">&nbsp;</td>
        </tr>
        <tr>
            <td rowspan="4" valign="middle">Reason Code</td>
            <td>1</td>
            <td colspan="4">Adverse weather conditions.</td>
        </tr>
        <tr>
            <td>2</td>
            <td colspan="4">Equipment failure.</td>
        </tr>
        <tr>
            <td>3</td>
            <td colspan="4">Emergency Site Requirements</td>
        </tr>
        <tr>
            <td>4</td>
            <td colspan="4">Accident or Incident.</td>
        </tr>
        <tr>
            <td colspan="6" class="nolb norb">&nbsp;</td>
        </tr>
        <tr>
            <td rowspan="3" valign="middle">
                Method of Request/Authorisation Code
            </td>
            <td>W</td>
            <td colspan="4">Written (letter,Text, Email etc)</td>
        </tr>
        <tr>
            <td>O</td>
            <td colspan="4">Oral (telephone or spoken in person)</td>
        </tr>
        <tr>
            <td>R</td>
            <td colspan="4">Retrospective</td>
        </tr>
    </table>


    <p class="text-center">PART 2</p>

    <table class="Table norb nolb notbb">
        <tr>
            <th class="DarkerBlueC" colspan="8">EXCESS HOURS RISK ASSESMENT</th>
        </tr>
        <tr>
            <th class="DarkerBlue" colspan="2">L = Likelihood</th>
            <th class="DarkerBlue" colspan="3">S = Severity</th>
            <th class="DarkerBlue" colspan="3">RF = Risk Factor</th>
        </tr>
        <tr>
            <th class="DarkerBlue" colspan="4">RISK</th>
            <th class="DarkerBlue" colspan="4">CONTROLS</th>
        </tr>
        <tr>
            <th class="DarkerBlue" width="33%">RISK</th>
            <th class="DarkerBlue">L</th>
            <th class="DarkerBlue">S</th>
            <th class="DarkerBlue">RF</th>
            <th class="DarkerBlue">&nbsp;</th>
            <th class="DarkerBlue">L</th>
            <th class="DarkerBlue">S</th>
            <th class="DarkerBlue">R</th>
        </tr>


        <tr>
            <td>Substandard work due to fatigue</td>
            <td>2</td>
            <td>4</td>
            <td>8</td>
            <td>Increased levels of supervision, downscale work loads</td>
            <td>1</td>
            <td>4</td>
            <td>4</td>
        </tr>
        <tr>

            <td>Substandard work due to fatigue</td>
            <td>2</td>
            <td>4</td>
            <td>8</td>
            <td>Supervisory monitoring/mentoring</td>
            <td>1</td>
            <td>4</td>
            <td>4</td>
        </tr>
        <tr>

            <td>Accident whilst driving home at end of shift</td>
            <td>3</td>
            <td>5</td>
            <td>15</td>
            <td>Offer/Provide lodgings</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>

            <td>Inability to achieve 12hr break due to increased shift time including travel</td>
            <td>3</td>
            <td>5</td>
            <td>15</td>
            <td>Offer/Provide lodgings</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
        </tr>
        <tr>
            <td colspan="8" align="left">
                N.B Exceedance of working hours must not extend beyond a maximum of 4hrs. <br />
                I have assessed the reasons for the authorisation/request for the above excess hours and therefore
                confirm that
                they will <br />
                not exceed a maximum 4hrs and will not contravene Network Rail's Standard NR/L2/ERG/003 ISSUE 5. <br />
                Arrangements for relief will be made where required. <br />
            </td>
        </tr>
        <tr>
            <th class="DarkerBlue">Signature of nominated client's site representative</th>
            <td colspan="3"><img height="75px" src="<?= $model->clientrepsignrepsign ?>" alt="signature"></td>
            <th colspan="2" class="DarkerBlue">Date</th>
            <td colspan="2"><?= empty($model->date) == false ? date('d/m/Y', strtotime($model->date)) : false ?></td>
        </tr>
        <tr>
            <th class="DarkerBlue">Client Print</th>
            <td colspan="7"><?= $model->clientsiterepprint ?></td>
        </tr>
    </table>
    Rev2/Feb2017/GJS
</div>
<style>
.dt058-view th, .dt058-view td{
    padding: 5px 9px;
}
</style>