function stockStatusDisplay($stock_status, $status, $products_id, $articles_id, $order_qty, $depot_order) { $el_link = '<a href="?open=products-elements-stock&products_id=' . $products_id . '&paid=' . $articles_id . '&qty=' . $order_qty . '&status=' . $stock_status . '&hidemenu=true" class="view_webpage"></a>'; $pr_link = '<a href="javascript:void();" onclick="alert($(this).siblings(\'abbr\').attr(\'title\'));"></a>'; $dp_link = '<a href="javascript:void();" onclick="alert($(this).siblings(\'abbr\').attr(\'title\'));"></a>'; $do_link = '<a href="?open=depot-order&id=' . $depot_order['depot_orders_id'] . '&hidemenu=true" class="view_webpage"></a>'; switch ($stock_status) { case '0': $stock_status_display = '<strong class="red">!</strong>'; if ($status == '8') { $do_status = statusNameShort($depot_order['status']); if (!is_array($do_status)) { $stock_status_display = $do_link . '<span class="red">' . $do_status . '</span>'; } } break; case 'R': $stock_status_display = $el_link . '<abbr title="Element Stock OK, Ready for Production" class="green">OK</abbr>'; break; case 'S': $stock_status_display = $el_link . '<abbr title="Element Stock Need Sourcing" class="red">NS</abbr>'; break; case 'P': $stock_status_display = $pr_link . '<abbr title="Use Finished Goods Stock" class="green">FG</abbr>'; break; case 'D': if (is_null($depot_order)) { $stock_status_display = $dp_link . '<abbr title="Use Depot Stock" class="green">DS</abbr>'; } else { $stock_status_display = $do_link . '<abbr title="Use Depot Stock" class="red">DS</abbr>'; } break; case 'W': $stock_status_display = $el_link . '<abbr title="Product is using Wholesale Element" class="red">WP</abbr>'; break; default: $stock_status_display = '<strong class="red">?</strong>'; } return $stock_status_display; }
mergeArticleRowsToProduct($article_rowstart, $product_row - 1); } $article_rowstart = $product_row; if (is_file($p_image)) { $img_path = thumbimage($p_image, $pi_width, $pi_height, 1, 1, DIR_WS_IMAGES . 'imagecache'); $obj_excel_draw = new PHPExcel_Worksheet_Drawing(); $obj_excel_draw->setWorksheet($obj_ws); $obj_excel_draw->setPath($img_path); $obj_excel_draw->setCoordinates('F' . $product_row); $obj_excel_draw->setOffsetX($img_offset); $obj_excel_draw->setOffsetY($img_offset); } if ($order_status == '4' && isset($prod_status) && $prod_status != '') { $current_status = statusNameProduction($prod_status, false, true); } else { $current_status = statusNameShort($order_status); } foreach ($orders_late_status as $status => $name) { if ($late_order_status == $status) { $check_status = $name; } } $pattern = "/[<][a][[:space:]][href]+/"; $need_remove_links = preg_match($pattern, $sp_name); if ($need_remove_links) { $pattern2 = "/[[:upper:]]+[-]+\\d+/"; preg_match($pattern2, $sp_name, $matches); $sp_name = $matches[0]; } $obj_ws->setCellValue('A' . $product_row, $no); $obj_ws->setCellValue('B' . $product_row, $order_detail);
$canrt = $total == 0 ? 0 : $d['C'] / $total * 100; $t['sp' . $spid] = number_format($canrt, 1) . '%<br /><small class="notice">' . $d['C'] . '/' . $total . '</small>'; } $table[] = $t; } $t = array(); $t['info'] = 'TOTAL'; foreach ($week_total as $spid => $ttl) { $canrt = $ttl == 0 ? 0 : $week_cancel[$spid] / $ttl * 100; $t['sp' . $spid] = number_format($canrt, 1) . '%<br /><small class="notice">' . $week_cancel[$spid] . '/' . $ttl . '</small>'; } $table[] = $t; $result = tep_draw_table('proman', $table, false, true); } } elseif ($_GET['week-sum'] == 'ALLPM') { $statusName = statusNameShort(); $statusGet = array(1, 2, 3, 4, 5); $daysGet = array(0, 1, 2, 3, 4, 5, 6); $daysGetMax = max($daysGet); /* //Use Import Date $q = "SELECT joi.status, count(joi.order_quantity) AS total, DATE(jo.import_date) AS rowdate"; $q .= " FROM jng_sp_orders jo"; $q .= " LEFT JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_id=jo.jng_sp_orders_id"; $q .= " WHERE joi.status<7"; $q .= " GROUP BY rowdate, joi.status"; */ $status_limit = max($statusGet); $q = "SELECT type, status, rowdate, SUM(total) AS total FROM (("; //SP TABLE (Use Confirm Date) $q .= "SELECT 'SP' AS type, joi.status, DATE(IFNULL(joi.confirm_order_time, NOW())) AS rowdate, SUM(joi.order_quantity) AS total";
function drawOrderDisplay($order_type, $order_id, $displaypart = 'ALL', $excludecurrentorderinhistory = true) { //$displaypart = 'ALL' / 'NEW' / 'HISTORY' global $class_do, $class_pm, $class_pa, $class_mc, $class_jo, $class_jc, $class_o, $sp_list; //ORDERED PRODUCTS DISPLAY SETTING $col_limit = 5; //max no of columns $row_limit = 5; //max no of rows $border = '1'; //border width $imgsize = '80'; //image size $padding = '5'; //box padding $margin = '10'; //box margin $po_limit = $col_limit * $row_limit; //max no of products - auto calc $powidth = ceil($col_limit * ($imgsize + 2 * ($border + $padding) + $margin) / 10) * 10; $total_price = 0; if ($order_type == 'SP') { use_class('jng_sp_customers_special'); $csl = new jng_sp_customers_special(); $order = $class_jo->retrieveDetail($order_id); $order_source = $sp_list[$order['jng_sp_id']]['name']; $order_products = $class_jo->retrieveItems($order_id); $customer = $class_jc->retrieveDetail(null, $order['jng_sp_id'], $order['customer_billing_id']); $list_type = $csl->getListType($customer['jng_sp_customers_id']); $cust_crown = $csl->getTypeSymbol($list_type, $customer['jng_sp_customers_id']); $customer_name = $cust_crown . $order['customer_billing_firstname'] . ' ' . $order['customer_billing_lastname']; $customer_address = $order['customer_billing_address']; if ($order['customer_billing_address2'] != '') { $customer_address .= ', ' . $order['customer_billing_address2']; } $customer_address .= ', ' . $order['customer_billing_postcode']; $customer_address .= ' ' . $order['customer_billing_city']; $customer_address .= ', ' . $order['customer_billing_country']; $products_ordered = $class_jc->retrieveOrdersItems($customer['jng_sp_customers_id']); $colname_order_id = 'jng_sp_orders_id'; $colname_items_id = 'jng_sp_orders_items_id'; $colname_order_date = 'order_date'; $colname_order_qty = 'order_quantity'; $colname_return_qty = 'return_quantity'; $colname_products_id = 'products_id'; $colname_products_code = 'article_number'; $colname_articles_id = 'products_articles_id'; $colname_custom_text1 = null; $colname_custom_text2 = null; $colname_custom_image = null; $order_history_display = null; $total_price = getTotalOrderAmount('S', $order_id); } elseif ($order_type == 'JG') { use_class('customers_special_list'); $csl = new customers_special_list(); $order = $class_o->retrieveDetail($order_id); $order_source = 'JULIE&GRACE'; $total_price = getTotalOrderAmount('J', $order_id, $order['currency']); $order_products = $class_o->retrieveProducts($order_id); //$customer = $class_mc->retrieveDetail($order['customers_id']); $list_type = $csl->getListType($order['customers_id']); $cust_crown = $csl->getTypeSymbol($list_type, $order['customers_id']); $customer_name = $cust_crown . $order['customers_name']; $customer_address = ''; if ($order['customers_company'] != '') { $customer_address .= $order['customers_company'] . ', '; } $customer_address .= $order['customers_street_address']; $customer_address .= ', ' . $order['customers_postcode']; $customer_address .= ' ' . $order['customers_city']; $customer_address .= ', ' . $order['customers_country']; $products_ordered = $class_mc->retrieveOrdersProducts($order['customers_id'], 'op.status>0'); $colname_order_id = 'orders_id'; $colname_items_id = 'orders_products_id'; $colname_order_date = 'date_purchased'; $colname_order_qty = 'products_quantity'; $colname_return_qty = 'return_quantity'; $colname_products_id = 'products_id'; $colname_products_code = 'products_model'; $colname_articles_id = 'products_articles_id'; $colname_custom_text1 = 'customers_text_line1'; $colname_custom_text2 = 'customers_text_line2'; $colname_custom_image = 'customers_image'; $order_history_display = null; } elseif ($order_type == 'DP') { $order = $class_do->retrieveDetail($order_id); $product_detail = $class_pm->retrieveDetail($order['products_id'], 'p'); $order['products_image'] = $product_detail['p']['products_image']; $order['products_model'] = $product_detail['p']['products_model']; $order['order_item_count'] = '1'; $order['order_item_total'] = '1'; $order_products = array(); $order_products[] = $order; $colname_order_id = 'depot_orders_id'; $colname_items_id = 'depot_orders_id'; $colname_order_date = 'order_date'; $colname_order_qty = 'quantity'; $colname_return_qty = ''; $colname_products_id = 'products_id'; $colname_products_code = 'products_model'; $colname_articles_id = 'articles_id'; $colname_custom_text1 = null; $colname_custom_text2 = null; $colname_custom_image = null; if ($order['trans_type'] == 'SP' || $order['trans_type'] == 'JG') { if ($order['trans_type'] == 'SP') { $item = $class_jo->retrieveItemDetail($order['trans_id']); //if ($item['jng_sp_id'] != '2') { //echo "<pre>"; //var_dump($item); //die("ttt"); if ($item['stock_status'] == '0') { $order_history_display = drawOrderDisplay($order['trans_type'], $item['jng_sp_orders_id'], 'HISTORY', false); } $total_price = getTotalOrderAmount('S', $item['jng_sp_orders_id']); //} } else { //die("test"); $item = $class_o->retrieveProductDetail($order['trans_id']); $total_price = getTotalOrderAmount('J', $item['orders_id']); if ($item['stock_status'] == '0') { $order_history_display = drawOrderDisplay($order['trans_type'], $item['orders_id'], 'HISTORY', false); } } } } $result = ''; if ($displaypart == 'ALL' || $displaypart == 'NEW') { //NEW ORDER $result .= '<h2 style="position:fixed;top:0;left:0;line-height:20px;width:480px;padding:5px 10px;background:#ccc;border-right:1px inset #666;">New ' . $order_type . ' Order ' . $order_id . ' (' . $total_price . ')</h2>'; //$result .= '<div style="position:fixed;top:30;bottom:0;left:0;width:480px;padding:10px;background:#efefef;border-right:1px inset #666;overflow:auto;">'; $result .= '<div id="box-order-items" style="position:fixed;top:30;bottom:0;height:93%;left:0;width:480px;padding:10px;background:#efefef;border-right:1px inset #666;overflow:auto;">'; $neworder = array(); $no = array(); $no['l'] = 'No'; $no['d'] = 'Image'; $no['t2'] = 'Info'; $no['q'] = 'Order<br/>Qty.'; $no['r'] = 'Stock Status<br /> and Actions'; $neworder[] = $no; foreach ($order_products as $op) { if ($op[$colname_articles_id] > 0) { $article = $class_pa->retrieveDetail($op[$colname_articles_id]); $prolength = $article['length']; } else { $product_detail = $class_pm->retrieveDetail($op[$colname_products_id], 'pnc'); $prolength = $product_detail['pnc']['products_length']; } $customize_info = ''; if (!is_null($colname_custom_text1) && !is_null($colname_custom_text2)) { if ($op[$colname_custom_text1] != '' || $op[$colname_custom_text2] != '') { $customize_info .= '<div style="margin-top:10px;">'; if ($op[$colname_custom_text1] != '') { $customize_info .= $op[$colname_custom_text1]; } if ($op[$colname_custom_text2] != '') { $customize_info .= '<br />' . $op[$colname_custom_text2]; } $customize_info .= '</div>'; } } if (!is_null($colname_custom_image) && $op[$colname_custom_image] != '') { $customize_info .= webImage($op[$colname_custom_image], '80', '80', 'Custom Image'); } $length_text = $prolength > 0 ? 'Length: ' . textLength($prolength) : '<span class="notice">No Length</span>'; //$tooltip_data = getTooltipThumbData($op[$colname_products_id], $op[$colname_articles_id], 0); $pdata = $class_pm->retrieveDetail($op[$colname_products_id], 'pl,sp'); $tooltip_text = '<table class="tiny" border="0" cellpadding="0" cellspacing="0" align="center">'; $tooltip_text .= '<tr><td width="80" title="Sold Last 30 Days">Sold L30D</td><td>' . intval($pdata['pl']['sold_monthly_1']) . ' products</td></tr>'; $tooltip_text .= '<tr><td>Total sold</td><td>' . intval($pdata['sp']['0']['total_sold']) . ' products</td></tr>'; $tooltip_text .= '<tr><td>Return Rate</td><td>' . number_format($pdata['sp']['0']['returned_rate'], 1) . '%</td></tr>'; $tooltip_text .= '<tr><td>Product Age</td><td>' . $pdata['sp']['0']['active_age'] . ' days</td></tr>'; $tooltip_text .= '</table>'; $info = array(); //var_dump($order_type); $info[] = $order_type . '-' . $op[$colname_items_id]; $info[] = $op['products_ean']; $info[] = $op[$colname_products_id] . ' / ' . $op[$colname_products_code]; $info[] = $length_text; $info[] = ' '; $info[] = '<strong>All SP Summary</strong>'; $info[] = $tooltip_text; $action_hidden = '<input type="hidden" id="' . $order_type . '-' . $op[$colname_items_id] . '" name="oiid" value="' . $op[$colname_items_id] . '" />'; $action_hidden .= '<input type="hidden" name="type" value="' . $order_type . '" />'; $action = array(); $action[] = stockStatusDisplay($op['stock_status'], $op['status'], $op[$colname_products_id], $op[$colname_articles_id], $op[$colname_order_qty], null); $action[] = ' '; if ($op['stock_status'] == 'S') { $action[] = '<input type="button" name="2" value="» Sourcing" class="bl green" />'; } elseif ($op['stock_status'] == 'R' || $op['stock_status'] == 'P' || $op['stock_status'] == 'W') { $action[] = '<input type="button" name="3" value="» Ready" class="bl green" />'; //$action[] = '<input type="button" name="test" value="» Sourcing" class="bl red" />'; } $action[] = '<input type="button" name="10" value="× Cancel" class="bl red" />'; $no = array(); $no['l'] = $op['order_item_count'] . '/' . $op['order_item_total']; $no['d'] = webImage($op['products_image'], '80', '80', 'Product Image') . $customize_info; $no['t2'] = implode('<br />', $info); if (isset($op['order_quantity'])) { $order_quantity = $op['order_quantity']; } elseif (isset($op['products_quantity'])) { $order_quantity = $op['products_quantity']; } else { $order_quantity = $op['quantity']; } $no['q'] = $order_quantity; $no['r'] = $action_hidden . implode('<br />', $action); $neworder[] = $no; } $result .= tep_draw_table('spo', $neworder); $result .= '<div class="buttons"><input type="button" name="nextorder" value="Next Order" class="button" /></div>'; $result .= '</div>'; //NEW ORDER - CLOSER } if (!is_null($order_history_display)) { $result .= $order_history_display; } elseif ($displaypart == 'ALL' || $displaypart == 'HISTORY') { $result .= '<div style="margin-left:510px;color:#666;" >'; //HISTORICAL INFO if ($order_type == 'DP') { $result .= '<h2>DEPOT ' . ($order['trans_type'] == 'AR' ? 'REFILL' : 'MANUAL ORDER') . '</h2>'; } else { //var_dump($order_type); $result .= '<h2>Customer Detail</h2>'; // $result .= '<table border="0" cellpadding="0" cellspacing="0">'; // $result .= '<tr><td width="150">Customer From</td><td>'.$order_source.'</td></tr>'; // $result .= '<tr><td>Customer Name</td><td>'.$customer_name.'</td></tr>'; // $result .= '<tr><td>Customer Address</td><td>'.$customer_address.'</td></tr>'; // $result .= '<tr><td></td><td></td></tr>'; // $result .= '</table>'; $result .= '<div class="bold">' . $order_source . '</div>'; $result .= '<div>' . $customer_name . '</div>'; $result .= '<div>' . $customer_address . '</div>'; $result .= '<div> </div>'; $orders_collection = array(); $products_ordered_total = 0; $products_returned_total = 0; $products_canceled_total = 0; $products_inprocess_total = 0; foreach ($products_ordered as $pok => $pov) { if ($excludecurrentorderinhistory && $pov[$colname_order_id] == $order[$colname_order_id]) { unset($products_ordered[$pok]); } else { if (!in_array($pov[$colname_order_id], $orders_collection)) { $orders_collection[] = $pov[$colname_order_id]; } $products_ordered_total += $pov[$colname_order_qty]; $products_returned_total += $pov[$colname_return_qty]; if (statusIsCancelled($pov['status'])) { $products_canceled_total += $pov[$colname_order_qty]; } if ($pov['status'] < 9) { $products_inprocess_total += $pov[$colname_order_qty]; } } } $result .= '<h2>Customer Historical Info</h2>'; if ($products_ordered_total > 0) { $products_success_total = $products_ordered_total - ($products_inprocess_total + $products_canceled_total); $return_rate = $products_returned_total == 0 ? 0 : $products_returned_total / $products_success_total * 100; $process_class = $products_inprocess_total > 0 ? 'red' : 'green'; $success_class = $products_success_total > 0 ? 'green' : 'red'; $return_class = $products_returned_total > 0 ? 'red' : 'green'; $return_rate_class = $return_rate <= 10 ? 'green' : 'red'; $prevtext = $excludecurrentorderinhistory ? 'Previous' : ''; $result .= '<h3>» Customer ' . $prevtext . ' Orders Total = ' . count($orders_collection) . '</h3>'; $result .= '<h3>» Ordered Products Total = ' . $products_ordered_total . '</h3>'; $result .= '<h3>» Ordered Products Canceled = ' . $products_canceled_total . '</h3>'; $result .= '<h3 class="' . $process_class . '">» Ordered Products in Progress = ' . $products_inprocess_total . '</h3>'; $result .= '<h3 class="' . $success_class . '">» Ordered Products Received = ' . $products_success_total . '</h3>'; $result .= '<h3 class="' . $return_class . '">» Ordered Products Returns = ' . $products_returned_total . '</h3>'; $result .= '<h3 class="' . $return_rate_class . '">» Customer Return Rate = ' . number_format($return_rate, 1) . '%</h3>'; $result .= '<h3>» Recent Ordered Products List (Showing Max ' . $po_limit . ' Products): ' . '</h3>'; $result .= '<div style="width:' . $powidth . 'px;">'; $pocount = 0; foreach ($products_ordered as $po) { $pocount++; if ($pocount <= $po_limit) { if ($po[$colname_articles_id] > 0) { $article = $class_pa->retrieveDetail($po[$colname_articles_id]); $prolength = $article['length']; } else { $product_detail = $class_pm->retrieveDetail($po[$colname_products_id], 'pnc'); $prolength = $product_detail['pnc']['products_length']; } $length_text = $prolength > 0 ? textLength($prolength) : '<span class="notice">No Length</span>'; $status = $po['status'] == '8' ? modeName($po['mode']) : statusNameShort($po['status'], true); $status_class = $po['status'] < 9 ? 'red' : 'notice'; $qty_class = statusIsCancelled($po['status']) > 0 ? 'notice' : 'green'; $result .= '<div style="float:left;border:' . $border . 'px solid #ccc;text-align:center;margin:0 ' . $margin . 'px ' . $margin . 'px 0;padding:' . $padding . 'px;">'; $result .= webImage($po['products_image'], $imgsize, $imgsize); $result .= '<br />'; $result .= $length_text; $result .= '<br />'; $result .= '<span title="Order Date">' . date('d.m.Y', strtotime($po[$colname_order_date])) . '</span>'; $result .= '<br />'; $result .= '<span class="' . $status_class . '" title="Current Status">' . $status . '</span>'; $result .= '<br />'; $result .= '<strong class="' . $qty_class . '" title="Order Quantity">+' . intval($po[$colname_order_qty]) . '</strong>'; $result .= ' '; $returns = intval($po[$colname_return_qty]); $retclas = $returns > 0 ? 'red' : 'notice'; $result .= '<strong class="' . $retclas . '" title="Return Quantity">-' . $returns . '</strong>'; $result .= '</div>'; } } $result .= '</div>'; $result .= '<div style="clear:both;"> </div>'; } else { $result .= '<h3>» No Order Historical info, a New Customer</h3>'; } } $result .= '</div>'; //HISTORICAL INFO - CLOSER } return $result; }
} $late_orders .= '<td style="text-align:center;">' . $order_detail . '</td>'; $late_orders .= '<td style="text-align:center;">' . displayDuration(strtotime('now') - strtotime($row['leadtime_start_date']), 'day', 1) . '</td>'; if ($row['type'] == 'SP') { $late_orders .= '<td style="text-align:center;">' . $row['sp_name'] . '</td>'; } elseif ($row['type'] == 'DP') { $late_orders .= '<td style="text-align:center;">' . $class_do->translateOrderSource($row['trans_type'], $row['trans_id'], true, null, $row['products_id']) . '</td>'; } else { $late_orders .= '<td style="text-align:center;">JG</td>'; } $late_orders .= '<td style="text-align:center;">' . $row['customers_name'] . '</td>'; $late_orders .= '<td style="text-align:center;"><div>' . webImage($row['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Product ' . $row['products_id'], 'img-border') . '</div><a title="View product detail" target="_blank" href="?open=product-detail&products_id=' . $row['products_id'] . '" class="view_webpage">' . $row['products_id'] . '</a></td>'; if ($order_status == '4' && isset($prod_status) && $prod_status != '') { $late_orders .= '<td style="text-align:center;">' . statusNameProduction($prod_status, false, true) . '</td>'; } else { $late_orders .= '<td style="text-align:center;">' . statusNameShort($order_status) . '</td>'; } $status_dropdown = '<select class="order_late_status">' . loadComboListFromArray($orders_late_status, null, $late_order_status, false) . '</select>'; $status_dropdown .= '<input type="hidden" id="opid-' . $row['order_items_id'] . '" name="op_id" value="' . $row['order_items_id'] . '" />'; $late_orders .= '<td style="text-align:center;">' . $status_dropdown . '</td>'; $late_orders .= '<td style="text-align:center;"><input type="hidden" id="opid-issue-' . $row['order_items_id'] . '" name="op_id" value="' . $row['order_items_id'] . '" /><textarea class="issue_text" style="width:200px;height:100px;">' . $row['issue'] . '</textarea></td>'; $late_orders .= "</tr>"; if (strtotime($row['reported_date']) != $current_date) { $late_orders .= "</tbody>"; $late_orders .= "</table></div><br>"; } } $late_orders .= '<input type="text" id="order-item-ids" style="display:none;" value="' . implode(',', $order_item_ids) . '" />'; } else { $late_orders .= '<h3 class="red">No Orders Late</h3>'; }
echo utf8_encode($result); exit; } elseif ($_GET['me_action'] == 'LEADTIMESHOWPOPUP') { $row_id = tep_db_prepare_input($_GET['rowid']); list($order_type, $orders_id, $orders_items_id, $row_template) = explode('-', $row_id); $result = $class_om->renderLeadtimePopup($order_type, $orders_items_id); echo $result; exit; } //== END AJAX =========================== //== BEGIN TEMPLATE ===================== //VARS PREPARATION //Order type vars $is_order_type_show_all = $order_type_selected == OrderManagement::ORDER_TYPE_ALL; //Status vars $status_name_collection = statusNameShort(); $status_use_subtab = array('4'); $is_display_subtab = count(array_intersect($status_use_subtab, $status_displayed)) > 0; $main_link = '?open=orders-management&status='; //TOP BUTTONS $content .= '<div style="margin-bottom:20px;text-align:left;">'; //$content .= '<input type="button" id="togglethumbs" value="Toggle Product Thumbnails" title="Show or hide product thumbnails for each items" />'; //$content .= '<input type="button" id="showelements" value="Show Used Elements" title="Show all elements used by all products in current Status Tab" />'; $content .= '<input type="button" id="btn-reload-tab" value="Reload Tab" title="Reload Current Tab" />'; $content .= '<span><a href="?open=elements-picking-list&hidemenu=true" class="view_webpage"></a><input type="button" id="showpickinglist" value="Elements Pick List" title="Print Elements Pick List for Sourcing (J&G and SP orders)" /></span>'; $content .= '<span><a href="?open=outsourcing-overview&hidemenu=true" class="view_webpage"></a><input type="button" id="outsourcingoview" value="Outsourcing Overview" title="Amazon orders outsourcing products overview" /></span>'; $content .= $additional_action_button; $content .= '</div>'; $content .= '<div id="items-elements" style="display:none;"></div>'; //MAIN TABS $content .= '<div id="tab-orders">';
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) { $action = '<span class="red">Cancel Notification Sent</span>'; } else { $action = '<span class="blue">Reminder Sent</span>'; } } } } else { use_class('depot_orders'); $class_do = new depot_orders(); //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['update_time']; //self::ROW_DATA_CUSTOMER_OR_ORDER_NO DATA $order_id = ''; $customer_name = $order_item_data['customer_name']; $depot_orders_info = $class_do->translateOrderSource($order_item_data['trans_type'], $order_item_data['trans_id'], true, null, $products_id); $cust_name = $customer_name; if ($depot_orders_info != '') { $cust_name = $cust_name . ($cust_name != '' ? " <br/>{$depot_orders_info}" : $depot_orders_info); if ($order_item_data['group_name'] != '') { $cust_name .= ': ' . $order_item_data['group_name']; } } //self::ROW_DATA_ORDER_ID DATA $source_name = 'DP'; $barcode_id = strtoupper(self::ORDER_TYPE_DP) . '-' . $order_item_data['depot_orders_id']; $barcode_id_link = '?open=depot-order&id=' . $order_item_data['depot_orders_id'] . '&hidemenu=true'; //self::ROW_DATA_ARTICLE_NO DATA $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['quantity']; //self::ROW_DATA_MARGIN DATA $product_margin = ''; } //FIRST ROW OF ORDER if ($is_order_first_row) { $crown_img_col = array('V' => 'vip', 'B' => 'black'); if ($order_item_data['list_type'] != '' && array_key_exists($order_item_data['list_type'], $crown_img_col)) { $crown_img_title = array('V' => 'VIP Customer', 'B' => 'Blacklist Customer'); $crown_img = '<a href="' . $crown_link . '" class="view_webpage">'; $crown_img .= '<img src="images/list-' . $crown_img_col[$order_item_data['list_type']] . '.gif" title="' . $crown_img_title[$order_item_data['list_type']] . '" />'; $crown_img .= '</a> '; $cust_crown = $crown_img; } else { $cust_crown = ''; } $cust_order_count = ' <sup>' . $order_item_data['customers_order_count'] . '</sup>'; if ($orders_number == '' || is_null($orders_number)) { $order_no = ''; } else { $order_no = '<br /><small>order no:</small> <a href="' . $order_no_link . '" class="view_webpage">' . $order_id . '</a>'; } $row_data[self::ROW_DATA_CUSTOMER_OR_ORDER_NO] = $cust_crown . $cust_name . $cust_order_count . $order_no; $row_data[self::ROW_DATA_SOURCE] = strtoupper($source_name); } $row_data[self::ROW_DATA_LEADTIME_OR_DATE] = $is_unpaid_prepayment || $this->filters_status > 9 ? date('d-M-y', strtotime($order_date)) : displayLeadTime($order_item_data['leadtime_start_date'], strtotime($order_item_data['leadtime_start_date'])); if ($this->filters_status == 1 && $order_item_data['update_time'] == '') { $order_item_data['update_time'] = $order_item_data['leadtime_start_date']; } $row_data[self::ROW_DATA_CYCLETIME] = displayCycleTime($previous_status_date); $row_data[self::ROW_DATA_ORDER_ID] = '<a href="' . $barcode_id_link . '" class="view_webpage">' . $barcode_id . '</a>' . ($order_item_data['order_item_total'] > 1 ? ' <sup>' . $order_item_data['order_item_count'] . '/' . $order_item_data['order_item_total'] . '</sup>' : ''); $row_data[self::ROW_DATA_ARTICLE_NO] = '<div class="thumb" thumbid="' . $product_image_thumbid . '">' . '<span>' . $product_image . '</span></div>' . '<div><a href="' . $article_no_link . '" target="_blank&hidemenu=true" title="View Product Detail" ' . 'class="view_webpage">' . $article_no . '</a></div>'; $row_data[self::ROW_DATA_PRICE] = number_format($products_price, 2); $order_quantity = intval($order_quantity); $row_data[self::ROW_DATA_QUANTITY] = $order_quantity; $row_data[self::ROW_DATA_MARGIN] = $product_margin; $el_link = '<a href="?open=products-elements-stock&products_id=' . $products_id . '&paid=' . $articles_id . '&qty=' . $order_quantity . '&status=' . $order_item_data['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>'; if ($this->filters_show_stock_status) { switch ($order_item_data['stock_status']) { case '0': $stock_status = '<strong class="red">!</strong>'; if ($this->filters_status == 8 && ($order_type == self::ORDER_TYPE_SP || $order_type == self::ORDER_TYPE_JG)) { $do_status = $order_item_data['depot_orders_status'] == '4' && isset($order_item_data['depot_orders_prod_status']) && $order_item_data['depot_orders_prod_status'] != '' ? statusNameProduction($order_item_data['depot_orders_prod_status'], false, true) : statusNameShort($order_item_data['depot_orders_status']); if (!is_array($do_status)) { $stock_status = '<a href="?open=depot-order&id=' . $order_item_data['depot_orders_id'] . '&hidemenu=true" ' . 'title="MMO product, current status is ' . $do_status . '" class="red view_webpage">' . $do_status . '</a>'; } } break; case 'R': $stock_status = $el_link . '<abbr title="Element Stock OK, Ready for Production" class="green">OK</abbr>'; break; case 'S': $stock_status = $el_link . '<abbr title="Element Stock Need Sourcing" class="red">NS</abbr>'; break; case 'P': $stock_status = $pr_link . '<abbr title="Use Finished Goods Stock" class="green">FG</abbr>'; break; case 'D': if (is_null($order_item_data['depot_orders_id'])) { $stock_status = $dp_link . '<abbr title="Use Depot Stock" class="green">DS</abbr>'; } else { $stock_status = '<a href="?open=depot-order&id=' . $order_item_data['depot_orders_id'] . '&hidemenu=true" class="green view_webpage">DS</a>'; } break; case 'W': $stock_status = $el_link . '<abbr title="Product is using Wholesale Element" class="red">WP</abbr>'; break; default: $stock_status = '<strong class="red">?</strong>'; } $row_data[self::ROW_DATA_STOCK] = $stock_status; } if ($this->filters_status == 3) { $row_data[self::ROW_DATA_PRINTED] = $order_item_data['print_count'] > 0 ? '<img title="Printed ' . $order_item_data['print_count'] . ' time(s)" src="images/icon-tick.png">' : '<img title="Not yet printed" src="images/icon-tick-dis.png">'; $row_data[self::ROW_DATA_SCANNED] = $order_item_data['print_confirmed'] > 0 ? '<img title="Scanned ' . $order_item_data['print_confirmed'] . ' time(s)" src="images/icon-tick.png">' : '<img title="Not yet scanned" src="images/icon-tick-dis.png">'; } //TODO: DEFINE ACTION BUTTON BASED ON SELECTED TAB $row_data[self::ROW_DATA_ACTION] = $action; if ($this->filters_status == 4 && in_array($this->filters_sub_status[0], $this->PROD_SUBSTATUS_USE_LINE)) { $row_data[self::ROW_DATA_STATUS] = strtoupper(statusNameProduction($order_item_data['prod_status'], true)); } //FILL DATA INTO ROW TEMPLATE $row = $this->getRowTemplate($template_row, false, $row_data); $result = ''; if (count($row) > 0) { foreach ($row as $c => $r) { $result .= '<td class="' . $c . '">' . $r . '</td>'; } } return $result; }
function productStatusNameShort($status = null) { return statusNameShort($status); }
function statusNameShort() { return statusNameShort(); }
function statusNameShort($status = null) { return statusNameShort($status); }