</tr> </thead> <?php $reagents_list = array(); $reagents_list = Inventory::getAllReagents($lid); foreach ($reagents_list as $reagent) { ?> <tbody> <tr align='center'> <td><?php echo $reagent['name']; ?> </td> <td><?php $quant = Inventory::getQuantity($lid, $reagent['id']); if ($quant == '') { echo "0"; } else { echo $quant; } ?> </td> <td><?php $uni = $reagent['unit']; if ($uni == '') { echo "units"; } else { echo $uni; } ?>
public function get_stock_usage($r_id, $lot) { if ($_SESSION['level'] < 2 || $_SESSION['level'] > 4) { $user = get_user_by_id($_SESSION['user_id']); $lid = $user->labConfigId; } if ($lid == null) { $lid = get_lab_config_id_admin($_SESSION['user_id']); } //$stocks_list = Inventory::getStocksList($lid, $r_id); $lab_config_id = $lid; $saved_db = DbUtil::switchToLabConfig($lab_config_id); $query_string = "SELECT * from inv_usage WHERE reagent_id = {$r_id} AND lot = '{$lot}'"; $recordset = query_associative_all($query_string, $row_count); DbUtil::switchRestore($saved_db); $cc = 1; //echo "-".$recordset."-"; //print_r($recordset); $spec = array(); foreach ($recordset as $stock) { $quant = Inventory::getQuantity($lid, $reagent['id']); // $uni = $reagent['unit']; $spec[$cc]['id'] = $stock['id']; $spec[$cc]['quantity_used'] = $stock['quantity_used']; $spec[$cc]['user_id'] = $stock['user_id']; $spec[$cc]['remarks'] = $reagent['remarks']; $dp = explode("-", $stock['date_of_use']); $e_date = $dp[2] . "/" . $dp[1] . "/" . $dp[0]; $spec[$cc]['date_of_use'] = $e_date; $cc++; } //$spec = get_specimen_by_id($specimen_id); if (count($spec) > 0) { $ret = $spec; } else { $ret = 0; } return $ret; }