$merge_use_elements[$eid] = $qty;
    } else {
        if ($qty > $merge_use_elements[$eid]) {
            $merge_use_elements[$eid] = $qty;
        }
    }
}
//echo "<h3>After Merged</h3>";
//echo "<pre>";var_dump($merge_use_elements);echo "</pre>";
//echo '<br /><br /><br />';
$new_use_element = array();
echo "<table border='1'>";
echo "<tr><th>Element ID</th><th>Current Stock</th><th>Pre-Ordered</th><th>Ordered</th><th>Total Available</th><th>Min Amount Needed</th></tr>";
foreach ($merge_use_elements as $eid => $qty) {
    $elstock = $class_es->retrieveOne(WAREHOUSE_ID_ELEMENTS, $eid);
    $tot_qty_el_preorder = elements_preorder::openOrdersQuantity($eid);
    $tot_qty_el_order = elements_order::openOrdersQuantity($eid);
    $total = $elstock['stock'] + $tot_qty_el_preorder + $tot_qty_el_order;
    echo "<tr><td>{$eid}</td><td>{$elstock['stock']}</td><td>{$tot_qty_el_preorder}</td><td>{$tot_qty_el_order}</td><td>{$total}</td><td>{$qty}</td></tr>";
    if ($total < $qty) {
        $stock = $qty - $total;
        $new_use_element[] = array('elements_id' => $eid, 'quantity' => $stock);
    }
}
echo "</table>";
echo '<br /><br /><br />';
echo "<h3>New Pre Order to be created</h3>";
echo "<pre>";
var_dump($new_use_element);
echo "</pre>";
echo '<br /><br /><br />';
         //}
     }
     $result = array();
     $result['found'] = $found;
     $result['qtytoadd'] = $qtytoadd;
     $result['preview'] = $preview;
     ajaxReturn($result);
     exit;
 } elseif ($_POST['me_action'] == 'ADDMANSUBMIT') {
     $eid = tep_db_prepare_input($_POST['eid']);
     $qty = tep_db_prepare_input($_POST['qty']);
     $epo_status_1 = new elements_preorder($eid, '1');
     if ($epo_status_1->total_orders_qty > 0) {
         $epo_status_1->remove($epo_status_1->total_orders_qty, $epo_status_1->total_orders_qty, $session_userinfo['username']);
     }
     $epo_status_0 = new elements_preorder($eid, '0');
     if ($qty > $epo_status_0->total_orders_qty) {
         $epo_status_0->addOrder($qty - $epo_status_0->total_orders_qty);
     } elseif ($qty < $epo_status_0->total_orders_qty) {
         $epo_status_0->remove($epo_status_0->total_orders_qty - $qty, $epo_status_0->total_orders_qty, $session_userinfo['username']);
     }
     $epo_status_0->updateStatus(array_keys($epo_status_0->orders), '1', $session_userinfo['username']);
     $status = '1';
     $message = '<div class="green">' . $qty . ' Qty Added for Element ' . $eid . ' in Element Request Tab</div>';
     $result = array();
     $result['status'] = $status;
     $result['message'] = $message;
     ajaxReturn($result);
     exit;
 } elseif ($_POST['me_action'] == 'REDOWNLOADPO') {
     $po = strtoupper(tep_db_prepare_input($_POST['po']));
Exemple #3
0
 function updateStatus($old_status, $new_status, $username)
 {
     $design_current_status = $this->sub_status != '' ? "{$this->status}-{$this->sub_status}" : $this->status;
     if ($design_current_status == $old_status) {
         $sda = array();
         $temp_new_status = explode('-', $new_status);
         $temp_old_status = explode('-', $old_status);
         $new_main_status = $temp_new_status[0];
         $old_main_status = $temp_old_status[0];
         $new_sub_status = isset($temp_new_status[1]) ? $temp_new_status[1] : 'null';
         $old_sub_status = isset($temp_old_status[1]) ? $temp_old_status[1] : 'null';
         $sda['status'] = $new_main_status;
         $sda['sub_status'] = $new_sub_status;
         //will automatically reset sub_status when its moved to status that have no sub status
         tep_db_perform('designs', $sda, 'update', "designs_id={$this->id}");
         $this->status = $new_main_status;
         $this->sub_status = $new_sub_status == 'null' ? null : $new_sub_status;
         $timestamp = $this->addStatusHistory($new_status, $username);
         $long_timestamp = date('Y-m-d H:i:s');
         if ($old_status == '2' && $new_status == '11') {
             //REQUEST TO PULLEDRACK
             $this->setTargetDateStart($timestamp);
         } elseif ($old_status == '11' && $new_status == '2') {
             //PULLEDRACK BACK TO REQUEST
             $this->setTargetDateStart('CLEAR');
             //            } elseif ($old_status=='3' && $new_status=='5') {   //DRAFTS TO SAMPLINGS
         } elseif ($old_status == '3' && $new_main_status == '5') {
             //DRAFTS TO SAMPLINGS
             //                $drafts = $this->retrieveDrafts("approve_status='A'");
             $drafts = $this->retrieveDrafts("approve_status!='R'");
             if (count($drafts) == 0) {
                 use_class('design_draft');
                 $draft = new design_draft();
                 $draft->create($this->id, $this->name, $this->colors_request, $this->followers->list_raw);
                 $draft->uploadImage('1', DIR_WS_IMAGES . $this->image_1, basename($this->image_1));
                 //$draft->setApproveStatus('A', 'auto-set');
             }
         } elseif ($old_status == '8' && $new_status == '9') {
             //FINALIZE TO DONE
             $this->setTargetDateEnd($timestamp);
             $drafts = $this->retrieveDrafts("approve_status!='R'");
             $drafts_ids = array();
             foreach ($drafts as $d) {
                 $drafts_ids[] = $d['drafts_id'];
             }
             $products = $this->retrieveProducts();
             //ADD TO WATCHLSIT
             $products_ids = array();
             //to be used by ADD ATTRIBUTES
             $products_ids_nosample = array();
             $products_ids_sample = array();
             use_class('minierp_users');
             use_class('elements_preorder');
             use_class('elements_order');
             use_class('products_articles');
             use_class('products_minierp');
             use_class('elements_stock');
             $class_mu = new minierp_users();
             $class_pm = new products_minierp();
             $class_pa = new products_articles();
             $class_es = new elements_stock();
             $use_elements = array();
             $eao = 2;
             //element adjust order
             foreach ($products as $p) {
                 if (in_array($p['drafts_id'], $drafts_ids) && $p['finalized_time'] != '' && $p['finalized_by'] != '') {
                     $products_ids[] = $p['products_id'];
                     if ($p['create_sample'] == '1') {
                         $products_ids_sample[] = $p['products_id'];
                     } else {
                         $products_ids_nosample[] = $p['products_id'];
                     }
                     foreach ($this->watched_by as $wl_user_id) {
                         if ($wl_user_id > 0) {
                             $class_mu->addToWatchlist($wl_user_id, $p['products_id']);
                         }
                     }
                     // #BEGIN CALCULATE NEW ELEMENT SOURCE
                     // first check category
                     $tpdbq_products_use_elements = $class_pm->retrieveElementsUsage($p['products_id']);
                     foreach ($tpdbq_products_use_elements as $row_pue) {
                         $use_elements[] = array('elements_id' => $row_pue['elements_id'], 'quantity' => (int) $row_pue['quantity'] * $eao);
                     }
                     $tpdbq_products_articles = $class_pa->retrieveList($p['products_id'], "active_status='1'");
                     foreach ($tpdbq_products_articles as $row_pa) {
                         $tpdbq_products_articles_use_elements = $class_pm->retrieveElementsUsage($p['products_id'], $row_pa['products_articles_id']);
                         foreach ($tpdbq_products_articles_use_elements as $row_pue) {
                             $use_elements[] = array('elements_id' => $row_pue['elements_id'], 'quantity' => (int) $row_pue['quantity'] * $eao);
                         }
                     }
                     // #END CALCULATE NEW ELEMENT SOURCE
                 }
             }
             // merge same element id
             $merge_use_elements = array();
             foreach ($use_elements as $use_element) {
                 $eid = $use_element['elements_id'];
                 $qty = $use_element['quantity'];
                 if (!isset($merge_use_elements[$eid])) {
                     $merge_use_elements[$eid] = $qty;
                 } else {
                     if ($qty > $merge_use_elements[$eid]) {
                         $merge_use_elements[$eid] = $qty;
                     }
                 }
             }
             // check to stock and
             // insert to element preorder
             //echo "</pre>merge<pre>";var_dump($merge_use_elements);
             // dari sini gk dibaca
             foreach ($merge_use_elements as $eid => $qty) {
                 $epreorder = new elements_preorder($eid);
                 $elstock = $class_es->retrieveOne(WAREHOUSE_ID_ELEMENTS, $eid);
                 $tot_qty_el_preorder = elements_preorder::openOrdersQuantity($eid);
                 $tot_qty_el_order = elements_order::openOrdersQuantity($eid);
                 $total = $elstock['stock'] + $tot_qty_el_preorder + $tot_qty_el_order;
                 if ($total < $qty) {
                     $stock = $qty - $total;
                     $epreorder->addOrder($stock, null, "New Design " . $this->id);
                 }
             }
             //ADD ATTRIBUTES
             if (count($products_ids) > 0 && ($this->styles_id_F > 0 || $this->styles_id_L > 0)) {
                 use_class('styles');
                 $class_s = new styles();
                 if ($this->styles_id_F > 0) {
                     $class_s->addProduct($this->styles_id_F, $products_ids, $username);
                 }
                 if ($this->styles_id_L > 0) {
                     $class_s->addProduct($this->styles_id_L, $products_ids, $username);
                 }
             }
             //FINALLY, ACTIVATE THE PRODUCTS
             if (count($products_ids_nosample) > 0) {
                 $class_pm->activateProducts($products_ids_nosample, true);
             }
             if (count($products_ids_sample) > 0) {
                 $class_pm->activateProducts($products_ids_sample, true, true);
             }
         } elseif ($old_status == '11' && $new_status == '10-0') {
             //PULLRACK TO SOURCING
             $this->updateField('is_sourcing', 1);
             $n_drafts = $this->retrieveDrafts("approve_status!='R'");
             if (count($n_drafts) == 0) {
                 use_class('design_draft');
                 $draft = new design_draft();
                 $draft->create($this->id, $this->name);
                 $draft->uploadImage('1', DIR_WS_IMAGES . $this->image_1, basename($this->image_1));
                 //$element = $draft->createElement('', $this->name, 0, '', 0, date('Y-m-d H:i:s'), 'auto', '0');  //we not auto create this, since we already used sub_status on design level
             }
         } elseif ($old_status == '10-0' && $new_status == '11') {
             //SOURCING BACK TO PULLRACK
             $this->updateField('is_sourcing', 'null');
         }
         //INCREMENT FOR GRAPH DATASOURCE
         //            if($old_status==3 && ($new_status==4||$new_status==5)) {
         if ($old_status == 3 && ($new_status == 4 || $new_main_status == 5)) {
             //COUNT NUMBER OF DESIGN MOVED OUT
             $this->addDataToField($long_timestamp, 'design_drafts', 1);
         }
         //            if($new_status>5){
         if ($new_main_status > 5) {
             //COUNT NUMBER OF PRODUCTS MOVED OUT
             $q = "SELECT COUNT(dp.designs_id) total_products FROM designs_products dp";
             $q .= " INNER JOIN designs_drafts dd ON dd.drafts_id = dp.drafts_id AND dd.approve_status != 'R'";
             $q .= " WHERE dp.designs_id = " . $this->id;
             $q .= " GROUP BY dp.designs_id";
             $dbq = tep_db_query($q);
             $res = tep_db_fetch_array($dbq);
             $total_products = $res['total_products'] > 0 ? $res['total_products'] : 0;
             //                if($old_status==5 && $new_status==6) $this->addDataToField($long_timestamp, 'design_samplings', $total_products);
             if ($old_main_status == 5 && $new_main_status == 14) {
                 $this->addDataToField($long_timestamp, 'design_samplings', $total_products);
             }
             //                if($old_status==6 && $new_status==12) $this->addDataToField($long_timestamp, 'design_graphics', $total_products);
             if ($old_main_status == 14 && $new_status == 12) {
                 $this->addDataToField($long_timestamp, 'design_graphics', $total_products);
             }
             if ($old_status == 12 && $new_status == 7) {
                 $this->addDataToField($long_timestamp, 'design_product_qc', $total_products);
             }
             if ($old_status == 7 && $new_status == 8) {
                 $this->addDataToField($long_timestamp, 'design_details', $total_products);
             }
             if ($old_status == 8 && $new_status == 9) {
                 $this->addDataToField($long_timestamp, 'design_finalize', $total_products);
             }
         }
         /*NO NEED ANYMORE, SINCE WE ALREADY SAVED sub_status ON DESIGN LEVEL
           if($new_status==10) {
               if($old_status=='1' && $this->isSourcingNewElements()) $this->addStatusHistory("10-0", $username);
               elseif($old_status=='6' && $this->isSourcingNewElements()) $this->addStatusHistory("10-0", $username);
               elseif($old_status=='4') $this->addStatusHistory("10-1", $username);
               elseif($old_status=='5') $this->addStatusHistory("10-7", $username);
           }
            */
     }
 }
 $elements_counter = 0;
 $total_value = 0;
 $total_missing = 0;
 while ($r = tep_db_fetch_array($dbq)) {
     $include = false;
     $elid = $r['elements_id'];
     $current_stock = $r['stock_actual'];
     $qty_ordered = elements_order::openOrdersQuantity($elid);
     $qty_requested = elements_preorder::openOrdersQuantity($elid);
     $e = new element($elid);
     $dioh = $e->getDIOH($current_stock);
     $dioh2 = $e->getDIOH($current_stock + $qty_ordered);
     $dioh_text = $e->displayDIOH($current_stock);
     $dioh2_text = $e->displayDIOH($current_stock + $qty_ordered);
     $target_stock = $e->getDIOHstockTarget();
     $orders_in_sourcing = elements_preorder::totalNeededForSourcingTab($elid);
     $missing = $target_stock + $orders_in_sourcing - ($current_stock + $qty_ordered);
     if ($missing < 0) {
         $missing = 0;
     }
     $refill = $e->calcRefillQuantity($current_stock, $qty_ordered, 1);
     if (!$need_php_filtered) {
         $include = true;
     } else {
         switch ($filter_refill) {
             case 'ON':
                 if ($refill > 0) {
                     $include = true;
                 }
                 break;
             case 'OFF':
function getElementStock($jng_warehouses_id, $elements_id)
{
    global $history_options, $history_options_2, $reduce_reason;
    $element_query = "SELECT es.qty_type, pieces_per_qty_type, es.stock";
    $element_query .= ", e.elements_id, e.elements_image AS image, e.elements_name AS name, e.stars, e.elements_description";
    $element_query .= " FROM element e";
    //  $element_query .= " LEFT JOIN elements_description ed ON ed.elements_id=e.elements_id AND ed.languages_id=1";
    $element_query .= " LEFT JOIN elements_stock es ON es.elements_id=e.elements_id AND es.jng_warehouses_id={$jng_warehouses_id}";
    $msg_filter_type = 'ID';
    $element_query .= " WHERE e.elements_id='{$elements_id}'";
    $element_result = tep_db_query($element_query);
    if (tep_db_num_rows($element_result) > 0) {
        $element = tep_db_fetch_array($element_result);
        if ($element['qty_type'] == '') {
            $defstock_query = "SELECT price_quantity_type, pieces_per_qty_type FROM elements_to_elements_suppliers";
            $defstock_query .= " WHERE elements_id={$element['elements_id']} AND is_default='1'";
            $defstock_result = tep_db_query($defstock_query);
            $defstock = tep_db_fetch_array($defstock_result);
            $element_qty_type = $defstock['price_quantity_type'];
            $element_ppqt = $defstock['pieces_per_qty_type'];
        } else {
            $element_qty_type = $element['qty_type'];
            $element_ppqt = $element['pieces_per_qty_type'];
        }
        $qty_unit = 'qty';
        if ($element_qty_type == 'meter') {
            $qty_unit = 'cm';
        }
        //if($element_qty_type=='bottle') $qty_unit = 'gr';
        $eqto = array();
        //HIDE option to update by unit, must use qty
        //$eqto['unit'] = $element_qty_type;
        //if($eqto['unit']!='pieces') $eqto['qty'] = $qty_unit;
        $eqto['qty'] = $qty_unit;
        $element_qty_type_options = '<select name="eqt">';
        $element_qty_type_options .= loadComboListFromArray($eqto, null, null, false);
        $element_qty_type_options .= '</select>';
        if ($element_ppqt == 0) {
            $element_ppqt = 1;
            global $messagebox;
            $messagebox->add('<strong>Qty/Unit</strong> for default supplier is unset, please <a href="?open=elements-suppliers&amp;id=' . $elements_id . '&amp;hidemenu=true" class="view_webpage">click here to update</a>.');
        }
        $element_stock = $element['stock'] == '' ? '0' : round($element['stock'] / $element_ppqt, 2);
        $result = '';
        if ($messagebox->counter > 0) {
            $result .= $messagebox->build();
        }
        $stock_booked = elements_minierp::elementsBookedCount($jng_warehouses_id, $elements_id);
        $stock_booked_unit = round($stock_booked / $element_ppqt, 2);
        $stock_total = $element['stock'] + $stock_booked;
        $stock_total_unit = $element_stock + $stock_booked_unit;
        $orders_in_sourcing = elements_preorder::totalNeededForSourcingTab($elements_id);
        $orders_in_sourcing_unit = round($orders_in_sourcing / $element_ppqt, 2);
        $elname = 'Element ' . $element['elements_id'] . ($element['elements_description'] != '' ? ' &sdot; ' . $element['elements_description'] : '');
        $result .= '<h2>' . $elname . '</h2>';
        $result .= '<div style="float:left;">' . webImageWithDetailLinkStars($element['image'], IMAGE_SIZE_THUMBNAIL_2, IMAGE_SIZE_THUMBNAIL_2, "Element {$element['elements_id']}", 'img-border img-padding', 'Click to view larger image', IMAGE_SIZE_BIG_1, IMAGE_SIZE_BIG_1, $element['stars']) . '</div>';
        $result .= '<div class="form" style="margin-left:170px;">';
        //$result .= '<form name="element-stock-update" action="?open=elements-stock-update" method="post">';
        //$result .= '<input type="hidden" name="me_action" value="UPDATEELEMENTSTOCK" />';
        $result .= '<input type="hidden" id="elements_id" name="elements_id" value="' . $element['elements_id'] . '" />';
        $result .= '<input type="hidden" id="jng_warehouses_id" name="jng_warehouses_id" value="' . $jng_warehouses_id . '" />';
        $result .= '<input type="hidden" id="stock" value="' . $element_stock . '" />';
        $result .= '<input type="hidden" id="qty_type" value="' . $element_qty_type . '" />';
        $result .= '<input type="hidden" id="qty_unit" value="' . $qty_unit . '" />';
        $result .= '<input type="hidden" id="pieces_per_qty_type" value="' . $element_ppqt . '" />';
        $result .= '<table border="0" cellpadding="0" cellspacing="0">';
        //$result .= '<tr><td>Pieces per Unit Type</td><td><input type="text" readonly="readonly" class="disabled" value="'.$ppqt_text.'" /></td></tr>';
        $result .= '<tr><td>Pieces per Unit Type</td><td><input type="text" value="' . "1 {$element_qty_type}" . '" class="esi readonly" /></td><td class="notice">=</td><td><input type="text" value="' . "{$element_ppqt} {$qty_unit}" . '" class="esi readonly" /></td></tr>';
        //$result .= '<tr><td width="150">Stock Available</td><td><input type="text" readonly="readonly" class="disabled" value="'."$element_stock $element_qty_type".' &asymp; '."$element[stock] $qty_unit".'" /></td></tr>';
        $result .= '<tr><td>Stock Total</td><td><input type="text" value="' . "{$stock_total_unit} {$element_qty_type}" . '" class="esi" style="color:#000;" /></td><td>&asymp;</td><td><input type="text" value="' . "{$stock_total} {$qty_unit}" . '" class="esi" style="color:#000;" /></td></tr>';
        $result .= '<tr><td>Stock Booked</td><td><input type="text" value="' . "{$stock_booked_unit} {$element_qty_type}" . '" class="esi" style="color:#000;" /></td><td>&asymp;</td><td><input type="text" value="' . "{$stock_booked} {$qty_unit}" . '" class="esi" style="color:#000;" /></td></tr>';
        $result .= '<tr><td width="150" class="bold">Stock Available</td><td><input id="cs-unit" type="text" value="' . "{$element_stock} {$element_qty_type}" . '" class="esi bold" style="color:#000;" /></td><td>&asymp;</td><td><input id="cs-qty" type="text" value="' . "{$element['stock']} {$qty_unit}" . '" class="esi bold" style="color:#000;" /></td></tr>';
        $result .= '<tr><td width="150" class="notice">Orders in Sourcing Tab</td><td><input type="text" value="' . "{$orders_in_sourcing_unit} {$element_qty_type}" . '" class="esi" /></td><td>&asymp;</td><td><input type="text" value="' . "{$orders_in_sourcing} {$qty_unit}" . '" class="esi" /></td></tr>';
        $result .= '<tr><td colspan="4">';
        $result .= '<div id="stock-buttons">';
        $result .= '<input type="button" id="stock-add" value="Add" class="button" />';
        $result .= '<input type="button" id="stock-adj" value="Adjust" class="button" />';
        $result .= '<input type="button" id="stock-red" value="Reduce" class="red button" />';
        $result .= '</div>';
        $result .= '<div id="stock-forms" style="margin-top:10px;">';
        $result .= '<div id="form-add" class="float-box ui-corner-all" style="display:none;">';
        $result .= '<input type="text" id="stock-add-value" value="" style="width:50px" />';
        $result .= ' ' . $element_qty_type_options . ' &nbsp; ';
        $result .= ' <input type="button" value="Add" class="action-btn" id="action-add" />';
        $result .= ' <input type="button" name="cancel" value="Cancel" />';
        $result .= '</div>';
        $result .= '<div id="form-adj" class="float-box ui-corner-all" style="display:none;">';
        $result .= '<input type="text" id="stock-adj-value" value="' . $element_stock . '" style="width:50px" />';
        $result .= ' ' . str_replace('<select', '<select id="eqt-adj"', $element_qty_type_options) . ' &nbsp; ';
        $result .= ' <input type="button" value="Update" class="action-btn" id="action-adj" />';
        $result .= ' <input type="button" name="cancel" value="Cancel" />';
        $result .= '</div>';
        $result .= '<div id="form-red" class="float-box ui-corner-all" style="display:none;">';
        $result .= '<strong>Reduce Reason</strong><br /><select id="reduce_reason" class="input">' . loadComboListFromArray($reduce_reason) . '</select><br /><br />';
        $result .= '<input type="text" id="stock-red-value" value="" style="width:50px" />';
        $result .= ' ' . $element_qty_type_options . ' &nbsp; ';
        $result .= ' <input type="button" value="Reduce" class="red action-btn" id="action-red" />';
        $result .= ' <input type="button" name="cancel" value="Cancel" />';
        $result .= '</div>';
        $result .= '</div>';
        $result .= '</td></tr>';
        $result .= '</table>';
        //$result .= '</form>';
        $result .= '</div>';
        $result .= '<h2 style="margin:20px 0;">Show Historical data for &nbsp;';
        $result .= '<select id="euhperiod">' . loadComboListFromArray($history_options, null, null, false) . '</select>';
        $result .= '<select id="euhdaisum">' . loadComboListFromArray($history_options_2, null, null, false) . '</select>';
        $result .= '</h2>';
        $result .= '<div id="euhdata">';
        $result .= getElementStockHistory($jng_warehouses_id, $elements_id, 0, 0, $element['stock']);
        $result .= '</div>';
    } else {
        $result = '<span class="red">Can not find Element ' . $msg_filter_type . ' <strong>' . $elements_id . '</strong> in database.</red>';
    }
    return $result;
}
if ($total_elements_with_missing_qty > 0) {
    $elements_exclude_filter = implode(',', $elements_with_missing_qty);
    $q .= " AND e.elements_id NOT IN ({$elements_exclude_filter})";
}
$r = tep_db_query($q);
while ($row = tep_db_fetch_array($r)) {
    $eid = $row['elements_id'];
    $sdt = $row['sdt'];
    $elements_with_dioh_le_sdt[] = $eid;
    $need_in_sourcing_tab = $elements_need_in_sourcing_tab[$eid];
    $current_stock = intval($elements_stock[$eid]);
    $already_ordered = intval($elements_open_po[$eid]);
    $already_preordered = 0;
    $valid_stock = $current_stock + $already_ordered + $already_preordered - $need_in_sourcing_tab;
    $element = new element($eid);
    $dioh = $element->getDIOH($valid_stock);
    if ($dioh <= $sdt) {
        $epo = new elements_preorder($eid);
        $epo->addOrder($sdt_min_order_qty, null, 'Daily Cron (SDT)');
        $logger->write("Found DIOH ({$dioh}) &le; SDT ({$sdt}) : {$eid} " . ' - Preorders created');
    }
}
$total_elements_with_dioh_le_sdt = count($elements_with_dioh_le_sdt);
if ($total_elements_with_dioh_le_sdt == 0) {
    $logger->write('No scheduled Elements with DIOH &le; SDT found!');
} else {
    $logger->write('Successfully generated preorders for TOTAL ' . $total_elements_with_dioh_le_sdt . ' Elements');
}
$logger->close();
echo 'Done!';
tep_db_close();
Exemple #7
0
 public function retreiveNeededInSourcingQuantity()
 {
     use_class('elements_preorder');
     return elements_preorder::totalNeededForSourcingTab($this->id);
 }