dbmsv3 init...1

This commit is contained in:
choi.jh 2025-10-15 14:02:42 +09:00
parent a36382ad18
commit 66fb3bdd2e
37 changed files with 241 additions and 135 deletions

View File

@ -3,8 +3,8 @@
namespace App\Controllers\Admin\Customer; namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\ClientEntity; use App\Entities\Customer\ClientEntity;
use App\Entities\PaymentEntity;
use App\Entities\Customer\ServiceEntity; use App\Entities\Customer\ServiceEntity;
use App\Entities\PaymentEntity;
use App\Services\Customer\ClientService; use App\Services\Customer\ClientService;
use App\Services\PaymentService; use App\Services\PaymentService;
use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RedirectResponse;
@ -74,40 +74,38 @@ class PaymentController extends CustomerController
throw new \Exception("청구서에 적용될 리스트를 선택하셔야합니다."); throw new \Exception("청구서에 적용될 리스트를 선택하셔야합니다.");
} }
$rows = []; $rows = [];
$clientEntities = [];
$serviceEntities = [];
foreach ($uids as $uid) { foreach ($uids as $uid) {
//기존 Entity 가져오기 //기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid); $entity = $this->getService()->getEntity($uid);
if (!$entity instanceof PaymentEntity) { if (!$entity instanceof PaymentEntity) {
throw new \Exception(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다."); throw new \Exception(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다.");
} }
if ($entity->getStatus() === STATUS['UNPAID']) { //미지급인경우 //지급기한일이 오늘보다 작거나 같고 미지급인경우
//entities에 고객 설정 if ($entity->getBillingAt() <= date("Y-m-d") && $entity->getStatus() === STATUS['UNPAID']) {
$clientEntity = $this->getClientService()->getEntity($entity->getClientInfoUID()); //고객 정보가져오기
if (!$clientEntity instanceof ClientEntity) { if (array_key_exists($entity->getClientInfoUID(), $clientEntities)) {
throw new \Exception(__METHOD__ . "에서 {$entity->getClientInfoUID()}에 대한 고객정보를 찾을수 없습니다."); $clientEntity = $clientEntities[$entity->getClientInfoUID()];
} else {
$clientEntity = $this->getClientService()->getEntity($entity->getClientInfoUID());
if (!$clientEntity instanceof ClientEntity) {
throw new \Exception(__METHOD__ . "에서 {$entity->getClientInfoUID()}에 대한 고객정보를 찾을수 없습니다.");
}
$clientEntities[$entity->getClientInfoUID()] = $clientEntity;
} }
if (!array_key_exists($clientEntity->getPK(), $rows)) { //서비스 정보가져오기
$rows[$clientEntity->getPK()] = [ if (array_key_exists($entity->getServiceInfoUid(), $serviceEntities)) {
'name' => $clientEntity->getName(), $serviceEntity = $serviceEntities[$entity->getServiceInfoUid()];
'total_amount' => 0, } else {
'services' => [], $serviceEntity = $this->getService()->getServiceService()->getEntity($entity->getServiceInfoUid());
]; if (!$serviceEntity instanceof ServiceEntity) {
throw new \Exception(__METHOD__ . "에서 {$entity->getServiceInfoUid()}에 대한 서비스정보를 찾을수 없습니다.");
}
$serviceEntities[$entity->getServiceInfoUid()] = $serviceEntity;
} }
//entities에 서비스 설정 //Invoice Data 가져오기
$serviceEntity = $this->getService()->getServiceService()->getEntity($entity->getServiceInfoUid()); $rows = $this->getService()->getInvoiceData($clientEntity, $serviceEntity, $entity, $rows);
if (!$serviceEntity instanceof ServiceEntity) {
throw new \Exception(__METHOD__ . "에서 {$entity->getServiceInfoUid()}에 대한 서비스정보를 찾을수 없습니다.");
}
if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) {
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
'code' => $serviceEntity->getCode(),
'billing_at' => $serviceEntity->getBillingAt(),
'items' => [],
];
}
//entities에 총 결제금액 설정
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()]['items'][] = ['title' => $entity->getTitle(), 'amount' => $entity->getAmount()];
$rows[$clientEntity->getPK()]['total_amount'] += $entity->getAmount();
} }
} }
// dd($rows); // dd($rows);

