Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.191.192.113
Current Path : /var/www/html/bnu/ |
| Current File : /var/www/html/bnu/getQPdet_org.php |
<?php
$servername = "97.74.228.93";
$username = "logisys3_logu";
$password = "Logisys@2106";
$conn = new mysqli($servername,$username,$password);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$url = $_SERVER['REQUEST_URI'];
$path = explode("/",$url);
// var_dump($path[1]);
if($path[1] == "bcu")
$db = "logisys3_bcu";
else if($path[1] == "bnu")
$db = "logisys3_bnu";
$fboard = $_POST['fboard'];
$Query = "select fqpcode, fsubname, ifnull(fspresent,0) as fspresent,
ifnull(fapresent,0) as fapresent, ifnull(fcodecount,0) as fcodecount,
ifnull(ftotpkt1,0) as ftotpkt1, ifnull(fvalpkt1,0) as fvalpkt1
from {$db}.masqp where fboard = '{$fboard}'";
$result = mysqli_query($conn, $Query);
$i = 1;
$html = "<tr class='bg-green'>
<th width='4%'><center>Sl. No.</center></th>
<th width='7%'><center>Qp. Code</center></th>
<th><center>Subject Name</center></th>
<th width='7%'><center>Script Recd.</center></th>
<th width='9%'><center>Script Counted</center></th>
<th width='9%'><center>Script Coded</center></th>
<th width='9%'><center>Coding Pending</center></th>
<th width='9%'><center>Packets Count</center></th>
<th width='9%'><center>Packets Valued</center></th>
<th width='9%'><center>Valuation Pending</center></th>
</tr>";
while($row = mysqli_fetch_assoc($result))
{
$codepend = $row['fapresent'] - $row['fcodecount'];
$valpend = $row['ftotpkt1'] - $row['fvalpkt1'];
if($codepend < 0)
$codepend = 0;
if($valpend < 0)
$valpend = 0;
$html .= "<tr>
<td><center>{$i}</center></td>
<td><center>{$row['fqpcode']}</center></td>
<td>{$row['fsubname']}</td>
<td style='text-align:center'>".moneyFormatIndia($row['fspresent'])."</td>
<td style='text-align:center'>".moneyFormatIndia($row['fapresent'])."</td>
<td style='text-align:center'>".moneyFormatIndia($row['fcodecount'])."</td>
<td style='text-align:center'>".moneyFormatIndia($codepend)."</td>
<td style='text-align:center'>".moneyFormatIndia($row['ftotpkt1'])."</td>
<td style='text-align:center'>".moneyFormatIndia($row['fvalpkt1'])."</td>
<td style='text-align:center'>".moneyFormatIndia($valpend)."</td>
</tr>";
$i++;
}
echo $html;
function moneyFormatIndia($num) {
$explrestunits = "" ;
if(strlen($num)>3) {
$lastthree = substr($num, strlen($num)-3, strlen($num));
$restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits
$restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping.
$expunit = str_split($restunits, 2);
for($i=0; $i<sizeof($expunit); $i++) {
// creates each of the 2's group and adds a comma to the end
if($i==0) {
$explrestunits .= (int)$expunit[$i].","; // if is first value , convert into integer
} else {
$explrestunits .= $expunit[$i].",";
}
}
$thecash = $explrestunits.$lastthree;
} else {
$thecash = $num;
}
return $thecash; // writes the final format where $currency is the currency symbol.
}
?>
|