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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Buat Folder Baru:
Buat File Baru:

Current File : /tkt_travelbus/www/admin/erp/edit_estimate_invoice.php
<?php
ini_set('max_inputs_vars',50000);
include $_SERVER['DOCUMENT_ROOT']."/admin/include/top.html";
include $_SERVER['DOCUMENT_ROOT']."/admin/erp/_common.html";

// 기존 예약정보
if($a_idx){
    $sql = "select * from TB_ERP_ALL where a_idx='{$a_idx}'";
    $rs = db_query($sql);
    $row = db_fetch_array($rs) ;

    //1인투어비
    $price_per_one = round($row['total_price'] / ($row['num_adult']+$row['num_child']));

    //통화단위
    $currency2 = $row[currency];

    $SqlType = "res_update";

    //견적서 정보
    $sql2 = "select * from TB_ERP_ESTIMATE where a_idx='{$a_idx}'";
    $rs2 = db_query($sql2);
    $row2 = db_fetch_array($rs2) ;
    $e_idx = $row2[e_idx];

    /*if(devCookie()){
        p($row2);
    }*/

    //invoice 정보
    $sql3 = "select * from TB_ERP_INVOICE where a_idx='{$a_idx}'";
    $rs3 = db_query($sql3);
    $row3 = db_fetch_array($rs3) ;
    $i_idx = $row3[i_idx];

    //voucher 정보
    $sql4 = "select * from TB_ERP_VOUCHER where a_idx='{$a_idx}'";
    $rs4 = db_query($sql4);
    $row4 = db_fetch_array($rs4) ;
    $v_idx = $row4[v_idx];

} else {
    $SqlType = "res_ins";
}

if($rtab=="2")	{
    $esti_tab = "none";
    $voucher_tab = "none";
    $invoice_tab = "block";

} elseif($rtab=="3")	{
    $esti_tab = "none";
    $invoice_tab = "none";
    $voucher_tab = "block";

} else {
    $esti_tab = "block";
    $invoice_tab = "none";
    $voucher_tab = "none";
}

?>

<!-- XEICON -->
<!--<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/xeicon@2.3.3/xeicon.min.css">-->

<!-- CSS -->
<link type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />
<!--<link rel="stylesheet" href="/admin/css/erp_css/xeicon.css">-->

<link rel="stylesheet" href="/admin/css/erp_css/style.css?ver=<?=time()?>">

<!-- font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">
<link href="https://webfontworld.github.io/pretendard/Pretendard.css" rel="stylesheet">
<style>
    #contents .left_wrap {
        float: left;
        z-index: 9999999;
        position: relative;
        background: #445163;
    }
    #contents .sub_menu_wrap .sub_menu {
        clear: both;
        margin-bottom: 20px;
        border-top: 1px solid #445163;
        background: #445163;
    }
</style>

