function drawPLthumb($row, $hide = false) { global $jng_sp_id; $link = '?' . (is_null($jng_sp_id) ? 'open=product-detail&products_id=' : 'open=sp-product&id=') . $row['products_id']; $l = '<div id="pid-' . $row['products_id'] . '" class="pro-thumb">'; $l .= '<input type="hidden" name="products_id" value="' . $row['products_id'] . '" />'; $l .= '<div><a href="' . $link . '" target="_blank" title="Manage product detail ID: ' . $row['products_id'] . '">' . webImage($row['products_image'], '120', '120') . '</a></div>'; $l .= '<div>' . displayCurrency('EUR', $row['products_price']) . '</div>'; $l .= '<div class="blue" title="Click to add this product">(+) Add</div>'; $l .= '</div>'; return $l; }
function runElementQuery($outsourced_flag) { global $class_ea, $pcats, $all_period, $product_categories_name; $product_list = array(); $order_date_start = '2013-08-13'; $order_date_end = '2013-08-14'; $q = "SELECT\n p.products_image,\n ptc.categories_id AS pcatid,\n MONTH(joi.shipping_window_open) AS period,\n p.products_id,\n SUM(joi.order_quantity) AS total_ordered\n FROM jng_sp_orders jo\n LEFT JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_id=jo.jng_sp_orders_id\n LEFT JOIN products p ON p.products_id=joi.products_id\n LEFT JOIN products_to_categories ptc ON ptc.products_id=joi.products_id\n WHERE jo.jng_sp_id=5 AND jo.order_date BETWEEN '{$order_date_start}' AND '{$order_date_end}' AND p.is_outsourced='{$outsourced_flag}'\n GROUP BY products_id, period\n ORDER BY pcatid, products_id, period"; $r = tep_db_query($q); $products_total = array(); while ($row = tep_db_fetch_array($r)) { $cid = $row['pcatid']; $pid = $row['products_id']; $p = $row['period']; if (!isset($pcats[$cid])) { $pcats[$cid] = $product_categories_name[$cid]; } if (!in_array($p, $all_period)) { $all_period[] = $p; } if (!isset($product_list[$cid])) { $product_list[$cid] = array(); } if (!isset($product_list[$cid][$pid])) { $product_list[$cid][$pid] = array(); } if (!isset($product_list[$cid][$pid]['id'])) { $product_list[$cid][$pid]['id'] = '<div>' . $pid . '</div>'; } if (!isset($product_list[$cid][$pid]['image'])) { $product_list[$cid][$pid]['image'] = '<div>' . webImage($row['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, "Product {$pid}") . '</div>'; } $product_list[$cid][$pid][$p] = '<div>' . intval($row['total_ordered']) . '</div>'; if (!isset($products_total[$pid])) { $products_total[$pid] = 0; } $products_total[$pid] += $row['total_ordered']; } foreach ($product_list as $cid => $plist) { foreach ($plist as $pid => $el) { foreach ($all_period as $p) { if (!isset($el[$p])) { $product_list[$cid][$pid][$p] = '<div>0</div>'; } } $product_list[$cid][$pid]['total'] = '<div>' . intval($products_total[$pid]) . '</div>'; } } return $product_list; }
function drawThumbs($links, $type, $addlink) { global $maxlinks; $results = ''; if (is_array($links[$type]) && count($links[$type]) > 0) { foreach ($links[$type] as $l) { $results .= '<div id="pl-' . $l['products_linking_id'] . '" class="pro-thumb">'; $results .= '<div>' . webImage($l['products_image'], '80', '80') . '</div>'; $results .= '<div>' . displayCurrency('EUR', $l['products_price']) . '</div>'; $results .= '<div class="red">(x) remove</div>'; $results .= '</div>'; } } else { $results .= ''; } $visible = count($links[$type]) < $maxlinks[$type] ? '' : 'style="display:none;"'; $addlink = sprintf($addlink, $visible, $type); $results .= $addlink; return $results; }
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; }
$content .= '</h3>'; $content .= '<div style="border-bottom:solid 2px #f0f0f0;width:100%;margin-bottom:10px;" class="' . $class . '"></div>'; } $classnf = $list['status'] == '0' ? ' isNew' : ''; $classnf .= $list['need_feedback'] == '1' ? ' isNFB' : ''; $titlenf = $list['status'] == '0' ? 'New notification' : ''; if ($list['need_feedback'] == '1') { $titlenf = 'Your feedback is needed'; } $content .= '<div id="' . $list['notifications_id'] . '" style="border-bottom:solid 1px #f0f0f0;width:100%;padding:5px;" class="notifications ' . $class . $classnf . '" title="' . $titlenf . '">'; if ($list['posted_by'] == '0' || $list['posted_by'] == 'auto-set' || strtolower($list['posted_by']) == 'manobo') { $user_img = 'user-manobo.png'; } else { $user_img = is_file(DIR_WS_IMAGES . $list['users_image']) ? $list['users_image'] : 'user-default.png'; } $content .= '<div style="float:left">' . webImage($user_img, '50', '50') . '</div>'; $content .= '<div style="margin:5px 0 0 55px;">'; $module_referer_url = $list['url'] != '' ? 'href="?' . $list['url'] . '&hidemenu=true" class="view_webpage"' : ''; $content .= '<a ' . $module_referer_url . '>' . nl2br($list['message']) . '<small class="notice" style="margin-left:10px;">' . date('g:ia', strtotime($list['posted_date'])) . '</small></a>'; if ($list['need_feedback'] != 1) { $content .= '<span class="ui-icon ui-icon-trash" title="Remove this notification">' . $list['notifications_id'] . '-' . $class . '</span>'; } elseif ($list['need_feedback'] == 1) { $content .= '<span class="ui-icon ui-icon-arrowreturnthick-1-w" style="float:right;cursor:pointer;" title="Set this notification as \'feedback replied\'">' . $list['notifications_id'] . '-' . $class . '</span>'; } $content .= '</div></div>'; } $content .= '</div></div>'; //if(count($notifications_new)>0) $notifications->setAsRead($notifications_new); } else { $content .= '<strong>No Notifications yet sent to you!</strong>'; }
$query = "SELECT p.products_id, p.products_model, p.products_image, p.products_price, p.products_price_old, p.stars, cat.categories_id, cd.categories_name FROM products p"; $query .= " LEFT JOIN products_to_categories cat ON cat.products_id=p.products_id"; $query .= " LEFT JOIN categories_description cd ON cd.categories_id=cat.categories_id AND cd.language_id='1'"; $query .= " WHERE p.products_id IN (" . $pids . ") ORDER BY cat.categories_id"; $result = tep_db_query($query); while ($row = tep_db_fetch_array($result)) { $cat[$row['categories_name']][] = array("id" => $row['products_id'], "image" => $row['products_image'], "price" => $row['products_price'], "price_old" => $row['products_price_old'], "model" => $row['products_model'], "stars" => $row['stars']); } foreach ($cat as $key => $value) { echo '<div style="clear:both;"></div>'; $total_prods = 0; $total_disc = 0; $content = '<div style="margin:0 auto 20px auto;">'; foreach ($value as $list) { $content .= '<div id="' . $list['id'] . '" style="float:left; border:solid 1px #ccc; text-align:center; margin:5px; background:#fff; width:170; height:250;" class="ui-corner-all">'; $images = webImage($list['image'], 150, 150); $price = displayCurrency('EUR', $list['price']); $price_old = displayCurrency('EUR', $list['price_old']); $stars = $class_pm->getDisplayStars($list['id'], $list['stars']); $total_prods++; $content .= '<div>' . $images . '</div>'; $content .= '<div>' . $stars . '</div>'; $content .= '<div>' . $list['id'] . " / " . $list['model'] . '</div>'; if ($price_old > 0) { $total_disc++; $content .= '<div class="notice deleted">' . $price_old . '</div>'; $content .= '<div class="red">' . $price . '</div>'; } else { $content .= '<div>' . $price . '</div>'; } $content .= '</div>';
$filter_query = ''; $el_query = tep_db_query("SELECT e.elements_id, e.elements_code, etes.item_number, e.elements_image AS image FROM element e\n INNER JOIN elements_to_elements_suppliers etes ON etes.elements_id=e.elements_id AND etes.is_default='1' AND etes.price_quantity_type='set'\n LEFT JOIN elements_images ei ON ei.elements_id=e.elements_id AND ei.elements_sample_name='EC1'\n LEFT JOIN elements_description ed ON ed.elements_id=e.elements_id AND ed.languages_id=2\n {$filter_query}\n GROUP BY e.elements_id ORDER BY e.elements_id"); $elements = array(); $e = array(); $e['i'] = '<div>Image</div>'; $e['j'] = '<div>J&G ID</div>'; $e['k'] = '<div>J&G Code</div>'; $e['l'] = '<div>J&G Name</div>'; $e['m'] = '<div>Supplier Code</div>'; $elements[] = $e; $grouper = array('+', '&', ','); while ($row = tep_db_fetch_array($el_query)) { $grabbed = false; foreach ($grouper as $g) { if (strpos($row['item_number'], $g) !== false) { $grabbed = true; break; } } if ($grabbed) { $e = array(); $e['i'] = '<div>' . webImage($row['image'], '130', '130') . '</div>'; $e['j'] = '<div>' . $row['elements_id'] . '</div>'; $e['k'] = '<div>' . $row['elements_code'] . '</div>'; $e['l'] = '<div>' . $row['name'] . '</div>'; $e['m'] = '<div>' . $row['item_number'] . '</div>'; $elements[] = $e; } } echo tep_draw_table('', $elements); tep_db_close();
$sda_return['shipping_paid'] = tep_db_prepare_input($_POST['shipping_paid']); $class_jo->returnItemUpdate($return_id, $sda_return); echo '<div class="green">Return detail is successfully saved</div>'; exit; } //START TEMPLATE $return_id = isset($_GET['id']) ? tep_db_prepare_input($_GET['id']) : ''; if ($return_id == '') { exit; } $return = $class_jo->retrieveReturnDetail($return_id); $item = $class_jo->retrieveItemDetail($return['jng_sp_orders_items_id']); $order = $class_jo->retrieveDetail($item['jng_sp_orders_id']); $pimg = webImageSource($item['products_image'], '500'); if ($pimg != '') { $pimg = webImage($item['products_image'], '120', '120', '', 'img-border img-padding'); } $content .= '<div style="float:left;">' . $pimg . '</div>'; $content .= '<div style="margin-left:150px;">'; $content .= '<table border="0" cellpadding="0" cellspacing="0">'; $order_id = $order['order_id'] == '' ? 'J&G ID: ' . $order['jng_sp_orders_id'] : $order['order_id']; if ($return['confirm_return'] == '1') { $return_reason = $class_jo->returnReasonText($return['return_reason']); $return_qty = $return['return_quantity']; $comment_c = nl2br($return['return_comment_customer']); $comment_j = nl2br($return['return_comment_jng']); $shipping_status = $return['shipping_paid'] == '1' ? 'Paid' : 'Unpaid'; } else { $return_reason = $class_jo->returnReasonCombo('', 'input2', 'return_reason', $return['return_reason']); $returnable = $item['order_quantity']; $return_data = $class_jo->retrieveReturnItem($item['jng_sp_orders_items_id']);
} //$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&id={ID2}&hidemenu=true" class="view_webpage">{ID3}</a></td>'; $row_template .= '<td colspan="' . (count($header) - 2) . '" class="load"> </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>'; $content .= loadComboList('element_category', 'element_category_id', 'name', $elcatfiltered); $content .= '</select></td></tr>'; $content .= '</table>'; $content .= '<table border="0" cellpadding="0" cellspacing="0" style="background:#eee;">';
} else { $qty .= $oi['quantity'] . ' ' . $oi['quantity_unit']; } $rowprice = $oi['quantity'] * $oi['unit_price']; } $qty .= '<br /><br /><span class="notice">1 ' . $oi['quantity_unit'] . ' = ' . $oi['unit_multiplier'] . ' qty</span>'; //$pri = '<input type="text" class="time" value="'.$oi['unit_price_order_currency'].'" /><br />'.$o['currency']; //$pri .= '<br /><br />'; $pri = displayCurrency($oi['unit_price_currency'], $oi['unit_price']); //$fpr = displayCurrency($o['currency'], $quantity * $oi['unit_price_order_currency']); //$fpr .= '<br />'; $fpr = displayCurrency($oi['unit_price_currency'], $rowprice); //$action .= '<input type="button" value="Change" />'; $oit = array(); $oit['d'] = $oicount; $oit['img'] = webImage($oi['elements_image'], '80', '80'); $oit['d2'] = $id; $oit['o'] = $qty; $oit['e'] = $pri; $oit['a'] = $fpr; $oit['t'] = $action; $oitable[] = $oit; } //$tabcontent .= '<div style="clear:both;">'; $tabcontent .= tep_draw_table('spo sticky-tablehead', $oitable); //$tabcontent .= '</div>'; $tabcontent .= '</div>'; $tabcontent .= '<div style="clear:both;"> </div>'; } } } elseif ($status == 'O') {
$post_result .= '</table>'; $ajaxResult = array(); $ajaxResult['result'] = $post_result; ajaxReturn($ajaxResult); exit; } } if (isset($_GET) && count($_GET) > 0) { $ean_no = $_GET['ean']; $pa = $class_pean->getProductArticle($ean_no); $products_id = $pa['products_id']; if ($products_id != '') { $qp = "SELECT p.*, pd.products_name FROM products p INNER JOIN products_description pd ON p.products_id = pd.products_id\n WHERE p.products_id = {$products_id} AND pd.language_id = 2"; $dbqp = tep_db_query($qp); $rp = tep_db_fetch_array($dbqp); $p_img = webImage($rp['products_image'], '350', '350', 'Products ' . $ean_no, 'ui-corner-all'); $p_length = $pa['length'] > 0 ? ' / ' . textLength($pa['length']) : ''; $is_best_product = $class_pm->isBestProduct($pa['products_id']); if ($is_best_product) { $used_form = '<table style="width:100%;position:absolute;top:0;left:0;" border="0" cellpadding="0" cellspacing="0">'; $used_form .= '<tr><td align="center" colspan="2">' . $p_img . '</td></tr>'; $used_form .= '<tr><td align="center" colspan="2" style="font-size:16px;font-weight:bold;">' . $rp['products_model'] . $p_length . '</td></tr>'; $used_form .= '<tr><td align="center" colspan="2" style="padding:9px;"><span class="bold" style="vertical-align:middle;font-size:34px;">Please Do Product Quality Check</span></td></tr>'; $used_form .= '<tr>'; $used_form .= '<input type="hidden" id="hid-ids" value="' . $pa['products_id'] . '-' . $pa['products_articles_id'] . '"/>'; $used_form .= '<td align="center"><input type="button" style="font-size:15px;" class="qcok green button" value="QC OK"/></td>'; $used_form .= '<td align="center"><input type="button" style="font-size:15px;" class="qcbad red button" value="QC BAD"/></td>'; $used_form .= '</tr>'; $used_form .= '</table>'; } else { $used_form .= '<table style="background:#ff0000;width:100%;height:100%;position:absolute;top:0;left:0;" border="0" cellpadding="0" cellspacing="0">';
$q .= " FROM products p"; $q .= " LEFT JOIN products_has_elements phe ON phe.products_id=p.products_id"; $q .= " LEFT JOIN elements e ON e.elements_id=phe.elements_id"; $q .= " LEFT JOIN elements_images ei ON ei.elements_id=phe.elements_id AND ei.elements_sample_name='EC1'"; $q .= " WHERE p.products_status='1' AND RIGHT(e.elements_code, 2)='PN'"; $q .= " GROUP BY phe.elements_id"; $q .= " ORDER BY total_used DESC"; $r = tep_db_query($q); while ($row = tep_db_fetch_array($r)) { $elements[] = $row; } $table = array(); $t = array(); $t[1] = 'No'; $t[2] = 'Image'; $t[3] = 'Element ID'; $t[4] = 'Element Code'; $t[5] = 'Total Used'; $table[] = $t; foreach ($elements as $counter => $row) { $t = array(); $t[1] = '<div>' . ($counter + 1) . '</div>'; $t[2] = '<div>' . webImage('elements/' . $row['elements_image'], '80', '80') . '</div>'; $t[3] = '<div>' . $row['elements_id'] . '</div>'; $t[4] = '<div>' . $row['elements_code'] . '</div>'; $t[5] = '<div>' . $row['total_used'] . '</div>'; $table[] = $t; } $content = tep_draw_table('', $table); echo $content; tep_db_close();
/** * Standard Display of Image Thumb with icons * @param int $width * @param int $height * @param string $additional_title * @param boolean $border * @param string $class * @param const $link_to IMAGE_LINKTO_BIGGER_IMAGE or IMAGE_LINKTO_PRODUCT_DETAIL * @return type */ public function displayImage($width, $height, $additional_title = '', $border = true, $class = '', $link_to = self::IMAGE_LINKTO_BIGGER_IMAGE) { $title = "Product {$this->id}"; if ($additional_title != '') { $title .= " {$additional_title}"; } $popup_title = 'View Larger Image (' . $this->id . '/' . $this->code . ')'; if ($additional_title != '') { $popup_title .= " {$additional_title}"; } $border_class = $border ? 'img-border' : ''; if ($border_class != $class) { $class .= ($class != '' ? ' ' : '') . $border_class; } //PREPARE THUMBNAIL $img_thumb = webImage($this->image, $width, $height, $popup_title, $class); $thumb_width = $width; $thumb_height = $height; if ($width == '' || $height == '') { $thumb_image_source = webImageSource($this->image, $width, $height); if ($thumb_image_source != '') { list($thumb_width, $thumb_height) = @getimagesize($thumb_image_source); } } //PREPARE LINK if ($link_to == self::IMAGE_LINKTO_BIGGER_IMAGE) { $main_image = webImageSource($this->image, IMAGE_SIZE_BIG_1); $link_target = $main_image != '' ? $main_image : ''; $link_class = 'view_image'; } else { $link_target = $this->getLinkProductDetail(); $link_class = 'view_webpage'; } if ($link_target != '') { $image = '<a href="' . $link_target . '" class="' . $link_class . '" title="' . $popup_title . '">' . $img_thumb . '</a>'; } else { $image = $img_thumb; } //PREPARE ICONS $icons_total_width = 0; $icons = array(); if ($this->isKilled()) { $icons[] = drawKilledIcon('Killed Product', ''); $icons_total_width += 16; } //DIAMOND ICON if ($this->isUsingDiamond()) { $icons[] = drawDiamondIcon('Diamond Product', ''); $icons_total_width += 16; } //GOLD ICON if ($this->isUsingGold()) { $icons[] = drawGoldIcon($this->metal_stamp_code, $this->metal_stamp_info); $icons_total_width += 21; } $icons_total_width += count($icons) * 2; //consider white space $icons_margin_top = $thumb_height - 16 - 1; //16 is default icon height, 1 is margin bottom $icons_margin_left = $thumb_width - $icons_total_width; $div_image = '<div>' . $image . '</div>'; $div_icons = '<div style="position:absolute;margin:' . $icons_margin_top . 'px 0 0 ' . $icons_margin_left . 'px;">' . implode(' ', array_reverse($icons)) . '</div>'; $div_stars = '<div>' . drawStars($this->stars) . '</div>'; return '<div class="tac" style="width:' . $thumb_width . 'px;margin:0 auto;">' . $div_icons . $div_image . $div_stars . '</div>'; }
} } if ($returnable > 0) { $o = array(); $order_date = strtotime($row['order_date']); $item_count = "{$row['order_item_count']}/{$row['order_item_total']}"; $info = array(); $info[] = 'No: <a href="?open=sp-order&id=' . $row['jng_sp_orders_id'] . '" target="_blank" title="View Order Detail">' . $row['order_id'] . '</a> <span class="notice">(' . $item_count . ')</span>'; $info[] = 'Date: ' . date('d-M-y', $order_date); $info[] = 'Cust: ' . $row['customer_name']; $info[] = 'Product: <a href="?open=product-detail&products_id=' . $row['products_id'] . '" target="_blank" title="View product detail">' . $row['article_number'] . '</a>'; $info[] = 'Qty: ' . $row['order_quantity'] . ' • ' . 'Price: ' . $row['price']; $info[] = 'Status: ' . $itemStatus[$row['status']]; $o['c'] = implode('<br />', $info); $pimg = webImageSource($row['products_image'], '500'); $thumb = $pimg == '' ? '' : webImage($row['products_image'], '80', '80', $row['products_id'], 'img-border img-padding'); $o['a'] = $thumb; $return_reason_combo = $class_jo->returnReasonCombo('reason', '', 'reason-' . $row['jng_sp_orders_items_id']); $return_qty_combo = 'Return Qty <select id="qty-' . $row['jng_sp_orders_items_id'] . '">'; for ($q = 1; $q <= $returnable; $q++) { $sel = $q == $returnable ? 'selected="selected"' : ''; $return_qty_combo .= '<option value="' . $q . '" ' . $sel . '>' . $q . '</option>'; } $return_qty_combo .= '</select>'; $shipping_cost = 'Shipping: <select id="shipping-' . $row['jng_sp_orders_items_id'] . '">'; $shipping_cost .= '<option value="1">Paid</option>'; $shipping_cost .= '<option value="0">UnPaid</option>'; $shipping_cost .= '</select>'; $cust_comment = '<textarea name="comment" id="comment-c-' . $row['jng_sp_orders_items_id'] . '" style="font-size:10px;">' . $default_comment . '</textarea>'; $jng_comment = '<textarea name="comment" id="comment-j-' . $row['jng_sp_orders_items_id'] . '" style="font-size:10px;">' . $default_comment . '</textarea>'; $return_info = '<table border="0" cellpadding="0" cellspacing="0">';
function draw($drawAtWall = false, $isNew = false, $showDelete = false, $show_comments_below = false) { global $session_userinfo; if (!$showDelete && $this->allowDelete()) { $showDelete = true; } $wall_post = '<div id="wall-post-id-' . $this->id . '" class="wall-post' . ($isNew ? ' wall-post-new' : '') . '">'; $wall_post .= '<div class="wall-post-pbi">' . webImage($this->posted_by_image, '50', '50', $this->posted_by_name) . '</div>'; $wall_post .= '<div class="wall-post-container">'; $wall_post .= '<div class="wall-post-user">' . $this->posted_by_name . '</div>'; $wall_post .= '<div class="message' . ($drawAtWall ? ' pointer" title="Click to add comments"' : '"') . '>' . nl2br($this->message) . '</div>'; if ($drawAtWall) { $wall_post .= $this->drawObjectSocialLine($showDelete); } else { $wall_post .= $this->drawDuration('notice', 'posted', $showDelete ? ' ⋅ <span class="del-text">Delete</span>' : ''); } //$wall_post .= $duration_final; $wall_post .= '</div>'; // .wall-post-container if ($show_comments_below) { if (count($this->comments->comments) > 0) { $wall_post .= $this->comments->drawComments('', 'Comments', 'h3', 'margin-top:20px;'); } $wall_post .= '<div class="postcomment pointer" title="Click to add comments">Post Comment »</div>'; } $wall_post .= '</div>'; //.wall-post return $wall_post; }
$categories_select .= '</select>'; $content = '<form name="create_design" action="?open=project_plan_new" method="post" enctype="multipart/form-data" >'; $content .= '<input type="hidden" name="me_action" value="CREATENEWDESIGN" />'; $content .= '<input type="hidden" id="product_id" name="product_id" value="' . $product_id . '"/>'; $content .= '<input type="hidden" id="design_id" name="design_id" value="' . $newdesign . '"/>'; $content .= '<input type="hidden" id="design_image" name="design_image" value="' . $design_image . '"/>'; $content .= '<div style="margin-bottom:20px;vertical-align: middle; ">'; $content .= '<table class="main" border="0" cellspacing="0" cellpadding="2">'; $content .= '<tr><td>Design Id</td><td>' . $newdesign . '</td></tr>'; $content .= '<tr><td>Set Design Type</td><td>' . $design_type . '</td></tr>'; $content .= '<tr><td></td><td></td></tr>'; $content .= '<tr><td></td><td></td></tr>'; $content .= '<tr><td style="width:120px;">Consumer Name</td><td><input type="text" id="customer_name" name="customer_name" value="' . $customer_name . '" class="input" /></td></tr>'; $content .= '<tr><td style="width:100px;">Design Project Name</td><td><input type="text" name="design_name" value="' . $design_name . '" class="input" /></td></tr>'; $content .= '<tr><td style="vertical-align: middle;" >Description</td><td><textarea name="design_description" style="width:300px" rows="4">' . $design_description . '</textarea></td></tr>'; $content .= '<tr><td>Priority</td><td>' . $priority_select . '</td></tr>'; $content .= '<tr><td>Pot. Qty</td><td><input type="text" name="design_qty" value="' . $design_qty . '" class="input" /> </td></tr>'; $content .= '<tr><td> Upload Add. Image1</td><td><input type="file" name="design_image" value="' . $design_image . '" class="input" /></td></tr>'; $content .= '<tr><td> Upload Add. Image2</td><td><input type="file" name="design_image2" value="' . $design_image2 . '" class="input" /></td></tr>'; $content .= '<tr><td> Upload Add. Image3</td><td><input type="file" name="design_image3" value="' . $design_image3 . '" class="input" /></td></tr>'; $content .= '<tr><td>Link (optional)</td><td><input type="text" name="design_link" value="' . $design_link . '" class="input" /> </td></tr>'; $content .= '<tr><td>Set Reminder To</td><td>' . $reminder_to . '</td></tr>'; $content .= '</table>'; $content .= '</div>'; $content .= '<div style="margin-top:20px;">'; $content .= '<input type="submit" value="Save New Design "/> ' . $status_uploaded; $content .= '</div>'; $content .= '</form>'; $image = webImage($design_image, '350', '', '', 'img-border img-padding'); $content .= '<div style="float:right;right: 10px;top: 10px;position:absolute;">' . $image . '</div>'; $title = "Design Project";
global $db; require_once '../confy.php'; require_once '../functions.php'; require_once '../functions-2.php'; require_once DIR_WS_FUNCTIONS . 'html_output.php'; tep_db_connect(); $q = "SELECT e.elements_id, e.elements_code, CONCAT(ei.image_path,ei.image_filename) as image FROM elements e"; $q .= " LEFT JOIN elements_images ei on e.elements_id=ei.elements_id AND ei.elements_sample_name='EC1'"; $q .= " WHERE RIGHT(e.elements_code,2)='PN' AND e.is_finalized='2'"; $q .= " ORDER BY e.elements_id"; $el_query = tep_db_query($q); $elements = array(); $e = array(); $e[1] = '<div>No</div>'; $e[2] = '<div>Image</div>'; $e[3] = '<div>Element Id</div>'; $e[4] = '<div>Element Code</div>'; $elements[] = $e; $rowcount = 0; while ($row = tep_db_fetch_array($el_query)) { $e = array(); $rowcount++; $e[1] = '<div>' . $rowcount . '</div>'; $e[2] = '<div>' . webImage('elements/' . $row['image'], '60', '60') . '</div>'; $e[3] = '<div>' . $row['elements_id'] . '</div>'; $e[4] = '<div>' . $row['elements_code'] . '</div>'; $elements[] = $e; } echo tep_draw_table('', $elements); tep_db_close();
$drafts = $design->retrieveDrafts(); for ($x = 0; $x < 5; $x++) { $d = $drafts[$x]; $draft_exist = isset($drafts[$x]); if ($draft_exist) { $draft_name = $d['drafts_name']; $name_dis = ''; } else { $draft_name = 'Draft Name'; $name_dis = ' disabled="disabled"'; } $keyid = 'drkey-' . $x; $draft_title = 'DRAFT ' . ($x + 1); $draft_link = '<a href="/?open=designs-draft-detail&id=' . $d['drafts_id'] . '" target="_self">'; $content .= '<div class="comment" style="background:#dedede;">'; $content .= '<div id="drimg-' . $keyid . '" style="float:left;margin-right:10px;">' . $draft_link . webImage($d['image_1'], $imgsize, $imgsize, $draft_title, 'img-border') . '</a></div>'; $content .= '<div style="height:82px;">'; $draft_title = '<h3 id="drh3-' . $keyid . '">' . $draft_title; if ($d['approve_status'] == 'A') { $draft_title .= ' <span class="green">(♥ Approved)</span>'; } elseif ($d['approve_status'] == 'R') { $draft_title .= ' <span class="red">(× Killed)</span>'; } $draft_title .= '</h3>'; $content .= $draft_title; $content .= '<div><input type="text" id="drname-' . $keyid . '" style="width:280px;" value="' . $draft_name . '" ' . $name_dis . '/></div>'; $content .= '<div id="' . $keyid . '" class="draftbtns" style="margin-top:5px;"><input type="hidden" name="drafts_id" value="' . $d['drafts_id'] . '" /></div>'; $content .= '</div>'; //COLORS REQUEST $hidden_input = '<input type="hidden" value="' . $d['drafts_id'] . '"/>'; if ($draft_exist) {
$q .= ", SUM(quantity) AS total_sold, SUM(price_total) AS total_sales"; $q .= ", SUM(quantity*cogs) AS total_cogs, SUM(gross_profit_total) AS total_gross_profit"; $q .= " FROM jng_sp_importdata jid"; $q .= " LEFT JOIN products p ON jid.products_id=p.products_id"; $q .= " LEFT JOIN report_cogs rc ON rc.jng_sp_id=jid.jng_sp_id AND rc.base_date LIKE '2013%' AND rc.products_ean=jid.products_ean"; $q .= " WHERE jid.jng_sp_id=5"; if ($use_image) { $q .= " AND p.stars=3"; } $q .= " GROUP BY jid.products_ean"; $q .= " ORDER BY stars DESC, products_id, articles_id"; $r = tep_db_query($q); $rowcount = 0; echo '<table border="0" cellpadding="0" cellspacing="0">'; while ($row = tep_db_fetch_array($r)) { $rowcount++; if ($rowcount == 1) { echo '<tr>'; if ($use_image) { echo '<td><div>Image</div></td>'; } echo '<td><div>' . implode('</div></td><td><div>', array_keys($row)) . '</div></td></tr>'; } echo '<tr>'; if ($use_image) { echo '<td><div>' . webImage($row['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1) . '</div></td>'; } echo '<td><div>' . implode('</div></td><td><div>', $row) . '</div></td></tr>'; } echo '</table>'; tep_db_close();
$brands = $class_pb->retrieveList(); $content = ''; if (count($brands) == 0) { $content .= '<h3>No Brand found in database</h3>'; } else { $btable = array(); $bt = array(); $bt['id'] = 'ID'; $bt['logo'] = 'Brand Logo'; $bt['name'] = 'Name'; $bt['status'] = 'Active in J&G'; $bt['w100'] = 'Active Products'; $btable[] = $bt; foreach ($brands as $b) { $link = '<a href="?open=products-brand&id=' . $b['products_brand_id'] . '">%s</a>'; $logo = $b['brand_image'] == '' ? '<span class="notice">No Logo</span>' : sprintf($link, webImage($b['brand_image'], '', '50')); $bt = array(); $bt['id'] = sprintf($link, $b['products_brand_id']); $bt['logo'] = '<div style="width:100%;height:100%;padding:10px 0;background:#fff;">' . $logo . '</div>'; $bt['name'] = sprintf($link, $b['brand_name']); $status_img = 'icon-tick'; if ($b['active_status'] != '1') { $status_img .= '-dis'; } $bt['status'] = '<img src="images/' . $status_img . '.png" />'; $bt['tac'] = strval($class_pb->getTotalProducts($b['products_brand_id'])); $btable[] = $bt; } $content .= tep_draw_table('', $btable); } $content .= '<div class="buttons-left"><input type="button" class="blue" name="create" value="Create New Brand" onclick="location.href=\'?open=products-brand\';" /></div>';
$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 products p ON p.products_id=joi.products_id"; $q .= " WHERE joir.return_comment_customer!='' OR joir.return_comment_jng!=''"; $q .= " ORDER BY p.products_id, joir.return_time"; $r = tep_db_query($q); while ($row = tep_db_fetch_array($r)) { $returns[] = $row; } $table = array(); $t = array(); $t[1] = 'No'; $t[2] = 'Image'; $t[3] = 'Return Date'; $t[4] = 'Product Code'; $t[5] = 'Article No'; $t[6] = 'Reason'; $table[] = $t; foreach ($returns as $counter => $row) { $t = array(); $t[1] = '<div>' . ($counter + 1) . '</div>'; $t[2] = '<div>' . webImage($row['products_image'], '80', '80') . '</div>'; $t[3] = '<div>' . date('d-M-y', strtotime($row['return_time'])) . '</div>'; $t[4] = '<div>' . $row['products_model'] . '</div>'; $t[5] = '<div>' . $row['article_number'] . '</div>'; $t[6] = '<div>' . $row['return_reason'] . '</div>'; $table[] = $t; } $content = tep_draw_table('', $table); echo $content; tep_db_close();
$c['vcg'] = 'Avg<br />VC'; $c['act'] = 'Active'; $cat[] = $c; $img_active = '<img id="%s" src="images/icon-yes.png" title="Product is active" />'; $img_inactive = '<img id="%s" src="images/icon-no.png" title="Product is inactive" />'; while ($row = tep_db_fetch_array($cat_result)) { $detail_link = "?open=sp-product&id={$row['products_id']}"; $popup_link = '<a href="' . "?open=analysis-vc-total-detail&sp={$jng_sp_id}&id={$row['products_id']}&hidemenu=true" . '" class="view_webpage bold" title="">'; $info = "<div>{$popup_link}{$row['products_id']}</a></div>"; $info .= '<div class="bold">' . $row['article_number'] . '</div>'; $info .= "<div>{$row['name']}</div>"; $age = $row['active_age'] . ' day' . ($row['active_age'] > 1 ? 's' : ''); $matexp = $row['material_expenses'] + $sp_detail['cost_packaging_product']; $catalog_id = '<div style="display:none;" class="catalog" title="' . $row['jng_sp_catalog_id'] . '"></div>'; $c = array(); $c['img'] = '<div id="' . $row['jng_sp_catalog_id'] . '"><a href="' . $detail_link . '" title="View and Manage Product Detail for Neckermann Catalog">' . webImage($row['products_image'], '80', '80') . '</a></div>'; $c['info'] = $info; $c['age'] = $age; $c['pr'] = $row['price']; $c['pn'] = $row['net_sales']; $c['me'] = '<a href="?open=product-detail&products_id=' . $row['products_id'] . '#prodet-tab2" target="_blank" title="View product detail: Elements Used">' . number_format($matexp, 2) . '</a>'; $c['mg'] = number_format($row['margin'], 1) . '%'; $c['cl'] = $row['cost_logistic']; $c['cd'] = $row['cost_distribution']; $c['rr'] = number_format($row['returned_rate'], 1) . '%'; $c['cs'] = $row['cost_service']; $c['vc'] = $row['vc_now']; $c['vcp'] = $row['vc_percent'] . '%'; $c['ts'] = $row['total_sold']; $c['vct'] = $row['vc_total']; $c['vcx'] = $row['vc_max'];
function analysis_list($jng_warehouses_id, $period, $price_type, $page) { use_class('jng_warehouses'); $class_jw = new jng_warehouses(); $wh = $class_jw->retrieveDetail($jng_warehouses_id); $period_year = substr($period, 0, 4); $period_month = substr($period, -2); $period_date = "{$period_year}-{$period_month}-01"; if ($wh['warehouse_type'] == 'E') { $filter = " WHERE mse.jng_warehouses_id={$jng_warehouses_id} AND mse.stock_period='{$period}'"; $total_query = "SELECT count(mse.elements_id) AS total FROM minierp_stock_elements mse"; $total_query .= $filter; $total_result = tep_db_query($total_query); $total = tep_db_fetch_array($total_result); //PAGING QUERY & LINKS $offset = ($page - 1) * ROWPERPAGE; $page_query = " LIMIT " . ROWPERPAGE . " OFFSET {$offset}"; $pagelink = tep_paging($total['total'], $page, '?open=analysis-stock-list&page='); $q = "SELECT mse.*"; $q .= ", SUM(mset.stock_add) AS stock_add, SUM(mset.stock_reduce) AS stock_red"; $q .= ", CONCAT(ei.image_path, ei.image_filename) AS elements_image, e.elements_code, ed.name AS elements_name"; $q .= " FROM minierp_stock_elements mse"; $q .= " LEFT JOIN minierp_stock_elements_transaction AS mset"; $q .= " \tON mset.jng_warehouses_id=mse.jng_warehouses_id"; $q .= " \tAND mset.elements_id=mse.elements_id"; $q .= "\t\tAND YEAR(mset.transaction_time)='{$period_year}'"; $q .= "\t\tAND MONTH(mset.transaction_time)='{$period_month}'"; $q .= " LEFT JOIN elements e ON e.elements_id=mse.elements_id"; $q .= " LEFT JOIN elements_images ei ON ei.elements_id=e.elements_id AND ei.elements_sample_name='EC1'"; $q .= " LEFT JOIN elements_description ed ON ed.elements_id=e.elements_id AND ed.languages_id=2"; $q .= $filter; $q .= " GROUP BY elements_id"; $q .= $page_query; $r = tep_db_query($q); } else { $filter = " WHERE msp.jng_warehouses_id={$jng_warehouses_id} AND msp.stock_period='{$period}'"; $total_query = "SELECT count(msp.products_id) AS total FROM minierp_stock_products msp"; $total_query .= $filter; $total_result = tep_db_query($total_query); $total = tep_db_fetch_array($total_result); //PAGING QUERY & LINKS $offset = ($page - 1) * ROWPERPAGE; $page_query = " LIMIT " . ROWPERPAGE . " OFFSET {$offset}"; $pagelink = tep_paging($total['total'], $page, '?open=analysis-stock-list&page='); $q = "SELECT msp.*"; $q .= ", SUM(mspt.stock_add) AS stock_add, SUM(mspt.stock_reduce) AS stock_red"; $q .= ", p.products_image, p.products_model, pd.products_name"; $q .= " FROM minierp_stock_products msp"; $q .= " LEFT JOIN minierp_stock_products_transaction AS mspt"; $q .= " \tON mspt.jng_warehouses_id=msp.jng_warehouses_id"; $q .= " \tAND mspt.products_id=msp.products_id"; $q .= "\t\tAND YEAR(mspt.transaction_time)='{$period_year}'"; $q .= "\t\tAND MONTH(mspt.transaction_time)='{$period_month}'"; $q .= " LEFT JOIN products p ON p.products_id=msp.products_id"; $q .= " LEFT JOIN products_description pd ON pd.products_id=p.products_id AND pd.language_id=2"; $q .= $filter; $q .= " GROUP BY products_id"; $q .= $page_query; $r = tep_db_query($q); } $stocks = array(); $s = array(); $s['img'] = 'Product'; $s['name'] = 'Info'; $s['ev'] = 'EoP Value'; $s['sb'] = 'Inventory BoP'; $s['sa'] = 'Addition'; $s['sr'] = 'Reduction'; $s['se'] = 'Inventory EoP'; $s['sv'] = 'Inventory EoP Value'; $s['avg'] = 'Average Inventory Level'; $s['avg_v'] = 'Average Inventory Value'; $s['to'] = 'Inventory Turnover'; $s['doi'] = 'Average days of inventory'; $s['tc'] = 'Total Cost of Capital of Period'; $stocks[] = $s; $total_days_period = date('Ym') == $period ? date('j') : date('t', strtotime($period_date)); while ($row = tep_db_fetch_array($r)) { if ($wh['warehouse_type'] == 'E') { $img = webImage('elements/' . $row['elements_image'], '80', '80'); $info = "<div><strong>{$row['elements_id']} / {$row['elements_code']}</strong></div>"; $info .= "<div>{$row['elements_name']}</div>"; } else { $img = '<a href="' . $detail_link . '" title="View and Manage Product Detail">' . webImage($row['products_image'], '80', '80') . '</a>'; $detail_link = "?open=product-detail&products_id={$row['products_id']}"; $info = "<div><strong>{$row['products_id']} / {$row['products_model']}</strong></div>"; $info .= "<div>{$row['products_name']}</div>"; } $eop_value = $row[$price_type . '_close']; $eop_value_inv = $row['stock_close'] * $eop_value; $avg = ($row['stock_open'] + $row['stock_close']) / 2; $avg_value = $avg * $eop_value; $turnover = $avg == 0 ? 0 : $row['stock_red'] / $avg; $avg_days = $turnover == 0 ? 0 : $total_days_period / $turnover; $cap_cost = $avg_value == 0 ? 0 : 0.07000000000000001 * $avg_days / 365 * 31 * $avg_value; $s = array(); $s['img'] = $img; $s['name'] = $info; $s['ev'] = number_format($eop_value, 2); $s['sb'] = $row['stock_open']; $s['sa'] = $row['stock_add']; $s['sr'] = $row['stock_red']; $s['se'] = $row['stock_close']; $s['sv'] = number_format($eop_value_inv, 2); $s['avg'] = number_format($avg, 1); $s['avg_v'] = number_format($avg_value, 2); $s['to'] = number_format($turnover, 2); $s['doi'] = number_format($avg_days, 1); $s['tc'] = number_format($cap_cost, 2); $stocks[] = $s; } $result = tep_draw_table('proman', $stocks); $result .= '<div> </div>'; $result .= $pagelink; return $result; }
$table = array(); $t = array(); $t['o'] = 'No'; $t['m'] = 'Image'; $t['i'] = 'ID'; $t['c'] = 'Code'; $t['n'] = 'Name'; $t['y'] = 'Qty'; $t['z'] = 'Unit'; $table[] = $t; $counter = 0; foreach ($elements as $e) { $counter++; $t = array(); $t['o'] = $counter; $t['m'] = webImage($e['image_filename'], '80', '80'); $t['i'] = $e['elements_id']; $t['c'] = $e['elements_code']; $t['n'] = $e['name']; $t['y'] = $e['pieces_per_qty_type']; $t['z'] = $e['qty_type']; $table[] = $t; } $content .= '<table border="0" cellpadding="0" cellspacing="0">'; foreach ($table as $row) { $content .= '<tr>'; foreach ($row as $col) { $content .= '<td><div>' . $col . '</div></td>'; } $content .= '</tr>'; }
} if (!isset($products_sold[$difart])) { $products_sold[$difart] = 0; } if (!isset($products_sales[$difart])) { $products_sales[$difart] = 0; } if (!isset($products_vc[$difart])) { $products_vc[$difart] = 0; } $products_sold[$difart] += $row['order_quantity']; $products_sales[$difart] += $row['price']; $products_vc[$difart] += $row['vc_value']; if (!isset($products_image[$difart])) { $pimg = webImageSource($row['products_image'], '500'); $thumb = $pimg == '' ? '' : '<div class="thumb" style="display:none"><a href="' . $pimg . '" class="view_image" title="Image of ' . $row['products_model'] . '">' . webImage($row['products_image'], '80', '80', $row['products_model'], 'img-border img-padding') . '</a></div>'; $products_image[$difart] = $thumb; } if (!isset($products_link[$difart])) { $products_link[$difart] = '<a href="?open=product-detail&products_id=' . $row['products_id'] . '" target="_blank">' . $difart . '</a>'; } } arsort($products_sold); arsort($products_sales); arsort($products_vc); $products_sold_filtered = array(); $products_sales_filtered = array(); $products_vc_filtered = array(); foreach ($products_sold as $artno => $ps) { if ($ps >= $min_sold_per_month) { $products_sold_filtered[$artno] = $ps;
$sold_last_month[$a_counter] = $sold_last_month[$a_counter]; $stock[$a_counter] = $stock[$a_counter]; $stock_target[$a_counter] = $stock_target[$a_counter]; $qty_ordered[$a_counter] = $qty_ordered[$a_counter]; $qty_missing[$a_counter] = $qty_missing[$a_counter]; $levelling_target[$a_counter] = $levelling_target[$a_counter]; $levelling_orders[$a_counter] = $levelling_orders[$a_counter]; $levelling_orders_ptb[$a_counter] = $levelling_orders_ptb[$a_counter]; $levelling_orders_os[$a_counter] = $levelling_orders_os[$a_counter]; $total_target[$a_counter] = $total_target[$a_counter]; $total_qty_missing[$a_counter] = $total_qty_missing[$a_counter]; $levelling_orders_today[$a_counter] = $levelling_orders_today[$a_counter]; } //$asep => Article SEParator $asep = '<br />'; $image = webImage($p['image'], '80', '80'); $imagesource = webImageSource($p['image'], '500', '500'); if ($imagesource != '') { $image = '<a href="' . $imagesource . '" class="view_image">' . $image . '</a>'; } $row = array(); $info = $pid . ' / ' . $p['code']; $info .= '<br />' . $p['name']; $row['a'] = "<div>{$counter}</div>"; $row['b'] = "<div>{$image}</div>"; $row['c'] = "<div>{$info}</div>"; $row['d'] = '<div>' . implode($asep, $size) . '</div>'; $row['e'] = '<div>' . implode($asep, $ean) . '</div>'; $row['f'] = '<div>' . implode($asep, $sold_last_month_nopromo) . '</div>'; $row['g'] = '<div>' . implode($asep, $sold_last_month) . '</div>'; $row['h'] = '<div>' . implode($asep, $stock) . '</div>';
function runElementQuery($outsourced_flag) { global $class_ea, $ecats, $all_period; if (isset($_GET['shipwin_month'])) { $month = str_pad(tep_db_prepare_input($_GET['shipwin_month']), 2, '0', STR_PAD_LEFT); $year = date('Y'); $shipwin_start = $year . "-{$month}-01"; $eom_date = date('t', strtotime($shipwin_start)); $shipwin_end = date('Y') . "-{$month}-{$eom_date}"; $shipwin_filter = "AND joi.shipping_window_open BETWEEN '{$shipwin_start}' AND '{$shipwin_end}'"; } else { $shipwin_filter = ""; } $whid = WAREHOUSE_ID_ELEMENTS; $element_list = array(); $order_date_start = '2013-08-13'; $order_date_end = '2013-08-14'; $q = "SELECT\n e.elements_image\n , e.attribute_category_id AS ecatid\n , MONTH(joi.shipping_window_open) AS period\n , IF(IFNULL(paue.elements_id, 0)>0, paue.elements_id, pue.elements_id) AS elements_id\n , SUM(joi.order_quantity * IF(IFNULL(paue.quantity,0)>0, paue.quantity, pue.quantity)) AS elements_needed\n , etes.price_quantity_type AS unit, etes.pieces_per_qty_type AS unit_multiplier\n , es.stock\n FROM jng_sp_orders jo\n LEFT JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_id=jo.jng_sp_orders_id\n LEFT JOIN products p ON p.products_id=joi.products_id\n LEFT JOIN products_use_elements pue ON pue.products_id=joi.products_id\n LEFT JOIN products_articles_use_elements paue ON paue.products_use_elements_id=pue.products_use_elements_id AND paue.products_articles_id=joi.products_articles_id\n LEFT JOIN element e ON e.elements_id=IF(IFNULL(paue.elements_id, 0)>0, paue.elements_id, pue.elements_id)\n LEFT JOIN elements_to_elements_suppliers etes ON etes.elements_id=e.elements_id AND is_default='1'\n LEFT JOIN elements_stock es ON es.jng_warehouses_id={$whid} AND es.elements_id=e.elements_id\n WHERE jo.jng_sp_id=5\n AND jo.order_date BETWEEN '{$order_date_start}' AND '{$order_date_end}'\n {$shipwin_filter}\n AND p.is_outsourced='{$outsourced_flag}'\n GROUP BY elements_id, period\n ORDER BY ecatid, elements_id, period"; $r = tep_db_query($q); $elements_total = array(); $elements_unit = array(); $elements_unit_multiplier = array(); while ($row = tep_db_fetch_array($r)) { $cid = $row['ecatid']; $eid = $row['elements_id']; $p = $row['period']; if (!isset($ecats[$cid])) { $c = $class_ea->retrieveDetail('cat', $cid); $ecats[$cid] = $c[0]['name']; } if (!in_array($p, $all_period)) { $all_period[] = $p; } if (!isset($element_list[$cid])) { $element_list[$cid] = array(); } if (!isset($element_list[$cid][$eid])) { $element_list[$cid][$eid] = array(); } if (!isset($element_list[$cid][$eid]['id'])) { $element_list[$cid][$eid]['id'] = '<div>' . $eid . '</div>'; } if (!isset($element_list[$cid][$eid]['image'])) { $element_list[$cid][$eid]['image'] = '<div>' . webImage($row['elements_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, "Element {$eid}") . '</div>'; } if (!isset($element_list[$cid][$eid]['stock'])) { $element_list[$cid][$eid]['stock'] = '<div>' . $row['stock'] . '</div>'; } if (!isset($element_list[$cid][$eid]['order'])) { $element_list[$cid][$eid]['order'] = '<div>' . elements_order::openOrdersQuantity($eid) . '</div>'; } $element_list[$cid][$eid][$p] = '<div>' . $row['elements_needed'] . '</div>'; if (!isset($elements_total[$eid])) { $elements_total[$eid] = 0; } $elements_total[$eid] += $row['elements_needed']; if (!isset($elements_unit[$eid])) { $elements_unit[$eid] = $row['unit']; } if (!isset($elements_unit_multiplier[$eid])) { $elements_unit_multiplier[$eid] = $row['unit_multiplier']; } } foreach ($element_list as $cid => $elist) { foreach ($elist as $eid => $el) { foreach ($all_period as $p) { if (!isset($el[$p])) { $element_list[$cid][$eid][$p] = '<div>0</div>'; } } $element_list[$cid][$eid]['total'] = '<div>' . $elements_total[$eid] . '</div>'; $element_list[$cid][$eid]['unitm'] = '<div>' . $elements_unit_multiplier[$eid] . '</div>'; $element_list[$cid][$eid]['totalunit'] = '<div>' . ceil($elements_total[$eid] / $elements_unit_multiplier[$eid]) . '</div>'; $element_list[$cid][$eid]['unit'] = '<div>' . $elements_unit[$eid] . '</div>'; } } return $element_list; }
} else { //START TEMPLATE $show_product_status_box = true; if (isset($product_id) && intval($product_id > 0)) { $product = $class_pm->retrieveDetail($product_id, 'p,pc'); $spinfo = $class_jc->retrieveDetail(null, $jng_sp_id, $product_id); if (is_array($product) || is_array($spinfo)) { $show_product_status_box = false; } } $content = ''; if ($show_product_status_box) { $content .= $loadform; } if (isset($product) && is_array($product)) { $image = webImage($product['p']['products_image'], '500', '', '', 'img-border img-padding'); if (!is_array($spinfo)) { $article_number = $product['p']['products_model']; $suppliers_products_id = ''; $content .= '<div style="float:left;margin: 0px 10px 20px 0px;">' . $image . '</div>'; $content .= '<div class="form"><form name="addtocat" action="?open=sp-product" method="post">'; $content .= '<input type="hidden" name="me_action" value="ADDTOCATALOGUE" />'; $content .= '<h3>Product ID</h3>'; $content .= '<table class="form" border="0" cellpadding="0" cellspacing="0">'; $content .= '<tr>'; $content .= '<td width="150">J&G ID</td>'; $content .= '<td><input type="text" class="input2" name="product_id" value="' . $product_id . '" readonly="readonly" /></td>'; $content .= '</tr>'; $content .= '<tr>'; $content .= '<td>Article ID</td>'; $content .= '<td><input type="text" class="input2" name="article_number" value="' . $article_number . '" /></td>';
function webImageWithDetailLinkStars($image, $thumb_width, $thumb_height, $thumb_title = '', $thumb_class = '', $link_title = '', $detail_width = '500', $detail_height = '500', $stars = '0', $max_stars = '3', $link = '', $link_class = '', $brand_id = '', $obj_product = '') { global $DIAMOND_BRAND_IDS; $pimg = webImage($image, $thumb_width, $thumb_height, $thumb_title, $thumb_class); $main_image = webImageSource($image, $detail_width, $detail_height); $gold_icon = ''; $diamond_icon = ''; if ($main_image != '') { $link_target = $link != '' ? $link : $main_image; $link_class = $link_class != '' ? $link_class : 'view_image'; $pimg = '<a href="' . $link_target . '" class="' . $link_class . '"' . ($link_title == '' ? '' : ' title="' . $link_title . '"') . '>' . $pimg . '</a>'; $thumb_image_source = webImageSource($image, $thumb_width, $thumb_height); list($width, $height) = getimagesize($thumb_image_source); $icon_tpos = $height; $icon_lpos = $width; if (is_object($obj_product) && $obj_product->is_killed) { /*Displaying icon stack-ly please used this $icon_tpos -= 20; $icon_lpos = $width - 20; */ //Icon displayed on same row $icon_tpos = $height - 20; $icon_lpos -= 20; $killed_icon = drawKilledIcon('Killed Product', 'position:absolute;margin:' . $icon_tpos . 'px 0 0 ' . $icon_lpos . 'px'); } if (in_array($brand_id, $DIAMOND_BRAND_IDS) || is_object($obj_product) && in_array($obj_product->brand_id, $DIAMOND_BRAND_IDS)) { /*Displaying icon stack-ly please used this $icon_tpos -= 20; $icon_lpos = $width - 20; */ //Icon displayed on same row $icon_tpos = $height - 20; $icon_lpos -= 20; $diamond_icon = drawDiamondIcon('Diamond Product', 'position:absolute;margin:' . $icon_tpos . 'px 0 0 ' . $icon_lpos . 'px'); } if (is_object($obj_product) && ($obj_product->metal_stamp_code > 0 && $obj_product->metal_stamp_code != 925)) { /*Displaying icon stack-ly please used this $icon_tpos -= 20; $icon_lpos = $width - 25; */ //Icon displayed on same row $icon_tpos = $height - 20; $icon_lpos -= 25; $style = 'position:absolute;margin:' . $icon_tpos . 'px 0 0 ' . $icon_lpos . 'px'; $gold_icon = drawGoldIcon($obj_product->metal_stamp_code, $obj_product->metal_stamp_info, '', $style); } } $pimg = '<div align="center"><div style="width:' . $width . 'px;">' . $gold_icon . $diamond_icon . $killed_icon . $pimg . '<br/>' . drawStars($stars, $max_stars) . '</div></div>'; return $pimg; }
$finishing[] = 'Hammer'; } if ($re['finishing_brush'] == '1') { $finishing[] = 'Brush'; } if ($re['finishing_oxid'] == '1') { $finishing[] = 'Oxid'; } if ($re['finishing_rosegoldplate'] == '1') { $finishing[] = '<span class="green">Rose Goldplate</span>'; $class = 'green'; } if (count($finishing) == 0) { $finishing[] = 'Unset'; } $elements_used .= '<div style="float:left;text-align:center;margin:5px 8px;">' . webImage($re['elements_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Element ' . $re['elements_id'], 'img-border') . '<br /><span class="' . $class . '">(' . implode(',', $finishing) . ')</span></div>'; } $t['i'] = $elements_used; $button_el = '<span>'; $button_el .= '<a href="?open=designs-products-elements-used&products_id=' . $products_id . '&act=LOAD&hidemenu=true" class="view_webpage"></a>'; $button_el .= '<input type="button" name="upd-elements" value="» Update Elements Used" class="input tal" />'; $button_el .= '</span>'; $button_pd = '<span>'; $button_pd .= '<a href="?open=product-detail&products_id=' . $products_id . '&hidemenu=true#prodet-tab1d" class="view_webpage"></a>'; $button_pd .= '<input type="button" name="upd-prodescs" value="» Update Product Description" class="input tal" />'; $button_pd .= '</span>'; $t['a'] = $button_el . $button_pd; $table[] = $t; } $tab_content .= tep_draw_table("spo designs-list", $table); if ($total_rows == 200) {