Exemplo n.º 1
0
 function drawNotifications($notifications)
 {
     $result = '';
     foreach ($notifications as $notification) {
         $timestamp = strtotime(date($notification['posted_date']));
         $duration = abs(time() - $timestamp);
         $duration_text = displayDuration($duration, 1);
         $title = '';
         $class = array('notifications');
         if ($notification['status'] == '0') {
             $class[] = 'isNew';
         }
         if ($notification['need_feedback'] == '1') {
             $class[] = 'isNFB';
             $title = 'Your feedback is needed for this notification';
         }
         $module_referer_url = '';
         if ($notification['url'] != '') {
             $class[] = 'view_webpage';
             $module_referer_url = 'href="?' . $notification['url'] . '&hidemenu=true"';
         }
         if ($notification['posted_by'] == '0' || $notification['posted_by'] == 'auto-set' || strtolower($notification['posted_by']) == 'manobo') {
             $user_img = 'user-manobo.png';
         } else {
             $user_img = is_file(DIR_WS_IMAGES . $notification['users_image']) ? $notification['users_image'] : 'user-default.png';
         }
         $result .= '<a id="not-' . $notification['notifications_id'] . '" ' . $module_referer_url . ' title="' . $title . '"  class="' . implode(' ', $class) . '">';
         $result .= '<div style="float:left;">' . webImage($user_img, '50', '50') . '</div>';
         $result .= '<div style="margin-left:55px;">';
         $result .= '<div>' . nl2br($notification['message']) . '</div>';
         $result .= '<div class="smallText notice">posted ' . $duration_text . ' ago</div>';
         $result .= '</div>';
         $result .= '</a>';
     }
     return $result;
 }
