/** * Start process * * @return bool */ public function generateReport() { $begin = microtime(true); $this->_dropTmpTables(); $this->_createTmpTables(); $this->_prepareData(); $this->_countDataAndFillResult(); $this->_dropTmpTables(); $end = microtime(true); $this->_list->updated(); M('Trace')->trace('report_shop_purchase', "Purchases has been counted up for " . round($end - $begin, 2) . " sec"); // так как отчет пересчитывается раз в сутки, то отправим емейл с уведомлением (в логах трудно отследить, пересчитался отчет или нет). M("MailSend")->sendAdminMail(array("subject" => "Shop purchases report", "body" => "Report has been counted up\n" . 'table: ' . $this->_tables['report_table'] . "\n" . 'execution time: ' . round($end - $begin, 2) . ' sec')) or die("Cannot send mail!"); return TRUE; }
/** * Generate report * * @return bool **/ public function generateReport() { $begin = microtime(true); $this->_dropTmpTables(); $this->_createTmpTables(); $this->_fillTmpTables(); $this->_countPanelistActivity(); $this->_countMoneyInMonth(); $this->_countCategoryInMonth(); $this->_countPercents(); $this->_prepareData(); $this->_fillDataToReportTable(); $this->_dropTmpTables(); $end = microtime(true); $this->_list->updated(); M('Trace')->trace('report_region_payment', "Payments for the " . D($this->_getStartDate(), 'date-format') . " - " . D($this->_getEndDate(), 'date-format') . " has been counted up for " . round($end - $begin, 2) . " sec"); // так как отчет пересчитывается раз в месяц, то отправим емейл с уведомлением (в логах трудно отследить, пересчитался отчет или нет). M("MailSend")->sendAdminMail(array("subject" => "Payment region report", "body" => "Payments for the " . D($this->_getStartDate(), 'date-format') . " - " . D($this->_getEndDate(), 'date-format') . " has been counted up\n" . 'table: ' . $this->_report_table . "\n" . 'execution time: ' . round($end - $begin, 2) . ' sec')) or die("Cannot send mail!"); return TRUE; }