Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/iws8/html/istore/
Upload File :
Current File : /var/www/html/mmishra/iws8/html/istore/stinoutrate.inc

<h3>Item In-Out Rate</h3>
<center>
<table width='90%' border='1' style='border-collapse: collapse'>
<tr><th>No.</th><th>Particulars</th><th>Inflow Qty</th><th>Inflow Rate</th><th>Outflow Qty</th><th>Outflow Rate</th></tr>

<?php

$rs = mysql_query("SELECT item,sum(qty_out) as no,min(date(dateCreation)) as d1,max(date(dateCreation)) as d2,datediff(max(dateCreation),min(dateCreation))+1 as days FROM st_stockout group by item order by sum(qty_out)/datediff(max(dateCreation),min(dateCreation))+1 desc");

while ($o = mysql_fetch_object($rs)) {
	if ($o->no) $orate = number_format($o->no/$o->days,2);
	//get inflow rate
	if ($o->days>1) {
		$sr = mysql_query("SELECT item,sum(qty_in) as no,min(date(dateCreation)) as d1,max(date(dateCreation)) as d2,datediff(max(dateCreation),min(dateCreation))+1 as days FROM st_stockin where item=$o->item");
	
		if (mysql_num_rows($sr)) {
			$i++;        
			$q = mysql_fetch_object($sr);
			if ($q->no) $irate = number_format($q->no/$q->days,2);
			echo "<tr><th>$i</th><td>".item_detail($o->item)."</td>
			<td>$q->no during $q->d1 - $q->d2 ($q->days days)</td><td>$irate</td>
			<td>$o->no during $o->d1 - $o->d2 ($o->days days)</td><td>$orate</td></tr>";
		}
	}
}
if (!$i) {
	echo "<tr><td colspan='4'>No status</td></tr>";
}

?>

</table>
</center>