function oiErrorStatus($item_status)
{
    //STATUS MISMATCH HANDLER
    global $order_type, $item_id, $status_current, $status_new, $user_name, $class_do, $class_jo, $class_o, $status_name;
    $result = '';
    $add_info = '';
    if ($item_status == 'OUTSOURCING-2-PRODUCTION') {
        $result = 'ERROR: Outsourcing Orders, can not set to Production!';
    } else {
        //error when set to production
        if ($item_status == 4 || $status_current == 3 && $status_new == 4 || !is_numeric($status_new)) {
            //get additional information to be displayed on MC error message
            if ($order_type == 'SP') {
                $item = $class_jo->retrieveItemDetail($item_id);
                $item_history = $class_jo->retrieveItemHistory($item_id);
            } elseif ($order_type == 'JG') {
                $item = $class_o->retrieveProductDetail($item_id);
                $item_history = $class_o->retrieveProductHistory($item_id);
            } elseif ($order_type == 'DP') {
                $item = $class_do->retrieveDetail($item_id);
                $item_history = $class_do->retrieveHistory($item_id);
            }
            $last_history = end($item_history);
            $last_production_history = end(retrieveProductionHistory($order_type, $item_id));
            $now = time();
            if ($order_type == 'SP' || $order_type == 'JG') {
                $last_status_time = strtotime($last_production_history['status_date']) > strtotime($last_history['status_date']) ? $last_production_history['status_date'] : $last_history['status_date'];
            } elseif ($order_type == 'DP') {
                $last_status_time = strtotime($last_production_history['update_time']) > strtotime($last_history['update_time']) ? $last_production_history['update_time'] : $last_history['update_time'];
            }
            $time_duration = abs($now - strtotime($last_status_time));
            //if more than 10 minutes
            $timedur = displayDuration($time_duration, 1, 0);
            $add_info = ",\nmoved since{$timedur} ago";
            if (floor($time_duration / 60) > 10 && $item['status'] == '4') {
                //display information on which tab this order processed on production
                $line_status = statusNameProduction($item['prod_status'], false, true);
                if ($line_status != '') {
                    $add_info .= ",\nplease check {$line_status}.";
                }
            }
        }
        if (!is_numeric($item_status)) {
            //Error Message for Production Sub Status
            $result = "ERROR: Status is now " . statusNameProduction($item_status, false, true) . $add_info;
        } else {
            $status_depos_sent_cancel = array('8', '9', '10', '11', '12', '14', '15', '16', '17', '18', '19', '20', '21');
            $status_new_temp = explode('-', $status_new);
            $sub_status = isset($status_new_temp[1]) ? $status_new_temp[1] : '';
            if ($order_type != 'DP' && in_array($item_status, $status_depos_sent_cancel)) {
                //If Not a Depot Order AND Current Product Status is handled by HH
                if ($status_current == '3' && ($status_new == '4' || !is_numeric($status_new))) {
                    //FOR SET2PROD RULE
                    /* Stop process when:
                           1) Real order taken over by HH and already have stock allocated     "set2prod_rule1"
                           2) or Real order already proceed by HH (status >= 9 "sent")         "set2prod_rule2"
                       */
                    $set2prod_rule1 = $item_status == '8' && $item['stock_status'] == 'D';
                    $set2prod_rule2 = $item_status != '8';
                    if ($set2prod_rule1 || $set2prod_rule2) {
                        $ok_for_production = false;
                    } else {
                        $ok_for_production = true;
                    }
                    $item_do = $class_do->retrieveDetailTransmigran($order_type, $item_id);
                    if ($ok_for_production) {
                        if (is_null($item_do)) {
                            if (realOrderIsPossibleToTransferred($order_type, $item_id)) {
                                //Transfer to DP if order is possible to transferred
                                $item_do = $class_do->transferFromRealOrder(SEGMENT_ID_HAMBURG, $order_type, $item_id);
                                $class_do->updateStatus($item_do['depot_orders_id'], $status_new, $user_name);
                                $result = "MOVEDTODEPOT";
                            } else {
                                $result = "ERROR: {$order_type}-{$item_id} could not transferred to Depot Orders!\nplease make sure order scanned is correct!";
                            }
                        } else {
                            //If MMO then update Depot Order Status
                            if ($item_do['status'] == $status_current || $item_do['status'] == $status_new_temp[0]) {
                                //SET2PRODSUBSTATUS
                                if (!is_numeric($status_new)) {
                                    //If DP already in same sub status or status in Production or more
                                    if ($item_do['prod_status'] == $sub_status || $item_do['status'] >= 4) {
                                        $result = "ERROR: Status is now " . statusNameProduction($item_do['prod_status'], false, true) . $add_info;
                                    } else {
                                        $class_do->updateStatus($item_do['depot_orders_id'], "{$status_new}", $user_name);
                                        $result = "MOVEDTODEPOT";
                                    }
                                } else {
                                    //If Depot Order Status match OR Depot Order Status already updated
                                    //Update Order Status only if it's match and not already updated
                                    if ($item_do['status'] == $status_current) {
                                        $class_do->updateStatus($item_do['depot_orders_id'], $status_new, $user_name);
                                    }
                                    $result = "MOVEDTODEPOT";
                                }
                            } else {
                                $result = "ERROR: Status is now " . $status_name[$item_do['status']] . $add_info;
                            }
                        }
                    } else {
                        if (!is_null($item_do)) {
                            $class_do->doCancelOrders($item_do['depot_orders_id'], $item_do['status'], 'auto-set');
                        }
                        $result = "(HH) CANCEL PRODUCTION!";
                    }
                } elseif ($status_current == '4' && !is_numeric($status_new)) {
                    //FOR SET2BETWEENPRODSUBSTATUS RULE
                    $item_do = $class_do->retrieveDetailTransmigran($order_type, $item_id);
                    if (is_null($item_do)) {
                        //check from last status on production to decide whether process need to continue or stop
                        $prod_histories = retrieveProductionHistory($order_type, $item_id);
                        $n_histories = count($prod_histories);
                        $ok_for_production = true;
                        if ($n_histories > 0) {
                            $last_status_prod_hist = $prod_histories[$n_histories - 1];
                            $last_status_on_prod = $last_status_prod_hist['status'];
                            //stop process when last status is order still on Pullrack
                            if ($last_status_on_prod == 'P') {
                                $ok_for_production = false;
                            }
                        }
                        if ($ok_for_production) {
                            if (realOrderIsPossibleToTransferred($order_type, $item_id)) {
                                //Transfer to DP if order is possible to transferred
                                $item_do = $class_do->transferFromRealOrder(SEGMENT_ID_HAMBURG, $order_type, $item_id);
                                $class_do->updateStatus($item_do['depot_orders_id'], $status_new, $user_name);
                                $result = "MOVEDTODEPOT";
                            } else {
                                $result = "ERROR: {$order_type}-{$item_id} could not transferred to Depot Orders!\nplease make sure order scanned is correct!";
                            }
                        } else {
                            $result = "(HH) CANCEL PRODUCTION!";
                        }
                    } else {
                        /* Stop process when: 
                           *  1) - Depot Orders still in Pullrack                                  "setbetweenprod_rule1"
                           * and:
                              2) Real order taken over by HH and already have stock allocated      "setbetweenprod_rule2"
                              3) or Real order already proceed by HH (status >= 9 "sent")          "setbetweenprod_rule3"
                           */
                        $setbetweenprod_rule1 = $item_do['prod_status'] == 'P';
                        $setbetweenprod_rule2 = $item_status == '8' && $item['stock_status'] == 'D';
                        $setbetweenprod_rule3 = $item_status != '8';
                        if ($setbetweenprod_rule1 && ($setbetweenprod_rule2 || $setbetweenprod_rule3)) {
                            $ok_for_production = false;
                        } else {
                            $ok_for_production = true;
                        }
                        if ($ok_for_production) {
                            if ($item_do['status'] == '4') {
                                //If order moved between sub tab production
                                if ($item_do['prod_status'] == $sub_status) {
                                    //Not updating the status if order is on the same sub status production - including lines
                                    $result = "ERROR: Status is now " . statusNameProduction($sub_status, false, true) . $add_info;
                                } else {
                                    //Order moved to other sub status, then update it's production sub status to the new status
                                    $class_do->updateStatus($item_do['depot_orders_id'], $status_new, $user_name);
                                    $result = 'Updated Successfully';
                                }
                            } else {
                                /*
                                    EXCEPT revived orders, Shows error if order is not from production but tried to set back to production status
                                    NOTES >> revived MTO orders which already have DP and at that moment status of DP was >= Package then manobo will set:
                                    "Real order to status New and let DP status as it is" ...
                                    But then, when real order taken over by HH so we need to used already created DP for status changes...
                                    ...this is actually the reason why we allowed revived orders
                                */
                                if (orderIsRevived($order_type, $item_id)) {
                                    $class_do->updateStatus($item_do['depot_orders_id'], $status_new, $user_name);
                                    $result = 'Updated Successfully';
                                } else {
                                    $result = "ERROR: Status is now " . $status_name[$item_do['status']] . $add_info;
                                }
                            }
                        } else {
                            if (!is_null($item_do)) {
                                $class_do->doCancelOrders($item_do['depot_orders_id'], $item_do['status'], 'auto-set');
                            }
                            $result = "(HH) CANCEL PRODUCTION!";
                        }
                    }
                } elseif ($status_current == '4' && $status_new == '5') {
                    //FOR SET2FINISH RULE
                    if (realOrderIsPossibleToTransferred($order_type, $item_id)) {
                        $item_do = $class_do->transferFromRealOrder(SEGMENT_ID_HAMBURG, $order_type, $item_id);
                        $class_do->updateStatus($item_do['depot_orders_id'], $status_new, $user_name);
                        $result = "(HH) PUT PRODUCT TO DEPO BOX";
                    } else {
                        $result = "ERROR: {$order_type}-{$item_id} could not transferred to Depot Orders!\nplease make sure order scanned is correct!";
                    }
                }
            } elseif ($item_status == '4' && $status_new != '' && !is_numeric($status_new) && $item['prod_status'] != $sub_status) {
                if ($sub_status == 'P') {
                    //Production Pullrack only allowed for order moved from ready tab to production, other will be rejected
                    $result = "ERROR: Status is now " . $status_name[$item_status] . $add_info;
                } else {
                    //moved between prod sub status >> $status_new is production sub status (S1..Sn, A, L)
                    if ($order_type == 'SP') {
                        $item = $class_jo->retrieveItemDetail($item_id);
                        $class_jo->updateItemStatus($item_id, $status_new, $user_name);
                    } elseif ($order_type == 'JG') {
                        $item = $class_o->retrieveProductDetail($item_id);
                        $class_o->updateProductStatus($item_id, $status_new, $user_name);
                    } elseif ($order_type == 'DP') {
                        $item = $class_do->retrieveDetail($item_id);
                        $class_do->updateStatus($item_id, $status_new, $user_name);
                    }
                    $result = 'Updated Successfully';
                }
            }
        }
    }
    if ($result == '') {
        $result = "ERROR: Status is now " . $status_name[$item_status] . $add_info;
    }
    return $result;
}
Exemplo n.º 3
0
 /**
  * Calculate forecast sales of 2 FUTURE dates
  * @param Float $base_number_in_days
  * @param String $date_start
  * @param String $date_end
  */
 public function calcForecastByDateRange($base_number_in_days, $date_start, $date_end)
 {
     $date_start_raw = strtotime($date_start);
     $date_end_raw = strtotime($date_end);
     if ($date_end_raw < $date_start_raw) {
         $date_temp = $date_end_raw;
         $date_end_raw = $date_start_raw;
         $date_start_raw = $date_temp;
     }
     $datediff = $date_end_raw - $date_start_raw;
     $total_days = intval(displayDuration($datediff, 'day'));
     return $this->calcForecastingValue($base_number_in_days, $date_start, $total_days);
 }
                    $tps = $total_process_sub[$rk];
                    $total_process -= $total_process_temp[$rk];
                } else {
                    $tps = $total_process_temp[$rk];
                }
                $row_temp[$rk]['c2 right'] = '<strong style="font-size:13px;">' . displayDuration($tps, 'day', 2) . '</strong>';
            }
            $row['c1'] = $row_temp[$rk]['c1'];
            $row['c2 right'] = $row_temp[$rk]['c2 right'];
            $tooltip_leadtime[] = $row;
        }
        if (!$result) {
            $result = "No lead time per tab measured yet for this";
        } else {
            $row['c1'] = '<span style="font-size:13px;">Total</span>';
            $row['c2 right'] = '<span style="font-size:13px;">' . displayDuration($total_process, 'day', 2) . '</span>';
            $tooltip_leadtime[] = $row;
            $result = tep_draw_table('summary2', $tooltip_leadtime, false, true);
        }
        echo utf8_encode($result);
        exit;
    } elseif ($_GET['me_action'] == 'LOADINGTHUMBTOOLTIP') {
        $thumbid = tep_db_prepare_input($_GET['thumbid']);
        list($pid, $article_id) = split('-', $thumbid);
        $tooltip_data = getTooltipThumbData($pid, $article_id);
        $tooltip = displayTooltipThumb($tooltip_data);
        $result = $tooltip;
        echo utf8_encode($result);
        exit;
    }
}
Exemplo n.º 5
0
 /**
  * Display DIOH of a specific article with standard style based on DIOH 
  * condition
  * @param type $articles_id Article ID
  * @param type $current_stock Stock qty of article
  * @return String
  */
 public function displayDIOH($articles_id, $current_stock)
 {
     $dioh = $this->getDIOH($articles_id, $current_stock);
     if (is_null($dioh)) {
         $result = '<abbr class="notice" title="No Recent Sales">NRS</abbr>';
     } else {
         if ($dioh >= forecasting::DIOH_MAX) {
             $result = '&ge;' . forecasting::DIOH_MAX . ' days';
         } else {
             $result = displayDuration($dioh * 86400, 'day');
             if ($result == '-') {
                 $result = '0 day';
             }
             if (is_null(self::$diohStopLevel)) {
                 self::loadDIOHsettings();
             }
             if ($dioh < self::$diohStopLevel[$this->stars]) {
                 $result = '<span class="red">' . $result . '</span>';
             }
         }
     }
     return $result;
 }
