//DEPOT ORDERS $q = "SELECT * FROM depot_orders WHERE ((status >= 1 AND status<=7) || status=22) " . ($reset_lsd ? '' : " AND IFNULL(leadtime_start_date,'') = ''"); if ($ids != '') { $q .= " AND depot_orders_id IN ({$ids})"; } $res = tep_db_query($q); while ($r = tep_db_fetch_array($res)) { $oid = $r['depot_orders_id']; $trans_type = $r['trans_type']; $trans_id = $r['trans_id']; if ($trans_type == 'SP') { $dbq = tep_db_query("SELECT leadtime_start_date FROM jng_sp_orders_items WHERE jng_sp_orders_items_id = {$trans_id}"); $r_his = tep_db_fetch_array($dbq); if (isset($r_his['leadtime_start_date'])) { $leadtime_start_date = $r_his['leadtime_start_date']; $n_updated = $class_do->leadtimeSetStart($leadtime_start_date, '', $oid, $reset_lsd); if ($n_updated > 0) { echo "DP-{$oid} ~ {$leadtime_start_date}<br/>"; } } } elseif ($trans_type == 'JG') { $dbq = tep_db_query("SELECT leadtime_start_date FROM orders_products WHERE orders_products_id = {$trans_id}"); $r_his = tep_db_fetch_array($dbq); if (isset($r_his['leadtime_start_date'])) { $leadtime_start_date = $r_his['leadtime_start_date']; $n_updated = $class_do->leadtimeSetStart($leadtime_start_date, '', $oid, $reset_lsd); if ($n_updated > 0) { echo "DP-{$oid} ~ {$leadtime_start_date}<br/>"; } } } else {