|
|
@ -11,7 +11,7 @@ |
|
|
|
parent::__construct($idProg, $dbcon, $incDac); |
|
|
|
parent::__construct($idProg, $dbcon, $incDac); |
|
|
|
$this->___campanha = isset($_REQUEST['campanha']) ? $_REQUEST['campanha'] : 0; |
|
|
|
$this->___campanha = isset($_REQUEST['campanha']) ? $_REQUEST['campanha'] : 0; |
|
|
|
$this->___lista = isset($_REQUEST['lista']) ? $_REQUEST['lista'] : 0; |
|
|
|
$this->___lista = isset($_REQUEST['lista']) ? $_REQUEST['lista'] : 0; |
|
|
|
$this->___telefone = isset($_REQUEST['telefone']) ? $_REQUEST['telefone'] : ''; |
|
|
|
$this->___filtro = isset($_REQUEST['filtro']) ? $_REQUEST['filtro'] : ''; |
|
|
|
$this->___btnConsulta = isset($_POST['btConsulta']) ? $_POST['btConsulta'] : ''; |
|
|
|
$this->___btnConsulta = isset($_POST['btConsulta']) ? $_POST['btConsulta'] : ''; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -24,7 +24,6 @@ |
|
|
|
if (empty($this->___lista) && $this->___campanha && $this->___btnConsulta) { |
|
|
|
if (empty($this->___lista) && $this->___campanha && $this->___btnConsulta) { |
|
|
|
GeraExcept('Informe uma lista!'); |
|
|
|
GeraExcept('Informe uma lista!'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function ___FiltrosRelatorio() { |
|
|
|
function ___FiltrosRelatorio() { |
|
|
@ -69,7 +68,7 @@ |
|
|
|
$filtro .= '<td>Data Final </td>'; |
|
|
|
$filtro .= '<td>Data Final </td>'; |
|
|
|
$filtro .= '<td>Campanha</td>'; |
|
|
|
$filtro .= '<td>Campanha</td>'; |
|
|
|
$filtro .= '<td>Lista</td>'; |
|
|
|
$filtro .= '<td>Lista</td>'; |
|
|
|
$filtro .= '<td>Origem/Destino</td>'; |
|
|
|
$filtro .= '<td>Filtro</td>'; |
|
|
|
$filtro .= '<td align="center" valign="middle"> </td>'; |
|
|
|
$filtro .= '<td align="center" valign="middle"> </td>'; |
|
|
|
$filtro .= '</tr>'; |
|
|
|
$filtro .= '</tr>'; |
|
|
|
|
|
|
|
|
|
|
@ -82,7 +81,7 @@ |
|
|
|
$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><input name="dataFim" id="dataFim" type="text" size="15" maxlength="16" value="%s" onkeyup="formataDataHora(this)" title="dd/mm/aaaa HH:mm"></td>'; |
|
|
|
$filtro .= sprintf('<td>%s</td>', $this->getCampanha($this->___campanha)); |
|
|
|
$filtro .= sprintf('<td>%s</td>', $this->getCampanha($this->___campanha)); |
|
|
|
$filtro .= sprintf('<td><select name="lista" id="lista" size="1" style="width: 200px">%s</select></td>', $this->getListaCampanha($this->___lista)); |
|
|
|
$filtro .= sprintf('<td><select name="lista" id="lista" size="1" style="width: 200px">%s</select></td>', $this->getListaCampanha($this->___lista)); |
|
|
|
$filtro .= sprintf('<td><input name="telefone" type="text" id="telefone" value="%s"/></td>', $this->___telefone); |
|
|
|
$filtro .= sprintf('<td><input name="filtro" type="text" id="filtro" value="%s"/></td>', $this->___filtro); |
|
|
|
$filtro .= '<td><input type="submit" name="btConsulta" id="btConsulta" value="Consultar"></td>'; |
|
|
|
$filtro .= '<td><input type="submit" name="btConsulta" id="btConsulta" value="Consultar"></td>'; |
|
|
|
$filtro .= '<td>%s</td>'; |
|
|
|
$filtro .= '<td>%s</td>'; |
|
|
|
$filtro .= '</tr>'; |
|
|
|
$filtro .= '</tr>'; |
|
|
@ -100,8 +99,10 @@ |
|
|
|
$dataIni = $this->___dataIni ? FormatDtMssql($this->___dataIni) : ''; |
|
|
|
$dataIni = $this->___dataIni ? FormatDtMssql($this->___dataIni) : ''; |
|
|
|
$dataFim = $this->___dataFim ? FormatDtMssql($this->___dataFim) : ''; |
|
|
|
$dataFim = $this->___dataFim ? FormatDtMssql($this->___dataFim) : ''; |
|
|
|
|
|
|
|
|
|
|
|
$query = "SELECT DISTINCT b.id AS fila_id, a.cmp_id, a.data_registro::date, d.cont_id, src, f.conf_fone as contato_numero, b.nome as fila_nome, j.apelido, billsec, a.cmp_descricao, |
|
|
|
$query = "SELECT DISTINCT b.id AS fila_id, a.cmp_id, a.data_registro::date, d.cont_id, src, f.conf_fone as contato_numero, |
|
|
|
|
|
|
|
b.nome as fila_nome, j.apelido, billsec, a.cmp_descricao, |
|
|
|
d.cont_param1 AS contato_descricao, |
|
|
|
d.cont_param1 AS contato_descricao, |
|
|
|
|
|
|
|
d.cont_param2 AS contato_descricao1, |
|
|
|
d.cont_discado AS contato_discado, |
|
|
|
d.cont_discado AS contato_discado, |
|
|
|
COALESCE(h.ctst_nome, 'Número Não Discado') AS contato_status, calldate |
|
|
|
COALESCE(h.ctst_nome, 'Número Não Discado') AS contato_status, calldate |
|
|
|
FROM pbx_campanha a |
|
|
|
FROM pbx_campanha a |
|
|
@ -117,9 +118,17 @@ |
|
|
|
$query .= " AND i.data_bilhete::DATE >= '{$dataIni}' AND i.data_bilhete::DATE <= '{$dataFim}'"; |
|
|
|
$query .= " AND i.data_bilhete::DATE >= '{$dataIni}' AND i.data_bilhete::DATE <= '{$dataFim}'"; |
|
|
|
$query .= $this->___campanha ? " AND a.cmp_id = {$this->___campanha}" : ''; |
|
|
|
$query .= $this->___campanha ? " AND a.cmp_id = {$this->___campanha}" : ''; |
|
|
|
$query .= $this->___lista ? " AND c.list_id = {$this->___lista}" : ''; |
|
|
|
$query .= $this->___lista ? " AND c.list_id = {$this->___lista}" : ''; |
|
|
|
$query .= $this->___telefone ? " AND (src = '{$this->___telefone}' OR f.conf_fone = '{$this->___telefone}') " : ''; |
|
|
|
$query .= $this->___filtro ? " AND (src ILIKE '%{$this->___filtro}%' " |
|
|
|
|
|
|
|
. "OR f.conf_fone ILIKE '%{$this->___filtro}%' " |
|
|
|
|
|
|
|
. "OR d.cont_param1 ILIKE '%{$this->___filtro}%' " |
|
|
|
|
|
|
|
. "OR d.cont_param2 ILIKE '%{$this->___filtro}%') " : ''; |
|
|
|
$query .= " ORDER BY a.cmp_id"; |
|
|
|
$query .= " ORDER BY a.cmp_id"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(IsAdmin()){ |
|
|
|
|
|
|
|
echo $query; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$result = $this->___GetQuery($query); |
|
|
|
$result = $this->___GetQuery($query); |
|
|
|
$row = pg_fetch_all($result); |
|
|
|
$row = pg_fetch_all($result); |
|
|
|
$this->SetData($row ? $row : array()); |
|
|
|
$this->SetData($row ? $row : array()); |
|
|
@ -142,6 +151,7 @@ |
|
|
|
'Agente' => 'align="center"', |
|
|
|
'Agente' => 'align="center"', |
|
|
|
'Campanha' => 'align="center"', |
|
|
|
'Campanha' => 'align="center"', |
|
|
|
'Contato' => 'align="center"', |
|
|
|
'Contato' => 'align="center"', |
|
|
|
|
|
|
|
'Descricao' => 'align="center"', |
|
|
|
'Status' => 'align="center"', |
|
|
|
'Status' => 'align="center"', |
|
|
|
'Data Chamada' => 'align="center"' |
|
|
|
'Data Chamada' => 'align="center"' |
|
|
|
); |
|
|
|
); |
|
|
@ -154,6 +164,7 @@ |
|
|
|
'apelido' => 'align="center"', |
|
|
|
'apelido' => 'align="center"', |
|
|
|
'cmp_descricao' => 'align="center"', |
|
|
|
'cmp_descricao' => 'align="center"', |
|
|
|
'contato_descricao' => 'align="center"', |
|
|
|
'contato_descricao' => 'align="center"', |
|
|
|
|
|
|
|
'contato_descricao1' => 'align="center"', |
|
|
|
'contato_status' => 'align="center"', |
|
|
|
'contato_status' => 'align="center"', |
|
|
|
'calldate' => 'align="center"' |
|
|
|
'calldate' => 'align="center"' |
|
|
|
); |
|
|
|
); |
|
|
@ -172,6 +183,7 @@ |
|
|
|
$row["calldate"] = $row["calldate"] ? date('d/m/Y H:i:s', strtotime($row["calldate"])) : '-'; |
|
|
|
$row["calldate"] = $row["calldate"] ? date('d/m/Y H:i:s', strtotime($row["calldate"])) : '-'; |
|
|
|
$row["apelido"] = $row["apelido"] ? $row["apelido"] : '-'; |
|
|
|
$row["apelido"] = $row["apelido"] ? $row["apelido"] : '-'; |
|
|
|
$row['cmp_descricao'] = RemoveAcentos($row['cmp_descricao']); |
|
|
|
$row['cmp_descricao'] = RemoveAcentos($row['cmp_descricao']); |
|
|
|
|
|
|
|
$row['contato_descricao1'] = RemoveAcentos($row['contato_descricao1']); |
|
|
|
$row['contato_status'] = RemoveAcentos($row['contato_status']); |
|
|
|
$row['contato_status'] = RemoveAcentos($row['contato_status']); |
|
|
|
$row["billsec"] = SecondToStrTime($row["billsec"]); |
|
|
|
$row["billsec"] = SecondToStrTime($row["billsec"]); |
|
|
|
$somaQuantidade++; |
|
|
|
$somaQuantidade++; |
|
|
@ -229,6 +241,7 @@ |
|
|
|
'Agente', |
|
|
|
'Agente', |
|
|
|
'Campanha', |
|
|
|
'Campanha', |
|
|
|
'Contato', |
|
|
|
'Contato', |
|
|
|
|
|
|
|
'Descricao', |
|
|
|
'Status', |
|
|
|
'Status', |
|
|
|
'Data Chamada' |
|
|
|
'Data Chamada' |
|
|
|
); |
|
|
|
); |
|
|
@ -241,6 +254,7 @@ |
|
|
|
'apelido', |
|
|
|
'apelido', |
|
|
|
'cmp_descricao', |
|
|
|
'cmp_descricao', |
|
|
|
'contato_descricao', |
|
|
|
'contato_descricao', |
|
|
|
|
|
|
|
'contato_descricao1', |
|
|
|
'contato_status', |
|
|
|
'contato_status', |
|
|
|
'calldate' |
|
|
|
'calldate' |
|
|
|
); |
|
|
|
); |
|
|
@ -265,6 +279,7 @@ |
|
|
|
$row["calldate"] = $row["calldate"] ? date('d/m/Y H:i:s', strtotime($row["calldate"])) : '-'; |
|
|
|
$row["calldate"] = $row["calldate"] ? date('d/m/Y H:i:s', strtotime($row["calldate"])) : '-'; |
|
|
|
$row["apelido"] = $row["apelido"] ? $row["apelido"] : '-'; |
|
|
|
$row["apelido"] = $row["apelido"] ? $row["apelido"] : '-'; |
|
|
|
$row['cmp_descricao'] = RemoveAcentos($row['cmp_descricao']); |
|
|
|
$row['cmp_descricao'] = RemoveAcentos($row['cmp_descricao']); |
|
|
|
|
|
|
|
$row['contato_descricao1'] = RemoveAcentos($row['contato_descricao1']); |
|
|
|
$row['contato_status'] = RemoveAcentos($row['contato_status']); |
|
|
|
$row['contato_status'] = RemoveAcentos($row['contato_status']); |
|
|
|
$row["billsec"] = SecondToStrTime($row["billsec"]); |
|
|
|
$row["billsec"] = SecondToStrTime($row["billsec"]); |
|
|
|
$somaQuantidade++; |
|
|
|
$somaQuantidade++; |
|
|
@ -295,6 +310,7 @@ |
|
|
|
'Agente' => 'align="center"', |
|
|
|
'Agente' => 'align="center"', |
|
|
|
'Campanha' => 'align="center"', |
|
|
|
'Campanha' => 'align="center"', |
|
|
|
'Contato' => 'align="center"', |
|
|
|
'Contato' => 'align="center"', |
|
|
|
|
|
|
|
'Descrição' => 'align="center"', |
|
|
|
'Status' => 'align="center"', |
|
|
|
'Status' => 'align="center"', |
|
|
|
'Data Chamada' => 'align="center"', |
|
|
|
'Data Chamada' => 'align="center"', |
|
|
|
'Retornar' => 'align="center"' |
|
|
|
'Retornar' => 'align="center"' |
|
|
@ -308,6 +324,7 @@ |
|
|
|
'apelido' => 'align="center"', |
|
|
|
'apelido' => 'align="center"', |
|
|
|
'cmp_descricao' => 'align="center"', |
|
|
|
'cmp_descricao' => 'align="center"', |
|
|
|
'contato_descricao' => 'align="center"', |
|
|
|
'contato_descricao' => 'align="center"', |
|
|
|
|
|
|
|
'contato_descricao1' => 'align="center"', |
|
|
|
'contato_status' => 'align="center"', |
|
|
|
'contato_status' => 'align="center"', |
|
|
|
'calldate' => 'align="center"', |
|
|
|
'calldate' => 'align="center"', |
|
|
|
'retornar' => 'align="center"' |
|
|
|
'retornar' => 'align="center"' |
|
|
@ -315,7 +332,7 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Inicia o relat�rio. |
|
|
|
* Inicia o relat�rio. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
$dataRel[] = '<table width="90%" cellpadding="2" class="grid">'; |
|
|
|
$dataRel[] = '<table width="100%" cellpadding="2" class="grid">'; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Monta a linha de cabecalio. |
|
|
|
* Monta a linha de cabecalio. |
|
|
@ -367,7 +384,7 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Linha de totalizacao. |
|
|
|
* Linha de totalizacao. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
$linha = '<tr><th colspan="2" align="left">Total</th><th align="left" colspan="2">Registros: %s</th><th align="left" colspan="7"></th></tr>'; |
|
|
|
$linha = '<tr><th colspan="2" align="left">Total</th><th align="left" colspan="2">Registros: %s</th><th align="left" colspan="8"></th></tr>'; |
|
|
|
$dataRel[] = sprintf($linha, $somaQuantidade, SecondToStrTime($somaTempo)); |
|
|
|
$dataRel[] = sprintf($linha, $somaQuantidade, SecondToStrTime($somaTempo)); |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
@ -382,52 +399,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function ___PreparaPdf() { |
|
|
|
protected function ___PreparaPdf() { |
|
|
|
list($this->___dataIni, $this->___dataFim) = $_SESSION["SSstorageFiltros"]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dados = $this->GetData()[0]; |
|
|
|
|
|
|
|
$x = 0; |
|
|
|
|
|
|
|
$somaQtd = 0; |
|
|
|
|
|
|
|
foreach ($dados as $row) { |
|
|
|
|
|
|
|
$dados[$x]["cmpo_fim"] = $row["cmpo_fim"] ? date('d/m/Y H:i', strtotime($row["cmpo_fim"])) : '-'; |
|
|
|
|
|
|
|
$dados[$x]["apelido"] = $row["apelido"] ? $row["apelido"] : '-'; |
|
|
|
|
|
|
|
$dados[$x]["cmp_descricao"] = RemoveAcentos($row['cmp_descricao']); |
|
|
|
|
|
|
|
$dados[$x]["contato_status"] = RemoveAcentos($row['contato_status']); |
|
|
|
|
|
|
|
$dados[$x]["billsec"] = SecondToStrTime($row["billsec"]); |
|
|
|
|
|
|
|
$somaQtd++; |
|
|
|
|
|
|
|
$x++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//HEADER DA TABELA DO PDF -> DADOS EM ARRAY |
|
|
|
|
|
|
|
$header = array( |
|
|
|
|
|
|
|
'Data/Hora' => 'C', |
|
|
|
|
|
|
|
'Origem' => 'C', |
|
|
|
|
|
|
|
'Destino' => 'C', |
|
|
|
|
|
|
|
'Fila' => 'C', |
|
|
|
|
|
|
|
'Duracao' => 'C', |
|
|
|
|
|
|
|
'Agente' => 'C', |
|
|
|
|
|
|
|
'Campanha' => 'C', |
|
|
|
|
|
|
|
'Contato' => 'C', |
|
|
|
|
|
|
|
'Status' => 'C' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$dataHeader = array( |
|
|
|
|
|
|
|
'cmpo_fim' => 'C', |
|
|
|
|
|
|
|
'src' => 'C', |
|
|
|
|
|
|
|
'contato_numero' => 'C', |
|
|
|
|
|
|
|
'fila_nome' => 'C', |
|
|
|
|
|
|
|
'billsec' => 'C', |
|
|
|
|
|
|
|
'apelido' => 'C', |
|
|
|
|
|
|
|
'cmp_descricao' => 'C', |
|
|
|
|
|
|
|
'contato_descricao' => 'C', |
|
|
|
|
|
|
|
'contato_status' => 'C' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$widthHeader = array(20, 13, 15, 20, 15, 15, 30, 60, 15); |
|
|
|
|
|
|
|
$totaliza = array('Total', "Registros: ", $somaQtd); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Monta o array para passar para o prepara; Necessário passar 6 parametros |
|
|
|
|
|
|
|
$table1 = array($header, $dataHeader, $dados, $widthHeader, $totaliza, 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->___dataRel = array($table1); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function getCampanha($select = null) { |
|
|
|
private function getCampanha($select = null) { |
|
|
|