wh; $l_date=$row->date; $l_cust=$row->cust; $l_po=$row->po; $l_qty=$row->qty; $l_item=$row->item; $l_price=$row->price; $plus[$l_wh][$l_date][$l_item]+=$l_qty; $a_plus[$l_wh][$l_item]+=$l_qty; $a_delta[$l_wh][$l_item]+=$l_qty; } $sqlq="SELECT * FROM vmilog WHERE msg = '861'"; $result=mysql_query($sqlq, $db_link); while (($row=mysql_fetch_object($result))) { $l_type=$row->msg; $l_po=$row->po; $l_date=$row->date; $l_wh=$row->one; $l_item=$row->two; $l_qty=$row->three; $minus[$l_wh][$l_date][$l_item]+=$l_qty; $a_minus[$l_wh][$l_item]+=$l_qty; $a_delta[$l_wh][$l_item]-=$l_qty; } /////////////////////////////////////////////////////////////// $WHERE=""; $today=date("Y-m-d"); $dioh_limit=9950; $d_dioh_limit=300; $d_dioh_reorder=30; $W=2; $WHERE="WHERE date='$today'"; if ($sb_wh != "") { $WHERE.=" wh = '$sb_wh'"; } $sqlq="SELECT * FROM whdioh $WHERE ORDER BY wh,item"; $result=mysql_query($sqlq, $db_link); // Read in all data while (($row=mysql_fetch_object($result))) { $l_item=$row->item; $l_wh=$row->wh; $l_date=$row->date; $l_qa=$row->qa; $l_qe=$row->qe; $l_qo=$row->qo; $l_qn=$row->qn; $l_qp=$row->qp; $l_status=$row->status; if ($l_qn!=0){ $dioh=(($l_qa-$l_qo+$l_qp)/$l_qn)*30.5; } else { $dioh=0; } $whlist[$l_wh][$l_date][$l_item]=array($l_qa, $l_qe, $l_qo, $l_qn, $l_qp, $l_status); } print "

"; print "

"; print ""; foreach ($whlist as $wh => $info) { print "
"; foreach ($info as $d => $item) { foreach ($item as $i => $q) { $qa=$q[0]; $qe=$q[1]; $qo=$q[2]; $qn=$q[3]; $qp=$q[4]; $status=$q[5]; $reorder=($qn/30.5)*21; $maxr=$qn/30.5*30; $aaa=$a_delta[$wh][$i]; if ($qn!=0) { $dioh=(($qa-$qo+$aaa+$qp)/$qn)*30.5; } else { $dioh=0; } $d_dioh=$dioh*2; if ($d_dioh>$d_dioh_limit) { $color="#ffcccc"; $d_dioh=$d_dioh_limit; } else { $color="#99ff99"; } if ($d==$today) { print "",$d_dioh,$dioh); } } } print "
"; } print "
"; ?>