preg_match_all($rex, $txt, $o); //print_r($o[0][0]); $html .= '<td>' . $o[0][0] . '</td>'; $rex = "/\\<em class=\"curPrice.+\"\\>(.*)\\<\\/em\\>/"; preg_match_all($rex, $txt, $o); //print_r($o[0][0]); $html .= '<td>' . $o[0][0] . '</td>'; $html .= '</tr>'; return $html; } function get_stock() { $html = ''; $html .= stock_val('004200'); $html .= stock_val('123700'); $html .= stock_val('083420'); return $html; } ?> <table> <tr> <td>name</td> <td>stock</td> </tr> <?php echo get_stock(); ?> </table>
break; case "write": $OUTPUT = write($_POST); break; default: if (isset($_REQUEST['stkid'])) { $OUTPUT = edit($_REQUEST); } else { $OUTPUT = "<li> - Invalid use of module.</li>"; } } } else { if (isset($_REQUEST['stkid'])) { $OUTPUT = edit($_REQUEST); } else { $OUTPUT = get_stock(); } } require "../template.php"; function get_stock() { db_connect(); $get_stock = "SELECT * FROM stock WHERE div = '" . USER_DIV . "' ORDER BY stkcod"; $run_stock = db_exec($get_stock) or errDie("Unable to get stock information."); if (pg_numrows($run_stock) < 1) { return "\n\t\t\t\t\t<li class='err'>No Stock Items Could Be Found.</li>" . mkQuickLinks(ql("../core/trans-new.php", "Journal Transactions"), ql("../stock-add.php", "New Stock"), ql("../stock-view.php", "View Stock")); } else { $stock_drop .= "<select name='stkid'>"; while ($sarr = pg_fetch_array($run_stock)) { $stock_drop .= "<option value='{$sarr['stkid']}'>({$sarr['stkcod']}) {$sarr['stkdes']}</option>"; }
$product_name = $row->product_name; $product_price = $row->product_price; $product_img = $row->img; $cretime = $row->cretime; $nowtime = strtotime(date("d M Y")); $diff = $nowtime - strtotime($cretime); $tickernew = ""; if ($diff <= 302400) { $tickernew = "<span class=\"tickernew\"></span>"; } if (isset($product_img)) { $varimg = "/mmcp/images/products/" . $product_img; } else { $varimg = "/images/products/no-img-potrait.jpg"; } $stock = get_stock($id); if ($stock == 0) { echo "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"linkproduct\" href=\"#\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"listitem\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"" . $varimg . "\" width=\"188\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"soldout\"><img src=\"/images/products/soldout.png\" /></span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"productname\">" . $product_name . "</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"productprice\">IDR " . number_format($product_price, 0, "", ".") . "</span> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $tickernew . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</li> \t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; } else { echo "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"linkproduct\" href=\"/products/detail/?type=" . $type . "&id_product=" . $id . "\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"listitem\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"" . $varimg . "\" width=\"188\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"productname\">" . $product_name . "</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"productprice\">IDR " . number_format($product_price, 0, "", ".") . "</span> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $tickernew . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</li> \t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; } } } else { echo "No data available right now for this category..."; } ?> </ul> <?php $url = "/products/list/?type=" . $type . "&cat=" . $cat . "";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <?php error_reporting(E_ALL ^ E_NOTICE); require_once 'model.php'; require_once 'php-ofc-library/open-flash-chart-object.php'; require_once 'php-ofc-library/open-flash-chart.php'; require_once 'php-ofc-library/ofc_candle.php'; $ticker = $_REQUEST['s']; //update_stock_info($ticker); update_stock_daily($ticker); update_stock_info($ticker); $stock = get_stock($ticker); $t = $_REQUEST['t']; if ($t == "") { $t = 20; } $tid = $_REQUEST['tid']; $sa = $_REQUEST['sa']; $sb = $_REQUEST['sb']; $sc = $_REQUEST['sc']; $sd = $_REQUEST['sd']; $se = $_REQUEST['se']; $chart_url = urlencode('chart.php?t=' . $t . '&tid=' . $stock->getId() . '&sa=' . $sa . '&sb=' . $sb . '&sc=' . $sc . '&sd=' . $sd . '&se=' . $se); if ($_REQUEST['do'] == 'processTrade') { $trade = new Trade(); $message = $trade->buildFromPost(); if ($message == "") { $trade->persist(); $message = "Successfully added trade."; include 'html/green_messagebox.php'; } else {
if (!empty($_SESSION['cart'][$id])) { $q = get_stock($id); if ($_SESSION['cart'][$id] >= $q) { $_SESSION['cart'][$id] = $q; $get = "?increase=false"; } else { ++$_SESSION['cart'][$id]; $get = "?increase=true"; } } break; //decrease the product amount. The amount cannot be decreased below 0 and the product will be removed if stock is empty. //decrease the product amount. The amount cannot be decreased below 0 and the product will be removed if stock is empty. case '-': if (!empty($_SESSION['cart'][$id])) { $q = get_stock($id); if ($_SESSION['cart'][$id] <= 1) { $_SESSION['cart'][$id] = 1; $get = "?decrease=false"; } elseif ($q < 1) { unset($_SESSION['cart'][$id]); $get = "?decrease=false"; } else { --$_SESSION['cart'][$id]; $get = "?decrease=true"; } } break; } } }
echo $row['item_limit']; ?> </td> <?php $count_branch = 0; $q_branch2 = mysql_query("select * from branches {$where_branch} order by branch_id"); while ($r_branch2 = mysql_fetch_array($q_branch2)) { ?> <td <?php if (get_stock($row['item_id'], $r_branch2['branch_id']) <= $row['item_limit']) { ?> bgcolor="#D82827" style="color:#fff;"<?php } ?> ><?php echo get_stock($row['item_id'], $r_branch2['branch_id']); ?> </td> <?php $count_branch++; } ?> <td style="text-align:center;"> <a href="stock.php?page=form&id=<?php echo $row['item_id']; ?> " class="btn btn-default" ><i class="fa fa-pencil"></i></a> <a href="javascript:void(0)" onclick="confirm_delete(<?php echo $row['item_id'];
<?php $related = get_related($id_product, $type); if ($related) { echo "\n\t\t\t\t\t\t\t\t\t<h2 class=\"prodrelated\">You may also like</h2>\n\t\t\t\t\n\t\t\t\t\t\t\t\t\t<div class=\"wraplistitem listitemrelated\">\n\t\t\t\t\t\t\t\t\t\t<ul class=\"productitem related_product\">\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t"; foreach ($related as $rowrelated) { $cretime = $rowrelated->cretime; $nowtime = strtotime(date("d M Y")); $diff = $nowtime - strtotime($cretime); $tickernew = ""; if ($diff <= 302400) { $tickernew = "<span class=\"tickernew\"></span>"; } $stock = get_stock($rowrelated->id); if ($stock == 0) { echo "\n\t\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t\t<a class=\"linkproduct\" href=\"/products/list/?type=" . $rowrelated->type . "\">\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"listitem\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span><img src=\"/mmcp/images/products/" . $rowrelated->img . "\" width=\"188\"/></span>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"soldout\"><img src=\"/images/products/soldout.png\" /></span>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"productname\">" . $rowrelated->product_name . "</span>\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"productprice\">IDR " . number_format($rowrelated->product_price, 0, "", ".") . "</span> \n\t\t\t\t\t\t\t\t\t\t\t" . $tickernew . "\n\t\t\t\t\t\t\t\t\t\t\t</a> \n\t\t\t\t\t\t\t\t\t\t</li>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t"; } else { echo "\n\t\t\t\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t\t\t\t<a class=\"linkproduct\" href=\"/products/detail/?type=" . $rowrelated->type . "&id_product=" . $rowrelated->id . "\">\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"listitem\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span><img src=\"/mmcp/images/products/" . $rowrelated->img . "\" width=\"188\"/></span>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"productname\">" . $rowrelated->product_name . "</span>\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"productprice\">IDR " . number_format($rowrelated->product_price, 0, "", ".") . "</span> \n\t\t\t\t\t\t\t\t\t\t\t" . $tickernew . "\n\t\t\t\t\t\t\t\t\t\t\t</a> \n\t\t\t\t\t\t\t\t\t\t</li>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t"; } } echo "</ul></div>\t\t\t\t\t\t\n "; } ?> </div> </div> <!--MAINCONTENT-->
# DEFINED VARIABLE # ---------------------------------------------------------------------- */ $stock_id = $_POST['ajax_stock_id']; /* # ---------------------------------------------------------------------- # CALL FUNCTIONS # ---------------------------------------------------------------------- */ $count_stock = count_stock($stock_id); $data_stock = get_stock($stock_id); /* # ---------------------------------------------------------------------- # CONTROL # ---------------------------------------------------------------------- */ if($count_stock['rows'] > 0){ $stock_qty = $data_stock['stock_quantity']; if($stock_qty > 9){ $stock_qty = 9;