<?php
namespace MedBrief\MSR\Entity\Embeddable;
use Doctrine\ORM\Mapping as ORM;
use MedBrief\MSR\Entity\BillingItem;
/**
* BillingItemPrice
*
* @ORM\Embeddable
*/
class BillingItemPrice
{
// Unit options
public const UNIT_MINUTES = 1;
public const UNIT_MATTER = 2;
public const UNIT_PAGE = 3;
public const UNIT_DISC = 4;
public const UNIT_CENTRE = 5;
public const UNIT_METRE = 6;
public const UNIT_FILM = 7;
public const UNIT_DISBURSEMENT = 8;
public const UNIT_XRAY = 9;
public const UNIT_UNIT = 10;
public const UNIT_HOUR = 11;
public const UNIT_BATCH = 12;
public const UNIT_CLIENT = 13;
public const UNIT_INVOICE = 14;
public const UNIT_CHRONOLOGY = 15;
public const UNIT_ITEM = 16;
/**
* @var string
*
* @ORM\Column(name="amount", type="decimal", precision=7, scale=2)
*/
protected $amount;
/**
* @var string
*
* @ORM\Column(name="unit", type="string")
*/
protected $unit;
/**
* @var string
*
* @ORM\Column(name="unitDescription", type="string")
*/
protected $unitDescription;
/**
* @var int
*
* @ORM\Column(name="unitQuantity", type="integer")
*/
protected $unitQuantity;
/**
* @var bool
*
* @ORM\Column(name="vatInclusive", type="boolean", options={"default"=false})
*/
protected $vatInclusive;
/**
* Option to hide this billing item from invoices.
*
* @var bool
*
* @ORM\Column(name="hideFromInvoice", type="boolean")
*/
protected $hideFromInvoice;
/**
* Constructor
*/
public function __construct()
{
// Assign default values to booleans
$this->vatInclusive = false;
$this->hideFromInvoice = false;
}
/**
* __toString
*
* @return string
*/
public function __toString()
{
return (string) '£' . $this->amount . ' per ' . $this->getUnitDescription();
}
/**
* Set amount
*
* @param string $amount
*
* @return self
*/
public function setAmount($amount)
{
$this->amount = $amount;
return $this;
}
/**
* Get amount
*
* @return string
*/
public function getAmount()
{
return $this->amount;
}
/**
* Set unit
*
* @param string $unit
*
* @return self
*/
public function setUnit($unit)
{
$this->unit = $unit;
return $this;
}
/**
* Get unit
*
* @return string
*/
public function getUnit()
{
return $this->unit;
}
/**
* Get unit options
*
* @return string
*/
public static function getUnitOptions()
{
return [
self::UNIT_MINUTES => 'Minutes',
self::UNIT_MATTER => 'Matter',
self::UNIT_PAGE => 'Page',
self::UNIT_DISC => 'Disc',
self::UNIT_CENTRE => 'Centre',
self::UNIT_METRE => 'Metre',
self::UNIT_FILM => 'Film',
self::UNIT_DISBURSEMENT => 'Disbursement',
self::UNIT_XRAY => 'Xray',
self::UNIT_UNIT => 'Unit',
self::UNIT_HOUR => 'Hour',
self::UNIT_BATCH => 'Batch',
self::UNIT_CLIENT => 'Client',
self::UNIT_INVOICE => 'Invoice',
self::UNIT_CHRONOLOGY => 'Chronology',
self::UNIT_ITEM => 'Item',
];
}
/**
* Get unit label
*
* @return string
*/
public function getUnitLabel()
{
$options = self::getUnitOptions();
return $options[$this->getUnit()] ?? '';
}
/**
* Set unitDescription
*
* @param string $unitDescription
*
* @return self
*/
public function setUnitDescription($unitDescription)
{
$this->unitDescription = $unitDescription;
return $this;
}
/**
* Get unitDescription
*
* @return string
*/
public function getUnitDescription()
{
return $this->unitDescription;
}
/**
* Set unitQuantity
*
* @param int $unitQuantity
*
* @return self
*/
public function setUnitQuantity($unitQuantity)
{
$this->unitQuantity = $unitQuantity;
return $this;
}
/**
* Get unitQuantity
*
* @return int
*/
public function getUnitQuantity()
{
return $this->unitQuantity;
}
/**
* Set vatInclusive
*
* @param bool $vatInclusive
*
* @return BillingItemPrice
*/
public function setVatInclusive($vatInclusive)
{
$this->vatInclusive = $vatInclusive;
return $this;
}
/**
* Get vatInclusive
*
* @return bool
*/
public function getVatInclusive()
{
return $this->vatInclusive;
}
/**
* Get vatInclusiveLabel
*
* @return bool
*/
public function getVatInclusiveLabel()
{
return $this->vatInclusive ? 'Yes' : 'No';
}
/**
* Set hideFromInvoice
*
* @param bool $hideFromInvoice
*
* @return BillingItem
*/
public function setHideFromInvoice($hideFromInvoice)
{
$this->hideFromInvoice = $hideFromInvoice;
return $this;
}
/**
* Get hideFromInvoice
*
* @return bool
*/
public function getHideFromInvoice()
{
return $this->hideFromInvoice;
}
/**
* Returns the label for the hideFromInvoice field.
*
* @return string
*/
public function getHideFromInvoiceLabel()
{
return $this->getHideFromInvoice() ? 'Yes' : 'No';
}
}