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

//echo $url_cancel;
?>

<?php
if(isset($_REQUEST['save']))
{	
	
	//print_r($_REQUEST); exit;
		$date=FormatDateForSQL($_REQUEST['tpl_asset_maintenace_bill_payment']['vendor_date']);
		
			$_REQUEST['tpl_asset_maintenace_bill_payment']['vendor_date']=$date;
			
		extract($_REQUEST['tpl_asset_maintenace_bill_payment']);
		if($s->RecordInsert('tpl_asset_maintenace_bill_payment',$_REQUEST['tpl_asset_maintenace_bill_payment']))
		{	
			
				//print_r($_REQUEST); exit;
				$_SESSION['success_msg']="Saved Successfully";
				echo "<script>location.href='$url_cancel'</script>";			

		 }
	
}
if(isset($_REQUEST['action']) && isset($_REQUEST['isid']))
{
	if($_REQUEST['action']=='edit' && !empty($_REQUEST['isid']))
	{	
		$recEdit=DB_fetch_array($s->GetRecordById('tpl_asset_maintenace_bill_payment','id='.$_REQUEST['isid']));
		extract($recEdit);
		
	}
}
if(isset($_REQUEST['update']))
{
			$date=FormatDateForSQL($_REQUEST['tpl_asset_maintenace_bill_payment']['vendor_date']);
		
			$_REQUEST['tpl_asset_maintenace_bill_payment']['vendor_date']=$date;
		extract($_REQUEST['tpl_asset_maintenace_bill_payment']);
		
		if($s->RecordEdit('tpl_asset_maintenace_bill_payment',$_REQUEST['tpl_asset_maintenace_bill_payment'],"id=".$_REQUEST['tpl_asset_maintenace_bill_payment']['id']))
		{
		
		//print_r($_REQUEST);exit;
			unset($_REQUEST['tpl_asset_maintenace_bill_payment']);
			$_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>AMC Bill Payment</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_asset_maintenace_bill[id]">
         <tr style="height:25px">
          <td >
          	<table width="100%" border="0" cellspacing="1" cellpadding="2" align="left">
                           <tr>
                             <td style="text-align:center;"><strong>Bill</strong></td>
                             <td align="center" style="text-align:center;">
                       <input type="radio" name="tpl_asset_maintenace_bill_payment[bill_type]"  value="B" <?php if($bill_type=='B') { echo "checked=checked"; }?>/></td> 
                              <td style="text-align:center;"><strong>Maintenance Bill</strong></td>
                             <td align="center" style="text-align:center;"><input type="radio" name="tpl_asset_maintenace_bill_payment[bill_type]"  value="M" <?php if($bill_type=='M') { echo "checked=checked"; }?>/></td>
                           </tr>
                         </table></td>         
       </tr>
        <tr style="height:25px">
           <td >
          	<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
                           <tr>
                             <td style="text-align:center;"><strong>Cash</strong></td>
                             <td align="center" style="text-align:center;"><input type="radio" name="tpl_asset_maintenace_bill_payment[payment_mode]"  value="Cash" <?php if($maintenance_type=='Ca') { echo "checked=checked"; }?>/></td> 
                         
                              <td style="text-align:center;"><strong>Cheque</strong></td>
                             <td align="center" style="text-align:center;"><input type="radio" name="tpl_asset_maintenace_bill_payment[payment_mode]"  value="Cheque" <?php if($payment_mode=='Cheque') { echo "checked=checked"; }?>/></td>
                           </tr>
                         </table></td>         
       </tr>
         <tr style="height:25px">
          <th> Cash/Bank </th>
          <td width="30%" align="left" >
          	<select name="tpl_asset_maintenace_bill_payment[bank]" id="bank" style="width:100%;">
			<option value="">Select</option>
		  </select>
         </td>
         
          <th>Vendor Date</th>
          <td width="30%" align="left"  >
          	<input type="text" value="<?php if($vendor_date!='') echo ConvertSqlDate($vendor_date);?>"  style="width:98%;"   name="tpl_asset_maintenace_bill_payment[vendor_date]" id="vendor_date" class="datepicker">
    	  </td>
       </tr>
       
      
        <tr>
		<input type="hidden" name="tpl_asset_maintenace_bill_payment[created]" value="<?php echo date('Y-m-d')?>">
		   <input type="hidden" name="tpl_asset_maintenace_bill_payment[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>Vendor</strong></th>
    <th><strong>AMC Ref No</strong></th>
    <th><strong>Bill Date</strong></th>
   	<th><strong>AMC Amount</strong></th>
   	<th><strong>Bal Inv Amt</strong></th>
   	   
  </tr>
<tr bgcolor="#ffffff">
 </tr>
 </table>
</td>
</tr>
</table>
</div>
</div>
