當前位置: 首頁>>代碼示例>>PHP>>正文


PHP products_minierp::getDIOHstockTarget方法代碼示例

本文整理匯總了PHP中products_minierp::getDIOHstockTarget方法的典型用法代碼示例。如果您正苦於以下問題:PHP products_minierp::getDIOHstockTarget方法的具體用法?PHP products_minierp::getDIOHstockTarget怎麽用?PHP products_minierp::getDIOHstockTarget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在products_minierp的用法示例。


在下文中一共展示了products_minierp::getDIOHstockTarget方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

tep_db_connect();
define('STOCK_WARNING_LIMIT', 0.5);
//Alert if stock availibility is below this level (in percentage, 0,8=80%)
$products = array();
$articles = array();
use_class('products_minierp');
$class_pm = new products_minierp();
$bg_settings = $class_pm->retrieveBestGoodSettings();
$q = "SELECT pal.products_id, pal.products_articles_id AS articles_id, IFNULL(ps.stock, 0) AS stock";
$q .= "  FROM products_log pl";
$q .= " INNER JOIN products p ON p.products_id=pl.products_id AND p.stars=3";
$q .= " INNER JOIN products_articles_log pal ON pal.products_id=pl.products_id";
$q .= " LEFT JOIN products_stock ps ON ps.jng_warehouses_id=" . WAREHOUSE_ID_PRODUCTS_HAMBURG . " AND ps.products_id=pl.products_id AND ps.articles_id=pal.products_articles_id";
$r = tep_db_query($q);
while ($row = tep_db_fetch_array($r)) {
    $target = $class_pm->getDIOHstockTarget($row['products_id'], $row['articles_id']);
    $percent = $target == 0 ? 0 : $row['stock'] / $target;
    if ($percent < STOCK_WARNING_LIMIT) {
        if (!in_array($row['products_id'], $products)) {
            $products[] = $row['products_id'];
        }
        $articles[] = $row['products_id'] . '-' . $row['articles_id'];
    }
}
$products_total = count($products);
$articles_total = count($articles);
if ($products_total > 0) {
    $subject = 'Depot Stock Report';
    $send_message = '<p>This email is sent automatically by Manobo.</p>';
    $send_message .= '<p>We have today ' . $products_total . ' Top Seller Products (' . $articles_total . ' Articles) with stock ' . STOCK_WARNING_LIMIT * 100 . '% below our stock target</p>';
    $send_message .= '<p>MANOBO</p>';
開發者ID:blasiuscosa,項目名稱:manobo-2008,代碼行數:31,代碼來源:early-warnings.php


注:本文中的products_minierp::getDIOHstockTarget方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。