File diff suppressed because one or more lines are too long

View File

@ -31,10 +31,6 @@ abstract class CommonEntity extends Entity
{ {
return $this->getTitle(); return $this->getTitle();
} }
final public function getCode(): string
{
return $this->attributes['code'] ?? "";
}
public function getStatus(): string public function getStatus(): string
{ {
return $this->attributes['status'] ?? ""; return $this->attributes['status'] ?? "";

View File

@ -9,13 +9,17 @@ class AccountEntity extends CustomerEntity
const PK = AccountModel::PK; const PK = AccountModel::PK;
const TITLE = AccountModel::TITLE; const TITLE = AccountModel::TITLE;
const DEFAULT_STATUS = STATUS['DEPOSIT']; const DEFAULT_STATUS = STATUS['DEPOSIT'];
final public function getUserUID(): string final public function getUserUID(): int
{ {
return $this->attributes['user_uid']; return $this->attributes['user_uid'];
} }
final public function getClientInfoUID(): string final public function getClientInfoUID(): int
{ {
return $this->attributes['clientinfo_uid']; return $this->attributes['clientinfo_uid'];
} }
//기본기능 //기본기능
public function getContent(): string|null
{
return $this->attributes['content'];
}
} }

View File

@ -9,37 +9,45 @@ class ClientEntity extends CustomerEntity
const PK = ClientModel::PK; const PK = ClientModel::PK;
const TITLE = ClientModel::TITLE; const TITLE = ClientModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE']; const DEFAULT_STATUS = STATUS['AVAILABLE'];
final public function getUserUID(): string final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid']; return $this->attributes['user_uid'];
} }
//기본기능 //기본기능
public function getCustomTitle(string $field = ClientModel::TITLE): string
{
return sprintf("[%s]%s", $this->getCode(), $this->$field);
}
final public function getCode(): string
{
return $this->attributes['code'];
}
public function getName(): string public function getName(): string
{ {
return $this->attributes['name'] ?? ""; return $this->attributes['name'];
} }
public function getSite(): string public function getSite(): string
{ {
return $this->attributes['site'] ?? ""; return $this->attributes['site'];
} }
public function getRole(): string public function getRole(): string
{ {
return $this->attributes['role'] ?? ""; return $this->attributes['role'];
} }
public function getAccountBalance(): int public function getAccountBalance(): int
{ {
return $this->attributes['account_balance'] ?? 0; return $this->attributes['account_balance'];
} }
public function getCouponBalance(): int public function getCouponBalance(): int
{ {
return $this->attributes['coupon_balance'] ?? 0; return $this->attributes['coupon_balance'];
} }
public function getPointBalance(): int public function getPointBalance(): int
{ {
return $this->attributes['point_balance'] ?? 0; return $this->attributes['point_balance'];
} }
public function getHistory(): string public function getHistory(): string|null
{ {
return $this->attributes['history'] ?? ""; return $this->attributes['history'];
} }
} }

View File

@ -9,13 +9,17 @@ class CouponEntity extends CustomerEntity
const PK = CouponModel::PK; const PK = CouponModel::PK;
const TITLE = CouponModel::TITLE; const TITLE = CouponModel::TITLE;
const DEFAULT_STATUS = STATUS['DEPOSIT']; const DEFAULT_STATUS = STATUS['DEPOSIT'];
final public function getUserUID(): string final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid']; return $this->attributes['user_uid'];
} }
final public function getClientInfoUID(): string final public function getClientInfoUID(): int|null
{ {
return $this->attributes['clientinfo_uid']; return $this->attributes['clientinfo_uid'];
} }
//기본기능 //기본기능
public function getContent(): string|null
{
return $this->attributes['content'];
}
} }

View File

