ÿØÿà 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/res_hotel/ |
Upload File : |
// 2019-10-18 통화단위당 원화 var ext_to_krw = parseInt($("input[name='ext_to_krw']").val()); //가격추가 테이블 var _HTML_ADDON_PRICE=''; _HTML_ADDON_PRICE = ' <tr class="{CLASS}" style="text-align:center;">'; _HTML_ADDON_PRICE += ' <td>{INPUT}</td>'; _HTML_ADDON_PRICE += ' <td style="text-align: left;">{TITLE}</td>'; _HTML_ADDON_PRICE += ' <td>{DATE}</td>'; _HTML_ADDON_PRICE += ' <td><input type="text" class="input_text" name="buy_price_arr[]" value="{COST_PRICE}" value_old="0" size="11" style="text-align:right;ime-mode:disabled;" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);if($(this).val()!=$(this).attr(\'value_old\')){}"></td>'; _HTML_ADDON_PRICE += ' <td><input type="text" class="input_text" name="agent_price_arr[]" value="{AGENT_PRICE}" value_old="0" size="11" style="text-align:right;ime-mode:disabled;" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);if($(this).val()!=$(this).attr(\'value_old\')){}"></td>'; _HTML_ADDON_PRICE += ' <td style="text-align:center;"><input type="hidden" name="sell_price_arr_fr[]" value="{SELL_PRICE_FR}" sell_price_fr_old="{SELL_PRICE_FR}" value_old="0"><input type="text" class="input_text" name="sell_price_arr[]" value="{SELL_PRICE}" sell_price_old="{SELL_PRICE_OLD}" value_old="0" size="11" style="text-align:right;ime-mode:disabled;" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);if($(this).val()!=$(this).attr(\'value_old\')){}"></td>'; _HTML_ADDON_PRICE += ' <td style="text-align:center;">{COUNT}</td>'; _HTML_ADDON_PRICE += ' <td style="text-align:center;"><input type="text" class="item_buy_price_tot" name="buy_price_tot_arr[]" size="11" value="0" style="border:0px;text-align:right;backgound-Color:#fffff;" readonly></td>'; _HTML_ADDON_PRICE += ' <td style="text-align:center;"><input type="text" class="item_agent_price_tot" name="agent_price_tot_arr[]" size="11" value="0" style="border:0px;text-align:right;backgound-Color:#fffff;" readonly></td>'; _HTML_ADDON_PRICE += ' <td style="text-align:center;"><input type="hidden" class="item_sell_price_tot_fr" name="sell_price_tot_arr_fr[]" value="0"><input type="text" class="item_sell_price_tot" name="sell_price_tot_arr[]" size="11" value="0" style="border:0px;text-align:right;backgound-Color:#fffff;" readonly></td>'; _HTML_ADDON_PRICE += ' <td style="text-align:center;"><input type="text" name="comt_arr[]" size="15" class="input_text" value=""></td>'; _HTML_ADDON_PRICE += ' <td>{CONTROL_BTN}</td>'; _HTML_ADDON_PRICE += '</tr>'; // 전체 금액 최종 계산 function dateDwCal38() { var buy_price_tot=0, agent_price_tot=0, sell_price_tot=0; var sell_price_tot_fr=0; var discount_buy=parseInt($("input[name='discount_buy']").val().replace(/,/g,'')); // 매입금액 할인 var discount_agent=parseInt($("input[name='discount_agent']").val().replace(/,/g,'')); // 매입금액 할인 var discount_sell=parseInt($("input[name='discount_sell']").val().replace(/,/g,'')); // 판매금액 할인 var discount_sell_old=parseInt($("input[name='discount_sell']").attr("value_old").replace(/,/g,'')); // 판매금액 할인 var discount_sell_fr=parseInt($("input[name='discount_sell_fr']").val()); // 판매금액 할인 if(discount_sell_old != discount_sell) { discount_sell_fr = parseInt(Math.round(discount_sell/ext_to_krw)); } if( !discount_sell_fr || discount_sell_fr==undefined) discount_sell_fr = '0'; $("input[name='discount_sell_fr']").val(discount_sell_fr); // 매입금액 합계 $(".item_buy_price_tot").each(function(){ buy_price_tot+=parseInt($(this).val().replace(/,/g,'')); }); buy_price_tot = buy_price_tot-discount_buy; // 거래처가 합계 $(".item_agent_price_tot").each(function(){ agent_price_tot+=parseInt($(this).val().replace(/,/g,'')); }); agent_price_tot = agent_price_tot-discount_agent; // 판매금액 합계 $(".item_sell_price_tot").each(function(){ sell_price_tot+=parseInt($(this).val().replace(/,/g,'')); }); sell_price_tot = sell_price_tot-discount_sell; // 판매금액 합계 외화 $(".item_sell_price_tot_fr").each(function(){ sell_price_tot_fr+=parseInt($(this).val()); }); sell_price_tot_fr = sell_price_tot_fr-discount_sell_fr; $("#item_buy_gtot").html(number_format(buy_price_tot.toString()));// 매입금액 총계 $("#item_agent_gtot").html(number_format(agent_price_tot.toString()));// 매입금액 총계 $("#item_sell_gtot").html(number_format(sell_price_tot.toString()));// 판매금액 총계 // 매입금액,판매금액 파라메터 $("#frm_ins input[name='sales_total']").val(sell_price_tot); $("#frm_ins input[name='buy_total']").val(buy_price_tot); $("#frm_ins input[name='agent_total']").val(agent_price_tot); $("#frm_ins input[name='sales_total_fr']").val(sell_price_tot_fr); return true; } // 매입금액/판매금액 소계 function dateDwLine($obj_input) { // 매입금액 & 판매금액 소계 var buy_price_s = $obj_input.parent().parent().find("input[name='buy_price_arr[]'] ").val().replace(/,/g,''); var agent_price_s = $obj_input.parent().parent().find("input[name='agent_price_arr[]'] ").val().replace(/,/g,''); var sell_price_s = $obj_input.parent().parent().find("input[name='sell_price_arr[]'] ").val().replace(/,/g,''); var sell_price_s_fr = $obj_input.parent().parent().find("input[name='sell_price_arr_fr[]'] ").val(); var i_count_s = $obj_input.parent().parent().find("input[name='i_count_arr[]'] ").val().replace(/,/g,''); //2019-10-18 원 판매금액과 비교하여 판매금액이 변경되면 각 통화값도 변경 var sell_price_s_old = $obj_input.parent().parent().find("input[name='sell_price_arr[]'] ").attr("value_old").replace(/,/g,''); if(sell_price_s != sell_price_s_old) { var sell_price_s_fr = parseInt(Math.round(sell_price_s/ext_to_krw)); $obj_input.parent().parent().find("input[name='sell_price_arr_fr[]']").val(sell_price_s_fr); } var buy_price_t = parseInt(buy_price_s) * parseInt(i_count_s); // 매입금 소계 var agent_price_t = parseInt(agent_price_s) * parseInt(i_count_s); // 매입금 소계 var sell_price_t = parseInt(sell_price_s) * parseInt(i_count_s);// 판매금 소계 var sell_price_t_fr = parseInt(sell_price_s_fr) * parseInt(i_count_s);// 판매금 소계 외화 $obj_input.parent().parent().find(".item_buy_price_tot").val(number_format(buy_price_t.toString())); $obj_input.parent().parent().find(".item_agent_price_tot").val(number_format(agent_price_t.toString())); $obj_input.parent().parent().find(".item_sell_price_tot").val(number_format(sell_price_t.toString())); $obj_input.parent().parent().find(".item_sell_price_tot_fr").val(sell_price_t_fr.toString()); // 전체금액 계산 dateDwCal38(); } // 옵션상품 매입금액/판매금액 소계 function dateDwLineOption($obj_input) { // 매입금액 & 판매금액 소계 var buy_price_s = $obj_input.parent().parent().find("input[name='op_buy_price_arr[]'] ").val().replace(/,/g,''); var sell_price_s = $obj_input.parent().parent().find("input[name='op_sell_price_arr[]'] ").val().replace(/,/g,''); var sell_price_s_fr = $obj_input.parent().parent().find("input[name='op_sell_price_arr_fr[]'] ").val(); var op_num = $obj_input.parent().parent().find("input[name='op_num_arr[]'] ").val().replace(/,/g,''); //2019-10-18 원 판매금액과 비교하여 판매금액이 변경되면 각 통화값도 변경 var sell_price_s_old = $obj_input.parent().parent().find("input[name='op_sell_price_arr[]'] ").attr("value_old").replace(/,/g,''); if(sell_price_s != sell_price_s_old) { var sell_price_s_fr = parseInt(Math.round(sell_price_s/ext_to_krw)); $obj_input.parent().parent().find("input[name='op_sell_price_arr_fr[]']").val(sell_price_s_fr); } var buy_price_t = parseInt(buy_price_s) * parseInt(op_num); // 매입금 소계 var sell_price_t = parseInt(sell_price_s) * parseInt(op_num);// 판매금 소계 var sell_price_t_fr = parseInt(sell_price_s_fr) * parseInt(op_num);// 판매금 소계 외화 $obj_input.parent().parent().find(".item_buy_price_tot").val(number_format(buy_price_t.toString())); $obj_input.parent().parent().find(".item_sell_price_tot").val(number_format(sell_price_t.toString())); $obj_input.parent().parent().find(".item_sell_price_tot_fr").val(sell_price_t_fr); // 전체금액 계산 dateDwCal38(); } //매입금액/판매금액 아래 항목에 카피 function cp_price($obj_input) { var gu=$obj_input.parent().parent().find("input[name='gu_arr[]']").val(); // 구분 var input_nm = $obj_input.attr("name"); var obj_hotel_i = $(".itemTableTrRoomDateOut input[name='"+input_nm+"']"); var obj_over_i = $(".itemTableTrRoomDateOverInwon input[name='"+input_nm+"']"); var hotel_i_no = obj_hotel_i.index($obj_input); // 호텔항목 순서 var over_i_no = obj_over_i.index($obj_input); // 초과인원항목 순서 // 호텔항목의 매입금액을 다른항목에 카피 if(hotel_i_no==0 && obj_hotel_i.length>1){ if(!confirm('다른항목으로 카피하시겠습니까?')) return; //obj_hotel_i.val($obj_input.val()); obj_hotel_i.each(function(){ $(this).val($obj_input.val()); dateDwLine($(this)); // 판매소계 }); } // 초과인원항목의 매입금액을 다른항목에 카피 if(over_i_no==0 && obj_over_i.length>1){ if(!confirm('다른항목으로 카피하시겠습니까?')) return; //obj_over_i.val($obj_input.val()); obj_over_i.each(function(){ $(this).val($obj_input.val()); dateDwLine($(this)); // 판매소계 }); } // 전체금액 계산 var r=dateDwCal38(); } //추가항목 추가 function addRowItem() { console.log('추가항목 추가'); var _tmp = _HTML_ADDON_PRICE.replace('{INPUT}','<input type="checkbox" name="" class="itemCheckBoxAddOn" value="">'); _tmp = _tmp.replace('{TITLE}','<input type="hidden" name="gu_arr[]" value="A"><input name="itemnm_arr[]" type="text" class="input_text" value="" size="13" hname="추가항목" required>'); _tmp = _tmp.replace('{DATE}','<input name="room_date_arr[]" type="text" class="cal_input" value="'+cur_date()+'" readonly onclick="AjaxCal(this,event)" size="13" hname="이용일자" required>'); _tmp = _tmp.replace('{COUNT}','<input type="text" class="input_text item_count" name="i_count_arr[]" size="4" maxlength="3" value="0" style="text-align:center;ime-mode:disabled;" onkeydown="ChkNum(this,event);">'); _tmp = _tmp.replace('{COST_PRICE}',0); _tmp = _tmp.replace('{AGENT_PRICE}',0); _tmp = _tmp.replace('{SELL_PRICE}',0); _tmp = _tmp.replace('{SELL_PRICE_FR}',0); _tmp = _tmp.replace('{CLASS}','itemTableTrAddOn'); _tmp = _tmp.replace('{CONTROL_BTN}','<input type="button" class="Table_btn blue itemButtonDelRow" value="삭제">'); htmlStr = _tmp; $(".item_addon_price_box tbody").append(htmlStr); // 매입금액/판매금액 소계 $(".itemTableTrAddOn input[name='buy_price_arr[]']").on("blur",function(){ dateDwLine($(this)); }); // 매입금액/판매금액 소계 $(".itemTableTrAddOn input[name='agent_price_arr[]']").on("blur",function(){ dateDwLine($(this)); }); $(".itemTableTrAddOn input[name='sell_price_arr[]']").on("blur",function(){ dateDwLine($(this)); }); $(".itemTableTrAddOn input[name='i_count_arr[]']").on("blur",function(){ dateDwLine($(this)); }); // 추가항목 삭제 $(".itemButtonDelRow").on("click",function(){ delRowItem($(this));// 추가항목 삭제 }); } //추가항목 삭제 function delRowItem($obj) { // 추가항목 삭제 $obj.parent().parent().remove(); // 전체금액 계산 var r=dateDwCal38(); } // 입실일/숙박일수 에 따른 항목생성 function ckRoomDateOut() { console.log('ckRoomDateOut'); var room_date = $("#room_date").val(); // 체크인 var room_day = $("#room_day").val(); // 숙박일 수 var room_cnt = $("#room_cnt").val(); // 객실수 var room_date_out = ''; room_date_out = setafterday(room_date,room_day); // 퇴실일 $("#room_date_out").val(room_date_out); // 기존 항목 백업 // 추가 항목 호텔 룸 var old_val_arr = new Array(); var n=0; $(".item_addon_price_box .itemTableTrRoomDateOut").each(function(){ var room_date = $(this).find("input[name='room_date_arr[]']").val(); var buy_price = $(this).find("input[name='buy_price_arr[]']").val(); var agent_price = $(this).find("input[name='agent_price_arr[]']").val(); var sell_price = $(this).find("input[name='sell_price_arr[]']").val(); var comt = $(this).find("input[name='comt_arr[]']").val(); old_val_arr[n]=[room_date,buy_price,agent_price,sell_price,comt]; n++; }); // 기존 항목 백업 // 초과인원 var old_val_arr2 = new Array(); var n=0; $(".item_addon_price_box .itemTableTrRoomDateOverInwon").each(function(){ var room_date = $(this).find("input[name='room_date_arr[]']").val(); var agent_price = $(this).find("input[name='agent_price_arr[]']").val(); var buy_price = $(this).find("input[name='buy_price_arr[]']").val(); var sell_price = $(this).find("input[name='sell_price_arr[]']").val(); var comt = $(this).find("input[name='comt_arr[]']").val(); old_val_arr2[n]=[room_date,buy_price,agent_price,sell_price,comt]; n++; }); // // mode값이 hotel이면 호텔검색에서 넘어온 정보에 입실가격을 일자별로 세팅 // var sell_price_arr=new Array(); // 일자별 가격 var sell_price_arr_fr=new Array(); // 일자별 가격 var cost_price_arr=new Array(); // 일자별 공급가 var agent_price_arr=new Array(); // 일자별 거래처가 console.log(mode); if(mode=='hotel') { console.log("ajax hotelResRegFormHotel.jason.html"); var params = 'hseq='+hseq+'&ridx='+ridx+'&room_date='+room_date+'&room_cnt='+room_cnt+'&room_day='+room_day; $.ajax({ dataType:'json', url: "hotelResRegFormHotel.jason.html", async: false, data: params, success: function(data,status){ cost_price_arr=data.r_price_cost_arr; // 일자별 공급가 agent_price_arr=data.r_price_agent_arr; // 일자별 공급가 sell_price_arr=data.r_price_sell_arr; // 일자별 가격 sell_price_arr_fr=data.r_price_sell_arr_fr; // 일자별 가격 }, fail: function(){ alert('중대한 오류가 발생했습니다.!!'); }, complete: function(){ // } }); } // // 항목 호텔 룸 // 일자만큼 입실 항목 생성 // var htmlStr='',rdt,rdt2; for(var i=1,j=0 ; i<=room_day ; i++,j++ ) { var _tmp=''; rdt2 = dateAddDel(room_date, j, 'd'); rdt = rdt2 + '<input type="hidden" name="room_date_arr[]" value="'+rdt2+'">'; _tmp = _HTML_ADDON_PRICE.replace('{TITLE}','객실금액<input type="hidden" name="gu_arr[]" value="R"><input name="itemnm_arr[]" type="hidden" class="input_text" value="객실금액" size="13">'); _tmp = _tmp.replace('{DATE}',rdt); _tmp = _tmp.replace('{COUNT}','<input type="text" class="item_count" name="i_count_arr[]" size="4" value="'+room_cnt+'" style="border:0px;text-align:center;backgound-Color:#fffff;" readonly>'); _tmp = (cost_price_arr[j]>0) ? _tmp.replace('{COST_PRICE}',number_format(cost_price_arr[j])): _tmp.replace('{COST_PRICE}','0'); _tmp = (agent_price_arr[j]>0) ? _tmp.replace('{AGENT_PRICE}',number_format(agent_price_arr[j])): _tmp.replace('{AGENT_PRICE}','0'); _tmp = (sell_price_arr[j]>0) ? _tmp.replace('{SELL_PRICE}',number_format(sell_price_arr[j])): _tmp.replace('{SELL_PRICE}','0'); _tmp = (sell_price_arr[j]>0) ? _tmp.replace('{SELL_PRICE_OLD}',number_format(sell_price_arr[j])): _tmp.replace('{SELL_PRICE_OLD}','0'); _tmp = (sell_price_arr_fr[j]>0) ? _tmp.replace('{SELL_PRICE_FR}',sell_price_arr_fr[j]): _tmp.replace('{SELL_PRICE_FR}','0'); _tmp = _tmp.replace('{CLASS}','itemTableTrRoomDateOut itemTableTrRoom'); _tmp = _tmp.replace('{INPUT}',''); _tmp = _tmp.replace('{CONTROL_BTN}','-'); htmlStr = htmlStr + _tmp; // TR테이블 } // // 항목 초과인원 // 일자만큼 입실 항목 생성 // var over_inwon=parseInt($("#room_adult_num option:checked").attr("over_inwon")); var sell_price=0; var sell_price_fr=0; if(mode=='hotel') { sell_price=number_format(person_max_price.toString()); // 호텔검색에서 넘어온 초과금액 sell_price_fr=number_format(person_max_price_fr.toString()); // 호텔검색에서 넘어온 초과금액 } if(over_inwon>0) { for(var i=1,j=0 ; i<=room_day ; i++,j++) { var _tmp=''; rdt2 = dateAddDel(room_date, j, 'd'); rdt = rdt2 + '<input type="hidden" name="room_date_arr[]" value="'+rdt2+'">'; _tmp = _HTML_ADDON_PRICE.replace('{TITLE}','객실초과인원<input type="hidden" name="gu_arr[]" value="U"><input name="itemnm_arr[]" type="hidden" class="input_text" value="객실초과인원" size="13">'); _tmp = _tmp.replace('{DATE}',rdt); _tmp = _tmp.replace('{COUNT}','<input type="text" class="item_count" name="i_count_arr[]" size="4" value="'+over_inwon+'" style="border:0px;text-align:center;backgound-Color:#fffff;" readonly>'); _tmp = _tmp.replace('{COST_PRICE}',buy_price); _tmp = _tmp.replace('{AGENT_PRICE}',agent_price); _tmp = _tmp.replace('{SELL_PRICE}',sell_price); _tmp = _tmp.replace('{SELL_PRICE_FR}',sell_price_fr); _tmp = _tmp.replace('{CLASS}','itemTableTrRoomDateOverInwon itemTableTrRoom'); _tmp = _tmp.replace('{INPUT}',''); _tmp = _tmp.replace('{CONTROL_BTN}','-'); htmlStr = htmlStr + _tmp; // TR테이블 }} // 기존항목을 지움 $(".item_addon_price_box .itemTableTrRoom").remove(); // 추가항목 - 호텔룸 // 생성된 일자를 테이블에 그려 넣기(호텔룸/초과인원) $(".item_addon_price_box tbody").prepend(htmlStr); // 추가 항목 호텔 룸 // 새로운항목에 기존항목의 값들을 넣어줌 $.each(old_val_arr,function(i,arr){ var room_date = arr[0]; var adult_buy = arr[1]; var adult_agent = arr[2]; var adult_price = arr[3]; var adult_comt = arr[4]; $(".item_addon_price_box .itemTableTrRoomDateOut").each(function(){ if($(this).find("input[name='room_date_arr[]']").val()==room_date) { $(this).find("input[name='buy_price_arr[]']").val(adult_buy); $(this).find("input[name='agent_price_arr[]']").val(adult_agent); $(this).find("input[name='sell_price_arr[]']").val(adult_price); $(this).find("input[name='comt_arr[]']").val(adult_comt); } }); }); // 추가 항목 초과인원 // 새로운항목에 기존항목의 값들을 넣어줌 $.each(old_val_arr2,function(i,arr){ var room_date = arr[0]; var adult_buy = arr[1]; var adult_agent = arr[2]; var adult_price = arr[3]; var adult_comt = arr[4]; $(".item_addon_price_box .itemTableTrRoomDateOverInwon").each(function(){ if($(this).find("input[name='room_date_arr[]']").val()==room_date) { $(this).find("input[name='buy_price_arr[]']").val(adult_buy); $(this).find("input[name='agent_price_arr[]']").val(adult_agent); $(this).find("input[name='sell_price_arr[]']").val(adult_price); $(this).find("input[name='comt_arr[]']").val(adult_comt); } }); }); // 호텔항목 // 매입금액/판매금액 더블클릭시 아래항목으로 가격카피 $(".itemTableTrRoomDateOut input[name='buy_price_arr[]']").on("dblclick",function(){ cp_price($(this)); }); $(".itemTableTrRoomDateOut input[name='agent_price_arr[]']").on("dblclick",function(){ cp_price($(this)); }); $(".itemTableTrRoomDateOut input[name='sell_price_arr[]']").on("dblclick",function(){ cp_price($(this)); }); // 초과인원 항목 // 매입금액/판매금액 더블클릭시 아래항목으로 가격카피 $(".itemTableTrRoomDateOverInwon input[name='buy_price_arr[]']").on("dblclick",function(){ cp_price($(this)); }); $(".itemTableTrRoomDateOverInwon input[name='agent_price_arr[]']").on("dblclick",function(){ cp_price($(this)); }); $(".itemTableTrRoomDateOverInwon input[name='sell_price_arr[]']").on("dblclick",function(){ cp_price($(this)); }); // 매입금액 소계 $(".itemTableTrRoom input[name='buy_price_arr[]']").on("blur",function(){ dateDwLine($(this)); }); // 거래처가 소계 $(".itemTableTrRoom input[name='agent_price_arr[]']").on("blur",function(){ dateDwLine($(this)); }); // 판매금액 소계 $(".itemTableTrRoom input[name='sell_price_arr[]']").on("blur",function(){ dateDwLine($(this)); }); } // 성인 기준인원(person_num) 체크,성인 최대 인원(person_maxnum) 체크 ,소인 최대인원(child_maxnum) 체크 function ckPersonNum() { var $person_num=$("#person_num"); var $person_maxnum=$("#person_maxnum"); var $child_maxnum=$("#child_maxnum"); if(parseInt($person_num.val())<=0 || parseInt($person_maxnum.val())<=0) { $person_num.val($person_num.attr("old_val")); $person_maxnum.val($person_maxnum.attr("old_val")); return; } // 성인 최대인원(person_maxnum)이 성인 기준인원(person_num)보다 항상 크다 if(parseInt($person_maxnum.val())<parseInt($person_num.val())){ alert('성인 기준인원은 성인 최대인원을 초과할 수 없습니다.'); $person_num.val($person_num.attr("old_val")); $person_maxnum.val($person_maxnum.attr("old_val")); return; } // 이전 값 보관 $person_num.attr("old_val",$person_num.val()); $person_maxnum.attr("old_val",$person_maxnum.val()); $child_maxnum.attr("old_val",$child_maxnum.val()); } // 성인/소인 숙박인원 인원수 세팅 function ckSelAdultChild() { var person_num=$("#person_num").val(); // 성인 기준인원 var person_maxnum=$("#person_maxnum").val();// 성인 최대인원 var old_room_adult_num=$("#room_adult_num").val(); // 기존값 var old_room_child_num=$("#room_child_num").val(); var room_cnt=$("#room_cnt").val(); // 객실수 var sel=''; // 성인숙박인원=성인기준인원*객실수+성인최대인원*객실수 var room_adult_num_to = (person_num*room_cnt)+((person_maxnum-person_num)*room_cnt); var room_adult_num = (person_num*room_cnt); $("#room_adult_num option").remove(); for(var i=0,over_inwon=1;i<=room_adult_num_to;i++){ sel=''; if(old_room_adult_num==i) sel='selected'; if (room_adult_num<i) {// 기준인원을 초과하면 초과인원으로 세팅 $("#room_adult_num").append("<option value='"+i+"' style='background-color:red;' "+sel+" over_inwon='"+over_inwon+"' >"+i+"</option>"); over_inwon++; }else $("#room_adult_num").append("<option value='"+i+"' "+sel+">"+i+"</option>"); } // 소인숙박인원 var child_maxnum=$("#child_maxnum").val(); var room_child_num_to = child_maxnum*room_cnt; $("#room_child_num option").remove(); for(var i=0;i<=room_child_num_to;i++){ sel=''; if(old_room_child_num==i) sel='selected'; $("#room_child_num").append("<option value='"+i+"' "+sel+">"+i+"</option>"); } } // 숙박자 입력목록 세칭 function ckRoomPersonIns() { var _HTML_ADDON_PERSON=''; _HTML_ADDON_PERSON = '<tr class="itemAddonPerson">'; _HTML_ADDON_PERSON += '<td>'; _HTML_ADDON_PERSON += ' <input name="generation_arr[]" type="hidden" value="{GENERATION}">{GENERATION_STR} '; _HTML_ADDON_PERSON += '</td>'; _HTML_ADDON_PERSON += '<td>'; _HTML_ADDON_PERSON += ' <select name="gend_arr[]" style="width:30px;"> '; _HTML_ADDON_PERSON += ' <option value=""></option>'; _HTML_ADDON_PERSON += ' <option value="M" {GEND_M}>남</option>'; _HTML_ADDON_PERSON += ' <option value="F" {GEND_F}>여</option>'; _HTML_ADDON_PERSON += ' </select>'; _HTML_ADDON_PERSON += '</td>'; _HTML_ADDON_PERSON += '<td><input type="text" class="input_text" name="name_kor_arr[]" value="{NAME_KOR}" style="width:80px;"></td>'; _HTML_ADDON_PERSON += '<td><input type="text" class="input_text" name="name_eng1_arr[]" value="{NAME_ENG1}" style="width:55px;"> <input type="text" class="input_text" name="name_eng2_arr[]" value="{NAME_ENG2}" style="width:55px;"></td>'; _HTML_ADDON_PERSON += '<td><input type="text" class="input_text" name="tel_arr[]" value="{TEL}" style="width:80px;"></td>'; _HTML_ADDON_PERSON += '<td><input type="text" class="cal_input" name="birth_dt_arr[]" style="width:80px;" value="{BIRTH_DT}" readonly onClick="AjaxCal(this,event)"></td>'; _HTML_ADDON_PERSON += '<td><input type="text" class="input_text" name="passenger_num_arr[]" value="{PASSENGER_NUM}" style="width:80px;"></td>'; _HTML_ADDON_PERSON += '<td><input type="text" class="cal_input" name="passenger_expire_arr[]" value="{PASSENGER_EXPIRE}" style="width:80px;" readonly onClick="AjaxCal(this,event)"></td>'; _HTML_ADDON_PERSON += '<td class="txt_l pl10"><input type="text" class="input_text" name="remarks_arr[]" value="{REMARKS}" style="width:90%;"></td>'; _HTML_ADDON_PERSON += '</tr>'; // 성인숙박인원수 var adult_num=$("#room_adult_num").val(); // 아동숙박인원수 var child_num=$("#room_child_num").val(); // 기존 항목 백업 var old_person_arr = new Array(); var n=0; $("#itemTablePersonBox .itemAddonPerson").each(function(){ var generation = $(this).find("input[name='generation_arr[]']").val(); var gend = $(this).find("select[name='gend_arr[]']").val(); var name_kor = $(this).find("input[name='name_kor_arr[]']").val(); var name_eng1 = $(this).find("input[name='name_eng1_arr[]']").val(); var name_eng2 = $(this).find("input[name='name_eng2_arr[]']").val(); var tel = $(this).find("input[name='tel_arr[]']").val(); var birth_dt = $(this).find("input[name='birth_dt_arr[]']").val(); var passenger_num = $(this).find("input[name='passenger_num_arr[]']").val(); var passenger_expire = $(this).find("input[name='passenger_expire_arr[]']").val(); var remarks = $(this).find("input[name='remarks_arr[]']").val(); old_person_arr[n]=[generation,gend,name_kor,name_eng1,name_eng2,tel,birth_dt,passenger_num,passenger_expire,remarks]; n++; }); /*$.each(old_person_arr,function(i,r){ console.log(r[2]); }); console.log("=================================================================");*/ // 기존입력목록 제거 $("#itemTablePersonBox .itemAddonPerson").remove(); // 성인수만큼 tr추가 for(var i=0;i<adult_num;i++){ var _tmp=_HTML_ADDON_PERSON; _tmp=_tmp.replace('{GENERATION}','A'); _tmp=_tmp.replace('{GENERATION_STR}','성인'); $.each(old_person_arr,function(j,arr){ var generation=arr[0]; var gend=arr[1]; var name_kor=arr[2]; var name_eng1=arr[3]; var name_eng2=arr[4]; var tel=arr[5]; var birth_dt=arr[6]; var passenger_num=arr[7]; var passenger_expire=arr[8]; var remarks=arr[9]; if(j==i && generation=='A') { var gend_m='',gend_f=''; if(gend=='M') gend_m='selected'; if(gend=='F') gend_f='selected'; _tmp=_tmp.replace('{GEND_M}',gend_m); _tmp=_tmp.replace('{GEND_F}',gend_f); _tmp=_tmp.replace('{NAME_KOR}',name_kor); _tmp=_tmp.replace('{NAME_ENG1}',name_eng1); _tmp=_tmp.replace('{NAME_ENG2}',name_eng2); _tmp=_tmp.replace('{TEL}',tel); _tmp=_tmp.replace('{BIRTH_DT}',birth_dt); _tmp=_tmp.replace('{PASSENGER_NUM}',passenger_num); _tmp=_tmp.replace('{PASSENGER_EXPIRE}',passenger_expire); _tmp=_tmp.replace('{REMARKS}',remarks); } }); _tmp=_tmp.replace('{GEND_M}',''); _tmp=_tmp.replace('{GEND_F}',''); _tmp=_tmp.replace('{NAME_KOR}',''); _tmp=_tmp.replace('{NAME_ENG1}',''); _tmp=_tmp.replace('{NAME_ENG2}',''); _tmp=_tmp.replace('{TEL}',''); _tmp=_tmp.replace('{BIRTH_DT}',''); _tmp=_tmp.replace('{PASSENGER_NUM}',''); _tmp=_tmp.replace('{PASSENGER_EXPIRE}',''); _tmp=_tmp.replace('{REMARKS}',''); $("#itemTablePersonBox tbody").append(_tmp); } // 소인수만큼 tr추가 var n=9999; for(var i=0;i<child_num;i++) { var _tmp=_HTML_ADDON_PERSON; var is_break=false; _tmp=_tmp.replace('{GENERATION}','C'); _tmp=_tmp.replace('{GENERATION_STR}','소인'); $.each(old_person_arr,function(j,arr){ if(is_break==false) { var generation=arr[0]; var gend=arr[1]; var name_kor=arr[2]; var name_eng1=arr[3]; var name_eng2=arr[4]; var tel=arr[5]; var birth_dt=arr[6]; var passenger_num=arr[7]; var passenger_expire=arr[8]; var remarks=arr[9]; if(generation=='C' && (n==9999 || j>n)){ var gend_m='',gend_f=''; if(gend=='M') gend_m='selected'; if(gend=='F') gend_f='selected'; _tmp=_tmp.replace('{GEND_M}',gend_m); _tmp=_tmp.replace('{GEND_F}',gend_f); _tmp=_tmp.replace('{NAME_KOR}',name_kor); _tmp=_tmp.replace('{NAME_ENG1}',name_eng1); _tmp=_tmp.replace('{NAME_ENG2}',name_eng2); _tmp=_tmp.replace('{TEL}',tel); _tmp=_tmp.replace('{BIRTH_DT}',birth_dt); _tmp=_tmp.replace('{PASSENGER_NUM}',passenger_num); _tmp=_tmp.replace('{PASSENGER_EXPIRE}',passenger_expire); _tmp=_tmp.replace('{REMARKS}',remarks); n=j; is_break=true; } } }); _tmp=_tmp.replace('{GEND_M}',''); _tmp=_tmp.replace('{GEND_F}',''); _tmp=_tmp.replace('{NAME_KOR}',''); _tmp=_tmp.replace('{NAME_ENG1}',''); _tmp=_tmp.replace('{NAME_ENG2}',''); _tmp=_tmp.replace('{TEL}',''); _tmp=_tmp.replace('{BIRTH_DT}',''); _tmp=_tmp.replace('{PASSENGER_NUM}',''); _tmp=_tmp.replace('{PASSENGER_EXPIRE}',''); _tmp=_tmp.replace('{REMARKS}',''); $("#itemTablePersonBox tbody").append(_tmp); } }