<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Opa Beraldo,<br>
<br>
Joia, vai me quebrar o galho com certeza...ja anotei!!!<br>
<br>
Tamb&eacute;m sou um mero fussador hehehe, mas vou tentar desenvolver algo em
web com suas queries...<br>
<br>
Valeu<br>
<br>
Fernando Beraldo escreveu:
<blockquote cite="mid:4c63f455.071f960a.2701.060c@mx.google.com"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 12 (filtered medium)">
  <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EstiloDeEmail17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#17365D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
-->
  </style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
  <div class="WordSection1">
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">Cara,
eu fiz algumas queries pro Mysql para um cliente, que bilheta
as chamadas no fator 30/6, coisa bem b&aacute;sica. Pois n&atilde;o manjo muito
(rs.rs). S&oacute;
que n&atilde;o tem nada via web, no fim do m&ecirc;s rodo as queries e exporto pro
Excel. &Eacute; mais
um quebra galho mesmo.<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">S&atilde;o
4 queries: Fixo-Local, Cel-Cel, Fixo-DDD, Cel-DDD. As DDI,
como tem a quest&atilde;o dos c&oacute;digos e valores para cada pais eu teria que
ter uma
outra tabela para fazer a consulta, e checar pelo n&uacute;mero, ai complicou
um&nbsp;
pouco. Mas esse cliente quase n&atilde;o tem liga&ccedil;&otilde;es DDI ent&atilde;o nem faz
diferen&ccedil;a.<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">Os
valores do minutos voc&ecirc; pode alterar no &#8220;SELECT CASE
WHEN billsec...&#8221; onde o primeiro valor &eacute; metade do minuto, e outros
dois
s&atilde;o d&eacute;cimos de valor do minutos. Conforme na chamada local. O minuto
custa R$
0,10, ent&atilde;o no primeiro &#8220;ROUND&#8221; coloco &#8220;0.05&#8221; e nos outros
dois coloco &#8220;0.010&#8221; que &eacute; igual &agrave; &#8220;0,10/10=0,010). Lembrando
que n&atilde;o usa virgula no valares e sim ponto.<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">Espero
que seja &uacute;til.<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">Segue
abaixo.<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">--
LISTA TODAS AS LIGA&Ccedil;OES LOCAIS, AGRUPANDO POR DATA, e ORIGEM<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">SELECT
data, origem, destino, SEC_TO_TIME(duracao) as
'duracao-sistema',<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">CASE
WHEN duracao &lt;= 30 THEN '00:00:30</span><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">' WHEN duracao &gt; 30 THEN SEC_TO_TIME(duracao) END AS
'duracao-cliente', valor<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">FROM<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">(SELECT calldate AS data, src AS origem, dst AS destino,
SEC_TO_TIME(billsec)
AS duracao,<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">(SELECT CASE WHEN billsec &gt;= 1 AND billsec &lt;= 30
THEN
ROUND(0.05,2) WHEN billsec &gt; 30 AND (billsec%6 = 0) THEN
ROUND((billsec/6)*0.010,2) ELSE ROUND(FLOOR((billsec/6)+1)*0.010,2)
END) AS
valor<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">FROM cdr<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">WHERE DATE_FORMAT(calldate, '%Y-%m-%d')<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">BETWEEN '2010-07-01'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND '2010-07-31'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND disposition = 'ANSWERED'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND channel LIKE 'S%'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND dstchannel LIKE 'D%'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND dcontext = 'from-internal'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND billsec &gt;= 3<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND (dst LIKE '2_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '3_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '4_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '5_______')<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">ORDER BY origem, data) as g;<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">--
LISTA TODAS AS LIGA&Ccedil;OES CEL-LOCAL, AGRUPANDO POR DATA, e
ORIGEM<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">SELECT
data, origem, destino, SEC_TO_TIME(duracao) as
'duracao-sistema',<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">CASE WHEN duracao &lt;= 30 THEN '00:00:30' WHEN duracao
&gt; 30
THEN SEC_TO_TIME(duracao) END AS 'duracao-cliente', valor<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">FROM<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">(SELECT calldate AS data, src AS origem, dst AS destino,
SEC_TO_TIME(billsec) AS duracao,<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">(SELECT CASE WHEN billsec &gt;= 1 AND billsec &lt;= 30
THEN
ROUND(0.49,2) WHEN billsec &gt; 30 AND (billsec%6 = 0) THEN
ROUND((billsec/6)*0.098,2) ELSE ROUND(FLOOR((billsec/6)+1)*0.098,2)
END) AS
valor<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">FROM cdr<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">WHERE DATE_FORMAT(calldate, '%Y-%m-%d')<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">BETWEEN '2010-07-01'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND '2010-07-31'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND disposition = 'ANSWERED'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND channel LIKE 'S%'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND dstchannel LIKE 'D%'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND dcontext = 'from-internal'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND billsec &gt;= 3<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND (dst LIKE '6_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '7_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '8_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '9_______')<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">ORDER BY origem, data) as g;<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">--
LISTA TODAS AS LIGA&Ccedil;OES DDD-LOCAL, AGRUPANDO POR DATA, e
ORIGEM<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">SELECT
data, origem, destino, SEC_TO_TIME(duracao) as
'duracao-sistema',<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">CASE WHEN duracao &lt;= 30 THEN '00:00:30' WHEN duracao
&gt; 30
THEN SEC_TO_TIME(duracao) END AS 'duracao-cliente', valor<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">FROM<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">(SELECT calldate AS data, src AS origem, dst AS destino,
SEC_TO_TIME(billsec) AS duracao,<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">(SELECT CASE WHEN billsec &gt;= 1 AND billsec &lt;= 30
THEN
ROUND(0.22,2) WHEN billsec &gt; 30 AND (billsec%6 = 0) THEN
ROUND((billsec/6)*0.044,2) ELSE ROUND(FLOOR((billsec/6)+1)*0.044,2)
END) AS
valor<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">FROM cdr<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">WHERE DATE_FORMAT(calldate, '%Y-%m-%d')<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">BETWEEN '2010-07-01'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND '2010-07-31'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND disposition = 'ANSWERED'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND channel LIKE 'S%'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND dstchannel LIKE 'D%'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND dcontext = 'from-internal'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND billsec &gt;= 3<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND (dst LIKE '0____2_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '0____3_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '0____4_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '0____5_______')<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">ORDER BY origem, data) as g;<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">--
LISTA TODAS AS LIGA&Ccedil;OES DDD-CEL, AGRUPANDO POR DATA, e ORIGEM<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">SELECT
data, origem, destino, SEC_TO_TIME(duracao) as
'duracao-sistema',<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">CASE WHEN duracao &lt;= 30 THEN '00:00:30' WHEN duracao
&gt; 30
THEN SEC_TO_TIME(duracao) END AS 'duracao-cliente', valor<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">FROM<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">(SELECT calldate AS data, src AS origem, dst AS destino,
SEC_TO_TIME(billsec)
AS duracao,<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">(SELECT CASE WHEN billsec &gt;= 1 AND billsec &lt;= 30
THEN
ROUND(0.74,2) WHEN billsec &gt; 30 AND (billsec%6 = 0) THEN
ROUND((billsec/6)*0.148,2) ELSE ROUND(FLOOR((billsec/6)+1)*0.148,2)
END) AS
valor<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">FROM cdr<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">WHERE DATE_FORMAT(calldate, '%Y-%m-%d')<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">BETWEEN '2010-07-01'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND '2010-07-31'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND disposition = 'ANSWERED'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND channel LIKE 'S%'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND dstchannel LIKE 'D%'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND dcontext = 'from-internal'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND billsec &gt;= 3<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">AND (dst LIKE '0____6_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '0____7_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '0____8_______'<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">OR dst LIKE '0____9_______')<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US">ORDER BY origem, data) as g;<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"
 lang="EN-US"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">[]&#8217;s<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);">Beraldo<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"><o:p>&nbsp;</o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(23, 54, 93);"><o:p>&nbsp;</o:p></span></p>
  <div>
  <div
 style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">
  <p class="MsoNormal"><b><span
 style="font-size: 10pt; font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: windowtext;">De:</span></b><span
 style="font-size: 10pt; font-family: &quot;Tahoma&quot;,&quot;sans-serif&quot;; color: windowtext;">