@ -9,13 +9,17 @@ class PointEntity extends CustomerEntity
const PK = PointModel::PK; const PK = PointModel::PK;
const TITLE = PointModel::TITLE; const TITLE = PointModel::TITLE;
const DEFAULT_STATUS = STATUS['DEPOSIT']; const DEFAULT_STATUS = STATUS['DEPOSIT'];
final public function getUserUID(): string final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid']; return $this->attributes['user_uid'];
} }
final public function getClientInfoUID(): string final public function getClientInfoUID(): int|null
{ {
return $this->attributes['clientinfo_uid']; return $this->attributes['clientinfo_uid'];
} }
//기본기능 //기본기능
public function getContent(): string|null
{
return $this->attributes['content'];
}
} }

View File

@ -4,7 +4,6 @@ namespace App\Entities\Customer;
use App\Entities\Equipment\ServerEntity; use App\Entities\Equipment\ServerEntity;
use App\Entities\PaymentEntity; use App\Entities\PaymentEntity;
use App\Entities\UserEntity;
use App\Models\Customer\ServiceModel; use App\Models\Customer\ServiceModel;
class ServiceEntity extends CustomerEntity class ServiceEntity extends CustomerEntity
@ -19,7 +18,7 @@ class ServiceEntity extends CustomerEntity
} }
final public function getServerEntity(): ServerEntity|null final public function getServerEntity(): ServerEntity|null
{ {
return $this->attributes['serverEntity'] ?? null; return $this->attributes['serverEntity'];
} }
final public function setPaymentEntity(PaymentEntity $entity): self final public function setPaymentEntity(PaymentEntity $entity): self
{ {
@ -28,66 +27,70 @@ class ServiceEntity extends CustomerEntity
} }
final public function getPaymentEntity(): PaymentEntity|null final public function getPaymentEntity(): PaymentEntity|null
{ {
return $this->attributes['paymentEntity'] ?? null; return $this->attributes['paymentEntity'];
} }
final public function getUserUID(): string final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid']; return $this->attributes['user_uid'];
} }
final public function getClientInfoUID(): string final public function getClientInfoUID(): int
{ {
return $this->attributes['clientinfo_uid']; return $this->attributes['clientinfo_uid'];
} }
final public function getServerInfoUID(): string final public function getServerInfoUID(): int
{ {
return $this->attributes['serverinfo_uid']; return $this->attributes['serverinfo_uid'];
} }
final public function getPaymentUID(): string|null final public function getPaymentUID(): string|null
{ {
return $this->attributes['payment_uid'] ?? null; return $this->attributes['payment_uid'];
} }
//기본기능용 //기본기능용
public function getCustomTitle(): string public function getCustomTitle(string $field = ServiceModel::TITLE): string
{ {
return sprintf("[%s] %s", $this->getCode(), $this->getServerEntity()->getTitle()); return sprintf("[%s]%s", $this->getCode(), $this->$field);
}
final public function getCode(): string
{
return $this->attributes['code'];
} }
final public function getSite(): string final public function getSite(): string
{ {
return $this->attributes['site'] ?? ""; return $this->attributes['site'];
} }
final public function getLocation(): string final public function getLocation(): string
{ {
return $this->attributes['location'] ?? ""; return $this->attributes['location'];
} }
final public function getBillingAt(): string final public function getBillingAt(): string
{ {
return $this->attributes['billing_at'] ?? ""; return $this->attributes['billing_at'];
} }
//청구금액->기본:상면비+회선비+서버금액(price)+서버파트연결(월비용)-할인액 //청구금액->기본:상면비+회선비+서버금액(price)+서버파트연결(월비용)-할인액
final public function getSale(): int final public function getSale(): int
{ {
return $this->attributes['sale'] ?? 0; return $this->attributes['sale'];
} }
final public function getAmount(): int final public function getAmount(): int
{ {
return $this->attributes['amount'] ?? 0; return $this->attributes['amount'];
} }
//상면비 //상면비
final public function getRack(): int final public function getRack(): int
{ {
return $this->attributes['rack'] ?? 0; return $this->attributes['rack'];
} }
//회선비 //회선비
final public function getLine(): int final public function getLine(): int
{ {
return $this->attributes['line'] ?? 0; return $this->attributes['line'];
} }
final public function getStartAt(): string final public function getStartAt(): string
{ {
return $this->attributes['start_at'] ?? ""; return $this->attributes['start_at'];
} }
public function getHistory(): string public function getHistory(): string|null
{ {
return $this->attributes['history'] ?? ""; return $this->attributes['history'];
} }
} }

