I have some code like below. If the difference is bigger or smaller than $deviasi=0.01 for the first OR condition, it will show the red label. But if the difference is bigger or smaller than $deviasi=0.01 for the next OR condition (the first OR condition is true), it will show the green label. Whereas it should display a red color label.
public function printed3($table1, $valuetable1, $table2, $valuetable2,$table3, $valuetable3, $deviasi, $count)
{
$differ = $valuetable1 - $valuetable2;
$round_differ = number_format((float)$differ, 5, '.', '');
$round_simple = number_format((float)$differ, 3, '.', '');
$differ2 = $valuetable1 - $valuetable3;
$round_differ2 = number_format((float)$differ2, 5, '.', '');
$round_simple2 = number_format((float)$differ2, 3, '.', '');
if (($round_differ >= $deviasi || $round_differ <= -$deviasi) && ($round_differ2 >= $deviasi || $round_differ2 <= -$deviasi)) {
echo "
<td>
<a href='#hasil".$count."' data-toggle='collapse'>
<span class='glyphicon glyphicon-remove-circle'></span><br>
<span class='label label-danger'>Selisih ".$table1." - ".$table2." : ".$round_simple."</span><br>
<span class='label label-danger'>Selisih ".$table1." - ".$table3." : ".$round_simple2."</span>
</a>
<div class='collapse' id='hasil".$count."'>
<small>
------------------<br>
<b>Nilai Tabel ".$table1."</b> : ".$valuetable1."<br>
<b>Nilai Tabel ".$table2."</b> : ".$valuetable2."<br>
<b>Nilai Tabel ".$table3."</b> : ".$valuetable3."<br>
</small>
</div>
</td>
";
}
else{
echo "
<td>
<a href='#hasil".$count."' data-toggle='collapse'>
<span class='glyphicon glyphicon-ok-circle'></span><br>
</a>
<small>
<b>Nilai Tabel ".$table1."</b> : ".$valuetable1."<br>
<b>Nilai Tabel ".$table2."</b> : ".$valuetable2."<br>
<b>Nilai Tabel ".$table3."</b> : ".$valuetable3."<br>
dev ".$deviasi."
</small>
<div class='collapse' id='hasil".$count."'>
<small>
------------------<br>
<b>Selisih Tabel ".$table1." - ".$table2."</b> : ".$round_differ."<br>
<b>differ Table ".$table1." - ".$table3."</b> : ".$round_differ2."
</small>
</div>
</td>
";
}
}
this is the error result: screenshot
Aucun commentaire:
Enregistrer un commentaire