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)
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)
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
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
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
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
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