View File

@ -9,18 +9,22 @@ class ServerEntity extends EquipmentEntity
const PK = ServerModel::PK; const PK = ServerModel::PK;
const TITLE = ServerModel::TITLE; const TITLE = ServerModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE']; const DEFAULT_STATUS = STATUS['AVAILABLE'];
final public function getClientInfoUID(): string|null final public function getClientInfoUID(): int|null
{ {
return $this->attributes['clientinfo_uid'] ?? null; return $this->attributes['clientinfo_uid'];
} }
final public function getServiceInfoUID(): string|null final public function getServiceInfoUID(): int|null
{ {
return $this->attributes['serviceinfo_uid'] ?? null; return $this->attributes['serviceinfo_uid'];
} }
//기본기능용 //기본기능용
public function getCustomTitle(): string public function getCustomTitle(string $field = ServerModel::TITLE): string
{ {
return sprintf("[%s] %s", $this->getCode(), $this->getTitle()); return sprintf("[%s]%s", $this->getCode(), $this->$field);
}
final public function getCode(): string
{
return $this->attributes['code'] ?? "";
} }
public function getPrice(): int public function getPrice(): int
{ {

View File

@ -17,7 +17,7 @@ class ServerPartEntity extends EquipmentEntity
//여러클래스존재가능 //여러클래스존재가능
public function getPartEntity(): mixed public function getPartEntity(): mixed
{ {
return $this->attributes['partEntity'] ?? null; return $this->attributes['partEntity'];
} }
final public function setPaymentEntity(PaymentEntity $entity): self final public function setPaymentEntity(PaymentEntity $entity): self
{ {
@ -26,29 +26,26 @@ class ServerPartEntity extends EquipmentEntity
} }
final public function getPaymentEntity(): PaymentEntity|null final public function getPaymentEntity(): PaymentEntity|null
{ {
return $this->attributes['paymentEntity'] ?? null; return $this->attributes['paymentEntity'];
} }
public function getPartUID(): int final public function getServerInfoUID(): int
{
return intval($this->attributes['part_uid']) ?? 0;
}
final public function getUserUID(): string|null
{
return $this->attributes['user_uid'];
}
final public function getClientInfoUID(): string|null
{
return $this->attributes['clientinfo_uid'];
}
final public function getServiceInfoUID(): string|null
{
return $this->attributes['serviceinfo_uid'];
}
final public function getServerInfoUID(): string
{ {
return $this->attributes['serverinfo_uid']; return $this->attributes['serverinfo_uid'];
} }
final public function getPaymentUID(): string|null
public function getPartUID(): int
{
return intval($this->attributes['part_uid']);
}
final public function getClientInfoUID(): int|null
{
return $this->attributes['clientinfo_uid'];
}
final public function getServiceInfoUID(): int|null
{
return $this->attributes['serviceinfo_uid'];
}
final public function getPaymentUID(): int|null
{ {
return $this->attributes['payment_uid'] ?? null; return $this->attributes['payment_uid'] ?? null;
} }
@ -64,24 +61,25 @@ class ServerPartEntity extends EquipmentEntity
public function getType(): string public function getType(): string
{ {
return $this->attributes['type'] ?? ""; return $this->attributes['type'];
} }
public function getBilling(): string public function getBilling(): string
{ {
return $this->attributes['billing'] ?? ""; return $this->attributes['billing'];
} }
public function getAmount(): int public function getAmount(): int
{ {
return $this->attributes['amount'] ?? 0; return $this->attributes['amount'];
} }
public function getCnt(): int public function getCnt(): int
{ {
return $this->attributes['cnt'] ?? 0; return $this->attributes['cnt'];
} }
public function getExtra(): string public function getExtra(): string|null
{ {
return $this->attributes['extra'] ?? ""; return $this->attributes['extra'];
} }
//리스트에서 상태표시용
public function getStatus(): string public function getStatus(): string
{ {
return self::DEFAULT_STATUS; return self::DEFAULT_STATUS;

View File

@ -9,4 +9,9 @@ class CPUEntity extends PartEntity
const PK = CPUModel::PK; const PK = CPUModel::PK;
const TITLE = CPUModel::TITLE; const TITLE = CPUModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE']; const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능
final public function getStock(): int
{
return $this->attributes['stock'];
}
} }

View File

@ -9,4 +9,18 @@ class CSEntity extends PartEntity
const PK = CSModel::PK; const PK = CSModel::PK;
const TITLE = CSModel::TITLE; const TITLE = CSModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE']; const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능
public function getIP(): string
{
return $this->attributes['ip'];
}
//기본기능
public function getAccountID(): string|null
{
return $this->attributes['accountid'];
}
public function getDomain(): string|null
{
return $this->attributes['domain'];
}
} }

