$chk = $sql->query("INSERT INTO batchMergeTable \n SELECT b.startDate, b.endDate, p.upc, p.description, b.batchID\n FROM batchList AS l LEFT JOIN batches AS b\n ON b.batchID=l.batchID INNER JOIN upcLike AS u\n ON l.upc = " . $sql->concat('LC', $sql->convert('u.likeCode', 'CHAR'), '') . ' ' . DTrans::joinProducts('u', 'p', 'INNER') . "\n WHERE p.upc IS NOT NULL"); if ($chk === False) { echo cron_msg("Could not load batch reporting data for likecodes"); } $sql->query("use {$FANNIE_TRANS_DB}"); $cashierPerformanceSQL = "\n SELECT\n min(tdate) as proc_date,\n max(emp_no) as emp_no,\n max(trans_num) as Trans_Num,\n min(tdate) as startTime,\n max(tdate) as endTime,\n CASE WHEN " . $sql->seconddiff('min(tdate)', 'max(tdate)') . " =0 \n then 1 else \n " . $sql->seconddiff('min(tdate)', 'max(tdate)') . "\n END as transInterval,\n sum(CASE WHEN abs(quantity) > 30 THEN 1 else abs(quantity) END) as items,\n Count(upc) as rings,\n SUM(case when trans_status = 'V' then 1 ELSE 0 END) AS Cancels,\n max(card_no) as card_no\n from dlog_90_view \n where trans_type IN ('I','D','0','C')\n group by year(tdate),month(tdate),day(tdate),trans_num"; if (!$sql->isView('CashPerformDay')) { $chk = $sql->query("TRUNCATE TABLE CashPerformDay"); if ($chk === False) { echo cron_msg("Could not truncate CashPerformDay"); } $chk = $sql->query("INSERT INTO CashPerformDay " . $cashierPerformanceSQL); if ($chk === False) { echo cron_msg("Could not load data for CashPerformDay"); } } if ($sql->tableExists('CashPerformDay_cache')) { $chk = $sql->query("TRUNCATE TABLE CashPerformDay_cache"); if ($chk === False) { echo cron_msg("Could not truncate CashPerformDay_cache"); } $chk = $sql->query("INSERT INTO CashPerformDay_cache " . $cashierPerformanceSQL); if ($chk === False) { echo cron_msg("Could not load data for CashPerformDay_cache"); } } $sql->query("USE " . $FANNIE_ARCHIVE_DB); if ($sql->table_exists("reportDataCache")) { $sql->query("DELETE FROM reportDataCache WHERE expires < " . $sql->now()); } echo cron_msg("Success");