dbmsv2_init...1
This commit is contained in:
parent
2dc1419880
commit
173858e229
@ -40,4 +40,18 @@ class ServiceCell extends CustomerCell
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
//서비스 방식에 따른 서비스별 Count
|
||||
final public function totalCountDashboard(array $params): string
|
||||
{
|
||||
$totalCounts = $this->getService()->getTotalServiceCount(array_key_exists('where', $params) ? $params['where'] : []);
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
||||
return view('cells/service/' . $template, [
|
||||
'serviceCellDatas' => [
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'totalCounts' => $totalCounts,
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ class ClientController extends CustomerController
|
||||
if (!$entity instanceof ClientEntity) {
|
||||
throw new \Exception("{$uid}에 해당하는 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->totalCounts = $this->getService()->getServiceService()->getTotalCountsBySite(['clientinfo_uid' => $entity->getPK()]);
|
||||
$this->totalCounts = $this->getService()->getServiceService()->getTotalServiceCount(['clientinfo_uid' => $entity->getPK()]);
|
||||
$this->totalAmounts = $this->getService()->getServiceService()->getTotalAmounts([
|
||||
'clientinfo_uid' => $entity->getPK(),
|
||||
'status' => STATUS['AVAILABLE']
|
||||
|
||||
@ -69,7 +69,6 @@ class Home extends AdminController
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
//Total 서버 현황
|
||||
$this->totalCounts = $this->getService()->getTotalCountsBySite();
|
||||
//interval을 기준으로 최근 신규 서비스정보 가져오기
|
||||
$this->interval = intval($this->request->getVar('interval') ?? SERVICE['NEW_INTERVAL']);
|
||||
$this->newServiceEntities = $this->getService()->getEntitiesByNewService($this->interval);
|
||||
|
||||
@ -18,6 +18,10 @@ class ClientEntity extends CustomerEntity
|
||||
{
|
||||
return $this->attributes['name'] ?? "";
|
||||
}
|
||||
public function getSite(): string
|
||||
{
|
||||
return $this->attributes['site'] ?? "";
|
||||
}
|
||||
public function getRole(): string
|
||||
{
|
||||
return $this->attributes['role'] ?? "";
|
||||
|
||||
@ -137,14 +137,12 @@ class ServiceService extends CustomerService
|
||||
}
|
||||
return $this->_serverPartService;
|
||||
}
|
||||
//create용 서비스코드 마지막번호 가져오기
|
||||
//interval을 기준으로 최근 신규 서비스정보 가져오기
|
||||
final public function getEntitiesByNewService(int $interval, string $status = ServiceEntity::DEFAULT_STATUS): array
|
||||
{
|
||||
return $this->getEntities(sprintf("start_at >= NOW()-INTERVAL {$interval} DAY AND status = '%s'", $status));
|
||||
}
|
||||
//서비스 방식에 따른 서비스별 Count
|
||||
final public function getTotalCountsBySite(array $where = []): array
|
||||
final public function getTotalServiceCount(array $where = []): array
|
||||
{
|
||||
$rows = $this->getModel()->groupBy(['site', 'type'])->select("site,type,
|
||||
COUNT(CASE WHEN location = 'chiba' THEN 1 END) AS chiba,
|
||||
@ -152,7 +150,7 @@ class ServiceService extends CustomerService
|
||||
COUNT(CASE WHEN location IN ('chiba', 'tokyo') THEN 1 END) AS summary")
|
||||
->where($where)
|
||||
->get()->getResult();
|
||||
// dd($rows);
|
||||
|
||||
$totalCounts = [
|
||||
'normal' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0],
|
||||
'defence' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0],
|
||||
@ -191,6 +189,7 @@ class ServiceService extends CustomerService
|
||||
// dd($totalCounts);
|
||||
return $totalCounts;
|
||||
}
|
||||
|
||||
//서비스별 총 금액
|
||||
final public function getTotalAmounts($where = []): array
|
||||
{
|
||||
|
||||
@ -50,15 +50,15 @@
|
||||
<th>전체미납금</th>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td><?= $viewDatas['totalCounts']['tokyo_total'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts']['chiba_total'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts']['vpn']['total'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts']['normal']['total'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts']['defence']['total'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts']['dedicated']['total'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts']['event']['total'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts']['test']['total'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts']['alternative']['total'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['tokyo_summary'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['chiba_summary'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['vpn']['summary'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['normal']['summary'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['defence']['summary'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['dedicated']['summary'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['event']['summary'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['test']['summary'] ?></td>
|
||||
<td><?= $viewDatas['totalCounts'][$viewDatas['entity']->getSite()]['alternative']['summary'] ?></td>
|
||||
<td><?= $viewDatas['entity']->getCouponBalance() ?>%</td>
|
||||
<td><?= $viewDatas['entity']->getSaleRate() ?>%</td>
|
||||
<td><?= $viewDatas['entity']->getAccountBalance() ?></td>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<?= $this->include("{$viewDatas['layout']}/welcome/banner"); ?>
|
||||
<div class="row align-items-start mt-3">
|
||||
<div class="col-8">
|
||||
<?= $this->include("{$viewDatas['layout']}/welcome/total_service"); ?>
|
||||
<?= view_cell("\App\Cells\Customer\ServiceCell::totalCountDashboard") ?>>
|
||||
<?= $this->include("{$viewDatas['layout']}/welcome/new_service"); ?>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<table class="table table-bordered table-hover align-middle">
|
||||
<thead class="table-light">
|
||||
<tr class="text-center">
|
||||
<th>서비스코드</th>
|
||||
<th>사이트</th>
|
||||
<th>업체명</th>
|
||||
<th>구분</th>
|
||||
<th>
|
||||
@ -25,15 +25,15 @@
|
||||
<?php foreach ($viewDatas['newServiceEntities'] as $entity): ?>
|
||||
<?php $viewDatas['entity'] = $entity ?>
|
||||
<tr class="text-center">
|
||||
<td><?= $entity->getCode() ?></td>
|
||||
<td><?= $viewDatas['service']->getHelper()->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['service']->getHelper()->getFieldView('type', $entity->getType(), $viewDatas) ?></td>
|
||||
<td><?= SITES[$entity->getSite()] ?></td>
|
||||
<td nowrap><?= $viewDatas['service']->getHelper()->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?></td>
|
||||
<td nowrap><?= $viewDatas['service']->getHelper()->getFieldView('type', $entity->getType(), $viewDatas) ?></td>
|
||||
<td><?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||
'serverinfo_uid' => $entity->getServerEntity()->getPK(),
|
||||
'types' => SERVERPART['SERVICE_PARTTYPES'],
|
||||
'template' => 'partlist_service'
|
||||
]) ?></td>
|
||||
<td><?= $viewDatas['service']->getHelper()->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?></td>
|
||||
<td nowrap><?= $viewDatas['service']->getHelper()->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
|
||||
75
app/Views/cells/service/totalCountDashboard.php
Normal file
75
app/Views/cells/service/totalCountDashboard.php
Normal file
@ -0,0 +1,75 @@
|
||||
<div class="layout_header">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<span class="nav-item navbar-brand" aria-current="page">
|
||||
<h4> <?= ICONS['CHART'] ?> 전체 서비스 현황 </h4>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="border-left: 1px solid black; border-right: 1px solid black; padding:20px;">
|
||||
<table class="table table-bordered table-hover align-middle">
|
||||
<tr class="text-center">
|
||||
<th rowspan="2">고객명</th>
|
||||
<th colspan="2">일반</th>
|
||||
<th colspan="2">방어</th>
|
||||
<th colspan="2">전용</th>
|
||||
<th colspan="2">대체</th>
|
||||
<th colspan="3">테스트</th>
|
||||
<th colspan="3">합계</th>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<th>도쿄</th>
|
||||
<th>치바</th>
|
||||
<th>도쿄</th>
|
||||
<th>치바</th>
|
||||
<th>도쿄</th>
|
||||
<th>치바</th>
|
||||
<th>도쿄</th>
|
||||
<th>치바</th>
|
||||
<th>도쿄</th>
|
||||
<th>치바</th>
|
||||
<th>합계</th>
|
||||
<th>도쿄</th>
|
||||
<th>치바</th>
|
||||
<th>합계</th>
|
||||
</tr>
|
||||
<?php foreach (SITES as $key => $label): ?>
|
||||
<tr class="text-center">
|
||||
<td><?= $label ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['normal']['tokyo'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['normal']['chiba'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['defence']['tokyo'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['defence']['chiba'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['dedicated']['tokyo'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['dedicated']['chiba'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['alternative']['tokyo'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['alternative']['chiba'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['test']['tokyo'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['test']['chiba'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['test']['summary'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['tokyo_summary'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['chiba_summary'] ?></td>
|
||||
<td><?= $serviceCellDatas['totalCounts'][$key]['all_summary'] ?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<tr class="text-center">
|
||||
<td>총합계</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="layout_footer"></div>
|
||||
Loading…
Reference in New Issue
Block a user