Browse Source

acrescentamos as colunas localidade, uf e usuario alem de exibir o horario no campo data

1.8.1-monitor
douglas.strappasson 1 year ago
parent
commit
4b183bb163
  1. 65
      relatorios/tarifador/tarifaConta.php
  2. 113
      relatorios/tarifador/tarifaFatura.php
  3. 75
      relatorios/tarifador/tarifaRamal.php

65
relatorios/tarifador/tarifaConta.php

@ -119,7 +119,7 @@
coalesce(e.id, 0) as id_empresa, coalesce(e.nome, 'NI') as nome_empresa, coalesce(f.id,0) as id_depto,
coalesce(f.nome_depto, 'NI') as nome_depto, case when(substring(a.trr_destino,1,4) = '0800')then 'Gratuito' else g.ttp_descricao end as ttp_descricao,
(a.trr_duracao / 60)::int as duracao_mininuto, (a.trr_duracao % 60) as duracao_segundo, a.trr_franquia,
h.contr_tipo_franquia, a.trr_duracao as duracao, a.trr_tipo_chamada, a.trr_duracao_transf,c.apelido
h.contr_tipo_franquia, a.trr_duracao as duracao, a.trr_tipo_chamada, a.trr_duracao_transf, c.apelido, pm.nome_municipio, pm.uf
from pbx_tarif_registra a
inner join pbx_operadoras b on b.oper_id = a.oper_id_dest
inner join pbx_tarif_contrato h on h.contr_id = a.contr_id
@ -127,6 +127,8 @@
left join pbx_empresa e on e.id = c.empresa
left join pbx_departamentos f on f.id = c.departamento
left join pbx_tarifa_tipo_preco g on g.ttp_id = a.trr_vc
left join pbx_bilhetes pb on a.uniqueid = pb.uniqueid
left join pbx_municipios pm on pb.id_municipio = pm.id
where a.trr_conta_senha = '1'
and a.trr_data >= '$dataIni'
and a.trr_data <= '$dataFim' ";
@ -162,15 +164,15 @@
* TABELA PRINCIPAL
*/
$dadosCabecalio = array(
'Data', 'Empresa', 'Departamento', 'Operadora', 'Tipo',
'Ramal', 'Conta','Usuario','Destino', 'Duracao', 'Valor'
'Data', 'Empresa', 'Departamento', 'Operadora', 'Tipo', 'Localidade',
'UF', 'Ramal', 'Conta', 'Usuario', 'Destino', 'Duracao', 'Valor'
);
$dadosField = array(
'trr_data', 'nome_empresa', 'nome_depto', 'oper_nome',
'ttp_descricao', 'trr_origem', 'trr_conta','apelido' ,'trr_destino',
'trr_inicio', 'nome_empresa', 'nome_depto', 'oper_nome',
'ttp_descricao', 'nome_municipio', 'uf', 'trr_origem', 'trr_conta', 'apelido', 'trr_destino',
'trr_duracao', 'trr_preco_total'
);
);
/*
* Monta a linha de cabecalio.
@ -235,10 +237,15 @@
/*
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$row['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$row['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$row['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$row['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$row['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$row['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$row['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$row['ttp_descricao'] = RemoveAcentos($row['ttp_descricao']);
$row['nome_municipio'] = RemoveAcentos($row['nome_municipio']);
// Formata linha de dados.
$linha = array();
@ -295,13 +302,13 @@
* TABELA PRINCIPAL
*/
$dadosCabecalio = array(
'Data', 'Empresa', 'Departamento', 'Operadora', 'Tipo',
'Ramal', 'Conta', 'Usuario', 'Destino', 'Duracao', 'Valor'
'Data', 'Empresa', 'Departamento', 'Operadora', 'Tipo', 'Localidade',
'UF', 'Ramal', 'Conta', 'Usuario', 'Destino', 'Duracao', 'Valor'
);
$dadosField = array(
'trr_data', 'nome_empresa', 'nome_depto', 'oper_nome',
'ttp_descricao', 'trr_origem', 'trr_conta', 'apelido','trr_destino',
'trr_inicio', 'nome_empresa', 'nome_depto', 'oper_nome',
'ttp_descricao', 'nome_municipio', 'uf', 'trr_origem', 'trr_conta', 'apelido', 'trr_destino',
'trr_duracao', 'trr_preco_total'
);
@ -371,10 +378,14 @@
/*
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$row['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$row['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$row['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$row['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$row['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$row['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$row['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$row['ttp_descricao'] = RemoveAcentos($row['ttp_descricao']);
$row['nome_municipio'] = RemoveAcentos($row['nome_municipio']);
// Formata linha de dados.
$linha = array('DADOS');
@ -411,6 +422,8 @@
'Departamento' => 'align="left"',
'Operadora' => 'align="left"',
'Tipo' => 'align="left"',
'Localidade' => 'align="left"',
'UF' => 'align="left"',
'Ramal' => 'align="left"',
'Conta' => 'align="left"',
'Usuário' => 'align="left"',
@ -420,11 +433,13 @@
);
$dadosField = array(
'trr_data' => 'align="center"',
'trr_inicio' => 'align="center"',
'nome_empresa' => 'align="left"',
'nome_depto' => 'align="left"',
'oper_nome' => 'align="left"',
'ttp_descricao' => 'align="left"',
'nome_municipio' => 'align="left"',
'uf' => 'align="left"',
'trr_origem' => 'align="left"',
'trr_conta' => 'align="left"',
'apelido' => 'align="left"',
@ -441,7 +456,7 @@
/*
* Monta a linha de cabecalio.
*/
$dataRel[] = "<tr><th colspan='11'>Relatório Tarifação por Fatura</th></tr>";
$dataRel[] = "<tr><th colspan='13'>Relatório Tarifação por Fatura</th></tr>";
$linhas = "<tr>";
foreach ($dadosCabecalio as $key => $value) {
$linhas .= sprintf("<th %s>%s</th>", $value, $key);
@ -513,8 +528,10 @@
/*
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$row['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$row['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$row['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$row['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$row['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$row['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$row['trr_destino'] = ocultarTelefone($row['trr_destino']);
/**
@ -531,7 +548,7 @@
/*
* MONTA A TABELA DE AGRUPAMENTO DE ACORDO COM OS DADOS GUARDADOS
*/
$dataRel[] = sprintf("<tr><th align='left' colspan='2'>Chamadas: $somaReg</th><th colspan='7'>Totalizador</th><th align='right'>%s</th><th align='right'>%s</th></tr>", SecondToStrTime($somaDuracao), FormataValor($somaValor));
$dataRel[] = sprintf("<tr><th align='left' colspan='2'>Chamadas: $somaReg</th><th colspan='9'>Totalizador</th><th align='right'>%s</th><th align='right'>%s</th></tr>", SecondToStrTime($somaDuracao), FormataValor($somaValor));
$dataRel[] = '</table>';
$dataRel[] = '<br>';
$dataRel[] = '<table width="70%" cellpadding="2" class="grid">';
@ -555,6 +572,8 @@
protected function ___PreparaPdf() {
list($this->___dataIni, $this->___dataFim) = $_SESSION["SSstorageFiltros"];
$this->settype("L");
/**
* TABELA DADOS PRINCIPAIS
@ -565,20 +584,25 @@
'Departamento' => 'C',
'Operadora' => 'C',
'Tipo' => 'C',
'Localidade' => 'C',
'UF' => 'C',
'Ramal' => 'C',
'Conta' => 'C',
'Usuário' => 'C',
'Usuário' => 'C',
'Destino' => 'C',
'Duração' => 'C',
'Valor' => 'C'
);
$dadosField = array(
'trr_data' => 'C',
'trr_inicio' => 'C',
'nome_empresa' => 'C',
'nome_depto' => 'C',
'oper_nome' => 'C',
'ttp_descricao' => 'C',
'nome_municipio' => 'C',
'uf' => 'C',
'trr_origem' => 'C',
'trr_conta' => 'C',
'apelido' => 'C',
@ -591,7 +615,7 @@
$somaValor = 0;
$somaDuracao = 0;
$agrupado = array();
$widthHeader = array(20, 20, 15, 30, 20, 15, 10, 20, 20, 10, 15);
$widthHeader = array(20, 40, 40, 30, 20, 15, 10, 20, 20, 10, 15, 15);
$dados = $this->GetData()[0];
foreach ($dados as $row) {
/**
@ -639,8 +663,11 @@
/*
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$dados[$somaReg]['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$dados[$somaReg]['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$dados[$somaReg]['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$dados[$somaReg]['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$dados[$somaReg]['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$dados[$somaReg]['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$dados[$somaReg]['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$somaReg ++;
}

113
relatorios/tarifador/tarifaFatura.php

@ -142,7 +142,7 @@
coalesce(e.nome, 'NI') as nome_empresa, coalesce(f.id,0) as id_depto, coalesce(f.nome_depto, 'NI') as nome_depto,
case when(substring(a.trr_destino,1,4) = '0800')then 'Gratuito' else g.ttp_descricao end as ttp_descricao,
(a.trr_duracao / 60)::int as duracao_mininuto, (a.trr_duracao % 60) as duracao_segundo, a.trr_franquia, h.contr_tipo_franquia,
a.trr_duracao as duracao,a.trr_tipo_chamada, a.trr_duracao_transf
a.trr_duracao as duracao,a.trr_tipo_chamada, a.trr_duracao_transf, pcu.apelido, pm.nome_municipio, pm.uf
from pbx_tarif_registra a
inner join pbx_operadoras b on b.oper_id = a.oper_id_dest
inner join pbx_tarif_contrato h on h.contr_id = a.contr_id
@ -150,7 +150,10 @@
left join pbx_centro_custo d on d.cc_id = c.cc_id
left join pbx_empresa e on e.id = d.empresa
left join pbx_departamentos f on f.id = d.departamento
left join pbx_tarifa_tipo_preco g on g.ttp_id = a.trr_vc
left join pbx_tarifa_tipo_preco g on g.ttp_id = a.trr_vc
left join pbx_cs_usuarios pcu on pcu.matricula::text = a.trr_conta
left join pbx_bilhetes pb on a.uniqueid = pb.uniqueid
left join pbx_municipios pm on pb.id_municipio = pm.id
where a.contr_id = '$contr_id'
and a.trr_data >= '$dataIni'
and a.trr_data <= '$dataFim' ";
@ -232,14 +235,35 @@
* TABELA PRINCIPAL
*/
$dadosCabecalio = array(
'Data', 'Empresa', 'Departamento', 'Operadora', 'Tipo',
'Ramal', 'Conta', 'Destino', 'Duracao', 'Valor'
'Data',
'Empresa',
'Departamento',
'Operadora',
'Tipo',
'Localidade',
'UF',
'Ramal',
'Conta',
'Usuario',
'Destino',
'Duracao',
'Valor'
);
$dadosField = array(
'trr_data', 'nome_empresa', 'cc_descricao', 'oper_nome',
'ttp_descricao', 'trr_origem', 'trr_conta', 'trr_destino',
'trr_duracao', 'trr_preco_total'
'trr_inicio',
'nome_empresa',
'cc_descricao',
'oper_nome',
'ttp_descricao',
'nome_municipio',
'uf',
'trr_origem',
'trr_conta',
'apelido',
'trr_destino',
'trr_duracao',
'trr_preco_total'
);
/*
@ -305,9 +329,12 @@
/*
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$row['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$row['trr_destino'] = ocultarTelefone($row['trr_destino']);
$row['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$row['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$row['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$row['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$row['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$row['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$row['ttp_descricao'] = RemoveAcentos($row['ttp_descricao']);
@ -398,14 +425,35 @@
* TABELA PRINCIPAL
*/
$dadosCabecalio = array(
'Data', 'Empresa', 'Departamento', 'Operadora', 'Tipo',
'Ramal', 'Conta', 'Destino', 'Duracao', 'Valor'
'Data',
'Empresa',
'Departamento',
'Operadora',
'Tipo',
'Localidade',
'UF',
'Ramal',
'Conta',
'Usuario',
'Destino',
'Duracao',
'Valor'
);
$dadosField = array(
'trr_data', 'nome_empresa', 'cc_descricao', 'oper_nome',
'ttp_descricao', 'trr_origem', 'trr_conta', 'trr_destino',
'trr_duracao', 'trr_preco_total'
'trr_inicio',
'nome_empresa',
'cc_descricao',
'oper_nome',
'ttp_descricao',
'nome_municipio',
'uf',
'trr_origem',
'trr_conta',
'apelido',
'trr_destino',
'trr_duracao',
'trr_preco_total'
);
/*
@ -476,9 +524,13 @@
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$row['trr_destino'] = ocultarTelefone($row['trr_destino']);
$row['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$row['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$row['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$row['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$row['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$row['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$row['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$row['nome_municipio'] = RemoveAcentos($row['nome_municipio']);
$row['ttp_descricao'] = RemoveAcentos($row['ttp_descricao']);
// Formata linha de dados.
@ -517,21 +569,27 @@
'Departamento' => 'align="left"',
'Operadora' => 'align="left"',
'Tipo' => 'align="left"',
'Localidade' => 'align="left"',
'UF' => 'align="left"',
'Ramal' => 'align="left"',
'Conta' => 'align="left"',
'Usuário' => 'align="left"',
'Destino' => 'align="left"',
'Duração' => 'align="right"',
'Valor' => 'align="right"'
);
$dadosField = array(
'trr_data' => 'align="center"',
'trr_inicio' => 'align="center"',
'nome_empresa' => 'align="left"',
'cc_descricao' => 'align="left"',
'oper_nome' => 'align="left"',
'ttp_descricao' => 'align="left"',
'nome_municipio' => 'align="left"',
'uf' => 'align="left"',
'trr_origem' => 'align="left"',
'trr_conta' => 'align="left"',
'apelido' => 'align="left"',
'trr_destino' => 'align="left"',
'trr_duracao' => 'align="right"',
'trr_preco_total' => 'align="right"'
@ -568,7 +626,7 @@
/*
* Monta a linha de cabecalio.
*/
$dataRel[] = "<tr><th colspan='10'>Relatório Tarifação por Fatura</th></tr>";
$dataRel[] = "<tr><th colspan='13'>Relatório Tarifação por Fatura</th></tr>";
$linhas = "<tr>";
foreach ($dadosCabecalio as $key => $value) {
$linhas .= sprintf("<th %s>%s</th>", $value, $key);
@ -640,8 +698,11 @@
/*
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$row['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$row['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$row['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$row['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$row['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$row['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$row['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$row['trr_destino'] = ocultarTelefone($row['trr_destino']);
/**
@ -658,7 +719,7 @@
/*
* MONTA A TABELA DE AGRUPAMENTO DE ACORDO COM OS DADOS GUARDADOS
*/
$dataRel[] = sprintf("<tr><th align='left' colspan='2'>Chamadas: $somaReg</th><th colspan='6'>Totalizador</th><th align='right'>%s</th><th align='right'>%s</th></tr>", SecondToStrTime($somaDuracao), FormataValor($somaValor));
$dataRel[] = sprintf("<tr><th align='left' colspan='2'>Chamadas: $somaReg</th><th colspan='9'>Totalizador</th><th align='right'>%s</th><th align='right'>%s</th></tr>", SecondToStrTime($somaDuracao), FormataValor($somaValor));
$dataRel[] = '</table>';
$dataRel[] = '<br>';
$dataRel[] = '<table width="70%" cellpadding="2" class="grid">';
@ -684,6 +745,7 @@
list($this->___ano, $this->___mes) = $_SESSION["SSstorageFiltros"];
$this->___dataIni = $this->___mes;
$this->___dataFim = $this->___ano;
$this->settype("L");
/**
* TABELA DADOS PRINCIPAIS
@ -694,21 +756,27 @@
'Departamento' => 'C',
'Operadora' => 'C',
'Tipo' => 'C',
'Localidade' => 'C',
'UF' => 'C',
'Ramal' => 'C',
'Conta' => 'C',
'Usuário' => 'C',
'Destino' => 'C',
'Duração' => 'C',
'Valor' => 'C'
);
$dadosField = array(
'trr_data' => 'C',
'trr_inicio' => 'C',
'nome_empresa' => 'C',
'cc_descricao' => 'C',
'oper_nome' => 'C',
'ttp_descricao' => 'C',
'nome_municipio' => 'C',
'uf' => 'C',
'trr_origem' => 'C',
'trr_conta' => 'C',
'apelido' => 'C',
'trr_destino' => 'C',
'trr_duracao' => 'C',
'trr_preco_total' => 'C'
@ -767,7 +835,7 @@
$somaValor = 0;
$somaDuracao = 0;
$agrupado = array();
$widthHeader = array(20, 20, 20, 30, 25, 20, 10, 20, 20, 10);
$widthHeader = array(20, 25, 25, 20, 20, 60, 10, 10, 10, 20, 25, 25);
$dados = $this->GetData()[0];
foreach ($dados as $row) {
/**
@ -815,8 +883,11 @@
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$dados[$somaReg]['trr_destino'] = ocultarTelefone($row['trr_destino']);
$dados[$somaReg]['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$dados[$somaReg]['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$dados[$somaReg]['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$dados[$somaReg]['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$dados[$somaReg]['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$dados[$somaReg]['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$dados[$somaReg]['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$somaReg ++;
}

75
relatorios/tarifador/tarifaRamal.php

@ -118,7 +118,7 @@
substring(coalesce(e.nome, 'NI'),1,30) as nome_empresa, coalesce(f.id,0) as id_depto, substring(coalesce(f.nome_depto, 'NI'), 1,30) as nome_depto,
case when(substring(a.trr_destino,1,4) = '0800')then 'Gratuito' else g.ttp_descricao end as ttp_descricao,a.trr_preco,
(a.trr_duracao / 60)::int as duracao_mininuto, (a.trr_duracao % 60) as duracao_segundo, a.trr_franquia, h.contr_tipo_franquia, a.trr_duracao as duracao,
a.trr_tipo_chamada, a.trr_duracao_transf
a.trr_tipo_chamada, a.trr_duracao_transf, pcu.apelido, pm.nome_municipio, pm.uf
from pbx_tarif_registra a
inner join pbx_operadoras b on b.oper_id = a.oper_id_dest
inner join pbx_tarif_contrato h on h.contr_id = a.contr_id
@ -126,7 +126,10 @@
left join pbx_centro_custo d on d.cc_id = c.cc_id
left join pbx_empresa e on e.id = d.empresa
left join pbx_departamentos f on f.id = d.departamento
left join pbx_tarifa_tipo_preco g on g.ttp_id = a.trr_vc
left join pbx_tarifa_tipo_preco g on g.ttp_id = a.trr_vc
left join pbx_cs_usuarios pcu on pcu.matricula::text = a.trr_conta
left join pbx_bilhetes pb on a.uniqueid = pb.uniqueid
left join pbx_municipios pm on pb.id_municipio = pm.id
where length(trr_destino) >= 8
and a.trr_data >= '$dataIni'
and a.trr_data <= '$dataFim'";
@ -144,7 +147,6 @@
$query .= " order by a.trr_data, a.trr_inicio ";
$result = $this->___GetQuery($query);
$row = pg_fetch_all($result);
$this->SetData($row ? $row : array());
@ -160,14 +162,14 @@
* TABELA PRINCIPAL
*/
$dadosCabecalio = array(
'Data', 'Empresa', 'Departamento', 'Operadora', 'Tipo',
'Ramal', 'Conta', 'Destino', 'Duracao', 'Valor'
'Data', 'Empresa', 'Departamento', 'Operadora', 'Tipo','Localidade',
'UF', 'Ramal', 'Conta', 'Usuario', 'Destino', 'Duracao', 'Valor'
);
$dadosField = array(
'trr_data', 'nome_empresa', 'cc_descricao', 'oper_nome',
'ttp_descricao', 'trr_origem', 'trr_conta', 'trr_destino',
'trr_duracao', 'trr_preco_total'
'trr_inicio', 'nome_empresa', 'cc_descricao', 'oper_nome',
'ttp_descricao', 'nome_municipio', 'uf', 'trr_origem', 'trr_conta',
'apelido', 'trr_destino', 'trr_duracao', 'trr_preco_total'
);
/*
@ -234,10 +236,14 @@
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$row['trr_destino'] = ocultarTelefone($row['trr_destino']);
$row['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$row['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$row['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$row['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$row['ttp_descricao'] = RemoveAcentos($row['ttp_descricao']);
$row['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$row['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$row['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$row['nome_municipio'] = RemoveAcentos($row['nome_municipio']);
// Formata linha de dados.
$linha = array();
@ -294,14 +300,14 @@
* TABELA PRINCIPAL
*/
$dadosCabecalio = array(
'Data', 'Empresa', 'Departamento', 'Operadora', 'Tipo',
'Ramal', 'Conta', 'Destino', 'Duracao', 'Valor'
'Data', 'Empresa', 'Departamento', 'Operadora', 'Tipo','Localidade',
'UF', 'Ramal', 'Conta', 'Usuario', 'Destino', 'Duracao', 'Valor'
);
$dadosField = array(
'trr_data', 'nome_empresa', 'cc_descricao', 'oper_nome',
'ttp_descricao', 'trr_origem', 'trr_conta', 'trr_destino',
'trr_duracao', 'trr_preco_total'
'trr_inicio', 'nome_empresa', 'cc_descricao', 'oper_nome',
'ttp_descricao', 'nome_municipio', 'uf', 'trr_origem', 'trr_conta',
'apelido', 'trr_destino', 'trr_duracao', 'trr_preco_total'
);
/*
@ -371,10 +377,14 @@
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$row['trr_destino'] = ocultarTelefone($row['trr_destino']);
$row['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$row['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$row['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$row['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$row['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$row['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$row['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$row['ttp_descricao'] = RemoveAcentos($row['ttp_descricao']);
$row['nome_municipio'] = RemoveAcentos($row['nome_municipio']);
// Formata linha de dados.
$linha = array('DADOS');
@ -411,7 +421,10 @@
'Departamento' => 'align="left"',
'Operadora' => 'align="left"',
'Tipo' => 'align="left"',
'Localidade' => 'align="left"',
'UF' => 'align="left"',
'Ramal' => 'align="left"',
'Usuário' => 'align="left"',
'Conta' => 'align="left"',
'Destino' => 'align="left"',
'Duração' => 'align="right"',
@ -419,13 +432,16 @@
);
$dadosField = array(
'trr_data' => 'align="center"',
'trr_inicio' => 'align="center"',
'nome_empresa' => 'align="left"',
'cc_descricao' => 'align="left"',
'oper_nome' => 'align="left"',
'ttp_descricao' => 'align="left"',
'nome_municipio' => 'align="left"',
'uf' => 'align="left"',
'trr_origem' => 'align="left"',
'trr_conta' => 'align="left"',
'apelido' => 'align="left"',
'trr_destino' => 'align="left"',
'trr_duracao' => 'align="right"',
'trr_preco_total' => 'align="right"'
@ -439,7 +455,7 @@
/*
* Monta a linha de cabecalio.
*/
$dataRel[] = "<tr><th colspan='10'>Relatório Tarifação por Fatura</th></tr>";
$dataRel[] = "<tr><th colspan='13'>Relatório Tarifação por Fatura</th></tr>";
$linhas = "<tr>";
foreach ($dadosCabecalio as $key => $value) {
$linhas .= sprintf("<th %s>%s</th>", $value, $key);
@ -511,10 +527,14 @@
/*
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$row['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$row['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$row['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$row['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$row['trr_destino'] = ocultarTelefone($row['trr_destino']);
$row['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$row['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$row['uf'] = $row['uf'] ? $row['uf'] : ' - ';
/**
* MONTA A TABELA DO RELATORIO
*/
@ -529,7 +549,7 @@
/*
* MONTA A TABELA DE AGRUPAMENTO DE ACORDO COM OS DADOS GUARDADOS
*/
$dataRel[] = sprintf("<tr><th align='left' colspan='2'>Chamadas: $somaReg</th><th colspan='6'>Totalizador</th><th align='right'>%s</th><th align='right'>%s</th></tr>", SecondToStrTime($somaDuracao), FormataValor($somaValor));
$dataRel[] = sprintf("<tr><th align='left' colspan='2'>Chamadas: $somaReg</th><th colspan='9'>Totalizador</th><th align='right'>%s</th><th align='right'>%s</th></tr>", SecondToStrTime($somaDuracao), FormataValor($somaValor));
$dataRel[] = '</table>';
$dataRel[] = '<br>';
$dataRel[] = '<table width="70%" cellpadding="2" class="grid">';
@ -553,6 +573,7 @@
protected function ___PreparaPdf() {
list($this->___dataIni, $this->___dataFim) = $_SESSION["SSstorageFiltros"];
$this->settype("L");
/**
* TABELA DADOS PRINCIPAIS
@ -563,21 +584,27 @@
'Departamento' => 'C',
'Operadora' => 'C',
'Tipo' => 'C',
'Localidade' => 'C',
'UF' => 'C',
'Ramal' => 'C',
'Conta' => 'C',
'Usuário' => 'C',
'Destino' => 'C',
'Duração' => 'C',
'Valor' => 'C'
);
$dadosField = array(
'trr_data' => 'C',
'trr_inicio' => 'C',
'nome_empresa' => 'C',
'cc_descricao' => 'C',
'oper_nome' => 'C',
'ttp_descricao' => 'C',
'nome_municipio' => 'C',
'uf' => 'C',
'trr_origem' => 'C',
'trr_conta' => 'C',
'apelido' => 'C',
'trr_destino' => 'C',
'trr_duracao' => 'C',
'trr_preco_total' => 'C'
@ -587,7 +614,8 @@
$somaValor = 0;
$somaDuracao = 0;
$agrupado = array();
$widthHeader = array(20, 20, 20, 30, 25, 20, 10, 20, 20, 10);
//$widthHeader = array(20, 20, 20, 30, 25, 20, 10, 20, 20, 10);
$widthHeader = array(20, 25, 25, 20, 20, 60, 10, 10, 10, 20, 25, 25);
$dados = $this->GetData()[0];
foreach ($dados as $row) {
/**
@ -636,9 +664,12 @@
* FORMATA OS DADOS PARA SER APRESENTADOS
*/
$dados[$somaReg]['trr_destino'] = ocultarTelefone($row['trr_destino']);
$dados[$somaReg]['trr_data'] = date('d/m/Y', strtotime($row['trr_data']));
$dados[$somaReg]['trr_inicio'] = date('d/m/Y H:i:s', strtotime($row['trr_inicio']));
$dados[$somaReg]['trr_conta'] = $row['trr_conta'] ? $row['trr_conta'] : ' - ';
$dados[$somaReg]['trr_duracao'] = $row['trr_duracao'] ? SecondToStrTime($row['trr_duracao']) : '00:00:00';
$dados[$somaReg]['apelido'] = $row['apelido'] ? $row['apelido'] : ' - ';
$dados[$somaReg]['nome_municipio'] = $row['nome_municipio'] ? $row['nome_municipio'] : ' - ';
$dados[$somaReg]['uf'] = $row['uf'] ? $row['uf'] : ' - ';
$somaReg ++;
}
$totalizador = array('Chamadas: ', $somaReg, '', '', 'Totalizador', '', '', '', SecondToStrTime($somaDuracao), FormataValor($somaValor));

Loading…
Cancel
Save