/** * Renders ticket, all of replies and all needed controls/forms for they * * @param int $ticketid * * @return string */ function web_TicketDialogue($ticketid) { $ticketid = vf($ticketid, 3); $ticketdata = zb_TicketGetData($ticketid); $ticketreplies = zb_TicketGetReplies($ticketid); $result = wf_tag('p', false, '', 'align="right"') . wf_Link('?module=ticketing', 'Back to tickets list', true, 'ubButton') . wf_tag('p', true); if (!empty($ticketdata)) { $alladdress = zb_AddressGetFulladdresslist(); $allrealnames = zb_UserGetAllRealnames(); $alltariffs = zb_TariffsGetAllUsers(); $allcash = zb_CashGetAllUsers(); $allcredits = zb_CreditGetAllUsers(); $alluserips = zb_UserGetAllIPs(); if ($ticketdata['status']) { $actionlink = wf_Link('?module=ticketing&openticket=' . $ticketdata['id'], 'Open', false, 'ubButton'); } else { $actionlink = wf_Link('?module=ticketing&closeticket=' . $ticketdata['id'], 'Close', false, 'ubButton'); } $tablecells = wf_TableCell(__('ID')); $tablecells .= wf_TableCell(__('Date')); $tablecells .= wf_TableCell(__('Login')); $tablecells .= wf_TableCell(__('Real Name')); $tablecells .= wf_TableCell(__('Full address')); $tablecells .= wf_TableCell(__('IP')); $tablecells .= wf_TableCell(__('Tariff')); $tablecells .= wf_TableCell(__('Balance')); $tablecells .= wf_TableCell(__('Credit')); $tablecells .= wf_TableCell(__('Processed')); $tablerows = wf_TableRow($tablecells, 'row1'); $tablecells = wf_TableCell($ticketdata['id']); $tablecells .= wf_TableCell($ticketdata['date']); $profilelink = wf_Link('?module=userprofile&username='******'from'], web_profile_icon() . ' ' . $ticketdata['from']); $tablecells .= wf_TableCell($profilelink); $tablecells .= wf_TableCell(@$allrealnames[$ticketdata['from']]); $tablecells .= wf_TableCell(@$alladdress[$ticketdata['from']]); $tablecells .= wf_TableCell(@$alluserips[$ticketdata['from']]); $tablecells .= wf_TableCell(@$alltariffs[$ticketdata['from']]); $tablecells .= wf_TableCell(@$allcash[$ticketdata['from']]); $tablecells .= wf_TableCell(@$allcredits[$ticketdata['from']]); $tablecells .= wf_TableCell(web_bool_led($ticketdata['status'])); $tablerows .= wf_TableRow($tablecells, 'row3'); $result .= wf_TableBody($tablerows, '100%', '0'); //ticket body $tickettext = strip_tags($ticketdata['text']); $tickettext = nl2br($tickettext); $tablecells = wf_TableCell('', '20%'); $tablecells .= wf_TableCell($ticketdata['date']); $tablerows = wf_TableRow($tablecells, 'row2'); $ticketauthor = wf_tag('center') . wf_tag('b') . @$allrealnames[$ticketdata['from']] . wf_tag('b', true) . wf_tag('center', true); $ticketavatar = wf_tag('center') . wf_img('skins/userava.png') . wf_tag('center', true); $ticketpanel = $ticketauthor . wf_tag('br') . $ticketavatar; $tablecells = wf_TableCell($ticketpanel); $tablecells .= wf_TableCell($tickettext); $tablerows .= wf_TableRow($tablecells, 'row3'); $result .= wf_TableBody($tablerows, '100%', '0', 'glamour'); $result .= $actionlink; } if (!empty($ticketreplies)) { $result .= wf_tag('h2') . __('Replies') . wf_tag('h2', true); $result .= wf_CleanDiv(); foreach ($ticketreplies as $io => $eachreply) { //reply if ($eachreply['admin']) { $replyauthor = wf_tag('center') . wf_tag('b') . $eachreply['admin'] . wf_tag('b', true) . wf_tag('center', true); $replyavatar = wf_tag('center') . gravatar_ShowAdminAvatar($eachreply['admin'], '64') . wf_tag('center', true); } else { $replyauthor = wf_tag('center') . wf_tag('b') . @$allrealnames[$eachreply['from']] . wf_tag('b', true) . wf_tag('center', true); $replyavatar = wf_tag('center') . wf_img('skins/userava.png') . wf_tag('center', true); } $replyactions = wf_tag('center'); $replyactions .= wf_JSAlert('?module=ticketing&showticket=' . $ticketdata['id'] . '&deletereply=' . $eachreply['id'], web_delete_icon(), 'Removing this may lead to irreparable results') . ' '; $replyactions .= wf_JSAlert('?module=ticketing&showticket=' . $ticketdata['id'] . '&editreply=' . $eachreply['id'], web_edit_icon(), 'Are you serious'); $replyactions .= wf_tag('center', true); // reply body if (isset($_GET['editreply'])) { if ($_GET['editreply'] == $eachreply['id']) { //is this reply editing? $replytext = web_TicketReplyEditForm($eachreply['id']); } else { //not this ticket edit $replytext = strip_tags($eachreply['text']); } } else { //normal text by default $replytext = strip_tags($eachreply['text']); $replytext = nl2br($replytext); } $replypanel = $replyauthor . wf_tag('br') . $replyavatar . wf_tag('br') . $replyactions; $tablecells = wf_TableCell('', '20%'); $tablecells .= wf_TableCell($eachreply['date']); $tablerows = wf_TableRow($tablecells, 'row2'); $tablecells = wf_TableCell($replypanel); $tablecells .= wf_TableCell($replytext); $tablerows .= wf_TableRow($tablecells, 'row3'); $result .= wf_TableBody($tablerows, '100%', '0', 'glamour'); $result .= wf_CleanDiv(); } } //reply form and previous tickets $allprevious = zb_TicketsGetAllByUser($ticketdata['from']); $previoustickets = ''; if (!empty($allprevious)) { $previoustickets = wf_tag('h2') . __('All tickets by this user') . wf_tag('h2', true); foreach ($allprevious as $io => $eachprevious) { $tablecells = wf_TableCell($eachprevious['date']); $tablecells .= wf_TableCell(web_bool_led($eachprevious['status'])); $prevaction = wf_Link('?module=ticketing&showticket=' . $eachprevious['id'], 'Show', false, 'ubButton'); $tablecells .= wf_TableCell($prevaction); $tablerows = wf_TableRow($tablecells, 'row3'); $previoustickets .= wf_TableBody($tablerows, '100%', '0'); } } $tablecells = wf_TableCell(web_TicketReplyForm($ticketid), '50%', '', 'valign="top"'); $tablecells .= wf_TableCell($previoustickets, '50%', '', 'valign="top"'); $tablerows = wf_TableRow($tablecells); $result .= wf_TableBody($tablerows, '100%', '0', 'glamour'); $result .= wf_CleanDiv(); return $result; }
/** * returns module control panel * * @return string */ protected function panel() { $result = wf_Link('?module=report_finance', __('Back'), false, 'ubButton'); $result .= wf_modal(web_icon_settings() . ' ' . __('Settings'), __('Settings'), $this->configForm(), 'ubButton', '700', '200'); $result .= wf_delimiter(); $monthArr = months_array_localized(); $inputs = wf_YearSelectorPreset('yearsel', __('Year'), false, $this->year); $inputs .= wf_Selector('monthsel', $monthArr, __('Month'), $this->month, false); $inputs .= wf_Submit(__('Show')); $result .= wf_Form('', 'POST', $inputs, 'glamour'); $result .= wf_CleanDiv(); return $result; }
/** * Renders search form. Deal with it. * * @return string */ public function renderSearchForm() { $result = ''; $datefromDefault = wf_CheckPost(array('datefrom')) ? $_POST['datefrom'] : curdate(); $datetoDefault = wf_CheckPost(array('dateto')) ? $_POST['dateto'] : curdate(); $inputs = __('Date') . ' ' . wf_DatePickerPreset('datefrom', $datefromDefault, true) . ' ' . __('From') . ' ' . wf_DatePickerPreset('dateto', $datetoDefault, true) . ' ' . __('To'); $inputs .= wf_tag('br'); $inputs .= wf_CheckInput('cb_id', '', false, false); $inputs .= wf_TextInput('taskid', __('ID'), '', true, 4); $inputs .= wf_CheckInput('cb_taskdays', '', false, false); $inputs .= wf_TextInput('taskdays', __('Implementation took more days'), '', true, 4); $inputs .= wf_CheckInput('cb_taskaddress', '', false, false); $inputs .= wf_TextInput('taskaddress', __('Task address'), '', true, 20); $inputs .= wf_CheckInput('cb_taskphone', '', false, false); $inputs .= wf_TextInput('taskphone', __('Phone'), '', true, 20); $inputs .= wf_CheckInput('cb_employee', '', false, false); $inputs .= wf_Selector('employee', $this->activeEmployee, __('Who should do'), '', true); $inputs .= wf_CheckInput('cb_employeedone', '', false, false); $inputs .= wf_Selector('employeedone', $this->activeEmployee, __('Worker done'), '', true); $inputs .= wf_CheckInput('cb_duplicateaddress', __('Duplicate address'), true, false); $inputs .= wf_CheckInput('cb_showlate', __('Show late'), true, false); $inputs .= wf_CheckInput('cb_onlydone', __('Done tasks'), true, false); $inputs .= wf_CheckInput('cb_onlyundone', __('Undone tasks'), true, false); if ($this->altCfg['SALARY_ENABLED']) { $inputs .= wf_CheckInput('cb_nosalsaryjobs', __('Tasks without jobs'), true, false); } $inputs .= wf_Submit(__('Search')); $result = wf_Form('', 'POST', $inputs, 'glamour'); $result .= wf_CleanDiv(); return $result; }
/** * Renders cumulative discounts report * * @return string */ public function renderReport() { $result = ''; $currentData = $this->getDiscountData($this->login); $customDiscount = $this->getCustomDiscount($this->login); if (!empty($currentData)) { $cells = wf_TableCell(__('Discount')); $cells .= wf_TableCell(__('Day')); $cells .= wf_TableCell(__('Custom discount')); $rows = wf_TableRow($cells, 'row1'); $cells = wf_TableCell($currentData['discount'] . '%'); $cells .= wf_TableCell($currentData['days']); if ($customDiscount == 0) { $customDiscount = __('No'); } else { $customDiscount = $customDiscount . '%'; } $cells .= wf_TableCell($customDiscount); $rows .= wf_TableRow($cells, 'row3'); $result .= wf_TableBody($rows, '100%', 0, 'glamour'); $result .= wf_CleanDiv(); $result .= wf_delimiter(); } $logData = $this->getLogData(); if (!empty($logData)) { $cells = wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Event')); $cells .= wf_TableCell(__('Details')); $rows = wf_TableRow($cells, 'row1'); foreach ($logData as $io => $each) { $fc = wf_tag('font', false); $efc = wf_tag('font', true); if ($each['event'] == 'CREATE') { $fc = wf_tag('font', false, '', 'color="#ffac1b"'); } if ($each['event'] == 'UPDATE') { $fc = wf_tag('font', false, '', 'color="#6396ff"'); } if ($each['event'] == 'PUSH') { $fc = wf_tag('font', false, '', 'color="#1c7700"'); } if ($each['event'] == 'SET') { $fc = wf_tag('font', false, '', 'color="#a90000"'); } if ($each['event'] == 'SETDOWN') { $fc = wf_tag('font', false, '', 'color="#a90000"'); } $params = $each['params']; $params = str_replace('DAYS', __('Day'), $params); $params = str_replace('PERCENT', __('Percent'), $params); $params = str_replace('CASH', __('Cash'), $params); $params = str_replace('TARIFF', __('Tariff'), $params); $cells = wf_TableCell($fc . $each['date'] . $efc); $cells .= wf_TableCell($fc . $each['event'] . $efc); $cells .= wf_TableCell($params); $rows .= wf_TableRow($cells, 'row3'); } $result .= wf_TableBody($rows, '100%', 0, 'sortable'); } else { $result .= wf_tag('span', false, 'alert_warning') . __('Nothing found') . wf_tag('span', true); } return $result; }
/** * Returns ONU edit form * * @param int $onuId * * @return string */ public function onuEditForm($onuId) { $onuId = vf($onuId, 3); $result = ''; if (isset($this->allOnu[$onuId])) { $messages = new UbillingMessageHelper(); $models = array(); if (!empty($this->allModelsData)) { foreach ($this->allModelsData as $io => $each) { $models[$each['id']] = $each['modelname']; } } $inputs = wf_HiddenInput('editonu', $onuId); $inputs .= wf_Selector('editoltid', $this->allOltDevices, __('OLT device') . $this->sup, $this->allOnu[$onuId]['oltid'], true); $inputs .= wf_Selector('editonumodelid', $models, __('ONU model') . $this->sup, $this->allOnu[$onuId]['onumodelid'], true); $inputs .= wf_TextInput('editip', __('IP'), $this->allOnu[$onuId]['ip'], true, 20); $inputs .= wf_TextInput('editmac', __('MAC') . $this->sup . ' ' . $this->getSearchmacControl($this->allOnu[$onuId]['mac']), $this->allOnu[$onuId]['mac'], true, 20); $inputs .= wf_TextInput('editserial', __('Serial number'), $this->allOnu[$onuId]['serial'], true, 20); $inputs .= wf_TextInput('editlogin', __('Login'), $this->allOnu[$onuId]['login'], true, 20); $inputs .= wf_Submit(__('Save')); $result = wf_Form('', 'POST', $inputs, 'glamour'); $result .= wf_CleanDiv(); $result .= wf_delimiter(); $result .= wf_Link('?module=ponizer', __('Back'), false, 'ubButton'); if (!empty($this->allOnu[$onuId]['login'])) { $result .= wf_Link('?module=userprofile&username='******'login'], wf_img('skins/icon_user.gif') . ' ' . __('User profile'), false, 'ubButton'); } $result .= wf_JSAlertStyled('?module=ponizer&deleteonu=' . $onuId, web_delete_icon() . ' ' . __('Delete'), $messages->getDeleteAlert(), 'ubButton'); } else { $result = wf_tag('div', false, 'alert_error') . __('Strange exeption') . ': ONUID_NOT_EXISTS' . wf_tag('div', true); } //Signal history chart $result .= $this->onuSignalHistory($onuId); //additional comments handling if ($this->altCfg['ADCOMMENTS_ENABLED']) { $adcomments = new ADcomments('PONONU'); $result .= wf_delimiter(); $result .= wf_tag('h3') . __('Additional comments') . wf_tag('h3', true); $result .= $adcomments->renderComments($onuId); } return $result; }
/** * Returns time rule editing form * * @param int $timeruleid existing time rule database ID * @return string */ public function renderEditForm($timeruleid) { $timeruleid = vf($timeruleid, 3); $query = "SELECT * from `dshape_time` WHERE `id`='" . $timeruleid . "'"; $timerule_data = simple_query($query); $sup = wf_tag('sup') . '*' . wf_tag('sup', true); $inputs = wf_tag('select', false, '', 'DISABLED'); $inputs .= wf_tag('option') . $timerule_data['tariff'] . $this->getSpeeds($timerule_data['tariff']) . wf_tag('option', true); $inputs .= wf_tag('select', true); $inputs .= wf_tag('br'); $inputs .= wf_HiddenInput('editdshapetariff', $timerule_data['tariff']); $inputs .= wf_TimePickerPresetSeconds('editthreshold1', $timerule_data['threshold1'], __('Time from') . $sup, true); $inputs .= wf_TimePickerPresetSeconds('editthreshold2', $timerule_data['threshold2'], __('Time to') . $sup, true); $inputs .= wf_TextInput('editspeed', __('Speed') . $sup, $timerule_data['speed'], true, 8); $inputs .= wf_Submit(__('Save')); $form = wf_Form('', 'POST', $inputs, 'glamour'); $form .= wf_CleanDiv(); $form .= wf_tag('br'); $form .= wf_Link('?module=dshaper', __('Back'), true, 'ubButton'); return $form; }
$tablecells .= wf_TableCell(web_bar($eachcount, sizeof($allsignups)), '', '', 'sorttable_customkey="' . $eachcount . '"'); $tablerows .= wf_TableRow($tablecells, 'row3'); } } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); show_window(__('Tariffs report'), $result); } if (!isset($_POST['yearsel'])) { $year = curyear(); } else { $year = $_POST['yearsel']; } $yearinputs = wf_YearSelector('yearsel'); $yearinputs .= wf_Submit(__('Show')); $yearform = wf_Form('?module=report_signup', 'POST', $yearinputs, 'glamour'); $yearform .= wf_CleanDiv(); web_SignupsShowToday(); show_window(__('Year'), $yearform); web_SignupsGraphYear($year); web_SignupGraph(); if ($altercfg['CEMETERY_ENABLED']) { $cemetery = new Cemetery(); show_window('', $cemetery->renderChart()); } if (!wf_CheckGet(array('month'))) { web_SignupsShowCurrentMonth(); } else { web_SignupsShowAnotherYearMonth($_GET['month']); } zb_BillingStats(true); } else {
/** * Returns list of available images for current scope/item * * @return string */ public function renderImagesRaw() { $result = ''; if (empty($this->allimages)) { $this->loadAllImages(); } if (!empty($this->allimages)) { foreach ($this->allimages as $io => $eachimage) { if ($eachimage['scope'] == $this->scope and $eachimage['item'] == $this->itemId) { $imgPreview = wf_img_sized(self::STORAGE_PATH . $eachimage['filename'], __('Show'), $this->photoCfg['IMGLIST_PREV_W'], $this->photoCfg['IMGLIST_PREV_H']); $imgFull = wf_img(self::STORAGE_PATH . $eachimage['filename']); $dimensions = 'width:' . ($this->photoCfg['IMGLIST_PREV_W'] + 10) . 'px;'; $dimensions .= 'height:' . ($this->photoCfg['IMGLIST_PREV_H'] + 10) . 'px;'; $result .= wf_modalAuto($imgPreview, __('Image') . ' ' . $eachimage['id'], $imgFull, ''); } } } $result .= wf_CleanDiv(); return $result; }
/** * Collects billing stats * * @param bool $quiet */ function zb_BillingStats($quiet = false) { $ubstatsurl = 'http://stats.ubilling.net.ua/'; $statsflag = 'exports/NOTRACK'; //detect host id $hostid_q = "SELECT * from `ubstats` WHERE `key`='ubid'"; $hostid = simple_query($hostid_q); if (empty($hostid)) { //register new ubilling $randomid = 'UB' . md5(curdatetime() . zb_rand_string(8)); $newhostid_q = "INSERT INTO `ubstats` (`id` ,`key` ,`value`) VALUES (NULL , 'ubid', '" . $randomid . "');"; nr_query($newhostid_q); $thisubid = $randomid; } else { $thisubid = $hostid['value']; } //detect stats collection feature $thiscollect = file_exists($statsflag) ? 0 : 1; //disabling collect subroutine if (isset($_POST['editcollect'])) { if (!isset($_POST['collectflag'])) { file_put_contents($statsflag, 'Im greedy bastard'); } else { if (file_exists($statsflag)) { unlink($statsflag); } } rcms_redirect("?module=report_sysload"); } //detect total user count $usercount_q = "SELECT COUNT(`login`) from `users`"; $usercount = simple_query($usercount_q); $usercount = $usercount['COUNT(`login`)']; //detect tariffs count $tariffcount_q = "SELECT COUNT(`name`) from `tariffs`"; $tariffcount = simple_query($tariffcount_q); $tariffcount = $tariffcount['COUNT(`name`)']; //detect nas count $nascount_q = "SELECT COUNT(`id`) from `nas`"; $nascount = simple_query($nascount_q); $nascount = $nascount['COUNT(`id`)']; //detect payments count $paycount_q = "SELECT COUNT(`id`) from `payments`"; $paycount = simple_query($paycount_q); $paycount = $paycount['COUNT(`id`)']; $paycount = $paycount / 100; $paycount = round($paycount); //detect ubilling actions count $eventcount_q = "SELECT COUNT(`id`) from `weblogs`"; $eventcount = simple_query($eventcount_q); $eventcount = $eventcount['COUNT(`id`)']; $eventcount = $eventcount / 100; $eventcount = round($eventcount); //detect ubilling version $releaseinfo = file_get_contents("RELEASE"); $ubversion = explode(' ', $releaseinfo); $ubversion = vf($ubversion[0], 3); $releasebox = wf_tag('span', false, '', 'id="lastrelease"'); $releasebox .= wf_tag('span', true) . wf_tag('br'); $updatechecker = wf_AjaxLink('?module=report_sysload&checkupdates=true', $releaseinfo . ' (' . __('Check updates') . '?)', 'lastrelease', false, ''); $ubstatsinputs = zb_AjaxLoader(); $ubstatsinputs .= wf_tag('b') . __('Serial key') . ': ' . wf_tag('b', true) . $thisubid . wf_tag('br'); $ubstatsinputs .= wf_tag('b') . __('Use this to request technical support') . ': ' . wf_tag('b', true) . wf_tag('font', false, '', 'color="#076800"') . substr($thisubid, -4) . wf_tag('font', true) . wf_tag('br'); $ubstatsinputs .= wf_tag('b') . __('Ubilling version') . ': ' . wf_tag('b', true) . $updatechecker . wf_tag('br'); $ubstatsinputs .= $releasebox; $ubstatsinputs .= wf_HiddenInput('editcollect', 'true'); $ubstatsinputs .= wf_CheckInput('collectflag', 'I want to help make Ubilling better', false, $thiscollect); $ubstatsinputs .= ' ' . wf_Submit('Save'); $ubstatsform = wf_Form("", 'POST', $ubstatsinputs, 'glamour'); $ubstatsform .= wf_CleanDiv(); $statsurl = $ubstatsurl . '?u=' . $thisubid . 'x' . $usercount . 'x' . $tariffcount . 'x' . $nascount . 'x' . $paycount . 'x' . $eventcount . 'x' . $ubversion; $tracking_code = wf_tag('div', false, '', 'style="display:none;"') . wf_tag('iframe', false, '', 'src="' . $statsurl . '" width="1" height="1" frameborder="0"') . wf_tag('iframe', true) . wf_tag('div', true); if ($quiet == false) { show_window(__('Billing info'), $ubstatsform); } if ($thiscollect) { show_window('', $tracking_code); } }
/** * Shows permissions editor for some user * * @global object $system * @param string $login */ function web_permissions_editor($login) { global $system; $regperms = zb_PermissionGroup('USERREG'); $geoperms = zb_PermissionGroup('GEO'); $sysperms = zb_PermissionGroup('SYSTEM'); $finperms = zb_PermissionGroup('FINANCE'); $repperms = zb_PermissionGroup('REPORTS'); $catvperms = zb_PermissionGroup('CATV'); $reginputs = ''; $geoinputs = ''; $sysinputs = ''; $fininputs = ''; $repinputs = ''; $catvinputs = ''; $miscinputs = ''; $inputs = wf_Link('?module=permissions', 'Back', true, 'ubButton') . '<br>'; $inputs .= wf_HiddenInput('save', '1'); if ($system->getRightsForUser($login, $rights, $root, $level)) { if ($root) { $inputs .= wf_tag('p', false, 'glamour') . wf_CheckInput('rootuser', __('Root administrator'), true, true) . wf_tag('p', true) . wf_CleanDiv(); } else { $inputs .= wf_tag('p', false, 'glamour') . wf_CheckInput('rootuser', __('Root administrator'), true, false) . wf_tag('p', true) . wf_CleanDiv(); foreach ($system->rights_database as $right_id => $right_desc) { //sorting inputs if (!isset($regperms[$right_id]) and !isset($geoperms[$right_id]) and !isset($sysperms[$right_id]) and !isset($finperms[$right_id]) and !isset($repperms[$right_id]) and !isset($catvperms[$right_id])) { $miscinputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id)); } //user register rights if (isset($regperms[$right_id])) { $reginputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id)); } //geo rights if (isset($geoperms[$right_id])) { $geoinputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id)); } //system config perms if (isset($sysperms[$right_id])) { $sysinputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id)); } //financial inputs if (isset($finperms[$right_id])) { $fininputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id)); } //reports rights if (isset($repperms[$right_id])) { $repinputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id)); } //catv rights if (isset($catvperms[$right_id])) { $catvinputs .= wf_CheckInput('_rights[' . $right_id . ']', $right_desc . ' - ' . $right_id, true, user_check_right($login, $right_id)); } } } } //rights grid $label = wf_tag('h3') . __('Users registration') . wf_tag('h3', true); $tablecells = wf_TableCell($label . $reginputs, '', '', 'valign="top"'); $label = wf_tag('h3') . __('System settings') . wf_tag('h3', true); $tablecells .= wf_TableCell($label . $sysinputs, '', '', 'valign="top"'); $tablerows = wf_TableRow($tablecells); $label = wf_tag('h3') . __('Reports') . wf_tag('h3', true); $tablecells = wf_TableCell($label . $repinputs, '', '', 'valign="top"'); $label = wf_tag('h3') . __('Financial management') . wf_tag('h3', true); $tablecells .= wf_TableCell($label . $fininputs, '', '', 'valign="top"'); $tablerows .= wf_TableRow($tablecells); $label = wf_tag('h3') . __('CaTV') . wf_tag('h3', true); $tablecells = wf_TableCell($label . $catvinputs, '', '', 'valign="top"'); $label = wf_tag('h3') . __('Geography') . wf_tag('h3', true); $tablecells .= wf_TableCell($label . $geoinputs, '', '', 'valign="top"'); $tablerows .= wf_TableRow($tablecells); $label = wf_tag('h3') . __('Misc rights') . wf_tag('h3', true); $tablecells = wf_TableCell($label . $miscinputs, '', '', 'valign="top"'); $tablerows .= wf_TableRow($tablecells); $rightsgrid = $inputs; $rightsgrid .= wf_Submit('Save') . wf_delimiter(); $rightsgrid .= wf_TableBody($tablerows, '100%', 0, 'glamour'); $permission_forms = wf_Form("", 'POST', $rightsgrid, ''); $permission_forms .= wf_CleanDiv(); $permission_forms .= wf_tag('br'); //copy permissions form $copyinputs = wf_tag('h2') . __('Rights cloning') . wf_tag('h2', true); $copyinputs .= web_AdminLoginSelector($login); $copyinputs .= wf_HiddenInput('clonerightsnow', 'true'); $copyinputs .= wf_Submit(__('Clone')); $copyform = wf_Form("", 'POST', $copyinputs, 'glamour'); $permission_forms .= $copyform; show_window(__('Rights for') . ' ' . $login, $permission_forms); }
/** * Renders Crime and Punishment report * * @return string */ public function renderReport() { $result = ''; $currentData = $this->getCapData($this->login); if (!empty($currentData)) { $result .= wf_tag('div', false, 'glamour') . __('Inactive days') . ': ' . $currentData['days'] . wf_tag('div', true); $result .= wf_CleanDiv(); } $logData = $this->getLogData(); if (!empty($logData)) { $cells = wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Event')); $cells .= wf_TableCell(__('Details')); $rows = wf_TableRow($cells, 'row1'); foreach ($logData as $io => $each) { $fc = wf_tag('font', false); $efc = wf_tag('font', true); if ($each['event'] == 'CREATE') { $fc = wf_tag('font', false, '', 'color="#ffac1b"'); } if ($each['event'] == 'UPDATE') { $fc = wf_tag('font', false, '', 'color="#6396ff"'); } if ($each['event'] == 'RESURRECTED') { $fc = wf_tag('font', false, '', 'color="#1c7700"'); } if ($each['event'] == 'PENALTY') { $fc = wf_tag('font', false, '', 'color="#a90000"'); } $params = $each['params']; $params = str_replace('DAYS', __('Day'), $params); $params = str_replace('PENALTY', __('Penalty'), $params); $cells = wf_TableCell($fc . $each['date'] . $efc); $cells .= wf_TableCell($fc . $each['event'] . $efc); $cells .= wf_TableCell($params); $rows .= wf_TableRow($cells, 'row3'); } $result .= wf_TableBody($rows, '100%', 0, 'sortable'); } else { $result .= wf_tag('span', false, 'alert_warning') . __('Nothing found') . wf_tag('span', true); } return $result; }
/** * Renders current IP styled notification * * @return string */ public function renderCurrentIp() { $result = wf_tag('h2', false, 'floatpanels', '') . ' ' . $this->currentIp . wf_tag('h2', true); $result = $this->messages->getStyledMessage(wf_tag('h2', false, '', '') . __('Current user IP') . ': ' . $this->currentIp . wf_tag('h2', true), 'info'); $result .= wf_CleanDiv(); return $result; }
/** * Renders report for some year * * @return string */ public function renderReport() { $result = ''; $months = months_array_localized(); $yearData = $this->loadStoredData(); $inputs = wf_YearSelectorPreset('yearsel', __('Year'), false, $this->showYear) . ' '; $chartsFlag = wf_CheckPost(array('showcharts')) ? true : false; $inputs .= wf_CheckInput('showcharts', __('Graphs'), false, $chartsFlag) . ' '; $inputs .= wf_Submit(__('Show')); $yearForm = wf_Form('', 'POST', $inputs, 'glamour'); $yearForm .= wf_CleanDiv(); $result .= $yearForm; //charts presets $chartsOptions = "\n 'focusTarget': 'category',\n 'hAxis': {\n 'color': 'none',\n 'baselineColor': 'none',\n },\n 'vAxis': {\n 'color': 'none',\n 'baselineColor': 'none',\n },\n 'curveType': 'function',\n 'pointSize': 5,\n 'crosshair': {\n trigger: 'none'\n },"; $usersChartData = array(0 => array(__('Month'), __('Total'), __('Active'), __('Inactive'), __('Frozen'), __('Signups'))); $complexChartData = array(0 => array(__('Month'), __('Total'), __('Active'), __('Inactive'))); $financeChartsData = array(0 => array(__('Month'), __('Money'), __('Payments count'), __('ARPU'), __('ARPAU'))); $ukvChartData = array(0 => array(__('Month'), __('Total'), __('Active'), __('Inactive'), __('Illegal'), __('Complex'), __('Social'), __('Signups'))); $ukvfChartData = array(0 => array(__('Month'), __('Money'), __('Payments count'), __('ARPU'), __('ARPAU'), __('Debt'))); $askoziaChartData = array(0 => array(__('Month'), __('Total calls'), __('Total answered'), __('No answer'))); $equipChartData = array(0 => array(__('Month'), __('Switches'), __('PON ONU'), __('DOCSIS modems'))); if (!empty($yearData)) { //internet users $cells = wf_TableCell(__('Month')); $cells .= wf_TableCell(__('Total')); $cells .= wf_TableCell(__('Active')); $cells .= wf_TableCell(__('Inactive')); $cells .= wf_TableCell(__('Frozen')); $cells .= wf_TableCell(__('Signups')); $rows = wf_TableRow($cells, 'row1'); foreach ($yearData as $monthNum => $each) { $cells = wf_TableCell($months[$monthNum]); $cells .= wf_TableCell($each['u_totalusers']); $cells .= wf_TableCell($each['u_activeusers'] . ' (' . $this->percentValue($each['u_totalusers'], $each['u_activeusers']) . '%)'); $cells .= wf_TableCell($each['u_inactiveusers'] . ' (' . $this->percentValue($each['u_totalusers'], $each['u_inactiveusers']) . '%)'); $cells .= wf_TableCell($each['u_frozenusers'] . ' (' . $this->percentValue($each['u_totalusers'], $each['u_frozenusers']) . '%)'); if (!empty($each['u_citysignups'])) { $signupData = ''; $sigDataTmp = base64_decode($each['u_citysignups']); $sigDataTmp = unserialize($sigDataTmp); $citySigs = ''; $cityRows = ''; if (!empty($sigDataTmp)) { $cityCells = wf_TableCell(__('City')); $cityCells .= wf_TableCell(__('Signups')); $cityRows .= wf_TableRow($cityCells, 'row1'); foreach ($sigDataTmp as $sigCity => $cityCount) { $cityCells = wf_TableCell($sigCity); $cityCells .= wf_TableCell($cityCount); $cityRows .= wf_TableRow($cityCells, 'row3'); } $citySigs .= wf_TableBody($cityRows, '100%', 0, ''); } $signupData .= wf_modalAuto($each['u_signups'], __('Cities'), $citySigs); } else { $signupData = $each['u_signups']; } $cells .= wf_TableCell($signupData); $rows .= wf_TableRow($cells, 'row3'); //chart data $usersChartData[] = array($months[$monthNum], $each['u_totalusers'], $each['u_activeusers'], $each['u_inactiveusers'], $each['u_frozenusers'], $each['u_signups']); } $result .= wf_tag('h2') . __('Internets users') . wf_tag('h2', true); $result .= wf_TableBody($rows, '100%', 0, ''); if ($chartsFlag) { $result .= wf_gchartsLine($usersChartData, __('Internets users'), '100%', '300px', $chartsOptions); } //complex data if ($this->complexFlag) { $result .= wf_tag('h2') . __('Complex services') . wf_tag('h2', true); $cells = wf_TableCell(__('Month')); $cells .= wf_TableCell(__('Total')); $cells .= wf_TableCell(__('Active')); $cells .= wf_TableCell(__('Inactive')); $rows = wf_TableRow($cells, 'row1'); foreach ($yearData as $monthNum => $each) { $cells = wf_TableCell($months[$monthNum]); $cells .= wf_TableCell($each['u_complextotal']); $cells .= wf_TableCell($each['u_complexactive'] . ' (' . $this->percentValue($each['u_complextotal'], $each['u_complexactive']) . '%)'); $cells .= wf_TableCell($each['u_complexinactive'] . ' (' . $this->percentValue($each['u_complextotal'], $each['u_complexinactive']) . '%)'); $rows .= wf_TableRow($cells, 'row3'); //chart data $complexChartData[] = array($months[$monthNum], $each['u_complextotal'], $each['u_complexactive'], $each['u_complexinactive']); } $result .= wf_TableBody($rows, '100%', 0, ''); if ($chartsFlag) { $result .= wf_gchartsLine($complexChartData, __('Complex services'), '100%', '300px', $chartsOptions); } } //finance data $result .= wf_tag('h2') . __('Financial highlights') . wf_tag('h2', true); $cells = wf_TableCell(__('Month')); $cells .= wf_TableCell(__('Money')); $cells .= wf_TableCell(__('Payments count')); $cells .= wf_TableCell(__('Cash payments')); $cells .= wf_TableCell(__('Cash payments count')); $cells .= wf_TableCell(__('ARPU')); $cells .= wf_TableCell(__('ARPAU')); $rows = wf_TableRow($cells, 'row1'); foreach ($yearData as $monthNum => $each) { $cells = wf_TableCell($months[$monthNum]); $cells .= wf_TableCell($each['f_totalmoney']); $cells .= wf_TableCell($each['f_paymentscount']); $cells .= wf_TableCell($each['f_cashmoney'] . ' (' . $this->percentValue($each['f_totalmoney'], $each['f_cashmoney']) . '%)'); $cells .= wf_TableCell($each['f_cashcount'] . ' (' . $this->percentValue($each['f_paymentscount'], $each['f_cashcount']) . '%)'); $cells .= wf_TableCell($each['f_arpu']); $cells .= wf_TableCell($each['f_arpau']); $rows .= wf_TableRow($cells, 'row3'); //chart data $financeChartsData[] = array($months[$monthNum], $each['f_totalmoney'], $each['f_paymentscount'], $each['f_arpu'], $each['f_arpau']); } $result .= wf_TableBody($rows, '100%', 0, ''); if ($chartsFlag) { $result .= wf_gchartsLine($financeChartsData, __('Financial highlights'), '100%', '300px', $chartsOptions); } // UKV cable users if ($this->ukvFlag) { $result .= wf_tag('h2') . __('UKV users') . wf_tag('h2', true); $cells = wf_TableCell(__('Month')); $cells .= wf_TableCell(__('Total')); $cells .= wf_TableCell(__('Active')); $cells .= wf_TableCell(__('Inactive')); $cells .= wf_TableCell(__('Illegal')); if ($this->complexFlag) { $cells .= wf_TableCell(__('Complex')); } $cells .= wf_TableCell(__('Social')); $cells .= wf_TableCell(__('Signups')); $rows = wf_TableRow($cells, 'row1'); foreach ($yearData as $monthNum => $each) { $cells = wf_TableCell($months[$monthNum]); $cells .= wf_TableCell($each['c_totalusers']); $cells .= wf_TableCell($each['c_activeusers'] . ' (' . $this->percentValue($each['c_totalusers'], $each['c_activeusers']) . '%)'); $cells .= wf_TableCell($each['c_inactiveusers'] . ' (' . $this->percentValue($each['c_totalusers'], $each['c_inactiveusers']) . '%)'); $cells .= wf_TableCell($each['c_illegal'] . ' (' . $this->percentValue($each['c_totalusers'], $each['c_illegal']) . '%)'); if ($this->complexFlag) { $cells .= wf_TableCell($each['c_complex'] . ' (' . $this->percentValue($each['c_totalusers'], $each['c_complex']) . '%)'); } $cells .= wf_TableCell($each['c_social'] . ' (' . $this->percentValue($each['c_totalusers'], $each['c_social']) . '%)'); $cells .= wf_TableCell($each['c_signups']); $rows .= wf_TableRow($cells, 'row3'); //chart data $ukvChartData[] = array($months[$monthNum], $each['c_totalusers'], $each['c_activeusers'], $each['c_inactiveusers'], $each['c_illegal'], $each['c_complex'], $each['c_social'], $each['c_signups']); } $result .= wf_TableBody($rows, '100%', 0, ''); if ($chartsFlag) { $result .= wf_gchartsLine($ukvChartData, __('UKV users'), '100%', '300px', $chartsOptions); } //UKV financial data $result .= wf_tag('h2') . __('UKV finance') . wf_tag('h2', true); $cells = wf_TableCell(__('Month')); $cells .= wf_TableCell(__('Money')); $cells .= wf_TableCell(__('Payments count')); $cells .= wf_TableCell(__('ARPU')); $cells .= wf_TableCell(__('ARPAU')); $cells .= wf_TableCell(__('Debt')); $rows = wf_TableRow($cells, 'row1'); foreach ($yearData as $monthNum => $each) { $cells = wf_TableCell($months[$monthNum]); $cells .= wf_TableCell($each['c_totalmoney']); $cells .= wf_TableCell($each['c_paymentscount']); $cells .= wf_TableCell($each['c_arpu']); $cells .= wf_TableCell($each['c_arpau']); $cells .= wf_TableCell($each['c_totaldebt']); $rows .= wf_TableRow($cells, 'row3'); //chart data $ukvfChartData[] = array($months[$monthNum], $each['c_totalmoney'], $each['c_paymentscount'], $each['c_arpu'], $each['c_arpau'], $each['c_totaldebt']); } $result .= wf_TableBody($rows, '100%', 0, ''); if ($chartsFlag) { $result .= wf_gchartsLine($ukvfChartData, __('UKV users'), '100%', '300px', $chartsOptions); } } //Askozia PBX if ($this->askoziaFlag) { $result .= wf_tag('h2') . __('AskoziaPBX integration') . wf_tag('h2', true); $cells = wf_TableCell(__('Month')); $cells .= wf_TableCell(__('Incoming calls')); $cells .= wf_TableCell(__('Total answered')); $cells .= wf_TableCell(__('No answer')); $cells .= wf_TableCell(__('Total duration')); $cells .= wf_TableCell(__('Average duration')); $cells .= wf_TableCell(__('Answers percent')); $rows = wf_TableRow($cells, 'row1'); foreach ($yearData as $monthNum => $each) { $cells = wf_TableCell($months[$monthNum]); $cells .= wf_TableCell($each['a_totalcalls']); $cells .= wf_TableCell($each['a_totalanswered']); $cells .= wf_TableCell($each['a_totalcalls'] - $each['a_totalanswered']); $cells .= wf_TableCell($this->formatTime($each['a_totalcallsduration'])); $cells .= wf_TableCell($this->formatTime($each['a_averagecallduration'])); $cells .= wf_TableCell($this->percentValue($each['a_totalcalls'], $each['a_totalanswered']) . '%'); $rows .= wf_TableRow($cells, 'row3'); //chart data $askoziaChartData[] = array($months[$monthNum], $each['a_totalcalls'], $each['a_totalanswered'], $each['a_totalcalls'] - $each['a_totalanswered']); } $result .= wf_TableBody($rows, '100%', 0, ''); if ($chartsFlag) { $result .= wf_gchartsLine($askoziaChartData, __('Askozia'), '100%', '300px', $chartsOptions); } } //Equipment $result .= wf_tag('h2') . __('Equipment') . wf_tag('h2', true); $cells = wf_TableCell(__('Month')); $cells .= wf_TableCell(__('Switches')); if ($this->ponFlag) { $cells .= wf_TableCell(__('PON ONU')); } if ($this->docsisFlag) { $cells .= wf_TableCell(__('DOCSIS Modems')); } $rows = wf_TableRow($cells, 'row1'); foreach ($yearData as $monthNum => $each) { $cells = wf_TableCell($months[$monthNum]); $cells .= wf_TableCell($each['e_switches']); if ($this->ponFlag) { $cells .= wf_TableCell($each['e_pononu']); } if ($this->docsisFlag) { $cells .= wf_TableCell($each['e_docsis']); } $rows .= wf_TableRow($cells, 'row3'); //chart data $equipChartData[] = array($months[$monthNum], $each['e_switches'], $each['e_pononu'], $each['e_docsis']); } $result .= wf_TableBody($rows, '100%', 0, ''); if ($chartsFlag) { $result .= wf_gchartsLine($equipChartData, __('Equipment'), '100%', '300px', $chartsOptions); } } else { $result .= $this->messages->getStyledMessage(__('Nothing found'), 'info'); } return $result; }
/** * Renders network template editing form * * @param int $dhcpid * * @return string */ public function editForm($dhcpid) { $dhcpid = vf($dhcpid, 3); $result = ''; if (isset($this->allDhcpNets[$dhcpid])) { $dhcpnetdata = $this->getNetworkData($dhcpid); $inputs = wf_TextInput('editdhcpconfname', __('DHCP config name'), $dhcpnetdata['confname'], true, 20); $inputs .= __('DHCP custom subnet template') . wf_tag('br'); $inputs .= wf_TextArea('editdhcpconfig', '', $dhcpnetdata['dhcpconfig'], true, '60x10'); $inputs .= wf_Submit(__('Save')); $result = wf_Form('', 'POST', $inputs, 'glamour'); $result .= wf_CleanDiv(); $result .= wf_Link(self::URL_ME, __('Back'), false, 'ubButton'); } else { $result = $this->messages->getStyledMessage(__('Something went wrong'), 'errors'); } return $result; }
$altercell = web_ConfigEditorShow('alterini', $alterconf, $alteropts); $catvcell = web_ConfigEditorShow('catvini', $catvconf, $catvopts); $ymcells = web_ConfigEditorShow('ymaps', $ymconf, $ymopts); $photocells = web_ConfigEditorShow('photostorage', $photoconf, $photoopts); $grid = wf_tag('script'); $grid .= '$(function() { $( "#tabs" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" ); $( "#tabs li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" ); });'; $grid .= wf_tag('script', true); $grid .= wf_tag('style'); $grid .= ' .ui-tabs-vertical { width: auto;} .ui-tabs-vertical .ui-tabs-nav { padding: .2em .1em .2em .2em; float: left; } .ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 1px !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; } .ui-tabs-vertical .ui-tabs-nav li a { display:block; } .ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active { padding-bottom: 0; padding-right: .1em; border-right-width: 1px; } .ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: left; width: 40em;} '; $grid .= wf_tag('style', true); $grid .= wf_tag('div', false, '', 'id="tabs"'); $grid .= wf_tag('ul'); $grid .= web_ConfigGetTabsControls($dbopts) . web_ConfigGetTabsControls($billopts) . web_ConfigGetTabsControls($alteropts); $grid .= web_ConfigGetTabsControls($catvopts) . web_ConfigGetTabsControls($ymopts) . web_ConfigGetTabsControls($photoopts); $grid .= wf_tag('ul', true); $grid .= $dbcell . $billcell . $catvcell . $ymcells . $photocells . $altercell; $grid .= wf_tag('div', true) . wf_CleanDiv(); show_window(__('System settings'), $grid); } else { show_error(__('You cant control this module')); }
/** * Returns outcoming operation creation form * * @param int $storageid * @param int $itemtypeid * * @return string */ public function outcomingCreateForm($storageid, $itemtypeid) { $result = ''; $storageid = vf($storageid, 3); $itemtypeid = vf($itemtypeid, 3); $tmpDests = array(); if (isset($this->allStorages[$storageid]) and isset($this->allItemTypes[$itemtypeid])) { $itemData = $this->allItemTypes[$itemtypeid]; $itemUnit = $this->unitTypes[$itemData['unit']]; $storageRemains = $this->remainsOnStorage($storageid); $allRemains = $this->remainsAll(); if (isset($storageRemains[$itemtypeid])) { $itemRemainsStorage = $storageRemains[$itemtypeid]; } else { $itemRemainsStorage = 0; } if (isset($allRemains[$itemtypeid])) { $itemRemainsTotal = $allRemains[$itemtypeid]; } else { $itemRemainsTotal = 0; } $isReserved = $this->reserveGet($storageid, $itemtypeid); foreach ($this->outDests as $destMark => $destName) { $tmpDests[self::URL_ME . '&' . self::URL_OUT . '&' . self::URL_AJODSELECTOR . $destMark] = $destName; } //form construct $inputs = wf_AjaxLoader(); $inputs .= wf_HiddenInput('newoutdate', curdate()); $inputs .= wf_AjaxSelectorAC('ajoutdestselcontainer', $tmpDests, __('Destination'), '', false); $inputs .= wf_AjaxContainer('ajoutdestselcontainer', '', $this->outcomindAjaxDestSelector('task')); $inputs .= wf_HiddenInput('newoutitemtypeid', $itemtypeid); $inputs .= wf_HiddenInput('newoutstorageid', $storageid); $inputs .= wf_TextInput('newoutcount', $itemUnit . ' (' . ($itemRemainsStorage - $isReserved) . ' ' . __('maximum') . ')', '', true, '4'); $inputs .= wf_TextInput('newoutprice', __('Price'), '', true, '4'); $inputs .= wf_TextInput('newoutnotes', __('Notes'), '', true, 25); $inputs .= wf_tag('br'); $inputs .= wf_Submit(__('Create')); $form = wf_Form('', 'POST', $inputs, 'glamour'); //notifications if ($itemRemainsTotal < $itemData['reserve']) { $remainsAlert = __('The balance of goods and materials in stock is less than the amount') . ' ' . $itemData['reserve'] . ' ' . $itemUnit; } else { $remainsAlert = ''; } $remainsNotification = __('At storage') . ' ' . @$this->allStorages[$storageid] . ' ' . __('remains') . ' ' . $itemRemainsStorage . ' ' . $itemUnit . ' ' . $itemData['name']; $notifications = $this->messages->getStyledMessage($remainsNotification, 'success'); if ($isReserved) { $notifications .= $this->messages->getStyledMessage(__('Reserved') . ' ' . $isReserved . ' ' . $itemUnit, 'info'); } if ($remainsAlert) { $notifications .= $this->messages->getStyledMessage($remainsAlert, 'warning'); } $notifications .= wf_CleanDiv(); $reserveLink = self::URL_ME . '&' . self::URL_RESERVE . '&itemtypeid=' . $itemtypeid . '&storageid=' . $storageid; $notifications .= wf_tag('div', false, '', 'style="margin: 20px 3% 0 3%;"') . wf_Link($reserveLink, wf_img('skins/whreservation.png') . ' ' . __('Reservation'), false, 'ubButton') . wf_tag('div', true); $notifications .= wf_CleanDiv(); $cells = wf_TableCell($form, '40%'); $cells .= wf_TableCell($notifications, '', '', 'valign="top"'); $rows = wf_TableRow($cells); $result = wf_TableBody($rows, '100%', 0, ''); //photostorage integration if ($this->altCfg['PHOTOSTORAGE_ENABLED']) { $photostorage = new PhotoStorage(self::PHOTOSTORAGE_SCOPE, $itemtypeid); $result .= $photostorage->renderImagesRaw(); } } else { $result = $this->messages->getStyledMessage(__('Strange exeption'), 'error'); } return $result; }
function web_PaymentSearch($markers) { if (wf_CheckPost(array('searchtable'))) { if ($_POST['searchtable'] == 'payments') { $table = 'payments'; } if ($_POST['searchtable'] == 'corrections') { $table = 'paymentscorr'; } } else { $table = 'payments'; } $query = "SELECT * from `" . $table . "`"; $query .= $markers; $altercfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $csvdata = ''; $allpayments = simple_queryall($query); if ($altercfg['FINREP_CONTRACT']) { $allcontracts = zb_UserGetAllContracts(); $allcontracts = array_flip($allcontracts); } if ($altercfg['FINREP_TARIFF']) { $alltariffs = zb_TariffsGetAllUsers(); } $allrealnames = zb_UserGetAllRealnames(); $alladdress = zb_AddressGetFulladdresslist(); $alltypes = zb_CashGetAllCashTypes(); $allservicenames = zb_VservicesGetAllNamesLabeled(); $allpaysyspercents = zb_PaySysPercentGetAll(); $totalsumm = 0; $paysyssumm = 0; $profitsumm = 0; $totalcount = 0; $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Cash')); $cells .= wf_TableCell(__('PS%')); $cells .= wf_TableCell(__('Profit')); $cells .= wf_TableCell(__('Login')); if ($altercfg['FINREP_CONTRACT']) { $cells .= wf_TableCell(__('Contract')); } $cells .= wf_TableCell(__('Full address')); $cells .= wf_TableCell(__('Real Name')); if ($altercfg['FINREP_TARIFF']) { $cells .= wf_TableCell(__('Tariff')); } $cells .= wf_TableCell(__('Payment type')); $cells .= wf_TableCell(__('Notes')); $cells .= wf_TableCell(__('Admin')); $rows = wf_TableRow($cells, 'row1'); if (!empty($allpayments)) { if ($altercfg['FINREP_TARIFF']) { $csvTariffColumn = ';' . __('Tariff'); } else { $csvTariffColumn = ''; } $csvdata .= __('ID') . ';' . __('Date') . ';' . __('Cash') . ';' . __('PS%') . ';' . __('Profit') . ';' . __('Login') . ';' . __('Full address') . ';' . __('Real Name') . $csvTariffColumn . ';' . __('Payment type') . ';' . __('Notes') . ';' . __('Admin') . "\n"; foreach ($allpayments as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($each['date']); $cells .= wf_TableCell($each['summ']); //detecting paymentsystem and calc percent if (isset($allpaysyspercents[$each['note']])) { $currPc = $allpaysyspercents[$each['note']]['percent']; $rawSumm = $each['summ']; $paySysPc = $rawSumm / 100 * $currPc; $ourProfit = $rawSumm - $paySysPc; } else { $paySysPc = 0; $ourProfit = $each['summ']; } $cells .= wf_TableCell($paySysPc); $cells .= wf_TableCell($ourProfit); $cells .= wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $each['login'], false, '')); if ($altercfg['FINREP_CONTRACT']) { $cells .= wf_TableCell(@$allcontracts[$each['login']]); } @($paymentRealname = $allrealnames[$each['login']]); @($paymentCashType = __($alltypes[$each['cashtypeid']])); @($paymentAddress = $alladdress[$each['login']]); $cells .= wf_TableCell($paymentAddress); $cells .= wf_TableCell($paymentRealname); if ($altercfg['FINREP_TARIFF']) { @($userTariff = $alltariffs[$each['login']]); $cells .= wf_TableCell($userTariff); $csvTariff = ';' . $userTariff; } else { $csvTariff = ''; } $cells .= wf_TableCell($paymentCashType); //payment notes translation if ($altercfg['TRANSLATE_PAYMENTS_NOTES']) { $paynote = zb_TranslatePaymentNote($each['note'], $allservicenames); } else { $paynote = $each['note']; } $cells .= wf_TableCell($paynote); $cells .= wf_TableCell($each['admin']); $rows .= wf_TableRow($cells, 'row3'); //calculating totals if ($each['summ'] > 0) { $totalsumm = $totalsumm + $each['summ']; $totalcount++; } if ($paySysPc > 0) { $paysyssumm = $paysyssumm + $paySysPc; } if ($ourProfit > 0) { $profitsumm = $profitsumm + $ourProfit; } $csvSumm = str_replace('.', ',', $each['summ']); $csvdata .= $each['id'] . ';' . $each['date'] . ';' . $csvSumm . ';' . $paySysPc . ';' . $ourProfit . ';' . $each['login'] . ';' . $paymentAddress . ';' . $paymentRealname . $csvTariff . ';' . $paymentCashType . ';' . $paynote . ';' . $each['admin'] . "\n"; } } //saving report for future download if (!empty($csvdata)) { $csvSaveName = 'exports/payfind_' . zb_rand_string(8) . '.csv'; $csvSaveNameEnc = base64_encode($csvSaveName); $csvdata = iconv('utf-8', 'windows-1251', $csvdata); file_put_contents($csvSaveName, $csvdata); $csvDownloadLink = wf_Link('?module=payfind&downloadcsv=' . $csvSaveNameEnc, wf_img('skins/excel.gif', __('Export')), false); } else { $csvDownloadLink = ''; } $result = wf_TableBody($rows, '100%', '0', 'sortable'); //additional total counters $result .= wf_tag('div', false, 'glamour') . __('Count') . ': ' . $totalcount . wf_tag('div', true); $result .= wf_tag('div', false, 'glamour') . __('Total payments') . ': ' . $totalsumm . wf_tag('div', true); $result .= wf_tag('div', false, 'glamour') . __('Payment systems %') . ': ' . $paysyssumm . wf_tag('div', true); $result .= wf_tag('div', false, 'glamour') . __('Our final profit') . ': ' . $profitsumm . wf_tag('div', true); $result .= wf_CleanDiv(); show_window(__('Payments found') . ' ' . $csvDownloadLink, $result); }
/** * Renders payroll report search results * * @param string $datefrom * @param string $dateto * @param int $employeeid * @return string */ public function payrollRenderSearch($datefrom, $dateto, $employeeid) { $datefrom = mysql_real_escape_string($datefrom); $dateto = mysql_real_escape_string($dateto); $employeeid = vf($employeeid, 3); $allTasks = ts_GetAllTasks(); $chartData = array(); $chartDataCash = array(); $result = ''; $totalSum = 0; $payedSum = 0; $jobCount = 0; $query = "SELECT * from `salary_jobs` WHERE CAST(`date` AS DATE) BETWEEN '" . $datefrom . "' AND '" . $dateto . "' AND `employeeid`='" . $employeeid . "';"; $all = simple_queryall($query); $cells = wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Task')); $cells .= wf_TableCell(__('Job type')); $cells .= wf_TableCell(__('Factor')); $cells .= wf_TableCell(__('Price override')); $cells .= wf_TableCell(__('Notes')); $cells .= wf_TableCell(__('Paid')); $cells .= wf_TableCell(__('Money')); $cells .= wf_TableCell(__('')); $rows = wf_TableRow($cells, 'row1'); if (!empty($all)) { foreach ($all as $io => $each) { $jobName = @$this->allJobtypes[$each['jobtypeid']]; $jobPrice = $this->getJobPrice($each['id']); if (!empty($jobName)) { if (isset($chartData[$jobName])) { $chartData[$jobName]++; $chartDataCash[$jobName] = $chartDataCash[$jobName] + $jobPrice; } else { $chartData[$jobName] = 1; $chartDataCash[$jobName] = $jobPrice; } } if (isset($this->allJobUnits[$each['jobtypeid']])) { $unit = $this->unitTypes[$this->allJobUnits[$each['jobtypeid']]]; } else { $unit = __('No'); } $cells = wf_TableCell($each['date']); $cells .= wf_TableCell(wf_Link(self::URL_TS . $each['taskid'], $each['taskid']) . ' ' . @$allTasks[$each['taskid']]['address']); $cells .= wf_TableCell($jobName); $cells .= wf_TableCell($each['factor'] . ' / ' . $unit); $cells .= wf_TableCell($each['overprice']); $cells .= wf_TableCell($each['note']); $cells .= wf_TableCell($this->renderPaidDataLed($each['id'])); $cells .= wf_TableCell($jobPrice); if (!$each['state']) { $actControls = wf_CheckInput('_prstatecheck[' . $each['id'] . ']', '', true, false); } else { $actControls = ''; } $cells .= wf_TableCell($actControls); $rows .= wf_TableRow($cells, 'row3'); if ($each['state'] == 0) { $totalSum = $totalSum + $jobPrice; $jobCount++; } else { $payedSum = $payedSum + $jobPrice; } } } $result = wf_TableBody($rows, '100%', 0, ''); $result .= wf_HiddenInput('prstateprocessing', 'true'); if ($jobCount > 0) { $result .= wf_Submit(__('Processing')) . wf_delimiter(); } $result = wf_Form('', 'POST', $result, ''); $result .= __('Total') . ' ' . __('money') . ': ' . $totalSum . wf_tag('br'); $result .= __('Paid') . ' ' . __('money') . ': ' . $payedSum; if (!empty($chartData)) { $result .= wf_CleanDiv(); $chartOpts = "chartArea: { width: '90%', height: '90%' }, legend : {position: 'right'}, "; $chartCells = wf_TableCell(wf_gcharts3DPie($chartData, __('Job types'), '400px', '400px', $chartOpts)); $chartCells .= wf_TableCell(wf_gcharts3DPie($chartDataCash, __('Money'), '400px', '400px', $chartOpts)); $chartRows = wf_TableRow($chartCells); $result .= wf_TableBody($chartRows, '100%', 0, ''); } return $result; }
/** * Returns NP switches replacement form * * @param int $fromSwitchId * * @return string */ function zb_SwitchReplaceForm($fromSwitchId) { $fromSwitchId = vf($fromSwitchId, 3); $result = ''; $query = "SELECT * from `switches` WHERE `desc` LIKE '%NP%' ORDER BY `id` DESC"; $raw = simple_queryall($query); $paramsNp = array(); $employee = array(); $employee = ts_GetActiveEmployee(); if (!empty($raw)) { foreach ($raw as $io => $eachNp) { $paramsNp[$eachNp['id']] = $eachNp['location'] . ' - ' . $eachNp['ip']; } } $inputs = wf_HiddenInput('switchreplace', $fromSwitchId); $inputs .= wf_Selector('toswtichreplace', $paramsNp, 'NP ' . __('Switch'), '', false); $inputs .= wf_Selector('replaceemployeeid', $employee, __('Worker'), '', false); $inputs .= wf_Submit('Save'); $result = wf_Form('', 'POST', $inputs, 'glamour'); $result .= wf_CleanDiv(); $result .= wf_delimiter(); $result .= wf_Link('?module=switches&edit=' . $fromSwitchId, __('Back'), false, 'ubButton'); return $result; }
/** * Renders date remains report * * @return string */ public function reportDateRemains() { $result = ''; $curyear = wf_CheckPost(array('yearsel')) ? vf($_POST['yearsel'], 3) : date("Y"); $curmonth = wf_CheckPost(array('monthsel')) ? vf($_POST['monthsel'], 3) : date("m"); $inputs = wf_YearSelector('yearsel', __('Year')) . ' '; $inputs .= wf_MonthSelector('monthsel', __('Month'), $curmonth) . ' '; $inputs .= wf_CheckInput('printmode', __('Print'), false, false); $inputs .= wf_Submit(__('Show')); $searchForm = wf_Form('', 'POST', $inputs, 'glamour'); $searchForm .= wf_CleanDiv(); //append form to result if (!wf_CheckPost(array('printmode'))) { $result .= $searchForm; } $lowerOffset = strtotime($curyear . '-' . $curmonth . '-01'); $upperOffset = strtotime($curyear . '-' . $curmonth . '-01'); $upperOffset = date("t", $upperOffset); $upperOffset = strtotime($curyear . '-' . $curmonth . '-' . $upperOffset); $incomingLower = array(); $outcomingLower = array(); if (!empty($this->allIncoming)) { foreach ($this->allIncoming as $io => $each) { $incomingDate = strtotime($each['date']); if ($incomingDate < $lowerOffset) { if ($each['contractorid'] != 0) { //ignoring move ops $incomingLower[$each['id']] = $each; } } } } if (!empty($this->allOutcoming)) { foreach ($this->allOutcoming as $io => $each) { $outcomingDate = strtotime($each['date']); if ($outcomingDate < $lowerOffset) { if ($each['desttype'] != 'storage') { // ignoring move ops $outcomingLower[$each['id']] = $each; } } } } $lowerIncome = array(); if (!empty($incomingLower)) { foreach ($incomingLower as $io => $each) { if (isset($lowerIncome[$each['itemtypeid']])) { $lowerIncome[$each['itemtypeid']]['count'] = $lowerIncome[$each['itemtypeid']]['count'] + $each['count']; $lowerIncome[$each['itemtypeid']]['price'] = $lowerIncome[$each['itemtypeid']]['price'] + $each['count'] * $each['price']; } else { $lowerIncome[$each['itemtypeid']]['count'] = $each['count']; $lowerIncome[$each['itemtypeid']]['price'] = $each['count'] * $each['price']; } } } $lowerOutcome = array(); if (!empty($outcomingLower)) { foreach ($outcomingLower as $io => $each) { if ($each['price'] == 0) { $each['price'] = $this->getIncomeMiddlePrice($each['itemtypeid']); } if (isset($lowerOutcome[$each['itemtypeid']])) { $lowerOutcome[$each['itemtypeid']]['count'] = $lowerOutcome[$each['itemtypeid']]['count'] + $each['count']; $lowerOutcome[$each['itemtypeid']]['price'] = $lowerOutcome[$each['itemtypeid']]['price'] + $each['count'] * $each['price']; } else { $lowerOutcome[$each['itemtypeid']]['count'] = $each['count']; $lowerOutcome[$each['itemtypeid']]['price'] = $each['count'] * $each['price']; } } } //first report column here $lowerRemains = array(); if (!empty($incomingLower)) { foreach ($incomingLower as $io => $each) { $outcomeCount = isset($lowerOutcome[$each['itemtypeid']]) ? $lowerOutcome[$each['itemtypeid']]['count'] : 0; $outcomePrice = isset($lowerOutcome[$each['itemtypeid']]) ? $lowerOutcome[$each['itemtypeid']]['price'] : 0; $lowerRemains[$each['itemtypeid']]['count'] = $lowerIncome[$each['itemtypeid']]['count'] - $outcomeCount; $lowerRemains[$each['itemtypeid']]['price'] = $lowerIncome[$each['itemtypeid']]['price'] - $outcomePrice; } } //second column $upperIncome = array(); if (!empty($this->allIncoming)) { foreach ($this->allIncoming as $io => $each) { $incomeDate = strtotime($each['date']); if ($incomeDate >= $lowerOffset and $incomeDate <= $upperOffset) { if ($each['contractorid'] != 0) { //ignoring move ops if (isset($upperIncome[$each['itemtypeid']])) { $upperIncome[$each['itemtypeid']]['count'] = $upperIncome[$each['itemtypeid']]['count'] + $each['count']; $upperIncome[$each['itemtypeid']]['price'] = $upperIncome[$each['itemtypeid']]['price'] + $each['count'] * $each['price']; } else { $upperIncome[$each['itemtypeid']]['count'] = $each['count']; $upperIncome[$each['itemtypeid']]['price'] = $each['count'] * $each['price']; } } } } } //third column $upperOutcome = array(); if (!empty($this->allOutcoming)) { foreach ($this->allOutcoming as $io => $each) { $outcomeDate = strtotime($each['date']); if ($outcomeDate >= $lowerOffset and $outcomeDate <= $upperOffset) { if ($each['desttype'] != 'storage') { //ignoring move ops if ($each['price'] == 0) { $each['price'] = $this->getIncomeMiddlePrice($each['itemtypeid']); } if (isset($upperOutcome[$each['itemtypeid']])) { $upperOutcome[$each['itemtypeid']]['count'] = $upperOutcome[$each['itemtypeid']]['count'] + $each['count']; $upperOutcome[$each['itemtypeid']]['price'] = $upperOutcome[$each['itemtypeid']]['price'] + $each['count'] * $each['price']; } else { $upperOutcome[$each['itemtypeid']]['count'] = $each['count']; $upperOutcome[$each['itemtypeid']]['price'] = $each['count'] * $each['price']; } } } } } //mixing earlier non exists items into lower remains array if (!empty($upperIncome)) { foreach ($upperIncome as $io => $each) { if (!isset($lowerRemains[$io])) { $lowerRemains[$io]['count'] = 0; $lowerRemains[$io]['price'] = 0; } } } $result .= $this->reportDateRemainsHeader($curyear, $curmonth); if (!empty($lowerRemains)) { $firstColumnTotal = 0; $secondColumnTotal = 0; $thirdColumnTotal = 0; $fourthColumnTotal = 0; foreach ($lowerRemains as $io => $each) { $itemtypeId = $io; $firstColumnCount = isset($lowerRemains[$itemtypeId]) ? $lowerRemains[$itemtypeId]['count'] : 0; $firstColumnPrice = isset($lowerRemains[$itemtypeId]) ? $lowerRemains[$itemtypeId]['price'] : 0; $secondColumnCount = isset($upperIncome[$itemtypeId]) ? $upperIncome[$itemtypeId]['count'] : 0; $secondColumnPrice = isset($upperIncome[$itemtypeId]) ? $upperIncome[$itemtypeId]['price'] : 0; $thirdColumnCount = isset($upperOutcome[$itemtypeId]) ? $upperOutcome[$itemtypeId]['count'] : 0; $thirdColumnPrice = isset($upperOutcome[$itemtypeId]) ? $upperOutcome[$itemtypeId]['price'] : 0; $fourthColumnCount = $lowerRemains[$itemtypeId]['count'] + $secondColumnCount - $thirdColumnCount; $fourthColumnPrice = $lowerRemains[$itemtypeId]['price'] + $secondColumnPrice - $thirdColumnPrice; $result .= $this->reportDateRemainsAddRow($itemtypeId, array($firstColumnCount, round($firstColumnPrice, 2), $secondColumnCount, round($secondColumnPrice, 2), $thirdColumnCount, round($thirdColumnPrice, 2), $fourthColumnCount, round($fourthColumnPrice, 2))); $firstColumnTotal += $firstColumnPrice; $secondColumnTotal += $secondColumnPrice; $thirdColumnTotal += $thirdColumnPrice; $fourthColumnTotal += $firstColumnPrice; } $result .= $this->reportDateRemainsAddRow('', array('', $firstColumnTotal, '', $secondColumnTotal, '', $thirdColumnTotal, '', $fourthColumnTotal)); } $result .= wf_tag('tbody', true); $result .= wf_tag('table', true); if (wf_CheckPost(array('printmode'))) { die($this->reportPrintable(__('Date remains'), $result)); } return $result; }
/** * renders report list * * @return void */ public function reportList() { $reports = ''; $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportDebtors', 'debtors.png', __('Debtors')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportAntiDebtors', 'antidebtors.png', __('AntiDebtors')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportTariffs', 'tariffsreport.jpg', __('Tariffs report')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportFinance', 'financereport.jpg', __('Finance report')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportSignup', 'signupreport.jpg', __('Signup report')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportFees', 'feesreport.png', __('Money fees')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportStreets', 'streetsreport.png', __('Streets report')); $reports .= wf_CleanDiv(); show_window(__('Reports'), $reports); }
/** * renders report list * * @return void */ public function reportList() { $reports = ''; $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportDebtors', 'debtors.png', __('Debtors')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportAntiDebtors', 'antidebtors.png', __('AntiDebtors')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportTariffs', 'tariffsreport.jpg', __('Tariffs report')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportFinance', 'financereport.jpg', __('Finance report')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportSignup', 'signupreport.jpg', __('Signup report')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportFees', 'feesreport.png', __('Money fees')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportStreets', 'streetsreport.png', __('Streets report')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportDebtAddr', 'debtaddr.png', __('Current debtors for delivery by address')); $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportDebtStreets', 'debtstreets.png', __('Current debtors for delivery by streets')); if ($this->altCfg['COMPLEX_ENABLED']) { $reports .= $this->buildReportTask(self::URL_REPORTS_MGMT . 'reportComplexAssign', 'reportcomplexassign.png', __('Users with complex services')); } $reports .= wf_CleanDiv(); show_window(__('Reports'), $reports); }