function ptg8_formasi($q,$col,$q1,$col1,$q2,$col2,$q3,$col3,$q4,$col4,$lcol,$lq,$ncol,$nq,$lc,$lv) {
global $db,$db1,$ar;
//print_r($ar);
?>
<h3 class="fw-900">Formasi Pendaftar Petugas Haji 2027</h3>
<table class="table table-bordered table-hover" id="dataTable_12d" cellspacing="0">
<thead>
<tr class="small">
<th>jp</th>
<th>jt</th>
<th>daftar</th>
<th>submit</th>
<th>% submit</th>
<th>stp1</th>
<th>% stp1</th>
<th>stp21</th>
<th>stp2</th>
<th>% stp2</th>
<th>stp22</th>
<th>% stp22</th>
<th>stp3</th>
<th>stp34</th>
<th>stp35</th>
<th>stp36</th>
<th>stp4</th>
<th>stp5</th>
<th>tes</th>
</tr>
</thead>
<tbody>
<?php
$sql = "select * from ref_jenis_tugas where id>0";
if($col!='') {
$sql .= " and `".$col."`='".$q."' ";
}
if($col1!='') {
$sql .= " and `".$col1."`='".$q1."' ";
}
if($col2!='') {
$sql .= " and `".$col2."`='".$q2."' ";
}
if($col3!='') {
$sql .= " and `".$col3."`='".$q3."' ";
}
if($col4!='') {
$sql .= " and `".$col4."`='".$q4."' ";
}
if($lcol!='') {
$sql .= " and `".$lcol."` like '".$lq."%' ";
}
if($ncol!='') {
$sql .= " and `".$ncol."` like '%".$nq."%' ";
}
if($lc!='') {
$sql .= " and `".$lc."` like '%".$nq."%' ";
}
//$sql2=$sql;
if($lc!='') {
$sql .= " and `".$lc."`<='".$lv."' ";
//$sql2 .= " and `".$lc."`='".$lv."' ";
}
//$sql .= " group by jenis_petugas,jenis_tugas ";
$res = mysqli_query($db, $sql);
//$res2 = mysqli_query($db, $sql2);
//echo $sql;
$j['p8_daf']=$j['p8_stp0']=$j['p8_stp1']=$j['p8_stp2']=$j['p8_stp21']=$j['p8_stp3']=$j['p8_stp35']=$j['p8_stp5']=$j['submit']=$j['p8_stp4']=0;
$j['p8_stp22']=$j['p8_stp34']=0;
while($rw = mysqli_fetch_assoc($res)) {
$j['p8_daf']=$j['p8_daf']+$rw['p8_daf'];
$j['p8_stp0']=$j['p8_stp0']+$rw['p8_stp0'];
$j['p8_stp1']=$j['p8_stp1']+$rw['p8_stp1'];
$j['p8_stp2']=$j['p8_stp2']+$rw['p8_stp2'];
$j['p8_stp21']=$j['p8_stp21']+$rw['p8_stp21'];
$j['p8_stp22']=$j['p8_stp22']+$rw['p8_stp22'];
$j['p8_stp3']=$j['p8_stp3']+$rw['p8_stp3'];
$j['p8_stp34']=$j['p8_stp34']+$rw['p8_stp34'];
$j['p8_stp35']=$j['p8_stp35']+$rw['p8_stp35'];
$j['p8_stp36']=$j['p8_stp36']+$rw['p8_stp36'];
$j['p8_stp4']=$j['p8_stp4']+$rw['p8_stp4'];
$j['p8_stp5']=$j['p8_stp5']+$rw['p8_stp5'];
$rw['submit']=$rw['p8_daf']-$rw['p8_stp0'];
$j['submit']=$j['submit']+$rw['submit'];
$p['submit']=$rw['submit']/$rw['p8_daf']*100;
$p['p8_stp0']=$rw['p8_stp0']/$rw['p8_daf']*100;
$p['p8_stp1']=$rw['p8_stp1']/$rw['p8_daf']*100;
$p['p8_stp2']=$rw['p8_stp2']/$rw['submit']*100;
$p['p8_stp22']=$rw['p8_stp22']/$rw['submit']*100;
?>
<tr class="small">
<td><a href="?op=ptg8&op2=formasi&col=jenis_petugas&q=<?=$rw['jenis_petugas'];?>"><?=$rw['jenis_petugas'];?> <?=$ar['jenis_petugas'][$rw['jenis_petugas']];?></a></td>
<td><a href="?op=ptg8&op2=list&col=jenis_tugas&q=<?=$rw['id'];?>"><?=$rw['id'];?> <?=$rw['nama_jenis_tugas'];?></a></td>
<td class="text-right"><?=ang2($rw['p8_daf']);?></td>
<td class="text-right"><?=ang2($rw['submit']);?></td>
<td class="text-right"><?=dec1($p['submit']);?>%</td>
<td class="text-right"><a href="?op=ptg8&op2=list&col=jenis_tugas&q=<?=$rw['id'];?>&col1=status&q1=stp-1"><?=ang2($rw['p8_stp1']);?></a></td>
<td class="text-right"><?=dec1($p['p8_stp1']);?>%</td>
<td class="text-right"><a href="?op=ptg8&op2=list&col=jenis_tugas&q=<?=$rw['id'];?>&col1=status&q1=stp-2.1"><?=ang2($rw['p8_stp21']);?></a></td>
<td class="text-right"><a href="?op=ptg8&op2=list&col=jenis_tugas&q=<?=$rw['id'];?>&col1=status&q1=stp-2"><?=ang2($rw['p8_stp2']);?></a></td>
<td class="text-right"><?=dec1($p['p8_stp2']);?>%</td>
<td class="text-right"><a href="?op=ptg8&op2=list&col=jenis_tugas&q=<?=$rw['id'];?>&col1=status&q1=stp-2.2"><?=ang2($rw['p8_stp22']);?></a></td>
<td class="text-right"><?=dec1($p['p8_stp22']);?>%</td>
<td class="text-right"><a href="?op=ptg8&op2=list&col=jenis_tugas&q=<?=$rw['id'];?>&col1=status&q1=stp-3"><?=ang2($rw['p8_stp3']);?></a></td>
<td class="text-right"><a href="?op=ptg8&op2=view&col=jenis_tugas&q=<?=$rw['id'];?>&col1=status&q1=stp-3.4&sortby=tgl_lahir&sort=desc" target="_blank"><?=ang2($rw['p8_stp34']);?></a></td>
<td class="text-right"><a href="?op=ptg8&op2=view&col=jenis_tugas&q=<?=$rw['id'];?>&col1=status&q1=stp-3.5&sortby=tgl_lahir&sort=desc" target="_blank"><?=ang2($rw['p8_stp35']);?></a></td>
<td class="text-right"><a href="?op=ptg8&op2=list&col=jenis_tugas&q=<?=$rw['id'];?>&col1=status&q1=stp-3.6"><?=ang2($rw['p8_stp36']);?></a></td>
<td class="text-right"><a href="?op=ptg8&op2=list&col=jenis_tugas&q=<?=$rw['id'];?>&col1=status&q1=stp-4"><?=ang2($rw['p8_stp4']);?></a></td>
<td class="text-right"><?=ang2($rw['p8_stp5']);?></td>
<td><?=$rw['is_test'];?></td>
</tr>
<?php
}
$jp['submit']=$j['submit']/$j['p8_daf']*100;
$jp['p8_stp0']=$j['p8_stp0']/$j['p8_daf']*100;
$jp['p8_stp1']=$j['p8_stp1']/$j['p8_daf']*100;
$jp['p8_stp2']=$j['p8_stp2']/$j['submit']*100;
$jp['p8_stp22']=$j['p8_stp22']/$j['submit']*100;
?>
</tbody>
<tfoot>
<th colspan="2"></th>
<th class="text-right"><?=ang2($j['p8_daf']);?></th>
<th class="text-right"><?=ang2($j['submit']);?></th>
<th class="text-right"><?=dec1($jp['submit']);?>%</th>
<th class="text-right"><?=ang2($j['p8_stp1']);?></th>
<th class="text-right"><?=dec1($jp['p8_stp1']);?>%</th>
<th class="text-right"><?=ang2($j['p8_stp21']);?></th>
<th class="text-right"><?=ang2($j['p8_stp2']);?></th>
<th class="text-right"><?=dec1($jp['p8_stp2']);?>%</th>
<th class="text-right"><?=ang2($j['p8_stp22']);?></th>
<th class="text-right"><?=dec1($jp['p8_stp22']);?>%</th>
<th class="text-right"><?=ang2($j['p8_stp3']);?></th>
<th class="text-right"><?=ang2($j['p8_stp34']);?></th>
<th class="text-right"><?=ang2($j['p8_stp35']);?></th>
<th class="text-right"><?=ang2($j['p8_stp36']);?></th>
<th class="text-right"><?=ang2($j['p8_stp4']);?></th>
<th class="text-right"><?=ang2($j['p8_stp5']);?></th>
<th></th>
</tfoot>
</table><?=$sql;?><br>
<?php
}