222 lines
6.7 KiB
PHP
222 lines
6.7 KiB
PHP
<?php
|
|
use Barryvdh\DomPDF\Facade\Pdf;
|
|
$documentInfo = document_template("clearance-report");
|
|
$j = j($documentInfo->json);
|
|
|
|
|
|
$prefix = "CLR";
|
|
$counter = get_counter("CLEARANCE");
|
|
$clearance_no = "$prefix-" . $counter;
|
|
|
|
$folderName = $counter;
|
|
|
|
$fileName = $clearance_no;
|
|
|
|
|
|
$data = j(post("data"));
|
|
|
|
|
|
|
|
|
|
|
|
$weldLogs = apply_welded_filter(
|
|
db("weld_logs")->whereIn("id", array_column($data, 'id'))
|
|
)->get();
|
|
|
|
|
|
$totalSpoolJoint = [];
|
|
$totalJoint = [];
|
|
|
|
foreach($weldLogs AS $weldLog) {
|
|
|
|
if(!isset($totalSpoolJoint[$weldLog->iso_number][$weldLog->spool_number]))
|
|
$totalSpoolJoint[$weldLog->iso_number][$weldLog->spool_number] = 0;
|
|
|
|
if(!isset($totalJoint[$weldLog->iso_number]))
|
|
$totalJoint[$weldLog->iso_number]= 0;
|
|
|
|
if($weldLog->type_of_joint == "S") {
|
|
$totalSpoolJoint[$weldLog->iso_number][$weldLog->spool_number]++;
|
|
$totalJoint[$weldLog->iso_number]++;
|
|
}
|
|
|
|
apply_welded_filter(
|
|
db("weld_logs")
|
|
->where("iso_number", $weldLog->iso_number)
|
|
->where("spool_number", $weldLog->spool_number)
|
|
)->update([
|
|
"clearance_no" => $clearance_no,
|
|
"clearance_date" => simdi(),
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
$k = 1;
|
|
$rows = "";
|
|
$isometrics = [];
|
|
$ste_subcontractor = "";
|
|
$contractor = "";
|
|
$general_contractor = "";
|
|
foreach($weldLogs AS $weldLog) {
|
|
|
|
if(!in_array($weldLog->iso_number, $isometrics)) {
|
|
$isometrics[] = $weldLog->iso_number;
|
|
}
|
|
|
|
$ste_subcontractor = $weldLog->ste_subcontractor;
|
|
$general_contractor =$weldLog->general_contractor;
|
|
$contractor =$weldLog->contractor;
|
|
|
|
$weldLog->welding_date = df($weldLog->welding_date);
|
|
|
|
$row = "
|
|
<tr class='bordered' style='height: 15.0pt;'>
|
|
<td align='right'>$k</td>
|
|
<td>{$weldLog->iso_number}</td>
|
|
<td>{$weldLog->spool_number}</td>
|
|
<td>{$weldLog->no_of_the_joint_as_per_as_built_survey}</td>
|
|
<td>{$weldLog->wps_no}</td>
|
|
<td>{$weldLog->welding_date}</td>
|
|
<td>{$weldLog->welder_1}</td>
|
|
<td>{$weldLog->welder_2}</td>
|
|
<td>{$weldLog->outside_diameter_1}</td>
|
|
<td>{$weldLog->wall_thickness_1}</td>
|
|
<td>{$weldLog->ndt_percent}</td>
|
|
<td>{$totalJoint[$weldLog->iso_number]}</td>
|
|
<td>{$totalSpoolJoint[$weldLog->iso_number][$weldLog->spool_number]}</td>
|
|
<td>{$weldLog->vt_report}</td>
|
|
<td>{$weldLog->rt_report} / {$weldLog->ut_report}</td>
|
|
<td>{$weldLog->rt_result} / {$weldLog->ut_result}</td>
|
|
<td>{$weldLog->mt_report} / {$weldLog->pt_report}</td>
|
|
<td>{$weldLog->no_of_pwht_report}</td>
|
|
<td>{$weldLog->pwht_date}</td>
|
|
<td>{$weldLog->ht_report}</td>
|
|
<td>{$weldLog->pmi_report}</td>
|
|
<td>{$weldLog->ferrite_result}</td>
|
|
<td>{$weldLog->remarks}</td>
|
|
</tr>
|
|
";
|
|
$rows .= $row;
|
|
$k++;
|
|
}
|
|
|
|
|
|
|
|
|
|
$table = "
|
|
<style>
|
|
table * {
|
|
font-size:10px !important;
|
|
}
|
|
</style>
|
|
<table style='font-size:6px !important;width: 100%;border:solid 1px #000;' border='0' cellspacing='0' cellpadding='0'>
|
|
<tbody>
|
|
<tr class='bordered'>
|
|
<td>No</td>
|
|
<td>Drawing</td>
|
|
<td>Spool No</td>
|
|
<td>Joint no</td>
|
|
<td>WPS no</td>
|
|
<td>Weld Date</td>
|
|
<td>Welder 1</td>
|
|
<td>Welder 2</td>
|
|
<td>OD1(mm)</td>
|
|
<td>Thck1(mm)</td>
|
|
<td>%NDT</td>
|
|
<td>Workshop joint quantity
|
|
(Line-based)</td>
|
|
<td>Workshop joint quantity
|
|
(Spool-based)</td>
|
|
<td>VT Report no</td>
|
|
<td>RT/ UT ReportNo</td>
|
|
<td>RT/ UT Status</td>
|
|
<td>MT/PT Report NO</td>
|
|
<td>PWHT Chart No</td>
|
|
<td>PWHT Date</td>
|
|
<td>HT Report No</td>
|
|
<td>Pmi report</td>
|
|
<td>Ferrite Report</td>
|
|
<td>Remarks</td>
|
|
</tr>
|
|
$rows
|
|
</tbody>
|
|
</table>
|
|
";
|
|
|
|
|
|
$document = pdf_html_content($documentInfo->html);
|
|
$document = str_replace("{table_content}", $table, $document);
|
|
$document = str_replace("{subcontractor}", $ste_subcontractor, $document);
|
|
$document = str_replace("{contractor}", $contractor, $document);
|
|
$document = str_replace("{third_party}", $ste_subcontractor, $document);
|
|
$document = str_replace("{engineering_company}", $general_contractor, $document);
|
|
$path = "004_QA/0010_Spool_NDT_Release_Check_List";
|
|
$path = "$path/$fileName";
|
|
$path2 = "004_QA/0014_Spool_Release_for_Client/$folderName/$fileName";
|
|
html_create($path, $document, $j['paper']);
|
|
html_create($path2, $document, $j['paper']);
|
|
|
|
echo url("storage/documents/$path.pdf?" . rand());
|
|
|
|
|
|
$QABasePath = "storage/documents/004_QA";
|
|
$clientBasePath = "$QABasePath/0014_Spool_Release_for_Client";
|
|
if(postesit("drawing_document", "true")) {
|
|
foreach($isometrics AS $isometric) {
|
|
$search = glob("storage/documents/001_Drawings/002_Iso/*$isometric*.pdf");
|
|
if(isset($search[0])) {
|
|
copy($search[0], "$clientBasePath/$folderName/$isometric.pdf");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(postesit("log_report", "true")) {
|
|
foreach($weldLogs AS $weldLog) {
|
|
$search = glob("$QABasePath/0000_VT/{$weldLog->vt_report}.pdf");
|
|
if(isset($search[0])) {
|
|
copy($search[0], "$clientBasePath/$folderName/{$weldLog->vt_report}.pdf");
|
|
}
|
|
|
|
$search = glob("$QABasePath/0001_RT/{$weldLog->rt_report}.pdf");
|
|
if(isset($search[0])) {
|
|
copy($search[0], "$clientBasePath/$folderName/{$weldLog->rt_report}.pdf");
|
|
}
|
|
|
|
$search = glob("$QABasePath/0002_UT/{$weldLog->ut_report}.pdf");
|
|
if(isset($search[0])) {
|
|
copy($search[0], "$clientBasePath/$folderName/{$weldLog->ut_report}.pdf");
|
|
}
|
|
|
|
$search = glob("$QABasePath/0003_MT/{$weldLog->mt_report}.pdf");
|
|
if(isset($search[0])) {
|
|
copy($search[0], "$clientBasePath/$folderName/{$weldLog->mt_report}.pdf");
|
|
}
|
|
|
|
$search = glob("$QABasePath/0004_PT/{$weldLog->pt_report}.pdf");
|
|
if(isset($search[0])) {
|
|
copy($search[0], "$clientBasePath/$folderName/{$weldLog->pt_report}.pdf");
|
|
}
|
|
|
|
$search = glob("$QABasePath/0005_PMI/{$weldLog->pmi_report}.pdf");
|
|
if(isset($search[0])) {
|
|
copy($search[0], "$clientBasePath/$folderName/{$weldLog->pmi_report}.pdf");
|
|
}
|
|
|
|
$search = glob("$QABasePath/0006_Ferrite/{$weldLog->ferrite_report}.pdf");
|
|
if(isset($search[0])) {
|
|
copy($search[0], "$clientBasePath/$folderName/{$weldLog->ferrite_report}.pdf");
|
|
}
|
|
|
|
$search = glob("$QABasePath/0007_PWHT/{$weldLog->no_of_pwht_report}.pdf");
|
|
if(isset($search[0])) {
|
|
copy($search[0], "$clientBasePath/$folderName/{$weldLog->no_of_pwht_report}.pdf");
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
@include("admin-ajax.generate-isometric-drawing-list")
|