<?php include "common/user_log.php"; 

date_default_timezone_set('Asia/Colombo');
$date = date("Y-m-d");

if(isset($_GET['id'])) {
	$id = htmlspecialchars(trim($_GET['id']), ENT_QUOTES, 'UTF-8');
	$sql = "SELECT * FROM travel_expenses WHERE flag = '1' AND vou_no = '$id'";
	$sql_inv = mysqli_fetch_assoc(mysqli_query($conn, $sql));

	date_default_timezone_set('Asia/Colombo');
	$date_today = date("Y-m-d");
	
}
if(empty($id)) { 
	$redirectUrl = "approved_invoices.php";
	echo "<script type=\"text/javascript\">";
	echo "window.location.href = '$redirectUrl'";
	echo "</script>";
}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>NWP Engineering Department</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="dist/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="dist/css/ionicons.min.css">
    <!-- daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- iCheck for checkboxes and radio inputs -->
    <link rel="stylesheet" href="plugins/iCheck/all.css">
    <!-- Bootstrap Color Picker -->
    <link rel="stylesheet" href="plugins/colorpicker/bootstrap-colorpicker.min.css">
    <!-- Bootstrap time Picker -->
    <link rel="stylesheet" href="plugins/timepicker/bootstrap-timepicker.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="plugins/select2/select2.min.css">
	<!-- DataTables -->
    <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="bootstrap-sweetalert/lib/sweet-alert.css" />
  </head>
  <body class="hold-transition skin-blue sidebar-mini" onload="window.print();">
    <div class="wrapper">

      <header class="main-header">
        <!-- Logo -->
         <a href="home.php" class="logo">
          <!-- mini logo for sidebar mini 50x50 pixels -->
         <span class="logo-mini"><img src="img/logo.png" width="100"></span>
          <!-- logo for regular state and mobile devices -->
        <span class="logo-lg"><b><img src="img/logo.png" width="100"></b></span>
        </a>
        <!-- Header Navbar: style can be found in header.less -->
        <nav class="navbar navbar-static-top" role="navigation">
          <!-- Sidebar toggle button-->
          <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
			 <span class="logo-lg">
             &nbsp;&nbsp;<font face="Lucida Sans Unicode, Lucida Grande, sans-serif">NWP Engineering Department</font></span>
          </a>
		
          <div class="navbar-custom-menu">
            <ul class="nav navbar-nav">

              <!-- User Account: style can be found in dropdown.less -->
              <li class="dropdown user user-menu">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                  <img src="dist/img/user2-160x160.png" class="user-image" alt="User Image">
                  <span class="hidden-xs"><?php echo $name; ?></span>
                </a>
                <ul class="dropdown-menu">
                  <!-- User image -->
                  <li class="user-header">
                    <img src="dist/img/user2-160x160.png" class="img-circle" alt="User Image">
                    <p>
             NWP Engineering Department
                    
                    </p>
                  </li>
                  <!-- Menu Body -->
                 
                  <!-- Menu Footer-->
                  <li class="user-footer">
                    <div class="pull-left">
                      
                    </div>
                    <div class="pull-right">
                      <a href="distroy.php" class="btn btn-default btn-flat">Sign out</a>
                    </div>
                  </li>
                </ul>
              </li>
              <!-- Control Sidebar Toggle Button -->
              <li>
                <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
              </li>
            </ul>
          </div>
        </nav>
      </header>
      <!-- Left side column. contains the logo and sidebar -->
      <aside class="main-sidebar">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
          <!-- Sidebar user panel -->
    <?php include "common/sidebar.php"; ?>  
     
        </section>
        <!-- /.sidebar -->
      </aside>

      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">


        <!-- Main content -->
        <section class="content">

<style>
hr {
	border-top: 1px solid #222d32;
	margin: 0;
}
p {
    margin: 5px 8px 3px 0;
}
.table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td {
	border-top: none;
	padding: 3px;
}
u {    
    border-bottom: 1px dotted #000;
    text-decoration: none;
}
.table>tbody>tr>td {
	    vertical-align: middle;
}
</style>		
		
