dbmsv4 init...3
This commit is contained in:
parent
ddb5b4f924
commit
ce3a3d0424
@ -24,10 +24,9 @@ abstract class CommonEntity extends Entity
|
||||
$field = constant("static::TITLE");
|
||||
return $this->attributes[$field] ?? "";
|
||||
}
|
||||
final public function getTitleByFormat(string $format, array $fields): string
|
||||
public function getCustomTitle(): string
|
||||
{
|
||||
$parameters = array_map(fn($field) => $this->attributes[$field], $fields);
|
||||
return sprintf($format, ...$parameters);
|
||||
return $this->getTitle();
|
||||
}
|
||||
public function getStatus(): string
|
||||
{
|
||||
|
||||
@ -25,6 +25,10 @@ class ServerPartEntity extends EquipmentEntity
|
||||
return $this->attributes['serviceinfo_uid'] ?? null;
|
||||
}
|
||||
//기본기능용
|
||||
public function getCustomTitle(): string
|
||||
{
|
||||
return sprintf("%s*%d개[%s]", $this->getTitle(), $this->getCnt(), $this->getExtra());
|
||||
}
|
||||
public function getCalculatedAmount(): int
|
||||
{
|
||||
return $this->getAmount() * $this->getCnt();
|
||||
|
||||
@ -27,7 +27,7 @@ abstract class PartEntity extends CommonEntity
|
||||
//기본기능용
|
||||
public function getCustomTitle(mixed $title = null): string
|
||||
{
|
||||
return sprintf("%s %s원", $title ? $title : $this->getTitle(), number_format($this->getPrice() . "원"));
|
||||
return sprintf("%s %s원", $title ? $title : $this->getTitle(), number_format($this->getPrice()));
|
||||
}
|
||||
final public function getPrice(): int
|
||||
{
|
||||
|
||||
@ -22,6 +22,10 @@ class PaymentEntity extends CommonEntity
|
||||
return $this->attributes['serviceinfo_uid'] ?? null;
|
||||
}
|
||||
//기본기능
|
||||
public function getCustomTitle(): string
|
||||
{
|
||||
return sprintf("%s %s [%s]", $this->getTitle(), $this->getAmount(), $this->getBillingAt());
|
||||
}
|
||||
public function getBilling(): string
|
||||
{
|
||||
return $this->attributes['billing'];
|
||||
|
||||
@ -21,6 +21,7 @@ class ServerPartModel extends EquipmentModel
|
||||
"title",
|
||||
"type",
|
||||
"billing",
|
||||
"billing_at",
|
||||
"amount",
|
||||
"cnt",
|
||||
"extra",
|
||||
|
||||
@ -254,7 +254,7 @@ class ServerService extends EquipmentService
|
||||
if (!$serviceEntity instanceof ServiceEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getServiceInfoUID()}에 해당하는 서비스정보을 찾을수 없습니다.");
|
||||
}
|
||||
service('customer_serviceservice')->updateAmount($entity);
|
||||
service('customer_serviceservice')->updateAmount($serviceEntity);
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ abstract class PartType1Service extends PartService
|
||||
$entity = $this->getPartEntityByServerPart($serverPartEntity);
|
||||
//파트정보의 사용가능한 갯수 , 사용갯수 비교
|
||||
if ($entity->getAvailable() < $serverPartEntity->getCnt()) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용가능 갯수[{$entity->getAvailable()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 {$entity->getTitle()}는 사용가능 갯수[{$entity->getAvailable()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||
}
|
||||
$formDatas['used'] = $entity->getUsed() + $serverPartEntity->getCnt();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
@ -35,7 +35,7 @@ abstract class PartType1Service extends PartService
|
||||
$entity = $this->getPartEntityByServerPart($serverPartEntity);
|
||||
//파트정보의 사용된 갯수 , 회수용 갯수 비교
|
||||
if ($entity->getUsed() < $serverPartEntity->getCnt()) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용된 갯수[{$entity->getUsed()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 {$entity->getTitle()}는 사용된 갯수[{$entity->getUsed()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||
}
|
||||
$formDatas['used'] = $entity->getUsed() - $serverPartEntity->getCnt();
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
|
||||
@ -342,12 +342,13 @@ class PaymentService extends CommonService
|
||||
}
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||
$formDatas["clientinfo_uid"] = $serverPartEntity->getClientInfoUID();
|
||||
$formDatas["serverpartinfo_uid"] = $serverPartEntity->getPK();
|
||||
$formDatas['amount'] = $serverPartEntity->getAmount();
|
||||
$formDatas['billing'] = $formDatas['billing'] ?? PAYMENT['BILLING']['ONETIME'];
|
||||
$formDatas['billing_at'] = $serverPartEntity->getBillingAt();
|
||||
$formDatas['pay'] = $formDatas['pay'] ?? PAYMENT['PAY']['ACCOUNT'];
|
||||
$formDatas['status'] = $formDatas['status'] ?? STATUS['UNPAID'];
|
||||
$formDatas['title'] = sprintf("%s 일회성비용", $formDatas['title'] ?? $serverPartEntity->getTitle());
|
||||
$formDatas['title'] = sprintf("%s 일회성비용", $formDatas['title'] ?? $serverPartEntity->getCustomTitle());
|
||||
return $formDatas;
|
||||
}
|
||||
public function createByServerPart(ServerPartEntity $serverPartEntity): PaymentEntity
|
||||
@ -356,6 +357,7 @@ class PaymentService extends CommonService
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서비스정보가 정의되지 않아 일회성 상품을 설정하실수 없습니다.");
|
||||
}
|
||||
$formDatas = $this->getFormDatasFromServerPart($serverPartEntity);
|
||||
$this->action_init_process('create', $formDatas);
|
||||
return parent::create_process($formDatas);
|
||||
}
|
||||
public function modifyByServerPart(ServerPartEntity $oldServerPartEntity, ServerPartEntity $serverPartEntity): PaymentEntity
|
||||
@ -367,7 +369,7 @@ class PaymentService extends CommonService
|
||||
$entity = $this->getEntity([
|
||||
'serverpartinfo_uid' => $oldServerPartEntity->getPK(),
|
||||
'serviceinfo_uid' => $oldServerPartEntity->getServiceInfoUID(),
|
||||
'billing' => PAYMENT['BILLING']['ONETIME'],
|
||||
'billing' => $oldServerPartEntity->getBilling(),
|
||||
'billing_at' => $oldServerPartEntity->getBillingAt(),
|
||||
'status' => STATUS['UNPAID']
|
||||
]);
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<?php foreach ($partCellDatas['entities'] as $entity): ?>
|
||||
<?php $partCellDatas['entity'] = $entity; ?>
|
||||
<tr>
|
||||
<td class="text-end text-nowrap"><?= $partCellDatas['helper']->getListButton('modify', $entity->getTitle(), $partCellDatas) ?><< /td>
|
||||
<td class="text-end text-nowrap"><?= $partCellDatas['helper']->getListButton('modify', $entity->getTitle(), $partCellDatas) ?></td>
|
||||
<td class="text-center text-nowrap"><?= $entity->getUsed() ?></td>
|
||||
<td class="text-center text-nowrap"><?= $entity->getAvailable() ?></td>
|
||||
<td class="text-center text-nowrap"><?= $entity->getStock() ?></td>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<th class="text-end m-0 p-0" width="15%"><?= $serverPartCellDatas['helper']->getListButton($type, '', $serverPartCellDatas) ?></th>
|
||||
<td class="text-start m-0 p-0">
|
||||
<?php foreach ($htmls[$type] as $html): ?>
|
||||
<?= $html['view'] ?>[<?= number_format($html['amount']) ?>원]<a href="/admin/equipment/serverpart/delete/<?= $html['entity']->getPK() ?>">❌</a><BR>
|
||||
<?= $html['view'] ?>[<?= number_format($html['amount']) ?>원]<?= $html['entity']->getBilling() == PAYMENT['BILLING']['BASE'] ? "" : "<a href=\"/admin/equipment/serverpart/delete/{$html['entity']->getPK()}\">❌</a>" ?><BR>
|
||||
<?php endforeach ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user