View File

@ -9,7 +9,11 @@ class DISKEntity extends PartEntity
const PK = DISKModel::PK; const PK = DISKModel::PK;
const TITLE = DISKModel::TITLE; const TITLE = DISKModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE']; const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능
final public function getStock(): int
{
return $this->attributes['stock'];
}
public function getFormat(): int public function getFormat(): int
{ {
return intval($this->attributes['format'] ?? 0); return intval($this->attributes['format'] ?? 0);

View File

@ -9,6 +9,10 @@ class IPEntity extends PartEntity
const PK = IPModel::PK; const PK = IPModel::PK;
const TITLE = IPModel::TITLE; const TITLE = IPModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE']; const DEFAULT_STATUS = STATUS['AVAILABLE'];
final public function getLineInfoUID(): string
{
return $this->attributes['lineinfo_uid'];
}
final public function getOldClientInfoUID(): string|null final public function getOldClientInfoUID(): string|null
{ {
return $this->attributes['old_clientinfo_uid']; return $this->attributes['old_clientinfo_uid'];

View File

@ -9,4 +9,9 @@ class OSEntity extends PartEntity
const PK = OSModel::PK; const PK = OSModel::PK;
const TITLE = OSModel::TITLE; const TITLE = OSModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE']; const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능
final public function getStock(): int
{
return $this->attributes['stock'];
}
} }

View File

@ -22,20 +22,13 @@ abstract class PartEntity extends CommonEntity
{ {
return $this->attributes['serverinfo_uid']; return $this->attributes['serverinfo_uid'];
} }
final public function getLineInfoUID(): string //기본기능용
final public function getCustomTitle(): string
{ {
return $this->attributes['lineinfo_uid']; return $this->getTitle() . " " . number_format($this->getPrice()) . "";
} }
final public function getPrice(): int final public function getPrice(): int
{ {
return $this->attributes['price']; return $this->attributes['price'];
} }
final public function getStock(): int
{
return $this->attributes['stock'];
}
final public function getCustomTitle(): string
{
return $this->getTitle() . " " . number_format($this->getPrice()) . "";
}
} }

View File

@ -9,4 +9,9 @@ class RAMEntity extends PartEntity
const PK = RAMModel::PK; const PK = RAMModel::PK;
const TITLE = RAMModel::TITLE; const TITLE = RAMModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE']; const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능
final public function getStock(): int
{
return $this->attributes['stock'];
}
} }

View File

@ -9,4 +9,9 @@ class SOFTWAREEntity extends PartEntity
const PK = SOFTWAREModel::PK; const PK = SOFTWAREModel::PK;
const TITLE = SOFTWAREModel::TITLE; const TITLE = SOFTWAREModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE']; const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능
final public function getStock(): int
{
return $this->attributes['stock'];
}
} }

View File

@ -9,4 +9,9 @@ class SWITCHEntity extends PartEntity
const PK = SWITCHModel::PK; const PK = SWITCHModel::PK;
const TITLE = SWITCHModel::TITLE; const TITLE = SWITCHModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE']; const DEFAULT_STATUS = STATUS['AVAILABLE'];
final public function getCode(): string
{
return $this->attributes['code'] ?? "";
}
} }

View File

