84 lines
2.0 KiB
PHP
84 lines
2.0 KiB
PHP
<?php
|
|
use App\Models\WelderTest;
|
|
use Barryvdh\DomPDF\Facade\Pdf;
|
|
use App\Models\WorkPermitDocument;
|
|
|
|
|
|
$userInfo = db("users");
|
|
if(getisset("id")) {
|
|
$userInfos = $userInfo
|
|
//->select("id","pic","name", "name_ru", "registration_no AS welder_id")
|
|
->where("registration_no", get("id"));
|
|
}
|
|
$userInfos = $userInfo->whereIn("level", ['Welder'])->get();
|
|
|
|
$fileName = "Welder List";
|
|
$welderNo = 1;
|
|
//dump($userInfos);
|
|
$table_rows = "";
|
|
$prefix = "📂 welder-list-generator";
|
|
Log::debug("$prefix start " . simdi());
|
|
foreach($userInfos AS $userInfo) {
|
|
|
|
$documentInfo = document_template("Welder_List");
|
|
$path = $documentInfo->kid;
|
|
$j = j($documentInfo->json);
|
|
$welderInfo = db("naks_welders")->where("welder_id", $userInfo->registration_no)->first();
|
|
$workPermitDocument = WorkPermitDocument::where("id_no", $userInfo->registration_no)->first();
|
|
|
|
|
|
$dateOfWelds = [];
|
|
$groupMaterials = [];
|
|
$process = [];
|
|
|
|
$naksDate = date("d.m.Y", strtotime($welderInfo?->period_of_validity));
|
|
|
|
$naksNo = $welderInfo?->naks_certificate_no;
|
|
|
|
|
|
|
|
|
|
|
|
$string = $documentInfo->html;
|
|
$string = pdf_html_content($string);
|
|
|
|
$table_row = "
|
|
<tr class='bordered'>
|
|
<td>$welderNo</td>
|
|
<td>{$userInfo->name_ru}</td>
|
|
<td>{$workPermitDocument?->duty}</td>
|
|
<td>{$workPermitDocument?->level}</td>
|
|
<td>{$userInfo->registration_no}</td>
|
|
<td>{$userInfo->registration_no}</td>
|
|
<td>No1</td>
|
|
<td></td>
|
|
</tr>
|
|
";
|
|
|
|
$table_rows .= $table_row;
|
|
|
|
$welderNo++;
|
|
}
|
|
|
|
$string = str_replace("<!-- table_row -->", $table_rows, $string);
|
|
$content1 = "";
|
|
$content2 = "";
|
|
$content3 = "";
|
|
$content4 = "";
|
|
$string = str_replace("{content1}", $content1, $string);
|
|
$string = str_replace("{content2}", $content2, $string);
|
|
$string = str_replace("{content3}", $content3, $string);
|
|
$string = str_replace("{content4}", $content4, $string);
|
|
|
|
|
|
$path = "$path/$fileName";
|
|
html_create($path, $string);
|
|
|
|
|
|
Log::debug("$prefix finish " . simdi());
|
|
|
|
|
|
|
|
?>
|
|
|