
<?
// $num = $_POST['num_p'];

// $id = $_GET['iv'];
// $r = $db->findByPK('tbiv','iv_id',$id)->executeRow();

// $num = $r['adult_num'];
// $code = $r['iv_id'];

// $num_day = $_POST['num_day'];
// $numday  = $num_day - 1;

// $ads = $_POST['price'];
// $ci_b = $_POST['size'];


// $book_ccc = $db->findByAttributes('tbpass',array('pass_iv =' => $id ))->execute();
// $ca_book = 0;
// while($c = mysql_fetch_assoc($book_ccc)){
//     $ca_book++;
//   }

$code = $_GET['id'];

    function DateThai($strDate){
      $strYear = date("Y",strtotime($strDate))+543;
      $strMonth= date("n",strtotime($strDate));
      $strDay= date("j",strtotime($strDate));
      $strHour= date("H",strtotime($strDate));
      $strMinute= date("i",strtotime($strDate));
      $strSeconds= date("s",strtotime($strDate));
      $strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
      $strMonthThai=$strMonthCut[$strMonth];
      return "$strDay $strMonthThai $strYear";
    }
    
     function DateGoBack($DateGo,$DateBack){
      $strYear = date("Y",strtotime($DateBack))+543;
      $strMonth= date("n",strtotime($DateBack));
      $strDay = date("j",strtotime($DateBack));
      $strDay2 = date("j",strtotime($DateGo));
      $strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
      $strMonthThai=$strMonthCut[$strMonth];
      return "$strDay2 $strMonthThai $strYear - $strDay $strMonthThai $strYear";
    }


?>  
<style>
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  border: 1px solid #ddd;
}

th, td {
  text-align: center;
  padding: 8px;
}

tr:nth-child(even){background-color: #f2f2f2}
</style>

<?
$filetest = $_POST['series_field'];
$CSVfp = fopen("../b_end/pdf/".$filetest."", "r");
?>

            <section class="panel">
              <header class="panel-heading"  style="margin-bottom:20px;">
                <h2 class="panel-title">รายละเอียดผู้เดินทาง
               <!--      <input type="hidden" class="form-control"name="namepro" id="namepro"  value="<?=$r['iv_namepro']?>">
                      <input type="hidden" class="form-control"name="namepro" id="namepro"  value="<?=$r['iv_namepro']?>">
                      <input class="form-control" name="pro_dategopr" id="pro_dategopr"
                      value="<?echo ''.datethai($r['pro_datego']).' - '.datethai($r['pro_dateback']).'';?>"  type="hidden">
                      <input type="hidden" class="form-control" id="iv_admin" name="iv_admin"  value="<?=$r['iv_admin']?>"/>
                      <input type="hidden" class="form-control" id="iv_new" name="iv_new" value="IM<?=$r['iv_id']?>"> -->
              </header>

  <div class="row">   
        <div class="col-xl-12">

<form class="form-horizontal" name="form_ivbup" id="form_ivbup" method="post" code="<?=$code;?>">
<table class="table table-bordered table-striped mb-none" id="datatable-tabletoolss">
    <tr style="    background: #e0331e;">
      <th align="center" class="text-center" style="width:30px;">NO</th>
      <th align="center" class="text-center" style="width:10px;">NOinFILE</th>
      <th align="center">รายละเอียดผู้เดินทาง</th>
    </tr>
         
<?
      while (! feof($CSVfp)) {
        $i++;
        // if (($i >= 1 && $i <= 10)) {
        $data = fgetcsv($CSVfp, 1000, ",");
        if (! empty($data)) { ?>
    <tr>
       <td><?=$i;?></td>
       <td style="width:10px;">
           <input class="form-control" type="text" id="tag_num<?=$i?>" name="tag_num<?=$i?>" value="<?php echo $data[0]; ?>" placeholder="NO">
       </td>
       <td> 
<div class="row">
        <div class="col-md-2">
          <label>ชื่อภาษาอังกฤษ</label>
          </div>
         <div class="col-md-5">
          <input class="form-control" type="text" id="iv_wholesale<?=$i?>" name="iv_wholesale<?=$i?>" value="<?php echo $data[1]; ?>" placeholder="FIRSTNAME">
        </div>
         <div class="col-md-5">
          <input class="form-control" type="text" id="iv_country<?=$i?>" name="iv_country<?=$i?>" value="<?php echo $data[2]; ?>" placeholder="LASTNAME">
        </div>
</div>



      </td>
    </tr>
<? }} ?>

  </table>
           
                <input class="text" type="hidden" id="allx" type="text" name="allx" style="text-transform:uppercase" value="<?=$i?>">
                <input class="text" type="hidden" id="code" type="text" name="code" style="text-transform:uppercase" value="<?=$code?>">
                
               <div class="col-md-12 text-center p-5 mb-5" style="margin-top:20px;margin-bottom: 20px;">
                <div class="form-actions">
                  <button type="submit" id="PackageBT" class="btn btn-danger"><i class="fa fa-save"></i> บันทึก</button>
                  <button type="reset" onclick="window.history.back();return false;" class="btn btn-cancel-color">ยกเลิก</button>
                </div>
                </div>
            </form>


      
        </div><!--/span-->
      
      </div>
</section>




