<?php  
// include 'backend/include/db.php';
// include 'backend/include/connect.php';
// $tlid = $_GET['tl'];
// $trs = $db->findByPK('tbtourlead','tl_id',$tlid)->executeRow();

// $tl2id = $_GET['tl2'];
// $trss = $db->findByPK('tbtourlead','tl_id',$tl2id)->executeRow();

// $agen = $_GET['agen'];
// $agen_logo = $db->findByPK('tbagency','agency_id',$agen)->executeRow();

// $rtp = $db->findByPK('tbtrip,tbprograme,tbairline','tbprograme.programe_airline = tbairline.airline_id && tbprograme.programe_id = tbtrip.trip_package_id && trip_id',$_GET['id'])->executeRow();
// $rpa = $db->findByPK('tbtrip,tbairport','tbairport.airport_id = tbtrip.trip_leave_go && trip_id',$_GET['id'])->executeRow();
// $rpb = $db->findByPK('tbtrip,tbairport','tbairport.airport_id = tbtrip.trip_arrive_go && trip_id',$_GET['id'])->executeRow();
// $rpc = $db->findByPK('tbtrip,tbairport','tbairport.airport_id = tbtrip.trip_leave_back && trip_id',$_GET['id'])->executeRow();
// $rpd = $db->findByPK('tbtrip,tbairport','tbairport.airport_id = tbtrip.trip_arrive_back && trip_id',$_GET['id'])->executeRow();
// $start_date = $rpa['trip_date_go'];
// $expire_date = $rpa['trip_date_back'];
// /* Start Date */
// $start_explode = explode("/", $start_date);
// $start_month = $start_explode[0];
// $start_day = $start_explode[1];
// $start_year = $start_explode[2];

// $hotel = $rtp['trip_hotel'];
// $hoteltel = $rtp['trip_hotel_tel'];


//     $datekr = $rpa['trip_date_go'];
//     $datekr1 = strtotime($datekr);
//     $datekr2 = strtotime("+1 day", $datekr1);



// /* Expire Date */
// $expire_explode = explode("/", $expire_date);
// $expire_month = $expire_explode[0];
// $expire_day = $expire_explode[1];
// $expire_year = $expire_explode[2];
// switch($start_month){
//     case 1: $mn = 'JAN'; break;
//     case 2: $mn = 'FEB'; break;
//     case 3: $mn = 'MAR'; break;
//     case 4: $mn = 'APR'; break;
//     case 5: $mn = 'MAY'; break;
//     case 6: $mn = 'JUN'; break;
//     case 7: $mn = 'JUL'; break;
//     case 8: $mn = 'AUG'; break;
//     case 9: $mn = 'SEP'; break;
//     case 10: $mn = 'OCT'; break;
//     case 11: $mn = 'NOV'; break;
//     case 12: $mn = 'DEC'; break;
// }
// switch($expire_month){
//     case 1: $mt = 'JAN'; break;
//     case 2: $mt = 'FEB'; break;
//     case 3: $mt = 'MAR'; break;
//     case 4: $mt = 'APR'; break;
//     case 5: $mt = 'MAY'; break;
//     case 6: $mt = 'JUN'; break;
//     case 7: $mt = 'JUL'; break;
//     case 8: $mt = 'AUG'; break;
//     case 9: $mt = 'SEP'; break;
//     case 10: $mt = 'OCT'; break;
//     case 11: $mt = 'NOV'; break;
//     case 12: $mt = 'DEC'; break;
// } //.$rtp['programe_name'].
// $i=0;

// if (!empty($_GET['name'])) {
//  $name = $_GET['name'];
// }else{
//   $name = 'GUI WEN LI';
// }
// if (!empty($_GET['tel'])) {
//  $tel = $_GET['tel'];
// }else{
//   $tel = '13888079989';
// }

