diff --git a/Base/Forms/FormsChartOfAccount.py b/Base/Forms/FormsChartOfAccount.py index 6af4c7c..e452c0f 100644 --- a/Base/Forms/FormsChartOfAccount.py +++ b/Base/Forms/FormsChartOfAccount.py @@ -7,18 +7,27 @@ class FormsChartOfAccount(forms.ModelForm): fields = [ 'name', 'debit', + 'credit', 'firm', + 'prof', + 'month', 'notes', ] widgets = { 'name': forms.TextInput({'class':'form-control'}), 'debit': forms.CheckboxInput({'class':''}), + 'credit': forms.CheckboxInput({'class':''}), 'firm': forms.CheckboxInput({'class':''}), + 'prof': forms.CheckboxInput({'class':''}), + 'month': forms.CheckboxInput({'class':''}), 'notes': forms.Textarea({'class':'form-control','rows':3 , }), } labels={ 'name':'Nome', 'debit':'Debito', + 'credit':'Credito', 'firm':'Firma', + 'prof':'Profissinal', + 'month':'Mensal', 'notes':'Notas', } \ No newline at end of file diff --git a/Base/Forms/__pycache__/FormsBankAccounts.cpython-312.pyc b/Base/Forms/__pycache__/FormsBankAccounts.cpython-312.pyc index e19dd4c..a2a489c 100644 Binary files a/Base/Forms/__pycache__/FormsBankAccounts.cpython-312.pyc and b/Base/Forms/__pycache__/FormsBankAccounts.cpython-312.pyc differ diff --git a/Base/Forms/__pycache__/FormsChartOfAccount.cpython-312.pyc b/Base/Forms/__pycache__/FormsChartOfAccount.cpython-312.pyc index 8386dfa..2311135 100644 Binary files a/Base/Forms/__pycache__/FormsChartOfAccount.cpython-312.pyc and b/Base/Forms/__pycache__/FormsChartOfAccount.cpython-312.pyc differ diff --git a/Base/Forms/__pycache__/FormsPayMethod.cpython-312.pyc b/Base/Forms/__pycache__/FormsPayMethod.cpython-312.pyc index 8bf2bab..8b54bd9 100644 Binary files a/Base/Forms/__pycache__/FormsPayMethod.cpython-312.pyc and b/Base/Forms/__pycache__/FormsPayMethod.cpython-312.pyc differ diff --git a/Base/Forms/__pycache__/FormsProductList.cpython-312.pyc b/Base/Forms/__pycache__/FormsProductList.cpython-312.pyc index 6e81383..5667b4e 100644 Binary files a/Base/Forms/__pycache__/FormsProductList.cpython-312.pyc and b/Base/Forms/__pycache__/FormsProductList.cpython-312.pyc differ diff --git a/Base/Forms/__pycache__/FormsProfessional.cpython-312.pyc b/Base/Forms/__pycache__/FormsProfessional.cpython-312.pyc index 661b6f3..cfab419 100644 Binary files a/Base/Forms/__pycache__/FormsProfessional.cpython-312.pyc and b/Base/Forms/__pycache__/FormsProfessional.cpython-312.pyc differ diff --git a/Base/Forms/__pycache__/FormsServiceList.cpython-312.pyc b/Base/Forms/__pycache__/FormsServiceList.cpython-312.pyc index 84f018d..4e15775 100644 Binary files a/Base/Forms/__pycache__/FormsServiceList.cpython-312.pyc and b/Base/Forms/__pycache__/FormsServiceList.cpython-312.pyc differ diff --git a/Base/Metrics/Dashboard/get_sum_of_professional_detail.py b/Base/Metrics/Dashboard/get_sum_of_professional_detail.py index 41c320e..2531f67 100644 --- a/Base/Metrics/Dashboard/get_sum_of_professional_detail.py +++ b/Base/Metrics/Dashboard/get_sum_of_professional_detail.py @@ -3,29 +3,51 @@ from Movement.models import Calendar # from django.utils import timezone from django.db.models import Sum + def metric(Day): professionals = Professional.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 = {} + for professional in professionals: professionals_report[professional.name] = {} + for service in services: + # Filtramos os agendamentos específicos deste profissional e serviço service_sum = service_movement.filter( - professional__name=professional.name, - service__name=service.name, + professional=professional, + 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() + + # --- 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] = { - 'servSum':servSum, - 'servCont':servCont, + 'servSum': servSum, + '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()) - for services in professionals_report.values() - ) + + # Cálculo do total geral simplificado + sum_of_prof = service_movement.aggregate(Sum('gross_value'))['gross_value__sum'] or 0 + return { - 'professionals_report':professionals_report, - 'sum_of_prof':sum_of_prof, + 'professionals_report': professionals_report, + 'sum_of_prof': sum_of_prof, } \ No newline at end of file diff --git a/Base/Metrics/Dashboard/get_sum_of_stone.py b/Base/Metrics/Dashboard/get_sum_of_stone.py deleted file mode 100644 index 2dcb0c1..0000000 --- a/Base/Metrics/Dashboard/get_sum_of_stone.py +++ /dev/null @@ -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, - } diff --git a/Base/Metrics/DashboardAdmin/__pycache__/get_total_bank.cpython-312.pyc b/Base/Metrics/DashboardAdmin/__pycache__/get_total_bank.cpython-312.pyc index c56721a..184bafe 100644 Binary files a/Base/Metrics/DashboardAdmin/__pycache__/get_total_bank.cpython-312.pyc and b/Base/Metrics/DashboardAdmin/__pycache__/get_total_bank.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardAdmin/__pycache__/get_total_credit_prof.cpython-312.pyc b/Base/Metrics/DashboardAdmin/__pycache__/get_total_credit_prof.cpython-312.pyc new file mode 100644 index 0000000..a8af031 Binary files /dev/null and b/Base/Metrics/DashboardAdmin/__pycache__/get_total_credit_prof.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardAdmin/__pycache__/get_total_expense.cpython-312.pyc b/Base/Metrics/DashboardAdmin/__pycache__/get_total_expense.cpython-312.pyc new file mode 100644 index 0000000..c9ea6b4 Binary files /dev/null and b/Base/Metrics/DashboardAdmin/__pycache__/get_total_expense.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardAdmin/__pycache__/get_total_expense_prof.cpython-312.pyc b/Base/Metrics/DashboardAdmin/__pycache__/get_total_expense_prof.cpython-312.pyc new file mode 100644 index 0000000..6fffdf7 Binary files /dev/null and b/Base/Metrics/DashboardAdmin/__pycache__/get_total_expense_prof.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardAdmin/__pycache__/get_total_firm.cpython-312.pyc b/Base/Metrics/DashboardAdmin/__pycache__/get_total_firm.cpython-312.pyc new file mode 100644 index 0000000..3d4e5b7 Binary files /dev/null and b/Base/Metrics/DashboardAdmin/__pycache__/get_total_firm.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardAdmin/__pycache__/get_total_prof.cpython-312.pyc b/Base/Metrics/DashboardAdmin/__pycache__/get_total_prof.cpython-312.pyc index c674e5e..2771f97 100644 Binary files a/Base/Metrics/DashboardAdmin/__pycache__/get_total_prof.cpython-312.pyc and b/Base/Metrics/DashboardAdmin/__pycache__/get_total_prof.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardAdmin/get_sum_of_stone.py b/Base/Metrics/DashboardAdmin/get_sum_of_stone.py new file mode 100644 index 0000000..f928b28 --- /dev/null +++ b/Base/Metrics/DashboardAdmin/get_sum_of_stone.py @@ -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, + } diff --git a/Base/Metrics/DashboardAdmin/get_total_bank.py b/Base/Metrics/DashboardAdmin/get_total_bank.py index 7abc551..1775f7c 100644 --- a/Base/Metrics/DashboardAdmin/get_total_bank.py +++ b/Base/Metrics/DashboardAdmin/get_total_bank.py @@ -7,8 +7,9 @@ from Base.models import ( from Movement.models import ( Calendar, Product, - Expense, - Stock + ExpenseOrCredit, + Stock, + Transition ) def metric(): @@ -36,31 +37,46 @@ def metric(): # pegando total de Desspesas sum_expense = {} for bank in banks: - sum_bank = Expense.objects.filter( + sum_bank = ExpenseOrCredit.objects.filter( # active=True, - firm=True, + # firm=True, + debit=True, + credit=False, bank__name=bank.name, ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 sum_expense[bank.name] = sum_bank - # pegando total de Desspesas Profissinal - sum_expense_prof = {} + # pegando total de Desspesas Profissinal + sum_expense_credit = {} for bank in banks: - sum_bank = Expense.objects.filter( + sum_bank = ExpenseOrCredit.objects.filter( # active=True, - firm=False, + # firm=True, + debit=False, + credit=True, bank__name=bank.name, ).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 - sum_stock = {} + # Valores trans. de entrada + sum_transition_credit = {} for bank in banks: - sum_bank = Stock.objects.filter( + sum_bank = Transition.objects.filter( # active=True, - bank__name=bank.name, + bank_credit__name=bank.name, ).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 sum_total = {} @@ -68,15 +84,23 @@ def metric(): sum_mov_serv_get = sum_mov_serv.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_prof_get = sum_expense_prof.get(str(bank.name)) - sum_sum_stock = sum_stock.get(str(bank.name)) + sum_expense_credit_get = sum_expense_credit.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_mov_serv_get + - sum_mov_prod_get - - sum_expense_get - - sum_expense_prof_get - - sum_sum_stock + sum_mov_prod_get + + sum_expense_credit_get + + sum_sum_transition_credit - + sum_sum_transition_debit - + sum_expense_get + ) - return sum_total \ No newline at end of file + sum_all = sum(sum_total.values()) or 0 + + return { + 'sum_total':sum_total, + 'sum_all':sum_all, + } \ No newline at end of file diff --git a/Base/Metrics/DashboardAdmin/get_total_credit_prof.py b/Base/Metrics/DashboardAdmin/get_total_credit_prof.py new file mode 100644 index 0000000..b7f1709 --- /dev/null +++ b/Base/Metrics/DashboardAdmin/get_total_credit_prof.py @@ -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, + } \ No newline at end of file diff --git a/Base/Metrics/DashboardAdmin/get_total_expense.py b/Base/Metrics/DashboardAdmin/get_total_expense.py new file mode 100644 index 0000000..c3330bc --- /dev/null +++ b/Base/Metrics/DashboardAdmin/get_total_expense.py @@ -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, + } + + diff --git a/Base/Metrics/DashboardAdmin/get_total_expense_prof.py b/Base/Metrics/DashboardAdmin/get_total_expense_prof.py new file mode 100644 index 0000000..1c4846e --- /dev/null +++ b/Base/Metrics/DashboardAdmin/get_total_expense_prof.py @@ -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, + } \ No newline at end of file diff --git a/Base/Metrics/DashboardAdmin/get_total_firm.py b/Base/Metrics/DashboardAdmin/get_total_firm.py new file mode 100644 index 0000000..59e22b7 --- /dev/null +++ b/Base/Metrics/DashboardAdmin/get_total_firm.py @@ -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 + } \ No newline at end of file diff --git a/Base/Metrics/DashboardAdmin/get_total_prof.py b/Base/Metrics/DashboardAdmin/get_total_prof.py index dbcca31..64582a0 100644 --- a/Base/Metrics/DashboardAdmin/get_total_prof.py +++ b/Base/Metrics/DashboardAdmin/get_total_prof.py @@ -1,39 +1,59 @@ from django.db.models import Sum from django.utils import timezone from Base.models import Professional -from Movement.models import Calendar, Expense +from Movement.models import Calendar, ExpenseOrCredit def metric(): Professionals = Professional.objects.all() - # current_month = timezone.localtime(timezone.now()).month - # current_year = timezone.localtime(timezone.now()).year + current_month = timezone.localtime(timezone.now()).month + current_year = timezone.localtime(timezone.now()).year 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: sum_ = Calendar.objects.filter( # active=True, - professional__name=Prof.name, - # date__month=current_month, - # date__year=current_year + professional__id=Prof.id, + date__month= current_month, + date__year= current_year ).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 = {} for total in Professionals: - sum1 = sum_serv_prof.get(str(total.name)) - sum2 = sum_expense_prof.get(str(total.name)) - sum_total[total.name] = ( sum1 - sum2 ) + sum1 = sum_expense_prof.get(str(total.name)) + sum2 = sum_serv_prof_credit.get(str(total.name)) + sum3 = sum_serv_prof_debit.get(str(total.name)) + sum_total[total.name] = ( sum1 + sum2 - sum3 ) - return sum_total \ No newline at end of file + sum_all = sum(sum_total.values()) or 0 + + return { + 'sum_total':sum_total, + 'sum_all':sum_all, + } \ No newline at end of file diff --git a/Base/Metrics/DashboardProf/__pycache__/get_sum_credit.cpython-312.pyc b/Base/Metrics/DashboardProf/__pycache__/get_sum_credit.cpython-312.pyc new file mode 100644 index 0000000..467abb9 Binary files /dev/null and b/Base/Metrics/DashboardProf/__pycache__/get_sum_credit.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardProf/__pycache__/get_sum_expense.cpython-312.pyc b/Base/Metrics/DashboardProf/__pycache__/get_sum_expense.cpython-312.pyc new file mode 100644 index 0000000..1a87a3d Binary files /dev/null and b/Base/Metrics/DashboardProf/__pycache__/get_sum_expense.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardProf/__pycache__/get_total_money.cpython-312.pyc b/Base/Metrics/DashboardProf/__pycache__/get_total_money.cpython-312.pyc new file mode 100644 index 0000000..e7acb4c Binary files /dev/null and b/Base/Metrics/DashboardProf/__pycache__/get_total_money.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardProf/__pycache__/get_total_serv.cpython-312.pyc b/Base/Metrics/DashboardProf/__pycache__/get_total_serv.cpython-312.pyc new file mode 100644 index 0000000..25b3002 Binary files /dev/null and b/Base/Metrics/DashboardProf/__pycache__/get_total_serv.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardProf/get_sum_credit.py b/Base/Metrics/DashboardProf/get_sum_credit.py new file mode 100644 index 0000000..582c64f --- /dev/null +++ b/Base/Metrics/DashboardProf/get_sum_credit.py @@ -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, + } \ No newline at end of file diff --git a/Base/Metrics/DashboardProf/get_sum_expense.py b/Base/Metrics/DashboardProf/get_sum_expense.py new file mode 100644 index 0000000..d28eb7e --- /dev/null +++ b/Base/Metrics/DashboardProf/get_sum_expense.py @@ -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, + } \ No newline at end of file diff --git a/Base/Metrics/DashboardProf/get_total_money.py b/Base/Metrics/DashboardProf/get_total_money.py new file mode 100644 index 0000000..1463ca4 --- /dev/null +++ b/Base/Metrics/DashboardProf/get_total_money.py @@ -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 \ No newline at end of file diff --git a/Base/Metrics/DashboardProf/get_total_serv.py b/Base/Metrics/DashboardProf/get_total_serv.py new file mode 100644 index 0000000..ebf4f88 --- /dev/null +++ b/Base/Metrics/DashboardProf/get_total_serv.py @@ -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, + } \ No newline at end of file diff --git a/Base/Urls/__pycache__/urlsBankAccount.cpython-312.pyc b/Base/Urls/__pycache__/urlsBankAccount.cpython-312.pyc index eff9493..c94f8a7 100644 Binary files a/Base/Urls/__pycache__/urlsBankAccount.cpython-312.pyc and b/Base/Urls/__pycache__/urlsBankAccount.cpython-312.pyc differ diff --git a/Base/Urls/__pycache__/urlsBase.cpython-312.pyc b/Base/Urls/__pycache__/urlsBase.cpython-312.pyc index 694eacb..156e559 100644 Binary files a/Base/Urls/__pycache__/urlsBase.cpython-312.pyc and b/Base/Urls/__pycache__/urlsBase.cpython-312.pyc differ diff --git a/Base/Urls/__pycache__/urlsChartOfAccount.cpython-312.pyc b/Base/Urls/__pycache__/urlsChartOfAccount.cpython-312.pyc index 39f576e..d5072cd 100644 Binary files a/Base/Urls/__pycache__/urlsChartOfAccount.cpython-312.pyc and b/Base/Urls/__pycache__/urlsChartOfAccount.cpython-312.pyc differ diff --git a/Base/Urls/__pycache__/urlsPaymentMethod.cpython-312.pyc b/Base/Urls/__pycache__/urlsPaymentMethod.cpython-312.pyc index 078cbcd..11afd67 100644 Binary files a/Base/Urls/__pycache__/urlsPaymentMethod.cpython-312.pyc and b/Base/Urls/__pycache__/urlsPaymentMethod.cpython-312.pyc differ diff --git a/Base/Urls/__pycache__/urlsProductList.cpython-312.pyc b/Base/Urls/__pycache__/urlsProductList.cpython-312.pyc index 987d628..d5dadbb 100644 Binary files a/Base/Urls/__pycache__/urlsProductList.cpython-312.pyc and b/Base/Urls/__pycache__/urlsProductList.cpython-312.pyc differ diff --git a/Base/Urls/__pycache__/urlsProfessional.cpython-312.pyc b/Base/Urls/__pycache__/urlsProfessional.cpython-312.pyc index 4075184..50bd38c 100644 Binary files a/Base/Urls/__pycache__/urlsProfessional.cpython-312.pyc and b/Base/Urls/__pycache__/urlsProfessional.cpython-312.pyc differ diff --git a/Base/Urls/__pycache__/urlsServiceList.cpython-312.pyc b/Base/Urls/__pycache__/urlsServiceList.cpython-312.pyc index 1f19528..d71b112 100644 Binary files a/Base/Urls/__pycache__/urlsServiceList.cpython-312.pyc and b/Base/Urls/__pycache__/urlsServiceList.cpython-312.pyc differ diff --git a/Base/Urls/urlsBankAccount.py b/Base/Urls/urlsBankAccount.py index 2f397fa..8472669 100644 --- a/Base/Urls/urlsBankAccount.py +++ b/Base/Urls/urlsBankAccount.py @@ -7,9 +7,9 @@ from Base.Views import ( urlpatterns = [ # URLs de Bancos - path('/', viewsBankAccounts.BankAccountsListView.as_view(), name='BankAccountsListView'), - path('/Create', viewsBankAccounts.BankAccountsCreateView.as_view(), name='BankAccountsCreateView'), - path('//Detail', viewsBankAccounts.BankAccountsDetailView.as_view(), name='BankAccountsDetailView'), - path('//Update', viewsBankAccounts.BankAccountsUpdateView.as_view(), name='BankAccountsUpdateView'), - path('//Delete', viewsBankAccounts.BankAccountsDeleteView.as_view(), name='BankAccountsDeleteView'), + path('', viewsBankAccounts.BankAccountsListView.as_view(), name='BankAccountsListView'), + path('Create', viewsBankAccounts.BankAccountsCreateView.as_view(), name='BankAccountsCreateView'), + path('/Detail', viewsBankAccounts.BankAccountsDetailView.as_view(), name='BankAccountsDetailView'), + path('/Update', viewsBankAccounts.BankAccountsUpdateView.as_view(), name='BankAccountsUpdateView'), + path('/Delete', viewsBankAccounts.BankAccountsDeleteView.as_view(), name='BankAccountsDeleteView'), ] \ No newline at end of file diff --git a/Base/Urls/urlsBase.py b/Base/Urls/urlsBase.py index 1a5433f..08830f5 100644 --- a/Base/Urls/urlsBase.py +++ b/Base/Urls/urlsBase.py @@ -11,5 +11,6 @@ urlpatterns = [ path('logout', auth_views.LogoutView.as_view(), name='logout'), path('dashboard', views.Dashboard.as_view(), name='Dashboard'), path('DashboardAdmin', views.DashboardAdmin.as_view(), name='DashboardAdmin'), + path('DashboardProf', views.DashboardProf.as_view(), name='DashboardProf'), ] \ No newline at end of file diff --git a/Base/Urls/urlsChartOfAccount.py b/Base/Urls/urlsChartOfAccount.py index 66c9d04..4e840d0 100644 --- a/Base/Urls/urlsChartOfAccount.py +++ b/Base/Urls/urlsChartOfAccount.py @@ -5,9 +5,9 @@ from Base.Views import ( urlpatterns = [ # URLs de Professional - path('/', viewsChartOfAccount.ChartOfAccountListView.as_view(), name='ChartOfAccountListView'), - path('/Create', viewsChartOfAccount.ChartOfAccountCreateView.as_view(), name='ChartOfAccountCreateView'), - path('//Detail', viewsChartOfAccount.ChartOfAccountDetailView.as_view(), name='ChartOfAccountDetailView'), - path('//Update', viewsChartOfAccount.ChartOfAccountUpdateView.as_view(), name='ChartOfAccountUpdateView'), - path('//Delete', viewsChartOfAccount.ChartOfAccountDeleteView.as_view(), name='ChartOfAccountDeleteView'), + path('', viewsChartOfAccount.ChartOfAccountListView.as_view(), name='ChartOfAccountListView'), + path('Create', viewsChartOfAccount.ChartOfAccountCreateView.as_view(), name='ChartOfAccountCreateView'), + path('/Detail', viewsChartOfAccount.ChartOfAccountDetailView.as_view(), name='ChartOfAccountDetailView'), + path('/Update', viewsChartOfAccount.ChartOfAccountUpdateView.as_view(), name='ChartOfAccountUpdateView'), + path('/Delete', viewsChartOfAccount.ChartOfAccountDeleteView.as_view(), name='ChartOfAccountDeleteView'), ] \ No newline at end of file diff --git a/Base/Urls/urlsPaymentMethod.py b/Base/Urls/urlsPaymentMethod.py index 885a92b..adc51ef 100644 --- a/Base/Urls/urlsPaymentMethod.py +++ b/Base/Urls/urlsPaymentMethod.py @@ -6,9 +6,9 @@ from Base.Views import ( urlpatterns = [ # URLs de Professional - path('/', viewsPayMethod.PayMethodListView.as_view(), name='PayMethodListView'), - path('/Create', viewsPayMethod.PayMethodCreateView.as_view(), name='PayMethodCreateView'), - path('//Detail', viewsPayMethod.PayMethodDetailView.as_view(), name='PayMethodDetailView'), - path('//Update', viewsPayMethod.PayMethodUpdateView.as_view(), name='PayMethodUpdateView'), - path('//Delete', viewsPayMethod.PayMethodDeleteView.as_view(), name='PayMethodDeleteView'), + path('', viewsPayMethod.PayMethodListView.as_view(), name='PayMethodListView'), + path('Create', viewsPayMethod.PayMethodCreateView.as_view(), name='PayMethodCreateView'), + path('/Detail', viewsPayMethod.PayMethodDetailView.as_view(), name='PayMethodDetailView'), + path('/Update', viewsPayMethod.PayMethodUpdateView.as_view(), name='PayMethodUpdateView'), + path('/Delete', viewsPayMethod.PayMethodDeleteView.as_view(), name='PayMethodDeleteView'), ] \ No newline at end of file diff --git a/Base/Urls/urlsProductList.py b/Base/Urls/urlsProductList.py index fbc1307..c89421b 100644 --- a/Base/Urls/urlsProductList.py +++ b/Base/Urls/urlsProductList.py @@ -6,9 +6,9 @@ from Base.Views import ( urlpatterns = [ # URLs de Professional - path('/', viewsProductList.ProductListListView.as_view(), name='ProductListListView'), - path('/Create', viewsProductList.ProductListCreateView.as_view(), name='ProductListCreateView'), - path('//Detail', viewsProductList.ProductListDetailView.as_view(), name='ProductListDetailView'), - path('//Update', viewsProductList.ProductListUpdateView.as_view(), name='ProductListUpdateView'), - path('//Delete', viewsProductList.ProductListDeleteView.as_view(), name='ProductListDeleteView'), + path('', viewsProductList.ProductListListView.as_view(), name='ProductListListView'), + path('Create', viewsProductList.ProductListCreateView.as_view(), name='ProductListCreateView'), + path('/Detail', viewsProductList.ProductListDetailView.as_view(), name='ProductListDetailView'), + path('/Update', viewsProductList.ProductListUpdateView.as_view(), name='ProductListUpdateView'), + path('/Delete', viewsProductList.ProductListDeleteView.as_view(), name='ProductListDeleteView'), ] \ No newline at end of file diff --git a/Base/Urls/urlsProfessional.py b/Base/Urls/urlsProfessional.py index e118cf1..d58165a 100644 --- a/Base/Urls/urlsProfessional.py +++ b/Base/Urls/urlsProfessional.py @@ -6,9 +6,9 @@ from Base.Views import ( urlpatterns = [ # URLs de Professional - path('/', viewsProfessional.ProfessionalListView.as_view(), name='ProfessionalListView'), - path('/Create', viewsProfessional.ProfessionalCreateView.as_view(), name='ProfessionalCreateView'), - path('//Detail', viewsProfessional.ProfessionalDetailView.as_view(), name='ProfessionalDetailView'), - path('//Update', viewsProfessional.ProfessionalUpdateView.as_view(), name='ProfessionalUpdateView'), - path('//Delete', viewsProfessional.ProfessionalDeleteView.as_view(), name='ProfessionalDeleteView'), + path('', viewsProfessional.ProfessionalListView.as_view(), name='ProfessionalListView'), + path('Create', viewsProfessional.ProfessionalCreateView.as_view(), name='ProfessionalCreateView'), + path('/Detail', viewsProfessional.ProfessionalDetailView.as_view(), name='ProfessionalDetailView'), + path('/Update', viewsProfessional.ProfessionalUpdateView.as_view(), name='ProfessionalUpdateView'), + path('/Delete', viewsProfessional.ProfessionalDeleteView.as_view(), name='ProfessionalDeleteView'), ] \ No newline at end of file diff --git a/Base/Urls/urlsServiceList.py b/Base/Urls/urlsServiceList.py index 8c5606b..8943701 100644 --- a/Base/Urls/urlsServiceList.py +++ b/Base/Urls/urlsServiceList.py @@ -6,9 +6,9 @@ from Base.Views import ( urlpatterns = [ # URLs de Professional - path('/', viewsServiceList.ServiceListListView.as_view(), name='ServiceListListView'), - path('/Create', viewsServiceList.ServiceListCreateView.as_view(), name='ServiceListCreateView'), - path('//Detail', viewsServiceList.ServiceListDetailView.as_view(), name='ServiceListDetailView'), - path('//Update', viewsServiceList.ServiceListUpdateView.as_view(), name='ServiceListUpdateView'), - path('//Delete', viewsServiceList.ServiceListDeleteView.as_view(), name='ServiceListDeleteView'), + path('', viewsServiceList.ServiceListListView.as_view(), name='ServiceListListView'), + path('Create', viewsServiceList.ServiceListCreateView.as_view(), name='ServiceListCreateView'), + path('/Detail', viewsServiceList.ServiceListDetailView.as_view(), name='ServiceListDetailView'), + path('/Update', viewsServiceList.ServiceListUpdateView.as_view(), name='ServiceListUpdateView'), + path('/Delete', viewsServiceList.ServiceListDeleteView.as_view(), name='ServiceListDeleteView'), ] \ No newline at end of file diff --git a/Base/Views/__pycache__/viewsBankAccounts.cpython-312.pyc b/Base/Views/__pycache__/viewsBankAccounts.cpython-312.pyc index 743438d..a549b2f 100644 Binary files a/Base/Views/__pycache__/viewsBankAccounts.cpython-312.pyc and b/Base/Views/__pycache__/viewsBankAccounts.cpython-312.pyc differ diff --git a/Base/Views/__pycache__/viewsChartOfAccount.cpython-312.pyc b/Base/Views/__pycache__/viewsChartOfAccount.cpython-312.pyc index dd25d71..5edebf1 100644 Binary files a/Base/Views/__pycache__/viewsChartOfAccount.cpython-312.pyc and b/Base/Views/__pycache__/viewsChartOfAccount.cpython-312.pyc differ diff --git a/Base/Views/__pycache__/viewsPayMethod.cpython-312.pyc b/Base/Views/__pycache__/viewsPayMethod.cpython-312.pyc index 7b9743b..cfe2789 100644 Binary files a/Base/Views/__pycache__/viewsPayMethod.cpython-312.pyc and b/Base/Views/__pycache__/viewsPayMethod.cpython-312.pyc differ diff --git a/Base/Views/__pycache__/viewsProductList.cpython-312.pyc b/Base/Views/__pycache__/viewsProductList.cpython-312.pyc index 0e1f48e..f8de648 100644 Binary files a/Base/Views/__pycache__/viewsProductList.cpython-312.pyc and b/Base/Views/__pycache__/viewsProductList.cpython-312.pyc differ diff --git a/Base/Views/__pycache__/viewsProfessional.cpython-312.pyc b/Base/Views/__pycache__/viewsProfessional.cpython-312.pyc index b26d31f..e028025 100644 Binary files a/Base/Views/__pycache__/viewsProfessional.cpython-312.pyc and b/Base/Views/__pycache__/viewsProfessional.cpython-312.pyc differ diff --git a/Base/Views/__pycache__/viewsServiceList.cpython-312.pyc b/Base/Views/__pycache__/viewsServiceList.cpython-312.pyc index 9ac5aef..c5d22e7 100644 Binary files a/Base/Views/__pycache__/viewsServiceList.cpython-312.pyc and b/Base/Views/__pycache__/viewsServiceList.cpython-312.pyc differ diff --git a/Base/Views/views.py b/Base/Views/views.py index 3091ba4..0c695e9 100644 --- a/Base/Views/views.py +++ b/Base/Views/views.py @@ -5,13 +5,28 @@ from django.utils import timezone from django.contrib.auth import views as auth_views from Base.Metrics.Dashboard import ( get_sum_of_professional, - get_sum_of_stone, get_sum_of_service, get_sum_of_professional_detail, 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): context = { 'ok':' Tudo ok', } @@ -21,12 +36,11 @@ class Login(auth_views.LoginView): template_name = 'Login/Login.html' class Dashboard(LoginRequiredMixin, TemplateView): - template_name = 'Login/Dashboard/index.html' + template_name = 'Dashboards/Dashboard/index.html' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) Day = timezone.localtime(timezone.now()) 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['Sum_of_professional_detail'] = get_sum_of_professional_detail.metric(Day) context['Sum_payment_method_service'] = get_sum_payment_method_service.metric(Day) @@ -34,9 +48,36 @@ class Dashboard(LoginRequiredMixin, TemplateView): return context class DashboardAdmin(LoginRequiredMixin, TemplateView): - template_name = 'Login/DashboardAdmin/index.html' + template_name = 'Dashboards/DashboardAdmin/index.html' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) 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 \ No newline at end of file diff --git a/Base/__pycache__/__init__.cpython-312.pyc b/Base/__pycache__/__init__.cpython-312.pyc index bfac4a0..f17bc5e 100644 Binary files a/Base/__pycache__/__init__.cpython-312.pyc and b/Base/__pycache__/__init__.cpython-312.pyc differ diff --git a/Base/__pycache__/admin.cpython-312.pyc b/Base/__pycache__/admin.cpython-312.pyc index 4df1fd8..635c6c0 100644 Binary files a/Base/__pycache__/admin.cpython-312.pyc and b/Base/__pycache__/admin.cpython-312.pyc differ diff --git a/Base/__pycache__/apps.cpython-312.pyc b/Base/__pycache__/apps.cpython-312.pyc index c898f80..0af0b6f 100644 Binary files a/Base/__pycache__/apps.cpython-312.pyc and b/Base/__pycache__/apps.cpython-312.pyc differ diff --git a/Base/__pycache__/models.cpython-312.pyc b/Base/__pycache__/models.cpython-312.pyc index 569f4c5..8cb2e22 100644 Binary files a/Base/__pycache__/models.cpython-312.pyc and b/Base/__pycache__/models.cpython-312.pyc differ diff --git a/Base/migrations/0001_initial.py b/Base/migrations/0001_initial.py index 677b445..b441f5c 100644 --- a/Base/migrations/0001_initial.py +++ b/Base/migrations/0001_initial.py @@ -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 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')), ('name', models.CharField(max_length=100)), ('debit', models.BooleanField(default=True)), + ('credit', models.BooleanField(default=False)), ('firm', models.BooleanField(default=True)), + ('month', models.BooleanField(default=False)), ('notes', models.TextField(blank=True, null=True)), ], options={ diff --git a/Base/migrations/0002_chartofaccount_prof.py b/Base/migrations/0002_chartofaccount_prof.py new file mode 100644 index 0000000..062986a --- /dev/null +++ b/Base/migrations/0002_chartofaccount_prof.py @@ -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), + ), + ] diff --git a/Base/migrations/0003_alter_chartofaccount_prof.py b/Base/migrations/0003_alter_chartofaccount_prof.py new file mode 100644 index 0000000..90dbbc6 --- /dev/null +++ b/Base/migrations/0003_alter_chartofaccount_prof.py @@ -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), + ), + ] diff --git a/Base/migrations/__pycache__/0001_initial.cpython-312.pyc b/Base/migrations/__pycache__/0001_initial.cpython-312.pyc index d3a6e63..c77e62c 100644 Binary files a/Base/migrations/__pycache__/0001_initial.cpython-312.pyc and b/Base/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/Base/migrations/__pycache__/0002_chartofaccount_prof.cpython-312.pyc b/Base/migrations/__pycache__/0002_chartofaccount_prof.cpython-312.pyc new file mode 100644 index 0000000..4be7918 Binary files /dev/null and b/Base/migrations/__pycache__/0002_chartofaccount_prof.cpython-312.pyc differ diff --git a/Base/migrations/__pycache__/0003_alter_chartofaccount_prof.cpython-312.pyc b/Base/migrations/__pycache__/0003_alter_chartofaccount_prof.cpython-312.pyc new file mode 100644 index 0000000..c7a30b0 Binary files /dev/null and b/Base/migrations/__pycache__/0003_alter_chartofaccount_prof.cpython-312.pyc differ diff --git a/Base/migrations/__pycache__/__init__.cpython-312.pyc b/Base/migrations/__pycache__/__init__.cpython-312.pyc index 628813f..e9628d1 100644 Binary files a/Base/migrations/__pycache__/__init__.cpython-312.pyc and b/Base/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/Base/models.py b/Base/models.py index 054b8ce..5a5bfe7 100644 --- a/Base/models.py +++ b/Base/models.py @@ -61,7 +61,10 @@ class ProductList(models.Model): class ChartOfAccount(models.Model): name = models.CharField(max_length=100) debit = models.BooleanField(default=True) + credit = models.BooleanField(default=False) firm = models.BooleanField(default=True) + prof = models.BooleanField(default=False) + month = models.BooleanField(default=False) notes = models.TextField(null=True, blank=True) class Meta: ordering = ['name'] diff --git a/Base/templates/ChartOfAccount/List.html b/Base/templates/ChartOfAccount/List.html index 3c5e45c..faedd0e 100644 --- a/Base/templates/ChartOfAccount/List.html +++ b/Base/templates/ChartOfAccount/List.html @@ -31,6 +31,8 @@ Notas Debito Firma + Mensais + Prof Ações @@ -44,6 +46,10 @@ {% else %} {% endif %} {% if Chart.firm %} {% else %} {% endif %} + {% if Chart.month %} + {% else %} {% endif %} + {% if Chart.prof %} + {% else %} {% endif %} diff --git a/Base/templates/Login/Dashboard/Professional.html b/Base/templates/Dashboards/Dashboard/Professional.html similarity index 100% rename from Base/templates/Login/Dashboard/Professional.html rename to Base/templates/Dashboards/Dashboard/Professional.html diff --git a/Base/templates/Login/Dashboard/Service.html b/Base/templates/Dashboards/Dashboard/Service.html similarity index 100% rename from Base/templates/Login/Dashboard/Service.html rename to Base/templates/Dashboards/Dashboard/Service.html diff --git a/Base/templates/Dashboards/Dashboard/Sum_of_product.html b/Base/templates/Dashboards/Dashboard/Sum_of_product.html new file mode 100644 index 0000000..6df33c4 --- /dev/null +++ b/Base/templates/Dashboards/Dashboard/Sum_of_product.html @@ -0,0 +1,31 @@ +
+
+ Produtos +
+ +
+
+ PRODUTO (QTD) + TOTAL +
+ + {% for name, value in Sum_of_product.product_report.items %} + {% if value.product_item != 0 %} +
+ + {{ name }} + {{ value.product_cont }}x + + R$ {{ value.product_item|floatformat:2 }} +
+ {% endif %} + {% empty %} +
Vazio.
+ {% endfor %} + +
+ Total da Venda + R$ {{ Sum_of_product.sum_of_product|floatformat:2 }} +
+
+
\ No newline at end of file diff --git a/Base/templates/Dashboards/Dashboard/Sum_of_professional_detail.html b/Base/templates/Dashboards/Dashboard/Sum_of_professional_detail.html new file mode 100644 index 0000000..279527c --- /dev/null +++ b/Base/templates/Dashboards/Dashboard/Sum_of_professional_detail.html @@ -0,0 +1,40 @@ +
+
Resumo de Atendimentos
+ +
+ {% for prof_name, services in Sum_of_professional_detail.professionals_report.items %} +
+
+
+ {{ prof_name }} +
+ + {% for service_name, data in services.items %} + {% if data.servCont > 0 %} +
+
+ {{ service_name }} ({{ data.servCont }}) + R$ {{ data.servSum|floatformat:2 }} +
+ + {% for client in data.clients %} +
+ {{ client.time }} {{ client.name }} + R${{ client.value|floatformat:0 }} +
+ {% endfor %} +
+ {% endif %} + {% endfor %} +
+
+ {% endfor %} +
+ +
+ Total Geral +
R$ {{ Sum_of_professional_detail.sum_of_prof|floatformat:2 }}
+
+
+{#

Total de Hoje : R$: {{ Sum_of_professional_detail.sum_of_prof|floatformat:2 }}

#} +
\ No newline at end of file diff --git a/Base/templates/Dashboards/Dashboard/Sum_payment_method_service.html b/Base/templates/Dashboards/Dashboard/Sum_payment_method_service.html new file mode 100644 index 0000000..a2896f5 --- /dev/null +++ b/Base/templates/Dashboards/Dashboard/Sum_payment_method_service.html @@ -0,0 +1,23 @@ +
+
+ Pagamentos +
+ +
+ {% for name, value in Sum_payment_method_service.bank_balance.items %} + {% if value != 0 %} +
+ {{ name }} + R$ {{ value|floatformat:2 }} +
+ {% endif %} + {% empty %} +
Vazio
+ {% endfor %} + +
+ Total Banco + R$ {{ Sum_payment_method_service.sum_of_bank|floatformat:2 }} +
+
+
diff --git a/Base/templates/Dashboards/Dashboard/index.html b/Base/templates/Dashboards/Dashboard/index.html new file mode 100644 index 0000000..541a21d --- /dev/null +++ b/Base/templates/Dashboards/Dashboard/index.html @@ -0,0 +1,24 @@ +{% extends "BaseLogin.html" %} +{% block title %} Dashboard {% endblock %} +{% block content %} + +
+
+ {% include 'Dashboards/Dashboard/Sum_of_professional_detail.html' %} +
+
+ {% include 'Dashboards/Dashboard/Sum_payment_method_service.html' %} + {% include 'Dashboards/Dashboard/Sum_of_product.html' %} +
+
+{#
#} +{#
#} +{#
{% include 'Dashboards/Dashboard/Professional.html' %}
#} + +{#
{% include 'Dashboards/Dashboard/Service.html' %}
#} +{#
#} +{#
#} +{#
#} + + +{% endblock %} diff --git a/Base/templates/Dashboards/DashboardAdmin/Stone.html b/Base/templates/Dashboards/DashboardAdmin/Stone.html new file mode 100644 index 0000000..697da98 --- /dev/null +++ b/Base/templates/Dashboards/DashboardAdmin/Stone.html @@ -0,0 +1,51 @@ +
+
+
+
+
+

Relatório de Métricas de Estoque

+ Total de Itens: {{ Stone.Stone|length }} +
+
+
+ + + + + + + + + + + + {% for item in Stone.Stone %} + + + + + + + + {% empty %} + + + + {% endfor %} + +
ProdutoQ. EstoqueCusto Bruto Valor Adquirido Preço Unit. Compra
{{ item.produto }} + + {{ item.quantidade_estoque }} + + R$ {{ item.valor_total_estoque_bruto|floatformat:2 }}R$ {{ item.valor_total_estoque_liquido|floatformat:2 }}R$ {{ item.valor_unitario_compra_medio|floatformat:2 }}
Nenhum registro encontrado.
+
+
+{# #} +
+
+
+
+ +{#{{Stone.}}#} \ No newline at end of file diff --git a/Base/templates/Dashboards/DashboardAdmin/index.html b/Base/templates/Dashboards/DashboardAdmin/index.html new file mode 100644 index 0000000..700109a --- /dev/null +++ b/Base/templates/Dashboards/DashboardAdmin/index.html @@ -0,0 +1,22 @@ +{% extends "BaseLogin.html" %} +{% block title %} Dashboard Admin {% endblock %} +{% block content %} + +
+
{% include 'Dashboards/DashboardAdmin/total_banck.html' %}
+
{% include 'Dashboards/DashboardAdmin/total_expense.html' %}
+
{% include 'Dashboards/DashboardAdmin/total_firm.html' %}
+{#
{% include 'Dashboards/DashboardAdmin/total_prof_month.html' %}
#} +{#
{% include 'Dashboards/DashboardAdmin/total_expense_prof.html' %}
#} +{#
{% include 'Dashboards/DashboardAdmin/total_credit_prof.html' %}
#} +
{% include 'Dashboards/DashboardAdmin/list-group.html' %}
+
+
+
+
{% include 'Dashboards/DashboardAdmin/Stone.html' %}
+
+
+ + + +{% endblock %} diff --git a/Base/templates/Dashboards/DashboardAdmin/list-group.html b/Base/templates/Dashboards/DashboardAdmin/list-group.html new file mode 100644 index 0000000..c6d7880 --- /dev/null +++ b/Base/templates/Dashboards/DashboardAdmin/list-group.html @@ -0,0 +1,11 @@ +
\ No newline at end of file diff --git a/Base/templates/Dashboards/DashboardAdmin/total_banck.html b/Base/templates/Dashboards/DashboardAdmin/total_banck.html new file mode 100644 index 0000000..e2fe81b --- /dev/null +++ b/Base/templates/Dashboards/DashboardAdmin/total_banck.html @@ -0,0 +1,38 @@ +
+
+

Resumo por Banco

+
+ +
+ + + + + + + + + {% for name, value in total_bank.sum_total.items %} + + + + + {% empty %} + + + + {% endfor %} + + {% if total_bank.sum_total %} + + + + + + + {% endif %} +
BancoTotal
{{ name }}R$ {{ value|floatformat:2 }}
+ Nenhum dado encontrado. +
Total GeralR$ {{ total_bank.sum_all|floatformat:2 }}
+
+
\ No newline at end of file diff --git a/Base/templates/Dashboards/DashboardAdmin/total_credit_prof.html b/Base/templates/Dashboards/DashboardAdmin/total_credit_prof.html new file mode 100644 index 0000000..1560e39 --- /dev/null +++ b/Base/templates/Dashboards/DashboardAdmin/total_credit_prof.html @@ -0,0 +1,23 @@ +

Credito do Prof.

+ + + + + + + + + {% for name, value in total_credit_prof.sum_total.items %} + + + + + {% empty %} + + + + {% endfor %} + +
BancoTotal
{{ name }}R$ {{ value|floatformat:2 }}
Vazio.
+Todos os bancos R$ {{ total_credit_prof.sum_all |floatformat:2 }} + diff --git a/Base/templates/Dashboards/DashboardAdmin/total_expense.html b/Base/templates/Dashboards/DashboardAdmin/total_expense.html new file mode 100644 index 0000000..80fd9cf --- /dev/null +++ b/Base/templates/Dashboards/DashboardAdmin/total_expense.html @@ -0,0 +1,48 @@ +
+

Relatório de Despesas

+ +
+ + + + + + + + + + {% for bank_name, info in total_expense.grouped_data.items %} + + + + + {% for item in info.registros %} + + + + + + {% endfor %} + + + + + + {% empty %} + + + + {% endfor %} + + + + + + + +
DataDescriçãoValor
+ {{ bank_name|upper }} +
{{ item.date|date:"d/m/Y" }}{{ item.chart_of_account }}R$ {{ item.gross_value|floatformat:2 }}
Subtotal {{ bank_name }}:R$ {{ info.total_banco|floatformat:2 }}
Sem lançamentos para este mês.
TOTAL GERAL DOS BANCOSR$ {{ total_expense.total_geral|floatformat:2 }}
+
+
+ diff --git a/Base/templates/Login/DashboardAdmin/total_banck.html b/Base/templates/Dashboards/DashboardAdmin/total_expense_prof.html similarity index 73% rename from Base/templates/Login/DashboardAdmin/total_banck.html rename to Base/templates/Dashboards/DashboardAdmin/total_expense_prof.html index dea01ab..2ae9333 100644 --- a/Base/templates/Login/DashboardAdmin/total_banck.html +++ b/Base/templates/Dashboards/DashboardAdmin/total_expense_prof.html @@ -1,4 +1,4 @@ -

Bancos

+

Despesas Prof

@@ -7,7 +7,7 @@ - {% for name, value in total_bank.items %} + {% for name, value in total_expense_prof.sum_total.items %} @@ -18,4 +18,5 @@ {% endfor %} -
{{ name }} R$ {{ value|floatformat:2 }}
\ No newline at end of file + +Todos os bancos R$ {{ total_expense_prof.sum_all |floatformat:2 }} \ No newline at end of file diff --git a/Base/templates/Dashboards/DashboardAdmin/total_firm.html b/Base/templates/Dashboards/DashboardAdmin/total_firm.html new file mode 100644 index 0000000..ba7187e --- /dev/null +++ b/Base/templates/Dashboards/DashboardAdmin/total_firm.html @@ -0,0 +1,56 @@ +
+
+

+ Resumo de Atendimentos +

+ Mês Atual +
+ +
+ + + + + + + + + + + {% for item in total_firm.services %} + + + + + + + {% empty %} + + + + {% endfor %} + + + {% if total_firm.services %} + + + + + + + {% endif %} +
ProfissionalServiçoQtd. RealizadaLucro Líquido
+ {{ item.professional__name }} + + {{ item.service__name }} + + {{ item.quantidade_feitas }} + + R$ {{ item.lucro_liquido|floatformat:2 }} +
+

Nenhum atendimento registrado até o momento.

+
Total Geral da Firma: + R$ {{ total_firm.total|floatformat:2 }} +
+
+
\ No newline at end of file diff --git a/Base/templates/Login/DashboardAdmin/total_prof_month.html b/Base/templates/Dashboards/DashboardAdmin/total_prof_month.html similarity index 79% rename from Base/templates/Login/DashboardAdmin/total_prof_month.html rename to Base/templates/Dashboards/DashboardAdmin/total_prof_month.html index 9e0eeb9..93ddfb3 100644 --- a/Base/templates/Login/DashboardAdmin/total_prof_month.html +++ b/Base/templates/Dashboards/DashboardAdmin/total_prof_month.html @@ -7,7 +7,7 @@ - {% for name, value in total_prof.items %} + {% for name, value in total_prof.sum_total.items %} {{ name }} R$ {{ value|floatformat:2 }} @@ -18,4 +18,5 @@ {% endfor %} - \ No newline at end of file + +Todos os Prof. R$ {{ total_prof.sum_all |floatformat:2 }} \ No newline at end of file diff --git a/Base/templates/Dashboards/DashboardProf/List_prof.html b/Base/templates/Dashboards/DashboardProf/List_prof.html new file mode 100644 index 0000000..3d1d846 --- /dev/null +++ b/Base/templates/Dashboards/DashboardProf/List_prof.html @@ -0,0 +1,27 @@ +
+
+ + {% for Prof in Professionals %} + + + + + + {% endfor %} + +
+
+ +
+
+
\ No newline at end of file diff --git a/Base/templates/Dashboards/DashboardProf/Relatório de Entradas.html b/Base/templates/Dashboards/DashboardProf/Relatório de Entradas.html new file mode 100644 index 0000000..73a88da --- /dev/null +++ b/Base/templates/Dashboards/DashboardProf/Relatório de Entradas.html @@ -0,0 +1,61 @@ +
+
+
+

Relatório de Entradas

+
+
+ + + + + + + + + {% for nome_servico, dados in Credit.sum_credit.items %} + {# Verifica se a soma do serviço é maior que zero #} + {% if dados.sum_credit > 0 %} + + + + + + {% for detalhe in dados.list_credit %} + {# Verifica se o valor individual é maior que zero #} + {% if detalhe.gross_value > 0 %} + + + + + {% endif %} + {% endfor %} + {% endif %} + + {% empty %} + + + + {% endfor %} + +
Descrição / DataValor (R$)
+
{{ nome_servico }}
+
+ + R$ {{ dados.sum_credit|floatformat:2 }} + +
+ {{ detalhe.date|date:"d/m/Y" }} + + {{ detalhe.gross_value|floatformat:2 }} +
+ Nenhum serviço realizado neste mês. +
+
+ +
+
\ No newline at end of file diff --git a/Base/templates/Dashboards/DashboardProf/Relatório de Saídas.html b/Base/templates/Dashboards/DashboardProf/Relatório de Saídas.html new file mode 100644 index 0000000..59c8c4a --- /dev/null +++ b/Base/templates/Dashboards/DashboardProf/Relatório de Saídas.html @@ -0,0 +1,61 @@ +
+
+
+

Relatório de Saídas

+
+
+ + + + + + + + + {% for nome_servico, dados in Expense.sum_expense.items %} + {# Verifica se a soma do serviço é maior que zero #} + {% if dados.sum_expense > 0 %} + + + + + + {% for detalhe in dados.list_expense %} + {# Verifica se o valor individual é maior que zero #} + {% if detalhe.gross_value > 0 %} + + + + + {% endif %} + {% endfor %} + {% endif %} + + {% empty %} + + + + {% endfor %} + +
Descrição / DataValor (R$)
+
{{ nome_servico }}
+
+ + R$ {{ dados.sum_expense|floatformat:2 }} + +
+ {{ detalhe.date|date:"d/m/Y" }} + + {{ detalhe.gross_value|floatformat:2 }} +
+ Nenhum serviço realizado neste mês. +
+
+ +
+
\ No newline at end of file diff --git a/Base/templates/Dashboards/DashboardProf/Resumo do Mês.html b/Base/templates/Dashboards/DashboardProf/Resumo do Mês.html new file mode 100644 index 0000000..af1d7f3 --- /dev/null +++ b/Base/templates/Dashboards/DashboardProf/Resumo do Mês.html @@ -0,0 +1,38 @@ +
+
+
+

Serviços Realizados

+
+
+
+ + + + + + + + + {% for item in Total_serv.services %} + + + + + {% empty %} + + + + {% endfor %} + +
ServiçoQuantidade
{{ item.service__name }} + + {{ item.total_performed }} + +
+ + Nenhum serviço realizado neste mês. +
+
+
+
+
\ No newline at end of file diff --git a/Base/templates/Dashboards/DashboardProf/index.html b/Base/templates/Dashboards/DashboardProf/index.html new file mode 100644 index 0000000..dc6fb3b --- /dev/null +++ b/Base/templates/Dashboards/DashboardProf/index.html @@ -0,0 +1,24 @@ +{% extends "BaseLogin.html" %} +{% block title %} Dashboard Prof {% endblock %} +{% block content %} + +
+ {% include 'Dashboards/DashboardProf/List_prof.html' %} +
+ +
+

Resumo do Mês

+

+ Total Ganho a Receber: R$ + + {{ Money|floatformat:2 }} + +

+
+ +
+ {% 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' %} +
+{% endblock %} \ No newline at end of file diff --git a/Base/templates/Login/Dashboard/Stone.html b/Base/templates/Login/Dashboard/Stone.html deleted file mode 100644 index c867012..0000000 --- a/Base/templates/Login/Dashboard/Stone.html +++ /dev/null @@ -1,23 +0,0 @@ -

Estoque

-
- - - - - - - - - {% for Prod, sum in Stone.Stone.items %} - {% if sum != 0 %} - - - - - {% endif %} - {% empty %} {% endfor %} - -
ProdutosTotal
{{ Prod }}{{ sum|floatformat:0 }}
Vazio.
-
- -
\ No newline at end of file diff --git a/Base/templates/Login/Dashboard/Sum_of_product.html b/Base/templates/Login/Dashboard/Sum_of_product.html deleted file mode 100644 index 8cf8654..0000000 --- a/Base/templates/Login/Dashboard/Sum_of_product.html +++ /dev/null @@ -1,22 +0,0 @@ -

Produtos

- - - - - - - - - - {% for name, value in Sum_of_product.product_report.items %} - {% if value.product_item != 0 %} - - - - - - {% endif %} - {% empty %} {% endfor %} - -
ProdutoTotalQuant.
{{ name }}R$ {{ value.product_item|floatformat:2 }}{{ value.product_cont }}
Vazio.
-

Total da Venda : R$: {{ Sum_of_product.sum_of_product|floatformat:2 }}

\ No newline at end of file diff --git a/Base/templates/Login/Dashboard/Sum_of_professional_detail.html b/Base/templates/Login/Dashboard/Sum_of_professional_detail.html deleted file mode 100644 index f9a1d5a..0000000 --- a/Base/templates/Login/Dashboard/Sum_of_professional_detail.html +++ /dev/null @@ -1,27 +0,0 @@ -

Relatório de Profissionais

- - - - - - - - - - - {% for professional, services in Sum_of_professional_detail.professionals_report.items %} - {% for service, value in services.items %} - {% if value.servSum != 0 %} - - - - - - - {% endif %} - {% endfor %} - {% endfor %} - -
ProfissionalServiçoValor BrutoQuant.
{{ professional }}{{ service }}R$ {{ value.servSum|floatformat:2 }}{{ value.servCont }}
-

Total de Hoje : R$: {{ Sum_of_professional_detail.sum_of_prof|floatformat:2 }}

-
\ No newline at end of file diff --git a/Base/templates/Login/Dashboard/Sum_payment_method_service.html b/Base/templates/Login/Dashboard/Sum_payment_method_service.html deleted file mode 100644 index afd3322..0000000 --- a/Base/templates/Login/Dashboard/Sum_payment_method_service.html +++ /dev/null @@ -1,20 +0,0 @@ -

Pagamentos

- - - - - - - - - {% for name, value in Sum_payment_method_service.bank_balance.items %} - {% if value != 0 %} - - - - - {% endif %} - {% empty %} {% endfor %} - -
BancoTotal
{{ name }}R$ {{ value|floatformat:2 }}
Vazio
-

Total : R$: {{ Sum_payment_method_service.sum_of_bank|floatformat:2 }}

diff --git a/Base/templates/Login/Dashboard/index.html b/Base/templates/Login/Dashboard/index.html deleted file mode 100644 index a4429cf..0000000 --- a/Base/templates/Login/Dashboard/index.html +++ /dev/null @@ -1,28 +0,0 @@ -{% extends "BaseLogin.html" %} -{% block title %} Dashboard {% endblock %} -{% block content %} - -
-
{% include 'Login/Dashboard/Sum_of_professional_detail.html' %}
-
-
{% include 'Login/Dashboard/Stone.html' %}
-
-
-
-
-
{% include 'Login/Dashboard/Sum_payment_method_service.html' %}
-
-
-
{% include 'Login/Dashboard/Professional.html' %}
-
-
-
{% include 'Login/Dashboard/Sum_of_product.html' %}
-
-
-
{% include 'Login/Dashboard/Service.html' %}
-
-
-
- - -{% endblock %} diff --git a/Base/templates/Login/DashboardAdmin/index.html b/Base/templates/Login/DashboardAdmin/index.html deleted file mode 100644 index 8505e14..0000000 --- a/Base/templates/Login/DashboardAdmin/index.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "BaseLogin.html" %} -{% block title %} Dashboard Admin {% endblock %} -{% block content %} - - -
-
-
{% include 'Login/DashboardAdmin/total_banck.html' %}
-
{% include 'Login/DashboardAdmin/total_prof_month.html' %}
-{#
#} -{#
#} -
-{% endblock %} diff --git a/Base/views/__pycache__/views.cpython-312.pyc b/Base/views/__pycache__/views.cpython-312.pyc index e2808d2..f9e5e33 100644 Binary files a/Base/views/__pycache__/views.cpython-312.pyc and b/Base/views/__pycache__/views.cpython-312.pyc differ diff --git a/Base/views/__pycache__/views.cpython-313.pyc b/Base/views/__pycache__/views.cpython-313.pyc deleted file mode 100644 index 2bc4f63..0000000 Binary files a/Base/views/__pycache__/views.cpython-313.pyc and /dev/null differ diff --git a/Client/FormsClient.py b/Client/FormsClient.py index 4b093da..5d32508 100644 --- a/Client/FormsClient.py +++ b/Client/FormsClient.py @@ -8,8 +8,10 @@ class FormsClient(forms.ModelForm): 'first_name', 'last_name', 'phone', - 'professional', 'double_workload', + 'responsable', + 'professional', + # 'late', # 'feed_back', # 'msg_3_months', # 'msg_6_months', @@ -21,8 +23,10 @@ class FormsClient(forms.ModelForm): 'last_name': forms.TextInput({'class':'form-control'}), 'notes': forms.Textarea({'class':'form-control','rows':3 , }), 'phone': forms.NumberInput(attrs={'step': 1, }), + 'responsable': forms.Select({'class': 'form-control'}), 'professional': forms.Select({'class':'form-control'}), 'double_workload': forms.CheckboxInput({'class':''}), + # 'late': forms.CheckboxInput({'class':''}), # 'msg_3_months': forms.CheckboxInput({'class':''}), # 'msg_6_months': forms.CheckboxInput({'class':''}), # 'msg_12_months': forms.CheckboxInput({'class':''}), @@ -32,8 +36,10 @@ class FormsClient(forms.ModelForm): 'first_name':'Nome', 'last_name':'Sobrenome', 'phone':'Telefone', + 'responsable':'Responsavel', 'professional':'Profissinal', 'double_workload':'Tempo Duplo', + # 'late':'Atrazildo', 'notes':'Notas', # 'feed_back':'FeedBack', # 'msg_3_months':'FeedBack', diff --git a/Client/migrations/0001_initial.py b/Client/migrations/0001_initial.py index a762acc..2a12571 100644 --- a/Client/migrations/0001_initial.py +++ b/Client/migrations/0001_initial.py @@ -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 from django.conf import settings @@ -24,8 +24,9 @@ class Migration(migrations.Migration): ('updated_at', models.DateTimeField(auto_now=True)), ('first_name', models.CharField(max_length=100)), ('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)), + ('last_visit', models.DateField(blank=True, null=True)), ('feed_back', models.BooleanField(default=False)), ('msg_3_months', models.BooleanField(default=False)), ('msg_6_months', models.BooleanField(default=False)), diff --git a/Client/migrations/0002_client_late_client_responsable_and_more.py b/Client/migrations/0002_client_late_client_responsable_and_more.py new file mode 100644 index 0000000..4ea7ea4 --- /dev/null +++ b/Client/migrations/0002_client_late_client_responsable_and_more.py @@ -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'), + ), + ] diff --git a/Client/migrations/__pycache__/0001_initial.cpython-312.pyc b/Client/migrations/__pycache__/0001_initial.cpython-312.pyc index 6f602be..7801f65 100644 Binary files a/Client/migrations/__pycache__/0001_initial.cpython-312.pyc and b/Client/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/Client/migrations/__pycache__/0002_client_late_client_responsable_and_more.cpython-312.pyc b/Client/migrations/__pycache__/0002_client_late_client_responsable_and_more.cpython-312.pyc new file mode 100644 index 0000000..e7dae55 Binary files /dev/null and b/Client/migrations/__pycache__/0002_client_late_client_responsable_and_more.cpython-312.pyc differ diff --git a/Client/migrations/__pycache__/__init__.cpython-312.pyc b/Client/migrations/__pycache__/__init__.cpython-312.pyc index a1a4d9b..0183a9a 100644 Binary files a/Client/migrations/__pycache__/__init__.cpython-312.pyc and b/Client/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/Client/models.py b/Client/models.py index 4beec4f..4bfd2f4 100644 --- a/Client/models.py +++ b/Client/models.py @@ -3,20 +3,28 @@ from Base.models import Professional , Base # Lista de clientes class Client(Base): - first_name = models.CharField(max_length=100) - last_name = models.CharField(max_length=500) - phone = models.DecimalField(max_digits=20,decimal_places=0) + first_name = models.CharField(max_length=100) # Nome + last_name = models.CharField(max_length=500) # Sobrenome + phone = models.DecimalField(max_digits=12,decimal_places=0) # Whatapp professional = models.ForeignKey( Professional, - on_delete=models.PROTECT, + on_delete=models.DO_NOTHING, related_name='ClientProfessional' - ) - double_workload = models.BooleanField(default=False) - feed_back = models.BooleanField(default=False) - msg_3_months = models.BooleanField(default=False) - msg_6_months = models.BooleanField(default=False) - msg_12_months = models.BooleanField(default=False) - notes = models.TextField(null=True, blank=True) + ) # profissinal do clinte + responsable = models.ForeignKey( + 'self', + on_delete=models.DO_NOTHING, + related_name='ClientResponsable', + 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: ordering = ['first_name','last_name'] def __str__(self): diff --git a/Client/templates/Client/Create.html b/Client/templates/Client/Create.html index b45a2e7..c6bc289 100644 --- a/Client/templates/Client/Create.html +++ b/Client/templates/Client/Create.html @@ -2,23 +2,49 @@ {% block title %} List {% endblock %} {% block content %} -
-

Cadastrar

-
+
+

Cadastrar Cliente

+
-
- {% csrf_token %} - {{ form.as_p }} - -
- Cancelar e Voltar +
+ {% csrf_token %} + +
+ + {{ form.first_name }} +
+ +
+ + {{ form.last_name }} +
+ +
+
+ + {{ form.phone }} +
+ +
+ + {{ form.double_workload }} +
+
+ +
+ + {{ form.professional }} +
+ +
+ + +
+ +
- - {% endblock %} diff --git a/Client/templates/Client/Detail.html b/Client/templates/Client/Detail.html deleted file mode 100644 index 111a70f..0000000 --- a/Client/templates/Client/Detail.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends "BaseLogin.html" %} -{% block title %} Bank Accounts List {% endblock %} -{% block content %} -
-

Detalhes do Banco

-
-
-

{{ object.first_name }} {{ object.last_name }}


-

Tel.: {{ object.phone }}

-

Prof. de Preferencia : {{ object.professional }}

-

Tempo Duplo : {{ object.double_workload }}

-

Nota: {{ object.notes }}

-
- -

Ultimas visitas

-
- - - - - - - - - - {% for client in clients %} - - - - - - {% empty %} - - - - {% endfor %} - -
Dia HorarioProfissinal
{{ client.date|date:"d/m/Y" }}{{ client.time }} {{ client.professional }}
Nada
-
- Editar -
-
- Cancelar e Voltar -
-{% endblock %} \ No newline at end of file diff --git a/Client/templates/Client/Detail/Detail.html b/Client/templates/Client/Detail/Detail.html new file mode 100644 index 0000000..4fc2808 --- /dev/null +++ b/Client/templates/Client/Detail/Detail.html @@ -0,0 +1,26 @@ +{% extends "BaseLogin.html" %} +{% block title %} Cliente {% endblock %} +{% block content %} + +
+{#

Detalhes do Cliente

#} +
+
+
+ {% include 'Client/Detail/Detail_p1.html' %} +
+ {% include 'Client/Detail/Detail_p2.html' %} + {% include 'Client/Detail/Detail_p3.html' %} +
+
+
+ {% include 'Client/Detail/Detail_btn.html' %} +
+
+
+ + + + +{% endblock %} + diff --git a/Client/templates/Client/Detail/Detail_btn.html b/Client/templates/Client/Detail/Detail_btn.html new file mode 100644 index 0000000..c1b4b40 --- /dev/null +++ b/Client/templates/Client/Detail/Detail_btn.html @@ -0,0 +1,32 @@ +
+ +
+ + +
+ +
+ + +
+ + {% if perms.brands.change_brands %} + + Editar Infirmações + + {% endif %} + + {% if perms.brands.change_brands %} + + Editar Responsavel + + {% endif %} + + + + +
+ + diff --git a/Client/templates/Client/Detail/Detail_p1.html b/Client/templates/Client/Detail/Detail_p1.html new file mode 100644 index 0000000..6028bcc --- /dev/null +++ b/Client/templates/Client/Detail/Detail_p1.html @@ -0,0 +1,21 @@ +{% load phone_filters %} +
+

{{ object.first_name }} {{ object.last_name }}

+
+

Tel.: {{ object.phone|format_phone_true }}

+

Prof. de Preferência: {{ object.professional }}

+ {% if object.responsable %} +

+ + Responsável: + + {{ object.responsable }} + +

+ {% endif %} +

Última visita: {{ object.last_visit|date:"d/m/Y" }}

+

Nota: {{ object.notes|default:"Nenhuma nota adicionada." }}

+
+ + diff --git a/Client/templates/Client/Detail/Detail_p2.html b/Client/templates/Client/Detail/Detail_p2.html new file mode 100644 index 0000000..b04f9a1 --- /dev/null +++ b/Client/templates/Client/Detail/Detail_p2.html @@ -0,0 +1,46 @@ + +
Detalhes
+

+

+ {% csrf_token %} + + Tempo Duplo +
+

+ +

+

+ {% csrf_token %} + + Costuma Atrasar +
+

+ +

+

+ {% csrf_token %} + + FeedBack no Google +
+

+ + + diff --git a/Client/templates/Client/Detail/Detail_p3.html b/Client/templates/Client/Detail/Detail_p3.html new file mode 100644 index 0000000..b49c3df --- /dev/null +++ b/Client/templates/Client/Detail/Detail_p3.html @@ -0,0 +1,43 @@ +
Lembrete de volta
+ +
+
+ {% csrf_token %} + + 3 meses +
+ +
+ {% csrf_token %} + + 6 meses +
+ +
+ {% csrf_token %} + + 1 Ano +
+
+ + + + diff --git a/Client/templates/Client/List.html b/Client/templates/Client/List.html index d5c1e9b..1d54768 100644 --- a/Client/templates/Client/List.html +++ b/Client/templates/Client/List.html @@ -1,5 +1,6 @@ {% extends "BaseLogin.html" %} {% block title %} List {% endblock %} +{% load phone_filters %} {% block content %}

Clientes


@@ -29,83 +30,46 @@
-{#
#} -{#
#} -{#
#} -{# #} -{# #} -{#
#} -{#
#} -{#
#} -{# {% if perms.brands.add_brands %}#} -{# {% endif %}#}
- - - - + + + + - - - - - + + {% for Client in Clients %} + - - - - + + + - - - - + {% endfor %} diff --git a/Client/templates/Client/Update.html b/Client/templates/Client/Update.html index 9f4f270..dce4625 100644 --- a/Client/templates/Client/Update.html +++ b/Client/templates/Client/Update.html @@ -2,15 +2,62 @@ {% block title %} Bank Accounts List {% endblock %} {% block content %}
-

Editar Bancos

+

Editar Clientes

- {% csrf_token %} - {{ form.as_p }} - - - Cancelar e Voltar + {% csrf_token %} + +
+
+ + + {% if form.first_name.errors %}
{{ form.first_name.errors }}
{% endif %} +
+ +
+ + +
+
+ +
+
+ + +
+ +
+ + +
+
+
+
+ + +
+
+
+
+ + +
+ +
+ + +
+
diff --git a/Client/templates/Client/Update_responsable.html b/Client/templates/Client/Update_responsable.html new file mode 100644 index 0000000..0ed58f8 --- /dev/null +++ b/Client/templates/Client/Update_responsable.html @@ -0,0 +1,72 @@ +{% extends "BaseLogin.html" %} +{% load phone_filters %} + +{% block title %} Editar Cliente {% endblock %} + +{% block content %} +
+

Editar Responsável

+ +
+
+ +
+ +
+ + +
+ + +
+ +
+ {% csrf_token %} + + + + + + +
+
+ + +
+ {% for client in Clients %} + + {% empty %} +
Nenhum cliente encontrado.
+ {% endfor %} +
+
+
+ +
+ + +
+ + +
+
+
+{% endblock %} \ No newline at end of file diff --git a/Client/templatetags/__init__.py b/Client/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Client/templatetags/__pycache__/__init__.cpython-312.pyc b/Client/templatetags/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..90104b4 Binary files /dev/null and b/Client/templatetags/__pycache__/__init__.cpython-312.pyc differ diff --git a/Client/templatetags/__pycache__/phone_filters.cpython-312.pyc b/Client/templatetags/__pycache__/phone_filters.cpython-312.pyc new file mode 100644 index 0000000..6fbb1f3 Binary files /dev/null and b/Client/templatetags/__pycache__/phone_filters.cpython-312.pyc differ diff --git a/Client/templatetags/phone_filters.py b/Client/templatetags/phone_filters.py new file mode 100644 index 0000000..9047d96 --- /dev/null +++ b/Client/templatetags/phone_filters.py @@ -0,0 +1,36 @@ +from django import template +register = template.Library() + +@register.filter +def format_phone(value): + """Formata telefone ocultando os números centrais.""" + if not value: + return "" + + # Remove qualquer caractere não numérico + value = "".join(filter(str.isdigit, str(value))) + + if len(value) == 11: # Celular: (XX) X****-XXXX + # Mantém o DDD, o primeiro dígito do número e os 4 finais + return f"({value[0:2]}) {value[2]}****-{value[7:]}" + + elif len(value) == 10: # Fixo: (XX) ****-XXXX + # Mantém o DDD e os 4 finais, oculta os 4 iniciais do número + return f"({value[0:2]}) ****-{value[6:]}" + + else: + return value +@register.filter +def format_phone_true(value): + """Formata telefone no padrão (XX) XXXXX-XXXX.""" + if not value: + return "" + + value = "".join(filter(str.isdigit, str(value))) # remove qualquer caractere não numérico + + if len(value) == 11: # Ex: 21998139861 + return f"({value[0:2]}) {value[2:7]}-{value[7:]}" + elif len(value) == 10: # Ex: 2134567890 + return f"({value[0:2]}) {value[2:6]}-{value[6:]}" + else: + return value # caso não caiba nos padrões \ No newline at end of file diff --git a/Client/urlsClient.py b/Client/urlsClient.py index d6814a4..3786012 100644 --- a/Client/urlsClient.py +++ b/Client/urlsClient.py @@ -3,10 +3,11 @@ from Client import viewsClient urlpatterns = [ # URLs de Client - path('/', viewsClient.ClientListView.as_view(), name='ClientListView'), - path('/Create', viewsClient.ClientCreateView.as_view(), name='ClientCreateView'), - path('//Detail', viewsClient.ClientDetailView.as_view(), name='ClientDetailView'), - path('//Update', viewsClient.ClientUpdateView.as_view(), name='ClientUpdateView'), - path('//Delete', viewsClient.ClientDeleteView.as_view(), name='ClientDeleteView'), + path('', viewsClient.ClientListView.as_view(), name='ClientListView'), + path('Create', viewsClient.ClientCreateView.as_view(), name='ClientCreateView'), + path('/Detail', viewsClient.ClientDetailView.as_view(), name='ClientDetailView'), + path('/Update', viewsClient.ClientUpdateView.as_view(), name='ClientUpdateView'), + path('/UpdateResp', viewsClient.ClientUpdateResponsableView.as_view(), name='ClientUpdateResponsableView'), + path('/Delete', viewsClient.ClientDeleteView.as_view(), name='ClientDeleteView'), ] \ No newline at end of file diff --git a/Client/viewsClient.py b/Client/viewsClient.py index 1454967..fedda74 100644 --- a/Client/viewsClient.py +++ b/Client/viewsClient.py @@ -4,6 +4,10 @@ from Client import models, FormsClient from Movement.models import Calendar from django.urls import reverse_lazy # from django.core import serializers +from django.shortcuts import redirect +from django.contrib import messages +# importate para função ou no filtro +from django.db.models import Q class ClientListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): model = models.Client @@ -26,7 +30,6 @@ class ClientListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): queryset = queryset.none() return queryset - class ClientCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): model = models.Client template_name = 'Client/Create.html' @@ -34,18 +37,33 @@ class ClientCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): success_url = reverse_lazy('ClientListView') permission_required = 'Client.add_client' - class ClientDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): model = models.Client - template_name = 'Client/Detail.html' + template_name = 'Client/Detail/Detail.html' permission_required = 'Client.view_client' + def post(self, request, *args, **kwargs): + self.object = self.get_object() - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - context['clients'] = Calendar.objects.filter( - client__id=self.object.id - ).order_by('-id').distinct()[:3] - return context + if request.POST.get('double_workload') == 'double_workload': + self.object.double_workload = not self.object.double_workload + + if request.POST.get('late') == 'late': + self.object.late = not self.object.late + + if request.POST.get('feed_back') == 'feed_back': + self.object.feed_back = not self.object.feed_back + + if request.POST.get('msg_3_months') == 'msg_3_months': + self.object.msg_3_months = not self.object.msg_3_months + + if request.POST.get('msg_6_months') == 'msg_6_months': + self.object.msg_6_months = not self.object.msg_6_months + + if request.POST.get('msg_12_months') == 'msg_12_months': + self.object.msg_12_months = not self.object.msg_12_months + + self.object.save() + return redirect('ClientDetailView', pk=self.object.id) class ClientUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView): model = models.Client @@ -54,6 +72,42 @@ class ClientUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView): success_url = reverse_lazy('ClientListView') permission_required = 'Client.change_client' +class ClientUpdateResponsableView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView): + model = models.Client + template_name = 'Client/Update_responsable.html' + form_class = FormsClient.FormsClient + permission_required = 'Client.change_client' + + def get_success_url(self): + return redirect('ClientDetailView', pk=self.object.pk)['Location'] + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + search_term = self.request.GET.get('Client') + + if search_term: + filter_client = models.Client.objects.filter( + Q(first_name__icontains=search_term) | + Q(last_name__icontains=search_term) + ) + else: + filter_client = models.Client.objects.none() + + context['Clients'] = filter_client + return context + + def form_valid(self, form): + print(self.request) + form.instance.created_by = self.request.user + messages.success(self.request, 'Registro realizado com sucesso!') + return super().form_valid(form) + + def form_invalid(self, form): + print(self.request) + errors = form.errors.as_text() + messages.error(self.request, f'Verifique os dados: {errors}') + return super().form_invalid(form) + class ClientDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView): model = models.Client template_name = 'Client/Delete.html' diff --git a/Movement/Forms/FormsExpense.py b/Movement/Forms/FormsExpenseOrCredit.py similarity index 77% rename from Movement/Forms/FormsExpense.py rename to Movement/Forms/FormsExpenseOrCredit.py index c14045c..1418a5b 100644 --- a/Movement/Forms/FormsExpense.py +++ b/Movement/Forms/FormsExpenseOrCredit.py @@ -2,14 +2,16 @@ from django import forms from Movement import models from django.utils import timezone -class FormsExpense(forms.ModelForm): +class FormsExpenseOrCredit(forms.ModelForm): class Meta: - model = models.Expense + model = models.ExpenseOrCredit fields = [ 'date', 'chart_of_account', 'bank', 'firm', + 'debit', + 'prof', 'professional', 'gross_value', ] @@ -19,7 +21,9 @@ class FormsExpense(forms.ModelForm): }), 'chart_of_account': forms.Select({'class': 'form-select'}), 'bank': forms.Select({'class': 'form-select'}), + 'debit': forms.CheckboxInput({'class': ''}), 'firm': forms.CheckboxInput({'class': ''}), + 'prof': forms.CheckboxInput({'class': ''}), 'professional': forms.Select({'class': 'form-select'}), 'gross_value': forms.NumberInput(attrs={'step': 1}), @@ -29,6 +33,8 @@ class FormsExpense(forms.ModelForm): 'chart_of_account':'Plano de contas', 'bank':'Banco', 'firm':'Firma', + 'debit':'Debito', + 'prof':'Prof.', 'gross_value':'Valor', 'professional':'Profissional', } \ No newline at end of file diff --git a/Movement/Forms/FormsProduct.py b/Movement/Forms/FormsProduct.py index 9132a74..f2d0196 100644 --- a/Movement/Forms/FormsProduct.py +++ b/Movement/Forms/FormsProduct.py @@ -34,6 +34,6 @@ class FormsProduct(forms.ModelForm): 'product':'Produto', 'pay_method':'M. Pagamento', 'professional':'Profissional', - 'quantity':'Quantiddade', + 'quantity':'Quantidade', # 'net_value':'Valor Liquido', } \ No newline at end of file diff --git a/Movement/Forms/FormsTransition.py b/Movement/Forms/FormsTransition.py new file mode 100644 index 0000000..8ac24ae --- /dev/null +++ b/Movement/Forms/FormsTransition.py @@ -0,0 +1,27 @@ +from django import forms +from Movement import models +from django.utils import timezone + +class FormsTransition(forms.ModelForm): + class Meta: + model = models.Transition + fields = [ + 'date', + 'bank_credit', + 'bank_debit', + 'gross_value', + ] + widgets = { + 'date': forms.DateInput(format=('%Y-%m-%d'), attrs={'type': 'date', 'class':'', + 'value':timezone.localtime(timezone.now()).date() + }), + 'bank_credit': forms.Select({'class': 'form-select'}), + 'bank_debit': forms.Select({'class': 'form-select'}), + 'gross_value': forms.NumberInput(attrs={'step': 1}), + } + labels={ + 'date':'Data', + 'bank_credit':'Entrada', + 'bank_debit':'Saida', + 'gross_value':'Valor', + } \ No newline at end of file diff --git a/Movement/Forms/__pycache__/FormsCalendar.cpython-312.pyc b/Movement/Forms/__pycache__/FormsCalendar.cpython-312.pyc index 290a989..b6df685 100644 Binary files a/Movement/Forms/__pycache__/FormsCalendar.cpython-312.pyc and b/Movement/Forms/__pycache__/FormsCalendar.cpython-312.pyc differ diff --git a/Movement/Forms/__pycache__/FormsExpense.cpython-312.pyc b/Movement/Forms/__pycache__/FormsExpense.cpython-312.pyc deleted file mode 100644 index e6995e7..0000000 Binary files a/Movement/Forms/__pycache__/FormsExpense.cpython-312.pyc and /dev/null differ diff --git a/Movement/Forms/__pycache__/FormsExpenseOrCredit.cpython-312.pyc b/Movement/Forms/__pycache__/FormsExpenseOrCredit.cpython-312.pyc new file mode 100644 index 0000000..ac534f5 Binary files /dev/null and b/Movement/Forms/__pycache__/FormsExpenseOrCredit.cpython-312.pyc differ diff --git a/Movement/Forms/__pycache__/FormsProduct.cpython-312.pyc b/Movement/Forms/__pycache__/FormsProduct.cpython-312.pyc index 7956965..c69ce0a 100644 Binary files a/Movement/Forms/__pycache__/FormsProduct.cpython-312.pyc and b/Movement/Forms/__pycache__/FormsProduct.cpython-312.pyc differ diff --git a/Movement/Forms/__pycache__/FormsStock.cpython-312.pyc b/Movement/Forms/__pycache__/FormsStock.cpython-312.pyc index 7a55a99..e4e8719 100644 Binary files a/Movement/Forms/__pycache__/FormsStock.cpython-312.pyc and b/Movement/Forms/__pycache__/FormsStock.cpython-312.pyc differ diff --git a/Movement/Forms/__pycache__/FormsTransition.cpython-312.pyc b/Movement/Forms/__pycache__/FormsTransition.cpython-312.pyc new file mode 100644 index 0000000..e083a06 Binary files /dev/null and b/Movement/Forms/__pycache__/FormsTransition.cpython-312.pyc differ diff --git a/Movement/Urls/__pycache__/urlsCalendar.cpython-312.pyc b/Movement/Urls/__pycache__/urlsCalendar.cpython-312.pyc index 41fb72d..241dad4 100644 Binary files a/Movement/Urls/__pycache__/urlsCalendar.cpython-312.pyc and b/Movement/Urls/__pycache__/urlsCalendar.cpython-312.pyc differ diff --git a/Movement/Urls/__pycache__/urlsExpense.cpython-312.pyc b/Movement/Urls/__pycache__/urlsExpense.cpython-312.pyc deleted file mode 100644 index 936f211..0000000 Binary files a/Movement/Urls/__pycache__/urlsExpense.cpython-312.pyc and /dev/null differ diff --git a/Movement/Urls/__pycache__/urlsExpenseOrCredit.cpython-312.pyc b/Movement/Urls/__pycache__/urlsExpenseOrCredit.cpython-312.pyc new file mode 100644 index 0000000..ba9f202 Binary files /dev/null and b/Movement/Urls/__pycache__/urlsExpenseOrCredit.cpython-312.pyc differ diff --git a/Movement/Urls/__pycache__/urlsProduct.cpython-312.pyc b/Movement/Urls/__pycache__/urlsProduct.cpython-312.pyc index d861df4..e5635e6 100644 Binary files a/Movement/Urls/__pycache__/urlsProduct.cpython-312.pyc and b/Movement/Urls/__pycache__/urlsProduct.cpython-312.pyc differ diff --git a/Movement/Urls/__pycache__/urlsStock.cpython-312.pyc b/Movement/Urls/__pycache__/urlsStock.cpython-312.pyc index 907d927..15efba1 100644 Binary files a/Movement/Urls/__pycache__/urlsStock.cpython-312.pyc and b/Movement/Urls/__pycache__/urlsStock.cpython-312.pyc differ diff --git a/Movement/Urls/__pycache__/urlsTransition.cpython-312.pyc b/Movement/Urls/__pycache__/urlsTransition.cpython-312.pyc new file mode 100644 index 0000000..6156a87 Binary files /dev/null and b/Movement/Urls/__pycache__/urlsTransition.cpython-312.pyc differ diff --git a/Movement/Urls/urlsCalendar.py b/Movement/Urls/urlsCalendar.py index f8bf26f..98ff770 100644 --- a/Movement/Urls/urlsCalendar.py +++ b/Movement/Urls/urlsCalendar.py @@ -7,10 +7,10 @@ from Movement.Views import ( urlpatterns = [ # URLs de Professional - path('/', viewsCalendar.CalendarListView.as_view(), name='MovCalendarListView'), + path('', viewsCalendar.CalendarListView.as_view(), name='MovCalendarListView'), # path('/Create', viewsCalendar.CalendarCreateView.as_view(), name='CalendarCreateView'), - path('//Detail', viewsCalendar.CalendarDetailView.as_view(), name='MovCalendarDetailView'), - path('//Update', viewsCalendar.CalendarUpdateView.as_view(), name='MovCalendarUpdateView'), - path('//Delete', viewsCalendar.CalendarDeleteView.as_view(), name='MovCalendarDeleteView'), - path('/CreateCuston', viewsCalendarCreateCustom.CalendarCreateCustomView.as_view(), name='MovCalendarCreateCustom'), + path('/Detail', viewsCalendar.CalendarDetailView.as_view(), name='MovCalendarDetailView'), + path('/Update', viewsCalendar.CalendarUpdateView.as_view(), name='MovCalendarUpdateView'), + path('/Delete', viewsCalendar.CalendarDeleteView.as_view(), name='MovCalendarDeleteView'), + path('CreateCuston', viewsCalendarCreateCustom.CalendarCreateCustomView.as_view(), name='MovCalendarCreateCustom'), ] \ No newline at end of file diff --git a/Movement/Urls/urlsExpense.py b/Movement/Urls/urlsExpense.py deleted file mode 100644 index 0027cfe..0000000 --- a/Movement/Urls/urlsExpense.py +++ /dev/null @@ -1,16 +0,0 @@ -from django.urls import path -# from django.contrib.auth import views as auth_views -from Movement.Views import ( - viewsExpense , -) - -urlpatterns = [ - # URLs de Professional - path('/', viewsExpense.ExpenseListView.as_view(), name='MovExpenseListView'), - path('/Create', viewsExpense.ExpenseCreateView.as_view(), name='MovExpenseCreateView'), - path('//Detail', viewsExpense.ExpenseDetailView.as_view(), name='MovExpenseDetailView'), - path('//Update', viewsExpense.ExpenseUpdateView.as_view(), name='MovExpenseUpdateView'), - path('//Delete', viewsExpense.ExpenseDeleteView.as_view(), name='MovExpenseDeleteView'), - path('/CreateFirm', viewsExpense.ExpenseFirmCreateView.as_view(), name='MovExpenseFirmCreateView'), - path('/CreateProf', viewsExpense.ExpenseProfCreateView.as_view(), name='MovExpenseProfCreateView'), -] \ No newline at end of file diff --git a/Movement/Urls/urlsExpenseOrCredit.py b/Movement/Urls/urlsExpenseOrCredit.py new file mode 100644 index 0000000..53cdda5 --- /dev/null +++ b/Movement/Urls/urlsExpenseOrCredit.py @@ -0,0 +1,17 @@ +from django.urls import path +# from django.contrib.auth import views as auth_views +from Movement.Views import ( + viewsExpenseOrCredit, +) + +urlpatterns = [ + # URLs de Professional + path('', viewsExpenseOrCredit.ExpenseOrCreditListView.as_view(), name='MovExpenseOrCreditListView'), + # path('Create', viewsExpenseOrCredit.ExpenseOrCreditCreateView.as_view(), name='MovExpenseOrCreditCreateView'), + path('/Detail', viewsExpenseOrCredit.ExpenseOrCreditDetailView.as_view(), name='MovExpenseOrCreditDetailView'), + path('/Delete', viewsExpenseOrCredit.ExpenseOrCreditDeleteView.as_view(), name='MovExpenseOrCreditDeleteView'), + path('CreateFirm', viewsExpenseOrCredit.ExpenseOrCreditFirmCreateView.as_view(), name='MovExpenseOrCreditFirmCreateView'), + path('CreateProf', viewsExpenseOrCredit.ExpenseOrCreditProfCreateView.as_view(), name='MovExpenseOrCreditProfCreateView'), + path('ProfCredit', viewsExpenseOrCredit.ExpenseOrCreditProfCreditCreateView.as_view(), name='MovExpenseOrCreditProfCreditCreateView'), + path('FirmCredit', viewsExpenseOrCredit.ExpenseOrCreditFirmCreditCreateView.as_view(), name='MovExpenseOrCreditFirmCreditCreateView'), +] \ No newline at end of file diff --git a/Movement/Urls/urlsProduct.py b/Movement/Urls/urlsProduct.py index fd7274a..f8c4380 100644 --- a/Movement/Urls/urlsProduct.py +++ b/Movement/Urls/urlsProduct.py @@ -7,10 +7,10 @@ from Movement.Views import ( urlpatterns = [ # URLs de Professional - path('/', viewsProduct.ProductListView.as_view(), name='MovProductListView'), - # path('/Create', viewsProduct.ProductCreateView.as_view(), name='MovProductCreateView'), - path('//Detail', viewsProduct.ProductDetailView.as_view(), name='MovProductDetailView'), - path('//Update', viewsProduct.ProductUpdateView.as_view(), name='MovProductUpdateView'), - path('//Delete', viewsProduct.ProductDeleteView.as_view(), name='MovProductDeleteView'), - path('/CreateCuston', viewsProductCreateCustom.ProductCreateCustomView.as_view(), name='MovProductCreateCustom'), + path('', viewsProduct.ProductListView.as_view(), name='MovProductListView'), + # path('Create', viewsProduct.ProductCreateView.as_view(), name='MovProductCreateView'), + path('/Detail', viewsProduct.ProductDetailView.as_view(), name='MovProductDetailView'), + path('/Update', viewsProduct.ProductUpdateView.as_view(), name='MovProductUpdateView'), + path('/Delete', viewsProduct.ProductDeleteView.as_view(), name='MovProductDeleteView'), + path('CreateCuston', viewsProductCreateCustom.ProductCreateCustomView.as_view(), name='MovProductCreateCustom'), ] \ No newline at end of file diff --git a/Movement/Urls/urlsStock.py b/Movement/Urls/urlsStock.py index 34ccb76..74d260d 100644 --- a/Movement/Urls/urlsStock.py +++ b/Movement/Urls/urlsStock.py @@ -6,10 +6,10 @@ from Movement.Views import ( urlpatterns = [ # URLs de Professional - path('/', viewsStock.StockListView.as_view(), name='MovStockListView'), - path('/Create', viewsStock.StockCreateView.as_view(), name='MovStockCreateView'), - path('//Detail', viewsStock.StockDetailView.as_view(), name='MovStockDetailView'), - path('//Update', viewsStock.StockUpdateView.as_view(), name='MovStockUpdateView'), - path('//Delete', viewsStock.StockDeleteView.as_view(), name='MovStockDeleteView'), - # path('/CreateCuston', viewsStockCreateCustom.StockCreateCustomView.as_view(), name='MovStockCreateCustom'), + path('', viewsStock.StockListView.as_view(), name='MovStockListView'), + path('Create', viewsStock.StockCreateView.as_view(), name='MovStockCreateView'), + path('/Detail', viewsStock.StockDetailView.as_view(), name='MovStockDetailView'), + path('/Update', viewsStock.StockUpdateView.as_view(), name='MovStockUpdateView'), + path('/Delete', viewsStock.StockDeleteView.as_view(), name='MovStockDeleteView'), + # path('CreateCuston', viewsStockCreateCustom.StockCreateCustomView.as_view(), name='MovStockCreateCustom'), ] \ No newline at end of file diff --git a/Movement/Urls/urlsTransition.py b/Movement/Urls/urlsTransition.py new file mode 100644 index 0000000..a38fcc8 --- /dev/null +++ b/Movement/Urls/urlsTransition.py @@ -0,0 +1,14 @@ +from django.urls import path +# from django.contrib.auth import views as auth_views +from Movement.Views import ( + viewsTransition , +) + +urlpatterns = [ + # URLs de Professional + path('', viewsTransition.TransitionListView.as_view(), name='MovTransitionListView'), + path('Create', viewsTransition.TransitionCreateView.as_view(), name='MovTransitionCreateView'), + path('/Detail', viewsTransition.TransitionDetailView.as_view(), name='MovTransitionDetailView'), + path('/Update', viewsTransition.TransitionUpdateView.as_view(), name='MovTransitionUpdateView'), + path('/Delete', viewsTransition.TransitionDeleteView.as_view(), name='MovTransitionDeleteView'), +] \ No newline at end of file diff --git a/Movement/Views/__pycache__/viewsCalendar.cpython-312.pyc b/Movement/Views/__pycache__/viewsCalendar.cpython-312.pyc index 7bdb74b..1db5d87 100644 Binary files a/Movement/Views/__pycache__/viewsCalendar.cpython-312.pyc and b/Movement/Views/__pycache__/viewsCalendar.cpython-312.pyc differ diff --git a/Movement/Views/__pycache__/viewsCalendarCreateCustom.cpython-312.pyc b/Movement/Views/__pycache__/viewsCalendarCreateCustom.cpython-312.pyc index 2037840..7b974c7 100644 Binary files a/Movement/Views/__pycache__/viewsCalendarCreateCustom.cpython-312.pyc and b/Movement/Views/__pycache__/viewsCalendarCreateCustom.cpython-312.pyc differ diff --git a/Movement/Views/__pycache__/viewsExpense.cpython-312.pyc b/Movement/Views/__pycache__/viewsExpense.cpython-312.pyc deleted file mode 100644 index 6cb1bd0..0000000 Binary files a/Movement/Views/__pycache__/viewsExpense.cpython-312.pyc and /dev/null differ diff --git a/Movement/Views/__pycache__/viewsExpenseOrCredit.cpython-312.pyc b/Movement/Views/__pycache__/viewsExpenseOrCredit.cpython-312.pyc new file mode 100644 index 0000000..a45b8f1 Binary files /dev/null and b/Movement/Views/__pycache__/viewsExpenseOrCredit.cpython-312.pyc differ diff --git a/Movement/Views/__pycache__/viewsProduct.cpython-312.pyc b/Movement/Views/__pycache__/viewsProduct.cpython-312.pyc index 46e2fcd..73fb82a 100644 Binary files a/Movement/Views/__pycache__/viewsProduct.cpython-312.pyc and b/Movement/Views/__pycache__/viewsProduct.cpython-312.pyc differ diff --git a/Movement/Views/__pycache__/viewsProductCreateCustom.cpython-312.pyc b/Movement/Views/__pycache__/viewsProductCreateCustom.cpython-312.pyc index 83ae57c..00ae2c2 100644 Binary files a/Movement/Views/__pycache__/viewsProductCreateCustom.cpython-312.pyc and b/Movement/Views/__pycache__/viewsProductCreateCustom.cpython-312.pyc differ diff --git a/Movement/Views/__pycache__/viewsStock.cpython-312.pyc b/Movement/Views/__pycache__/viewsStock.cpython-312.pyc index fa45cfa..a0c0788 100644 Binary files a/Movement/Views/__pycache__/viewsStock.cpython-312.pyc and b/Movement/Views/__pycache__/viewsStock.cpython-312.pyc differ diff --git a/Movement/Views/__pycache__/viewsTransition.cpython-312.pyc b/Movement/Views/__pycache__/viewsTransition.cpython-312.pyc new file mode 100644 index 0000000..0ddb5f1 Binary files /dev/null and b/Movement/Views/__pycache__/viewsTransition.cpython-312.pyc differ diff --git a/Movement/Views/viewsCalendarCreateCustom.py b/Movement/Views/viewsCalendarCreateCustom.py index 2d65da5..5792b83 100644 --- a/Movement/Views/viewsCalendarCreateCustom.py +++ b/Movement/Views/viewsCalendarCreateCustom.py @@ -5,13 +5,14 @@ from Movement import models from Client.models import Client from django.urls import reverse_lazy from django.contrib import messages +from decimal import Decimal class CalendarCreateCustomView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): model = models.Calendar template_name = 'Calendar/Create/index.html' form_class = FormsCalendar.FormsCalendar - success_url = reverse_lazy('MovCalendarListView') + success_url = reverse_lazy('Dashboard') permission_required = 'Base.add_' def get_context_data(self, **kwargs): @@ -43,7 +44,9 @@ class CalendarCreateCustomView(LoginRequiredMixin, PermissionRequiredMixin, Crea form.instance.gross_value = gross_value form.instance.net_value = net_value form.instance.value_cash = value_cash - form.instance.prof_money = prof_money + form.instance.prof_money = prof_money - Decimal('0.01') + (Client.objects.filter(id=form.instance.client.id) + .update(last_visit=form.instance.date)) form.instance.created_by = self.request.user messages.success(self.request, 'Registro realizado com sucesso!') return super().form_valid(form) diff --git a/Movement/Views/viewsExpense.py b/Movement/Views/viewsExpense.py deleted file mode 100644 index 20ef7b1..0000000 --- a/Movement/Views/viewsExpense.py +++ /dev/null @@ -1,102 +0,0 @@ -from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView -from django.contrib.auth.mixins import LoginRequiredMixin , PermissionRequiredMixin -from Movement.Forms import FormsExpense -from Movement import models -from Base.models import ChartOfAccount -from django.urls import reverse_lazy -from django.contrib import messages -from django.utils import timezone - -class ExpenseListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): - model = models.Expense - template_name = 'Expense/List.html' - context_object_name = 'Expenses' - paginate_by = 10 - permission_required = 'Base.view_professional' - def get_queryset(self): - queryset = super().get_queryset() - date = self.request.GET.get('date') - if date: - queryset = queryset.filter(date__icontains=date) - else: - queryset = queryset.filter( - date__icontains=timezone.localtime(timezone.now()).month - ) - return queryset - -class ExpenseCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): - model = models.Expense - template_name = 'Expense/Create.html' - form_class = FormsExpense.FormsExpense - success_url = reverse_lazy('MovExpenseListView') - permission_required = 'Base.add_professional' - -class ExpenseDetailView(LoginRequiredMixin,PermissionRequiredMixin, DetailView): - model = models.Expense - template_name = 'Expense/Detail.html' - permission_required = 'Base.view_professional' - -class ExpenseUpdateView(LoginRequiredMixin,PermissionRequiredMixin, UpdateView): - model = models.Expense - template_name = 'Expense/Update.html' - form_class = FormsExpense.FormsExpense - success_url = reverse_lazy('ExpenseListView') - permission_required = 'Base.change_professional' - -class ExpenseDeleteView(LoginRequiredMixin,PermissionRequiredMixin, DeleteView): - model = models.Expense - template_name = 'Expense/Delete.html' - success_url = reverse_lazy('MovExpenseListView') - permission_required = 'Base.delete_professional' - -class ExpenseFirmCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): - model = models.Expense - template_name = 'Expense/CreateFirm.html' - form_class = FormsExpense.FormsExpense - success_url = reverse_lazy('MovExpenseListView') - permission_required = 'Base.add_professional' - - def get_form(self, form_class=None): - form = super().get_form(form_class) - form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter( - firm=True, - debit=True, - ) - return form - - def form_valid(self, form): - form.instance.firm = True - form.instance.created_by = self.request.user - messages.success(self.request, 'Registro realizado com sucesso!') - return super().form_valid(form) - - def form_invalid(self, form): - errors = form.errors.as_text() - messages.error(self.request, f'Verifique os dados: {errors}') - return super().form_invalid(form) - -class ExpenseProfCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): - model = models.Expense - template_name = 'Expense/CreateProf.html' - form_class = FormsExpense.FormsExpense - success_url = reverse_lazy('MovExpenseListView') - permission_required = 'Base.add_professional' - - def get_form(self, form_class=None): - form = super().get_form(form_class) - form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter( - firm=False, - debit=True, - ) - return form - - def form_valid(self, form): - form.instance.firm = False - form.instance.created_by = self.request.user - messages.success(self.request, 'Registro realizado com sucesso!') - return super().form_valid(form) - - def form_invalid(self, form): - errors = form.errors.as_text() - messages.error(self.request, f'Verifique os dados: {errors}') - return super().form_invalid(form) \ No newline at end of file diff --git a/Movement/Views/viewsExpenseOrCredit.py b/Movement/Views/viewsExpenseOrCredit.py new file mode 100644 index 0000000..649b49e --- /dev/null +++ b/Movement/Views/viewsExpenseOrCredit.py @@ -0,0 +1,196 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin , PermissionRequiredMixin +from Movement.Forms import FormsExpenseOrCredit +from Movement import models +from Base.models import ChartOfAccount +from django.urls import reverse_lazy +from django.contrib import messages +from django.utils import timezone + +class ExpenseOrCreditListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.ExpenseOrCredit + template_name = 'ExpenseOrCredit/List.html' + context_object_name = 'Expenses' + paginate_by = 10 + permission_required = 'Base.view_professional' + def get_queryset(self): + queryset = super().get_queryset() + + month = self.request.GET.get('month') + mov_type = self.request.GET.get('type') + resp = self.request.GET.get('resp') + + # Validação: Se NÃO houver month E NÃO houver type E NÃO houver resp, retorna vazio + if not any([month, mov_type, resp]): + return super().get_queryset().none() + + # Se passou da validação, começamos o filtro + queryset = super().get_queryset() + year = timezone.localtime(timezone.now()).year + + # 1. Filtro de Data + if month: + queryset = queryset.filter(date__month=month, date__year=year) + else: + # Se você quiser que o mês atual seja o padrão caso month não venha, + # mas type ou resp venham: + current_month = timezone.localtime(timezone.now()).month + queryset = queryset.filter(date__month=current_month, date__year=year) + + # 2. Filtro de Tipo + if mov_type == 'credit': + queryset = queryset.filter(credit=True, debit=False) + elif mov_type == 'debit': + queryset = queryset.filter(credit=False, debit=True) + + # 3. Filtro de Responsável + if resp == 'firm': + queryset = queryset.filter(firm=True, prof=False) + elif resp == 'prof': + queryset = queryset.filter(firm=False, prof=True) + + return queryset + +# class ExpenseOrCreditCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): +# model = models.ExpenseOrCredit +# template_name = 'ExpenseOrCredit/Create.html' +# form_class = FormsExpenseOrCredit.FormsExpenseOrCredit +# success_url = reverse_lazy('MovExpenseOrCreditListView') +# permission_required = 'Base.add_professional' + +class ExpenseOrCreditDetailView(LoginRequiredMixin,PermissionRequiredMixin, DetailView): + model = models.ExpenseOrCredit + template_name = 'ExpenseOrCredit/Detail.html' + permission_required = 'Base.view_professional' + +class ExpenseOrCreditDeleteView(LoginRequiredMixin,PermissionRequiredMixin, DeleteView): + model = models.ExpenseOrCredit + # template_name = 'Expense/Delete.html' + success_url = reverse_lazy('MovExpenseOrCreditListView') + permission_required = 'Base.delete_professional' + + def form_valid(self, form): + messages.success(self.request, 'Registro Deletado com sucesso!') + return super().form_valid(form) + + def form_invalid(self, form): + errors = form.errors.as_text() + messages.error(self.request, f'Verifique os dados: {errors}') + return super().form_invalid(form) + +class ExpenseOrCreditFirmCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): + model = models.ExpenseOrCredit + template_name = 'ExpenseOrCredit/CreateFirm.html' + form_class = FormsExpenseOrCredit.FormsExpenseOrCredit + success_url = reverse_lazy('MovExpenseOrCreditListView') + permission_required = 'Base.add_professional' + + def get_form(self, form_class=None): + form = super().get_form(form_class) + form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter( + firm=True, + debit=True, + credit=False, + ) + return form + + def form_valid(self, form): + form.instance.firm = True + form.instance.debit = True + form.instance.created_by = self.request.user + messages.success(self.request, 'Registro realizado com sucesso!') + return super().form_valid(form) + + def form_invalid(self, form): + errors = form.errors.as_text() + messages.error(self.request, f'Verifique os dados: {errors}') + return super().form_invalid(form) + +class ExpenseOrCreditProfCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): + model = models.ExpenseOrCredit + template_name = 'ExpenseOrCredit/CreateProf.html' + form_class = FormsExpenseOrCredit.FormsExpenseOrCredit + success_url = reverse_lazy('MovExpenseOrCreditListView') + permission_required = 'Base.add_professional' + + def get_form(self, form_class=None): + form = super().get_form(form_class) + form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter( + firm=False, + debit=True, + credit=False, + prof=True, + ) + return form + + def form_valid(self, form): + form.instance.firm = False + form.instance.debit = True + form.instance.prof = True + form.instance.created_by = self.request.user + messages.success(self.request, 'Registro realizado com sucesso!') + return super().form_valid(form) + + def form_invalid(self, form): + errors = form.errors.as_text() + messages.error(self.request, f'Verifique os dados: {errors}') + return super().form_invalid(form) + +class ExpenseOrCreditFirmCreditCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): + model = models.ExpenseOrCredit + template_name = 'ExpenseOrCredit/CreateCredit.html' + form_class = FormsExpenseOrCredit.FormsExpenseOrCredit + success_url = reverse_lazy('MovExpenseOrCreditListView') + permission_required = 'Base.add_professional' + + def get_form(self, form_class=None): + form = super().get_form(form_class) + form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter( + firm=True, + credit=True, + ) + return form + + def form_valid(self, form): + form.instance.firm = True + form.instance.debit = False + form.instance.credit = True + form.instance.created_by = self.request.user + messages.success(self.request, 'Registro realizado com sucesso!') + return super().form_valid(form) + + def form_invalid(self, form): + errors = form.errors.as_text() + messages.error(self.request, f'Verifique os dados: {errors}') + return super().form_invalid(form) + +class ExpenseOrCreditProfCreditCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): + model = models.ExpenseOrCredit + template_name = 'ExpenseOrCredit/CreateProfCredit.html' + form_class = FormsExpenseOrCredit.FormsExpenseOrCredit + success_url = reverse_lazy('MovExpenseOrCreditListView') + permission_required = 'Base.add_professional' + + def get_form(self, form_class=None): + form = super().get_form(form_class) + form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter( + firm=False, + debit=False, + credit=True, + prof=True, + ) + return form + + def form_valid(self, form): + form.instance.firm = False + form.instance.debit = False + form.instance.credit = True + form.instance.prof = True + form.instance.created_by = self.request.user + messages.success(self.request, 'Registro realizado com sucesso!') + return super().form_valid(form) + + def form_invalid(self, form): + errors = form.errors.as_text() + messages.error(self.request, f'Verifique os dados: {errors}') + return super().form_invalid(form) \ No newline at end of file diff --git a/Movement/Views/viewsProductCreateCustom.py b/Movement/Views/viewsProductCreateCustom.py index acf9b01..b9a6f46 100644 --- a/Movement/Views/viewsProductCreateCustom.py +++ b/Movement/Views/viewsProductCreateCustom.py @@ -11,17 +11,11 @@ class ProductCreateCustomView(LoginRequiredMixin, PermissionRequiredMixin, Creat model = models.Product template_name = 'Product/Create/index.html' form_class = FormsProduct.FormsProduct - success_url = reverse_lazy('MovProductListView') + success_url = reverse_lazy('Dashboard') permission_required = 'Base.add_' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - # if self.request.GET.get('Client'): - # filter_client = Client.objects.filter( - # id=self.request.GET.get('Client') or '' - # ) - # else: filter_client = Client.objects.none() - # context['Client'] = filter_client return context def get_form(self, form_class=None): diff --git a/Movement/Views/viewsTransition.py b/Movement/Views/viewsTransition.py new file mode 100644 index 0000000..7232f29 --- /dev/null +++ b/Movement/Views/viewsTransition.py @@ -0,0 +1,52 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin , PermissionRequiredMixin +from Movement.Forms import FormsTransition +from Movement import models +from django.urls import reverse_lazy +from django.utils import timezone + +class TransitionListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.Transition + template_name = 'Transition/List.html' + context_object_name = 'Transitions' + paginate_by = 10 + permission_required = 'Base.view_professional' + def get_queryset(self): + queryset = super().get_queryset() + date = self.request.GET.get('month') + if date: + queryset = queryset.filter( + date__month=date, + date__year=timezone.localtime(timezone.now()).year, + ) + else: + queryset = queryset.filter( + date__month=timezone.localtime(timezone.now()).month, + date__year =timezone.localtime(timezone.now()).year, + ) + return queryset + +class TransitionCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): + model = models.Transition + template_name = 'Transition/Create.html' + form_class = FormsTransition.FormsTransition + success_url = reverse_lazy('MovTransitionListView') + permission_required = 'Base.add_professional' + +class TransitionDetailView(LoginRequiredMixin,PermissionRequiredMixin, DetailView): + model = models.Transition + template_name = 'Transition/Detail.html' + permission_required = 'Base.view_professional' + +class TransitionUpdateView(LoginRequiredMixin,PermissionRequiredMixin, UpdateView): + model = models.Transition + template_name = 'Transition/Update.html' + form_class = FormsTransition.FormsTransition + success_url = reverse_lazy('MovTransitionListView') + permission_required = 'Base.change_professional' + +class TransitionDeleteView(LoginRequiredMixin,PermissionRequiredMixin, DeleteView): + model = models.Transition + template_name = 'Transition/Delete.html' + success_url = reverse_lazy('MovTransitionListView') + permission_required = 'Base.delete_professional' \ No newline at end of file diff --git a/Movement/migrations/0001_initial.py b/Movement/migrations/0001_initial.py index fdc9842..4eddf6d 100644 --- a/Movement/migrations/0001_initial.py +++ b/Movement/migrations/0001_initial.py @@ -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 from django.conf import settings @@ -42,13 +42,14 @@ class Migration(migrations.Migration): }, ), migrations.CreateModel( - name='Expense', + name='ExpenseOrCredit', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('active', models.BooleanField(default=False)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('date', models.DateField()), + ('debit', models.BooleanField(default=True)), ('firm', models.BooleanField(default=True)), ('gross_value', models.DecimalField(decimal_places=2, max_digits=10)), ('bank', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ExpenseBank', to='Base.bankaccount')), @@ -99,4 +100,22 @@ class Migration(migrations.Migration): 'ordering': ['product'], }, ), + migrations.CreateModel( + name='Transition', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('active', models.BooleanField(default=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('date', models.DateField()), + ('gross_value', models.DecimalField(decimal_places=2, max_digits=10)), + ('bank_credit', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='TransitionBankCredit', to='Base.bankaccount')), + ('bank_debit', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='TransitionBankDebit', to='Base.bankaccount')), + ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created', to=settings.AUTH_USER_MODEL)), + ('updated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['date'], + }, + ), ] diff --git a/Movement/migrations/0002_expenseorcredit_credit.py b/Movement/migrations/0002_expenseorcredit_credit.py new file mode 100644 index 0000000..8479f0e --- /dev/null +++ b/Movement/migrations/0002_expenseorcredit_credit.py @@ -0,0 +1,18 @@ +# Generated by Django 6.0 on 2025-12-24 14:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('Movement', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='expenseorcredit', + name='credit', + field=models.BooleanField(default=False), + ), + ] diff --git a/Movement/migrations/0003_expenseorcredit_prof.py b/Movement/migrations/0003_expenseorcredit_prof.py new file mode 100644 index 0000000..03a621e --- /dev/null +++ b/Movement/migrations/0003_expenseorcredit_prof.py @@ -0,0 +1,18 @@ +# Generated by Django 6.0 on 2025-12-24 14:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('Movement', '0002_expenseorcredit_credit'), + ] + + operations = [ + migrations.AddField( + model_name='expenseorcredit', + name='prof', + field=models.BooleanField(default=False), + ), + ] diff --git a/Movement/migrations/__pycache__/0001_initial.cpython-312.pyc b/Movement/migrations/__pycache__/0001_initial.cpython-312.pyc index 4e8f4b8..06a4f4e 100644 Binary files a/Movement/migrations/__pycache__/0001_initial.cpython-312.pyc and b/Movement/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/Movement/migrations/__pycache__/0002_expenseorcredit_credit.cpython-312.pyc b/Movement/migrations/__pycache__/0002_expenseorcredit_credit.cpython-312.pyc new file mode 100644 index 0000000..5537380 Binary files /dev/null and b/Movement/migrations/__pycache__/0002_expenseorcredit_credit.cpython-312.pyc differ diff --git a/Movement/migrations/__pycache__/0003_expenseorcredit_prof.cpython-312.pyc b/Movement/migrations/__pycache__/0003_expenseorcredit_prof.cpython-312.pyc new file mode 100644 index 0000000..d078d6b Binary files /dev/null and b/Movement/migrations/__pycache__/0003_expenseorcredit_prof.cpython-312.pyc differ diff --git a/Movement/migrations/__pycache__/__init__.cpython-312.pyc b/Movement/migrations/__pycache__/__init__.cpython-312.pyc index df2a61d..1b0684c 100644 Binary files a/Movement/migrations/__pycache__/__init__.cpython-312.pyc and b/Movement/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/Movement/models.py b/Movement/models.py index 3b97cce..7c8acc8 100644 --- a/Movement/models.py +++ b/Movement/models.py @@ -36,10 +36,10 @@ class Calendar(Base): ) first_time = models.BooleanField(default=False) # Value - gross_value = models.DecimalField(max_digits=10, decimal_places=2) - net_value = models.DecimalField(max_digits=10, decimal_places=2) - value_cash = models.DecimalField(max_digits=10, decimal_places=2) - prof_money = models.DecimalField(max_digits=10, decimal_places=2) + gross_value = models.DecimalField(max_digits=10, decimal_places=2) # bruto + net_value = models.DecimalField(max_digits=10, decimal_places=2) #liquido + value_cash = models.DecimalField(max_digits=10, decimal_places=2) # da empresa + prof_money = models.DecimalField(max_digits=10, decimal_places=2) # do profissinal class Meta: ordering = ['date','time','professional',] @@ -102,7 +102,7 @@ class Product(Base): return f'{self.date} - {self.product} ' # Despesas -class Expense(Base): +class ExpenseOrCredit(Base): date = models.DateField() chart_of_account = models.ForeignKey( ChartOfAccount, @@ -114,7 +114,10 @@ class Expense(Base): on_delete=models.PROTECT, related_name='ExpenseBank', ) + debit = models.BooleanField(default=True) + credit = models.BooleanField(default=False) firm = models.BooleanField(default=True) + prof = models.BooleanField(default=False) professional = models.ForeignKey( Professional, on_delete=models.PROTECT, @@ -126,4 +129,24 @@ class Expense(Base): class Meta: ordering = ['date','chart_of_account',] def __str__(self): - return f'{self.date} - {self.chart_of_account} ' \ No newline at end of file + return f'{self.date} - {self.chart_of_account} ' + +# trasiçoes entre bancos +class Transition(Base): + date = models.DateField() + bank_credit = models.ForeignKey( + BankAccount, + on_delete=models.PROTECT, + related_name='TransitionBankCredit', + ) + bank_debit = models.ForeignKey( + BankAccount, + on_delete=models.PROTECT, + related_name='TransitionBankDebit', + ) + gross_value = models.DecimalField(max_digits=10, decimal_places=2) + + class Meta: + ordering = ['date',] + def __str__(self): + return f'{self.bank_credit} to {self.bank_credit}' \ No newline at end of file diff --git a/Movement/templates/Calendar/Create/date.html b/Movement/templates/Calendar/Create/date.html index 799dbd3..d252fcd 100644 --- a/Movement/templates/Calendar/Create/date.html +++ b/Movement/templates/Calendar/Create/date.html @@ -1,7 +1,7 @@ {##} -
+{#
#} diff --git a/Movement/templates/Calendar/Create/index.html b/Movement/templates/Calendar/Create/index.html index 899fd07..37b6856 100644 --- a/Movement/templates/Calendar/Create/index.html +++ b/Movement/templates/Calendar/Create/index.html @@ -18,11 +18,12 @@ {% include 'Calendar/Create/date.html' %}
{% include 'Calendar/Create/time.html' %} {% include 'Calendar/Create/first_time.html' %} +
+ +       + Cancelar - -       - Cancelar diff --git a/Movement/templates/Calendar/List.html b/Movement/templates/Calendar/List.html index 03f48ca..73dd5c6 100644 --- a/Movement/templates/Calendar/List.html +++ b/Movement/templates/Calendar/List.html @@ -25,7 +25,7 @@
- + @@ -46,6 +46,7 @@ {# #} {# #} {# {% endif %}#} + {# {% if perms.brands.delete_brands %}#} diff --git a/Movement/templates/Calendar/Update.html b/Movement/templates/Calendar/Update.html index f60a1ac..a900619 100644 --- a/Movement/templates/Calendar/Update.html +++ b/Movement/templates/Calendar/Update.html @@ -10,7 +10,9 @@ {{ form.as_p }} - Cancelar e Voltar + diff --git a/Movement/templates/Expense/List.html b/Movement/templates/Expense/List.html deleted file mode 100644 index 0ba1d80..0000000 --- a/Movement/templates/Expense/List.html +++ /dev/null @@ -1,78 +0,0 @@ -{% extends "BaseLogin.html" %} -{% block title %} List {% endblock %} -{% block content %} -

Despesas


-
-
-
-
- - -
- -
-{# {% if perms.brands.add_brands %}#} -{#
#} -{# #} -{# Criar #} -{#
#} - - -{# {% endif %}#} -
- -
-
Marcar Nome Sobrenome Telefone Nome Completo Telefone Profissinal T. D. FeedBack Notas Produto Ações T. Duplo U. Visita
-
+ +{# #} + + +
+ - + {{ Client.first_name }} {{ Client.last_name }} {{ Client.phone }} {{ Client.professional.symbol }} {{ Client.professional }} {{ Client.first_name }} {{ Client.last_name }} {{ Client.professional.symbol }} {{ Client.phone|format_phone }} {{ Client.professional.name }} {% if Client.double_workload %} {% else %} {% endif %} {% if Client.feed_back %} - {% else %} {% endif %} {{ Client.notes }} -
- - -
-
- - - -{# {% if perms.brands.change_brands %}#} - - - -{# {% endif %}#} -{# {% if perms.brands.delete_brands %}#} - - - -{# {% endif %}#} - {{ Client.last_visit|date:"d/m/Y" }}
Hora professional Cliente service Service Ações
- - - - - - - - - - - - - {% for Exp in Expenses %} - - - - - - - - - - {% endfor %} - -
Data Plano de Contas Banco Firma Prof Valor Ações
{{ Exp.date|date:"d/m/Y" }} {{ Exp.chart_of_account }} {{ Exp.bank }} {{ Exp.firm }} {{ Exp.professional }} {{ Exp.gross_value }} - - - -{# {% if perms.brands.change_brands %}#} - - - -{# {% endif %}#} -{# {% if perms.brands.delete_brands %}#} - - - -{# {% endif %}#} -
-
- {% include 'components/_pagination.html' %} -{% endblock %} diff --git a/Movement/templates/ExpenseOrCredit/CreateCredit.html b/Movement/templates/ExpenseOrCredit/CreateCredit.html new file mode 100644 index 0000000..55e9f10 --- /dev/null +++ b/Movement/templates/ExpenseOrCredit/CreateCredit.html @@ -0,0 +1,22 @@ +{% extends "BaseLogin.html" %} +{% block title %} Create {% endblock %} +{% block content %} + +
+

Despesa Do Prof.

+
+
+
+ {% csrf_token %} + {{ form.date.label }} {{ form.date }}

+ {{ form.chart_of_account.label }}
{{ form.chart_of_account }}
+ {{ form.bank.label }}
{{ form.bank }}
+ {{ form.gross_value.label }} {{ form.gross_value }}

+ +
+{# Cancelar e Voltar #} +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Movement/templates/Expense/CreateFirm.html b/Movement/templates/ExpenseOrCredit/CreateFirm.html similarity index 100% rename from Movement/templates/Expense/CreateFirm.html rename to Movement/templates/ExpenseOrCredit/CreateFirm.html diff --git a/Movement/templates/Expense/CreateProf.html b/Movement/templates/ExpenseOrCredit/CreateProf.html similarity index 100% rename from Movement/templates/Expense/CreateProf.html rename to Movement/templates/ExpenseOrCredit/CreateProf.html diff --git a/Movement/templates/ExpenseOrCredit/CreateProfCredit.html b/Movement/templates/ExpenseOrCredit/CreateProfCredit.html new file mode 100644 index 0000000..b79d2f2 --- /dev/null +++ b/Movement/templates/ExpenseOrCredit/CreateProfCredit.html @@ -0,0 +1,23 @@ +{% extends "BaseLogin.html" %} +{% block title %} Create {% endblock %} +{% block content %} + +
+

Despesa Do Prof.

+
+
+
+ {% csrf_token %} + {{ form.date.label }} {{ form.date }}

+ {{ form.chart_of_account.label }}
{{ form.chart_of_account }}
+ {{ form.bank.label }}
{{ form.bank }}
+ {{ form.professional.label }}
{{ form.professional }}
+ {{ form.gross_value.label }} {{ form.gross_value }}

+ +
+{# Cancelar e Voltar #} +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Movement/templates/Expense/Detail.html b/Movement/templates/ExpenseOrCredit/Detail.html similarity index 100% rename from Movement/templates/Expense/Detail.html rename to Movement/templates/ExpenseOrCredit/Detail.html diff --git a/Movement/templates/ExpenseOrCredit/List.html b/Movement/templates/ExpenseOrCredit/List.html new file mode 100644 index 0000000..098f4cb --- /dev/null +++ b/Movement/templates/ExpenseOrCredit/List.html @@ -0,0 +1,142 @@ +{% extends "BaseLogin.html" %} +{% block title %} List {% endblock %} +{% block content %} + +
+
+
+
+

+ Despesas +

+
+ + + + +
+
+ +
+ +
+
+ +
+
+
+
+ Tipo: +
+ + + + + +
+
+ +
+ Resp: +
+ + + + + +
+
+ + +
+
+
+
+
+ + + +
+ + + + + + + + + + + + + + + + + {% for Exp in Expenses %} + + + + + + + + + + + + + {% endfor %} + +
Data Plano de Contas Valor Banco Firma Credito Debito Prof Profissimal Ações
{{ Exp.date|date:"d/m/Y" }} {{ Exp.chart_of_account }} R$ {{ Exp.gross_value }} {{ Exp.bank }} {% if Exp.firm %} + {% else %} {% endif %} {% if Exp.credit %} + {% else %} {% endif %} {% if Exp.debit %} + {% else %} {% endif %} {% if Exp.prof %} + {% else %} {% endif %} {% if Exp.professional %} {{ Exp.professional }} + {% else %} {% endif %} +
+ {% csrf_token %} + +
+
+
+ {% include 'components/_pagination.html' %} + +
+ +
+ + +{% endblock %} + + + diff --git a/Movement/templates/Expense/Update.html b/Movement/templates/ExpenseOrCredit/Update.html similarity index 100% rename from Movement/templates/Expense/Update.html rename to Movement/templates/ExpenseOrCredit/Update.html diff --git a/Movement/templates/Product/Create/date.html b/Movement/templates/Product/Create/date.html index a4b6958..ed5189c 100644 --- a/Movement/templates/Product/Create/date.html +++ b/Movement/templates/Product/Create/date.html @@ -1,6 +1,10 @@ -

#} + -

\ No newline at end of file + > \ No newline at end of file diff --git a/Movement/templates/Product/Create/index.html b/Movement/templates/Product/Create/index.html index 6c312f7..f605f08 100644 --- a/Movement/templates/Product/Create/index.html +++ b/Movement/templates/Product/Create/index.html @@ -3,7 +3,7 @@ {% block content %}
-

Cadastrar

+

lançar um produto

@@ -13,14 +13,12 @@
{% include 'Product/Create/client.html' %}
-
-
{% include 'Product/Create/date.html' %}
-
{{ form.quantity.label }}
{{ form.quantity }}
-
-
{% include 'Product/Create/product.html' %}
-
{% include 'Product/Create/pay_method.html' %}
-
{% include 'Product/Create/professional.html' %}
+
{% include 'Product/Create/product.html' %}
+
{% include 'Product/Create/pay_method.html' %}
+
{% include 'Product/Create/professional.html' %}
+
{{ form.quantity.label }}
{{ form.quantity }}
+
{% include 'Product/Create/date.html' %}
diff --git a/Movement/templates/Expense/Create.html b/Movement/templates/Transition/Create.html similarity index 88% rename from Movement/templates/Expense/Create.html rename to Movement/templates/Transition/Create.html index 5ced28a..74871fa 100644 --- a/Movement/templates/Expense/Create.html +++ b/Movement/templates/Transition/Create.html @@ -11,7 +11,7 @@ {{ form.as_p }} - Cancelar e Voltar + Cancelar e Voltar
diff --git a/Movement/templates/Expense/Delete.html b/Movement/templates/Transition/Delete.html similarity index 90% rename from Movement/templates/Expense/Delete.html rename to Movement/templates/Transition/Delete.html index 83943d8..440c2d4 100644 --- a/Movement/templates/Expense/Delete.html +++ b/Movement/templates/Transition/Delete.html @@ -13,6 +13,6 @@
- Cancelar e Voltar + Cancelar e Voltar {% endblock %} diff --git a/Movement/templates/Transition/Detail.html b/Movement/templates/Transition/Detail.html new file mode 100644 index 0000000..d603d0b --- /dev/null +++ b/Movement/templates/Transition/Detail.html @@ -0,0 +1,15 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Detalhes do Banco

+
+
+

{{ object.name }}

+

Descrição: {{ object.description }}

+{# Editar #} +
+
+ Cancelar e Voltar +
+{% endblock %} \ No newline at end of file diff --git a/Movement/templates/Transition/List.html b/Movement/templates/Transition/List.html new file mode 100644 index 0000000..3230fb2 --- /dev/null +++ b/Movement/templates/Transition/List.html @@ -0,0 +1,79 @@ +{% extends "BaseLogin.html" %} +{% block title %} List {% endblock %} +{% block content %} +

Tranf. entre Bancos


+
+
+
+
+ + +
+
+
+{# {% if perms.brands.add_brands %}#} + +{# {% endif %}#} +
+ +
+ + + +{# #} + + + + + + + + + {% for Bank in Transitions %} + +{# #} + + + + + + + {% endfor %} + +
ID Data Entrada Saida Valor Ações
{{ Bank.id }} {{ Bank.date|date:"d/m/Y" }} {{ Bank.bank_credit }} {{ Bank.bank_debit }} {{ Bank.gross_value }} + + + +{# {% if perms.brands.change_brands %}#} + + + +{# {% endif %}#} +{# {% if perms.brands.delete_brands %}#} + + + +{# {% endif %}#} +
+
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Movement/templates/Transition/Update.html b/Movement/templates/Transition/Update.html new file mode 100644 index 0000000..f60a1ac --- /dev/null +++ b/Movement/templates/Transition/Update.html @@ -0,0 +1,17 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Editar Bancos

+
+
+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Cancelar e Voltar +
+
+
+{% endblock %} \ No newline at end of file diff --git a/Setup/__pycache__/__init__.cpython-312.pyc b/Setup/__pycache__/__init__.cpython-312.pyc index 329fbad..5109ac0 100644 Binary files a/Setup/__pycache__/__init__.cpython-312.pyc and b/Setup/__pycache__/__init__.cpython-312.pyc differ diff --git a/Setup/__pycache__/settings.cpython-312.pyc b/Setup/__pycache__/settings.cpython-312.pyc index 775b12d..3adfafa 100644 Binary files a/Setup/__pycache__/settings.cpython-312.pyc and b/Setup/__pycache__/settings.cpython-312.pyc differ diff --git a/Setup/__pycache__/urls.cpython-312.pyc b/Setup/__pycache__/urls.cpython-312.pyc index 923a460..bc69e3a 100644 Binary files a/Setup/__pycache__/urls.cpython-312.pyc and b/Setup/__pycache__/urls.cpython-312.pyc differ diff --git a/Setup/__pycache__/wsgi.cpython-312.pyc b/Setup/__pycache__/wsgi.cpython-312.pyc index b8fd612..b21f5ac 100644 Binary files a/Setup/__pycache__/wsgi.cpython-312.pyc and b/Setup/__pycache__/wsgi.cpython-312.pyc differ diff --git a/Setup/urls.py b/Setup/urls.py index 5d8eb31..a53dd56 100644 --- a/Setup/urls.py +++ b/Setup/urls.py @@ -4,16 +4,17 @@ from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include('Base.Urls.urlsBase')), - path('Professional', include('Base.Urls.urlsProfessional')), - path('BankAccount', include('Base.Urls.urlsBankAccount')), - path('ServiceList', include('Base.Urls.urlsServiceList')), - path('ProductList', include('Base.Urls.urlsProductList')), - path('ChartOfAccount', include('Base.Urls.urlsChartOfAccount')), - path('PaymentMethod', include('Base.Urls.urlsPaymentMethod')), - path('Client', include('Client.urlsClient')), - path('Mov/Calendar', include('Movement.Urls.urlsCalendar')), - path('Mov/Stock', include('Movement.Urls.urlsStock')), - path('Mov/Product', include('Movement.Urls.urlsProduct')), - path('Mov/Expense', include('Movement.Urls.urlsExpense')), + path('Professional/', include('Base.Urls.urlsProfessional')), + path('BankAccount/', include('Base.Urls.urlsBankAccount')), + path('ServiceList/', include('Base.Urls.urlsServiceList')), + path('ProductList/', include('Base.Urls.urlsProductList')), + path('ChartOfAccount/', include('Base.Urls.urlsChartOfAccount')), + path('PaymentMethod/', include('Base.Urls.urlsPaymentMethod')), + path('Client/', include('Client.urlsClient')), + path('Mov/Calendar/', include('Movement.Urls.urlsCalendar')), + path('Mov/Stock/', include('Movement.Urls.urlsStock')), + path('Mov/Product/', include('Movement.Urls.urlsProduct')), + path('Mov/ExpenseOrCredit/', include('Movement.Urls.urlsExpenseOrCredit')), + path('Mov/Transition/', include('Movement.Urls.urlsTransition')), ] diff --git a/Templates/Base.html b/Templates/Base.html index e627969..3d7753a 100644 --- a/Templates/Base.html +++ b/Templates/Base.html @@ -5,12 +5,13 @@ {% block title %} {% endblock %} - + {% include 'components/_header.html' %}
{% block content %} diff --git a/Templates/components/_footer.html b/Templates/components/_footer.html index 5cfaa06..c62dd57 100644 --- a/Templates/components/_footer.html +++ b/Templates/components/_footer.html @@ -1,4 +1,4 @@ -
{% endif %} diff --git a/requirements.txt b/requirements.txt index cf43e80..8bd7992 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/requirements_linux.txt b/requirements_linux.txt new file mode 100644 index 0000000..149762e --- /dev/null +++ b/requirements_linux.txt @@ -0,0 +1,4 @@ +asgiref +Django +sqlparse +uWSGI diff --git a/requirements_win.txt b/requirements_win.txt deleted file mode 100644 index 0792fb1..0000000 Binary files a/requirements_win.txt and /dev/null differ