rendered paste body<?php// Populate LINES$sqlq="SELECT * FROM linlog";$result=mysql_query($sqlq, $db_link);while (($row=mysql_fetch_object($result))) { $l_wh=$row->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 datawhile (($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 "<form name=warehouse class=text><select class=text name=sb_wh onchange=\"document.warehouse.submit()\"><option value= >All Warehouses</option> ";while (list($wh) = each($whlist)) { $selected = $wh==$sb_wh ? "selected" : ""; print "<option value=$wh $selected>$wh</option>";}$checked=$incomplete=="yes" ? "checked" : "";$nschecked=$nonshipped=="yes" ? "checked" : "";print "</select><br><!--input type=checkbox name=incomplete value=yes onclick=\"document.warehouse.submit()\" $checked> Only show incomplete orders, <input type=checkbox name=nonshipped value=yes onclick=\"document.warehouse.submit()\" $nschecked> Only show non shipped orders -->";print "</form></p>";print "<table cellspacing=5 border=0>";foreach ($whlist as $wh => $info) { print "<tr><td><table border=0><tr><td class=submenu><b>$wh</b></td></tr><tr class=submenu><td><b>Item</b></td><td><b>Status</b></td><td><b>QA</b></td><td><b>QE</b></td><td><b>QO</b></td><td><b>QN</b></td><td><b>QP</b></td><td><b>Delta</b></td><td><b>R</b></td><td></td><td><b>DIOH</b></td>"; 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 "<tr bgcolor=#ffff99 class=submenu><td width=40><a href=vmi_dioh_wh_item.php?sb_wh=$wh&sb_item=$i>$i</a></td><td>$status</td><td width=40>$qa</td><td width=40>$qe</td><td width=40>$qo</td><td width=40>$qn</td><td>$qp</td><td>".$a_delta[$wh][$i]."</td><td>".number_format($reorder)."/".number_format($maxr)."</td><td width=15>"; if ($dioh<$d_dioh_reorder && $dioh>0){ print "<img src=red.gif>"; } printf ("</td><td bgcolor=#ffffff><table cellspacing=0 cellpadding=0><td bgcolor=$color align=left width=%4.0f class=submenu>%4.0f</td></table></td>",$d_dioh,$dioh); } } } print "</tr></td></table>";}print "</table>";?>