dbmsv2/app/Entities/Customer/PaymentEntity.php
2025-08-19 15:07:14 +09:00

68 lines
1.8 KiB
PHP

<?php
namespace App\Entities\Customer;
use App\Models\Customer\PaymentModel;
use DateTime;
class PaymentEntity extends CustomerEntity
{
const PK = PaymentModel::PK;
const TITLE = PaymentModel::TITLE;
const STATUS_UNPAID = "unpaid";
const STATUS_PAID = "paid";
//관리자정보객체
final public function getUserUID(): int
{
return intval($this->attributes['user_uid']);
}
final public function getClientCode(): int
{
return intval($this->attributes['clientinfo_code']);
}
final public function getServiceCode(): int
{
return intval($this->attributes['serviceinfo_code']);
}
//타 객체정의 부분
public function getItemType(): string
{
return $this->attributes['item_type'];
}
public function getIsOnetime(): int
{
return intval($this->attributes['isOnetime']);
}
public function getAmount(): int
{
return intval($this->attributes['amount']);
}
public function getBillingAt(): string
{
return $this->attributes['billing_at'];
}
public function getPayMethod(): string
{
return $this->attributes['pay_method'];
}
public function getCountDueAt(): string
{
$result = "";
if ($this->getStatus() === DEFAULTS['STATUS']) {
$now = new DateTime(); // 오늘 날짜
$due = new DateTime($this->getBillingAt());
if ($due < $now) {
$interval = $due->diff($now);
$result = "{$interval->days}일지남";
} else if ($due > $now) {
$interval = $now->diff($due);
$day = $interval->days + 1;
$result = "{$day}일전";
} else {
$result = "당일";
}
}
return $result;
}
}