ÿØÿà 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/ |
Upload File : |
<?php ini_set('max_inputs_vars',50000); include $_SERVER['DOCUMENT_ROOT'].'/admin/include/top_proc.html'; // 신규예약 if(!$SqlType) $SqlType="res_ins"; // 상품정보 if ( $a_idx ) { $sql = "SELECT * FROM TB_ERP_ALL WHERE a_idx='{$a_idx}'"; $rs = db_query($sql); $row = db_fetch_array($rs) ; } $require_num_comma = " style=\"ime-mode:inactive;text-align:right\" onblur=\"this.value=calcu_esti(this.value)\" onKeyUp=\"this.value=comma(this.value);\" "; // 가격입력시에 콤마+숫자필수 ?> <table width="72%" border="0" cellspacing="0" cellpadding="0"> <!-- <tr> <td valign="top"> <div class="pop_title"><div class="lo_left">생성일차</div> </td> </tr> --> <tr> <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="setting_write"> <tbody> <tr style="border-top:1.2px solid #555;"> <th 11 width="70">생성일차</th> <td> <select name="date_num" id="date_num" class="" style="width:150px;background-color:#f2fcea" onchange="create_dateform();"> <?for ($i=1 ; $i<=15 ; $i++){?> <option value="<?=$i?>"><?=$i?>일</option> <?}?> </select>   <span style="color:red;">※ 생성일차를 선택 후 행사날짜 년, 월, 일을 입력해 주세요!</span> <div style="display:inline-block;float:right;"><input type="button" class="Tbtn red" value="버스정산등록" onclick="to_dialog.iframe('bus_edit.php?x_idx=<?=$x_idx?>&window=close','버스정산등록','800','780',true,true,'yes');"></div> </td> </tr> </tbody> </table> </td> </tr> <tr> <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="setting_write item_addon_price_box"> <colgroup> <col style=" width:8%" /> <col style=" width:8%" /> <col style=" width:5%" /> <col style=" width:5%" /> <col style=" width:27%" /> <col style=" width:8%" /> <col style=" width:11%" /> <col style=" width:7%" /> <col style=" width:4%" /> <col style=" width:9%" /> <col style=" width:7%" /> </colgroup> <thead> <tr> <th>Date</th> <th>Place</th> <th colspan="2" style="width:10%">Time</th> <th>Itinerary</th> <th>Meals</th> <th class="bg_sky">세부항목</th> <th class="bg_sky">ⓐ공급가</th> <th class="bg_sky">ⓑ수량</th> <th class="bg_sky">지출비용(ⓐ*ⓑ)</th> <th class="bg_sky">판매가</th> </tr> </thead> <tbody> </tbody> </table> </td> </tr> <tr> <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="setting_write"> <colgroup> <col style=" width:19.8%" /> <col /> </colgroup> <tr> <th>Remarks</th> <td><textarea name="remarks" style="width:100%;height:100px"></textarea></td> </tr> </table> </td> </tr> <tr> <td valign="top" align="right" style="background-color:#edf0f5"> <p> </p> <table width="22.5%" border="0" cellspacing="0" cellpadding="0" class="setting_write" style="background-color:#FFF;position:fixed;right:25px;top:182px;border-radius:5px; border-top:1.2px solid #555;"> <colgroup> <col style=" width:20%" /> <col style=" width:30%" /> <col style=" width:30%" /> </colgroup> <tr style="background-color:#f2fcea"> <th style="background-color:#f2fcea;text-align:center;padding-right:10px;">구분</th> <td style="text-align:center;padding-right:10px"> <span style="color:red;">지출금액</span><br> <!-- <span id="esti_total_buy_price">₩ 0</span> --> </td> <td style="text-align:center;padding-right:10px"> <span style="color:blue;">판매금액</span><br> <!-- <span id="esti_total_sell_price">₩ 0</span> --> </td> </tr> <tr> <th style="text-align:center;padding-right:10px">소계</th> <td style="text-align:center;padding-right:10px"> <!-- <span style="color:red;">지출소계</span><br> --> <span id="esti_total_buy_price">₩ 0</span> </td> <td style="text-align:center;padding-right:10px"> <!-- <span style="color:blue;">판매소계</span><br> --> <span id="esti_total_sell_price">₩ 0</span> </td> </tr> <tr style="text-align:center;"> <th style="padding-right:10px">수수료</th> <td> <input type="text" name="fee_rate" id="fee_rate" class="input_ctext" style="width:30px;" value="0" onblur="this.value=calcu_esti(this.value);"> % </td> <td style="padding-right:10px"> <span id="fee">₩ 0</span> </td> </tr> <tr style="text-align:center;"> <th style="text-align:center;padding-right:10px;">부가세</th> <td style="text-align:center;"> <input type="text" name="surtax_rate" id="surtax_rate" class="input_ctext" style="width:30px;" value="0" onblur="this.value=calcu_esti(this.value);"> % </td> <td style="padding-right:10px"> <span id="surtax">₩ 0</span> </td> </tr> <tr style="text-align:center;"> <th style="padding-right:10px; height:22px;">최종견적합계</th> <td colspan="2" style="padding-right:10px"> <span id="last_sell_price" style="font-weight:bold;">₩ 0</span> </td> </tr> <tr style="text-align:center;"> <th style="padding-right:11px;color:red;font-weight:bold; height:22px;">회사순이익</th> <td colspan="2" style="padding-right:11px;font-weight:bold;"> <span id="esti_profit"> ₩ 0 </span> </td> </tr> </thead> <tbody> </tbody> </table> <div style="position:fixed;top:467px;right:26px;"> <a class="Bbtn red" href="javascript:;" onclick="chk_form();" style="width:70px;margin-right:10px"><i class="xi-save" style="font-size:15px;vertical-align:text-top;"></i> 저장</a> <a class="Bbtn black" value="버스정산등록" onclick="to_dialog.iframe('bus_edit.php?x_idx=<?=$x_idx?>&window=close','버스정산등록','800','780',true,true,'yes');"style="width:70px;margin-right:10px"><i class="xi-bus" style="font-size:15px;vertical-align:text-top;"></i> 버스등록</a> <a class="Bbtn black" href="https://www.tourboss.co.kr/admin/erp/erp_list.php" style="width:70px;"><i class="xi-reply" style="font-size:15px;vertical-align:text-top;"></i> 리스트</a> </div> </td> </tr> </table> <script type="text/javascript"> // 폼 저장 function chk_form() { var f = document.frm_reserv_good; var result = to_validation(f) if( result == false ) return false; $(".day_date").each(function(index){ var day_value = $(this).val(); if(day_value == ''){ var number = index +1; alert('"Day ' + number +'" 값을 입력하세요'); $(this).focus(); result = false; return false; } }); if( result == false ) return false; if(!confirm('저장하시겠습니까?')) return; //ajax_post('ajax_proc','res_proc.php','frm_reserv_good'); f.action = "res_proc.php"; f.submit(); } $(document).ready(function(){ create_dateform(); // 공급가 * 수량 = 지출비용 $("input[name$='supply_arr[]'], input[name$='count_arr[]']").blur(function(){ var p_obj = $(this).parent().parent(); var buy_obj = $(p_obj).find("input[name$='buy_arr[]']"); var supply = $(p_obj).find("input[name$='supply_arr[]']").val(); var count = $(p_obj).find("input[name$='count_arr[]']").val(); supply = replaceComma(supply); count = replaceComma(count); if(supply != '') { supply = parseInt(supply, 10); } else { supply = 0; } if(count != '') { count = parseInt(count, 10); } else { count = 0; } $(buy_obj).val(supply * count); }); }); // 생성일자 추가 function create_dateform() { // 생성일자 추가 스크립트 var html_addon_price =''; var date_num = $("#frm_reserv_good select[name='date_num']").val(); //선택된 일자 갯수 var line = 15; var line_rowspan = line; // 날짜별 for(var i=1;i<=date_num;i++) { if(i<date_num){ line_rowspan = line + 1; } else { line_rowspan = line; } // 행 for(var j=1;j<=line;j++) { if(i==date_num && j==line){ html_addon_price += '<tr class="last">'; } else { html_addon_price += '<tr>'; } if(j==1){ html_addon_price += ' <td rowspan="'+line_rowspan+'" class="last" style="text-align:center; vertical-align:top;"><span class="day">'+i+' Day</span><input type="text" name="day'+i+'" class="input_text day_date"></td>'; } html_addon_price += ' <td><input type="text" name="day'+i+'_place_arr[]" class="input_text" ></td>'; html_addon_price += ' <td><input type="text" name="day'+i+'_time_start_arr[]" class="input_text"></td>'; html_addon_price += ' <td><input type="text" name="day'+i+'_time_end_arr[]" class="input_text"></td>'; html_addon_price += ' <td><input type="text" name="day'+i+'_info_arr[]" class="input_text"></td>'; html_addon_price += ' <td><input type="text" name="day'+i+'_food_arr[]" class="input_text"></td>'; html_addon_price += ' <td><input type="text" name="day'+i+'_item_arr[]" class="input_text"></td>'; html_addon_price += ' <td><input type="text" name="day'+i+'_supply_arr[]" class="input_rtext" value="0" <?=$require_num_comma;?>></td>'; html_addon_price += ' <td><input type="text" name="day'+i+'_count_arr[]" class="input_ctext"></td>'; html_addon_price += ' <td><input type="text" name="day'+i+'_buy_arr[]" id="day'+i+'_buy'+j+'" class="input_rtext" value="0" <?=$require_num_comma;?>></td>'; html_addon_price += ' <td><input type="text" name="day'+i+'_sell_arr[]" id="day'+i+'_sell'+j+'" class="input_rtext" value="0" <?=$require_num_comma;?>></td>'; html_addon_price += '<input type="hidden" name="date_num_arr[]" value="'+i+'">'; html_addon_price += '</tr>'; } // 호텔정보 (마지막 날짜는 호텔정보를 뺌) if(i<date_num){ html_addon_price += '<tr class="last">'; html_addon_price += ' <td> </td>'; html_addon_price += ' <td colspan=2>HOTEL Information</td>'; html_addon_price += ' <td><input type="text" name="hotel'+i+'_info_arr[]" class="input_text"></td>'; html_addon_price += ' <td> </td>'; html_addon_price += ' <td><input type="text" name="hotel'+i+'_item_arr[]" class="input_text"></td>'; html_addon_price += ' <td> </td>'; html_addon_price += ' <td> </td>'; html_addon_price += ' <td><input type="text" name="hotel'+i+'_buy_arr[]" id="hotel'+i+'_buy" class="input_rtext" value="0" <?=$require_num_comma;?>></td>'; html_addon_price += ' <td><input type="text" name="hotel'+i+'_sell_arr[]" id="hotel'+i+'_sell" class="input_rtext" value="0" <?=$require_num_comma;?>></td>'; html_addon_price += '</tr>'; } } $(".item_addon_price_box tbody").html(html_addon_price); } //합계 계산하기 function calcu_esti(val) { var date_num = $("#frm_reserv_good select[name='date_num']").val(); //선택된 일자 갯수 var total_day_buy = "0"; //각 상품 입금가 합계 var total_day_sell = "0"; //각 상품 판매가 합계 var total_hotel_buy = "0"; //각 호텔 입금가 합계 var total_hotel_sell = "0"; //각 호텔 판매가 합계 var total_buy_price = "0"; //상품 total입금가 + 호텔 total입금가 var total_sell_price = "0"; //상품 total판매가 + 호텔 total판매가 var fee = "0"; // 수수료 var surtax = "0"; // 부가세 for(var i=1;i<=date_num;i++) { for(var j=1;j<=15;j++) { var each_day_buy = replaceComma($("#day"+i+"_buy"+j).val()); var each_day_sell = replaceComma($("#day"+i+"_sell"+j).val()); total_day_buy = parseInt(total_day_buy) + parseInt(each_day_buy); total_day_sell = parseInt(total_day_sell) + parseInt(each_day_sell); } if($("#hotel"+i+"_buy").val()==undefined) var each_hotel_buy = parseInt("0"); else var each_hotel_buy = replaceComma($("#hotel"+i+"_buy").val()); if($("#hotel"+i+"_sell").val()==undefined) var each_hotel_sell = parseInt("0"); else var each_hotel_sell = replaceComma($("#hotel"+i+"_sell").val()); total_hotel_buy = parseInt(total_hotel_buy) + parseInt(each_hotel_buy); total_hotel_sell = parseInt(total_hotel_sell) + parseInt(each_hotel_sell); } var total_buy_price = parseInt(total_day_buy) + parseInt(total_hotel_buy); var total_sell_price = parseInt(total_day_sell) + parseInt(total_hotel_sell); var fee_rate = replaceComma($("#fee_rate").val()); var fee = Math.ceil(total_buy_price * (parseInt(fee_rate) / 100)); var surtax_rate = replaceComma($("#surtax_rate").val()); var surtax = Math.ceil((total_sell_price + fee) * parseInt(surtax_rate) / 100); var esti_profit = parseInt(total_sell_price) + fee - parseInt(total_buy_price); var last_sell_price = total_sell_price + fee + surtax; $("#esti_total_buy_price").html("₩ "+number_format(total_buy_price.toString())); //마지막 tr의 td에 소계금액 적용 document.getElementsByClassName('item_addon_price_box')[0].getElementsByTagName('tr').length; lastTrIdx = document.getElementsByClassName('item_addon_price_box')[0].getElementsByTagName('tr').length - 1; document.getElementsByClassName('item_addon_price_box')[0].getElementsByTagName('tr')[lastTrIdx].getElementsByTagName('td').length; lastTdIdx = document.getElementsByClassName('item_addon_price_box')[0].getElementsByTagName('tr')[lastTrIdx].getElementsByTagName('td').length - 1; document.getElementsByClassName('item_addon_price_box')[0].getElementsByTagName('tr')[lastTrIdx].getElementsByTagName('td')[lastTdIdx].getElementsByTagName('input')[0].value = number_format(total_buy_price.toString()); $("#esti_total_sell_price").html("₩ "+number_format(total_sell_price.toString())); $("#fee").html("₩ "+number_format(fee.toString())); $("#surtax").html("₩ "+number_format(surtax.toString())); $("#last_sell_price").html("₩ "+number_format(last_sell_price.toString())); $("#total_price").val(last_sell_price); $("#total").html("₩ "+number_format(last_sell_price)); $("#esti_profit").html("₩ "+number_format(esti_profit.toString())); $("#supply_price").html("₩ "+number_format(total_sell_price + fee)); $("#surtax_price").html("₩ "+number_format(surtax)); //comma val = get_number(val); if(val.length <= 3) return val; var loop = Math.ceil(val.length / 3); var offset = val.length % 3; if((val.length % 3)==0){ offset = 3; } var ret = val.substring(0, offset); for(i=1;i<loop;i++){ ret += "," + val.substring(offset, offset+3); offset += 3; } return ret; } </script>