Browse Source

Adicionei a coluna e filtro 'entrada' no Relatorio de Chamadas Entrantes Geral

1.8-dev
Claudio Zimmermann Junior 3 months ago committed by bruno
parent
commit
cb18b0bd63
  1. 2
      include/configBd.php
  2. 128
      include/util/relatoriosBase.php
  3. 599
      include/util/util.php
  4. 775
      relatorios/pbx/chamadasEntrantes/chamadasEntrantesGeral.php

2
include/configBd.php

@ -3,7 +3,7 @@
* configuração para acesso ao banco de dados principal da aplicação.
*/
$dbPort = getenv('DB_PORT') ? getenv('DB_PORT') : '5432';
$dbHost = getenv('DB_HOST') ? getenv('DB_HOST') : '127.0.0.1';
$dbHost = getenv('DB_HOST') ? getenv('DB_HOST') : 'postgres';
$dbName = getenv('DB_BASE') ? getenv('DB_BASE') : 'pbx';
$dbUser = getenv('DB_USER') ? getenv('DB_USER') : 'contacte';
$dbPassword = getenv('DB_PASSWD') ? getenv('DB_PASSWD') : 'ctepgSQL';

128
include/util/relatoriosBase.php

@ -6,7 +6,8 @@ use PhpOffice\PhpSpreadsheet\Writer\Xls;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
abstract class Relatorios {
abstract class Relatorios
{
/*
* Valores globais para dados de formul?rio.
*/
@ -27,14 +28,16 @@ abstract class Relatorios {
private $idProg;
private $dbcon;
public function __construct($idProg, $dbcon, $incDac) {
public function __construct($idProg, $dbcon, $incDac)
{
$this->idProg = $idProg;
$this->dbcon = $dbcon;
$this->___incDac = $incDac;
$this->___InicializaForm();
}
protected function ___GetQuery($query) {
protected function ___GetQuery($query)
{
$result = pg_query($query);
if (!$result) {
GeraExcept("Não foi possível executar a consulta no banco de dados!");
@ -42,7 +45,8 @@ abstract class Relatorios {
return $result;
}
public function ___ValidaForm() {
public function ___ValidaForm()
{
if (!IsPostBack())
return;
@ -69,7 +73,8 @@ abstract class Relatorios {
}
}
protected function ___InicializaForm() {
protected function ___InicializaForm()
{
/*
* Dados de formul?rio.
*/
@ -113,12 +118,13 @@ abstract class Relatorios {
$this->___pathLog = sprintf("/var/log/asterisk/relatorio_%s.log", $scrpName);
}
protected function ___FiltrosRelatorio() {
protected function ___FiltrosRelatorio()
{
if ($this->___media != MEDIA_PRINT_GRID) {
/*
* Recupera os filtros da sess�o do usu�rio.
*/
list( $this->___dac, $this->___dataIni, $this->___dataFim) = $_SESSION["SSstorageFiltros"];
list($this->___dac, $this->___dataIni, $this->___dataFim) = $_SESSION["SSstorageFiltros"];
if ($this->___media == MEDIA_PRINT_HTML) {
$fila = $this->GetIncDac() ? ('Fila:' . GetDacDesc($this->dbcon, $this->idProg) . ' ') : '';
@ -184,7 +190,8 @@ abstract class Relatorios {
return sprintf($filtro, $this->___dataIni, $this->___dataFim, $lkPrint);
}
public function ___ConteudoRelatorio() {
public function ___ConteudoRelatorio()
{
if ($this->___media == MEDIA_PRINT_GRID) {
$this->___GetDadosDb();
SaveVarToFile($this->___data, $this->___dataFile);
@ -194,23 +201,29 @@ abstract class Relatorios {
$this->___PreparaData();
}
$this->___dataCount = count($this->___data[0]?? []);
$this->___dataCount = count($this->___data[0] ?? []);
}
public function ___ImprimeRelatorio() {
public function ___ImprimeRelatorio()
{
switch ($this->___media) {
//case MEDIA_PRINT_HTML: return $this->___ImprimeHtml();
case MEDIA_PRINT_HTML: return $this->___ImprimePdf("I");
case MEDIA_PRINT_PDF: return $this->___ImprimePdf("D");
case MEDIA_PRINT_EXCEL: return $this->___ImprimeExcel();
case MEDIA_PRINT_CSV: return $this->___ImprimeCsv();
//case MEDIA_PRINT_HTML: return $this->___ImprimeHtml();
case MEDIA_PRINT_HTML:
return $this->___ImprimePdf("I");
case MEDIA_PRINT_PDF:
return $this->___ImprimePdf("D");
case MEDIA_PRINT_EXCEL:
return $this->___ImprimeExcel();
case MEDIA_PRINT_CSV:
return $this->___ImprimeCsv();
default:
return $this->___ImprimeGrid();
}
}
protected function ___GravaLog($erro = true) {
protected function ___GravaLog($erro = true)
{
$erroSys = error_get_last();
$erroSys = sprintf("Msg: %s Line: %s", $erroSys['message'], $erroSys['line']);
$erroBd = pg_last_error();
@ -220,7 +233,8 @@ abstract class Relatorios {
fclose($arq);
}
private function ___GetScptName() {
private function ___GetScptName()
{
$query = sprintf("select arquivo from pbx_funcoes_internas where id_prog = '%s'", $this->idProg);
$result = pg_query($query);
$row = pg_fetch_row($result);
@ -228,20 +242,26 @@ abstract class Relatorios {
return $path['filename'];
}
private function ___PreparaData() {
private function ___PreparaData()
{
switch ($this->___media) {
// case MEDIA_PRINT_HTML: $this->___PreparaHtml();
// break;
case MEDIA_PRINT_HTML: $this->___PreparaPdf();
// case MEDIA_PRINT_HTML: $this->___PreparaHtml();
// break;
case MEDIA_PRINT_HTML:
$this->___PreparaPdf();
break;
case MEDIA_PRINT_PDF: $this->___PreparaPdf();
case MEDIA_PRINT_PDF:
$this->___PreparaPdf();
break;
case MEDIA_PRINT_EXCEL: $this->___PreparaExcel();
case MEDIA_PRINT_EXCEL:
$this->___PreparaExcel();
break;
case MEDIA_PRINT_CSV: $this->___PreparaCsv();
case MEDIA_PRINT_CSV:
$this->___PreparaCsv();
break;
default:
case MEDIA_PRINT_GRID: $this->___PreparaGrid();
case MEDIA_PRINT_GRID:
$this->___PreparaGrid();
break;
}
}
@ -256,7 +276,8 @@ abstract class Relatorios {
abstract protected function ___PreparaGrid();
private function ___ImprimeGrid() {
private function ___ImprimeGrid()
{
$fh = fopen('php://memory', 'rw');
$numTable = 0;
@ -280,7 +301,8 @@ abstract class Relatorios {
return stream_get_contents($fh);
}
private function ___ImprimeHtml() {
private function ___ImprimeHtml()
{
$fh = fopen('php://memory', 'rw');
$numTable = 0;
@ -313,10 +335,12 @@ abstract class Relatorios {
exit(0);
}
private function ___GetTemplate($filtros, $conteudoRelatorio) {
private function ___GetTemplate($filtros, $conteudoRelatorio)
{
$pathTpl = $_SESSION[PATH_ABSOLUTO] . 'templates/relbasehtml.tpl';
$vars = array('tituloPage' => GetDispProgSel($this->idProg),
$vars = array(
'tituloPage' => GetDispProgSel($this->idProg),
'logoRel' => GetLogoRel(),
'REL_HEAD_NIVEL1' => GetHeadRel(REL_HEAD_NIVEL1),
'tituloRelatorio' => GetDispProgSel($this->idProg),
@ -333,7 +357,8 @@ abstract class Relatorios {
return $content;
}
private function ___ImprimePdf($target) {
private function ___ImprimePdf($target)
{
$pdf = new GerarPDF();
//Informações do Filtro do Relatório
@ -360,12 +385,13 @@ abstract class Relatorios {
$pdf->Output(GetDispProgSel($this->GetIdProg()) . ".pdf", $target);
}
private function ___ImprimeExcel() {
private function ___ImprimeExcel()
{
$fileName = sprintf("%s.xls", substr(LimpaString(GetDispProgSel($this->idProg)), 0, 32));
$objPHPExcel = new Spreadsheet();
$objPHPExcel->setActiveSheetIndex(0);
$sheet = $objPHPExcel->getActiveSheet();
//Nome do Relatório
$sheet->getRowDimension(1)->setRowHeight(20);
$cell = $sheet->setCellValue('A1', RemoveAcentos(GetDispProgSel($this->idProg)));
@ -418,7 +444,8 @@ abstract class Relatorios {
$this->___SendFile($fh, $fileName);
}
private function ___ImprimeExcelOld() {
private function ___ImprimeExcelOld()
{
$fileName = sprintf("%s.xls", substr(LimpaString(GetDispProgSel($this->idProg)), 0, 32));
$fh = fopen('php://memory', 'rw');
@ -475,7 +502,8 @@ abstract class Relatorios {
$this->___SendFile($fh, $fileName);
}
private function ___ImprimeCsv() {
private function ___ImprimeCsv()
{
$fileName = sprintf("%s.csv", substr(LimpaString(GetDispProgSel($this->idProg)), 0, 32));
$fh = fopen('php://memory', 'rw');
@ -489,7 +517,8 @@ abstract class Relatorios {
$this->___SendFile($fh, $fileName);
}
private function ___SendFile($data, $fileName) {
private function ___SendFile($data, $fileName)
{
ob_end_clean();
ob_start();
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
@ -504,39 +533,48 @@ abstract class Relatorios {
exit(0);
}
protected function GetData() {
protected function GetData()
{
return $this->___data;
}
protected function SetData($data) {
protected function SetData($data)
{
$this->___data[] = ($data ?? []);
}
protected function GetIdProg() {
protected function GetIdProg()
{
return $this->idProg;
}
protected function GetDbCon() {
protected function GetDbCon()
{
return $this->dbcon;
}
protected function GetMsg() {
protected function GetMsg()
{
return $this->___msg;
}
protected function GetIncDac() {
protected function GetIncDac()
{
return $this->___incDac;
}
protected function SetMsg($msg) {
protected function SetMsg($msg)
{
$this->___msg = $msg;
}
function getType() {
function getType()
{
return $this->___type;
}
function setType($___type) {
function setType($___type)
{
$this->___type = $___type;
}
@ -544,5 +582,3 @@ abstract class Relatorios {
abstract public function ExecutaRelatorio();
}
?>

599
include/util/util.php

File diff suppressed because it is too large Load Diff

775
relatorios/pbx/chamadasEntrantes/chamadasEntrantesGeral.php

@ -1,141 +1,151 @@
<?php
include_once 'util/relatoriosBase.php';
class ChamadasEntrantesGeral extends Relatorios {
private $___tipoAtendimento;
private $___tempoDuracao;
private $___telefone;
private $___tipoRecepcao;
public function __construct($idProg, $dbcon, $incDac) {
parent::__construct($idProg, $dbcon, $incDac);
$this->___tipoAtendimento = isset($_REQUEST['tipoAtendimento']) ? $_REQUEST['tipoAtendimento'] : 1;
$this->___tempoDuracao = isset($_REQUEST['tempoDuracao']) ? $_REQUEST['tempoDuracao'] : 1;
$this->___tipoRecepcao = isset($_REQUEST['tipoRecepcao']) ? $_REQUEST['tipoRecepcao'] : 1;
$this->___telefone = isset($_REQUEST['telefone']) ? $_REQUEST['telefone'] : '';
$this->___dataIni = IsPostBack() ? $_POST['dataIni'] : date('d/m/Y')." 00:00";
$this->___dataFim = IsPostBack() ? $_POST['dataFim'] : date('d/m/Y')." 23:59";
}
include_once 'util/relatoriosBase.php';
class ChamadasEntrantesGeral extends Relatorios
{
private $___tipoAtendimento;
private $___tempoDuracao;
private $___telefone;
private $___tipoRecepcao;
private $___entrada;
public function __construct($idProg, $dbcon, $incDac)
{
parent::__construct($idProg, $dbcon, $incDac);
$this->___tipoAtendimento = isset($_REQUEST['tipoAtendimento']) ? $_REQUEST['tipoAtendimento'] : 1;
$this->___tempoDuracao = isset($_REQUEST['tempoDuracao']) ? $_REQUEST['tempoDuracao'] : 1;
$this->___tipoRecepcao = isset($_REQUEST['tipoRecepcao']) ? $_REQUEST['tipoRecepcao'] : 1;
$this->___telefone = isset($_REQUEST['telefone']) ? $_REQUEST['telefone'] : '';
$this->___entrada = isset($_REQUEST['entrada']) ? $_REQUEST['entrada'] : '';
$this->___dataIni = IsPostBack() ? $_POST['dataIni'] : date('d/m/Y') . " 00:00";
$this->___dataFim = IsPostBack() ? $_POST['dataFim'] : date('d/m/Y') . " 23:59";
}
function ___ValidaForm() {
parent::___ValidaForm();
if (empty($this->___tipoAtendimento)) {
GeraExcept('Informe um tipo de atendimento!');
}
function ___ValidaForm()
{
parent::___ValidaForm();
if (empty($this->___tipoAtendimento)) {
GeraExcept('Informe um tipo de atendimento!');
}
if (empty($this->___tempoDuracao)) {
GeraExcept('Informe um tempo de duração!');
}
if (empty($this->___tempoDuracao)) {
GeraExcept('Informe um tempo de duração!');
}
if (empty($this->___tipoRecepcao)) {
GeraExcept('Informe um tipo de recepção!');
}
if (empty($this->___tipoRecepcao)) {
GeraExcept('Informe um tipo de recepção!');
}
if ($this->___telefone) {
if (!soNumero($this->___telefone)) {
GeraExcept('Informe apenas números no campo de Telefone!');
}
if ($this->___telefone) {
if (!soNumero($this->___telefone)) {
GeraExcept('Informe apenas números no campo de Telefone!');
}
}
}
function ___FiltrosRelatorio() {
if ($this->___media != MEDIA_PRINT_GRID) {
/*
function ___FiltrosRelatorio()
{
if ($this->___media != MEDIA_PRINT_GRID) {
/*
* Recupera os filtros da sess�o do usu�rio.
*/
list($this->___dac, $this->___dataIni, $this->___dataFim, $this->___telefone) = $_SESSION["SSstorageFiltros"];
if ($this->___media == MEDIA_PRINT_HTML) {
return sprintf("Data Inicial: %s Data Final: %s ", $this->___dataIni, $this->___dataFim);
}
$fltCsv = array();
$fltCsv[] = "Data Inicial: " . $this->___dataIni;
$fltCsv[] = "Data Final: " . $this->___dataFim;
//$fltCsv[] = $this->___telefone ? "Telefone: " . $this->___telefone : '';
$fltCsv[] = "Data Emissao: " . date('d/m/Y H:i:s');
$fltCsv[] = "Emitido Por: " . GetLogin();
return $fltCsv;
}
$dacs = GetDac($this->GetDbCon(), $this->___dac, "", 0, 1, 0, 0, 1);
$lkPrint = "";
if ($this->___dataCount) {
$prt = '<a href="index.php?idProg=%s&media=%s"><img src="imgSite/%s" alt="Clique aqui para imprimir!" width="24" height="24" border="0"></a>';
$prtHtml = "<a href=\"javaScript:NovaJanela('index.php?idProg=%s&media=%s', '%s', '720', '700', 'scrollbars=YES');\"><img src=\"imgSite/%s\" alt=\"Clique aqui para imprimir!\" width=\"24\" height=\"24\" border=\"0\"></a>";
$lkPrint .= sprintf($prtHtml, $this->GetidProg(), MEDIA_PRINT_HTML, substr(LimpaString(GetDispProgSel($this->GetIdProg())), 0, 20), 'print.gif');
$lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_EXCEL, 'prt-xls.png');
$lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_PDF, 'prt-pdf.png');
$lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_CSV, 'prt-csv.png');
list($this->___dac, $this->___dataIni, $this->___dataFim, $this->___telefone, $this->___entrada) = $_SESSION["SSstorageFiltros"];
if ($this->___media == MEDIA_PRINT_HTML) {
return sprintf("Data Inicial: %s Data Final: %s ", $this->___dataIni, $this->___dataFim);
}
/*
$fltCsv = array();
$fltCsv[] = "Data Inicial: " . $this->___dataIni;
$fltCsv[] = "Data Final: " . $this->___dataFim;
//$fltCsv[] = $this->___telefone ? "Telefone: " . $this->___telefone : '';
$fltCsv[] = "Data Emissao: " . date('d/m/Y H:i:s');
$fltCsv[] = "Emitido Por: " . GetLogin();
return $fltCsv;
}
$dacs = GetDac($this->GetDbCon(), $this->___dac, "", 0, 1, 0, 0, 1);
$lkPrint = "";
if ($this->___dataCount) {
$prt = '<a href="index.php?idProg=%s&media=%s"><img src="imgSite/%s" alt="Clique aqui para imprimir!" width="24" height="24" border="0"></a>';
$prtHtml = "<a href=\"javaScript:NovaJanela('index.php?idProg=%s&media=%s', '%s', '720', '700', 'scrollbars=YES');\"><img src=\"imgSite/%s\" alt=\"Clique aqui para imprimir!\" width=\"24\" height=\"24\" border=\"0\"></a>";
$lkPrint .= sprintf($prtHtml, $this->GetidProg(), MEDIA_PRINT_HTML, substr(LimpaString(GetDispProgSel($this->GetIdProg())), 0, 20), 'print.gif');
$lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_EXCEL, 'prt-xls.png');
$lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_PDF, 'prt-pdf.png');
$lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_CSV, 'prt-csv.png');
}
/*
* Personalise esta função se necessitar de outras opções de filtro.
*/
$filtro = '<table class="filtro" border="0" cellspacing="1" cellpadding="1">';
/*
$filtro = '<table class="filtro" border="0" cellspacing="1" cellpadding="1">';
/*
* Rotulos.
*/
$filtro .= '<tr>';
$filtro .= '<td>&nbsp</td>';
$filtro .= '<td>Fila</td>';
$filtro .= '<td>Data Inicial </td>';
$filtro .= '<td>Data Final </td>';
$filtro .= '<td>Duração</td>';
$filtro .= '<td>Tipo Atendimento</td>';
$filtro .= '<td>';
$filtro .= sprintf('<input name="tipoRecepcao" class="clean" type="radio" value="1" %s>Origem'
. '<input type="radio" class="clean" name="tipoRecepcao" value="2" %s>Destino'
. '<input type="radio" class="clean" name="tipoRecepcao" value="3" %s>Ambos'
. '</td>', $this->___tipoRecepcao == 1 ? 'checked' : '', $this->___tipoRecepcao == 2 ? 'checked' : '', $this->___tipoRecepcao == 3 ? 'checked' : '');
$filtro .= '<td align="center" valign="middle">&nbsp;</td>';
$filtro .= '</tr>';
/*
$filtro .= '<tr>';
$filtro .= '<td>&nbsp</td>';
$filtro .= '<td>Fila</td>';
$filtro .= '<td>Data Inicial </td>';
$filtro .= '<td>Data Final </td>';
$filtro .= '<td>Duração</td>';
$filtro .= '<td>Tipo Atendimento</td>';
$filtro .= '<td>';
$filtro .= sprintf('<input name="tipoRecepcao" class="clean" type="radio" value="1" %s>Origem'
. '<input type="radio" class="clean" name="tipoRecepcao" value="2" %s>Destino'
. '<input type="radio" class="clean" name="tipoRecepcao" value="3" %s>Ambos'
. '</td>', $this->___tipoRecepcao == 1 ? 'checked' : '', $this->___tipoRecepcao == 2 ? 'checked' : '', $this->___tipoRecepcao == 3 ? 'checked' : '');
$filtro .= '<td style="padding-left: 10px;">Entrada<td>';
$filtro .= '<td align="center" valign="middle">&nbsp;</td>';
$filtro .= '</tr>';
/*
* Valores.
*/
$filtro .= '<tr>';
$filtro .= '<td>&nbsp;</td>';
$filtro .= sprintf('<td>%s</td>', $dacs);
$filtro .= '<td><input name="dataIni" id="dataIni" type="text" size="15" maxlength="16" value="%s" onkeyup="formataDataHora(this)" title="dd/mm/aaaa HH:mm"></td>';
$filtro .= '<td><input name="dataFim" id="dataFim" type="text" size="15" maxlength="16" value="%s" onkeyup="formataDataHora(this)" title="dd/mm/aaaa HH:mm"></td>';
$filtro .= '<td><div class="geral"> ';
$filtro .= sprintf('<input name="tempoDuracao" class="clean" type="radio" id="tempoDuracao" value="1" %s>Todos'
. '<input name="tempoDuracao" class="clean" type="radio" id="tempoDuracao" value="2" %s>maior que(&gt;0)'
. '<input name="tempoDuracao" class="clean" type="radio" id="tempoDuracao" value="3" %s>Igual a 0 (= 0)', $this->___tempoDuracao == 1 ? 'checked' : '', $this->___tempoDuracao == 2 ? 'checked' : '', $this->___tempoDuracao == 3 ? 'checked' : '');
$filtro .= '</div></td>';
$filtro .= sprintf('<td><div class="geral"> '
. '<input name="tipoAtendimento" class="clean" type="radio" id="tipoAtendimento" value="1" %s>Ambos'
. '<input name="tipoAtendimento" class="clean" type="radio" id="tipoAtendimento" value="2" %s>Atendida'
. '<input name="tipoAtendimento" class="clean" type="radio" id="tipoAtendimento" value="3" %s>Não Atendida'
. '</div></td>', $this->___tipoAtendimento == 1 ? 'checked' : '', $this->___tipoAtendimento == 2 ? 'checked' : '', $this->___tipoAtendimento == 3 ? 'checked' : '');
$filtro .= '<td><input name="telefone" type="text" id="telefone" value="%s" /></td>';
$filtro .= '<td><input type="submit" name="btConsulta" id="btConsulta" value="Consultar"></td>';
$filtro .= '<td>%s</td>';
$filtro .= '</tr>';
$filtro .= '</table>';
/*
$filtro .= '<tr>';
$filtro .= '<td>&nbsp;</td>';
$filtro .= sprintf('<td>%s</td>', $dacs);
$filtro .= '<td><input name="dataIni" id="dataIni" type="text" size="15" maxlength="16" value="%s" onkeyup="formataDataHora(this)" title="dd/mm/aaaa HH:mm"></td>';
$filtro .= '<td><input name="dataFim" id="dataFim" type="text" size="15" maxlength="16" value="%s" onkeyup="formataDataHora(this)" title="dd/mm/aaaa HH:mm"></td>';
$filtro .= '<td><div class="geral"> ';
$filtro .= sprintf('<input name="tempoDuracao" class="clean" type="radio" id="tempoDuracao" value="1" %s>Todos'
. '<input name="tempoDuracao" class="clean" type="radio" id="tempoDuracao" value="2" %s>maior que(&gt;0)'
. '<input name="tempoDuracao" class="clean" type="radio" id="tempoDuracao" value="3" %s>Igual a 0 (= 0)', $this->___tempoDuracao == 1 ? 'checked' : '', $this->___tempoDuracao == 2 ? 'checked' : '', $this->___tempoDuracao == 3 ? 'checked' : '');
$filtro .= '</div></td>';
$filtro .= sprintf('<td><div class="geral"> '
. '<input name="tipoAtendimento" class="clean" type="radio" id="tipoAtendimento" value="1" %s>Ambos'
. '<input name="tipoAtendimento" class="clean" type="radio" id="tipoAtendimento" value="2" %s>Atendida'
. '<input name="tipoAtendimento" class="clean" type="radio" id="tipoAtendimento" value="3" %s>Não Atendida'
. '</div></td>', $this->___tipoAtendimento == 1 ? 'checked' : '', $this->___tipoAtendimento == 2 ? 'checked' : '', $this->___tipoAtendimento == 3 ? 'checked' : '');
$filtro .= '<td><input name="telefone" type="text" id="telefone" value="%s" /></td>';
$filtro .= '<td><input name="entrada" type="text" id="entrada" value="%s" /></td>';
$filtro .= '<td><input type="submit" name="btConsulta" id="btConsulta" value="Consultar"></td>';
$filtro .= '<td>%s</td>';
$filtro .= '</tr>';
$filtro .= '</table>';
/*
* Guarda os filtros passados para recuperar na emiss�o dos relat?ios para impress�o.
*/
$_SESSION["SSstorageFiltros"] = array($this->___dataIni, $this->___dataFim, $this->___telefone);
$_SESSION["SSstorageFiltros"] = array($this->___dataIni, $this->___dataFim, $this->___telefone, $this->___entrada);
return sprintf($filtro, $this->___dataIni, $this->___dataFim, $this->___telefone, $lkPrint);
}
return sprintf($filtro, $this->___dataIni, $this->___dataFim, $this->___telefone, $this->___entrada, $lkPrint);
}
protected function ___GetDadosDb() {
protected function ___GetDadosDb()
{
$dataIni = strlen($this->___dataIni) == 10 ? FormatDtMssql($this->___dataIni) . " 00:00": FormatDtMssql(substr($this->___dataIni, 0, 10)). substr($this->___dataIni, 10, 16);
$dataFim = strlen($this->___dataFim) == 10 ? FormatDtMssql($this->___dataFim) . " 23:59": FormatDtMssql(substr($this->___dataFim, 0, 10)). substr($this->___dataFim, 10, 16);
$telefone = $this->___telefone;
$duracao = $this->___tempoDuracao;
$tipoAtendimento = $this->___tipoAtendimento;
$fonePesquisa = $this->___tipoRecepcao;
$dataIni = strlen($this->___dataIni) == 10 ? FormatDtMssql($this->___dataIni) . " 00:00" : FormatDtMssql(substr($this->___dataIni, 0, 10)) . substr($this->___dataIni, 10, 16);
$dataFim = strlen($this->___dataFim) == 10 ? FormatDtMssql($this->___dataFim) . " 23:59" : FormatDtMssql(substr($this->___dataFim, 0, 10)) . substr($this->___dataFim, 10, 16);
$telefone = $this->___telefone;
$entrada = $this->___entrada;
$duracao = $this->___tempoDuracao;
$tipoAtendimento = $this->___tipoAtendimento;
$fonePesquisa = $this->___tipoRecepcao;
$query = sprintf("SELECT a.uniqueid, a.calldate, a.src, a.dst,
$query = sprintf("SELECT a.uniqueid, a.calldate, a.src, a.dst, a.clid AS entrada,
CASE WHEN(d.evento = 'ABANDON')THEN strtoint(d.param3) ELSE a.billsec END AS tempo_atendimento, COALESCE(d.fila, '-') AS fila, coalesce(e.apelido, '-') AS agente,
d.evento, CASE WHEN(tplg_codigo IN(23,24))THEN 'MÓVEL' ELSE c.nome_municipio END AS nome_municipio, c.uf, b.tplg_descricao,
CASE WHEN((d.evento IN('COMPLETEAGENT','COMPLETECALLER') AND (strtoint(d.param2) > 3) ) OR ((d.evento is null) AND (billsec > 3)))THEN 'ATENDIDA' ELSE 'N ATENDIDA' END AS status
@ -150,335 +160,348 @@
AND a.calldate::timestamp <= '%s'
AND a.lastapp <> 'Transferred Call' ", $dataIni, $dataFim);
$query .= $this->___dac ? " AND f.id = '{$this->___dac}' " : '';
if (!empty($telefone) && ($fonePesquisa == 1))
$query .= sprintf(" AND a.src LIKE '%s' ", PreparaLike($telefone));
else if (!empty($telefone) && ($fonePesquisa == 2))
$query .= sprintf(" AND a.dst LIKE '%s' ", PreparaLike($telefone));
else if (!empty($telefone) && ($fonePesquisa == 3))
$query .= sprintf(" AND (a.dst LIKE '%s' OR src LIKE '%s') ", PreparaLike($telefone), PreparaLike($telefone));
if ($duracao == 2) {
$query .= " AND a.billsec > 0 ";
}
if ($duracao == 3) {
$query .= " AND a.billsec = 0 ";
}
$query .= $this->___dac ? " AND f.id = '{$this->___dac}' " : '';
if ($tipoAtendimento == 2) {
$query .= "AND ((d.evento IN('COMPLETEAGENT','COMPLETECALLER') AND (billsec > 3) ) OR ((d.evento is null) AND (billsec > 3)))";
}
if ($tipoAtendimento == 3) {
$query .= "AND ((d.evento NOT IN('COMPLETEAGENT','COMPLETECALLER')) OR (billsec <= 3))";
}
if (!empty($telefone) && ($fonePesquisa == 1))
$query .= sprintf(" AND a.src LIKE '%s' ", PreparaLike($telefone));
else if (!empty($telefone) && ($fonePesquisa == 2))
$query .= sprintf(" AND a.dst LIKE '%s' ", PreparaLike($telefone));
else if (!empty($telefone) && ($fonePesquisa == 3))
$query .= sprintf(" AND (a.dst LIKE '%s' OR src LIKE '%s') ", PreparaLike($telefone), PreparaLike($telefone));
$query .= " ORDER BY a.calldate";
$result = $this->___GetQuery($query);
$row = pg_fetch_all($result);
$this->SetData($row ? $row : array());
if (!empty($entrada)) {
$query .= "AND UPPER(a.clid) LIKE UPPER('%$entrada%')";
}
protected function ___PreparaCsv() {
$nomeDac = "";
$dataRel = array();
$dataAgrup = array();
$filtro = $this->___FiltrosRelatorio();
if ($duracao == 2) {
$query .= " AND a.billsec > 0 ";
}
if ($duracao == 3) {
$query .= " AND a.billsec = 0 ";
}
$dataRel[] = GenerateCsvFromArray($filtro);
if ($tipoAtendimento == 2) {
$query .= "AND ((d.evento IN('COMPLETEAGENT','COMPLETECALLER') AND (billsec > 3) ) OR ((d.evento is null) AND (billsec > 3)))";
}
if ($tipoAtendimento == 3) {
$query .= "AND ((d.evento NOT IN('COMPLETEAGENT','COMPLETECALLER')) OR (billsec <= 3))";
}
$dadosCabecalio = array('Data/Hora', 'Origem', 'Destino', 'Tipo', 'Duracao', 'Atendida', 'Fila', 'Agente', 'Municipio', 'UF');
$dadosField = array('calldate', 'src', 'dst', 'tplg_descricao', 'tempo_atendimento', 'status', 'fila', 'agente', 'nome_municipio', 'uf');
$query .= " ORDER BY a.calldate";
$this->SetMsg("Query: $query");
$this->___GravaLog(false);
$result = $this->___GetQuery($query);
$row = pg_fetch_all($result);
$dataRel[] = GenerateCsvFromArray(array_keys($dadosCabecalio));
$this->SetData($row ? $row : array());
}
$somaTempo = 0;
$somaQuantidade = 0;
protected function ___PreparaCsv()
{
$nomeDac = "";
$dataRel = array();
$dataAgrup = array();
$filtro = $this->___FiltrosRelatorio();
/*
$dataRel[] = GenerateCsvFromArray($filtro);
$dadosCabecalio = array('Data/Hora', 'Origem', 'Destino', 'Tipo', 'Duracao', 'Atendida', 'Fila', 'Agente', 'Municipio', 'UF');
$dadosField = array('calldate', 'src', 'dst', 'tplg_descricao', 'tempo_atendimento', 'status', 'fila', 'agente', 'nome_municipio', 'uf');
$dataRel[] = GenerateCsvFromArray(array_keys($dadosCabecalio));
$somaTempo = 0;
$somaQuantidade = 0;
/*
* Inicia o relat�rio.
*/
foreach ($this->GetData()[0] as $row) {
$row['src'] = ocultarTelefone($row['src']);
$row["calldate"] = date('d/m/Y H:i', strtotime($row["calldate"]));
$row["tplg_descricao"] = str_replace("Entrada", "", $row["tplg_descricao"]);
$row["status"] = $row["status"] == 'ATENDIDA' ? 'S' : 'N';
$somaTempo += $row["tempo_atendimento"];
$row["tempo_atendimento"] = SecondToStrTime($row["tempo_atendimento"]);
$row["nome_municipio"] = $row['nome_municipio'] == "CHAMADAS NAO IDENTIFICADAS" ? 'NI' : RemoveAcentos($row['nome_municipio']);
$somaQuantidade ++;
$linha = array();
foreach ($dadosField as $key) {
$linha[] = $row["$key"];
}
$dataRel[] = GenerateCsvFromArray($linha);
foreach ($this->GetData()[0] as $row) {
$row['src'] = ocultarTelefone($row['src']);
$row["calldate"] = date('d/m/Y H:i', strtotime($row["calldate"]));
$row["tplg_descricao"] = str_replace("Entrada", "", $row["tplg_descricao"]);
$row["status"] = $row["status"] == 'ATENDIDA' ? 'S' : 'N';
$somaTempo += $row["tempo_atendimento"];
$row["tempo_atendimento"] = SecondToStrTime($row["tempo_atendimento"]);
$row["nome_municipio"] = $row['nome_municipio'] == "CHAMADAS NAO IDENTIFICADAS" ? 'NI' : RemoveAcentos($row['nome_municipio']);
$somaQuantidade++;
$linha = array();
foreach ($dadosField as $key) {
$linha[] = $row["$key"];
}
$linha = array('Total', '', '', 'Registros: '.$somaQuantidade, 'Duracao: '.SecondToStrTime($somaTempo));
$dataRel[] = GenerateCsvFromArray($linha);
$this->___dataRel[] = $dataRel;
$dataRel[] = GenerateCsvFromArray($linha);
}
protected function ___PreparaExcel() {
//list($this->___dataIni, $this->___dataFim) = $_SESSION["SSstorageFiltros"];
$linha = array('Total', '', '', 'Registros: ' . $somaQuantidade, 'Duracao: ' . SecondToStrTime($somaTempo));
$dataRel[] = GenerateCsvFromArray($linha);
$dataRel = array();
$dataAgrup = array();
$filtro = $this->___FiltrosRelatorio();
$this->___dataRel[] = $dataRel;
}
/*
protected function ___PreparaExcel()
{
//list($this->___dataIni, $this->___dataFim) = $_SESSION["SSstorageFiltros"];
$dataRel = array();
$dataAgrup = array();
$filtro = $this->___FiltrosRelatorio();
/*
* Inicia o relatório.
*/
/*
/*
* Cria os filtros
*/
$linha = array('LABEL');
foreach ($filtro as $values) {
list($label, $value) = explode(":", $values);
$linha[] = $label;
}
$dataRel[] = $linha;
$linha = array('LABEL');
foreach ($filtro as $values) {
list($label, $value) = explode(":", $values);
$linha[] = $label;
}
$dataRel[] = $linha;
$linha = array('DADOS');
foreach ($filtro as $values) {
list($label, $value) = explode(":", $values);
$linha[] = $value;
}
$linha = array('DADOS');
foreach ($filtro as $values) {
list($label, $value) = explode(":", $values);
$linha[] = $value;
}
$dataRel[] = $linha;
$dataRel[] = $linha;
$dadosCabecalio = array('Data/Hora', 'Origem', 'Destino', 'Tipo', 'Duracao', 'Atendida', 'Fila', 'Agente', 'Municipio', 'UF');
$dadosField = array('calldate', 'src', 'dst', 'tplg_descricao', 'tempo_atendimento', 'status', 'fila', 'agente', 'nome_municipio', 'uf');
$dadosCabecalio = array('Data/Hora', 'Origem', 'Destino', 'Tipo', 'Duracao', 'Atendida', 'Fila', 'Agente', 'Municipio', 'UF');
$dadosField = array('calldate', 'src', 'dst', 'tplg_descricao', 'tempo_atendimento', 'status', 'fila', 'agente', 'nome_municipio', 'uf');
/*
/*
* Monta a linha de cabecalio.
*/
$linha = array('LABEL');
foreach ($dadosCabecalio as $value) {
$linha[] = $value;
}
$dataRel[] = $linha;
$linha = array('LABEL');
foreach ($dadosCabecalio as $value) {
$linha[] = $value;
}
$dataRel[] = $linha;
$somaTempo = 0;
$somaQuantidade = 0;
/*
$somaTempo = 0;
$somaQuantidade = 0;
/*
* Linhas de dados.
*/
foreach ($this->GetData()[0] as $row) {
$row['src'] = ocultarTelefone($row['src']);
$row["calldate"] = date('d/m/Y H:i', strtotime($row["calldate"]));
$row["tplg_descricao"] = str_replace("Entrada", "", $row["tplg_descricao"]);
$row["status"] = $row["status"] == 'ATENDIDA' ? 'S' : 'N';
$somaTempo += $row["tempo_atendimento"];
$row["tempo_atendimento"] = SecondToStrTime($row["tempo_atendimento"]);
$row["nome_municipio"] = $row['nome_municipio'] == "CHAMADAS NAO IDENTIFICADAS" ? 'NI' : RemoveAcentos($row['nome_municipio']);
$somaQuantidade ++;
// Formata linha de dados.
$linha = array('DADOS');
foreach ($dadosField as $key) {
$linha[] = $row["$key"];
}
$dataRel[] = $linha;
foreach ($this->GetData()[0] as $row) {
$row['src'] = ocultarTelefone($row['src']);
$row["calldate"] = date('d/m/Y H:i', strtotime($row["calldate"]));
$row["tplg_descricao"] = str_replace("Entrada", "", $row["tplg_descricao"]);
$row["status"] = $row["status"] == 'ATENDIDA' ? 'S' : 'N';
$somaTempo += $row["tempo_atendimento"];
$row["tempo_atendimento"] = SecondToStrTime($row["tempo_atendimento"]);
$row["nome_municipio"] = $row['nome_municipio'] == "CHAMADAS NAO IDENTIFICADAS" ? 'NI' : RemoveAcentos($row['nome_municipio']);
$somaQuantidade++;
// Formata linha de dados.
$linha = array('DADOS');
foreach ($dadosField as $key) {
$linha[] = $row["$key"];
}
$linha = array('LABEL', 'Total', '', '', 'Registros: '.$somaQuantidade, 'Duracao: '.SecondToStrTime($somaTempo));
$dataRel[] = $linha;
$this->___dataRel[] = $dataRel;
}
protected function ___PreparaGrid() {
$dadosCabecalio = array(
'Data/Hora' => 'align="center"',
'Origem' => 'align="left"',
'Destino' => 'align="left"',
'Tipo' => 'align="left"',
'Duração' => 'align="center"',
'Atendida' => 'align="center"',
'Fila' => 'align="left"',
'Agente' => 'align="left"',
'Município' => 'align="left"',
'UF' => 'align="center"'
);
$dadosField = array(
'calldate' => 'align="center"',
'src' => 'align="left"',
'dst' => 'align="left"',
'tplg_descricao' => 'align="left"',
'tempo_atendimento' => 'align="center"',
'status' => 'align="center"',
'fila' => 'align="left"',
'agente' => 'align="left"',
'nome_municipio' => 'align="left"',
'uf' => 'align="center"'
);
/*
* Inicia o relat�rio.
*/
$dataRel[] = '<table width="90%" cellpadding="2" class="grid">';
$linha = array('LABEL', 'Total', '', '', 'Registros: ' . $somaQuantidade, 'Duracao: ' . SecondToStrTime($somaTempo));
/*
$dataRel[] = $linha;
$this->___dataRel[] = $dataRel;
}
protected function ___PreparaGrid()
{
$dadosCabecalio = array(
'Data/Hora' => 'align="center"',
'Origem' => 'align="left"',
'Destino' => 'align="left"',
'Tipo' => 'align="left"',
'Duração' => 'align="center"',
'Atendida' => 'align="center"',
'Fila' => 'align="left"',
'Agente' => 'align="left"',
'Entrada' => 'align="left"',
'Município' => 'align="left"',
'UF' => 'align="center"'
);
$dadosField = array(
'calldate' => 'align="center"',
'src' => 'align="left"',
'dst' => 'align="left"',
'tplg_descricao' => 'align="left"',
'tempo_atendimento' => 'align="center"',
'status' => 'align="center"',
'fila' => 'align="left"',
'agente' => 'align="left"',
'entrada' => 'align="left"',
'nome_municipio' => 'align="left"',
'uf' => 'align="center"'
);
/*
* Inicia o relatorio.
*/
$dataRel[] = '<table width="90%" cellpadding="2" class="grid">';
/*
* Monta a linha de cabecalio.
*/
$linha = '<tr>';
foreach ($dadosCabecalio as $key => $value) {
$linha .= sprintf("<th %s>%s</th>", $value, $key);
}
$linha .= "</tr>";
$dataRel[] = $linha;
$linha = '<tr>';
foreach ($dadosCabecalio as $key => $value) {
$linha .= sprintf("<th %s>%s</th>", $value, $key);
}
$linha .= "</tr>";
$dataRel[] = $linha;
/*
/*
* Verifica se retornou dados
*/
if (!IsPostBack() || !count($this->GetData()[0])) {
$dataRel[] = sprintf("<tr><td align=\"center\" colspan=\"%s\">%s<td></tr></table>", count($dadosCabecalio) - 1, (!IsPostBack() ? 'Informe os parametros e clique em consultar!' : 'Nenhum registro encontado!'));
$this->___dataRel[] = $dataRel;
return;
}
if (!IsPostBack() || !count($this->GetData()[0])) {
$dataRel[] = sprintf("<tr><td align=\"center\" colspan=\"%s\">%s<td></tr></table>", count($dadosCabecalio) - 1, (!IsPostBack() ? 'Informe os parametros e clique em consultar!' : 'Nenhum registro encontado!'));
$this->___dataRel[] = $dataRel;
return;
}
$somaTempo = 0;
$somaQuantidade = 0;
/*
$somaTempo = 0;
$somaQuantidade = 0;
/*
* Linhas de dados.
*/
foreach ($this->GetData()[0] as $row) {
$row['src'] = ocultarTelefone($row['src']);
$row["calldate"] = date('d/m/Y H:i', strtotime($row["calldate"]));
$row["tplg_descricao"] = str_replace("Fixo Entrada", "", $row["tplg_descricao"]);
$row["status"] = $row["status"] == 'ATENDIDA' ? 'S' : 'N';
$somaTempo += $row["tempo_atendimento"];
$row["tempo_atendimento"] = SecondToStrTime($row["tempo_atendimento"]);
$somaQuantidade ++;
// Formata linha de dados.
$linha = "<tr>";
foreach ($dadosField as $key => $value) {
$linha .= sprintf("<td %s>%s</td>", $value, $row["$key"]);
}
$linha .= "</tr>";
$dataRel[] = $linha;
foreach ($this->GetData()[0] as $row) {
$row['entrada'] = explode('"', $row['entrada'])[1];
$row['src'] = ocultarTelefone($row['src']);
$row["calldate"] = date('d/m/Y H:i', strtotime($row["calldate"]));
$row["tplg_descricao"] = str_replace("Fixo Entrada", "", $row["tplg_descricao"]);
$row["status"] = $row["status"] == 'ATENDIDA' ? 'S' : 'N';
$somaTempo += $row["tempo_atendimento"];
$row["tempo_atendimento"] = SecondToStrTime($row["tempo_atendimento"]);
$somaQuantidade++;
// Formata linha de dados.
$linha = "<tr>";
foreach ($dadosField as $key => $value) {
$linha .= sprintf("<td %s>%s</td>", $value, $row["$key"]);
}
/*
$linha .= "</tr>";
$dataRel[] = $linha;
}
/*
* Linha de totalizacao.
*/
$linha = '<tr><th colspan="2" align="left">Total</th><th align="left" colspan="2">Registros: %s</th><th align="left" colspan="6">Duração: %s</th></tr>';
$dataRel[] = sprintf($linha, $somaQuantidade, SecondToStrTime($somaTempo));
$linha = '<tr><th colspan="2" align="left">Total</th><th align="left" colspan="2">Registros: %s</th><th align="left" colspan="6">Duração: %s</th></tr>';
$dataRel[] = sprintf($linha, $somaQuantidade, SecondToStrTime($somaTempo));
/*
/*
* Fecha relatorio.
*/
$dataRel[] = '</table>';
$dataRel[] = '<table width="50%">';
$dataRel[] = '<tr><td><b>* CHAMADAS ABANDONADAS OU NÃO ATENDIDAS, NO CAMPO DESTINO SERÁ APRESENTADO O NÚMERO DA FILA!</b></td></tr>';
$dataRel[] = '</table>';
$this->___dataRel[] = $dataRel;
}
$dataRel[] = '</table>';
$dataRel[] = '<table width="50%">';
$dataRel[] = '<tr><td><b>* CHAMADAS ABANDONADAS OU NÃO ATENDIDAS, NO CAMPO DESTINO SERÁ APRESENTADO O NÚMERO DA FILA!</b></td></tr>';
$dataRel[] = '</table>';
$this->___dataRel[] = $dataRel;
}
protected function ___PreparaHtml() {
protected function ___PreparaHtml()
{
}
protected function ___PreparaPdf()
{
list($this->___dataIni, $this->___dataFim) = $_SESSION["SSstorageFiltros"];
$dados = array();
$x = 0;
$somaQtd = 0;
$somaTempo = 0;
foreach ($this->GetData()[0] as $row) {
$dados[$x]["calldate"] = date('d/m/Y H', strtotime($row["calldate"]));
$dados[$x]["src"] = ocultarTelefone($row['src']);
$dados[$x]["dst"] = $row["dst"];
$dados[$x]["tplg_descricao"] = str_replace('Entrada', '', $row["tplg_descricao"]);
$somaTempo += $row["tempo_atendimento"];
$dados[$x]["tempo_atendimento"] = SecondToStrTime($row["tempo_atendimento"]);
$dados[$x]["status"] = $row["status"] == 'ATENDIDA' ? 'S' : 'N';
$dados[$x]["fila"] = $row["fila"];
$dados[$x]["agente"] = $row["agente"];
$dados[$x]["nome_municipio"] = $row['nome_municipio'] == "CHAMADAS NAO IDENTIFICADAS" ? 'NI' : $row['nome_municipio'];
$dados[$x]["uf"] = $row['uf'];
$somaQtd++;
$x++;
}
protected function ___PreparaPdf() {
list($this->___dataIni, $this->___dataFim) = $_SESSION["SSstorageFiltros"];
$dados = array();
$x = 0;
$somaQtd = 0;
$somaTempo = 0;
foreach ($this->GetData()[0] as $row) {
$dados[$x]["calldate"] = date('d/m/Y H', strtotime($row["calldate"]));
$dados[$x]["src"] = ocultarTelefone($row['src']);
$dados[$x]["dst"] = $row["dst"];
$dados[$x]["tplg_descricao"] = str_replace('Entrada', '', $row["tplg_descricao"]);
$somaTempo += $row["tempo_atendimento"];
$dados[$x]["tempo_atendimento"] = SecondToStrTime($row["tempo_atendimento"]);
$dados[$x]["status"] = $row["status"] == 'ATENDIDA' ? 'S' : 'N';
$dados[$x]["fila"] = $row["fila"];
$dados[$x]["agente"] = $row["agente"];
$dados[$x]["nome_municipio"] = $row['nome_municipio'] == "CHAMADAS NAO IDENTIFICADAS" ? 'NI' : $row['nome_municipio'];
$dados[$x]["uf"] = $row['uf'];
$somaQtd ++;
$x++;
}
//HEADER DA TABELA DO PDF -> DADOS EM ARRAY
$header = array(
'Data/Hora' => 'C',
'Origem' => 'L',
'Destino' => 'L',
'Tipo' => 'L',
'Duração' => 'C',
'Atend.' => 'C',
'Fila' => 'L',
'Agente' => 'L',
'Município' => 'L',
'UF' => 'C');
$dataHeader = array(
'calldate' => 'C',
'src' => 'L',
'dst' => 'L',
'tplg_descricao' => 'L',
'tempo_atendimento' => 'C',
'status' => 'C',
'fila' => 'L',
'agente' => 'L',
'nome_municipio' => 'L',
'uf' => 'C'
);
$widthHeader = array(20, 25, 15, 25, 15, 10, 20, 20, 30, 10);
$totaliza = array('Total', "Registros: " , $somaQtd, 'Duração:', SecondToStrTime($somaTempo), '', '', '', '', '');
//Monta o array para passar para o prepara; Necessário passar 6 parametros
$table1 = array($header, $dataHeader, $dados, $widthHeader, $totaliza, 0);
$this->___dataRel = array($table1);
}
//HEADER DA TABELA DO PDF -> DADOS EM ARRAY
$header = array(
'Data/Hora' => 'C',
'Origem' => 'L',
'Destino' => 'L',
'Tipo' => 'L',
'Duração' => 'C',
'Atend.' => 'C',
'Fila' => 'L',
'Agente' => 'L',
'Município' => 'L',
'UF' => 'C'
);
$dataHeader = array(
'calldate' => 'C',
'src' => 'L',
'dst' => 'L',
'tplg_descricao' => 'L',
'tempo_atendimento' => 'C',
'status' => 'C',
'fila' => 'L',
'agente' => 'L',
'nome_municipio' => 'L',
'uf' => 'C'
);
$widthHeader = array(20, 25, 15, 25, 15, 10, 20, 20, 30, 10);
$totaliza = array('Total', "Registros: ", $somaQtd, 'Duração:', SecondToStrTime($somaTempo), '', '', '', '', '');
//Monta o array para passar para o prepara; Necessário passar 6 parametros
$table1 = array($header, $dataHeader, $dados, $widthHeader, $totaliza, 0);
$this->___dataRel = array($table1);
}
public function ExecutaRelatorio() {
global $jsStartup, $jsJQuery, $smarty;
try {
/*
public function ExecutaRelatorio()
{
global $jsStartup, $jsJQuery, $smarty;
try {
/*
* Use esta fun��o para validar dados do formul�rio.
*/
$this->___ValidaForm();
$this->___ValidaForm();
/*
/*
* Recupera os dados do banco.
*/
$this->___ConteudoRelatorio();
$this->___ConteudoRelatorio();
/*
/*
* Imprime relat�rio de acordo com a media passada.
*/
$conteudoRelatorio = $this->___ImprimeRelatorio();
} catch (Exception $exc) {
$this->SetMsg($exc->getMessage());
$jsStartup[] = sprintf("alert('%s');", $this->GetMsg());
$this->___GravaLog();
}
$conteudoRelatorio = $this->___ImprimeRelatorio();
} catch (Exception $exc) {
$this->SetMsg($exc->getMessage());
$jsStartup[] = sprintf("alert('%s');", $this->GetMsg());
$this->___GravaLog();
}
/*
/*
* Inclua os scripts necessários aqui.
*/
$jsJQuery[] = "\$('#dataIni').keypress(function(){formataDataHora(this);}) ";
$jsJQuery[] = "\$('#dataFim').keypress(function(){formataDataHora(this);}) ";
$smarty->assign('filtros', $this->___FiltrosRelatorio());
$smarty->assign('conteudo', $conteudoRelatorio);
$smarty->assign('msg', $this->GetMsg());
GetTemplate($smarty, 'relatoriosGrid.tpl');
}
$jsJQuery[] = "\$('#dataIni').keypress(function(){formataDataHora(this);}) ";
$jsJQuery[] = "\$('#dataFim').keypress(function(){formataDataHora(this);}) ";
$smarty->assign('filtros', $this->___FiltrosRelatorio());
$smarty->assign('conteudo', $conteudoRelatorio);
$smarty->assign('msg', $this->GetMsg());
GetTemplate($smarty, 'relatoriosGrid.tpl');
}
}
$relChmEntG = new ChamadasEntrantesGeral($idProg, $dbcon, 0);
$relChmEntG->ExecutaRelatorio();
?>
$relChmEntG = new ChamadasEntrantesGeral($idProg, $dbcon, 0);
$relChmEntG->ExecutaRelatorio();

Loading…
Cancel
Save