$update = strtolower($_POST['update']); $products_id = tep_db_prepare_input($_GET['products_id']); if ($update == 'add') { $class_mu->addToWatchlist($session_userinfo['id'], $products_id); } else { $class_mu->removeFromWatchlist($session_userinfo['id'], $products_id); } $result = array(); $result['pid'] = $products_id; $result['update'] = $update; ajaxReturn($result); exit; } elseif ($_POST['me_action'] == 'UPDATECOMPLEXITY') { $products_id = tep_db_prepare_input($_GET['products_id']); $complexity = tep_db_prepare_input($_POST['complexity']); $class_pm->updateComplexity($products_id, $complexity); echo utf8_encode(productComplexityName($complexity)); exit; } elseif ($_POST['me_action'] == 'UPDATEPRODUCTINFO') { //UPDATE PRODUCT DETAIL $products_id = tep_db_prepare_input($_POST['products_id']); //Update Table products $sql_data_array = array(); $sql_data_array['active_status'] = tep_db_prepare_input($_POST['active_status']); $sql_data_array['products_status'] = tep_db_prepare_input($_POST['products_status']); // $sql_data_array['products_date_added'] = tep_db_prepare_input($_POST['products_date_added']).' '.tep_db_prepare_input($_POST['products_date_added_time']); // $sql_data_array['products_last_modified'] = tep_db_prepare_input($_POST['products_last_modified']).' '.tep_db_prepare_input($_POST['products_last_modified_time']); $sql_data_array['products_last_modified'] = date('Y-m-d H:i:s'); if (isset($_POST['products_weight'])) { $sql_data_array['products_weight'] = tep_db_prepare_input($_POST['products_weight']); }
$q .= " UNION ALL"; $q .= " SELECT DATE(do.order_date) AS rowdate, do.products_id, do.quantity, p.complexity "; $q .= " FROM depot_orders do"; $q .= " LEFT JOIN products p ON p.products_id = do.products_id"; $q .= " LEFT JOIN jng_sp_orders_items joi ON do.trans_type='SP' AND joi.jng_sp_orders_items_id=do.trans_id"; $q .= " LEFT JOIN orders_products op ON do.trans_type='JG' AND op.orders_products_id=do.trans_id"; //$q .= " WHERE DATE(do.order_date)>DATE('$filterdate_start') AND DATE(do.order_date)<DATE('$filterdate_end') AND do.status NOT IN (10, 12)"; $q .= " WHERE do.order_date>'{$filterdate_start}' AND do.order_date<='{$filterdate_end}' AND do.status NOT IN (10, 12)"; $q .= " AND (IFNULL(do.trans_type, 'AR')='AR' OR NOT (IFNULL(joi.mode, 0)=4 OR IFNULL(op.mode, 0)=4))"; $q .= " ) dt"; $q .= " ORDER BY rowdate DESC, complexity"; $r = tep_db_query($q); $dbq = tep_db_query($q); $data = array(); while ($r = tep_db_fetch_array($dbq)) { $complexity = $r['complexity'] != '' ? $r['complexity'] : $class_pm->updateComplexity($r['products_id']); $complexity_settings = $class_pm->retrieveComplexitySettings($complexity); $data[$r['rowdate']]['complexity'][$complexity] += $r['quantity']; $data[$r['rowdate']]['avgtotal'] += $complexity_settings['avg']; } $result = '<div class="kpi-infobox" style="float:right;min-width:400px;">'; $result .= '<div class="ui-state-default ui-corner-all" style="float:right;margin:10px 10px 0 0"><span title="Hide/Show KPI Complexity" class="ui-icon ui-icon-minus" id="kpi-depot-info"></span></div>'; $result .= '<div class="ibox ui-corner-all" style="padding:10px;">'; $result .= '<h3>Current Settings</h3>'; $result .= '<table class="form" border="0" cellpadding="0" cellspacing="0">'; $result .= '<tr><td>AVG Time Product Easy</td><td>= ' . $bgst['vate_avgtime'] . ' minutes</td></tr>'; $result .= '<tr><td>AVG Time Product Medium</td><td>= ' . $bgst['vatm_avgtime'] . ' minutes</td></tr>'; $result .= '<tr><td>AVG Time Product Hard</td><td>= ' . $bgst['vath_avgtime'] . ' minutes</td></tr>'; $result .= '<tr><td>AVG Time Product Extreme</td><td>= ' . $bgst['vatx_avgtime'] . ' minutes</td></tr>'; $result .= '<tr><td>Available Time per Smith per Day</td><td>= ' . $bgst['atpdps'] . ' minutes</td></tr>'; $result .= '</table>';
<?php global $db; require_once '../confy.php'; require_once '../functions.php'; require_once '../functions-2.php'; tep_db_connect(); set_time_limit(0); ini_set('memory_limit', '256M'); use_class('products_minierp'); $class_pm = new products_minierp(); $n_complexity_added = 0; //$dbq = tep_db_query("SELECT * FROM products ORDER BY products_id "); //APPLY TO ALL PRODUCTS $dbq = tep_db_query("SELECT * FROM products WHERE IFNULL(complexity,'') = '' AND active_status = 1 ORDER BY products_id "); //APPLY TO ALL PRODUCTS WHICH HAVE NO complexity while ($r = tep_db_fetch_array($dbq)) { $pid = $r['products_id']; $update = $class_pm->updateComplexity($pid); if ($update) { $complexity = $class_pm->getProductComplexity($pid); echo "<p style=\"font-size:14px;\">Products {$pid} set with <strong>complexity {$complexity}</strong></p>"; $n_complexity_added++; } else { echo "<p style=\"font-size:14px;color:red;\">Products {$pid} HAVE NO complexity</p>"; } } echo "<br/><h2>{$n_complexity_added} Products are set with complexity</h2>";