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; }
$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 $result .= '<div> </div>'; $result .= '<div class="ibox ui-corner-all" style="padding:10px;">'; $result .= '<h3>DIOH Target</h3>'; $result .= '<table class="form" style="" border="0" cellpadding="0" cellspacing="0">'; for ($s = 0; $s <= 3; $s++) { $result .= '<tr><td class="label">' . drawStars($s) . '</td><td>= ' . element::$diohStopLevel[$s] . ' days</td></tr>'; } //$result .= '<tr><td>Adjustment Orders</td><td>= '.element::$adjustmentOrder.'</td></tr>'; $result .= '</table>'; $result .= '<div style="text-align:right;"><a href="?open=settings-best-sellings&hidemenu=true#stars" class="view_webpage">Change Settings »</a></div>'; $result .= '</div>'; //.ibox $result .= '<div> </div>'; $result .= '<div class="ibox ui-corner-all" style="padding:10px;">'; $result .= '<h3>KPI Sourcing Terms</h3>'; $result .= '<table class="form" border="0" cellpadding="0" cellspacing="0">'; $result .= '<tr><td class="smallText">Incoming</td><td class="smallText">= Stock Increase</td><td class="smallText">→ Triggered by New Elements Stock Added</td></tr>'; $result .= '<tr><td class="smallText">Outgoing</td><td class="smallText">= Stock Reduction</td><td class="smallText">→ Triggered by new orders that use elements stock</td></tr>'; $result .= '</table>'; $result .= '</div>'; //.ibox
$supplier_code = ''; if ($info == '') { $info = 'UNSET'; } else { $dbsc = tep_db_query("SELECT item_number FROM elements_to_elements_suppliers WHERE elements_id = {$id} and is_default='1' AND item_number!=''"); while ($sc = tep_db_fetch_array($dbsc)) { $supplier_code = '<br /><span>' . $sc['item_number'] . '</span>'; } } $content = '<a href="?open=elements-suppliers&id=' . $id . '&hidemenu=true" class="view_webpage">' . $info . '</a>'; $content .= $supplier_code; } else { if ($td == 'name') { $class = $detail->isFinalized() ? 'green' : 'red'; $content = '<span class="' . $class . '">' . $name . '</span>'; $content .= '<br />' . drawStars($detail->stars); } else { $content = ${$td}; } } $row .= '<td class="' . $td . '">' . $content . '</td>'; } $row .= '</tr>'; } echo utf8_encode($row); exit; } elseif ($_POST['me_action'] == 'SORTLIST') { $orderby = tep_db_prepare_input($_POST['sortopt']); } } $sort_options = array();
$content .= ' <table border="0" cellpadding="0" cellspacing="0">'; $content .= ' <tr><th>Stars</th><th style="width:150px;">Sold <abbr title="Last 30 Days">L30D</abbr></th><th style="width:120px;">DIOH Target</th></tr>'; $content .= ' <tr class="o"><td align="center">' . drawStars(0) . '</td><td>' . $input47 . '</td><td>' . $input91 . '</td></tr>'; $content .= ' <tr class="e"><td>' . drawStars(1) . '</td><td>' . $input48 . '</td><td>' . $input92 . '</td></tr>'; $content .= ' <tr class="o"><td>' . drawStars(2) . '</td><td>' . $input49 . '</td><td>' . $input93 . '</td></tr>'; $content .= ' <tr class="e"><td>' . drawStars(3) . '</td><td> <span title="greater than or equal to">≥</span> ' . $input50 . '</td><td>' . $input94 . '</td></tr>'; $content .= ' </table>'; $content .= ' </div>'; $content .= ' <div id="set-el-sourcing" style="float:left;margin-left:40px;">'; $content .= ' <h2>Elements Stars</h2>'; $content .= ' <table border="0" cellpadding="0" cellspacing="0">'; $content .= ' <tr><th>Stars</th><th style="width:150px;">Products Sold <abbr title="Last 30 Days">L30D</abbr><th style="width:120px;">DIOH Target</th></th></tr>'; $content .= ' <tr class="o"><td align="center">' . drawStars(0) . '</td><td>' . $input51 . '</td><td>' . $input95 . '</td></tr>'; $content .= ' <tr class="e"><td>' . drawStars(1) . '</td><td>' . $input52 . '</td><td>' . $input96 . '</td></tr>'; $content .= ' <tr class="o"><td>' . drawStars(2) . '</td><td>' . $input53 . '</td><td>' . $input97 . '</td></tr>'; $content .= ' <tr class="e"><td>' . drawStars(3) . '</td><td> <span title="greater than or equal to">≥</span> ' . $input54 . '</td><td>' . $input98 . '</td></tr>'; $content .= ' </table>'; //#set-el-sourcing .draw-table $content .= ' </div>'; $content .= ' <div id="refill-notes" style="float:left;margin-left:40px;width:350px;">'; $content .= ' <h2>Auto Refill Notes</h2>'; $content .= ' <div style="margin-top:10px;">We can exclude Seasonal / Promotional Products from Auto Refill by adding them to Collection ID 1174:<br /><br /><a href="http://manobo.de/index.php?open=products-styles&id=1174&hidemenu=true" class="bold view_webpage">EXCLUDE from REFILL (Seasonal products)</a></div>'; $content .= ' </div>'; //#refill-notes $content .= ' <div id="set-best-sellings" class="draw-table prolinks" style="float:left;margin-left:40px;display:none;">'; $content .= ' <h2>Products Best Selling</h2>'; $content .= ' <table border="0" cellpadding="0" cellspacing="0">'; $content .= ' <tr><th style="width:150px;">Configuration</th><th style="width:150px;">Value</th></tr>'; $content .= ' <tr class="o"><td><span class="help ui-icon ui-icon-info" style="float:right;" title="' . $sop_mouse_over['bestselling_period'] . '"></span>Period to use</td><td>' . $period_Configurations . '</td></tr>'; $content .= ' <tr class="e"><td><span class="help ui-icon ui-icon-info" style="float:right;" title="' . $sop_mouse_over['bestselling_entry_level'] . '"></span>ENTRY Level</td><td>' . $input1 . '</td></tr>'; $content .= ' <tr class="o"><td><span class="help ui-icon ui-icon-info" style="float:right;" title="' . $sop_mouse_over['bestselling_exit_level'] . '"></span>EXIT Level</td><td>' . $input2 . '</td></tr>';
function postProcess($post_vars) { global $session_userinfo; $result = array(); if ($post_vars['me_action'] == 'SEARCH') { $type = $post_vars['type']; $jng_sp_id = $post_vars['jng_sp_id']; //another strange case, in live datepicker filter is always given as \'datevalue\' instead of 'datevalue' //still cant find the root cause (and it's ok in local dev), so for quickwin workaround we simple replace //the \' value into ' with below update (sahat 11.02.2014) //$post_filters = explode("|", $post_vars['post_filters']); $post_filters = explode("|", str_replace('\\\'', "'", $post_vars['post_filters'])); $filters = array(); foreach ($post_filters as $f) { $f_temp = explode('-', $f); $field = $f_temp[0]; unset($f_temp[0]); $value = implode('-', $f_temp); //explode to array for input on field $multivalue_fields which allowed multivalue separated by $multivalue_separator if (in_array($field, $this->multivalue_fields)) { $mv_temp = explode(current($this->multivalue_separator), $value); if (is_array($mv_temp) && $mv_temp > 0) { foreach ($mv_temp as $mv) { $mv = trim($mv); if (!isset($filters[$field]) || !in_array($mv, $filters[$field])) { $filters[$field][] = $mv; } } } else { $filters[$field][] = $value; } } else { $filters[$field][] = $value; } } $query = $this->constructQuery($jng_sp_id, $filters); $dbq = tep_db_query($query); $result = ''; $total = 0; $elements_ids = ''; //$display_spot = ''; while ($r = tep_db_fetch_array($dbq)) { $total++; if ($total > 1) { $elements_ids .= ','; } $elements_ids .= $r['elements_id']; // $display_spot .= '<div id="'.$r['elements_id'].'" class="lists-elements"></div>'; } $result['type'] = $type; $result['total'] = $total; $result['elements_ids'] = $elements_ids; // $result['display_spot'] = $display_spot; ajaxReturn($result); } elseif ($post_vars['me_action'] == 'DISPLAY') { $type = $post_vars['type']; $elements_id = $post_vars['elements_id']; $query = "SELECT e.elements_id, e.elements_code, e.elements_name, e.elements_image, e.elements_price, e.add_date, IFNULL(e.elements_weight,'-') elements_weight, e.stars, e.elements_description"; $query .= ", IFNULL(esup.suppliers_name,'-') suppliers_name"; $query .= ", el.used_in_products, IFNULL(el.weekly_sold, '-') weekly_sold, IFNULL(el.weekly_sold_products, '-') weekly_sold_products, IFNULL(el.sold_monthly_1, '-') last_month_sold"; $query .= ", (IFNULL(els.sold_{$this->last_year}_sp, 0) + IFNULL(els.sold_{$this->last_year}_jg, 0)) sold_{$this->last_year}"; $query .= ", (IFNULL(els.sold_products_{$this->last_year}_sp, 0) + IFNULL(els.sold_products_{$this->last_year}_jg, 0)) sold_products_{$this->last_year}"; $query .= ", ec.name AS cat_name, pm.material_name AS mat_name, cpd.name AS color_name, ei.name AS size_name, eh.name AS holesize_name"; $query .= ", es.name AS shape_name, es.shape_image, eu.name AS surface_name, eu.surface_image, et.name AS cut_name, et.cuts_image AS cut_image"; $query .= ", ehe.name AS height_name, ew.name AS width_name, eth.name AS thickness_name, est.stock"; $query .= ", DATEDIFF(NOW(), e.add_date) AS elements_age"; $query .= " FROM element e"; $query .= " LEFT JOIN elements_log el ON el.elements_id=e.elements_id"; $query .= " LEFT JOIN elements_log_static els ON els.elements_id=e.elements_id"; $query .= " LEFT JOIN elements_to_elements_suppliers etes ON etes.elements_id = e.elements_id AND is_default = 1"; $query .= " LEFT JOIN elements_suppliers esup ON esup.elements_suppliers_id = etes.elements_suppliers_id"; $query .= " LEFT JOIN elements_stock est ON est.elements_id = e.elements_id AND est.jng_warehouses_id = " . WAREHOUSE_ID_ELEMENTS; $query .= " LEFT JOIN element_category ec ON ec.element_category_id=e.attribute_category_id"; $query .= " LEFT JOIN products_materials pm ON pm.products_materials_id=e.attribute_material_id"; $query .= " LEFT JOIN color_pattern cp ON cp.color_pattern_id=e.attribute_color_id"; $query .= " LEFT JOIN color_pattern_description cpd ON cpd.color_pattern_id=e.attribute_color_id AND languages_id=1"; $query .= " LEFT JOIN element_size ei ON ei.element_size_id=e.attribute_size_id"; $query .= " LEFT JOIN element_holesize eh ON eh.element_holesize_id=e.attribute_holesize_id"; $query .= " LEFT JOIN element_shape es ON es.element_shape_id=e.attribute_shape_id"; $query .= " LEFT JOIN element_surface eu ON eu.element_surface_id=e.attribute_surface_id"; $query .= " LEFT JOIN element_cut et ON et.element_cut_id=e.attribute_cut_id"; $query .= " LEFT JOIN element_height ehe ON ehe.element_height_id=e.attribute_height_id"; $query .= " LEFT JOIN element_width ew ON ew.element_width_id=e.attribute_width_id"; $query .= " LEFT JOIN element_thickness eth ON eth.element_thickness_id=e.attribute_thickness_id"; $query .= " WHERE e.elements_id = '{$elements_id}'"; $dbq = tep_db_query($query); $res = tep_db_fetch_array($dbq); $elements_image = webImageWithDetailLink($res['elements_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Element ' . $res['elements_id'], 'img-border'); $elements_created = date('d-M-Y', strtotime($res['add_date'])); $elements_price = $res['elements_price'] < ELEMENTS_LOWER_PRICE ? displayCurrency('EUR', $res['elements_price'], true, 5) : displayCurrency('EUR', $res['elements_price']); $resultsdt = array(); //0-4 $resultsdt[] = $elements_id; $resultsdt[] = $elements_image; //$resultsdt[] = $res['elements_name']; $resultsdt[] = $res['elements_description']; $resultsdt[] = $elements_created; $resultsdt[] = $elements_price; //5-9 $resultsdt[] = $res['suppliers_name']; $resultsdt[] = $res['weekly_sold']; $resultsdt[] = $res['weekly_sold_products']; $resultsdt[] = $res['sold_' . $this->last_year]; $resultsdt[] = $res['sold_products_' . $this->last_year]; //10-14'd $resultsdt[] = $res['elements_weight']; $resultsdt[] = $res['last_month_sold']; $resultsdt[] = $res['stock']; $resultsdt[] = drawStars($res['stars']); $resultsdt[] = $res['elements_age']; $result['type'] = $type; $result['result'] = implode($this->result_separator, $resultsdt); ajaxReturn($result); } elseif ($post_vars['me_action'] == 'KILLELEMENT') { use_class('element'); $elid = tep_db_prepare_input($_POST['elid']); $element = new element($elid); $is_deleted = $element->delete($session_userinfo['username']); $result = array(); $result['target_id'] = $elid; $result['is_deleted'] = $is_deleted; ajaxReturn($result); } }
/** * 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>'; }
$content .= '<tr><td> » <abbr title="Maximum usage in Active Products">Max/Product</abbr></td><td class="tar">' . $element->log['usage_max'] . ' Pcs</td></tr>'; $content .= '<tr><td colspan="2"> <a href="?open=element-forecasting&id=' . $element->id . '&hidemenu=true" class="view_webpage">» Forecasting</a></td></tr>'; $content .= '<tr><td colspan="2" class="bold">Sold Last 7 days</td></tr>'; $content .= '<tr><td> » Elements</td><td class="tar">' . $element->log['weekly_sold'] . ' Qty</td></tr>'; $content .= '<tr><td colspan="2" class="bold">Sold Last 30 days</td></tr>'; $content .= '<tr><td> » Elements</td><td class="tar">' . $element->log['sold_monthly_1'] . ' Qty</td></tr>'; $content .= '<tr><td> » Products</td><td class="tar">' . $element->log['sold_monthly_1_products'] . ' Pcs</td></tr>'; $last_year = date('Y') - 1; $content .= '<tr><td colspan="2" class="bold">Sold ' . $last_year . '</td></tr>'; $content .= '<tr><td> » Elements</td><td class="tar">' . $element->log['sold_' . $last_year] . ' Qty</td></tr>'; $content .= '<tr><td> » Products</td><td class="tar">' . $element->log['sold_products_' . $last_year] . ' Pcs</td></tr>'; $content .= '</table>'; $content .= '</div>'; $content .= '<div style="float:left;border:1px solid #ccc;margin-right:10px;text-align:center;width:130px;height:130px;">'; $content .= '<div>' . webImageWithDetailLink($element->image, '130', '130', 'Element ' . $element->id, 'elements_image') . '</div>'; $content .= '<div>' . drawStars($element->stars) . '</div>'; $content .= '</div>'; $content .= '<div>'; $content .= '<table class="form" border="0" cellpadding="0" cellspacing="0">'; $content .= '<tr><td width="80">' . $id_label . '</td><td colspan="2">' . $element_id . '</td></tr>'; $content .= '<tr><td>Name</td><td colspan="2">' . $element_name . '</td></tr>'; $content .= '<tr><td>Description</td><td colspan="2">' . $element_description . '</td></tr>'; $content .= '<tr><td>Weight</td><td>' . $element_weight . '</td><td class="notice">Gram</td></tr>'; $goldcarat_autoupdate_info = 'This field is auto updated when Element Attributes Material is filled<br/>as explained below:<ul><li>non-gold option: Material selected <strong>is not gold pure</strong></li><li>other carat option: Material selected <strong>is gold pure</strong></li></ul>'; $goldpureweight_autoupdate_info = 'This will auto calculated based on selected Gold Carat'; $content .= '<tr><td>Gold Carat</td><td>' . $goldpure_carat . '</td><td>' . drawIconInfo($goldcarat_autoupdate_info, true, 'float-right') . '<small style="float:right;" class="red">» auto update</small></td></tr>'; $content .= '<tr><td>Goldpure Weight</td><td>' . $element_weight_goldpure . '</td><td class="notice">Gram ' . drawIconInfo($goldpureweight_autoupdate_info, true, 'float-right') . '<small style="float:right;" class="red">» auto update</small></td></tr>'; $content .= '<tr><td>Supplier</td><td>' . $element_suppliers . '</td>'; $content .= '<td rowspan="2" width="200">'; if (is_null($element->id)) { $content .= ' ';
$right_side_margin = 'margin-left:750px;'; $eta_text = '<abbr title="Estimated Time Allocation">ETA</abbr>'; $pic_text = '<abbr title="Person in Charge">PIC</abbr>'; //LEFT PART $content .= '<div style="float:left;">'; //Prepare star ratings for Goals Relevancy if ($is_createnew) { $relevancy_stars = '<span class="notice">Stars MUST be set after MIMS is created</span>'; } else { $st0 = drawStars(0, 3, improvement::TEXT_STARS_0); $st_title[0] = improvement::TEXT_STARS_0; $st1 = drawStars(1, 3, improvement::TEXT_STARS_1); $st_title[1] = improvement::TEXT_STARS_1; $st2 = drawStars(2, 3, improvement::TEXT_STARS_2); $st_title[2] = improvement::TEXT_STARS_2; $st3 = drawStars(3, 3, improvement::TEXT_STARS_3); $st_title[3] = improvement::TEXT_STARS_3; $stars_info = '<span class="ui-icon ui-icon-info" style="display:inline-block;"></span>'; $stars_legends = '<span id="stars-legend" style="display:none;">'; $stars_legends .= $st3 . ' » ' . $st_title[3] . '<br/>'; $stars_legends .= $st2 . ' » ' . $st_title[2] . '<br/>'; $stars_legends .= $st1 . ' » ' . $st_title[1] . '<br/>'; $stars_legends .= $st0 . ' » ' . $st_title[0]; $stars_legends .= '</span>'; $btn_crs_show_hide = $improvement->relevancy_stars == 0 ? 'display:none;"' : ''; $btn_clear_relevancy_stars = '<div id="reset-rstars" class="pointer notice" style="float:right;' . $btn_crs_show_hide . '" title="Click here to clear all stars">clear stars</div>'; //Draw stars for ratings $relevancy_stars = drawStarsRating(3, 'goals-relevancy', 'relevancy_stars', $improvement->relevancy_stars, $st_title); } $goals_relevancy = $btn_clear_relevancy_stars . $relevancy_stars . $stars_info . $stars_legends; $label = array();
$option_refill = array('SHOWALL' => 'Show All', 'ON' => 'Show ON', 'OFF' => 'Show OFF'); $option_bestse = array('SHOWALL' => 'Show All', 'ON' => 'Show Best Seller', 'OFF' => 'Show Non Best Seller'); $option_stars = array('SHOWALL' => 'Show All', '1' => '1 Star', '2' => '2 Stars', '3' => '3 Stars'); $option_outsou = array('SHOWALL' => 'Show All', '0' => 'No (Produce in House)', '1' => 'Yes (Outsourced)'); $option_astats = array('SHOWALL' => 'Include', '1' => 'Exclude'); $option_health = array('SHOWALL' => 'Show All', 'OVER' => 'Overstock', 'GOOD' => 'Good stock', 'SHORT' => 'Shortage'); $option_level1 = array('SHOWALL' => 'Show All', 'GT' => 'Stock > Target after Levelling', 'E' => 'Stock = Target after Levelling', 'LT' => 'Stock < Target after Levelling'); $option_level2 = array('SHOWALL' => 'Show All', 'GT' => 'Stock+Refill > Target after Levelling', 'E' => 'Stock+Refill = Target after Levelling', 'LT' => 'Stock+Refill < Target after Levelling'); $content .= '<div id="search_form" class="ui-widget-content ui-corner-all" style="position:fixed;padding:10px;cursor:move;">'; $content .= '<div id="kpi-block" style="position:absolute;width:210px;top:0;">'; $content .= '<div class="ui-state-default ui-corner-all" style="float:right;margin:10px 10px 0 0"><span title="Hide/Show KPI Depot Terms" class="ui-icon ui-icon-info" id="kpi-icon"></span></div>'; $content .= '<div class="ibox ui-corner-all" style="padding:10px;display:none;">'; $content .= '<h3>DIOH Target</h3>'; $content .= '<table class="form" style="" border="0" cellpadding="0" cellspacing="0">'; for ($s = 0; $s <= 3; $s++) { $content .= '<tr><td>' . drawStars($s) . '</td><td>=</td><td class="tar">' . product::$diohStopLevel[$s] . ' days</td></tr>'; } /* $content .= '<tr><td>DIOH Stop Level</td><td>= '.$class_pm->diohStopLevel.' days</td></tr>'; $content .= '<tr><td>Adjustment Orders</td><td>= '.$class_pm->adjustmentOrder.'</td></tr>'; */ $content .= '</table>'; $content .= '<div style="margin-top:5px;text-align:right;"><a href="?open=settings-best-sellings&hidemenu=true#stars" class="view_webpage">Change Settings »</a></div>'; $content .= '</div>'; //.ibox $content .= '</div>'; //#kpi-block $content .= '<h2>Filter Window</h2>'; $content .= '<table class="form" border="0" cellpadding="0" cellspacing="0">'; $content .= '<tr><td colspan="2" class="bold">Products</td></tr>'; $content .= '<tr><td>Stock Segment</td><td>' . $segment_combo . '</td></tr>';
/** * For handling submitted POST * @global array $session_userinfo * @param array $post_vars */ public function postProcess($post_vars) { global $session_userinfo; $result = array(); if ($post_vars['me_action'] == 'SEARCH') { $type = $post_vars['type']; $jng_sp_id = $post_vars['jng_sp_id']; //another strange case, in live datepicker filter is always given as \'datevalue\' instead of 'datevalue' //still cant find the root cause (and it's ok in local dev), so for quickwin workaround we simple replace //the \' value into ' with below update (sahat 11.02.2014) //$post_filters = explode("|", $post_vars['post_filters']); $post_filters = explode("|", str_replace('\\\'', "'", $post_vars['post_filters'])); $post_sorts = explode("|", $post_vars['post_sorts']); $filters = array(); foreach ($post_filters as $f) { $f_temp = explode('-', $f); $field = $f_temp[0]; unset($f_temp[0]); $value = implode('-', $f_temp); //explode to array for input on field $multivalue_fields which allowed multivalue separated by $multivalue_separator if (in_array($field, $this->multivalue_fields)) { $mv_temp = explode(current($this->multivalue_separator), $value); if (is_array($mv_temp) && $mv_temp > 0) { foreach ($mv_temp as $mv) { $mv = trim($mv); if (!isset($filters[$field]) || !in_array($mv, $filters[$field])) { $filters[$field][] = $mv; } } } else { $filters[$field][] = $value; } } else { $filters[$field][] = $value; } } $sorts = array(); foreach ($post_sorts as $s) { list($field, $value) = explode("-", $s); $sorts[$field][] = $value; } $query = $this->constructQuery($jng_sp_id, $filters, $sorts); //die($query); $dbq = tep_db_query($query); $result = ''; $products_ids = array(); $total_stock = 0; $total_stock_value = 0; $total_margin = 0; $total_sold = 0; $total_rets = 0; $total_sales = 0; $total_vc = 0; $total_sold_l30d = 0; $total_sold_l60d = 0; $total_sold_l90d = 0; $total_sales_l30d = 0; $total_sales_l60d = 0; $total_sales_l90d = 0; $display_spot = ''; while ($r = tep_db_fetch_array($dbq)) { $products_ids[] = $r['products_id']; $total_stock += $r['hh_stock']; $total_stock_value += $r['hh_stock_value']; $total_margin += $r['margin']; $total_sold += $r['total_sold']; $total_rets += $r['total_returned']; $total_sales += $r['total_sales']; $vc += $r['vc_now']; //$total_vc += $r['total_vc']; $total_vc += $r['vc_total']; $total_sold_l30d += $r['sold_monthly_1']; $total_sold_l60d += $r['sold_monthly_2']; $total_sold_l90d += $r['sold_monthly_3']; $total_sales_l30d += $r['sales_monthly_1']; $total_sales_l60d += $r['sales_monthly_2']; $total_sales_l90d += $r['sales_monthly_3']; } $jng_nodata = '<span class="notice">N/A for J&G</span>'; $returned_rate = number_format($total_sold > 0 ? $total_rets / $total_sold * 100 : 0, 1); $n_products_ids = count($products_ids); $result['type'] = $type; $result['spid'] = $jng_sp_id; $result['avg_margin'] = ($n_products_ids > 0 ? number_format($total_margin / $n_products_ids, 1) : 0) . '%'; $result['total'] = $n_products_ids; $result['total_stock'] = $total_stock; $result['total_stock_value'] = displayCurrency(CURRENCY_DEFAULT, convertCurrency($total_stock_value, CURRENCY_CODE_EURO, CURRENCY_DEFAULT)); $result['total_sold'] = $jng_sp_id == '0' ? $jng_nodata : $total_sold; $result['total_rets'] = $jng_sp_id == '0' ? $jng_nodata : $total_rets . " ({$returned_rate}%)"; $result['total_sales'] = $jng_sp_id == '0' ? $jng_nodata : displayCurrency(DEFAULT_CURRENCY, $total_sales); $result['vc'] = $jng_sp_id == '0' ? $jng_nodata : number_format($vc, 2); //$result['total_vc'] = number_format($total_vc, 2); $result['vc_total'] = $jng_sp_id == '0' ? $jng_nodata : number_format($total_vc, 2); $result['total_sales_l30d'] = displayCurrency(DEFAULT_CURRENCY, $total_sales_l30d); $result['total_sales_l60d'] = displayCurrency(DEFAULT_CURRENCY, $total_sales_l60d); $result['total_sales_l90d'] = displayCurrency(DEFAULT_CURRENCY, $total_sales_l90d); $result['total_sold_l30d'] = $total_sold_l30d; $result['total_sold_l60d'] = $total_sold_l60d; $result['total_sold_l90d'] = $total_sold_l90d; $result['products_ids'] = implode(',', $products_ids); } elseif ($post_vars['me_action'] == 'DISPLAY') { use_class('products_minierp'); use_class('minierp_users'); use_class('Product'); $class_pm = new products_minierp(); $class_mu = new minierp_users(); $jng_sp_id = $post_vars['jng_sp_id']; $type = $post_vars['type']; $products_id = $post_vars['products_id']; $is_killed = $post_vars['is_killed']; $is_sp_not_yet_added = $post_vars['is_sp_not_yet_added']; $added_post_vars = array('is_killed' => $is_killed, 'is_sp_not_yet_added' => $is_sp_not_yet_added); $display_type = $post_vars['display_type']; $row_number = $post_vars['row_number']; $showing_id = $post_vars['showing_id']; $obj_product = new Product($products_id); $display_res = $this->retrieveDataForDisplay($jng_sp_id, $products_id, $added_post_vars, $display_type); $res = $display_res[0]; $img_size = $display_type == 'thumbnail' ? IMAGE_SIZE_THUMBNAIL_2 : IMAGE_SIZE_THUMBNAIL_1; //SHOW PURE IMAGE FOR SP THAT USED IT AS MAIN IMAGE if (in_array($jng_sp_id, $this->sp_use_pure_image)) { $obj_product->setDisplayImage(Product::IMAGE_TYPE_ZALANDO); } else { if (in_array($jng_sp_id, $this->sp_use_clear_image)) { $obj_product->setDisplayImage(Product::IMAGE_TYPE_AMAZON); } } //$products_image = webImageWithDetailLinkStars($image_used, $img_size, $img_size, 'Product '.$products_id, 'img-border', 'View Larger Image', IMAGE_SIZE_BIG_1, '', $res['stars'], 3, '', '', $res['products_brand_id']); $products_image = $obj_product->displayImage($img_size, $img_size); $position_padding = $display_type == 'thumbnail' ? '2px 0 0 15px;' : ''; $products_image = webImageAddPosition($row_number, $products_image, $position_padding); $products_complexity = productComplexityName($res['complexity']); $products_stars = drawStars($res['stars']); $products_is_watched = $class_mu->isOnWatchlist($session_userinfo['id'], $products_id); $resultsdt = array(); if ($display_type == 'table' || $type == 'displaytooltip') { if ($type == 'thumbnail_tooltip') { //HTML Version result $sales_partner_id = $jng_sp_id == 'allsp' ? '0' : $jng_sp_id; //TODO: seperate B2C and B2b calculation, or even better is if // we can calculate it by the object directly $price = $obj_product->getPriceSelling($sales_partner_id); $net_price = Product::calculateNetPrice($price, VAT); $cogs = $obj_product->getProductCOGSValue(); $profit = Product::calculateProfit($net_price, $cogs); $margin = Product::calculateMargin($profit, $net_price); $jng_nodata = '<span class="notice">N/A for J&G</span>'; $infos = array(); $infos[] = $obj_product->displayIDAndCode(); $infos[] = $res['products_name']; if ($res['hh_stock'] > 0) { $infos[] = '<strong class="green">Depot Stock = ' . $res['hh_stock'] . '</strong>'; } else { $infos[] = '<strong>Depot Stock = 0</strong>'; } $infos[] = 'Complexity = ' . $products_complexity; if ($res['sample_created'] == '1') { $infos[] = '<span class="green">Sample order created</span>'; } else { $infos[] = '<span class="notice">No sample order created</span>'; } if ($jng_sp_id == '0') { $total_sold = $jng_nodata; $return_info = $jng_nodata; $qty_sold = $jng_nodata; } else { $returned_rate = number_format($res['returned_rate'], 1); $sales_monthly = number_format($res['sales_monthly'], 1); $sales_weekly = number_format($res['sales_weekly'], 1); $total_sold = $res['total_sold']; $return_info = $res['total_returned'] . ' (' . $returned_rate . '%)'; $qty_sold = "per Week: {$sales_weekly} ⋅ per Month: {$sales_monthly}"; } $tooltip = '<div class="draw-table"><table border="0" cellpadding="0" cellspacing="0">'; $tooltip .= '<tr class="o"><td class="w200 bold">Brand</td><td class="w300 bold">' . $res['brand_name'] . '</td></tr>'; $tooltip .= '<tr class="e"><td>Info</td><td>• ' . implode('<br />• ', $infos) . '</td></tr>'; $tooltip .= '<tr class="o"><td>Price Preview</td><td>' . $obj_product->displayPricePreview($sales_partner_id) . '</td></tr>'; $tooltip .= '<tr class="e"><td>Margin in %</td><td>' . $obj_product->displayMargin($price, $margin) . '</td></tr>'; $tooltip .= '<tr class="o"><td>Age JG (finalized)</td><td>' . $res['jng_products_age'] . ' days</td></tr>'; $tooltip .= '<tr class="e"><td>Age (selected SP filter)</td><td>' . $res['products_age'] . ' days</td></tr>'; $tooltip .= '<tr class="o"><td>Total Sold (excl. JG)</td><td>' . $total_sold . '</td></tr>'; $tooltip .= '<tr class="e"><td>Total Returns (excl. JG)</td><td>' . $return_info . '</td></tr>'; $tooltip .= '<tr class="o"><td>Pieces Sold</td><td>' . str_replace('align="center"', 'align="left"', $obj_product->displayRecentSoldTable()) . '</div></td></tr>'; $tooltip .= '<tr class="e"><td>Qty. Sold (excl. JG)</td><td>' . $qty_sold . '</td></tr>'; $tooltip .= '</table></div>'; $ajaxResult = array(); $ajaxResult['type'] = $type; $ajaxResult['spid'] = $jng_sp_id; $ajaxResult['products_id'] = $products_id; $ajaxResult['tooltip'] = $tooltip; $ajaxResult['rownumber'] = $row_number; $ajaxResult['showingid'] = $showing_id; ajaxReturn($ajaxResult); } else { $sales_partner_id = $jng_sp_id == 'allsp' ? '0' : $jng_sp_id; $price = $obj_product->getPriceSelling($sales_partner_id); $net_price = Product::calculateNetPrice($price, VAT); $cogs = $obj_product->getProductCOGSValue(); $profit = Product::calculateProfit($net_price, $cogs); $margin = Product::calculateMargin($profit, $net_price); $material_expenses = displayCurrency(DEFAULT_CURRENCY, convertCurrency($res['material_expenses'], 'EUR', DEFAULT_CURRENCY), false); $products_price = displayCurrency(DEFAULT_CURRENCY, $res['products_price'], false); $products_price_old = displayCurrency(DEFAULT_CURRENCY, $res['products_price_old'], false); $products_created = date('d-M-Y', strtotime($res['products_date_added'])); $vc_now = number_format($res['vc_now'], 2); $total_vc = number_format($res['vc_total'], 2); $vc_percent = number_format($res['vc_percent'], 1); //$margin = $res['margin']; //$margin = '<span class="'.(($class_pm->priceMargindIsGood($res['products_price'], $margin)) ? 'green' : 'red') . '">' . // number_format($margin, 1) . '%</span>'; $margin = $obj_product->displayMargin($price, $margin); $returned_rate = number_format($res['returned_rate'], 1); $discount = number_format($res['products_discount'], 2); $total_sales = number_format($res['total_sales'], 2); $sales_monthly = number_format($res['sales_monthly'], 1); $sales_weekly = number_format($res['sales_weekly'], 1); $jng_nodata = '<span class="notice">N/A' . ($type == 'displaytooltip' ? ' ' : '<br />') . 'for J&G</span>'; //0-4 $resultsdt[] = $products_image; $resultsdt[] = $products_id; $resultsdt[] = $res['products_model']; $resultsdt[] = $res['products_name']; //$resultsdt[] = $class_pm->displayProductName($products_id); $resultsdt[] = $products_price_old; //5-9 $resultsdt[] = $products_price; $resultsdt[] = $discount; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $vc_now; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $vc_percent; $resultsdt[] = $margin; //10-14 $resultsdt[] = $res['products_age']; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $res['total_sold']; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $total_vc; $resultsdt[] = $res['total_returned']; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $returned_rate; //15-19 $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $total_sales; $resultsdt[] = $res['sold_monthly_1']; $resultsdt[] = $res['sold_monthly_2']; $resultsdt[] = $res['sold_monthly_3']; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $sales_weekly; //20-24 $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $sales_monthly; $resultsdt[] = $res['brand_name']; $resultsdt[] = $res['kill_status']; $resultsdt[] = $products_created; $resultsdt[] = $res['hh_stock']; //25-28 $resultsdt[] = $products_complexity; $resultsdt[] = $products_stars; $resultsdt[] = $products_is_watched; $resultsdt[] = $res['sample_created']; //29 $resultsdt[] = $res['jng_products_age']; $resultsdt[] = $material_expenses; $resultsdt[] = $res['products_length']; } } elseif ($display_type == 'thumbnail') { //0-4 $resultsdt[] = $products_image; $resultsdt[] = $products_id; $resultsdt[] = $res['products_model']; $resultsdt[] = $products_stars; $resultsdt[] = $products_is_watched; //5 $resultsdt[] = $res['sample_created']; } $result['type'] = $type; $result['spid'] = $jng_sp_id; $result['result'] = implode($this->result_separator, $resultsdt); $result['rownumber'] = $row_number; $result['showingid'] = $showing_id; } ajaxReturn($result); }
function templateElementsUsed($submit_action = '') { $products_id = isset($_POST['products_id']) ? $_POST['products_id'] : tep_db_prepare_input($_GET['products_id']); $act = isset($_POST['act']) ? $_POST['act'] : tep_db_prepare_input($_GET['act']); switch ($act) { case 'UPDATE_MATEXP_MANUAL': $matexp = tep_db_prepare_input($_POST['new_matexp']); $p = new Product($products_id); $p->updateMaterialExpense($matexp); $result = $matexp; break; case 'LOAD': $product = $this->retrieveDetail($products_id, 'p,pnc,pc'); $p = $product['p']; $pc = $product['pc']; $pnc = $product['pnc']; $result = ''; //ELEMENTS USED if ($pc !== false) { //For Customized Products: //CHECK FOR IMAGES OF CUSTOMIZED ELEMENTS $pe_image = array(); $pci_query = "SELECT phe.elements_id, pci.*"; $pci_query .= " FROM products_has_elements phe"; $pci_query .= " INNER JOIN phe_custom_image pci ON pci.products_has_elements_id=phe.products_has_elements_id"; $pci_query .= " WHERE phe.products_id={$products_id}"; $pci_query .= " ORDER BY orientation ASC, position ASC"; $pci_result = tep_db_query($pci_query); if (tep_db_num_rows($pci_result) > 0) { while ($row = tep_db_fetch_array($pci_result)) { if (!isset($pe_image[$row['elements_id']])) { $pe_image[$row['elements_id']] = array(); } $pe_image[$row['elements_id']][] = '<a href="?open=pe-uploaded-image&id=' . $row['elements_custom_image_uploaded_id'] . '&hidemenu=true" class="view_webpage" title="View uploaded image and comment">Image</a>'; } } //CHECK FOR TEXT OF CUSTOMIZED ELEMENTS $pe_text = array(); $pct_query = "SELECT phe.elements_id, pct.*"; $pct_query .= " FROM products_has_elements phe"; $pct_query .= " INNER JOIN phe_custom_text pct ON pct.products_has_elements_id=phe.products_has_elements_id"; $pct_query .= " WHERE phe.products_id={$products_id}"; $pct_query .= " ORDER BY orientation ASC, position ASC"; $pct_result = tep_db_query($pct_query); if (tep_db_num_rows($pct_result) > 0) { $fulltext = array(); while ($textrow = tep_db_fetch_array($pct_result)) { if (!isset($fulltext[$textrow['elements_id']])) { $fulltext[$textrow['elements_id']] = array(); } $fulltext[$textrow['elements_id']][] = $textrow['entry_text']; } foreach ($fulltext as $elements_id => $elements_text) { $elements_fulltext = implode('\\n', $elements_text); $pe_text[$elements_id] = '<a href="javascript:alert(\'' . $elements_fulltext . '\')">Text</a>'; } } //QUERY ELEMENTS $phe_query = "SELECT phe.elements_id, COUNT(phe.elements_id) AS quantity, e.elements_code"; $phe_query .= ", ed.name, ei.image_path, ei.image_filename, (etes.elements_price/etes.pieces_per_qty_type) AS price, etes.price_currency"; $phe_query .= " FROM products_has_elements phe"; $phe_query .= " LEFT JOIN elements e ON e.elements_id=phe.elements_id"; $phe_query .= " LEFT JOIN elements_description ed ON ed.elements_id=e.elements_id AND ed.languages_id=1"; $phe_query .= " LEFT JOIN elements_images ei ON ei.elements_id=phe.elements_id AND elements_sample_name='EC1'"; $phe_query .= " LEFT JOIN elements_to_elements_suppliers etes ON etes.elements_id=phe.elements_id AND etes.is_default='1'"; $phe_query .= " WHERE phe.products_id={$products_id}"; $phe_query .= " GROUP BY phe.elements_id"; $phe_result = tep_db_query($phe_query); if (tep_db_num_rows($phe_result) > 0) { $result .= '<div class="draw-table">'; $result .= '<table class="el-used" border="0" cellpadding="0" cellspacing="0">'; //Header $result .= '<tr><th>Image</th><th>ID</th>'; //$result .= '<th>Code</th>'; $result .= '<th>Info</th><th>Qty</th><th>Unit</th><th><abbr title="Material Expenses">Mat.Exp.</abbr></th></tr>'; $counter = 0; while ($phe = tep_db_fetch_array($phe_result)) { if ($phe['elements_code'] != '07-0001BS') { $counter++; $rowclass = $counter % 2 == 0 ? 'e' : 'o'; $qty_type = 'piece'; if ($phe['quantity'] > 1 && $qty_type == 'piece') { $qty_type .= 's'; } $el_img = 'elements/' . $phe['image_path'] . $phe['image_filename']; $el_img_src = webImageSource($el_img); $el_img_link = '<a href="' . $el_img_src . '" class="view_image" title="Element ID ' . $phe['elements_id'] . '">'; $result .= '<tr class="' . $rowclass . '">'; $result .= '<td>' . $el_img_link . webImage($el_img, '80', '80') . '</a></td>'; $result .= '<td><strong>' . $phe['elements_id'] . '</strong></td>'; //$result .= '<td><strong>'.$phe['elements_code'].'</strong></td>'; $result .= '<td style="width:300px;text-align:left;">'; $result .= $phe['name']; if (isset($pe_image[$phe['elements_id']]) || isset($pe_text[$phe['elements_id']])) { $result .= '<br /><br /><span class="red">Personized Elements:</span><br />'; if (isset($pe_image[$phe['elements_id']])) { $result .= implode(' • ', $pe_image[$phe['elements_id']]); } if (isset($pe_text[$phe['elements_id']])) { $result .= $pe_text[$phe['elements_id']]; } } $result .= '</td>'; $result .= '<td>' . $phe['quantity'] . '</td>'; $result .= '<td>' . $qty_type . '</td>'; $result .= '<td style="text-align:right;"><a href="?open=elements-suppliers&id=' . $phe['elements_id'] . '&hidemenu=true" class="view_webpage" title="View elements suppliers detail">'; $matexp = calculateCurrency($phe['quantity'] * $phe['price'], $phe['price_currency']); $result .= displayCurrency('EUR', $matexp); $result .= '</a></td>'; $result .= '</tr>'; } } $result .= '</table>'; $result .= '</div>'; } } else { //ELEMENTS USED //For standard Products: $result .= '<div id="add_el_used_form" style="display:none;">'; $submit_action = $submit_action == '' ? '?open=product-detail&products_id=' . $products_id . '#prodet-tab2' : $submit_action; $result .= '<form name="elements_used_add" action="' . $submit_action . '" method="post">'; $result .= '<input type="hidden" name="me_action" value="ELEMENTSUSEDADD" />'; $result .= '<input type="hidden" name="products_id" value="' . $products_id . '" />'; $result .= '<div class="form"><table border="0" cellpadding="0" cellspacing="0">'; $result .= '<tr><td class="label">Element ID/Code</td><td><input type="text" name="add_id" value="" /></td>'; $result .= '<tr><td>Element Qty</td><td><input type="text" name="add_qty" value="1" onfocus="$(this).select();" /></td>'; $result .= '</table></div>'; $result .= '<div class="buttons"><input type="submit" name="submit" value="Add Element" /></div>'; $result .= '</form>'; $result .= '</div>'; //OVERRIDE FORMS $result .= '<div id="ovr_el_used_form" style="display:none;">'; $result .= '<form name="elements_used_add" action="' . $submit_action . '" method="post">'; $result .= '<input type="hidden" name="me_action" value="ELEMENTSUSEDOVR" />'; $result .= '<input type="hidden" id="pid" name="products_id" value="' . $products_id . '" />'; $result .= '<input type="hidden" id="ovr_pean" name="ovr_pean" value=""/>'; $result .= '<input type="hidden" id="ovr_paid" name="ovr_paid" value=""/>'; $result .= '<input type="hidden" id="ovr_pueid" name="ovr_pueid" value=""/>'; $result .= '<input type="hidden" id="ovr_elid_def" name="ovr_elid_def" value=""/>'; $result .= '<input type="hidden" id="ovr_qty_def" name="ovr_qty_def" value=""/>'; $result .= '<input type="hidden" id="ovr_elid_old" name="ovr_elid_old" value=""/>'; $result .= '<input type="hidden" id="ovr_qty_old" name="ovr_qty_old" value=""/>'; $result .= '<input type="hidden" id="type" name="ovr_type" value=""/>'; $result .= '<div class="form"><table border="0" cellpadding="0" cellspacing="0">'; $result .= '<tr><td class="label">Element ID/Code</td><td><input type="text" id="ovr_id" name="ovr_id" value="" onfocus="$(this).select();" /></td>'; $result .= '<tr><td>Element Qty</td><td><input type="text" id="ovr_qty" name="ovr_qty" value="1" onfocus="$(this).select();" /></td>'; $result .= '</table></div>'; $result .= '<div class="buttons"><input type="button" class="submit" value="Override Element" /></div>'; $result .= '</form>'; $result .= '</div>'; //QUESTION FORMS $result .= '<div id="confirm_form" style="display:none;">'; $result .= '<div class="form"><table border="0" cellpadding="0" cellspacing="0">'; $result .= '<tr><td>There element ID overridden on Additional Lengths, do you want to also replace with element <span id="el_id" class="bold"></span>?</td></tr>'; $result .= '</table></div>'; $result .= '<div class="buttons"><button name="act_yes" id="act_yes">Yes</button><button name="act_no" id="act_no">No</button></div>'; $result .= '</div>'; $form_width = 845; $result .= '<form name="elements_used_update" action="' . $submit_action . '" method="post">'; $result .= '<input type="hidden" name="me_action" value="ELEMENTSUSEDUPDATE" />'; $result .= '<input type="hidden" name="products_id" value="' . $products_id . '" />'; if ($elements_use_msg != '') { $result .= '<div style="margin:10px 0px;font-weight:bold;" class="red">' . $elements_use_msg . '</div>'; } $pue_query = "SELECT pue.*, e.elements_code, e.elements_name, e.elements_image, e.elements_price, e.stars, e.elements_description"; $pue_query .= " FROM products_use_elements pue"; $pue_query .= " LEFT JOIN element e ON e.elements_id=pue.elements_id"; //$pue_query .= " LEFT JOIN `products_non_configurator` pnc ON pue.`products_id` = pnc.`products_id`"; //$pue_query .= " LEFT JOIN elements e ON e.elements_id=pue.elements_id"; //$pue_query .= " LEFT JOIN elements_description ed ON ed.elements_id=e.elements_id AND ed.languages_id=1"; //$pue_query .= " LEFT JOIN elements_images ei ON ei.elements_id=pue.elements_id AND elements_sample_name='EC1'"; //$pue_query .= " LEFT JOIN elements_to_elements_suppliers etes ON etes.elements_id=pue.elements_id AND etes.is_default='1'"; $pue_query .= " WHERE pue.products_id={$products_id}"; $pue_query .= " GROUP BY pue.elements_id"; $pue_result = tep_db_query($pue_query); $products_length = $pnc['products_length']; $form_footer = '<div class="pro-button" style="width:' . ($form_width + 5) . 'px;">'; $form_footer .= '<a href="?open=products-add-elements&pid=' . $products_id . '&hidemenu=true" class="view_webpage"></a>'; $form_footer .= '<input type="button" id="add_el_used" value="Add Element" />'; $form_footer .= '<input type="submit" name="submit" value="Save Changes" {BTNUPDDIS} />'; $form_footer .= '</div>'; $form_footer .= '</form>'; if (tep_db_num_rows($pue_result) == 0) { //No Elements attached to product $dis = SERVER_IS_LOCAL ? ' disabled="disabled"' : ''; $dis_note = SERVER_IS_LOCAL ? '<br /><span class="smallText notice">* can only' . ' be updated in Manobo Central!</span>' : ''; $result .= '<div class="box w500" style="margin-bottom:20px;">' . 'Material Expense (set manually in ' . CURRENCY_CODE_EURO . '): <input type="text"' . ' id="p-matexp-manual" class="w080 tar" value="' . $p['material_expenses'] . '"' . $dis . ' />' . $dis_note . '</div>'; $result .= '<h3 class="red bold">No Element is attached to this product</h3>'; $result .= str_replace('{BTNUPDDIS}', 'disabled="disabled"', $form_footer); } else { $complexity_manual = array_keys(productComplexityName(null, 2)); $title_complexity = 'This complexity sets '; $title_complexity .= '<strong>' . (in_array($p['complexity'], $complexity_manual) ? 'manually by user' : 'automatically by manobo') . '</strong>'; $title_complexity .= ', if you need to change this,<br/>please do as explained below:<ol><li>Click on complexity</li><li>Select new complexity from displayed list</li></ol>Done, should be complexity will updated to the new values'; $complexity = drawIconInfo($title_complexity, true, 'float-left', 'margin-right:5px;') . '<span id="elused-complexity" class="pointer" title="Click to set complexity manually">' . productComplexityName($p['complexity']) . '</span><select id="elused-complexity-manual" style="display:none;"><option value="">Please select complexity</option>' . loadComboListFromArray(productComplexityName(null, 2)) . '</select> Complexity «'; $deflength = $products_length <= 0 ? ' ' : '» Default Length ' . textLength($products_length); $result .= '<div style="margin-top:10px;width:' . $form_width . 'px;"><h2 style="float:right;">' . $complexity . '</h2><h2>' . $deflength . '</h2></div>'; $result .= '<div class="smallText notice" style="margin-bottom:2px;">* Remove elements by updating Qty to 0 (zero). To save all changes you MUST click on button "Save Changes"</div>'; $result .= '<div class="draw-table">'; $result .= '<table class="proman" border="0" cellpadding="0" cellspacing="0">'; //Header $result .= '<tr>'; $result .= '<th>Image</th><th>ID</th><th class="w100">Main Element<br> <a href="javascript:void(0)" id="clear-main-image">Clear</a></th>'; $result .= '<th>Name</th><th>Qty</th>'; $result .= '<th>Finishing</th>'; $result .= '<th><abbr title="Material Expenses">Mat.Exp.</abbr></th>'; $result .= '<th>Action</th>'; $result .= '</tr>'; $counter = 0; $matexp_total = 0; while ($pue = tep_db_fetch_array($pue_result)) { $products_analysis_link = ''; $counter++; $rowclass = $counter % 2 == 0 ? 'e' : 'o'; $pueid = $pue['products_use_elements_id']; $elid = $pue['elements_id']; $qty = $pue['quantity']; $is_main_el = $pue['is_main']; $lr_check = $pue['length_relevance'] == '1' ? 'checked="checked"' : ''; $is_main_el_check = $pue['is_main'] == '1' ? 'checked="checked"' : ''; $is_main_el_result = '<input type="radio" id="' . $elid . '" class="is_main" name="is_main[' . $pue['elements_id'] . ']" value="1"' . $is_main_el_check . '/>'; $el_img = webImageWithDetailLink($pue['elements_image'], '80', '80', 'Element ' . $pue['elements_id']); $quantity = '<input type="text" name="upd_qty[' . $pue['elements_id'] . ']" value="' . $pue['quantity'] . '" style="width:50px;text-align:center;" onfocus="this.select();" />'; $fin_gp = $pue['finishing_goldplate'] == '1' ? 'checked="checked"' : ''; $fin_hm = $pue['finishing_hammer'] == '1' ? 'checked="checked"' : ''; $fin_br = $pue['finishing_brush'] == '1' ? 'checked="checked"' : ''; $fin_ox = $pue['finishing_oxid'] == '1' ? 'checked="checked"' : ''; $fin_rg = $pue['finishing_rosegoldplate'] == '1' ? 'checked="checked"' : ''; $finishing = '<div style="margin-left:15px;"><table border="0" cellpadding="0" cellspacing="0">'; $finishing .= '<tr><td style="width:20px;"><input type="checkbox" id="fin_gp_' . $counter . '" class="fin" name="finishing_goldplate[' . $pue['elements_id'] . ']" value="1"' . $fin_gp . ' /></td><td class="load"><label for="fin_gp_' . $counter . '">Yellow Goldplate</label></td></tr>'; $finishing .= '<tr><td style="width:20px;"><input type="checkbox" id="fin_rg_' . $counter . '" class="fin" name="finishing_rosegoldplate[' . $pue['elements_id'] . ']" value="1"' . $fin_rg . ' /></td><td class="load"><label for="fin_rg_' . $counter . '">Rose Goldplate</label></td></tr>'; $finishing .= '<tr><td style="width:20px;"><input type="checkbox" id="fin_hm_' . $counter . '" class="fin" name="finishing_hammer[' . $pue['elements_id'] . ']" value="1"' . $fin_hm . ' /></td><td class="load"><label for="fin_hm_' . $counter . '">Hammer</label></td></tr>'; $finishing .= '<tr><td style="width:20px;"><input type="checkbox" id="fin_br_' . $counter . '" class="fin" name="finishing_brush[' . $pue['elements_id'] . ']" value="1"' . $fin_br . ' /></td><td class="load"><label for="fin_br_' . $counter . '">Brush</label></td></tr>'; $finishing .= '<tr><td style="width:20px;"><input type="checkbox" id="fin_ox_' . $counter . '" class="fin" name="finishing_oxid[' . $pue['elements_id'] . ']" value="1"' . $fin_ox . ' /></td><td class="load"><label for="fin_ox_' . $counter . '">Oxid</label></td></tr>'; $finishing .= '</table></div>'; //$matexp = $pue['quantity'] * $pue['elements_price']; $matexp = $this->elementMaterialExpenses($pue['quantity'], $pue['elements_price']); if ($pue['finishing_goldplate'] == '1') { $matexp += FINISHING_PRICE_YELLOWGOLD; } if ($pue['finishing_hammer'] == '1') { $matexp += FINISHING_PRICE_HAMMER; } if ($pue['finishing_brush'] == '1') { $matexp += FINISHING_PRICE_BRUSH; } if ($pue['finishing_oxid'] == '1') { $matexp += FINISHING_PRICE_OXID; } if ($pue['finishing_rosegoldplate'] == '1') { $matexp += FINISHING_PRICE_ROSEGOLD; } $matexp_total += $matexp; $matexp_link = '<a href="?open=elements-suppliers&id=' . $pue['elements_id'] . '&hidemenu=true" class="view_webpage" title="View elements suppliers detail">' . displayCurrency('EUR', $matexp) . '</a>'; //$products_analysis_link = '<a href="?open=products-analysis&sp=allsp&filter=el-used&sign=e&value='.$pue['elements_id'].'" target="_blank">Show all Products using this element</a>'; $products_analysis_link = '<a href="?open=products-analysis&sp=allsp&filter=el-used&sign=e&value=' . $pue['elements_id'] . '" target="_blank" title="Show all Products using Element ' . $pue['elements_id'] . '">« Show All Products »</a>'; $result .= '<tr class="' . $rowclass . '">'; $result .= '<td>' . $el_img . '</td>'; $result .= '<td><a class="view_webpage" href="?open=element&id=' . $pue['elements_id'] . '&hidemenu=true" title="Manage Element Detail">' . $pue['elements_id'] . '</a></td>'; $result .= '<td>' . $is_main_el_result . '</td>'; $result .= '<td class="name">' . $pue['elements_description'] . '<br />' . drawStars($pue['stars']) . '<br />' . $products_analysis_link . '</td>'; $result .= '<td>' . $quantity . '</td>'; $result .= '<td style="width:120;">' . $finishing . '</td>'; $result .= '<td class="pri">' . $matexp_link . '</td>'; $btn_o_def = '<input class="btn_ovr_def" type="button" value="Replace" title="Replace this element" />'; $h_pueid = '<input type="hidden" id="d_pueid" value="' . $pueid . '"/>'; $h_elid_def = '<input type="hidden" id="d_elid" value="' . $elid . '"/>'; $h_qty_def = '<input type="hidden" id="d_qty" value="' . $qty . '"/>'; $result .= '<td>' . $btn_o_def . $h_pueid . $h_elid_def . $h_qty_def . '</td>'; $result .= '</tr>'; } $products_finishing = array(); $products_finishing_styles = $this->productHaveStylePrice('PF', $products_id); $products_finishing_cost = 0; if (count($products_finishing_styles) > 0) { foreach ($products_finishing_styles as $styles_id) { $products_finishing_cost = $this->getStylePrice($styles_id); $matexp_total += $products_finishing_cost; //not use class styles related to php5 issues for J&G webshop $f_r = tep_db_query("SELECT name FROM styles_description WHERE styles_id = {$styles_id} AND languages_id = 2"); $f_row = tep_db_fetch_array($f_r); $products_finishing[$f_row['name']] = $products_finishing_cost; } } //$result .= '<tr><td colspan=""></td></tr>'; $result .= '</table></div>'; $chk_partial_plated = $product['p']['is_partial_plated'] == '1' ? 'checked="checked"' : ''; $title_product_is_partial_plated = 'Check this when product plated partially'; $result .= '<div style="margin:10px 0;float:left;" title="' . $title_product_is_partial_plated . '"><input type="checkbox" id="is_pp" value="1" name="is_partial_plated" ' . $chk_partial_plated . '>' . '<label for="is_pp"> Product is Partially Plated</label></div>'; if (count($products_finishing) > 0) { $result .= '<div style="margin:10px 0;width:' . $form_width . 'px;text-align:right;">'; foreach ($products_finishing as $pfin_name => $pfin_cost) { $result .= 'Product Finishing ' . $pfin_name . ': ' . displayCurrency('EUR', $pfin_cost) . '<br/>'; } $result .= '</div>'; } $result .= '<h3 style="margin:10px 0;width:' . $form_width . 'px;text-align:right;">Total Material Expenses: ' . displayCurrency('EUR', $matexp_total) . '</h3>'; $result .= str_replace('{BTNUPDDIS}', '', $form_footer); //ARTICLES (ADDITIONAL LENGTH) TABLES use_class('products_articles'); $class_pa = new products_articles(); $articles = $class_pa->retrieveList($products_id); if (count($articles) > 0) { $result .= '<div style="margin-top:30px;"><h2>Additional Length</h2></div>'; foreach ($articles as $key => $article) { $p_aid = $article['products_articles_id']; $qaue = "SELECT pa.*, pue.`quantity`,pue.`elements_id`, pue.`products_use_elements_id`, e.elements_image\n FROM products_articles pa\n INNER JOIN `products_use_elements` pue ON pue.`products_id` = pa.`products_id`\n LEFT JOIN element e ON e.`elements_id` = pue.`elements_id`\n WHERE pa.`products_articles_id` = {$p_aid}"; $dbqaue = tep_db_query($qaue); $p_ean = ''; $result .= '<div style="border:solid 1px #ababab;float:left;margin:0 20px 20px 0;background:#fff;">'; $articles_data = array(); while ($row = tep_db_fetch_array($dbqaue)) { $articles_data[$p_aid][] = $row; } foreach ($articles_data as $paid => $dt) { $p_ean = $dt[0]['products_ean']; $p_length = textLength($dt[0]['length']); $result .= '<h3 style="margin:5px;">Length ' . $p_length . '</h3>'; $result .= '<table class="paid" border="0" celpadding="0" cellspacing="0"><tr><th>Image</th><th>ID</th><th>Qty.</th><th>Action</th></tr>'; $n = 0; foreach ($dt as $key => $rd) { $el_img = $dt[$n]['elements_image']; $elid_def = $rd['elements_id']; $qty_def = $rd['quantity']; $qty_ovr = '0'; $elid_ovr = '0'; $pueid = $rd['products_use_elements_id']; $q_check = "SELECT paue.*, e.elements_image FROM products_articles_use_elements paue LEFT JOIN element e ON e.`elements_id` = paue.`elements_id` WHERE products_articles_id = {$p_aid} AND products_use_elements_id = {$pueid}"; $dbqc = tep_db_query($q_check); if (tep_db_num_rows($dbqc) > 0) { while ($rc = tep_db_fetch_array($dbqc)) { $elid_ovr = $rc['elements_id']; $qty_ovr = $rc['quantity']; if ($elid_ovr != '' && $elid_ovr != '0') { $el_img = $rc['elements_image']; } } } $style_elid = $elid_ovr != '0' && $elid_ovr != $elid_def ? ' bold' : ''; $style_qty = $qty_ovr != '0' && $qty_ovr != $qty_def ? ' bold' : ''; $elid = $elid_ovr != '0' ? $elid_ovr : $elid_def; $qty = $qty_ovr != '0' ? $qty_ovr : $qty_def; $result .= "<div>"; $result .= '<tr id="' . $p_aid . $elid_def . '"' . ($style_elid != '' || $style_qty != '' ? 'style="background:#fbff96;"' : "") . ">"; $result .= '<td class="img">' . webImage($el_img, '80', '80') . '</td>'; $result .= '<td class="id' . $style_elid . '">' . ($style_elid != '' ? '<a href="?open=element&id=' . $elid . '&hidemenu=true" class="view_webpage">' . $elid . '</a>' : $elid) . '</td>'; $result .= '<td class="qty' . $style_qty . '">' . $qty . '</td>'; $h_paid = '<input type="hidden" id="h_paid" value="' . $p_aid . '"/>'; $h_pean = '<input type="hidden" id="h_pean" value="' . $p_ean . '"/>'; $h_pueid = '<input type="hidden" id="h_pueid" value="' . $pueid . '"/>'; $h_elid_def = '<input type="hidden" id="h_elid_def" value="' . $elid_def . '"/>'; $h_qty_def = '<input type="hidden" id="h_qty_def" value="' . $qty_def . '"/>'; $h_elid = '<input type="hidden" id="h_elid" value="' . $elid . '"/>'; $h_qty = '<input type="hidden" id="h_qty" value="' . $qty . '"/>'; $btn_o = '<input class="btn_ovr" type="button" style="font-size:10;color:blue;margin:0;padding:0;" value="O" title="Override this element" />'; $btn_r = $elid_ovr != 0 && $elid_ovr != $elid_def || $qty_ovr != 0 && $qty_ovr != $qty_def ? '<input class="btn_ovr_r" type="button" style="font-size:10;color:red;margin:0;padding:0;" value="R" title="Reset this element to ' . $elid_def . ' / ' . $qty_def . '"/>' : '<input class="btn_ovr_r" type="button" style="font-size:10;margin:0;padding:0;color:grey;" value="R" title="Reset this element to ' . $elid_def . ' / ' . $qty_def . '" disabled="disabled"/>'; $result .= "<td>{$btn_o} {$btn_r} {$h_paid} {$h_pean} {$h_pueid} {$h_elid_def} {$h_qty_def} {$h_elid} {$h_qty}</td>"; $result .= "</tr>"; $n++; } $result .= '</table>'; } $result .= '</div>'; } } } $result .= '<div style="clear:both;"></div>'; } $result = utf8_encode($result); break; case 'UPDATE': break; case 'ADD': break; } return $result; }
break; case 'Create Date': $value = date('d.m.Y', strtotime($object->date_added)); break; case 'Team': $teams = load_config('teams'); $value = $teams[$object->team]; break; case 'Category': $value = improvement::getTeamCategories($object->team, $object->category); $sensitive = $object->is_sensitive ? '<br/><small style="border:solid 1px red;color:white;background:red;padding:5px;" class="ui-corner-all"><strong>S E N S I T I V E</strong></small><br/><br/>' : ''; if ($object->category == '1') { $value = '<strong class="red">' . $value . '</strong>'; } eval('$stars_title = improvement::TEXT_STARS_' . $object->relevancy_stars . ';'); $value = $sensitive . drawStars($object->relevancy_stars, 3, $stars_title) . '<br/>' . $value; break; case 'Kickoff': if ($object->attachments_kickoff->getTotalFiles() > 0) { $kickoff_icon = 'icon-document-ok.png'; $kickoff_title = 'MIMS already has at least 1 Kickoff document attached'; } else { $kickoff_icon = 'icon-document-missing.png'; $kickoff_title = 'MIMS has no Kickoff document attached'; } $value = '<img src="/images/' . $kickoff_icon . '" title="' . $kickoff_title . '" />'; break; case 'Details': $value = $detail_link . ($object->name == '' ? '<strong class="red">UNSPECIFIED NAME</strong>' : $object->name) . '</a>'; break; case 'Name':
?> </span> </span> </li> <li class="c"> <label>Корректность</label> <span id="a_stars_<?php echo $theme['id']; ?> " class="stars-vote vote-<?php echo $theme['a_rate']; ?> "> <span> <?php echo drawStars('a', $theme['id']); ?> </span> </span> </li> </ul> <?php } ?> <div class="utxt ops-nr-utxt<?php echo $theme['stage_status'] == sbr_stages::STATUS_ARBITRAGED ? ' ops-nr-arb' : ''; ?> "> <p id="message<?php echo $theme['id']; ?>
$class_pm = new products_minierp(); $content .= '<div id="prod-sales-info" style="margin-bottom:10px;">'; $content .= ' <div class="ui-state-default ui-corner-all" style="float:right;margin:10px 10px 0 0;">'; $content .= ' <span class="ui-icon ui-icon-minus" title="Hide/Show Sales Data" style="cursor: pointer;"></span>'; $content .= ' </div>'; $content .= ' <div class="ibox ui-corner-all">'; $npr = 0; foreach ($product_referer_ids as $product_referer_id) { $npr++; $content .= ' <h3>Product ' . $product_referer_id . ' Sales Data "All SP"</h3>'; $content .= ' <table border="0" cellpadding="0" cellspacing="0">'; $content .= ' <tr>'; $product_referer = $class_pm->retrieveDetail($product_referer_id, 'p,pl,sp'); $content .= ' <td align="center" rowspan="8">'; $content .= ' ' . webImageWithDetailLink($product_referer['p']['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Product ' . $product_referer_id, 'img-border'); $content .= ' <br/>' . drawStars($product_referer['p']['stars']); $content .= ' </td>'; $content .= ' <td rowspan="8" width="10px;"> </td>'; $content .= ' <td>Age</td><td>= </td><td>' . intval($product_referer['sp']['0']['active_age']) . ' days</td>'; $content .= ' </tr>'; use_class('Product'); $obj_product = new Product($product_referer_id); $content .= '<tr><td>Products Sold</td><td>= </td><td>' . str_replace('align="center"', 'align="left"', $obj_product->displayRecentSoldTable()) . '</td></tr>'; // $content .= ' <tr><td>Sold Last 30 Days </td><td>= </td><td>'.intval($product_referer['pl']['sold_monthly_1']).'</td></tr>'; // $content .= ' <tr><td>Sold Last 60 Days </td><td>= </td><td>'.intval($product_referer['pl']['sold_monthly_2']).'</td></tr>'; // $content .= ' <tr><td>Sold Last 90 Days</td><td>= </td><td>'.intval($product_referer['pl']['sold_monthly_3']).'</td></tr>'; $content .= ' <tr><td>Total Sold</td><td>= </td><td>' . intval($product_referer['sp']['0']['total_sold']) . '</td></tr>'; $content .= ' <tr><td>Total Return</td><td>= </td><td>' . intval($product_referer['sp']['0']['total_returned']) . '</td></tr>'; $content .= ' <tr><td>Returns Rate</td><td>= </td><td>' . number_format($product_referer['sp']['0']['returned_rate'], 2) . '%</td></tr>'; $content .= ' <tr><td>Total Sales</td><td>= </td><td>' . displayCurrency('EUR', $product_referer['sp']['0']['total_sales']) . '</td></tr>'; $content .= ' <tr><td>Sold per Week</td><td>= </td><td>' . number_format($product_referer['sp']['0']['sales_weekly'], 2) . '</td></tr>';