<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model modules\forms\models\Dt198 */

$this->title = $model->id;
?>
<div class="dt198-view">

    <style>
    .toppad {
        padding-top: 3px;
        padding-bottom: 3px;
    }
    </style>
    <table class="Table notbb nolb norb">
        <tr>

            <td colspan="5">
                <?= $this->render('//common/_viewheader', ['title' => $model->formname]) ?></td>

            <td class="text-left nolb pl-3">
                Pad No: <br />
                <?= $model->padno ?>
            </td>
        </tr>

        <tr>
            <th class="DarkerBlue">Gauge Corner Restoration Delivered by :</th>
            <th class="DarkerBlue">Inline Track Welding</th>
            <th class="DarkerBlueC" colspan="4">Gauge Corner Restoration - Specified Welding Parameters &
                Process Route</th>
        </tr>
        <tr>
            <th class="DarkerBlue">Client</th>
            <td><?= $model->clientl ? $model->clientl->account_name : null ?></td>
            <th class="DarkerBlue toppad">Welding Current</th>
            <td colspan="3" class="text-center">380A +/- 30A</td>
        </tr>
        <tr>
            <th class="DarkerBlue">Job No</th>
            <td><?= $model->jobno ?></td>
            <th class="DarkerBlue toppad">Welding Voltage:</th>
            <td colspan="3" class="text-center">32V +/- 2V</td>
        </tr>

        <tr>
            <th class="DarkerBlue">Location</th>
            <td><?= $model->location ?></td>
            <th class="DarkerBlue toppad">Wire Feed Speed:</th>
            <td colspan="3" class="text-center">2.3m/min</td>
        </tr>
        <tr>
            <th width="20%" class="DarkerBlue">Date</th>
            <td width="15%"><?= $model->insdate ?></td>
            <th width="16.7%" class="DarkerBlue toppad" rowspan="5">Welding Speed; cm/min</th>
            <th width="16.7%" class="DarkerBlueC">Root Bead</th>
            <th width="16.7%" class="DarkerBlueC">Subsequent Beads</th>
            <th width="16.7%" class="DarkerBlueC">Sacrificial Beads</th>

            </td>
        </tr>
        <tr>
            <th class="DarkerBlue">Curve radii, m</th>
            <td><?= $model->curveradii ?></td>
            <td class="text-center">48 +/- 2</td>
            <td class="text-center">60 +/- 2</td>
            <td class="text-center">72 +/- 2</td>
        </tr>
        <tr>
            <th class="DarkerBlue">Rail grade</th>
            <td><?= $model->railgrade ?></td>
            <td colspan="3" class="toppad">
                Single, non-consecutive weld beads may be laid down at up to 0.72m/min if a smaller weld
                deposit is required.
            </td>

        </tr>
        <tr>
            <th class="DarkerBlue">Shift Start Time</th>
            <td><?=  $model->shiftstart; ?></td>
            <td colspan="3" class="toppad" rowspan="2">
                Sacrificial bead MUST NOT create a new HAZ on the rail running surface: bead must be
                displaced towards the gauge corner by ~2mm compared to the previous bead
            </td>

        </tr>
        <tr>
            <th class="DarkerBlue">Shift End Time</th>
            <td><?= $model->shiftend; ?></td>
        </tr>
        <tr>
            <th class="DarkerBlue">Planned meterage</th>
            <td><?= $model->plannedmeterage ?></td>
            <th class="DarkerBlue toppad">Low Preheat Temperature (Soaked NOT Peak Value):</th>
            <td colspan="3" class="text-center">60-80 °C</td>
        </tr>
        <tr>
            <th class="DarkerBlue">Actual Meterage</th>
            <td><?= $model->actualmeterage ?></td>
            <th class="DarkerBlue toppad">Minimum Inter-pass Temperature at start & finish of pass:</th>
            <td colspan="3" class="text-center">60°C</td>
        </tr>
        <tr>
            <th class="DarkerBlue">Senior Welder</th>
            <td><?= $model->seniorwelder ?></td>
            <th class="DarkerBlue toppad">Maximum Inter-pass Temperature at start of pass:</th>
            <td colspan="3" class="text-center">130˚C</td>
        </tr>
        <tr>
            <th class="DarkerBlue">Assistant 1</th>
            <td><?= $model->assistant1 ?></td>
            <th class="DarkerBlue toppad">Welding Wire (Name & Wire Diameter):</th>
            <td colspan="3" class="text-center">LWS 307</td>
        </tr>
        <tr>
            <th class="DarkerBlue">Assistant 2</th>
            <td><?= $model->assistant2 ?></td>
            <th class="DarkerBlue toppad">Welding Flux:</th>
            <td colspan="3" class="text-center">&nbsp;</td>
        </tr>
        <tr>
            <th class="DarkerBlue">Assistant 3</th>
            <td><?= $model->assistant3 ?></td>
        </tr>
    </table>
    <table class="Table norb nolb notbb">

        <tr class="DarkerBlue">
            <th class="Title" colspan="20">Process Control Data</th>
        </tr>
        <tr class="DarkerBlue">
            <th colspan="2">Welding Beads</th>
            <th rowspan="2" style="vertical-align: top;">Distance</th>
            <th colspan="3">Volts, V</th>
            <th colspan="3">Amps, A</th>
            <th colspan="3">Welding Speed; mm/sec</th>
            <th colspan="3">Heat Input, Kj/mm</th>
            <th colspan="3">Interpass Temperature; &deg;C</th>
            <th rowspan="2" style="vertical-align: top;">"Strike on" Temperature; &deg;C</th>
            <th rowspan="2" style="vertical-align: top;">"Strike off" Temperature; &deg;C</th>
        </tr>
        <tr class="DarkerBlue ">
            <td class="toppad">Type</td>
            <td>No</td>
            <td>Avg</td>
            <td>Max</td>
            <td>Min</td>
            <td>Avg</td>
            <td>Max</td>
            <td>Min</td>
            <td>Avg</td>
            <td>Max</td>
            <td>Min</td>
            <td>Avg</td>
            <td>Max</td>
            <td>Min</td>
            <td>Avg</td>
            <td>Max</td>
            <td>Min</td>

        </tr>

        <?php $x = 1; ?>
        <?php while($x <= count($model->rowtype)) { ?>
                <?php if(isset($model->rowstatus[$x]) == true && $model->rowstatus[$x] !== 'Deleted'){ ?>
        <tr >
            <td class="toppad"><?= $model->rowtype[$x] ?> </td>

            <td><?= $model->rowno[$x] ?></td>
            <td><?= isset($model->rowdistance[$x]) ? number_format((float)$model->rowdistance[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowvoltsavg[$x]) ? number_format((float)$model->rowvoltsavg[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowvoltsmax[$x]) ? number_format((float)$model->rowvoltsmax[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowvoltsmin[$x]) ? number_format((float)$model->rowvoltsmin[$x], 3, '.', '') : null;  ?>
            </td>
            <td><?= isset($model->rowampsavg[$x]) ? number_format((float)$model->rowampsavg[$x], 3, '.', '') : null;  ?>
            </td>
            <td><?= isset($model->rowampsmax[$x]) ? number_format((float)$model->rowampsmax[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowampsmin[$x]) ? number_format((float)$model->rowampsmin[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowspeedavg[$x]) ? number_format((float)$model->rowspeedavg[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowspeedmax[$x]) ? number_format((float)$model->rowspeedmax[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowspeedmin[$x]) ? number_format((float)$model->rowspeedmin[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowinputkjavg[$x]) ? number_format((float)$model->rowinputkjavg[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowinputkjmax[$x]) ? number_format((float)$model->rowinputkjmax[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowinputkjmin[$x]) ? number_format((float)$model->rowinputkjmin[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowinterpassavg[$x]) ? number_format((float)$model->rowinterpassavg[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowinterpassmax[$x]) ? number_format((float)$model->rowinterpassmax[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowinterpassmin[$x]) ? number_format((float)$model->rowinterpassmin[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowstrikeonavg[$x]) ? number_format((float)$model->rowstrikeonavg[$x], 3, '.', '') : null; ?>
            </td>
            <td><?= isset($model->rowstrikeoffavg[$x]) ? number_format((float)$model->rowstrikeoffavg[$x], 3, '.', '') : null; ?>
            </td>
            <?php /*
							<td><?= number_format((float)$model->rowstrikeonmax, 3, '.', ''); ?></td>
            <td><?= number_format((float)$model->rowstrikeonmin, 3, '.', ''); ?></td>
            <td><?= number_format((float)$model->rowstrikeoffmax, 3, '.', ''); ?></td>
            <td><?= number_format((float)$model->rowstrikeoffmin, 3, '.', ''); ?></td>
            */ ?>
        </tr>
        <?php } ?>
        <?php $x ++; ?>
        <?php } ?>
    </table>
    <table class="Table nolb norb notbb">
        <tr class="DarkerBlue">
            <td rowspan="2" class="toppad">Welding Heat Input =</td>
            <td style="padding-left: 25px;" class="toppad">(60VI)/1000v =  Kj/mm </td>
            <td style="padding-left: 25px;" class="toppad"> Amp * Volt * 60 * factor / (1000*welding Speed in
                mm/min)</td>
        </tr>
        <tr class="DarkerBlue">
            <td style="padding-left: 25px;" colspan="2">Factor for submerged arc welding = 1</td>
        </tr>
    </table>
</div>