function getLastIndicadores($customerID, $indType, $nPassado = 1) { // buscando a data da última carga desse customer/type $param = array(); $param[] = $customerID; $param[] = $indType; $ultimaCarga = sqlTop('main', "\r\n\t\t\tSELECT MIN(ind_datetime) data \r\n\t\t\tFROM (\r\n\t\t\t\tSELECT DISTINCT ind_datetime\r\n\t\t\t\tFROM indicators \r\n\t\t\t\tWHERE ind_customer_id = ? AND ind_type_id = ?\r\n\t\t\t\tORDER BY ind_datetime DESC\r\n\t\t\t\tLIMIT {$nPassado}\r\n\t\t\t) A\r\n\t\t", $param); // buscando todos os registros dessa última carga $param = array(); $param[] = $ultimaCarga['data']; $param[] = $customerID; $param[] = $indType; $busca = sqlQuery('main', ' SELECT * FROM indicators WHERE ind_datetime >= ? AND ind_customer_id = ? AND ind_type_id = ? ', $param); return $busca; }
$busca = sqlQuery('main', ' SELECT DISTINCT tkt_status_name FROM trouble_tickets A WHERE A.tkt_customer_id = ? ORDER BY 1 ', $customerID); foreach ($busca['rows'] as $x) { $vl = $x['tkt_status_name']; $status[$vl] = $vl; } // ====================================================== // DATAS // ====================================================== $x = sqlTop('main', ' SELECT Min(DATE(tkt_open_date)) data_inicio FROM trouble_tickets WHERE tkt_customer_id = ? ', $customerID); $datas = array(); $datas['min'] = date('Y-m-d', strtotime($x['data_inicio'])); $datas['max'] = date('Y-m-d'); // ====================================================== // MENU - CLIENTES // ====================================================== $customers = mySx('customers'); if (count($customers) > 1) { $i++; $gs[$i] = new Sidebar_Group('OUTROS CLIENTES'); foreach ($customers as $x) { if ($x['id_customers'] != mySx('customerID')) { $gs[$i]->addLink(new Sidebar_Link($x['cus_name'], 'fa-user', 'customer' . $x['id_customers'], "?ct={$x['id_customers']}"));
<?php $user = mySx('user'); ?> <style> .main-header .logo { line-height:45px; } </style> <header class="main-header"> <!-- Logo --> <a class="logo" style='padding:0px 3px; text-align:left'> <?php $customerID = mySx('customerID'); $cust = sqlTop('main', 'SELECT * FROM customers WHERE id_customers = ?', $customerID); $parts = explode(' ', $cust['cus_name']); $bold = array_shift($parts); $rest = implode(' ', $parts); $logoClient = "<img src='../images/logocliente{$customerID}.png' style='width:40px'>"; echo "<span style='margin-left:10px'><b>{$bold}</b> {$rest}</span>"; ?> </a> <!-- Header Navbar: style can be found in header.less --> <nav class="navbar navbar-static-top" role="navigation"> <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> <span class="sr-only">Toggle navigation</span> </a> <div class='navbar-menu' style='float:left'>
function request_getMaxValue($request) { foreach ($request as $campo => $valor) { ${$campo} = $valor; } $top = sqlTop('main', "SELECT MAX({$ordered}) v FROM {$tabela}"); return $top ? $top['v'] : 0; }