<?php 
 if($_REQUEST['action']=='Delete')
 {
   $sql_delete="delete from tpl_rate_deprications where id='".$_REQUEST['mid']."'";
   $result_delete=DB_query($sql_delete,$db);

   $sql_delete_details="delete from tpl_rate_deprications_details where parent_id='".$_REQUEST['mid']."'";
   $result_delete_details=DB_query($sql_delete_details,$db);
 }
?>

<form action="" name=""> 
  <div class="row1">
    <h1><input type="checkbox" checked="checked" disabled="true" /> As Per Company Act</h1>
  </div>
  <?php
  $i=1;
  $sql1=DB_query("SELECT * FROM tpl_rate_deprications where act='Company Act'",$db);
  //while($row=DB_fetch_array($sql1))
  //{
  ?>

<div id="companyact">
<table width="100%" cellspacing="0" cellpadding="3" border="0" class="thborder">
  <tr>
    <th width="10%">Schedule</th>
    <!--<th width="15%" valign="top" align="left"><?php echo $row['schedule']; ?></th> -->
    <th width="10%">Section</th>
    <!-- <th width="15%" valign="top" align="left"><?php echo $row['section']; ?></th> -->
    <th width="10%">Effective From </th>
    <!-- <th width="15%" valign="top" align="left"><?php echo ConvertSQLDate($row['effective_from']); ?></th> -->
    <th width="10%">Effective To</th>
    <!-- <th valign="top" align="left"><?php echo ConvertSQLDate($row['effective_to']); ?></th> -->
    <th width="100">Code</th>
    <th>Nature &amp; Asset</th>
    <th colspan="2" style="text-align:center;">Action</th>
  </tr>
  
  <!--<tr>
    <td style="padding:0px;" colspan="8">
	<table width="100%" cellspacing="0" cellpadding="3" border="0" style="border:#666666 1px solid;"> 
  <tbody>   
    <td style="text-align:center;" colspan="2">Single Shift </td>
    <td style="text-align:center;" colspan="2">Double Shift </td>
    <td style="text-align:center;" colspan="2">Triple Shift </td>    
    </tr>     
  <tr>
    <td bgcolor="#CCC">&nbsp;</td>
    <td bgcolor="#CCC">&nbsp;</td>
    <td bgcolor="#CCC">WDV</td>
    <td bgcolor="#CCC">SLM</td>
    <td bgcolor="#CCC">WDV</td>
    <td bgcolor="#CCC">SLM</td>
    <td bgcolor="#CCC">WDV</td>
    <td bgcolor="#CCC">SLM</td>   
    <td bgcolor="#CCC">&nbsp;</td>   
  </tr> -->
  <?php // } ?>
 
  <?php 
  while($row=DB_fetch_array($sql1))
  {
    $q1=DB_query("select * from tpl_rate_deprications_details where parent_id='".$row['id']."'",$db);
   //echo "select * from tpl_rate_deprications_details where parent_id='".$row['id']."'";
  ?>
  <tr>
    <td><?php echo $row['schedule'];?></td>
    <td><?php echo $row['section'];?></td>
    <td><?php echo date('d/m/Y',strtotime($row['effective_from']));?></td>
    <td><?php echo date('d/m/Y',strtotime($row['effective_to']));?></td>
    <td colspan="2" style="padding:0;" valign="top">
     <div id="amc-tab">
     <table width="100%" border="0" cellspacing="0" cellpadding="3" style="border-collapse:collapse;">
      <?php while ($row2=DB_fetch_array($q1))
       {
      ?>    
      <tr>
          <td width="100"><?php echo $row2['code'];?></td>
          <td><?php echo $row2['asset_name'];?></td>    
      </tr>
  <?php }?>
  </table>
  </div>
  </td>
  <td width="4%" style="text-align:center;"><a href="index.php?route=ToolPlants/maintenance/act_edit&modid=<?php echo $_REQUEST['modid']; ?>&frmid=<?php echo $_REQUEST['frmid']; ?>&mid=<?php echo $row['id']; ?>&subid=<?php echo $r['id'];?>"><img src="images/icon-edit.png" width="15" title="Edit" /></a></td>
  <td width="4%" style="text-align:center;"><a href="index.php?route=ToolPlants/maintenance/act_index&modid=<?php echo $_REQUEST['modid']; ?>&frmid=<?php echo $_REQUEST['frmid']; ?>&mid=<?php echo $row['id']; ?>&subid=<?php echo $r['id'];?>&action=<?php echo "Delete"; ?>"><img src="images/Icon_Delete.png" width="15" title="Delete" /></a></td>
 <?php } ?>  
</tr>
</table>
</div>
<?php $i++; //} ?>
 
</form>