<?php

use yii\helpers\Html;

$headerimage = Html::Img(Yii::$app->params['settings']['logo'], ['alt' => Yii::$app->params['settings']['company_name'],'height' => "75px", 'width'=>"auto"]);
/* @var $this yii\web\View */
/* @var $model modules\forms\models\Dt022 */

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Dt022s', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="dt022-view">
    <div class="details">
        <table class="table table-bordered ">
            <thead>
                <tr>
                    <td colspan="2" class="nolb norb notbb">
                        <?= $headerimage; ?>
                    </td>
                    <th colspan="2" class="nolb norb notb">Inline Track Welding Limited Welding Site Surveillance Report
                        DT022</th>
                    <td colspan="3" class="nolb norb notbb" style="text-align: right">InLine Track<br />Ashmill
                        Business Park<br />Ashford Road<br />Lenham – Maidstone<br />Kent ME17 2GQ<br />Tel: 01622
                        854730
                    </td>
                </tr>
            </thead>
            <tbody>
                <tr class="DarkerBlue">
                    <th>Date</th>
                    <th>Location</th>
                    <th>Welders Name</th>
                    <th>Stamp No</th>
                    <th colspan="3">Welders Assistant</th>
                </tr>
                <tr>
                    <td><?php if ($model->date) { echo date('d/m/Y', strtotime($model->date));} ?></td>
                    <td><?= $model->location ?></td>
                    <td><?= $model->welder ?></td>
                    <td><?= $model->stampno ?></td>
                    <td colspan="3"><?= $model->weldersasst ?></td>
                </tr>
                <tr class="nolb norb">
                    <td colspan="7">&nbsp;</td>
                </tr>
                <tr>
                    <th class="DarkerBlue">Job No</th>
                    <td colspan="2"><?= $model->jobno ?></td>
                    <th class="DarkerBlue">Sentinal No</th>
                    <td colspan="3"><?= $model->sentinelno ?></td>
                </tr>
                <tr class="nolb norb">
                    <td colspan="7">&nbsp;</td>
                </tr>
                <tr class="DarkerBlue">
                    <th colspan="7">Work Description</th>
                </tr>
                <tr>
                    <td colspan="7"><?= $model->workdescription ?></td>
                </tr>
                <tr class="nolb norb">
                    <td colspan="7">&nbsp;</td>
                </tr>

                <tr class="DarkerBlue">
                    <th colspan="3">Competency Certificates Valid</th>
                    <th colspan="4">Correct PPE Worn</th>
                </tr>
                <tr class="DarkerBlue">
                    <th>Skill</th>
                    <th colspan="2">Expiry Date</th>
                    <th colspan="4">&nbsp;</th>
                </tr>
                <?php $x = 2; $y = 1; ?>
                <?php while ($y <= 10){ ?>
                <?php $fielda = 'cced'.$x; ?>
                <?php $fieldc = 'ppe'.$y; ?>
                    
                <tr>
                    <th class="DarkerBlue">
                        <?= $model->getAttributeLabel($fielda); ?>
                    </th>
                    <td>
                        <?= !empty($model->$fielda) && intval($model->$fielda) > 0 && $model->$fielda !== '1970-01-01' ? date('d/m/Y', strtotime($model->$fielda)) : '' ?><br/>
                    </td>
                    <td>
                    </td>
                    <th colspan="2" class="DarkerBlue">
                        <?= $model->getAttributeLabel($fieldc); ?>
                    <td colspan="2">
                        <?= !empty($model->$fieldc) ? yii::$app->formatter->asBoolean($model->$fieldc)  : '' ?>
                    </td>
                    </th>
                </tr>
                <?php $x++; $y++ ?>
                <?php } ?>

                <tr>
                    <td colspan="6">&nbsp;</td>
                </tr>
                <tr class="DarkerBlue">
                    <th colspan="3">Type of Welding</th>
                    <th colspan="3">Welding Equipmet Fit For Use and in Date</th>
                    <th colspan="" rowspan="2">Expiry Date</th>
                </tr>
                <tr>
                    <th class="DarkerBlue">Railtech</th>
                    <td colspan="2"><?= $model->twrailtech ?></td>
                    <td colspan="" class="DarkerBlue">&nbsp;</td>
                    <td colspan="" class="DarkerBlue">Yes/No</td>
                    <td colspan="" class="DarkerBlue">Item ID No</td>
                </tr>

                <tr>

                    <th class="DarkerBlue">Thermit</th>
                    <td colspan="2"><?= $model->twtermit ?></td>
                    <th class="DarkerBlue">Oxy/Fuel Gas</th>
                    <td colspan="">
                        <?= !empty($model->ffu1) ? Yii::$app->formatter->asBoolean($model->ffu1) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid1 ?></td>
                    <td colspan=""><?= !empty($model->ffused1) && intval($model->ffused1) > 0 && $model->ffused1 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused1)) : '' ?></td>
                </tr>
                <tr>
                    <th class="DarkerBlue">Standard Gap</th>
                    <td colspan="2"><?= $model->twstandardgap ?></td>
                    <th class="DarkerBlue">1mtr Straight Edge</th>
                    <td colspan="">
                        <?= !empty($model->ffu2) ? Yii::$app->formatter->asBoolean($model->ffu2) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid2 ?></td>
                    <td colspan=""><?= !empty($model->ffused2) && intval($model->ffused2) > 0 && $model->ffused2 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused2)) : '' ?></td>
                </tr>
                <tr>
                    <th class="DarkerBlue">Wide Gap </th>
                    <td colspan="2"><?= $model->twwidegap ?></td>
                    <th class="DarkerBlue">Rail Wear Gauge</th>
                    <td colspan="">
                        <?= !empty($model->ffu3) ? Yii::$app->formatter->asBoolean($model->ffu3) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid3 ?></td>
                    <td colspan=""><?= !empty($model->ffused3) && intval($model->ffused3) > 0 && $model->ffused3 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused3)) : '' ?></td>
                    
                </tr>
                <tr>
                    <th class="DarkerBlue">MMA</th>
                    <td colspan="2"><?= $model->twmma ?></td>
                    <th class="DarkerBlue">Engineers Square</th>
                    <td colspan=""><?= !empty($model->ffu4) ? Yii::$app->formatter->asBoolean($model->ffu4) : '' ?>
                </td>
                <td colspan=""><?= $model->ffuid4 ?></td>
                    <td colspan=""><?= !empty($model->ffused4) && intval($model->ffused4) > 0 && $model->ffused4 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused4)) : '' ?></td>
                    
                </tr>
                <tr>
                    <th class="DarkerBlue"></th>
                    <td colspan="2"></td>
                    <th class="DarkerBlue">Rail Grinder</th>
                    <td colspan="">
                        <?= !empty($model->ffu5) ? Yii::$app->formatter->asBoolean($model->ffu5) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid5 ?></td>
                    <td colspan=""><?= !empty($model->ffused5) && intval($model->ffused5) > 0 && $model->ffused5 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused5)) : '' ?></td>
                    
                </tr>
                <tr>
                    <th class="DarkerBlue"></th>
                    <td colspan="2"></td>
                    <th class="DarkerBlue">Angle Grinder</th>
                    <td colspan="">
                        <?= !empty($model->ffu6) ? Yii::$app->formatter->asBoolean($model->ffu6) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid6 ?></td>
                    <td colspan=""><?= !empty($model->ffused6) && intval($model->ffused6) > 0 && $model->ffused6 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused6)) : '' ?></td>
                    
                </tr>
                <tr>
                    <th class="DarkerBlue"></th>
                    <td colspan="2"></td>
                    <th class="DarkerBlue">Needle Gun</th>
                    <td colspan="">
                        <?= !empty($model->ffu7) ? Yii::$app->formatter->asBoolean($model->ffu7) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid7 ?></td>
                    <td colspan=""><?= !empty($model->ffused7) && intval($model->ffused7) > 0 && $model->ffused7 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused7)) : '' ?></td>
                    
                </tr>
                <tr>
                    <th class="DarkerBlue" colspan="3">Track Condition</th>
                    <th class="DarkerBlue">Electric Generator</th>
                    <td colspan="">
                        <?= !empty($model->ffu8) ? Yii::$app->formatter->asBoolean($model->ffu8) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid8 ?></td>
                    <td colspan=""><?= !empty($model->ffused8) && intval($model->ffused8) > 0 && $model->ffused8 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused8)) : '' ?></td>
                    
                </tr>
                <tr>
                    <th class="DarkerBlue">Track Type</th>
                    <td colspan="2"><?= $model->tc1 ?></td>
                    <th class="DarkerBlue">Weld Trimmer</th>
                    <td colspan="">
                        <?= !empty($model->ffu9) ? Yii::$app->formatter->asBoolean($model->ffu9) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid9 ?></td>
                    <td colspan=""><?= !empty($model->ffused9) && intval($model->ffused9) > 0 && $model->ffused9 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused9)) : '' ?></td>
                    
                </tr>
                <tr>
                    <th class="DarkerBlue">Current Type</th>
                    <td colspan="2"><?= $model->tc2 ?></td>
                    <th class="DarkerBlue">Stressing Equipment </th>
                    <td colspan="">
                        <?= !empty($model->ffu10) ? Yii::$app->formatter->asBoolean($model->ffu10) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid10 ?></td>
                    <td colspan=""><?= !empty($model->ffused10) && intval($model->ffused10) > 0 && $model->ffused10 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused10)) : '' ?></td>
                    
                </tr>
                <tr>
                    <th class="DarkerBlue">Work in Tunnel</th>
                    <td colspan="2"><?= $model->tc3 ?></td>
                    <th class="DarkerBlue">Track Trolley</th>
                    <td colspan="">
                        <?= !empty($model->ffu11) ? Yii::$app->formatter->asBoolean($model->ffu11) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid11 ?></td>
                    <td colspan=""><?= !empty($model->ffused11) && intval($model->ffused11) > 0 && $model->ffused11 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused11)) : '' ?></td>
                    
                    
                </tr>
                <tr>
                    <th class="DarkerBlue">Work in Platform</th>
                    <td colspan="2"><?= $model->tc4 ?></td>
                    <th class="DarkerBlue">Welding Equipment</th>
                    <td colspan="">
                        <?= !empty($model->ffu12) ? Yii::$app->formatter->asBoolean($model->ffu12) : '' ?>
                    </td>
                    <td colspan=""><?= $model->ffuid12 ?></td>
                    <td colspan=""><?= !empty($model->ffused12) && intval($model->ffused12) > 0 && $model->ffused12 !== '1970-01-01' ? date('d/m/Y', strtotime($model->ffused12)) : '' ?></td>
                    
                </tr>
                <tr>
                    <th class="DarkerBlue">Sleeper Type</th>
                    <td colspan="2"><?= $model->tc5 ?></td>
                    <th colspan="4">&nbsp;</th>
                </tr>
                <tr>
                    <th class="DarkerBlue">Fastening Type</th>
                    <td colspan="2"><?= $model->tc6 ?></td>
                    <th class="DarkerBlue" colspan="2">Rail End Preperation</th>
                    <td colspan=""><?= $model->rep1 ?></td>
                </tr>
                <tr>
                    <th class="DarkerBlue" colspan="3">Rail Details</th>
                    <th class="DarkerBlue" colspan="2">If Gas Cut What Type of Fuel?</th>
                    <td colspan=""><?= $model->gasfuel ?></td>
                </tr>
                <tr>
                    <th class="DarkerBlue">&nbsp;</th>
                    <td colspan="">Left Rail</td>
                    <td colspan="">Right Rail</td>
                    <th class="DarkerBlue" colspan="2">Rail End Preperation</th>
                    <td colspan=""><?= $model->rep1 ?></td>
                </tr>

                <tr>
                    <th class="DarkerBlue">Rail Section</th>
                    <td colspan=""><?= $model->rs1 ?></td>
                    <td colspan=""><?= $model->rs2 ?></td>
                    <td colspan="3" rowspan="3" valign="top" align="left"><b>Comments:</b><?= $model->comments ?></td>

                </tr>

                <tr>
                    <th class="DarkerBlue">Rail Type</th>
                    <td colspan=""><?= $model->rt1 ?></td>
                    <td colspan=""><?= $model->rt2 ?></td>
                </tr>
                <tr>
                    <th class="DarkerBlue">Current Type</th>
                    <td colspan=""><?= $model->tw1 ?></td>
                    <td colspan=""><?= $model->rw2 ?></td>

                </tr>

                <tr>
                    <td colspan="6">&nbsp;</td>
                </tr>
                <tr>
                    <th class="DarkerBlue">Name Of Client</th>
                    <td colspan="2"><?= $model->clientl ? $model->clientl->account_name : null ?></td>
                    <th class="DarkerBlue">Area</th>
                    <td colspan="2"><?= $model->area ?></td>
                </tr>
                <tr>
                    <td colspan="6">&nbsp;</td>
                </tr>
                <tr>
                    <th class="DarkerBlue">Name Of Site Audit Person</th>
                    <td colspan="2"><?= $model->sitesuditor ?></td>
                    <th class="DarkerBlue">Signature</th>
                    <td colspan="2"><img height="75px" src="<?= $model->auditorsign ?>"></td>
                </tr>
                <tr>
                    <th class="DarkerBlue">Signature of Persons being Audited

                    </th>
                    <td colspan="2"><img height="75px" src="<?= $model->auditoredsign ?>"></td>
                </tr>

            </tbody>

        </table>
    </div>
    <div class="pagebreak"> </div>
    <div class="hseqdiv">
        <table class="table table-bordered">
            <thead>
                <tr>
                    <td colspan="" class="border borderless" style="text-align: left">
                        <?= $headerimage; ?>
                    </td>
                    <th colspan="" class="border borderless">
                        Welding Site Surveillance Report DT022
                    </th>
                    <td colspan="" class="border borderless" style="text-align: right">
                        InLine Track Welding Ltd<br />
                        Ashmill Business Park<br />
                        Ashford Road<br />
                        Lenham – Maidstone <br />
                        Kent ME17 2GQ<br />
                        Tel: 01622 854730
                    </td>
                </tr>
                <tr>
                    <th class="DarkerBlue" width="50%">Item / Subject</th>
                    <th class="DarkerBlue" width="10%">Yes/No</th>
                    <th class="DarkerBlue">Comments</th>
                </tr>
            </thead>
            <tbody>
                <?php $x = 1 ?>
                <?php while( $x <= 79)  { ?>
                <?php $field = 'response'.$x; ?>
                <?php $fieldcomment = 'repsonsecomment'.$x; ?>
                <?= $field == 'response1' ? '<tr><td colspan="3" class="DarkerBlue">ON SITE PROCEDURES</td></tr>' : false ?>
                <?= $field == 'response10' ? '<tr><td colspan="3" class="DarkerBlue">WORK ON OR NEAR THE LINE</td></tr>' : false ?>
                <?= $field == 'response20' ? '<tr><td colspan="3" class="DarkerBlue">SIGNS</td></tr>' : false ?>
                <?= $field == 'response25' ? '<tr><td colspan="3" class="DarkerBlue">ACCESS AND EGRESS</td></tr>' : false ?>
                <?= $field == 'response30' ? '<tr><td colspan="3" class="DarkerBlue">WELFARE</td></tr>' : false ?>
                <?= $field == 'response35' ? '<tr><td colspan="3" class="DarkerBlue">HAZARDOUS MATERIALS</td></tr>' : false ?>
                <?= $field == 'response40' ? '<tr><td colspan="3" class="DarkerBlue">WASTE</td></tr>' : false ?>
                <?= $field == 'response45' ? '<tr><td colspan="3" class="DarkerBlue">SECURITY</td></tr>' : false ?>
                <?= $field == 'response50' ? '<tr><td colspan="3" class="DarkerBlue">FIRE PRECAUTIONS</td></tr>' : false ?>
                <?= $field == 'response55' ? '<tr><td colspan="3" class="DarkerBlue">HOT WORK</td></tr>' : false ?>
                <?= $field == 'response60' ? '<tr><td colspan="3" class="DarkerBlue">NOISE</td></tr>' : false ?>
                <?= $field == 'response65' ? '<tr><td colspan="3" class="DarkerBlue">ELECTRICITY AND OTHER SERVICES</td></tr>' : false ?>
                <?= $field == 'response70' ? '<tr><td colspan="3" class="DarkerBlue" >HEALTH & WELLBEING</td></tr>' : false ?>
                <?php if($model->getAttributelabel($field) !== $field) { ?>
                <tr>
                    <td style="text-align: left">
                        <?= $model->getAttributelabel($field);  ?>
                    </td>
                    <td>
                        <?= is_null($model->$field) ? '&nbsp;' : Yii::$app->formatter->asBoolean($model->$field) ?>
                    </td>
                    <td>
                        <?= $model->$fieldcomment ?>
                    </td>
                </tr>

                <?php } ?>
                <?php $x++ ?>
                <?php } ?>

            </tbody>
        </table>
    </div>
    <div class="pagebreak"></div>
    <div class="wsodiv">

        <table class="table table-bordered">
            <thead>
                <tr>
                    <th class="DarkerBlue" width="45%">Item / Subject</th>
                    <th class="DarkerBlue" width="10%">Yes/No</th>
                    <th class="DarkerBlue">Comments</th>
                </tr>
            </thead>
            <tbody>
                <?php $x = 80 ?>
                <?php while( $x < 149)  { ?>
                <?php $field = 'response'.$x; ?>
                <?php $fieldcomment = 'repsonsecomment'.$x; ?>

                <?= $field == 'response80' ? '<tr><td colspan="3" class="DarkerBlue">ON SITE PROCEDURES</td></tr>' : false ?>
                <?= $field == 'response85' ? '<tr><td colspan="3" class="DarkerBlue">WORK ON OR NEAR THE LINE</td></tr>' : false ?>
                <?= $field == 'response90' ? '<tr><td colspan="3" class="DarkerBlue">SIGNS</td></tr>' : false ?>
                <?= $field == 'response95' ? '<tr><td colspan="3" class="DarkerBlue">ACCESS AND EGRESS</td></tr>' : false ?>
                <?= $field == 'response100' ? '<tr><td colspan="3" class="DarkerBlue">WELFARE</td></tr>' : false ?>
                <?= $field == 'response105' ? '<tr><td colspan="3" class="DarkerBlue">HAZARDOUS MATERIALS</td></tr>' : false ?>
                <?= $field == 'response110' ? '<tr><td colspan="3" class="DarkerBlue">WASTE</td></tr>' : false ?>
                <?= $field == 'response115' ? '<tr><td colspan="3" class="DarkerBlue">SECURITY</td></tr>' : false ?>
                <?= $field == 'response120' ? '<tr><td colspan="3" class="DarkerBlue">FIRE PRECAUTIONS</td></tr>' : false ?>
                <?= $field == 'response130' ? '<tr><td colspan="3" class="DarkerBlue">HOT WORK</td></tr>' : false ?>
                <?= $field == 'response135' ? '<tr><td colspan="3" class="DarkerBlue">NOISE</td></tr>' : false ?>
                <?= $field == 'response141' ? '<tr><td colspan="3" class="DarkerBlue">ELECTRICITY AND OTHER SERVICES</td></tr>' : false ?>
                <?= $field == 'response145' ? '<tr><td colspan="3" class="DarkerBlue">HEALTH & WELLBEING</td></tr>' : false ?>

                <?php if($model->getAttributelabel($field) !== $field) { ?>
                <tr>
                    <td style="text-align: left">
                        <?= $model->getAttributelabel($field);  ?>
                    </td>
                    <td>
                        <?= is_null($model->$field) ? '&nbsp;' : Yii::$app->formatter->asBoolean($model->$field) ?>
                    </td>
                    <td>
                        <?= $model->$fieldcomment ?>
                    </td>
                </tr>

                <?php } ?>
                <?php $x++ ?>
                <?php } ?>

            </tbody>
        </table>
    </div>
    <div class="pagebreak"></div>
    <div class="commentsdiv">

        <table class="table table-bordered">
            <thead>
                <tr>
                    <th class="DarkerBlue" width="45%">Item / Subject</th>
                    <th class="DarkerBlue" width="10%">Yes/No</th>
                    <th class="DarkerBlue">Comments</th>
                </tr>
            </thead>
            <tbody>
                <?php $x = 149 ?>
                <?php while( $x <= 160)  { ?>
                <?php $field = 'response'.$x; ?>
                <?php $fieldcomment = 'repsonsecomment'.$x; ?>

                <?php if($model->getAttributelabel($field) !== $field) { ?>
                <tr>
                    <td style="text-align: left">
                        <?= $model->getAttributelabel($field);  ?>
                    </td>
                    <td>
                        <?=  is_null($model->$field) ? '&nbsp;' : Yii::$app->formatter->asBoolean($model->$field) ?>
                    </td>
                    <td>
                        <?= $model->$fieldcomment ?>
                    </td>
                </tr>

                <?php } ?>
                <?php $x++ ?>
                <?php } ?>
            <tr>
                <th colspan="3" class="DarkerBlue">Comments</th>
            </tr>
            <tr>
                <td colspan="3" style="height:100px;"><?= $model->addcomments ?></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<style>
.pagebreak {
    page-break-after: always;
}

td, th {
    padding: 2.5px 10px;
}
</style>