Skip to content

A free open source IT asset/license management system

adds Z Ultimate 18939

Godfrey Mde37b326d231
diff --git a/app/Models/Labels/Tapes/Zebra/Z_Ultimate.php b/app/Models/Labels/Tapes/Zebra/Z_Ultimate.php
new file mode 100644
index 0000000000..4f8b673434
--- /dev/null
+++ b/app/Models/Labels/Tapes/Zebra/Z_Ultimate.php
@@ -0,0 +1,80 @@
+<?php
+
+namespace App\Models\Labels\Tapes\Zebra;
+
+use App\Helpers\Helper;
+use App\Models\Labels\Label;
+use Illuminate\Support\Collection;
+use TCPDF;
+
+abstract class Z_Ultimate extends Label
+{
+ private const LABEL_GAP = 3.00;
+ private const MARGIN_SIDES = 1.50;
+
+ private const MARGIN_ENDS = 1.50;
+
+ public function getLabelGap()
+ {
+ return Helper::convertUnit(
+ self::LABEL_GAP,
+ 'mm',
+ $this->getUnit()
+ );
+ }
+
+ public function getMarginTop()
+ {
+ return Helper::convertUnit(
+ self::MARGIN_SIDES,
+ 'mm',
+ $this->getUnit()
+ );
+ }
+
+ public function getMarginBottom()
+ {
+ return Helper::convertUnit(
+ self::MARGIN_SIDES,
+ 'mm',
+ $this->getUnit()
+ );
+ }
+
+ public function getMarginLeft()
+ {
+ return Helper::convertUnit(
+ self::MARGIN_ENDS,
+ 'mm',
+ $this->getUnit()
+ );
+ }
+
+ public function getMarginRight()
+ {
+ return Helper::convertUnit(
+ self::MARGIN_ENDS,
+ 'mm',
+ $this->getUnit()
+ );
+ }
+
+ public function preparePDF(TCPDF $pdf)
+ {
+ $pdf->SetMargins(0, 0, 0);
+ $pdf->SetAutoPageBreak(false, 0);
+ }
+
+ public function writeAll(TCPDF $pdf, Collection $data)
+ {
+ $pageSize = [
+ $this->getWidth(),
+ $this->getHeight() + $this->getLabelGap(),
+ ];
+
+ $data->each(function ($record) use ($pdf, $pageSize) {
+ $pdf->AddPage('L', $pageSize);
+ $this->write($pdf, $record);
+ });
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Labels/Tapes/Zebra/Z_Ultimate_10022964.php b/app/Models/Labels/Tapes/Zebra/Z_Ultimate_10022964.php
new file mode 100644
index 0000000000..fbda391765
--- /dev/null
+++ b/app/Models/Labels/Tapes/Zebra/Z_Ultimate_10022964.php
@@ -0,0 +1,8 @@
+<?php
+
+namespace App\Models\Labels\Tapes\Zebra;
+
+class Z_Ultimate_10022964
+{
+
+}
\ No newline at end of file
diff --git a/app/Models/Labels/Tapes/Zebra/Z_Ultimate_18939.php b/app/Models/Labels/Tapes/Zebra/Z_Ultimate_18939.php
new file mode 100644
index 0000000000..c23a6e96d7
--- /dev/null
+++ b/app/Models/Labels/Tapes/Zebra/Z_Ultimate_18939.php
@@ -0,0 +1,231 @@
+<?php
+
+namespace App\Models\Labels\Tapes\Zebra;
+
+use App\Helpers\Helper;
+
+class Z_Ultimate_18939 extends Z_Ultimate
+{
+ private const WIDTH = 76.20;
+
+ private const HEIGHT = 25.40;
+
+ 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 = 20.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