ÿØÿà JFIF ` ` ÿþ
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 : |
<?php include "../include/top.html"; if($period_yy == ""){ $period_yy = date('Y'); } if($period_mm == ""){ $period_mm = date('m'); } $period = $period_yy . "-" . $period_mm; // 관리자 $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}'"); } //p($agent_list); $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){ $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); //total } //p($agentSellList); //exit; $start_ym = date('Y-m'); $end_ym = date('Y-m'); $res_data = TO_get_reserv_data($start_ym, $end_ym); foreach($res_data as $item) { $agentSellList[$item['agent_id']][$item['tab']]['cnt'] += 1; $agentSellList[$item['agent_id']][$item['tab']]['amount'] += (int) $item['buy_total']; $agentSellList[$item['agent_id']]['totalCnt'] += 1; $agentSellList[$item['agent_id']]['totalAmount'] += (int) $item['buy_total']; } //p($agentSellList); /*$agentSellListArr = array(); foreach($agentSellList as $item){ array_push($agentSellListArr, $item); } p($agentSellListArr);*/ //p($agentSellList); $agentSellListArr = array(); foreach($agentSellList as $key => $item){ $agentSellListArr[] = array('agentName' => $key, 'data' => $item, 'totalAmount' => $item['totalAmount']); } //p($agentSellListArr); //exit; $agentSellListArr = arr_sort($agentSellListArr, 'totalAmount','desc'); $agentSellList = array(); foreach($agentSellListArr as $value){ $agentSellList[$value['agentName']] = $value['data']; } //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; } ?> <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;} </style> <div class="contents_wrap"> <div class="contents_wrap_in"> <div class="title"><strong>B2B 거래처(<?=$natWord?>) 월별정산내역</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 >= 2018; $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} </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?>"> <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-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">당일투어(D)</th> <th style="border-top:2px solid #000;border-right:1px solid #ccc !important;" colspan="2">숙박패키지(L)</th> <th style="border-top:2px solid #000;border-right:1px solid #ccc !important;" colspan="2">티켓(T)</th> <th style="border-top:2px solid #000;border-right:1px solid #ccc !important;" colspan="2">버스송영(P)</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:#FFF0D9;border-right:1px solid #ccc !important;">총합계</th> <th rowspan="2" style="border-top:2px solid #000;width:88px;background:#555;color:#fff">인보이스</th> </tr> <tr> <th class="th2">수량</th> <th style="width:<?=$amountWidth?>;border-right:1px solid #ccc !important;" class="th2">금액</th> <th>수량</th> <th style="width:<?=$amountWidth?>;border-right:1px solid #ccc !important;">금액</th> <th>수량</th> <th style="width:<?=$amountWidth?>;border-right:1px solid #ccc !important;">금액</th> <th>수량</th> <th style="width:<?=$amountWidth?>;border-right:1px solid #ccc !important;">금액</th> <th style="background:#fffde1">수량</th> <th style="width:<?=$amountWidth?>;background:#fffde1;border-right:1px solid #ccc !important;">금액</th> <th style="background:#FFF0D9">수량</th> <th style="width:<?=$amountWidth?>;background:#FFF0D9;border-right:1.5px solid #ccc !important;">금액</th> </tr> </thead> <tbody> <?php $idx = 1; foreach($agentSellList as $key => $value){ if($key == '' || $agentList[$key] == '' || $value['totalAmount'] == 0) { continue; } // p($key); // p($value); ?> <tr> <td style="text-align:left;padding-left:10px;border-right:1px solid #ccc !important;" class="agentName"><?=(($agentList[$key] != '') ? $agentList[$key] : $key)?></td> <td><?=number_format($value['D']['cnt'])?></td> <td style="text-align: right;border-right:1px solid #ccc !important;"><?=number_format($value['D']['amount'])?></td> <td><?=number_format($value['L']['cnt'])?></td> <td style="text-align: right"><?=number_format($value['L']['amount'])?></td> <td><?=number_format($value['T']['cnt'])?></td> <td style="text-align: right;border-right:1px solid #ccc !important;"><?=number_format($value['T']['amount'])?></td> <td><?=number_format($value['P']['cnt'])?></td> <td style="text-align: right;border-right:1px solid #ccc !important;"><?=number_format($value['P']['amount'])?></td> <td style="background:#fffde1"><input type="number" class="minusTotalCnt" idx="<?=$idx?>" totalcnt="<?=$value['totalCnt']?>" totalamount="<?=$value['totalAmount']?>" /></td> <td style="background:#fffde1;border-right:1px solid #ccc !important;"><input type="number" class="minusTotalAmount" idx="<?=$idx?>" totalcnt="<?=$value['totalCnt']?>" totalamount="<?=$value['totalAmount']?>"/></td> <td style="background:#FFF0D9" id="minusTotalCnt<?=$idx?>"><?=number_format($value['totalCnt'])?></td> <td style="text-align:right;background:#FFF0D9;border-right:1px solid #ccc !important;" class="agentAmount" id="minusTotalAmount<?=$idx?>"><?=number_format($value['totalAmount'])?></td> <td> <button class="Tbtn red" style="padding:5px 25px" onclick="invoice_pdf_download('<?=$key?>')">PDF <i style="font-size:20px;margin-top:-6px;margin-right:-6px;position:relative;top:4px" class="xi-download "></i></button> </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(){ $('.minusTotalCnt').keyup(function(){ thisIdx = $(this).attr('idx'); thisTotalCnt = parseInt($(this).val()); totalCnt = parseInt($(this).attr('totalcnt')); if(typeof(thisTotalCnt) == 'number'){ if(thisTotalCnt == 'NaN'){ // $('#minusTotalCnt'+thisIdx).text(comma(totalCnt.toString())); $('#minusTotalCnt'+thisIdx).text(totalCnt); }else{ if(thisTotalCnt >= 0){ applyTotalCnt = totalCnt - thisTotalCnt; // $('#minusTotalCnt'+thisIdx).text(comma(applyTotalCnt.toString())); $('#minusTotalCnt'+thisIdx).text(applyTotalCnt); }else{ // $('#minusTotalCnt'+thisIdx).text(comma(totalCnt.toString())); $('#minusTotalCnt'+thisIdx).text(totalCnt); } } }else{ // $('#minusTotalCnt'+thisIdx).text(comma(totalCnt.toString())); $('#minusTotalCnt'+thisIdx).text(totalCnt); } }) $('.minusTotalAmount').keyup(function(){ thisIdx = $(this).attr('idx'); thisTotalAmount = parseInt($(this).val()); totalAmount = parseInt($(this).attr('totalAmount')); if(typeof(thisTotalAmount) == 'number'){ if(thisTotalAmount == 'NaN'){ $('#minusTotalAmount'+thisIdx).text(comma(totalAmount.toString())); }else{ if(thisTotalAmount >= 0){ applyTotalAmount = totalAmount - thisTotalAmount; $('#minusTotalAmount'+thisIdx).text(comma(applyTotalAmount.toString())); }else{ $('#minusTotalAmount'+thisIdx).text(comma(totalAmount.toString())); } } }else{ $('#minusTotalAmount'+thisIdx).text(comma(totalAmount.toString())); } }) }) function invoice_pdf_download(agentID){ var dateterm = $('#period_yy').val() + '-' + $('#period_mm').val(); var url = "/admin/TCPDF/erp/pdf_invoice_estimate_agent.php?agent_id="+agentID+"&dateterm="+dateterm; location.href = url; } </script> <?php include "../include/footer.html"; ?>