diff --git a/.gitignore b/.gitignore index 6b02e10..0d0c0f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ # created by virtualenv automatically +# created by virtualenv automatically .venv venv -.idea \ No newline at end of file +db.sqlite3 +media +.idea +*/__pycache__ +static \ No newline at end of file diff --git a/Base/Forms/FormsBankAccounts.py b/Base/Forms/FormsBankAccounts.py new file mode 100644 index 0000000..6bca387 --- /dev/null +++ b/Base/Forms/FormsBankAccounts.py @@ -0,0 +1,15 @@ +from django import forms +from Base import models + +class FormsBankAccount(forms.ModelForm): + class Meta: + model = models.BankAccount + fields = ['name','description'] + widgets = { + 'name': forms.TextInput({'class':'form-control'}), + 'description': forms.Textarea({'class':'form-control','rows':3 , }), + } + labels={ + 'name':'Nome', + 'description':'Descrição', + } \ No newline at end of file diff --git a/Base/Forms/FormsChartOfAccount.py b/Base/Forms/FormsChartOfAccount.py new file mode 100644 index 0000000..6af4c7c --- /dev/null +++ b/Base/Forms/FormsChartOfAccount.py @@ -0,0 +1,24 @@ +from django import forms +from Base import models + +class FormsChartOfAccount(forms.ModelForm): + class Meta: + model = models.ChartOfAccount + fields = [ + 'name', + 'debit', + 'firm', + 'notes', + ] + widgets = { + 'name': forms.TextInput({'class':'form-control'}), + 'debit': forms.CheckboxInput({'class':''}), + 'firm': forms.CheckboxInput({'class':''}), + 'notes': forms.Textarea({'class':'form-control','rows':3 , }), + } + labels={ + 'name':'Nome', + 'debit':'Debito', + 'firm':'Firma', + 'notes':'Notas', + } \ No newline at end of file diff --git a/Base/Forms/FormsPayMethod.py b/Base/Forms/FormsPayMethod.py new file mode 100644 index 0000000..aa63078 --- /dev/null +++ b/Base/Forms/FormsPayMethod.py @@ -0,0 +1,24 @@ +from django import forms +from Base import models + +class FormsPayMethod(forms.ModelForm): + class Meta: + model = models.PayMethod + fields = [ + 'name', + 'bank', + 'percentage', + 'description', + ] + widgets = { + 'name': forms.TextInput({'class':'form-control'}), + 'bank': forms.Select({'class': 'form-select'}), + 'percentage': forms.NumberInput(attrs={'step': 1}), + 'description': forms.Textarea({'class': 'form-control', 'rows': 3, }), + } + labels={ + 'name':'Nome', + 'bank':'Banco', + 'percentage':'Percentual', + 'description':'Descrição', + } \ No newline at end of file diff --git a/Base/Forms/FormsProductList.py b/Base/Forms/FormsProductList.py new file mode 100644 index 0000000..54a4962 --- /dev/null +++ b/Base/Forms/FormsProductList.py @@ -0,0 +1,17 @@ +from django import forms +from Base import models + +class FormsProductList(forms.ModelForm): + class Meta: + model = models.ProductList + fields = ['name','value','description'] + widgets = { + 'name': forms.TextInput({'class':'form-control'}), + 'value': forms.NumberInput(attrs={'step': 1}), + 'description': forms.Textarea({'class':'form-control','rows':3 , }), + } + labels={ + 'name':'Nome', + 'value':'Valor', + 'description':'Descrição', + } \ No newline at end of file diff --git a/Base/Forms/FormsProfessional.py b/Base/Forms/FormsProfessional.py new file mode 100644 index 0000000..adcff0a --- /dev/null +++ b/Base/Forms/FormsProfessional.py @@ -0,0 +1,24 @@ +from django import forms +from Base import models + +class FormsProfessional(forms.ModelForm): + class Meta: + model = models.Professional + fields = [ + 'name', + 'percentage', + 'symbol', + 'user', + ] + widgets = { + 'name': forms.TextInput({'class':'form-control'}), + 'percentage': forms.NumberInput(attrs={'step': 1 }), + 'symbol': forms.TextInput({'class': 'form-control'}), + 'user': forms.Select({'class':'form-control'}), + } + labels={ + 'name':'Nome', + 'percentage':'Porcentagem', + 'symbol':'Simbolo', + 'user':'User', + } \ No newline at end of file diff --git a/Base/Forms/FormsServiceList.py b/Base/Forms/FormsServiceList.py new file mode 100644 index 0000000..86af125 --- /dev/null +++ b/Base/Forms/FormsServiceList.py @@ -0,0 +1,17 @@ +from django import forms +from Base import models + +class FormsServiceList(forms.ModelForm): + class Meta: + model = models.ServiceList + fields = ['name','value','description'] + widgets = { + 'name': forms.TextInput({'class':'form-control'}), + 'value': forms.NumberInput(attrs={'step': 1}), + 'description': forms.Textarea({'class':'form-control','rows':3 , }), + } + labels={ + 'name':'Nome', + 'value':'Valor', + 'description':'Descrição', + } \ No newline at end of file diff --git a/Base/Forms/__pycache__/FormsBankAccounts.cpython-312.pyc b/Base/Forms/__pycache__/FormsBankAccounts.cpython-312.pyc new file mode 100644 index 0000000..e19dd4c Binary files /dev/null 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 new file mode 100644 index 0000000..8386dfa Binary files /dev/null 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 new file mode 100644 index 0000000..8bf2bab Binary files /dev/null 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 new file mode 100644 index 0000000..6e81383 Binary files /dev/null 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 new file mode 100644 index 0000000..661b6f3 Binary files /dev/null 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 new file mode 100644 index 0000000..84f018d Binary files /dev/null and b/Base/Forms/__pycache__/FormsServiceList.cpython-312.pyc differ diff --git a/Base/Metrics/Dashboard/__pycache__/get_sum_of_product.cpython-312.pyc b/Base/Metrics/Dashboard/__pycache__/get_sum_of_product.cpython-312.pyc new file mode 100644 index 0000000..0687e7d Binary files /dev/null and b/Base/Metrics/Dashboard/__pycache__/get_sum_of_product.cpython-312.pyc differ diff --git a/Base/Metrics/Dashboard/__pycache__/get_sum_of_professional.cpython-312.pyc b/Base/Metrics/Dashboard/__pycache__/get_sum_of_professional.cpython-312.pyc new file mode 100644 index 0000000..8e6a0e6 Binary files /dev/null and b/Base/Metrics/Dashboard/__pycache__/get_sum_of_professional.cpython-312.pyc differ diff --git a/Base/Metrics/Dashboard/__pycache__/get_sum_of_professional_detail.cpython-312.pyc b/Base/Metrics/Dashboard/__pycache__/get_sum_of_professional_detail.cpython-312.pyc new file mode 100644 index 0000000..fd57982 Binary files /dev/null and b/Base/Metrics/Dashboard/__pycache__/get_sum_of_professional_detail.cpython-312.pyc differ diff --git a/Base/Metrics/Dashboard/__pycache__/get_sum_of_service.cpython-312.pyc b/Base/Metrics/Dashboard/__pycache__/get_sum_of_service.cpython-312.pyc new file mode 100644 index 0000000..62799a4 Binary files /dev/null and b/Base/Metrics/Dashboard/__pycache__/get_sum_of_service.cpython-312.pyc differ diff --git a/Base/Metrics/Dashboard/__pycache__/get_sum_of_stone.cpython-312.pyc b/Base/Metrics/Dashboard/__pycache__/get_sum_of_stone.cpython-312.pyc new file mode 100644 index 0000000..6214712 Binary files /dev/null and b/Base/Metrics/Dashboard/__pycache__/get_sum_of_stone.cpython-312.pyc differ diff --git a/Base/Metrics/Dashboard/__pycache__/get_sum_payment_method_service.cpython-312.pyc b/Base/Metrics/Dashboard/__pycache__/get_sum_payment_method_service.cpython-312.pyc new file mode 100644 index 0000000..6dbceca Binary files /dev/null and b/Base/Metrics/Dashboard/__pycache__/get_sum_payment_method_service.cpython-312.pyc differ diff --git a/Base/Metrics/Dashboard/get_sum_of_product.py b/Base/Metrics/Dashboard/get_sum_of_product.py new file mode 100644 index 0000000..cc202b3 --- /dev/null +++ b/Base/Metrics/Dashboard/get_sum_of_product.py @@ -0,0 +1,24 @@ +from django.db.models import Sum +from Base.models import ProductList +from Movement.models import Product + +def metric(Day): + products = ProductList.objects.all() + product_mov = Product.objects.filter(date=Day).values() + product_report = {} + for product in products: + product_item = product_mov.filter( + product__name=product.name, + ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 + product_cont = product_mov.filter( + product__name=product.name, + ).aggregate(Sum('quantity'))['quantity__sum'] or 0 + product_report[product.name] = { + 'product_item':product_item, + 'product_cont':product_cont, + } + sum_of_product = sum(item['product_item'] for item in product_report.values()) or 0 + return { + 'product_report':product_report, + 'sum_of_product':sum_of_product, + } \ No newline at end of file diff --git a/Base/Metrics/Dashboard/get_sum_of_professional.py b/Base/Metrics/Dashboard/get_sum_of_professional.py new file mode 100644 index 0000000..7eca0d2 --- /dev/null +++ b/Base/Metrics/Dashboard/get_sum_of_professional.py @@ -0,0 +1,19 @@ +# from django.utils import timezone +from django.db.models import Sum +from Base.models import Professional +from Movement.models import Calendar + +def metric(Day): + professionals = Professional.objects.all() + professionals_report = {} + for professional in professionals: + service = Calendar.objects.filter( + professional__name=professional.name, + date=Day + ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 + professionals_report[professional.name] = service + sum_of_professionals = sum(professionals_report.values()) or 0 + return { + 'professional':professionals_report, + 'sum_all_prof':sum_of_professionals, + } \ No newline at end of file diff --git a/Base/Metrics/Dashboard/get_sum_of_professional_detail.py b/Base/Metrics/Dashboard/get_sum_of_professional_detail.py new file mode 100644 index 0000000..41c320e --- /dev/null +++ b/Base/Metrics/Dashboard/get_sum_of_professional_detail.py @@ -0,0 +1,31 @@ +from Base.models import Professional , ServiceList +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() + professionals_report = {} + for professional in professionals: + professionals_report[professional.name] = {} + for service in services: + service_sum = service_movement.filter( + professional__name=professional.name, + service__name=service.name, + ) + servSum =service_sum.aggregate(Sum('gross_value'))['gross_value__sum'] or 0 + servCont = service_sum.count() + professionals_report[professional.name][service.name] = { + 'servSum':servSum, + 'servCont':servCont, + } + sum_of_prof = sum( + sum(service['servSum'] for service in services.values()) + for services in professionals_report.values() + ) + return { + '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_service.py b/Base/Metrics/Dashboard/get_sum_of_service.py new file mode 100644 index 0000000..96bf84d --- /dev/null +++ b/Base/Metrics/Dashboard/get_sum_of_service.py @@ -0,0 +1,19 @@ +# from django.utils import timezone +from django.db.models import Sum +from Base.models import ServiceList +from Movement.models import Calendar + +def metric(Day): + Service = ServiceList.objects.all() + Serv_report = {} + for Serv in Service: + service = Calendar.objects.filter( + service__name=Serv.name, + date=Day + ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 + Serv_report[Serv.name] = service + sum_ = sum(Serv_report.values()) or 0 + return { + 'Service':Serv_report, + 'sum':sum_, + } \ 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 new file mode 100644 index 0000000..2dcb0c1 --- /dev/null +++ b/Base/Metrics/Dashboard/get_sum_of_stone.py @@ -0,0 +1,24 @@ +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/Dashboard/get_sum_payment_method_service.py b/Base/Metrics/Dashboard/get_sum_payment_method_service.py new file mode 100644 index 0000000..11de4d3 --- /dev/null +++ b/Base/Metrics/Dashboard/get_sum_payment_method_service.py @@ -0,0 +1,24 @@ +from django.db.models import Sum +from Base.models import PayMethod +from Movement.models import Calendar , Product + + +def metric(Day): + # Total de despesas do dia + payment_method = PayMethod.objects.all() + serv_mov = Calendar.objects.filter(date=Day).values() + prod_mov = Product.objects.filter(date=Day).values() + bank_balance = {} + for PayM in payment_method: + sum_bank1 = serv_mov.filter( + pay_method__name=PayM.name, + ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 + sum_bank2 = prod_mov.filter( + pay_method__name=PayM.name, + ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 + bank_balance[PayM.name] = sum_bank1 + sum_bank2 + sum_of_bank = sum(bank_balance.values()) or 0 + return { + 'bank_balance':bank_balance, + 'sum_of_bank':sum_of_bank, + } \ No newline at end of file diff --git a/Base/Metrics/DashboardAdmin/__pycache__/get_total_bank.cpython-312.pyc b/Base/Metrics/DashboardAdmin/__pycache__/get_total_bank.cpython-312.pyc new file mode 100644 index 0000000..c56721a Binary files /dev/null and b/Base/Metrics/DashboardAdmin/__pycache__/get_total_bank.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 new file mode 100644 index 0000000..c674e5e Binary files /dev/null and b/Base/Metrics/DashboardAdmin/__pycache__/get_total_prof.cpython-312.pyc differ diff --git a/Base/Metrics/DashboardAdmin/get_total_bank.py b/Base/Metrics/DashboardAdmin/get_total_bank.py new file mode 100644 index 0000000..7abc551 --- /dev/null +++ b/Base/Metrics/DashboardAdmin/get_total_bank.py @@ -0,0 +1,82 @@ +from django.db.models import Sum +from django.utils import timezone +from Base.models import ( + PayMethod, + BankAccount, +) +from Movement.models import ( + Calendar, + Product, + Expense, + Stock +) + +def metric(): + # Lista de Bancos + banks = BankAccount.objects.all() + + # pegando total de Serviços + sum_mov_serv = {} + for bank in banks: + sum_bank = Calendar.objects.filter( + # active = True, + pay_method__bank__name = bank.name, + ).aggregate(Sum('net_value'))['net_value__sum'] or 0 + sum_mov_serv[bank.name] = sum_bank + + # pegando total de Produtos + sum_mov_prod = {} + for bank in banks: + sum_bank = Product.objects.filter( + # active=True, + pay_method__bank__name=bank.name, + ).aggregate(Sum('net_value'))['net_value__sum'] or 0 + sum_mov_prod[bank.name] = sum_bank + + # pegando total de Desspesas + sum_expense = {} + for bank in banks: + sum_bank = Expense.objects.filter( + # active=True, + firm=True, + 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 = {} + for bank in banks: + sum_bank = Expense.objects.filter( + # active=True, + firm=False, + bank__name=bank.name, + ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 + sum_expense_prof[bank.name] = sum_bank + + # Valores de entrada do estoque + sum_stock = {} + for bank in banks: + sum_bank = Stock.objects.filter( + # active=True, + bank__name=bank.name, + ).aggregate(Sum('gross_value'))['gross_value__sum'] or 0 + sum_stock[bank.name] = sum_bank + + # saldo total de tudo + sum_total = {} + for bank in banks: + 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_total[bank.name] = ( + sum_mov_serv_get + + sum_mov_prod_get - + sum_expense_get - + sum_expense_prof_get - + sum_sum_stock + ) + + return sum_total \ No newline at end of file diff --git a/Base/Metrics/DashboardAdmin/get_total_prof.py b/Base/Metrics/DashboardAdmin/get_total_prof.py new file mode 100644 index 0000000..dbcca31 --- /dev/null +++ b/Base/Metrics/DashboardAdmin/get_total_prof.py @@ -0,0 +1,39 @@ +from django.db.models import Sum +from django.utils import timezone +from Base.models import Professional +from Movement.models import Calendar, Expense + +def metric(): + Professionals = Professional.objects.all() + # 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 + ).aggregate(Sum('prof_money'))['prof_money__sum'] or 0 + sum_serv_prof[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 ) + + return sum_total \ No newline at end of file diff --git a/Base/Urls/__pycache__/urlsBankAccount.cpython-312.pyc b/Base/Urls/__pycache__/urlsBankAccount.cpython-312.pyc new file mode 100644 index 0000000..eff9493 Binary files /dev/null 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 new file mode 100644 index 0000000..694eacb Binary files /dev/null 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 new file mode 100644 index 0000000..39f576e Binary files /dev/null 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 new file mode 100644 index 0000000..078cbcd Binary files /dev/null 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 new file mode 100644 index 0000000..987d628 Binary files /dev/null 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 new file mode 100644 index 0000000..4075184 Binary files /dev/null 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 new file mode 100644 index 0000000..1f19528 Binary files /dev/null and b/Base/Urls/__pycache__/urlsServiceList.cpython-312.pyc differ diff --git a/Base/Urls/urlsBankAccount.py b/Base/Urls/urlsBankAccount.py new file mode 100644 index 0000000..2f397fa --- /dev/null +++ b/Base/Urls/urlsBankAccount.py @@ -0,0 +1,15 @@ +from django.urls import path +# from django.contrib.auth import views as auth_views +from Base.Views import ( + viewsBankAccounts , +) + + +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'), +] \ No newline at end of file diff --git a/Base/urls.py b/Base/Urls/urlsBase.py similarity index 50% rename from Base/urls.py rename to Base/Urls/urlsBase.py index e43ef49..1a5433f 100644 --- a/Base/urls.py +++ b/Base/Urls/urlsBase.py @@ -1,14 +1,15 @@ from django.urls import path from django.contrib.auth import views as auth_views -from Base.views import ( +from Base.Views import ( views, ) - urlpatterns = [ # base das URLs path('', views.Home, name='Home'), - path('login/', auth_views.LoginView.as_view(), name='login'), - path('logout/', auth_views.LogoutView.as_view(), name='logout'), + path('login', views.Login.as_view(), name='login'), + 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'), + ] \ No newline at end of file diff --git a/Base/Urls/urlsChartOfAccount.py b/Base/Urls/urlsChartOfAccount.py new file mode 100644 index 0000000..66c9d04 --- /dev/null +++ b/Base/Urls/urlsChartOfAccount.py @@ -0,0 +1,13 @@ +from django.urls import path +from Base.Views import ( + viewsChartOfAccount , +) + +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'), +] \ No newline at end of file diff --git a/Base/Urls/urlsPaymentMethod.py b/Base/Urls/urlsPaymentMethod.py new file mode 100644 index 0000000..885a92b --- /dev/null +++ b/Base/Urls/urlsPaymentMethod.py @@ -0,0 +1,14 @@ +from django.urls import path +# from django.contrib.auth import views as auth_views +from Base.Views import ( + viewsPayMethod , +) + +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'), +] \ No newline at end of file diff --git a/Base/Urls/urlsProductList.py b/Base/Urls/urlsProductList.py new file mode 100644 index 0000000..fbc1307 --- /dev/null +++ b/Base/Urls/urlsProductList.py @@ -0,0 +1,14 @@ +from django.urls import path +# from django.contrib.auth import views as auth_views +from Base.Views import ( + viewsProductList , +) + +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'), +] \ No newline at end of file diff --git a/Base/Urls/urlsProfessional.py b/Base/Urls/urlsProfessional.py new file mode 100644 index 0000000..e118cf1 --- /dev/null +++ b/Base/Urls/urlsProfessional.py @@ -0,0 +1,14 @@ +from django.urls import path +# from django.contrib.auth import views as auth_views +from Base.Views import ( + viewsProfessional , +) + +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'), +] \ No newline at end of file diff --git a/Base/Urls/urlsServiceList.py b/Base/Urls/urlsServiceList.py new file mode 100644 index 0000000..8c5606b --- /dev/null +++ b/Base/Urls/urlsServiceList.py @@ -0,0 +1,14 @@ +from django.urls import path +# from django.contrib.auth import views as auth_views +from Base.Views import ( + viewsServiceList , +) + +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'), +] \ No newline at end of file diff --git a/Base/Views/__pycache__/viewsBankAccounts.cpython-312.pyc b/Base/Views/__pycache__/viewsBankAccounts.cpython-312.pyc new file mode 100644 index 0000000..743438d Binary files /dev/null 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 new file mode 100644 index 0000000..dd25d71 Binary files /dev/null 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 new file mode 100644 index 0000000..7b9743b Binary files /dev/null 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 new file mode 100644 index 0000000..0e1f48e Binary files /dev/null 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 new file mode 100644 index 0000000..b26d31f Binary files /dev/null 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 new file mode 100644 index 0000000..9ac5aef Binary files /dev/null and b/Base/Views/__pycache__/viewsServiceList.cpython-312.pyc differ diff --git a/Base/Views/views.py b/Base/Views/views.py new file mode 100644 index 0000000..3091ba4 --- /dev/null +++ b/Base/Views/views.py @@ -0,0 +1,42 @@ +from django.shortcuts import render +from django.views.generic import TemplateView +from django.contrib.auth.mixins import LoginRequiredMixin #, PermissionRequiredMixin +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 +) +from Base.Metrics.DashboardAdmin import get_total_bank,get_total_prof + +def Home(request): + context = { 'ok':' Tudo ok', } + return render(request,'Home.html',context ) + +class Login(auth_views.LoginView): + template_name = 'Login/Login.html' + +class Dashboard(LoginRequiredMixin, TemplateView): + template_name = 'Login/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) + context['Sum_of_product'] = get_sum_of_product.metric(Day) + return context + +class DashboardAdmin(LoginRequiredMixin, TemplateView): + template_name = 'Login/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() + return context \ No newline at end of file diff --git a/Base/Views/viewsBankAccounts.py b/Base/Views/viewsBankAccounts.py new file mode 100644 index 0000000..db506bd --- /dev/null +++ b/Base/Views/viewsBankAccounts.py @@ -0,0 +1,57 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin +from Base.Forms import FormsBankAccounts +from Base import models +from django.urls import reverse_lazy +from django.contrib import messages + +class BankAccountsListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.BankAccount + template_name = 'BankAccounts/List.html' + context_object_name = 'BankAccounts' + paginate_by = 10 + permission_required = 'Base.view_bankaccount' + def get_queryset(self): + queryset = super().get_queryset() + name = self.request.GET.get('name') + if name: + queryset = queryset.filter(name__icontains=name) + return queryset + +class BankAccountsCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): + model = models.BankAccount + template_name = 'BankAccounts/Create.html' + form_class = FormsBankAccounts.FormsBankAccount + success_url = reverse_lazy('BankAccountsListView') + permission_required = 'Base.add_bankaccount' + + def get_form(self, form_class=None): + form = super().get_form(form_class) + return form + + def form_valid(self, form): + 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 BankAccountsDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): + model = models.BankAccount + template_name = 'BankAccounts/Detail.html' + permission_required = 'Base.view_bankaccount' + +class BankAccountsUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView): + model = models.BankAccount + template_name = 'BankAccounts/Update.html' + form_class = FormsBankAccounts.FormsBankAccount + success_url = reverse_lazy('BankAccountsListView') + permission_required = 'Base.change_bankaccount' + +class BankAccountsDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView): + model = models.BankAccount + template_name = 'BankAccounts/Delete.html' + success_url = reverse_lazy('BankAccountsListView') + permission_required = 'Base.delete_bankaccount' \ No newline at end of file diff --git a/Base/Views/viewsChartOfAccount.py b/Base/Views/viewsChartOfAccount.py new file mode 100644 index 0000000..2f0e51c --- /dev/null +++ b/Base/Views/viewsChartOfAccount.py @@ -0,0 +1,43 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin +from Base.Forms import FormsChartOfAccount +from Base import models +from django.urls import reverse_lazy + +class ChartOfAccountListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.ChartOfAccount + template_name = 'ChartOfAccount/List.html' + context_object_name = 'ChartOfAccount' + paginate_by = 10 + permission_required = 'Base.view_' + def get_queryset(self): + queryset = super().get_queryset() + name = self.request.GET.get('name') + if name: + queryset = queryset.filter(name__icontains=name) + return queryset + +class ChartOfAccountCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): + model = models.ChartOfAccount + template_name = 'ChartOfAccount/Create.html' + form_class = FormsChartOfAccount.FormsChartOfAccount + success_url = reverse_lazy('ChartOfAccountListView') + permission_required = 'Base.add_' + +class ChartOfAccountDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): + model = models.ChartOfAccount + template_name = 'ChartOfAccount/Detail.html' + permission_required = 'Base.view_' + +class ChartOfAccountUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView): + model = models.ChartOfAccount + template_name = 'ChartOfAccount/Update.html' + form_class = FormsChartOfAccount.FormsChartOfAccount + success_url = reverse_lazy('ChartOfAccountListView') + permission_required = 'Base.change_' + +class ChartOfAccountDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView): + model = models.ChartOfAccount + template_name = 'ChartOfAccount/Delete.html' + success_url = reverse_lazy('ChartOfAccountListView') + permission_required = 'Base.delete_' \ No newline at end of file diff --git a/Base/Views/viewsPayMethod.py b/Base/Views/viewsPayMethod.py new file mode 100644 index 0000000..79956ad --- /dev/null +++ b/Base/Views/viewsPayMethod.py @@ -0,0 +1,43 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin +from Base.Forms import FormsPayMethod +from Base import models +from django.urls import reverse_lazy + +class PayMethodListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.PayMethod + template_name = 'PayMethod/List.html' + context_object_name = 'PayMethod' + paginate_by = 10 + permission_required = 'Base.view_' + def get_queryset(self): + queryset = super().get_queryset() + name = self.request.GET.get('name') + if name: + queryset = queryset.filter(name__icontains=name) + return queryset + +class PayMethodCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): + model = models.PayMethod + template_name = 'PayMethod/Create.html' + form_class = FormsPayMethod.FormsPayMethod + success_url = reverse_lazy('PayMethodListView') + permission_required = 'Base.add_' + +class PayMethodDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): + model = models.PayMethod + template_name = 'PayMethod/Detail.html' + permission_required = 'Base.view_' + +class PayMethodUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView): + model = models.PayMethod + template_name = 'PayMethod/Update.html' + form_class = FormsPayMethod.FormsPayMethod + success_url = reverse_lazy('PayMethodListView') + permission_required = 'Base.change_' + +class PayMethodDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView): + model = models.PayMethod + template_name = 'PayMethod/Delete.html' + success_url = reverse_lazy('PayMethodListView') + permission_required = 'Base.delete_' \ No newline at end of file diff --git a/Base/Views/viewsProductList.py b/Base/Views/viewsProductList.py new file mode 100644 index 0000000..e107676 --- /dev/null +++ b/Base/Views/viewsProductList.py @@ -0,0 +1,43 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin +from Base.Forms import FormsProductList +from Base import models +from django.urls import reverse_lazy + +class ProductListListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.ProductList + template_name = 'ProductList/List.html' + context_object_name = 'ProductList' + paginate_by = 10 + permission_required = 'Base.view_' + def get_queryset(self): + queryset = super().get_queryset() + name = self.request.GET.get('name') + if name: + queryset = queryset.filter(name__icontains=name) + return queryset + +class ProductListCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): + model = models.ProductList + template_name = 'ProductList/Create.html' + form_class = FormsProductList.FormsProductList + success_url = reverse_lazy('ProductListListView') + permission_required = 'Base.add_' + +class ProductListDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): + model = models.ProductList + template_name = 'ProductList/Detail.html' + permission_required = 'Base.view_' + +class ProductListUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView): + model = models.ProductList + template_name = 'ProductList/Update.html' + form_class = FormsProductList.FormsProductList + success_url = reverse_lazy('ProductListListView') + permission_required = 'Base.change_' + +class ProductListDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView): + model = models.ProductList + template_name = 'ProductList/Delete.html' + success_url = reverse_lazy('ProductListListView') + permission_required = 'Base.delete_' \ No newline at end of file diff --git a/Base/Views/viewsProfessional.py b/Base/Views/viewsProfessional.py new file mode 100644 index 0000000..15a4e44 --- /dev/null +++ b/Base/Views/viewsProfessional.py @@ -0,0 +1,43 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin , PermissionRequiredMixin +from Base.Forms import FormsProfessional +from Base import models +from django.urls import reverse_lazy + +class ProfessionalListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.Professional + template_name = 'Professional/List.html' + context_object_name = 'Professionals' + paginate_by = 10 + permission_required = 'Base.view_professional' + def get_queryset(self): + queryset = super().get_queryset() + name = self.request.GET.get('name') + if name: + queryset = queryset.filter(name__icontains=name) + return queryset + +class ProfessionalCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): + model = models.Professional + template_name = 'Professional/Create.html' + form_class = FormsProfessional.FormsProfessional + success_url = reverse_lazy('ProfessionalListView') + permission_required = 'Base.add_professional' + +class ProfessionalDetailView(LoginRequiredMixin,PermissionRequiredMixin, DetailView): + model = models.Professional + template_name = 'Professional/Detail.html' + permission_required = 'Base.view_professional' + +class ProfessionalUpdateView(LoginRequiredMixin,PermissionRequiredMixin, UpdateView): + model = models.Professional + template_name = 'Professional/Update.html' + form_class = FormsProfessional.FormsProfessional + success_url = reverse_lazy('ProfessionalListView') + permission_required = 'Base.change_professional' + +class ProfessionalDeleteView(LoginRequiredMixin,PermissionRequiredMixin, DeleteView): + model = models.Professional + template_name = 'Professional/Delete.html' + success_url = reverse_lazy('ProfessionalListView') + permission_required = 'Base.delete_professional' \ No newline at end of file diff --git a/Base/Views/viewsServiceList.py b/Base/Views/viewsServiceList.py new file mode 100644 index 0000000..5a39dfe --- /dev/null +++ b/Base/Views/viewsServiceList.py @@ -0,0 +1,43 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin +from Base.Forms import FormsServiceList +from Base import models +from django.urls import reverse_lazy + +class ServiceListListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.ServiceList + template_name = 'ServiceList/List.html' + context_object_name = 'ServiceList' + paginate_by = 10 + permission_required = 'Base.view_' + def get_queryset(self): + queryset = super().get_queryset() + name = self.request.GET.get('name') + if name: + queryset = queryset.filter(name__icontains=name) + return queryset + +class ServiceListCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): + model = models.ServiceList + template_name = 'ServiceList/Create.html' + form_class = FormsServiceList.FormsServiceList + success_url = reverse_lazy('ServiceListListView') + permission_required = 'Base.add_' + +class ServiceListDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): + model = models.ServiceList + template_name = 'ServiceList/Detail.html' + permission_required = 'Base.view_' + +class ServiceListUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView): + model = models.ServiceList + template_name = 'ServiceList/Update.html' + form_class = FormsServiceList.FormsServiceList + success_url = reverse_lazy('ServiceListListView') + permission_required = 'Base.change_' + +class ServiceListDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView): + model = models.ServiceList + template_name = 'ServiceList/Delete.html' + success_url = reverse_lazy('ServiceListListView') + permission_required = 'Base.delete_' \ No newline at end of file diff --git a/Base/__pycache__/__init__.cpython-312.pyc b/Base/__pycache__/__init__.cpython-312.pyc index 16f5411..bfac4a0 100644 Binary files a/Base/__pycache__/__init__.cpython-312.pyc and b/Base/__pycache__/__init__.cpython-312.pyc differ diff --git a/Base/__pycache__/__init__.cpython-313.pyc b/Base/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 702fb60..0000000 Binary files a/Base/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/Base/__pycache__/admin.cpython-312.pyc b/Base/__pycache__/admin.cpython-312.pyc index bb4ed3c..4df1fd8 100644 Binary files a/Base/__pycache__/admin.cpython-312.pyc and b/Base/__pycache__/admin.cpython-312.pyc differ diff --git a/Base/__pycache__/admin.cpython-313.pyc b/Base/__pycache__/admin.cpython-313.pyc deleted file mode 100644 index 155047e..0000000 Binary files a/Base/__pycache__/admin.cpython-313.pyc and /dev/null differ diff --git a/Base/__pycache__/apps.cpython-312.pyc b/Base/__pycache__/apps.cpython-312.pyc index 67b8ec2..c898f80 100644 Binary files a/Base/__pycache__/apps.cpython-312.pyc and b/Base/__pycache__/apps.cpython-312.pyc differ diff --git a/Base/__pycache__/apps.cpython-313.pyc b/Base/__pycache__/apps.cpython-313.pyc deleted file mode 100644 index 5669343..0000000 Binary files a/Base/__pycache__/apps.cpython-313.pyc and /dev/null differ diff --git a/Base/__pycache__/models.cpython-312.pyc b/Base/__pycache__/models.cpython-312.pyc index 513c703..569f4c5 100644 Binary files a/Base/__pycache__/models.cpython-312.pyc and b/Base/__pycache__/models.cpython-312.pyc differ diff --git a/Base/__pycache__/models.cpython-313.pyc b/Base/__pycache__/models.cpython-313.pyc deleted file mode 100644 index b9bbded..0000000 Binary files a/Base/__pycache__/models.cpython-313.pyc and /dev/null differ diff --git a/Base/__pycache__/urls.cpython-312.pyc b/Base/__pycache__/urls.cpython-312.pyc deleted file mode 100644 index fc156ad..0000000 Binary files a/Base/__pycache__/urls.cpython-312.pyc and /dev/null differ diff --git a/Base/__pycache__/urls.cpython-313.pyc b/Base/__pycache__/urls.cpython-313.pyc deleted file mode 100644 index 56bb7c2..0000000 Binary files a/Base/__pycache__/urls.cpython-313.pyc and /dev/null differ diff --git a/Base/__pycache__/views.cpython-312.pyc b/Base/__pycache__/views.cpython-312.pyc deleted file mode 100644 index 2801d29..0000000 Binary files a/Base/__pycache__/views.cpython-312.pyc and /dev/null differ diff --git a/Base/migrations/0001_initial.py b/Base/migrations/0001_initial.py new file mode 100644 index 0000000..677b445 --- /dev/null +++ b/Base/migrations/0001_initial.py @@ -0,0 +1,91 @@ +# Generated by Django 5.2.7 on 2025-11-01 11:15 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='BankAccount', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=50)), + ('description', models.TextField(blank=True, null=True)), + ], + options={ + 'ordering': ['name'], + }, + ), + migrations.CreateModel( + name='ChartOfAccount', + fields=[ + ('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)), + ('firm', models.BooleanField(default=True)), + ('notes', models.TextField(blank=True, null=True)), + ], + options={ + 'ordering': ['name'], + }, + ), + migrations.CreateModel( + name='ProductList', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=50)), + ('value', models.DecimalField(decimal_places=2, max_digits=6)), + ('description', models.TextField(blank=True, null=True)), + ], + options={ + 'ordering': ['name'], + }, + ), + migrations.CreateModel( + name='ServiceList', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=50)), + ('value', models.DecimalField(decimal_places=2, max_digits=6)), + ('description', models.TextField(blank=True, null=True)), + ], + options={ + 'ordering': ['name'], + }, + ), + migrations.CreateModel( + name='PayMethod', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ('percentage', models.DecimalField(decimal_places=0, max_digits=3)), + ('description', models.TextField(blank=True, null=True)), + ('bank', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='PaymentMethodBank', to='Base.bankaccount')), + ], + options={ + 'ordering': ['bank', 'name'], + }, + ), + migrations.CreateModel( + name='Professional', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100, unique=True)), + ('percentage', models.DecimalField(decimal_places=0, max_digits=3)), + ('symbol', models.CharField(max_length=2, unique=True)), + ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ProfessionalUser', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['name'], + }, + ), + ] diff --git a/Base/migrations/__pycache__/0001_initial.cpython-312.pyc b/Base/migrations/__pycache__/0001_initial.cpython-312.pyc new file mode 100644 index 0000000..d3a6e63 Binary files /dev/null and b/Base/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/Base/migrations/__pycache__/__init__.cpython-312.pyc b/Base/migrations/__pycache__/__init__.cpython-312.pyc index fcf7171..628813f 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/migrations/__pycache__/__init__.cpython-313.pyc b/Base/migrations/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 29f2c5a..0000000 Binary files a/Base/migrations/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/Base/models.py b/Base/models.py index 71a8362..054b8ce 100644 --- a/Base/models.py +++ b/Base/models.py @@ -1,3 +1,84 @@ from django.db import models +from django.contrib.auth.models import User +from django.utils import timezone -# Create your models here. +#Base de varias tabelas +class Base(models.Model): + active = models.BooleanField(default=False) + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + created_by = models.ForeignKey(User, related_name='%(class)s_created', on_delete=models.SET_NULL, null=True) + updated_by = models.ForeignKey(User, related_name='%(class)s_updated', on_delete=models.SET_NULL, null=True) + class Meta: + abstract = True + +# Lista de Profissinal +class Professional(models.Model): + name = models.CharField(max_length=100, unique=True ) + percentage = models.DecimalField(max_digits=3, decimal_places=0) + symbol = models.CharField(max_length=2, unique=True) + user= models.ForeignKey( + User, + related_name='ProfessionalUser', + on_delete=models.SET_NULL, + null=True, blank=True + ) + class Meta: + ordering = ['name'] + def __str__(self): + return f'{ self.name } { self.symbol }' + +# Lista de Bancos +class BankAccount(models.Model): + name = models.CharField(max_length=50) + description = models.TextField(null=True, blank=True) + class Meta: + ordering = ['name'] + def __str__(self): + return self.name + +# Lista de serviços +class ServiceList(models.Model): + name = models.CharField(max_length=50) + value = models.DecimalField(max_digits=6, decimal_places=2) + description = models.TextField(null=True, blank=True) + class Meta: + ordering = ['name'] + def __str__(self): + return self.name + +# Lista de Produtos +class ProductList(models.Model): + name = models.CharField(max_length=50) + value = models.DecimalField(max_digits=6, decimal_places=2) + description = models.TextField(null=True, blank=True) + class Meta: + ordering = ['name'] + def __str__(self): + return f'{ self.name } - { self.value }' + +# Lista de Contas +class ChartOfAccount(models.Model): + name = models.CharField(max_length=100) + debit = models.BooleanField(default=True) + firm = models.BooleanField(default=True) + notes = models.TextField(null=True, blank=True) + class Meta: + ordering = ['name'] + def __str__(self): + return self.name + +# metodos de pagamentos +class PayMethod(models.Model): + name = models.CharField(max_length=100) + bank = models.ForeignKey( + BankAccount, + on_delete=models.PROTECT, + related_name='PaymentMethodBank', + ) + percentage = models.DecimalField(max_digits=3, decimal_places=0) + description = models.TextField(null=True, blank=True) + class Meta: + ordering = ['bank','name',] + def __str__(self): + return f'{ self.bank } - { self.name }' \ No newline at end of file diff --git a/Base/templates/BankAccounts/Create.html b/Base/templates/BankAccounts/Create.html new file mode 100644 index 0000000..74871fa --- /dev/null +++ b/Base/templates/BankAccounts/Create.html @@ -0,0 +1,19 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} + +
+

