100 lines
4.9 KiB
PHP
100 lines
4.9 KiB
PHP
<?php
|
|
|
|
namespace lib\Controllers\DBMS\Client;
|
|
|
|
use lib\Models\AddDbModel;
|
|
use lib\Models\ClientModel;
|
|
use lib\Utils\Pagination;
|
|
|
|
class PaymentController extends ClientController
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->getView()->setPath('payment');
|
|
} //
|
|
|
|
//청구서, depositbillpaper.php
|
|
//CLI 접속방법 : php index.php site/client/payment/billpaper
|
|
//WEB 접속방법 : http://localhostsite/client/payment/billpaper
|
|
public function billpaper(array $params): string
|
|
{
|
|
//사이트 정보 가져오기
|
|
if (!array_key_exists('sitekey', $params)) {
|
|
throw new \Exception("sitekey 값이 정의되지 않았습니다.");
|
|
}
|
|
$sitekey = $params['sitekey'];
|
|
$this->siteInfo = DBMS_SITEINFOS[$sitekey];
|
|
if (!array_key_exists($sitekey, DBMS_SITEINFOS)) {
|
|
throw new \Exception("[{$sitekey}]에 해당하는 사이트정보가 없습니다.");
|
|
}
|
|
//사용자정보가져오기
|
|
$client_code = $params['client_code'];
|
|
if (!array_key_exists('client_code', $params)) {
|
|
throw new \Exception("client_code 값이 정의되지 않았습니다.");
|
|
}
|
|
$client = $this->getClientService()->getEntityByCode($client_code);
|
|
if (!$client) {
|
|
throw new \Exception("[{$client_code}]에 해당하는 사이트정보가 없습니다.");
|
|
}
|
|
$this->client = $client;
|
|
return $this->render(__FUNCTION__);
|
|
}
|
|
|
|
//청구서, NonPaymentList.php
|
|
//CLI 접속방법 : php index.php site/client/payment/unpaid
|
|
//WEB 접속방법 : http://localhostsite/client/payment/unpaid
|
|
public function nonpayment(array $params): string
|
|
{
|
|
//Client_Code = ["C219"=>WinIDC,"C116"=>IDC-JP"] -> 미지급금계산 제외 Client_Code
|
|
$exclude_clients = ['C116', 'C219'];
|
|
//mode 당일,1일전,2일전,3일전,custom
|
|
$today = date("Y-m-d");
|
|
switch ($params['mode']) {
|
|
case 'today':
|
|
$this->getServiceService()->getModel()->where("service_payment_date = CURDATE()");
|
|
$this->message = "{$today} 기준 당일 ";
|
|
break;
|
|
case '1day':
|
|
$nonpaymentDay = 1;
|
|
$this->getServiceService()->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
|
|
$this->message = "{$today}] 기준 {$nonpaymentDay}일전";
|
|
break;
|
|
case '2day':
|
|
$nonpaymentDay = 2;
|
|
$this->getServiceService()->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
|
|
$this->message = "{$today}] 기준 {$nonpaymentDay}일전";
|
|
break;
|
|
case '3day':
|
|
$nonpaymentDay = 3;
|
|
$this->getServiceService()->getModel()->where("service_payment_date = Date_Add(CURDATE(),INTERVAL {$nonpaymentDay} DAY)");
|
|
$this->message = "{$today}] 기준 {$nonpaymentDay}일전";
|
|
break;
|
|
case 'all':
|
|
default:
|
|
$this->message = "{$today}] 기준 전체";
|
|
break;
|
|
}
|
|
$table = $this->getServiceService()->getModel()->getTable();
|
|
$clientTable = ClientModel::TABLE;
|
|
$addDbTable = AddDbModel::TABLE;
|
|
$this->getServiceService()->getModel()->select("{$clientTable}.Client_Name,{$table}.service_code,service_line,server_code,service_ip,service_payment_date,service_amount,service_nonpayment,service_note,addDB_case,addDB_nonpayment,addDB_payment,addDB_accountStatus,addDB_ip,addDB_payment_date");
|
|
$this->getServiceService()->getModel()->join($clientTable, "{$table}.client_code = {$clientTable}.Client_Code");
|
|
$this->getServiceService()->getModel()->join($addDbTable, "{$table}.service_code = {$addDbTable}.service_code");
|
|
$this->getServiceService()->getModel()->whereNotIn("{$addDbTable}.client_code", $exclude_clients);
|
|
$this->getServiceService()->getModel()->whereNotIn("{$addDbTable}.addDB_accountStatus", ["complete"]);
|
|
$this->getServiceService()->getModel()->orderBy("service_payment_date", "DESC");
|
|
|
|
$this->mode = $params['mode'];
|
|
$this->total = $this->getServiceService()->getModel()->setReset(false);
|
|
$this->total = $this->getServiceService()->getCount();
|
|
$this->entities = $this->getServiceService()->getEntities();
|
|
// $total = count($temps);
|
|
// $page = $parmas['page'] ?? 1;
|
|
// $perPage = $parmas['perPage'] ?? 10;
|
|
// $this->pagination = new Pagination($total, (int)$page, (int)$perPage);
|
|
// <div align='center'><?= $this->pagination->render("http://{$_SERVER['HTTP_HOST']}:6752/IdcDepositNonPaymentListMK.dep?mode=", ['mode' => "{$this->mode}", 'ea' => "{$this->total}"])></div>
|
|
return $this->render(path: __FUNCTION__);
|
|
}
|
|
} //Class
|