<?php
$vehicle_no=$_REQUEST['vehicle_no'];
include("../include/config.php");
require_once "../include/Database_functions.php";
$sqlObj=new sqlclass();
?>
	<table width="100%">
    <tr>
      <td height="30" colspan="2" align="left" valign="middle">Total Load Moved</td>
      </tr>
	      <tr>
      <td height="30" align="left" valign="top">
	  <div id="tab_lster">
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
		<th align="left" valign="middle">Vehicle Number</th>
          <th align="left" valign="middle">Date</th>
          <th align="left" valign="middle">Container No</th>
          <th align="left" valign="middle">From</th>
          <th align="left" valign="middle">To</th>
          <th align="left" valign="middle">Amount</th>
        </tr>
		
<?php
	if(isset($_REQUEST['vehicle_no'])){
	$vehicle_no=$_REQUEST['vehicle_no'];
	}
	
	$i=1;
	$sq_arr="select * from tbl_trip_sheet where 1 ";
	if($vehicle_no!=''){
	$sq_arr.=" and vehicle_no ='".$vehicle_no."' ";
	}
	$sq_arr.=" order by id desc ";
	$query=$sq_arr;
	$function="load_moved";
	include("../paging.php");
	$sq_arr.=" LIMIT $start, $limit";
	
	$array=mysql_query($sq_arr);
	if($array && mysql_num_rows($array)>0){
		while($result=mysql_fetch_array($array))
		{
		$dd=date("m-d-Y",strtotime($result['date']));
?>
        <tr>
		<td class="tr_td"><?php if($result['vehicle_no']!='') echo $result['vehicle_no'];else echo '--';?></td>
          <td class="tr_td"><?php if($result['date']!='') echo $dd;else echo '--';?></td>
          <td class="tr_td"><?php  if($result['container_no']!='') echo $result['container_no'];else echo '--';?></td>
          <td class="tr_td"><?php  if($result['from_place']!='') echo $result['from_place'];else echo '--';?></td>
          <td class="tr_td"><?php  if($result['to_place']!='') echo $result['to_place'];else echo '--';?></td>
          <td class="tr_td tr_td_r"><?php  if($result['total_expence']!='') echo $result['total_expence'];else echo '--';?></td>
          <td height="30"><a href="view_trip_sheet.php?veh_no=<?php echo $result['id']; ?>"><span style="color:#660000;">View Trip Sheet</span></a></td>
        </tr>
<?php
		}?>
		<tr>
            <td colspan="6" align="left" valign="middle"><div align="right" style="padding-top:10px;"><?=$pagination?></div></td>
          </tr>
		  <?
		}
?>		
         </table> </div>       </td>
      <td align="center" valign="top"></td>
    </tr>
          
          <tr>
      <td height="30" align="left" valign="middle">Vehicle Maintenance</td>
      <td align="center" valign="middle">&nbsp;</td>
    </tr>
    <tr>
      <td height="30" align="left" valign="middle">
	 <div id="tab_mainer"> 
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
		 <th width="24%" align="left" valign="middle">Vehicle Number</th>
          <th width="24%" align="left" valign="middle">Date</th>
          <th width="22%" align="left" valign="middle">Work</th>
          <th align="left" valign="middle">Amount</th>
        </tr>
<?php