// $rs = $db->findorderid('tbbook,tbpassenger,tblogin,tbagency,tbadmin,tbroom','tblogin.u_agency = tbagency.agency_id && tblogin.u_id = tbbook.book_sale && tbbook.book_id = tbpassenger.pass_book && tbbook.book_admin = tbadmin.admin_id && tbpassenger.pass_room = tbroom.room_id && book_pass = 1 && book_status != 0 && book_cancel = 0 && pass_noland != 1 && book_trip',$_GET['id'],'book_id asc, pass_room')->execute();
// $rs_2 = $db->findorderid('tbbook,tbpassenger,tblogin,tbagency,tbadmin,tbroom','tblogin.u_agency = tbagency.agency_id && tblogin.u_id = tbbook.book_sale && tbbook.book_id = tbpassenger.pass_book && tbbook.book_admin = tbadmin.admin_id && tbpassenger.pass_room = tbroom.room_id && book_pass = 1 && book_status != 0 && book_cancel = 0 && pass_noland != 1 && book_trip',$_GET['id'],'book_id asc, pass_room')->execute();
// $rs_3 = $db->findorderid('tbbook,tbpassenger,tblogin,tbagency,tbadmin,tbroom','tblogin.u_agency = tbagency.agency_id && tblogin.u_id = tbbook.book_sale && tbbook.book_id = tbpassenger.pass_book && tbbook.book_admin = tbadmin.admin_id && tbpassenger.pass_room = tbroom.room_id && book_pass = 1 && book_status != 0 && book_cancel = 0 && pass_noland != 1 && book_trip',$_GET['id'],'book_id asc, pass_room')->execute();
// $rs_4 = $db->findorderid('tbbook,tbpassenger,tblogin,tbagency,tbadmin,tbroom','tblogin.u_agency = tbagency.agency_id && tblogin.u_id = tbbook.book_sale && tbbook.book_id = tbpassenger.pass_book && tbbook.book_admin = tbadmin.admin_id && tbpassenger.pass_room = tbroom.room_id && book_pass = 1 && book_status != 0 && book_cancel = 0 && pass_noland != 1 && book_trip',$_GET['id'],'book_id asc, pass_room')->execute();

// $rs_noland = $db->findorderid('tbbook,tbpassenger,tblogin,tbagency,tbadmin,tbroom','tblogin.u_agency = tbagency.agency_id && tblogin.u_id = tbbook.book_sale && tbbook.book_id = tbpassenger.pass_book && tbbook.book_admin = tbadmin.admin_id && tbpassenger.pass_room = tbroom.room_id && book_pass = 1 && book_status != 0 && book_cancel = 0 && pass_noland = 1 && book_trip',$_GET['id'],'book_id asc, pass_room')->execute();



// if(!empty($agen)){
//  $img_logo = "<img  src='../backend/logo/".$agen_logo['agency_logo']."' style='width:46px;position: absolute;right: 4px;'>";
// }else{
//  $img_logo = "<img src='../img/logo_bestconsortium.png' style='width:42px;position: absolute;right: 4px;'>";
// }
// if ($_GET['id'] == '13229') {
//    $airline_file = "<img src='backend/logo/DD.png' style='width:50px;'>";
// }else{
//   $airline_file = "<img src='backend/logo/".$rtp['airline_file']."' style='width:50px;'>";

