dbmsv2 init...1
This commit is contained in:
parent
740a8ce897
commit
7fb1a2b1d7
19
app/Cells/CommonCell.php
Normal file
19
app/Cells/CommonCell.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells;
|
||||
|
||||
use App\Services\CommonService;
|
||||
|
||||
abstract class CommonCell
|
||||
{
|
||||
protected $_service = null;
|
||||
|
||||
protected function __construct(CommonService $service)
|
||||
{
|
||||
$this->_service = $service;
|
||||
}
|
||||
final public function getService(): mixed
|
||||
{
|
||||
return $this->_service;
|
||||
}
|
||||
}
|
||||
15
app/Cells/Customer/CustomerCell.php
Normal file
15
app/Cells/Customer/CustomerCell.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Customer;
|
||||
|
||||
use App\Cells\CommonCell;
|
||||
use App\Services\CommonService;
|
||||
|
||||
abstract class CustomerCell extends CommonCell
|
||||
{
|
||||
|
||||
protected function __construct(CommonService $service)
|
||||
{
|
||||
parent::__construct($service);
|
||||
}
|
||||
}
|
||||
32
app/Cells/Customer/ServiceCell.php
Normal file
32
app/Cells/Customer/ServiceCell.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Customer;
|
||||
|
||||
use App\Services\Customer\PaymentService;
|
||||
use App\Services\Customer\ServiceService;
|
||||
|
||||
class ServiceCell extends CustomerCell
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new ServiceService());
|
||||
}
|
||||
|
||||
public function detail(array $params): string
|
||||
{
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
$entities = $this->getService()->getEntities(['clientinfo_uid' => $params['userinfo_uid']]);
|
||||
return view('cells/service/detail', [
|
||||
'cellDatas' => [
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'entities' => $entities,
|
||||
'paymentService' => new PaymentService()
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -118,8 +118,6 @@ class ClientController extends CustomerController
|
||||
$this->serviceEntities = $this->getService()->getServiceService()->getEntities(['clientinfo_uid' => $entity->getPK()]);
|
||||
$this->entity = $entity;
|
||||
helper(['form']);
|
||||
$this->serviceService = new ServiceService();
|
||||
$this->serverServicer = new ServerService();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
|
||||
@ -62,4 +62,8 @@ class ServiceEntity extends CustomerEntity
|
||||
{
|
||||
return $this->attributes['amount'] ?? 0;
|
||||
}
|
||||
public function getHistory(): string
|
||||
{
|
||||
return $this->attributes['history'] ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,17 +100,11 @@ class PaymentService extends CustomerService
|
||||
public function getUnPaids(string $group, array $where = []): array
|
||||
{
|
||||
$rows = $this->getModel()->groupBy($group)
|
||||
->select("{$group}, COUNT(uid) as cnt, SUM(amount) as amount")
|
||||
->select("COUNT(uid) as cnt, SUM(amount) as amount")
|
||||
->where(['billing_at <=' => date('Y-m-d')])
|
||||
->where(['status' => STATUS['UNPAID']])
|
||||
->where($where)
|
||||
->get()->getResult();
|
||||
$unpaids = [];
|
||||
foreach ($rows as $row) {
|
||||
$unpaids[$row->$group] = [];;
|
||||
$unpaids[$row->$group]['count'] = $row->cnt;
|
||||
$unpaids[$row->$group]['amount'] = $row->amount;
|
||||
}
|
||||
return $unpaids;
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,6 +199,8 @@ class ServiceService extends CustomerService
|
||||
) WHERE billing_at = ? AND status = ?";
|
||||
return $this->getModel()->query($sql, [$billing_at, $status]);
|
||||
}
|
||||
//기본기능
|
||||
|
||||
//서버정보 상태설정용
|
||||
private function setServer_process(ServiceEntity $entity, mixed $serverinfo_uid, string $status): ServiceEntity
|
||||
{
|
||||
|
||||
@ -55,87 +55,29 @@
|
||||
<td><?= $viewDatas['entity']->getAccountBalance() ?></td>
|
||||
<td><?= array_key_exists($viewDatas['entity']->getPK(), $viewDatas['totalAmounts']) ? number_format($viewDatas['totalAmounts'][$viewDatas['entity']->getPK()]) : 0 ?></td>
|
||||
<td><?= array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids']) ? number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount']) : 0 ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="row align-items-center rounded border border-gray p-2 mt-3">
|
||||
<div class="col-1">
|
||||
<div class="text-center fw-bold">고객 비고</div>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<textarea class="form-control note-box"><?= nl2br($viewDatas['entity']->getHistory()) ?></textarea>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<button class="btn btn-primary">저장</button>
|
||||
</div>
|
||||
</div>
|
||||
<?= view_cell("\App\Cells\Customer\ServiceCell::detail", ['userinfo_uid' => $viewDatas['entity']->getPK()]) ?>
|
||||
</div>
|
||||
<!-- index_body -->
|
||||
</div>
|
||||
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
||||
<!-- Layout Right End -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="row align-items-center rounded border border-gray p-2 mt-3">
|
||||
<div class="col-1">
|
||||
<div class="text-center fw-bold">고객 비고</div>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<textarea class="form-control note-box"><?= nl2br($viewDatas['entity']->getHistory()) ?></textarea>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<button class="btn btn-primary">저장</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php foreach ($viewDatas['serviceEntities'] as $serviceEntity): ?>
|
||||
<div class="row align-items-end rounded border border-gray p-2 mt-3">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<tr class="text-center">
|
||||
<th><a href="#">[상세정보]</a></th>
|
||||
<th>사이트</th>
|
||||
<th>위치</th>
|
||||
<th>형식</th>
|
||||
<th>CPU</th>
|
||||
<th>메모리</th>
|
||||
<th>저장장치</th>
|
||||
<th>OS</th>
|
||||
<th>SOFTWARE</th>
|
||||
<th>IP주소</th>
|
||||
<th>CS</th>
|
||||
<th>결제처리</th>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td rowspan="4">
|
||||
<div><?= $serviceEntity->getCode() ?></div>
|
||||
<div><?= $serviceEntity->getServerEntity()->getCode() ?></div>
|
||||
</td>
|
||||
<td><?= $viewDatas['serviceService']->getHelper()->getFieldView('site', $serviceEntity->getSite(), $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['serviceService']->getHelper()->getFieldView('location', $serviceEntity->getLocation(), $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['serviceService']->getHelper()->getFieldView('type', $serviceEntity->getType(), $viewDatas) ?></td>
|
||||
<td>CPU</td>
|
||||
<td>메모리</td>
|
||||
<td>저장장치</td>
|
||||
<td>OS</td>
|
||||
<th>SOFTWARE</th>
|
||||
<th>IP주소</th>
|
||||
<th>CS</th>
|
||||
<td rowspan="4">
|
||||
<table class="table">
|
||||
<tr class="text-center">
|
||||
<th class="text-start fw-bold">결제일</th>
|
||||
<td>2025-09-11</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-start fw-bold">결제금</th>
|
||||
<td class="amount-green">500,000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-start fw-bold">미납금</th>
|
||||
<td class="amount-red">500,000</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="10">서비스 비고</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="10">서비스 비고</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<!-- index_body -->
|
||||
</div>
|
||||
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
||||
<!-- Layout Right End -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Layout Middle End -->
|
||||
<div class="layout_bottom"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?></div>
|
||||
<?= $this->endSection() ?>
|
||||
60
app/Views/cells/service/detail.php
Normal file
60
app/Views/cells/service/detail.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php foreach ($cellDatas['entities'] as $entity): ?>
|
||||
<?php $cellDatas['entity'] = $entity ?>
|
||||
<?php $unpaids = $cellDatas['paymentService']->getUnPaids('serviceinfo_uid', ['serviceinfo_uid' => $entity->getPK()]) ?>
|
||||
<div class="row align-items-end rounded border border-gray p-2 mt-3">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<tr class="text-center">
|
||||
<th><a href="#">[상세정보]</a></th>
|
||||
<th>사이트</th>
|
||||
<th>위치</th>
|
||||
<th>형식</th>
|
||||
<th>CPU</th>
|
||||
<th>메모리</th>
|
||||
<th>저장장치</th>
|
||||
<th>OS</th>
|
||||
<th>SOFTWARE</th>
|
||||
<th>IP주소</th>
|
||||
<th>CS</th>
|
||||
<th>결제처리</th>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td rowspan="4">
|
||||
<div><?= $entity->getCode() ?></div>
|
||||
<div><?= $entity->getServerEntity()->getCode() ?></div>
|
||||
</td>
|
||||
<td><?= $cellDatas['service']->getHelper()->getFieldView('site', $entity->getSite(), $cellDatas) ?></td>
|
||||
<td><?= $cellDatas['service']->getHelper()->getFieldView('location', $entity->getLocation(), $cellDatas) ?></td>
|
||||
<td><?= $cellDatas['service']->getHelper()->getFieldView('type', $entity->getType(), $cellDatas) ?></td>
|
||||
<td><?= $cellDatas['service']->getHelper()->getFieldView('CPU', "", $cellDatas) ?></td>
|
||||
<td><?= $cellDatas['service']->getHelper()->getFieldView('RAM', "", $cellDatas) ?></td>
|
||||
<td><?= $cellDatas['service']->getHelper()->getFieldView('DISK', "", $cellDatas) ?></td>
|
||||
<td><?= $cellDatas['service']->getHelper()->getFieldView('OS', "", $cellDatas) ?></td>
|
||||
<td><?= $cellDatas['service']->getHelper()->getFieldView('SOFTWARE', "", $cellDatas) ?></td>
|
||||
<td><?= $cellDatas['service']->getHelper()->getFieldView('IP', "", $cellDatas) ?></td>
|
||||
<td><?= $cellDatas['service']->getHelper()->getFieldView('CS', "", $cellDatas) ?></td>
|
||||
<td rowspan="4">
|
||||
<table class="table">
|
||||
<tr class="text-center">
|
||||
<th class="text-start fw-bold">결제일</th>
|
||||
<td><?= $entity->getBillingAT() ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-start fw-bold">결제금</th>
|
||||
<td class="amount-green"><?= number_format(intval($entity->getBillingAT())) ?>원</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-start fw-bold">미납금</th>
|
||||
<td class="amount-red"><?= array_key_exists('amount', $unpaids) ? number_format($unpaids['amount']) : 0 ?>원</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="10">서비스 비고</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="10"><?= nl2br($entity->getHistory()) ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
Loading…
Reference in New Issue
Block a user