Exemplo n.º 6
0
 function drawDuration($class = '', $prefix = '', $suffix = '')
 {
     $duration = abs(time() - $this->posted_date_timestamp);
     $duration_text = displayDuration($duration, 1);
     $duration_full = date('l, j M Y', $this->posted_date_timestamp) . ' at ' . date('H:i', $this->posted_date_timestamp);
     if ($duration == '-') {
         $duration_text = '(new)';
     } else {
         $duration_text .= ' ago';
     }
     if ($prefix != '') {
         $duration_text = "{$prefix} {$duration_text}";
     }
     if ($suffix != '') {
         $duration_text = "{$duration_text} {$suffix}";
     }
     return '<div ' . ($class != '' ? 'class="' . $class . '" ' : '') . 'title="' . $duration_full . '">' . $duration_text . '</div>';
 }
Exemplo n.º 7
0
 function drawSingleComment($timestamp, $username, $comment, $showDelete = false)
 {
     $duration = abs(time() - $timestamp);
     $duration_text = displayDuration($duration, 1);
     $duration_full = date('l, j M Y', $timestamp) . ' at ' . date('H:i', $timestamp);
     if ($duration == '-') {
         $duration_text = 'new comment';
     } else {
         $duration_text .= ' ago';
     }
     $delete = $showDelete ? ' &sdot; <span class="del">Delete</span>' : '';
     $result = '<div id="' . $this->comment_id_prefix . $timestamp . '" class="comment">';
     $result .= '<strong class="blue">' . $username . '</strong><br />';
     //        $result .= nl2br($comment).'<br />';
     $result .= nl2br(TextLinkToHTMLLink($comment)) . '<br />';
     $result .= '<span class="notice" title="' . $duration_full . '">' . $duration_text . '</span>' . $delete;
     $result .= '</div>';
     return $result;
 }
        break;
    default:
        $q .= " ORDER BY {$sort_option}";
        break;
}
//$q .= " LIMIT 10";
$r = tep_db_query($q);
$elements = array();
$total_total = 0;
$dioh_collection = array();
while ($row = tep_db_fetch_array($r)) {
    $listofids[] = $row['elements_id'];
    $total_total += $row['total'];
    $dioh_collection[$row['elements_id']] = calculateDIOH($row['stock'], $row[element::DIOH_BASENUMBER_COLUMN_NAME]);
}
$dioh_average = count($dioh_collection) > 0 ? displayDuration(array_sum($dioh_collection) / count($dioh_collection) * 86400, 'day') : '<span class="notice">N/A</span>';
$table = array();
$table[] = $header;
$row_template = '<tr id="id-{ID1}" class="{ODDEVEN}">';
$row_template .= '<td class="img">' . webImage('', '80', '80') . '</td>';
$row_template .= '<td class="id"><a href="?open=element&amp;id={ID2}&amp;hidemenu=true" class="view_webpage">{ID3}</a></td>';
$row_template .= '<td colspan="' . (count($header) - 2) . '" class="load">&nbsp;</td>';
$row_template .= '</tr>';
$width = $sort_option == 'msws' ? '1030' : '975';
//$content .= '<div style="position:absolute;left:600px;top:85px;"><input type="button" id="print-stock" value="Print Stock List" /></div>';
$content .= '<div style="margin-bottom:10px;width:' . $width . 'px;"><form name="frm_sort" action="?open=elements-stock-list" method="post">';
$content .= '<div style="float:right;">';
$content .= '<table class="form" border="0" cellpadding="0" cellspacing="0" style="margin-bottom:10px;">';
$content .= '<tr><td width="150"><strong>Filter by Category</strong></td>';
$content .= '<td><select name="elcat-filter" class="input" onchange="frm_sort.submit();">';
$content .= '<option value="">Show All</option>';
    if ($default_length != '-') {
        //        foreach($pa as $a) $products_options[] = $a['products_ean'].','.textLength($a['length']);
        foreach ($pa as $a) {
            $products_options[] = $a['products_articles_id'] . ';' . $a['products_ean'] . ',' . textLength($a['length']);
        }
    }
    $bestgood_status = $class_pm->retrieveBestGoodStatus($pid);
    $result['status'] = 'FOUND';
    $result['products_id'] = $pid;
    $result['products_code'] = $p['p']['products_model'];
    $result['products_image'] = $products_image;
    $result['products_option'] = $aid;
    $result['products_options'] = implode('|', $products_options);
    $result['bestgood_status'] = $bestgood_status;
    $result['scanned_ean'] = $ean;
    $result['orders_qty'] = $qty;
    $result['sp_id'] = $spid;
    $result['use_am_logistic'] = in_array($spid, array_keys(getSalesPartnerUseAmazonLogistic()));
    $result['ean_printed'] = $ean_printed;
    $result['multiple_scan_error_msg'] = '';
    if ($ean_printed != '' && !$counter_on) {
        $now = time();
        $last_ean_scanned = $ean_printed;
        $manobo_date_format = date('d-m-Y h:i:s', strtotime($ean_printed));
        $time_duration = abs($now - strtotime($last_ean_scanned));
        $time_duration = trim(displayDuration($time_duration, 1, 0));
        $result['multiple_scan_error_msg'] = "PI {$barcode_id} already scanned for EAN on {$manobo_date_format} ({$time_duration} ago)";
    }
    $result['barcode_id'] = $barcode_id;
}
$logger->close();
Exemplo n.º 10
0
 $no++;
 $rowcount++;
 $order_status = $row['order_status'];
 $prod_status = $row['prod_status'];
 $late_order_status = $row['status'];
 $late_orders .= '<tr class="' . $rowclass . '">';
 $late_orders .= '<td style="text-align:center;">' . $no . '</td>';
 if ($row['type'] == 'DP') {
     $order_detail = '<a href="?open=depot-order&amp;id=' . $row['order_items_id'] . '&amp;hidemenu=true" class="view_webpage fancybox">DP-' . $row['order_items_id'] . '</a>';
 } elseif ($row['type'] == 'SP') {
     $order_detail = '<a href="?open=customer-care-order-detail&amp;source=' . $row['type'] . '&amp;id=' . $row['order_id'] . '&amp;hidemenu=true" class="view_webpage">' . $row['type'] . '-' . $row['order_items_id'] . '</a>';
 } else {
     $order_detail = '<a href="?open=order&id=' . $row['order_id'] . '&opid=' . $row['order_items_id'] . '&hidemenu=true class="view_webpage">' . $row['type'] . '-' . $row['order_items_id'] . '</a>';
 }
 $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&amp;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>';
