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 . "
" . $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());
?>