<?
	session_start();
	$reportid = $_GET['reid'];
	//echo "{$groupid}";
	include "../../Connections/connect_mysql.php";
	if($reportid){
		$sqle=" select * from report_tb where repID=" . $reportid . "; ";
		$resulte = mysql_query($sqle) or die(mysql_error());
		$recorde=mysql_fetch_array($resulte);
		$repName = $recorde['repName'];
	}
?>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script>
$(document).ready(function() {
	$('#reportgtb').DataTable({
		"dom": '', //กำหนดส่วนหัวเอง
		"scrollY": '50vh', //"200px",
  		"scrollCollapse": true,
  		"paging": false
	});

});
</script>
</head>

<body>
	<div class="row">
    	<div id="rc1" class="col-md-12">
			<div id="a1" style="display:none;"><? echo "{$reportid}";  ?></div><? if($reportid){ echo " {$repName}"; } ?>
    	</div>
    </div>
    <div class="row">
    	<div id="rc2" class="col-md-12">
        	<div id="a2">
           <table id="reportgtb" class="display cell-border compact row-border table table-striped table-bordered" cellspacing="0" width="100%">
          <thead>
              <tr>
                  <th>กลุ่ม2</th>
                  <th align="center">ลบ</th>
              </tr>
          </thead>

          <tbody>
         <?
			if($reportid){
			  $sqlet=" select * from mainreport_tb where ggrpRepID=" . $reportid . "; ";
			  $resultet = mysql_query($sqlet) or die(mysql_error());
			  while($recordet=mysql_fetch_array($resultet)){
				  $groprpID = $recordet['grpID'];
				  $groprpRepID = $recordet['ggrpRepID'];
				  $groprpGTeamID = $recordet['ggrpTeamID'];

				  $sqlug = " select * from grouprp_tb where rpID={$groprpGTeamID}";
				  $resultug = mysql_query($sqlug) or die(mysql_error());
				  $recordug=mysql_fetch_array($resultug);
				  $GroupName2 = $recordug['rpName'];
		 ?>

          	<tr>
                <td><?=$GroupName2?></td>
                <td align="center"><button type="button" class="btn btn-danger" onClick="javascript:delreportpGroup(<?=$groprpID?>);"><i class="fa fa-times"></i> ลบ</button></td>
            </tr>
         <?
			  }
			}//while
		 ?>
          </tbody>
     </table>


            </div>
        </div>
    </div>
</body>
</html>
<?
	mysql_close($c);
?>