Exemplo n.º 11
0
 public function renderLeadtimePopup($order_type, $orders_items_id)
 {
     $query = '';
     if ($order_type == self::ORDER_TYPE_SP) {
         $query = " SELECT * FROM (";
         $query .= "SELECT joi.jng_sp_orders_items_id, joi.leadtime_start_date, joish.status, joish.status_date";
         $query .= " FROM jng_sp_orders_items joi";
         $query .= " INNER JOIN jng_sp_orders_items_status_history joish ON joish.jng_sp_orders_items_id = joi.jng_sp_orders_items_id";
         $query .= " WHERE joi.status >= 1 AND joi.jng_sp_orders_items_id = {$orders_items_id}";
         $query .= " UNION ALL";
         $query .= " SELECT psh.orders_items_id AS jng_sp_orders_items_id, joi.leadtime_start_date, CONCAT('4-',SUBSTR(psh.status,1,1)) status, psh.status_date";
         $query .= " FROM jng_sp_orders_items joi";
         $query .= " INNER JOIN production_status_history psh ON psh.type='SP' AND psh.orders_items_id = joi.jng_sp_orders_items_id";
         $query .= " WHERE joi.status >= 1 AND joi.jng_sp_orders_items_id = {$orders_items_id}";
         $query .= " ) dt";
         $query .= " ORDER BY status_date, status";
     } elseif ($order_type == self::ORDER_TYPE_JG) {
         $query = " SELECT * FROM (";
         $query .= " SELECT opsh.orders_products_id, op.leadtime_start_date, opsh.status, opsh.status_date";
         $query .= " FROM orders_products op";
         $query .= " INNER JOIN orders_products_status_history opsh ON opsh.orders_products_id = op.orders_products_id";
         $query .= " WHERE op.status >= 1 AND op.orders_products_id = {$orders_items_id}";
         $query .= " UNION ALL";
         $query .= " SELECT psh.orders_items_id AS orders_products_id, op.leadtime_start_date, CONCAT('4-',SUBSTR(psh.status,1,1)) status, psh.status_date";
         $query .= " FROM orders_products op";
         $query .= " INNER JOIN production_status_history psh ON psh.type='JG' AND psh.orders_items_id = op.orders_products_id";
         $query .= " WHERE op.status >= 1 AND op.orders_products_id = {$orders_items_id}";
         $query .= " ) dt";
         $query .= " ORDER BY status_date, status";
     } elseif ($order_type == self::ORDER_TYPE_DP) {
         $query = " SELECT * FROM (";
         $query .= " SELECT do.depot_orders_id, do.leadtime_start_date, dosh.status, dosh.update_time AS status_date";
         $query .= " FROM depot_orders do";
         $query .= " INNER JOIN depot_orders_status_history dosh ON dosh.depot_orders_id = do.depot_orders_id";
         $query .= " WHERE do.status >= 1 AND do.depot_orders_id = {$orders_items_id}";
         $query .= " UNION ALL";
         $query .= " SELECT psh.orders_items_id AS depot_orders_id, do.leadtime_start_date, CONCAT('4-',SUBSTR(psh.status,1,1)) status, psh.status_date";
         $query .= " FROM depot_orders do";
         $query .= " INNER JOIN production_status_history psh ON psh.type='DP' AND psh.orders_items_id = do.depot_orders_id";
         $query .= " WHERE do.status >= 1 AND do.depot_orders_id = {$orders_items_id}";
         $query .= " ) dt";
         $query .= " ORDER BY status_date, status";
     }
     if ($query != '') {
         $dbq = tep_db_query($query);
         $prev_oi_id = '';
         $kpi_status_cycletime = array();
         while ($row = tep_db_fetch_array($dbq)) {
             $leadtime_start_date = $row['leadtime_start_date'];
             $current_status = $row['status'];
             $oi_id = $row['jng_sp_orders_items_id'];
             //use leadtime start date as start date when orders processed
             if ($current_status == 1) {
                 $row['status_date'] = $leadtime_start_date;
             }
             if ($oi_id == $prev_oi_id && isset($prev_status)) {
                 //UPDATED TO USE AVERAGE VALUE
                 if (!isset($kpi_status_cycletime[$prev_status])) {
                     $kpi_status_cycletime[$prev_status] = array();
                 }
                 if (!isset($kpi_status_cycletime[$prev_status][$oi_id])) {
                     $kpi_status_cycletime[$prev_status][$oi_id] = 0;
                 }
                 $kpi_status_cycletime[$prev_status][$oi_id] += strtotime($row['status_date']) - strtotime($prev_status_time);
             }
             $prev_status = $row['status'];
             $prev_status_time = $row['status_date'];
             $prev_oi_id = $oi_id;
         }
         //---START Manage status to show using below array (notes: status need to be sorted based on real process - from new until ends)
         $status_to_show = array('1', '2', '3', '4');
         //Include also production sub status
         $prod_sub_status = getProductionSubStatus(4);
         foreach ($prod_sub_status as $pss_k => $pss_v) {
             array_push($status_to_show, "4-{$pss_k}");
         }
         for ($s = 5; $s <= 7; $s++) {
             array_push($status_to_show, "{$s}");
         }
         //Also Depot/Mixed status, in case there order taken over by HH then set back to MTO
         array_push($status_to_show, '8');
         //---END Manage status to show...
         $row = array();
         $tooltip_leadtime = array();
         $row['c1'] = 'Tabs Through';
         $row['c2'] = 'Lead Time';
         $tooltip_leadtime[] = $row;
         $total_process = 0;
         $total_process_sub = array();
         $total_process_temp = array();
         $result = false;
         $row_temp = array();
         $tab_have_sub_status = array('4');
         foreach ($status_to_show as $sv) {
             $colval = isset($kpi_status_cycletime[$sv]) ? array_sum($kpi_status_cycletime[$sv]) / count($kpi_status_cycletime[$sv]) : 0;
             $temp_status = explode('-', $sv);
             if ($colval > 0 || !isset($temp_status[1]) && isset($kpi_status_cycletime[$sv])) {
                 $result = true;
                 $total_process += $colval;
                 if (isset($temp_status[1])) {
                     $total_process_sub[$temp_status[0]] += $colval;
                 }
                 if (in_array($temp_status[0], $tab_have_sub_status) && !isset($row_temp[$temp_status[0]])) {
                     $row_temp[$temp_status[0]]['c1'] = '<strong style="font-size:13px;">' . statusName($temp_status[0]) . '</strong>';
                     $total_process_temp[$sv] += $colval;
                 }
                 $row_temp[$sv]['c1'] = $temp_status[0] == '4' && isset($temp_status[1]) ? statusNameProduction($temp_status[1]) : statusName($sv);
                 $row_temp[$sv]['c2 right'] = displayDuration($colval, 'day', 2);
                 if (!isset($temp_status[1])) {
                     $row_temp[$sv]['c1'] = '<strong style="font-size:13px;">' . $row_temp[$sv]['c1'] . '</strong>';
                     $row_temp[$sv]['c2 right'] = '<strong style="font-size:13px;">' . $row_temp[$sv]['c2 right'] . '</strong>';
                 }
                 if (isset($temp_status[1])) {
                     $row_temp[$sv]['c1'] = '<div style="margin-left:20px;">' . $row_temp[$sv]['c1'] . '</div>';
                 }
             }
         }
         //Show sub status leadtime
         foreach ($row_temp as $rk => $rv) {
             $row = array();
             if (in_array($rk, $tab_have_sub_status)) {
                 if (isset($total_process_sub[$rk])) {
                     $tps = $total_process_sub[$rk];
                     $total_process -= $total_process_temp[$rk];
                 } else {
                     $tps = $total_process_temp[$rk];
                 }
                 $row_temp[$rk]['c2 right'] = '<strong style="font-size:13px;">' . displayDuration($tps, 'day', 2) . '</strong>';
             }
             $row['c1'] = $row_temp[$rk]['c1'];
             $row['c2 right'] = $row_temp[$rk]['c2 right'];
             $tooltip_leadtime[] = $row;
         }
         if (!$result) {
             $result = "No lead time per tab measured yet for this";
         } else {
             $row['c1'] = '<span style="font-size:13px;">Total</span>';
             $row['c2 right'] = '<span style="font-size:13px;">' . displayDuration($total_process, 'day', 2) . '</span>';
             $tooltip_leadtime[] = $row;
             $result = tep_draw_table('summary2', $tooltip_leadtime, false, true);
         }
     } else {
         $result = 'Query not found for this order type';
     }
     return $result;
 }
