<?php
namespace lib\Controller;

use lib\Core\Controller;

class Billing extends Controller
{
    public function __construct()
    {
        parent::__construct();
    } //

    final public function getAccounts($site_id)
    {
        switch ($site_id) {
            case 'PRIMEIDC':
                return [
                    ["id" => "1005-202-907217", "name" => '우리은행', "owner" => "(주)브엘세바"],
                    ["id" => "355-0040-4154-03", "name" => '농협', "owner" => "(주)브엘세바"],
                ];
                break;
            case "ITSOLUTION":
                return [
                    ["id" => "351-0995-6751-73", "name" => '농협', "owner" => "주식회사 르호봇"],
                    ["id" => "9002-1932-1654-1", "name" => '새마을금고', "owner" => "주식회사 르호봇"],
                ];
                break;
            case 'GDIDC':
                return [
                    ["id" => "1005-204-100758", "name" => '우리은행', "owner" => " (주)브엘라해로이"],
                ];
                break;
            default:
                throw new \Exception(sprintf(__METHOD__ . "에서 오류 SiteID[%s]가 정의되지 않았습니다.", $site_id));
                break;
        }
    }

    public function execute($client_code)
    {
        $site = $this->getSite();

        $this->view->client = $this->getModel("Client")->getData(array(sprintf("Client_Code='%s'", $client_code)));
        $this->view->site = $site;
        $this->view->accounts = $this->getAccounts($site['id']);
        return $this->render('depositbillpaper');
    }
}
