first commit
This commit is contained in:
@@ -2,14 +2,16 @@ from django import forms
|
||||
from Movement import models
|
||||
from django.utils import timezone
|
||||
|
||||
class FormsExpense(forms.ModelForm):
|
||||
class FormsExpenseOrCredit(forms.ModelForm):
|
||||
class Meta:
|
||||
model = models.Expense
|
||||
model = models.ExpenseOrCredit
|
||||
fields = [
|
||||
'date',
|
||||
'chart_of_account',
|
||||
'bank',
|
||||
'firm',
|
||||
'debit',
|
||||
'prof',
|
||||
'professional',
|
||||
'gross_value',
|
||||
]
|
||||
@@ -19,7 +21,9 @@ class FormsExpense(forms.ModelForm):
|
||||
}),
|
||||
'chart_of_account': forms.Select({'class': 'form-select'}),
|
||||
'bank': forms.Select({'class': 'form-select'}),
|
||||
'debit': forms.CheckboxInput({'class': ''}),
|
||||
'firm': forms.CheckboxInput({'class': ''}),
|
||||
'prof': forms.CheckboxInput({'class': ''}),
|
||||
'professional': forms.Select({'class': 'form-select'}),
|
||||
'gross_value': forms.NumberInput(attrs={'step': 1}),
|
||||
|
||||
@@ -29,6 +33,8 @@ class FormsExpense(forms.ModelForm):
|
||||
'chart_of_account':'Plano de contas',
|
||||
'bank':'Banco',
|
||||
'firm':'Firma',
|
||||
'debit':'Debito',
|
||||
'prof':'Prof.',
|
||||
'gross_value':'Valor',
|
||||
'professional':'Profissional',
|
||||
}
|
||||
@@ -34,6 +34,6 @@ class FormsProduct(forms.ModelForm):
|
||||
'product':'Produto',
|
||||
'pay_method':'M. Pagamento',
|
||||
'professional':'Profissional',
|
||||
'quantity':'Quantiddade',
|
||||
'quantity':'Quantidade',
|
||||
# 'net_value':'Valor Liquido',
|
||||
}
|
||||
27
Movement/Forms/FormsTransition.py
Normal file
27
Movement/Forms/FormsTransition.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from django import forms
|
||||
from Movement import models
|
||||
from django.utils import timezone
|
||||
|
||||
class FormsTransition(forms.ModelForm):
|
||||
class Meta:
|
||||
model = models.Transition
|
||||
fields = [
|
||||
'date',
|
||||
'bank_credit',
|
||||
'bank_debit',
|
||||
'gross_value',
|
||||
]
|
||||
widgets = {
|
||||
'date': forms.DateInput(format=('%Y-%m-%d'), attrs={'type': 'date', 'class':'',
|
||||
'value':timezone.localtime(timezone.now()).date()
|
||||
}),
|
||||
'bank_credit': forms.Select({'class': 'form-select'}),
|
||||
'bank_debit': forms.Select({'class': 'form-select'}),
|
||||
'gross_value': forms.NumberInput(attrs={'step': 1}),
|
||||
}
|
||||
labels={
|
||||
'date':'Data',
|
||||
'bank_credit':'Entrada',
|
||||
'bank_debit':'Saida',
|
||||
'gross_value':'Valor',
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
BIN
Movement/Forms/__pycache__/FormsExpenseOrCredit.cpython-312.pyc
Normal file
BIN
Movement/Forms/__pycache__/FormsExpenseOrCredit.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Movement/Forms/__pycache__/FormsTransition.cpython-312.pyc
Normal file
BIN
Movement/Forms/__pycache__/FormsTransition.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Movement/Urls/__pycache__/urlsExpenseOrCredit.cpython-312.pyc
Normal file
BIN
Movement/Urls/__pycache__/urlsExpenseOrCredit.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Movement/Urls/__pycache__/urlsTransition.cpython-312.pyc
Normal file
BIN
Movement/Urls/__pycache__/urlsTransition.cpython-312.pyc
Normal file
Binary file not shown.
@@ -7,10 +7,10 @@ from Movement.Views import (
|
||||
|
||||
urlpatterns = [
|
||||
# URLs de Professional
|
||||
path('/', viewsCalendar.CalendarListView.as_view(), name='MovCalendarListView'),
|
||||
path('', viewsCalendar.CalendarListView.as_view(), name='MovCalendarListView'),
|
||||
# path('/Create', viewsCalendar.CalendarCreateView.as_view(), name='CalendarCreateView'),
|
||||
path('/<int:pk>/Detail', viewsCalendar.CalendarDetailView.as_view(), name='MovCalendarDetailView'),
|
||||
path('/<int:pk>/Update', viewsCalendar.CalendarUpdateView.as_view(), name='MovCalendarUpdateView'),
|
||||
path('/<int:pk>/Delete', viewsCalendar.CalendarDeleteView.as_view(), name='MovCalendarDeleteView'),
|
||||
path('/CreateCuston', viewsCalendarCreateCustom.CalendarCreateCustomView.as_view(), name='MovCalendarCreateCustom'),
|
||||
path('<int:pk>/Detail', viewsCalendar.CalendarDetailView.as_view(), name='MovCalendarDetailView'),
|
||||
path('<int:pk>/Update', viewsCalendar.CalendarUpdateView.as_view(), name='MovCalendarUpdateView'),
|
||||
path('<int:pk>/Delete', viewsCalendar.CalendarDeleteView.as_view(), name='MovCalendarDeleteView'),
|
||||
path('CreateCuston', viewsCalendarCreateCustom.CalendarCreateCustomView.as_view(), name='MovCalendarCreateCustom'),
|
||||
]
|
||||
@@ -1,16 +0,0 @@
|
||||
from django.urls import path
|
||||
# from django.contrib.auth import views as auth_views
|
||||
from Movement.Views import (
|
||||
viewsExpense ,
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
# URLs de Professional
|
||||
path('/', viewsExpense.ExpenseListView.as_view(), name='MovExpenseListView'),
|
||||
path('/Create', viewsExpense.ExpenseCreateView.as_view(), name='MovExpenseCreateView'),
|
||||
path('/<int:pk>/Detail', viewsExpense.ExpenseDetailView.as_view(), name='MovExpenseDetailView'),
|
||||
path('/<int:pk>/Update', viewsExpense.ExpenseUpdateView.as_view(), name='MovExpenseUpdateView'),
|
||||
path('/<int:pk>/Delete', viewsExpense.ExpenseDeleteView.as_view(), name='MovExpenseDeleteView'),
|
||||
path('/CreateFirm', viewsExpense.ExpenseFirmCreateView.as_view(), name='MovExpenseFirmCreateView'),
|
||||
path('/CreateProf', viewsExpense.ExpenseProfCreateView.as_view(), name='MovExpenseProfCreateView'),
|
||||
]
|
||||
17
Movement/Urls/urlsExpenseOrCredit.py
Normal file
17
Movement/Urls/urlsExpenseOrCredit.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.urls import path
|
||||
# from django.contrib.auth import views as auth_views
|
||||
from Movement.Views import (
|
||||
viewsExpenseOrCredit,
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
# URLs de Professional
|
||||
path('', viewsExpenseOrCredit.ExpenseOrCreditListView.as_view(), name='MovExpenseOrCreditListView'),
|
||||
# path('Create', viewsExpenseOrCredit.ExpenseOrCreditCreateView.as_view(), name='MovExpenseOrCreditCreateView'),
|
||||
path('<int:pk>/Detail', viewsExpenseOrCredit.ExpenseOrCreditDetailView.as_view(), name='MovExpenseOrCreditDetailView'),
|
||||
path('<int:pk>/Delete', viewsExpenseOrCredit.ExpenseOrCreditDeleteView.as_view(), name='MovExpenseOrCreditDeleteView'),
|
||||
path('CreateFirm', viewsExpenseOrCredit.ExpenseOrCreditFirmCreateView.as_view(), name='MovExpenseOrCreditFirmCreateView'),
|
||||
path('CreateProf', viewsExpenseOrCredit.ExpenseOrCreditProfCreateView.as_view(), name='MovExpenseOrCreditProfCreateView'),
|
||||
path('ProfCredit', viewsExpenseOrCredit.ExpenseOrCreditProfCreditCreateView.as_view(), name='MovExpenseOrCreditProfCreditCreateView'),
|
||||
path('FirmCredit', viewsExpenseOrCredit.ExpenseOrCreditFirmCreditCreateView.as_view(), name='MovExpenseOrCreditFirmCreditCreateView'),
|
||||
]
|
||||
@@ -7,10 +7,10 @@ from Movement.Views import (
|
||||
|
||||
urlpatterns = [
|
||||
# URLs de Professional
|
||||
path('/', viewsProduct.ProductListView.as_view(), name='MovProductListView'),
|
||||
# path('/Create', viewsProduct.ProductCreateView.as_view(), name='MovProductCreateView'),
|
||||
path('/<int:pk>/Detail', viewsProduct.ProductDetailView.as_view(), name='MovProductDetailView'),
|
||||
path('/<int:pk>/Update', viewsProduct.ProductUpdateView.as_view(), name='MovProductUpdateView'),
|
||||
path('/<int:pk>/Delete', viewsProduct.ProductDeleteView.as_view(), name='MovProductDeleteView'),
|
||||
path('/CreateCuston', viewsProductCreateCustom.ProductCreateCustomView.as_view(), name='MovProductCreateCustom'),
|
||||
path('', viewsProduct.ProductListView.as_view(), name='MovProductListView'),
|
||||
# path('Create', viewsProduct.ProductCreateView.as_view(), name='MovProductCreateView'),
|
||||
path('<int:pk>/Detail', viewsProduct.ProductDetailView.as_view(), name='MovProductDetailView'),
|
||||
path('<int:pk>/Update', viewsProduct.ProductUpdateView.as_view(), name='MovProductUpdateView'),
|
||||
path('<int:pk>/Delete', viewsProduct.ProductDeleteView.as_view(), name='MovProductDeleteView'),
|
||||
path('CreateCuston', viewsProductCreateCustom.ProductCreateCustomView.as_view(), name='MovProductCreateCustom'),
|
||||
]
|
||||
@@ -6,10 +6,10 @@ from Movement.Views import (
|
||||
|
||||
urlpatterns = [
|
||||
# URLs de Professional
|
||||
path('/', viewsStock.StockListView.as_view(), name='MovStockListView'),
|
||||
path('/Create', viewsStock.StockCreateView.as_view(), name='MovStockCreateView'),
|
||||
path('/<int:pk>/Detail', viewsStock.StockDetailView.as_view(), name='MovStockDetailView'),
|
||||
path('/<int:pk>/Update', viewsStock.StockUpdateView.as_view(), name='MovStockUpdateView'),
|
||||
path('/<int:pk>/Delete', viewsStock.StockDeleteView.as_view(), name='MovStockDeleteView'),
|
||||
# path('/CreateCuston', viewsStockCreateCustom.StockCreateCustomView.as_view(), name='MovStockCreateCustom'),
|
||||
path('', viewsStock.StockListView.as_view(), name='MovStockListView'),
|
||||
path('Create', viewsStock.StockCreateView.as_view(), name='MovStockCreateView'),
|
||||
path('<int:pk>/Detail', viewsStock.StockDetailView.as_view(), name='MovStockDetailView'),
|
||||
path('<int:pk>/Update', viewsStock.StockUpdateView.as_view(), name='MovStockUpdateView'),
|
||||
path('<int:pk>/Delete', viewsStock.StockDeleteView.as_view(), name='MovStockDeleteView'),
|
||||
# path('CreateCuston', viewsStockCreateCustom.StockCreateCustomView.as_view(), name='MovStockCreateCustom'),
|
||||
]
|
||||
14
Movement/Urls/urlsTransition.py
Normal file
14
Movement/Urls/urlsTransition.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from django.urls import path
|
||||
# from django.contrib.auth import views as auth_views
|
||||
from Movement.Views import (
|
||||
viewsTransition ,
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
# URLs de Professional
|
||||
path('', viewsTransition.TransitionListView.as_view(), name='MovTransitionListView'),
|
||||
path('Create', viewsTransition.TransitionCreateView.as_view(), name='MovTransitionCreateView'),
|
||||
path('<int:pk>/Detail', viewsTransition.TransitionDetailView.as_view(), name='MovTransitionDetailView'),
|
||||
path('<int:pk>/Update', viewsTransition.TransitionUpdateView.as_view(), name='MovTransitionUpdateView'),
|
||||
path('<int:pk>/Delete', viewsTransition.TransitionDeleteView.as_view(), name='MovTransitionDeleteView'),
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Movement/Views/__pycache__/viewsExpenseOrCredit.cpython-312.pyc
Normal file
BIN
Movement/Views/__pycache__/viewsExpenseOrCredit.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Movement/Views/__pycache__/viewsTransition.cpython-312.pyc
Normal file
BIN
Movement/Views/__pycache__/viewsTransition.cpython-312.pyc
Normal file
Binary file not shown.
@@ -5,13 +5,14 @@ from Movement import models
|
||||
from Client.models import Client
|
||||
from django.urls import reverse_lazy
|
||||
from django.contrib import messages
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
class CalendarCreateCustomView(LoginRequiredMixin, PermissionRequiredMixin, CreateView):
|
||||
model = models.Calendar
|
||||
template_name = 'Calendar/Create/index.html'
|
||||
form_class = FormsCalendar.FormsCalendar
|
||||
success_url = reverse_lazy('MovCalendarListView')
|
||||
success_url = reverse_lazy('Dashboard')
|
||||
permission_required = 'Base.add_'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
@@ -43,7 +44,9 @@ class CalendarCreateCustomView(LoginRequiredMixin, PermissionRequiredMixin, Crea
|
||||
form.instance.gross_value = gross_value
|
||||
form.instance.net_value = net_value
|
||||
form.instance.value_cash = value_cash
|
||||
form.instance.prof_money = prof_money
|
||||
form.instance.prof_money = prof_money - Decimal('0.01')
|
||||
(Client.objects.filter(id=form.instance.client.id)
|
||||
.update(last_visit=form.instance.date))
|
||||
form.instance.created_by = self.request.user
|
||||
messages.success(self.request, 'Registro realizado com sucesso!')
|
||||
return super().form_valid(form)
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin , PermissionRequiredMixin
|
||||
from Movement.Forms import FormsExpense
|
||||
from Movement import models
|
||||
from Base.models import ChartOfAccount
|
||||
from django.urls import reverse_lazy
|
||||
from django.contrib import messages
|
||||
from django.utils import timezone
|
||||
|
||||
class ExpenseListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
|
||||
model = models.Expense
|
||||
template_name = 'Expense/List.html'
|
||||
context_object_name = 'Expenses'
|
||||
paginate_by = 10
|
||||
permission_required = 'Base.view_professional'
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
date = self.request.GET.get('date')
|
||||
if date:
|
||||
queryset = queryset.filter(date__icontains=date)
|
||||
else:
|
||||
queryset = queryset.filter(
|
||||
date__icontains=timezone.localtime(timezone.now()).month
|
||||
)
|
||||
return queryset
|
||||
|
||||
class ExpenseCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView):
|
||||
model = models.Expense
|
||||
template_name = 'Expense/Create.html'
|
||||
form_class = FormsExpense.FormsExpense
|
||||
success_url = reverse_lazy('MovExpenseListView')
|
||||
permission_required = 'Base.add_professional'
|
||||
|
||||
class ExpenseDetailView(LoginRequiredMixin,PermissionRequiredMixin, DetailView):
|
||||
model = models.Expense
|
||||
template_name = 'Expense/Detail.html'
|
||||
permission_required = 'Base.view_professional'
|
||||
|
||||
class ExpenseUpdateView(LoginRequiredMixin,PermissionRequiredMixin, UpdateView):
|
||||
model = models.Expense
|
||||
template_name = 'Expense/Update.html'
|
||||
form_class = FormsExpense.FormsExpense
|
||||
success_url = reverse_lazy('ExpenseListView')
|
||||
permission_required = 'Base.change_professional'
|
||||
|
||||
class ExpenseDeleteView(LoginRequiredMixin,PermissionRequiredMixin, DeleteView):
|
||||
model = models.Expense
|
||||
template_name = 'Expense/Delete.html'
|
||||
success_url = reverse_lazy('MovExpenseListView')
|
||||
permission_required = 'Base.delete_professional'
|
||||
|
||||
class ExpenseFirmCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView):
|
||||
model = models.Expense
|
||||
template_name = 'Expense/CreateFirm.html'
|
||||
form_class = FormsExpense.FormsExpense
|
||||
success_url = reverse_lazy('MovExpenseListView')
|
||||
permission_required = 'Base.add_professional'
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super().get_form(form_class)
|
||||
form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter(
|
||||
firm=True,
|
||||
debit=True,
|
||||
)
|
||||
return form
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.firm = True
|
||||
form.instance.created_by = self.request.user
|
||||
messages.success(self.request, 'Registro realizado com sucesso!')
|
||||
return super().form_valid(form)
|
||||
|
||||
def form_invalid(self, form):
|
||||
errors = form.errors.as_text()
|
||||
messages.error(self.request, f'Verifique os dados: {errors}')
|
||||
return super().form_invalid(form)
|
||||
|
||||
class ExpenseProfCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView):
|
||||
model = models.Expense
|
||||
template_name = 'Expense/CreateProf.html'
|
||||
form_class = FormsExpense.FormsExpense
|
||||
success_url = reverse_lazy('MovExpenseListView')
|
||||
permission_required = 'Base.add_professional'
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super().get_form(form_class)
|
||||
form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter(
|
||||
firm=False,
|
||||
debit=True,
|
||||
)
|
||||
return form
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.firm = False
|
||||
form.instance.created_by = self.request.user
|
||||
messages.success(self.request, 'Registro realizado com sucesso!')
|
||||
return super().form_valid(form)
|
||||
|
||||
def form_invalid(self, form):
|
||||
errors = form.errors.as_text()
|
||||
messages.error(self.request, f'Verifique os dados: {errors}')
|
||||
return super().form_invalid(form)
|
||||
196
Movement/Views/viewsExpenseOrCredit.py
Normal file
196
Movement/Views/viewsExpenseOrCredit.py
Normal file
@@ -0,0 +1,196 @@
|
||||
from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin , PermissionRequiredMixin
|
||||
from Movement.Forms import FormsExpenseOrCredit
|
||||
from Movement import models
|
||||
from Base.models import ChartOfAccount
|
||||
from django.urls import reverse_lazy
|
||||
from django.contrib import messages
|
||||
from django.utils import timezone
|
||||
|
||||
class ExpenseOrCreditListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
|
||||
model = models.ExpenseOrCredit
|
||||
template_name = 'ExpenseOrCredit/List.html'
|
||||
context_object_name = 'Expenses'
|
||||
paginate_by = 10
|
||||
permission_required = 'Base.view_professional'
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
|
||||
month = self.request.GET.get('month')
|
||||
mov_type = self.request.GET.get('type')
|
||||
resp = self.request.GET.get('resp')
|
||||
|
||||
# Validação: Se NÃO houver month E NÃO houver type E NÃO houver resp, retorna vazio
|
||||
if not any([month, mov_type, resp]):
|
||||
return super().get_queryset().none()
|
||||
|
||||
# Se passou da validação, começamos o filtro
|
||||
queryset = super().get_queryset()
|
||||
year = timezone.localtime(timezone.now()).year
|
||||
|
||||
# 1. Filtro de Data
|
||||
if month:
|
||||
queryset = queryset.filter(date__month=month, date__year=year)
|
||||
else:
|
||||
# Se você quiser que o mês atual seja o padrão caso month não venha,
|
||||
# mas type ou resp venham:
|
||||
current_month = timezone.localtime(timezone.now()).month
|
||||
queryset = queryset.filter(date__month=current_month, date__year=year)
|
||||
|
||||
# 2. Filtro de Tipo
|
||||
if mov_type == 'credit':
|
||||
queryset = queryset.filter(credit=True, debit=False)
|
||||
elif mov_type == 'debit':
|
||||
queryset = queryset.filter(credit=False, debit=True)
|
||||
|
||||
# 3. Filtro de Responsável
|
||||
if resp == 'firm':
|
||||
queryset = queryset.filter(firm=True, prof=False)
|
||||
elif resp == 'prof':
|
||||
queryset = queryset.filter(firm=False, prof=True)
|
||||
|
||||
return queryset
|
||||
|
||||
# class ExpenseOrCreditCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView):
|
||||
# model = models.ExpenseOrCredit
|
||||
# template_name = 'ExpenseOrCredit/Create.html'
|
||||
# form_class = FormsExpenseOrCredit.FormsExpenseOrCredit
|
||||
# success_url = reverse_lazy('MovExpenseOrCreditListView')
|
||||
# permission_required = 'Base.add_professional'
|
||||
|
||||
class ExpenseOrCreditDetailView(LoginRequiredMixin,PermissionRequiredMixin, DetailView):
|
||||
model = models.ExpenseOrCredit
|
||||
template_name = 'ExpenseOrCredit/Detail.html'
|
||||
permission_required = 'Base.view_professional'
|
||||
|
||||
class ExpenseOrCreditDeleteView(LoginRequiredMixin,PermissionRequiredMixin, DeleteView):
|
||||
model = models.ExpenseOrCredit
|
||||
# template_name = 'Expense/Delete.html'
|
||||
success_url = reverse_lazy('MovExpenseOrCreditListView')
|
||||
permission_required = 'Base.delete_professional'
|
||||
|
||||
def form_valid(self, form):
|
||||
messages.success(self.request, 'Registro Deletado com sucesso!')
|
||||
return super().form_valid(form)
|
||||
|
||||
def form_invalid(self, form):
|
||||
errors = form.errors.as_text()
|
||||
messages.error(self.request, f'Verifique os dados: {errors}')
|
||||
return super().form_invalid(form)
|
||||
|
||||
class ExpenseOrCreditFirmCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView):
|
||||
model = models.ExpenseOrCredit
|
||||
template_name = 'ExpenseOrCredit/CreateFirm.html'
|
||||
form_class = FormsExpenseOrCredit.FormsExpenseOrCredit
|
||||
success_url = reverse_lazy('MovExpenseOrCreditListView')
|
||||
permission_required = 'Base.add_professional'
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super().get_form(form_class)
|
||||
form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter(
|
||||
firm=True,
|
||||
debit=True,
|
||||
credit=False,
|
||||
)
|
||||
return form
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.firm = True
|
||||
form.instance.debit = True
|
||||
form.instance.created_by = self.request.user
|
||||
messages.success(self.request, 'Registro realizado com sucesso!')
|
||||
return super().form_valid(form)
|
||||
|
||||
def form_invalid(self, form):
|
||||
errors = form.errors.as_text()
|
||||
messages.error(self.request, f'Verifique os dados: {errors}')
|
||||
return super().form_invalid(form)
|
||||
|
||||
class ExpenseOrCreditProfCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView):
|
||||
model = models.ExpenseOrCredit
|
||||
template_name = 'ExpenseOrCredit/CreateProf.html'
|
||||
form_class = FormsExpenseOrCredit.FormsExpenseOrCredit
|
||||
success_url = reverse_lazy('MovExpenseOrCreditListView')
|
||||
permission_required = 'Base.add_professional'
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super().get_form(form_class)
|
||||
form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter(
|
||||
firm=False,
|
||||
debit=True,
|
||||
credit=False,
|
||||
prof=True,
|
||||
)
|
||||
return form
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.firm = False
|
||||
form.instance.debit = True
|
||||
form.instance.prof = True
|
||||
form.instance.created_by = self.request.user
|
||||
messages.success(self.request, 'Registro realizado com sucesso!')
|
||||
return super().form_valid(form)
|
||||
|
||||
def form_invalid(self, form):
|
||||
errors = form.errors.as_text()
|
||||
messages.error(self.request, f'Verifique os dados: {errors}')
|
||||
return super().form_invalid(form)
|
||||
|
||||
class ExpenseOrCreditFirmCreditCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView):
|
||||
model = models.ExpenseOrCredit
|
||||
template_name = 'ExpenseOrCredit/CreateCredit.html'
|
||||
form_class = FormsExpenseOrCredit.FormsExpenseOrCredit
|
||||
success_url = reverse_lazy('MovExpenseOrCreditListView')
|
||||
permission_required = 'Base.add_professional'
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super().get_form(form_class)
|
||||
form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter(
|
||||
firm=True,
|
||||
credit=True,
|
||||
)
|
||||
return form
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.firm = True
|
||||
form.instance.debit = False
|
||||
form.instance.credit = True
|
||||
form.instance.created_by = self.request.user
|
||||
messages.success(self.request, 'Registro realizado com sucesso!')
|
||||
return super().form_valid(form)
|
||||
|
||||
def form_invalid(self, form):
|
||||
errors = form.errors.as_text()
|
||||
messages.error(self.request, f'Verifique os dados: {errors}')
|
||||
return super().form_invalid(form)
|
||||
|
||||
class ExpenseOrCreditProfCreditCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView):
|
||||
model = models.ExpenseOrCredit
|
||||
template_name = 'ExpenseOrCredit/CreateProfCredit.html'
|
||||
form_class = FormsExpenseOrCredit.FormsExpenseOrCredit
|
||||
success_url = reverse_lazy('MovExpenseOrCreditListView')
|
||||
permission_required = 'Base.add_professional'
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super().get_form(form_class)
|
||||
form.fields['chart_of_account'].queryset = ChartOfAccount.objects.filter(
|
||||
firm=False,
|
||||
debit=False,
|
||||
credit=True,
|
||||
prof=True,
|
||||
)
|
||||
return form
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.firm = False
|
||||
form.instance.debit = False
|
||||
form.instance.credit = True
|
||||
form.instance.prof = True
|
||||
form.instance.created_by = self.request.user
|
||||
messages.success(self.request, 'Registro realizado com sucesso!')
|
||||
return super().form_valid(form)
|
||||
|
||||
def form_invalid(self, form):
|
||||
errors = form.errors.as_text()
|
||||
messages.error(self.request, f'Verifique os dados: {errors}')
|
||||
return super().form_invalid(form)
|
||||
@@ -11,17 +11,11 @@ class ProductCreateCustomView(LoginRequiredMixin, PermissionRequiredMixin, Creat
|
||||
model = models.Product
|
||||
template_name = 'Product/Create/index.html'
|
||||
form_class = FormsProduct.FormsProduct
|
||||
success_url = reverse_lazy('MovProductListView')
|
||||
success_url = reverse_lazy('Dashboard')
|
||||
permission_required = 'Base.add_'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
# if self.request.GET.get('Client'):
|
||||
# filter_client = Client.objects.filter(
|
||||
# id=self.request.GET.get('Client') or ''
|
||||
# )
|
||||
# else: filter_client = Client.objects.none()
|
||||
# context['Client'] = filter_client
|
||||
return context
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
|
||||
52
Movement/Views/viewsTransition.py
Normal file
52
Movement/Views/viewsTransition.py
Normal file
@@ -0,0 +1,52 @@
|
||||
from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin , PermissionRequiredMixin
|
||||
from Movement.Forms import FormsTransition
|
||||
from Movement import models
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils import timezone
|
||||
|
||||
class TransitionListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
|
||||
model = models.Transition
|
||||
template_name = 'Transition/List.html'
|
||||
context_object_name = 'Transitions'
|
||||
paginate_by = 10
|
||||
permission_required = 'Base.view_professional'
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
date = self.request.GET.get('month')
|
||||
if date:
|
||||
queryset = queryset.filter(
|
||||
date__month=date,
|
||||
date__year=timezone.localtime(timezone.now()).year,
|
||||
)
|
||||
else:
|
||||
queryset = queryset.filter(
|
||||
date__month=timezone.localtime(timezone.now()).month,
|
||||
date__year =timezone.localtime(timezone.now()).year,
|
||||
)
|
||||
return queryset
|
||||
|
||||
class TransitionCreateView(LoginRequiredMixin,PermissionRequiredMixin, CreateView):
|
||||
model = models.Transition
|
||||
template_name = 'Transition/Create.html'
|
||||
form_class = FormsTransition.FormsTransition
|
||||
success_url = reverse_lazy('MovTransitionListView')
|
||||
permission_required = 'Base.add_professional'
|
||||
|
||||
class TransitionDetailView(LoginRequiredMixin,PermissionRequiredMixin, DetailView):
|
||||
model = models.Transition
|
||||
template_name = 'Transition/Detail.html'
|
||||
permission_required = 'Base.view_professional'
|
||||
|
||||
class TransitionUpdateView(LoginRequiredMixin,PermissionRequiredMixin, UpdateView):
|
||||
model = models.Transition
|
||||
template_name = 'Transition/Update.html'
|
||||
form_class = FormsTransition.FormsTransition
|
||||
success_url = reverse_lazy('MovTransitionListView')
|
||||
permission_required = 'Base.change_professional'
|
||||
|
||||
class TransitionDeleteView(LoginRequiredMixin,PermissionRequiredMixin, DeleteView):
|
||||
model = models.Transition
|
||||
template_name = 'Transition/Delete.html'
|
||||
success_url = reverse_lazy('MovTransitionListView')
|
||||
permission_required = 'Base.delete_professional'
|
||||
@@ -1,4 +1,4 @@
|
||||
# Generated by Django 5.2.7 on 2025-11-01 11:15
|
||||
# Generated by Django 6.0 on 2025-12-24 11:22
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
@@ -42,13 +42,14 @@ class Migration(migrations.Migration):
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Expense',
|
||||
name='ExpenseOrCredit',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('active', models.BooleanField(default=False)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('date', models.DateField()),
|
||||
('debit', models.BooleanField(default=True)),
|
||||
('firm', models.BooleanField(default=True)),
|
||||
('gross_value', models.DecimalField(decimal_places=2, max_digits=10)),
|
||||
('bank', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ExpenseBank', to='Base.bankaccount')),
|
||||
@@ -99,4 +100,22 @@ class Migration(migrations.Migration):
|
||||
'ordering': ['product'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Transition',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('active', models.BooleanField(default=False)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('date', models.DateField()),
|
||||
('gross_value', models.DecimalField(decimal_places=2, max_digits=10)),
|
||||
('bank_credit', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='TransitionBankCredit', to='Base.bankaccount')),
|
||||
('bank_debit', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='TransitionBankDebit', to='Base.bankaccount')),
|
||||
('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created', to=settings.AUTH_USER_MODEL)),
|
||||
('updated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['date'],
|
||||
},
|
||||
),
|
||||
]
|
||||
|
||||
18
Movement/migrations/0002_expenseorcredit_credit.py
Normal file
18
Movement/migrations/0002_expenseorcredit_credit.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 6.0 on 2025-12-24 14:06
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('Movement', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='expenseorcredit',
|
||||
name='credit',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
||||
18
Movement/migrations/0003_expenseorcredit_prof.py
Normal file
18
Movement/migrations/0003_expenseorcredit_prof.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 6.0 on 2025-12-24 14:47
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('Movement', '0002_expenseorcredit_credit'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='expenseorcredit',
|
||||
name='prof',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -36,10 +36,10 @@ class Calendar(Base):
|
||||
)
|
||||
first_time = models.BooleanField(default=False)
|
||||
# Value
|
||||
gross_value = models.DecimalField(max_digits=10, decimal_places=2)
|
||||
net_value = models.DecimalField(max_digits=10, decimal_places=2)
|
||||
value_cash = models.DecimalField(max_digits=10, decimal_places=2)
|
||||
prof_money = models.DecimalField(max_digits=10, decimal_places=2)
|
||||
gross_value = models.DecimalField(max_digits=10, decimal_places=2) # bruto
|
||||
net_value = models.DecimalField(max_digits=10, decimal_places=2) #liquido
|
||||
value_cash = models.DecimalField(max_digits=10, decimal_places=2) # da empresa
|
||||
prof_money = models.DecimalField(max_digits=10, decimal_places=2) # do profissinal
|
||||
|
||||
class Meta:
|
||||
ordering = ['date','time','professional',]
|
||||
@@ -102,7 +102,7 @@ class Product(Base):
|
||||
return f'{self.date} - {self.product} '
|
||||
|
||||
# Despesas
|
||||
class Expense(Base):
|
||||
class ExpenseOrCredit(Base):
|
||||
date = models.DateField()
|
||||
chart_of_account = models.ForeignKey(
|
||||
ChartOfAccount,
|
||||
@@ -114,7 +114,10 @@ class Expense(Base):
|
||||
on_delete=models.PROTECT,
|
||||
related_name='ExpenseBank',
|
||||
)
|
||||
debit = models.BooleanField(default=True)
|
||||
credit = models.BooleanField(default=False)
|
||||
firm = models.BooleanField(default=True)
|
||||
prof = models.BooleanField(default=False)
|
||||
professional = models.ForeignKey(
|
||||
Professional,
|
||||
on_delete=models.PROTECT,
|
||||
@@ -126,4 +129,24 @@ class Expense(Base):
|
||||
class Meta:
|
||||
ordering = ['date','chart_of_account',]
|
||||
def __str__(self):
|
||||
return f'{self.date} - {self.chart_of_account} '
|
||||
return f'{self.date} - {self.chart_of_account} '
|
||||
|
||||
# trasiçoes entre bancos
|
||||
class Transition(Base):
|
||||
date = models.DateField()
|
||||
bank_credit = models.ForeignKey(
|
||||
BankAccount,
|
||||
on_delete=models.PROTECT,
|
||||
related_name='TransitionBankCredit',
|
||||
)
|
||||
bank_debit = models.ForeignKey(
|
||||
BankAccount,
|
||||
on_delete=models.PROTECT,
|
||||
related_name='TransitionBankDebit',
|
||||
)
|
||||
gross_value = models.DecimalField(max_digits=10, decimal_places=2)
|
||||
|
||||
class Meta:
|
||||
ordering = ['date',]
|
||||
def __str__(self):
|
||||
return f'{self.bank_credit} to {self.bank_credit}'
|
||||
@@ -1,7 +1,7 @@
|
||||
{#<input type="hidden" name="date" value="2025-10-20" >#}
|
||||
<label> <div class=""> Dia </div>
|
||||
<input type="date" name="date"
|
||||
{#<label> <div class=""> Dia </div>#}
|
||||
<input type="hidden" name="date"
|
||||
value="{% now 'Y-m-d' %}"
|
||||
class="date form-control"
|
||||
{# class="date form-control"#}
|
||||
>
|
||||
</label><br>
|
||||
{#</label><br>#}
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
{% include 'Calendar/Create/date.html' %}
|
||||
<br> {% include 'Calendar/Create/time.html' %}
|
||||
{% include 'Calendar/Create/first_time.html' %}
|
||||
<br>
|
||||
<button type="submit" class="btn btn-primary"> Salvar </button>
|
||||
     
|
||||
<a href="{% url 'MovCalendarListView' %}" class="btn btn-secondary"> Cancelar </a>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"> Salvar </button>
|
||||
     
|
||||
<a href="{% url 'MovCalendarListView' %}" class="btn btn-secondary"> Cancelar </a>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<th> Hora </th>
|
||||
<th> professional </th>
|
||||
<th> Cliente </th>
|
||||
<th > service </th>
|
||||
<th > Service </th>
|
||||
<th width="15%"> Ações </th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -46,6 +46,7 @@
|
||||
{# <i class="bi bi-pencil"></i>#}
|
||||
{# </a>#}
|
||||
{# {% endif %}#}
|
||||
|
||||
{# {% if perms.brands.delete_brands %}#}
|
||||
<a href="{% url 'MovCalendarDeleteView' Cal.id %}" class="btn btn-danger btn-sm">
|
||||
<i class="bi bi-trash"></i>
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-primary"> Salvar </button>
|
||||
</form>
|
||||
<a href="{% url 'BankAccountsListView' %}" class="btn btn-secondary mt-3 "> Cancelar e Voltar </a>
|
||||
<button type="button" onclick="history.back()" class="btn btn-danger">
|
||||
<i class="bi bi-arrow-left"></i> Cancelar e Voltar
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
{% extends "BaseLogin.html" %}
|
||||
{% block title %} List {% endblock %}
|
||||
{% block content %}
|
||||
<h1> Despesas </h1><br>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-3">
|
||||
<form method="get" action="{% url 'MovExpenseListView' %}" id="filterForm">
|
||||
<div class="input-group">
|
||||
<input type="date" class="date form-control" name="date"
|
||||
placeholder="Dia" value="{{ request.GET.date }}"
|
||||
onchange="document.getElementById('filterForm').submit();"
|
||||
>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{# {% if perms.brands.add_brands %}#}
|
||||
{# <div class="col-md-1">#}
|
||||
{# <a href="{% url 'MovExpenseCreateView' %}" class="btn btn-success float-end">#}
|
||||
{# <i class="bi bi-plus"></i> Criar </a>#}
|
||||
{# </div>#}
|
||||
<div class="col-md-1">
|
||||
<a href="{% url 'MovExpenseFirmCreateView' %}" class="btn btn-success float-end">
|
||||
Criar Firm</a>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<a href="{% url 'MovExpenseProfCreateView' %}" class="btn btn-success float-end">
|
||||
Criar Prof</a>
|
||||
</div>
|
||||
{# {% endif %}#}
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead class="thead-dark">
|
||||
<tr align="center">
|
||||
<th> Data </th>
|
||||
<th> Plano de Contas </th>
|
||||
<th> Banco </th>
|
||||
<th> Firma </th>
|
||||
<th> Prof </th>
|
||||
<th> Valor </th>
|
||||
<th width="15%"> Ações </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for Exp in Expenses %}
|
||||
<tr align="center">
|
||||
<td> {{ Exp.date|date:"d/m/Y" }} </td>
|
||||
<td> {{ Exp.chart_of_account }} </td>
|
||||
<td> {{ Exp.bank }} </td>
|
||||
<td> {{ Exp.firm }} </td>
|
||||
<td> {{ Exp.professional }} </td>
|
||||
<td> {{ Exp.gross_value }} </td>
|
||||
<td>
|
||||
<a href="{% url 'MovExpenseDetailView' Exp.id %}" class="btn btn-info btn-sm">
|
||||
<i class="bi bi-eye"></i>
|
||||
</a>
|
||||
{# {% if perms.brands.change_brands %}#}
|
||||
<a href="{% url 'MovExpenseUpdateView' Exp.id %}" class="btn btn-warning btn-sm">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
{# {% endif %}#}
|
||||
{# {% if perms.brands.delete_brands %}#}
|
||||
<a href="{% url 'MovExpenseDeleteView' Exp.id %}" class="btn btn-danger btn-sm">
|
||||
<i class="bi bi-trash"></i>
|
||||
</a>
|
||||
{# {% endif %}#}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% include 'components/_pagination.html' %}
|
||||
{% endblock %}
|
||||
22
Movement/templates/ExpenseOrCredit/CreateCredit.html
Normal file
22
Movement/templates/ExpenseOrCredit/CreateCredit.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{% extends "BaseLogin.html" %}
|
||||
{% block title %} Create {% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<div class="conteiner mt-4">
|
||||
<h3 class="display-6"> Despesa Do Prof. </h3>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form method="post" class="form">
|
||||
{% csrf_token %}
|
||||
{{ form.date.label }} {{ form.date }} <br><br>
|
||||
{{ form.chart_of_account.label }}<br>{{ form.chart_of_account }} <br>
|
||||
{{ form.bank.label }}<br>{{ form.bank }} <br>
|
||||
{{ form.gross_value.label }} {{ form.gross_value }} <br><br>
|
||||
<button type="submit" class="btn btn-primary"> Salvar </button>
|
||||
</form>
|
||||
{# <a href="{% url 'ProfessionalListView' %}" class="btn btn-secondary mt-3 "> Cancelar e Voltar </a>#}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
23
Movement/templates/ExpenseOrCredit/CreateProfCredit.html
Normal file
23
Movement/templates/ExpenseOrCredit/CreateProfCredit.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends "BaseLogin.html" %}
|
||||
{% block title %} Create {% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<div class="conteiner mt-4">
|
||||
<h3 class="display-6"> Despesa Do Prof. </h3>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form method="post" class="form">
|
||||
{% csrf_token %}
|
||||
{{ form.date.label }} {{ form.date }} <br><br>
|
||||
{{ form.chart_of_account.label }}<br>{{ form.chart_of_account }} <br>
|
||||
{{ form.bank.label }}<br>{{ form.bank }} <br>
|
||||
{{ form.professional.label }}<br>{{ form.professional }} <br>
|
||||
{{ form.gross_value.label }} {{ form.gross_value }} <br><br>
|
||||
<button type="submit" class="btn btn-primary"> Salvar </button>
|
||||
</form>
|
||||
{# <a href="{% url 'ProfessionalListView' %}" class="btn btn-secondary mt-3 "> Cancelar e Voltar </a>#}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
142
Movement/templates/ExpenseOrCredit/List.html
Normal file
142
Movement/templates/ExpenseOrCredit/List.html
Normal file
@@ -0,0 +1,142 @@
|
||||
{% extends "BaseLogin.html" %}
|
||||
{% block title %} List {% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<div class="container py-4">
|
||||
<form method="get" action="{% url 'MovExpenseOrCreditListView' %}" id="Form">
|
||||
<div class="row align-items-center g-3 mb-4">
|
||||
<div class="col-12 col-lg-6 d-flex align-items-center gap-3">
|
||||
<h1 class="h3 m-0 text-nowrap">
|
||||
<i class="bi bi-wallet2 text-primary me-2"></i>Despesas
|
||||
</h1>
|
||||
<div class="input-group" style="max-width: 250px;">
|
||||
<span class="input-group-text bg-transparent border-secondary text-secondary">
|
||||
<i class="bi bi-calendar3"></i>
|
||||
</span>
|
||||
<select class="form-select border-secondary bg-dark text-white" name="month" onchange="this.form.submit();">
|
||||
<option value="">Todos os meses</option>
|
||||
<option value="1" {% if request.GET.month == '1' %}selected{% endif %}>Janeiro</option>
|
||||
<option value="2" {% if request.GET.month == '2' %}selected{% endif %}>Fevereiro</option>
|
||||
<option value="3" {% if request.GET.month == '3' %}selected{% endif %}>Março</option>
|
||||
<option value="4" {% if request.GET.month == '4' %}selected{% endif %}>Abril</option>
|
||||
<option value="5" {% if request.GET.month == '5' %}selected{% endif %}>Maio</option>
|
||||
<option value="6" {% if request.GET.month == '6' %}selected{% endif %}>Junho</option>
|
||||
<option value="7" {% if request.GET.month == '7' %}selected{% endif %}>Julho</option>
|
||||
<option value="8" {% if request.GET.month == '8' %}selected{% endif %}>Agosto</option>
|
||||
<option value="9" {% if request.GET.month == '9' %}selected{% endif %}>Setembro</option>
|
||||
<option value="10" {% if request.GET.month == '10' %}selected{% endif %}>Outubro</option>
|
||||
<option value="11" {% if request.GET.month == '11' %}selected{% endif %}>Novembro</option>
|
||||
<option value="12" {% if request.GET.month == '12' %}selected{% endif %}>Dezembro</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-lg-6 text-lg-end">
|
||||
<div class="btn-group" role="group">
|
||||
<a href="{% url 'MovExpenseOrCreditFirmCreateView' %}" class="btn btn-outline-info btn-sm px-3">D. Firm</a>
|
||||
<a href="{% url 'MovExpenseOrCreditProfCreateView' %}" class="btn btn-outline-info btn-sm px-3">D. Prof</a>
|
||||
<a href="{% url 'MovExpenseOrCreditFirmCreditCreateView' %}" class="btn btn-outline-success btn-sm px-3">C. Firm</a>
|
||||
<a href="{% url 'MovExpenseOrCreditProfCreditCreateView' %}" class="btn btn-outline-success btn-sm px-3">C. Prof</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card bg-dark border-secondary mb-4">
|
||||
<div class="card-body py-2 px-3">
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-md-5 d-flex align-items-center gap-3">
|
||||
<span class="small text-secondary fw-bold text-uppercase">Tipo:</span>
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<input type="radio" class="btn-check" name="type" id="typeC" value="credit"
|
||||
{% if request.GET.type == "credit" %}checked{% endif %} onchange="this.form.submit();">
|
||||
<label class="btn btn-outline-secondary px-4" for="typeC">Crédito</label>
|
||||
|
||||
<input type="radio" class="btn-check" name="type" id="typeD" value="debit"
|
||||
{% if request.GET.type == "debit" %}checked{% endif %} onchange="this.form.submit();">
|
||||
<label class="btn btn-outline-secondary px-4" for="typeD">Débito</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-5 d-flex align-items-center gap-3 border-start border-secondary ps-4">
|
||||
<span class="small text-secondary fw-bold text-uppercase">Resp:</span>
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<input type="radio" class="btn-check" name="resp" id="resF" value="firm"
|
||||
{% if request.GET.resp == "firm" %}checked{% endif %} onchange="this.form.submit();">
|
||||
<label class="btn btn-outline-secondary px-4" for="resF">Firma</label>
|
||||
|
||||
<input type="radio" class="btn-check" name="resp" id="respP" value="prof"
|
||||
{% if request.GET.resp == "prof" %}checked{% endif %} onchange="this.form.submit();">
|
||||
<label class="btn btn-outline-secondary px-4" for="respP">Prof.</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 text-end">
|
||||
<a href="{% url 'MovExpenseOrCreditListView' %}" class="btn btn-link btn-sm text-secondary text-decoration-none">
|
||||
<i class="bi bi-x-circle me-1"></i>Limpar
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead class="thead-dark">
|
||||
<tr align="center">
|
||||
<th width="15%"> Data </th>
|
||||
<th> Plano de Contas </th>
|
||||
<th> Valor </th>
|
||||
<th width="10%"> Banco </th>
|
||||
<th width="5%"> Firma </th>
|
||||
<th width="5%"> Credito </th>
|
||||
<th width="5%"> Debito </th>
|
||||
<th width="5%"> Prof </th>
|
||||
<th> Profissimal </th>
|
||||
<th width="5%"> Ações </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for Exp in Expenses %}
|
||||
<tr align="center">
|
||||
<td> {{ Exp.date|date:"d/m/Y" }}</td>
|
||||
<td> {{ Exp.chart_of_account }} </td>
|
||||
<td> R$ {{ Exp.gross_value }} </td>
|
||||
<td> {{ Exp.bank }} </td>
|
||||
<td> {% if Exp.firm %} <i class="bi bi-check-circle-fill text-success "></i>
|
||||
{% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td>
|
||||
<td> {% if Exp.credit %} <i class="bi bi-check-circle-fill text-success "></i>
|
||||
{% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td>
|
||||
<td> {% if Exp.debit %} <i class="bi bi-check-circle-fill text-success "></i>
|
||||
{% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td>
|
||||
<td> {% if Exp.prof %} <i class="bi bi-check-circle-fill text-success "></i>
|
||||
{% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td>
|
||||
<td> {% if Exp.professional %} {{ Exp.professional }}
|
||||
{% else %} <i class="bi bi-x-circle-fill text-danger "></i> {% endif %} </td>
|
||||
<td>
|
||||
<form action="{% url 'MovExpenseOrCreditDeleteView' Exp.id %}" method="post" >
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-danger" >
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% include 'components/_pagination.html' %}
|
||||
|
||||
<form method="get" action="{% url 'MovExpenseOrCreditListView' %}" id="Form" class="">
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<label> <div class=""> Dia </div>
|
||||
<input type="date" name="date"
|
||||
{#<label> <div class=""> Dia </div>#}
|
||||
{# <input type="date" name="date"#}
|
||||
{# value="{% now 'Y-m-d' %}"#}
|
||||
{# class="date form-control"#}
|
||||
{# disabled#}
|
||||
{# >#}
|
||||
{#</label><br><br>#}
|
||||
<input type="hidden" name="date"
|
||||
value="{% now 'Y-m-d' %}"
|
||||
class="date form-control"
|
||||
>
|
||||
</label><br><br>
|
||||
>
|
||||
@@ -3,7 +3,7 @@
|
||||
{% block content %}
|
||||
|
||||
<div class="conteiner mt-4">
|
||||
<h3 class="display-6"> Cadastrar </h3>
|
||||
<h3 class="display-6"> lançar um produto </h3>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
@@ -13,14 +13,12 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">{% include 'Product/Create/client.html' %}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">{% include 'Product/Create/date.html' %}</div>
|
||||
<div class="col-md-6">{{ form.quantity.label }} <br> {{ form.quantity }} </div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">{% include 'Product/Create/product.html' %}</div>
|
||||
<div class="col-md-4">{% include 'Product/Create/pay_method.html' %}</div>
|
||||
<div class="col-md-4">{% include 'Product/Create/professional.html' %}</div>
|
||||
<div class="col-md-2">{% include 'Product/Create/product.html' %}</div>
|
||||
<div class="col-md-3">{% include 'Product/Create/pay_method.html' %}</div>
|
||||
<div class="col-md-2">{% include 'Product/Create/professional.html' %}</div>
|
||||
<div class="col-md-2">{{ form.quantity.label }} <br> {{ form.quantity }} </div>
|
||||
<div class="col-md-1">{% include 'Product/Create/date.html' %}</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"> Salvar </button>
|
||||
</form>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-primary"> Salvar </button>
|
||||
</form>
|
||||
<a href="{% url 'ProfessionalListView' %}" class="btn btn-secondary mt-3 "> Cancelar e Voltar </a>
|
||||
<a href="{% url 'BankAccountsListView' %}" class="btn btn-secondary mt-3 "> Cancelar e Voltar </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -13,6 +13,6 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a href="{% url 'ProfessionalListView' %}" class="btn btn-secondary mt-3 "> Cancelar e Voltar </a>
|
||||
<a href="{% url 'BankAccountsListView' %}" class="btn btn-secondary mt-3 "> Cancelar e Voltar </a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
15
Movement/templates/Transition/Detail.html
Normal file
15
Movement/templates/Transition/Detail.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "BaseLogin.html" %}
|
||||
{% block title %} Bank Accounts List {% endblock %}
|
||||
{% block content %}
|
||||
<div class="conteiner mt-4">
|
||||
<h3 class="display-6"> Detalhes do Banco </h3>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h3 class="card-title">{{ object.name }}</h3>
|
||||
<p class="card-text">Descrição: {{ object.description }}</p>
|
||||
{# <a href="{% url 'BrandsUpdate' object.id %}" class="btn btn-secondary mt-3 "> Editar </a>#}
|
||||
</div>
|
||||
</div>
|
||||
<a href="{% url 'BankAccountsListView' %}" class="btn btn-secondary mt-3 "> Cancelar e Voltar </a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
79
Movement/templates/Transition/List.html
Normal file
79
Movement/templates/Transition/List.html
Normal file
@@ -0,0 +1,79 @@
|
||||
{% extends "BaseLogin.html" %}
|
||||
{% block title %} List {% endblock %}
|
||||
{% block content %}
|
||||
<h1> Tranf. entre Bancos </h1><br>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-3">
|
||||
<form method="get" action="{% url 'MovTransitionListView' %}" id="filterForm">
|
||||
<div class="input-group">
|
||||
<select class="form-select" name="month" onchange="document.getElementById('filterForm').submit();">
|
||||
<option value="">Selecione o mês</option>
|
||||
<option value="1" {% if request.GET.month == '1' %}selected{% endif %}>Janeiro</option>
|
||||
<option value="2" {% if request.GET.month == '2' %}selected{% endif %}>Fevereiro</option>
|
||||
<option value="3" {% if request.GET.month == '3' %}selected{% endif %}>Março</option>
|
||||
<option value="4" {% if request.GET.month == '4' %}selected{% endif %}>Abril</option>
|
||||
<option value="5" {% if request.GET.month == '5' %}selected{% endif %}>Maio</option>
|
||||
<option value="6" {% if request.GET.month == '6' %}selected{% endif %}>Junho</option>
|
||||
<option value="7" {% if request.GET.month == '7' %}selected{% endif %}>Julho</option>
|
||||
<option value="8" {% if request.GET.month == '8' %}selected{% endif %}>Agosto</option>
|
||||
<option value="9" {% if request.GET.month == '9' %}selected{% endif %}>Setembro</option>
|
||||
<option value="10" {% if request.GET.month == '10' %}selected{% endif %}>Outubro</option>
|
||||
<option value="11" {% if request.GET.month == '11' %}selected{% endif %}>Novembro</option>
|
||||
<option value="12" {% if request.GET.month == '12' %}selected{% endif %}>Dezembro</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{# {% if perms.brands.add_brands %}#}
|
||||
<div class="col-md-6">
|
||||
<a href="{% url 'MovTransitionCreateView' %}" class="btn btn-success float-end">
|
||||
<i class="bi bi-plus"></i> Criar </a>
|
||||
</div>
|
||||
{# {% endif %}#}
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead class="thead-dark">
|
||||
<tr align="center">
|
||||
{# <th> ID </th>#}
|
||||
<th> Data </th>
|
||||
<th> Entrada </th>
|
||||
<th> Saida </th>
|
||||
<th > Valor </th>
|
||||
<th width="15%"> Ações </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for Bank in Transitions %}
|
||||
<tr align="center">
|
||||
{# <td> {{ Bank.id }} </td>#}
|
||||
<td> {{ Bank.date|date:"d/m/Y" }} </td>
|
||||
<td> {{ Bank.bank_credit }} </td>
|
||||
<td> {{ Bank.bank_debit }} </td>
|
||||
<td> {{ Bank.gross_value }} </td>
|
||||
<td>
|
||||
<a href="{% url 'MovTransitionDetailView' Bank.id %}" class="btn btn-info btn-sm">
|
||||
<i class="bi bi-eye"></i>
|
||||
</a>
|
||||
{# {% if perms.brands.change_brands %}#}
|
||||
<a href="{% url 'MovTransitionUpdateView' Bank.id %}" class="btn btn-warning btn-sm">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
{# {% endif %}#}
|
||||
{# {% if perms.brands.delete_brands %}#}
|
||||
<a href="{% url 'MovTransitionDeleteView' Bank.id %}" class="btn btn-danger btn-sm">
|
||||
<i class="bi bi-trash"></i>
|
||||
</a>
|
||||
{# {% endif %}#}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% include 'components/_pagination.html' %}
|
||||
{% endblock %}
|
||||
17
Movement/templates/Transition/Update.html
Normal file
17
Movement/templates/Transition/Update.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{% extends "BaseLogin.html" %}
|
||||
{% block title %} Bank Accounts List {% endblock %}
|
||||
{% block content %}
|
||||
<div class="conteiner mt-4">
|
||||
<h3 class="display-6"> Editar Bancos </h3>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form method="post" class="form">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-primary"> Salvar </button>
|
||||
</form>
|
||||
<a href="{% url 'BankAccountsListView' %}" class="btn btn-secondary mt-3 "> Cancelar e Voltar </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user