ikinci temizlik tamamlandı

This commit is contained in:
Ümit Tunç
2026-04-28 21:15:09 +03:00
parent f80443aec0
commit 37e7296527
8313 changed files with 2400677 additions and 0 deletions
@@ -0,0 +1,99 @@
<?php
use App\Models\WelderTest;
use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
setlocale(LC_ALL, 'ru_RU.utf8');
App::setLocale("ru");
$documentInfo = document_template("Cleaning_Blowing");
$j = j($documentInfo->json);
$weldLogs = db("weld_logs");
$weldLogs = $weldLogs->join("subcontractors", "weld_logs.general_contractor", "subcontractors.company_name_en");
$weldLogs = $weldLogs->groupBy("line_number")->get();
$prefix = "📂 cleainig-blowing-generator";
Log::debug("$prefix start " . simdi());
$k = 0;
foreach($weldLogs AS $weldLog) {
$contractorInfo = db("subcontractors")->where("company_name_en", $weldLog->contractor)->first();
$workPermitInfo = db("work_permit_documents")
->where("duty", "Главный Начальник участка")
->where("zone", "like", "%{$weldLog->project}%")->first();
$fileName = $weldLog->line_number;
$string = $documentInfo->html;
$string = pdf_html_content($string);
$date = (new Carbon($weldLog->date_test));
$city = $contractorInfo?->city;
$c1 = $date->translatedFormat('d');
$c2 = $date->translatedFormat('F');
$c3 = $date->translatedFormat('y');
$c4 = $weldLog->general_contractor . "<hr>" . $weldLog->address;
$c5 = $contractorInfo?->company_name_ru;
$c6 = "";
$c7 = $workPermitInfo?->duty . " " . $workPermitInfo?->name_surname;
$c8 = "";
$c9 = $workPermitInfo?->third_party;
$c10 = $workPermitInfo?->duty;
$c11 = $contractorInfo?->company_name_ru;
$c12 = "";
$c13 = $weldLog->iso_number;
$c14 = "воздух";
if($weldLog->type_of_test == "Hydraulic") {
$c14 = "водой";
}
$c15 = $weldLog->design_pressure_mpa;
$c16 = $weldLog->test_pressure;
$c17 = "0,5";
$c18 = $workPermitInfo?->name_surname;
$c19 = $workPermitInfo?->name_surname;
$c20 = $workPermitInfo?->name_surname;
$c21 = "";
$c22 = "";
$c23 = "";
$string = str_replace("{city}", $city, $string);
$string = str_replace("{c1}", $c1, $string);
$string = str_replace("{c2}", $c2, $string);
$string = str_replace("{c3}", $c3, $string);
$string = str_replace("{c4}", $c4, $string);
$string = str_replace("{c5}", $c5, $string);
$string = str_replace("{c6}", $c6, $string);
$string = str_replace("{c7}", $c7, $string);
$string = str_replace("{c8}", $c8, $string);
$string = str_replace("{c9}", $c9, $string);
$string = str_replace("{c10}", $c10, $string);
$string = str_replace("{c11}", $c11, $string);
$string = str_replace("{c12}", $c12, $string);
$string = str_replace("{c13}", $c13, $string);
$string = str_replace("{c14}", $c14, $string);
$string = str_replace("{c15}", $c15, $string);
$string = str_replace("{c16}", $c16, $string);
$string = str_replace("{c17}", $c17, $string);
$string = str_replace("{c18}", $c18, $string);
$string = str_replace("{c19}", $c19, $string);
$string = str_replace("{c20}", $c20, $string);
$string = str_replace("{c21}", $c21, $string);
$string = str_replace("{c22}", $c22, $string);
$string = str_replace("{c23}", $c23, $string);
$path = $documentInfo->kid;//"005_PTO/08_Спецификация";
$path = "$path/$fileName";
html_create($path, $string);
$k++;
}
Log::debug("$prefix finish processed $k " . simdi());
?>
@@ -0,0 +1,90 @@
<?php
use App\Models\WelderTest;
use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
setlocale(LC_ALL, 'ru_RU.utf8');
App::setLocale("ru");
$documentInfo = document_template("Leak_test");
$j = j($documentInfo->json);
$weldLogs = db("weld_logs");
$weldLogs = $weldLogs->join("subcontractors", "weld_logs.general_contractor", "subcontractors.company_name_en");
$montajContractor = db("subcontractors")->where("job_description", "MONTAJ")->first();
$constructionContractor = db("subcontractors")->where("job_description", "CONSTRUCTION")->first();
$weldLogs = $weldLogs->groupBy("line_number")->get();
$projectNameRu = setting('project_name_ru');
$prefix = "📂 hydro-test-generator";
Log::debug("$prefix start " . simdi());
$k = 0;
foreach($weldLogs AS $weldLog) {
$contractorInfo = db("subcontractors")->where("company_name_en", $weldLog->contractor)->first();
$fileName = $weldLog->line_number;
$string = $documentInfo->html;
$string = workPermitReplacer($string, $weldLog, $documentInfo);
$string = str_replace("{project_name}", $projectNameRu, $string);
$string = pdf_html_content($string);
$date = (new Carbon($weldLog->date_test));
$c1 = $contractorInfo?->project_city_ru;
$c2 = $date->translatedFormat('d');
$c3 = $date->translatedFormat('F');
$c4 = $date->translatedFormat('y');
$c5 = $weldLog->general_contractor . "<hr>" . $weldLog->address;
$c6 = $montajContractor?->company_name_ru;
$c7 = $contractorInfo?->company_name_ru ;
$c11 = $contractorInfo?->company_name_ru;
$c12 = $constructionContractor?->company_name_ru;
$c13 = $weldLog->iso_number;
$c14 = "вода";
if($weldLog->type_of_test == "Hydraulic") {
$c14 = "водой";
}
$c15 = $weldLog->design_pressure_mpa;
$c16 = $weldLog->test_pressure;
$c17 = "0,5";
$string = str_replace("{c1}", $c1, $string);
$string = str_replace("{c2}", $c2, $string);
$string = str_replace("{c3}", $c3, $string);
$string = str_replace("{c4}", $c4, $string);
$string = str_replace("{c5}", $c5, $string);
$string = str_replace("{c6}", $c6, $string);
$string = str_replace("{c7}", $c7, $string);
$string = str_replace("{c11}", $c11, $string);
$string = str_replace("{c12}", $c12, $string);
$string = str_replace("{c13}", $c13, $string);
$string = str_replace("{c14}", $c14, $string);
$string = str_replace("{c15}", $c15, $string);
$string = str_replace("{c16}", $c16, $string);
$string = str_replace("{c17}", $c17, $string);
$path = $documentInfo->kid; //"005_PTO/07_Герметичность";
$path = "$path/$fileName";
html_create($path, $string);
$k++;
}
echo $k;
Log::debug("$prefix finish processed $k " . simdi());
?>
@@ -0,0 +1,168 @@
<?php
use App\Models\WelderTest;
use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
setlocale(LC_ALL, 'ru_RU.utf8');
App::setLocale("ru");
$documentInfo = document_template("Line_Specification");
$j = j($documentInfo->json);
$tableName = "m_t_o_s";
$mtos = db($tableName);
$mtos = $mtos->groupBy("line")
//->where("line","NI-80-AH01JL-FA00.830")
->get();
$prefix = "📂 line-specification";
Log::debug("$prefix start " . simdi());
$k = 0;
foreach($mtos AS $mto) {
$tableRows1 = "";
$tableRows2 = "";
$tableRows3 = "";
$fileName = $mto->line;
$string = $documentInfo->html;
$string = pdf_html_content($string);
$string .= "<style> table td {
border: solid 1px #000;
}</style>";
$c1 = $mto->line;
$c2 = "";
$string = str_replace("{c1}", $c1, $string);
$string = str_replace("{c2}", $c2, $string);
$pipes = db($tableName)
->where("line", $mto->line)
->where(function($query) use($tableName) {
$types = ['PIPE'];
foreach($types AS $type) {
$query->orWhere("$tableName.longdescription", "like", "%$type%");
}
$types = ['ТРУБА'];
foreach($types AS $type) {
$query->orWhere("$tableName.description_ru", "like", "%$type%");
}
})
->get();
$others = db($tableName)
->where("line", $mto->line)
->where(function($query) {
$types = ['flange', 'elbow', 'Tee', 'reducer'];
foreach($types AS $type) {
$query->orWhere("longdescription", "like", "%$type%");
}
})
->get();
$others2 = db($tableName)
->where("line", $mto->line)
->where(function($query) {
$types = ['support', 'gasket', 'nuts', 'bolt'];
foreach($types AS $type) {
$query->orWhere("longdescription", "like", "%$type%");
}
})
->get();
foreach($pipes AS $pipe) {
$weldLog = db("weld_logs")
->where("line_number", $pipe->line)
->where("element_code_1", $pipe->component_code_id)
->first();
$tableRow1 = "
<tr border='1' style='border:solid 1px #000'>
<td style='text-align:center;'>{$weldLog?->pose_no_1} <br> ({$pipe->component_code_id}) </td>
<td width='30%'>{$pipe->description_ru}</td>
<td style='text-align:center;'>{$pipe->odmm_1}x{$pipe->thicknessmm_1}</td>
<td style='text-align:center;'>{$pipe->material}</td>
<td>{$pipe->quantity} m</td>
</tr>
";
$tableRows1 .= $tableRow1;
}
foreach($others AS $pipe) {
$weldLog = db("weld_logs")
->where("line_number", $pipe->line)
->where("element_code_1", $pipe->component_code_id)
->first();
$dn1 = "{$pipe->dn_1}x{$pipe->dn_2}";
if($pipe->dn_2 == "") {
$dn1 = $pipe->dn_1;
}
$tableRow2 = "
<tr border=1>
<td style='text-align:center;'>{$weldLog?->pose_no_1} <br> ({$pipe->component_code_id}) </td>
<td width='30%'>{$pipe->description_ru}</td>
<td style='text-align:center;'>$dn1</td>
<td style='text-align:center;'>{$pipe->pn_mpa}</td>
<td>{$pipe->material}</td>
<td>{$pipe->quantity} шт</td>
</tr>
";
$tableRows2 .= $tableRow2;
}
foreach($others2 AS $pipe) {
$weldLog = db("weld_logs")
->where("line_number", $pipe->line)
->where("element_code_1", $pipe->component_code_id)
->first();
$dn1 = "{$pipe->dn_1}x{$pipe->dn_2}";
if($pipe->dn_2 == "") {
$dn1 = $pipe->dn_1;
}
$tableRow3 = "
<tr border=1>
<td style='text-align:center;'>{$weldLog?->pose_no_1} <br> ({$pipe->component_code_id}) </td>
<td width='30%'>{$pipe->description_ru}</td>
<td style='text-align:center;'>{$pipe->material}</td>
<td style='text-align:center;'>{$pipe->quantity} шт</td>
</tr>
";
$tableRows3 .= $tableRow3;
}
$string = str_replace("<!-- table_row_1 -->", $tableRows1, $string);
$string = str_replace("<!-- table_row_2 -->", $tableRows2, $string);
$string = str_replace("<!-- table_row_3 -->", $tableRows3, $string);
$string = workPermitReplacer($string, null, $documentInfo);
$path = $documentInfo->kid; //"005_PTO/08_Спецификация";
$path = "$path/$fileName";
html_create($path, $string);
$k++;
}
echo $k;
Log::debug("$prefix finish processed $k " . simdi());
?>
@@ -0,0 +1,2 @@
<?php $_GET['all'] = "ok"; ?>
@include("admin-ajax.pdf.generate-zhcp")
@@ -0,0 +1,104 @@
<?php
use App\Models\WelderTest;
use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
setlocale(LC_ALL, 'ru_RU.utf8');
App::setLocale("ru");
$documentInfo = document_template("Hydro_test");
$j = j($documentInfo->json);
function mb_str_replace($search, $replace, $subject) {
return implode($replace, explode($search, $subject, 2));
}
$weldLogs = db("weld_logs");
$weldLogs = $weldLogs->join("subcontractors", "weld_logs.general_contractor", "subcontractors.company_name_en");
$montajContractor = db("subcontractors")->where("job_description", "MONTAJ")->first();
$constructionContractor = db("subcontractors")->where("job_description", "CONSTRUCTION")->first();
$weldLogs = $weldLogs->groupBy("line_number")->get();
$prefix = "📂 hydro-test-generator";
Log::debug("$prefix start " . simdi());
$k = 0;
$projectNameRu = setting('project_name_ru');
foreach($weldLogs AS $weldLog) {
$contractorInfo = db("subcontractors")->where("company_name_en", $weldLog->contractor)->first();
$fileName = $weldLog->line_number;
$string = $documentInfo->html;
$string = pdf_html_content($string);
$string = str_replace("{project_name}", $projectNameRu, $string);
$string = workPermitReplacer($string, $weldLog, $documentInfo);
$date = (new Carbon($weldLog->date_test));
$c1 = $contractorInfo?->project_city_ru;
$c2 = $date->translatedFormat('d');
$c3 = $date->translatedFormat('F');
$c4 = $date->translatedFormat('y');
$c5 = $weldLog->general_contractor . "<hr>" . $weldLog->address;
$c6 = $montajContractor?->company_name_ru;
$c7 = $contractorInfo?->company_name_ru ;
$c11 = $contractorInfo?->company_name_ru;
$c12 = $constructionContractor?->company_name_ru;
$c13 = $weldLog->iso_number;
$c14 = "вода";
if($weldLog->type_of_test == "Hydraulic") {
$c14 = "водой";
}
$c15 = $weldLog->design_pressure_mpa;
$c16 = $weldLog->test_pressure;
$c17 = "0,5";
$string = str_replace("{c1}", $c1, $string);
$string = str_replace("{c2}", $c2, $string);
$string = str_replace("{c3}", $c3, $string);
$string = str_replace("{c4}", $c4, $string);
$string = str_replace("{c5}", $c5, $string);
$string = str_replace("{c6}", $c6, $string);
$string = str_replace("{c7}", $c7, $string);
$string = str_replace("{c11}", $c11, $string);
$string = str_replace("{c12}", $c12, $string);
$string = str_replace("{c13}", $c13, $string);
$string = str_replace("{c14}", $c14, $string);
$string = str_replace("{c15}", $c15, $string);
$string = str_replace("{c16}", $c16, $string);
$string = str_replace("{c17}", $c17, $string);
$path = $documentInfo->kid; //"005_PTO/06_Прочность и плотность";
$path = "$path/$fileName";
html_create($path, $string);
/*
echo $string;
exit();
*/
$k++;
}
echo $k;
Log::debug("$prefix finish processed $k " . simdi());
?>
@@ -0,0 +1,103 @@
<?php
use App\Models\WelderTest;
use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
setlocale(LC_ALL, 'ru_RU.utf8');
App::setLocale("ru");
$documentInfo = document_template("Internal cleaning of pipelines");
$j = j($documentInfo->json);
function mb_str_replace($search, $replace, $subject) {
return implode($replace, explode($search, $subject, 2));
}
$weldLogs = db("weld_logs");
$weldLogs = $weldLogs->join("subcontractors", "weld_logs.general_contractor", "subcontractors.company_name_en");
$montajContractor = db("subcontractors")->where("job_description", "MONTAJ")->first();
$constructionContractor = db("subcontractors")->where("job_description", "CONSTRUCTION")->first();
$weldLogs = $weldLogs->groupBy("line_number")->get();
$prefix = "📂 hydro-test-generator";
Log::debug("$prefix start " . simdi());
$k = 0;
$projectNameRu = setting('project_name_ru');
foreach($weldLogs AS $weldLog) {
$contractorInfo = db("subcontractors")->where("company_name_en", $weldLog->contractor)->first();
$fileName = $weldLog->line_number;
$string = $documentInfo->html;
$string = pdf_html_content($string);
$string = str_replace("{project_name}", $projectNameRu, $string);
$string = workPermitReplacer($string, $weldLog, $documentInfo);
$date = (new Carbon($weldLog->date_test));
$c1 = $contractorInfo?->project_city_ru;
$c2 = $date->translatedFormat('d');
$c3 = $date->translatedFormat('F');
$c4 = $date->translatedFormat('y');
$c5 = $weldLog->general_contractor . "<hr>" . $weldLog->address;
$c6 = $montajContractor?->company_name_ru;
$c7 = $contractorInfo?->company_name_ru ;
$c11 = $contractorInfo?->company_name_ru;
$c12 = $constructionContractor?->company_name_ru;
$c13 = $weldLog->iso_number;
$c14 = "вода";
if($weldLog->type_of_test == "Hydraulic") {
$c14 = "водой";
}
$c15 = $weldLog->design_pressure_mpa;
$c16 = $weldLog->test_pressure;
$c17 = "0,5";
$string = str_replace("{c1}", $c1, $string);
$string = str_replace("{c2}", $c2, $string);
$string = str_replace("{c3}", $c3, $string);
$string = str_replace("{c4}", $c4, $string);
$string = str_replace("{c5}", $c5, $string);
$string = str_replace("{c6}", $c6, $string);
$string = str_replace("{c7}", $c7, $string);
$string = str_replace("{c11}", $c11, $string);
$string = str_replace("{c12}", $c12, $string);
$string = str_replace("{c13}", $c13, $string);
$string = str_replace("{c14}", $c14, $string);
$string = str_replace("{c15}", $c15, $string);
$string = str_replace("{c16}", $c16, $string);
$string = str_replace("{c17}", $c17, $string);
$path = $documentInfo->kid;//"005_PTO/11_Внутренней очистки";
$path = "$path/$fileName";
html_create($path, $string);
/*
echo $string;
exit();
*/
$k++;
}
echo $k;
Log::debug("$prefix finish processed $k " . simdi());
?>
@@ -0,0 +1,94 @@
<?php
use App\Models\WelderTest;
use Barryvdh\DomPDF\Facade\Pdf;
$documentInfo = document_template("Pipeline_certificate");
$j = j($documentInfo->json);
$lineLists = db("line_lists");
if(getisset("line_no")) {
$lineLists = $lineLists
//->select("id","pic","name", "name_ru", "registration_no AS welder_id")
->whereIn("line_no", get("line_no"));
}
if(getisset("first")) {
$lineLists = $lineLists->take(1);
}
$lineLists = $lineLists->join("weld_logs","line_lists.line_no", "weld_logs.line_number")->whereNotNull("welding_date")->groupBy("line_no")->get();
$projectNameRu = setting('project_name_ru');
$prefix = "📂 line-certificate-generator";
Log::debug("$prefix start " . simdi());
$count = 0;
foreach($lineLists AS $lineList) {
//dump($lineList);
$fileName = $lineList->line_no;
$string = $documentInfo->html;
$string = pdf_html_content($string);
$string = str_replace("{project_name}", $projectNameRu, $string);
$string = workPermitReplacer($string, null, $documentInfo);
$certificate_no = $lineList->line_no;
try {
$content = db("subcontractors")->where("job_description", "CONSTRUCTION")->first()->company_name_ru;
} catch (\Throwable $th) {
$content = "СТЕЛЛАР";
}
$certificate_title = "Линия ({$lineList->line_no}, Категория {$lineList->category} {$lineList->fluid_group}";
$press_title = "Продукт - {$lineList->fluid_ru}, Ррасч. = {$lineList->design_pressure_mpa} MPa/FV, Трасч. = {$lineList->design_temperature}°C";
$content3 = "{$lineList->p_id}, {$lineList->iso_number}";
$content4 = getBeforeSlash($lineList->welding_method);
$content5 = "ВК - 100%, РК - %{$lineList->rt_scope}";
if($lineList->pwht == "YES") {
$content6 = "Требуется в соответствии с ГОСТ 32569-2013";
} else {
$content6 = "не требуется";
}
if($lineList->pmi_scope != "") {
$pmi_status = "Требуется в соответствии с ОСТ 36-50-86";
} else {
$pmi_status = "Не Требуется";
}
$content7 = "";
$content8 = df($lineList->date_test);
$content9 = "";
$string = str_replace("{date}", date("d.m.Y", strtotime($lineList->welding_date)), $string);
$string = str_replace("{pmi_status}", $pmi_status, $string);
$string = str_replace("{certificate_no}", $certificate_no, $string);
$string = str_replace("{content}", $content, $string);
$string = str_replace("{certificate_title}", $certificate_title, $string);
$string = str_replace("{press_title}", $press_title, $string);
$string = str_replace("{content3}", $content3, $string);
$string = str_replace("{content4}", $content4, $string);
$string = str_replace("{content5}", $content5, $string);
$string = str_replace("{content6}", $content6, $string);
$string = str_replace("{content7}", $content7, $string);
$string = str_replace("{content8}", $content8, $string);
$string = str_replace("{content9}", $content9, $string);
// echo $string; exit();
$path = $documentInfo->kid;//"005_PTO/03_свидетельство";
$path = "$path/$fileName";
html_create($path, $string);
$count++;
}
echo $count;
Log::debug("$prefix finish " . simdi());
?>
@@ -0,0 +1,313 @@
<?php
use App\Models\WelderTest;
use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
set_time_limit(-1);
ini_set('max_execution_time', -1);
setlocale(LC_ALL, 'ru_RU.utf8');
App::setLocale("ru");
$documentInfo = document_template("NDT_Clearance_TP");
$j = j($documentInfo->json);
function mb_str_replace($search, $replace, $subject) {
return implode($replace, explode($search, $subject, 2));
}
$weldLogs = db("weld_logs");
$weldLogs = $weldLogs->join("subcontractors", "weld_logs.general_contractor", "subcontractors.company_name_en");
$montajContractor = db("subcontractors")->where("job_description", "MONTAJ")->first();
$constructionContractor = db("subcontractors")->where("job_description", "CONSTRUCTION")->first();
if(!getesit("test_package_no", ""))
{
$weldLogs = $weldLogs->where("weld_logs.test_package_no", get("test_package_no"));
}
$weldLogs = $weldLogs
->where("weld_logs.test_package_no", "!=", "")
->whereNotNull("weld_logs.test_package_no")->groupBy("weld_logs.test_package_no")->get();
$prefix = "📂 {$documentInfo->title}";
Log::debug("$prefix start " . simdi());
$k = 0;
$projectNameRu = setting('project_name_ru');
// Get the active sheet or a specific sheet where you want to make replacements
// or $spreadsheet->getSheetByName('SheetName');
$total = $weldLogs->count();
$cacheId = "ndt-clearance-report-progress";
if(!getisset("test_package_no"))
{
Cache::put($cacheId,[
'total' => $total,
'current' => 0,
'progress' => 0,
'description' => 'Started'
]);
}
foreach($weldLogs AS $weldLog) {
// Load your Excel template file
$spreadsheet = IOFactory::load('storage/documents/' . $documentInfo->files);
$spreadsheet = $spreadsheet;
$sheet = $spreadsheet->getActiveSheet();
$contractorInfo = db("subcontractors")->where("company_name_en", $weldLog->contractor)->first();
$lineList = db("line_lists")->where([
'line_no' => $weldLog->line_number
])->first();
$fileName = $weldLog->test_package_no . " - " . $documentInfo->title2;
$spreadsheet = workPermitReplacerExcel($spreadsheet, $weldLog, $documentInfo);
$date = (new Carbon($weldLog->date_test));
$c1 = $contractorInfo?->project_city_ru;
$c2 = $date->translatedFormat('d');
$c3 = $date->translatedFormat('F');
$c4 = $date->translatedFormat('y');
$c5 = $weldLog->general_contractor . "<hr>" . $weldLog->address;
$c6 = $montajContractor?->company_name_ru;
$c7 = $contractorInfo?->company_name_ru ;
$c11 = $contractorInfo?->company_name_ru;
$c12 = $constructionContractor?->company_name_ru;
$c13 = $weldLog->iso_number;
$spoolReleaseNumbers = db("weld_logs")
->where("line_number", $weldLog->line_number)
->where("spool_status", "Spool Release")
->get()->pluck("spool_number")->toArray();
$spoolReleaseNumbers = implode(", ", $spoolReleaseNumbers);
$c14 = "вода";
if($weldLog->type_of_test == "Hydraulic") {
$c14 = "водой";
}
$c15 = $weldLog->design_pressure_mpa;
$c16 = $weldLog->test_pressure;
$c17 = "0,5";
$first_welding_date = db("weld_logs")->where("line_number", $weldLog->line_number)->whereNotNull("welding_date")->orderBy("welding_date", "ASC")->value("welding_date");
$first_welding_date = df($first_welding_date);
$last_welding_date = db("weld_logs")->where("line_number", $weldLog->line_number)->whereNotNull("welding_date")->orderBy("welding_date", "DESC")->value("welding_date");
$last_welding_date = df($last_welding_date);
$engineering_ru = db("subcontractors")->where("company_name_en", $lineList?->engineering)->value("company_name_ru");
// Define your placeholders and their corresponding replacements
$replacements = [
'{project_name}' => $projectNameRu,
'{date}' => $date,
'{c1}' => $c1,
'{c2}' => $c2,
'{c3}' => $c3,
'{c4}' => $c4,
'{c5}' => $c5,
'{c6}' => $c6,
'{c7}' => $c7,
'{c11}' => $c11,
'{c12}' => $c12,
'{c13}' => $c13,
'{c14}' => $c14,
'{c15}' => $c15,
'{c16}' => $c16,
'{c17}' => $c17,
'{test_package_no}' => $weldLog->test_package_no,
'{plant}' => $lineList?->plant,
'{p_id}' => $lineList?->p_id,
'{first_welding_date}' => $first_welding_date,
'{last_welding_date}' => $last_welding_date,
'{engineering_ru}' => $engineering_ru,
'{spoolReleaseNumbers}' => $spoolReleaseNumbers,
// '{welders}' => $weldLog->welder_2 ? $weldLog->welder_1 . ", " . $weldLog->welder_2 : $weldLog->welder_1,
];
foreach($weldLog AS $field => $value)
{
$replacements['{'.$field.'}'] = $value;
}
// Get the starting row index where the data begins (adjust according to your template)
$startRow = 19; // Example row number where the placeholders start
$templateRowCells = [];
// Iterate through the template row and save cell values and merge information
foreach ($sheet->getRowIterator($startRow)->current()->getCellIterator() as $cell) {
$templateRowCells[] = $cell->getValue();
}
// Loop through all the cells in the sheet and replace placeholders
foreach ($sheet->getRowIterator() as $row) {
foreach ($row->getCellIterator() as $cell) {
$cellValue = $cell->getValue();
if (is_string($cellValue)) {
foreach ($replacements as $placeholder => $replacement) {
if (strpos($cellValue, $placeholder) !== false) {
$newValue = str_replace($placeholder, $replacement, $cellValue);
$cell->setValue($newValue);
}
}
}
}
}
if($documentInfo->title == "NDT Clearance_TP")
{
// Retrieve the weld logs
$sameWeldLogs = db("weld_logs")->where("test_package_no", $weldLog->test_package_no)->get();
foreach($sameWeldLogs AS $sameWeldLog) {
// Save the template row's cell values and merge information
$mergedCells = [];
// Save merged cell ranges in the template row
foreach ($sheet->getMergeCells() as $mergeRange) {
// Check if the merge range starts in the template row
if (preg_match('/^\D*'.$startRow.'$/', explode(':', $mergeRange)[0])) {
$mergedCells[] = $mergeRange;
}
}
// Insert a new row before the next one (clone the template row)
$sheet->insertNewRowBefore($startRow + 1, 1);
// Get the newly inserted row
$newRow = $sheet->getRowIterator($startRow + 1)->current();
// Copy template row's values to the new row
$cellIndex = 0; // To keep track of which cell we're on
foreach ($newRow->getCellIterator() as $newCell) {
// Set the template value to the new cell
$newCellValue = $templateRowCells[$cellIndex];
// Replace placeholders with actual values
$newCellValue = str_replace('{line_no}', $sameWeldLog->line_number, $newCellValue);
$newCellValue = str_replace('{quantity_of_iso}', $sameWeldLog->quantity_of_iso, $newCellValue);
$newCellValue = str_replace('{joint_no}', $sameWeldLog->no_of_the_joint_as_per_as_built_survey, $newCellValue);
$newCellValue = str_replace('{welder_id}', $sameWeldLog->real_welder_1, $newCellValue);
$newCellValue = str_replace('{dia}', $sameWeldLog->outside_diameter_1, $newCellValue);
$newCellValue = str_replace('{thk}', $sameWeldLog->wall_thickness_1, $newCellValue);
$newCellValue = str_replace('{vt_report_no}', $sameWeldLog->vt_report, $newCellValue);
$newCellValue = str_replace('{pt_report_no}', $sameWeldLog->pt_report, $newCellValue);
$newCellValue = str_replace('{mt_report_no}', $sameWeldLog->mt_report, $newCellValue);
$newCellValue = str_replace('{rt_report_no}', $sameWeldLog->rt_report, $newCellValue);
$newCellValue = str_replace('{welders}', $sameWeldLog->welder_2 ? $sameWeldLog->welder_1 . ", " . $sameWeldLog->welder_2 : $sameWeldLog->welder_1, $newCellValue);
foreach($sameWeldLog AS $field => $value)
{
$newCellValue = str_replace('{'.$field.'}', $value, $newCellValue);
}
// Set the new value in the cell
$newCell->setValue($newCellValue);
$cellIndex++; // Move to the next cell
}
// Apply merged cells to the new row
foreach ($mergedCells as $mergeRange) {
// Adjust the merge range to the new row
$adjustedMergeRange = preg_replace_callback('/\d+/', function($matches) use ($startRow) {
return $matches[0] + 1; // Shift row numbers by 1 for the newly inserted row
}, $mergeRange);
// Apply the adjusted merge range to the new row
$sheet->mergeCells($adjustedMergeRange);
}
// Move to the next row for the next weld log entry
$startRow++;
}
// After inserting all new rows, remove the original template row
$sheet->removeRow(19);
}
$path = $documentInfo->kid; //"005_PTO/06_Прочность и плотность";
$fileName = str_replace("/", "-", $fileName);
$path = "storage/documents/$path/$fileName.xlsx";
if (!file_exists(dirname($path))) {
mkdir(dirname($path), 0777, true);
}
// Save the modified spreadsheet
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save($path);
echo xlsx_to_pdf_legacy($path, "storage/documents/{$documentInfo->kid}");
$k++;
if(!getisset("test_package_no"))
{
Cache::put($cacheId,[
'total' => $total,
'current' => $k,
'progress' => round($k * 100 / $total),
'description' => $weldLog->test_package_no . " - " . $path,
]);
}
}
e2("The process is completed: a total of :count documents have been processed into the :folder folder.",
[
'folder' => $documentInfo->kid,
'count' => $k
]);
Log::debug("$prefix finish processed $k " . simdi());
?>
@@ -0,0 +1,107 @@
<?php
use App\Models\WelderTest;
use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
setlocale(LC_ALL, 'ru_RU.utf8');
App::setLocale("ru");
$documentInfo = document_template("Cleaning_Blowing");
$j = j($documentInfo->json);
function mb_str_replace($search, $replace, $subject) {
return implode($replace, explode($search, $subject, 2));
}
$weldLogs = db("weld_logs");
$weldLogs = $weldLogs->join("subcontractors", "weld_logs.general_contractor", "subcontractors.company_name_en");
$montajContractor = db("subcontractors")->where("job_description", "MONTAJ")->first();
$constructionContractor = db("subcontractors")->where("job_description", "CONSTRUCTION")->first();
$weldLogs = $weldLogs->groupBy("line_number")->get();
$prefix = "📂 pdf-washing-blowing-generator";
Log::debug("$prefix start " . simdi());
$k = 0;
$projectNameRu = setting('project_name_ru');
foreach($weldLogs AS $weldLog) {
$contractorInfo = db("subcontractors")->where("company_name_en", $weldLog->contractor)->first();
$cleaning_blowing_drying_date = db("test_pack_base_statuses")
->join("test_packages", "test_pack_base_statuses.test_package_no", "test_packages.test_package_number")
->select("cleaning_blowing_drying_date")
->where("drawing_no", $weldLog->line_number)->first()?->cleaning_blowing_drying_date;
$fileName = $weldLog->line_number;
$string = $documentInfo->html;
$string = pdf_html_content($string);
$string = str_replace("{project_name}", $projectNameRu, $string);
$string = workPermitReplacer($string, $weldLog, $documentInfo);
$date = (new Carbon($cleaning_blowing_drying_date));
$c1 = $contractorInfo?->project_city_ru;
$c2 = $date->translatedFormat('d');
$c3 = $date->translatedFormat('F');
$c4 = $date->translatedFormat('y');
$c5 = $weldLog->general_contractor . "<hr>" . $weldLog->address;
$c6 = $montajContractor?->company_name_ru;
$c7 = $contractorInfo?->company_name_ru ;
$c11 = $contractorInfo?->company_name_ru;
$c12 = $constructionContractor?->company_name_ru;
$c13 = $weldLog->iso_number;
$c14 = "вода";
if($weldLog->type_of_test == "Hydraulic") {
$c14 = "водой";
}
$c15 = $weldLog->design_pressure_mpa;
$c16 = $weldLog->test_pressure;
$c17 = "0,5";
$string = str_replace("{c1}", $c1, $string);
$string = str_replace("{c2}", $c2, $string);
$string = str_replace("{c3}", $c3, $string);
$string = str_replace("{c4}", $c4, $string);
$string = str_replace("{c5}", $c5, $string);
$string = str_replace("{c6}", $c6, $string);
$string = str_replace("{c7}", $c7, $string);
$string = str_replace("{c11}", $c11, $string);
$string = str_replace("{c12}", $c12, $string);
$string = str_replace("{c13}", $c13, $string);
$string = str_replace("{c14}", $c14, $string);
$string = str_replace("{c15}", $c15, $string);
$string = str_replace("{c16}", $c16, $string);
$string = str_replace("{c17}", $c17, $string);
$path = $documentInfo->kid; //"005_PTO/10_промывки и продувки";
$path = "$path/$fileName";
html_create($path, $string);
/*
echo $string;
exit();
*/
$k++;
}
echo $k;
Log::debug("$prefix finish processed $k " . simdi());
?>
@@ -0,0 +1,83 @@
<?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());
?>
@@ -0,0 +1,346 @@
<?php
use App\Models\WelderTest;
use Barryvdh\DomPDF\Facade\Pdf;
$count = 0;
$prefix = "📂 wqtr-generator";
Log::debug("$prefix start " . simdi());
$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();
foreach($userInfos AS $userInfo) {
$documentInfo = document_template("WQTR_Dopusk_list");
$j = j($documentInfo->json);
$welderInfo = db("naks_welders")->where("welder_id", $userInfo->registration_no)->first();
$welderTests = WelderTest::where("naks_id", $userInfo->registration_no)
->select("*")
->selectRaw(DB::raw("(GROUP_CONCAT(material_group_1 SEPARATOR '; ')) AS material_group_1"))
->selectRaw(DB::raw("(GROUP_CONCAT(material_group_2 SEPARATOR '; ')) AS material_group_2"))
->selectRaw(DB::raw("(GROUP_CONCAT(dia_min SEPARATOR '; ')) AS dia_min"))
->selectRaw(DB::raw("(GROUP_CONCAT(dia_max SEPARATOR '; ')) AS dia_max"))
->selectRaw(DB::raw("(GROUP_CONCAT(thk_min SEPARATOR '; ')) AS thk_min"))
->selectRaw(DB::raw("(GROUP_CONCAT(thk_max SEPARATOR '; ')) AS thk_max"))
->selectRaw(DB::raw("(GROUP_CONCAT(kss_number SEPARATOR ' <br> ')) AS kss_number"))
->selectRaw(DB::raw("(GROUP_CONCAT(welding_method SEPARATOR '; ')) AS welding_method"))
->selectRaw(DB::raw("(GROUP_CONCAT(naks_no SEPARATOR ', ')) AS naks_no"))
->selectRaw(DB::raw("(GROUP_CONCAT(wps_no SEPARATOR ', ')) AS wps_no"))
->selectRaw(DB::raw("(GROUP_CONCAT(vt_report_no SEPARATOR ' <br> ')) AS vt_reports"))
->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(vt_date, '%d.%m.%Y') SEPARATOR ' <br> ')) AS vt_dates"))
->selectRaw(DB::raw("(GROUP_CONCAT(vt_result SEPARATOR ' <br> ')) AS vt_results"))
->selectRaw(DB::raw("(GROUP_CONCAT(rt_report_no SEPARATOR ' <br> ')) AS rt_reports"))
->selectRaw(DB::raw("(GROUP_CONCAT(rt_result SEPARATOR ' <br> ')) AS rt_results"))
->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(rt_date, '%d.%m.%Y') SEPARATOR ' <br> ')) AS rt_dates"))
->selectRaw(DB::raw("(GROUP_CONCAT(impact_report_no SEPARATOR ' <br> ')) AS impact_reports"))
->selectRaw(DB::raw("(GROUP_CONCAT(impact_result SEPARATOR ' <br> ')) AS impact_results"))
->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(impact_date, '%d.%m.%Y') SEPARATOR ' <br> ')) AS impact_dates"))
->selectRaw(DB::raw("(GROUP_CONCAT(bending_report_no SEPARATOR ' <br> ')) AS bending_reports"))
->selectRaw(DB::raw("(GROUP_CONCAT(bending_result SEPARATOR ' <br> ')) AS bending_results"))
->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(bending_date, '%d.%m.%Y') SEPARATOR ' <br> ')) AS bending_dates"))
->selectRaw(DB::raw("(GROUP_CONCAT(tensile_report_no SEPARATOR ' <br> ')) AS tensile_reports"))
->selectRaw(DB::raw("(GROUP_CONCAT(tensile_result SEPARATOR ' <br> ')) AS tensile_results"))
->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(tensile_date, '%d.%m.%Y') SEPARATOR ' <br> ')) AS tensile_dates"))
->selectRaw(DB::raw("(GROUP_CONCAT(pmi_report_no SEPARATOR ' <br> ')) AS pmi_reports"))
->selectRaw(DB::raw("(GROUP_CONCAT(pmi_result SEPARATOR ' <br> ')) AS pmi_results"))
->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(pmi_date, '%d.%m.%Y') SEPARATOR ' <br> ')) AS pmi_dates"))
->selectRaw(DB::raw("(GROUP_CONCAT(ht_report_no SEPARATOR ' <br> ')) AS ht_reports"))
->selectRaw(DB::raw("(GROUP_CONCAT(ht_result SEPARATOR ' <br> ')) AS ht_results"))
->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(ht_date, '%d.%m.%Y') SEPARATOR ' <br> ')) AS ht_dates"))
->selectRaw(DB::raw("(GROUP_CONCAT(ferrit_report_no SEPARATOR ' <br> ')) AS ferrite_reports"))
->selectRaw(DB::raw("(GROUP_CONCAT(ferrit_result SEPARATOR ' <br> ')) AS ferrite_results"))
->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(ferrit_date, '%d.%m.%Y') SEPARATOR ' <br> ')) AS ferrite_dates"))
->selectRaw(DB::raw("(GROUP_CONCAT(metallography_report_no SEPARATOR ' <br> ')) AS mt_reports"))
->selectRaw(DB::raw("(GROUP_CONCAT(metallography_result SEPARATOR ' <br> ')) AS mt_results"))
->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(metallography_date, '%d.%m.%Y') SEPARATOR ' <br> ')) AS mt_dates"))
->selectRaw(DB::raw("(GROUP_CONCAT(intergranullar_corrosion_report_no SEPARATOR ' <br> ')) AS icr_reports"))
->selectRaw(DB::raw("(GROUP_CONCAT(intergranullar_corrosion_result SEPARATOR ' <br> ')) AS icr_results"))
->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(intergranullar_corrosion_test_date, '%d.%m.%Y') SEPARATOR ' <br> ')) AS icr_dates"))
->groupBy("wpq_document_no")
->get();
$dateOfWelds = [];
$groupMaterials = [];
$process = [];
$naksDate = date("d.m.Y", strtotime($welderInfo?->period_of_validity));
$naksNo = $welderInfo?->naks_certificate_no;
$naksNo = "$naksNo до дд$naksDate";
foreach($welderTests AS $welderTest) {
$weldingMethods = explode("; ", $welderTest->welding_method);
$dateOfWeld = date("d.m.Y", strtotime($welderTest->welding_date));
$fileName = $welderTest->wpq_document_no;
$string = $documentInfo->html;
$string = pdf_html_content($string);
$object = $welderInfo?->qualitification_category;
$company = $welderInfo?->company;
$contractor = $welderInfo?->company;
$document_no = $welderTest->wpq_document_no;
$document_date = date("d.m.Y");
$full_name = $welderInfo?->welder_name_ru . " <br> " . $welderInfo?->welder_name_en;
$birth_year = date("d.m.Y", strtotime($welderInfo?->year_of_birth));
$qualification_category = $welderInfo?->qualitification_category;
$work_experience_in_welding = $welderTest->work_experience;
$naks_number = differentValuesImplode(", ", $welderTest->naks_no);
$order_number = $welderInfo?->welder_id;
$date_of_weld = $dateOfWeld;
$welderTest->welding_method = str_replace(",", "+", $welderTest->welding_method);
$welderTest->welding_method = differentValuesImplode("; ", $welderTest->welding_method);
$type_of_weld = $welderTest->welding_method;
$welding_regulatory_document = differentValuesImplode(", ", $welderTest->wps_no);
$weld_joint_mark = $welderTest->kss_number;
$group_and_grade_of_welded_materal = "{$welderTest->material_group_1}";
if($welderTest->material_group_1 != $welderTest->material_group_2) {
$group_and_grade_of_welded_materal .= "; {$welderTest->material_group_2}";
}
$group_and_grade_of_welded_materal = differentValuesImplode("; ", $group_and_grade_of_welded_materal);
$type_of_welded_parts = $welderInfo?->weld_type;
$outside_dia = differentValuesImplode("; ", $welderTest->dia_max);
$wall_thk = differentValuesImplode("; ", $welderTest->thk_max);
$seam_type = $welderTest->joint_type;
$type_of_welded_joint = "Труба+труба <br> Pipe + pipe";
if($welderTest->shield_gas == "AR") {
$joint_layers = "многопроходной <br> multipass";
} else {
$joint_layers = "одинокий <br> single";
}
$position_during_welding = $welderInfo?->welding_position;
$welding_equipment = "Lincoln Electric Invertec 270-TP";
$type_and_classification_of_electrodes = "Н/П";
$welding_filler_wire_class = $welderTest->wire;
$shielding_gas_type = $welderTest->shield_gas;
$thermal_treatment_date = "Н/П";
$testing_regulatory_documents = "";
$vt_reports = $welderTest->vt_reports;
$vt_date = $welderTest->vt_dates;
$vt_status = $welderTest->vt_results;
$rt_reports = $welderTest->rt_reports;
$rt_date = $welderTest->rt_dates;
$rt_status = $welderTest->rt_results;
$ut_reports = $welderTest?->ut_reports;
$ut_date = "";
$ut_status = "";
$mt_reports = $welderTest->mt_reports;
$mt_date = $welderTest->mt_dates;
$mt_status = $welderTest->mt_results;
$pmi_reports = $welderTest->pmi_reports;
$pmi_date = $welderTest->pmi_dates;
$pmi_status = $welderTest->pmi_results;
$ht_reports = $welderTest->ht_reports;
$ht_date = $welderTest->ht_dates;
$ht_status = $welderTest->ht_results;
$st_status = $welderTest->rt_results;
$sb_reports = $welderTest->tensile_reports . " <br> " . $welderTest->impact_reports;
$sb_date = $welderTest->tensile_dates . " <br> " . $welderTest->impact_dates;
$sb_status = $welderTest->tensile_results . " <br> " . $welderTest->impact_results;
$ibt_reports = $welderTest->bending_reports;
$ibt_date = $welderTest->bending_dates;
$ibt_status = $welderTest->bending_results;
$metallography_reports = $welderTest->mt_reports;
$metallography_date = $welderTest->mt_dates;
$metallography_status = $welderTest->mt_results;
$ferrite_reports = $welderTest->ferrite_reports;
$ferrite_date = $welderTest->ferrite_dates;
$ferrite_status = $welderTest->ferrite_results;
$icr_reports = $welderTest->icr_reports;
$icr_date = $welderTest->icr_dates;
$icr_status = $welderTest->icr_results;
$welding_up = $welderTest->welding_method;
$type_of_welded_parts = $welderInfo?->component;
$joint_types = $welderInfo?->weld_type;
$welds_types = "Стыковое, угловое, нахлесточное/ butt weld, fillet weld, T-Join Weld";
$joint_types = "Все/ All";
$outer_dia = [];
$parts_thk = [];
$dia_min = explode("; ", $welderTest->dia_min);
$dia_max = explode("; ", $welderTest->dia_max);
$thk_min = explode("; ", $welderTest->thk_min);
$thk_max = explode("; ", $welderTest->thk_max);
$dcount = 0;
foreach($dia_min AS $dm) {
if(!isset($dia_max[$dcount])) {
$dia_max[$dcount] = "и выше";
} else {
if($dia_max[$dcount] == "")
$dia_max[$dcount] = "и выше";
}
$thisWeldingMethod = "";
if(isset($weldingMethods[$dcount])) {
$thisWeldingMethod = $weldingMethods[$dcount];
}
$outer_dia[] = "$thisWeldingMethod от $dm до {$dia_max[$dcount]}";
$dcount++;
}
$outer_dia = implode("; ", $outer_dia);
$dcount = 0;
foreach($thk_min AS $dm) {
if(!isset($thk_max[$dcount])) {
$thk_max[$dcount] = "и выше";
} else {
if($thk_max[$dcount] == "")
$thk_max[$dcount] = "и выше";
}
$thisWeldingMethod = "";
if(isset($weldingMethods[$dcount])) {
$thisWeldingMethod = $weldingMethods[$dcount];
}
$parts_thk[] = "$thisWeldingMethod от $dm до {$thk_max[$dcount]}";
$dcount++;
}
$parts_thk = implode("; ", $parts_thk);
$welded_material_group = differentValuesImplode("; ", $welderTest->material_group_1 . "; " . $welderTest->material_group_2);
$welded_material_type = "{$welderTest->wire}, {$welderTest->electrode}, {$welderTest->flux}";
$equipment_group = $welderTest->technology_range;
$welded_joint = "{$welderTest->process} ос (бп)";
$head_of_welding = "";
$welding_inspector = "";
$welding_engineer = "";
$string = str_replace("{object}", $object, $string);
$string = str_replace("{company}", $company, $string);
$string = str_replace("{contractor}", $contractor, $string);
$string = str_replace("{document_no}", $document_no, $string);
$string = str_replace("{document_date}", $document_date, $string);
$string = str_replace("{full_name}", $full_name, $string);
$string = str_replace("{birth_year}", $birth_year, $string);
$string = str_replace("{qualification_category}", $qualification_category, $string);
$string = str_replace("{work_experience_in_welding}", $work_experience_in_welding, $string);
$string = str_replace("{naks_number}", $naks_number, $string);
$string = str_replace("{order_number}", $order_number, $string);
$string = str_replace("{date_of_weld}", $date_of_weld, $string);
$string = str_replace("{type_of_weld}", $type_of_weld, $string);
$string = str_replace("{welding_regulatory_document}", $welding_regulatory_document, $string);
$string = str_replace("{weld_joint_mark}", $weld_joint_mark, $string);
$string = str_replace("{group_and_grade_of_welded_materal}", $group_and_grade_of_welded_materal, $string);
$string = str_replace("{type_of_welded_parts}", $type_of_welded_parts, $string);
$string = str_replace("{outside_dia}", $outside_dia, $string);
$string = str_replace("{wall_thk}", $wall_thk, $string);
$string = str_replace("{seam_type}", $seam_type, $string);
$string = str_replace("{type_of_welded_joint}", $type_of_welded_joint, $string);
$string = str_replace("{joint_layers}", $joint_layers, $string);
$string = str_replace("{position_during_welding}", $position_during_welding, $string);
$string = str_replace("{welding_equipment}", $welding_equipment, $string);
$string = str_replace("{type_and_classification_of_electrodes}", $type_and_classification_of_electrodes, $string);
$string = str_replace("{welding_filler_wire_class}", $welding_filler_wire_class, $string);
$string = str_replace("{shielding_gas_type}", $shielding_gas_type, $string);
$string = str_replace("{thermal_treatment_date}", $thermal_treatment_date, $string);
$string = str_replace("{testing_regulatory_documents}", $testing_regulatory_documents, $string);
$string = str_replace("{vt_reports}", $vt_reports, $string);
$string = str_replace("{vt_date}", $vt_date, $string);
$string = str_replace("{vt_status}", $vt_status, $string);
$string = str_replace("{rt_reports}", $rt_reports, $string);
$string = str_replace("{rt_date}", $rt_date, $string);
$string = str_replace("{rt_status}", $rt_status, $string);
$string = str_replace("{ut_reports}", $ut_reports, $string);
$string = str_replace("{ut_date}", $ut_date, $string);
$string = str_replace("{ut_status}", $ut_status, $string);
$string = str_replace("{mt_reports}", $mt_reports, $string);
$string = str_replace("{mt_date}", $mt_date, $string);
$string = str_replace("{mt_status}", $mt_status, $string);
$string = str_replace("{pmi_reports}", $pmi_reports, $string);
$string = str_replace("{pmi_date}", $pmi_date, $string);
$string = str_replace("{pmi_status}", $pmi_status, $string);
$string = str_replace("{ht_reports}", $ht_reports, $string);
$string = str_replace("{ht_date}", $ht_date, $string);
$string = str_replace("{ht_status}", $ht_status, $string);
$string = str_replace("{rt_reports}", $rt_reports, $string);
$string = str_replace("{rt_date}", $rt_date, $string);
$string = str_replace("{st_status}", $st_status, $string);
$string = str_replace("{sb_reports}", $sb_reports, $string);
$string = str_replace("{sb_date}", $sb_date, $string);
$string = str_replace("{sb_status}", $sb_status, $string);
$string = str_replace("{ibt_reports}", $ibt_reports, $string);
$string = str_replace("{ibt_date}", $ibt_date, $string);
$string = str_replace("{ibt_status}", $ibt_status, $string);
$string = str_replace("{metallography_reports}", $metallography_reports, $string);
$string = str_replace("{metallography_date}", $metallography_date, $string);
$string = str_replace("{metallography_status}", $metallography_status, $string);
$string = str_replace("{ferrite_reports}", $ferrite_reports, $string);
$string = str_replace("{ferrite_date}", $ferrite_date, $string);
$string = str_replace("{ferrite_status}", $ferrite_status, $string);
$string = str_replace("{icr_reports}", $icr_reports, $string);
$string = str_replace("{icr_date}", $icr_date, $string);
$string = str_replace("{icr_status}", $icr_status, $string);
$string = str_replace("{welding_up}", $welding_up, $string);
$string = str_replace("{type_of_welded_parts}", $type_of_welded_parts, $string);
$string = str_replace("{joint_types}", $joint_types, $string);
$string = str_replace("{welds_types}", $welds_types, $string);
$string = str_replace("{joint_types}", $joint_types, $string);
$string = str_replace("{outer_dia}", $outer_dia, $string);
$string = str_replace("{parts_thk}", $parts_thk, $string);
$string = str_replace("{welded_material_group}", $welded_material_group, $string);
$string = str_replace("{welded_material_type}", $welded_material_type, $string);
$string = str_replace("{welding_equipment}", $welding_equipment, $string);
$string = str_replace("{equipment_group}", $equipment_group, $string);
$string = str_replace("{welded_joint}", $welded_joint, $string);
$string = str_replace("{head_of_welding}", $head_of_welding, $string);
$string = str_replace("{welding_inspector}", $welding_inspector, $string);
$string = str_replace("{welding_engineer}", $welding_engineer, $string);
/*
echo $string;
dd("ok");
*/
$path = $documentInfo->kid;//"004_QA/0015_WQTR";
$path = "$path/$fileName";
html_create($path, $string);
$count++;
}
}
echo $count;
Log::debug("$prefix finish " . simdi());
?>
@@ -0,0 +1,86 @@
<?php
use App\Models\WelderTest;
use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
setlocale(LC_ALL, 'ru_RU.utf8');
App::setLocale("ru");
$documentInfo = document_template("welding_consumables_journal");
$j = j($documentInfo->json);
$naksConsumables = db("naks_consumables");
$naksConsumables = $naksConsumables->get();
$prefix = "📂 welding-consumables-journal-generator";
Log::debug("$prefix start " . simdi());
$k = 1;
$tableRows = "";
foreach($naksConsumables AS $naksConsumable) {
$naksCertificate = db("naks_certificates")->where("certificate_no", $naksConsumable->naks_certificate_no)->first();
$naksConsumable->naks_certificate_date = df($naksConsumable->naks_certificate_date);
$naksConsumable->naks_valid_date = df($naksConsumable->naks_valid_date);
$naksConsumable->certification_date = df($naksConsumable->certification_date);
$naksConsumable->created_at = df($naksConsumable->created_at);
$tableRow = "
<tr class='bordered'>
<td>$k</td>
<td>{$naksConsumable->naks_certificate_date}
</td>
<td>{$naksConsumable->product_name}; <br>
ø{$naksConsumable->diameter}x{$naksConsumable->qty} мм; <br>
{$naksConsumable->inspection_certificate_standart}
</td>
<td>{$naksConsumable->batch_number}</td>
<td>{$naksConsumable->qty}</td>
<td>{$naksConsumable->naks_valid_date}</td>
<td>{$naksConsumable->certification_date}</td>
<td>{$naksConsumable->brand}</td>
<td>{$naksConsumable->inspection_test_report}</td>
<td>{$naksCertificate?->welding_method}</td>
<td>{$naksConsumable->brand}</td>
<td>годен</td>
<td>{$naksConsumable->naks_valid_date}</td>
<td>{$naksConsumable->naks_valid_date}</td>
<td></td>
</tr>
";
$tableRows .= $tableRow;
$k++;
}
$fileName = "Welding Consumables Journal";
$string = $documentInfo->html;
$string = pdf_html_content($string);
$string = str_replace("<!-- table_row -->", $tableRows, $string);
$c1 = "";
$c2 = "";
$c3 = "";
$string = str_replace("{c1}", $c1, $string);
$string = str_replace("{c2}", $c2, $string);
$string = str_replace("{c3}", $c3, $string);
$path = $documentInfo->kid;
$path = "$path/$fileName";
html_create($path, $string, $j['paper']);
Log::debug("$prefix finish processed $k " . simdi());
?>