@ -14,34 +14,34 @@ class PaymentEntity extends CommonEntity
{ {
return $this->attributes['user_uid']; return $this->attributes['user_uid'];
} }
final public function getClientInfoUID(): int|null final public function getClientInfoUID(): int
{ {
return $this->attributes['clientinfo_uid'] ?? null; return $this->attributes['clientinfo_uid'];
} }
final public function getServiceInfoUID(): int|null final public function getServiceInfoUID(): int
{ {
return $this->attributes['serviceinfo_uid'] ?? null; return $this->attributes['serviceinfo_uid'];
} }
//기본기능 //기본기능
public function getBilling(): string public function getBilling(): string
{ {
return $this->attributes['billing'] ?? ""; return $this->attributes['billing'];
} }
public function getAmount(): int public function getAmount(): int
{ {
return $this->attributes['amount'] ?? 0; return $this->attributes['amount'];
} }
public function getBillingAt(): string public function getBillingAt(): string
{ {
return $this->attributes['billing_at'] ?? ""; return $this->attributes['billing_at'];
} }
public function getPay(): string public function getPay(): string|null
{ {
return $this->attributes['pay'] ?? ""; return $this->attributes['pay'];
} }
public function getContent(): string public function getContent(): string|null
{ {
return $this->attributes['content'] ?? ""; return $this->attributes['content'];
} }
public function getCountDueAt(): string public function getCountDueAt(): string
{ {

View File

@ -13,14 +13,14 @@ class UserEntity extends CommonEntity
public function getID(): string public function getID(): string
{ {
return $this->attributes['id'] ?? ""; return $this->attributes['id'];
} }
public function getPassword(): string public function getPassword(): string
{ {
return $this->attributes['passwd'] ?? ""; return $this->attributes['passwd'];
} }
public function getRole(): string public function getRole(): string
{ {
return $this->attributes['role'] ?? ""; return $this->attributes['role'];
} }
} }

View File

@ -17,14 +17,14 @@ class UserSNSEntity extends CommonEntity
} }
public function getID(): string public function getID(): string
{ {
return $this->attributes['id'] ?? ""; return $this->attributes['id'];
} }
public function getSite(): string public function getSite(): string
{ {
return $this->attributes['site'] ?? ""; return $this->attributes['site'];
} }
public function getEmail(): string public function getEmail(): string
{ {
return $this->attributes['email'] ?? ""; return $this->attributes['email'];
} }
} }

View File

