Пример #1
0
 public function execute()
 {
     $request = $this->getRequest();
     $aid = $request->get("aid");
     $stamp = Billrun_Util::getBillrunKey(time());
     $subscribers = $request->get("subscribers");
     if (!is_numeric($aid)) {
         die;
     }
     if (is_string($subscribers)) {
         $subscribers = explode(",", $subscribers);
     } else {
         $subscribers = array();
     }
     $options = array('type' => 'balance', 'aid' => $aid, 'subscribers' => $subscribers, 'stamp' => $stamp);
     $generator = Billrun_Generator::getInstance($options);
     if ($generator) {
         $generator->load();
         header('Content-type: text/xml');
         $generator->generate();
         $this->getController()->setOutput(array(false, true));
         // hack
     } else {
         $this->_controller->addOutput("Generator cannot be loaded");
     }
 }
Пример #2
0
 public function __construct($options)
 {
     parent::__construct($options);
     $this->setFilename();
     $this->buildHeader();
     $this->file_path = $this->export_directory . DIRECTORY_SEPARATOR . $this->filename;
     $this->resetFile();
 }
Пример #3
0
 protected function fetchData($params)
 {
     $options = array('type' => 'balance', 'aid' => $params['aid'], 'subscribers' => $params['subscribers'], 'stamp' => $params['stamp'], 'buffer' => true);
     $generator = Billrun_Generator::getInstance($options);
     $generator->load();
     $output = $generator->generate();
     return $output;
 }
Пример #4
0
 public function __construct($options)
 {
     parent::__construct($options);
     $this->reportType = isset($options['report_type']) ? $options['report_type'] : $this->reportType;
     $this->reportBasePath = Billrun_Factory::config()->getConfigValue($this->reportType . '.reports.path', './');
     $this->types = Billrun_Factory::config()->getConfigValue($this->reportType . '.reports.types', array('I' => 'International', 'M' => 'Mobile', 'N' => 'National', '4' => 'National', 'P' => 'National', 'Un' => 'Other'));
     $this->startDate = isset($options['start_date']) ? strtotime($options['start_date']) : (strlen($this->stamp) > 8 ? strtotime($this->stamp) : Billrun_Util::getLastChargeTime(true));
     $this->endDate = isset($options['end_date']) ? strtotime($options['end_date']) : strtotime(date('Ymt', $this->startDate));
 }
Пример #5
0
 public function __construct($options)
 {
     parent::__construct($options);
     if (isset($options['csv_filename'])) {
         $this->csvPath = $this->export_directory . '/' . $options['csv_filename'] . '.csv';
     } else {
         $this->csvPath = $this->export_directory . '/' . $this->getStamp() . '.csv';
     }
     $this->loadCsv();
 }
Пример #6
0
 /**
  * method to execute the generate process
  * it's called automatically by the cli main controller
  */
 public function execute()
 {
     $possibleOptions = array('type' => false, 'stamp' => false, 'page' => true, 'size' => true);
     if (($options = $this->_controller->getInstanceOptions($possibleOptions)) === FALSE) {
         return;
     }
     $this->_controller->addOutput("Loading generator");
     $generator = Billrun_Generator::getInstance($options);
     $this->_controller->addOutput("Generator loaded");
     if ($generator) {
         $this->_controller->addOutput("Loading data to Generate...");
         $generator->load();
         $this->_controller->addOutput("Starting to Generate. This action can take a while...");
         $generator->generate();
         $this->_controller->addOutput("Finished generating.");
     } else {
         $this->_controller->addOutput("Generator cannot be loaded");
     }
 }
Пример #7
0
 protected function makeXml($account_billrun, $lines)
 {
     $options = array('type' => 'golanxml', 'stamp' => $account_billrun->getBillrunKey());
     $generator = Billrun_Generator::getInstance($options);
     $generator->createXmlInvoice($account_billrun->getRawData(), $lines);
 }