<!-- ************************************************* -->

    <div style="background-color:#fff;">
      <div class="box-body">

		<table class="table" border="0">
		  <tr>
			<td width="60%">Payable within 30 days from the date of issue.</td>
			<td colspan="2" width="40%" align="right">General 177</td>
		  </tr>
		  <tr>
			<td rowspan="2"><h4><b>TRAVEL EXPENSES REQUEST</b></h4></td>
			<td width="10%">Voucher No</td>
			<td align="left" width="40%"><table width="50%" border="1">
			   <tr>
				 <td height="25"><p style="margin:3px"><?php echo $sql_inv['vou_no']; ?></p></td>
			   </tr>
			</table></td>
		  </tr>
		  <tr>
			<td>Cheque No</td>
			<td  align="left"><table width="50%" border="1">
			   <tr>
				 <td height="28"><p style="margin:3px"><?php echo $sql_inv['chq_no']; ?></p></td>
			   </tr>
			</table></td>
		  </tr>
		  <tr>
			<td><p>Expenses Details: &nbsp;&nbsp;<span><?php echo $sql_inv['exp_detail']; ?></span></p>
			<p>Name of the officer: &nbsp;&nbsp;<span><?php echo $sql_inv['officer_name']; ?></span></p>
			<p>Position: &nbsp;&nbsp;<span><?php echo $sql_inv['position']; ?></span></p>
			<p>Department: &nbsp;&nbsp;<span><?php echo $sql_inv['department']; ?></span></p></td>
			<td colspan="2">
			<p>Consolidated Annual Salary (Rs): &nbsp;&nbsp;<span><?php echo $sql_inv['annual_sal']; ?></span></p>
			<p>Other Allowances Approved or Travel Cost (Rs): &nbsp;&nbsp;<span><?php echo $sql_inv['approve_all']; ?></span></p>
			<p>Combined Allowances (Rs): &nbsp;&nbsp;<span><?php echo $sql_inv['combined_all']; ?></span></p>		
			</td>
		  </tr>
		  <tr><td colspan="3"><br>Government Service of <b><?php echo $sql_inv['reason']; ?></b> traveling to <b><?php echo $sql_inv['departure']; ?></b></td>
		  </tr>
		</table>
		<br>
		
		<table class="" border="1" width="100%">
		  <tr>
			<td width="35%" style="border-bottom-color: transparent;">&nbsp;</td>
			<th width="20%" valign="bottom"><p align="right">Rs. &nbsp;&nbsp;&nbsp;cts</p></th>
			<td width="55%"  style="border-bottom-color: transparent;" rowspan="9">&nbsp;</td>
		  </tr>
		  <tr>
			<td style="border-bottom-color: transparent;"><p style="margin-left:10px">(a) Travel Expenses*</p></td>
			<td style="border-bottom-color: transparent;" align="right"><p><?php echo $sql_inv['travel_exp']; ?></p></td>
		  </tr>
		  <tr>
			<td style="border-bottom-color: transparent;"><p style="margin-left:10px">(b) Combined Allowance*</p></td>
			<td style="border-bottom-color: transparent;"align="right"><p><?php echo $sql_inv['comb_allow']; ?></p></td>
		  </tr>
		  <tr>
			<td style="border-bottom-color: transparent;"><p style="margin-left:10px">(c) Employee and driver bata*</p></td>
			<td align="right"><p><?php echo $sql_inv['emp_bata']; ?></p></td>
		  </tr>
		  <tr>
			<td style="border-bottom-color: transparent;">&nbsp;</td>
			<td style="border-bottom-color: transparent;">&nbsp;</td>
		  </tr>
		  <tr>
			<td style="border-bottom-color: transparent;"><p style="margin-left:10px">Total Amount Requested</p></td>
			<td style="border-bottom-color: transparent;" align="right"><p><?php echo $amount = $sql_inv['req_amount']; ?></p></td>
		  </tr>
		  <tr>
			<td style="border-bottom-color: transparent;"><p style="margin-left:10px">Deducted</p></td>
			<td style="border-bottom-color: transparent;">&nbsp;</td>
		  </tr>
		  <tr>
			<td style="border-bottom-color: transparent;"><p style="margin-left:10px">Advance Payment</p></td>
			<td align="right"><p><?php echo $adv = $sql_inv['adv_pay']; ?></p></td>
		  </tr>
		  <tr>
			<td style="border-bottom-color: transparent;"><p style="margin-left:10px">Remaining Expenses</p><br></td>
			<td align="right"><p><?php $bal = $amount-$adv; echo number_format($bal, 2); ?></p></td>
		  </tr>
		</table>
		
		<table border="0">
		  <tr>
			<td colspan="2"><p align="justify" style="margin:10px 0">Rupees .................................. of above mentioned amount includes precise details of the expenses to be spent and already spent. The estimated amounts are justful and fair according to the rules and regulations, also certify that this journey was completed with minimum expenses and by the shortest route to reach on behalf of social republic of Sri Lanka. </p></td>
		  </tr>
		  <tr>
			<td width="70%"></td>
			<td><br><p>................................................................</p><p>Signature of Requested Officer</p>Date: .............................</td>
		  </tr>
		  <tr>
			<td><br><p align="left">................................................................</p><p align="left">Signature of Checked Officer</p></td>
			<td><br><p>................................................................</p><p>Signature of Department Head</p>Date: .............................</td>
		  </tr>
		</table><br>
		<table border="0" width="100%">
		<tr><td>Received amount of Rs. ....................................... from the socialist republic of Sri Lanka.</td></tr>
		<tr><td width="70%"><br>Date: ..........................</td><td><br>Signature: ...............................................</td></tr>
		</table>
		<br>
		
      </div>
      <!-- /.box-body -->
    </div>
    
  </section>
   
      </div>
	      <!-- /.End table -->
