public function __construct($argv) { $this->logger = QCLogger::getInstance(); $this->config = QCConfig::getInstance(); //get revenue report filename from arg $this->revenueReportFile = RevenueReportUtils::getReportFileName($argv); $this->revenueReportDate = RevenueReportUtils::getReportDate($argv); $this->templateReportSheet = APPLICATION_ROOT_FOLDER . '/' . $this->config->get('reports')['cklein.consolidated.report.tempate.file']; $this->reportsFolder = $this->config->get("reports")["cklien.consolidated.reports.folder"]; $this->reportsFilename = $this->config->get('reports')["cklien.consolidated.reports.filename"]; $this->reportsFileExt = $this->config->get('reports')["cklien.consolidated.reports.file.ext"]; $this->reportsRecipients = $this->config->get('reports')["cklien.consolidated.reports.recipients.csv"]; }
function setUp($argv, $argc) { $logger = QCLogger::getInstance(); $logger->info("BEGIN " . __METHOD__); $revenueReportFile = RevenueReportUtils::getReportFileName($argv); if (!$argv) { $revenueReportFile = "/tmp/ck-daily-sales.csv"; } Registry::getInstance()->add('revenueReportFile', $revenueReportFile); if (!file_exists($revenueReportFile)) { $exception = new Exception("Revenue Report file " . $revenueReportFile . " is not found"); $this->handleSetupError($exception); throw $exception; } $revenueReport = new RevenueCSV($revenueReportFile); $csvRecords = $revenueReport->getCsvRecords()->setOffset(1)->fetchAll(); Registry::getInstance()->add('csvRecords', $csvRecords); $revenueReportModel = RevenueCSV2Model::transform($csvRecords); if ($revenueReportModel) { $revenueReportModel->setRevenueReportFile($revenueReportFile); } Registry::getInstance()->add('revReportModel', $revenueReportModel); $logger->info("END " . __METHOD__); }