コード例 #1
0
 public function payCreditCard()
 {
     echo 1;
     die;
     fb($this->orderModel);
     $requestArray = array('request' => array('terminalid' => null, 'password' => null, 'action' => 1, 'card' => $this->paymentModel->cc_number, 'cvv2' => $this->paymentModel->cc_cvv, 'expYear' => '20' . $this->paymentModel->num4, 'expMonth' => $this->paymentModel->num3, 'member' => $this->customerModel->lname . ' ' . $this->customerModel->fname, 'currencyCode' => $this->campaignModel->currency_id, 'address' => $this->billingAddressModel->address1 . ' ' . $this->billingAddressModel->address2, 'city' => $this->billingAddressModel->city, 'statecode' => $this->billingAddressModel->state_id, 'zip' => $this->billingAddressModel->zip, 'CountryCode' => $this->billingAddressModel->country->country_name, 'email' => $this->customerModel->email, 'amount' => $this->attemptModel->amount, 'trackid' => $this->attemptModel->getrequest_id('vg'), 'udf1' => null, 'udf2' => null, 'udf3' => null, 'udf4' => null, 'udf5' => null));
     $xml = HelperFormatted::array2xml($requestArray);
     echo '<pre>';
     print_r($xml);
     echo '</pre>';
     return false;
     //OrderLog::createLog(0, $this->orderModel->order_id, 22, ($this->attemptModel->amount).' '.$this->campaignModel->currency_id);
 }
