function report_results() { $department = get_form_value('department', 0); $order = get_form_value('order', 'upc'); $dir = get_form_value('dir', 'ASC'); $excel = get_form_value('excel', False); $dbc = op_connect(); $query = "SELECT upc, description, normal_price, modified\n\t\t\tFROM products WHERE department={$department}\n\t\t\tORDER BY {$order} {$dir}"; $columns = array('UPC' => array('col' => 'upc'), 'Description' => array('col' => 'description'), 'Price' => array('col' => 'normal_price', 'align' => 'right', 'format' => '%.2f'), 'Last Modified' => array('col' => 'modified', 'date' => 'm/d/Y')); $report = get_sortable_table($dbc, $query, $columns, $this->module_url(), $order, $excel); if ($excel) { $this->download('report.xls', 'excel'); } $dbc->close(); return $report; }
function task() { $sql = op_connect(); $chk = $sql->query("TRUNCATE TABLE batchMergeTable"); if ($chk === False) { echo $this->cron_msg("Could not truncate batchMergeTable"); } $chk = $sql->query("INSERT INTO batchMergeTable SELECT * FROM batchMergeProd"); if ($chk === False) { echo $this->cron_msg("Could not load data from batchMergeProd"); } $chk = $sql->query("INSERT INTO batchMergeTable SELECT * FROM batchMergeLC"); if ($chk === False) { echo $this->cron_msg("Could not load data from batchMergeLC"); } echo $this->cron_msg("Task complete"); $sql->close(); }