feat(patients): service quantity in visit session

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-23 22:13:51 +03:30
co-authored by Claude Opus 4.8
parent f41314a3ad
commit 0e6111f1be
5 changed files with 67 additions and 17 deletions
+9 -1
View File
@@ -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,
];
}