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 manageOrderList($status, $dpo_option = 'ALL', $dpo_group = '', $ean_list = '', $date_start = null, $date_end = null, $brand_id = null, $cat_id = null) { global $PROD_SUBSTATUS_USE_LINE; $show_stock_status = $status == '1' || $status == '2' || $status == '3' || $status == '4'; $depot_orders = $this->retrieveOrders($status, $dpo_option, $dpo_group, $ean_list, $date_start, $date_end, $brand_id, $cat_id); $orders_items = $this->translateOrdersForSP($depot_orders); list($status, $sub_status) = explode('-', $status); $orders = array(); $filter_date_shown = $status > 7 ? 'Date' : 'Started Date'; $result = $this->manageOrderList_drawFilter($dpo_option, $dpo_group, $ean_list, $date_start, $date_end, $brand_id, $cat_id); if (count($orders_items) > 0) { if ($status == '7') { //Info how depot orders closed in Sent to HH Tab $result .= '<div class="sop-box ui-corner-all">'; $result .= '<h3>How Depot Orders in "Sent to HH" tab is closed</h3>'; $result .= '<ol>'; $result .= '<li>Depot orders 1 qty is closed automatically with bin ins of EAN</li>'; $result .= '<li>Outsourcing Depot Orders is closed automatically with bin ins of Order ID'; $result .= '<li>Depot orders > 1 qty is closed automatically by cron'; $result .= '<li>In a special case cron might not be able to close it ' . '<br/>(e.g. Depot order 3 qty is open, 3 qty is binned in, 2 other depot orders ' . '1 qty is closed instead with bin ins, leaving only 1 bin in qty open and ' . 'can not be used to close the Depot order 3 qty)'; $result .= '</ol>'; $result .= '</div>'; $result .= '<div style="clear:both;"> </div>'; } $class_pm = new products_minierp(); $header = array(); //$header['d'] = (($status < 2) OR ($status > 7)) ? 'Date' : 'Lead Time'; $header['d'] = $status > 7 ? 'Date' : 'Lead Time'; $header['d2'] = 'Cycle Time'; $header['c'] = 'Segment'; $header['o'] = 'Order ID'; $header['e'] = 'Order Source'; $header['a'] = 'Article No'; $header['p'] = 'Price'; $header['q'] = 'Qty'; if ($show_stock_status) { $header['s'] = 'Stock'; } if ($status == '3') { $header['pc1'] = '<abbr title="PI has been sent to PRINTER by MC">P</abbr>'; $header['pc2'] = '<abbr title="PI has been SCANNED for EAN label in MC">S</abbr>'; } $sub_status = trim($sub_status); $sub_prod_show_line_only = in_array($sub_status[0], $PROD_SUBSTATUS_USE_LINE); if ($status == '4' && $sub_prod_show_line_only) { $header['g'] = 'Status'; } $header['t'] = 'Action'; $timestamp = date('Y-m-d H:i:s'); $order_pi_print_count = array(); $order_pi_unscanned = array(); //echo "<pre>";var_dump($orders_items);die(); foreach ($orders_items as $row) { $oid = $row['jng_sp_orders_items_id']; $products_id = $row['products_id']; $articles_id = $row['products_articles_id']; $is_outsourced = $this->isOutsourceOrder($row['trans_type'], $row['trans_id']); $order_pi_print_count[$oid] = $row['print_count']; $order_pi_unscanned[$oid] = $row['print_confirmed']; $obj_product = new Product($products_id); $o = array(); /* COMMENT THIS, SO WE GRAB prod_target_in DIRECTLY ON $this->retrieveOrders, SO IT WOULD BE POSSIBLE SORTED BY prod_target_in if ($row['trans_type'] == 'SP') { $qTemp = "SELECT prod_target_in FROM jng_sp_orders_items "; $qTemp .= " WHERE jng_sp_orders_items_id = ".$row['trans_id']; $rowTemp = tep_db_fetch_array(tep_db_query($qTemp)); $prod_target_in = $rowTemp['prod_target_in']; } elseif ($row['trans_type'] == 'JG') { $qTemp = "SELECT prod_target_in FROM orders_products "; $qTemp .= " WHERE orders_products_id = ".$row['trans_id']; $rowTemp = tep_db_fetch_array(tep_db_query($qTemp)); $prod_target_in = $rowTemp['prod_target_in']; } else { $prod_target_in = $row['prod_target_in']; } */ /* $prod_target_in = $row['prod_target_in']; $date_used = ($status < 3) ? strtotime($row['update_time']) : strtotime($prod_target_in); if (($status < 2) OR ($status > 7)) { $value_date = date('d-M-y', strtotime($row['order_date'])); } else { $value_date = displayLeadTime($prod_target_in, $date_used); } $o['d'] = $value_date; */ $o['d'] = $status > 7 ? date('d-M-y', strtotime($row['order_date'])) : displayLeadTime($row['leadtime_start_date'], strtotime($row['leadtime_start_date'])); if ($status == 1 && $row['update_time'] == '') { $row['update_time'] = $row['leadtime_start_date']; } $previous_status_date = $status == 4 ? $row['status_date_prod'] : $row['update_time']; $o['d2'] = displayCycleTime($previous_status_date); $o['c'] = $row['customer_name']; $o['o'] = '<a href="?open=depot-order&id=' . $oid . '&hidemenu=true" class="view_webpage">DP-' . $oid . '</a>'; $o['e'] = $this->translateOrderSource($row['trans_type'], $row['trans_id'], true, null, $row['products_id']); $article = '<div><a href="?open=product-detail&products_id=' . $products_id . '" target="_blank" title="View Product Detail">' . $row['article_number'] . '</a></div>'; $pimg = webImageSource($row['products_image'], '500'); if ($pimg != '') { //$thumb_title = $row['article_number']; // $thumb_title = displayTooltipThumb($row); $thumb = '<div class="thumb" thumbid="' . "{$products_id}-{$articles_id}" . '"><a href="' . $pimg . '" class="view_image" title="' . $thumb_title . '">' . webImage($row['products_image'], '80', '80', '', 'img-border img-padding') . '</a></div>'; $article = $thumb . $article; } //$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, '', ' '); $icons = $gold_icon . $diamond_icon; $o['a'] = drawTableArticleInfoWithIcons($article, $icons); $o['p'] = $row['price']; $qty = intval($row['order_quantity']); $o['q'] = $qty; // $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=' . $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>'; switch ($row['stock_status']) { case '0': $stock_status = '<strong class="red">!</strong>'; 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 'W': $stock_status = $el_link . '<abbr title="Product is using Wholesale Element" class="red">WP</abbr>'; break; default: $stock_status = '<strong class="red">?</strong>'; } if ($show_stock_status) { $o['s'] = $stock_status; } if ($status == '3') { $o['pc1'] = $row['print_count'] > 0 ? '<img title="Printed ' . $row['print_count'] . ' time(s)" src="images/icon-tick.png">' : '<img title="Not yet printed" src="images/icon-tick-dis.png">'; $o['pc2'] = $row['print_confirmed'] > 0 ? '<img title="Scanned ' . $row['print_confirmed'] . ' time(s)" src="images/icon-tick.png">' : '<img title="Not yet scanned" src="images/icon-tick-dis.png">'; } if ($status == '4' && $sub_prod_show_line_only) { $o['g'] = isset($row['prod_status']) && $row['prod_status'] != '' ? strtoupper(statusNameProduction($row['prod_status'], true)) : ''; } $action = ''; $disabled = 'disabled="disabled"'; if ($row['status'] == '1') { //19112010 : DEWA add Ready and Sourcing button if ($row['stock_status'] == 'R' || $row['stock_status'] == 'P' || $row['stock_status'] == 'W') { $action .= '<input type="button" class="actbtn green" name="3" value="Ready" title="Set to Ready for Production" />'; } elseif ($row['stock_status'] == 'S') { $action .= '<input type="button" class="actbtn red" name="2" value="Sourcing" title="Set to In Sourcing" />'; } $action .= '<input type="button" class="actbtn" name="10" value="Cancel" title="Cancel this product" />'; } if ($row['status'] == '2') { if ($row['stock_status'] != 'S') { $action .= '<input type="button" class="actbtn" name="3" value="Ready" title="Set to Ready for Production" />'; } $action .= '<input type="button" class="actbtn" name="10" value="Cancel" title="Cancel this product" />'; } if ($row['status'] == '3') { $action .= '<input type="hidden" name="oi_id_cols" value="' . $row['jng_sp_orders_items_id'] . '" />'; if ($is_outsourced) { $action .= '<input type="button" class="actbtn" name="22" value="Outsourcing PI" title="Print PI and move to Outsourcing" />'; } else { $action .= '<input type="button" class="actbtn" name="printpi" value="Print PI" title="Print Production Instruction" />'; $action .= '<input type="button" class="actbtn" name="2" value="S" title="Set to In Sourcing" />'; } $action .= '<input type="button" class="actbtn" name="10" value="C" title="Cancel this product" />'; } if ($row['status'] == '4' || $row['status'] == '22') { if ($row['status'] == '4') { $action .= '<input type="button" class="actbtn" name="5" value="Finish" title="Set to Finish" />'; } if ($row['status'] == '22') { $action .= '<input type="button" class="actbtn" name="7" value="to HH" title="Set as Sent to HH" />'; } $action .= '<input type="button" class="actbtn" name="' . $row['status'] . '" value="PI" title="Reprint Production Instruction" />'; if (!$is_outsourced) { $action .= '<input type="button" class="actbtn" name="2" value="S" title="Set to In Sourcing" />'; } $action .= '<input type="button" class="actbtn" name="10" value="C" title="Cancel this product" />'; $prod_sub_status = getProductionSubStatus(4); if (count($prod_sub_status) > 0) { $action .= '<br/>'; } foreach ($prod_sub_status as $pss => $pss_name) { if (in_array($pss, $PROD_SUBSTATUS_USE_LINE)) { continue; } if ($pss == $sub_status[0]) { continue; } $action .= '<input type="button" class="actbtn" name="4-' . $pss . '" value="' . $pss . '" title="Moved to ' . $pss_name . '" />'; } } if ($row['status'] == '5') { //$action .= '<input type="button" class="actbtn" name="6" value="Package" title="Add to Selected Package" '.((!$packages_exist) ? 'style="display:none;"' : '').'/>'; if (!$is_outsourced) { $action .= '<input type="button" class="actbtn" name="4-P" value="Prod" title="Set back to Production" />'; } else { $action .= '<input type="button" class="actbtn" name="22" value="Outsourcing" title="Move back to Outsourcing" />'; } //$action .= '<input type="button" class="actbtn" name="10" value="C" title="Cancel this product" />'; //activate this only when needed. } if ($row['status'] == '7' && $row['trans_type'] == '') { $action .= '<input type="button" class="actbtn" name="8" value="Received" title="Received in HH" />'; } //Default Row Action Value (id, status, stock status) $action .= '<input type="hidden" id="oiid-' . $row['jng_sp_orders_items_id'] . '" name="oi_id" value="' . $row['jng_sp_orders_items_id'] . '" >'; $action .= '<input type="hidden" name="oi_status" value="' . $row['status'] . '" >'; $action .= '<input type="hidden" name="csl_type" value="' . $row['list_type'] . '" />'; if ($show_stock_status) { $action .= '<input type="hidden" name="oi_stock_status" value="' . $row['stock_status'] . '" >'; } $o['t'] = $action; $orders[$row['jng_sp_orders_items_id']] = $o; } $buttons = ''; switch ($status) { case '1': //hide by request of markus so pic must check line by line //if ($show_btn_inprod && $show_btn_insrcn) $buttons .= '<input type="button" class="grpbtn button" name="stockstatusall" value="Set ALL" title="Set all product status according to the stock status" />'; //if ($show_btn_insrcn) $buttons .= '<input type="button" class="grpbtn button" name="stockstatusns" value="Set all NS to Sourcing" title="Set all product with status NS to In Sourcing" />'; //hide by request of markus so pic must check line by line //if ($show_btn_inprod && $show_btn_insrcn) $buttons .= '<input type="button" class="grpbtn button" name="stockstatusall" value="Set ALL" title="Set all product status according to the stock status" />'; //if ($show_btn_insrcn) $buttons .= '<input type="button" class="grpbtn button" name="stockstatusns" value="Set all NS to Sourcing" title="Set all product with status NS to In Sourcing" />'; case '2': //hide by request of markus so pic must check line by line //if ($show_btn_inprod) $buttons .= '<input type="button" class="grpbtn button" name="stockstatusok" value="Set all OK/FG to Ready" title="Set all product with status OK/FG to Ready for Production" />'; break; case '3': //hide due to printing PI is now done per order //$buttons .= 'Product Amount: <input type="text" class="iwbutton" id="pi_print_amount" name="ppa" value="10" title="Set number of products to print" style="width:50px;text-align=center;" />'; //$buttons .= ' <input type="button" class="grpbtn button" name="printmultpi" value="Print PI and set to Production" title="Print Production Instruction of a set number of products" />'; //$buttons .= '<input type="button" class="grpbtn button" name="togglehideoi" value="Toggle Printed" title="Show or hide already printed items" />'; $buttons .= '<div>'; $buttons .= '<input type="button" id="btn-reprint-pi-now" class="button help" value="REPRINT NOW for All Already Printed, Unscanned PI (0)" title="Reprint automatically NOW for all PI which<br/><strong>Already printed but not EAN scanned yet</strong>"/> '; $buttons .= '<input type="button" id="btn-reprint-pi-nextbatch" class="button help" value="REPRINT ON NEXT BATCH for All Already Printed, Unscanned PI (0)" title="Reprint ON NEXT BATCH print PI for all PI which<br/><strong>Already printed but not EAN scanned yet</strong>"/><br/><br/>'; $buttons .= '</div>'; $buttons .= '<table class="form" border="0" cellpadding="0" cellspacing="0"><tr>'; $buttons .= '<td class="bold">Show Products</td>'; $buttons .= '<td style="padding-left:30px;"><input id="rb-orf-2" type="radio" class="readyfilter" name="readyfilter" value="2"/></td>'; $buttons .= '<td><label for="rb-orf-2">Unprinted <span id="orfc-up">(0)</span></label></td>'; //$buttons .= '<td style="padding-left:30px;"><input id="rb-orf-1" type="radio" class="readyfilter" name="readyfilter" value="1" /></td>'; //$buttons .= '<td><label for="rb-orf-1">Ready to be printed <span id="orfc-rp">(0)</span></label></td>'; $buttons .= '<td style="padding-left:30px;"><input id="rb-orf-4" type="radio" class="readyfilter" name="readyfilter" value="4" /></td>'; $buttons .= '<td><label for="rb-orf-4">Already Printed <span id="orfc-ap">(0)</span></label></td>'; $buttons .= '<td style="padding-left:30px;"><input id="rb-orf-5" type="radio" class="readyfilter" name="readyfilter" value="5" /></td>'; $buttons .= '<td><label for="rb-orf-5">Already Printed, Unscanned <span id="orfc-apun">(0)</span></label></td>'; $buttons .= '<td style="padding-left:30px;"><input id="rb-orf-3" type="radio" class="readyfilter" name="readyfilter" value="3" checked="checked" /></td>'; $buttons .= '<td><label class="bold" for="rb-orf-3">All <span id="orfc-al">(0)</span></label></td>'; $buttons .= '</tr></table>'; break; case '5': $jp_mb = new messagebox(); $jp_mb->add('Package Management is prohibited here, please <a href="?open=packaging" class="bold">click here and use module Packaging Process</a>'); $buttons = $jp_mb->build(); break; } $barcode_rule1 = $status == 3; $barcode_rule2 = $status == 4; //$barcode_rule2 = ($status==5 && $jng_sp_id!='0'); if ($barcode_rule1 || $barcode_rule2) { $style = $status == 5 && !$packages_exist ? 'style="display:none;"' : ''; //$buttons .= '<input type="button" class="button barcode-form-trigger" value="BARCODE ENTRY" '.$style.' />'; } if ($buttons != '') { $buttons = '<div class="spb" style="margin-bottom:10px;"><input type="hidden" name="grp_status" value="' . $status . '" />' . $buttons . '</div>'; } $result .= '<div id="sp-orders-' . $status . '">'; $result .= $buttons; //$result .= tep_draw_table('spo', $orders); //DRAW MANUALLY $result .= '<div class="draw-table"><table class="spo sticky-tablehead" border="0" cellpadding="0" cellspacing="0">'; $result .= '<thead><tr>'; foreach ($header as $c => $h) { $result .= '<th class="' . $c . '">' . $h . '</th>'; } $result .= '</tr></thead><tbody>'; $prev_oid = null; $order_counter = 0; $rowclass = 'e'; foreach ($orders as $oiid => $order) { $order_counter++; $oi = $orders_items[$oiid]; $oid = $oi['jng_sp_orders_id']; if ($oid != $prev_oid) { $item_counter = 0; } $item_counter++; if ($item_counter == 1) { $rowclass = $rowclass == 'e' ? 'o' : 'e'; } $result .= '<tr class="' . $rowclass . '">'; $hidecol = 4; $use_hide = $item_counter > 1; //$use_hide = ($status=='3' && $item_counter>1); if ($use_hide) { $result .= '<td colspan="' . $hidecol . '"> </td>'; } $col_counter = 0; foreach ($order as $c => $o) { $col_counter++; if ($status == '3' && $c == 't') { $action = '<input type="button" class="actbtn" name="4" value="Production" style="display:none;" />'; $cla = array(); $cla[] = $order_pi_print_count[$oid] > 0 ? 'oi-printed' : ''; $cla[] = $order_pi_ready[$oid] ? 'oi-ready' : ''; $cla[] = $order_pi_unscanned[$oid] == 0 ? 'oi-unscanned' : ''; $action .= '<input type="hidden" name="orf" class="' . implode(' ', $cla) . '"/>'; $o = $action . $o; } if ($use_hide) { if ($col_counter == $hidecol + 1) { $o_pos = strpos($o, '<sup'); $o = $o_pos === false ? '' : substr($o, $o_pos); } if ($col_counter > $hidecol) { $result .= '<td class="' . $c . '">' . $o . '</td>'; } } else { $result .= '<td class="' . $c . '">' . $o . '</td>'; } } $result .= '</tr>'; $prev_oid = $oid; } $result .= '</tbody><table></div>'; } else { $result .= '<h3>No Orders in this status</h3>'; } return $result; }
function manageListProductPackageList($status, $ean_list = '', $date_start = null, $date_end = null, $brand_id = null, $cat_id = null) { //use_class('product'); use_class('Product'); $q = "SELECT o.orders_id, o.orders_no, o.date_purchased, o.customers_id, o.customers_name, o.customers_order_count"; $q .= ", op.*, p.products_image, dr.dti_referrers_code, mp.packages_id, mp.packages_code, mp.awb_no, csl.list_type, opsh.status_date"; $q .= ", IFNULL(op.leadtime_start_date, o.date_purchased) AS date_for_sorting"; $q .= " FROM orders_products op"; $q .= " LEFT JOIN orders_products_status_history opsh ON opsh.orders_products_id=op.orders_products_id AND opsh.status=op.status"; $q .= " INNER JOIN minierp_packages_products mpp ON mpp.orders_products_id=op.orders_products_id"; $q .= " LEFT JOIN orders o ON o.orders_id=op.orders_id"; $q .= " LEFT JOIN customers_special_list csl ON csl.customers_id=o.customers_id"; $q .= " LEFT JOIN products p ON p.products_id=op.products_id"; $q .= " LEFT JOIN products_articles pa ON pa.products_articles_id=op.products_articles_id"; $q .= " LEFT JOIN dti_referrers dr ON dr.dti_referrers_id=o.dti_referrers_id"; $q .= " LEFT JOIN minierp_packages mp ON mp.packages_id=mpp.packages_id"; $q .= " LEFT JOIN products_to_categories ptc ON ptc.products_id=op.products_id"; $q .= " WHERE op.status={$status}"; $q .= $this->eanListFilterQuery($ean_list, 'AND', ''); $q .= $this->leadtimeFilterQuery($status, $date_start, $date_end, 'AND', ''); if ($brand_id > 0) { $q .= " AND p.products_brand_id='{$brand_id}' "; } if ($cat_id > 0) { $q .= " AND ptc.categories_id='{$cat_id}' "; } $q .= " ORDER BY "; $q .= " IFNULL(mp.sent_date, NOW()) "; $q .= ($status < 14 ? 'ASC' : 'DESC') . ','; $q .= " date_for_sorting ASC, o.orders_id ASC, op.order_item_count ASC"; $r = tep_db_query($q); $orders = array(); $orders_items = array(); $package_code = array(); $package_awb = array(); $filters = $this->retrieveListProductOverview_drawFilter($ean_list, $date_start, $date_end, $brand_id, $cat_id); $all_package_receivable = true; if (tep_db_num_rows($r) > 0) { use_class('products_minierp'); $class_pm = new products_minierp(); $items_listed = array(); while ($row = tep_db_fetch_array($r)) { if (!in_array($row['orders_products_id'], $items_listed)) { //$obj_product = new product($row['products_id']); $obj_product = new Product($row['products_id']); $items_listed[] = $row['orders_products_id']; $orders_items[$row['orders_products_id']] = $row; $package_id = $row['packages_id']; if (!isset($orders[$package_id])) { $orders[$package_id] = array(); $package_code[$package_id] = $row['packages_code']; $package_awb[$package_id] = $row['awb_no']; if ($row['awb_no'] == '') { $all_package_receivable = false; } $header = array(); $header['d'] = $status < 6 || $status > 7 ? 'Date' : 'Lead Time'; if (!($status < 6 or $status > 7)) { $header['d2'] = 'Cycle Time'; } $header['r'] = 'Source'; $header['c'] = 'Customer / Order No'; $header['o'] = 'Order ID'; $header['a'] = 'Product Code'; $header['p'] = 'Price'; $header['q'] = 'Qty'; $header['t'] = 'Action'; } $order_date = strtotime($row['date_purchased']); $o = array(); /* $date_used = strtotime($row['prod_target_in']); if (($status < 6) OR ($status > 7)) { $value_date = date('d-M-y', $order_date); } else { $value_date = displayLeadTime($row['prod_target_in'], $date_used); } $o['d'] = $value_date; */ $o['d'] = displayLeadTime($row['leadtime_start_date'], strtotime($row['leadtime_start_date'])); if (!($status < 6 || $status > 7)) { $o['d2'] = displayCycleTime($row['status_date']); } $o['r'] = $row['dti_referrers_code'] == '' ? '<span class="notice">julie-grace.de</span>' : $row['dti_referrers_code']; $cust = '<a href="?open=customer&id=' . $row['customers_id'] . '&hidemenu=true" class="view_webpage" >' . $row['customers_name'] . '</a> <sup>' . $row['customers_order_count'] . '</sup>'; $crown_img_col = array('V' => 'vip', 'B' => 'black'); if ($row['list_type'] != '' && array_key_exists($row['list_type'], $crown_img_col)) { $crown_img_title = array('V' => 'VIP Customer', 'B' => 'Blacklist Customer'); $crown_img = '<a href="?open=customers-special-detail&id=' . $row['customers_id'] . '&hidemenu=true" class="view_webpage">'; $crown_img .= '<img src="images/list-' . $crown_img_col[$row['list_type']] . '.gif" title="' . $crown_img_title[$row['list_type']] . '" />'; $crown_img .= '</a> '; $cust = $crown_img . $cust; } $orders_products_id = 'JG-' . $row['orders_products_id']; $orders_products_id = '<a href="?open=order-history&opid=' . $row['orders_products_id'] . '&hidemenu=true" class="view_webpage">' . $orders_products_id . '</a>'; $order_no = '<a href="?open=customer-care-order-detail&source=JG&id=' . $row['orders_id'] . '&hidemenu=true" class="view_webpage">' . $row['orders_no'] . '</a>'; if ($row['order_item_total'] > 1) { $orders_products_id .= " <sup>{$row['order_item_count']}/{$row['order_item_total']}</sup>"; } if ($row['products_problem'] != '0') { $rep_img = array('R' => 'icon-hazard', 'W' => 'icon-hazard-red'); $return = $this->retrieveReturnDetailLatest($row['orders_products_id']); $return_id = $return['orders_products_return_id']; $order_no = '<a href="?open=order-return&id=' . $return_id . '&hidemenu=true" class="view_webpage" title="View Return Detail"><img src="images/' . $rep_img[$row['products_problem']] . '.png" class="repro-' . $row['products_problem'] . '"/></a> ' . $order_id; } $o['c'] = $cust . '<br /><small>order no:</small> ' . $order_no; $o['o'] = $orders_products_id; $product = '<div><a href="?open=product-detail&products_id=' . $row['products_id'] . '" target="_blank" title="View product detail">' . $row['products_model'] . '</a></div>'; $pimg = webImageSource($row['products_image'], '500'); if ($pimg != '') { $thumb = '<div class="thumb"><a href="' . $pimg . '" class="view_image" title="Image of ' . $row['products_model'] . '">' . webImage($row['products_image'], '80', '80', $row['products_id'], 'img-border img-padding') . '</a></div>'; $product = $thumb . $product; } //$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, '', ' '); $icons = $gold_icon . $diamond_icon; $o['a'] = drawTableArticleInfoWithIcons($product, $icons); $o['p'] = number_format($row['final_price'], 2); $o['q'] = $row['products_quantity']; $action = ''; if ($row['status'] == '6') { $action .= '<input type="button" class="actbtn" name="5" value="Remove" title="Remove from package" />'; } if ($row['status'] == '7' || $row['status'] == '8') { $action .= '<input type="button" class="actbtn" name="10" value="DOA" title="Received DOA, cancel this product" />'; } //Default Row Action Value (id, status, stock status) $action .= '<input type="hidden" id="opid-' . $row['orders_products_id'] . '" name="op_id" value="' . $row['orders_products_id'] . '" />'; $action .= '<input type="hidden" name="op_status" value="' . $row['status'] . '" />'; $o['t'] = $action; $orders[$package_id][$row['orders_products_id']] = $o; } } $result = '<div id="packages">'; /* if($status=='7' && count($orders)>1 && $all_package_receivable) $result .= '<div style="margin-bottom:20px;"><input type="button" class="pkgbtn button" name="receiveallpackage" value="Receive All Packages" title="Receive all packages listed in HH" /></div>'; if($status=='8') { //$result .= ; if($this->easylogImportDataExist()) { $import_stats = ''; $import_class = ' red '; $import_value = 'Import file found. Click here to set status to Sent.'; $import_title = 'Import shipping data exported from EASYLOG'; } else { $import_class = ' '; $import_stats = 'disabled="disabled"'; $import_value = 'There is no import file to proccess'; $import_title = $import_value; } $result .= '<div style="margin-bottom:20px;">'; $result .= '<input type="button" class="pkgbtn'.$import_class.'button" name="importeasylog" value="'.$import_value.'" title="'.$import_title.'" '.$import_stats.' />'; $result .= '</div>'; } */ foreach ($orders as $pid => $package) { $result .= '<div id="package-' . $pid . '" style="margin-bottom:20px;">'; $button = ''; if ($status == '6') { $button .= ' <input type="button" class="pkgbtn" name="printpackagelabel" value="Print Labels" title="Print Labels for products in this package" />'; $button .= ' <input type="button" class="pkgbtn" name="printpackagechecklist" value="Print Checklist" title="Print Package Checklist" />'; $button .= ' <input type="button" class="pkgbtn" name="sendpackage" value="Send" title="Send this Package to HH" />'; } if ($status == '7' || $status == '8') { $awb = $package_awb[$pid] == '' ? '' : '(AWB: ' . $package_awb[$pid] . ')'; $awb_button_tips = $package_awb[$pid] == '' ? 'Add AWB no to this Package' : 'Change AWB'; $button .= ' <span id="awb-' . $pid . '" style="font-weight:normal;">' . $awb . '</span>'; $button .= ' <input type="button" class="pkgbtn" name="updateawb" value="AWB" title="' . $awb_button_tips . '" />'; //$button .= ' <input type="button" class="pkgbtn" name="printpackagepicklist" value="Print Picklist" title="Print Package Picklist" />'; } /* if($status=='7') $button .= ' <input type="button" class="pkgbtn" name="receivepackage" value="Receive" title="Receive this Package in HH" />'; if($status=='8') { $button .= ' <input type="button" class="pkgbtn" name="printinvoices" value="Print Invoices" title="Print Invoices of all orders in this package" />'; $button .= ' <input type="button" class="pkgbtn" name="downloadcsv" value="Download CSV" title="Download CSV file of all orders in this package" />'; $button .= ' <input type="button" class="pkgbtn" name="sendtocust" value="Send" title="Send this Package to Customer" />'; } */ $result .= '<h3>Package ' . $package_code[$pid] . ' ' . $button . ' <input type="hidden" name="package_id" value="' . $pid . '" /></h3>'; //$result .= tep_draw_table('spo', $package); $result .= $this->drawTableListProduct($header, $package, $orders_items); $result .= '</div>'; } $result .= '</div>'; } else { $result = '<h3>No Orders in this status</h3>'; } return $filters . $result; }
/** * Retrieve order items data on Package * @global array $SP_DOESNT_NEED_EASYLOG * @param int $jng_sp_id * @param int $status * @param string $ean_list * @param string $date_start * @param string $date_end * @param int $brand_id * @param int $cat_id * @param string $orders_no * @return array of order items */ function manageOrderPackageList($jng_sp_id, $status, $ean_list = null, $date_start = null, $date_end = null, $brand_id = null, $cat_id = null, $orders_no = '') { use_class('jng_sp'); $class_sp = new jng_sp(); $SP_DOESNT_NEED_EASYLOG = array_keys($class_sp->retrieveList('use_easylog=0')); $query = "SELECT CONCAT(jo.customer_billing_firstname,' ',jo.customer_billing_lastname) AS customer_name"; $query .= ", jo.order_id, jo.order_date, jo.customers_order_count, joi.*, p.products_image, p.products_brand_id, joih.status_date"; $query .= ", jp.jng_sp_id, jp.jng_sp_packages_id, jp.package_code, jp.awb_no, jcust.jng_sp_customers_id, jscs.list_type"; $query .= ", IFNULL(joi.leadtime_start_date, jo.order_date) AS date_for_sorting"; $query .= " FROM jng_sp_orders jo"; $query .= " LEFT JOIN jng_sp_customers jcust ON jcust.jng_sp_id=jo.jng_sp_id AND jcust.customer_id=jo.customer_billing_id"; $query .= " LEFT JOIN jng_sp_customers_special jscs ON jscs.jng_sp_customers_id=jcust.jng_sp_customers_id"; $query .= " LEFT JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_id=jo.jng_sp_orders_id"; $query .= " LEFT JOIN jng_sp_orders_items_status_history joih ON joih.jng_sp_orders_items_id=joi.jng_sp_orders_items_id AND joih.status=joi.status"; $query .= " INNER JOIN jng_sp_packages_items jpi ON jpi.jng_sp_orders_items_id=joi.jng_sp_orders_items_id"; $query .= " LEFT JOIN products p ON p.products_id=joi.products_id"; $query .= " LEFT JOIN jng_sp_packages jp ON jp.jng_sp_packages_id=jpi.jng_sp_packages_id"; $query .= " LEFT JOIN products_to_categories ptc ON ptc.categories_id=joi.products_id"; $query .= " WHERE joi.status='{$status}'"; if ($jng_sp_id != '0') { $query .= " AND jo.jng_sp_id={$jng_sp_id}"; } $query .= $this->eanListFilterQuery($ean_list, 'AND', ''); $query .= $this->leadtimeFilterQuery($status, $date_start, $date_end, 'AND', ''); if ($brand_id > 0) { $query .= " AND p.products_brand_id='{$brand_id}' "; } if ($cat_id > 0) { $query .= " AND ptc.categories_id='{$cat_id}' "; } if ($orders_no != '') { $query .= " AND jo.order_id IN ('" . (is_array($orders_no) ? implode("','", $orders_no) : $orders_no) . "') "; } $query .= " ORDER BY IFNULL(jp.sent_date, NOW()) "; $query .= $status < 14 ? 'ASC' : 'DESC'; $query .= ", date_for_sorting ASC, jo.jng_sp_orders_id ASC, joi.order_item_count ASC"; $result = tep_db_query($query); $orders = array(); $package_code = array(); $package_awb = array(); $package_sp_id = array(); $all_package_receivable = true; $filters = $this->manageOrderList_drawFilter($jng_sp_id, $ean_list, $date_start, $date_end, $brand_id, $cat_id, $orders_no); if (tep_db_num_rows($result) > 0) { $header = array(); $header['d'] = ($status < 6 or $status > 7) ? 'Date' : 'Lead Time'; //$header['d2'] = '<abbr title="Reported Shipping Date">RSD</abbr>'; if (!($status < 6 || $status > 7)) { $header['d3'] = 'Cycle Time'; $header['d2'] = 'Started Date'; } $header['c'] = 'Customer / Order No'; $header['o'] = 'Order ID'; $header['a'] = 'Article No'; $header['p'] = 'Price'; $header['q'] = 'Qty'; $header['t'] = 'Action'; $orders_items = array(); $items_listed = array(); while ($row = tep_db_fetch_array($result)) { if (!in_array($row['jng_sp_orders_items_id'], $items_listed)) { $obj_product = new Product($row['products_id']); $orders_items[$row['jng_sp_orders_items_id']] = $row; $items_listed[] = $row['jng_sp_orders_items_id']; $package_id = $row['jng_sp_packages_id']; if (!isset($orders[$package_id])) { $orders[$package_id] = array(); $package_code[$package_id] = $row['package_code']; $package_awb[$package_id] = $row['awb_no']; if ($row['awb_no'] == '') { $all_package_receivable = false; } } $order_date = strtotime($row['order_date']); $o = array(); /* $date_used = strtotime($row['prod_target_in']); if (($status < 6) OR ($status > 7)) { $value_date = date('d-M-y', $order_date); } else { $value_date = displayLeadTime($row['prod_target_in'], $date_used); } $o['d'] = $value_date; */ $o['d'] = displayLeadTime($row['leadtime_start_date'], strtotime($row['leadtime_start_date'])); //$o['d'] = '<div title="'.date('H:i:s', $order_date).'">'.date('d-M-y', $order_date).'</div>'; //$o['d2'] = $this->reportedShippingDate($order_date, $status, $row['delivery_time'], $row['delivery_replacement_time']); if (!($status < 6 or $status > 7)) { $o['d3'] = displayCycleTime($row['status_date']); //$o['d2'] = date('d-M-y', $date_used); $o['d2'] = date('d-M-y', strtotime($row['leadtime_start_date'])); } $cust = '<a href="?open=sp-customer&id=' . $row['jng_sp_customers_id'] . '&hidemenu=true" class="view_webpage" >' . $row['customer_name'] . '</a>'; if ($row['list_type'] != '') { $crown_img_col = array('V' => 'vip', 'B' => 'black'); $crown_img_title = array('V' => 'VIP Customer', 'B' => 'Blacklist Customer'); $crown_img = '<a href="?open=sp-customers-special-detail&id=' . $row['jng_sp_customers_id'] . '&hidemenu=true" class="view_webpage">'; $crown_img .= '<img src="images/list-' . $crown_img_col[$row['list_type']] . '.gif" title="' . $crown_img_title[$row['list_type']] . '" />'; $crown_img .= '</a> '; $cust = $crown_img . $cust; } $cust .= ' <sup>' . $row['customers_order_count'] . '</sup>'; $link_item = '<a href="?open=sp-order-history&oi_id=' . $row['jng_sp_orders_items_id'] . '&hidemenu=true" class="view_webpage">SP-' . $row['jng_sp_orders_items_id'] . '</a>'; $order_id_info = $link_item; $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) { $order_id_info .= ' <sup>' . $row['order_item_count'] . '/' . $row['order_item_total'] . '</sup>'; } $o['c'] = $cust . '<br /><small>order no:</small> ' . $order_no; $o['o'] = $order_id_info; $article = $row['article_number']; $pimg = webImageSource($row['products_image'], '500'); $article = '<div><a href="?open=product-detail&products_id=' . $row['products_id'] . '" target="_blank" title="View Product Detail">' . $article . '</a></div>'; if ($pimg != '') { $thumb = '<div class="thumb"><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; } //$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, '', ' '); $icons = $gold_icon . $diamond_icon; $o['a'] = drawTableArticleInfoWithIcons($article, $icons); $o['p'] = $row['price']; $o['q'] = intval($row['order_quantity']); $action = ''; if ($row['status'] == '6') { $action .= '<input type="button" class="actbtn" name="5" value="Remove" title="Remove from package" />'; } if ($row['status'] == '7' || $row['status'] == '8') { $action .= '<input type="button" class="actbtn" name="10" value="DOA" title="Received DOA, cancel this product" />'; } if ($row['status'] == '16') { $action .= '<input type="button" class="actbtn" name="15" value="Keep" title="Remove from package and Set to Keep" />'; } if ($row['status'] == '18') { $action .= '<input type="button" class="actbtn" name="20" value="Stock" title="Add product to Stock" />'; $action .= '<input type="button" class="actbtn" name="21" value="Disass" title="Disassemble and add elements to Stock" />'; } if ($row['status'] == '17' || $row['status'] == '18') { $action .= '<input type="button" class="actbtn" name="19" value="Lost" title="Product is lost" />'; } //Default Row Action Value (id, status, stock status) $action .= '<input type="hidden" id="oiid-' . $row['jng_sp_orders_items_id'] . '" name="oi_id" value="' . $row['jng_sp_orders_items_id'] . '" >'; $action .= '<input type="hidden" name="oi_status" value="' . $row['status'] . '" >'; $o['t'] = $action; $orders[$package_id][$row['jng_sp_orders_items_id']] = $o; if (!isset($package_sp_id[$package_id])) { $package_sp_id[$package_id] = $row['jng_sp_id']; } } } $result = '<div id="packages">'; /* if($status=='7' && count($orders)>1 && $all_package_receivable) $result .= '<div style="margin-bottom:20px;"><input type="button" class="pkgbtn button" name="receiveallpackage" value="Receive All Packages" title="Receive all packages listed in HH" /></div>'; if($status=='8') { //$result .= ; if($this->easylogImportDataExist()) { $import_stats = ''; $import_class = ' red '; $import_value = 'Import file found. Click here to set status to Sent.'; $import_title = 'Import shipping data exported from EASYLOG'; } else { $import_class = ' '; $import_stats = 'disabled="disabled"'; $import_value = 'There is no import file to proccess'; $import_title = $import_value; } $result .= '<div style="margin-bottom:20px;">'; $result .= '<input type="button" class="pkgbtn'.$import_class.'button" name="importeasylog" value="'.$import_value.'" title="'.$import_title.'" '.$import_stats.' />'; $result .= '</div>'; } */ foreach ($orders as $pid => $package) { $result .= '<div id="package-' . $pid . '" style="margin-bottom:20px;">'; $button = ''; if ($status == '6') { //$button .= ' <input type="button" class="pkgbtn" name="printpackagelabel" value="Print Labels" title="Print Labels for products in this package" />'; $button .= ' <input type="button" class="pkgbtn" name="printpackagechecklist" value="Print Checklist" title="Print Package Checklist" />'; $button .= ' <input type="button" class="pkgbtn" name="sendpackage" value="Send" title="Send this Package to HH" />'; } if ($status == '7' || $status == '8' || $status == '17' || $status == '18') { use_class('jng_sp_packages'); if ($status < 14) { $class_jp = new jng_sp_packages(); $awb_code = $class_jp->awbCodeLink($package_awb[$pid]); } else { $awb_code = $package_awb[$pid]; } if ($awb_code == '') { $awb = $awb_code; $awb_button_tips = 'Add AWB no to this Package'; } else { $awb = '(AWB: ' . $awb_code . ')'; $awb_button_tips = 'Change AWB'; } $button .= ' <span id="awb-' . $pid . '" style="font-weight:normal;">' . $awb . '</span>'; $button .= ' <input type="button" class="pkgbtn" name="updateawb" value="AWB" title="' . $awb_button_tips . '" />'; //$button .= ' <input type="button" class="pkgbtn" name="printpackagepicklist" value="Print Picklist" title="Print Package Picklist" />'; } //if($status=='7') $button .= ' <input type="button" class="pkgbtn" name="receivepackage" value="Receive" title="Receive this Package in HH" />'; if ($status == '7') { //if($status=='8') { if (in_array($package_sp_id[$pid], $SP_DOESNT_NEED_EASYLOG)) { //for SP that use manual button instead of Easylog $button .= ' <input type="button" class="pkgbtn" name="printdeliverydocsingle" value="Invoice / Delivery Document" title="Print Invoice / Delivery Documents of this package" />'; $button .= ' <input type="button" class="pkgbtn" name="setsent2cust" value="Set as Sent to Customer" title="Set all orders in this package as Sent to Customer" disabled="disabled" />'; } } if ($status == '16') { $button .= ' <input type="button" class="pkgbtn" name="printpackagechecklist" value="Print Checklist" title="Print Package Checklist" />'; $button .= ' <input type="button" class="pkgbtn" name="printpackagefakeinvoice" value="Print Invoice" title="Print Fake Invoice for Bali Customs" />'; $button .= ' <input type="button" class="pkgbtn" name="sendpackage" value="Send" title="Send this Package to Bali" />'; } if ($status == '17') { $button .= ' <input type="button" class="pkgbtn" name="receivepackage" value="Receive" title="Receive this Package in Bali" />'; } $result .= '<h3>Package ' . $package_code[$pid] . ' ' . $button . ' <input type="hidden" name="package_id" value="' . $pid . '" /></h3>'; //$result .= tep_draw_table('spo', $package); //DRAW MANUALLY $result .= '<div class="draw-table"><table class="spo" border="0" cellpadding="0" cellspacing="0">'; $result .= '<tr>'; foreach ($header as $c => $h) { $result .= '<th class="' . $c . '">' . $h . '</th>'; } $result .= '</tr>'; $prev_oid = null; $order_counter = 0; $rowclass = 'e'; foreach ($package as $oiid => $order) { $order_counter++; $oi = $orders_items[$oiid]; $oid = $oi['jng_sp_orders_id']; if ($oid != $prev_oid) { $item_counter = 0; } $item_counter++; if ($item_counter == 1) { $rowclass = $rowclass == 'e' ? 'o' : 'e'; } $result .= '<tr class="' . $rowclass . '">'; $hidecol = 5; $use_hide = $item_counter > 1; //$use_hide = ($status=='3' && $item_counter>1); // Logic for lead time /* $date_used = strtotime($oi['prod_target_in']); if (($oi['status'] < 2) OR ($oi['status'] > 7)) { $value_date = ""; } else { $value_date = displayLeadTime($oi['prod_target_in'], $date_used); } if (!(($oi['status'] < 2) OR ($oi['status'] > 7))) { $started_date = date('d-M-y', $date_used); } */ $started_date = date('d-M-y', strtotime($oi['leadtime_start_date'])); $value_date = displayLeadTime($oi['leadtime_start_date'], strtotime($oi['leadtime_start_date'])); if ($use_hide) { $result .= '<td class="d">' . $value_date . '</td>'; if (!($status < 6 || $status > 7)) { $result .= '<td class="d3">' . displayCycleTime($oi['status_date']) . '</td>'; $result .= '<td class="d2">' . $started_date . '</td>'; } $result .= '<td> </td>'; } $col_counter = 0; foreach ($order as $c => $o) { $col_counter++; if ($use_hide) { /* if($col_counter==$hidecol) { $o_pos = strpos($o, '<sup'); $o = ($o_pos===false) ? '' : substr($o, $o_pos); } */ if ($col_counter >= $hidecol) { $result .= '<td class="' . $c . '">' . $o . '</td>'; } } else { $result .= '<td class="' . $c . '">' . $o . '</td>'; } } $result .= '</tr>'; $prev_oid = $oid; } $result .= '</table></div>'; $result .= '</div>'; //close package-pid } $result .= '</div>'; //close packages } else { $result = '<h3>No Orders in this status </h3>'; } $result = $filters . $result; return $result; }