diff --git a/app/Cells/Customer/ServiceCell.php b/app/Cells/Customer/ServiceCell.php index b19076c..fb4b830 100644 --- a/app/Cells/Customer/ServiceCell.php +++ b/app/Cells/Customer/ServiceCell.php @@ -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, + ] + ]); + } } diff --git a/app/Controllers/Admin/Customer/ClientController.php b/app/Controllers/Admin/Customer/ClientController.php index 9daff83..980bdc8 100644 --- a/app/Controllers/Admin/Customer/ClientController.php +++ b/app/Controllers/Admin/Customer/ClientController.php @@ -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'] diff --git a/app/Controllers/Admin/Home.php b/app/Controllers/Admin/Home.php index 8d7e54e..0fa1c65 100644 --- a/app/Controllers/Admin/Home.php +++ b/app/Controllers/Admin/Home.php @@ -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); diff --git a/app/Entities/Customer/ClientEntity.php b/app/Entities/Customer/ClientEntity.php index 0078905..eb1ca72 100644 --- a/app/Entities/Customer/ClientEntity.php +++ b/app/Entities/Customer/ClientEntity.php @@ -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'] ?? ""; diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index 0bf150e..f96d17a 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -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 { diff --git a/app/Views/admin/client/detail.php b/app/Views/admin/client/detail.php index 6c852c6..184e665 100644 --- a/app/Views/admin/client/detail.php +++ b/app/Views/admin/client/detail.php @@ -50,15 +50,15 @@ 전체미납금 - - - - - - - - - + getSite()]['tokyo_summary'] ?> + getSite()]['chiba_summary'] ?> + getSite()]['vpn']['summary'] ?> + getSite()]['normal']['summary'] ?> + getSite()]['defence']['summary'] ?> + getSite()]['dedicated']['summary'] ?> + getSite()]['event']['summary'] ?> + getSite()]['test']['summary'] ?> + getSite()]['alternative']['summary'] ?> getCouponBalance() ?>% getSaleRate() ?>% getAccountBalance() ?> diff --git a/app/Views/admin/welcome/index.php b/app/Views/admin/welcome/index.php index b137813..68b1b85 100644 --- a/app/Views/admin/welcome/index.php +++ b/app/Views/admin/welcome/index.php @@ -15,7 +15,7 @@ include("{$viewDatas['layout']}/welcome/banner"); ?>
- include("{$viewDatas['layout']}/welcome/total_service"); ?> + > include("{$viewDatas['layout']}/welcome/new_service"); ?>
diff --git a/app/Views/admin/welcome/new_service.php b/app/Views/admin/welcome/new_service.php index 3dff60e..2ab393b 100644 --- a/app/Views/admin/welcome/new_service.php +++ b/app/Views/admin/welcome/new_service.php @@ -11,7 +11,7 @@ - + - - - + + + - + diff --git a/app/Views/cells/service/totalCountDashboard.php b/app/Views/cells/service/totalCountDashboard.php new file mode 100644 index 0000000..ced3be9 --- /dev/null +++ b/app/Views/cells/service/totalCountDashboard.php @@ -0,0 +1,75 @@ +
+ +
+
+
서비스코드사이트 업체명 구분 @@ -25,15 +25,15 @@
getCode() ?>getHelper()->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?>getHelper()->getFieldView('type', $entity->getType(), $viewDatas) ?>getSite()] ?>getHelper()->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?>getHelper()->getFieldView('type', $entity->getType(), $viewDatas) ?> $entity->getServerEntity()->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], 'template' => 'partlist_service' ]) ?>getHelper()->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?>getHelper()->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?>
+ + + + + + + + + + + + + + + + + + + + + + + + + + $label): ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
고객명일반방어전용대체테스트합계
도쿄치바도쿄치바도쿄치바도쿄치바도쿄치바합계도쿄치바합계
총합계00000000000000
+
+ \ No newline at end of file