function populateRoutes() { $time_pre = microtime(true); include '../connection.php'; set_time_limit(120); $reportS = 0; $reportW = 0; $thisWeek = getWeek(); $query = "SELECT cID FROM clients WHERE cActive = 1"; $sql = $db->query($query); while ($info = $sql->fetch_array()) { $cID = $info['cID']; // Check if client is in for this week. if (!inForThisWeek($cID, $thisWeek, $db)) { // Today is for ($i = 1; $i <= 5; $i++) { $delDay = date('Y/m/d', time() + ($i - date('w')) * 24 * 3600); $rDay = getTodaysDay($i); //echo $delDay.' '.$info['cID'].' '.$rDay.' '.$thisWeek.'</br>'; $unixDate = unixTime($delDay); $query = "INSERT INTO routes (cID,rDate,unixDate,rDay,rWeek) \n\t\t\t\t\t\t\t\tVALUES ('{$cID}', '{$delDay}','{$unixDate}', '{$rDay}', '{$thisWeek}')"; //echo $query; $db->query($query); $reportS++; } } else { $reportW++; } } $time_post = microtime(true); $exec_time = $time_post - $time_pre; echo "{$reportS} Clients were populated -- {$reportW} Clients were already populated for this week</br>"; echo "Routes has been populated: " . format_period($exec_time) . "</br>"; }
<!---- Deliveries tab ------> <div class="tabContent" id="deliveries"> <div class="fullHeight container-fluid"> <div class="row" style="padding: 0px 20px;"> <div id="delYesterday" class="col-md-4 btn btn-success" ><< Yesterday</div> <div id="delToday" class="col-md-4 btn btn-success">Today</div> <div id="delTomorrow" class="col-md-4 btn btn-success">Tomorrow >></div> </div> <div class="scrollable-yHeader" id="displayData"> <?php unixTime('11/23/2015'); ?> <?php getDeliverys(date('W'), getTodaysDay(date('w')), 0); ?> </div> </div> </div> <!---- Create routes tab ------> <div class="scrollable-y tabContent" id="generateDeliveryTab"> <div class="fullHeight container-fluid"> <div class="row" style="padding: 10px 30px;">