<?php   
$pcode= $rolepid;
function CategoryShow(  $PcateID, $dashVal)
{
	global $db;
	$dashVal = $dashVal . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	$s=new db_query();
	$rurl="&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid'];
	
	$sqlCate = "select * from accountgroupmaster  where  MainGroupId  = '".$PcateID."' ";
	
	$rsCate  = DB_query($sqlCate,$db);	
	if(DB_num_rows($rsCate)>0)
	{
	while($rowCate = DB_fetch_array($rsCate))
	{
	echo '<tr bgcolor="#CCCCCC"><td><b>'.$dashVal.'&nbsp;';
	echo  '</b>'.$dashVal.'';
	$k=1;
	echo $dashVal.'&nbsp; 
	';
	echo "<b>".$rowCate['GroupName']."</b>";
	echo ' </td></tr>';
	$ledgersSql=DB_query("Select * from accountledger where UnderGroup=".$rowCate['GroupId']."",$db);
	while($ledgersRow=DB_fetch_array($ledgersSql)){
	echo '<tr bgcolor="#FFFFFF"><td>';
	echo $dashVal .$dashVal.$dashVal.$dashVal."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$ledgersRow['AccountName'];
	echo '</td></tr>'; }
	CategoryShow( $rowCate['GroupId'], $dashVal);
	}
	} 
}
$dashVal = "&nbsp;&nbsp;&nbsp;";		
?>
<link href="../../compaint/Setup/css/pagnation.css" rel="stylesheet" type="text/css">
<a href="Print_ListOfAcc.php" target="_blank"><input type="button" value="Print" /></a>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>

<table width="70%" border="0" cellspacing="0" cellpadding="0" align="left">
   <tr>
    <td colspan="2"><h2>List Of Accounts </h2></td>
	
   </tr>
<tr><td colspan="3" >
<form action="" method="post" >
		<table width="100%" border="1" cellspacing="0" cellpadding="0">
 		<tr>
		<td colspan="2"> 
		
 		<?php 
	 
			$dashVal = "&nbsp;&nbsp;&nbsp;";
			?>
			<table width="100%" border="0" cellspacing="2" cellpadding="5">
 			<?php 
			
			 $k=1;
			
			//  echo "select * from accountgroupmaster where MainGroupId=0  ";
			 $query_comprole=DB_query("select * from accountgroupmaster where MainGroupId=0 and Type='G' ",$db);
 			  while($row_comprole=DB_fetch_array($query_comprole))
			  {
			  	 echo '<tr style="background:#999999"><td style="border-bottom:#333333 solid 1px"><b><font face="Arial, Helvetica, sans-serif"></font> &nbsp;&nbsp; ';
					  		echo ' &nbsp;&nbsp; &nbsp;&nbsp;'.$k++."  )  ".$row_comprole['GroupName'].'<br>';
					  
					 
				      
				 echo '  </b></td></tr>';
  			     $getDirectLedgers=DB_query("Select * from accountledger where UnderGroup=".$row_comprole['GroupId']."",$db);
				 while($directLedgersRow=DB_fetch_array($getDirectLedgers))
				 {
				 	echo '<tr style="background:#FFFFFF"><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$directLedgersRow['AccountName'].'</td></tr>';
				 }
				 CategoryShow(   $row_comprole['GroupId'], $dashVal);
				
 			  }	
 		 ?>
		 
		 </table>
	 
		 	 </td>
		</tr>
		</table>
</form>
</td>
</tr>
</table>
 </td>
</table>