<div class="page_cont">
    <div class="contents_wrap">
        <form name="frm_reserv_good" id="frm_reserv_good" method="post" style="float: left;position: absolute;">

            <input type="hidden" name="SqlType" value="<?=$SqlType?>">
            <input type="hidden" name="a_idx" value="<?=$a_idx?>">
            <input type="hidden" name="e_idx" value="<?=$e_idx?>">
            <input type="hidden" name="i_idx" value="<?=$i_idx?>">
            <input type="hidden" name="v_idx" value="<?=$v_idx?>">
            <input type="hidden" name="amount_per_one" value="">

            <div class="page_inner">
                <p class="page_tit">
                    견적서 수정
                </p>
                <div class="tab_wrap">
                    <?php
                    $rtab = '1';
                    include $_SERVER['DOCUMENT_ROOT']."/admin/erp/good_res_tabreg.php";
                    ?>
                    <div id="tab_contbox" class="tab_contbox">

                        <!-- 견적서(Itinerary) -->
                        <div class="tab_cont tab_cont1 on">

                            <div class="tab_top">
                                <?php
                                if($a_idx and $e_idx) {
                                    ?>
                                    <ul class="tab_side">
                                        <li>
                                            <a href="../TCPDF/erp/pdf_estimate_tourboss.php?a_idx=<?=$a_idx?>&e_idx=<?=$e_idx?>" class="btn primary" >여행대장 PDF</a>
                                        </li>
                                        <li>
                                            <a href="../TCPDF/erp/pdf_estimate_tktravel.php?a_idx=<?=$a_idx?>&e_idx=<?=$e_idx?>" class="btn primary">TK 트래블 PDF</a>
                                        </li>
                                        <li>
                                            <a href="excel_estimate.php?a_idx=<?=$a_idx?>&e_idx=<?=$e_idx?>" class="btn">
                                                <img src="/admin/image/erp_imgs/ic_excel.svg" alt="" class="icon">
                                                엑셀저장
                                            </a>
                                        </li>
                                    </ul>
                                    <?php
                                }
                                ?>
                            </div>



                            <div class="contbox">
                                <div class="cont_left">
                                    <div class="chkbox">
                                        <div class="form_check">
                                            <input class="form_check_input" type="checkbox" id="chk1-1" name="state" value="A" <?=(($row['state'] == "A") ? 'checked' : '')?>>
                                            <label class="form_check_label" for="chk1-1">
                                                견적서발행
                                            </label>
                                        </div>
                                        <div class="form_check">
                                            <input class="form_check_input" type="checkbox" id="chk1-2" name="state" value="B" <?=(($row['state'] == "B") ? 'checked' : '')?>>
                                            <label class="form_check_label" for="chk1-2">
                                                예약확정
                                            </label>
                                        </div>
                                        <div class="form_check">
                                            <input class="form_check_input" type="checkbox" id="chk1-3" name="state" value="C" <?=(($row['state'] == "C") ? 'checked' : '')?>>
                                            <label class="form_check_label" for="chk1-3">
                                                INVOICE발행
                                            </label>
                                        </div>
                                        <div class="form_check">
                                            <input class="form_check_input" type="checkbox" id="chk1-4" name="state" value="D" <?=(($row['state'] == "D") ? 'checked' : '')?>>
                                            <label class="form_check_label" for="chk1-4">
                                                입금완료
                                            </label>
                                        </div>
                                        <div class="form_check">
                                            <input class="form_check_input" type="checkbox" id="chk1-5" name="state" value="E" <?=(($row['state'] == "E") ? 'checked' : '')?>>
                                            <label class="form_check_label" for="chk1-5">
                                                VOUCHER발행
                                            </label>
                                        </div>
                                        <div class="form_check">
                                            <input class="form_check_input" type="checkbox" id="chk1-6" name="state" value="F" <?=(($row['state'] == "F") ? 'checked' : '')?>>
                                            <label class="form_check_label" for="chk1-6">
                                                행사완료
                                            </label>
                                        </div>
                                        <div class="form_check">
                                            <input class="form_check_input" type="checkbox" id="chk1-7" name="state" value="G" <?=(($row['state'] == "G") ? 'checked' : '')?>>
                                            <label class="form_check_label" for="chk1-7">
                                                취소완료
                                            </label>
                                        </div>
                                    </div>

                                    <p class="page_sub">
                                        예약정보
                                    </p>

                                    <div class="data_cont">
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    ATTN
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" id="attn" name="attn"  value="<?=$row['attn']?>" required>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            FROM
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" id="admin_nm" name="admin_nm" value="<?=$row['admin_nm']?>" >
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            담당자
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <? if($TK_MEMBER['mb_level'] < 2) { ?>
                                                                    <input type="text"  class="form_input" id="charger" name="charger" value="<?=$TK_MEMBER['mb_nm']?>" readonly>
                                                                <? } else { ?>
                                                                    <input type="text" class="form_input" id="charger" name="charger" value="<?=$TK_MEMBER['mb_nm']?>" >
                                                                <? } ?>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    행사명
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" id="good_name" name="good_name" value="<?=$row['good_name']?>" hname="행사명" required>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    행사날짜
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="date" name="start_date" id="start_date" class="form_input datepicker inp" value="<?=$row['start_date']?>" hname="출발날짜" required>
                                                    </div>
                                                    <div class="division">~</div>
                                                    <div class="form_input_box">
                                                        <input type="date" name="end_date" id="end_date" class="form_input datepicker inp" value="<?=$row['end_date']?>"  hname="도착날짜" required>
                                                    </div>
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" id="period_str" name="period_str" value="<?=$row['periods']?>" >
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    호텔명
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" id="hotel_name" name="hotel_name" value="<?=$row['hotel_name']?>">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    차량정보
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" id="car_info" name="car_info" value="<?=$row['car_info']?>" >
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            예약자명
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" id="res_name" name="res_name" value="<?=$row['res_name']?>" hname="예약자명" required>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            국적
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" id="res_nationality" name="res_nationality" value="<?=$row['res_nationality']?>" >
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    공급가액
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input price" value="" id="price1" readonly>
                                                        <label for="price1" id="supply_price" class="form_price_txt">₩</label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            연락처
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" id="res_phone" name="res_phone" value="<?=$row['res_phone']?>" hname="연락처" required>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            이메일
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" id="res_email" name="res_email" value="<?=$row['res_email']?>" hname="이메일" required>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    부가세
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input price" id="price2" value="" readonly>
                                                        <label for="price2" id="surtax_price" class="form_price_txt">₩</label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>


                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    인원
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box flex">
                                                        <div class="input_tit">
                                                            Adult
                                                        </div>
                                                        <input type="text" class="form_input" id="num_adult" name="num_adult" value="<?=$row['num_adult']?>" hname="성인 인원" required>

                                                    </div>
                                                    <div class="form_input_box flex">
                                                        <div class="input_tit">
                                                            Child
                                                        </div>
                                                        <input type="text" class="form_input" id="num_child" name="num_child" value="<?=$row['num_child']?>"  hname="소인 인원"  >

                                                    </div>
                                                    <div class="form_input_box flex">
                                                        <div class="input_tit">
                                                            FOC
                                                        </div>
                                                        <input type="text" class="form_input" id="num_foc" name="num_foc" value="<?=$row['num_foc']?>">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            최종합계
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <!--                                                                <span id="total" style="font-weight:bold;">0</span>-->
                                                                <input type="text" id="total_price" class="form_input"  name="total_price" value="<?=$row['total_price']?>" readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            1인투어비
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input id="per_amount" type="text" class="form_input" value="<?=$row['currency']?> <?=$price_per_one?>" readonly>

                                                                <!--                                                                <span id="per_amount"></span>-->

                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="data_cont textarea b-0">
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    포함사항
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <textarea name="included" class="form_input"><?=$row['included']?></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    불포함사항
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <textarea class="form_input" name="non_included"><?=$row['non_included']?></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    비고
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <textarea  class="form_input" name="notice"><?=$row['remarks']?></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>


                                    <?php

                                    //estimate 정보 넣기

                                    // 신규예약
                                    if(!$SqlType) $SqlType="res_ins";

                                    // 상품정보
                                    if ( $a_idx ) {
                                        $sql = "select * from TB_ERP_ALL where a_idx='{$a_idx}'";
                                        $rs = db_query($sql);
                                        $erp_row = db_fetch_array($rs) ;
                                    }

                                    //견적서 일자정보
                                    if ( $e_idx ) {
                                        $sql2 = "select * from TB_ERP_ESTIMATE where e_idx='{$e_idx}'";
                                        $rs2 = db_query($sql2);
                                        $row = db_fetch_array($rs2) ;

                                        $day_num = "0";

                                        for($day=1; $day<=15; $day++){
                                            if($row['day'.$day.'_date']) {
                                                $day_info = explode("^^",$row['day'.$day.'_info']);
                                                $day_hotel_info = explode("^^",$row['day'.$day.'_hotel_info']);

                                                for($i=0; $i<count($day_info); $i++) {
                                                    if($day_info[$i]){
                                                        $content[$day][$i] = explode("::",$day_info[$i]);

                                                        foreach($content[$day][$i] as $k => $v){
                                                            if(is_numeric($v) == true && $k > 5){
//                                                                    $content[$day][$i][$k] = number_format($v);
                                                                $content[$day][$i][$k] = $v;
                                                            }
                                                        }
                                                    }
                                                }

                                                $content_hotel[$day] = explode("::",$day_hotel_info[0]);
                                            }
                                        }
                                        //p($content);

                                        $day_num = count($content);

                                        //마지막 라인
                                        $before_last = ' class="last" ';

                                    }
                                    $require_num_comma = " style=\"ime-mode:inactive;text-align:right\" onblur=\"this.value=calcu_esti(this.value)\" onKeyUp=\"this.value=comma(this.value);\" ";
                                    // 가격입력시에 콤마+숫자필수



                                    //for($line = 0; $line<15; $line++) {

                                    ?>



                                    <div class="data_cont b-0" id="erpScheduledArea">
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    생성일자
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box flex">
                                                        <select name="date_num" id="date_num" class="form_select"  onchange="create_dateform();">
                                                            <?php
                                                            for ($i = 1; $i <= 15; $i++){
                                                                ?>
                                                                <option value="<?=$i?>" <?=(($day_num==$i) ? ' selected' : '')?>><?=$i?>일</option>
                                                                <?php
                                                            }
                                                            ?>
                                                        </select>

                                                        <div class="opt_desc">
                                                            *생성일자를 선택 후 행사날짜 년, 월 일을 입력해주세요!
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <button type="button" class="btn primary add_btn" onclick="to_dialog.iframe('bus_edit.php?x_idx=<?=$x_idx?>&window=close','버스정산등록','800','780',true,true,'yes');">
                                                버스정산등록
                                            </button>
                                        </div>

                                        <?php

                                        for($day = 1; $day <= $day_num; $day++) {

                                            if($day < $day_num) {
                                                $row_span = '16';
                                            } else {
                                                $row_span = '15';
                                            }

                                        ?>


                                        <div class="data_row realDataRow"  id="dataRowDay<?=$day?>">


                                            <div class="data_col">
                                                <div class="day_infobox">
                                                    <div class="day_tit">DAY <?=$day?></div>
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input txt datepicker" name="day<?=$day?>" value="<?=$row['day'.$day.'_date']?>" required>
                                                    </div>
                                                </div>
                                                <div class="tbl_wrap">
                                                    <table class="tbl tbl_schedule">
                                                        <thead>
                                                        <input type="hidden" class="dayNum" value="<?=$day?>">
                                                        <tr>
                                                            <th>Place</th>
                                                            <th>Time</th>
                                                            <th>Itinerary</th>
                                                            <th>Meals</th>
                                                            <th class="detail">세부항목</th>
                                                            <th class="detail"><span class="dot_txt">a</span> 공급가</th>
                                                            <th class="detail"><span class="dot_txt">b</span> 수량</th>
                                                            <th class="detail">지출비용(<span class="dot_txt">a</span>*<span class="dot_txt">b</span>)
                                                            </th>
                                                            <th class="detail">판매가</th>
                                                            <th></th>
                                                        </tr>
                                                        </thead>
                                                        <tbody>



                                                        <?php
                                                            foreach($content[$day] as $dayRowData){

                                                                $dayRowDataPlace = $dayRowData[0];
                                                                $dayRowDataTimeStart = $dayRowData[1];
                                                                $dayRowDataTimeEnd = $dayRowData[2];
                                                                $dayRowDataInfo = $dayRowData[3];
                                                                $dayRowDataFood = $dayRowData[4];
                                                                $dayRowDataItem = $dayRowData[5];
                                                                $dayRowDataSupply = $dayRowData[6];
                                                                $dayRowDataCount = $dayRowData[7];
                                                                $dayRowDataBuy = $dayRowData[8];
                                                                $dayRowDataSell = $dayRowData[9];


                                                                $isData = false;
                                                                //아이템 공데이터 체크
                                                                foreach($dayRowData as $checkItem){
                                                                    if($checkItem){
                                                                        $isData = true;
                                                                        break;
                                                                    }
                                                                }

                                                                if(!$isData){
                                                                    continue;
                                                                }


                                                        ?>

                                                        <tr class="trRow">
                                                            <td class="place">
                                                                <input type="text" name="day<?=$day?>_place_arr[]" class="form_input txt" value="<?=$dayRowDataPlace?>">
                                                            </td>
                                                            <td class="time">
                                                                <input type="text" name="day<?=$day?>_time_start_arr[]" class="form_input txt" value="<?=$dayRowDataTimeStart?>">
                                                                <span class="sep">~</span>
                                                                <input type="text" name="day<?=$day?>_time_end_arr[]" class="form_input txt" value="<?=$dayRowDataTimeEnd?>">
                                                            </td>
                                                            <td class="itinerary">
                                                                <input type="text" name="day<?=$day?>_info_arr[]" class="form_input txt" value="<?=$dayRowDataInfo?>">
                                                            </td>

                                                            <td class="meals">
                                                                <input type="text" name="day<?=$day?>_food_arr[]" class="form_input txt" value="<?=$dayRowDataFood?>">
                                                            </td>
                                                            <td class="detail1">
                                                                <input type="text" name="day<?=$day?>_item_arr[]" class="form_input txt" value="<?=$dayRowDataItem?>">
                                                            </td>
                                                            <td class="detail2">

                                                                <input type="text" name="day<?=$day?>_supply_arr[]" id="day<?=$day?>_supply1"  style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value,<?=$day?>,1)"  class="form_input txt" value="<?=$dayRowDataSupply?>">
                                                            </td>
                                                            <td class="detail3">
                                                                <input type="text" name="day<?=$day?>_count_arr[]" id="day<?=$day?>_count1" onblur="this.value=calcu_esti(this.value,<?=$day?>,1)" class="form_input txt" value="<?=$dayRowDataCount?>">
                                                            </td>
                                                            <td class="detail4">
                                                                <input type="text" name="day<?=$day?>_buy_arr[]" id="day<?=$day?>_buy1" style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value,<?=$day?>,1)" class="dayBuy form_input txt" readonly value="<?=$dayRowDataBuy?>">
                                                            </td>
                                                            <td class="detail5">
                                                                <input type="text" name="day<?=$day?>_sell_arr[]" id="day<?=$day?>_sell1" style="ime-mode:inactive;text-align:right" onblur="this.value=priceAmount(this.value,<?=$day?>,1)"  class="form_input txt rowPriceAmount" value="<?=$dayRowDataSell?>">
                                                            </td>
                                                            <td>
                                                                <button type="button" class="btn clear del_schedule" dayNum="<?=$day?>" trRow="1">
                                                                    <span class="del_icon"><i class="xi-minus"></i></span>
                                                                </button>
                                                            </td>
                                                        </tr>

                                                        <input type="hidden" name="date_num_arr[]" value="<?=$day?>">
                                                        <?php
                                                            }
                                                        ?>




                                                        <tr class="last" style="display:<?=(($day != $day_num) ? 'table-row' : 'none')?>" >
                                                            <td class="place"></td>
                                                            <td class="time bold">HOTEL Information</td>
                                                            <td class="itinerary">

                                                                <input type="text" name="hotel<?=$day?>_info_arr[]" class="form_input txt">

                                                            </td>
                                                            <td class="meals"></td>
                                                            <td class="detail1">
                                                                <input type="text" name="hotel<?=$day?>_item_arr[]" class="form_input txt">
                                                            </td>
                                                            <td class="detail2"></td>
                                                            <td class="detail3"></td>
                                                            <td class="detail4">
                                                                <input type="text" name="hotel<?=$day?>_buy_arr[]" id="hotel<?=$day?>_buy" class="form_input txt" onblur="this.value=calcu_esti_hotel(this.value,<?=$day?>)" >
                                                            </td>
                                                            <td class="detail5">
                                                                <input type="text" name="hotel<?=$day?>_sell_arr[]" id="hotel<?=$day?>_sell" class="form_input txt" onblur="this.value=priceAmountHotel(this.value,<?=$day?>)">
                                                            </td>
                                                            <td></td>
                                                        </tr>






                                                        </tbody>
                                                    </table>
                                                </div>
                                                <div class="add_btnbox">
                                                    <button type="button" class="btn add_schedule">
                                                        일정 추가
                                                        <span class="plus_icon">
                                                            <i class="xi-plus"></i>
                                                        </span>
                                                    </button>
                                                </div>
                                            </div>
                                        </div>

                                        <?php
                                            }
                                        ?>

                                    </div>


                                    <div class="data_cont textarea b-0">
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    Remarks
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <textarea name="remarks" class="form_input"><?=$row['remarks']?></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>


                                </div>

                                <div class="cont_right" id="item_ajaxEstimate"></div>

                            </div>
                        </div>

                        <!-- 인보이스(Invoice) -->
                        <div class="tab_cont tab_cont2">
                            <div class="tab_top">
                                <ul class="tab_side">
                                    <li>
                                        <button type="button" class="btn primary">
                                            여행대장 PDF
                                        </button>
                                    </li>
                                    <li>
                                        <button type="button" class="btn primary">
                                            TK 트래블 PDF
                                        </button>
                                    </li>
                                    <li>
                                        <button type="button" class="btn">
                                            <img src="/admin/image/erp_imgs/ic_excel.svg" alt="" class="icon">
                                            엑셀저장
                                        </button>
                                    </li>
                                </ul>
                            </div>
                            <div class="contbox">
                                <div class="cont_left">
                                    <p class="page_sub">
                                        예약정보
                                    </p>

                                    <div class="data_cont">
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    ATTN
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="TK - Kelly Hsu"
                                                               readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            FROM
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="TK Travel"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            담당자
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="여소문 매니저"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    행사명
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="행사명입니다." readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    행사날짜
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input"
                                                               value="2024-01-20 ~ 2024-01-24 (4박5일)" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    호텔명
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="호텔명입니다." readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    차량정보
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="차량정보" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            예약자명
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="Kelly Hsu"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            국적
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="TW" readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    공급가액
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="₩ 0" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            연락처
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="kelly6015"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            이메일
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="-" readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    부가세
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="₩ 0" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    인원
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box flex">
                                                        <div class="input_tit">
                                                            Adult
                                                        </div>
                                                        <input type="text" class="form_input" value="8" readonly>
                                                    </div>
                                                    <div class="form_input_box flex">
                                                        <div class="input_tit">
                                                            Child
                                                        </div>
                                                        <input type="text" class="form_input" value="6" readonly>
                                                    </div>
                                                    <div class="form_input_box flex">
                                                        <div class="input_tit">
                                                            FOC
                                                        </div>
                                                        <input type="text" class="form_input" value="0" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            최종합계
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input point" value="₩ 0"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            1인투어비
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input point" value="₩ 0"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    입금기한
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <p class="page_sub">
                                        INVOICE 정보
                                    </p>
                                    <div class="data_cont">
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    INVOICE NO.
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    작성일자
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input datepicker inp" readonly />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    결제수단
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box chk">
                                                        <div class="form_check">
                                                            <input class="form_check_input" type="radio" id="pay1-1"
                                                                   name="pay1">
                                                            <label class="form_check_label" for="pay1-1">
                                                                Bank Transfer
                                                            </label>
                                                        </div>
                                                        <div class="form_check">
                                                            <input class="form_check_input" type="radio" id="pay1-2"
                                                                   name="pay1">
                                                            <label class="form_check_label" for="pay1-2">
                                                                Credit Card
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    입금상태
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box chk">
                                                        <div class="form_check">
                                                            <input class="form_check_input" type="radio" id="chk2-1"
                                                                   name="chk2">
                                                            <label class="form_check_label" for="chk2-1">
                                                                미입금
                                                            </label>
                                                        </div>
                                                        <div class="form_check">
                                                            <input class="form_check_input" type="radio" id="chk2-2"
                                                                   name="chk2">
                                                            <label class="form_check_label" for="chk2-2">
                                                                부분입금
                                                            </label>
                                                        </div>
                                                        <div class="form_check">
                                                            <input class="form_check_input" type="radio" id="chk2-3"
                                                                   name="chk2">
                                                            <label class="form_check_label" for="chk2-3">
                                                                입금완료
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <p class="page_sub">
                                        세부항목 수량
                                    </p>
                                    <div class="data_cont">
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    포함사항
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <select class="form_select">
                                                            <option value="0" disabled selected>수량선택</option>
                                                            <option value="1">1</option>
                                                            <option value="2">2</option>
                                                            <option value="3">3</option>
                                                            <option value="4">4</option>
                                                            <option value="5">5</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    세부항목 Details
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <textarea class="form_input"></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="data_cont b-0">
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    ACCOUNT INFORMATION
                                                </div>
                                                <div class="data_detail account_info">
                                                    <div class="input_tit">
                                                        ACCOUNT INFO
                                                    </div>
                                                    <div class="form_input_box info1">
                                                        <input type="text" class="form_input" placeholder="IFNO 1">
                                                    </div>
                                                    <div class="form_input_box info2">
                                                        <input type="text" class="form_input" placeholder="IFNO 2">
                                                    </div>
                                                </div>
                                                <div class="data_detail account_info">
                                                    <div class="input_tit">
                                                        ACCOUNT INFO
                                                    </div>
                                                    <div class="form_input_box info1">
                                                        <input type="text" class="form_input" placeholder="IFNO 1">
                                                    </div>
                                                    <div class="form_input_box info2">
                                                        <input type="text" class="form_input" placeholder="IFNO 2">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    취소 및 환불규정
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <textarea class="form_input"></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    비고
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <textarea class="form_input"></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="page_btnbox right">
                                        <button type="button" class="btn primary">INVOICE 저장</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- 바우처(Voucher) -->
                        <div class="tab_cont tab_cont3">
                            <div class="tab_top">
                                <ul class="tab_side">
                                    <li>
                                        <button type="button" class="btn primary">
                                            여행대장 PDF
                                        </button>
                                    </li>
                                    <li>
                                        <button type="button" class="btn primary">
                                            TK 트래블 PDF
                                        </button>
                                    </li>
                                    <li>
                                        <button type="button" class="btn">
                                            <img src="/admin/image/erp_imgs/ic_excel.svg" alt="" class="icon">
                                            엑셀저장
                                        </button>
                                    </li>
                                </ul>
                            </div>
                            <div class="contbox">
                                <div class="cont_left">
                                    <p class="page_sub">
                                        예약정보
                                    </p>

                                    <div class="data_cont">
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    ATTN
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="TK - Kelly Hsu"
                                                               readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            FROM
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="TK Travel"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            담당자
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="여소문 매니저"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    행사명
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="행사명입니다." readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    행사날짜
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input"
                                                               value="2024-01-20 ~ 2024-01-24 (4박5일)" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    호텔명
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="호텔명입니다." readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    차량정보
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="차량정보" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            예약자명
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="Kelly Hsu"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            국적
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="TW" readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    공급가액
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="₩ 0" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            연락처
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="kelly6015"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            이메일
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input" value="-" readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    부가세
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <input type="text" class="form_input" value="₩ 0" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col w-50">
                                                <div class="data_tit">
                                                    인원
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box flex">
                                                        <div class="input_tit">
                                                            Adult
                                                        </div>
                                                        <input type="text" class="form_input" value="8" readonly>
                                                    </div>
                                                    <div class="form_input_box flex">
                                                        <div class="input_tit">
                                                            Child
                                                        </div>
                                                        <input type="text" class="form_input" value="6" readonly>
                                                    </div>
                                                    <div class="form_input_box flex">
                                                        <div class="input_tit">
                                                            FOC
                                                        </div>
                                                        <input type="text" class="form_input" value="0" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="data_col w-50">
                                                <div class="data_row">
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            최종합계
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input point" value="₩ 0"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="data_col">
                                                        <div class="data_tit">
                                                            1인투어비
                                                        </div>
                                                        <div class="data_detail">
                                                            <div class="form_input_box">
                                                                <input type="text" class="form_input point" value="₩ 0"
                                                                       readonly>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <p class="page_sub">
                                        VOUCHER 정보
                                    </p>
                                    <div class="data_cont">
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    코드타입.
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box chk">
                                                        <div class="form_check">
                                                            <input class="form_check_input" type="radio" id="type1-1"
                                                                   name="type1">
                                                            <label class="form_check_label" for="type1-1">
                                                                Voucher Number
                                                            </label>
                                                        </div>
                                                        <div class="form_check">
                                                            <input class="form_check_input" type="radio" id="type1-2"
                                                                   name="type1">
                                                            <label class="form_check_label" for="type1-2">
                                                                QRCODE Number
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <p class="page_sub">
                                        코드항목 수량
                                    </p>
                                    <div class="data_cont">
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    코드항목
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <select class="form_select">
                                                            <option value="0" disabled selected>수량선택</option>
                                                            <option value="1">1</option>
                                                            <option value="2">2</option>
                                                            <option value="3">3</option>
                                                            <option value="4">4</option>
                                                            <option value="5">5</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="data_cont b-0">
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    Guest Details
                                                </div>
                                                <div class="data_detail">
                                                    <div class="tbl_wrap">
                                                        <table class="tbl">
                                                            <thead>
                                                            <tr>
                                                                <th>Name</th>
                                                                <th>Persons</th>
                                                                <th>Nationality</th>
                                                            </tr>
                                                            </thead>
                                                            <tbody>
                                                            <tr>
                                                                <td class="sub">
                                                                    홍길동
                                                                </td>
                                                                <td>
                                                                    5
                                                                </td>
                                                                <td>
                                                                    KR
                                                                </td>
                                                            </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="data_cont b-0">
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    VOUCHER 사용방법
                                                </div>
                                                <div class="data_detail">
                                                    <div class="tbl_wrap">
                                                        <table class="tbl tbl_voucher">
                                                            <thead>
                                                            <tr>
                                                                <th>No.</th>
                                                                <th>내용</th>
                                                                <th></th>
                                                                <th></th>
                                                            </tr>
                                                            </thead>
                                                            <tbody>
                                                            <tr>
                                                                <td class="No">
                                                                    1
                                                                </td>
                                                                <td class="text">
                                                                    <input type="text" class="form_input">
                                                                </td>
                                                                <td class="control col2" colspan="2">
                                                                    <button type="button" class="btn clear add_voucher">
                                                                                <span class="add_icon">
                                                                                    <i class="xi-plus"></i>
                                                                                </span>
                                                                    </button>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td class="No">
                                                                    2
                                                                </td>
                                                                <td class="text">
                                                                    <input type="text" class="form_input">
                                                                </td>
                                                                <td class="control">
                                                                    <button type="button" class="btn clear add_voucher">
                                                                                <span class="add_icon">
                                                                                    <i class="xi-plus"></i>
                                                                                </span>
                                                                    </button>
                                                                </td>
                                                                <td class="control">
                                                                    <button type="button" class="btn clear del_voucher">
                                                                                <span class="del_icon">
                                                                                    <i class="xi-minus"></i>
                                                                                </span>
                                                                    </button>
                                                                </td>
                                                            </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    미팅장소 및 교환장소 (700 * 345px)
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_file_box">
                                                        <label for="meeting_file" id="file_name" class="btn primary">
                                                            파일 첨부
                                                        </label>
                                                        <div id="meeting_file_name" class="file_name"></div>
                                                        <input type="file" class="form_input" id="meeting_file">
                                                        <div class="file_del2">
                                                            <i class="xi-close"></i>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="data_tit">
                                                    Contact Us
                                                </div>
                                                <div class="data_detail">
                                                    <div class="form_input_box">
                                                        <textarea class="form_input"></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="page_btnbox right">
                                        <button type="button" class="btn primary">VOUCHER 저장</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- 고객리스트 -->
                        <div class="tab_cont tab_cont4">
                            <div class="tab_top">
                                <ul class="tab_side">
                                    <li>
                                        <button type="button" class="btn primary">
                                            PDF 다운로드
                                        </button>
                                    </li>
                                    <li>
                                        <button type="button" class="btn">
                                            <img src="/admin/image/erp_imgs/ic_excel.svg" alt="" class="icon">
                                            엑셀저장
                                        </button>
                                    </li>
                                </ul>
                            </div>
                            <div class="contbox">
                                <div class="cont_left">
                                    <div class="data_cont b-0 m-0 p-0">
                                        <div class="data_row">
                                            <div class="data_col">
                                                <div class="tbl_wrap">
                                                    <table class="tbl tbl_list">
                                                        <thead>
                                                        <tr>
                                                            <th>NO</th>
                                                            <th>고객이름</th>
                                                            <th>전화번호</th>
                                                            <th>국적</th>
                                                            <th>성별</th>
                                                            <th>나이</th>
                                                            <th>미팅장소</th>
                                                            <th>객실타입</th>
                                                            <th>객실번호</th>
                                                            <th>예약경로</th>
                                                            <th>비고</th>
                                                            <th></th>
                                                            <th></th>
                                                        </tr>
                                                        </thead>
                                                        <tbody>
                                                        <tr>
                                                            <td class="No">
                                                                <span class="num">1</span>
                                                            </td>
                                                            <td class="name">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="call">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="nationality">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="gender">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="age">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="place">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="type">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="number">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="route">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="note">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="control col2" colspan="2">
                                                                <button type="button" class="btn clear add_list">
                                                                            <span class="add_icon">
                                                                                <i class="xi-plus"></i>
                                                                            </span>
                                                                </button>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td class="No">
                                                                <span class="num">2</span>
                                                            </td>
                                                            <td class="name">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="call">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="nationality">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="gender">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="age">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="place">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="type">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="number">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="route">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="note">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="control">
                                                                <button type="button" class="btn clear add_list">
                                                                            <span class="add_icon">
                                                                                <i class="xi-plus"></i>
                                                                            </span>
                                                                </button>
                                                            </td>
                                                            <td class="control">
                                                                <button type="button" class="btn clear del_list">
                                                                            <span class="del_icon">
                                                                                <i class="xi-minus"></i>
                                                                            </span>
                                                                </button>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td class="No">
                                                                <span class="num">3</span>
                                                            </td>
                                                            <td class="name">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="call">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="nationality">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="gender">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="age">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="place">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="type">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="number">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="route">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="note">
                                                                <input type="text" class="form_input txt">
                                                            </td>
                                                            <td class="control">
                                                                <button type="button" class="btn clear add_list">
                                                                            <span class="add_icon">
                                                                                <i class="xi-plus"></i>
                                                                            </span>
                                                                </button>
                                                            </td>
                                                            <td class="control">
                                                                <button type="button" class="btn clear del_list">
                                                                            <span class="del_icon">
                                                                                <i class="xi-minus"></i>
                                                                            </span>
                                                                </button>
                                                            </td>
                                                        </tr>
                                                        </tbody>
                                                    </table>
                                                </div>
                                                <div class="page_pagination">
                                                    <ul class="pagination">
                                                        <li class="page-item">
                                                            <a class="page-link start" href="#">
                                                                <img src=/admin/image/erp_imgs/ic_first.png" alt="" class="img-full icon">
                                                            </a>
                                                        </li>
                                                        <li class="page-item">
                                                            <a class="page-link prev" href="#">
                                                                <img src="/admin/image/erp_imgs/ic_prev.png" alt="" class="img-full icon">
                                                            </a>
                                                        </li>
                                                        <li class="page-item">
                                                            <a class="page-link active" href="#">1</a>
                                                        </li>
                                                        <li class="page-item">
                                                            <a class="page-link" href="#">2</a>
                                                        </li>
                                                        <li class="page-item">
                                                            <a class="page-link" href="#">3</a>
                                                        </li>
                                                        <li class="page-item">
                                                            <a class="page-link" href="#">4</a>
                                                        </li>
                                                        <li class="page-item">
                                                            <a class="page-link" href="#">5</a>
                                                        </li>
                                                        <li class="page-item">
                                                            <a class="page-link next" href="#">
                                                                <img src="/admin/image/erp_imgs/ic_next.png" alt="" class="img-full icon">
                                                            </a>
                                                        </li>
                                                        <li class="page-item">
                                                            <a class="page-link end" href="#">
                                                                <img src="/admin/image/erp_imgs/ic_end.png" alt="" class="img-full icon">
                                                            </a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="cont_right">
                                    <div class="tbl_wrap">
                                        <table class="tbl">
                                            <tbody>
                                            <tr>
                                                <th class="sub">
                                                    행사명
                                                </th>
                                                <td>
                                                    240120~240124 4박5일 테스트 문구
                                                </td>
                                            </tr>
                                            <tr>
                                                <th class="sub">
                                                    출발일
                                                </th>
                                                <td>
                                                    2024년 01월 20일 (토)
                                                </td>
                                            </tr>
                                            <tr>
                                                <th class="sub">
                                                    가이드정보
                                                </th>
                                                <td>
                                                    <input type="text" class="form_input info">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th class="sub">
                                                    기사정보
                                                </th>
                                                <td>
                                                    <input type="text" class="form_input info">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th class="sub">
                                                    차량정보
                                                </th>
                                                <td>
                                                    <input type="text" class="form_input info">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th class="sub">
                                                    총인원
                                                </th>
                                                <td>
                                                    36명
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="btn_box">
                                        <button type="button" class="btn primary">
                                            저장
                                        </button>
                                        <button type="button" class="btn light">
                                            견적리스트
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


        </form>
    </div>

