dbmsv2/app/Services/Customer/PaymentService.php
2025-09-03 18:03:04 +09:00

104 lines
2.6 KiB
PHP

<?php
namespace App\Services\Customer;
use App\Entities\Customer\PaymentEntity;
use App\Models\Customer\PaymentModel;
class PaymentService extends CustomerService
{
public function __construct()
{
parent::__construct(new PaymentModel());
$this->addClassName('Payment');
}
public function getModelClass(): PaymentModel
{
return new PaymentModel();
}
public function getEntityClass(): PaymentEntity
{
return new PaymentEntity();
}
public function getFormFields(): array
{
return [
"clientinfo_uid",
"serviceinfo_uid",
"title",
"amount",
"billing",
"billing_at",
"pay",
"status",
];
}
public function getFormFilters(): array
{
return [
'clientinfo_uid',
'billing',
'pay',
'status',
'user_uid',
];
}
public function getIndexFields(): array
{
return [
'clientinfo_uid',
'billing',
'title',
'amount',
'billing_at',
'pay',
'status',
'updated_at',
'countdown',
'user_uid',
];
}
public function getBatchjobFields(): array
{
return ['clientinfo_uid', 'billing', 'pay', 'status'];
}
public function getBatchjobButtons(): array
{
return [
'invoice' => '청구서 발행',
];
}
//기본 기능부분
//FieldForm관련용
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'user_uid':
$options = $this->getUserService()->getEntities();
break;
case 'clientinfo_uid':
$options = $this->getClientService()->getEntities();
break;
case 'serviceinfo_uid':
$options = $this->getServiceService()->getEntities();
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
return $options;
}
//List 검색용
//OrderBy 처리
public function setOrderBy(mixed $field = null, mixed $value = null): void
{
$this->getModel()->orderBy('billing_at ASC');
parent::setOrderBy($field, $value);
}
//미납서비스 정보
final public function getUnPaidCount(string $checkDate = 'now', string $idx_field = "serviceinfo_uid"): array
{
return $this->getModel()->getUnPaidCount($checkDate, $idx_field);
}
}