dbmsv4 init...2

This commit is contained in:
최준흠 2025-12-02 19:30:39 +09:00
parent 2b83afd59f
commit 0e72ca6428

View File

@ -130,6 +130,22 @@ class PaymentService extends CommonService
$this->getFormService()->setBatchjobFilters($batchjobFilters);
$this->getFormService()->setBatchjobButtons($batchjobButtons);
}
//총 미납건수, 금액
final public function getUnPaids(string $group, array $where = []): array
{
$builder = $this->model->groupBy($group)
->select("{$group},COUNT(uid) as cnt, SUM(amount) as amount")
->where(['status' => STATUS['UNPAID']])
->where($where)
->builder();
// echo $builder->getCompiledSelect(false); //초기화 없이 SQL만 보고 싶을 때: getCompiledSelect(false) ← 꼭 false!
$unPaids = [];
foreach ($builder->get()->getResult() as $row) {
$unPaids[$row->$group] = ['cnt' => $row->cnt, 'amount' => $row->amount];
}
return $unPaids;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): PaymentEntity
{
@ -159,20 +175,28 @@ class PaymentService extends CommonService
parent::setSearchWord($word);
}
//추가기능
//총 미납건수, 금액
final public function getUnPaids(string $group, array $where = []): array
//일회성 입력용
protected function create_process(array $formDatas): PaymentEntity
{
$builder = $this->model->groupBy($group)
->select("{$group},COUNT(uid) as cnt, SUM(amount) as amount")
->where(['status' => STATUS['UNPAID']])
->where($where)
->builder();
// echo $builder->getCompiledSelect(false); //초기화 없이 SQL만 보고 싶을 때: getCompiledSelect(false) ← 꼭 false!
$unPaids = [];
foreach ($builder->get()->getResult() as $row) {
$unPaids[$row->$group] = ['cnt' => $row->cnt, 'amount' => $row->amount];
if (!array_key_exists('serviceinfo_uid', $formDatas)) {
throw new RuntimeException(__METHOD__ . "에서 오류발생: 서비스가 정의되지 않았습니다.");
}
return $unPaids;
$serviceEntity = service('customer_serviceservice')->getEntity($formDatas['serviceinfo_uid']);
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
$entity = parent::create_process($formDatas);
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
}
return $entity;
}
protected function modify_process($entity, array $formDatas): PaymentEntity
{
$entity = parent::modify_process($entity, $formDatas);
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
}
return $entity;
}
//청구서 관련