예제 #1
0
def LoggerQueryRdr(request):
    roomid = request.GET.get('room_id', None)
    stat = apps.Statistic("record", {'roomid': roomid})
    ret = {'message': 'OK'}

    ret["result"] = stat.handleStatProcess()

    return JsonResponse(ret)
예제 #2
0
def LoggerQueryReport(request):
    qtype = request.GET.get("qtype", None)
    roomid = request.GET.get("room_id", None)
    date = request.GET.get("date", None)

    stat = apps.Statistic(qtype, {'roomid': roomid, 'btime': date})
    ret = {'message': 'OK'}

    ret["result"] = stat.handleStatProcess()

    return JsonResponse(ret)
예제 #3
0
def LoggerPrintRdr(request):
    roomid = request.GET.get('room_id', None)
    stat = apps.Statistic("record", {'roomid': roomid})

    stat.handleStatProcess()
    filename = stat.printStatResult()

    file = open("downloads/" + filename, "rb")
    response = FileResponse(file)
    response['Content-Disposition'] = 'attachment;filename="{}"'.format(
        urlquote(filename))

    return response
예제 #4
0
def LoggerPrintReport(request):
    qtype = request.GET.get("qtype", None)
    roomid = request.GET.get("room_id", None)
    date = request.GET.get("date", None)

    stat = apps.Statistic(qtype, {'roomid': roomid, 'btime': date})

    stat.handleStatProcess()
    filename = stat.printStatResult()

    file = open("downloads/" + filename, "rb")
    response = FileResponse(file)
    response['Content-Disposition'] = 'attachment;filename="{}"'.format(
        urlquote(filename))

    return response
예제 #5
0
def LoggerPrintRdr(request):
    roomid = request.GET.get('room_id', None)
    stat = apps.Statistic("record", {'roomid': roomid})

    stat.handleStatProcess()
    data = stat.printStatResult()
    file = open("record.csv", "w")
    file.write(data)
    file.close()

    file = open("record.csv", "rb")
    response = FileResponse(file)
    response['Content-Type'] = 'application/octet-stream'
    response['Content-Disposition'] = 'attachment;filename="record.csv"'

    return response
예제 #6
0
def LoggerPrintInvoice(request):
    roomid = request.GET.get('room_id', None)
    stat = apps.Statistic("invoice", {'roomid': roomid})

    stat.handleStatProcess()
    data = stat.printStatResult()

    file = open("invoice.csv", "w")
    file.write(data)
    file.close()

    file = open("invoice.csv", "rb")
    response = FileResponse(file)
    response['Content-Type'] = 'text/csv'
    response['Content-Disposition'] = 'attachment;filename="invoice.csv"'

    return response
예제 #7
0
def LoggerPrintReport(request):
    qtype = request.GET.get("qtype", None)
    roomid = request.GET.get("room_id", None)
    date = request.GET.get("date", None)

    stat = apps.Statistic(qtype, {'roomid': roomid, 'btime': date})

    stat.handleStatProcess()
    data = stat.printStatResult()

    file = open("report.csv", "w")
    file.write(data)
    file.close()

    file = open("report.csv", "rb")
    response = FileResponse(file)
    response['Content-Type'] = 'text/csv'
    response['Content-Disposition'] = 'attachment;filename="report.csv"'

    return response