Merge pull request 'Added rules and font path in sticker pdf service' (#1096) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #1096
This commit was merged in pull request #1096.
This commit is contained in:
@@ -1108,23 +1108,88 @@ class StickerPdfService
|
||||
if ($row->characteristics_type == 'serial_number') {
|
||||
$textValue = '__SERIAL_NUMBER__';
|
||||
}
|
||||
if ($row->characteristics_type === 'plant_name') {
|
||||
if ($row->characteristics_type == 'plant_name') {
|
||||
$textValue = $plantName;
|
||||
}
|
||||
if ($row->characteristics_type === 'plant_address') {
|
||||
if ($row->characteristics_type == 'plant_address') {
|
||||
$textValue = $plantAddress;
|
||||
}
|
||||
if ($row->characteristics_type === 'current_date') {
|
||||
if ($row->characteristics_type == 'current_date') {
|
||||
$textValue = date('M-y');
|
||||
}
|
||||
if ($row->characteristics_type === 'date_of_test') {
|
||||
if ($row->characteristics_type == 'date_of_test') {
|
||||
$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 ?? '', '₹')) {
|
||||
$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[] =
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user