Change CSS. Added report procedure.
This commit is contained in:
parent
9dbbc80009
commit
d7b690dd6a
|
@ -30,18 +30,17 @@ h2{
|
||||||
h3{
|
h3{
|
||||||
font-size:18px;
|
font-size:18px;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
left:50%;
|
|
||||||
/*margin-left:-400px;*/
|
/*margin-left:-400px;*/
|
||||||
padding:10px 0;
|
padding:10px 0;
|
||||||
/*position:absolute;*/
|
/*position:absolute;*/
|
||||||
width:540px;
|
/*width:540px;*/
|
||||||
color:#fff;
|
color:#fff;
|
||||||
text-shadow: 3px 3px 3px #050505;
|
text-shadow: 3px 3px 3px #050505;
|
||||||
}
|
}
|
||||||
h4{
|
h4{
|
||||||
font-size:16px;
|
font-size:16px;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
/*margin-left:20px;*/
|
margin-left:20px;
|
||||||
padding:10px 0;
|
padding:10px 0;
|
||||||
color:#fff;
|
color:#fff;
|
||||||
text-shadow: 2px 2px 2px #050505;
|
text-shadow: 2px 2px 2px #050505;
|
||||||
|
@ -114,3 +113,62 @@ A:hover {
|
||||||
color: #00B4FF;
|
color: #00B4FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
border: 1px solid #696969;
|
||||||
|
border-radius: 5px;
|
||||||
|
/*font: 14px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;*/
|
||||||
|
overflow: hidden;
|
||||||
|
width: 150px;
|
||||||
|
margin-left:20px;
|
||||||
|
padding:10px 0;
|
||||||
|
}
|
||||||
|
fieldset {
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
border-radius: 5px;
|
||||||
|
/*font: 14px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;*/
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.report {
|
||||||
|
padding: 20px 20px 0 20px;
|
||||||
|
}
|
||||||
|
.report label {
|
||||||
|
color: #CAD4D6;
|
||||||
|
font-size: 12px;
|
||||||
|
display: block;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.report input {
|
||||||
|
font-size: 12px;
|
||||||
|
background: #212121;
|
||||||
|
border: 1px solid #696969;
|
||||||
|
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .1);
|
||||||
|
color: #636466;
|
||||||
|
padding: 6px;
|
||||||
|
margin-top: 6px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.report-action {
|
||||||
|
background: #212121;
|
||||||
|
border-top: 1px solid #696969;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
.report-action .btn {
|
||||||
|
background: linear-gradient(#212121, #000000);
|
||||||
|
border: 0;
|
||||||
|
color: #636466;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
float: left;
|
||||||
|
padding: 8px 16px;
|
||||||
|
}
|
||||||
|
.report-action label {
|
||||||
|
color: #7c7c80;
|
||||||
|
font-size: 12px;
|
||||||
|
float: left;
|
||||||
|
margin: 10px 0 0 20px;
|
||||||
|
}
|
56
www/index.py
56
www/index.py
|
@ -1,5 +1,4 @@
|
||||||
import os, sys, \
|
import os, sys, pymysql, urlparse3
|
||||||
pymysql, urlparse3
|
|
||||||
|
|
||||||
def application(environ, start_response):
|
def application(environ, start_response):
|
||||||
#sys.stdout._encoding = 'utf-8'
|
#sys.stdout._encoding = 'utf-8'
|
||||||
|
@ -13,10 +12,11 @@ def application(environ, start_response):
|
||||||
output = bytes((header() + body() + getInternalNumbers() + footer()).encode('utf8'))
|
output = bytes((header() + body() + getInternalNumbers() + footer()).encode('utf8'))
|
||||||
elif paramDict.get('query_type') == 'external':
|
elif paramDict.get('query_type') == 'external':
|
||||||
output = bytes((header() + body() + getCOline() + footer()).encode('utf8'))
|
output = bytes((header() + body() + getCOline() + footer()).encode('utf8'))
|
||||||
|
elif paramDict.get('query_type') == 'report':
|
||||||
|
output = bytes((header() + body() + ReportForm() + ReportData(environ) + footer()).encode('utf8'))
|
||||||
else:
|
else:
|
||||||
output = bytes((header() + body() + footer()).encode('utf8'))
|
output = bytes((header() + body() + footer()).encode('utf8'))
|
||||||
|
|
||||||
|
|
||||||
response_headers = [('Content-type', 'text/html;charset=utf-8'),
|
response_headers = [('Content-type', 'text/html;charset=utf-8'),
|
||||||
('Content-Length', str(len(output)))]
|
('Content-Length', str(len(output)))]
|
||||||
start_response(status, response_headers)
|
start_response(status, response_headers)
|
||||||
|
@ -32,12 +32,12 @@ def header():
|
||||||
return txtHeader
|
return txtHeader
|
||||||
|
|
||||||
def footer():
|
def footer():
|
||||||
txtFooter = '</td></tr></table></body></html>\n'
|
txtFooter = '</body></html>\n'
|
||||||
return txtFooter
|
return txtFooter
|
||||||
|
|
||||||
def body():
|
def body():
|
||||||
txtBody = '<table><tr><td><h2 align=left>ТЕЛЕФОНЫ</h2></td></tr>\n' \
|
txtBody = '<table><tr><td><h2 align=left>ТЕЛЕФОНЫ</h2></td></tr>\n' \
|
||||||
'<tr><td>{}</td></tr><tr><td>\n'.format(menu())
|
'<tr><td>{}</td></tr></table>\n'.format(menu())
|
||||||
return txtBody
|
return txtBody
|
||||||
def menu():
|
def menu():
|
||||||
#<div class="container">
|
#<div class="container">
|
||||||
|
@ -45,7 +45,7 @@ def menu():
|
||||||
'<li><a class="hsubs" href="#">Справочник</a><ul class="subs">\n' \
|
'<li><a class="hsubs" href="#">Справочник</a><ul class="subs">\n' \
|
||||||
'<li><a href="?query_type=external">Городские телефоны</a></li>\n' \
|
'<li><a href="?query_type=external">Городские телефоны</a></li>\n' \
|
||||||
'<li><a href="?query_type=internal">Внутренние</a></li></ul></li>\n' \
|
'<li><a href="?query_type=internal">Внутренние</a></li></ul></li>\n' \
|
||||||
'<li><a class="hsubs" href="">Отчёты</a><ul class="subs"><li><a href="#">Звонки по отделам</a></li>\n' \
|
'<li><a class="hsubs" href="">Отчёты</a><ul class="subs"><li><a href="?query_type=report">Звонки по отделам</a></li>\n' \
|
||||||
'</ul></div>\n'
|
'</ul></div>\n'
|
||||||
return txtMenu
|
return txtMenu
|
||||||
|
|
||||||
|
@ -83,11 +83,51 @@ def getCOline():
|
||||||
result = result + rowData
|
result = result + rowData
|
||||||
return (result + "</table>\n")
|
return (result + "</table>\n")
|
||||||
|
|
||||||
|
def ReportForm():
|
||||||
|
txtReportForm = '<h3 align=center>Отчёт по звонкам</h3><table><tr valign=top><td>' \
|
||||||
|
'<form><input type=hidden name="query_type" value="report">' \
|
||||||
|
'<fieldset class="report">' \
|
||||||
|
'<label>Номер<input type="text" name="int_number"></label>' \
|
||||||
|
'<label>Период с<input type="date" name="date_begin"></label>' \
|
||||||
|
'<label>По<input type="date" name="date_end"></label>' \
|
||||||
|
'</fieldset>' \
|
||||||
|
'<fieldset class="report-action">' \
|
||||||
|
'<input class="btn" type="submit" name="submit" value="Выбрать">' \
|
||||||
|
'</fieldset></form></td>'
|
||||||
|
return txtReportForm
|
||||||
|
|
||||||
|
def ReportData(environ):
|
||||||
|
paramDict = {item.split('=')[0]: item.split('=')[1] for item in environ['QUERY_STRING'].split('&')}
|
||||||
|
numbers = paramDict.get('int_number')
|
||||||
|
date_begin = paramDict.get('date_begin')
|
||||||
|
date_end = paramDict.get('date_end')
|
||||||
|
|
||||||
|
conn = connectDB()
|
||||||
|
c = conn.cursor()
|
||||||
|
order = 'call_date'
|
||||||
|
result = '<td><h4 align=left>Список звонков с номера {}</h4>'.format(numbers)
|
||||||
|
qwr = "SELECT * FROM ats.cdr where int_number=\'{}\' AND call_date BETWEEN CAST(\'{}\' AS DATE) AND CAST(\'{}\' AS DATE) LIMIT 1000".format(numbers, date_begin, date_end)
|
||||||
|
|
||||||
|
c.execute(qwr)
|
||||||
|
listHeader = '<table class="table_dark"><tr>' \
|
||||||
|
'<th>№ п/п</th><th>Дата</th><th>Время</th><th>Внут.номер</th><th>Внеш.линия</th><th>Вызываемый номер</th>' \
|
||||||
|
'<th>Ring</th><th>Длительность</th><th>АСС</th><th>Код звонка</th><th>Направление</th><tr>\n'
|
||||||
|
|
||||||
|
result = result + listHeader
|
||||||
|
|
||||||
|
for row in c.fetchall():
|
||||||
|
rowData = '<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>'\
|
||||||
|
% (row[0], row[1], row[2], row[3], row[4], row[5], row[5], row[7], row[9], row[9], row[10])
|
||||||
|
|
||||||
|
result = result + rowData
|
||||||
|
return (result + "</table></td></tr></table>\n" + qwr)
|
||||||
|
|
||||||
|
|
||||||
def connectDB():
|
def connectDB():
|
||||||
c = pymysql.connect(
|
c = pymysql.connect(
|
||||||
db='ats_test',
|
db='ats_test',
|
||||||
user='ats',
|
user='ats',
|
||||||
passwd='',
|
passwd='T,fkfqneyU',
|
||||||
host='kis',
|
host='kis',
|
||||||
charset='utf8')
|
charset='utf8')
|
||||||
return c
|
return c
|
||||||
|
|
Loading…
Reference in New Issue
Block a user