在营业部信息系统类型里增加一行统计信息
This commit is contained in:
Binary file not shown.
@@ -51,7 +51,7 @@
|
||||
{% if budgets %}
|
||||
{% for budget in budgets %}
|
||||
<div class="mb-6">
|
||||
<h3 class="text-lg font-semibold mb-3">{{ budget.activity.name }} - 总预算: ¥{{ budget.total_budget }}</h3>
|
||||
<h3 class="text-lg font-semibold mb-3">{{ budget.name }} - 总预算: ¥{{ budget.total_budget }}</h3>
|
||||
|
||||
<!-- 设备预算部分 -->
|
||||
<div class="mb-4">
|
||||
|
||||
@@ -33,6 +33,14 @@
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tr class="bg-gray-200 font-bold">
|
||||
<td class="px-6 py-4 whitespace-no-wrap text-left border-b border-gray-200">
|
||||
分支机构类别统计
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-no-wrap text-left border-b border-gray-200">
|
||||
A型: {{ type_a_count }}家 | B型: {{ type_b_count }}家 | C型: {{ type_c_count }}家
|
||||
</td>
|
||||
</tr>
|
||||
<tfoot>
|
||||
<tr class="bg-gray-50">
|
||||
<td colspan="2" class="px-6 py-4 text-right border-b border-gray-200">
|
||||
|
||||
@@ -56,7 +56,7 @@ def branch_detail(request, branch_id):
|
||||
public_screens = branch.public_screens.all()
|
||||
|
||||
# 获取预算数据
|
||||
budgets = Budget.objects.filter(branch=branch).select_related('activity').prefetch_related('equipment_budgets', 'infrastructure_budgets').order_by('-created_at')
|
||||
budgets = Budget.objects.filter(branch=branch).prefetch_related('equipment_budgets', 'infrastructure_budgets').order_by('-created_at')
|
||||
|
||||
# 获取预算模板
|
||||
budget_templates = BudgetTemplate.objects.all()
|
||||
@@ -228,8 +228,17 @@ def BranchAll(request):
|
||||
|
||||
# 生成branchinfo的视图
|
||||
def Branchinfo(request):
|
||||
branches = Branch.objects.all
|
||||
context = {'branches': branches, }
|
||||
branches = Branch.objects.all()
|
||||
# 统计A型、B型、C型分支机构的数量
|
||||
type_a_count = branches.filter(category='A型').count()
|
||||
type_b_count = branches.filter(category='B型').count()
|
||||
type_c_count = branches.filter(category='C型').count()
|
||||
context = {
|
||||
'branches': branches,
|
||||
'type_a_count': type_a_count,
|
||||
'type_b_count': type_b_count,
|
||||
'type_c_count': type_c_count,
|
||||
}
|
||||
return render(request, 'branch_info.html', context)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user