first commit

This commit is contained in:
2026-01-02 09:19:43 -03:00
parent 63cf724aaf
commit cc44b7ef4f
187 changed files with 2484 additions and 686 deletions

View File

@@ -7,18 +7,27 @@ class FormsChartOfAccount(forms.ModelForm):
fields = [ fields = [
'name', 'name',
'debit', 'debit',
'credit',
'firm', 'firm',
'prof',
'month',
'notes', 'notes',
] ]
widgets = { widgets = {
'name': forms.TextInput({'class':'form-control'}), 'name': forms.TextInput({'class':'form-control'}),
'debit': forms.CheckboxInput({'class':''}), 'debit': forms.CheckboxInput({'class':''}),
'credit': forms.CheckboxInput({'class':''}),
'firm': forms.CheckboxInput({'class':''}), 'firm': forms.CheckboxInput({'class':''}),
'prof': forms.CheckboxInput({'class':''}),
'month': forms.CheckboxInput({'class':''}),
'notes': forms.Textarea({'class':'form-control','rows':3 , }), 'notes': forms.Textarea({'class':'form-control','rows':3 , }),
} }
labels={ labels={
'name':'Nome', 'name':'Nome',
'debit':'Debito', 'debit':'Debito',
'credit':'Credito',
'firm':'Firma', 'firm':'Firma',
'prof':'Profissinal',
'month':'Mensal',
'notes':'Notas', 'notes':'Notas',
} }

View File

@@ -3,29 +3,51 @@ from Movement.models import Calendar
# from django.utils import timezone # from django.utils import timezone
from django.db.models import Sum from django.db.models import Sum
def metric(Day): def metric(Day):
professionals = Professional.objects.all() professionals = Professional.objects.all()
services = ServiceList.objects.all() services = ServiceList.objects.all()
service_movement = Calendar.objects.filter(date=Day).values() # Importante: removi o .values() aqui para podermos acessar os objetos relacionados (como cliente)
service_movement = Calendar.objects.filter(date=Day)
professionals_report = {} professionals_report = {}
for professional in professionals: for professional in professionals:
professionals_report[professional.name] = {} professionals_report[professional.name] = {}
for service in services: for service in services:
# Filtramos os agendamentos específicos deste profissional e serviço
service_sum = service_movement.filter( service_sum = service_movement.filter(
professional__name=professional.name, professional=professional,
service__name=service.name, service=service,
) )
servSum =service_sum.aggregate(Sum('gross_value'))['gross_value__sum'] or 0
# Cálculo dos totais
servSum = service_sum.aggregate(Sum('gross_value'))['gross_value__sum'] or 0
servCont = service_sum.count() servCont = service_sum.count()
# --- NOVA PARTE: Detalhamento dos clientes ---
# Criamos uma lista com o nome completo de cada cliente atendido
clients_list = []
for appointment in service_sum:
client_name = f"{appointment.client.first_name} {appointment.client.last_name}"
clients_list.append({
'name': client_name,
'time': appointment.time.strftime('%H:%M'), # Opcional: mostra o horário
'value': appointment.gross_value
})
# ---------------------------------------------
professionals_report[professional.name][service.name] = { professionals_report[professional.name][service.name] = {
'servSum':servSum, 'servSum': servSum,
'servCont':servCont, 'servCont': servCont,
'clients': clients_list, # Aqui estão os detalhes que você pediu
} }
sum_of_prof = sum(
sum(service['servSum'] for service in services.values()) # Cálculo do total geral simplificado
for services in professionals_report.values() sum_of_prof = service_movement.aggregate(Sum('gross_value'))['gross_value__sum'] or 0
)
return { return {
'professionals_report':professionals_report, 'professionals_report': professionals_report,
'sum_of_prof':sum_of_prof, 'sum_of_prof': sum_of_prof,
} }

View File

@@ -1,24 +0,0 @@
from Base.models import ProductList
from Movement.models import Stock , Product
from django.db.models import Sum
def metric(Day):
List = ProductList.objects.all()
Products = Product.objects.all()
Stones = Stock.objects.all()
Stones_report = {}
for Prod in List:
sum_ = Stones.filter(
product__name=Prod.name,
).aggregate(Sum('quantity'))['quantity__sum'] or 0
sum_v = Products.filter(
product__name=Prod.name,
).aggregate(Sum('quantity'))['quantity__sum'] or 0
Stones_report[Prod.name] = sum_ - sum_v
return {
'Stone':Stones_report,
}

View File

@@ -0,0 +1,36 @@
from Base.models import ProductList
from Movement.models import Stock , Product
from django.db.models import Avg, Sum
def metric():
products_list = ProductList.objects.all()
stones = Stock.objects.all()
vendas = Product.objects.all()
stones_report = []
for prod in products_list:
# --- QUANTIDADES ---
total_comprado = stones.filter(product__id=prod.id).aggregate(Sum('quantity'))['quantity__sum'] or 0
total_vendido = vendas.filter(product__id=prod.id).aggregate(Sum('quantity'))['quantity__sum'] or 0
estoque_atual = total_comprado - total_vendido
# Média dos valores de gross_value vezes o estoque_atual
media_gross = stones.filter(product__id=prod.id).aggregate(Avg('unit_value'))['unit_value__avg'] or 0
custo_total_estoque = media_gross * estoque_atual
# Média dos valores de net_value vezes o estoque_atual
media_net = vendas.filter(product__id=prod.id).aggregate(Avg('net_value'))['net_value__avg'] or 0
valor_liquido_vendas_estoque = media_net * estoque_atual
if total_comprado > 0 or total_vendido > 0:
stones_report.append({
'produto': prod.name,
'quantidade_estoque': estoque_atual,
'valor_total_estoque_bruto': valor_liquido_vendas_estoque,
'valor_total_estoque_liquido': custo_total_estoque,
'valor_unitario_compra_medio': media_gross, # Alterado para refletir que é uma média
})
return {
'Stone': stones_report,
}

View File

