Add wash item usage log functionality to XL Vask module

This commit is contained in:
Jeppe Bundgaard
2025-07-16 09:01:03 +02:00
parent 6a696eeb71
commit 4e89d168de
@@ -0,0 +1,67 @@
<?php
namespace objects;
use classes\db;
use classes\object_property;
use classes\xlvask;
use Exception;
use helpers\xlvask_customer;
use helpers\xlvask_vehicle;
use traits\db_object_t;
class xlvask_usage_log_wash_items_o extends db
{
use db_object_t;
public object_property $WashItemId;
public object_property $ExternalProductId;
public object_property $ExternalProductName;
public object_property $OriginalProductName;
public object_property $Unit;
public object_property $UnitPrice;
public object_property $Count;
public object_property $Discount;
public object_property $PriceExVat;
public object_property $Vat;
public object_property $PriceIncVat;
public function structure(): void
{
$this->setTable('xlvask_usage_log_wash_items');
}
/**
* Add a new XL Vask usage log wash item
* @param array $data The properties
* @returns void
* @throws Exception If the object was not created successfully
*/
public function add(array $data): void
{
$tmp_id = self::add_object($data);
$this->id = $tmp_id;
self::getObjectProperties();
self::objectChanged();
}
public function getObjectProperties(): void
{
$this->WashItemId = new object_property($this->table, $this->id, 'WashItemId', 'string', false);
$this->ExternalProductId = new object_property($this->table, $this->id, 'ExternalProductId', 'string', false);
$this->ExternalProductName = new object_property($this->table, $this->id, 'ExternalProductName', 'string', false);
$this->OriginalProductName = new object_property($this->table, $this->id, 'OriginalProductName', 'string', false);
$this->Unit = new object_property($this->table, $this->id, 'Unit', 'string', false);
$this->UnitPrice = new object_property($this->table, $this->id, 'UnitPrice', 'string', false);
$this->Count = new object_property($this->table, $this->id, 'Count', 'string', false);
$this->Discount = new object_property($this->table, $this->id, 'Discount', 'string', false);
$this->PriceExVat = new object_property($this->table, $this->id, 'PriceExVat', 'string', false);
$this->Vat = new object_property($this->table, $this->id, 'Vat', 'string', false);
$this->PriceIncVat = new object_property($this->table, $this->id, 'PriceIncVat', 'string', false);
}
public function objectChanged(): void
{
//TODO: Add cache invalidation
}
}