Added rules and font path in sticker pdf service
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Pint / pint (pull_request) Successful in 2m56s
Laravel Larastan / larastan (pull_request) Failing after 5m30s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Pint / pint (pull_request) Successful in 2m56s
Laravel Larastan / larastan (pull_request) Failing after 5m30s
This commit is contained in:
@@ -1108,23 +1108,88 @@ class StickerPdfService
|
|||||||
if ($row->characteristics_type == 'serial_number') {
|
if ($row->characteristics_type == 'serial_number') {
|
||||||
$textValue = '__SERIAL_NUMBER__';
|
$textValue = '__SERIAL_NUMBER__';
|
||||||
}
|
}
|
||||||
if ($row->characteristics_type === 'plant_name') {
|
if ($row->characteristics_type == 'plant_name') {
|
||||||
$textValue = $plantName;
|
$textValue = $plantName;
|
||||||
}
|
}
|
||||||
if ($row->characteristics_type === 'plant_address') {
|
if ($row->characteristics_type == 'plant_address') {
|
||||||
$textValue = $plantAddress;
|
$textValue = $plantAddress;
|
||||||
}
|
}
|
||||||
if ($row->characteristics_type === 'current_date') {
|
if ($row->characteristics_type == 'current_date') {
|
||||||
$textValue = date('M-y');
|
$textValue = date('M-y');
|
||||||
}
|
}
|
||||||
if ($row->characteristics_type === 'date_of_test') {
|
if ($row->characteristics_type == 'date_of_test') {
|
||||||
$textValue = $dateOfTest;
|
$textValue = $dateOfTest;
|
||||||
}
|
}
|
||||||
$font = $row->string_font ?? 'helvetica';
|
// if ($row->characteristics_type == 'zmm_grwt_pump_dual') {
|
||||||
|
// $column = 'zmm_grwt_pump';
|
||||||
|
// $textValue = $itemCharacteristic?->{$column} != null
|
||||||
|
// ? (float) $itemCharacteristic->{$column} * 2
|
||||||
|
// : '';
|
||||||
|
// }
|
||||||
|
// if ($row->characteristics_type == 'zmm_newt_pump_dual') {
|
||||||
|
// $column = 'zmm_newt_pump';
|
||||||
|
// $textValue = $itemCharacteristic?->{$column} != null
|
||||||
|
// ? (float) $itemCharacteristic->{$column} * 2
|
||||||
|
// : '';
|
||||||
|
// }
|
||||||
|
if ($row->characteristics_type == 'zmm_grwt_pump_dual') {
|
||||||
|
$column = 'zmm_grwt_pump';
|
||||||
|
|
||||||
|
$textValue = $itemCharacteristic?->{$column} != null
|
||||||
|
? number_format((float) $itemCharacteristic->{$column} * 2, 3, '.', '')
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($row->characteristics_type == 'zmm_newt_pump_dual') {
|
||||||
|
$column = 'zmm_newt_pump';
|
||||||
|
|
||||||
|
$textValue = $itemCharacteristic?->{$column} != null
|
||||||
|
? number_format((float) $itemCharacteristic->{$column} * 2, 3, '.', '')
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
// if ($row->characteristics_type == 'mrp_dual') {
|
||||||
|
// $column = 'zmm_mrp';
|
||||||
|
// $textValue = $itemCharacteristic?->{$column} != null
|
||||||
|
// ? (float) $itemCharacteristic->{$column} * 2
|
||||||
|
// : '';
|
||||||
|
// }
|
||||||
|
if ($row->characteristics_type == 'mrp_dual') {
|
||||||
|
$column = 'zmm_mrp';
|
||||||
|
|
||||||
|
$textValue = $itemCharacteristic?->{$column} != null
|
||||||
|
? number_format((float) $itemCharacteristic->{$column} * 2, 2, '.', '')
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (str_contains($row->string_value ?? '', '₹')) {
|
if (str_contains($row->string_value ?? '', '₹')) {
|
||||||
$font = 'dejavusans';
|
$font = 'dejavusans';
|
||||||
}
|
}
|
||||||
|
// else{
|
||||||
|
// $font = $row->string_font ?? 'helvetica';
|
||||||
|
// }
|
||||||
|
else {
|
||||||
|
// $font = !empty($row->string_font)
|
||||||
|
// ? $row->string_font
|
||||||
|
// : 'helvetica';
|
||||||
|
|
||||||
|
if (!empty($row->string_font)) {
|
||||||
|
$fontFile = storage_path('app/private/fonts/' . $row->string_font . '.ttf');
|
||||||
|
|
||||||
|
if (file_exists($fontFile)) {
|
||||||
|
$font = TCPDF_FONTS::addTTFfont(
|
||||||
|
$fontFile,
|
||||||
|
'TrueTypeUnicode',
|
||||||
|
'',
|
||||||
|
32
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$font = 'helvetica';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$font = 'helvetica';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$templateElements[] =
|
$templateElements[] =
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user