<script>
function toggle_new(urls) {
 
    window.location = "index.php?route=CRM/TA_DA_Claim_form&action=update&tada_id="+urls;
	
	
	document.getElementById("showdata").style.display = "none";
	document.getElementById("Addnew").style.display = "none";
}    
</script>

<?php 
if($_GET['action']=='delete' && $_GET['tada_id']){
	$TaDa_id = $_GET['tada_id'];
	$rtn = DB_query("delete from crm_ta_da_claim_form where crm_ta_da_claim_form_main_id=".$TaDa_id,$db);
	if($rtn){
		DB_query("delete from crm_ta_da_claim_form_main where id=".$TaDa_id,$db);
		$s->pageLocation('index.php?route=CRM/TA_DA_Claim_form&modid='.$_REQUEST['modid'].'&frmid='.$_REQUEST['frmid'].'');
	}	
}
?>

<table align="center" width="100%;" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid;">
    
<tr>
	<th width="3%">S. No.</th>
    <th width="10%">Bill No.</th>
    <th width="7%">Bill Date</th>
    <th>Client</th>
    <th width="22%">Employee</th>
	<th width="7%">Grand Total</th>
	<th width="7%">Status</th>	
	<th width="3%" style="text-align:center;">Edit</th>
    <th width="3%" style="text-align:center;">Delete</th>
    <th width="3%" style="text-align:center;">Print</th>
</tr>
  <tbody id="dataTable" >
  <?php  $TADASQL="Select * from crm_ta_da_claim_form_main where prepared_by='".$_SESSION['UserID']."'   ";
		$TADADATA=DB_query($TADASQL,$db);
		$count=0;
                if(DB_num_rows($TADADATA)>0){
		while($TADARow=DB_fetch_array($TADADATA))
		{ $count++; ?>
  	<tr bgcolor="#fff">
<td><?php echo $count; ?></td>
<td><?php echo $TADARow['bill_no'] ?> </td>
<td><?php echo ConvertSQLDate($TADARow['bill_date']) ?></td>
<td style="white-space:nowrap"><?php echo $s->getField('clientmaster','id',$TADARow['client_name'] ,'c_name');  ?></td>
<td><?php echo $s->getField('empmaster','id',$TADARow['employee'] ,'emp_name');  ?></td>
<td><?php echo $TADARow['grand_total']; ?></td>
<td><?php if($TADARow['status']==0) { 
echo "Pending"; } else if($TADARow['status']==1) { echo "Approved"; } ?> 
</td>
 <?php 
  if($TADARow['status']==1) { ?>
<td style="text-align:center;"><img src="images/icon-edit.png" width="15" height="15" style="opacity: .6" title="Approved"></td>
<td style="text-align:center;"><img src="images/Icon_Delete.png" width="15" height="15" style="opacity: .6" title="Approved"></td>
<td style="text-align:center;"><a href="#" onclick="popup('bill_report.php?id=<?php echo $TADARow['id']; ?>',1200,600)"><img src="images/icon_print.jpg" width="18" height="18"></a></td>
<?php } else if($TADARow['status']==0 ){ 

?>

<td style="text-align:center;"><a href="#"><img src="images/icon-edit.png" width="15" height="15" onclick="toggle_new('<?php echo $TADARow['id'].$rurl;?>');" /></a></td>
<td style="text-align:center;"><a href="index.php?route=CRM/TA_DA_Claim_form&action=delete&tada_id=<?php echo $TADARow['id'].$rurl;?>" ><img src="images/Icon_Delete.png" width="15" height="15" title="Approved"></a></td>
<td style="text-align:center;"><a href="#" onclick="popup('bill_report.php?id=<?php echo $TADARow['id']; ?>',1200,600)"><img src="images/icon_print.jpg" width="18" height="18" ></a></td>
<?php } ?>
</tr>
                <?php }  } else {?>
<tr bgcolor="#fff">
    <td colspan="10">No Record Found.</td>
</tr>
<?php } ?>
</tbody>
 </table>