Cadastrar Banco

+
+
+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Cancelar e Voltar +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Base/templates/BankAccounts/Delete.html b/Base/templates/BankAccounts/Delete.html new file mode 100644 index 0000000..440c2d4 --- /dev/null +++ b/Base/templates/BankAccounts/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Deletar da Marcar

+
+
+

Tem certeza que quer deletar ?

+ {{ object.name }} +
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Base/templates/BankAccounts/Detail.html b/Base/templates/BankAccounts/Detail.html new file mode 100644 index 0000000..d603d0b --- /dev/null +++ b/Base/templates/BankAccounts/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/Base/templates/BankAccounts/List.html b/Base/templates/BankAccounts/List.html new file mode 100644 index 0000000..f3e2da6 --- /dev/null +++ b/Base/templates/BankAccounts/List.html @@ -0,0 +1,62 @@ +{% extends "BaseLogin.html" %} +{% block title %} List {% endblock %} +{% block content %} +

Bancos


+
+
+
+
+ + +
+
+
+{# {% if perms.brands.add_brands %}#} + +{# {% endif %}#} +
+ +
+ + + +{# #} + + + + + + + {% for Bank in BankAccounts %} + +{# #} + + + + + {% endfor %} + +
ID Nome Descrição Ações
{{ Bank.id }} {{ Bank.name }} {{ Bank.description }} + + + +{# {% if perms.brands.change_brands %}#} + + + +{# {% endif %}#} +{# {% if perms.brands.delete_brands %}#} + + + +{# {% endif %}#} +
+
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Base/templates/BankAccounts/Update.html b/Base/templates/BankAccounts/Update.html new file mode 100644 index 0000000..f60a1ac --- /dev/null +++ b/Base/templates/BankAccounts/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/Base/templates/ChartOfAccount/Create.html b/Base/templates/ChartOfAccount/Create.html new file mode 100644 index 0000000..bb12196 --- /dev/null +++ b/Base/templates/ChartOfAccount/Create.html @@ -0,0 +1,19 @@ +{% extends "BaseLogin.html" %} +{% block title %} Cadastro {% endblock %} +{% block content %} + +
+

Cadastrar

+
+
+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Cancelar e Voltar +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Base/templates/ChartOfAccount/Delete.html b/Base/templates/ChartOfAccount/Delete.html new file mode 100644 index 0000000..a51ba6d --- /dev/null +++ b/Base/templates/ChartOfAccount/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Deletar da Marcar

+
+
+

Tem certeza que quer deletar ?

+ {{ object.name }} +
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Base/templates/ChartOfAccount/Detail.html b/Base/templates/ChartOfAccount/Detail.html new file mode 100644 index 0000000..b76b1b6 --- /dev/null +++ b/Base/templates/ChartOfAccount/Detail.html @@ -0,0 +1,16 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Detalhes

+
+
+

{{ object.name }}

+

{{ object.value }}

+

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

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

Plano de Contas


+
+
+
+
+ + +
+
+
+{# {% if perms.brands.add_brands %}#} + +{# {% endif %}#} +
+ +
+ + + +{# #} + + + + + + + + + {% for Chart in ChartOfAccount %} + +{# #} + + + + + + + {% endfor %} + +
ID Nome Notas Debito Firma Ações
{{ Chart.id }} {{ Chart.name }} {{ Chart.notes }} {% if Chart.debit %} + {% else %} {% endif %} {% if Chart.firm %} + {% else %} {% endif %} + + + +{# {% if perms.brands.change_brands %}#} + + + +{# {% endif %}#} +{# {% if perms.brands.delete_brands %}#} + + + +{# {% endif %}#} +
+
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Base/templates/ChartOfAccount/Update.html b/Base/templates/ChartOfAccount/Update.html new file mode 100644 index 0000000..f60a1ac --- /dev/null +++ b/Base/templates/ChartOfAccount/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/Base/templates/Login/Dashboard.html b/Base/templates/Login/Dashboard.html deleted file mode 100644 index 12cf799..0000000 --- a/Base/templates/Login/Dashboard.html +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "BaseLogin.html" %} -{% block title %} Dashboard {% endblock %} -{% block content %} - -
-
-

{{ Day }}

-
-
-
-{% endblock %} diff --git a/Base/templates/Login/Dashboard/Professional.html b/Base/templates/Login/Dashboard/Professional.html new file mode 100644 index 0000000..5dfeb9d --- /dev/null +++ b/Base/templates/Login/Dashboard/Professional.html @@ -0,0 +1,24 @@ +

Professional

+
+ + + + + + + + + {% for Prof, sum in Professional.professional.items %} + {% if sum != 0 %} + + + + + {% endif %} + {% empty %} {% endfor %} + +
BancoTotal
{{ Prof }}R$ {{ sum|floatformat:2 }}
Vazio.
+

Total : R$: {{ Professional.sum_all_prof|floatformat:2 }}

+
+ +
diff --git a/Base/templates/Login/Dashboard/Service.html b/Base/templates/Login/Dashboard/Service.html new file mode 100644 index 0000000..80588f3 --- /dev/null +++ b/Base/templates/Login/Dashboard/Service.html @@ -0,0 +1,24 @@ +

Serviço

+
+ + + + + + + + + {% for Prod, sum in Service.Service.items %} + {% if sum != 0 %} + + + + + {% endif %} + {% empty %} {% endfor %} + +
ProdutosTotal
{{ Prod }}R$ {{ sum|floatformat:2 }}
Vazio.
+

Total R$: {{ Service.sum|floatformat:2 }}

+
+ +
\ No newline at end of file diff --git a/Base/templates/Login/Dashboard/Stone.html b/Base/templates/Login/Dashboard/Stone.html new file mode 100644 index 0000000..c867012 --- /dev/null +++ b/Base/templates/Login/Dashboard/Stone.html @@ -0,0 +1,23 @@ +

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 new file mode 100644 index 0000000..8cf8654 --- /dev/null +++ b/Base/templates/Login/Dashboard/Sum_of_product.html @@ -0,0 +1,22 @@ +

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 new file mode 100644 index 0000000..f9a1d5a --- /dev/null +++ b/Base/templates/Login/Dashboard/Sum_of_professional_detail.html @@ -0,0 +1,27 @@ +

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 new file mode 100644 index 0000000..afd3322 --- /dev/null +++ b/Base/templates/Login/Dashboard/Sum_payment_method_service.html @@ -0,0 +1,20 @@ +

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 new file mode 100644 index 0000000..a4429cf --- /dev/null +++ b/Base/templates/Login/Dashboard/index.html @@ -0,0 +1,28 @@ +{% 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 new file mode 100644 index 0000000..8505e14 --- /dev/null +++ b/Base/templates/Login/DashboardAdmin/index.html @@ -0,0 +1,25 @@ +{% 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/templates/Login/DashboardAdmin/total_banck.html b/Base/templates/Login/DashboardAdmin/total_banck.html new file mode 100644 index 0000000..dea01ab --- /dev/null +++ b/Base/templates/Login/DashboardAdmin/total_banck.html @@ -0,0 +1,21 @@ +

Bancos

+ + + + + + + + + {% for name, value in total_bank.items %} + + + + + {% empty %} + + + + {% endfor %} + +
BancoTotal
{{ name }}R$ {{ value|floatformat:2 }}
Vazio.
\ No newline at end of file diff --git a/Base/templates/Login/DashboardAdmin/total_prof_month.html b/Base/templates/Login/DashboardAdmin/total_prof_month.html new file mode 100644 index 0000000..9e0eeb9 --- /dev/null +++ b/Base/templates/Login/DashboardAdmin/total_prof_month.html @@ -0,0 +1,21 @@ +

Prof.

+ + + + + + + + + {% for name, value in total_prof.items %} + + + + + {% empty %} + + + + {% endfor %} + +
Prof.Total
{{ name }}R$ {{ value|floatformat:2 }}
Vazio.
\ No newline at end of file diff --git a/Templates/registration/login.html b/Base/templates/Login/Login.html similarity index 95% rename from Templates/registration/login.html rename to Base/templates/Login/Login.html index 339d5b0..f7cde6c 100644 --- a/Templates/registration/login.html +++ b/Base/templates/Login/Login.html @@ -11,7 +11,7 @@
{% csrf_token %}
- +
diff --git a/Base/templates/PayMethod/Create.html b/Base/templates/PayMethod/Create.html new file mode 100644 index 0000000..bb12196 --- /dev/null +++ b/Base/templates/PayMethod/Create.html @@ -0,0 +1,19 @@ +{% extends "BaseLogin.html" %} +{% block title %} Cadastro {% endblock %} +{% block content %} + +
+

Cadastrar

+
+
+ + {% csrf_token %} + {{ form.as_p }} + + + Cancelar e Voltar +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Base/templates/PayMethod/Delete.html b/Base/templates/PayMethod/Delete.html new file mode 100644 index 0000000..a51ba6d --- /dev/null +++ b/Base/templates/PayMethod/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Deletar da Marcar

+
+
+

Tem certeza que quer deletar ?

+ {{ object.name }} +
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Base/templates/PayMethod/Detail.html b/Base/templates/PayMethod/Detail.html new file mode 100644 index 0000000..b76b1b6 --- /dev/null +++ b/Base/templates/PayMethod/Detail.html @@ -0,0 +1,16 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Detalhes

+
+
+

{{ object.name }}

+

{{ object.value }}

+

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

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

Serviços


+
+
+
+
+ + +
+
+
+{# {% if perms.brands.add_brands %}#} + +{# {% endif %}#} +
+ +
+ + + +{# #} + + + + + + + + + {% for Payment in PayMethod %} + +{# #} + + + + + + + {% endfor %} + +
ID Nome Banco Percentual Descrição Ações
{{ Payment.id }} {{ Payment.name }} {{ Payment.bank }} {{ Payment.percentage }} {{ Payment.description }} + + + +{# {% if perms.brands.change_brands %}#} + + + +{# {% endif %}#} +{# {% if perms.brands.delete_brands %}#} + + + +{# {% endif %}#} +
+
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Base/templates/PayMethod/Update.html b/Base/templates/PayMethod/Update.html new file mode 100644 index 0000000..f60a1ac --- /dev/null +++ b/Base/templates/PayMethod/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/Base/templates/ProductList/Create.html b/Base/templates/ProductList/Create.html new file mode 100644 index 0000000..b9f0fe0 --- /dev/null +++ b/Base/templates/ProductList/Create.html @@ -0,0 +1,19 @@ +{% extends "BaseLogin.html" %} +{% block title %} Cadastro {% endblock %} +{% block content %} + +
+

Cadastrar

+
+
+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Cancelar e Voltar +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Base/templates/ProductList/Delete.html b/Base/templates/ProductList/Delete.html new file mode 100644 index 0000000..3852938 --- /dev/null +++ b/Base/templates/ProductList/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Deletar {% endblock %} +{% block content %} +
+

Deletar

+
+
+

Tem certeza que quer deletar ?

+ {{ object.name }} +
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Base/templates/ProductList/Detail.html b/Base/templates/ProductList/Detail.html new file mode 100644 index 0000000..d211d07 --- /dev/null +++ b/Base/templates/ProductList/Detail.html @@ -0,0 +1,16 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Detalhes

+
+
+

{{ object.name }}

+

{{ object.value }}

+

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

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

Produtos


+
+
+
+
+ + +
+
+
+{# {% if perms.brands.add_brands %}#} + +{# {% endif %}#} +
+ +
+ + + +{# #} + + + + + + + + {% for Serv in ProductList %} + +{# #} + + + + + + {% endfor %} + +
ID Nome Valor Descrição Ações
{{ Serv.id }} {{ Serv.name }} {{ Serv.value }} {{ Serv.description }} + + + +{# {% if perms.brands.change_brands %}#} + + + +{# {% endif %}#} +{# {% if perms.brands.delete_brands %}#} + + + +{# {% endif %}#} +
+
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Base/templates/ProductList/Update.html b/Base/templates/ProductList/Update.html new file mode 100644 index 0000000..6bdda5a --- /dev/null +++ b/Base/templates/ProductList/Update.html @@ -0,0 +1,17 @@ +{% extends "BaseLogin.html" %} +{% block title %} Editar {% endblock %} +{% block content %} +
+

Editar

+
+
+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Cancelar e Voltar +
+
+
+{% endblock %} \ No newline at end of file diff --git a/Base/templates/Professional/Create.html b/Base/templates/Professional/Create.html new file mode 100644 index 0000000..5ced28a --- /dev/null +++ b/Base/templates/Professional/Create.html @@ -0,0 +1,19 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} + +
+

Cadastrar Banco

+
+
+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Cancelar e Voltar +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Base/templates/Professional/Delete.html b/Base/templates/Professional/Delete.html new file mode 100644 index 0000000..83943d8 --- /dev/null +++ b/Base/templates/Professional/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Deletar da Marcar

+
+
+

Tem certeza que quer deletar ?

+ {{ object.name }} +
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Base/templates/Professional/Detail.html b/Base/templates/Professional/Detail.html new file mode 100644 index 0000000..6b4aa78 --- /dev/null +++ b/Base/templates/Professional/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/Base/templates/Professional/List.html b/Base/templates/Professional/List.html new file mode 100644 index 0000000..a56bb86 --- /dev/null +++ b/Base/templates/Professional/List.html @@ -0,0 +1,62 @@ +{% extends "BaseLogin.html" %} +{% block title %} List {% endblock %} +{% block content %} +

Profissinais


+
+
+
+
+ + +
+
+
+{# {% if perms.brands.add_brands %}#} + +{# {% endif %}#} +
+ +
+ + + + + + + + + + + {% for Prof in Professionals %} + + + + + + + {% endfor %} + +
Simbolo Nome Porcentagem Ações
{{ Prof.symbol }} {{ Prof.name }} {{ Prof.percentage }} % + + + +{# {% if perms.brands.change_brands %}#} + + + +{# {% endif %}#} +{# {% if perms.brands.delete_brands %}#} + + + +{# {% endif %}#} +
+
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Base/templates/Professional/Update.html b/Base/templates/Professional/Update.html new file mode 100644 index 0000000..e14cab8 --- /dev/null +++ b/Base/templates/Professional/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/Base/templates/ServiceList/Create.html b/Base/templates/ServiceList/Create.html new file mode 100644 index 0000000..bb12196 --- /dev/null +++ b/Base/templates/ServiceList/Create.html @@ -0,0 +1,19 @@ +{% extends "BaseLogin.html" %} +{% block title %} Cadastro {% endblock %} +{% block content %} + +
+

Cadastrar

+
+
+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Cancelar e Voltar +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Base/templates/ServiceList/Delete.html b/Base/templates/ServiceList/Delete.html new file mode 100644 index 0000000..a51ba6d --- /dev/null +++ b/Base/templates/ServiceList/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Deletar da Marcar

+
+
+

Tem certeza que quer deletar ?

+ {{ object.name }} +
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Base/templates/ServiceList/Detail.html b/Base/templates/ServiceList/Detail.html new file mode 100644 index 0000000..b76b1b6 --- /dev/null +++ b/Base/templates/ServiceList/Detail.html @@ -0,0 +1,16 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Detalhes

+
+
+

{{ object.name }}

+

{{ object.value }}

+

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

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

Serviços


+
+
+
+
+ + +
+
+
+{# {% if perms.brands.add_brands %}#} + +{# {% endif %}#} +
+ +
+ + + +{# #} + + + + + + + + {% for Serv in ServiceList %} + +{# #} + + + + + + {% endfor %} + +
ID Nome Valor Descrição Ações
{{ Serv.id }} {{ Serv.name }} {{ Serv.value }} {{ Serv.description }} + + + +{# {% if perms.brands.change_brands %}#} + + + +{# {% endif %}#} +{# {% if perms.brands.delete_brands %}#} + + + +{# {% endif %}#} +
+
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Base/templates/ServiceList/Update.html b/Base/templates/ServiceList/Update.html new file mode 100644 index 0000000..f60a1ac --- /dev/null +++ b/Base/templates/ServiceList/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/Base/views/__pycache__/views.cpython-312.pyc b/Base/views/__pycache__/views.cpython-312.pyc index a2ff4f7..e2808d2 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/views.py b/Base/views/views.py deleted file mode 100644 index 8c4181b..0000000 --- a/Base/views/views.py +++ /dev/null @@ -1,21 +0,0 @@ -from django.shortcuts import render -from django.views.generic import TemplateView -from django.contrib.auth.mixins import LoginRequiredMixin #, PermissionRequiredMixin -from django.utils import timezone - - - -# Create your views here. - -def Home(request): - context = { 'ok':'ok', } - return render(request,'Login/Home.html',context ) - -class Dashboard(LoginRequiredMixin, TemplateView): - template_name = 'Login/Dashboard.html' - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - Day = timezone.localtime(timezone.now()) - context['User'] = self.request.user.username.capitalize() - context['Day'] = Day - return context diff --git a/Client/FormsClient.py b/Client/FormsClient.py new file mode 100644 index 0000000..4b093da --- /dev/null +++ b/Client/FormsClient.py @@ -0,0 +1,42 @@ +from django import forms +from Client import models + +class FormsClient(forms.ModelForm): + class Meta: + model = models.Client + fields = [ + 'first_name', + 'last_name', + 'phone', + 'professional', + 'double_workload', + # 'feed_back', + # 'msg_3_months', + # 'msg_6_months', + # 'msg_12_months', + 'notes', + ] + widgets = { + 'first_name': forms.TextInput({'class':'form-control'}), + 'last_name': forms.TextInput({'class':'form-control'}), + 'notes': forms.Textarea({'class':'form-control','rows':3 , }), + 'phone': forms.NumberInput(attrs={'step': 1, }), + 'professional': forms.Select({'class':'form-control'}), + 'double_workload': forms.CheckboxInput({'class':''}), + # 'msg_3_months': forms.CheckboxInput({'class':''}), + # 'msg_6_months': forms.CheckboxInput({'class':''}), + # 'msg_12_months': forms.CheckboxInput({'class':''}), + # 'feed_back': forms.CheckboxInput({'class':''}), + } + labels={ + 'first_name':'Nome', + 'last_name':'Sobrenome', + 'phone':'Telefone', + 'professional':'Profissinal', + 'double_workload':'Tempo Duplo', + 'notes':'Notas', + # 'feed_back':'FeedBack', + # 'msg_3_months':'FeedBack', + # 'msg_6_months':'FeedBack', + # 'msg_12_months':'FeedBack', + } \ No newline at end of file diff --git a/Client/__init__.py b/Client/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Client/admin.py b/Client/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/Client/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/Client/apps.py b/Client/apps.py new file mode 100644 index 0000000..7179f69 --- /dev/null +++ b/Client/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ClientConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'Client' diff --git a/Client/migrations/0001_initial.py b/Client/migrations/0001_initial.py new file mode 100644 index 0000000..a762acc --- /dev/null +++ b/Client/migrations/0001_initial.py @@ -0,0 +1,42 @@ +# Generated by Django 5.2.7 on 2025-11-01 11:15 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('Base', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Client', + 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)), + ('first_name', models.CharField(max_length=100)), + ('last_name', models.CharField(max_length=500)), + ('phone', models.DecimalField(decimal_places=0, max_digits=20)), + ('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(blank=True, null=True)), + ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created', to=settings.AUTH_USER_MODEL)), + ('professional', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ClientProfessional', to='Base.professional')), + ('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': ['first_name', 'last_name'], + }, + ), + ] diff --git a/Client/migrations/__init__.py b/Client/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Client/migrations/__pycache__/0001_initial.cpython-312.pyc b/Client/migrations/__pycache__/0001_initial.cpython-312.pyc new file mode 100644 index 0000000..6f602be Binary files /dev/null and b/Client/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/Client/migrations/__pycache__/__init__.cpython-312.pyc b/Client/migrations/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..a1a4d9b Binary files /dev/null and b/Client/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/Client/models.py b/Client/models.py new file mode 100644 index 0000000..4beec4f --- /dev/null +++ b/Client/models.py @@ -0,0 +1,23 @@ +from django.db import models +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) + professional = models.ForeignKey( + Professional, + on_delete=models.PROTECT, + 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) + class Meta: + ordering = ['first_name','last_name'] + def __str__(self): + return f'{self.first_name} {self.last_name} {self.professional.symbol}' diff --git a/Client/templates/Client/Create.html b/Client/templates/Client/Create.html new file mode 100644 index 0000000..b45a2e7 --- /dev/null +++ b/Client/templates/Client/Create.html @@ -0,0 +1,24 @@ +{% extends "BaseLogin.html" %} +{% block title %} List {% endblock %} +{% block content %} + +
+

Cadastrar

+
+
+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Cancelar e Voltar +
+
+
+ + + +{% endblock %} + diff --git a/Client/templates/Client/Delete.html b/Client/templates/Client/Delete.html new file mode 100644 index 0000000..ca92a4a --- /dev/null +++ b/Client/templates/Client/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Deletar da Marcar

+
+
+

Tem certeza que quer deletar ?

+

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

+
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Client/templates/Client/Detail.html b/Client/templates/Client/Detail.html new file mode 100644 index 0000000..111a70f --- /dev/null +++ b/Client/templates/Client/Detail.html @@ -0,0 +1,45 @@ +{% 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/List.html b/Client/templates/Client/List.html new file mode 100644 index 0000000..d5c1e9b --- /dev/null +++ b/Client/templates/Client/List.html @@ -0,0 +1,115 @@ +{% extends "BaseLogin.html" %} +{% block title %} List {% endblock %} +{% block content %} +

Clientes


+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+{#
#} +{#
#} +{#
#} +{# #} +{# #} +{#
#} +{#
#} +{#
#} +{# {% if perms.brands.add_brands %}#} + +{# {% endif %}#} +
+ +
+ + + + + + + + + + + + + + + + + {% for Client in Clients %} + + + + + + + + + + + + + {% endfor %} + +
Marcar Nome Sobrenome Telefone Profissinal T. D. FeedBack Notas Produto Ações
+
+ + +
+
{{ Client.first_name }} {{ Client.last_name }} {{ Client.phone }} {{ Client.professional.symbol }} {{ Client.professional }} {% 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 %}#} +
+
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Client/templates/Client/Update.html b/Client/templates/Client/Update.html new file mode 100644 index 0000000..9f4f270 --- /dev/null +++ b/Client/templates/Client/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/Client/tests.py b/Client/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/Client/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/Client/urlsClient.py b/Client/urlsClient.py new file mode 100644 index 0000000..d6814a4 --- /dev/null +++ b/Client/urlsClient.py @@ -0,0 +1,12 @@ +from django.urls import path +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'), + +] \ No newline at end of file diff --git a/Client/viewsClient.py b/Client/viewsClient.py new file mode 100644 index 0000000..1454967 --- /dev/null +++ b/Client/viewsClient.py @@ -0,0 +1,61 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin , PermissionRequiredMixin +from Client import models, FormsClient +from Movement.models import Calendar +from django.urls import reverse_lazy +# from django.core import serializers + +class ClientListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.Client + template_name = 'Client/List.html' + context_object_name = 'Clients' + # paginate_by = 5 + permission_required = 'Client.view_client' + def get_queryset(self): + queryset = super().get_queryset() + name = self.request.GET.get('name') + number = self.request.GET.get('number') + # all = self.request.GET.get('all') + if name: + queryset = queryset.filter(first_name__icontains=name) | queryset.filter(last_name__icontains=name) + elif number: + queryset = queryset.filter(phone__icontains=number) + # elif all: + # queryset = queryset.all() + else: + queryset = queryset.none() + return queryset + + +class ClientCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): + model = models.Client + template_name = 'Client/Create.html' + form_class = FormsClient.FormsClient + success_url = reverse_lazy('ClientListView') + permission_required = 'Client.add_client' + + +class ClientDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): + model = models.Client + template_name = 'Client/Detail.html' + permission_required = 'Client.view_client' + + 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 + +class ClientUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView): + model = models.Client + template_name = 'Client/Update.html' + form_class = FormsClient.FormsClient + success_url = reverse_lazy('ClientListView') + permission_required = 'Client.change_client' + +class ClientDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView): + model = models.Client + template_name = 'Client/Delete.html' + success_url = reverse_lazy('ClientListView') + permission_required = 'Client.delete_client' diff --git a/Movement/Forms/FormsCalendar.py b/Movement/Forms/FormsCalendar.py new file mode 100644 index 0000000..1e4f8ca --- /dev/null +++ b/Movement/Forms/FormsCalendar.py @@ -0,0 +1,42 @@ +from django import forms +from Movement import models +from django.utils import timezone + +class FormsCalendar(forms.ModelForm): + class Meta: + model = models.Calendar + fields = [ + 'client', + 'date', + 'time', + 'service', + 'pay_method', + 'professional', + 'first_time', + # 'gross_value', + # 'net_value', + # 'value_cash', + # 'prof_money', + ] + widgets = { + 'client': forms.Select({'class': 'form-select'}), + 'time': forms.DateInput(format=('%Y-%m-%d'), attrs={'type': 'time', 'class': '', + 'value': timezone.localtime(timezone.now()).time() + }), + 'date': forms.DateInput(format=('%Y-%m-%d'), attrs={'type': 'date', 'class':'', + 'value':timezone.localtime(timezone.now()).date() + }), + 'service': forms.Select({'class': 'form-select'}), + 'pay_method': forms.Select({'class': 'form-select'}), + 'professional': forms.Select({'class': 'form-select'}), + 'first_time': forms.CheckboxInput({'class': ''}), + } + labels={ + 'client':'Cliente', + 'date':'Data', + 'time':'Hora', + 'service':'Serviço', + 'pay_method':'Pagamento', + 'professional':'Profissional', + 'first_time':'Primeira Vez', + } \ No newline at end of file diff --git a/Movement/Forms/FormsExpense.py b/Movement/Forms/FormsExpense.py new file mode 100644 index 0000000..c14045c --- /dev/null +++ b/Movement/Forms/FormsExpense.py @@ -0,0 +1,34 @@ +from django import forms +from Movement import models +from django.utils import timezone + +class FormsExpense(forms.ModelForm): + class Meta: + model = models.Expense + fields = [ + 'date', + 'chart_of_account', + 'bank', + 'firm', + 'professional', + 'gross_value', + ] + widgets = { + 'date': forms.DateInput(format=('%Y-%m-%d'), attrs={'type': 'date', 'class': '', + 'value': timezone.localtime(timezone.now()).date() + }), + 'chart_of_account': forms.Select({'class': 'form-select'}), + 'bank': forms.Select({'class': 'form-select'}), + 'firm': forms.CheckboxInput({'class': ''}), + 'professional': forms.Select({'class': 'form-select'}), + 'gross_value': forms.NumberInput(attrs={'step': 1}), + + } + labels={ + 'date':'Data', + 'chart_of_account':'Plano de contas', + 'bank':'Banco', + 'firm':'Firma', + 'gross_value':'Valor', + 'professional':'Profissional', + } \ No newline at end of file diff --git a/Movement/Forms/FormsProduct.py b/Movement/Forms/FormsProduct.py new file mode 100644 index 0000000..9132a74 --- /dev/null +++ b/Movement/Forms/FormsProduct.py @@ -0,0 +1,39 @@ +from django import forms +from Movement import models +from django.utils import timezone + +class FormsProduct(forms.ModelForm): + class Meta: + model = models.Product + fields = [ + 'client', + 'date', + 'product', + 'quantity', + 'pay_method', + 'professional', + # 'gross_value', + # 'net_value', + + ] + widgets = { + 'client': forms.Select({'class': 'form-select'}), + 'date': forms.DateInput(format=('%Y-%m-%d'), attrs={'type': 'date', 'class':'', + 'value':timezone.localtime(timezone.now()).date() + }), + 'product': forms.Select({'class': 'form-select'}), + 'pay_method': forms.Select({'class': 'form-select'}), + 'professional': forms.Select({'class': 'form-select'}), + 'quantity': forms.NumberInput(attrs={'step': 1}, ), + # 'gross_value': forms.NumberInput(attrs={'step': 1}), + # 'net_value': forms.NumberInput(attrs={'step': 1}), + } + labels={ + 'client':'Cliente', + 'date':'Data', + 'product':'Produto', + 'pay_method':'M. Pagamento', + 'professional':'Profissional', + 'quantity':'Quantiddade', + # 'net_value':'Valor Liquido', + } \ No newline at end of file diff --git a/Movement/Forms/FormsStock.py b/Movement/Forms/FormsStock.py new file mode 100644 index 0000000..82fbc8d --- /dev/null +++ b/Movement/Forms/FormsStock.py @@ -0,0 +1,33 @@ +from django import forms +from Movement import models +from django.utils import timezone + +class FormsStock(forms.ModelForm): + class Meta: + model = models.Stock + fields = [ + 'date', + 'product', + 'quantity', + 'gross_value', + 'bank', + 'notes', + ] + widgets = { + 'date': forms.DateInput(format=('%Y-%m-%d'), attrs={'type': 'date', 'class':'', + 'value':timezone.localtime(timezone.now()).date() + }), + 'product': forms.Select({'class': 'form-select'}), + 'quantity': forms.NumberInput(attrs={'step': 1}), + 'gross_value': forms.NumberInput(attrs={'step': 1}), + 'bank': forms.Select({'class': 'form-select'}), + 'notes': forms.Textarea({'class': 'form-control', 'rows': 3, }), + } + labels={ + 'date':'Data', + 'product':'Produto', + 'quantity':'Quantidade', + 'gross_value':'Valor', + 'bank':'Banco', + 'notes':'Notas', + } \ No newline at end of file diff --git a/Movement/Forms/__pycache__/FormsCalendar.cpython-312.pyc b/Movement/Forms/__pycache__/FormsCalendar.cpython-312.pyc new file mode 100644 index 0000000..290a989 Binary files /dev/null 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 new file mode 100644 index 0000000..e6995e7 Binary files /dev/null and b/Movement/Forms/__pycache__/FormsExpense.cpython-312.pyc differ diff --git a/Movement/Forms/__pycache__/FormsProduct.cpython-312.pyc b/Movement/Forms/__pycache__/FormsProduct.cpython-312.pyc new file mode 100644 index 0000000..7956965 Binary files /dev/null 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 new file mode 100644 index 0000000..7a55a99 Binary files /dev/null and b/Movement/Forms/__pycache__/FormsStock.cpython-312.pyc differ diff --git a/Movement/Urls/__pycache__/urlsCalendar.cpython-312.pyc b/Movement/Urls/__pycache__/urlsCalendar.cpython-312.pyc new file mode 100644 index 0000000..41fb72d Binary files /dev/null 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 new file mode 100644 index 0000000..936f211 Binary files /dev/null and b/Movement/Urls/__pycache__/urlsExpense.cpython-312.pyc differ diff --git a/Movement/Urls/__pycache__/urlsProduct.cpython-312.pyc b/Movement/Urls/__pycache__/urlsProduct.cpython-312.pyc new file mode 100644 index 0000000..d861df4 Binary files /dev/null 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 new file mode 100644 index 0000000..907d927 Binary files /dev/null and b/Movement/Urls/__pycache__/urlsStock.cpython-312.pyc differ diff --git a/Movement/Urls/urlsCalendar.py b/Movement/Urls/urlsCalendar.py new file mode 100644 index 0000000..f8bf26f --- /dev/null +++ b/Movement/Urls/urlsCalendar.py @@ -0,0 +1,16 @@ +from django.urls import path +# from django.contrib.auth import views as auth_views +from Movement.Views import ( + viewsCalendar , + viewsCalendarCreateCustom +) + +urlpatterns = [ + # URLs de Professional + 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'), +] \ No newline at end of file diff --git a/Movement/Urls/urlsExpense.py b/Movement/Urls/urlsExpense.py new file mode 100644 index 0000000..0027cfe --- /dev/null +++ b/Movement/Urls/urlsExpense.py @@ -0,0 +1,16 @@ +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/urlsProduct.py b/Movement/Urls/urlsProduct.py new file mode 100644 index 0000000..fd7274a --- /dev/null +++ b/Movement/Urls/urlsProduct.py @@ -0,0 +1,16 @@ +from django.urls import path +# from django.contrib.auth import views as auth_views +from Movement.Views import ( + viewsProduct , + viewsProductCreateCustom +) + +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'), +] \ No newline at end of file diff --git a/Movement/Urls/urlsStock.py b/Movement/Urls/urlsStock.py new file mode 100644 index 0000000..34ccb76 --- /dev/null +++ b/Movement/Urls/urlsStock.py @@ -0,0 +1,15 @@ +from django.urls import path +# from django.contrib.auth import views as auth_views +from Movement.Views import ( + viewsStock , +) + +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'), +] \ No newline at end of file diff --git a/Movement/Views/__pycache__/viewsCalendar.cpython-312.pyc b/Movement/Views/__pycache__/viewsCalendar.cpython-312.pyc new file mode 100644 index 0000000..7bdb74b Binary files /dev/null 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 new file mode 100644 index 0000000..2037840 Binary files /dev/null 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 new file mode 100644 index 0000000..6cb1bd0 Binary files /dev/null and b/Movement/Views/__pycache__/viewsExpense.cpython-312.pyc differ diff --git a/Movement/Views/__pycache__/viewsProduct.cpython-312.pyc b/Movement/Views/__pycache__/viewsProduct.cpython-312.pyc new file mode 100644 index 0000000..46e2fcd Binary files /dev/null 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 new file mode 100644 index 0000000..83ae57c Binary files /dev/null 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 new file mode 100644 index 0000000..fa45cfa Binary files /dev/null and b/Movement/Views/__pycache__/viewsStock.cpython-312.pyc differ diff --git a/Movement/Views/viewsCalendar.py b/Movement/Views/viewsCalendar.py new file mode 100644 index 0000000..53f9012 --- /dev/null +++ b/Movement/Views/viewsCalendar.py @@ -0,0 +1,39 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin +from Movement.Forms import FormsCalendar +from Movement import models +from django.urls import reverse_lazy +from django.utils import timezone + +class CalendarListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.Calendar + template_name = 'Calendar/List.html' + context_object_name = 'Calendar' + paginate_by = 10 + permission_required = 'Base.view_' + 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.localdate()) + return queryset + +class CalendarDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): + model = models.Calendar + template_name = 'Calendar/Detail.html' + permission_required = 'Base.view_' + +class CalendarUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView): + model = models.Calendar + template_name = 'Calendar/Update.html' + form_class = FormsCalendar.FormsCalendar + success_url = reverse_lazy('MovCalendarListView') + permission_required = 'Base.change_' + +class CalendarDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView): + model = models.Calendar + template_name = 'Calendar/Delete.html' + success_url = reverse_lazy('MovCalendarListView') + permission_required = 'Base.delete_' \ No newline at end of file diff --git a/Movement/Views/viewsCalendarCreateCustom.py b/Movement/Views/viewsCalendarCreateCustom.py new file mode 100644 index 0000000..2d65da5 --- /dev/null +++ b/Movement/Views/viewsCalendarCreateCustom.py @@ -0,0 +1,54 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin +from Movement.Forms import FormsCalendar +from Movement import models +from Client.models import Client +from django.urls import reverse_lazy +from django.contrib import messages + + +class CalendarCreateCustomView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): + model = models.Calendar + template_name = 'Calendar/Create/index.html' + form_class = FormsCalendar.FormsCalendar + success_url = reverse_lazy('MovCalendarListView') + 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): + form = super().get_form(form_class) + client_id = self.request.GET.get('Client') or self.request.POST.get('client') + if client_id: + filter_client = Client.objects.filter(id=client_id) + else: + filter_client = Client.objects.none() + form.fields['client'].queryset = filter_client.all() + return form + + def form_valid(self, form): + gross_value = form.instance.service.value + net_value = gross_value - ((gross_value * form.instance.pay_method.percentage) / 100) + value_cash = ((100 - form.instance.professional.percentage) * net_value) / 100 + prof_money = (form.instance.professional.percentage * net_value) / 100 + # + 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.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/viewsExpense.py b/Movement/Views/viewsExpense.py new file mode 100644 index 0000000..20ef7b1 --- /dev/null +++ b/Movement/Views/viewsExpense.py @@ -0,0 +1,102 @@ +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/viewsProduct.py b/Movement/Views/viewsProduct.py new file mode 100644 index 0000000..17d3bd0 --- /dev/null +++ b/Movement/Views/viewsProduct.py @@ -0,0 +1,47 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin , PermissionRequiredMixin +from Movement.Forms import FormsProduct +from Movement import models +from django.urls import reverse_lazy +from django.utils import timezone + +class ProductListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.Product + template_name = 'Product/List.html' + context_object_name = 'Products' + paginate_by = 10 + permission_required = 'Base.view_professional' + def get_queryset(self): + queryset = super().get_queryset() + date = self.request.GET.get('date') + print(date) + if date: + queryset = queryset.filter(date__icontains=date) + else: + queryset = queryset.filter(date__icontains=timezone.localdate()) + return queryset + +# class ProductCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): +# model = models.Product +# template_name = 'Product/Create.html' +# form_class = FormsProduct.FormsProduct +# success_url = reverse_lazy('ProductListView') +# permission_required = 'Base.add_professional' + +class ProductDetailView(LoginRequiredMixin,PermissionRequiredMixin, DetailView): + model = models.Product + template_name = 'Product/Detail.html' + permission_required = 'Base.view_professional' + +class ProductUpdateView(LoginRequiredMixin,PermissionRequiredMixin, UpdateView): + model = models.Product + template_name = 'Product/Update.html' + form_class = FormsProduct.FormsProduct + success_url = reverse_lazy('ProductListView') + permission_required = 'Base.change_professional' + +class ProductDeleteView(LoginRequiredMixin,PermissionRequiredMixin, DeleteView): + model = models.Product + template_name = 'Product/Delete.html' + success_url = reverse_lazy('MovProductListView') + permission_required = 'Base.delete_professional' \ No newline at end of file diff --git a/Movement/Views/viewsProductCreateCustom.py b/Movement/Views/viewsProductCreateCustom.py new file mode 100644 index 0000000..acf9b01 --- /dev/null +++ b/Movement/Views/viewsProductCreateCustom.py @@ -0,0 +1,50 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin +from Movement.Forms import FormsProduct +from Movement import models +from Client.models import Client +from django.urls import reverse_lazy +from django.contrib import messages + + +class ProductCreateCustomView(LoginRequiredMixin, PermissionRequiredMixin, CreateView): + model = models.Product + template_name = 'Product/Create/index.html' + form_class = FormsProduct.FormsProduct + success_url = reverse_lazy('MovProductListView') + 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): + form = super().get_form(form_class) + client_id = self.request.GET.get('Client') or self.request.POST.get('client') + if client_id: + filter_client = Client.objects.filter(id=client_id) + else: + filter_client = Client.objects.none() + form.fields['client'].queryset = filter_client.all() + return form + + def form_valid(self, form): + gross_value = form.instance.product.value + quantity = form.instance.quantity + net_value = gross_value - ((gross_value * form.instance.pay_method.percentage) / 100) + form.instance.gross_value = gross_value * quantity + form.instance.net_value = net_value * quantity + 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/viewsStock.py b/Movement/Views/viewsStock.py new file mode 100644 index 0000000..189d86d --- /dev/null +++ b/Movement/Views/viewsStock.py @@ -0,0 +1,60 @@ +from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView +from django.contrib.auth.mixins import LoginRequiredMixin , PermissionRequiredMixin +from Movement.Forms import FormsStock +from Movement import models +from django.urls import reverse_lazy +from django.contrib import messages +from django.utils import timezone + +class StockListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): + model = models.Stock + template_name = 'Stock/List.html' + context_object_name = 'Stocks' + 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.localdate()) + return queryset + +class StockCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView): + model = models.Stock + template_name = 'Stock/Create.html' + form_class = FormsStock.FormsStock + success_url = reverse_lazy('MovStockListView') + permission_required = 'Base.add_professional' + + def form_valid(self, form): + gross_value = form.instance.gross_value + quantity = form.instance.quantity + form.instance.unit_value = gross_value / quantity + 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 StockDetailView(LoginRequiredMixin,PermissionRequiredMixin, DetailView): + model = models.Stock + template_name = 'Stock/Detail.html' + permission_required = 'Base.view_professional' + +class StockUpdateView(LoginRequiredMixin,PermissionRequiredMixin, UpdateView): + model = models.Stock + template_name = 'Stock/Update.html' + form_class = FormsStock.FormsStock + success_url = reverse_lazy('MovStockListView') + permission_required = 'Base.change_professional' + +class StockDeleteView(LoginRequiredMixin,PermissionRequiredMixin, DeleteView): + model = models.Stock + template_name = 'Stock/Delete.html' + success_url = reverse_lazy('MovStockListView') + permission_required = 'Base.delete_professional' \ No newline at end of file diff --git a/Movement/__init__.py b/Movement/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Movement/admin.py b/Movement/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/Movement/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/Movement/apps.py b/Movement/apps.py new file mode 100644 index 0000000..b9aed9e --- /dev/null +++ b/Movement/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class MovementConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'Movement' diff --git a/Movement/migrations/0001_initial.py b/Movement/migrations/0001_initial.py new file mode 100644 index 0000000..fdc9842 --- /dev/null +++ b/Movement/migrations/0001_initial.py @@ -0,0 +1,102 @@ +# Generated by Django 5.2.7 on 2025-11-01 11:15 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('Base', '0001_initial'), + ('Client', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Calendar', + 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()), + ('time', models.TimeField()), + ('first_time', models.BooleanField(default=False)), + ('gross_value', models.DecimalField(decimal_places=2, max_digits=10)), + ('net_value', models.DecimalField(decimal_places=2, max_digits=10)), + ('value_cash', models.DecimalField(decimal_places=2, max_digits=10)), + ('prof_money', models.DecimalField(decimal_places=2, max_digits=10)), + ('client', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='CalendarClient', to='Client.client')), + ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created', to=settings.AUTH_USER_MODEL)), + ('pay_method', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='CalendarPayMethod', to='Base.paymethod')), + ('professional', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='CalendarProfessional', to='Base.professional')), + ('service', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='CalendarService', to='Base.servicelist')), + ('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', 'time', 'professional'], + }, + ), + migrations.CreateModel( + name='Expense', + 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()), + ('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')), + ('chart_of_account', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ExpenseChartOfAccount', to='Base.chartofaccount')), + ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created', to=settings.AUTH_USER_MODEL)), + ('professional', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='ExpenseProfessional', to='Base.professional')), + ('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', 'chart_of_account'], + }, + ), + migrations.CreateModel( + name='Product', + 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()), + ('quantity', models.DecimalField(decimal_places=0, default=1, max_digits=10)), + ('gross_value', models.DecimalField(decimal_places=2, max_digits=10)), + ('net_value', models.DecimalField(decimal_places=2, max_digits=10)), + ('client', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ProductClient', to='Client.client')), + ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created', to=settings.AUTH_USER_MODEL)), + ('pay_method', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ProductPayMethod', to='Base.paymethod')), + ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ProductProduct', to='Base.productlist')), + ('professional', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ProductProfessional', to='Base.professional')), + ('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', 'product'], + }, + ), + migrations.CreateModel( + name='Stock', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateField()), + ('quantity', models.DecimalField(decimal_places=0, default=1, max_digits=10)), + ('unit_value', models.DecimalField(decimal_places=2, max_digits=10)), + ('gross_value', models.DecimalField(decimal_places=2, max_digits=10)), + ('notes', models.TextField(blank=True, null=True)), + ('bank', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='StockBank', to='Base.bankaccount')), + ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='StockProduct', to='Base.productlist')), + ], + options={ + 'ordering': ['product'], + }, + ), + ] diff --git a/Movement/migrations/__init__.py b/Movement/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Movement/migrations/__pycache__/0001_initial.cpython-312.pyc b/Movement/migrations/__pycache__/0001_initial.cpython-312.pyc new file mode 100644 index 0000000..4e8f4b8 Binary files /dev/null and b/Movement/migrations/__pycache__/0001_initial.cpython-312.pyc differ diff --git a/Movement/migrations/__pycache__/__init__.cpython-312.pyc b/Movement/migrations/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..df2a61d Binary files /dev/null and b/Movement/migrations/__pycache__/__init__.cpython-312.pyc differ diff --git a/Movement/models.py b/Movement/models.py new file mode 100644 index 0000000..3b97cce --- /dev/null +++ b/Movement/models.py @@ -0,0 +1,129 @@ +from django.db import models +from Base.models import ( + Base, + PayMethod, + Professional , + ServiceList, + ProductList, + ChartOfAccount, + BankAccount, +) +from Client.models import Client + +# Movimento do Dia +class Calendar(Base): + client = models.ForeignKey( + Client, + on_delete=models.PROTECT, + related_name='CalendarClient' + ) + date = models.DateField() + time = models.TimeField() + service = models.ForeignKey( + ServiceList, + on_delete=models.PROTECT, + related_name='CalendarService' + ) + pay_method = models.ForeignKey( + PayMethod, + on_delete=models.PROTECT, + related_name='CalendarPayMethod' + ) + professional = models.ForeignKey( + Professional, + on_delete=models.PROTECT, + related_name='CalendarProfessional' + ) + 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) + + class Meta: + ordering = ['date','time','professional',] + def __str__(self): + return f'{self.date} - {self.professional} - {self.time}' + +# Estoque Entrada +class Stock(models.Model): + date = models.DateField() + product = models.ForeignKey( + ProductList, + on_delete=models.PROTECT, + related_name='StockProduct', + ) + quantity = models.DecimalField(max_digits=10, default=1, decimal_places=0 ) + unit_value = models.DecimalField(max_digits=10, decimal_places=2) + gross_value = models.DecimalField(max_digits=10, decimal_places=2) + bank = models.ForeignKey( + BankAccount, + on_delete=models.PROTECT, + related_name='StockBank', + ) + notes = models.TextField(null=True, blank=True) + class Meta: + ordering = ['product'] + def __str__(self): + return self.product + +# Venda de Produtos +class Product(Base): + client = models.ForeignKey( + Client, + on_delete=models.PROTECT, + related_name='ProductClient', + ) + date = models.DateField() + product = models.ForeignKey( + ProductList, + on_delete=models.PROTECT, + related_name='ProductProduct', + ) + pay_method = models.ForeignKey( + PayMethod, + on_delete=models.PROTECT, + related_name='ProductPayMethod', + ) + professional = models.ForeignKey( + Professional, + on_delete=models.PROTECT, + related_name='ProductProfessional', + ) + quantity = models.DecimalField(max_digits=10, default=1 ,decimal_places=0) + # Value + gross_value = models.DecimalField(max_digits=10, decimal_places=2) + net_value = models.DecimalField(max_digits=10, decimal_places=2) + + class Meta: + ordering = ['date','product',] + def __str__(self): + return f'{self.date} - {self.product} ' + +# Despesas +class Expense(Base): + date = models.DateField() + chart_of_account = models.ForeignKey( + ChartOfAccount, + on_delete=models.PROTECT, + related_name='ExpenseChartOfAccount' + ) + bank = models.ForeignKey( + BankAccount, + on_delete=models.PROTECT, + related_name='ExpenseBank', + ) + firm = models.BooleanField(default=True) + professional = models.ForeignKey( + Professional, + on_delete=models.PROTECT, + related_name='ExpenseProfessional', + null=True, blank=True, + ) + gross_value = models.DecimalField(max_digits=10, decimal_places=2) + + class Meta: + ordering = ['date','chart_of_account',] + def __str__(self): + return f'{self.date} - {self.chart_of_account} ' \ No newline at end of file diff --git a/Movement/templates/Calendar/Create/client.html b/Movement/templates/Calendar/Create/client.html new file mode 100644 index 0000000..8a710f8 --- /dev/null +++ b/Movement/templates/Calendar/Create/client.html @@ -0,0 +1,8 @@ +
+ {% for cl in form.client.field.queryset %} + +

{{ cl.first_name }} {{ cl.last_name }}

+ {% endfor %} +

+ +{#{{ form.client }}#} diff --git a/Movement/templates/Calendar/Create/date.html b/Movement/templates/Calendar/Create/date.html new file mode 100644 index 0000000..799dbd3 --- /dev/null +++ b/Movement/templates/Calendar/Create/date.html @@ -0,0 +1,7 @@ +{##} +
diff --git a/Movement/templates/Calendar/Create/first_time.html b/Movement/templates/Calendar/Create/first_time.html new file mode 100644 index 0000000..7344333 --- /dev/null +++ b/Movement/templates/Calendar/Create/first_time.html @@ -0,0 +1,18 @@ +{#
Professional
#} +{#
#} +{# {% for prof in form.professional.field.queryset %}#} +{#
#} +{#
#} +{#
#} +{# {% endfor %}#} +{#

#} +
+ + +
\ No newline at end of file diff --git a/Movement/templates/Calendar/Create/index.html b/Movement/templates/Calendar/Create/index.html new file mode 100644 index 0000000..899fd07 --- /dev/null +++ b/Movement/templates/Calendar/Create/index.html @@ -0,0 +1,32 @@ +{% extends "BaseLogin.html" %} +{% block title %} Cadastro {% endblock %} +{% block content %} + +
+
+
+
+ {% csrf_token %} +
+
{% include 'Calendar/Create/client.html' %}
+
+
+
{% include 'Calendar/Create/professional.html' %}
+
{% include 'Calendar/Create/pay_method.html' %}
+
{% include 'Calendar/Create/service.html' %}
+
+ {% include 'Calendar/Create/date.html' %} +
{% include 'Calendar/Create/time.html' %} + {% include 'Calendar/Create/first_time.html' %} +
+
+ +       + Cancelar +
+ +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Movement/templates/Calendar/Create/pay_method.html b/Movement/templates/Calendar/Create/pay_method.html new file mode 100644 index 0000000..f603467 --- /dev/null +++ b/Movement/templates/Calendar/Create/pay_method.html @@ -0,0 +1,13 @@ +
Metodo de Pagamento

+
+ {% for Pay in form.pay_method.field.queryset %} +
+
+
+ {% endfor %} +

\ No newline at end of file diff --git a/Movement/templates/Calendar/Create/professional.html b/Movement/templates/Calendar/Create/professional.html new file mode 100644 index 0000000..323506a --- /dev/null +++ b/Movement/templates/Calendar/Create/professional.html @@ -0,0 +1,13 @@ +
Professional

+
+ {% for prof in form.professional.field.queryset %} +
+
+
+ {% endfor %} +

\ No newline at end of file diff --git a/Movement/templates/Calendar/Create/service.html b/Movement/templates/Calendar/Create/service.html new file mode 100644 index 0000000..d42e659 --- /dev/null +++ b/Movement/templates/Calendar/Create/service.html @@ -0,0 +1,13 @@ +
Serviço

+
+ {% for serv in form.service.field.queryset %} +
+
+
+ {% endfor %} +

\ No newline at end of file diff --git a/Movement/templates/Calendar/Create/time.html b/Movement/templates/Calendar/Create/time.html new file mode 100644 index 0000000..b551dd3 --- /dev/null +++ b/Movement/templates/Calendar/Create/time.html @@ -0,0 +1,17 @@ +
Time
+
+ +

+ + \ No newline at end of file diff --git a/Movement/templates/Calendar/Delete.html b/Movement/templates/Calendar/Delete.html new file mode 100644 index 0000000..a51ba6d --- /dev/null +++ b/Movement/templates/Calendar/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Deletar da Marcar

+
+
+

Tem certeza que quer deletar ?

+ {{ object.name }} +
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Movement/templates/Calendar/Detail.html b/Movement/templates/Calendar/Detail.html new file mode 100644 index 0000000..b76b1b6 --- /dev/null +++ b/Movement/templates/Calendar/Detail.html @@ -0,0 +1,16 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Detalhes

+
+
+

{{ object.name }}

+

{{ object.value }}

+

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

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

Agenda


+
+
+
+
+ + +
+
+
+

+
+ + + +{# #} + + + + + + + + + {% for Cal in Calendar %} + +{# #} + + + + + + + {% endfor %} + +
ID Hora professional Cliente service Ações
{{ Cal.id }} {{ Cal.time }} {{ Cal.professional }} {{ Cal.client }} {{ Cal.service }} + + + +{# {% if perms.brands.change_brands %}#} +{# #} +{# #} +{# #} +{# {% endif %}#} +{# {% if perms.brands.delete_brands %}#} + + + +{# {% endif %}#} +
+ +
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Movement/templates/Calendar/Update.html b/Movement/templates/Calendar/Update.html new file mode 100644 index 0000000..f60a1ac --- /dev/null +++ b/Movement/templates/Calendar/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/Movement/templates/Expense/Create.html b/Movement/templates/Expense/Create.html new file mode 100644 index 0000000..5ced28a --- /dev/null +++ b/Movement/templates/Expense/Create.html @@ -0,0 +1,19 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} + +
+

Cadastrar Banco

+
+
+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Cancelar e Voltar +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Movement/templates/Expense/CreateFirm.html b/Movement/templates/Expense/CreateFirm.html new file mode 100644 index 0000000..b7870f5 --- /dev/null +++ b/Movement/templates/Expense/CreateFirm.html @@ -0,0 +1,22 @@ +{% extends "BaseLogin.html" %} +{% block title %} Create {% endblock %} +{% block content %} + +
+

Despesa da Firma

+
+
+
+ {% 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/CreateProf.html b/Movement/templates/Expense/CreateProf.html new file mode 100644 index 0000000..b79d2f2 --- /dev/null +++ b/Movement/templates/Expense/CreateProf.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/Delete.html b/Movement/templates/Expense/Delete.html new file mode 100644 index 0000000..83943d8 --- /dev/null +++ b/Movement/templates/Expense/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Deletar da Marcar

+
+
+

Tem certeza que quer deletar ?

+ {{ object.name }} +
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Movement/templates/Expense/Detail.html b/Movement/templates/Expense/Detail.html new file mode 100644 index 0000000..6b4aa78 --- /dev/null +++ b/Movement/templates/Expense/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/Expense/List.html b/Movement/templates/Expense/List.html new file mode 100644 index 0000000..0ba1d80 --- /dev/null +++ b/Movement/templates/Expense/List.html @@ -0,0 +1,78 @@ +{% extends "BaseLogin.html" %} +{% block title %} List {% endblock %} +{% block content %} +

Despesas


+
+
+
+
+ + +
+
+
+{# {% if perms.brands.add_brands %}#} +{#
#} +{# #} +{# Criar #} +{#
#} + + +{# {% endif %}#} +
+ +
+ + + + + + + + + + + + + + {% 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/Expense/Update.html b/Movement/templates/Expense/Update.html new file mode 100644 index 0000000..e14cab8 --- /dev/null +++ b/Movement/templates/Expense/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/Movement/templates/Product/Create/client.html b/Movement/templates/Product/Create/client.html new file mode 100644 index 0000000..57f165a --- /dev/null +++ b/Movement/templates/Product/Create/client.html @@ -0,0 +1,4 @@ +{% for cl in form.client.field.queryset %} + +

{{ cl.first_name }} {{ cl.last_name }}

+{% endfor %}
\ No newline at end of file diff --git a/Movement/templates/Product/Create/date.html b/Movement/templates/Product/Create/date.html new file mode 100644 index 0000000..a4b6958 --- /dev/null +++ b/Movement/templates/Product/Create/date.html @@ -0,0 +1,6 @@ +

\ No newline at end of file diff --git a/Movement/templates/Product/Create/index.html b/Movement/templates/Product/Create/index.html new file mode 100644 index 0000000..6c312f7 --- /dev/null +++ b/Movement/templates/Product/Create/index.html @@ -0,0 +1,33 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} + +
+

Cadastrar

+
+
+
+
+
+ {% csrf_token %} +
+
{% 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' %}
+
+ +
+
+
+ Cancelar e Voltar +
+
+
+{% endblock %} \ No newline at end of file diff --git a/Movement/templates/Product/Create/pay_method.html b/Movement/templates/Product/Create/pay_method.html new file mode 100644 index 0000000..f603467 --- /dev/null +++ b/Movement/templates/Product/Create/pay_method.html @@ -0,0 +1,13 @@ +
Metodo de Pagamento

+
+ {% for Pay in form.pay_method.field.queryset %} +
+
+
+ {% endfor %} +

\ No newline at end of file diff --git a/Movement/templates/Product/Create/product.html b/Movement/templates/Product/Create/product.html new file mode 100644 index 0000000..838483e --- /dev/null +++ b/Movement/templates/Product/Create/product.html @@ -0,0 +1,13 @@ +
Produto

+
+ {% for Pay in form.product.field.queryset %} +
+
+
+ {% endfor %} +

\ No newline at end of file diff --git a/Movement/templates/Product/Create/professional.html b/Movement/templates/Product/Create/professional.html new file mode 100644 index 0000000..323506a --- /dev/null +++ b/Movement/templates/Product/Create/professional.html @@ -0,0 +1,13 @@ +
Professional

+
+ {% for prof in form.professional.field.queryset %} +
+
+
+ {% endfor %} +

\ No newline at end of file diff --git a/Movement/templates/Product/Create/quantity.html b/Movement/templates/Product/Create/quantity.html new file mode 100644 index 0000000..eadfb9d --- /dev/null +++ b/Movement/templates/Product/Create/quantity.html @@ -0,0 +1,8 @@ +
+
+
+
+

\ No newline at end of file diff --git a/Movement/templates/Product/Delete.html b/Movement/templates/Product/Delete.html new file mode 100644 index 0000000..83943d8 --- /dev/null +++ b/Movement/templates/Product/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Deletar da Marcar

+
+
+

Tem certeza que quer deletar ?

+ {{ object.name }} +
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Movement/templates/Product/Detail.html b/Movement/templates/Product/Detail.html new file mode 100644 index 0000000..6b4aa78 --- /dev/null +++ b/Movement/templates/Product/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/Product/List.html b/Movement/templates/Product/List.html new file mode 100644 index 0000000..ad26af1 --- /dev/null +++ b/Movement/templates/Product/List.html @@ -0,0 +1,75 @@ +{% extends "BaseLogin.html" %} +{% block title %} List {% endblock %} +{% block content %} +

Produtos


+
+
+
+
+ + +
+
+
+{# {% if perms.brands.add_brands %}#} +{#
#} +{# #} +{# Criar #} +{#
#} +{# {% endif %}#} +
+ +
+ + + + + + + + + + +{# #} + + + + + + {% for Prod in Products %} + + + + + + + +{# #} + + + + {% endfor %} + +
date product pay_method professional quantity gross_value net_value client Ações
{{ Prod.date|date:"d/m/Y" }} {{ Prod.product.name }} {{ Prod.pay_method }} {{ Prod.professional }} {{ Prod.quantity }} {{ Prod.gross_value }} {{ Prod.net_value }} {{ Prod.client }} + + + +{# {% if perms.brands.change_brands %}#} + + + +{# {% endif %}#} +{# {% if perms.brands.delete_brands %}#} + + + +{# {% endif %}#} +
+
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Movement/templates/Product/Update.html b/Movement/templates/Product/Update.html new file mode 100644 index 0000000..e14cab8 --- /dev/null +++ b/Movement/templates/Product/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/Movement/templates/Stock/Create.html b/Movement/templates/Stock/Create.html new file mode 100644 index 0000000..5ced28a --- /dev/null +++ b/Movement/templates/Stock/Create.html @@ -0,0 +1,19 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} + +
+

Cadastrar Banco

+
+
+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Cancelar e Voltar +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/Movement/templates/Stock/Delete.html b/Movement/templates/Stock/Delete.html new file mode 100644 index 0000000..83943d8 --- /dev/null +++ b/Movement/templates/Stock/Delete.html @@ -0,0 +1,18 @@ +{% extends "BaseLogin.html" %} +{% block title %} Bank Accounts List {% endblock %} +{% block content %} +
+

Deletar da Marcar

+
+
+

Tem certeza que quer deletar ?

+ {{ object.name }} +
+ {% csrf_token %} + +
+
+
+ Cancelar e Voltar +
+{% endblock %} diff --git a/Movement/templates/Stock/Detail.html b/Movement/templates/Stock/Detail.html new file mode 100644 index 0000000..6b4aa78 --- /dev/null +++ b/Movement/templates/Stock/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/Stock/List.html b/Movement/templates/Stock/List.html new file mode 100644 index 0000000..515c595 --- /dev/null +++ b/Movement/templates/Stock/List.html @@ -0,0 +1,72 @@ +{% extends "BaseLogin.html" %} +{% block title %} List {% endblock %} +{% block content %} +

Entrada de Estoque


+
+
+
+
+ + +
+
+
+{# {% if perms.brands.add_brands %}#} + +{# {% endif %}#} +
+ +
+ + + + + + + + + + + + + + + {% for Stock in Stocks %} + + + + + + + + + + + {% endfor %} + +
date product quantity unit_value gross_value bank notes Ações
{{ Stock.date|date:"d/m/Y" }} {{ Stock.product.name }} {{ Stock.quantity }} {{ Stock.unit_value }} {{ Stock.gross_value }} {{ Stock.bank }} {{ Stock.notes }} + + + +{# {% if perms.brands.change_brands %}#} + + + +{# {% endif %}#} +{# {% if perms.brands.delete_brands %}#} + + + +{# {% endif %}#} +
+
+ {% include 'components/_pagination.html' %} +{% endblock %} diff --git a/Movement/templates/Stock/Update.html b/Movement/templates/Stock/Update.html new file mode 100644 index 0000000..e14cab8 --- /dev/null +++ b/Movement/templates/Stock/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/Movement/tests.py b/Movement/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/Movement/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/Setup/__pycache__/__init__.cpython-312.pyc b/Setup/__pycache__/__init__.cpython-312.pyc index 94b147d..329fbad 100644 Binary files a/Setup/__pycache__/__init__.cpython-312.pyc and b/Setup/__pycache__/__init__.cpython-312.pyc differ diff --git a/Setup/__pycache__/__init__.cpython-313.pyc b/Setup/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 9ad5286..0000000 Binary files a/Setup/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/Setup/__pycache__/settings.cpython-312.pyc b/Setup/__pycache__/settings.cpython-312.pyc index c0acffe..775b12d 100644 Binary files a/Setup/__pycache__/settings.cpython-312.pyc and b/Setup/__pycache__/settings.cpython-312.pyc differ diff --git a/Setup/__pycache__/settings.cpython-313.pyc b/Setup/__pycache__/settings.cpython-313.pyc deleted file mode 100644 index 3d3f87b..0000000 Binary files a/Setup/__pycache__/settings.cpython-313.pyc and /dev/null differ diff --git a/Setup/__pycache__/urls.cpython-312.pyc b/Setup/__pycache__/urls.cpython-312.pyc index b3db99d..923a460 100644 Binary files a/Setup/__pycache__/urls.cpython-312.pyc and b/Setup/__pycache__/urls.cpython-312.pyc differ diff --git a/Setup/__pycache__/urls.cpython-313.pyc b/Setup/__pycache__/urls.cpython-313.pyc deleted file mode 100644 index 5503d56..0000000 Binary files a/Setup/__pycache__/urls.cpython-313.pyc and /dev/null differ diff --git a/Setup/__pycache__/wsgi.cpython-312.pyc b/Setup/__pycache__/wsgi.cpython-312.pyc index 1a42bec..b8fd612 100644 Binary files a/Setup/__pycache__/wsgi.cpython-312.pyc and b/Setup/__pycache__/wsgi.cpython-312.pyc differ diff --git a/Setup/__pycache__/wsgi.cpython-313.pyc b/Setup/__pycache__/wsgi.cpython-313.pyc deleted file mode 100644 index 1b27df5..0000000 Binary files a/Setup/__pycache__/wsgi.cpython-313.pyc and /dev/null differ diff --git a/Setup/settings.py b/Setup/settings.py index f7bad3b..f4a4b19 100644 --- a/Setup/settings.py +++ b/Setup/settings.py @@ -39,6 +39,8 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', #Apps 'Base', + 'Client', + 'Movement', ] MIDDLEWARE = [ diff --git a/Setup/urls.py b/Setup/urls.py index 9c10547..5d8eb31 100644 --- a/Setup/urls.py +++ b/Setup/urls.py @@ -1,23 +1,19 @@ -""" -URL configuration for Setup project. - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/5.2/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), - path('', include('Base.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')), ] + diff --git a/Base/templates/Login/Home.html b/Templates/Home.html similarity index 76% rename from Base/templates/Login/Home.html rename to Templates/Home.html index 7f7eb87..6cee767 100644 --- a/Base/templates/Login/Home.html +++ b/Templates/Home.html @@ -2,4 +2,5 @@ {% block title %} Home {% endblock %} {% block content %}

Home

+

{{ ok }}

{% endblock %} \ No newline at end of file diff --git a/Templates/components/_footer.html b/Templates/components/_footer.html index 08d87c6..5cfaa06 100644 --- a/Templates/components/_footer.html +++ b/Templates/components/_footer.html @@ -1,6 +1,6 @@