本文整理汇总了PHP中products_minierp::calculateMargin方法的典型用法代码示例。如果您正苦于以下问题:PHP products_minierp::calculateMargin方法的具体用法?PHP products_minierp::calculateMargin怎么用?PHP products_minierp::calculateMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类products_minierp
的用法示例。
在下文中一共展示了products_minierp::calculateMargin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderRow
public function renderRow($order_type, $orders_items_id, $template_row = self::ROW_TEMPLATE_DEFAULT, $is_order_first_row = false)
{
use_class('Product');
$order_item_data = $this->retrieveOrdersItemsDetail($order_type, $orders_items_id);
$row_data = array();
//SET GENERAL VARS VALUES
$products_id = $order_item_data['products_id'];
$articles_id = $order_item_data['products_articles_id'];
$obj_product = new Product($products_id);
$product_image = $obj_product->displayImage(80, 80);
$product_image_thumbid = "{$products_id}-{$articles_id}";
$article_no_link = '?open=product-detail&products_id=' . $products_id;
switch ($this->filters_status) {
case '1':
$is_sp = $order_type == self::ORDER_TYPE_SP;
$is_prepayment = strtoupper($order_item_data['payment_method']) == strtoupper(PAYMENT_METHOD_BANK_TRANSFER) || strtoupper($order_item_data['payment_method']) == strtoupper(PAYMENT_METHOD_PREPAYMENT);
$is_unpaid_prepayment = $is_prepayment && !conditionPrepaymentIsPaid($order_item_data, $is_sp);
break;
}
if ($order_type == self::ORDER_TYPE_SP) {
use_class('products_minierp');
$class_pm = new products_minierp();
//self::ROW_DATA_LEADTIME_OR_DATE
$order_date = $order_item_data['order_date'];
//self::ROW_DATA_CYCLETIME DATA
$previous_status_date = $this->filters_status == 4 ? $order_item_data['status_date_prod'] : $order_item_data['status_date'];
//self::ROW_DATA_CUSTOMER_OR_ORDER_NO DATA
$order_id = $order_item_data['order_id'];
$orders_number = $order_item_data['order_id'];
$order_no_link = '?open=customer-care-order-detail&source=SP&id=' . $order_item_data['jng_sp_orders_id'] . '&hidemenu=true';
$customer_name = $order_item_data['customer_name'];
$cust_link = '?open=sp-customer&id=' . $order_item_data['jng_sp_customers_id'] . '&hidemenu=true';
$cust_name = '<a href="' . $cust_link . '" class="view_webpage" >' . $customer_name . '</a>';
//self::ROW_DATA_ORDER_ID DATA
$source_name = $order_item_data['package_prefix'];
$barcode_id = strtoupper(self::ORDER_TYPE_SP) . '-' . $order_item_data['jng_sp_orders_items_id'];
$barcode_id_link = '?open=sp-order-history&oi_id=' . $order_item_data['jng_sp_orders_items_id'] . '&hidemenu=true';
$crown_link = '?open=sp-customers-special-detail&id=' . $order_item_data['jng_sp_customers_id'] . '&hidemenu=true';
//self::ROW_DATA_ARTICLE_NO DATA
$product_image_thumbid .= "-{$order_item_data['jng_sp_id']}";
$article_no = $order_item_data['article_number'];
//self::ROW_DATA_PRICE DATA
$products_price = $order_item_data['price'];
//self::ROW_DATA_QUANTITY DATA
$order_quantity = $order_item_data['order_quantity'];
//self::ROW_DATA_MARGIN DATA
$mat_exp = $order_item_data['material_expenses'] > 0 ? $order_item_data['material_expenses'] : $order_item_data['current_mat_exp'];
$product_margin = number_format($class_pm->calculateMargin($order_item_data['price'], $mat_exp), 1) . '%';
$product_margin = '<span class="' . ($class_pm->priceMargindIsGood($order_item_data['price'], $product_margin) ? 'green' : 'red') . '">' . $product_margin . '</span>';
//self::ROW_DATA_ACTION DATA
//Tab Unpaid Prepayment
if ($this->filters_status == 1 && $this->filters_sub_status == '0') {
if ($order_item_data['jng_sp_id'] == '8') {
$action = '<span class="green">Waiting Payment Status</span>';
} else {
if ($order_item_data['last_sent_date'] == '') {
$action = '<span class="green">Reminder Not Sent</span>';
} else {
$overtime = strtotime($order_item_data['last_sent_date']) < strtotime('-' . PAYMENT_METHOD_BANK_TRANSFER_OVERDUE);
if ($order_item_data['sent_count'] > 1) {
$action = '<span class="red">Cancel Notification Sent</span>';
} else {
$action = '<span class="blue">Reminder Sent</span>';
}
}
}
}
} elseif ($order_type == self::ORDER_TYPE_JG) {
//self::ROW_DATA_LEADTIME_OR_DATE
$order_date = $order_item_data['date_purchased'];
//self::ROW_DATA_CYCLETIME DATA
$previous_status_date = $this->filters_status == 4 ? $order_item_data['status_date_prod'] : $order_item_data['status_date'];
//self::ROW_DATA_CUSTOMER_OR_ORDER_NO DATA
$order_id = $order_item_data['orders_no'];
$orders_number = $order_item_data['orders_no'];
$order_no_link = '?open=customer-care-order-detail&source=JG&id=' . $order_item_data['orders_id'] . '&hidemenu=true';
$customer_name = $order_item_data['customers_name'];
$cust_link = '?open=customer&id=' . $order_item_data['customers_id'] . '&hidemenu=true';
$cust_name = '<a href="' . $cust_link . '" class="view_webpage" >' . $customer_name . '</a>';
//self::ROW_DATA_ORDER_ID DATA
$source_name = 'J&G';
$barcode_id = strtoupper(self::ORDER_TYPE_JG) . '-' . $order_item_data['orders_products_id'];
$barcode_id_link = '?open=sp-order-history&opid=' . $order_item_data['orders_products_id'] . '&hidemenu=true';
$crown_link = '?open=customers-special-detail&id=' . $order_item_data['customers_id'] . '&hidemenu=true';
//self::ROW_DATA_ARTICLE_NO DATA
$article_no = $order_item_data['products_model'] . ($order_item_data['products_length'] > 0 ? '_' . textLength($order_item_data['products_length'], false) : '');
//self::ROW_DATA_PRICE DATA
$products_price = $order_item_data['final_price'];
//self::ROW_DATA_QUANTITY DATA
$order_quantity = $order_item_data['products_quantity'];
//self::ROW_DATA_MARGIN DATA
$product_margin = '';
//self::ROW_DATA_ACTION DATA
//Tab Unpaid Prepayment
if ($this->filters_status == 1 && $this->filters_sub_status == '0') {
if ($order_item_data['last_sent_date'] == '') {
$action = '<span class="green">Reminder Not Sent</span>';
} else {
$overtime = strtotime($order_item_data['last_sent_date']) < strtotime('-' . PAYMENT_METHOD_BANK_TRANSFER_OVERDUE);
if ($order_item_data['sent_count'] > 1) {
//.........这里部分代码省略.........
示例2: manageOrderList
//.........这里部分代码省略.........
$cust = $crown_img . $cust;
}
$cust .= ' <sup>' . $row['customers_order_count'] . '</sup>';
$jng_sp_orders_items_id = 'SP-' . $row['jng_sp_orders_items_id'];
$jng_sp_orders_items_id = '<a href="?open=sp-order-history&oi_id=' . $row['jng_sp_orders_items_id'] . '&hidemenu=true" class="view_webpage">' . $jng_sp_orders_items_id . '</a>';
$order_no = $row['order_id'];
if ($order_no == '') {
$order_no = 'J&G ID: ' . $row['jng_sp_orders_id'];
}
$order_no = '<a href="?open=customer-care-order-detail&source=SP&id=' . $row['jng_sp_orders_id'] . '&hidemenu=true" class="view_webpage">' . $order_no . '</a>';
if ($row['order_item_total'] > 1) {
$jng_sp_orders_items_id .= ' <sup>' . $row['order_item_count'] . '/' . $row['order_item_total'] . '</sup>';
}
if ($row['cod_costs'] > 0) {
$order_no = '<img src="images/list-cod.gif" title="COD Method" /> ' . $order_no;
}
$o['c'] = $cust . '<br /><small>order no:</small> ' . $order_no;
$o['o'] = $jng_sp_orders_items_id;
//$diamond_icon = ($obj_product->brand_id == 14) ? drawDiamondIcon('Diamond Product', ' ') : '';
$diamond_icon = $obj_product->isUsingDiamond() ? drawDiamondIcon('Diamond Product', ' ') : '';
$gold_icon = drawGoldIcon($obj_product->metal_stamp_code, $obj_product->metal_stamp_info, '', ' ');
$article = '<div><a href="?open=product-detail&products_id=' . $products_id . '" target="_blank" title="View Product Detail">' . $row['article_number'] . '</a></div>';
$icons = $gold_icon . $diamond_icon;
$pimg = webImageSource($row['products_image'], '500');
if ($pimg != '') {
$thumb = '<div class="thumb" thumbid="' . "{$products_id}-{$articles_id}-{$jng_sp_id}" . '"><a href="' . $pimg . '" class="view_image" title="Click to view larger image">' . webImage($row['products_image'], '80', '80', '', 'img-border img-padding') . '</a></div>';
$article = $thumb . $article;
}
$o['a'] = drawTableArticleInfoWithIcons($article, $icons);
$o['p'] = $row['price'];
$qty = intval($row['order_quantity']);
$o['q'] = $qty;
$mat_exp = $row['material_expenses'] > 0 ? $row['material_expenses'] : $row['current_mat_exp'];
$margin = number_format($class_pm->calculateMargin($row['price'], $mat_exp), 1) . '%';
$o['m'] = '<span class="' . ($class_pm->priceMargindIsGood($row['price'], $margin) ? 'green' : 'red') . '">' . $margin . '</span>';
// $el_link = '<a href="?open=elements-stock&products_id='.$products_id.'&hidemenu=true" class="view_webpage"></a>'; //PREVIOUS
$el_link = '<a href="?open=products-elements-stock&products_id=' . $products_id . '&paid=' . $row['products_articles_id'] . '&qty=' . $qty . '&status=' . $row['stock_status'] . '&hidemenu=true" class="view_webpage"></a>';
$pr_link = '<a href="javascript:void();" onclick="alert(\'Please use Finish Good Stock\');"></a>';
$dp_link = '<a href="javascript:void();" onclick="alert(\'Please use Depot Stock\');"></a>';
switch ($row['stock_status']) {
case '0':
$stock_status = '<strong class="red">!</strong>';
if ($status == '8') {
//$do_status = statusNameShort($row['depot_orders_status']);
$do_status = $row['depot_orders_status'] == '4' && isset($row['depot_orders_prod_status']) && $row['depot_orders_prod_status'] != '' ? statusNameProduction($row['depot_orders_prod_status'], false, true) : statusNameShort($row['depot_orders_status']);
if (!is_array($do_status)) {
//$stock_status = '<span class="red">'.$do_status.'</span>';
$stock_status = '<a href="?open=depot-order&id=' . $row['depot_orders_id'] . '&hidemenu=true" title="MMO product, current status is ' . $do_status . '" class="red view_webpage">' . $do_status . '</a>';
}
}
break;
case 'R':
$show_btn_inprod = true;
$stock_status = $el_link . '<abbr title="Element Stock OK, Ready for Production" class="green">OK</abbr>';
break;
case 'S':
$show_btn_insrcn = true;
$stock_status = $el_link . '<abbr title="Element Stock Need Sourcing" class="red">NS</abbr>';
break;
case 'P':
$show_btn_inprod = true;
$stock_status = $pr_link . '<abbr title="Use Finished Goods Stock" class="green">FG</abbr>';
break;
case 'D':
if (is_null($row['depot_orders_id'])) {
$stock_status = $dp_link . '<abbr title="Use Depot Stock" class="green">DS</abbr>';