def room_list(request): operators = _getOperators() if request.method == 'POST': cleanData = request.POST.dict() rooms = list(set(Classroom.objects.filter(BUILDING =\ cleanData.get('building','')).values_list('ROOM_NAME', flat=True))) #教室列表 rooms = pinyin(rooms) return render(request, 'account/room_list.html', context=locals())
def get_model_name_customer(model, cleanData): name_list = list(set(model.values_list('name', flat=True))) name_list = pinyin(name_list) name = get_dict_val(cleanData) queryString = '?' + '&'.join( ['%s=%s' % (k, v) for k, v in cleanData.items()]) datas = _filter_name_customer(model, cleanData) return name, name_list, queryString, datas
def building_list(request): operators = _getOperators() cleanData = request.GET.dict() campus_list = list(set(Classroom.objects.values_list('CAMPUS', flat=True))) #校区列表 campus_list = pinyin(campus_list) if request.method == 'POST': cleanData = request.POST.dict() dict.pop(cleanData, 'csrfmiddlewaretoken') if cleanData.get('campus', ''): campus = cleanData['campus'] buildings = list(set(Classroom.objects.filter(\ CAMPUS=campus).values_list('BUILDING', flat=True))) #教学楼列表 buildings = pinyin(buildings) return render(request, 'account/building_list.html', context=locals()) return render(request, 'account/campus_list.html', context=locals())
def picking_list(request, page): """材料报表列表""" cleanData = request.GET.dict() model = Picking.objects if request.method == 'POST': cleanData = request.POST.dict() dict.pop(cleanData, 'csrfmiddlewaretoken') page = int(cleanData.get('page', 1)) name, name_list, queryString, datas = get_model_data(model, cleanData) moneys = round(sum(datas.filter().values_list('money', flat=True)), 2) #金额 求和 data_list, pageList, num_pages, page = djangoPage(datas, page, PAGE_NUM) #调用分页函数 offset = PAGE_NUM * (page - 1) name_list = pinyin(list(set(model.values_list('name', flat=True)))) name_list.insert(0, '') return render(request, 'web/picking/picking_list.html', context=locals())
def delivery_list(request, page): """送货列表""" cleanData = request.GET.dict() model = Delivery.objects if request.method == 'POST': page = 1 cleanData = request.POST.dict() dict.pop(cleanData, 'csrfmiddlewaretoken') name, name_list, queryString, datas = get_model_name_customer( model, cleanData) customer_list = list( set(Deliverycustomer.objects.values_list('name', flat=True))) # 客户名称 customer_list = pinyin(customer_list) customer = get_dict_customer(cleanData) moneys = round(sum(datas.filter().values_list('money', flat=True)), 2) #金额总和 data_list, pageList, num_pages, page = djangoPage(datas, page, PAGE_NUM) #调用分页函数 offset = PAGE_NUM * (page - 1) return render(request, 'web/delivery/delivery_list.html', context=locals())
def materialreport_list(request, page): """材料报表列表""" cleanData = request.GET.dict() model = Materialreport.objects if request.method == 'POST': page = 1 cleanData = request.POST.dict() dict.pop(cleanData, 'csrfmiddlewaretoken') name, name_list, queryString, datas = get_model_data(model, cleanData) lastmonth_money = round( sum(datas.filter().values_list('lastmonth_money', flat=True)), 2) #上月结存金额 求和 income_money = round( sum(datas.filter().values_list('income_money', flat=True)), 2) #收入金额 求和 weighting_money = round( sum(datas.filter().values_list('weighting_money', flat=True)), 2) #加权金额 求和 production_expenditure_money = round( sum(datas.filter().values_list('production_expenditure_money', flat=True)), 2) #生产支出金额 求和 material_expenditure_money = round( sum(datas.filter().values_list('material_expenditure_money', flat=True)), 2) #材料支出金额 求和 sale_money = round(sum(datas.filter().values_list('sale_money', flat=True)), 2) #销售金额 求和 thismonth_money = round( sum(datas.filter().values_list('thismonth_money', flat=True)), 2) #本月结存金额 求和 data_list, pageList, num_pages, page = djangoPage(datas, page, PAGE_NUM) #调用分页函数 offset = PAGE_NUM * (page - 1) name_list = pinyin( list(set(Materialreport.objects.values_list('name', flat=True)))) name_list.insert(0, '') return render(request, 'web/materialreport/materialreport_list.html', context=locals())