/** * Rule Engine Execution Data Generator for a Dealer * * @param \Akzo\Dealer $dealer Dealer for which to generate execution data * @param boolean $format none | json */ public function toRuleEngineDealerExecData(\Akzo\Dealer $dealer, $executionDataType, $format = 'none') { $data = parent::toRuleEngineDealerExecData($dealer, $executionDataType, 'none'); // Read in the sales value for the dealer for the products and period $vals = \Akzo\Sales\Service::getInstance()->getSalesData($dealer, $this->segment, $this->period, $this->products); if (strcasecmp($this->type->getValue(), \Akzo\Scheme\Data\Common\QuantityType::VALUE) === 0) { $data['val'] = $vals['value']; } else { $data['val'] = $vals['volume']; } if (strcasecmp($format, 'json') === 0) { return json_encode($data); } else { return $data; } }
private function _getSalesTargetData(\Akzo\Dealer $dealer, $executionDataType) { // Function for execution differs based on execution data type $funcToExec = 'getTargetData'; if (strcasecmp($executionDataType, \Akzo\Scheme\ExecuteActionDataType::ACTUAL) === 0 || strcasecmp($executionDataType, \Akzo\Scheme\ExecuteActionDataType::HISTORICAL) === 0) { $funcToExec = 'getSalesData'; } // Read in the sales value for the dealer for the products and period return call_user_func_array(array(\Akzo\Sales\Service::getInstance(), $funcToExec), array($dealer, $this->segment, $this->period, $this->product, $this->projectSku)); }
private function __getSalesData($period, $dealerIDs) { //$GLOBALS['logger']->info("kjndkgjd: ".PHP_EOL.print_r($dealerIDs,1)); return \Akzo\Sales\Service::getInstance()->loadSalesDataFromDealerIDs($dealerIDs, $period); }