// }
$filetest = $_POST['series_field'];
$CSVfp = fopen("../b_end/pdf/1111Book2.csv", "r");
?>
<!DOCTYPE html>
<html>
<head>
    <title></title>
        <!-- Bootstrap core CSS -->
    <link href="https://www.bestindochina.com/css/bootstrap.css?v=1.37" rel="stylesheet">
    <style>
    @import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,100;1,200;1,300;1,400;1,500;1,600&display=swap');
        body {
        margin: 0;
        padding: 0;
        background-color: #FAFAFA;
      /*  font-family: 'Prompt' !important;*/
    }
    * {
        box-sizing: border-box;
        -moz-box-sizing: border-box;
    }
     .page {
        width: 250mm;
        min-height: 90mm;
        height:  90mm;
        padding: 0cm;
        margin: 0cm auto;
        border: 0px #D3D3D3 solid;
        border-radius: 0px;
     /*   background: black;*/
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
      /*  page-break-after: always;*/
    /*background-image: url(https://www.bestindochina.com/img/jp_card-off-03.jpg);*/
                     background-position: center center;
                     background-repeat: no-repeat;
                     background-size: cover;
    }
    .subpage {
        padding: 1cm;
        border: 3px red solid;
        height: 256mm;
        outline: 2cm #eee solid;
    }
    
    @page {
   /*     size: A4;*/
        margin: 0;
    }
    @media print {
        .page {
            margin: 0;
            border: initial;
            border-radius: initial;
            width: initial;
            min-height: initial;
            box-shadow: initial;
            background: initial;
            page-break-after: always;
        }
    }

    h2{
      font-size:1.3rem;
    }
    .bg-danger {
    background-color: #e9292a !important;
    border-color: #e9292a !important;
        background-image: linear-gradient(1deg,#e9292a 10%,#8e0e00);
    }
    .box_nb{
     background: #e9292a !important;
    border-radius: 10px;
    color: white;
    padding: 2px;
    }
    .text-danger{
     color: #e9292a !important;
    }
    .btn-dark{
      background: #4c4c4c;
    color: white;
    }
    body{
        color:blue;
        font-size:11pt;
        font-weight:400;
    }
      @media print
{    
    .no-print, .no-print *
    {
        display: none !important;
    }
}
</style>
</head>
<body>
<!--    <a style="position:absolute;right:10px;top:20px;" class="no-print btn btn-danger" href="">แบบ2</a> -->
<div class="book">
       <div class="controls">

           
                  <?
//                     $pob = $db['pass_birth_place'];
//                     $pob_explode = explode(", ", $pob);
//                     $pob1 = $pob_explode[0];
//                     $pob2 = $pob_explode[1];
//                     $datebrit = $db['pass_birth_date'];;
//                     $mm2 = date("d-m-Y", strtotime($datebrit));
//                     $month23 = date("dmY", strtotime($mm2));
//                           if ($rtp['programe_time'] == '7 วัน 4 คืน'){
//                       $time = '4 Days';
//                     }else if($rtp['programe_time'] == '5 วัน 3 คืน'){
//                       $time = '4 Days';
//                     }else if($rtp['programe_time'] == '6 วัน 4 คืน'){
//                       $time = '4 Days';
//                     }else if($rtp['programe_time'] == '4 วัน 3 คืน'){
//                       $time = '3 Days';
//                     }else{
//                       $time = $rtp['programe_time'];
//                     }
//                     $datego1 = $rtp['trip_date_go'];
//                     $dd1 = date("d", strtotime($datego1));
//                     $mm1 = date("m", strtotime($datego1));
//                     $yy1 = date("Y", strtotime($datego1));

//                     $pdd1 = date("d", strtotime($datebrit));
//                     $pmm1 = date("m", strtotime($datebrit));
//                     $pyy1 = date("Y", strtotime($datebrit));


//                     $dateback1 = $rtp['trip_date_back'];
//                     $dd1b = date("d", strtotime($dateback1));
//                     $mm1b = date("m", strtotime($dateback1));
//                     $yy1b = date("Y", strtotime($dateback1));

//     $pass_date_date = $db['pass_date_iss'];
//     $pass_exp_date = $db['pass_exp_iss']; 


//     $birth_date = $db['pass_birth_date'];
//     $birth_explode = explode("/", $birth_date);
//     $birth_month = $birth_explode[0];
//     $birth_day = $birth_explode[1];
//     $birth_year = $birth_explode[2];


//     $pass_date_explode = explode("/", $pass_date_date);
//     $pass_date_month = $pass_date_explode[0];
//     $pass_date_day = $pass_date_explode[1];
//     $pass_date_year = $pass_date_explode[2];

//     $pass_exp_explode = explode("/", $pass_exp_date);
//     $pass_exp_month = $pass_exp_explode[0];
//     $pass_exp_day = $pass_exp_explode[1];
//     $pass_exp_year = $pass_exp_explode[2];

//     switch($birth_month){
//       case 1: $an = 'Jan'; break;
//       case 2: $an = 'Feb'; break;
//       case 3: $an = 'Mar'; break;
//       case 4: $an = 'Apr'; break;
//       case 5: $an = 'May'; break;
//       case 6: $an = 'Jun'; break;
//       case 7: $an = 'Jul'; break;
//       case 8: $an = 'Aug'; break;
//       case 9: $an = 'Sep'; break;
//       case 10: $an = 'Oct'; break;
//       case 11: $an = 'Nov'; break;
//       case 12: $an = 'Dec'; break;
//     }
//     switch($pass_date_month){
//       case 1: $ai = 'Jan'; break;
//       case 2: $ai = 'Feb'; break;
//       case 3: $ai = 'Mar'; break;
//       case 4: $ai = 'Apr'; break;
//       case 5: $ai = 'May'; break;
//       case 6: $ai = 'Jun'; break;
//       case 7: $ai = 'Jul'; break;
//       case 8: $ai = 'Aug'; break;
//       case 9: $ai = 'Sep'; break;
//       case 10: $ai = 'Oct'; break;
//       case 11: $ai = 'Nov'; break;
//       case 12: $ai = 'Dec'; break;
//     }
//     switch($pass_exp_month){
//       case 1: $at = 'Jan'; break;
//       case 2: $at = 'Feb'; break;
//       case 3: $at = 'Mar'; break;
//       case 4: $at = 'Apr'; break;
//       case 5: $at = 'May'; break;
//       case 6: $at = 'Jun'; break;
//       case 7: $at = 'Jul'; break;
//       case 8: $at = 'Aug'; break;
//       case 9: $at = 'Sep'; break;
//       case 10: $at = 'Oct'; break;
//       case 11: $at = 'Nov'; break;
//       case 12: $at = 'Dec'; break;
//     }
// $hotel = $rtp['trip_hotel'];
// $hoteltel = $rtp['trip_hotel_tel'];

                  ?>

<?
      while (! feof($CSVfp)) {
        // if (($i >= 1 && $i <= 10)) {
        $data = fgetcsv($CSVfp, 1000, ",");
        if (! empty($data)) { ?>
<?if(!empty($_GET['page'])){?>
    <div class="page" style="position:relative;"><?$i++?>
     <span style="    position: absolute;left:362px;top: 44px;font-size: 10pt;">X</span> 
      <span style="    position: absolute;left:362px;top:120px;font-size: 10pt;">X</span> 
        <div style="padding-top:95px;padding-left:40px;line-height: 0.2;">
       <sapn style="font-size:0.8rem;">2024 / OCT /  25&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; TG613
       </div>
        <div style="padding-top:80px;padding-left:40px;line-height: 0.2;">
       <sapn style="font-size:0.8rem;">Chengtao&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 13808702690</sapn>
      <!--  <sapn style="font-size:0.7rem;">HUNAN BEST INTERNATIONAL TRAVEL SERVICE</sapn> -->
       </div>
  </div>
<?}else{?>
    <div class="page" style="position:relative;"><?$i++?>
     <span style="position:absolute;right:20px;top:16px;font-size:10pt;"><?=$i;?></span> 
        <div style="padding-top:65px;padding-left:560px;line-height: 0.2;">
       <sapn style="font-size:0.8rem;"><?php echo $data[4]; ?></sapn>
    <?if($data[6] == "M"){?>
     <sapn style="font-weight:bold;color:red;position:absolute;right:80px;">X</sapn>
    <?}else{?>
     <sapn style="font-weight:bold;color:red;position:absolute;right:20px;">X</sapn>
    <?}?>
       </div>
        <div style="padding-top:30px;padding-left:560px;line-height: 0.2;">
       <sapn style="font-size:0.8rem;"><?php echo $data[1]; ?></sapn>
       <sapn style="position:absolute;right:44px;">THAI</sapn>
       </div>
       <div style="padding-top:30px;padding-left:560px;line-height: 0.2;letter-spacing: 6px;">
       <sapn style="font-size:0.8rem;"><?php echo $data[7]; ?></sapn>
       </div>
        <div style="padding-top:30px;padding-left:560px;line-height: 0.2;letter-spacing: 4px;">
       <sapn style="font-size:0.8rem;"><?php echo $data[5]; ?>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?=$db[pass_place_iss];?></sapn>
       </div>
        <div style="padding-top:30px;padding-left:622px;line-height: 0.2;letter-spacing:1px;">
       <sapn style="font-size:0.8rem;">TG612</sapn>
       </div>
        <div style="padding-top:27px;padding-left:622px;line-height: 0.2;letter-spacing:1px;">
       <sapn style="font-size:0.8rem;">028682233</sapn>
       </div>
        <div style="padding-top:26px;padding-left:622px;line-height: 0.2;letter-spacing:1px;">
       <sapn style="font-size:0.8rem;">Kunming</sapn>
       </div>
       <div style="padding-top:20px;padding-left:622px;line-height: 0.2;letter-spacing:1px;">
        <sapn style="font-weight:bold;position:absolute;right:18px; right: 19px;top: 237px;">X</sapn>
       </div>
       <div style="padding-top:17px;padding-left:622px;line-height: 0.2;letter-spacing:1px;">
       </div>
       <div style="padding-top:0px;padding-left:530px;line-height: 0.2;letter-spacing:1px;font-size:0.8rem;">
      Feilong 288,Qinghong R. Dali
      <sapn style="position:absolute;right:23px;"> Kunming</sapn>
       </div>
  </div>
<?}?>

<?}}?>






</div>

</body>
</html>









