diff --git a/app/Services/StickerPdfService.php b/app/Services/StickerPdfService.php index 8be8bb55..2b6c47fc 100644 --- a/app/Services/StickerPdfService.php +++ b/app/Services/StickerPdfService.php @@ -9,6 +9,8 @@ use App\Models\StickerDetail; use App\Models\StickerMappingMaster; use App\Models\StickerStructureDetail; use App\Models\StickerValidation; +use App\Models\Company; +use App\Models\Plant; use App\Models\TestApprovalMapping; use App\Models\ClassCharacteristic; use Illuminate\Http\Response; @@ -1057,6 +1059,7 @@ class StickerPdfService $plantName = $itemCharacteristic?->plant?->name ?? ''; $plantAddress = $itemCharacteristic?->plant?->address ?? ''; + $plantRegdAddress = $itemCharacteristic?->plant?->reg_address ?? ''; $dateOfTest = $itemCharacteristic?->created_at?->format('d.m.Y') ?? ''; // $currentDate = $itemCharacteristic?->created_at?->format('M-y') ?? ''; @@ -1154,6 +1157,70 @@ class StickerPdfService ? number_format((float) $itemCharacteristic->{$column} * 2, 2, '.', '') : ''; } + if ($row->characteristics_type == 'regd_address') { + + $column = 'zmm_brand'; + + $textValue = $itemCharacteristic?->{$column} != null + ? $itemCharacteristic->{$column} + : ''; + if($textValue == 'TORMAC'){ + $cName = Company::where('name', 'TORMAC')->first(); + $plantRegdAddress = Plant::where('company_id', $cName->id)->first(); + + $textValue = $plantRegdAddress->reg_address; + } + else if($textValue == 'CRI'){ + $cName = Company::where('name', 'CRI')->first(); + $plantRegdAddress = Plant::where('company_id', $cName->id)->where('id', $plantId)->first(); + + $textValue = $plantRegdAddress->reg_address; + } + else if($textValue == 'GENVIK'){ + $cName = Company::where('name', 'GENVIK')->first(); + $plantRegdAddress = Plant::where('company_id', $cName->id)->first(); + + $textValue = $plantRegdAddress->reg_address; + } + else if($textValue == 'ZIRANTECH'){ + $cName = Company::where('name', 'ZIRANTECH')->first(); + $plantRegdAddress = Plant::where('company_id', $cName->id)->first(); + + $textValue = $plantRegdAddress->reg_address; + } + } + if ($row->characteristics_type == 'regd_unit') { + + $column = 'zmm_brand'; + + $textValue = $itemCharacteristic?->{$column} != null + ? $itemCharacteristic->{$column} + : ''; + if($textValue == 'TORMAC'){ + $cName = Company::where('name', 'TORMAC')->first(); + $plantRegdUnit = Plant::where('company_id', $cName->id)->first(); + + $textValue = $plantRegdUnit->name; + } + else if($textValue == 'CRI'){ + $cName = Company::where('name', 'CRI')->first(); + $plantRegdUnit = Plant::where('company_id', $cName->id)->where('id', $plantId)->first(); + + $textValue = $plantRegdUnit->name; + } + else if($textValue == 'GENVIK'){ + $cName = Company::where('name', 'GENVIK')->first(); + $plantRegdUnit = Plant::where('company_id', $cName->id)->first(); + + $textValue = $plantRegdUnit->name; + } + else if($textValue == 'ZIRANTEC'){ + $cName = Company::where('name', 'ZIRANTEC')->first(); + $plantRegdUnit = Plant::where('company_id', $cName->id)->first(); + + $textValue = $plantRegdUnit->name; + } + } if (str_contains($row->string_value ?? '', '₹')) {