Example #1
0
 /**
  * method to execute the calculate process
  * it's called automatically by the cli main controller
  */
 public function execute()
 {
     $possibleOptions = array('type' => false);
     if (($options = $this->_controller->getInstanceOptions($possibleOptions)) === FALSE) {
         return;
     }
     $this->_controller->addOutput("Loading Calculator");
     $calculator = Billrun_Calculator::getInstance($options);
     $this->_controller->addOutput("Calculator loaded");
     if ($calculator) {
         $this->_controller->addOutput("Starting to calculate. This action can take a while...");
         $calculator->calc();
         $this->_controller->addOutput("Writing calculated data.");
         $calculator->write();
         $this->_controller->addOutput("Calculation finished.");
         $calculator->removeFromQueue();
     } else {
         $this->_controller->addOutput("Calculator cannot be loaded");
     }
 }
Example #2
0
 public function afterProcessorStore($processor)
 {
     Billrun_Factory::log('Plugin calc cpu triggered after processor store', Zend_Log::INFO);
     $customerPricingCalc = Billrun_Calculator::getInstance(array('type' => 'customerPricing', 'autoload' => false));
     foreach ($this->tx_saved_rows as $row) {
         $customerPricingCalc->removeBalanceTx($row);
     }
     if (isset($this->unifyCalc)) {
         $this->unifyCalc->releaseAllLines();
     }
 }