Exemplo n.º 12
0
     case 1:
         if (time() - $row['last_access_time_manobo'] <= $min_time_user_idle) {
             $manobo_online_status = "is-online";
             $manobo_online_status_title = "online";
             $manobo_online_status_class = 'green';
         } else {
             $manobo_online_status = "is-idle";
             $manobo_online_status_title = "idle";
             if (time() - $row['last_access_time_manobo'] > $min_time_user_offline) {
                 $manobo_online_status = "is-offline";
                 $manobo_online_status_title = "offline";
             }
         }
         break;
 }
 $last_access_time = $row['last_access_time_manobo'] > 0 ? displayDuration(time() - $row['last_access_time_manobo'], 1) . " ago" : '';
 $u = array();
 $img = is_file(DIR_WS_IMAGES . $row['users_image']) ? $row['users_image'] : 'user-default.png';
 $query = "SELECT muhn.* FROM minierp_users mu";
 $query .= " LEFT JOIN minierp_users_has_notifications muhn ON mu.id=muhn.user_id";
 $query .= " WHERE muhn.need_feedback=1 AND muhn.user_id='{$row['id']}' AND muhn.posted_by!=mu.username";
 $result = tep_db_query($query);
 $count_notif = tep_db_num_rows($result);
 //            $count_notif = count($class_n->retrieveList("user_id='$row[id]'", $sort_older_first));
 $count_notif <= 0 ? $open_notif = '<span class="green">0</span>' : ($open_notif = $count_notif > 10 ? "<span style='font-weight:bold;'class='red'>{$count_notif}</span>" : $count_notif);
 $u['img'] = webImage($img, '50', '50', 'User ' . $row['id']);
 $u['name'] = $row['username'];
 if ($row['email'] != '') {
     $u['name'] .= '<br /><a href="mailto:' . $row['email'] . '">' . $row['email'] . '</a>';
 }
 $u['o'] = '<span class="' . $manobo_online_status . '" title="user is ' . $manobo_online_status_title . ' on manobo"></span><br /><span class="' . $manobo_online_status_class . '">' . $manobo_online_status_title . '</span>';
