Exemplo n.º 1
0
function get_hcm_security($board = 0)
{
    $trading =& new cTrading(1);
    // hcm: parameter = 1
    $orign_data = $trading->get_hcm_security();
    $data = my_format_array_number($_SESSION["language"], $orign_data);
    $session = $trading->get_hcm_trading_session();
    switch ($board) {
        case 0:
            $start = 0;
            $end = count($data);
            break;
        case 1:
            //$start = 0; $end = 37;
            $start = 0;
            $end = 39;
            break;
        case 2:
            //$start = 37; $end = 74;
            $start = 39;
            $end = 77;
            break;
        case 3:
            //$start = 74; $end = 109;
            $start = 77;
            $end = count($data);
            break;
        case 4:
        default:
            $start = 109;
            $end = count($data);
            break;
    }
    $total_market = get_hcm_total_market();
    $html = $total_market . get_hcm_security_header();
    for ($i = $start; $i < $end; $i++) {
        $tr_class = $i % 2 == 0 ? "" : "special";
        $other_class = $i % 2 == 0 ? "other" : "other_special";
        $class = get_css_class($data[$i]["change"]);
        // CE or FL
        if ($orign_data[$i]["last_price"] == $orign_data[$i]["ceiling"]) {
            $more_change = "<span class=\"ce\">CE</span>";
        } else {
            if ($orign_data[$i]["last_price"] == $orign_data[$i]["floor"]) {
                $more_change = "<span class=\"fl\">FL</span>";
            } else {
                $more_change = "";
            }
        }
        // ATO || ATC
        $special_price = $session >= 3 ? "ATC" : "ATO";
        // get highlight
        if (!empty($_SESSION["data"][$i])) {
            $highlight = get_highlight($data[$i], $_SESSION["data"][$i]);
        }
        // get notice for symbol
        $notice = $data[$i]["securityname"];
        $class_symbol = "";
        if ($data[$i]["splitstock"] != " " && $data[$i]["splitstock"] != " ") {
            $class_symbol = "bgcolor='#744e21'";
            $notice .= "<br>" . " - Thực hiện tách cổ phiếu";
        }
        if ($data[$i]["benefit"] == "A") {
            $class_symbol = "bgcolor='#744e21'";
            $notice .= "<br>" . " - Phát hành thêm cổ phiếu";
        } elseif ($data[$i]["benefit"] == "D") {
            $class_symbol = "bgcolor='#744e21'";
            $notice .= "<br>" . " - Giao dịch không hưởng cổ tức";
        } elseif ($data[$i]["benefit"] == "R") {
            $class_symbol = "bgcolor='#744e21'";
            $notice .= "<br>" . " - Giao dịch không hưởng quyền";
        } else {
            $class_symbol = "";
            $notice .= "";
        }
        $html .= "<tr class='" . $tr_class . "'>";
        $html .= "<td class=\"order\">" . ($i + 1) . "</td>";
        $html .= "<td " . $class_symbol . "><label class=\"" . $class["icon"] . "\">" . "<a href=\"\" onMouseOver=\"return overlib('" . $notice . "');\" onMouseOut=\"return nd();\">" . $data[$i]["stocksymbol"] . "</a></label></td>";
        $html .= "<td>" . $data[$i]["priorcloseprice"] . "</td>";
        $html .= "<td>" . $data[$i]["ceiling"] . "</td>";
        $html .= "<td>" . $data[$i]["floor"] . "</td>";
        /*
              $html .= "<td><span class=\"" . get_class_change($orign_data[$i]["openprice"], $orign_data[$i]["priorcloseprice"]) . "\">" 
        						. $data[$i]["openprice"] . "</span></td>"; 
        */
        $html .= "<td><span class=\"" . get_class_change($orign_data[$i]["openprice"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["openprice"] . "</span></td>";
        $html .= "<td><span class=\"" . get_class_change($orign_data[$i]["highest"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["highest"] . "</span></td>";
        $html .= "<td style=\"border-right:2px solid #9aa3ba;\"><span class=\"" . get_class_change($orign_data[$i]["lowest"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["lowest"] . "</span></td>";
        // ======= Best Bid =======
        $html .= "<td class=\"" . $highlight["best3bid"] . "\"><span class=\"" . get_class_change($orign_data[$i]["best3bid"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best3bid"] . "</span></td>";
        $html .= "<td class=\"" . $highlight["best3bidvolume"] . "\"><span class=\"" . get_class_change($orign_data[$i]["best3bid"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best3bidvolume"] . "</td>";
        $html .= "<td class=\"" . $highlight["best2bid"] . "\"><span class=\"" . get_class_change($orign_data[$i]["best2bid"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best2bid"] . "</span></td>";
        $html .= "<td class=\"" . $highlight["best2bidvolume"] . "\"><span class=\"" . get_class_change($orign_data[$i]["best2bid"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best2bidvolume"] . "</td>";
        if ($data[$i]["best1bid"] == "&nbsp;" && $data[$i]["best1bidvolume"] != "&nbsp;") {
            $html .= "<td class=\"" . $highlight["best1bid"] . "\"><span class=\"" . get_class_change(1, 0) . "\">" . $special_price . "</span></td>";
            $html .= "<td class=\"" . $highlight["best1bidvolume"] . "\" style=\"border-right:2px solid #9aa3ba;\"><span class=\"" . get_class_change(1, 0) . "\">" . $data[$i]["best1bidvolume"] . "</td>";
        } else {
            $html .= "<td class=\"" . $highlight["best1bid"] . "\"><span class=\"" . get_class_change($orign_data[$i]["best1bid"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best1bid"] . "</span></td>";
            $html .= "<td class=\"" . $highlight["best1bidvolume"] . "\" style=\"border-right:2px solid #9aa3ba;\"><span class=\"" . get_class_change($orign_data[$i]["best1bid"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best1bidvolume"] . "</td>";
        }
        // ======= Change =======
        if ($highlight["last_price"] == "") {
            $highlight["last_price"] = $other_class;
        }
        if ($highlight["last_change"] == "") {
            $highlight["last_change"] = $other_class;
        }
        if ($highlight["last_volume"] == "") {
            $highlight["last_volume"] = $other_class;
        }
        $html .= "<td class=\"" . $highlight["last_price"] . "\"><span class=\"" . $class["change"] . "\">" . $data[$i]["last_price"] . "</td>";
        $html .= "<td class=\"" . $highlight["last_change"] . "\">" . $more_change . "<span class=\"" . $class["fit"] . "\">" . $data[$i]["last_change"] . "</td>";
        $html .= "<td class=\"" . $highlight["last_volume"] . "\" style=\"border-right:2px solid #9aa3ba;\"><span class=\"" . $class["change"] . "\">" . $data[$i]["last_volume"] . "</td>";
        // ======= Best Offer =======
        if ($data[$i]["best1offer"] == "&nbsp;" && $data[$i]["best1offervolume"] != "&nbsp;") {
            $html .= "<td class=\"" . $highlight["best1offer"] . "\"><span class=\"" . get_class_change(1, 2) . "\">" . $special_price . "</span></td>";
            $html .= "<td class=\"" . $highlight["best1offervolume"] . "\"><span class=\"" . get_class_change(1, 2) . "\">" . $data[$i]["best1offervolume"] . "</td>";
        } else {
            $html .= "<td class=\"" . $highlight["best1offer"] . "\"><span class=\"" . get_class_change($orign_data[$i]["best1offer"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best1offer"] . "</span></td>";
            $html .= "<td class=\"" . $highlight["best1offervolume"] . "\"><span class=\"" . get_class_change($orign_data[$i]["best1offer"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best1offervolume"] . "</td>";
        }
        $html .= "<td class=\"" . $highlight["best2offer"] . "\"><span class=\"" . get_class_change($orign_data[$i]["best2offer"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best2offer"] . "</span></td>";
        $html .= "<td class=\"" . $highlight["best2offervolume"] . "\"><span class=\"" . get_class_change($orign_data[$i]["best2offer"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best2offervolume"] . "</td>";
        $html .= "<td class=\"" . $highlight["best3offer"] . "\"><span class=\"" . get_class_change($orign_data[$i]["best3offer"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best3offer"] . "</span></td>";
        $html .= "<td class=\"" . $highlight["best3offervolume"] . "\" style=\"border-right:2px solid #9aa3ba;\"><span class=\"" . get_class_change($orign_data[$i]["best3offer"], $orign_data[$i]["priorcloseprice"]) . "\">" . $data[$i]["best3offervolume"] . "</td>";
        $html .= "<td class=\"" . $highlight["fbuy"] . "\"><b>" . $data[$i]["fbuy"] . "</b></td>";
        $html .= "<td class=\"" . $highlight["currentroom"] . "\"><b>" . $data[$i]["currentroom"] . "</b></td>";
    }
    $_SESSION["data"] = $data;
    $html_footer = get_hcm_security_footer();
    $html .= $html_footer;
    return $html;
}
Exemplo n.º 2
0
function get_hcm_security($trading, $pattern = '')
{
    $orign_data = $trading->get_hcm_security(str_replace("\\", "", $pattern));
    $data = my_format_array_number($_SESSION["language"], $orign_data);
    $session = $trading->get_hcm_trading_session();
    $html = get_hcm_security_header();
    $html .= display_hcm_security($session, $orign_data, $data);
    $_SESSION["data"] = $data;
    $html_footer = get_hcm_security_footer();
    $html .= $html_footer;
    return $html;
}