ÿØÿà 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_proc.html"; $agentID = $agent_id; if(!$agentID){ echo "<script>alert('agentID가 없습니다.');</script>"; exit; } //p($agent_id); //exit; // 엑셀 파일명 설정 $FileName = "B2B_INVOICE"; $FileName = $FileName."_".Date("Ymd").".xls"; $FileName = urlencode($FileName); // UTF-8 // 엑셀 파일로 변환 헤더 header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=$FileName"); header("Content-Description: PHP4 Generated Data" ); $tk_info = array( 'name' => 'TK트래블', 'addr' => '서울시 동대문구 신이문로39 명경빌딩 5층', 'tel' => '02-6298-8000', 'ceo' => '강일구 대표', 'bank' => '국민은행', 'account' => '99919-107950', 'holder' => '강일구(TKTRAVEL)' ); if($agent_row['bz_avnk_cd']){ $bank_code = base_codec("ACC","AVNK", $agent_row['bz_avnk_cd']); $bank_name = $bank_code[0]['cd_nm']; } // 회원 여부 체크 $query = "select * from TB_MEMBER where mb_id ='{$agentID}' and del_flag='N' and mb_level <= ".$cf['trade_level']; $result = db_query( $query ); $agent_row = db_fetch_array( $result ); if( !$agent_row ){ error('올바르지 않은 아이디입니다.', '0003'); } $bz_nat = $agent_row['bz_nat']; $agent_info = array( 'name' => $agent_row['bz_corp_nm'], 'addr' => $agent_row['mb_address1'].'<br>'.$agent_row['mb_address2'], 'tel' => $agent_row['mb_phone'], 'ceo' => $agent_row['mb_nm'], 'bank' => $bank_name, 'account' => $agent_row['bz_avnk_number'], 'holder' => $agent_row['bz_avnk_owner'], 'bz_nat' => $agent_row['bz_nat'] ); //p($agent_info['bz_nat']); //exit; if(!isset($_GET['dateterm'])){ if($period_yy == ""){ $period_yy = date('Y'); } if($period_mm == ""){ $period_mm = date('m'); } }else{ $periodEx = explode("-",$_GET['dateterm']); $period_yy = $periodEx[0]; $period_mm = $periodEx[1]; } $period = $period_yy . "-" . $period_mm; //p($period); //exit; $monthLastDay = date('t', strtotime($period)); //p($monthLastDay); // 관리자 //$admin_arr = member_fetch(" and mb_level <= 10 and del_flag='N' "); $agent_list = member_fetch(" and mb_id='{$agent_id}' "); //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 } $start_ym = $period_yy.'-'.$period_mm; $end_ym = $period_yy.'-'.$period_mm; $res_data = TO_get_reserv_data_b2b($start_ym, $end_ym); $resData = array(); foreach($res_data as $item) { if($item['agent_id'] == $agentID){ array_push($resData, $item); } } $resDataArr = array(); foreach($resData as $item){ $item['personAdult'] = (int) $item['personAdult']; $item['personChild'] = (int) $item['personChild']; $item['personBaby'] = (int) $item['personBaby']; if(isset($resDataArr[$item['res_no']])){ $resDataArr[$item['res_no']]['adultCnt'] += $item['personAdult']; $resDataArr[$item['res_no']]['childCnt'] += $item['personChild']; $resDataArr[$item['res_no']]['babyCnt'] += $item['personBaby']; }else{ $resDataArr[$item['res_no']] = array(); $resDataArr[$item['res_no']]['g_title'] = $item['g_title']; $resDataArr[$item['res_no']]['start_date'] = $item['start_date']; $resDataArr[$item['res_no']]['adultUnitPrice'] = $item['adult_buy']; $resDataArr[$item['res_no']]['childUnitPrice'] = $item['child_buy']; $resDataArr[$item['res_no']]['babyUnitPrice'] = $item['baby_buy']; $resDataArr[$item['res_no']]['adultCnt'] = $item['personAdult']; $resDataArr[$item['res_no']]['childCnt'] = $item['personChild']; $resDataArr[$item['res_no']]['babyCnt'] = $item['personBaby']; } } $resData = $resDataArr; $calStartDate = $period_yy.'.'.$period_mm.'.01'; $calEndDate = $period_yy.'.'.$period_mm.'.'.$monthLastDay; $firstRowsCnt = 2; $grandTotalPrice = 0; //총금액 foreach($resData as $item) { //어덜트영역 if ($item['adultCnt'] > 0) { $grandTotalPrice += ($item['adultUnitPrice'] * $item['adultCnt']); $firstRowsCnt += 1; } if ($item['childCnt'] > 0) { $grandTotalPrice += ($item['childUnitPrice'] * $item['childCnt']); $firstRowsCnt += 1; } if ($item['babyCnt'] > 0) { $grandTotalPrice += ($item['babyUnitPrice'] * $item['babyCnt']); $firstRowsCnt += 1; } } $currency = ""; switch($agent_info['bz_nat']) { case 'KO': $currency = 'KRW'; break; case 'HK': $currency = 'HKD'; break; case 'SG': $currency = 'SGD'; break; case 'TW': $currency = 'TWD'; break; case 'MY': $currency = 'MYR'; break; case 'US': $currency = 'USD'; break; case 'PH': $currency = 'PHP'; break; case 'CN': $currency = 'CNY'; break; case 'TA': $currency = 'THB'; break; } $bankInfo = $TK_CF; // 은행정보 $shop_bank_arr = explode("||",$bankInfo['shop_bank']); foreach($shop_bank_arr as $v){ $bank_arr = explode("^",$v); if($bank_arr[0]) { $bankInfo['shop_bank_all'][] = array( 'shop_bank_name' => $bank_arr[0], 'shop_bank_number' => $bank_arr[1] ); } } $shop_bank_lang_arr = explode("||",$bankInfo['shop_bank_lang']); foreach($shop_bank_lang_arr as $v){ $bank_arr = explode("^",$v); if($bank_arr[0]) { $bankInfo['shop_bank_all_lang'][] = array( 'shop_bank_name' => $bank_arr[0], 'shop_bank_number' => $bank_arr[1] ); } } //p($bankInfo['shop_bank_all_lang']); $krwAccount = array(); $usdAccount = array(); $twdAccount = array(); $hkdAccount = array(); $accountHolder = "KANG ILGOO"; foreach($bankInfo['shop_bank_all_lang'] as $item){ p($item['BankName']); if(strpos($item['shop_bank_name'], 'HSBC') !== false){ continue; } if(strpos($item['shop_bank_name'], 'HKD') !== false){ $bankName = explode("|", $item['shop_bank_name']); $bankName = trim($bankName[1]); $bankAccountNumber = $item['shop_bank_number']; $hkdAccount['bankName'] = $bankName; $hkdAccount['bankAccountNumber'] = $bankAccountNumber; $hkdAccount['holder'] = $accountHolder; } if(strpos($item['shop_bank_name'], 'TWD') !== false){ $bankName = explode("|", $item['shop_bank_name']); $bankName = trim($bankName[1]); $bankAccountNumber = $item['shop_bank_number']; $twdAccount['bankName'] = $bankName; $twdAccount['bankAccountNumber'] = $bankAccountNumber; $twdAccount['holder'] = $accountHolder; } if(strpos($item['shop_bank_name'], 'USD') !== false){ $bankName = explode("|", $item['shop_bank_name']); $bankName = trim($bankName[1]); $bankAccountNumber = $item['shop_bank_number']; $usdAccount['bankName'] = $bankName; $usdAccount['bankAccountNumber'] = $bankAccountNumber; $usdAccount['holder'] = $accountHolder; } if(strpos($item['shop_bank_name'], 'KRW') !== false){ $bankName = explode("|", $item['shop_bank_name']); $bankName = trim($bankName[1]); $bankAccountNumber = $item['shop_bank_number']; $krwAccount['bankName'] = $bankName; $krwAccount['bankAccountNumber'] = $bankAccountNumber; $krwAccount['holder'] = $accountHolder; } } $bankAccountInfo = array('USD' => $usdAccount,'TWD' => $twdAccount,'HKD' => $hkdAccount); //p($bankAccountInfo); ?> <html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=utf-8"> <meta name=ProgId content=Excel.Sheet> <meta name=Generator content="Microsoft Excel 10"> <style> <!-- table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";} @page {margin:1.0in .75in 1.0in .75in; mso-header-margin:.5in; mso-footer-margin:.5in;} --> </style> <!--[if gte mso 9]><xml> <x:ExcelWorkbook> <x:ExcelWorksheets> <x:ExcelWorksheet> <x:Name>Sheet1</x:Name> <x:WorksheetOptions> <x:Print> <x:ValidPrinterInfo/> </x:Print> <x:Selected/> </x:WorksheetOptions> </x:ExcelWorksheet> </x:ExcelWorksheets> </x:ExcelWorkbook> </xml><![endif]--> <meta http-equiv=Content-Language content=ko> </head> <body> <table> <tr> <td><!-- start --> <table cellspacing="0" cellpadding="2" bordercolor="#999999" bordercolordark="#FFFFFF" border="1"> <tr> <td colspan="10" rowspan="3" style="text-align:center" align="center"> <h1><img width="200" align="center" style="width:200px;margin:0 auto" src="http://www.tktravelkorea.com/admin/image/b2b/excel/b2b_month_top.png" /></h1> </td> </tr> </table> </td><!-- end --> </tr> <tr height="20"> <td><!-- space start --> </td><!-- space end --> </tr> <tr> <td><!-- start --> <table cellspacing="0" cellpadding="2" bordercolor="#999999" bordercolordark="#FFFFFF" border="1"> <tr bgcolor="#000000"> <td colspan="10" style="text-align:center;color:#fff"> 판매자정보 </td> </tr> <tr> <td rowspan="3" bgcolor="#000000" style="color:#fff" align="center" colspan="2">업체정보</td> <td bgcolor="#cccccc" align="center">회사명</td> <td><?=$agent_info['name']?></td> <td colspan="2" align="center" bgcolor="#cccccc">회사주소</td> <td colspan="4"><?=$agent_info['addr']?></td> </tr> <tr> <td bgcolor="#cccccc" align="center">담당자 이름</td> <td><?=$agent_info['ceo']?></td> <td rowspan="2" colspan="2" bgcolor="#cccccc" align="center">연락처</td> <td bgcolor="#cccccc" align="center">직통번호</td> <td colspan="3"><?=$agent_info['tel']?></td> </tr> <tr> <td bgcolor="#cccccc" align="center">이메일 주소</td> <td><!--tktraveldeveloper@icloud.com--></td> <td bgcolor="#cccccc" align="center">Mobile</td> <td colspan="3"><!--01021330111--></td> </tr> </table> </td><!-- end --> </tr> <tr height="20"> <td><!-- space start --> </td><!-- space end --> </tr> <tr> <td><!-- start --> <table cellspacing="0" cellpadding="2" bordercolor="#999999" bordercolordark="#FFFFFF" border="1"> <tr> <td bgcolor="#ff1493" colspan="3" align="center" style="color:#ffffff">총금액(KRW)</td> <td align="center"></td> <td colspan="3" align="center">총금액(HKD)</td> <td colspan="3"><?=number_format($grandTotalPrice)?>원</td> </tr> <tr> <td rowspan="2" colspan="3" bgcolor="#000000" style="color:#ffffff" align="center">정산기간 (<?=$period_mm?>月)</td> <td bgcolor="#cccccc" align="center">시작일 ~ 종료일</td> <td bgcolor="#000000" style="color:#ffffff" align="center" colspan="3"rowspan="2">청구사 정보</td> <td bgcolor="#cccccc" align="center">담당자</td> <td colspan="2" bgcolor="#cccccc" align="center">작성일</td> </tr> <tr> <td><?=$calStartDate?> ~ <?=$calEndDate?></td> <td></td> <td colspan="2"></td> </tr> </table> </td><!-- end --> </tr> <tr height="20"> <td><!-- space start --> </td><!-- space end --> </tr> <tr> <td><!-- start --> <table cellspacing="0" cellpadding="2" bordercolor="#999999" bordercolordark="#FFFFFF" border="1"> <tr height="35"> <th align="center" bgcolor="#000000" style="color:#ffffff" rowspan="<?=$firstRowsCnt?>">상품내용</th> <th align="center" bgcolor="#E7E7E7">번호</th> <th align="center" bgcolor="#E7E7E7">사용일</th> <th align="center" bgcolor="#E7E7E7">상품명</th> <th align="center" bgcolor="#E7E7E7">인원/수량</th> <th align="center" bgcolor="#E7E7E7">구분</th> <th align="center" bgcolor="#E7E7E7">단가</th> <th align="center" bgcolor="#E7E7E7">소계</th> <th align="center" bgcolor="#E7E7E7">추가옵션</th> <th align="center" bgcolor="#E7E7E7">비고</th> </tr> <?php $no = 1; $grandTotalCnt = 0; $grandTotalPrice = 0; foreach($resData as $item){ //어덜트영역 if($item['adultCnt'] > 0) { $grandTotalPrice += ($item['adultUnitPrice'] * $item['adultCnt']); $grandTotalCnt += $item['adultCnt']; ?> <tr> <td align="center"><?=$no?></td> <td align="center"><?=$item['start_date']?></td> <td align="center"><?=$item['g_title']?></td> <td align="right"><?=$item['adultCnt']?></td> <td align="center">대인</td> <td align="right"><?=number_format($item['adultUnitPrice'])?></td> <td align="right"><?=number_format($item['adultUnitPrice'] * $item['adultCnt'])?></td> <td align="center"></td> <td align="center"></td> </tr> <?php $no++; } //차일드영역 if($item['childCnt'] > 0) { $grandTotalPrice += ($item['childUnitPrice'] * $item['childCnt']); $grandTotalCnt += $item['childCnt']; ?> <tr> <td align="center"><?=$no?></td> <td align="center"><?=$item['start_date']?></td> <td align="center"><?=$item['g_title']?></td> <td align="right"><?=$item['childCnt']?></td> <td align="center">소인</td> <td align="right"><?=number_format($item['childUnitPrice'])?></td> <td align="right"><?=number_format($item['childUnitPrice'] * $item['childCnt'])?></td> <td align="center"></td> <td align="center"></td> </tr> <?php $no++; } //베이비영역 if($item['babyCnt'] > 0) { $grandTotalPrice += ($item['babyUnitPrice'] * $item['babyCnt']); $grandTotalCnt += $item['babyCnt']; ?> <tr> <td align="center"><?=$no?></td> <td align="center"><?=$item['start_date']?></td> <td align="center"><?=$item['g_title']?></td> <td align="right"><?=$item['childCnt']?></td> <td align="center">아동</td> <td align="right"><?=number_format($item['babyUnitPrice'])?></td> <td align="right"><?=number_format($item['babyUnitPrice'] * $item['ㅠ뮤ㅛCnt'])?></td> <td align="center"></td> <td align="center"></td> </tr> <?php $no++; } ?> <?php } ?> <tr> <td></td> <td bgcolor="yellow" colspan="2" align="center">합계</td> <td bgcolor="yellow" style="text-align:right"><?=number_format($grandTotalCnt)?></td> <td bgcolor="yellow"></td> <td bgcolor="yellow"></td> <td bgcolor="yellow" align="right" class="total"><?=number_format($grandTotalPrice)?></td> <td bgcolor="yellow"></td> <td bgcolor="yellow"></td> </tr> </table> </td><!-- end --> </tr> <tr height="20"> <td><!-- space start --> </td><!-- space end --> </tr> <tr> <td><!-- start --> <table cellspacing="0" cellpadding="2" bordercolor="#999999" bordercolordark="#FFFFFF" border="1"> <tr> <td bgcolor="#000000" rowspan="3" style="color:#ffffff" > 입금계좌정보 </td> <td bgcolor="#cccccc" colspan="2" align="center"> USD </td> <td bgcolor="#f7f7f7" colspan="7"> Bank Name : <?=$bankAccountInfo['USD']['bankName']?> <br><br> Name : <?=$bankAccountInfo['USD']['holder']?> / 강일구(TKTRAVEL) <br><br> Account No : <?=$bankAccountInfo['USD']['bankAccountNumber']?> <br><br> </td> </tr> <tr> <td bgcolor="#cccccc" colspan="2" align="center"> TWD </td> <td bgcolor="#f7f7f7" colspan="7"> Bank Name : <?=$bankAccountInfo['TWD']['bankName']?> <br><br> Name : <?=$bankAccountInfo['TWD']['holder']?> <br><br> Account No : <?=$bankAccountInfo['TWD']['bankAccountNumber']?> <br><br> </td> </tr> <tr> <td bgcolor="#cccccc" colspan="2" align="center"> HKD </td> <td bgcolor="#f7f7f7" colspan="7"> Bank Name : <?=$bankAccountInfo['HKD']['bankName']?> <br><br> Name : <?=$bankAccountInfo['HKD']['holder']?> <br><br> Account No : <?=$bankAccountInfo['HKD']['bankAccountNumber']?> <br><br> </td> </tr> </table> </td><!-- end --> </tr> <tr height="20"> <td><!-- space start --> </td><!-- space end --> </tr> <tr> <td><!-- start --> <table cellspacing="0" cellpadding="2" bordercolor="#999999" bordercolordark="#FFFFFF" border="1"> <tr> <td colspan="10" align="center" bgcolor="#000000" style="color:#ffffff">입금 기한 날짜</td> </tr> <tr> <td colspan="3" bgcolor="#cccccc" >비고</td> <td colspan="7"></td> </tr> </table> </td><!-- end --> </tr> <tr height="20"> <td><!-- space start --> </td><!-- space end --> </tr> <tr> <td><!-- start --> <table cellspacing="0" cellpadding="2" bordercolor="#999999" bordercolordark="#FFFFFF" border="1"> <tr> <td colspan="10" rowspan="3" style="text-align:center" align="center"> <img width="200" align="center" style="width:200px;margin:0 auto" src="http://www.tktravelkorea.com/admin/image/b2b/excel/b2b_month_bottom.png" /><br> </td> </tr> </table> </td><!-- end --> </tr> </table> </body> </html>