public function flushCredit($login) { global $billing; $login = mysql_real_escape_string($login); $credit = 0; $curdate = curdate(); $billing->setcredit($login, $credit); log_register('CHANGE FIX Credit (' . $login . ') ON ' . $credit); $billing->setcreditexpire($login, $curdate); log_register('CHANGE FIX CreditExpire (' . $login . ') ON ' . $curdate); }
public static function init() { self::$prefix = HOST . ':hash:'; @(self::$hash = $_COOKIE['hash']); if (self::$hash and R::EXISTS(self::$prefix . self::$hash)) { $pipeline = R::pipeline(); $pipeline->HSET(self::$prefix . self::$hash, 'LAST', now()); $pipeline->EXPIRE(self::$prefix . self::$hash, USER_SESSION_TIMEOUT); $pipeline->execute(); self::setCookie(); self::$me = R::toHash(R::HGETALL(self::$prefix . self::$hash)); } else { self::login(); } if (USER_STAT) { $IP = IP(); $STAMP = curdate(); $HOST = HOST; $HASH = self::$hash; $METHOD = IS_AJAX ? 'AJAX' : (IS_POST ? 'POST' : 'GET'); R::RPUSH("{$HOST}:stat:{$STAMP}:{$IP}:{$HASH}", implode(chr(10), array(now(), $METHOD, REF(), SITE . URI()))); } }
/** * Render TurboSMS server-side queue * * @return string */ public function renderTurboSMSQueue() { $result = ''; $tsms_host = $this->settings['TSMS_GATEWAY']; $tsms_db = 'users'; $tsms_login = $this->settings['TSMS_LOGIN']; $tsms_password = $this->settings['TSMS_PASSWORD']; $tsms_table = $this->settings['TSMS_LOGIN']; $smsArray = array(); $total = 0; $TsmsDB = new DbConnect($tsms_host, $tsms_login, $tsms_password, $tsms_db, $error_reporting = true, $persistent = false); $TsmsDB->open() or die($TsmsDB->error()); $TsmsDB->query('SET NAMES utf8;'); if (wf_CheckPost(array('showdate'))) { $date = mysql_real_escape_string($_POST['showdate']); } else { $date = ''; } if (!empty($date)) { $where = " WHERE `send_time` LIKE '" . $date . "%' ORDER BY `id` DESC;"; } else { $where = ' ORDER BY `id` DESC LIMIT 50;'; } $query = "SELECT * from `" . $tsms_table . "`" . $where; $TsmsDB->query($query); while ($row = $TsmsDB->fetchassoc()) { $smsArray[] = $row; } //close old datalink $TsmsDB->close(); //rendering result $inputs = wf_DatePickerPreset('showdate', curdate()); $inputs .= wf_Submit(__('Show')); $dateform = wf_Form("", 'POST', $inputs, 'glamour'); $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Msg ID')); $cells .= wf_TableCell(__('Mobile')); $cells .= wf_TableCell(__('Sign')); $cells .= wf_TableCell(__('Message')); $cells .= wf_TableCell(__('Balance')); $cells .= wf_TableCell(__('Cost')); $cells .= wf_TableCell(__('Send time')); $cells .= wf_TableCell(__('Sended')); $cells .= wf_TableCell(__('Status')); $rows = wf_TableRow($cells, 'row1'); if (!empty($smsArray)) { foreach ($smsArray as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($each['msg_id']); $cells .= wf_TableCell($each['number']); $cells .= wf_TableCell($each['sign']); $msg = wf_modal(__('Show'), __('SMS'), $each['message'], '', '300', '200'); $cells .= wf_TableCell($msg); $cells .= wf_TableCell($each['balance']); $cells .= wf_TableCell($each['cost']); $cells .= wf_TableCell($each['send_time']); $cells .= wf_TableCell($each['sended']); $cells .= wf_TableCell($each['status']); $rows .= wf_TableRow($cells, 'row5'); $total++; } } $result .= wf_Link(self::URL_ME, __('Back'), true, 'ubButton'); $result .= $dateform; $result .= wf_TableBody($rows, '100%', '0', 'sortable'); $result .= __('Total') . ': ' . $total; return $result; }
public function testCurdate() { $this->assertEquals(intval(curdate()) > 2010, true); }
/** * show calendar contol form * * @return string */ public function dateControl() { if (wf_CheckPost(array('showdate'))) { $curdate = $_POST['showdate']; } else { $curdate = curdate(); } $inputs = wf_DatePickerPreset('showdate', $curdate); $inputs .= wf_Submit(__('Show')); $result = wf_Form('', 'POST', $inputs, 'glamour'); return $result; }
function web_TsmsDateForm() { $inputs = __('By date') . ' ' . wf_DatePickerPreset('showqueuedate', curdate()); $inputs .= wf_Submit(__('Show')); $result = wf_Form("", "POST", $inputs, 'glamour'); return $result; }
function web_PayFindForm() { //try to save calendar states if (wf_CheckPost(array('datefrom', 'dateto'))) { $curdate = $_POST['dateto']; $yesterday = $_POST['datefrom']; } else { $curdate = date("Y-m-d", time() + 60 * 60 * 24); $yesterday = curdate(); } $inputs = __('Date'); $inputs .= wf_DatePickerPreset('datefrom', $yesterday) . ' ' . __('From'); $inputs .= wf_DatePickerPreset('dateto', $curdate) . ' ' . __('To'); $inputs .= wf_delimiter(); $inputs .= wf_CheckInput('type_payid', '', false, false); $inputs .= wf_TextInput('payid', __('Search by payment ID'), '', true, '10'); $inputs .= wf_CheckInput('type_contract', '', false, false); $inputs .= wf_TextInput('contract', __('Search by users contract'), '', true, '10'); $inputs .= wf_CheckInput('type_login', '', false, false); $inputs .= wf_TextInput('login', __('Search by users login'), '', true, '10'); $inputs .= wf_CheckInput('type_summ', '', false, false); $inputs .= wf_TextInput('summ', __('Search by payment sum'), '', true, '10'); $inputs .= wf_CheckInput('type_cashtype', '', false, false); $inputs .= web_CashTypeSelector() . wf_tag('label', false, '', 'for="cashtype"') . __('Search by cash type') . wf_tag('label', true) . wf_tag('br'); $inputs .= wf_CheckInput('type_cashier', '', false, false); $inputs .= web_PayFindCashierSelector(); $inputs .= wf_CheckInput('type_tagid', '', false, false); $inputs .= web_PayFindTagidSelector(); $inputs .= wf_CheckInput('type_paysys', '', false, false); $inputs .= web_PaySysPercentSelector(); $inputs .= wf_Link("?module=payfind&confpaysys=true", __('Settings')) . wf_tag('br'); $inputs .= wf_CheckInput('only_positive', __('Show only positive payments'), true, false); $inputs .= wf_CheckInput('numeric_notes', __('Show payments with numeric notes'), true, false); $inputs .= wf_CheckInput('numericonly_notes', __('Show payments with only numeric notes'), true, false); //ugly spacing hack $inputs .= ' ' . web_PayFindTableSelect() . wf_delimiter(); $inputs .= wf_HiddenInput('dosearch', 'true'); $inputs .= wf_Submit(__('Search')); $result = wf_Form('', 'POST', $inputs, 'glamour'); $result .= wf_Link("?module=report_finance", __('Back'), true, 'ubButton'); return $result; }
<?php include 'config.inc.php'; require_once 'functions.php'; if (isset($_POST['submit']) == 'Submit') { $fname = mysql_real_escape_string($_POST['fname']); $lname = mysql_real_escape_string($_POST['lname']); $email = mysql_real_escape_string($_POST['email']); $pass = mysql_real_escape_string($_POST['pass']); $utype = mysql_real_escape_string($_POST['utype']); $data = array('firstname' => $fname, 'lastname' => $lname, 'email' => $email, 'password' => $pass, 'user_type' => $utype, 'status' => 1, 'date' => curdate()); InsertPDO('library_user', $data); header("Location: index.php"); } include 'header.php'; ?> <script language="javascript"> function validform(){ var y=document.forms["myForm"]["fname"].value; if(y==null || y=="" || y.length<3) { alert('please enter your First name which is more than 3 character'); document.forms["myForm"]["fname"].focus(); return false; } var p=document.forms["myForm"]["lname"].value; if(p==null || p=="" || p.length<2) { alert('please enter your Last name which is more than 2 character'); document.forms["myForm"]["lname"].focus(); return false;
/** * Performs available tasks processing * * @return void */ public function tasksProcessing() { global $billing; $curdate = curdate(); $rawUsers = zb_UserGetAllStargazerData(); $allUsers = array(); if (!empty($rawUsers)) { foreach ($rawUsers as $io => $each) { $allUsers[$each['login']] = $each; } } if (!empty($this->allTasks)) { foreach ($this->allTasks as $io => $each) { if ($each['date'] == $curdate) { if (isset($allUsers[$each['login']])) { $login = $each['login']; $param = $each['param']; switch ($each['action']) { case 'addcash': zb_CashAdd($login, $param, 'add', 1, 'SCHEDULED'); break; case 'corrcash': zb_CashAdd($login, $param, 'correct', 1, 'SCHEDULED'); break; case 'setcash': zb_CashAdd($login, $param, 'set', 1, 'SCHEDULED'); break; case 'credit': $billing->setcredit($login, $param); log_register('CHANGE Credit (' . $login . ') ON ' . $param); break; case 'creditexpire': $billing->setcreditexpire($login, $param); log_register('CHANGE CreditExpire (' . $login . ') ON ' . $param); break; case 'tariffchange': $billing->settariff($login, $param); log_register('CHANGE Tariff (' . $login . ') ON `' . $param . '`'); //optional user reset if ($this->altCfg['TARIFFCHGRESET']) { $billing->resetuser($login); log_register('RESET User (' . $login . ')'); } break; case 'tagadd': stg_add_user_tag($login, $param); break; case 'tagdel': stg_del_user_tagid($login, $param); break; case 'freeze': $billing->setpassive($login, 1); log_register('CHANGE Passive (' . $login . ') ON 1'); break; case 'unfreeze': $billing->setpassive($login, 0); log_register('CHANGE Passive (' . $login . ') ON 0'); break; case 'reset': $billing->resetuser($login); log_register('RESET User (' . $login . ')'); break; case 'setspeed': zb_UserDeleteSpeedOverride($login); zb_UserCreateSpeedOverride($login, $param); $billing->resetuser($login); log_register("RESET User (" . $login . ")"); break; case 'down': $billing->setdown($login, 1); log_register('CHANGE Down (' . $login . ') ON 1'); break; case 'undown': $billing->setdown($login, 0); log_register('CHANGE Down (' . $login . ') ON 0'); break; case 'ao': $billing->setao($login, 1); log_register('CHANGE AlwaysOnline (' . $login . ') ON 1'); break; case 'unao': $billing->setao($login, 0); log_register('CHANGE AlwaysOnline (' . $login . ') ON 0'); break; } //flush task from database $this->setTaskIsDone($each['id']); } else { log_register('SCHEDULER FAIL ID [' . $taskId . '] USER (' . $each['login'] . ') NON EXISTS'); $this->deleteTask($taskId); } } } } }
/** * Returns list of previous user payments * * @param string $login * @return string */ function web_PaymentsByUser($login) { global $ubillingConfig; $allpayments = zb_CashGetUserPayments($login); $alter_conf = $ubillingConfig->getAlter(); $alltypes = zb_CashGetAllCashTypes(); $allservicenames = zb_VservicesGetAllNamesLabeled(); $total_payments = "0"; $curdate = curdate(); $deletingAdmins = array(); $editingAdmins = array(); $iCanDeletePayments = false; $iCanEditPayments = false; $currentAdminLogin = whoami(); //extract admin logins with payments delete rights if (!empty($alter_conf['CAN_DELETE_PAYMENTS'])) { $deletingAdmins = explode(',', $alter_conf['CAN_DELETE_PAYMENTS']); $deletingAdmins = array_flip($deletingAdmins); } //extract admin logins with date edit rights if (!empty($alter_conf['CAN_EDIT_PAYMENTS'])) { $editingAdmins = explode(',', $alter_conf['CAN_EDIT_PAYMENTS']); $editingAdmins = array_flip($editingAdmins); } //setting editing/deleting flags $iCanDeletePayments = isset($deletingAdmins[$currentAdminLogin]) ? true : false; $iCanEditPayments = isset($editingAdmins[$currentAdminLogin]) ? true : false; $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('IDENC')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Payment')); $cells .= wf_TableCell(__('Balance before')); $cells .= wf_TableCell(__('Cash type')); $cells .= wf_TableCell(__('Payment note')); $cells .= wf_TableCell(__('Admin')); $cells .= wf_TableCell(__('Actions')); $rows = wf_TableRow($cells, 'row1'); if (!empty($allpayments)) { foreach ($allpayments as $eachpayment) { if ($alter_conf['TRANSLATE_PAYMENTS_NOTES']) { $eachpayment['note'] = zb_TranslatePaymentNote($eachpayment['note'], $allservicenames); } //hightlight of today payments if ($alter_conf['HIGHLIGHT_TODAY_PAYMENTS']) { if (ispos($eachpayment['date'], $curdate)) { $hlight = 'paytoday'; } else { $hlight = 'row3'; } } else { $hlight = 'row3'; } if (!empty($alter_conf['DOCX_SUPPORT']) && !empty($alter_conf['DOCX_CHECK'])) { $printcheck = wf_Link('?module=printcheck&paymentid=' . $eachpayment['id'], wf_img('skins/printer_small.gif', __('Print')), false); } else { $printcheck = wf_tag('a', false, '', 'href="#" onClick="window.open(\'?module=printcheck&paymentid=' . $eachpayment['id'] . '\',\'checkwindow\',\'width=800,height=600\')"'); $printcheck .= wf_img('skins/printer_small.gif', __('Print')); $printcheck .= wf_tag('a', true); } //payments deleting controls if ($iCanDeletePayments) { $deleteControls = wf_JSAlert('?module=addcash&username='******'&paymentdelete=' . $eachpayment['id'], wf_img('skins/delete_small.png', __('Delete')), __('Removing this may lead to irreparable results')) . ' '; } else { $deleteControls = ''; } //payments editing form if ($iCanEditPayments) { $editControls = wf_modalAuto(wf_img_sized('skins/icon_edit.gif', __('Edit'), '10'), __('Edit'), web_PaymentEditForm($eachpayment), '') . ' '; } else { $editControls = ''; } $cells = wf_TableCell($eachpayment['id']); $cells .= wf_TableCell(zb_NumEncode($eachpayment['id'])); $cells .= wf_TableCell($eachpayment['date']); $cells .= wf_TableCell($eachpayment['summ']); $cells .= wf_TableCell($eachpayment['balance']); $cells .= wf_TableCell(@__($alltypes[$eachpayment['cashtypeid']])); $cells .= wf_TableCell($eachpayment['note']); $cells .= wf_TableCell($eachpayment['admin']); $cells .= wf_TableCell($deleteControls . $editControls . $printcheck); $rows .= wf_TableRow($cells, $hlight); $total_payments = $total_payments + $eachpayment['summ']; } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); $result .= __('Total payments') . ': ' . wf_tag('b') . abs($total_payments) . wf_tag('b') . wf_tag('br'); return $result; }
function web_SignupsShowToday() { $query = "SELECT COUNT(`id`) from `userreg` WHERE `date` LIKE '" . curdate() . "%'"; $sigcount = simple_query($query); $sigcount = $sigcount['COUNT(`id`)']; show_window(__('Today signups') . ': ' . $sigcount, ''); }
/** * Renders default subscriptions report * * @return string */ public function renderSubscribtionsReportDaily() { $result = ''; $defaultDateTo = strtotime(curdate()) + 86400; $defaultDateTo = date("Y-m-d", $defaultDateTo); $inputs = wf_DatePickerPreset('datefrom', date("Y-m") . '-01', true); $inputs .= wf_DatePickerPreset('dateto', $defaultDateTo, true); $inputs .= wf_Submit(__('Show')); $result .= wf_Form('', 'POST', $inputs, 'glamour'); $dateFrom = wf_CheckPost(array('datefrom')) ? mysql_real_escape_string($_POST['datefrom']) : date("Y-m") . '-01'; $dateTo = wf_CheckPost(array('dateto')) ? mysql_real_escape_string($_POST['dateto']) : $defaultDateTo; $query = "SELECT * from `payments` WHERE `date` BETWEEN '" . $dateFrom . "' AND '" . $dateTo . "' AND `note` LIKE 'MEGOGO:%';"; $raw = simple_queryall($query); $totalSumm = 0; $tmpArr = array(); if (!empty($raw)) { foreach ($raw as $io => $each) { $tariffId = explode(':', $each['note']); $tariffId = $tariffId[1]; if (isset($tmpArr[$tariffId])) { $tmpArr[$tariffId]['summ'] = $tmpArr[$tariffId]['summ'] + abs($each['summ']); $tmpArr[$tariffId]['count']++; //try&buy user if ($each['summ'] == 0) { $tmpArr[$tariffId]['freeperiod']++; } } else { $tmpArr[$tariffId]['summ'] = abs($each['summ']); $tmpArr[$tariffId]['count'] = 1; //try&buy user if ($each['summ'] == 0) { $tmpArr[$tariffId]['freeperiod'] = 1; } else { $tmpArr[$tariffId]['freeperiod'] = 0; } } } if (!empty($tmpArr)) { $cells = wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Fee') . ' / ' . __('month')); $cells .= wf_TableCell(__('days')); $cells .= wf_TableCell(__('Free period')); $cells .= wf_TableCell(__('Total payments')); $cells .= wf_TableCell(__('Profit')); $rows = wf_TableRow($cells, 'row1'); foreach ($tmpArr as $io => $each) { $cells = wf_TableCell(@$this->allTariffs[$io]['name']); $cells .= wf_TableCell(@$this->allTariffs[$io]['fee']); $cells .= wf_TableCell($each['count']); $cells .= wf_TableCell($each['freeperiod']); $cells .= wf_TableCell($each['summ']); $cells .= wf_TableCell(zb_Percent($each['summ'], $this->altCfg['MG_PERCENT'])); $rows .= wf_TableRow($cells, 'row3'); $totalSumm = $totalSumm + $each['summ']; } $cells = wf_TableCell(wf_tag('b') . __('Total') . wf_tag('b', true)); $cells .= wf_TableCell(''); $cells .= wf_TableCell(''); $cells .= wf_TableCell(''); $cells .= wf_TableCell($totalSumm); $cells .= wf_TableCell(zb_Percent($totalSumm, $this->altCfg['MG_PERCENT'])); $rows .= wf_TableRow($cells, 'row2'); $result .= wf_TableBody($rows, '100%', 0, ''); } } else { $result .= $this->messages->getStyledMessage(__('Nothing found'), 'info'); } return $result; }
<th>Artikelnaam</th> <th>Omschrijving</th> <th>Verkoopprijs</th> <th>Afbeelding</th> <th>Aantal</th> <th>Subtotaal</th> <th>Verwijderen</th> </tr> </thead> <tbody> <?php if (isset($_POST['bestel'])) { unset($_POST['table_length']); unset($_POST['bestel']); $curedate = curdate(); global $db; $sth = $db->prepare("INSERT INTO bestelling (Datum, GebruikerID, Geexporteerd) VALUES (:curdate, :GebruikerID, 0)"); $sth->bindParam(":GebruikerID", $_SESSION['GebruikerID']); $sth->bindParam(":curdate", $curedate); $sth->execute(); $lastInsertId = $db->lastInsertId(); foreach ($_POST as $productid => $aantal) { $sth = $db->prepare("SELECT Verkoopprijs FROM product WHERE ProductID = :ProductID"); $sth->bindParam(":ProductID", $productid); $sth->execute(); $VerkoopPrijs = $sth->fetchAll(PDO::FETCH_ASSOC); $VerkoopPrijs = $VerkoopPrijs['0']['Verkoopprijs']; $Totaal = $VerkoopPrijs * $aantal; $sth = $db->prepare("INSERT INTO bestelling_product (BestellingID, ProductID, Aantal, Verkoopprijs, Totaalprijs) VALUES (:lastid, :ProductID, :Aantal, :Verkoopprijs, :Totaalprijs)"); $sth->bindParam(":lastid", $lastInsertId);
/** * returns payments search form * * @return string */ public function paymentSearchForm() { //try to save calendar states if (wf_CheckPost(array('datefrom', 'dateto'))) { $curdate = $_POST['dateto']; $yesterday = $_POST['datefrom']; } else { $curdate = date("Y-m-d", time() + 60 * 60 * 24); $yesterday = curdate(); } //try to save cashtype selector state if (wf_CheckPost(array('cashtypeid'))) { $currentCashtypeId = $_POST['cashtypeid']; } else { //cash money by default $currentCashtypeId = 1; } $allcashtypes = zb_CashGetAlltypes(); $cashTypesArr = array(); if (!empty($allcashtypes)) { foreach ($allcashtypes as $io => $each) { $cashTypesArr[$each['id']] = __($each['cashtype']); } } $cashTypesArr['any'] = __('Any'); $inputs = __('Date'); $inputs .= wf_DatePickerPreset('datefrom', $yesterday) . ' ' . __('From'); $inputs .= wf_DatePickerPreset('dateto', $curdate) . ' ' . __('To') . ' '; $inputs .= wf_Selector('cashtypeid', $cashTypesArr, __('Cash type'), $currentCashtypeId, false); $inputs .= wf_HiddenInput('dosearch', 'true'); $inputs .= wf_Submit(__('Search')); $result = wf_Form("", 'POST', $inputs, 'glamour'); return $result; }
/** * Replaces all known macro in template with per-user values for selected user * * @param string $login existing user login * @param string $template raw template * @param array $alluserdata collected userdata * @return string */ function zb_TemplateReplace($login, $template, $alluserdata) { $result = ''; if (!empty($alluserdata)) { $result .= $template; //known macro $result = str_ireplace('{LOGIN}', $alluserdata[$login]['login'], $result); $result = str_ireplace('{PASSWORD}', $alluserdata[$login]['password'], $result); $result = str_ireplace('{USERHASH}', $alluserdata[$login]['userhash'], $result); $result = str_ireplace('{TARIFF}', $alluserdata[$login]['tariff'], $result); $result = str_ireplace('{TARIFFPRICE}', $alluserdata[$login]['tariffprice'], $result); $result = str_ireplace('{CASH}', $alluserdata[$login]['cash'], $result); $result = str_ireplace('{ROUNDCASH}', round($alluserdata[$login]['cash'], 2), $result); $result = str_ireplace('{CURDATE}', curdate(), $result); $result = str_ireplace('{CREDIT}', $alluserdata[$login]['credit'], $result); $result = str_ireplace('{DOWN}', $alluserdata[$login]['down'], $result); $result = str_ireplace('{PASSIVE}', $alluserdata[$login]['passive'], $result); $result = str_ireplace('{AO}', $alluserdata[$login]['ao'], $result); $result = str_ireplace('{CONTRACT}', $alluserdata[$login]['contract'], $result); $result = str_ireplace('{REALNAME}', $alluserdata[$login]['realname'], $result); $result = str_ireplace('{ADDRESS}', $alluserdata[$login]['address'], $result); $result = str_ireplace('{EMAIL}', $alluserdata[$login]['email'], $result); $result = str_ireplace('{PAYID}', $alluserdata[$login]['payid'], $result); $result = str_ireplace('{TRAFFIC}', $alluserdata[$login]['traffic'], $result); $result = str_ireplace('{TRAFFICDOWN}', $alluserdata[$login]['trafficdown'], $result); $result = str_ireplace('{TRAFFICUP}', $alluserdata[$login]['trafficup'], $result); $result = str_ireplace('{IP}', $alluserdata[$login]['ip'], $result); $result = str_ireplace('{MAC}', $alluserdata[$login]['mac'], $result); $result = str_ireplace('{NETID}', $alluserdata[$login]['netid'], $result); $result = str_ireplace('{HOSTID}', $alluserdata[$login]['hostid'], $result); $result = str_ireplace('{NASID}', $alluserdata[$login]['nasid'], $result); $result = str_ireplace('{NASIP}', $alluserdata[$login]['nasip'], $result); $result = str_ireplace('{NASNAME}', $alluserdata[$login]['nasname'], $result); $result = str_ireplace('{NASTYPE}', $alluserdata[$login]['nastype'], $result); $result = str_ireplace('{SPEEDDOWN}', $alluserdata[$login]['speeddown'], $result); $result = str_ireplace('{SPEEDUP}', $alluserdata[$login]['speedup'], $result); $result = str_ireplace('{PBIRTH}', $alluserdata[$login]['birthdate'], $result); $result = str_ireplace('{PNUM}', $alluserdata[$login]['passportnum'], $result); $result = str_ireplace('{PDATE}', $alluserdata[$login]['passportdate'], $result); $result = str_ireplace('{PWHO}', $alluserdata[$login]['passportwho'], $result); $result = str_ireplace('{PCITY}', $alluserdata[$login]['pcity'], $result); $result = str_ireplace('{PSTREET}', $alluserdata[$login]['pstreet'], $result); $result = str_ireplace('{PBUILD}', $alluserdata[$login]['pbuild'], $result); $result = str_ireplace('{PAPT}', $alluserdata[$login]['papt'], $result); //custom fields extract if (ispos($result, '{CFIELD:')) { $split = explode('{CFIELD:', $result); $cfid = vf($split[1], 3); $result = str_ireplace('{CFIELD:' . $cfid . '}', @$alluserdata[$login]['cf'][$cfid], $result); } //print macro $printsub = '<script language="javascript"> window.print(); </script>'; $result = str_ireplace('{PRINTME}', $printsub, $result); } return $result; }
function catv_FinanceReport() { if (!isset($_POST['yearsel'])) { $show_year = curyear(); } else { $show_year = $_POST['yearsel']; } $dateform = ' <form action="?module=catv&action=reports&showreport=finance" method="POST"> ' . web_CalendarControl('showdatepayments') . ' <input type="submit" value="' . __('Show') . '"> </form> <br> '; $yearform = ' <form action="?module=catv&action=reports&showreport=finance" method="POST"> ' . web_year_selector() . ' <input type="submit" value="' . __('Show') . '"> </form> '; show_window(__('Year'), $yearform); show_window(__('Payments by date'), $dateform); catv_PaymentsShowGraph($show_year); if (!isset($_GET['month'])) { // payments by somedate if (isset($_POST['showdatepayments'])) { $paydate = mysql_real_escape_string($_POST['showdatepayments']); //deb($paydate); show_window(__('Payments by date') . ' ' . $paydate, catv_PaymentsShow("SELECT * from `catv_payments` WHERE `date` LIKE '" . $paydate . "%'")); } else { // today payments $today = curdate(); show_window(__('Today payments'), catv_PaymentsShow("SELECT * from `catv_payments` WHERE `date` LIKE '" . $today . "%'")); } } else { // show monthly payments $paymonth = mysql_real_escape_string($_GET['month']); show_window(__('Month payments'), catv_PaymentsShow("SELECT * from `catv_payments` WHERE `date` LIKE '" . $paymonth . "%'")); } }
/** * Renders export form body * * @return string */ function zb_ExportForm() { $curdate = curdate(); $yesterday = date("Y-m-d", time() - 86400); $inputs = __('From'); $inputs .= wf_DatePickerPreset('fromdate', $yesterday); $inputs .= __('To'); $inputs .= wf_DatePickerPreset('todate', $curdate); $inputs .= wf_Submit('Export'); $form = wf_Form("", 'POST', $inputs, 'glamour'); return $form; }
/** * Do some search actions by captured POST request * * @return array */ public function commonSearch() { $result = array(); if (wf_CheckPost(array('datefrom', 'dateto'))) { $dateFrom = mysql_real_escape_string($_POST['datefrom']); $dateTo = mysql_real_escape_string($_POST['dateto']); $baseQuery = "SELECT * from `taskman` WHERE `startdate` BETWEEN '" . $dateFrom . "' AND '" . $dateTo . "' "; $appendQuery = ''; //task id if (wf_CheckPost(array('cb_id', 'taskid'))) { $taskid = vf($_POST['taskid'], 3); $appendQuery .= " AND `id`='" . $taskid . "' "; } //more than some days count if (wf_CheckPost(array('cb_taskdays', 'taskdays'))) { $taskdays = vf($_POST['taskdays'], 3); $appendQuery .= " AND DATEDIFF(`enddate`, `startdate`) > '" . $taskdays . "' "; } //task address non strict if (wf_CheckPost(array('cb_taskaddress', 'taskaddress'))) { $taskaddress = mysql_real_escape_string($_POST['taskaddress']); $appendQuery .= " AND `address` LIKE '%" . $taskaddress . "%' "; } //task phone non strict if (wf_CheckPost(array('cb_taskphone', 'taskphone'))) { $taskphone = mysql_real_escape_string($_POST['taskphone']); $appendQuery .= " AND `phone` LIKE '%" . $taskphone . "%' "; } //original task employee if (wf_CheckPost(array('cb_employee', 'employee'))) { $employee = mysql_real_escape_string($_POST['employee']); $appendQuery .= " AND `employee`='" . $employee . "' "; } //original task employeedone if (wf_CheckPost(array('cb_employeedone', 'employeedone'))) { $employeedone = mysql_real_escape_string($_POST['employeedone']); $appendQuery .= " AND `employeedone`='" . $employeedone . "' "; } //address duplicate search if (wf_CheckPost(array('cb_duplicateaddress'))) { // $appendQuery.=" AND `address` IN (SELECT `address` FROM `taskman` WHERE `startdate` BETWEEN '" . $dateFrom . "' AND '" . $dateTo . "' GROUP BY `address` HAVING COUNT(*) > 1) "; $baseQuery = "SELECT st1.*, st2.`address` FROM `taskman` st1 INNER JOIN taskman st2 ON (st2.`startdate` BETWEEN '" . $dateFrom . "' AND '" . $dateTo . "' AND st1.address = st2.address) GROUP BY st1.id HAVING COUNT(*) > 1 AND `startdate` BETWEEN '" . $dateFrom . "' AND '" . $dateTo . "' "; } //late jobs if (wf_CheckPost(array('cb_showlate'))) { $curdate = curdate(); $appendQuery .= " AND `status`='0' AND `startdate`< '" . $curdate . "' "; } //only done jobs if (wf_CheckPost(array('cb_onlydone'))) { $appendQuery .= " AND `status`='1' "; } //only undone jobs if (wf_CheckPost(array('cb_onlyundone'))) { $appendQuery .= " AND `status`='0' "; } $query = $baseQuery . $appendQuery; // deb($query); $raw = simple_queryall($query); if (!empty($raw)) { foreach ($raw as $io => $each) { $result[$each['id']] = $each; } } //salary no jobs processing/excluding if (wf_CheckPost(array('cb_nosalsaryjobs'))) { $salaryTasks = array(); $greed = new Avarice(); $beggar = $greed->runtime('SALARY'); if (!empty($beggar)) { $querySalaryJobs = "SELECT `id`,`taskid` from `salary_jobs`"; $salaryJobsRaw = simple_queryall($querySalaryJobs); if (!empty($salaryJobsRaw)) { foreach ($salaryJobsRaw as $io => $each) { if (!empty($each['taskid'])) { $salaryTasks[$each['taskid']] = $each['id']; } } } if (!empty($salaryTasks)) { foreach ($salaryTasks as $jobTaskid => $eachJobId) { if (isset($result[$jobTaskid])) { unset($result[$jobTaskid]); } } } } else { show_error(__('No license key available')); } } } return $result; }
/** * Shows salary summary report * * @return void */ public function summaryReport() { $result = ''; if ($_SERVER['QUERY_STRING'] == 'module=salary') { $messages = new UbillingMessageHelper(); if (empty($this->allEmployee)) { $result .= $messages->getStyledMessage(__('No available workers for wage creation'), 'error'); } else { $result .= $messages->getStyledMessage(__('Total existing employees') . ': ' . sizeof($this->allEmployee), 'info'); } if (empty($this->allJobtypes)) { $result .= $messages->getStyledMessage(__('No available job types for pricing'), 'error'); } else { $result .= $messages->getStyledMessage(__('Total existing job types') . ': ' . sizeof($this->allJobtypes), 'info'); } if (empty($this->allJobPrices)) { $result .= $messages->getStyledMessage(__('There is no set prices for job types'), 'warning'); } else { $result .= $messages->getStyledMessage(__('Total paid types of work') . ': ' . sizeof($this->allJobPrices), 'info'); } if (empty($this->allWages)) { $result .= $messages->getStyledMessage(__('There is no set wages for workers'), 'warning'); } if (empty($this->allJobs)) { $result .= $messages->getStyledMessage(__('Not done yet any paid work'), 'warning'); } else { $todayJobs = $this->jobsFilterDate(curdate()); $todayJobsCount = sizeof($todayJobs); $monthJobs = $this->jobsFilterDate(curmonth()); $monthJobsCount = sizeof($monthJobs); $result .= $messages->getStyledMessage(__('Today performed paid work') . ': ' . $todayJobsCount, 'success'); $result .= $messages->getStyledMessage(__('Month performed paid work') . ': ' . $monthJobsCount, 'success'); $result .= $messages->getStyledMessage(__('Total performed paid work') . ': ' . sizeof($this->allJobs), 'success'); } if (empty($this->allTimesheetDates)) { $result .= $messages->getStyledMessage(__('No filled timesheets'), 'warning'); } else { if (!isset($this->allTimesheetDates[curdate()])) { $result .= $messages->getStyledMessage(__('For today is not filled timesheets'), 'warning'); } else { $result .= $messages->getStyledMessage(__('For today timesheets is filled'), 'success'); } $result .= $messages->getStyledMessage(__('Filled timesheets for') . ' ' . sizeof($this->allTimesheetDates) . ' ' . __('days'), 'success'); } if (!empty($result)) { show_window(__('Stats'), $result); } } }
if ($altcfg['AGENTS_ASSIGN'] == '2') { $controlcells .= wf_TableCell(wf_Link("?module=report_agentfinance", wf_img('skins/corporate_small.png') . ' ' . __('Search'), false, 'ubButton')); } $controlrows .= wf_TableRow($controlcells); $controlgrid = wf_TableBody($controlrows, '100%', 0, ''); show_window('', $controlgrid); web_PaymentsShowGraph($show_year); if (!isset($_GET['month'])) { // payments by somedate if (isset($_POST['showdatepayments'])) { $paydate = mysql_real_escape_string($_POST['showdatepayments']); $paydate = !empty($paydate) ? $paydate : curdate(); show_window(__('Payments by date') . ' ' . $paydate, web_PaymentsShow("SELECT * from `payments` WHERE `date` LIKE '" . $paydate . "%' ORDER by `date` DESC;")); } else { // today payments $today = curdate(); show_window(__('Today payments'), web_PaymentsShow("SELECT * from `payments` WHERE `date` LIKE '" . $today . "%' ORDER by `date` DESC;")); } } else { // show monthly payments $paymonth = mysql_real_escape_string($_GET['month']); show_window(__('Month payments'), web_PaymentsShow("SELECT * from `payments` WHERE `date` LIKE '" . $paymonth . "%' ORDER by `date` DESC;")); } } else { //show finance analytics info if (wf_CheckPost(array('anyearsel'))) { $currentYear = $_POST['anyearsel']; } else { $currentYear = date("Y"); } $yearinputs = wf_YearSelectorPreset('anyearsel', __('Year'), false, $currentYear) . ' ';
/** * 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') . ' (' . __('middle price') . ': ' . $this->getIncomeMiddlePrice($itemtypeid) . ')', '', 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(); if (cfr('WAREHOUSERESERVE')) { $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 docsis_ModemAdd($maclan) { $maclan = mysql_real_escape_string($maclan); //random mac for usb $macusb = '14:' . '88' . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99); $altercfg = rcms_parse_ini_file(CONFIG_PATH . '/alter.ini'); $netid = $altercfg['DOCSIS_MODEM_NETID']; $nextfreeip = multinet_get_next_freeip('nethosts', 'ip', $netid); $note = ''; $userbind = ''; $basetemplate = 'short'; $date = curdate(); //check for free ip in subnet if (!empty($nextfreeip)) { $nic = str_replace('.', 'x', $nextfreeip); //check is mac unique? if (multinet_mac_free($maclan) and check_mac_format($maclan)) { $query = "INSERT INTO `modems` (\n `id` ,\n `maclan` ,\n `macusb` ,\n `date` ,\n `ip` ,\n `conftemplate` ,\n `userbind` ,\n `nic` ,\n `note`\n )\n VALUES (\n NULL , '" . $maclan . "', '" . $maclan . "', '" . $date . "', '" . $nextfreeip . "', '" . $basetemplate . "', '' , '" . $nic . "', ''\n );"; nr_query($query); $lastid = simple_get_lastid('modems'); log_register("DOCSIS MODEM ADD MAC" . $maclan . " IP " . $nextfreeip . "[" . $lastid . "]"); multinet_add_host($netid, $nextfreeip, $maclan, ''); multinet_rebuild_all_handlers(); rcms_redirect("?module=docsis&showmodem=" . $lastid); } else { show_window(__('Error'), __('This MAC is currently used') . ' ' . __('This MAC have wrong format')); } } else { show_window(__('Error'), __('No free IP available in selected pool')); } }
/** * Renders ONU signal history chart * * @param int $onuId * @return string */ protected function onuSignalHistory($onuId) { $onuId = vf($onuId, 3); $result = ''; if (isset($this->allOnu[$onuId])) { //not empty MAC if ($this->allOnu[$onuId]['mac']) { if (file_exists(self::ONUSIG_PATH . md5($this->allOnu[$onuId]['mac']))) { $historyKey = self::ONUSIG_PATH . md5($this->allOnu[$onuId]['mac']); } elseif (file_exists(self::ONUSIG_PATH . md5($this->allOnu[$onuId]['serial']))) { $historyKey = self::ONUSIG_PATH . md5($this->allOnu[$onuId]['serial']); } else { $historyKey = ''; } if (!empty($historyKey)) { $rawData = file_get_contents($historyKey); $result .= wf_delimiter(); $result .= wf_tag('h2') . __('ONU signal history') . wf_tag('h2', true); //current day signal levels $todaySignal = ''; $curdate = curdate(); if (!empty($rawData)) { $todayTmp = explodeRows($rawData); if (!empty($todayTmp)) { foreach ($todayTmp as $io => $each) { if (ispos($each, $curdate)) { $todaySignal .= $each . "\n"; } } } } $result .= __('Today'); $result .= wf_tag('div', false, '', ''); $result .= wf_Graph($todaySignal, '800', '300', false); $result .= wf_tag('div', true); $result .= wf_tag('br'); //current month signal levels $monthSignal = ''; $curmonth = curmonth(); if (!empty($rawData)) { $monthTmp = explodeRows($rawData); if (!empty($monthTmp)) { foreach ($monthTmp as $io => $each) { if (ispos($each, $curmonth)) { $monthSignal .= $each . "\n"; } } } } $result .= __('Month'); $result .= wf_tag('div', false, '', ''); $result .= wf_Graph($monthSignal, '800', '300', false); $result .= wf_tag('div', true); $result .= wf_tag('br'); //all time signal history $result .= __('All time'); $result .= wf_tag('div', false, '', ''); $result .= wf_GraphCSV($historyKey, '800', '300', false); $result .= wf_tag('div', true); } } } return $result; }
function web_AskoziaDateForm() { $inputs = wf_Link("?module=askozia&config=true", wf_img('skins/settings.png', __('Settings'))) . ' '; $inputs .= wf_DatePickerPreset('datefrom', curdate()) . ' ' . __('From'); $inputs .= wf_DatePickerPreset('dateto', curdate()) . ' ' . __('To'); $inputs .= wf_Submit(__('Show')); $result = wf_Form("", "POST", $inputs, 'glamour'); return $result; }
public function showSMSqueue() { $smsPath = 'content/tsms/'; $tsms_host = $this->settings['WATCHDOG_TSMS_GATEWAY']; $tsms_db = 'users'; $tsms_login = $this->settings['WATCHDOG_TSMS_LOGIN']; $tsms_password = $this->settings['WATCHDOG_TSMS_PASSWORD']; $tsms_table = $this->settings['WATCHDOG_TSMS_LOGIN']; $smsArray = array(); $TsmsDB = new DbConnect($tsms_host, $tsms_login, $tsms_password, $tsms_db, $error_reporting = true, $persistent = false); $TsmsDB->open() or die($TsmsDB->error()); $TsmsDB->query('SET NAMES utf8;'); if (wf_CheckPost(array('showdate'))) { $date = mysql_real_escape_string($_POST['showdate']); } else { $date = ''; } if (!empty($date)) { $where = " WHERE `send_time` LIKE '" . $date . "%' ORDER BY `id` DESC;"; } else { $where = ' ORDER BY `id` DESC LIMIT 50;'; } $query = "SELECT * from `" . $tsms_table . "`" . $where; $TsmsDB->query($query); while ($row = $TsmsDB->fetchassoc()) { $smsArray[] = $row; } //close old datalink $TsmsDB->close(); //rendering result $inputs = wf_DatePickerPreset('showdate', curdate()); $inputs .= wf_Submit(__('Show')); $dateform = wf_Form("", 'POST', $inputs, 'glamour'); $lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" '; $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Msg ID')); $cells .= wf_TableCell(__('Mobile')); $cells .= wf_TableCell(__('Sign')); $cells .= wf_TableCell(__('Message')); $cells .= wf_TableCell(__('WAP')); $cells .= wf_TableCell(__('Cost')); $cells .= wf_TableCell(__('Send time')); $cells .= wf_TableCell(__('Sended')); $cells .= wf_TableCell(__('Status')); $rows = wf_TableRow($cells, 'row1'); if (!empty($smsArray)) { foreach ($smsArray as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($each['msg_id']); $cells .= wf_TableCell($each['number']); $cells .= wf_TableCell($each['sign']); $msg = wf_modal(__('Show'), __('SMS'), $each['message'], '', '300', '200'); $cells .= wf_TableCell($msg); $cells .= wf_TableCell($each['wappush']); $cells .= wf_TableCell($each['cost']); $cells .= wf_TableCell($each['send_time']); $cells .= wf_TableCell($each['sended']); $cells .= wf_TableCell($each['status']); $rows .= wf_tag('tr', false, 'row3', $lighter); $rows .= $cells; $rows .= wf_tag('tr', true); } } $result = $dateform; $result .= wf_TableBody($rows, '100%', '0', 'sortable'); return $result; }
/** * Returns server system information * * @return array */ protected function getSystemInformation() { $result = array(); $curdate = curdate(); $operatingSystem = shell_exec('uname'); $billingVersion = file_get_contents('RELEASE'); $result['date'] = $curdate; $result['os'] = trim($operatingSystem); $result['billing']['name'] = 'Ubilling'; $result['billing']['version'] = trim($billingVersion); return $result; }
/** * Askozia PBX data fetching and processing * * @return void */ protected function preprocessAskoziaData() { if ($this->askoziaFlag) { if (!empty($this->askoziaUrl) and !empty($this->askoziaLogin) and !empty($this->askoziaPassword)) { $callsTmp = array(); $normalCalls = array(); //working time setup $rawWorkTime = $this->altCfg['WORKING_HOURS']; $rawWorkTime = explode('-', $rawWorkTime); $workStartTime = $rawWorkTime[0]; $workEndTime = $rawWorkTime[1]; $fields = array('extension_number' => 'all', 'cdr_filter' => 'incomingoutgoing', 'period_from' => $this->curmonth . '-01', 'period_to' => curdate(), 'date_format' => 'Y-m-d', 'time_format' => 'H:i:s', 'page_format' => 'A4', 'SubmitCSVCDR' => 'Download CSV'); $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $this->askoziaUrl . '/status_cdr.php'); curl_setopt($ch, CURLOPT_USERPWD, $this->askoziaLogin . ":" . $this->askoziaPassword); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); $rawResult = curl_exec($ch); curl_close($ch); if (!empty($rawResult)) { $callsTmp = explodeRows($rawResult); if (!empty($callsTmp)) { foreach ($callsTmp as $eachline) { $explode = explode(';', $eachline); //in 2.2.8 delimiter changed from ," to ; if (!empty($eachline)) { $normalCalls[] = str_replace('"', '', $explode); } } } if (!empty($normalCalls)) { unset($normalCalls[0]); foreach ($normalCalls as $io => $each) { if ($each[16] != 'outbound') { $startTime = explode(' ', $each[9]); @($startTime = $startTime[1]); //only working time if (zb_isTimeBetween($workStartTime, $workEndTime, $startTime)) { if (ispos($each[14], 'ANSWERED') and !ispos($each[7], 'VoiceMail')) { $this->storeTmp['a_totalanswered']++; } $this->storeTmp['a_totalcalls']++; //call duration in seconds increment $this->storeTmp['a_totalcallsduration'] += $each[13]; } } } //average calls duration $this->storeTmp['a_averagecallduration'] = $this->storeTmp['a_totalcallsduration'] / $this->storeTmp['a_totalanswered']; } } } } }
/** * Shows signups performed today * * @return void */ function web_SignupsShowToday() { $messages = new UbillingMessageHelper(); $query = "SELECT COUNT(`id`) from `userreg` WHERE `date` LIKE '" . curdate() . "%'"; $sigcount = simple_query($query); $sigcount = $sigcount['COUNT(`id`)']; show_window('', $messages->getStyledMessage(__('Today signups') . ': ' . wf_tag('strong') . $sigcount . wf_tag('strong', true), 'info')); }
/** * renders finance report * * @return void */ public function reportFinance() { $show_year = !wf_CheckPost(array('yearsel')) ? curyear() : $_POST['yearsel']; $dateSelectorPreset = wf_CheckPost(array('showdatepayments')) ? $_POST['showdatepayments'] : curdate(); $dateinputs = wf_DatePickerPreset('showdatepayments', $dateSelectorPreset); $dateinputs .= wf_Submit(__('Show')); $dateform = wf_Form(self::URL_REPORTS_MGMT . 'reportFinance', 'POST', $dateinputs, 'glamour'); $yearinputs = wf_YearSelector('yearsel'); $yearinputs .= wf_Submit(__('Show')); $yearform = wf_Form(self::URL_REPORTS_MGMT . 'reportFinance', 'POST', $yearinputs, 'glamour'); $controlcells = wf_TableCell(wf_tag('h3', false, 'title') . __('Year') . wf_tag('h3', true)); $controlcells .= wf_TableCell(wf_tag('h3', false, 'title') . __('Payments by date') . wf_tag('h3', true)); $controlcells .= wf_TableCell(wf_tag('h3', false, 'title') . __('Debt') . wf_tag('h3', true)); $controlrows = wf_TableRow($controlcells); $controlcells = wf_TableCell($yearform); $controlcells .= wf_TableCell($dateform); //extract total debt summ $debt_q = "SELECT SUM(`cash`) as `totaldebt`, COUNT(`id`) as `debtcount` from `ukv_users` WHERE `cash`<0"; $totalDebt = simple_query($debt_q); $debtData = __('Cash') . ': ' . wf_tag('b') . $totalDebt['totaldebt'] . wf_tag('b', true) . wf_tag('br'); $debtData .= __('Count') . ': ' . wf_tag('b') . $totalDebt['debtcount'] . wf_tag('b', true); $controlcells .= wf_TableCell($debtData); $controlrows .= wf_TableRow($controlcells); $controlgrid = wf_TableBody($controlrows, '100%', 0, ''); show_window('', $controlgrid); //show per month report $this->paymentsShowGraph($show_year); if (!isset($_GET['month'])) { // payments by somedate if (isset($_POST['showdatepayments'])) { $paydate = mysql_real_escape_string($_POST['showdatepayments']); $paydate = !empty($paydate) ? $paydate : curdate(); show_window(__('Payments by date') . ' ' . $paydate, $this->paymentsShow("SELECT * from `ukv_payments` WHERE `date` LIKE '" . $paydate . "%' AND `visible`='1' ORDER by `date` DESC;")); } else { // today payments $today = curdate(); show_window(__('Today payments'), $this->paymentsShow("SELECT * from `ukv_payments` WHERE `date` LIKE '" . $today . "%' AND `visible`='1' ORDER by `date` DESC;")); } } else { // show monthly payments $paymonth = mysql_real_escape_string($_GET['month']); show_window(__('Month payments'), $this->paymentsShow("SELECT * from `ukv_payments` WHERE `date` LIKE '" . $paymonth . "%' AND `visible`='1' ORDER by `date` DESC;")); } }
/** * Returns count of undone tasks only for current admin login - used by DarkVoid * * @return int */ function ts_GetUndoneCountersMy() { $result = 0; $curdate = curdate(); $curyear = curyear(); $mylogin = whoami(); $adminQuery = "SELECT `id` from `employee` WHERE `admlogin`='" . $mylogin . "'"; $adminId = simple_query($adminQuery); if (!empty($adminId)) { $adminId = $adminId['id']; $query = "SELECT `id` from `taskman` WHERE `employee`='" . $adminId . "' AND `status` = '0' AND `startdate` <= '" . $curdate . "' AND `date` LIKE '" . $curyear . "-%';"; $allundone = simple_queryall($query); if (!empty($allundone)) { $result = sizeof($allundone); } } return $result; }