</div> <!-- page of cont -->

<!-- JS -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<!--<script src="/admin/js/erp_js/common.js"></script>-->
<script>

    // 견적서 일정 table remove row
    $(document).on("click", ".del_schedule", function () {

        delDayNum = $(this).attr('daynum');
        deltrRow = parseInt($(this).attr('trrow'));

        console.log('delDayNum is ' + delDayNum);
        console.log('deltrRow is ' + deltrRow);

        console.log('#trDay'+delDayNum+'Row'+deltrRow)

        plusDelTrRow = deltrRow + 1;

        console.log('plusDelTrRow is ' + plusDelTrRow);

        isDelOk = false;

        for(i = plusDelTrRow; i <= 15; i++){

            if($('#trDay'+delDayNum+'Row'+i).html() == undefined){
                console.log('undefined');
            }else{
                console.log('exists');
                isDelOk = true;
                break;
            }
        }

        if(isDelOk){
            alert('마지막 데이터부터 삭제하세요.');
            return false;
        }

        //지우려는 줄의 데이터가 있는지 확인
        //공급가
        //수량
        //판매가
        daySupplyValue = parseInt($('#day'+delDayNum+'_supply'+deltrRow).val());

        if(isNaN){
            daySupplyValue = 0;
        }

        console.log('daySupplyValue is ' + daySupplyValue);
        console.log('delDayNum is ' + delDayNum);
        console.log('deltrRow is ' + deltrRow);


        $('#day'+delDayNum+'_supply'+deltrRow).val(0);
        calcu_esti(0, delDayNum, deltrRow);


        dayCountValue = parseInt($('#day'+delDayNum+'_count'+deltrRow).val());

        if(isNaN){
            dayCountValue = 0;
        }

        console.log('dayCountValue is ' + dayCountValue);
        console.log('delDayNum is ' + delDayNum);
        console.log('deltrRow is ' + deltrRow);

        $('#day'+delDayNum+'_count'+deltrRow).val(0);

        calcu_esti(0,delDayNum,deltrRow);

        daySellValue = parseInt($('#day'+delDayNum+'_sell'+deltrRow).val());

        if(isNaN){
            daySellValue = 0;
        }


        console.log('daySellValue is ' + daySellValue);
        console.log('delDayNum is ' + delDayNum);
        console.log('deltrRow is ' + deltrRow);

        $('#day'+delDayNum+'_sell'+deltrRow).val(0);
        priceAmount(0, delDayNum, deltrRow)


        //이후의 tr이 있는지 체크
        // $('#trDay'+delDayNum+'Row'+deltrRow)

        console.log()

        console.log(111);

        let tbl = $(this).parent().parent().parent()
        let target_tr = $(this).parent().parent()
        let tr = tbl.find("tr")

        if (tr.length <= 2) {
            alert("일정은 최소 1개 이상이어야 합니다.")
            return false;
        }

        target_tr.remove();

        calFeeRate($('#fee_rate').val());
        calSurtaxRate($('#surtax_rate').val());
        setSupplySurtaxTotalPerAmount();

    });

    function calcu() {
        var currency	= $("input[name='currency']").val();

        //인원
        var num_adult	= $("#frm_reserv_good input[name='num_adult']").val();
        var num_child	= $("#frm_reserv_good input[name='num_child']").val();

        if(!num_adult || num_adult==undefined)	num_adult = "0";
        if(!num_child || num_child==undefined)	num_child = "0";

        var total_price	= $("#frm_reserv_good input[name='total_price']").val();	//합계

        console.log('total_price is ' + total_price);
        total_price = parseInt(replaceComma(total_price));

        $("#total_price").val(total_price);

        //1인 투어비
        var per_amount = "";
        var total_inwon = parseInt(num_adult) + parseInt(num_child);
        if(total_inwon == 0) total_inwon = 1;

        $("#frm_reserv_good input[name='amount_per_one']").val(Math.round(total_price / total_inwon));
        per_amount = currency + " " + number_format(Math.round(total_price / total_inwon)).toString();
        $("#per_amount").html(per_amount);

        // 최종합계
        $("#total").html(currency + " " + number_format(total_price));

        setSupplySurtaxTotalPerAmount();

    }


    function calcu_esti_hotel(val, dayNum){
        console.log('in calcu_esti_hotel');
        console.log('val is ' + val);
        console.log('dayNum is ' + dayNum);

        estiTotalBuyPrice = parseInt($('#esti_total_buy_price').text().replace("₩ ",""));

        if(isNaN(estiTotalBuyPrice)){
            estiTotalBuyPrice = 0;
        }

        hotelBuy = parseInt(val);

        if(isNaN(hotelBuy)){
            hotelBuy = 0;
        }

        estiTotalBuyPriceValue = estiTotalBuyPrice + hotelBuy;

        $('#esti_total_buy_price').text('₩ ' + estiTotalBuyPriceValue);

        calFeeRate($('#fee_rate').val());
        calSurtaxRate($('#surtax_rate').val());
        setSupplySurtaxTotalPerAmount();

        return val;
    }

    function priceAmountHotel(val, dayNum){
        console.log('in priceAmountHotel');
        console.log('val is ' + val);
        console.log('dayNum is ' + dayNum);

        estiTotalSellPrice = parseInt($('#esti_total_sell_price').text().replace("₩ ",""));
        if(isNaN(estiTotalSellPrice)){
            estiTotalSellPrice = 0;
        }

        hotelSell = parseInt(val);

        if(isNaN(hotelSell)){
            hotelSell = 0;
        }

        estiTotalSellPriceValue = estiTotalSellPrice + hotelSell

        $('#esti_total_sell_price').text('₩ ' + estiTotalSellPriceValue);

        calFeeRate($('#fee_rate').val());
        calSurtaxRate($('#surtax_rate').val());
        setSupplySurtaxTotalPerAmount();


        return val;
    }

    function calcu_esti(val, dayNum, rowNum){
        supplyAmt = parseInt($('#day'+dayNum+'_supply'+rowNum).val());
        countNum = parseInt($('#day'+dayNum+'_count'+rowNum).val());

        dayBuySum = supplyAmt * countNum;

        if(isNaN(dayBuySum)){
            dayBuySum = 0;
        }else{
            // console.log('dayBuySum is ' + dayBuySum);
        }

        $('#day'+dayNum+'_buy'+rowNum).val(dayBuySum);


        //지출소계
        // console.log('dayBuyLen is ' + document.getElementsByClassName('dayBuy').length);

        dayBuySum = 0;

        for(i = 0; i < document.getElementsByClassName('dayBuy').length; i++){
            // console.log('dayBuy is ' + parseInt(document.getElementsByClassName('dayBuy')[i].value));
            thisDayBuy = parseInt(document.getElementsByClassName('dayBuy')[i].value);

            if(!isNaN(thisDayBuy)){
                dayBuySum += thisDayBuy;
            }
        }

        // console.log('dayBuySum is ' + dayBuySum);
        $('#esti_total_buy_price').text('₩ ' + dayBuySum); //지출 소계 합


        calFeeRate($('#fee_rate').val());
        calSurtaxRate($('#surtax_rate').val());
        setSupplySurtaxTotalPerAmount();




        return val;

    }

    function priceAmount(sellPrice){

        console.log('in priceAmount');

        totalSellPrice = 0;

        console.log('len is ' + document.getElementsByClassName('rowPriceAmount').length);

        for(i = 0; i < document.getElementsByClassName('rowPriceAmount').length; i++){
            console.log(document.getElementsByClassName('rowPriceAmount')[i].value);

            thisSellPrice = parseInt(document.getElementsByClassName('rowPriceAmount')[i].value);

            if(isNaN(thisSellPrice)){
                thisSellPrice = 0;
            }

            totalSellPrice += parseInt(thisSellPrice)
        }


        //지출소계
        dayBuySum = 0;

        for(i = 0; i < document.getElementsByClassName('dayBuy').length; i++){

            thisDayBuy = parseInt(document.getElementsByClassName('dayBuy')[i].value);

            console.log('thisDayBuy is ' + thisDayBuy);

            if(!isNaN(thisDayBuy)){
                dayBuySum += thisDayBuy;
            }else{
                console.log('this is NAN');

            }
        }////지출소계

        console.log('dayBuySum is ' + dayBuySum)

        totalSellPrice = totalSellPrice + dayBuySum;

        $('#esti_total_sell_price').text('₩ ' + totalSellPrice); //우측 판매 소계

        fee = parseInt($('fee').text().replace().replace("₩ ",""));

        if(isNaN(fee)){
            fee = 0;
        }

        supplyPrice = totalSellPrice + fee;

        $('#supply_price').text('₩ ' + supplyPrice); //왼쪽 공급가액

        //부가세
        surtaxPrice = parseInt($('#surtax').text().replace("₩ ",""));

        if(isNaN(surtaxPrice)){
            surtaxPrice = 0;
        }

        totalPrice = supplyPrice + surtaxPrice; //부가세 포함

        $('#total_price').val('₩ ' + totalPrice); //왼쪽 최종합계

        $('#last_sell_price').text('₩ ' + totalSellPrice); //우측 최종 견적 합계

        console.log("$('#esti_total_buy_price').text() is " + $('#esti_total_buy_price').text())

        estiTotalBuyPrice = parseInt($('#esti_total_buy_price').text().replace("₩ ",""));

        if(isNaN(estiTotalBuyPrice)){
            estiTotalBuyPrice = 0;
        }

        console.log('estiTotalBuyPrice is ' + estiTotalBuyPrice);

        estiProfit = totalSellPrice - estiTotalBuyPrice

        $('#esti_profit').text('₩ ' + estiProfit); // 우측 회사 순이익

        calFeeRate($('#fee_rate').val());
        calSurtaxRate($('#surtax_rate').val());
        setSupplySurtaxTotalPerAmount();

        return sellPrice;

    }

    //인당 가격
    function setOnePersonPrice(){
        adultNum = parseInt($('#num_adult').val());
        childNum = parseInt($('#num_child').val());

        if(isNaN(adultNum)){
            adultNum = 0;
        }

        if(isNaN(childNum)){
            childNum = 0;
        }

        if(adultNum == 0 && childNum == 0){
            return false;
        }

        totalPrice = parseInt($('#total_price').val().replace("₩ ",""));

        if(isNaN(totalPrice)){
            return false;
        }

        // console.log('adultNum is ' + adultNum);
        // console.log('childNum is ' + childNum);
        // console.log('totalPrice is ' + totalPrice);

        totalPeopleCnt = adultNum + childNum;

        perAmount = parseInt(totalPrice / totalPeopleCnt);

        $('#per_amount').val('₩ ' + perAmount);


    }

    //수수료
    function calFeeRate(feeRateVal){

        // console.log('feeRateVal is ' + feeRateVal);
        // console.log('feeRateVal is ' + feeRateVal);

        estiTotalBuyPrice = parseInt($('#esti_total_buy_price').text().replace("₩ ",""));

        console.log('estiTotalBuyPrice is ' + estiTotalBuyPrice);

        if(isNaN(estiTotalBuyPrice) || estiTotalBuyPrice == 0){
            return false;
        }else{
            console.log('calFeeRate work');
            fee = parseInt((estiTotalBuyPrice / 100) * feeRateVal);

            $('#fee').text('₩ ' + fee)

        }

        setSupplySurtaxTotalPerAmount();
    }

    //부가세
    function calSurtaxRate(surtaxRateVal){

        console.log('surtaxRateVal is ' + surtaxRateVal);

        estiTotalSellPrice = parseInt($('#esti_total_sell_price').text().replace("₩ ","")); //판매소계

        fee = parseInt($('#fee').text().replace("₩ ","")); //판매소계

        console.log('estiTotalSellPrice is ' + estiTotalSellPrice);
        console.log('fee is ' + fee);

        sumOfestiTotalSellPriceAndFee = estiTotalSellPrice + fee;

        if(isNaN(sumOfestiTotalSellPriceAndFee)){
            return false;
        }else{
            surtax = parseInt((sumOfestiTotalSellPriceAndFee / 100) * surtaxRateVal);

            $('#surtax').text('₩ ' + surtax);
            $('#surtax_price').text('₩ ' + surtax); //왼쪽 부가세



            //최종견적합계

            //판매금액의 소계, 수수료, 부가세의 합

            lastSellPrice = sumOfestiTotalSellPriceAndFee + surtax;

            $('#last_sell_price').text('₩ ' + lastSellPrice)

            //회사순이익
            //(판매금액의 소계 + 수수료) - 지출금액의 소계

            // esti_total_sell_price

            console.log('sumOfestiTotalSellPriceAndFee is ' + sumOfestiTotalSellPriceAndFee);

            estiTotalBuyPrice = parseInt($('#esti_total_buy_price').text().replace("₩ ",""));

            if(isNaN(estiTotalBuyPrice)){
                estiTotalBuyPrice = 0;
            }

            estiProfit =sumOfestiTotalSellPriceAndFee - estiTotalBuyPrice

            $('#esti_profit').text('₩ ' + estiProfit);

        }

        setSupplySurtaxTotalPerAmount();
    }


    function setSupplySurtaxTotalPerAmount(){

        //공급가액

        estiTootalSellPrice	= parseInt($('#esti_total_sell_price').text().replace("₩ ","")); //판매소계의 소계

        if(isNaN(estiTootalSellPrice)){
            estiTootalSellPrice = 0;
        }

        fee = parseInt($('#fee').text().replace("₩ ",""));

        if(isNaN(fee)){
            fee = 0;
        }

        supplyPrice = estiTootalSellPrice + fee;

        $('#supply_price').text('₩ ' + supplyPrice); //왼쪽 공급가액


        //부가세
        $('#surtax_price').text($('#surtax').text());

        surTax = parseInt($('#surtax').text().replace("₩ ",""));

        if(isNaN(surTax)){
            surTax = 0;
        }

        totalPrice = estiTootalSellPrice + fee + surTax;

        console.log('----------------------------------------------------------------------');
        console.log('estiTootalSellPrice is ' + estiTootalSellPrice);
        console.log('fee is ' + fee);
        console.log('surTax is ' + surTax);
        console.log('totalPrice is ' + totalPrice);

        console.log(' // --------------');


        //최종합계
        $('#total_price').val('₩ ' + totalPrice);


        setOnePersonPrice();

    }





    //합계 계산하기
    function calcu_esti2(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++) {

            if(document.getElementById('dataRowDay' + i) != null){

                trRowLength = document.getElementById('dataRowDay' + i).getElementsByClassName('trRow').length;

            }

            // console.log()
            console.log('i is ' + i);

            for(var j = 1; j <= trRowLength; j++) {
                console.log('j is ' + j);


                console.log($("#day"+i+"_buy"+j).val());


                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);
        }


        return false;


        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>


