Skip to content

A free open source IT asset/license management system

adds Z Ultimate 10022964

Godfrey Me153f899ab04
diff --git a/app/Models/Labels/Tapes/Zebra/Z_Ultimate_10022964.php b/app/Models/Labels/Tapes/Zebra/Z_Ultimate_10022964.php
index fbda391765..ada8e31b9e 100644
--- a/app/Models/Labels/Tapes/Zebra/Z_Ultimate_10022964.php
+++ b/app/Models/Labels/Tapes/Zebra/Z_Ultimate_10022964.php
@@ -2,7 +2,230 @@
namespace App\Models\Labels\Tapes\Zebra;
-class Z_Ultimate_10022964
+use App\Helpers\Helper;
+
+class Z_Ultimate_10022964 extends Z_Ultimate
{
+ private const WIDTH = 76.20;
+
+ private const HEIGHT = 38.0;
+
+ protected const BARCODE_MARGIN = 1.40;
+
+ protected const TAG_SIZE = 2.80;
+ protected const TAG_MARGIN = 1.5;
+
+ protected const TITLE_SIZE = 2.80;
+
+ protected const TITLE_MARGIN = 0.50;
+
+ protected const LABEL_SIZE = 2.00;
+
+ protected const LABEL_MARGIN = -0.35;
+
+ protected const FIELD_SIZE = 3.20;
+
+ protected const FIELD_MARGIN = 0.15;
+
+ protected const LOGO_MAX_WIDTH = 18.00;
+
+ protected const LOGO_MARGIN = 1.00;
+
+ public function getUnit()
+ {
+ return 'mm';
+ }
+
+ public function getSupportAssetTag()
+ {
+ return true;
+ }
+
+ public function getSupport1DBarcode()
+ {
+ return false;
+ }
+
+ public function getSupport2DBarcode()
+ {
+ return true;
+ }
+
+ public function getSupportFields()
+ {
+ return 3;
+ }
+
+ public function getSupportLogo()
+ {
+ return true;
+ }
+
+ public function getSupportTitle()
+ {
+ return true;
+ }
+
+ public function getWidth()
+ {
+ return Helper::convertUnit(
+ self::WIDTH,
+ 'mm',
+ $this->getUnit()
+ );
+ }
+
+ public function getHeight()
+ {
+ return Helper::convertUnit(
+ self::HEIGHT,
+ 'mm',
+ $this->getUnit()
+ );
+ }
+
+ public function write($pdf, $record)
+ {
+ $pa = $this->getPrintableArea();
+
+ $currentX = $pa->x1;
+ $currentY = $pa->y1;
+ $usableWidth = $pa->w;
+ $usableHeight = $pa->h;
+ $currentY += 2.0;
+ $barcodeSize = max(
+ 0,
+ $usableHeight - static::TAG_SIZE - static::TAG_MARGIN
+ );
+
+ if ($record->has('barcode2d')) {
+ static::writeText(
+ $pdf,
+ $record->get('tag'),
+ $pa->x1,
+ $pa->y2 - static::TAG_SIZE,
+ 'freemono',
+ 'B',
+ static::TAG_SIZE,
+ 'C',
+ $barcodeSize,
+ static::TAG_SIZE,
+ true,
+ 0
+ );
+
+ static::write2DBarcode(
+ $pdf,
+ $record->get('barcode2d')->content,
+ $record->get('barcode2d')->type,
+ $currentX,
+ $currentY,
+ $barcodeSize,
+ $barcodeSize
+ );
+
+ $barcodeWidth = $barcodeSize + static::BARCODE_MARGIN;
+
+ $currentX += $barcodeWidth;
+ $usableWidth -= $barcodeWidth;
+ } else {
+ static::writeText(
+ $pdf,
+ $record->get('tag'),
+ $pa->x1,
+ $pa->y2 - static::TAG_SIZE,
+ 'freemono',
+ 'B',
+ static::TAG_SIZE,
+ 'R',
+ $usableWidth,
+ static::TAG_SIZE,
+ true,
+ 0
+ );
+ }
+ $textWidth = $usableWidth;
+
+ if ($record->has('logo')) {
+ $textWidth -= static::LOGO_MAX_WIDTH + static::LOGO_MARGIN;
+ }
+
+ $textWidth = max(0, $textWidth);
+
+ if ($record->has('title')) {
+ static::writeText(
+ $pdf,
+ $record->get('title'),
+ $currentX,
+ $currentY,
+ 'freesans',
+ '',
+ static::TITLE_SIZE,
+ 'L',
+ $textWidth,
+ static::TITLE_SIZE,
+ true,
+ 0
+ );
+
+ $currentY += static::TITLE_SIZE + static::TITLE_MARGIN;
+ }
+
+ foreach ($record->get('fields', []) as $field) {
+ static::writeText(
+ $pdf,
+ $field['label'],
+ $currentX,
+ $currentY,
+ 'freesans',
+ '',
+ static::LABEL_SIZE,
+ 'L',
+ $textWidth,
+ static::LABEL_SIZE,
+ true,
+ 0,
+ 0
+ );
+
+ $currentY += static::LABEL_SIZE + static::LABEL_MARGIN;
+
+ static::writeText(
+ $pdf,
+ $field['value'],
+ $currentX,
+ $currentY,
+ 'freemono',
+ 'B',
+ static::FIELD_SIZE,
+ 'L',
+ $textWidth,
+ static::FIELD_SIZE,
+ true,
+ 0,
+ 0.3
+ );
+
+ $currentY += static::FIELD_SIZE + static::FIELD_MARGIN;
+ }
+
+ if ($record->has('logo')) {
+ $logoX = $currentX + $textWidth + static::LOGO_MARGIN;
+ static::writeImage(
+ $pdf,
+ $record->get('logo'),
+ $logoX,
+ $pa->y1 + 2.0,
+ static::LOGO_MAX_WIDTH,
+ $usableHeight,
+ 'L',
+ 'T',
+ 300,
+ true,
+ false,
+ 0
+ );
+ }
+ }
}
\ No newline at end of file