@ -96,6 +96,7 @@ class ClientHelper extends CustomerHelper
break; break;
case 'coupon': case 'coupon':
case 'account': case 'account':
case 'point':
$extras = [ $extras = [
"class" => "btn btn-sm btn-outline btn-circle btn-link form-label-sm", "class" => "btn btn-sm btn-outline btn-circle btn-link form-label-sm",
"target" => "_self", "target" => "_self",

View File

@ -6,6 +6,7 @@ return [
'clientinfo_uid' => "고객명", 'clientinfo_uid' => "고객명",
'bank' => "은행", 'bank' => "은행",
'title' => "제목", 'title' => "제목",
'content' => "내용",
'alias' => "입출금자명", 'alias' => "입출금자명",
'amount' => "금액", 'amount' => "금액",
'status' => "상태", 'status' => "상태",

View File

@ -4,6 +4,7 @@ return [
'label' => [ 'label' => [
'clientinfo_uid' => "고객명", 'clientinfo_uid' => "고객명",
'title' => "제목", 'title' => "제목",
'content' => "내용",
'cnt' => "갯수", 'cnt' => "갯수",
'status' => "추가/사용", 'status' => "추가/사용",
'updated_at' => "수정일", 'updated_at' => "수정일",

View File

@ -4,6 +4,7 @@ return [
'label' => [ 'label' => [
'clientinfo_uid' => "고객명", 'clientinfo_uid' => "고객명",
'title' => "제목", 'title' => "제목",
'content' => "내용",
'amount' => "금액", 'amount' => "금액",
'status' => "입/출금", 'status' => "입/출금",
'updated_at' => "수정일", 'updated_at' => "수정일",

View File

@ -18,6 +18,7 @@ class AccountModel extends CustomerModel
"clientinfo_uid", "clientinfo_uid",
"bank", "bank",
"title", "title",
"content",
"alias", "alias",
"issue_at", "issue_at",
"amount", "amount",
@ -48,6 +49,9 @@ class AccountModel extends CustomerModel
case "issue_at": case "issue_at":
$rule = "required|valid_date"; $rule = "required|valid_date";
break; break;
case "content":
$rule = "permit_empty|trim|string";
break;
default: default:
$rule = parent::getFormRule($action, $field); $rule = parent::getFormRule($action, $field);
break; break;

View File

@ -17,6 +17,7 @@ class CouponModel extends CustomerModel
"user_uid", "user_uid",
"clientinfo_uid", "clientinfo_uid",
"title", "title",
"content",
"cnt", "cnt",
"status", "status",
"updated_at" "updated_at"
@ -40,6 +41,9 @@ class CouponModel extends CustomerModel
case "status": case "status":
$rule = "required|trim|string"; $rule = "required|trim|string";
break; break;
case "content":
$rule = "permit_empty|trim|string";
break;
default: default:
$rule = parent::getFormRule($action, $field); $rule = parent::getFormRule($action, $field);
break; break;

View File

@ -17,6 +17,7 @@ class PointModel extends CustomerModel
"user_uid", "user_uid",
"clientinfo_uid", "clientinfo_uid",
"title", "title",
"content",
"amount", "amount",
"status", "status",
"updated_at" "updated_at"
@ -40,6 +41,9 @@ class PointModel extends CustomerModel
case "status": case "status":
$rule = "required|trim|string"; $rule = "required|trim|string";
break; break;
case "content":
$rule = "permit_empty|trim|string";
break;
default: default:
$rule = parent::getFormRule($action, $field); $rule = parent::getFormRule($action, $field);
break; break;

View File

@ -54,7 +54,7 @@ class ServerPartModel extends EquipmentModel
$rule = "required|trim|string"; $rule = "required|trim|string";
break; break;
case "extra": case "extra":
$rule = "permit_empty|string"; $rule = "permit_empty|trim|string";
break; break;
default: default:
$rule = parent::getFormRule($action, $field); $rule = parent::getFormRule($action, $field);

View File

@ -27,6 +27,7 @@ class AccountService extends CustomerService implements PaymentInterface
"issue_at", "issue_at",
"amount", "amount",
"status", "status",
"content"
]; ];
} }
public function getFormFilters(): array public function getFormFilters(): array

View File

@ -21,6 +21,7 @@ class CouponService extends CustomerService
"title", "title",
"cnt", "cnt",
"status", "status",
"content"
]; ];
} }
public function getFormFilters(): array public function getFormFilters(): array

View File

@ -22,6 +22,7 @@ class PointService extends CustomerService
"title", "title",
"amount", "amount",
"status", "status",
"content"
]; ];
} }
public function getFormFilters(): array public function getFormFilters(): array

View File

@ -2,6 +2,7 @@
namespace App\Services; namespace App\Services;
use App\Entities\Customer\ClientEntity;
use App\Entities\Customer\ServiceEntity; use App\Entities\Customer\ServiceEntity;
use App\Entities\Equipment\ServerPartEntity; use App\Entities\Equipment\ServerPartEntity;
use App\Entities\PaymentEntity; use App\Entities\PaymentEntity;
@ -199,6 +200,28 @@ class PaymentService extends CommonService implements ServiceInterface, ServerPa
} }
return $serverPartEntity->setPaymentEntity($entity); return $serverPartEntity->setPaymentEntity($entity);
} }
//Invoice 관련
public function getInvoiceData(ClientEntity $clientEntity, ServiceEntity $serviceEntity, PaymentEntity $entity, array $rows): array
{
if (!array_key_exists($clientEntity->getPK(), $rows)) {
$rows[$clientEntity->getPK()] = [
'name' => $clientEntity->getName(),
'total_amount' => 0,
'services' => [],
];
}
if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) {
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
'ip' => $serviceEntity->getServerEntity()->getIP(),
'billing_at' => $serviceEntity->getBillingAt(),
'items' => [],
];
}
//entities에 총 결제금액 설정
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()]['items'][] = ['title' => $entity->getTitle(), 'amount' => $entity->getAmount()];
$rows[$clientEntity->getPK()]['total_amount'] += $entity->getAmount();
return $rows;
}
//기본 기능부분 //기본 기능부분
//FieldForm관련용 //FieldForm관련용
final public function getFormOption(string $field, array $options = []): array final public function getFormOption(string $field, array $options = []): array