コード例 #2
0
 /**
  * @param $text
  * @return string - url to the created file
  */
 private function createFile($text)
 {
     $this->fileName = 'site_update_' . HelperFormatted::generateString(5) . '_' . time() . '.json';
     $this->dirPath = 'files/site_update/';
     $this->filePath = Config::get()->basePath . '/' . $this->dirPath . $this->fileName;
     //Save file
     try {
         $fp = fopen($this->filePath, "w");
         fwrite($fp, $text);
         fclose($fp);
         $this->fileUrl = Config::get()->url . $this->dirPath . $this->fileName;
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
コード例 #3
0
 public function getForGraph()
 {
     $searchFields = $this->searchFields;
     if (!$searchFields['initial_dates']) {
         return array();
     }
     $billingCycle = (int) $searchFields['billing_cycle'];
     if ($billingCycle < 1 || $billingCycle > 2) {
         $billingCycle = 1;
     }
     $initialDates = explode('-', $searchFields['initial_dates']);
     $dateStartT = explode('.', $initialDates[0]);
     $dateStart = array_reverse($dateStartT);
     $dateStart = implode('-', $dateStart);
     $dateFinishT = explode('.', $initialDates[1]);
     $dateFinish = array_reverse($dateFinishT);
     $dateFinish = implode('-', $dateFinish);
     $datetime1 = new DateTime($dateStart);
     $datetime2 = new DateTime($dateFinish);
     $interval = $datetime1->diff($datetime2);
     $int = $interval->days;
     $dates = array();
     if ($int < 10) {
         for ($i = 0; $i <= $int; $i++) {
             $dates[] = $datetime1->format('Y-m-d');
             $datetime1->add(new DateInterval('P1D'));
         }
     } else {
         $maxSelect = 10;
         $max = ceil($int / $maxSelect);
         $min = floor($interval->days / 10);
         $dif = $min == $max ? 1 : $min - $max;
         $x = ($int - $max * $maxSelect) / $dif;
         $y = ($int - $min * $x) / $max;
         while ($datetime1->getTimestamp() <= $datetime2->getTimestamp()) {
             $dates[] = $datetime1->format('Y-m-d');
             if ($x) {
                 $step = $min;
                 $x--;
             } elseif ($y) {
                 $step = $max;
                 $y--;
             }
             $datetime1->add(new DateInterval('P' . $step . 'D'));
         }
     }
     $db = self::$_msql;
     $this->whereAndLimit();
     $tempReport = array();
     $campaignsName = array();
     foreach ($dates as $date) {
         $sql = "SELECT `campaign_id`, 'ALL' AS `aff_id`, `col_name`, SUM(`data`) AS `data`, `campaign_name`\n                FROM (\n                    SELECT `date`, `campaign_id`, `aff_id`, `col_name`, `data`, `campaign_name`\n                    FROM (\n                        SELECT rh.*, c.`campaign_name`\n                        FROM `retention_history` as rh\n                        LEFT JOIN `campaigns` as c USING(`campaign_id`)\n                        WHERE ?p\n                        AND rh.`id_date` <= ?s\n                        AND rh.`col_name` IN ('c{$billingCycle}_net_revenue', 'c{$billingCycle}_potential_revenue')\n                        ORDER BY rh.`id_date` DESC\n                    ) `t`\n                    GROUP BY `date`, `campaign_id`, `aff_id`, `col_name`\n                ) `t2`\n                GROUP BY `campaign_id`, `col_name`\n                ORDER BY `campaign_id`";
         $r = $db->getAll($sql, $this->where, $date);
         $tArrayByCampaign = array();
         foreach ($r as $item) {
             if (!isset($campaignsName[$item['campaign_id']])) {
                 $campaignsName[$item['campaign_id']] = $item['campaign_name'];
             }
             if (!isset($tArrayByCampaign[$item['campaign_id']])) {
                 $tArrayByCampaign[$item['campaign_id']] = array();
             }
             $colNameArray = explode('_', $item['col_name'], 2);
             $tArrayByCampaign[$item['campaign_id']][$colNameArray[1]] = $item['data'];
         }
         foreach ($tArrayByCampaign as $k => $v) {
             if (!isset($tempReport[$k])) {
                 $tempReport[$k] = array();
             }
             $tempReport[$k][$date] = isset($v['potential_revenue']) && $v['potential_revenue'] && isset($v['net_revenue']) ? round($v['net_revenue'] / $v['potential_revenue'], 4) * 100 : null;
         }
         unset($tArrayByCampaign, $k, $v, $date, $colNameArray, $item, $r);
     }
     if (!$tempReport) {
         return array();
     }
     $campaigns = array_keys($campaignsName);
     $report = array(0 => array('Dates'));
     foreach ($campaignsName as $k => $v) {
         $tName = '[' . $k . '] ';
         $tName .= $v ? $v : __('no_name');
         array_push($report[0], $tName);
     }
     $i = 1;
     foreach ($dates as $date) {
         $dateFormatted = HelperFormatted::date($date, HelperFormatted::TIME_FORMAT_DATE);
         $report[$i] = array($dateFormatted);
         foreach ($campaigns as $campaignID) {
             array_push($report[$i], isset($tempReport[$campaignID][$date]) ? $tempReport[$campaignID][$date] : 0);
         }
         $i++;
     }
     return $report;
 }
コード例 #4
0
 public function getrecurring_next_formatted()
 {
     return $this->recurring_next ? HelperFormatted::date($this->recurring_next, HelperFormatted::TIME_FORMAT_DATE) : '';
 }
コード例 #5
0
 public function getcreated_formatted()
 {
     return $this->created ? HelperFormatted::date($this->created) : null;
 }
コード例 #6
0
 public function createByOrder(Order $order)
 {
     $modelAttempt = new Attempt();
     $modelAttempt->getLastOrderAttempt($order->order_id, Attempt::CREDIT_TYPE);
     //fb($order);
     $xmlArr = self::$_xmlContainer;
     $xmlArr['inkasso']['auftraggebernummer'] = 1088;
     $xmlArr['inkasso']['erstellungsdatum'] = date("d.m.Y");
     //$xmlArr['inkasso']['schuldner']['kundennummer']='';//2325
     $xmlArr['inkasso']['schuldner']['vorname'] = $order->customer->fname;
     $xmlArr['inkasso']['schuldner']['name'] = $order->customer->lname;
     //$xmlArr['inkasso']['schuldner']['anrede']='';
     //$xmlArr['inkasso']['schuldner']['geburtsdatum']='';
     //$xmlArr['inkasso']['schuldner']['familienstand']='';
     $xmlArr['inkasso']['schuldner']['gewerblich'] = 0;
     $xmlArr['inkasso']['schuldner']['rechtsform'] = 'Privat';
     //??
     //$xmlArr['inkasso']['schuldner']['arbeitgeber']['arbeitgeber-name1']='';
     //$xmlArr['inkasso']['schuldner']['arbeitgeber']['arbeitgeber-strasse']='';
     //$xmlArr['inkasso']['schuldner']['arbeitgeber']['arbeitgeber-plz']='';
     //$xmlArr['inkasso']['schuldner']['arbeitgeber']['arbeitgeber-ort']='';
     $xmlArr['inkasso']['schuldner']['adresse']['strasse'] = $order->address->fullAddress;
     $xmlArr['inkasso']['schuldner']['adresse']['plz'] = $order->address->zip;
     $xmlArr['inkasso']['schuldner']['adresse']['ort'] = $order->address->city;
     $xmlArr['inkasso']['schuldner']['adresse']['land'] = $order->address->country->country_name;
     //$xmlArr['inkasso']['schuldner']['adresse']['zusatz']='';
     $xmlArr['inkasso']['schuldner']['telefon']['telefonnr'] = $order->address->phone;
     $xmlArr['inkasso']['schuldner']['telefon']['typ'] = 'Telefon';
     //or Mobil
     $xmlArr['inkasso']['schuldner']['telefon']['zusatz'] = 'Zuhause';
     //?? Zuhause, Arbeit, Partner, Eltern
     $xmlArr['inkasso']['schuldner']['email']['emailadresse'] = $order->customer->email;
     //$xmlArr['inkasso']['schuldner']['bankverbindung']['kontoinhaber']='';
     $xmlArr['inkasso']['schuldner']['bankverbindung']['kontonr'] = strlen($order->payment->bank_code) <= 10 ? $order->payment->bank_code : null;
     $xmlArr['inkasso']['schuldner']['bankverbindung']['blz'] = strlen($order->payment->bank_code) == 8 ? $order->payment->bank_code : null;
     //$xmlArr['inkasso']['schuldner']['bankverbindung']['bankname']='';//??
     $xmlArr['inkasso']['inkassofall']['bestelldatum'] = HelperFormatted::date_euro_format($order->created);
     $xmlArr['inkasso']['inkassofall']['bestellzeit'] = HelperFormatted::time_format($order->created);
     $xmlArr['inkasso']['inkassofall']['mandatenreferenz'] = $order->campaign->order_url;
     $xmlArr['inkasso']['inkassofall']['zusatzinfo1'] = $order->ip_formatted;
     //$xmlArr['inkasso']['inkassofall']['zusatzinfo2']='';
     //$xmlArr['inkasso']['inkassofall']['zusatzinfo3']='';
     //$xmlArr['inkasso']['inkassofall']['sachbearbeiter']='';
     //$xmlArr['inkasso']['inkassofall']['telsach']='';
     $xmlArr['inkasso']['inkassofall']['forderung']['rechnungsnr'] = $modelAttempt->attempt_id;
     $xmlArr['inkasso']['inkassofall']['forderung']['rechnungstext'] = $modelAttempt->status_note;
     $xmlArr['inkasso']['inkassofall']['forderung']['betrag'] = $modelAttempt->amount * 100;
     $xmlArr['inkasso']['inkassofall']['forderung']['rech-datum'] = HelperFormatted::date_euro_format($modelAttempt->created);
     //$xmlArr['inkasso']['inkassofall']['forderung']['datumerstemahn']='';
     //$xmlArr['inkasso']['inkassofall']['forderung']['mahngebuehrengesamt']='';
     $xmlArr['inkasso']['inkassofall']['forderung']['zins-datum'] = HelperFormatted::date_euro_format($modelAttempt->created);
     //$xmlArr['inkasso']['inkassofall']['forderung']['katalog-nr']='';
     //$xmlArr['inkasso']['inkassofall']['forderung']['ruecklaeufergebuehr']='';
     //$xmlArr['inkasso']['inkassofall']['forderung']['datumruecklaeufergebuehr']='';
     //$xmlArr['inkasso']['inkassofall']['forderung']['waehrung']='';
     $xmlRequest = HelperFormatted::array2xml($xmlArr, false);
     /*
     header("Content-type:text/xml; charset=utf-8");
     echo $xmlRequest;
     die;
     */
     $xmlResponse = $this->request($xmlRequest, self::METHOD_INKASSOFAL_EINTRAGEN);
     $responseModel = simplexml_load_string($xmlResponse);
     $responseModel = (array) $responseModel;
     $responseItem = false;
     echo '<pre>';
     print_r($responseModel);
     echo '</pre>';
     die;
     foreach ($responseModel as $item) {
         ///*
         header("Content-type:text/xml; charset=utf-8");
         echo $item;
         die;
         //*/
         $responseItem = simplexml_load_string($item);
         return;
     }
     if ($responseItem && $responseItem->Code == 'OK') {
     } else {
     }
 }
コード例 #7
0
 public function getcreated_formatted()
 {
     return HelperFormatted::date($this->created);
 }
コード例 #8
0
 private function send($xmlArray, $url, $service = null, $post = true, $put = false)
 {
     $xml = null;
     if ($post && $service) {
         $xml = HelperFormatted::array2xml($xmlArray, false);
         $xml = str_replace('<' . $service . '>', '<' . $service . ' xmlns="http://ws.plimus.com">', $xml);
         fb($xml);
     }
     $url = $this->_paymentOptions['curlUrl'] . $url;
     $options = $this->gatewayModel->attributes;
     self::log('request', $xml, $url);
     $login = base64_encode(self::$isTest ? 'API_1420799842330432723628:l4D9dB8g!j4NaV70' : $options['username'] . ':' . $options['shared_secret']);
     //$key = '84bef16bbed7ec95389a6a3023b56b87d9e163c32812a96d19d9b3c6f3447e2108001655a66940752960648513ca8f6ba80b034a14e915de6d1392a2a2ca4d12950c948207e05749f635b468b82f38bd0418d67acd2a009070886ef0eb4eaec7239a6341aae57211ad9357e976c4fe37c80dea52009af6dc101114a513c9d1726bfce01c97ee370f60e1205c0fb92798736ddb8de558a666b7edb65f8ea4e82003945cbad9adcdf1259d8dd6c69081b2e226b6bba416cb0f84cfef5fc976fd2c6a9c247f4eb12a3a5ff0a06c85c0aeeeecc6cfe6507eedd05153d1e5bab9dd9840d9c78121fa8c86ffec32f778de5720d37c886ea4bb12c244e8a6255b20cab5';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_HEADER, 1);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     if ($post) {
         curl_setopt($ch, CURLOPT_URL, $url);
         if ($put) {
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
         }
         curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', 'Authorization: Basic ' . $login));
         curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
     } else {
         if (http_build_query($xmlArray)) {
             $url .= '?' . http_build_query($xmlArray);
         }
         curl_setopt($ch, CURLOPT_URL, $url);
         if ($put) {
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
         }
         curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', 'Authorization: Basic ' . $login));
     }
     $output = curl_exec($ch);
     if (curl_errno($ch)) {
         self::log('response', 'error:' . curl_error($ch));
         self::log('response', $output);
     }
     $info = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
     curl_close($ch);
     //Execute Curl call and extract header and body contant
     $headers = substr($output, 0, $info);
     $body = substr($output, $info);
     self::log('response', $body);
     $t = explode("\r\n", $headers);
     $headersArray = array();
     foreach ($t as $item) {
         $tt = explode(': ', $item);
         if (isset($tt[0]) && $tt[0] && isset($tt[1]) && $tt[1]) {
             $headersArray[trim($tt[0])] = trim($tt[1]);
         }
     }
     $return = array('headers' => $headersArray, 'body' => $body);
     if ($body) {
         libxml_use_internal_errors(true);
         try {
             $return['xml'] = new SimpleXMLElement($body);
         } catch (Exception $e) {
             $return['xml'] = null;
         }
     }
     if (self::$isTest) {
         fb('Service: ' . $service . '-->');
         fb($xmlArray);
         fb($url);
         fb('Response:');
         fb($return);
         fb('<--');
     }
     return $return;
 }
コード例 #9
0
 private static function clearDateArray($FilterFields, $dataArray)
 {
     foreach ($FilterFields as $k => $v) {
         if (!in_array($k, $dataArray)) {
             continue;
         }
         $dArray = explode('-', $v);
         if (isset($dArray[0]) && isset($dArray[1])) {
             $d1 = HelperFormatted::date($dArray[0], HelperFormatted::TIME_FORMAT_DATE);
             $d2 = HelperFormatted::date($dArray[1], HelperFormatted::TIME_FORMAT_DATE);
             if ($d1 && $d2) {
                 $FilterFields[$k . '_post'] = $FilterFields[$k];
                 $FilterFields[$k] = $d1 . '-' . $d2;
             }
         }
     }
     return $FilterFields;
 }
コード例 #10
0
 function newretentionAction()
 {
     $clearArray = array('campaign_id', 'detail_dates', 'detail_affiliates', 'detail_sid', 'simple', 'currency_id', 'country_id');
     $this->filter($clearArray);
     $filterFields = $this->params;
     //AFActiveDataProvider::clearDateArray($this->params, array('r_dates'));
     if (!isset($filterFields['circle']) || isset($filterFields['circle']) && !$filterFields['circle']) {
         $filterFields['circle'] = 0;
     }
     if ($clearArray) {
         foreach ($clearArray as $value) {
             if (isset($filterFields[$value])) {
                 $filterFields[$value] = explode(',', $filterFields[$value]);
             }
         }
     }
     // build filter select datasources
     $currencies = Currency::model()->cache()->findAllInArray();
     $countries = Country::model()->cache()->findAllInArray();
     $campaigns = isset($filterFields['campaign_id']) ? $filterFields['campaign_id'] : null;
     $country_id = isset($filterFields['country_id']) ? $filterFields['country_id'] : null;
     $currency_id = isset($filterFields['currency_id']) ? $filterFields['currency_id'] : null;
     $groupDate = isset($filterFields['detail_dates']) ? false : true;
     $groupAfid = isset($filterFields['detail_affiliates']) ? false : true;
     $groupSid = isset($filterFields['detail_sid']) ? false : true;
     $msql = SafeMySQL::getInstance();
     $sql = 'SELECT campaign_id, campaign_name
         FROM `campaigns`
         ORDER BY `campaign_id`';
     $campaignsFilterTemp = $msql->getAll($sql);
     $campaignsFilter = array();
     foreach ($campaignsFilterTemp as $v) {
         $campaignsFilter[$v['campaign_id']] = $v;
     }
     unset($campaignsFilterTemp);
     $sql = 'SELECT aff_id, aff_name
         FROM `affiliates`
         ORDER BY `aff_id`';
     $affidsTemp = $msql->getAll($sql);
     $affids = array();
     foreach ($affidsTemp as $v) {
         $affids[$v['aff_id']] = $v;
     }
     unset($affidsTemp);
     $where = '';
     if ($campaigns) {
         $where .= $msql->parse(" AND `campaign_id` IN (?a)", $campaigns);
     }
     if ($currency_id) {
         $where .= $msql->parse(" AND `campaign_id` IN ( select campaign_id from campaigns where currency_id in (?a))", $currency_id);
     }
     if ($country_id) {
         $where .= $msql->parse(" AND `campaign_id` IN ( select campaign_id from campaigns where country_id in (?a))", $country_id);
     }
     if (!isset($filterFields['r_dates'])) {
         $filterFields['r_dates'] = date('d.m.Y-d.m.Y');
     }
     $dates = explode('-', $filterFields['r_dates']);
     if (isset($dates[0]) && isset($dates[1])) {
         $dateStartT = explode('.', $dates[0]);
         $dateStart = array_reverse($dateStartT);
         $dateStart = implode('-', $dateStart);
         $dateFinishT = explode('.', $dates[1]);
         $dateFinish = array_reverse($dateFinishT);
         $dateFinish = implode('-', $dateFinish);
         $where .= $msql->parse(" AND DATE(`date`) BETWEEN ?s AND ?s", $dateStart, $dateFinish);
         unset($dateStartT, $dateFinishT);
     }
     if (!isset($filterFields['report_date'])) {
         $filterFields['report_date'] = date('d.m.Y');
     }
     $reportDateArray = explode('.', $filterFields['report_date']);
     if (isset($reportDateArray[0]) && isset($reportDateArray[1]) && isset($reportDateArray[2])) {
         $reportDate = array_reverse($reportDateArray);
         $reportDate = implode('-', $reportDate);
         $where .= $msql->parse("AND `id_date` <= ?s", $reportDate);
         unset($reportDate, $reportDateArray);
     }
     $where .= $msql->parse("AND CAST(SUBSTR(`col_name`,2,1) AS UNSIGNED) <= ?i", (int) $filterFields['circle']);
     $sql = "\n        SELECT " . ($groupDate ? "'ALL' AS " : '') . "`date`, `campaign_id`, " . ($groupAfid ? "'ALL' AS " : '') . "`aff_id`, " . ($groupSid ? "'ALL' AS " : '') . "`sid`, `col_name`, SUM(`data`) AS `data`, `currency_id`\n        FROM (\n            SELECT `date`, `campaign_id`, `aff_id`, `sid`, `col_name`, `data`, `currency_id`\n            FROM (\n                SELECT `retention_history`.*, `campaigns`.`currency_id`\n                FROM `retention_history`\n                LEFT JOIN `campaigns` USING(`campaign_id`)\n                WHERE 1 " . $where . "\n                ORDER BY `id_date` DESC\n            ) `t`\n            GROUP BY `date`, `campaign_id`, `aff_id`, `col_name`\n            ) `t2`\n        GROUP BY " . ($groupDate ? '' : "`date`, ") . "`campaign_id`, " . ($groupAfid ? '' : "`aff_id`, ") . "`col_name`\n        ";
     $result = $msql->getAll($sql);
     $report = array();
     $reportCur = array();
     $countR = 0;
     foreach ($result as $row) {
         if (isset($row['col_name'])) {
             $colNameArr = explode('_', $row['col_name']);
             if (isset($colNameArr[0])) {
                 $countCycles = (int) substr($colNameArr[0], 1, 1);
                 if ($countCycles > $countR) {
                     $countR = $countCycles;
                 }
             }
         }
         if (!isset($report[$row['date'] . '_' . $row['campaign_id'] . '_' . $row['aff_id']]['c' . ($row['col_name'][1] + 1) . '_gross'])) {
             if (!isset($report[$row['date'] . '_' . $row['campaign_id'] . '_' . $row['aff_id']])) {
                 $report[$row['date'] . '_' . $row['campaign_id'] . '_' . $row['aff_id']] = array();
             }
             $report[$row['date'] . '_' . $row['campaign_id'] . '_' . $row['aff_id']] += self::cycle_array($row['col_name'][1]);
         }
         $report[$row['date'] . '_' . $row['campaign_id'] . '_' . $row['aff_id']][$row['col_name']] = $row['data'];
         if (!isset($reportCur[$row['date'] . '_' . $row['campaign_id'] . '_' . $row['aff_id']])) {
             $reportCur[$row['date'] . '_' . $row['campaign_id'] . '_' . $row['aff_id']] = $row['currency_id'];
         }
     }
     $countR++;
     unset($result);
     foreach ($report as $row => $data) {
         for ($i = 0; isset($data['c' . ($i + 1) . '_gross']); $i++) {
             $report[$row]['c' . $i . '_gross'] = (int) $report[$row]['c' . $i . '_gross'];
             $report[$row]['c' . $i . '_declined'] = (int) $report[$row]['c' . $i . '_declined'];
             $report[$row]['c' . $i . '_void'] = (int) $report[$row]['c' . $i . '_void'];
             $report[$row]['c' . $i . '_pending'] = (int) $report[$row]['c' . $i . '_pending'];
             $report[$row]['c' . $i . '_rma'] = (int) $report[$row]['c' . $i . '_rma'];
             $report[$row]['c' . $i . '_partial_refund'] = (int) $report[$row]['c' . $i . '_partial_refund'];
             $report[$row]['c' . $i . '_chargeback'] = (int) $report[$row]['c' . $i . '_chargeback'];
             if ($i) {
                 $report[$row]['c' . $i . '_discounts'] = (int) $report[$row]['c' . $i . '_discounts'];
             }
             $report[$row]['c' . $i . '_decline_rate'] = $report[$row]['c' . $i . '_gross'] ? round($report[$row]['c' . $i . '_declined'] / $report[$row]['c' . $i . '_gross'], 4) : NULL;
             $report[$row]['c' . $i . '_paid'] = $report[$row]['c' . $i . '_gross'] - $report[$row]['c' . $i . '_declined'];
             $report[$row]['c' . $i . '_void_rate'] = $report[$row]['c' . $i . '_paid'] ? round($report[$row]['c' . $i . '_void'] / $report[$row]['c' . $i . '_paid'], 4) : NULL;
             $report[$row]['c' . $i . '_net_approved'] = $report[$row]['c' . $i . '_paid'] - $report[$row]['c' . $i . '_void'];
             $report[$row]['c' . $i . '_approval_rate'] = $report[$row]['c' . $i . '_paid'] ? round($report[$row]['c' . $i . '_net_approved'] / $report[$row]['c' . $i . '_paid'], 4) : NULL;
             $report[$row]['c' . $i . '_cancelled'] = $report[$row]['c' . $i . '_paid'] - $report[$row]['c' . $i . '_pending'] - $report[$row]['c' . ($i + 1) . '_gross'];
             $report[$row]['c' . $i . '_cancel_rate'] = $report[$row]['c' . $i . '_paid'] ? round($report[$row]['c' . $i . '_cancelled'] / $report[$row]['c' . $i . '_paid'], 4) : NULL;
             $report[$row]['c' . $i . '_subscriptions_approved'] = $report[$row]['c' . $i . '_paid'] - $report[$row]['c' . $i . '_cancelled'];
             $report[$row]['c' . $i . '_rma_rate'] = $report[$row]['c' . $i . '_paid'] ? round($report[$row]['c' . $i . '_rma'] / $report[$row]['c' . $i . '_paid'], 4) : NULL;
             //		$report[$row]['c'.$i.'_pending_rebill'] = $report[$row]['c'.$i.'_pending'] - $report[$row]['c'.$i.'_rma'];
             $report[$row]['c' . $i . '_chargeback_rate'] = $report[$row]['c' . $i . '_paid'] ? round($report[$row]['c' . $i . '_chargeback'] / $report[$row]['c' . $i . '_paid'], 4) : NULL;
             if ($i) {
                 $report[$row]['c' . $i . '_retention_count_rate'] = $report[$row]['c' . ($i - 1) . '_paid'] ? round($report[$row]['c' . $i . '_paid'] / $report[$row]['c' . ($i - 1) . '_paid'], 4) : NULL;
                 $report[$row]['c' . $i . '_retention_rate'] = $report[$row]['c' . $i . '_potential_revenue'] ? round($report[$row]['c' . $i . '_net_revenue'] / $report[$row]['c' . $i . '_potential_revenue'], 4) : NULL;
             }
         }
         if (isset($report[$row]['c' . $countR . '_gross']) && !$report[$row]['c' . $countR . '_gross']) {
             unset($report[$row]['c' . $countR . '_gross']);
         }
     }
     $extraFields = array(array('gross', 'declined', 'decline_rate', 'paid', 'void', 'void_rate', 'net_approved', 'approval_rate', 'cancelled', 'cancel_rate', 'subscriptions_approved', 'pending', 'rma', 'rma_rate', 'partial_refund', 'refund_amount', 'chargeback', 'chargeback_rate', 'chargeback_loss', 'net_revenue'), array('gross2', 'declined', 'decline_rate', 'paid', 'void', 'void_rate', 'net_approved', 'approval_rate', 'cancelled', 'cancel_rate', 'subscriptions_approved', 'pending', 'rma', 'rma_rate', 'discounts', 'discount_amount', 'partial_refund', 'refund_amount', 'chargeback', 'chargeback_rate', 'chargeback_loss', 'retention_count_rate', 'net_revenue', 'potential_revenue', 'retention_rate'));
     $simpleReportFields = array('gross', 'gross2', 'decline_rate', 'cancel_rate', 'chargeback_rate', 'pending', 'net_revenue', 'potential_revenue', 'retention_rate');
     // CSV builder
     if (isset($this->params['download_csv']) && $this->params['download_csv']) {
         self::retentionCsvBuilder($report, $extraFields, $campaignsFilter, $affids, $countR, $simpleReportFields, $filterFields);
         die;
     }
     $tempArray = explode('-', $filterFields['r_dates']);
     $filterFields['r_dates_post'] = $filterFields['r_dates'];
     $filterFields['r_dates'] = HelperFormatted::date($tempArray[0], HelperFormatted::TIME_FORMAT_DATE) . '-' . HelperFormatted::date($tempArray[1], HelperFormatted::TIME_FORMAT_DATE);
     $filterFields['report_date'] = HelperFormatted::date($filterFields['report_date'], HelperFormatted::TIME_FORMAT_DATE);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_newretantion_table', array('application', 'views', 'reports'), array('access' => $this->access, 'controller' => $this->controller, 'report' => $report, 'extraFields' => $extraFields, 'countR' => $countR, 'campaignsFilter' => $campaignsFilter, 'filterFields' => $filterFields, 'affids' => $affids, 'simpleReportFields' => $simpleReportFields, 'simple' => isset($this->params['simple']) ? (int) $this->params['simple'] : 0, 'currencies' => $currencies, 'countries' => $countries, 'reportCur' => $reportCur));
         die;
     }
     Assets::css('jquery-ui');
     Assets::js('//code.jquery.com/ui/1.10.3/jquery-ui.js');
     Assets::js('dateRange/jquery.daterange');
     Assets::js('jquery.form');
     // for ajax submission used to build csv
     Assets::js('ajax_table');
     Assets::js('af_input_field');
     $this->render('newretention', array('report' => $report, 'extraFields' => $extraFields, 'countR' => $countR, 'campaignsFilter' => $campaignsFilter, 'filterFields' => $filterFields, 'affids' => $affids, 'simpleReportFields' => $simpleReportFields, 'simple' => isset($this->params['simple']) ? (int) $this->params['simple'] : 0, 'currencies' => $currencies, 'countries' => $countries, 'reportCur' => $reportCur));
 }
