? and viamedquote_purchase_orders.hostcompanyid=? and viamedquote_purchase_orders_details.orderid=viamedquote_purchase_orders.id and viamedquote_purchase_orders_details.stockref=? and viamedquote_purchase_orders_details.remainingcancelled=? and viamedquote_purchase_orders_details.qty_received < viamedquote_purchase_orders_details.qty"; $stmt = pdoquery($sql, array('0', '0', $hostcompanyid, $stkref, '0')); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); //print "ROWS ".count($rows)."
"; //print "$sql
"; foreach ($rows as $row) { $qtyreamin=$row['qty']-$row['qty_received']; $company_id=$row['company_id']; $lineid=$row['lineid']; $cidlist[$company_id] = isset($cidlist[$company_id]) ? $cidlist[$company_id] + 1 : 1; if ($row['hostcompanyid']==4) { $prreference="SR".$row['orderid']." Line ID ".$row['lineid']." Qty LEft on Line : ".$qtyreamin; } else { $prreference="P".(isset($global_company_prefix[$hostcompanyid]) ? $global_company_prefix[$hostcompanyid] : '').$row['orderid']." Line ID ".$row['lineid']." Qty Left on Line : ".$qtyreamin; } $polineoptions[$lineid] = isset ( $polineoptions[$lineid] ) ? $polineoptions[$lineid] : ''; $polineoptions[$lineid] .= ""; $poidlink[$lineid]="P".(isset($global_company_prefix[$hostcompanyid]) ? $global_company_prefix[$hostcompanyid] : '').$row['orderid']; } $company_id = isset ( $company_id ) ? $company_id : 0 ; $cidlist[$company_id] = isset ( $cidlist[$company_id] ) ? $cidlist[$company_id] : null ; if ($company_id > 0){ $cid=$company_id; include ("../crm/showaddress.php"); } $s7daysago=date("U")-604800; if ($hostcompanyid=='') { $buttext="Warning No Company Selected"; } else { $buttext="Proceed to enter Serial Numbers"; } if ($orderid >0 and $hostcompanyid < 1 ) { $sql="SELECT * FROM viamedquote_purchase_orders where id=?"; $stmt = pdoquery($sql, array($orderid)); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($rows as $row) { $cid=$row['company_id']; $hostcompanyid=$row['hostcompanyid']; include ("../../databases/crm/LINKS_company.php"); $buttext="Confirm"; } } ?> fetchAll(PDO::FETCH_ASSOC); $num = count($rows); if ($num==0 ) { print "

You require Training in Goods in Theory Training Introduction - Requires Management Training Manager

"; } else { $sql = "DELETE FROM temporaryserialnumber WHERE user=?"; pdoquery($sql, array($localuser)); $sql="SELECT * FROM stocklist_tarriffs where stock_ref=? and hostcompany_id=?"; $stmt = pdoquery($sql, array($stkref, $hostcompanyid)); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($rows as $row) { $usenotes=$row['prelabeltext']; $usenotes=nl2br($usenotes); $usedesc=$row['pricedesc']; $mainlocationid=$row['mainstocklocation']; $goodsinproceduredocid=$row['goodsinproceduredocid']; if ($goodsinproceduredocid > 0 ) { $proclink=linkdocid($x,$goodsinproceduredocid)." Goods in Procedure
"; } else { $proclink=""; } if ($mainlocationid > 0 ) { $mainlocationoption = ""; } else { $mainlocationoption = ""; } } ?>
Add New Items
$stkref - $usedesc

Before Placing into Stock Ensure:


Please send any Safety data Sheets, Coshh Sheets to Technical Manager to be added to the document system.

"; // Document display section print "

Linked Documents for $stkref

Existing Documents:


"; if ($usenotes<>'') { $usenotes=str_replace("

","
",$usenotes); print "

Goods in $stkref Notes

$usenotes


"; } else { ?>

Open Issues for $stkref

"; $sql = "SELECT * FROM viamedagendahistory WHERE completed='' AND agendid <> '57' AND stock_ref_tag = '" . safetext2($stkref) . "' ORDER BY id DESC"; $stmt = pdoquery($sql, array()); $issues = $stmt->fetchAll(PDO::FETCH_ASSOC); if (count($issues) > 0) { print ""; print ""; foreach ($issues as $issue) { $link = "/intranet/databases/agenda/singleissue3.php" . $x . "&iid=" . $issue['id'] . "&clue=1"; print ""; print ""; print ""; print ""; print ""; print ""; } print "
Issue IDSubjectCreatedWith
" . $issue['id'] . "" . htmlspecialchars($issue['subject']) . "" . date('d/m/Y', $issue['createdate']) . "" . htmlspecialchars($issue['investigateby']) . "
"; } else { print "

No open issues found for this stock reference.

"; } if ($readmemo=='') { print "
"; } print "$proclink $stkref
"; ?>