  <div style="padding:20px">
                  <table style="width:100%" class="TableHeading">
                      <tr>
                          <td  style="width:5%"></td>
                          <td  style="width:5%">D</td>
                          <td  style="width:5%">P</td>
                          <td  style="width:5%">C</td>
                          <td  style="width:5%">T</td>
                          
                          <td  style="width:50%; text-align: center; font-weight: bolder; padding: 5px">LINEUP</td>
                          
                          <td  style="width:5%">T</td>
                          <td  style="width:5%">C</td>
                          <td  style="width:5%">P</td>
                          <td  style="width:5%">D</td>
                          <td  style="width:5%"></td>
                      </tr>
                  </table>
                  <table style="width:100%" class="StartUpLineup">
                      <?php 
                      //Players
                      $n=1;
                      $AvailableCount =0;
                      $totalPlayers = 0;
                      
                      $Afican = 0;
                      $Colored = 0;
                      $White = 0;
                      $indian= 0;
                       if($this->squad["SID"]==$this->fixture["HomeTeam"]){
                              $totalPlayers = count($this->Players["HomeTeam"]);
                          }       
                        if($this->squad["SID"]==$this->fixture["AwayTeam"]){
                              $totalPlayers = count($this->Players["AwayTeam"]);
                          }        
                      while ($n<$this->squad["RugbyCode"]+1){
                          
                          
                          
                          
                          
                          
                           $playerHome = $this->Players["HomeTeam"][$n];
                           
                           $Subs = "";
                           if(count($playerHome["Subs"])>0){
                           foreach($playerHome["Subs"] as $sub){
                               if($sub["PlayerID"]==$playerHome["UserID"]){
                                   if($sub["Type"]=="PlayerOff"){
                                   $Subs ='<span style="color:red" class="fa fa-arrow-down"></span>';
                                   }
                                   if($sub["Type"]=="PlayerOn"){
                                   $Subs ='<span style="color:#89AD4D" class="fa fa-arrow-up"></span>';
                                   }
                               }
                           }
                           }
                           
                           
                           
                           $fullNaneHome = "Not Assigned";
                           if(isset($this->Players["HomeTeam"][$n])&& $playerHome["LastName"]!="Not Assigned"){
                               $lasName = (strlen($playerHome["LastName"])>14)? substr($playerHome["LastName"], 0,14)."...":$playerHome["LastName"];
                               $fullNaneHome ="<b>".$playerHome["INIT"].", ".$lasName."</b> (".$playerHome["JerseyNumber"].")".$playerHome["Cap"].$playerHome["Vice"] ;
                           }
                          
                           
                          // AwayTeam
                           $playerAway = $this->Players["AwayTeam"][$n];
                           $Subs2 = "";
                           if(count($playerAway["Subs"])>0){
                           foreach($playerAway["Subs"] as $sub2){
                               if($sub2["PlayerID"]==$playerAway["UserID"]){
                                   if($sub2["Type"]=="PlayerOff"){
                                   $Subs2 ='<span style="color:red" class="fa fa-arrow-down"></span>';
                                   }
                                   if($sub2["Type"]=="PlayerOn"){
                                   $Subs2 ='<span style="color:#89AD4D" class="fa fa-arrow-up"></span>';
                                   }
                               }
                           }
                           }
                           $fullNaneAway = "Not Assigned";
                           if(isset($this->Players["AwayTeam"][$n])&& $playerAway["LastName"]!="Not Assigned"){
                              $lasName = (strlen($playerAway["LastName"])>14)? substr($playerAway["LastName"], 0,14)."...":$playerAway["LastName"];
                               
                              $fullNaneAway =$playerAway["Cap"].$playerAway["Vice"]."(".$playerAway["JerseyNumber"].") <b>".$playerAway["INIT"].", ".$lasName."</b>" ;
                           }
                          ?>
                      <tr>
                          <td  style="width:5%"><?=$Subs?></td>
                          
                          <td  style="width:5%"><?=($playerHome["DropGoals"]>0)?$playerHome["DropGoals"]:""?></td>
                          <td  style="width:5%"><?=($playerHome["Penalties"]>0)?$playerHome["Penalties"]:""?></td>
                          <td  style="width:5%"><?=($playerHome["Conversions"]>0)?$playerHome["Conversions"]:""?></td>
                          <td  style="width:5%"><?=($playerHome["tries"]>0)?$playerHome["tries"]:""?></td>
                         <td  style="width:20%; text-align: right; border-right: 0px"><?=$fullNaneHome?></td>
                         <td  style="width:10%; text-align: center;padding: 5px; border: 0px ">
                              <div style="text-align: center; background:#476687; 
                                   width: 30px; height: 30px ; margin: auto ; line-height: 30px;color:#fff; font-weight: bold  " class=" cound-10"><?=$n?></div>
                          </td>
                           <td  style="width:20%; text-align: left; border-left: 0px"><?=$fullNaneAway?> </td>
                           <td  style="width:5%"><?=($playerAway["tries"]>0)?$playerAway["tries"]:""?></td> 
                        
                           <td  style="width:5%"><?=($playerAway["Conversions"]>0)?$playerAway["Conversions"]:""?></td>
                          <td  style="width:5%"><?=($playerAway["Penalties"]>0)?$playerAway["Penalties"]:""?></td>
                          <td  style="width:5%"><?=($playerAway["DropGoals"]>0)?$playerAway["DropGoals"]:""?></td>
                          
                           <td  style="width:5%"><?=$Subs2?></td>
                      </tr>
                      <?php $n++; } ?>
                  </table>
                  <div style=" height: 20px"></div>
                  <table style="width:100%" class="TableHeading"  style="margin-top:20px ">
                      <tr>
                          <td  style="width:25%"></td>
                          
                          <td  style="width:50%; text-align: center; font-weight: bolder; padding: 5px">REPLACEMENTS</td>
                          
                          <td  style="width:25%"></td>
                      </tr>
                  </table>
                  <table style="width:100%" class="StartUpLineup">
                      <?php 
                      $n=$this->squad["RugbyCode"]+1;
                      while ($n< $this->squad["NumbersOfPlayers"]+1){
                          
                          $playerHome = $this->Players["HomeTeam"][$n];
                          $Subs = "";
                           if(count($playerHome["Subs"])>0){
                           foreach($playerHome["Subs"] as $sub){
                               if($sub["PlayerID"]==$playerHome["UserID"]){
                                   if($sub["Type"]=="PlayerOff"){
                                   $Subs ='<span style="color:red" class="fa fa-arrow-down"></span>';
                                   }
                                   if($sub["Type"]=="PlayerOn"){
                                   $Subs ='<span style="color:#89AD4D" class="fa fa-arrow-up"></span>';
                                   }
                               }
                           }
                           }
                           $fullNaneHome = "Not Assigned";
                           if(isset($this->Players["HomeTeam"][$n])&& $playerHome["LastName"]!="Not Assigned"){
                               $lasName = (strlen($playerHome["LastName"])>14)? substr($playerHome["LastName"], 0,14)."...":$playerHome["LastName"];
                               $fullNaneHome ="<b>".$playerHome["INIT"].", ".$lasName."</b> (".$playerHome["JerseyNumber"].")".$playerHome["Cap"].$playerHome["Vice"] ;
                           }
                           // AwayTeam
                           $playerAway = $this->Players["AwayTeam"][$n];
                           $Subs2 = "";
                           if(count($playerAway["Subs"])>0){
                           foreach($playerAway["Subs"] as $sub2){
                               if($sub2["PlayerID"]==$playerAway["UserID"]){
                                   if($sub2["Type"]=="PlayerOff"){
                                   $Subs2 ='<span style="color:red" class="fa fa-arrow-down"></span>';
                                   }
                                   if($sub2["Type"]=="PlayerOn"){
                                   $Subs2 ='<span style="color:#89AD4D" class="fa fa-arrow-up"></span>';
                                   }
                               }
                           }
                           }
                           $fullNaneAway = "Not Assigned";
                           if(isset($this->Players["AwayTeam"][$n])&& $playerAway["LastName"]!="Not Assigned"){
                               $lasName = (strlen($playerAway["LastName"])>14)? substr($playerAway["LastName"], 0,14)."...":$playerAway["LastName"];
                               
                               $fullNaneAway =$playerAway["Cap"].$playerAway["Vice"]."(".$playerAway["JerseyNumber"].") <b>".$playerAway["INIT"].", ".$lasName."</b>" ;
                           }
                          ?>
                      <tr>
                          <td  style="width:5%"><?=$Subs?></td>
                          
                          
                          
                          <td  style="width:5%"><?=($playerHome["DropGoals"]>0)?$playerHome["DropGoals"]:""?></td>
                          <td  style="width:5%"><?=($playerHome["Penalties"]>0)?$playerHome["Penalties"]:""?></td>
                          <td  style="width:5%"><?=($playerHome["Conversions"]>0)?$playerHome["Conversions"]:""?></td>
                          <td  style="width:5%"><?=($playerHome["tries"]>0)?$playerHome["tries"]:""?></td>
                         <td  style="width:20%; text-align: right; border-right: 0px"><?=$fullNaneHome?></td>
                         <td  style="width:10%; text-align: center;padding: 5px; border: 0px ">
                              <div style="text-align: center; background:#476687; 
                                   width: 30px; height: 30px ; margin: auto ; line-height: 30px;color:#fff; font-weight: bold  " class=" cound-10"><?=$n?></div>
                          </td>
                           <td  style="width:20%; text-align: left; border-left: 0px"><?=$fullNaneAway?> </td>
                        <td  style="width:5%"><?=($playerAway["tries"]>0)?$playerAway["tries"]:""?></td> 
                           <td  style="width:5%"><?=($playerAway["Conversions"]>0)?$playerAway["Conversions"]:""?></td>
                          <td  style="width:5%"><?=($playerAway["Penalties"]>0)?$playerAway["Penalties"]:""?></td>
                          <td  style="width:5%"><?=($playerAway["DropGoals"]>0)?$playerAway["DropGoals"]:""?></td>
                          
                           <td  style="width:5%"><?=$Subs2?></td>
                      </tr>
                      <?php $n++; } ?>
                  </table>
              </div>
<?php

$african =$this->Ethnicity["African"];
$white =$this->Ethnicity["White"];
$coloured =$this->Ethnicity["Coloured"];
$indian =$this->Ethnicity["Indian"];
$all = $african+$white+$coloured+$indian;
			@$tranform = floor( ( $african + $coloured ) / $all * 100 );
?>
<script>
    
$(function(){
    $("#teamSheetBtn").show();
    
    
     var african =<?=$african?>;
    var coloured =<?=$coloured?>;
    var indian =<?=$indian?>;
    var white =<?=$white?>;
    var undif =0;
    var totalPlayers = <?=$all?>;
    
    var perce =<?=$tranform ?>;
    
    
	   if(totalPlayers>0){
	   	$("#Total_per").text(perce+"%");
	   }else{
	   	$("#Total_per").text("0%");
	   }
	   
       $("#African_per").text(african);
       $("#Coloured_per").text(coloured);
       $("#Indian_per").text(indian);
       $("#White_per").text(white);
       $("#Undefined_per").text(undif);
});
</script>