<?php 
$url_cancel= "index.php?route=ToolPlants/maintenance/assets_maintenance_bill_posting_index".$rurl;
$url_add= "index.php?route=ToolPlants/maintenance/assets_maintenance_bill_posting".$rurl;

//echo $rurl;
?>

<?php
if(isset($_REQUEST['save']))
{	
	
	//print_r($_REQUEST); exit;
		$date=FormatDateForSQL($_REQUEST['tpl_maintenace_billposting']['voucher_date']);		
		$_REQUEST['tpl_maintenace_billposting']['voucher_date']=$date;			
		extract($_REQUEST['tpl_maintenace_billposting']);
		if($s->RecordInsert('tpl_maintenace_billposting',$_REQUEST['tpl_maintenace_billposting']))
		{				
				//print_r($_REQUEST); exit;
				$_SESSION['success_msg']="Saved Successfully";
				echo "<script>location.href='$url_cancel'</script>";
		 }
	
}
if(isset($_REQUEST['action']) && isset($_REQUEST['mid']))
{
	if($_REQUEST['action']=='edit' && !empty($_REQUEST['mid']))
	{	
		$recEdit=DB_fetch_array($s->GetRecordById('tpl_maintenace_billposting','id='.$_REQUEST['mid']));
		extract($recEdit);		
	}
}
if(isset($_REQUEST['update']))
{
			$date=FormatDateForSQL($_REQUEST['tpl_maintenace_billposting']['voucher_date']);
			$_REQUEST['tpl_maintenace_billposting']['voucher_date']=$date;
		extract($_REQUEST['tpl_maintenace_billposting']);
		
		if($s->RecordEdit('tpl_maintenace_billposting',$_REQUEST['tpl_maintenace_billposting'],"id=".$_REQUEST['tpl_maintenace_billposting']['id']))
		{		
		//print_r($_REQUEST);exit;
			unset($_REQUEST['tpl_maintenace_billposting']);
			$_SESSION['success_msg']="Saved Successfully";
			echo "<script>location.href='$url_cancel'</script>";
	}
	
}

?><head>

</head>

<form name="" id="" method="POST">
<div align="center">
<fieldset style="width:800px"><legend><strong>Fixed Asset Maitenance Bill Posting</strong></legend>	
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr>
    <td style="padding:5px"><!-- General details -->
      <table width="100%" cellspacing="4" cellpadding="4" border="0" style="color:#ffffff>
        <tr>
          <td style="padding:5px; text-align:center;" colspan="4" align="right"></td>
        </tr>
        <tr>
          <td style="text-align:center;" colspan="4"><b></b></td>
        </tr>
          <input type="hidden" value="<?php if($_REQUEST['action']=='edit') echo $id; ?>" name="tpl_maintenace_billposting[id]">
          <tr style="height:25px">
          <th> Voucher Date </th>
          <td width="30%" align="left" >
          	<select name="tpl_maintenace_billposting[voucher_date]" id="voucher_date" style="width:100%;">
			<option value="">Select</option>
			</select>
          </td>
         
         
        </tr>
      
        <tr>
		<input type="hidden" name="tpl_maintenace_billposting[created]" value="<?php echo date('Y-m-d')?>">
		   <input type="hidden" name="tpl_maintenace_billposting[created_by]" value="<?php echo $_SESSION['UserID']?>">

          <td style="padding:5px; text-align:center;" colspan="4" align="right">
		  <input type="submit" value="Save" name="<?php if($_REQUEST['action']=='edit') echo 'update'; else echo 'save'; ?>" class="add">    <a href="<?php echo $url_cancel;?>"><input type="button" value="Cancel" name="button" class="add"></a>
</td>
        </tr>
      </table></td>
  
  </tr>
</table></fieldset>
</div></form>

<div align="center">
<div style="overflow:auto; width:800px; height:150px">
<table width="100%" border="0" align="center">
<tr>
<td bgcolor="#c6c6c6" ><table width="100%" border="0" cellspacing="1" cellpadding="5" align="center">
  <tr>
  	<th><strong>Select</strong></th>
  	<th><strong>AMC Vendor</strong></th>
    <th><strong>Bill No.</strong></th>
    <th><strong>Bill Date</strong></th>
   	<th><strong>Project Name</strong></th>
   	<th><strong>Net Amount</strong></th>
   	<th><strong>Additional Amount</strong></th>
   	<th><strong>Deduction Amount</strong></th>
     </tr>
<tr bgcolor="#ffffff">
 </tr>
 </table>
</td>
</tr>
</table>
</div>
</div>
