<?
include("../include/config.php");
require_once "../include/Database_functions.php";
$sqlObj=new sqlclass();
$div=$_GET['div'];
$div1=$div;
$div=$div+1;
?>
<link type="text/css" href="../css_date/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type="text/javascript" src="../scripts_date/jquery.js"></script>
<script type="text/javascript" src="../scripts_date/jquery-calendar-1.7.2.js"></script>
<script>$(document).ready(function(){
$('#indate').datepicker({
showOn: 'both',
buttonImage: '../icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd'
});
});

$(document).ready(function(){
$('#txdate').datepicker({
showOn: 'both',
buttonImage: '../icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd'
});
});
</script>

	
	<table width="50%" border="0" cellspacing="0" cellpadding="0">
     <tr>
      <th width="35%" align="left" valign="middle">ADD TRIP SHEET </th>
      <th width="40%" align="left" valign="middle">&nbsp;</th>
    </tr>
	<tr>
      <td class="tr_td">Container No.<span class="err_msg">*</span></td>
      <td class="tr_td tr_td_r" align="left">
	 <select name="container_no<?=$div?>" id="container_no<?=$div?>">
	  <option value="">--Select--</option>
	  <?
	  $contarr=mysql_query("select * from tbl_container where status = '1'");
while($contres=mysql_fetch_array($contarr))
{

?>
<option value="<?php echo $contres['container_num'];?>" <? if(isset($_POST['container_no'])){if($_POST['container_no']==$contres['container_num']){?>checked="checked"<? }}?>><?php echo $contres['container_num'];?></option>
<?php
}
?>
      </select>
	  </td>
    </tr>
	
	 <tr>
      <td class="tr_td">Start Date.<span class="err_msg">*</span></td>
      <td class="tr_td tr_td_r" align="left">
	  <input type="text" class="content" name="cdate<?=$div?>"  id="ldate<?=$div?>" size="10" maxlength="100" style="display:none;">
   <a style="cursor:hand;cursor:pointer;" id="imgsrcins11"  onclick="clkins_dt(<?=$div?>);"/><font color="#000000">click to date</font> </a>
   
	  </td>
    </tr>
    <tr>
      <td class="tr_td">End Date.<span class="err_msg">*</span></td>
      <td class="tr_td tr_td_r" align="left">
	  <input type="text" class="content" name="edate<?=$div?>"  id="kdate<?=$div?>" size="10" maxlength="100" style="display:none;">
   <a style="cursor:hand;cursor:pointer;" id="imgsrc11"  onclick="clk_dt(<?=$div?>);"/><font color="#000000">click to date</font> </a> 
	  </td>
    </tr>
	
	
	
	
    <tr>
      <td class="tr_td">Vehicle No.<span class="err_msg">*</span></td>
      <td class="tr_td tr_td_r" align="left"><select name="vehicle_no<?=$div?>" id="vehcle_no<?=$div?>" onchange="go_datecheck(1,<?=$div?>)">
	  <option value="" selected="selected">--Select--</option>
	  <?php
	  $vehicle=mysql_query("select * from tbl_vehicle where status = '1'");
	  while($vehires=mysql_fetch_array($vehicle))
	  {
	  
	  ?>
	  <option value="<?=$vehires['vehiclenum'];?>" <? if(isset($_POST['vehicle_no'])){if($_POST['vehicle_no']==$vehires['vehiclenum']){?>checked="checked"<? }}?>><?=$vehires['vehiclenum'];?></option>
	  <?php
	  }
	  ?>
	  </select></td>
    </tr>
    <tr>
      <td class="tr_td">Driver Details</td>
      <td class="tr_td tr_td_r" align="left">
	   <select name="driver_det<?=$div?>" id="driver_det<?=$div?>" onchange="go_datecheck(2,<?=$div?>);">
	  <option value="">--Select--</option>
	  <?php
	  $emp=mysql_query("select * from tbl_employee where department='driver' and trip_status=1");
	  while($list=mysql_fetch_array($emp))
	  {
	  ?>
	  <option value="<?php echo $list['id']; ?>" <? if(isset($_POST['driver_det'])){if($_POST['driver_det']==$list['id']){?>checked="checked"<? }}?>><?php echo $list['name']; ?></option>
	  <?php
	  }
	  ?>
      </select>
	  </td>
    </tr>
    <tr>
      <td valign="top" class="tr_td">Cart Used</td>
      <td class="tr_td tr_td_r" align="left"> <select name="cart_used<?=$div?>" id="cart_used<?=$div?>">
	  <option value="">--Select--</option> 
	  <?
	  $sql_cart=mysql_query("select vehiclenum from  tbl_vehicle where type='cart'");
	  while($cart_obj=mysql_fetch_object($sql_cart)){
	  $crt=$cart_obj->vehiclenum;
	  ?>
	 <option value="<?=$crt?>" <? if(isset($_POST['cart_used'])){if($_POST['cart_used']==$crt){?>selected<? }}?>><?=$crt?></option> 
	<?  }
	  ?> </select></td>
    </tr>
    <tr>
      <td valign="top" class="tr_td">Consignee</td>
      <td class="tr_td tr_td_r" align="left"> <input type="text" name="consignee<?=$div?>" <? if(isset($_POST['consignee'])){?>value="<?=$_POST['consignee']?>"<? }?>/></td>
    </tr>
		  <tr>
      <td colspan="2" class="tr_td tr_td_r"><strong>Delivery Details</strong></td>
      </tr>
   
  
    <tr>
      <td class="tr_td">From</td>
      <td class="tr_td tr_td_r" align="left"><input name="from<?=$div?>" type="text" <? if(isset($_POST['from1'])){?>value="<?=$_POST['from1']?>"<? }?>/></td>
    </tr>
    <tr>
      <td class="tr_td">To</td>
      <td class="tr_td tr_td_r" align="left"><input name="to<?=$div?>" type="text" <? if(isset($_POST['to1'])){?>value="<?=$_POST['to1']?>"<? }?>/></td>
    </tr>
	<tr>
      <td class="tr_td">Kilometer</td>
      <td class="tr_td tr_td_r" align="left"><input name="kilometer<?=$div?>" id="kilometer<?=$div?>" type="text" <? if(isset($_POST['kilometer'])){?>value="<?=$_POST['kilometer']?>"<? }?>/></td>
    </tr>
    <tr>
      <td class="tr_td">Additional Delivery Details</td>
      <td class="tr_td tr_td_r" align="left"><textarea name="additional_det<?=$div?>" cols="15" rows="5" id="additional_det<?=$div?>"><? if(isset($_POST['additional_det'])){?><?=$_POST['additional_det']?><? }?></textarea></td>
    </tr>
    <tr>
      <td class="tr_td">Trip Advance </td>
      <td class="tr_td tr_td_r" align="left"><input name="batta<?=$div?>" type="text" id="batta<?=$div?>" <? if(isset($_POST['batta'])){?>value="<?=$_POST['batta']?>"<? }?> onkeyup="calculate()"/></td>
    </tr>
	
	
	
	<tr>
      <td class="tr_td">Expense Details</td>
      <td class="tr_td tr_td_r"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>Details </td>
          <td>Amount</td>
        </tr>
        <tr>
          <td><input type="text" name="det<?=$div?>1" <? if(isset($_POST['det11'])){?>value="<?=$_POST['det11']?>"<? }?>/></td>
          <td><input type="text" name="amnt<?=$div?>1" id="amnt<?=$div?>1" onkeyup="calculate(this.value)" <? if(isset($_POST['amnt11'])){?>value="<?=$_POST['amnt11']?>"<? }?>/>
		
		  </td>
        </tr>
     <tr>
      <td colspan="2" align="right"> <a style="cursor:pointer;" id="atag<?=$div?>2" onclick="addmoreexpense('<?=$div?>','2')">Add more</a></td>
      </tr>

      </table>
	   <div id="td<?=$div?>2"></div></td>
    </tr>
	
	
	 <tr>
      <td class="tr_td">Total Expense</td>
      <td class="tr_td tr_td_r"><input type="text" id="total_expence<?=$div?>" name="total_expence<?=$div?>"  value="0"  onclick="calculate()" <? if(isset($_POST['total_expence1'])){?>value="<?=$_POST['total_expence1']?>"<? }?>/></td>
    </tr>
    <tr>
      <td class="tr_td">Amount Pending</td>
      <td class="tr_td tr_td_r"><input name="amount_pend<?=$div?>" type="text" id="amount_pend<?=$div?>"  <? if(isset($_POST['amount_pend1'])){?>value="<?=$_POST['amount_pend1']?>"<? }?>/></td>
    </tr>
    <tr>
      <td class="tr_td">Amount to be Paid</td>
      <td class="tr_td tr_td_r"><input name="amount_paid<?=$div?>" type="text" id="amount_paid<?=$div?>"  <? if(isset($_POST['amount_paid1'])){?>value="<?=$_POST['amount_paid1']?>"<? }?>/></td>
    </tr>
	
	 <tr>
      <td class="tr_td">Client</td>
      <td class="tr_td tr_td_r"><input type="text" name="client<?=$div?>" id="client<?=$div?>" onclick="client_dt(<?=$div?>);" class="txtbox" /></td>
    </tr>
	
	
	
	 <tr>
      <td class="tr_td">Trip Finished</td>
      <td class="tr_td tr_td_r">
	  
	  <input type="checkbox" name="tripstatus<?=$div?>" id="tripstatus<?=$div?>" value="1" <? if(isset($_POST['tripstatus1'])){if($_POST['tripstatus1']==1){?>checked="checked"<? }}?>/>
	  
	  </td>
    </tr>
	
	<tr>
		<td class="tr_td tr_td_r" colspan="2"><a href="#div<?=$div?>" style="cursor:pointer;" onclick="addmore('<?=$div?>')"><font color="#000000">Add more</font></a>
	</tr>
	
  </table>
<div id="div<?=$div?>">
</div>