if(isset($_REQUEST['vehicle_no'])){
	$vehicle_no1=$_REQUEST['vehicle_no'];
	}
	$i=1;
	$sq_arr1="select tbl_maintenance.* from tbl_maintenance where tbl_maintenance.vehicle_no in(select maint_id from tbl_maint_voucher)";
	if($vehicle_no1!=''){
	$sq_arr1.=" and tbl_maintenance.vehicle_no ='".$vehicle_no1."' ";
	}
	$sq_arr1.=" order by tbl_maintenance.id desc ";
	$query=$sq_arr1;
	$function="maint_moved";
	include("../paging.php");
	$sq_arr1.=" LIMIT $start, $limit";
	
	$array1=mysql_query($sq_arr1);
	if($array1 && mysql_num_rows($array1)>0){
		while($maintres=mysql_fetch_array($array1))
		{
		$dd1=date("m-d-Y",strtotime($maintres['date']));
?>
         <tr>
		 <td class="tr_td"><?php if($maintres['vehicle_no']!='') echo $maintres['vehicle_no'];else echo '--';?></td>
          <td align="left" valign="middle" class="tr_td"><?php if($maintres['date']!='') echo $dd1;else echo '--';?></td>
          <td align="left" valign="middle" class="tr_td"><?php if($maintres['work_details']!='') echo $maintres['work_details'];else echo '--';?></td>
          <td align="left" valign="middle" class="tr_td tr_td_r"><?php if($maintres['amount']!='') echo $maintres['amount'];else echo '--';?></td>
		  <td><a href="view_maintenance.php?vehicle_no=<?php echo $maintres['vehicle_no']; ?>"><span style="color:#660000;">View Details</span></a></td>
        </tr>
<?php
}
?>
		<tr>
            <td colspan="6" align="left" valign="middle"><div align="right" style="padding-top:10px;"><?=$pagination?></div></td>
          </tr>
		  <?
		}
?>		
         </table>
		 </div>
		 </td>
      <td align="center" valign="top"></td>
    </tr>
<!--fuel -->
<tr>
      <td height="30" align="left" valign="middle">Fuel Maintenance</td>
      <td align="center" valign="middle">&nbsp;</td>
    </tr>
<tr>
      <td height="30" align="left" valign="middle">
	   <div id="tab_fuel"> 
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
		 <th width="24%" align="left" valign="middle">Vehicle Number</th>
          <th width="24%" align="left" valign="middle">Date</th>
          <th width="22%" align="left" valign="middle">Litre</th>
          <th align="left" valign="middle">Amount</th>
		   <th align="left" valign="middle">Towards</th>
        </tr>
<?php

if(isset($_REQUEST['vehicle_no'])){
	$vehicle_no2=$_REQUEST['vehicle_no'];
	}
	$i=1;
	$sq_arr2="select * from tbl_fuel_expence where vehicle_number in(select  vehicle_number from tbl_fuel_voucher) ";
	if($vehicle_no2!=''){
	$sq_arr2.=" and tbl_fuel_expence.vehicle_number ='".$vehicle_no2."' ";
	}
	$sq_arr2.=" order by tbl_fuel_expence.id desc ";
	$query=$sq_arr2;
	$function="fuel_moved";
	include("../paging.php");
	$sq_arr1.=" LIMIT $start, $limit";
	
	$array2=mysql_query($sq_arr2);
	if($array2 && mysql_num_rows($array2)>0){
		while($fuelres=mysql_fetch_array($array2))
		{
		$dd2=date("m-d-Y",strtotime($fuelres['date']));
?>
        <tr>
		 <td class="tr_td"><?php if($fuelres['vehicle_number']!='') echo $fuelres['vehicle_number'];else echo '--';?></td>
          <td align="left" valign="middle" class="tr_td"><? if($fuelres['date']!=''){ echo $dd2;}else{echo '--';}?></td>
          <td align="left" valign="middle" class="tr_td"><? if($fuelres['litres']!=''){ echo $fuelres['litres'];}else{echo '--';}?></td>
          <td align="left" valign="middle" class="tr_td tr_td_r"><? if($fuelres['amount']!=''){ echo $fuelres['amount'];}else{echo '--';}?></td>
		  <td align="left" valign="middle" class="tr_td tr_td_r"><? if($fuelres['pump']!=''){ echo $fuelres['pump'];}else{echo '--';}?></td>
		 <!-- <td><a href="view_maintenance.php?vehicle_no=<?php// echo $fuelres['pump']; ?>"><span style="color:#660000;">View Details</span></a></td> -->
        </tr>
<?php
}
?>
		<tr>
            <td colspan="6" align="left" valign="middle"><div align="right" style="padding-top:10px;"><?=$pagination?></div></td>
          </tr>
		  <?
		}
?>		
         </table></div></td>
      <td align="center" valign="top"></td>
    </tr>
</table>