Exemple #1
0
 /**
  * renders fees report by selected month
  * 
  * @return void
  */
 public function reportFees()
 {
     $allFeesDates_q = "SELECT * from `ukv_fees` ORDER BY `id` DESC;";
     $allFeesDates = simple_queryall($allFeesDates_q);
     $result = '';
     $csvData = '';
     //existing report download
     if (wf_CheckGet(array('downloadfeereport'))) {
         $filenameToDownload = base64_decode($_GET['downloadfeereport']);
         zb_DownloadFile('exports/' . $filenameToDownload, 'docx');
     }
     //render fees list
     $cells = wf_TableCell(__('Month'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($allFeesDates)) {
         foreach ($allFeesDates as $ia => $eachFee) {
             $feeLink = wf_Link(self::URL_REPORTS_MGMT . 'reportFees&showfees=' . $eachFee['yearmonth'], $eachFee['yearmonth'], false);
             $cells = wf_TableCell($feeLink);
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     $result .= wf_TableBody($rows, '30%', '0', 'sortable');
     show_window(__('By date'), $result);
     //render fees by selected month
     if (wf_CheckGet(array('showfees'))) {
         $feesSumm = 0;
         $feesCount = 0;
         $searchFees = mysql_real_escape_string($_GET['showfees']);
         $payments_q = "SELECT * from `ukv_payments` WHERE `date` LIKE '" . $searchFees . "%' AND `note` LIKE 'UKVFEE:%' ORDER BY `id` DESC";
         $allPayments = simple_queryall($payments_q);
         if (!empty($allPayments)) {
             $cells = wf_TableCell(__('ID'));
             $cells .= wf_TableCell(__('Date'));
             $cells .= wf_TableCell(__('Cash'));
             $cells .= wf_TableCell(__('Full address'));
             $cells .= wf_TableCell(__('Real Name'));
             $rowsf = wf_TableRow($cells, 'row1');
             foreach ($allPayments as $io => $eachPayment) {
                 if ($eachPayment['summ'] < 0) {
                     $cells = wf_TableCell($eachPayment['id']);
                     $cells .= wf_TableCell($eachPayment['date']);
                     $cells .= wf_TableCell($eachPayment['summ']);
                     $userLink = wf_Link(self::URL_USERS_PROFILE . $eachPayment['userid'], web_profile_icon() . ' ', false);
                     $userAddress = $this->userGetFullAddress($eachPayment['userid']);
                     $cells .= wf_TableCell($userLink . $userAddress);
                     $userRealName = $this->users[$eachPayment['userid']]['realname'];
                     $cells .= wf_TableCell($userRealName);
                     $rowsf .= wf_TableRow($cells, 'row3');
                     $feesCount++;
                     $feesSumm = $feesSumm + $eachPayment['summ'];
                     $csvData .= $eachPayment['id'] . ';' . $eachPayment['date'] . ';' . $eachPayment['summ'] . ';' . $userAddress . ';' . $userRealName . "\r" . "\n";
                 }
             }
             //saving downloadable report
             $csvSaveName = $searchFees . '_ukvfeesreport.csv';
             $csvData = iconv('utf-8', 'windows-1251', $csvData);
             file_put_contents('exports/' . $csvSaveName, $csvData);
             $downloadLink = wf_Link(self::URL_REPORTS_MGMT . 'reportFees&downloadfeereport=' . base64_encode($csvSaveName), wf_img('skins/excel.gif', __('Download')), false);
             $result = wf_tag('strong') . __('Count') . ': ' . $feesCount;
             $result .= wf_tag('br');
             $result .= __('Money') . ': ' . $feesSumm;
             $result .= wf_tag('strong', true);
             $result .= wf_TableBody($rowsf, '100%', '0', 'sortable');
             show_window(__('Money fees') . ' ' . $searchFees . ' ' . $downloadLink, $result);
         }
     }
 }
Exemple #2
0
     show_window(__('Payments found') . ' ' . $csvDownloadLink, $result);
 }
 /*
  * Interfaces
  */
 if (!wf_CheckGet(array('confpaysys'))) {
     show_window(__('Payment search'), web_PayFindForm());
 } else {
     show_window(__('Payment systems'), web_PaySysForm());
 }
 /*
  * Controller section
  */
 //downloading report as csv
 if (wf_CheckGet(array('downloadcsv'))) {
     zb_DownloadFile(base64_decode($_GET['downloadcsv']), 'csv');
 }
 //Payment systems configuration
 //adding payment system
 if (wf_CheckPost(array('newmarker', 'newname'))) {
     zb_PaySysPercentAdd($_POST['newmarker'], $_POST['newname'], $_POST['newpercent']);
     rcms_redirect("?module=payfind&confpaysys=true");
 }
 //removing payment system
 if (wf_CheckGet(array('delete'))) {
     zb_PaySysPercentDelete($_GET['delete']);
     rcms_redirect("?module=payfind&confpaysys=true");
 }
 //Search
 $markers = '';
 //date search
Exemple #3
0
<?php

if (cfr('PLDOCS')) {
    $altcfg = $ubillingConfig->getAlter();
    if ($altcfg['DOCX_SUPPORT']) {
        $documents = new ProfileDocuments();
        $date = wf_CheckPost(array('showdate')) ? $_POST['showdate'] : '';
        $documents->loadAllUsersDocuments($date);
        //existing document downloading
        if (wf_CheckGet(array('documentdownload'))) {
            zb_DownloadFile($documents::DOCUMENTS_PATH . $_GET['documentdownload'], 'docx');
        }
        //document deletion from database
        if (wf_CheckGet(array('deletedocument'))) {
            $documents->unregisterDocument($_GET['deletedocument']);
            rcms_redirect('?module=report_documents');
        }
        //controls
        $actionLinks = wf_Link('?module=report_documents', __('Grid view') . ' ' . wf_img('skins/icon_table.png'), false, 'ubButton');
        $actionLinks .= wf_Link('?module=report_documents&calendarview=true', __('As calendar') . ' ' . wf_img('skins/icon_calendar.gif'), false, 'ubButton');
        show_window('', $actionLinks);
        if (!wf_CheckGet(array('calendarview'))) {
            //show calendar control
            show_window(__('By date'), $documents->dateControl());
            //list available documents
            show_window(__('Previously generated documents'), $documents->renderAllUserDocuments());
        } else {
            //or calendar view
            show_window(__('Previously generated documents'), $documents->renderAllUserDocumentsCalendar());
        }
    } else {
Exemple #4
0
         if (!empty($alterConf['MYSQLDUMP_PATH'])) {
             //run system mysqldump command
             zb_backup_database();
         } else {
             //using old native mysql storing function
             zb_backup_tables();
         }
     } else {
         show_error(__('You are not mentally prepared for this'));
     }
 }
 //downloading mysql dump
 if (wf_CheckGet(array('download'))) {
     if (cfr('ROOT')) {
         $filePath = base64_decode($_GET['download']);
         zb_DownloadFile($filePath);
     } else {
         show_error(__('Access denied'));
     }
 }
 //deleting dump
 if (wf_CheckGet(array('deletedump'))) {
     if (cfr('ROOT')) {
         $deletePath = base64_decode($_GET['deletedump']);
         if (file_exists($deletePath)) {
             rcms_delete_files($deletePath);
             log_register('BACKUP DELETE `' . $deletePath . '`');
             rcms_redirect('?module=backups');
         } else {
             show_error(__('Not existing item'));
         }
Exemple #5
0
<?php

if (cfr('PAYEXPORT')) {
    $alter_conf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    if ($alter_conf['EXPORT_ENABLED']) {
        $export_filepath = 'exports/';
        $export_fileext = '.export';
        if (wf_CheckGet(array('dlexf'))) {
            zb_DownloadFile($export_filepath . vf($_GET['dlexf'], 3) . $export_fileext, 'default');
        }
        show_window(__('Export payments data'), zb_ExportForm());
        if (isset($_POST['fromdate']) and isset($_POST['todate'])) {
            $from_date = $_POST['fromdate'];
            $to_date = $_POST['todate'];
            //export types
            //xml
            if ($alter_conf['EXPORT_FORMAT'] == 'xml') {
                $export_result = zb_ExportPayments($from_date, $to_date);
            }
            //dbf
            if ($alter_conf['EXPORT_FORMAT'] == 'dbf') {
                //need to be written
            }
            $export_filename = time();
            $exported_link = wf_Link('?module=payexport&dlexf=' . $export_filename, wf_img('skins/icon_download.png') . ' ' . __('Exported data download'), false, 'ubButton');
            file_write_contents($export_filepath . $export_filename . $export_fileext, $export_result);
            show_window('', $exported_link);
        }
    } else {
        show_error(__('Payments export not enabled'));
    }
 /**
  * Downloads image file by its id
  * 
  * @param int $id database image ID
  */
 public function catchDownloadImage($id)
 {
     $id = vf($id, 3);
     if (empty($this->allimages)) {
         $this->loadAllImages();
     }
     if (!empty($id)) {
         @($filename = $this->allimages[$id]['filename']);
         if (file_exists(self::STORAGE_PATH . $filename)) {
             zb_DownloadFile(self::STORAGE_PATH . $filename, 'jpg');
         } else {
             show_error(__('File not exist'));
         }
     } else {
         show_error(__('Image not exists'));
     }
 }
Exemple #7
0
 function zb_FDBTableLogDownload()
 {
     $logPath = 'exports/swpolldata.log';
     if (file_exists($logPath)) {
         zb_DownloadFile($logPath);
     } else {
         show_error(__('Something went wrong') . ': EX_FILE_NOT_FOUND ' . $logPath);
     }
 }
Exemple #8
0
                     rcms_redirect("?module=openpayz");
                 } else {
                     show_error(__('Already processed'));
                 }
             } else {
                 show_error(__('Customer unknown'));
             }
         }
     }
     if (wf_CheckGet(array('ajax'))) {
         die($opayz->transactionAjaxSource());
     }
     if (!wf_CheckGet(array('graphs'))) {
         //download exported search
         if (wf_CheckGet(array('dload'))) {
             zb_DownloadFile(base64_decode($_GET['dload']), 'docx');
         }
         show_window(__('Search'), $opayz->renderSearchForm());
         if (wf_CheckPost(array('searchyear', 'searchmonth', 'searchpaysys'))) {
             show_window('', wf_Link('?module=openpayz', __('Back'), true, 'ubButton'));
             $opayz->doSearch($_POST['searchyear'], $_POST['searchmonth'], $_POST['searchpaysys']);
         } else {
             //show transactions list
             $opayz->renderTransactionList();
         }
     } else {
         show_window(__('Graphs'), $opayz->renderGraphs());
     }
 } else {
     show_error(__('OpenPayz support not enabled'));
 }
 /**
  * extracts data from agentPring cache for future export in CSV
  * 
  * @param int $agentid Existing agent ID in database
  * 
  * @return void
  */
 public function exportCSV($agentid)
 {
     $tmpArr = array();
     $result = '';
     if (!empty($this->altcfg)) {
         $altercfg = $this->altcfg;
     } else {
         global $ubillingConfig;
         $this->altcfg = $ubillingConfig->getAlter();
         $altercfg = $this->altcfg;
     }
     if (file_exists(self::EXPORT_PATH . 'report_agentfinance.prindataraw')) {
         $rawData = file_get_contents(self::EXPORT_PATH . 'report_agentfinance.prindataraw');
         $tmpArr = unserialize($rawData);
         $allservicenames = zb_VservicesGetAllNamesLabeled();
         $this->loadUserRealnames();
         $this->loadCashTypes();
         if (!empty($tmpArr)) {
             if (isset($tmpArr[$agentid])) {
                 if (!empty($tmpArr[$agentid])) {
                     //CSV header
                     $result .= __('ID') . ';' . __('Date') . ';' . __('Cash') . ';' . __('Login') . ';' . __('Full address') . ';' . __('Real Name') . ';' . __('Contrahent name') . ';' . __('Payment type') . ';' . __('Notes') . ';' . __('Admin') . "\n";
                     //CSV data
                     foreach ($tmpArr[$agentid] as $io => $each) {
                         $summ = str_replace('.', ',', $each['summ']);
                         //need for normal summ in excel
                         $result .= $each['id'] . ';' . $each['date'] . ';' . $summ . ';' . $each['login'] . ';' . @$this->alladdress[$each['login']] . ';' . @$this->userRealnames[$each['login']] . ';' . @$this->agentsNamed[$this->assigns[$each['login']]] . ';' . __(@$this->cashtypes[$each['cashtypeid']]) . ';' . zb_TranslatePaymentNote($each['note'], $allservicenames) . ';' . $each['admin'] . "\n";
                     }
                 }
             }
         }
     }
     $saveCsvName = self::EXPORT_PATH . 'report_agentfinance_' . $agentid . '_' . zb_rand_string(8) . '.csv';
     $result = iconv('utf-8', 'windows-1251', $result);
     file_put_contents($saveCsvName, $result);
     zb_DownloadFile($saveCsvName, 'csv');
     die;
 }
Exemple #10
0
 /**
  * Downloads DHCP config template
  * 
  * @param string $filename
  * 
  * @return void
  */
 public function downloadTemplate($filename)
 {
     $filename = vf($filename);
     if (file_exists(self::TEMPLATES_PATH . $filename)) {
         zb_DownloadFile(self::TEMPLATES_PATH . $filename, 'text');
     } else {
         show_error(__('File not found') . ': ' . $filename);
     }
 }