diff --git a/inventory/__pycache__/views.cpython-311.pyc b/inventory/__pycache__/views.cpython-311.pyc index 5e9e0822..38d47dd9 100644 Binary files a/inventory/__pycache__/views.cpython-311.pyc and b/inventory/__pycache__/views.cpython-311.pyc differ diff --git a/inventory/templatetags/__pycache__/custom_filters.cpython-311.pyc b/inventory/templatetags/__pycache__/custom_filters.cpython-311.pyc index a6cb025f..9c078ef4 100644 Binary files a/inventory/templatetags/__pycache__/custom_filters.cpython-311.pyc and b/inventory/templatetags/__pycache__/custom_filters.cpython-311.pyc differ diff --git a/inventory/templatetags/custom_filters.py b/inventory/templatetags/custom_filters.py index 93e3ff05..69570a5c 100644 --- a/inventory/templatetags/custom_filters.py +++ b/inventory/templatetags/custom_filters.py @@ -2,6 +2,7 @@ from random import randint from django import template from calendar import month_abbr from django.urls import reverse +from django.utils.formats import number_format from django_ledger.io.io_core import get_localdate,validate_activity from django.conf import settings from django.utils.translation import get_language @@ -352,4 +353,10 @@ def date_picker(context, nav_url=None, date_picker_id=None): @register.filter def splitlines(value): """Splits text into lines""" - return value.splitlines() \ No newline at end of file + return value.splitlines() + +@register.filter(name='currency_format') +def currency_format(value): + if not value: + value = 0.00 + return number_format(value, decimal_pos=2, use_l10n=True, force_grouping=True) \ No newline at end of file diff --git a/inventory/views.py b/inventory/views.py index 08f9fd8f..ccbd3e2f 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -1280,15 +1280,14 @@ class CustomerDetailView(LoginRequiredMixin, DetailView): dealer = get_user_type(self.request) entity = dealer.entity context = super().get_context_data(**kwargs) - # customer = f"{context['customer'].first_name} {context['customer'].middle_name} {context['customer'].last_name}" - # context["estimates"] = entity.get_estimates().filter( - # customer__customer_name=name - # ) + estimates = entity.get_estimates().filter(customer=self.object) invoices = entity.get_invoices().filter(customer=self.object) + # txs = entity. transactions(customer=self.object) total = estimates.count() + invoices.count() context["estimates"] = estimates context["invoices"] = invoices + # context["txs"] = txs context["total"] = total @@ -2632,6 +2631,7 @@ def account_delete(request, pk): # Sales list +@login_required def sales_list_view(request): dealer = get_user_type(request) entity = dealer.entity diff --git a/templates/customers/note_form.html b/templates/customers/note_form.html index 19cd30fe..6e829d3c 100644 --- a/templates/customers/note_form.html +++ b/templates/customers/note_form.html @@ -1,11 +1,7 @@ {% load i18n static crispy_forms_filters %} - -
- + {% csrf_token %} {{ form|crispy }} - - - -
\ No newline at end of file + + \ No newline at end of file diff --git a/templates/customers/view_customer.html b/templates/customers/view_customer.html index cb3ad776..c6bcd194 100644 --- a/templates/customers/view_customer.html +++ b/templates/customers/view_customer.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load i18n static crispy_forms_filters%} +{% load i18n static crispy_forms_filters custom_filters%} {% block title %}{{ _("View Customer") }}{% endblock title %} @@ -41,7 +41,7 @@
-

{{ customer.additional_info }}

+

{{ customer.customer_name }}

{{ customer.created|timesince}}

@@ -105,30 +105,51 @@
-

{{ _("Cars") }} ({{ total }})

+

{{ _("Related") }} ({{ total }})

- - - - - - + + + + + - +{% for estimate in estimates %} - - - - - - + + + + + - +{% endfor %}
ORDERTOTALPAYMENT STATUSFULFILMENT STATUSDELIVERY TYPEDATE{% trans 'Type'|upper %}{% trans 'Total'|upper %}{% trans 'Payment Status'|upper %}{% trans 'Fulfilment Status'|upper %}{% trans 'Date'|upper %}
#2453$87PaidOrder FulfilledCash on deliveryDec 12, 12:56 PM +

{{ estimate.estimate_number }}

+
{{ estimate.revenue_estimate|currency_format }} + + Paid + + + + {% if estimate.status == 'draft' %} + {% trans "Draft" %} + {% elif estimate.status == 'in_review' %} + {% trans "In Review" %} + {% elif estimate.status == 'approved' %} + {% trans "Approved" %} + {% elif estimate.status == 'declined' %} + {% trans "Declined" %} + {% elif estimate.status == 'canceled' %} + {% trans "Canceled" %} + {% elif estimate.status == 'completed' %} + {% trans "Completed" %} + {% elif estimate.status == 'void' %} + {% trans "Void" %} + {% endif %} + {{ estimate.created }}
@@ -138,7 +159,7 @@
diff --git a/templates/dashboards/manager.html b/templates/dashboards/manager.html index a6b5f1d0..28b6a58a 100644 --- a/templates/dashboards/manager.html +++ b/templates/dashboards/manager.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load i18n static %} +{% load i18n static custom_filters %} {% block content %} @@ -132,7 +132,7 @@
-

{{ total_selling_price }} {{ CURRENCY }}

+

{{ total_selling_price|currency_format }} {{ CURRENCY }}

@@ -147,7 +147,7 @@
-

{{ total_profit }} {{ CURRENCY }}

+

{{ total_profit|currency_format }} {{ CURRENCY }}

diff --git a/templates/ledger/reports/dashboard-copy.html b/templates/ledger/reports/dashboard-copy.html index a24843dd..4a61e25b 100644 --- a/templates/ledger/reports/dashboard-copy.html +++ b/templates/ledger/reports/dashboard-copy.html @@ -5,7 +5,6 @@ {% block content %}
-
diff --git a/templates/sales/estimates/estimate_detail.html b/templates/sales/estimates/estimate_detail.html index 3cc9e502..6a59290c 100644 --- a/templates/sales/estimates/estimate_detail.html +++ b/templates/sales/estimates/estimate_detail.html @@ -183,7 +183,7 @@ {% trans "Discount Amount" %} - - {{data.total_discount}} + - {{data.total_discount}} @@ -192,11 +192,11 @@ {% for service in data.additionals %} + {{service.name}} - {{service.total}}
{% endfor %} - + {% trans "Grand Total" %} - + {{data.grand_total}}