def copewith_list(request, page): """应付账款列表""" cleanData = request.GET.dict() model = Copewith.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) payments = round(sum(datas.filter().values_list('payment', flat=True)), 2) #付款 求和 moneys = round(sum(datas.filter().values_list('money', flat=True)), 2) #金额 求和 money1s = round(sum(datas.filter().values_list('money1', flat=True)), 2) #金额1 求和 owe_tickets = round( sum(datas.filter().values_list('owe_ticket', flat=True)), 2) #欠票 求和 if get_model_first_id(datas): balances = datas.get(id=get_model_first_id(datas)).balance # 倒数最后一条记录 data_list, pageList, num_pages, page = djangoPage(datas, page, PAGE_NUM) #调用分页函数 offset = PAGE_NUM * (page - 1) return render(request, 'web/copewith/copewith_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 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())
def purchase_list(request, page): """采购列表""" cleanData = request.GET.dict() model = models.Purchase.objects if request.method == 'POST': page = 1 cleanData = request.POST.dict() dict.pop(cleanData, 'csrfmiddlewaretoken') #删除字典中的键'csrfmiddlewaretoken'和值 name, name_list, queryString, datas = get_model_data(model, cleanData) moneys = round(sum(datas.filter().values_list('money', flat=True)), 2) #金额总和 payments = round(sum(datas.filter().values_list('payment', flat=True)), 2) #支付款总和 if datas: balance = datas.filter().get( id=get_model_first_id(datas)).balance #结余款 最后一条记录(-id第一条记录) data_list, pageList, num_pages, page = djangoPage(datas, page, PAGE_NUM) #调用分页函数 offset = PAGE_NUM * (page - 1) return render(request, 'web/purchase/purchase_list.html', context=locals())