use_class('styles'); use_class('products_minierp'); use_class('products_articles'); $class_s = new styles(); $class_pm = new products_minierp(); $class_pa = new products_articles(); $style_id = 680; //COLLECTION: DOOMED TO BE KILLED $products = $class_s->retrieveProducts($style_id, false); $killed = array(); $logger->write('Total products to check: ' . count($products)); foreach ($products as $pid => $date_added) { //SET INACTIVE FOR DTK ARTICLES WHICH HAVE NO DEPOT STOCK $products_articles = $class_pa->retrieveList($pid); foreach ($products_articles as $pa) { $stock_article = $class_pm->stockRetrieve(WAREHOUSE_ID_PRODUCTS_HAMBURG, $pid, $pa['products_articles_id']); if ($stock_article == 0) { $class_pa->setActiveStatus($pa['products_articles_id'], 0); } } $stock = $class_pm->stockRetrieve(WAREHOUSE_ID_PRODUCTS_HAMBURG, $pid, '*'); if ($stock == 0) { //KILL PRODUCT AND REMOVE IT FROM DTK COLLECTION $username = '******'; $class_pm->killProduct($pid, $username); $class_s->remProduct($style_id, $pid, $username); $killed[] = $pid; } } $killed_total = count($killed); //Notify Design and IT Team
$pure_image = webImageSource($products['products_pure_image'], IMAGE_SIZE_BIG_1); //GET EXTRA IMAGES DATA (PUT HERE SINCE ITS VALUE WILL USED ON Main Image SECTION) $extra_images_query = tep_db_query("SELECT * FROM products_extra_images WHERE products_id={$products_id} ORDER BY products_extra_images_id"); $extra_images = array(); $add_have_set_to_default = false; $alternate_main_image_key = null; $x = 0; while ($row = tep_db_fetch_array($extra_images_query)) { $extra_images[$x] = $row; if ($row['alternate_main_image'] == 1) { $add_have_set_to_default = true; $alternate_main_image_key = $x; } $x++; } $depot_stock = $class_pm->stockRetrieve(WAREHOUSE_ID_FOR_HANDLING_ORDERS, $products_id, '*'); $depot_refill = $class_do->refillOpenOrdersQuantity(SEGMENT_ID_DEFAULT, $products_id, '*'); $elements_status_raw = true; $elements_usage = $class_pm->retrieveElementsUsage($products_id); if (count($elements_usage) > 0) { $elements_stock = $class_es->retrieveList(WAREHOUSE_ID_ELEMENTS, 'elements_id IN (' . implode(',', array_keys($elements_usage)) . ')'); foreach ($elements_usage as $eid => $eu) { if ($eu['quantity'] > $elements_stock[$eid]) { $elements_status_raw = false; break; } } } else { $elements_status_raw = '<span class="green" title="No Element used Found for this product">NEF</span>'; } $elements_status = is_bool($elements_status_raw) ? '<span class="' . ($elements_status_raw ? 'green">OK</span>' : 'red">NS') . '</span>' : $elements_status_raw;
break; default: $value = ' '; } $cols[$class_raw] = strval($value); } $table[] = $cols; } } $date_filter_nice = date('d.m.Y', strtotime($date_filter)); $total_confirmed = $total_orders - $total_cancels; //GRAB IMPORT DATA $last_import = $class_jd->retrieveLatestDownloads($jng_sp_id, 'IMPORTDATA', 1); $importdata = $class_jc->importDataQueryEAN($jng_sp_id, $products_ean); $pdata = $class_ean->getProductArticle($products_ean); $stock = $class_pm->stockRetrieve($whid, $pdata['products_id'], $pdata['articles_id'], true); $content .= "<h2>Order Date {$date_filter_nice} - EAN {$products_ean}</h2>"; $content .= '<div class="smallText red" style="margin-bottom:5px;">* ' . (count($last_import) > 0 ? 'Using Data from last import: ' . $last_import[0]['info'] : 'No import data can be used') . '</div>'; $content .= '<div class="draw-table" style="margin-bottom:20px;"><table border="0" cellspacing="0" cellpadding="0">'; $content .= '<tr><th>Open PO</th><th>Stock SP</th><th>Stock HH</th><th>Ordered<br />by Customers</th><th>Delivered<br />to Customers</th></tr>'; $content .= "<tr class=\"o\"><td class=\"w080 tac\">{$importdata['sp_open_orders']}</td><td class=\"w080 tac\">{$importdata['sp_stock']}</td><td class=\"w080 tac\">{$stock}</td><td class=\"w080 tac\">{$importdata['sp_ordered']}</td><td class=\"w080 tac\">{$importdata['sp_delivered']}</td></tr>"; $content .= '</table></div>'; $content .= "<h3>Total Order = {$total_orders} ⋅ Total Cancels = {$total_cancels} ⋅ Total Confirmed = {$total_confirmed}</h3>"; $content .= '<form name="cancel_orders" action="?' . $_SERVER['QUERY_STRING'] . '" method="post">'; $content .= '<input type="hidden" name="me_action" value="CANCELORDERS" />'; $content .= tep_draw_table('', $table); $content .= '<div class="buttons-left"><input type="submit" name="submit" value="Cancel Orders!" title="Click here to cancel orders as " /></div>'; $content .= '</form>'; } else { $jng_sp_id = '5'; $sp_detail = $class_sp->retrieveDetail($jng_sp_id);
$list[$pid] = array(); $list[$pid]['articles'] = array(); $list[$pid]['code'] = $row['products_model']; $list[$pid]['image'] = $row['products_image']; $list[$pid]['stars'] = $row['stars']; } if (!isset($list[$pid]['articles'][$aid])) { $list[$pid]['articles'][$aid] = array(); $list[$pid]['articles'][$aid]['ean'] = $row['products_ean'] . ($row['length'] > 0 ? ' ⋅ ' . textLength($row['length']) : ''); $list[$pid]['articles'][$aid]['total'] = 0; $list[$pid]['articles'][$aid]['sent'] = 0; $list[$pid]['articles'][$aid]['mto'] = 0; $list[$pid]['articles'][$aid]['dso'] = 0; $list[$pid]['articles'][$aid]['waiting'] = 0; $list[$pid]['articles'][$aid]['new'] = 0; $list[$pid]['articles'][$aid]['stock'] = $class_pm->stockRetrieve($whid, $pid, $aid, true); $list[$pid]['articles'][$aid]['nsar'] = 0; //total No Stock After Released $ordered_refills_total = $class_do->refillOpenOrdersQuantity(SEGMENT_ID_HAMBURG, $pid, $aid); $ordered_refills_outsourcing = $class_do->refillOpenOrdersQuantityOutsourcing(SEGMENT_ID_HAMBURG, $pid, $aid); $list[$pid]['articles'][$aid]['open_os'] = $ordered_refills_outsourcing; $list[$pid]['articles'][$aid]['open_nos'] = $ordered_refills_total - $ordered_refills_outsourcing; } switch ($row['status']) { case '1': $colname = 'new'; break; case '2': case '3': case '4': case '5':
echo "ADD-{$pid}"; exit; } elseif ($_POST['me_action'] == 'REM1PROD') { $pid = tep_db_prepare_input($_POST['pid']); $product_sp = $class_jc->retrieveDetail(null, $jng_sp_id, $pid); $class_jc->remProduct($product_sp['jng_sp_catalog_id']); echo "REM-{$pid}"; exit; } elseif ($_POST['me_action'] == 'LOADPRODUCT') { $pid = tep_db_prepare_input($_POST['pid']); $pos = tep_db_prepare_input($_POST['pos']) + 1; $obj_product = new Product($pid); $product = $class_pm->retrieveDetail($pid, 'p,pd,pl,sp'); $product_sp = $class_jc->retrieveDetail(null, $jng_sp_id, $pid); $added = is_array($product_sp) && isset($product_sp['active_status']); $stock = $class_pm->stockRetrieve(WAREHOUSE_ID_PRODUCTS_HAMBURG, $pid); $cols = array(); foreach ($header as $hk => $hv) { $value = ''; switch ($hk) { case 'img': $value .= webImageAddPosition($pos, $obj_product->displayImage(IMAGE_SIZE_THUMBNAIL_2, IMAGE_SIZE_THUMBNAIL_2_PORTRAIT)); break; case 'nm w300': $value .= $product['p']['products_brand_name']; $value .= '<br />' . $obj_product->displayIDAndCode(); $value .= '<br />' . $product['pd']['2']['products_name']; $value .= '<br /><br /><a href="?open=products-price&pids=' . $pid . '&hidemenu=true&hidecopyurl=true"'; $value .= ' class="bold view_webpage">» Click here to manage price details!</a>'; break; case 'ps w150':
<?php global $db; require_once '../confy.php'; require_once '../functions.php'; require_once '../functions-2.php'; tep_db_connect(); use_class('products_minierp'); $class_pm = new products_minierp(); $jng_warehouses_id_fg = '7'; //7 is default warehouse for finished goods in bali $products_id = 26272; $products_stock = is_null($products_id) || $products_id == '' ? 0 : $class_pm->stockRetrieve($jng_warehouses_id_fg, $products_id); $class_pm->stockReduce($jng_warehouses_id_fg, $products_id, 1); //$row['stock_status'] = $this->updateItemStockStatus('', 'P'); echo "Product {$products_id} Stock = {$products_stock}"; tep_db_close();
$row[] = ''; //Saison $row[] = ''; //Gefahrgut $row[] = ''; //Gewicht der Batterie $row[] = ''; //Packing (Height) $row[] = ''; //Packing (Length) $row[] = ''; //Packing (Width) $row[] = ''; //Packing (Weight) $row[] = $i['qty_reported']; $row[] = intval($class_pm->stockRetrieve(WAREHOUSE_ID_PRODUCTS_HAMBURG, $pid, $aid)); // $row[] = $colors_main; // $row[] = $materials_stone; // $row[] = $materials_stone_size; // $row[] = (in_array($pdata['categories_id'], $string_category)) ? textLength($length) : '';; //Additional Details $row[] = $ean; $row[] = $pdata['pd']['2']['products_description']; $row[] = $pdata['pd2']['height']; $row[] = $pdata['pd2']['width']; $row[] = $pdata['pd2']['weight']; $row[] = $pdata['pd2']['diameter']; $row[] = $pdata['pd2']['pearls_total']; $row[] = $pdata['pd2']['pearls_color']; $row[] = $pdata['pd2']['pearls_shape']; $row[] = $pdata['pd2']['pearls_size'];
case 'b': $value .= '<strong>' . $product->brand_name . '</strong>'; $value .= '<br /><a href="?open=product-detail&products_id=' . $product->id . '" target="_blank">' . $product->id . ' / ' . $product->code . '</a>'; if (!is_null($product->last_keep_timestamp)) { $value .= '<br /><br />'; $value .= '<span class="red">« Last kept on ' . date('d.m.Y', $product->last_keep_timestamp) . ' by ' . $product->last_keep_by . ' »</span>'; } break; case 'c': $value = $product->displayYearlySoldTable(); break; case 'd': $value = $product->displayRecentSoldTable(); break; case 'e': $value = strval($class_pm->stockRetrieve(WAREHOUSE_ID_PRODUCTS_HAMBURG, $pid, '*', true)); break; case 'f': if ($product->is_killed) { $value .= '<div class="red">KILLED!</div>'; } else { $value .= '<input type="hidden" name="products_id" value="' . $pid . '" />'; $value .= '<input type="button" class="w080 bold red" name="kill" value="Kill" />'; $value .= '<br /><input type="button" class="w080 green" name="keep" value="Keep" />'; } break; default: $value = ' '; } $row .= '<td class="' . $hk . '">' . $value . '</td>'; }