Added logic in sticker pdf service
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 25s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 21s
Laravel Pint / pint (pull_request) Successful in 3m46s
Laravel Larastan / larastan (pull_request) Failing after 6m22s

This commit is contained in:
dhanabalan
2026-10-20 10:10:07 +05:30
parent bb74a6c480
commit 4f97cd607e

View File

@@ -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 ?? '', '₹')) {