<?php 
if($_REQUEST['action']=='del')
{
  $sql_delete="delete from account_cost_category where id='".$_REQUEST['id']."'";
  $result_category=DB_query($sql_delete,$db);
  //$s->pageLocation("index.php?route=cost_category_index");
}

?>
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1>Cost Category Master</h1>
 <p align="left"><a href="index.php?route=cost_category_master&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>"><input type='button' value='Add New' class="search" /></a></p>
<table width="100%" border="1" cellspacing="0" cellpadding="3" style="border:#808080 1px solid; border-collapse:collapse;">
   <tr>
   <th width="5%">S.No.</th>
   <th width="15%">Code</th>
   <th>Category Name</th>
   <th width="15%">Parent Category</th>
   <th width="6%" style="text-align:center;">Edit</th>
   <th width="6%" style="text-align:center;">Delete</th>
   </tr>
   <?php 
      // LIMIT $startpoint,$perpage
   $GetRecord = "Select * from account_cost_category";
   $ResultData = DB_query($GetRecord,$db);
   $i=1;
   if(DB_num_rows($ResultData)==0)
   echo "<td>--No Record--</td>";
   
   while($RowData = DB_fetch_array($ResultData))
   {
    
   ?>
 <tr bgcolor="#FFFFFF">
 <td><?php echo $i; ?></td>
 <td><?php echo $RowData['code'];?></td>
 <td><?php echo $RowData['category_name'];?></td>
 <td><?php     
      $parent= $s->getField('account_cost_category','id',$RowData['parent_id'],'category_name');   
    if($parent!='')
    echo $parent;
    else{
    echo "Root";
    }
     ?></td>   
   <td style="text-align:center;"><a href="index.php?route=cost_category_edit&id=<?php echo $RowData['id'].$url; ?>&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=edit"><img src="images/icon-edit.png" width="15" height="15" title="Edit Document" /></a></td>
  <td style="text-align:center;"><a href="index.php?route=cost_category_index&action=del&id=<?php echo $RowData['id']; ?>&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>" onclick="return confirm('Do You Want To Delete This Record')"><img src="images/Icon_Delete.png" width="15" height="15" title="Delete Document" /></a></td> 
   </tr>
 
  <?php $i++;}  ?> 
 
</table>
</div>
</div>