Exemplo n.º 1
0
 $logger->write("{$total_found} article(s) found");
 if ($total_found > 0) {
     $canceled_qty_total = 0;
     while ($row = tep_db_fetch_array($r)) {
         $pid = $row['products_id'];
         $aid = $row['articles_id'];
         $stock_id = $pid . '-' . $aid;
         if (!isset($p) || !is_object($p) || $p->id != $pid) {
             $p = new Product($pid);
         }
         //CURRENT STOCK TARGET AFTER LEVELLING
         $target_after_levelling = $p->getDIOHstockTargetAfterLevelling($aid);
         //CURRENT STOCK (ALREADY RETRIEVED ABOVE)
         $current_stock = intval($products_stock[$stock_id]);
         //CURRENT OPEN ORDERS
         $already_ordered = $class_do->refillOpenOrdersQuantity($segment_id, $pid, $aid);
         //Check if we have too much refill
         $over_refill = $current_stock + $already_ordered - $target_after_levelling;
         $logger->write("- article {$pid}-{$aid}, Total orders = {$row['total_qty']}" . ", Over refill = {$over_refill}");
         if ($over_refill > 0) {
             //cancel orders
             $order_ids = explode(',', $row['order_ids']);
             $order_status = explode(',', $row['order_status']);
             $canceled_qty = 0;
             foreach ($order_ids as $key => $order_id) {
                 //AR is always 1 qty, so cancel all orders
                 //1 by 1 until total over_refill is reached
                 $new_status = $class_do->doCancelOrders($order_id, $order_status[$key], 'auto-set');
                 if (statusIsCancelConfirmed($new_status)) {
                     $canceled_qty++;
                     $canceled_qty_total++;
Exemplo n.º 2
0
 /**
  * Get total refill quantity of an article which currently still open
  * @param Int $articles_id
  * @return Int
  */
 public function getRefillQuantity($articles_id)
 {
     use_class('depot_orders');
     $class_do = new depot_orders();
     return $class_do->refillOpenOrdersQuantity(SEGMENT_ID_DEFAULT, $this->id, $articles_id);
 }
     $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':
     case '6':
     case '7':
         $colname = 'mto';
Exemplo n.º 4
0
 //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;
 $products_agegroup_options = $class_pm->productAgeGroupName();
Exemplo n.º 5
0
 public function retrieveRefillQuantity($articles_id)
 {
     use_class('depot_orders');
     $class_do = new depot_orders();
     return $class_do->refillOpenOrdersQuantity(SEGMENT_ID_HAMBURG, $this->id, $articles_id);
 }