Exemplo n.º 13
0
function drawDraftRow($draft_count, $drafts_id, $rowclass, $status, $sub_status = '', $designs_id = '')
{
    $descoldata = getDesCol($status);
    $descol = $descoldata['cols'];
    $descol_count = $descoldata['count'];
    $draft = new design_draft($drafts_id);
    $products = $draft->retrieveProducts();
    $detail_link = '<a href="?open=designs-draft-detail&amp;id=' . $draft->id . '&amp;hidemenu=true" class="view_webpage">';
    $row .= '<tr id="dra-' . $draft->id . '" class="dra ' . $rowclass . ' desdra-' . $draft->designs_id . '">';
    $new_elements = $draft->retrieveElements();
    $wax_stats = array();
    $wax_stats[] = 'New Wax';
    $wax_stats[] = 'Revision';
    $qwax = "SELECT mu.id, mu.username";
    $qwax .= " FROM minierp_users mu";
    $qwax .= " LEFT JOIN minierp_groups_members mgm ON mgm.minierp_users_id = mu.id";
    $qwax .= " WHERE mgm.minierp_groups_id = '46'";
    $rwax = tep_db_query($qwax);
    $waxers = array();
    while ($r = tep_db_fetch_array($rwax)) {
        $waxers[$r['id']] = $r['username'];
    }
    unset($waxers['137']);
    foreach ($descol as $class => $key) {
        $value = '&nbsp;';
        switch ($key) {
            //                            case 'Lead Time':
            //                                $value = 'DRAFT '.($x+1);
            //                                break;
            case 'ID':
                $value = $draft->id;
                if ($draft->colors_request != '') {
                    $value .= '<br/><img src="images/colors_circle_16x16.png" title="This Draft have Colors Requested" />';
                }
                break;
            case 'Image':
                $weblink = webImageSource($draft->image_1, IMAGE_SIZE_BIG_1, IMAGE_SIZE_BIG_1);
                $value = '<a href="' . $weblink . '" class="view_image">' . webImage($draft->image_1, IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, $draft->name, 'img-border') . '</a>';
                break;
            case 'Name':
                $value = '<strong>Draft ' . ($draft_count + 1) . '</strong><br />' . ($draft->name == '' ? '<span class="notice">No Name Specified</span>' : '<span>' . $draft->name . '</span>');
                break;
            case 'Products':
                if (count($products) > 0) {
                    $value = '';
                    if ($status <= 5 || $status == 13) {
                        foreach ($products as $p) {
                            $value .= productLinkWithID($p['products_id'], $p['products_name'], '&amp;designs_id=' . $designs_id);
                        }
                    } else {
                        foreach ($products as $p) {
                            $pname = htmlspecialchars($p['products_name']);
                            $link = '<a href="?open=product-detail&amp;products_id=' . $p['products_id'] . '" target="_blank" title="' . $pname . '">';
                            if ($status <= 5) {
                                $link_text = $p['products_id'];
                            } else {
                                $tooltip = $pname;
                                $img_class = '';
                                if ($status == 8) {
                                    $link = '<a href="?open=designs-finalize&amp;id=' . $p['products_id'] . '&amp;hidemenu=true" class="view_webpage">';
                                    if ($p['finalized_time'] != '' && $p['finalized_by'] != '') {
                                        $fint = time() - $p['finalized_time'];
                                        $duration = $fint > 0 ? displayDuration($fint, 1) . ' ago' : 'just now';
                                        $tooltip = 'Finalized by ' . $p['finalized_by'] . ' (' . trim($duration) . ')';
                                        $img_class = 'img-status-ok';
                                    } else {
                                        $img_class = 'img-status-bad';
                                    }
                                } elseif ($status == 7) {
                                    $link = '<a href="?open=designs-details&amp;id=' . $p['products_id'] . '&amp;hidemenu=true" class="view_webpage">';
                                    if ($p['detailed_time'] != '' && $p['detailed_by'] != '') {
                                        $fint = time() - $p['detailed_time'];
                                        $duration = $fint > 0 ? displayDuration($fint, 1) . ' ago' : 'just now';
                                        $tooltip = 'Details Completed by ' . $p['detailed_by'] . ' (' . trim($duration) . ')';
                                        $img_class = 'img-status-ok';
                                    } else {
                                        $img_class = 'img-status-bad';
                                    }
                                } elseif ($status == 6) {
                                    $link = '<a href="?open=designs-graphics&amp;id=' . $p['products_id'] . '&amp;hidemenu=true" class="view_webpage">';
                                }
                                $link_text = webimage($p['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, $tooltip, $img_class, 'style="margin-bottom:1px;"');
                            }
                            $del = '<div id="delpid-' . $p['products_id'] . '" class="ui-state-default ui-corner-all del-prod" style="width:16px;float:right;" title="Delete Product"><span class="ui-icon ui-icon-close" style="cursor: pointer;"></span></div>';
                            $value .= '<div>' . $del . $link . $link_text . '</a></div>';
                        }
                    }
                }
                break;
            case 'Elements':
                $value = '';
                if (count($new_elements) > 0) {
                    foreach ($new_elements as $ne) {
                        $el_style = '';
                        $el_image = '';
                        $el_class = '';
                        if ($ne['elements_image'] != '') {
                            $el_style = 'margin-bottom:1px;';
                            if ($sub_status == 7) {
                                $el_class = $ne['is_finalized'] == '1' ? 'img-status-ok' : 'img-status-bad';
                            }
                            $el_image = webImage($ne['elements_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, '', $el_class);
                        }
                        use_class('element');
                        $e = new element($ne['elements_id']);
                        if ($sub_status == 2) {
                            //SHOW WAX COMPLEXITY ON TAB WAX
                            $wax_complexity = $e->wax_complexity != '' ? " ({$e->wax_complexity})" : '';
                            $wax_complexity_name = $e->wax_complexity != '' ? ' (' . getComplexity($e->wax_complexity) . ' wax complexity)' : '';
                        }
                        $value .= elementLinkWithID($ne['elements_id'], $ne['elements_id'] . " : " . $ne['elements_description'] . $wax_complexity_name, $drafts_id, $el_style, $el_image, "{$wax_complexity}");
                        unset($e);
                        //SET NEW ELEMENTS FINALIZED
                        if ((is_null($ne['finalized_date']) || $ne['finalized_date'] == '') && $ne['is_finalized'] == '1') {
                            $sda = array();
                            $sda['finalized_date'] = date("Y-m-d H:i:s");
                            $sda['finalized_by'] = $session_userinfo['username'];
                            tep_db_perform('designs_elements', $sda, 'update', "designs_id='" . $design->id . "' AND elements_id=" . $ne['elements_id']);
                        }
                    }
                }
                break;
            case 'Action':
                $value = '';
                $value .= '<input type="hidden" name="drafts_id" value="' . $draft->id . '" />';
                $value .= '<input type="hidden" name="status" value="' . $status . '" />';
                $value .= '<input type="hidden" name="sub_status" value="' . $sub_status . '" />';
                $actions = array();
                if ($status == 5) {
                    if ($sub_status == 3) {
                        $ap_class = count($products) > 0 ? ' class="red"' : ' class="green"';
                        $actions[] = '<input type="button" name="AP"' . $ap_class . ' value="&oplus; ADD PRODUCT" title="Add Products to this Draft" />';
                    }
                }
                //                if($status==6 && $draft->products_image_by=='') {
                //                    $actions[] = '<input type="button" name="GD" class="green" value="&reg; SET AS MINE" title="Set Draft as yours (GD Team only)" />';
                //                }
                if ($status == 14 && $draft->products_image_by == '') {
                    if ($sub_status == 1) {
                        $actions[] = '<input type="button" name="GD" class="green" value="&reg; SET AS MINE" title="Set Draft as yours (GD Team only)" />';
                    }
                }
                if ($status == 10 && ($sub_status == '' || $sub_status == 0 || $sub_status == 1)) {
                    $cel_class = count($new_elements) > 0 ? ' class="red"' : ' class="green"';
                    $actions[] = '<input type="button" name="CE"' . $cel_class . ' value="&oplus; CREATE ELEMENT" title="Create New Element for this Draft" />';
                }
                if ($status == 10 && $sub_status == 2) {
                    if ($draft->wax_history_info == '') {
                        $pic_wax = '<div class="pic_wax" style="margin-bottom:5px;float:left;"><strong style="margin-right:5px;">Wax PIC</strong><select id="pic_wax"><option value="0">Show All</option>' . loadComboListFromArray($waxers, null, null, false) . '</select></div>';
                        $pic_wax .= '<div class="wax_status" style="margin-bottom:5px;float:left;"><strong style="margin-right:5px;">Wax Status</strong><select id="wax_status"><option value="0">Show All</option>' . loadComboListFromArray($wax_stats, null, null, false) . '</select></div>';
                        $pic_wax .= '<input class="wax_submit" type="button" name="SW" value="Save WAX" title="Save WAX"/>';
                        $pic_wax .= '<input class="wax_done green" type="button" style="display:none;" name="WD" value="&#10003; WAX DONE" title="Set Wax as done" />';
                    } else {
                        if (substr($draft->wax_history_info, -1) == '|') {
                            $pic_wax = '<div class="pic_wax" style="margin-bottom:5px;float:left;"><strong style="margin-right:5px;">Wax PIC</strong><select id="pic_wax"><option value="0">Show All</option>' . loadComboListFromArray($waxers, null, null, false) . '</select></div>';
                            $pic_wax .= '<div class="wax_status" style="margin-bottom:5px;float:left;"><strong style="margin-right:5px;">Wax Status</strong><select id="wax_status"><option value="0">Show All</option>' . loadComboListFromArray($wax_stats, null, null, false) . '</select></div>';
                            $pic_wax .= '<input class="wax_submit" type="button" name="SW" value="Save WAX" title="Save WAX"/>';
                            $pic_wax .= '<input class="wax_done green" type="button" style="display:none;" name="WD" value="&#10003; WAX DONE" title="Set Wax as done" />';
                        } else {
                            $pic_wax = '<input class="wax_done green" type="button" name="WD" value="&#10003; WAX DONE" title="Set Wax as done" />';
                            $pic_wax .= '<div class="pic_wax" style="margin-bottom:5px;float:left;display:none;"><strong style="margin-right:5px;">Wax PIC</strong><select id="pic_wax"><option value="0">Show All</option>' . loadComboListFromArray($waxers, null, null, false) . '</select></div>';
                            $pic_wax .= '<div class="wax_status" style="margin-bottom:5px;float:left;display:none;"><strong style="margin-right:5px;">Wax Status</strong><select id="wax_status"><option value="0">Show All</option>' . loadComboListFromArray($wax_stats, null, null, false) . '</select></div>';
                            $pic_wax .= '<input class="wax_submit" type="button" style="display:none;" name="SW" value="Save WAX" title="Save WAX"/>';
                        }
                    }
                    $actions[] = $pic_wax;
                }
                if ($status == 12 || $status == 7 || $status == 8) {
                    $acttemp = '';
                    foreach ($products as $p) {
                        $acttemp .= '<div style="height:81px;"><div style="padding-top:40px"><input id="sof-' . $p['products_id'] . '" type="checkbox" name="sample_order"' . ($p['create_sample'] == '1' ? ' checked="checked"' : '') . ' style="width:auto;" title="Check this to auto generate sample order automatically when the product is finalized" /> <label for="sof-' . $p['products_id'] . '">Create <abbr title="Sample Order">SO</abbr></label></div></div>';
                    }
                    $actions[] = $acttemp;
                }
                $clear = '<input type="button" name="DC" value="&times; CLEAR" title="Clear Approval Status" />';
                $kill = '<input type="button" name="DR" class="red" value="&times; Kill" title="Kill Draft" />';
                if ($draft->approve_status == '0') {
                    if ($status == '4') {
                        $actions[] = '<input type="button" name="DA" class="green" value="&hearts; Approve" title="Approve Draft for New Elements" />';
                    }
                    if ($status == '4' || $status == '5' || $status == '10') {
                        $actions[] = $kill;
                    }
                } elseif ($draft->approve_status == 'A') {
                    if ($status < 5) {
                        $actions[] = '<input type="button" class="green" value="&hearts; Approved" disabled="disabled" />';
                    } elseif ($status == '5' || $status == '10') {
                        $actions[] = $kill;
                    }
                    if ($status >= 5) {
                        $clear = '';
                    }
                } elseif ($draft->approve_status == 'R' && $status < 5) {
                    $actions[] = '<input type="button" class="red" value="&hearts; Killed" disabled="disabled" />';
                }
                if ($draft->approve_status != '0') {
                    $actions[] = $clear;
                }
                $value .= implode('<br />', $actions);
                break;
        }
        if ($key == 'ID' || $key == 'Name') {
            $value = $detail_link . $value . '</a>';
        }
        if ($key == 'Name') {
            $showComment = false;
            $showGD = false;
            $showWaxHistory = false;
            if ($status == 10 && $sub_status == 2 && $draft->wax_history_info != '') {
                $showWaxHistory = true;
            }
            if ($draft->comments != '' && $draft->comments_lub != '' && $draft->comments_lut != '') {
                $showComment = true;
            }
            if ($showWaxHistory) {
                $wax_pic = explode('||', $draft->wax_history_info);
                $history_array = array();
                $p = array();
                $history_wax = false;
                $p['pic w100'] = 'PIC';
                $p['start w100'] = 'Start Date';
                $p['end w100'] = 'End Date';
                $p['wax_status w100'] = 'Status';
                $p['lead w100'] = 'Lead Time';
                $table_pic[] = $p;
                foreach ($wax_pic as $text) {
                    list($pics, $wax_status, $start_date, $end_date) = explode('|', $text);
                    if ($end_date == '') {
                        $wax_start = time() - strtotime($start_date);
                        $current_duration = $wax_start > 0 ? displayDuration($wax_start, 1) . ' ago' : 'just now';
                        $value .= '<br /><br /<span style="font-weight:bold;">PIC Wax: ' . $pics . ' (' . $current_duration . ') - ' . $wax_status . '</span>';
                    }
                    if ($end_date != '') {
                        $wax_end = strtotime($end_date) - strtotime($start_date);
                        $p['pic w100'] = $pics;
                        $p['start w100'] = date('d-M-y', strtotime($start_date));
                        $p['end w100'] = date('d-M-y', strtotime($end_date));
                        $p['wax_status w100'] = $wax_status;
                        $p['lead w100'] = displayDuration($wax_end, 1);
                        $table_pic[] = $p;
                        $history_wax = true;
                    }
                }
                if ($history_wax) {
                    $title_pic_wax = tep_draw_table('main_center', $table_pic);
                    $value .= '<br /><div style="float:left;">Wax History</div><span class="ui-icon ui-icon-info"></span><span style="display:none;">' . $title_pic_wax . '</span>';
                }
            }
            if ($status >= 6 && $draft->products_image_by != '' && $draft->products_image_start != '') {
                $showGD = true;
                if ($showComment) {
                    if ($draft->comments_lut < $draft->products_image_start) {
                        $showComment = false;
                    }
                }
            }
            if ($showGD) {
                $gdstart = time() - $draft->products_image_start;
                $duration = $gdstart > 0 ? displayDuration($gdstart, 1) . ' ago' : 'just now';
                $value .= '<br /><br /><span class="red">GD: <strong>' . $draft->products_image_by . '</strong>';
                $value .= ' (' . trim($duration) . ')</span>';
            }
            if ($showComment) {
                $lastcomment = time() - strtotime($draft->comments_lut);
                $duration = $lastcomment > 0 ? displayDuration($lastcomment, 1) . ' ago' : 'just now';
                //if($lastcomment<1*24*60*60) {
                $value .= '<br /><br /><span class="red">Last Comment by <strong>' . $draft->comments_lub . '</strong>';
                $value .= '<br />posted ' . $duration . '</span>';
            }
            $value = '<div>' . $value . '</div>' . drawObjectSocialLine($draft, 'dra');
        }
        $row .= '<td class="' . $class . '">' . $value . '</td>';
    }
    $row .= '</tr>';
    return $row;
}
Exemplo n.º 14
0
 /**
  * DEPRECATED! please use the one in class product as an object
  * @param Int $products_id
  * @param Int $articles_id
  * @param Int $current_stock
  * @return String
  */
 function displayDIOH($products_id, $articles_id, $current_stock)
 {
     $dioh = $this->getDIOH($products_id, $articles_id, $current_stock);
     $p = $this->retrieveDetail($products_id, 'p');
     if (is_null($dioh)) {
         $result = '<abbr class="notice" title="No Recent Sales">NRS</abbr>';
     } else {
         $result = displayDuration($dioh * 86400, 'day');
         if ($result == '-') {
             $result = '0 day';
         }
         if (is_null($this->diohStopLevel)) {
             $this->loadDIOHsettings();
         }
         if ($dioh < $this->diohStopLevel[$p['p']['stars']]) {
             $result = '<span class="red">' . $result . '</span>';
         }
     }
     return $result;
 }
Exemplo n.º 15
0
     if ($row['attribute_category_id'] != '6') {
         $dioh_collection_all[] = $dioh;
         if ($row['sold_monthly_1'] > 0) {
             $dioh_collection_moving[] = $dioh;
         }
         if ($row['pieces_per_qty_type'] <= 1) {
             $dioh_collection_supermarkt[] = $dioh;
         } else {
             $dioh_collection_scheduled[] = $dioh;
         }
     }
 }
 $avg_dioh_all = count($dioh_collection_all) > 0 ? displayDuration(array_sum($dioh_collection_all) / count($dioh_collection_all) * 86400, 'day') : '<span class="notice">N/A</span>';
 $avg_dioh_moving = count($dioh_collection_moving) > 0 ? displayDuration(array_sum($dioh_collection_moving) / count($dioh_collection_moving) * 86400, 'day') : '<span class="notice">N/A</span>';
 $avg_dioh_supermarkt = count($dioh_collection_supermarkt) > 0 ? displayDuration(array_sum($dioh_collection_supermarkt) / count($dioh_collection_supermarkt) * 86400, 'day') : '<span class="notice">N/A</span>';
 $avg_dioh_scheduled = count($dioh_collection_scheduled) > 0 ? displayDuration(array_sum($dioh_collection_scheduled) / count($dioh_collection_supermarkt) * 86400, 'day') : '<span class="notice">N/A</span>';
 $result = '<div class="kpi-infobox" style="float:right;">';
 //$result .= '<div style="padding-bottom:10px;"><strong>Query Date </strong><input type="text" id="kpisourcing" title="select date to load data based on query date" class="date_picker input" readonly="readonly" value="'.$date_id_userformat.'"/></div>';
 $result .= '<div class="ui-state-default ui-corner-all" style="float:right;margin:10px 10px 0 0"><span title="Hide/Show KPI Sourcing" class="ui-icon ui-icon-minus" id="kpi-depot-info"></span></div>';
 $result .= '<div class="ibox ui-corner-all" style="padding:10px;">';
 $result .= '<h3>Elements Summary</h3>';
 $result .= '<table border="0" cellpadding="0" cellspacing="0">';
 $result .= '<tr><td width="250">Total Stock Value</td><td>=</td><td>' . displayCurrency('EUR', $el_stock_value) . '</td></tr>';
 $result .= '<tr><td width="250">Average DIOH all elements</td><td>=</td><td>' . $avg_dioh_all . '</td></tr>';
 $result .= '<tr><td width="250">Average DIOH supermarkt elements</td><td>=</td><td>' . $avg_dioh_supermarkt . '</td></tr>';
 $result .= '<tr><td width="250">Average DIOH scheduled elements</td><td>=</td><td>' . $avg_dioh_scheduled . '</td></tr>';
 $result .= '<tr><td width="250">Average DIOH moving elements</td><td>=</td><td>' . $avg_dioh_moving . '</td></tr>';
 $result .= '<tr><td colspan="2" class="smallText notice">* ALL Average DIOH is exluding Filling Elements</td></tr>';
 $result .= '</table>';
 $result .= '</div>';
 //.ibox
Exemplo n.º 16
0
 $product_counter++;
 $reported_date = date("d-M-y", strtotime($row['reported_date']));
 $rowclass = $rowclass == 'o' ? 'e' : 'o';
 $no = $product_counter;
 $product_row = $product_rowstart + $product_counter;
 $order_status = $row['order_status'];
 $prod_status = $row['prod_status'];
 $late_order_status = $row['status'];
 if ($row['type'] == 'DP') {
     $order_detail = 'DP-' . $row['order_items_id'];
 } elseif ($row['type'] == 'SP') {
     $order_detail = $row['type'] . '-' . $row['order_items_id'];
 } else {
     $order_detail = $row['type'] . '-' . $row['order_items_id'];
 }
 $lead_time = displayDuration(strtotime('now') - strtotime($row['leadtime_start_date']), 'day', 1);
 if ($row['type'] == 'SP') {
     $sp_name = $row['sp_name'];
 } elseif ($row['type'] == 'DP') {
     $sp_name = $class_do->translateOrderSource($row['trans_type'], $row['trans_id'], true, null, $row['products_id']);
 } else {
     $sp_name = 'JG';
 }
 $customer_name = $row['customers_name'];
 $p_image = DIR_WS_IMAGES . $row['products_image'];
 if (isset($article_rowstart)) {
     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');
Exemplo n.º 17
0
$average_leadtime = count($orders_leadtime) > 0 ? array_sum($orders_leadtime) / count($orders_leadtime) : 0;
if ($average_leadtime > 0) {
    $average_leadtime_text = '<h3>Total Average Leadtime: ' . displayDuration($average_leadtime) . '</h3>';
}
//DAILY AVERAGE
$table = array();
$header = array();
$header['d'] = 'Day';
$header['i'] = 'Lead Time';
$header['t'] = 'Total Orders';
$table[] = $header;
foreach ($orders_dailly_leadtime as $period => $lt) {
    $total_orders = count($lt);
    $row = array();
    $row['d'] = substr($period, -2) . '.' . substr($period, 4, 2) . '.' . substr($period, 0, 4);
    $row['i'] = displayDuration(array_sum($lt) / $total_orders);
    $row['t'] = $total_orders;
    //.'<br />'.implode(',', $orders_daily[$period]);
    $table[] = $row;
}
$daily_table = count($table) > 1 ? tep_draw_table('spo', $table) : '';
if (isset($_POST['me_action']) && $_POST['me_action'] == 'RELOAD') {
    echo utf8_encode($average_leadtime_text);
    echo utf8_encode($daily_table);
    exit;
}
$content .= '<div class="notice" style="margin:-15px 0 20px 0;">Average time of SP orders from set to <strong>"Production"</strong> until shipped <strong>"to HH"</strong> (namechains are excluded).</div>';
$content .= '<div class="bold">Period</div>';
$content .= '<div style="margin:5px 0 20px 0;">';
$content .= ' <input type="text" class="date_picker" id="start_date" value="' . $start_date . '" />';
$content .= ' <input type="text" class="date_picker" id="end_date" value="' . $end_date . '" />';
<?php

global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
$q = "SELECT joir.return_time, joi.confirm_delivery_time";
$q .= " FROM jng_sp_orders_items_return joir";
$q .= " LEFT JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_items_id=joir.jng_sp_orders_items_id";
$q .= " LEFT JOIN jng_sp_orders jo ON jo.jng_sp_orders_id=joi.jng_sp_orders_id";
$q .= " WHERE return_time < DATE('2009-08-01');";
$r = tep_db_query($q);
$time_diff = array();
while ($row = tep_db_fetch_array($r)) {
    $time_diff[] = strtotime($row['return_time']) - strtotime(date('Y-m-d 00:00:00', strtotime($row['confirm_delivery_time'])));
}
$avg_time = array_sum($time_diff) / count($time_diff);
$avg_duration = displayDuration($avg_time);
//var_dump($avg_time);
echo $avg_duration;
tep_db_close();
Exemplo n.º 19
0
function displayCycleTime($last_moved_date)
{
    return '<span class="ct">' . displayDuration(strtotime('now') - strtotime($last_moved_date), 'day', 2) . '</span>';
}
Exemplo n.º 20
0
 function displaySafetyDT($current_stock, $current_dt)
 {
     if (is_null(self::$dtMultiplier)) {
         self::loadDIOHsettings();
     }
     $sdt = $current_dt * self::$dtMultiplier;
     $result = trim(displayDuration($sdt * 86400, 'day'));
     $dioh = $this->getDIOH($current_stock);
     if (is_null($dioh) || $dioh >= $sdt) {
         $result = '<span class="green">' . $result . '</span>';
     } else {
         $result = '<strong class="red">' . $result . '</strong>';
     }
     return $result;
 }