<a class="moz-txt-link-abbreviated" href="mailto:asteriskbrasil-bounces@listas.asteriskbrasil.org">asteriskbrasil-bounces@listas.asteriskbrasil.org</a>
[<a class="moz-txt-link-freetext" href="mailto:asteriskbrasil-bounces@listas.asteriskbrasil.org">mailto:asteriskbrasil-bounces@listas.asteriskbrasil.org</a>] <b>Em nome
de </b>Fabiano
Carlos Heringer<br>
  <b>Enviada em:</b> quarta-feira, 11 de agosto de 2010 19:52<br>
  <b>Para:</b> <a class="moz-txt-link-abbreviated" href="mailto:asteriskbrasil@listas.asteriskbrasil.org">asteriskbrasil@listas.asteriskbrasil.org</a><br>
  <b>Assunto:</b> [AsteriskBrasil] Tarifador corporativo<o:p></o:p></span></p>
  </div>
  </div>
  <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
  <p class="MsoNormal"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;">Pessoal,
estou precisando implantar na minha empresa um bilhetador para
monitorar o que
cada uma est&aacute; gastando (os ramais aqui sao liberados para liga&ccedil;&otilde;es).<br>
  <br>
Precisaria de algo simples, somente para controle interno das ligacoes
(em
reais).<br>
  <br>
O A2Billing &eacute; excelente, mas complexo demais, existe algum outro
front-end que
possa me auxiliar nisso?<br>
  <br>
Obrigado</span><o:p></o:p></p>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
KHOMP: qualidade em placas de E1, GSM, FXS e FXO para Asterisk. 
- Hardware com alta disponibilidade de recursos e qualidade KHOMP
- Suporte t&eacute;cnico local qualificado e gratuito 
Conhe&ccedil;a a linha completa de produtos KHOMP em <a class="moz-txt-link-abbreviated" href="http://www.khomp.com.br">www.khomp.com.br</a>
_______________________________________________
Temos tudo para seu projeto VoIP com Asterisk!
Descontos especiais para assinantes da AsteriskBrasil.org.
Registre-se e receba um cupom exclusivo de desconto!
Acesse agora <a class="moz-txt-link-abbreviated" href="http://www.voipmania.com.br">www.voipmania.com.br</a>
______________________________________________
Lista de discuss&otilde;es AsteriskBrasil.org
<a class="moz-txt-link-abbreviated" href="mailto:AsteriskBrasil@listas.asteriskbrasil.org">AsteriskBrasil@listas.asteriskbrasil.org</a>
<a class="moz-txt-link-freetext" href="http://listas.asteriskbrasil.org/mailman/listinfo/asteriskbrasil">http://listas.asteriskbrasil.org/mailman/listinfo/asteriskbrasil</a></pre>
</blockquote>
<br>
</body>
</html>