 <? $code ="".$_GET["id"]."" ?>
 <?php
      include('../inc/connect.php'); 
      $strSql="SELECT * FROM tb_programe,tbairline,tbtrip where tb_programe.programe_id = tbtrip.trip_programe_code
       && tb_programe.programe_airline = tbairline.airline_id && programe_id = '".$_GET["id"]."' ";
      $rs = mysql_query($strSql,$conn) or die("Error : ".mysql_error());
       ?> 

<?php 
    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];

      if($strDay==$strDay2){
        return "$strDay $strMonthThai $strYear";
      }

      return "$strDay2-$strDay $strMonthThai $strYear";
    }
    ?>

   <script type="text/javascript">  
            function selects(){  
                var ele=document.getElementsByName('checkbox[]');  
                for(var i=0; i<ele.length; i++){  
                    if(ele[i].type=='checkbox')  
                        ele[i].checked=true;  
                }  
            }  
            function deSelect(){  
                var ele=document.getElementsByName('checkbox[]');  
                for(var i=0; i<ele.length; i++){  
                    if(ele[i].type=='checkbox')  
                        ele[i].checked=false;  
                      
                }  
            }             
        </script> 

    <!-- start: page -->
            <section class="panel">
              <header class="panel-heading">

                <div class="panel-actions">
                  <a href="#" class="fa fa-caret-down"></a>
                  <a href="#" class="fa fa-times"></a>
                </div>
        <div class="box-header" data-original-title>
         <h4><i class="halflings-icon user"></i><span class="break"></span>Period For <?=$code?></h4>
         <!-- Modal Bootstrap -->
          </div>
              </header>
              <div class="panel-body">
       <form class="form-horizontal" name="form_period_del_all" id="form_period_del_all" method="post" code="<?=$code;?>">
                <table class="table table-bordered table-striped mb-none" id="datatable-default">
                  <thead>
                    <tr>
                  <th class="text-center" style="width:5%;">#</th>
                                  <th style="width:30%;">ชื่อโปรแกรม</th>
                                  <th style="width:30%;">เดินทาง</th>
                                  <th style="width:15%">เลือกลบ</th>
                    </tr>
                  </thead>
                  <tbody>
                    <?php
                            $i=0;                
                
                            while($dbarr= mysql_fetch_array($rs)){
                            echo "<tr class='gradeX'>";  $i++ ;
                            echo "<td class='center'>$i</td>";
                            echo "<td class='center'>$dbarr[programe_name]</td>";
                            echo "<td class='center'>".DateGoBack($dbarr[trip_date_go],$dbarr[trip_date_back]) ."</td>";
                            echo "<td class='center'>";
                            echo "<input class='checkbox' name='checkbox[]' type='checkbox' value=$dbarr[trip_id] style='width: 30px;height: 30px;text-align: center;margin: auto;'>";
                            echo "</td>";
                            echo "</tr>";
                        }
                          ?>
                  </tbody>
                </table>
                 <div class="form-actions text-center">
                  <button type="submit" id="PackageBT" class="btn btn-danger"><i class='fa fa-trash-o fa-x'></i> ลบ</button>
                  <button type="reset" onclick="window.history.back();return false;" class="btn btn-cancel-color">ยกเลิก</button>

                  <input onclick='selects()' class="btn btn-danger"  type="button" value="เลือกทั้งหมด"> 
                  <input onclick='deSelect()' class="btn btn-danger"  type="button" value="ไม่เลือกทั้งหมด"> 
                </div>
              </form>
              </div>
            </section>

 
   <!--    <div class="modal fade" id="modalBootstrap2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
     <div class="modal-content">
     <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
      <div class="swal-icon swal-icon--warning">
    <span class="swal-icon--warning__body">
      <span class="swal-icon--warning__dot"></span>
    </span>
  </div>
       <h4 class="modal-title text-danger text-center"  id="myModalLabel">คุณต้องการที่จะลบ PERIOD <span class="del-item"></span></h4>
      </div>
    <div class="modal-footer" style="margin-top: 0;">
      <a href="#" class="mb-xs mt-xs mr-xs btn btn-default" data-dismiss="modal">Cancel</a>
      <a href="?url=period_delete" class="mb-xs mt-xs mr-xs btn btn-danger period_del" data-dismiss="modal">Delete</a>
    </div>
              </div>
              </div>
              </div> -->


