<?php
    if($_REQUEST['action']=='delete' && $_REQUEST[Id]!='')
    {
      DB_query("delete from tbl_prementive_sub_details where tbl_prementive_id='".$_REQUEST['Id']."'",$db);
      DB_query("delete from tbl_prementive_details where tbl_prementive_id='".$_REQUEST['Id']."'",$db);
      DB_query("delete from tbl_prementive where id='".$_REQUEST['Id']."'",$db);
    }
 ?>
<div style="display:none" id="div_id"></div>
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">  
<h1>Preventive Schedule</h1>
<p align="left"><a href="index.php?route=ToolPlants/fixed_assets/sub_asset_master&modid=<?php echo $_REQUEST['modid']; ?>&frmid=<?php echo $_REQUEST['frmid']; ?>"><input type="button" name="Add Title" value="Add New" class="search"></a></p>	
<form action="" method="post">
<table width="100%" border="0" cellspacing="3" cellpadding="3" class="thborder">
  <tr>  
    <th width="4%" rowspan="2">S. No.</th> 		
    <th width="20%" rowspan="2">Branch</th>
    <th width="20%" rowspan="2">Group</th>
    <th width="15%" rowspan="2">Asset Code</th>
    <th rowspan="2">Asset Name</th>   
    <th colspan="2" style="text-align:center;">Action</th>    
</tr>
<tr>
    <th width="5%" class="text-center">Edit</th>
    <th width="5%" class="text-center">Delete</th>
</tr>
<?php 
$i=1;
$sql=DB_query("select * from tbl_prementive where companyId='".$_SESSION['ACGCompanyId']."'",$db);
while($row=DB_fetch_array($sql))
{  
?>
<tr>  
    <td ><?php echo $i; ?></td>     
    <td ><?php echo $s->getField('locations','loccode',$row['site'],'loccode'); ?></td>
    <td ><?php echo $s->getField('machine_group_master','id',$row['asset_group'],'machine_gp_location'); ?></td>
    <td ><?php echo $s->getField('machine_center','id',$row['asset_id'],'code'); ?></td> 
    <td ><?php echo $s->getField('machine_center','id',$row['asset_id'],'name'); ?></td>  
    <td style="text-align:center;"><a href="index.php?route=ToolPlants/fixed_assets/sub_asset_master_edit&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=delete&Id=<?php echo $row['id'];?>"><img src="images/icon-edit.png" height="15" width="15" title="Edit" /></a></td>
    <td style="text-align:center;"><a href="index.php?route=ToolPlants/fixed_assets/sub_asset_master_index&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=delete&Id=<?php echo $row['id'];?>" onclick="return confirm('Are you sure you want to delete?')"><img src="images/Icon_Delete.png" height="15" width="15" title="Delete" /></a></td>
</tr>
<?php $i++;} ?>
</table>
</form>
</div></div>

<style type="text/css" >
.button{ background-color:#666666;
color: #FFFFFF;
height:25px;
margin:0px 5px 0px 5px;
border:1px solid #359CA2;
}
.link{ color:#9900CC; font-family:"Comic Sans MS"; letter-spacing:1px
}
</style>

