\n'
result = result + listHeader
for row in c.fetchall():
rowData = "
%s
%s
%s
%s
%s
\n" % (row[0], row[1], row[2], row[4], row[3])
result = result + rowData
return (result + "
\n")
def getCOline():
conn = connectDB()
c = conn.cursor()
order = 'ext_co_line'
result = '
Список внешних линий
'
qwr = "SELECT * FROM ext_co_line ORDER by " + order
c.execute(qwr)
listHeader = '
№ п/п
\n' \
'
Линия
\n' \
'
Номер телефона
\n' \
'
Описание
\n'
result = result + listHeader
for row in c.fetchall():
rowData = "
%s
%s
%s
%s
" % (row[0], row[1], row[2], row[3])
result = result + rowData
return (result + "
\n")
def ReportForm():
txtReportForm = '
Отчёт по звонкам
' \
'
'
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 = '
Список звонков с номера {}
'.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 = '
' \
'
№ п/п
Дата
Время
Внут.номер
Внеш.линия
Вызываемый номер
' \
'
Ring
Длительность
АСС
Код звонка
Направление
\n'
result = result + listHeader
for row in c.fetchall():
rowData = '