Font Color changes when value changes
Posted: 2019-01-26 03:45
Hello,
I have fields named receiving.amountrecieved, batchesdetails.quantityused, receiving.balance.
What I would like to happen is the color of the font in receiving.balance will change to red when the value is less than or equal 5%.
I have fields named receiving.amountrecieved, batchesdetails.quantityused, receiving.balance.
What I would like to happen is the color of the font in receiving.balance will change to red when the value is less than or equal 5%.
Code: Select all
<?php
$currDir = dirname(__FILE__) . '/..';
include("$currDir/defaultLang.php");
include("$currDir/language.php");
include("$currDir/lib.php");
/* grant access to all users who have access to the receiving table */
$od_from = get_sql_from('receiving');
if(!$od_from){
header('HTTP/1.0 401 Unauthorized');
exit;
}
$id = intval($_REQUEST['id']);
if(!$id) exit;
$total_quantityused = sqlValue("SELECT sum(QuantityUsed) from batchesdetails where ReceivingID='{$id}'");
$AmountReceived = sqlValue("SELECT AmountReceived from receiving where ReceivingID='{$id}'");
$Adjustment = sqlValue("SELECT sum(Qty) from adjustments2 where ReceivingID='{$id}'");
$balance_supply = $AmountReceived - ($total_quantityused + $Adjustment);
sql("update receiving set Balance='{$balance_supply}' where ReceivingID='{$id}'", $eo);
$total_qty = sqlValue("SELECT sum(Qty) from adjustments2 where ReceivingID='{$id}'");
$adjustment = $total_qty;
sql("update receiving set Adjustment='{$adjustment}' where ReceivingID='{$id}'", $eo);
echo number_format($balance_supply, 2);