@@ -7,8 +7,9 @@ from Base.models import (
from Movement.models import ( from Movement.models import (
Calendar, Calendar,
Product, Product,
Expense, ExpenseOrCredit,
Stock Stock,
Transition
) )
def metric(): def metric():
@@ -36,31 +37,46 @@ def metric():
# pegando total de Desspesas # pegando total de Desspesas
sum_expense = {} sum_expense = {}
for bank in banks: for bank in banks:
sum_bank = Expense.objects.filter( sum_bank = ExpenseOrCredit.objects.filter(
# active=True, # active=True,
firm=True, # firm=True,
debit=True,
credit=False,
bank__name=bank.name, bank__name=bank.name,
).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0
sum_expense[bank.name] = sum_bank sum_expense[bank.name] = sum_bank
# pegando total de Desspesas Profissinal # pegando total de Desspesas Profissinal
sum_expense_prof = {} sum_expense_credit = {}
for bank in banks: for bank in banks:
sum_bank = Expense.objects.filter( sum_bank = ExpenseOrCredit.objects.filter(
# active=True, # active=True,
firm=False, # firm=True,
debit=False,
credit=True,
bank__name=bank.name, bank__name=bank.name,
).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0
sum_expense_prof[bank.name] = sum_bank sum_expense_credit[bank.name] = sum_bank
# Valores de entrada do estoque # Valores trans. de entrada
sum_stock = {} sum_transition_credit = {}
for bank in banks: for bank in banks:
sum_bank = Stock.objects.filter( sum_bank = Transition.objects.filter(
# active=True, # active=True,
bank__name=bank.name, bank_credit__name=bank.name,
).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0
sum_stock[bank.name] = sum_bank sum_transition_credit[bank.name] = sum_bank
# Valores trans. de saida
sum_transition_debit = {}
for bank in banks:
sum_bank = Transition.objects.filter(
# active=True,
bank_debit__name=bank.name,
).aggregate(Sum('gross_value'))['gross_value__sum'] or 0
sum_transition_debit[bank.name] = sum_bank
# saldo total de tudo # saldo total de tudo
sum_total = {} sum_total = {}
@@ -68,15 +84,23 @@ def metric():
sum_mov_serv_get = sum_mov_serv.get(str(bank.name)) sum_mov_serv_get = sum_mov_serv.get(str(bank.name))
sum_mov_prod_get = sum_mov_prod.get(str(bank.name)) sum_mov_prod_get = sum_mov_prod.get(str(bank.name))
sum_expense_get = sum_expense.get(str(bank.name)) sum_expense_get = sum_expense.get(str(bank.name))
sum_expense_prof_get = sum_expense_prof.get(str(bank.name)) sum_expense_credit_get = sum_expense_credit.get(str(bank.name))
sum_sum_stock = sum_stock.get(str(bank.name)) sum_sum_transition_credit = sum_transition_credit.get(str(bank.name))
sum_sum_transition_debit = sum_transition_debit.get(str(bank.name))
sum_total[bank.name] = ( sum_total[bank.name] = (
sum_mov_serv_get + sum_mov_serv_get +
sum_mov_prod_get - sum_mov_prod_get +
sum_expense_get - sum_expense_credit_get +
sum_expense_prof_get - sum_sum_transition_credit -
sum_sum_stock sum_sum_transition_debit -
sum_expense_get
) )
return sum_total sum_all = sum(sum_total.values()) or 0
return {
'sum_total':sum_total,
'sum_all':sum_all,
}

View File

@@ -0,0 +1,46 @@
from django.db.models import Sum
from django.utils import timezone
from Base.models import (
BankAccount,
ChartOfAccount
)
from Movement.models import (
ExpenseOrCredit,
)
def metric():
# Lista de Bancos
current_month = timezone.localtime(timezone.now()).month
current_year = timezone.localtime(timezone.now()).year
banks = ChartOfAccount.objects.filter(
debit=False,
credit=True,
firm=False,
)
# pegando total de Desspesas Profissinal
sum_expense_prof = {}
for bank in banks:
sum_bank = ExpenseOrCredit.objects.filter(
# active=True,
date__month=current_month,
date__year=current_year,
firm=False,
debit=False,
credit=True,
chart_of_account__name=bank.name,
).aggregate(Sum('gross_value'))['gross_value__sum'] or 0
if sum_bank > 0:
sum_expense_prof[bank.name] = sum_bank
# saldo total de tudo
sum_total = {}
for bank in sum_expense_prof:
sum_expense_get = sum_expense_prof.get(str(bank))
sum_total[bank] = sum_expense_get
sum_all = sum(sum_total.values()) or 0
return {
'sum_total':sum_total,
'sum_all':sum_all,
}

View File

@@ -0,0 +1,45 @@
from django.db.models import Sum
from django.utils import timezone
from collections import defaultdict
from datetime import date
from Base.models import (
BankAccount,
ChartOfAccount
)
from Movement.models import (
ExpenseOrCredit,
)
def metric():
today = date.today()
expenses = ExpenseOrCredit.objects.filter(
firm=True,
debit=True,
date__month=today.month,
date__year=today.year
).select_related('bank', 'chart_of_account').order_by('bank', 'date')
# Estrutura: { 'Nome do Banco': {'registros': [...], 'total_banco': 0} }
grouped_data = {}
total_geral = 0
for expense in expenses:
bank_name = expense.bank.name
if bank_name not in grouped_data:
grouped_data[bank_name] = {'registros': [], 'total_banco': 0}
grouped_data[bank_name]['registros'].append(expense)
# Soma os valores
valor = float(expense.gross_value)
grouped_data[bank_name]['total_banco'] += valor
total_geral += valor
return {
'grouped_data': grouped_data,
'total_geral': total_geral,
}

View File

@@ -0,0 +1,46 @@
from django.db.models import Sum
from django.utils import timezone
from Base.models import (
BankAccount,
ChartOfAccount
)
from Movement.models import (
ExpenseOrCredit,
)
def metric():
# Lista de Bancos
current_month = timezone.localtime(timezone.now()).month
current_year = timezone.localtime(timezone.now()).year
banks = ChartOfAccount.objects.filter(
debit=True,
credit=False,
firm=False,
)
# pegando total de Desspesas Profissinal
sum_expense_prof = {}
for bank in banks:
sum_bank = ExpenseOrCredit.objects.filter(
# active=True,
date__month=current_month,
date__year=current_year,
firm=False,
debit=True,
credit=False,
chart_of_account__name=bank.name,
).aggregate(Sum('gross_value'))['gross_value__sum'] or 0
if sum_bank > 0:
sum_expense_prof[bank.name] = sum_bank
# saldo total de tudo
sum_total = {}
for bank in sum_expense_prof:
sum_expense_get = sum_expense_prof.get(str(bank))
sum_total[bank] = sum_expense_get
sum_all = sum(sum_total.values()) or 0
return {
'sum_total':sum_total,
'sum_all':sum_all,
}

View File

@@ -0,0 +1,36 @@
from django.db.models import Sum,Count
from django.utils import timezone
from Base.models import (
ServiceList,
)
from Movement.models import (
Calendar,
)
def metric():
now = timezone.localtime(timezone.now())
current_month = now.month
current_year = now.year
# Criamos um queryset base para evitar repetição de filtros
base_queryset = Calendar.objects.filter(
date__month=current_month,
date__year=current_year
)
# Breakdown (Agrupado por profissional e serviço)
services_breakdown = base_queryset.values(
'professional__name',
'service__name'
).annotate(
quantidade_feitas=Count('id'),
lucro_liquido=Sum('value_cash')
).order_by('professional__name', 'service__name')
# Total geral de lucro no mês
total_geral = base_queryset.aggregate(total=Sum('value_cash'))['total'] or 0
return {
'services': services_breakdown,
'total': total_geral
}

View File

@@ -1,39 +1,59 @@
from django.db.models import Sum from django.db.models import Sum
from django.utils import timezone from django.utils import timezone
from Base.models import Professional from Base.models import Professional
from Movement.models import Calendar, Expense from Movement.models import Calendar, ExpenseOrCredit
def metric(): def metric():
Professionals = Professional.objects.all() Professionals = Professional.objects.all()
# current_month = timezone.localtime(timezone.now()).month current_month = timezone.localtime(timezone.now()).month
# current_year = timezone.localtime(timezone.now()).year current_year = timezone.localtime(timezone.now()).year
sum_expense_prof = {} sum_expense_prof = {}
for Prof in Professionals:
sum_ = Expense.objects.filter(
# active=True,
firm=False,
professional__name=Prof.name,
# date__month=current_month,
# date__year=current_year
).aggregate(Sum('gross_value'))['gross_value__sum'] or 0
sum_expense_prof[Prof.name] = sum_
sum_serv_prof = {}
for Prof in Professionals: for Prof in Professionals:
sum_ = Calendar.objects.filter( sum_ = Calendar.objects.filter(
# active=True, # active=True,
professional__name=Prof.name, professional__id=Prof.id,
# date__month=current_month, date__month= current_month,
# date__year=current_year date__year= current_year
).aggregate(Sum('prof_money'))['prof_money__sum'] or 0 ).aggregate(Sum('prof_money'))['prof_money__sum'] or 0
sum_serv_prof[Prof.name] = sum_ sum_expense_prof[Prof.name] = sum_
sum_serv_prof_credit = {}
for Prof in Professionals:
sum_ = ExpenseOrCredit.objects.filter(
# active=True,
firm=False,
debit=False,
credit=True,
professional__id=Prof.id,
date__month= current_month,
date__year= current_year
).aggregate(Sum('gross_value'))['gross_value__sum'] or 0
sum_serv_prof_credit[Prof.name] = sum_
sum_serv_prof_debit = {}
for Prof in Professionals:
sum_ = ExpenseOrCredit.objects.filter(
# active=True,
firm=False,
debit=True,
credit=False,
professional__id=Prof.id,
date__month= current_month,
date__year= current_year
).aggregate(Sum('gross_value'))['gross_value__sum'] or 0
sum_serv_prof_debit[Prof.name] = sum_
sum_total = {} sum_total = {}
for total in Professionals: for total in Professionals:
sum1 = sum_serv_prof.get(str(total.name)) sum1 = sum_expense_prof.get(str(total.name))
sum2 = sum_expense_prof.get(str(total.name)) sum2 = sum_serv_prof_credit.get(str(total.name))
sum_total[total.name] = ( sum1 - sum2 ) sum3 = sum_serv_prof_debit.get(str(total.name))
sum_total[total.name] = ( sum1 + sum2 - sum3 )
return sum_total sum_all = sum(sum_total.values()) or 0
return {
'sum_total':sum_total,
'sum_all':sum_all,
}

View File

@@ -0,0 +1,39 @@
from django.db.models import Sum , Count
from django.utils import timezone
from Movement.models import (
Calendar,
ExpenseOrCredit,
ChartOfAccount,
)
def metric(Prof_id):
current_month = timezone.localtime(timezone.now()).month
current_year = timezone.localtime(timezone.now()).year
# pegando total de Despesas
debit = ChartOfAccount.objects.filter(
firm=False,
debit=False,
credit=True,
prof=True,
)
expense = {}
total_geral_despesas = 0
for bank in debit:
sum_bank = ExpenseOrCredit.objects.filter(
# active=True,
date__month=current_month,
date__year=current_year,
chart_of_account__id=bank.id,
professional__id=Prof_id,
)
total_geral_despesas += sum_bank.aggregate(Sum('gross_value'))['gross_value__sum'] or 0
expense[bank.name] = {
'sum_credit': sum_bank.aggregate(Sum('gross_value'))['gross_value__sum'] or 0,
'list_credit': sum_bank ,
}
return {
'sum_credit': expense,
'sum_credit_all': total_geral_despesas,
}

View File

@@ -0,0 +1,39 @@
from django.db.models import Sum , Count
from django.utils import timezone
from Movement.models import (
Calendar,
ExpenseOrCredit,
ChartOfAccount,
)
def metric(Prof_id):
current_month = timezone.localtime(timezone.now()).month
current_year = timezone.localtime(timezone.now()).year
# pegando total de Despesas
debit = ChartOfAccount.objects.filter(
firm=False,
debit=True,
credit=False,
prof=True,
)
expense = {}
total_geral_despesas = 0
for bank in debit:
sum_bank = ExpenseOrCredit.objects.filter(
# active=True,
date__month=current_month,
date__year=current_year,
chart_of_account__id=bank.id,
professional__id=Prof_id,
)
total_geral_despesas += sum_bank.aggregate(Sum('gross_value'))['gross_value__sum'] or 0
expense[bank.name] = {
'sum_expense': sum_bank.aggregate(Sum('gross_value'))['gross_value__sum'] or 0,
'list_expense': sum_bank ,
}
return {
'sum_expense': expense,
'sum_expense_all': total_geral_despesas,
}

View File

@@ -0,0 +1,38 @@
from django.db.models import Sum , Count
from django.utils import timezone
from Movement.models import (
Calendar,
ExpenseOrCredit
)
def metric(Prof_id):
current_month = timezone.localtime(timezone.now()).month
current_year = timezone.localtime(timezone.now()).year
calenda = Calendar.objects.filter(
professional_id=Prof_id,
date__month=current_month,
date__year=current_year,
)
debit = ExpenseOrCredit.objects.filter(
prof=True,
debit=True,
credit=False,
professional_id=Prof_id,
date__month=current_month,
date__year=current_year,
)
credit = ExpenseOrCredit.objects.filter(
prof=True,
debit=False,
credit=True,
professional_id=Prof_id,
date__month=current_month,
date__year=current_year,
)
sum_calenda = calenda.aggregate(Sum('prof_money'))['prof_money__sum'] or 0
sum_debit = calenda.aggregate(Sum('gross_value'))['gross_value__sum'] or 0
sum_credit = calenda.aggregate(Sum('gross_value'))['gross_value__sum'] or 0
all = sum_calenda + sum_credit - sum_debit
return all

View File

@@ -0,0 +1,23 @@
from django.db.models import Sum , Count
from django.utils import timezone
from Movement.models import (
Calendar,
)
def metric(Prof_id):
current_month = timezone.localtime(timezone.now()).month
current_year = timezone.localtime(timezone.now()).year
qs = Calendar.objects.filter(
professional_id=Prof_id,
date__month=current_month,
date__year=current_year,
)
# Contagem de cada serviço realizado
services_breakdown = qs.values('service__name').annotate(
total_performed=Count('id')
).order_by('-total_performed')
return {
'services': services_breakdown,
}

View File

@@ -7,9 +7,9 @@ from Base.Views import (
urlpatterns = [ urlpatterns = [
# URLs de Bancos # URLs de Bancos
path('/', viewsBankAccounts.BankAccountsListView.as_view(), name='BankAccountsListView'), path('', viewsBankAccounts.BankAccountsListView.as_view(), name='BankAccountsListView'),
path('/Create', viewsBankAccounts.BankAccountsCreateView.as_view(), name='BankAccountsCreateView'), path('Create', viewsBankAccounts.BankAccountsCreateView.as_view(), name='BankAccountsCreateView'),
path('/<int:pk>/Detail', viewsBankAccounts.BankAccountsDetailView.as_view(), name='BankAccountsDetailView'), path('<int:pk>/Detail', viewsBankAccounts.BankAccountsDetailView.as_view(), name='BankAccountsDetailView'),
path('/<int:pk>/Update', viewsBankAccounts.BankAccountsUpdateView.as_view(), name='BankAccountsUpdateView'), path('<int:pk>/Update', viewsBankAccounts.BankAccountsUpdateView.as_view(), name='BankAccountsUpdateView'),
path('/<int:pk>/Delete', viewsBankAccounts.BankAccountsDeleteView.as_view(), name='BankAccountsDeleteView'), path('<int:pk>/Delete', viewsBankAccounts.BankAccountsDeleteView.as_view(), name='BankAccountsDeleteView'),
] ]

View File

@@ -11,5 +11,6 @@ urlpatterns = [
path('logout', auth_views.LogoutView.as_view(), name='logout'), path('logout', auth_views.LogoutView.as_view(), name='logout'),
path('dashboard', views.Dashboard.as_view(), name='Dashboard'), path('dashboard', views.Dashboard.as_view(), name='Dashboard'),
path('DashboardAdmin', views.DashboardAdmin.as_view(), name='DashboardAdmin'), path('DashboardAdmin', views.DashboardAdmin.as_view(), name='DashboardAdmin'),
path('DashboardProf', views.DashboardProf.as_view(), name='DashboardProf'),
] ]

View File

@@ -5,9 +5,9 @@ from Base.Views import (
urlpatterns = [ urlpatterns = [
# URLs de Professional # URLs de Professional
path('/', viewsChartOfAccount.ChartOfAccountListView.as_view(), name='ChartOfAccountListView'), path('', viewsChartOfAccount.ChartOfAccountListView.as_view(), name='ChartOfAccountListView'),
path('/Create', viewsChartOfAccount.ChartOfAccountCreateView.as_view(), name='ChartOfAccountCreateView'), path('Create', viewsChartOfAccount.ChartOfAccountCreateView.as_view(), name='ChartOfAccountCreateView'),
path('/<int:pk>/Detail', viewsChartOfAccount.ChartOfAccountDetailView.as_view(), name='ChartOfAccountDetailView'), path('<int:pk>/Detail', viewsChartOfAccount.ChartOfAccountDetailView.as_view(), name='ChartOfAccountDetailView'),
path('/<int:pk>/Update', viewsChartOfAccount.ChartOfAccountUpdateView.as_view(), name='ChartOfAccountUpdateView'), path('<int:pk>/Update', viewsChartOfAccount.ChartOfAccountUpdateView.as_view(), name='ChartOfAccountUpdateView'),
path('/<int:pk>/Delete', viewsChartOfAccount.ChartOfAccountDeleteView.as_view(), name='ChartOfAccountDeleteView'), path('<int:pk>/Delete', viewsChartOfAccount.ChartOfAccountDeleteView.as_view(), name='ChartOfAccountDeleteView'),
] ]

View File

@@ -6,9 +6,9 @@ from Base.Views import (
urlpatterns = [ urlpatterns = [
# URLs de Professional # URLs de Professional
path('/', viewsPayMethod.PayMethodListView.as_view(), name='PayMethodListView'), path('', viewsPayMethod.PayMethodListView.as_view(), name='PayMethodListView'),
path('/Create', viewsPayMethod.PayMethodCreateView.as_view(), name='PayMethodCreateView'), path('Create', viewsPayMethod.PayMethodCreateView.as_view(), name='PayMethodCreateView'),
path('/<int:pk>/Detail', viewsPayMethod.PayMethodDetailView.as_view(), name='PayMethodDetailView'), path('<int:pk>/Detail', viewsPayMethod.PayMethodDetailView.as_view(), name='PayMethodDetailView'),
path('/<int:pk>/Update', viewsPayMethod.PayMethodUpdateView.as_view(), name='PayMethodUpdateView'), path('<int:pk>/Update', viewsPayMethod.PayMethodUpdateView.as_view(), name='PayMethodUpdateView'),
path('/<int:pk>/Delete', viewsPayMethod.PayMethodDeleteView.as_view(), name='PayMethodDeleteView'), path('<int:pk>/Delete', viewsPayMethod.PayMethodDeleteView.as_view(), name='PayMethodDeleteView'),
] ]

View File

@@ -6,9 +6,9 @@ from Base.Views import (
urlpatterns = [ urlpatterns = [
# URLs de Professional # URLs de Professional
path('/', viewsProductList.ProductListListView.as_view(), name='ProductListListView'), path('', viewsProductList.ProductListListView.as_view(), name='ProductListListView'),
path('/Create', viewsProductList.ProductListCreateView.as_view(), name='ProductListCreateView'), path('Create', viewsProductList.ProductListCreateView.as_view(), name='ProductListCreateView'),
path('/<int:pk>/Detail', viewsProductList.ProductListDetailView.as_view(), name='ProductListDetailView'), path('<int:pk>/Detail', viewsProductList.ProductListDetailView.as_view(), name='ProductListDetailView'),
path('/<int:pk>/Update', viewsProductList.ProductListUpdateView.as_view(), name='ProductListUpdateView'), path('<int:pk>/Update', viewsProductList.ProductListUpdateView.as_view(), name='ProductListUpdateView'),
path('/<int:pk>/Delete', viewsProductList.ProductListDeleteView.as_view(), name='ProductListDeleteView'), path('<int:pk>/Delete', viewsProductList.ProductListDeleteView.as_view(), name='ProductListDeleteView'),
] ]

View File

@@ -6,9 +6,9 @@ from Base.Views import (
urlpatterns = [ urlpatterns = [
# URLs de Professional # URLs de Professional
path('/', viewsProfessional.ProfessionalListView.as_view(), name='ProfessionalListView'), path('', viewsProfessional.ProfessionalListView.as_view(), name='ProfessionalListView'),
path('/Create', viewsProfessional.ProfessionalCreateView.as_view(), name='ProfessionalCreateView'), path('Create', viewsProfessional.ProfessionalCreateView.as_view(), name='ProfessionalCreateView'),
path('/<int:pk>/Detail', viewsProfessional.ProfessionalDetailView.as_view(), name='ProfessionalDetailView'), path('<int:pk>/Detail', viewsProfessional.ProfessionalDetailView.as_view(), name='ProfessionalDetailView'),
path('/<int:pk>/Update', viewsProfessional.ProfessionalUpdateView.as_view(), name='ProfessionalUpdateView'), path('<int:pk>/Update', viewsProfessional.ProfessionalUpdateView.as_view(), name='ProfessionalUpdateView'),
path('/<int:pk>/Delete', viewsProfessional.ProfessionalDeleteView.as_view(), name='ProfessionalDeleteView'), path('<int:pk>/Delete', viewsProfessional.ProfessionalDeleteView.as_view(), name='ProfessionalDeleteView'),
] ]

View File

@@ -6,9 +6,9 @@ from Base.Views import (
urlpatterns = [ urlpatterns = [
# URLs de Professional # URLs de Professional
path('/', viewsServiceList.ServiceListListView.as_view(), name='ServiceListListView'), path('', viewsServiceList.ServiceListListView.as_view(), name='ServiceListListView'),
path('/Create', viewsServiceList.ServiceListCreateView.as_view(), name='ServiceListCreateView'), path('Create', viewsServiceList.ServiceListCreateView.as_view(), name='ServiceListCreateView'),
path('/<int:pk>/Detail', viewsServiceList.ServiceListDetailView.as_view(), name='ServiceListDetailView'), path('<int:pk>/Detail', viewsServiceList.ServiceListDetailView.as_view(), name='ServiceListDetailView'),
path('/<int:pk>/Update', viewsServiceList.ServiceListUpdateView.as_view(), name='ServiceListUpdateView'), path('<int:pk>/Update', viewsServiceList.ServiceListUpdateView.as_view(), name='ServiceListUpdateView'),
path('/<int:pk>/Delete', viewsServiceList.ServiceListDeleteView.as_view(), name='ServiceListDeleteView'), path('<int:pk>/Delete', viewsServiceList.ServiceListDeleteView.as_view(), name='ServiceListDeleteView'),
] ]

View File

@@ -5,13 +5,28 @@ from django.utils import timezone
from django.contrib.auth import views as auth_views from django.contrib.auth import views as auth_views
from Base.Metrics.Dashboard import ( from Base.Metrics.Dashboard import (
get_sum_of_professional, get_sum_of_professional,
get_sum_of_stone,
get_sum_of_service, get_sum_of_service,
get_sum_of_professional_detail, get_sum_of_professional_detail,
get_sum_payment_method_service, get_sum_payment_method_service,
get_sum_of_product get_sum_of_product,
) )
from Base.Metrics.DashboardAdmin import get_total_bank,get_total_prof from Base.Metrics.DashboardAdmin import (
get_total_bank,
get_total_prof,
get_sum_of_stone,
get_total_firm,
get_total_expense,
get_total_expense_prof,
get_total_credit_prof,
)
from Base.Metrics.DashboardProf import (
get_total_serv,
get_sum_expense,
get_sum_credit,
get_total_money,
)
from Base.models import Professional
from Movement.models import Calendar
def Home(request): def Home(request):
context = { 'ok':' Tudo ok', } context = { 'ok':' Tudo ok', }
@@ -21,12 +36,11 @@ class Login(auth_views.LoginView):
template_name = 'Login/Login.html' template_name = 'Login/Login.html'
class Dashboard(LoginRequiredMixin, TemplateView): class Dashboard(LoginRequiredMixin, TemplateView):
template_name = 'Login/Dashboard/index.html' template_name = 'Dashboards/Dashboard/index.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
Day = timezone.localtime(timezone.now()) Day = timezone.localtime(timezone.now())
context['Professional'] = get_sum_of_professional.metric(Day) context['Professional'] = get_sum_of_professional.metric(Day)
context['Stone'] = get_sum_of_stone.metric(Day)
context['Service'] = get_sum_of_service.metric(Day) context['Service'] = get_sum_of_service.metric(Day)
context['Sum_of_professional_detail'] = get_sum_of_professional_detail.metric(Day) context['Sum_of_professional_detail'] = get_sum_of_professional_detail.metric(Day)
context['Sum_payment_method_service'] = get_sum_payment_method_service.metric(Day) context['Sum_payment_method_service'] = get_sum_payment_method_service.metric(Day)
@@ -34,9 +48,36 @@ class Dashboard(LoginRequiredMixin, TemplateView):
return context return context
class DashboardAdmin(LoginRequiredMixin, TemplateView): class DashboardAdmin(LoginRequiredMixin, TemplateView):
template_name = 'Login/DashboardAdmin/index.html' template_name = 'Dashboards/DashboardAdmin/index.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context['total_bank'] = get_total_bank.metric() context['total_bank'] = get_total_bank.metric()
context['total_prof'] = get_total_prof.metric() context['total_firm'] = get_total_firm.metric()
# context['total_prof'] = get_total_prof.metric()
context['total_expense'] = get_total_expense.metric()
context['Stone'] = get_sum_of_stone.metric()
# context['total_expense_prof'] = get_total_expense_prof.metric()
# context['total_credit_prof'] = get_total_credit_prof.metric()
return context
class DashboardProf(LoginRequiredMixin, TemplateView):
template_name = 'Dashboards/DashboardProf/index.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
if self.request.GET.get('Prof'):
total_serv = get_total_serv.metric(self.request.GET.get('Prof'))
sum_expense = get_sum_expense.metric(self.request.GET.get('Prof'))
sum_credit = get_sum_credit.metric(self.request.GET.get('Prof'))
sum_money = get_total_money.metric(self.request.GET.get('Prof'))
else:
total_serv = Calendar.objects.none()
sum_expense = Calendar.objects.none()
sum_credit = Calendar.objects.none()
sum_money = Calendar.objects.none()
context['Total_serv'] = total_serv
context['Expense'] = sum_expense
context['Credit'] = sum_credit
context['Money'] = sum_money
context['Professionals'] = Professional.objects.all()
return context return context

View File

@@ -1,4 +1,4 @@
# Generated by Django 5.2.7 on 2025-11-01 11:15 # Generated by Django 6.0 on 2025-12-24 11:22
import django.db.models.deletion import django.db.models.deletion
from django.conf import settings from django.conf import settings
@@ -31,7 +31,9 @@ class Migration(migrations.Migration):
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)), ('name', models.CharField(max_length=100)),
('debit', models.BooleanField(default=True)), ('debit', models.BooleanField(default=True)),
('credit', models.BooleanField(default=False)),
('firm', models.BooleanField(default=True)), ('firm', models.BooleanField(default=True)),
('month', models.BooleanField(default=False)),
('notes', models.TextField(blank=True, null=True)), ('notes', models.TextField(blank=True, null=True)),
], ],
options={ options={

View File

@@ -0,0 +1,18 @@
# Generated by Django 6.0 on 2025-12-24 18:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Base', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='chartofaccount',
name='prof',
field=models.BooleanField(default=True),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.2.8 on 2025-12-26 15:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Base', '0002_chartofaccount_prof'),
]
operations = [
migrations.AlterField(
model_name='chartofaccount',
name='prof',
field=models.BooleanField(default=False),
),
]

View File

@@ -61,7 +61,10 @@ class ProductList(models.Model):
class ChartOfAccount(models.Model): class ChartOfAccount(models.Model):
name = models.CharField(max_length=100) name = models.CharField(max_length=100)
debit = models.BooleanField(default=True) debit = models.BooleanField(default=True)
credit = models.BooleanField(default=False)
firm = models.BooleanField(default=True) firm = models.BooleanField(default=True)
prof = models.BooleanField(default=False)
month = models.BooleanField(default=False)
notes = models.TextField(null=True, blank=True) notes = models.TextField(null=True, blank=True)
class Meta: class Meta:
ordering = ['name'] ordering = ['name']

View File

@@ -31,6 +31,8 @@
<th > Notas </th> <th > Notas </th>
<th width="10%"> Debito </th> <th width="10%"> Debito </th>
<th width="10%"> Firma </th> <th width="10%"> Firma </th>
<th width="10%"> Mensais </th>
<th width="10%"> Prof </th>
<th width="15%"> Ações </th> <th width="15%"> Ações </th>
</tr> </tr>
</thead> </thead>
@@ -44,6 +46,10 @@
{% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td> {% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td>
<td> {% if Chart.firm %} <i class="bi bi-check-circle-fill text-success "></i> <td> {% if Chart.firm %} <i class="bi bi-check-circle-fill text-success "></i>
{% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td> {% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td>
<td> {% if Chart.month %} <i class="bi bi-check-circle-fill text-success "></i>
{% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td>
<td> {% if Chart.prof %} <i class="bi bi-check-circle-fill text-success "></i>
{% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td>
<td> <td>
<a href="{% url 'ChartOfAccountDetailView' Chart.id %}" class="btn btn-info btn-sm"> <a href="{% url 'ChartOfAccountDetailView' Chart.id %}" class="btn btn-info btn-sm">
<i class="bi bi-eye"></i> <i class="bi bi-eye"></i>

View File

@@ -0,0 +1,31 @@
<div class="container-fluid mt-2 bg-dark text-light p-2" style="font-size: 0.85rem;">
<h6 class="text-secondary text-uppercase border-bottom border-secondary pb-1 mb-2">
<i class="bi bi-cart me-1"></i>Produtos
</h6>
<div class="border border-secondary rounded overflow-hidden">
<div class="d-flex justify-content-between px-2 py-1 bg-black bg-opacity-40 text-secondary" style="font-size: 0.7rem;">
<span>PRODUTO (QTD)</span>
<span>TOTAL</span>
</div>
{% for name, value in Sum_of_product.product_report.items %}
{% if value.product_item != 0 %}
<div class="d-flex justify-content-between align-items-center p-1 px-2 border-bottom border-secondary border-opacity-25 bg-opacity-5">
<span class="text-truncate" style="max-width: 70%;">
{{ name }}
<span class="badge bg-secondary ms-1" style="font-size: 0.65rem;">{{ value.product_cont }}x</span>
</span>
<span class="fw-bold">R$ {{ value.product_item|floatformat:2 }}</span>
</div>
{% endif %}
{% empty %}
<div class="p-2 text-center text-muted italic">Vazio.</div>
{% endfor %}
<div class="d-flex justify-content-between align-items-center p-1 px-2 bg-black bg-opacity-50">
<span class="text-uppercase" style="font-size: 0.7rem;">Total da Venda</span>
<span class="text-warning fw-bold">R$ {{ Sum_of_product.sum_of_product|floatformat:2 }}</span>
</div>
</div>
</div>

View File

@@ -0,0 +1,40 @@
<div class="container-fluid mt-2 bg-dark text-light p-2" style="font-size: 0.85rem;">
<h5 class="text-center mb-3 border-bottom border-secondary pb-2 text-uppercase">Resumo de Atendimentos</h5>
<div class="row">
{% for prof_name, services in Sum_of_professional_detail.professionals_report.items %}
<div class="col-12 mb-2">
<div class="border border-secondary rounded p-2 bg-black bg-opacity-10">
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="fw-bold text-info">{{ prof_name }}</span>
</div>
{% for service_name, data in services.items %}
{% if data.servCont > 0 %}
<div class="ps-2 mb-1 border-start border-secondary">
<div class="d-flex justify-content-between " style="font-size: 0.75rem;">
<span>{{ service_name }} ({{ data.servCont }})</span>
<span class="fw-bold">R$ {{ data.servSum|floatformat:2 }}</span>
</div>
{% for client in data.clients %}
<div class="d-flex justify-content-between py-0 px-1 border-bottom border-secondary border-opacity-25 bg-opacity-5">
<span>{{ client.time }} <span class="text-truncate" style="max-width: 60%;">{{ client.name }}</span></span>
<span class="text-success ms-2">R${{ client.value|floatformat:0 }}</span>
</div>
{% endfor %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endfor %}
</div>
<div class="mt-3 p-2 bg-black rounded d-flex justify-content-between align-items-center border border-success border-opacity-50">
<small class="text-secondary text-uppercase">Total Geral</small>
<h6 class="mb-0 text-success">R$ {{ Sum_of_professional_detail.sum_of_prof|floatformat:2 }}</h6>
</div>
</div>
{#<p> Total de Hoje : R$: {{ Sum_of_professional_detail.sum_of_prof|floatformat:2 }}</p>#}
<br>

View File

@@ -0,0 +1,23 @@
<div class="container-fluid mt-2 bg-dark text-light p-2" style="font-size: 0.85rem;">
<h6 class="text-secondary text-uppercase border-bottom border-secondary pb-1 mb-2">
<i class="bi bi-bank me-1"></i>Pagamentos
</h6>
<div class="border border-secondary rounded overflow-hidden">
{% for name, value in Sum_payment_method_service.bank_balance.items %}
{% if value != 0 %}
<div class="d-flex justify-content-between align-items-center p-1 px-2 border-bottom border-secondary border-opacity-25 bg-opacity-5">
<span class="">{{ name }}</span>
<span class="fw-bold">R$ {{ value|floatformat:2 }}</span>
</div>
{% endif %}
{% empty %}
<div class="p-2 text-center text-muted italic">Vazio</div>
{% endfor %}
<div class="d-flex justify-content-between align-items-center p-1 px-2 bg-black bg-opacity-50">
<span class="text-uppercase" style="font-size: 0.7rem;">Total Banco</span>
<span class="text-info fw-bold">R$ {{ Sum_payment_method_service.sum_of_bank|floatformat:2 }}</span>
</div>
</div>
</div>

View File

@@ -0,0 +1,24 @@
{% extends "BaseLogin.html" %}
{% block title %} Dashboard {% endblock %}
{% block content %}
<div class="row">
<div class="col-md-3">
{% include 'Dashboards/Dashboard/Sum_of_professional_detail.html' %}
</div>
<div class="col-md-3">
{% include 'Dashboards/Dashboard/Sum_payment_method_service.html' %}
{% include 'Dashboards/Dashboard/Sum_of_product.html' %}
</div>
</div>
{#<div class="row">#}
{# <div class="col-2">#}
{# <div class="col-md-12">{% include 'Dashboards/Dashboard/Professional.html' %} </div>#}
{# <div class="col-md-12">{% include 'Dashboards/Dashboard/Service.html' %} </div>#}
{# </div>#}
{#</div>#}
{# <br>#}
{% endblock %}

View File

@@ -0,0 +1,51 @@
<div class="container mt-5">
<div class="row">
<div class="col-12">
<div class="card shadow">
<div class="card-header bg-dark d-flex justify-content-between align-items-center">
<h4 class="mb-0 text-white">Relatório de Métricas de Estoque</h4>
<span class="badge bg-primary">Total de Itens: {{ Stone.Stone|length }}</span>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-dark table-hover mb-0">
<thead class="table">
<tr>
<th>Produto</th>
<th class="text-center">Q. Estoque</th>
<th>Custo Bruto </th>
<th>Valor Adquirido </th>
<th>Preço Unit. Compra</th>
</tr>
</thead>
<tbody>
{% for item in Stone.Stone %}
<tr>
<td class="fw-bold text-info">{{ item.produto }}</td>
<td class="text-center">
<span class="badge {% if item.quantidade_estoque > 0 %}bg-success{% else %}bg-danger{% endif %}">
{{ item.quantidade_estoque }}
</span>
</td>
<td>R$ {{ item.valor_total_estoque_bruto|floatformat:2 }}</td>
<td class="text-success-custom">R$ {{ item.valor_total_estoque_liquido|floatformat:2 }}</td>
<td class="text-text-success-custom">R$ {{ item.valor_unitario_compra_medio|floatformat:2 }}</td>
</tr>
{% empty %}
<tr>
<td colspan="5" class="text-center py-4 text-muted">Nenhum registro encontrado.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{# <div class="card-footer bg-dark text-muted">#}
{# <small>Gerado em: {% now "d/m/Y H:i" %}</small>#}
{# </div>#}
</div>
</div>
</div>
</div>
{#{{Stone.}}#}

View File

@@ -0,0 +1,22 @@
{% extends "BaseLogin.html" %}
{% block title %} Dashboard Admin {% endblock %}
{% block content %}
<div class="row">
<div class="col-md-2"> {% include 'Dashboards/DashboardAdmin/total_banck.html' %} </div>
<div class="col-md-3"> {% include 'Dashboards/DashboardAdmin/total_expense.html' %} </div>
<div class="col-md-4"> {% include 'Dashboards/DashboardAdmin/total_firm.html' %} </div>
{# <div class="col-md-3"> {% include 'Dashboards/DashboardAdmin/total_prof_month.html' %} </div>#}
{# <div class="col-md-3"> {% include 'Dashboards/DashboardAdmin/total_expense_prof.html' %} </div>#}
{# <div class="col-md-3"> {% include 'Dashboards/DashboardAdmin/total_credit_prof.html' %} </div>#}
<div class="col-md-2"> {% include 'Dashboards/DashboardAdmin/list-group.html' %} </div>
</div>
<div class="row">
<div class="col-12">
<div class="col-md-6">{% include 'Dashboards/DashboardAdmin/Stone.html' %} </div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,11 @@
<ul class="list-group list-group-flush">
<li class="list-group-item"><a href="{% url 'ProfessionalListView' %}" > Professional </a></li>
<li class="list-group-item"><a href="{% url 'BankAccountsListView' %}" > Banks </a></li>
<li class="list-group-item"><a href="{% url 'PayMethodListView' %}" > Meio de Pagamento </a></li>
<li class="list-group-item"><a href="{% url 'ServiceListListView' %}" > Lista de Serviços </a></li>
<li class="list-group-item"><a href="{% url 'ProductListListView' %}" > Lista de Produtos </a></li>
<li class="list-group-item"><a href="{% url 'ChartOfAccountListView' %}" > Plano de Contas </a></li>
<li class="list-group-item"><a href="{% url 'MovStockListView' %}" > Estoque </a></li>
<li class="list-group-item"><a href="{% url 'MovProductListView' %}" > Venda de Produtos </a></li>
<li class="list-group-item"><a href="{% url 'MovTransitionListView' %}" > Trans. de Contas </a></li>
</ul>

View File

@@ -0,0 +1,38 @@
<div class="card shadow-sm mb-4">
<div class="card-header ">
<h3 class="h5 mb-0">Resumo por Banco</h3>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="table">
<tr>
<th>Banco</th>
<th class="text-end">Total</th>
</tr>
</thead>
<tbody>
{% for name, value in total_bank.sum_total.items %}
<tr>
<td class="fw-bold ">{{ name }}</td>
<td class="text-end ">R$ {{ value|floatformat:2 }}</td>
</tr>
{% empty %}
<tr>
<td colspan="2" class="text-center text-muted py-4">
<i>Nenhum dado encontrado.</i>
</td>
</tr>
{% endfor %}
</tbody>
{% if total_bank.sum_total %}
<tfoot class="table-group-divider">
<tr class="table">
<td class="fw-bold">Total Geral</td>
<td class="text-end fw-bold">R$ {{ total_bank.sum_all|floatformat:2 }}</td>
</tr>
</tfoot>
{% endif %}
</table>
</div>
</div>

View File

@@ -0,0 +1,23 @@
<h3> Credito do Prof. </h3>
<table class="table">
<thead>
<tr>
<th>Banco</th>
<th>Total</th>
</tr>
</thead>
<tbody>
{% for name, value in total_credit_prof.sum_total.items %}
<tr class="table table-striped" >
<td>{{ name }}</td>
<td>R$ {{ value|floatformat:2 }}</td>
</tr>
{% empty %}
<tr>
<td colspan="2"> Vazio. </td>
</tr>
{% endfor %}
</tbody>
</table>
Todos os bancos R$ {{ total_credit_prof.sum_all |floatformat:2 }}

View File

@@ -0,0 +1,48 @@
<div class="container mt-4">
<h4 class="mb-4 text">Relatório de Despesas</h4>
<div class="table-responsive">
<table class="table table-hover border">
<thead class="table-dark">
<tr>
<th scope="col">Data</th>
<th scope="col">Descrição</th>
<th scope="col">Valor</th>
</tr>
</thead>
<tbody>
{% for bank_name, info in total_expense.grouped_data.items %}
<tr>
<td colspan="3" class="text-primary fw-bold border-bottom-0 pt-3">
{{ bank_name|upper }}
</td>
</tr>
{% for item in info.registros %}
<tr>
<td class="ps-4 text-muted">{{ item.date|date:"d/m/Y" }}</td>
<td>{{ item.chart_of_account }}</td>
<td>R$ {{ item.gross_value|floatformat:2 }}</td>
</tr>
{% endfor %}
<tr class="table">
<td colspan="2" class="text-end text-muted small">Subtotal {{ bank_name }}:</td>
<td class="fw-bold small">R$ {{ info.total_banco|floatformat:2 }}</td>
</tr>
{% empty %}
<tr>
<td colspan="3" class="text-center py-4">Sem lançamentos para este mês.</td>
</tr>
{% endfor %}
</tbody>
<tfoot class="table-dark">
<tr>
<td colspan="2" class=" align-middle">TOTAL GERAL DOS BANCOS</td>
<td class="fs-5">R$ {{ total_expense.total_geral|floatformat:2 }}</td>
</tr>
</tfoot>
</table>
</div>
</div>

View File

@@ -1,4 +1,4 @@
<h3> Bancos </h3> <h3> Despesas Prof </h3>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@@ -7,7 +7,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for name, value in total_bank.items %} {% for name, value in total_expense_prof.sum_total.items %}
<tr class="table table-striped" > <tr class="table table-striped" >
<td>{{ name }}</td> <td>{{ name }}</td>
<td>R$ {{ value|floatformat:2 }}</td> <td>R$ {{ value|floatformat:2 }}</td>
@@ -18,4 +18,5 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
Todos os bancos R$ {{ total_expense_prof.sum_all |floatformat:2 }}

View File

@@ -0,0 +1,56 @@
<div class="card shadow-sm border-0 mb-4">
<div class="card-header py-3 d-flex justify-content-between align-items-center">
<h3 class="h5 mb-0 text-primary">
<i class="bi bi-person-check-fill me-2"></i>Resumo de Atendimentos
</h3>
<span class="badge rounded-pill bg-primary px-3">Mês Atual</span>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="table text-secondary">
<tr>
<th class="ps-4">Profissional</th>
<th>Serviço</th>
<th class="text-center">Qtd. Realizada</th>
<th class="text-end pe-4">Lucro Líquido</th>
</tr>
</thead>
<tbody>
{% for item in total_firm.services %}
<tr>
<td class="ps-4">
<span class="fw-bold ">{{ item.professional__name }}</span>
</td>
<td>
<span class="text-muted">{{ item.service__name }}</span>
</td>
<td class="text-center">
<span class="badge bg-light text-dark border">{{ item.quantidade_feitas }}</span>
</td>
<td class="text-end pe-4 fw-semibold text-success">
R$ {{ item.lucro_liquido|floatformat:2 }}
</td>
</tr>
{% empty %}
<tr>
<td colspan="4" class="text-center py-5 text-muted">
<p class="mb-0">Nenhum atendimento registrado até o momento.</p>
</td>
</tr>
{% endfor %}
</tbody>
{% if total_firm.services %}
<tfoot class="table-group-divider">
<tr class="bg-light">
<td colspan="3" class="fw-bold py-3">Total Geral da Firma:</td>
<td class="text-end pe-4 fw-bold text-primary h4 mb-0">
R$ {{ total_firm.total|floatformat:2 }}
</td>
</tr>
</tfoot>
{% endif %}
</table>
</div>
</div>

View File

@@ -7,7 +7,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for name, value in total_prof.items %} {% for name, value in total_prof.sum_total.items %}
<tr class="table table-striped" > <tr class="table table-striped" >
<td>{{ name }}</td> <td>{{ name }}</td>
<td>R$ {{ value|floatformat:2 }}</td> <td>R$ {{ value|floatformat:2 }}</td>
@@ -18,4 +18,5 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
Todos os Prof. R$ {{ total_prof.sum_all |floatformat:2 }}

View File

@@ -0,0 +1,27 @@
<div class="col-12">
<form method="get" action="{% url 'DashboardProf' %}" id="Form"
class="d-flex flex-wrap gap-3">
{% for Prof in Professionals %}
<input type="radio"
class="btn-check"
name="Prof"
id="prof_{{ Prof.id }}"
value="{{ Prof.id }}"
{% if request.GET.Prof == Prof.id|stringformat:"i" %}checked{% endif %}
onchange="this.form.submit();">
<label class="btn btn-outline-primary fw-semibold fs-5 shadow-sm rounded-pill"
for="prof_{{ Prof.id }}">
{{ Prof.name }} {{ Prof.symbol }}
</label>
{% endfor %}
</form>
</div>
<br>
<br>
<br>

View File

@@ -0,0 +1,61 @@
<div class="col-4">
<div class="card shadow-sm">
<div class="card-header">
<h3 class="h5 mb-0">Relatório de Entradas</h3>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="table">
<tr>
<th scope="col" class="ps-4">Descrição / Data</th>
<th scope="col" class="text-end pe-4">Valor (R$)</th>
</tr>
</thead>
<tbody>
{% for nome_servico, dados in Credit.sum_credit.items %}
{# Verifica se a soma do serviço é maior que zero #}
{% if dados.sum_credit > 0 %}
<tr class="table border-bottom">
<td class="ps-4">
<div class="fw-bold">{{ nome_servico }}</div>
</td>
<td class="text-end pe-4">
<span class="badge bg-primary rounded-pill fs-6">
R$ {{ dados.sum_credit|floatformat:2 }}
</span>
</td>
</tr>
{% for detalhe in dados.list_credit %}
{# Verifica se o valor individual é maior que zero #}
{% if detalhe.gross_value > 0 %}
<tr class="border-0">
<td class="ps-5">
<i class="bi bi-arrow-return-right me-2"></i> {{ detalhe.date|date:"d/m/Y" }}
</td>
<td class="text-end pe-4">
{{ detalhe.gross_value|floatformat:2 }}
</td>
</tr>
{% endif %}
{% endfor %}
{% endif %}
{% empty %}
<tr>
<td colspan="2" class="text-center py-4 text-muted">
Nenhum serviço realizado neste mês.
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="card-footer d-flex justify-content-between align-items-center">
<div class="h4 mb-0">Total</div>
<span class="badge bg-primary rounded-pill fs-6">
<div class="h4 mb-0 ">R$ {{ Credit.sum_credit_all|floatformat:2 }}</div>
</span>
</div>
</div>
</div>

View File

@@ -0,0 +1,61 @@
<div class="col-4">
<div class="card shadow-sm">
<div class="card-header">
<h3 class="h5 mb-0">Relatório de Saídas</h3>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="table">
<tr>
<th scope="col" class="ps-4">Descrição / Data</th>
<th scope="col" class="text-end pe-4">Valor (R$)</th>
</tr>
</thead>
<tbody>
{% for nome_servico, dados in Expense.sum_expense.items %}
{# Verifica se a soma do serviço é maior que zero #}
{% if dados.sum_expense > 0 %}
<tr class="table border-bottom">
<td class="ps-4">
<div class="fw-bold">{{ nome_servico }}</div>
</td>
<td class="text-end pe-4">
<span class="badge bg-primary rounded-pill fs-6">
R$ {{ dados.sum_expense|floatformat:2 }}
</span>
</td>
</tr>
{% for detalhe in dados.list_expense %}
{# Verifica se o valor individual é maior que zero #}
{% if detalhe.gross_value > 0 %}
<tr class="border-0">
<td class="ps-5">
<i class="bi bi-arrow-return-right me-2"></i> {{ detalhe.date|date:"d/m/Y" }}
</td>
<td class="text-end pe-4">
{{ detalhe.gross_value|floatformat:2 }}
</td>
</tr>
{% endif %}
{% endfor %}
{% endif %}
{% empty %}
<tr>
<td colspan="2" class="text-center py-4 text-muted">
Nenhum serviço realizado neste mês.
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="card-footer d-flex justify-content-between align-items-center">
<div class="h4 mb-0">Total</div>
<span class="badge bg-primary rounded-pill fs-6">
<div class="h4 mb-0 ">R$ {{ Expense.sum_expense_all|floatformat:2 }}</div>
</span>
</div>
</div>
</div>

View File

@@ -0,0 +1,38 @@
<div class="col-4">
<div class="card shadow-sm mb-4">
<div class="card-header ">
<h3 class="card-title h5 mb-0">Serviços Realizados</h3>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover table-striped mb-0">
<thead class="table">
<tr>
<th scope="col" class="ps-4">Serviço</th>
<th scope="col" class="text-center">Quantidade</th>
</tr>
</thead>
<tbody>
{% for item in Total_serv.services %}
<tr>
<td class="ps-4">{{ item.service__name }}</td>
<td class="text-center">
<span class="badge bg-secondary rounded-pill">
{{ item.total_performed }}
</span>
</td>
</tr>
{% empty %}
<tr>
<td colspan="2" class="text-center py-4 text-muted">
<i class="bi bi-info-circle me-2"></i>
Nenhum serviço realizado neste mês.
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,24 @@
{% extends "BaseLogin.html" %}
{% block title %} Dashboard Prof {% endblock %}
{% block content %}
<div class="row">
{% include 'Dashboards/DashboardProf/List_prof.html' %}
<hr>
<div class="resumo">
<h3>Resumo do Mês</h3>
<p>
<strong>Total Ganho a Receber: R$ </strong>
<span class="fs-4 fw-bold">
{{ Money|floatformat:2 }}
</span>
</p>
</div>
<hr>
{% include 'Dashboards/DashboardProf/Resumo do Mês.html' %}
{% include 'Dashboards/DashboardProf/Relatório de Saídas.html' %}
{% include 'Dashboards/DashboardProf/Relatório de Entradas.html' %}
</div>
{% endblock %}

View File

@@ -1,23 +0,0 @@
<h3> Estoque </h3>
<div class="row">
<table class="table">
<thead>
<tr>
<th>Produtos</th>
<th>Total</th>
</tr>
</thead>
<tbody>
{% for Prod, sum in Stone.Stone.items %}
{% if sum != 0 %}
<tr class="table table-striped" >
<td>{{ Prod }}</td>
<td>{{ sum|floatformat:0 }}</td>
</tr>
{% endif %}
{% empty %} <tr> <td colspan="2"> Vazio. </td> </tr> {% endfor %}
</tbody>
</table>
</div>
<br>

View File

@@ -1,22 +0,0 @@
<h3> Produtos </h3>
<table class="table">
<thead>
<tr>
<th>Produto</th>
<th>Total</th>
<th>Quant.</th>
</tr>
</thead>
<tbody>
{% for name, value in Sum_of_product.product_report.items %}
{% if value.product_item != 0 %}
<tr class="table table-striped" >
<td>{{ name }}</td>
<td>R$ {{ value.product_item|floatformat:2 }}</td>
<td>{{ value.product_cont }}</td>
</tr>
{% endif %}
{% empty %} <tr> <td colspan="2"> Vazio. </td> </tr> {% endfor %}
</tbody>
</table>
<p>Total da Venda : R$: {{ Sum_of_product.sum_of_product|floatformat:2 }}</p>

View File

@@ -1,27 +0,0 @@
<h3 class="mb-4">Relatório de Profissionais</h3>
<table class="table table-striped">
<thead>
<tr>
<th>Profissional</th>
<th>Serviço</th>
<th>Valor Bruto</th>
<th>Quant.</th>
</tr>
</thead>
<tbody>
{% for professional, services in Sum_of_professional_detail.professionals_report.items %}
{% for service, value in services.items %}
{% if value.servSum != 0 %}
<tr>
<td>{{ professional }}</td>
<td>{{ service }}</td>
<td>R$ {{ value.servSum|floatformat:2 }}</td>
<td>{{ value.servCont }}</td>
</tr>
{% endif %}
{% endfor %}
{% endfor %}
</tbody>
</table>
<p> Total de Hoje : R$: {{ Sum_of_professional_detail.sum_of_prof|floatformat:2 }}</p>
<br>

View File

@@ -1,20 +0,0 @@
<h3> Pagamentos </h3>
<table class="table">
<thead>
<tr>
<th>Banco</th>
<th>Total</th>
</tr>
</thead>
<tbody>
{% for name, value in Sum_payment_method_service.bank_balance.items %}
{% if value != 0 %}
<tr class="table table-striped" >
<td>{{ name }}</td>
<td>R$ {{ value|floatformat:2 }}</td>
</tr>
{% endif %}
{% empty %} <tr> <td colspan="2"> Vazio </td> </tr> {% endfor %}
</tbody>
</table>
<p>Total : R$: {{ Sum_payment_method_service.sum_of_bank|floatformat:2 }}</p>

View File

@@ -1,28 +0,0 @@
{% extends "BaseLogin.html" %}
{% block title %} Dashboard {% endblock %}
{% block content %}
<div class="row">
<div class="col-md-6">{% include 'Login/Dashboard/Sum_of_professional_detail.html' %} </div>
<div class="col-md-2"></div>
<div class="col-md-3">{% include 'Login/Dashboard/Stone.html' %} </div>
<div class="col-md-1"> </div>
</div>
<div class="row">
<div class="col-2">
<div class="col-md-12"> {% include 'Login/Dashboard/Sum_payment_method_service.html' %} </div>
</div>
<div class="col-2">
<div class="col-md-12">{% include 'Login/Dashboard/Professional.html' %} </div>
</div>
<div class="col-2">
<div class="col-md-12">{% include 'Login/Dashboard/Sum_of_product.html' %} </div>
</div>
<div class="col-2">
<div class="col-md-12">{% include 'Login/Dashboard/Service.html' %} </div>
</div>
</div>
<br>
{% endblock %}

View File

@@ -1,25 +0,0 @@
{% extends "BaseLogin.html" %}
{% block title %} Dashboard Admin {% endblock %}
{% block content %}
<div class="row">
<div class="col-12">
<a href="{% url 'ProfessionalListView' %}" class="btn btn-primary"> Professional </a><br>
<a href="{% url 'BankAccountsListView' %}" class="btn btn-primary"> Banks </a><br>
<a href="{% url 'PayMethodListView' %}" class="btn btn-primary"> Meio de Pagamento </a><br>
<a href="{% url 'ServiceListListView' %}" class="btn btn-primary"> Lista de Serviços </a><br>
<a href="{% url 'ProductListListView' %}" class="btn btn-primary"> Lista de Produtos </a><br>
<a href="{% url 'ChartOfAccountListView' %}" class="btn btn-primary"> Plano de Contas </a><br>
<a href="{% url 'MovStockListView' %}" class="btn btn-primary"> Estoque </a><br>
<a href="{% url 'MovExpenseListView' %}" class="btn btn-primary"> Despesa </a><br>
<a href="{% url 'MovProductListView' %}" class="btn btn-primary"> Venda de Produtos </a><br>
</div>
</div>
<br>
<div class="row">
<div class="col-md-3">{% include 'Login/DashboardAdmin/total_banck.html' %} </div>
<div class="col-md-3"> {% include 'Login/DashboardAdmin/total_prof_month.html' %} </div>
{# <div class="col-md-3"> </div>#}
{# <div class="col-md-1"> </div>#}
</div>
{% endblock %}

View File

@@ -8,8 +8,10 @@ class FormsClient(forms.ModelForm):
'first_name', 'first_name',
'last_name', 'last_name',
'phone', 'phone',
'professional',
'double_workload', 'double_workload',
'responsable',
'professional',
# 'late',
# 'feed_back', # 'feed_back',
# 'msg_3_months', # 'msg_3_months',
# 'msg_6_months', # 'msg_6_months',
@@ -21,8 +23,10 @@ class FormsClient(forms.ModelForm):
'last_name': forms.TextInput({'class':'form-control'}), 'last_name': forms.TextInput({'class':'form-control'}),
'notes': forms.Textarea({'class':'form-control','rows':3 , }), 'notes': forms.Textarea({'class':'form-control','rows':3 , }),
'phone': forms.NumberInput(attrs={'step': 1, }), 'phone': forms.NumberInput(attrs={'step': 1, }),
'responsable': forms.Select({'class': 'form-control'}),
'professional': forms.Select({'class':'form-control'}), 'professional': forms.Select({'class':'form-control'}),
'double_workload': forms.CheckboxInput({'class':''}), 'double_workload': forms.CheckboxInput({'class':''}),
# 'late': forms.CheckboxInput({'class':''}),
# 'msg_3_months': forms.CheckboxInput({'class':''}), # 'msg_3_months': forms.CheckboxInput({'class':''}),
# 'msg_6_months': forms.CheckboxInput({'class':''}), # 'msg_6_months': forms.CheckboxInput({'class':''}),
# 'msg_12_months': forms.CheckboxInput({'class':''}), # 'msg_12_months': forms.CheckboxInput({'class':''}),
@@ -32,8 +36,10 @@ class FormsClient(forms.ModelForm):
'first_name':'Nome', 'first_name':'Nome',
'last_name':'Sobrenome', 'last_name':'Sobrenome',
'phone':'Telefone', 'phone':'Telefone',
'responsable':'Responsavel',
'professional':'Profissinal', 'professional':'Profissinal',
'double_workload':'Tempo Duplo', 'double_workload':'Tempo Duplo',
# 'late':'Atrazildo',
'notes':'Notas', 'notes':'Notas',
# 'feed_back':'FeedBack', # 'feed_back':'FeedBack',
# 'msg_3_months':'FeedBack', # 'msg_3_months':'FeedBack',

View File

@@ -1,4 +1,4 @@
# Generated by Django 5.2.7 on 2025-11-01 11:15 # Generated by Django 6.0 on 2025-12-24 11:22
import django.db.models.deletion import django.db.models.deletion
from django.conf import settings from django.conf import settings
@@ -24,8 +24,9 @@ class Migration(migrations.Migration):
('updated_at', models.DateTimeField(auto_now=True)), ('updated_at', models.DateTimeField(auto_now=True)),
('first_name', models.CharField(max_length=100)), ('first_name', models.CharField(max_length=100)),
('last_name', models.CharField(max_length=500)), ('last_name', models.CharField(max_length=500)),
('phone', models.DecimalField(decimal_places=0, max_digits=20)), ('phone', models.DecimalField(decimal_places=0, max_digits=11)),
('double_workload', models.BooleanField(default=False)), ('double_workload', models.BooleanField(default=False)),
('last_visit', models.DateField(blank=True, null=True)),
('feed_back', models.BooleanField(default=False)), ('feed_back', models.BooleanField(default=False)),
('msg_3_months', models.BooleanField(default=False)), ('msg_3_months', models.BooleanField(default=False)),
('msg_6_months', models.BooleanField(default=False)), ('msg_6_months', models.BooleanField(default=False)),

View File

@@ -0,0 +1,30 @@
# Generated by Django 5.2.8 on 2025-12-26 15:30
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Base', '0003_alter_chartofaccount_prof'),
('Client', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='client',
name='late',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='client',
name='responsable',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='ClientResponsable', to='Client.client'),
),
migrations.AlterField(
model_name='client',
name='professional',
field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='ClientProfessional', to='Base.professional'),
),
]

View File

@@ -3,20 +3,28 @@ from Base.models import Professional , Base
# Lista de clientes # Lista de clientes
class Client(Base): class Client(Base):
first_name = models.CharField(max_length=100) first_name = models.CharField(max_length=100) # Nome
last_name = models.CharField(max_length=500) last_name = models.CharField(max_length=500) # Sobrenome
phone = models.DecimalField(max_digits=20,decimal_places=0) phone = models.DecimalField(max_digits=12,decimal_places=0) # Whatapp
professional = models.ForeignKey( professional = models.ForeignKey(
Professional, Professional,
on_delete=models.PROTECT, on_delete=models.DO_NOTHING,
related_name='ClientProfessional' related_name='ClientProfessional'
) ) # profissinal do clinte
double_workload = models.BooleanField(default=False) responsable = models.ForeignKey(
feed_back = models.BooleanField(default=False) 'self',
msg_3_months = models.BooleanField(default=False) on_delete=models.DO_NOTHING,
msg_6_months = models.BooleanField(default=False) related_name='ClientResponsable',
msg_12_months = models.BooleanField(default=False) null = True, blank = True
notes = models.TextField(null=True, blank=True) ) #responsalvewl do clinte
double_workload = models.BooleanField(default=False) # Tempo dublo
late = models.BooleanField(default=False) # costuma atrasar
last_visit = models.DateField(null=True, blank=True) # ultimoa visita
feed_back = models.BooleanField(default=False) # feedback no google
msg_3_months = models.BooleanField(default=False) # mensagem de 3 messes que não vem
msg_6_months = models.BooleanField(default=False) # mensagem de 6 messes que não vem
msg_12_months = models.BooleanField(default=False) # mensagem de um ano que não vem
notes = models.TextField(null=True, blank=True) # notas do clinte
class Meta: class Meta:
ordering = ['first_name','last_name'] ordering = ['first_name','last_name']
def __str__(self): def __str__(self):

View File

@@ -2,23 +2,49 @@
{% block title %} List {% endblock %} {% block title %} List {% endblock %}
{% block content %} {% block content %}
<div class="conteiner mt-4"> <div class="container">
<h3 class="display-6"> Cadastrar </h3> <h3 class="mb-4">Cadastrar Cliente</h3>
<div class="card col-md-10"> <div class="card shadow-sm col-md-8 ">
<div class="card-body"> <div class="card-body">
<form method="post" class="form"> <form method="post">
{% csrf_token %} {% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary"> Salvar </button> <div class="mb-3">
</form> <label class="form-label">{{ form.first_name.label }}</label>
<a href="{% url 'ClientListView' %}" class="btn btn-secondary mt-3 "> Cancelar e Voltar </a> {{ form.first_name }}
</div>
<div class="mb-3">
<label class="form-label">{{ form.last_name.label }}</label>
{{ form.last_name }}
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">{{ form.phone.label }}</label>
{{ form.phone }}
</div>
<div class="col-md-6 mb-3">
<label class="form-label">{{ form.double_workload.label }}</label>
{{ form.double_workload }}
</div>
</div>
<div class="mb-3">
<label class="form-label">{{ form.professional.label }}</label>
{{ form.professional }}
</div>
<div class="mt-4 border-top pt-3 d-flex justify-content-between">
<button type="submit" class="btn btn-primary px-4">Salvar Alterações</button>
<button type="button" onclick="history.back()" class="btn btn-outline-secondary">Cancelar e Voltar</button>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>
<script>
</script>
{% endblock %} {% endblock %}

Some files were not shown because too many files have changed in this diff Show More