View File

@ -35,6 +35,7 @@
<th>대체</th> <th>대체</th>
<th>쿠폰</th> <th>쿠폰</th>
<th>예치금</th> <th>예치금</th>
<th>포인트</th>
<th>전체요금</th> <th>전체요금</th>
<th>전체미납금</th> <th>전체미납금</th>
</tr> </tr>
@ -50,6 +51,7 @@
<td><?= $viewDatas['totalCounts']['alternative']['summary'] ?></td> <td><?= $viewDatas['totalCounts']['alternative']['summary'] ?></td>
<td><?= $viewDatas['service']->getHelper()->getListButton("coupon", $viewDatas['entity']->getCouponBalance(), $viewDatas) ?></td> <td><?= $viewDatas['service']->getHelper()->getListButton("coupon", $viewDatas['entity']->getCouponBalance(), $viewDatas) ?></td>
<td><?= $viewDatas['service']->getHelper()->getListButton("account", number_format($viewDatas['entity']->getAccountBalance()) . "", $viewDatas) ?></td> <td><?= $viewDatas['service']->getHelper()->getListButton("account", number_format($viewDatas['entity']->getAccountBalance()) . "", $viewDatas) ?></td>
<td><?= $viewDatas['service']->getHelper()->getListButton("point", number_format($viewDatas['entity']->getPointBalance()), $viewDatas) ?></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['totalAmounts']) ? number_format($viewDatas['totalAmounts'][$viewDatas['entity']->getPK()]) : 0 ?>원</td>
<td> <td>
<?php if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])): ?> <?php if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])): ?>

View File

@ -33,13 +33,13 @@
<td colspan="2"> <td colspan="2">
<table class="table table-sm table-bordered"> <table class="table table-sm table-bordered">
<tr> <tr>
<th class="p-0">코드</th> <th class="p-0">서버 IP</th>
<th class="p-0">항목</th> <th class="p-0">항목</th>
<th class="p-0">결제일</th> <th class="p-0">결제일</th>
</tr> </tr>
<?php foreach ($row['services'] as $service): ?> <?php foreach ($row['services'] as $service): ?>
<tr> <tr>
<td class="p-0"><?= $service['code'] ?></td> <td class="p-0"><?= $service['ip'] ?></td>
<td class="p-0"> <td class="p-0">
<ol> <ol>
<?php foreach ($service['items'] as $item): ?> <?php foreach ($service['items'] as $item): ?>

View File

@ -3,11 +3,11 @@
안녕하세요 Prime IDC 입니다.<BR> 안녕하세요 Prime IDC 입니다.<BR>
항상 저희 IDC를 이용해 주셔서 감사합니다.<BR> 항상 저희 IDC를 이용해 주셔서 감사합니다.<BR>
서버비 안내 드립니다.<BR> 서버비 안내 드립니다.<BR>
<div class="p-0">고객명: <?= $row['name'] ?> , 총 납부금액: <?= number_format($row['total_amount']) ?>원</div> <div class="p-0">고객명: <?= $row['name'] ?> , 총 결제금액: <?= number_format($row['total_amount']) ?>원</div>
===========================<BR> ===========================<BR>
<ol> <ol>
<?php foreach ($row['services'] as $service): ?> <?php foreach ($row['services'] as $service): ?>
<li class="p-0">비스:<?= $service['code'] ?> , 결제일:<?= $service['billing_at'] ?></li> <li class="p-0">IP:<?= $service['ip'] ?> , 결제일:<?= $service['billing_at'] ?></li>
<?php endforeach; ?> <?php endforeach; ?>
</ol> </ol>
===========================<BR> ===========================<BR>