feat(patients): service quantity in visit session
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -35,16 +35,20 @@ class SessionService
|
||||
#[ORM\Column(name: 'price_rials', type: 'integer')]
|
||||
private int $priceRials;
|
||||
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private int $quantity = 1;
|
||||
|
||||
#[ORM\Column(name: 'created_at', type: 'integer')]
|
||||
private int $createdAt;
|
||||
|
||||
public function __construct(PatientSession $session, ServiceItem $serviceItem, ?ClinicStaff $staff = null)
|
||||
public function __construct(PatientSession $session, ServiceItem $serviceItem, ?ClinicStaff $staff = null, int $quantity = 1)
|
||||
{
|
||||
$this->uuid = Uuid::v4()->toRfc4122();
|
||||
$this->session = $session;
|
||||
$this->serviceItem = $serviceItem;
|
||||
$this->staff = $staff;
|
||||
$this->priceRials = $serviceItem->getPriceRials();
|
||||
$this->quantity = max(1, $quantity);
|
||||
$this->createdAt = time();
|
||||
}
|
||||
|
||||
@@ -54,6 +58,8 @@ class SessionService
|
||||
public function getServiceItem(): ServiceItem { return $this->serviceItem; }
|
||||
public function getStaff(): ?ClinicStaff { return $this->staff; }
|
||||
public function getPriceRials(): int { return $this->priceRials; }
|
||||
public function getQuantity(): int { return $this->quantity; }
|
||||
public function getLineTotalRials(): int { return $this->priceRials * $this->quantity; }
|
||||
public function getCreatedAt(): int { return $this->createdAt; }
|
||||
|
||||
public function toArray(): array
|
||||
@@ -65,6 +71,8 @@ class SessionService
|
||||
'staff_uuid' => $this->staff?->getUuid(),
|
||||
'staff_name' => $this->staff?->getFullName(),
|
||||
'price_rials' => $this->priceRials,
|
||||
'quantity' => $this->quantity,
|
||||
'line_total_rials' => $this->getLineTotalRials(),
|
||||
'created_at' => $this->createdAt,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user