コード例 #11
0
                <span class="help-inline"></span>
            </div>
        </div>

        <div class="control-group order-pmf pmf-pn">
            <label class="control-label"><?php 
echo __('exp_date');
?>
</label>
            <div class="controls">
                <select style="width: 160px;" name="fields_expmonth" id="fields_expmonth" class="afnosselect" data-placeholder="<?php 
echo __('month');
?>
">
                    <option value=""></option>
                    <? foreach(HelperFormatted::getMonth() as $key => $value){ ?>
                        <option value="<?php 
echo $key;
?>
" <?if($model->fields_expmonth == $key){?>selected="" <?}?>>(<?php 
echo $key;
?>
) <?php 
echo $value;
?>
</option>
                    <? } ?>
                </select>

                <select style="width: 116px;" name="fields_expyear" id="fields_expyear" class="afnosselect" data-placeholder="<?php 
echo __('year');
コード例 #12
0
 protected function getAttemptInfo($isSave = false)
 {
     $xmlStructure = array('request' => array('action', 'meta', 'params' => array('order' => array('orderid'))));
     $xmlArray = $this->getMainRequestArray(self::ACTION_GET_ORDERSTATUS, $xmlStructure);
     $xmlArray['request']['params']['order']['orderid'] = $this->orderModel->order_id;
     $xml = HelperFormatted::array2xml($xmlArray);
     $ExternalData = new ExternalData();
     $xmlResponse = $ExternalData->getData($this->_paymentOptions['curlUrl'], $xml);
     //fb($xmlArray);
     /*
     header("Content-type:text/xml; charset=utf-8");
     echo $xmlResponse;
     die;
     */
     if ($ExternalData->checkErrors()) {
         $this->_paymetnResponse->addError(substr($ExternalData->error, 6));
         $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
         return false;
     }
     $xmlResponseModel = simplexml_load_string($xmlResponse);
     $RESPONSE = $xmlResponseModel->REQUEST->RESPONSE;
     if ($RESPONSE->RESULT != 'OK') {
         $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
         return false;
     }
     $this->attemptModel->status_note = $RESPONSE->STATUS->STATUSID;
     if ($isSave) {
         if ($RESPONSE->STATUS->PAYMENTREFERENCE && !$RESPONSE->STATUS->CUSTOMERACCOUNT->PAYMENTREFERENCE) {
             $RESPONSE->STATUS->CUSTOMERACCOUNT->PAYMENTREFERENCE = $RESPONSE->STATUS->PAYMENTREFERENCE;
         }
         $this->saveBankData($RESPONSE->STATUS->CUSTOMERACCOUNT);
     }
     $this->checkResponseStatusID($RESPONSE);
     return true;
 }
コード例 #13
0
</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <base href="<?php 
echo Config::get()->url;
?>
">
    <link rel="icon" href="favicon.ico" type="image/x-icon">
    <link rel="shortcut icon" href="favicon.ico">
    <?php 
echo Assets::getCss();
?>
    <?php 
echo Assets::getJS();
?>
    <script>
        var userDateFormatted = {<?foreach(HelperFormatted::getDateFormatted('js') as $k=>$v){?>'<?php 
echo $k;
?>
' : '<?php 
echo $v;
?>
',<?}?>};
        var prefix = '/lj3/';
    </script>
</head>
<body>
    <div id="wrap">
        <div class="navbar">
            <div class="navbar-inner">
                <div class="container">
                    <button data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar" type="button">
コード例 #14
0
 public function getupdated_formatted_date()
 {
     return $this->updated ? HelperFormatted::date($this->updated, HelperFormatted::TIME_FORMAT_DATE) : null;
 }