Ejemplo n.º 1
0
 /**
  * We add the service type to service description and call the parent method afterwards.
  *
  * @param array  Service details
  * @param array  Service description
  * @return array The invoice row
  *
  * @author Former03 GmbH :: Florian Lippert <*****@*****.**>
  */
 function buildInvoiceRowIntervalFee($service_detail, $service_description)
 {
     if (isset($service_detail['service_type']) && $service_detail['service_type'] != '') {
         $service_description['service_type'] = $service_detail['service_type'];
     }
     return parent::buildInvoiceRowIntervalFee($service_detail, $service_description);
 }
Ejemplo n.º 2
0
 /**
  * Here we calculate the traffic usage, as we get the interval from the collector at this point.
  * All the rest is done in parent::buildInvoiceRowIntervalFee.
  *
  * @param array  Service details
  * @param array  Service description
  * @return array The invoice row
  *
  * @author Former03 GmbH :: Florian Lippert <*****@*****.**>
  */
 function buildInvoiceRowIntervalFee($service_detail, $service_description)
 {
     $traffic_total = 0;
     if (isset($this->traffic_data[$service_detail[$this->toInvoiceTableData['keyfield']]]) && is_array($this->traffic_data[$service_detail[$this->toInvoiceTableData['keyfield']]]) && !empty($this->traffic_data[$service_detail[$this->toInvoiceTableData['keyfield']]])) {
         reset($this->traffic_data[$service_detail[$this->toInvoiceTableData['keyfield']]]);
         foreach ($this->traffic_data[$service_detail[$this->toInvoiceTableData['keyfield']]] as $date => $traffic) {
             if (calculateDayDifference($service_detail['service_date_begin'], $date) >= 0 && calculateDayDifference($date, $service_detail['service_date_end']) > 0) {
                 $traffic_total += $traffic;
             }
         }
     }
     $service_description['traffic_included'] = round($service_detail['traffic'] / (1024 * 1024), 2);
     $service_description['traffic_total'] = round($traffic_total / (1024 * 1024), 2);
     if ($service_detail['traffic'] < $traffic_total && $service_description['traffic_included'] != '-1' && (int) $service_detail['additional_traffic_unit'] != 0) {
         $traffic_exceeded = $traffic_total - $service_detail['traffic'];
         // Wir casten auf int um die Dezimalstellen zu entfernen. Danach wird 1 addiert ("je angefangenes gb traffic")
         $service_detail['interval_fee'] = (int) ((int) ($traffic_exceeded / $service_detail['additional_traffic_unit']) + 1) * $service_detail['additional_traffic_fee'];
     } else {
         $service_detail['interval_fee'] = '0.00';
     }
     if ($service_description['traffic_included'] == '-1') {
         $service_description['caption_class'] = 'unlimited';
     }
     return parent::buildInvoiceRowIntervalFee($service_detail, $service_description);
 }
Ejemplo n.º 3
0
 public function actionFindDelect()
 {
     $data = serviceCategory::find()->where(['>', 'delect', 0]);
     $pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => '20']);
     $model = $data->offset($pages->offset)->limit($pages->limit)->all();
     return $this->render('delect', ['model' => $model, 'pages' => $pages]);
 }
Ejemplo n.º 4
0
 /**
  * If the check for included domain is positive we override interval_fee to 0.00 and call the parent method afterwards.
  *
  * @param array  Service details
  * @param array  Service description
  * @return array The invoice row
  *
  * @author Former03 GmbH :: Florian Lippert <*****@*****.**>
  */
 function buildInvoiceRowIntervalFee($service_detail, $service_description)
 {
     // Check for included domains
     if ($this->_checkIncludedDomain($service_detail['domain'], $service_detail['customerid']) === true) {
         $service_detail['interval_fee'] = '0.00';
     }
     return parent::buildInvoiceRowIntervalFee($service_detail, $service_description);
 }
Ejemplo n.º 5
0
 /**
  * We are merging the loginname in the returned value of the parent.
  *
  * @param date   The date when the template should have been valid
  * @param array  All appropriate template keys
  * @return array The valid template
  *
  * @author Former03 GmbH :: Florian Lippert <*****@*****.**>
  */
 function getServiceDescription($service_detail, $service_occurence)
 {
     return array_merge(parent::getServiceDescription($service_detail, $service_occurence), array('loginname' => $service_detail['loginname']));
 }