crm-summit/app/Views/dashboard_tss_ivd_tengah.php
2024-04-24 13:20:52 +07:00

115 lines
3.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$irTotal = 0;
$mnTotal = 0;
$crTotal = 0;
$prTotal = 0;
$spTotal = 0;
$trTotal = 0;
$rfTotal = 0;
$sumTotal = 0;
?>
<div class="card">
<div class="card-header">
<h4 class='text-center fw-bold mt-1'>ACTIVITIES BY TSO THIS MONTH</h4>
</div>
<div class="card-body">
<div class='row'>
<div class="col-12">
<table class='table small table-bordered'>
<thead class='table-info'>
<tr class='fw-bold text-center'>
<th colspan=10><h5>TSO IVD - TENGAH</h5></th>
</tr>
<tr style='text-align: center;'>
<th>TSO</th>
<th>IR</th>
<th>MN</th>
<th>CR</th>
<th>PR</th>
<th>SP</th>
<th>TR</th>
<th>RF</th>
<th>Total</th>
<th>IC</th>
</tr>
</thead>
<tbody>
<?php
$iCounter = 0;
foreach($count as $row) {
// User 10 adalah Milik SPV TSO TENGAH
if($row['userid']==10 || $row['reportto']==10 ) {
// Count Untuk Banyak Iterasi
$iCounter++;
// Hitung Total
$irTotal += $row['IR'];
$mnTotal += $row['MN'];
$crTotal += $row['CR'];
$prTotal += $row['PR'];
$spTotal += $row['SP'];
$trTotal += $row['TR'];
$rfTotal += $row['RF'];
$sumTotal += $row['total'];
?>
<tr style='text-align: center;'>
<td style='text-align: left;'><?= $row['firstname'] . ' ' . $row['lastname'];?></td>
<td><?= $row['IR'];?></td>
<td><?= $row['MN'];?></td>
<td><?= $row['CR'];?></td>
<td><?= $row['PR'];?></td>
<td><?= $row['SP'];?></td>
<td><?= $row['TR'];?></td>
<td><?= $row['RF'];?></td>
<td class='fw-bold' style="text-align: center;"><?= $row['total']; ?></td>
<td> - </td>
</tr>
<?php
}
}
?>
<tr class='text-center fw-bold' style='color:#0C356A;'>
<td class='text-end fs-6'>Total</td>
<td><?=$irTotal;?></td>
<td><?=$mnTotal;?></td>
<td><?=$crTotal;?></td>
<td><?=$prTotal;?></td>
<td><?=$spTotal;?></td>
<td><?=$trTotal;?></td>
<td><?=$rfTotal;?></td>
<td><?=$sumTotal;?></td>
<td> </td>
</tr>
<!-- Apabila hasil 0 maka tampilkan 0, jika lebih dari 0 maka lakukan batasan koma pada hasil -->
<tr class='text-center fw-bold' style='color:#0C356A;'>
<td class='text-end fs-6'>Average</td>
<td><?=($irTotal/$iCounter > 0 ) ? number_format($irTotal/$iCounter, 1, '.', '') : 0;?></td>
<td><?=($mnTotal/$iCounter > 0 ) ? number_format($mnTotal/$iCounter, 1, '.', '') : 0;?></td>
<td><?=($crTotal/$iCounter > 0 ) ? number_format($crTotal/$iCounter, 1, '.', '') : 0;?></td>
<td><?=($prTotal/$iCounter > 0 ) ? number_format($prTotal/$iCounter, 1, '.', '') : 0;?></td>
<td><?=($spTotal/$iCounter > 0 ) ? number_format($spTotal/$iCounter, 1, '.', '') : 0;?></td>
<td><?=($trTotal/$iCounter > 0 ) ? number_format($trTotal/$iCounter, 1, '.', '') : 0;?></td>
<td><?=($rfTotal/$iCounter > 0 ) ? number_format($rfTotal/$iCounter, 1, '.', '') : 0;?></td>
<td><?=($sumTotal/$iCounter > 0 ) ? number_format($sumTotal/$iCounter, 1, '.', '') : 0;?></td>
<td> </td>
</tr>
<?php // Reset Total
$irTotal = 0;
$mnTotal = 0;
$crTotal = 0;
$prTotal = 0;
$spTotal = 0;
$trTotal = 0;
$rfTotal = 0;
$sumTotal = 0;
?>
</tbody>
</table>
</div>
</div>
</div>
</div>