<script>
    $(window).load(function(){

        //인원 수 조정
        $(document).on('change', '#num_adult', function(){
            setSupplySurtaxTotalPerAmount();
            // setOnePersonPrice();
        });

        $(document).on('change', '#num_child', function(){
            setSupplySurtaxTotalPerAmount();
            // setOnePersonPrice();
        });


        //수수료
        $(document).on('change', '#fee_rate', function(){
            calFeeRate($(this).val())

        });

        //부가세
        $(document).on('change', '#surtax_rate', function(){
            calSurtaxRate($(this).val())
        });


        // create_dateform()

        $(document).on('click', '.add_schedule', function(){

            let tbl = $(this).parent("div").siblings(".tbl_wrap").find("table")

            dayNum = $(this).parent("div").siblings(".tbl_wrap").find('table').find('.dayNum').attr('value');

            trRowLen = $(this).parent("div").siblings(".tbl_wrap").find('table').find('.trRow').length;

            trRowLen += 1;

            console.log('trRowLen is ' + trRowLen);

            let lastTr = tbl.find("tbody").find(".last")


            dataRowHtml = '<tr class="trRow" id="trDay'+dayNum+'Row'+trRowLen+'">';
            dataRowHtml += '<td class="place">';
            dataRowHtml += '<input type="text" name="day'+dayNum+'_place_arr[]" class="form_input txt">';
            dataRowHtml += '</td>';
            dataRowHtml += '<td class="time">';
            dataRowHtml += '<input type="text" name="day'+dayNum+'_time_start_arr[]" class="form_input txt">';
            dataRowHtml += '<span class="sep">~</span>';
            dataRowHtml += '<input type="text" name="day'+dayNum+'_time_end_arr[]" class="form_input txt">';
            dataRowHtml += '</td>';
            dataRowHtml += '<td class="itinerary">';
            dataRowHtml += '<input type="text" name="day'+dayNum+'_info_arr[]" class="form_input txt">';
            dataRowHtml += '</td>';

            dataRowHtml += '<td class="meals">';
            dataRowHtml += '<input type="text" name="day'+dayNum+'_food_arr[]" class="form_input txt">';
            dataRowHtml += '</td>';
            dataRowHtml += '<td class="detail1">';
            dataRowHtml += '<input type="text" name="day'+dayNum+'_item_arr[]" class="form_input txt">'; //세부항목
            dataRowHtml += '</td>';
            dataRowHtml += '<td class="detail2">';
            // dataRowHtml += '<input type="text" name="day'+dayNum+'_supply_arr[]" style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value)" onkeyup="this.value=comma(this.value);" class="form_input txt">'; //공급가
            dataRowHtml += '<input type="text" name="day'+dayNum+'_supply_arr[]" id="day'+dayNum+'_supply'+trRowLen+'" style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value,'+dayNum+','+trRowLen+')"  class="form_input txt">'; //공급가
            dataRowHtml += '</td>';
            dataRowHtml += '<td class="detail3">';
            dataRowHtml += '<input type="text" name="day'+dayNum+'_count_arr[]" id="day'+dayNum+'_count'+trRowLen+'" onblur="this.value=calcu_esti(this.value,'+dayNum+','+trRowLen+')" class="form_input txt">';  //수량
            dataRowHtml += '</td>';
            dataRowHtml += '<td class="detail4">';
            // dataRowHtml += '<input type="text" name="day'+dayNum+'_buy_arr[]" id="day'+dayNum+'_buy'+trRowLen+'" style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value)" onkeyup="this.value=comma(this.value);" class="form_input txt">'; //지출비용
            dataRowHtml += '<input type="text" name="day'+dayNum+'_buy_arr[]" id="day'+dayNum+'_buy'+trRowLen+'" style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value,'+dayNum+','+trRowLen+')"  class="dayBuy form_input txt" readonly>'; //지출비용
            dataRowHtml += '</td>';
            dataRowHtml += '<td class="detail5">';
            // dataRowHtml += '<input type="text" name="day'+dayNum+'_sell_arr[]" id="day'+dayNum+'_sell'+trRowLen+'"  style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value)" onkeyup="this.value=comma(this.value);" class="form_input txt">'; //판매가
            dataRowHtml += '<input type="text" name="day'+dayNum+'_sell_arr[]" id="day'+dayNum+'_sell'+trRowLen+'"  style="ime-mode:inactive;text-align:right" onblur="this.value=priceAmount(this.value,'+dayNum+','+trRowLen+')"  class="form_input txt rowPriceAmount">'; //판매가
            dataRowHtml += '</td>';
            dataRowHtml += '<td>';
            dataRowHtml += '<button type="button" class="btn clear del_schedule" dayNum="'+dayNum+'" trRow="'+trRowLen+'">';
            dataRowHtml += '<span class="del_icon"><i class="xi-minus"></i></span>';
            dataRowHtml += '</button>';
            dataRowHtml += '</td>';
            dataRowHtml += '</tr>';

            dataRowHtml += '<input type="hidden" name="date_num_arr[]" value="'+dayNum+'">';

            lastTr.before(dataRowHtml);
        });


        $('#start_date').change(function(){
            console.log($(this).val());

            startDate = $(this).val();
            endDate = $('#end_date').val();

            startDateTimeStamp = new Date();

            if(endDate != ''){
                if(startDate > endDate){
                    alert('날짜를 재확인 해주세요.');
                    $(this).val('');
                    $('#period_str').val('');
                    return false;
                }else{
                    calcuDayNight()
                }
            }
        })

        $('#end_date').change(function(){
            console.log($(this).val());

            startDate = $('#start_date').val();
            endDate = $(this).val();

            if(startDate != ''){
                if(startDate > endDate){
                    alert('날짜를 재확인 해주세요.');
                    $(this).val('');
                    $('#period_str').val('');
                    return false;
                }else{
                    calcuDayNight()
                }
            }
        })

    })

    function calcuDayNight(){

        startDate = $('#start_date').val();
        endDate = $('#end_date').val();

        if(startDate && endDate){

            if(startDate == endDate){
                $('#period_str').val('0박 1일');
            }else{
                startDateTimeStamp = parseInt((new Date(startDate).getTime()) / 1000);
                endDateTimeStamp = parseInt((new Date(endDate).getTime()) / 1000);

                startEndDateTerm = endDateTimeStamp - startDateTimeStamp

                termDays = startEndDateTerm / 86400;

                termDay = termDays + 1;
                termNight = termDays;

                $('#period_str').val(termNight + '박 '+ termDay + '일');

                $('#date_num').val(termDay);
                create_dateform();
            }

        }

    }

    // 생성일자 추가
    function create_dateform() {

        console.log('in create_dateform');

        //  생성일자 추가 스크립트
        var html_addon_price ='';
        var date_num = $("#frm_reserv_good select[name='date_num']").val();		//선택된 일자 갯수

        startNum = 1;

        //현재 만들어진 부분 계산

        dayTitLength = document.getElementsByClassName('day_tit').length;


        if(dayTitLength != 0){

            lastDayTit = document.getElementsByClassName('day_tit')[dayTitLength-1];
            lastDayTitText = lastDayTit.innerText;

            // console.log(lastDayTitText);

            lastDayTitText = parseInt(lastDayTitText.replace("DAY ",""));

            // console.log(lastDayTitText);

            startNum = lastDayTitText + 1;

        }


        console.log('startNum111 is ' + startNum);

        startDate = $('#start_date').val();
        startDateTimeStamp = new Date(startDate).getTime();

        // 날짜별
        for(var i = startNum; i <= date_num; i++) {


            if(startDate){
                if(i == 1){
                    viewStartDate = startDate;
                }else{
                    nextDaySViewDate = startDateTimeStamp += 86400000;

                    viewStartDate = new Date(nextDaySViewDate);

                    console.log('viewStartDate is '+ viewStartDate);
                    console.log(viewStartDate.getFullYear());
                    console.log(viewStartDate.getMonth() + 1);
                    console.log(viewStartDate.getDate());

                    viewStartDate = viewStartDate.getFullYear()+'-'+(viewStartDate.getMonth() + 1)+'-'+viewStartDate.getDate();
                }
            }else{
                viewStartDate = "";
            }


            dayNum = i;


            html_addon_price += '<div class="data_row realDataRow"  id="dataRowDay'+i+'">';


            html_addon_price += '<div class="data_col">';
            html_addon_price += '<div class="day_infobox">';
            html_addon_price += '<div class="day_tit">DAY '+i+'</div>';
            html_addon_price += '<div class="form_input_box">';
            html_addon_price += '<input type="text" class="form_input txt datepicker" name="day'+dayNum+'" value="' + viewStartDate + '" required>';
            html_addon_price += '</div>';
            html_addon_price += '</div>';
            html_addon_price += '<div class="tbl_wrap">';
            html_addon_price += '<table class="tbl tbl_schedule">';
            html_addon_price += '<thead>';
            html_addon_price += '<input type="hidden" class="dayNum" value="'+i+'">';
            html_addon_price += '<tr>';
            html_addon_price += '<th>Place</th>';
            html_addon_price += '<th>Time</th>';
            html_addon_price += '<th>Itinerary</th>';
            html_addon_price += '<th>Meals</th>';
            html_addon_price += '<th class="detail">세부항목</th>';
            html_addon_price += '<th class="detail"><span class="dot_txt">a</span> 공급가</th>';
            html_addon_price += '<th class="detail"><span class="dot_txt">b</span> 수량</th>';
            html_addon_price += '<th class="detail">';
            html_addon_price += '지출비용(<span class="dot_txt">a</span>*';
            html_addon_price += '<span class="dot_txt">b</span>)';
            html_addon_price += '</th>';
            html_addon_price += '<th class="detail">판매가</th>';
            html_addon_price += '<th></th>';
            html_addon_price += '</tr>';
            html_addon_price += '</thead>';
            html_addon_price += '<tbody>';



            html_addon_price += '<tr class="trRow" id="trDay'+dayNum+'Row1">';
            html_addon_price += '<td class="place">';
            html_addon_price += '<input type="text" name="day'+dayNum+'_place_arr[]" class="form_input txt">';
            html_addon_price += '</td>';
            html_addon_price += '<td class="time">';
            html_addon_price += '<input type="text" name="day'+dayNum+'_time_start_arr[]" class="form_input txt">';
            html_addon_price += '<span class="sep">~</span>';
            html_addon_price += '<input type="text" name="day'+dayNum+'_time_end_arr[]" class="form_input txt">';
            html_addon_price += '</td>';
            html_addon_price += '<td class="itinerary">';
            html_addon_price += '<input type="text" name="day'+dayNum+'_info_arr[]" class="form_input txt">';
            html_addon_price += '</td>';

            html_addon_price += '<td class="meals">';
            html_addon_price += '<input type="text" name="day'+dayNum+'_food_arr[]" class="form_input txt">';
            html_addon_price += '</td>';
            html_addon_price += '<td class="detail1">';
            html_addon_price += '<input type="text" name="day'+dayNum+'_item_arr[]" class="form_input txt">';
            html_addon_price += '</td>';
            html_addon_price += '<td class="detail2">';
            // html_addon_price += '<input type="text" name="day'+dayNum+'_supply_arr[]" style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value)" onkeyup="this.value=comma(this.value);" class="form_input txt">';
            html_addon_price += '<input type="text" name="day'+dayNum+'_supply_arr[]" id="day'+dayNum+'_supply1"  style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value,'+dayNum+',1)"  class="form_input txt">';
            html_addon_price += '</td>';
            html_addon_price += '<td class="detail3">';
            html_addon_price += '<input type="text" name="day'+dayNum+'_count_arr[]" id="day'+dayNum+'_count1" onblur="this.value=calcu_esti(this.value,'+dayNum+',1)" class="form_input txt">';
            html_addon_price += '</td>';
            html_addon_price += '<td class="detail4">';
            // html_addon_price += '<input type="text" name="day'+dayNum+'_buy_arr[]" id="day'+dayNum+'_buy1" style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value)" onkeyup="this.value=comma(this.value);" class="form_input txt">';
            html_addon_price += '<input type="text" name="day'+dayNum+'_buy_arr[]" id="day'+dayNum+'_buy1" style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value,'+dayNum+',1)" class="dayBuy form_input txt" readonly>';
            html_addon_price += '</td>';
            html_addon_price += '<td class="detail5">';
            // html_addon_price += '<input type="text" name="day'+dayNum+'_sell_arr[]" id="day'+dayNum+'_sell1" style="ime-mode:inactive;text-align:right" onblur="this.value=calcu_esti(this.value)" onkeyup="this.value=comma(this.value);" class="form_input txt">';
            html_addon_price += '<input type="text" name="day'+dayNum+'_sell_arr[]" id="day'+dayNum+'_sell1" style="ime-mode:inactive;text-align:right" onblur="this.value=priceAmount(this.value,'+dayNum+',1)"  class="form_input txt rowPriceAmount">';
            html_addon_price += '</td>';
            html_addon_price += '<td>';
            html_addon_price += '<button type="button" class="btn clear del_schedule" dayNum="'+dayNum+'" trRow="1">';
            html_addon_price += '<span class="del_icon"><i class="xi-minus"></i></span>';
            html_addon_price += '</button>';
            html_addon_price += '</td>';
            html_addon_price += '</tr>';
            html_addon_price += '<input type="hidden" name="date_num_arr[]" value="'+dayNum+'">';





            html_addon_price += '<tr class="last">';
            html_addon_price += '<td class="place"></td>';
            html_addon_price += '<td class="time bold">HOTEL Information</td>';
            html_addon_price += '<td class="itinerary">';

            html_addon_price += '<input type="text" name="hotel'+dayNum+'_info_arr[]" class="form_input txt">';

            html_addon_price += '</td>';
            html_addon_price += '<td class="meals"></td>';
            html_addon_price += '<td class="detail1">';
            html_addon_price += '<input type="text" name="hotel'+dayNum+'_item_arr[]" class="form_input txt">';
            html_addon_price += '</td>';
            html_addon_price += '<td class="detail2"></td>';
            html_addon_price += '<td class="detail3"></td>';
            html_addon_price += '<td class="detail4">';
            html_addon_price += '<input type="text" name="hotel'+dayNum+'_buy_arr[]" id="hotel'+dayNum+'_buy" class="form_input txt">';
            html_addon_price += '</td>';
            html_addon_price += '<td class="detail5">';
            html_addon_price += '<input type="text" name="hotel'+dayNum+'_sell_arr[]" id="hotel'+dayNum+'_sell" class="form_input txt">';
            html_addon_price += '</td>';
            html_addon_price += '<td></td>';
            html_addon_price += '</tr>';





            html_addon_price += '</tbody>';
            html_addon_price += '</table>';
            html_addon_price += '</div>';
            html_addon_price += '<div class="add_btnbox">';
            html_addon_price += '<button type="button" class="btn add_schedule">';
            html_addon_price += '일정 추가';
            html_addon_price += '<span class="plus_icon">';
            html_addon_price += '<i class="xi-plus"></i>';
            html_addon_price += '</span>';
            html_addon_price += '</button>';
            html_addon_price += '</div>';
            html_addon_price += '</div>';
            html_addon_price += '</div>';


            // html_addon_price += '';
            // html_addon_price += '';

















            // 호텔정보 (마지막 날짜는 호텔정보를 뺌)
            /*if(i<date_num){
                html_addon_price += '<tr class="last">';
                html_addon_price += '<td class="place"></td>';
                html_addon_price += '<td class="time bold">HOTEL Information</td>';
                html_addon_price += '<td class="itinerary">';
                html_addon_price += '<input type="text" class="form_input txt">';
                html_addon_price += '</td>';
                html_addon_price += '<td class="meals"></td>';
                html_addon_price += '<td class="detail1">';
                html_addon_price += '<input type="text" class="form_input txt">';
                html_addon_price += '</td>';
                html_addon_price += '<td class="detail2"></td>';
                html_addon_price += '<td class="detail3"></td>';
                html_addon_price += '<td class="detail4">';
                html_addon_price += '<input type="text" class="form_input txt">';
                html_addon_price += '</td>';
                html_addon_price += '<td class="detail5">';
                html_addon_price += '<input type="text" class="form_input txt">';
                html_addon_price += '</td>';
                html_addon_price += '<td></td>';
                html_addon_price += '</tr>';
            }*/
        }

        $("#erpScheduledArea").append(html_addon_price);

        setHotelShowhide();
    }

    function setHotelShowhide(){

        for(i = 0; i < document.getElementsByClassName('realDataRow').length; i++){
            if(i == (document.getElementsByClassName('realDataRow').length - 1)){
                document.getElementsByClassName('realDataRow')[i].getElementsByClassName('last')[0].style.display = 'none';
            }else{
                document.getElementsByClassName('realDataRow')[i].getElementsByClassName('last')[0].style.display = 'table-row';
            }

        }

    }


</script>
<?php
//    p($SqlType); //res_update
//    p($a_idx); //1
//    p($e_idx); //1
?>
<script>
    $(function(){
        var e_idx = '<?=$e_idx?>';

        console.log('e_idx is ' + e_idx);

        if ( e_idx ) {
            ajax_loader('resEdit.ajax.php?SqlType=<?=$SqlType?>&a_idx=<?=$a_idx?>&e_idx=<?=$e_idx?>','item_ajaxEstimate');
        } else {
            ajax_loader('resForm.ajax.php?SqlType=<?=$SqlType?>&a_idx=<?=$a_idx?>','item_ajaxEstimate');
        }

    });

</script>





<?php
include $_SERVER['DOCUMENT_ROOT']."/admin/include/footer.html";
?>



Anon7 - 2021