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 '
')) 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 '
')) AS vt_reports")) ->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(vt_date, '%d.%m.%Y') SEPARATOR '
')) AS vt_dates")) ->selectRaw(DB::raw("(GROUP_CONCAT(vt_result SEPARATOR '
')) AS vt_results")) ->selectRaw(DB::raw("(GROUP_CONCAT(rt_report_no SEPARATOR '
')) AS rt_reports")) ->selectRaw(DB::raw("(GROUP_CONCAT(rt_result SEPARATOR '
')) AS rt_results")) ->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(rt_date, '%d.%m.%Y') SEPARATOR '
')) AS rt_dates")) ->selectRaw(DB::raw("(GROUP_CONCAT(impact_report_no SEPARATOR '
')) AS impact_reports")) ->selectRaw(DB::raw("(GROUP_CONCAT(impact_result SEPARATOR '
')) AS impact_results")) ->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(impact_date, '%d.%m.%Y') SEPARATOR '
')) AS impact_dates")) ->selectRaw(DB::raw("(GROUP_CONCAT(bending_report_no SEPARATOR '
')) AS bending_reports")) ->selectRaw(DB::raw("(GROUP_CONCAT(bending_result SEPARATOR '
')) AS bending_results")) ->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(bending_date, '%d.%m.%Y') SEPARATOR '
')) AS bending_dates")) ->selectRaw(DB::raw("(GROUP_CONCAT(tensile_report_no SEPARATOR '
')) AS tensile_reports")) ->selectRaw(DB::raw("(GROUP_CONCAT(tensile_result SEPARATOR '
')) AS tensile_results")) ->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(tensile_date, '%d.%m.%Y') SEPARATOR '
')) AS tensile_dates")) ->selectRaw(DB::raw("(GROUP_CONCAT(pmi_report_no SEPARATOR '
')) AS pmi_reports")) ->selectRaw(DB::raw("(GROUP_CONCAT(pmi_result SEPARATOR '
')) AS pmi_results")) ->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(pmi_date, '%d.%m.%Y') SEPARATOR '
')) AS pmi_dates")) ->selectRaw(DB::raw("(GROUP_CONCAT(ht_report_no SEPARATOR '
')) AS ht_reports")) ->selectRaw(DB::raw("(GROUP_CONCAT(ht_result SEPARATOR '
')) AS ht_results")) ->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(ht_date, '%d.%m.%Y') SEPARATOR '
')) AS ht_dates")) ->selectRaw(DB::raw("(GROUP_CONCAT(ferrit_report_no SEPARATOR '
')) AS ferrite_reports")) ->selectRaw(DB::raw("(GROUP_CONCAT(ferrit_result SEPARATOR '
')) AS ferrite_results")) ->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(ferrit_date, '%d.%m.%Y') SEPARATOR '
')) AS ferrite_dates")) ->selectRaw(DB::raw("(GROUP_CONCAT(metallography_report_no SEPARATOR '
')) AS mt_reports")) ->selectRaw(DB::raw("(GROUP_CONCAT(metallography_result SEPARATOR '
')) AS mt_results")) ->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(metallography_date, '%d.%m.%Y') SEPARATOR '
')) AS mt_dates")) ->selectRaw(DB::raw("(GROUP_CONCAT(intergranullar_corrosion_report_no SEPARATOR '
')) AS icr_reports")) ->selectRaw(DB::raw("(GROUP_CONCAT(intergranullar_corrosion_result SEPARATOR '
')) AS icr_results")) ->selectRaw(DB::raw("(GROUP_CONCAT(DATE_FORMAT(intergranullar_corrosion_test_date, '%d.%m.%Y') SEPARATOR '
')) 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 . "
" . $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 = "Труба+труба
Pipe + pipe"; if($welderTest->shield_gas == "AR") { $joint_layers = "многопроходной
multipass"; } else { $joint_layers = "одинокий
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 . "
" . $welderTest->impact_reports; $sb_date = $welderTest->tensile_dates . "
" . $welderTest->impact_dates; $sb_status = $welderTest->tensile_results . "
" . $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()); ?>