public function generate()
 {
     //get Revenue Model object
     $revenueReportModel = RevenueReportUtils::getRevenueModel($this->revenueReportFile);
     //get Dw, WMS, Suplizer data from Db
     $dbData = $this->getDbData(array_keys($revenueReportModel->getOrders()));
     //get Cybersource data for each order
     $csTxnInfoArray = Transaction::getCyberSourceTxnSummary($revenueReportModel);
     $reportDataArray = ConsolidatedReportOrders2Array::getReportDataInArray($dbData, $revenueReportModel, $csTxnInfoArray);
     $this->logger->debug("reportData" . print_r($reportDataArray, true));
     $reportFile = $this->getReportFile();
     //$reportFile = $this->reportsFilename;
     $this->logger->debug("Report file  = " . $reportFile);
     $consolidateReportFile = (new OfficeExcelFactory())->createDocument($this->templateReportSheet, $reportFile, "0", $reportDataArray, "A3");
     $this->logger->debug("Report file generated " . $reportFile);
     $this->emailReport($reportFile);
 }
Exemple #2
0
 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__);
 }