| Current Path : /var/www/html/mmishra/icure/staff/ |
| Current File : /var/www/html/mmishra/icure/staff/requisition.inc |
<h3 align='left'>Medicine requirement prediction for 6 months based on previous consumptions</h3>
<center>
<?php
$tbl = 'medicines';
$fyear = date("Y") - 1;
$fyear = date("Y");
echo "<div align='right'>Date: ".date("d-m-Y")."
<table border='1' width='100%'>
<tr><th rowspan='2'>Sr</th><th rowspan='2'>Medicine Name<br>(with specification)</th>
<th colspan='12'>Monthly Quantity Used in the Year $fyear</th>
<th rowspan='2'>Total<br>Used</th><th rowspan='2'>Average<br>/Month</th>
<th rowspan='2'>Predicted<br>Qty (+5%)</th><th rowspan='2'>Indent<br>Qty</th></tr>
<tr>";
foreach ($months as $mnth) {
echo "<th>$mnth</th>";
}
echo "</tr>";
$no = 12; $sl = 0;
$rs = mysql_query("select med_id,med_name from $tbl order by med_name");
while ($o = mysql_fetch_object($rs)) {
$sl++;
$mid = $o->med_id;
echo "<tr><td>$sl</td><td>$o->med_name</td>";
$tot = 0; $j = 0; $avg = 0;
for ($i=1; $i <= $no; $i++) {
$sr = mysql_query("select sum(qty) as iq from medications where med_id=$mid and concat(year(dis_datetime),'-',month(dis_datetime))='$fyear-$i' group by med_id");
echo '<td>';
if (mysql_num_rows($sr)) {
$j++;
$q = mysql_fetch_object($sr);
$iqty = $q->iq;
$tot += $iqty;
$avg = ceil($tot/$j);
echo $iqty;
} else {
echo '';
}
echo '</td>';
}
//projected qty for 6 months plus 5% extra
$pqty = $avg * 6;
$pqty += round(($pqty * 5 / 100));
echo "<td>$tot</td><td>$avg</td><td>$pqty</td><td> </td></tr>";
}
for ($i = $sl+1; $i<$sl+15; $i++) {
echo "<tr><td>$i</td><td></td><td colspan='15'></td><td> </td></tr>";
}
?>
</table>
<br>
<pre>............................. ..................................
Pharmacist/Nurse CMO, IIIT Allahabad</pre>
</center>