<!-- ************************************************* -->
      
           <!-- /.col -->
              </div><!-- /.row -->
            </div><!-- /.box-body -->
            
          

          <div class="row">
            
    
    
      </div>
      <!-- /.col (right) -->
         

      </div>

      <!-- Control Sidebar -->
      <aside class="control-sidebar control-sidebar-dark">
        <!-- Create the tabs -->
        <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
          <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
          <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
        </ul>
        <!-- Tab panes -->
        <div class="tab-content">
          <!-- Home tab content -->
          <div class="tab-pane" id="control-sidebar-home-tab">
          </div><!-- /.tab-pane -->

          </div><!-- /.tab-pane -->
        </div>
      </aside><!-- /.control-sidebar -->
      <!-- Add the sidebar's background. This div must be placed
           immediately after the control sidebar -->
      <div class="control-sidebar-bg"></div>
    </div><!-- ./wrapper -->

    <!-- jQuery 2.1.4 -->
    <script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
    <!-- Bootstrap 3.3.5 -->
    <script src="bootstrap/js/bootstrap.min.js"></script>
    <!-- Select2 -->
    <script src="plugins/select2/select2.full.min.js"></script>
	<!-- DataTables -->
    <script src="plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
    <!-- InputMask -->
    <script src="plugins/input-mask/jquery.inputmask.js"></script>
    <script src="plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
    <script src="plugins/input-mask/jquery.inputmask.extensions.js"></script>
    <!-- date-range-picker -->
    <script src="plugins/daterangepicker_n/moment.min.js"></script>
    <script src="plugins/daterangepicker_n/daterangepicker.js"></script>
    <!-- bootstrap color picker -->
    <script src="plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
    <!-- bootstrap time picker -->
    <script src="plugins/timepicker/bootstrap-timepicker.min.js"></script>
    <!-- SlimScroll 1.3.0 -->
    <script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- iCheck 1.0.1 -->
    <script src="plugins/iCheck/icheck.min.js"></script>
    <!-- FastClick -->
    <script src="plugins/fastclick/fastclick.min.js"></script>
    <!-- AdminLTE App -->
    <script src="dist/js/app.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="dist/js/demo.js"></script>
    <script src="bootstrap-sweetalert/lib/sweet-alert.min.js"></script>
	
    <!-- Page script -->
    <script>
      $(function () {
        //Initialize Select2 Elements
        $(".select2").select2();

        //Datemask dd/mm/yyyy
        $("#datemask").inputmask("dd/mm/yyyy", {"placeholder": "yyyy-mm-dd"});
        //Datemask2 mm/dd/yyyy
        $("#datemask2").inputmask("mm/dd/yyyy", {"placeholder": "yyyy-mm-dd"});
        //Money Euro
        $("[data-mask]").inputmask();

        //Date range picker
        $('#reservation').daterangepicker();
        //Date range picker with time picker
       $('#date_start').daterangepicker({timePicker: false, timePickerIncrement: 30, format: 'YYYY-MM-DD'});
       $('#date_comp').daterangepicker({timePicker: false, timePickerIncrement: 30, format: 'YYYY-MM-DD'});
       $('#date_award').daterangepicker({timePicker: false, timePickerIncrement: 30, format: 'YYYY-MM-DD'});


       $('#date_start_up').daterangepicker({timePicker: false, timePickerIncrement: 30, format: 'YYYY-MM-DD'});
       $('#date_comp_up').daterangepicker({timePicker: false, timePickerIncrement: 30, format: 'YYYY-MM-DD'});
		   $('#date_award_up').daterangepicker({timePicker: false, timePickerIncrement: 30, format: 'YYYY-MM-DD'});


		   $('#exp_date_up').daterangepicker({timePicker: false, timePickerIncrement: 30, format: 'YYYY-MM-DD'});
        //Date range as a button
        $('#daterange-btn').daterangepicker(
            {
              ranges: {
                'Today': [moment(), moment()],
                'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                'Last 7 Days': [moment().subtract(6, 'days'), moment()],
                'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                'This Month': [moment().startOf('month')],
                'Last Month': [moment().subtract(1, 'month').startOf('month')]
              },
              startDate: moment().subtract(29, 'days'),
           
            },
        function (start) {
          $('#reportrange span').html(start.format('MMMM D, YYYY'));
        }
        );

        //iCheck for checkbox and radio inputs
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
          checkboxClass: 'icheckbox_minimal-blue',
          radioClass: 'iradio_minimal-blue'
        });
        //Red color scheme for iCheck
        $('input[type="checkbox"].minimal-red, input[type="radio"].minimal-red').iCheck({
          checkboxClass: 'icheckbox_minimal-red',
          radioClass: 'iradio_minimal-red'
        });
        //Flat red color scheme for iCheck
        $('input[type="checkbox"].flat-red, input[type="radio"].flat-red').iCheck({
          checkboxClass: 'icheckbox_flat-green',
          radioClass: 'iradio_flat-green'
        });

        
      });
	  
      $(function () {
        $("#example1").DataTable();
        $('#example2').DataTable({
          "paging": true,
          "lengthChange": false,
          "searching": false,
          "ordering": true,
          "info": true,
          "autoWidth": false
        });
      });
	</script>
		
</body>
</html>
