Merge pull request 'dealer default invoice settings and account related updates and few changes to the dashboards' (#252) from frontend into main

Reviewed-on: #252
This commit is contained in:
ismail 2025-09-11 17:54:09 +03:00
commit a2a60c249c
10 changed files with 184 additions and 119 deletions

View File

@ -3416,6 +3416,8 @@ class DealerSettings(models.Model):
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Cash account to track cash transactions when an invoice is created."),
verbose_name=_("Invoice Cash Account"),
)
invoice_prepaid_account = models.ForeignKey(
AccountModel,
@ -3423,6 +3425,8 @@ class DealerSettings(models.Model):
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Prepaid Revenue account to track prepaid revenue when an invoice is created."),
verbose_name=_("Invoice Prepaid Account"),
)
invoice_unearned_account = models.ForeignKey(
AccountModel,
@ -3430,6 +3434,54 @@ class DealerSettings(models.Model):
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Unearned Revenue account to track unearned revenue when an invoice is created."),
verbose_name=_("Invoice Unearned Account"),
)
invoice_tax_payable_account = models.ForeignKey(
AccountModel,
related_name="invoice_tax_payable",
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Tax Payable account to track tax liabilities when an invoice is created."),
verbose_name=_("Invoice Tax Payable Account"),
)
invoice_vehicle_sale_account = models.ForeignKey(
AccountModel,
related_name="invoice_vehicle_sale",
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Vehicle Sales account to track vehicle sales revenue when an invoice is created."),
verbose_name=_("Invoice Vehicle Sale Account"),
)
invoice_additional_services_account = models.ForeignKey(
AccountModel,
related_name="invoice_additional_services",
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Additional Services account to track additional services revenue when an invoice is created."),
verbose_name=_("Invoice Additional Services Account"),
)
invoice_cost_of_good_sold_account = models.ForeignKey(
AccountModel,
related_name="invoice_cost_of_good_sold",
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Cost of Goods Sold account to track the cost of goods sold when an invoice is created."),
verbose_name=_("Invoice Cost of Goods Sold Account"),
)
invoice_inventory_account = models.ForeignKey(
AccountModel,
related_name="invoice_inventory",
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Inventory account to track the cost of goods sold when an invoice is created."),
verbose_name=_("Invoice Inventory Account"),
)
bill_cash_account = models.ForeignKey(
@ -3438,6 +3490,8 @@ class DealerSettings(models.Model):
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Cash account to track cash transactions when a bill is created."),
verbose_name=_("Bill Cash Account"),
)
bill_prepaid_account = models.ForeignKey(
AccountModel,
@ -3445,6 +3499,8 @@ class DealerSettings(models.Model):
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Prepaid account to track prepaid expenses when a bill is created."),
verbose_name=_("Bill Prepaid Account"),
)
bill_unearned_account = models.ForeignKey(
AccountModel,
@ -3452,9 +3508,11 @@ class DealerSettings(models.Model):
on_delete=models.SET_NULL,
null=True,
blank=True,
help_text=_("Unearned account to track unearned expenses when a bill is created."),
verbose_name=_("Bill Unearned Account"),
)
additional_info = models.JSONField(default=dict, null=True, blank=True)
additional_info = models.JSONField(default=dict, null=True, blank=True, help_text=_("Additional information"))
def __str__(self):
return f"Settings for {self.dealer}"

View File

@ -311,8 +311,8 @@ def create_item_model(sender, instance, created, **kwargs):
instance.item_model = inventory
instance.save()
if instance.marked_price:
instance.item_model.default_amount = instance.marked_price
if instance.cost_price:
instance.item_model.default_amount = instance.cost_price
instance.item_model.save()
# inventory = entity.create_item_inventory(
@ -813,7 +813,7 @@ def create_dealer_settings(sender, instance, created, **kwargs):
# entity = instance.entity
# coa = entity.get_default_coa()
# for make in models.CarMake.objects.all():
# for make in models. ke.objects.all():
# last_account = entity.get_all_accounts().filter(role=roles.ASSET_CA_RECEIVABLES).order_by('-created').first()
# if len(last_account.code) == 4:
# code = f"{int(last_account.code)}{1:03d}"
@ -824,7 +824,7 @@ def create_dealer_settings(sender, instance, created, **kwargs):
# code=code,
# role=roles.ASSET_CA_RECEIVABLES,
# coa_model=coa,
# balance_type="credit",
# balance_type="credit",b vgbvf vh cbgl;;;
# active=True
# )

View File

@ -1598,44 +1598,23 @@ def _post_sale_and_cogs(invoice, dealer):
# calc = CarFinanceCalculator(invoice)
data = get_finance_data(invoice, dealer)
car = data.get("car")
cash_acc = (
entity.get_default_coa_accounts()
.filter(role_default=True, role=roles.ASSET_CA_CASH)
.first()
)
ar_acc = (
entity.get_default_coa_accounts()
.filter(role_default=True, role=roles.ASSET_CA_RECEIVABLES)
.first()
)
vat_acc = (
entity.get_default_coa_accounts()
.filter(role_default=True, role=roles.LIABILITY_CL_TAXES_PAYABLE)
.first()
)
car_rev = (
entity.get_default_coa_accounts()
.filter(role_default=True, role=roles.INCOME_OPERATIONAL)
.first()
)
add_rev = entity.get_default_coa_accounts().filter(code="4020").first()
cogs_acc = (
entity.get_default_coa_accounts()
.filter(role_default=True, role=roles.COGS)
.first()
)
inv_acc = (
entity.get_default_coa_accounts()
.filter(role_default=True, role=roles.ASSET_CA_INVENTORY)
.first()
)
# for car_data in data['cars']:
# car = invoice.get_itemtxs_data()[0].filter(
# item_model__car__vin=car_data['vin']
# ).first().item_model.car
# qty = Decimal(car_data['quantity'])
# cash_acc = (
# entity.get_default_coa_accounts()
# .filter(role_default=True, role=roles.ASSET_CA_CASH)
# .first()
# )
cash_acc = invoice.cash_account or dealer.settings.invoice_cash_account
vat_acc = dealer.settings.invoice_tax_payable_account or entity.get_default_coa_accounts().filter(role_default=True, role=roles.LIABILITY_CL_TAXES_PAYABLE).first()
car_rev = dealer.settings.invoice_vehicle_sale_account or entity.get_default_coa_accounts().filter(role_default=True, role=roles.INCOME_OPERATIONAL).first()
add_rev = dealer.settings.invoice_additional_services_account
cogs_acc = dealer.settings.invoice_cost_of_good_sold_account or entity.get_default_coa_accounts().filter(role_default=True, role=roles.COGS).first()
inv_acc = dealer.settings.invoice_inventory_account or entity.get_default_coa_accounts().filter(role_default=True, role=roles.ASSET_CA_INVENTORY).first()
net_car_price = Decimal(data["discounted_price"])
net_additionals_price = Decimal(data["additional_services"]["total"])
vat_amount = Decimal(data["vat_amount"])
@ -1663,23 +1642,6 @@ def _post_sale_and_cogs(invoice, dealer):
description="Debit to Cash on Hand",
)
# # Cr A/R (clear the receivable)
# TransactionModel.objects.create(
# journal_entry=je_sale,
# account=ar_acc,
# amount=grand_total,
# tx_type='credit'
# )
# Cr VAT Payable
TransactionModel.objects.create(
journal_entry=je_sale,
account=vat_acc,
amount=vat_amount,
tx_type="credit",
description="Credit to Tax Payable",
)
# Cr Sales Car
TransactionModel.objects.create(
journal_entry=je_sale,
@ -1689,22 +1651,43 @@ def _post_sale_and_cogs(invoice, dealer):
description=" Credit to Car Sales",
)
# Cr VAT Payable
TransactionModel.objects.create(
journal_entry=je_sale,
account=vat_acc,
amount=vat_amount + car.get_additional_services_vat,
tx_type="credit",
description="Credit to Tax Payable",
)
# # Cr A/R (clear the receivable)
# TransactionModel.objects.create(
# journal_entry=je_sale,
# account=ar_acc,
# amount=grand_total,
# tx_type='credit'
# )
if car.get_additional_services_amount > 0:
# Cr Sales Additional Services
TransactionModel.objects.create(
journal_entry=je_sale,
account=add_rev,
amount=car.get_additional_services_amount,
tx_type="credit",
description="Credit to After-Sales Services",
)
TransactionModel.objects.create(
journal_entry=je_sale,
account=vat_acc,
amount=car.get_additional_services_vat,
tx_type="credit",
description="Credit to Tax Payable (Additional Services)",
)
if not add_rev:
logger.warning(f"Additional Services account not set for dealer {dealer}. Skipping additional services revenue entry.")
else:
TransactionModel.objects.create(
journal_entry=je_sale,
account=add_rev,
amount=car.get_additional_services_amount,
tx_type="credit",
description="Credit to After-Sales Services",
)
# TransactionModel.objects.create(
# journal_entry=je_sale,
# account=vat_acc,
# amount=car.get_additional_services_vat,
# tx_type="credit",
# description="Credit to Tax Payable (Additional Services)",
# )
# ------------------------------------------------------------------
# 2B. Journal: COGS / Inventory reduction

View File

@ -503,9 +503,7 @@ def general_dashboard(request,dealer_slug):
total_vat_collected_from_services = sum([car.get_additional_services()['services_vat'] for car in cars_sold_filtered])
total_vat_collected = total_vat_collected_from_cars + total_vat_collected_from_services
total_revenue_generated = total_revenue_from_cars + total_revenue_from_services
expenses = models.ItemModel.objects.filter(entity__admin__dealer=dealer, item_role='expense')
total_expenses = expenses.aggregate(total=Sum('default_amount'))['total'] or 0
total_expenses=sum([x.amount_paid for x in dealer.entity.get_bills().filter(bill_items__item_role="expense")])
gross_profit = net_profit_from_cars - total_expenses
# ----------------------------------------------------
@ -4201,7 +4199,7 @@ class BankAccountCreateView(
def get_form(self, form_class=None):
dealer = get_object_or_404(models.Dealer, slug=self.kwargs["dealer_slug"])
form = super().get_form(form_class)
account_qs = dealer.entity.get_default_coa_accounts().filter(
account_qs = dealer.entity.get_get_default_coa_accounts().filter(
role__in=[
roles.ASSET_CA_CASH,
roles.LIABILITY_CL_ACC_PAYABLE,
@ -4296,7 +4294,7 @@ class BankAccountUpdateView(
def get_form(self, form_class=None):
dealer = get_object_or_404(models.Dealer, slug=self.kwargs["dealer_slug"])
form = super().get_form(form_class)
account_qs = dealer.entity.get_default_coa_accounts().filter(
account_qs = dealer.entity.get_get_default_coa_accounts().filter(
role__in=[
roles.ASSET_CA_CASH,
roles.LIABILITY_CL_ACC_PAYABLE,
@ -9221,27 +9219,47 @@ def DealerSettingsView(request, slug):
form = forms.DealerSettingsForm(instance=dealer_setting, initial={"dealer": dealer})
form.fields[
"invoice_cash_account"
].queryset = dealer.entity.get_all_accounts().filter(role=roles.ASSET_CA_CASH)
].queryset = dealer.entity.get_default_coa_accounts().filter(role=roles.ASSET_CA_CASH)
form.fields[
"invoice_prepaid_account"
].queryset = dealer.entity.get_all_accounts().filter(
].queryset = dealer.entity.get_default_coa_accounts().filter(
role=roles.ASSET_CA_RECEIVABLES
)
form.fields[
"invoice_unearned_account"
].queryset = dealer.entity.get_all_accounts().filter(
].queryset = dealer.entity.get_default_coa_accounts().filter(
role=roles.LIABILITY_CL_DEFERRED_REVENUE
)
form.fields[
"invoice_tax_payable_account"
].queryset = dealer.entity.get_default_coa_accounts().filter(
role=roles.LIABILITY_CL_TAXES_PAYABLE
)
form.fields[
"invoice_vehicle_sale_account"
].queryset = dealer.entity.get_default_coa_accounts().filter(
role=roles.INCOME_OPERATIONAL
)
form.fields[
"invoice_cost_of_good_sold_account"
].queryset = dealer.entity.get_default_coa_accounts().filter(
role=roles.COGS
)
form.fields[
"invoice_inventory_account"
].queryset = dealer.entity.get_default_coa_accounts().filter(
role=roles.ASSET_CA_INVENTORY
)
form.fields["bill_cash_account"].queryset = dealer.entity.get_all_accounts().filter(
form.fields["bill_cash_account"].queryset = dealer.entity.get_default_coa_accounts().filter(
role=roles.ASSET_CA_CASH
)
form.fields[
"bill_prepaid_account"
].queryset = dealer.entity.get_all_accounts().filter(role=roles.ASSET_CA_PREPAID)
].queryset = dealer.entity.get_default_coa_accounts().filter(role=roles.ASSET_CA_PREPAID)
form.fields[
"bill_unearned_account"
].queryset = dealer.entity.get_all_accounts().filter(
].queryset = dealer.entity.get_default_coa_accounts().filter(
role=roles.LIABILITY_CL_ACC_PAYABLE
)
return render(request, "account/user_settings.html", {"form": form})

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 KiB

View File

@ -24,12 +24,18 @@
{{ form.invoice_cash_account|as_crispy_field }}
{{ form.invoice_prepaid_account|as_crispy_field }}
{{ form.invoice_unearned_account|as_crispy_field }}
{{ form.invoice_tax_payable_account|as_crispy_field }}
{{ form.invoice_vehicle_sale_account|as_crispy_field }}
{{ form.invoice_additional_services_account|as_crispy_field }}
{{ form.invoice_cost_of_good_sold_account|as_crispy_field }}
{{ form.invoice_inventory_account|as_crispy_field }}
</div>
<div class="col-12 mt-4">
<h4 class="mb-4 text-center">{% trans 'Default Bill Accounts' %}</h4>
{{ form.bill_cash_account|as_crispy_field }}
{{ form.bill_prepaid_account|as_crispy_field }}
{{ form.bill_unearned_account|as_crispy_field }}
</div>
</div>
<hr class="my-4">

View File

@ -20,7 +20,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Total Revenue from Cars" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_revenue_from_cars|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_revenue_from_cars|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -30,7 +30,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Net Profit from Cars" %}</p>
<h4 class="fw-bolder text-success mb-3">
{{ net_profit_from_cars|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ net_profit_from_cars|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -50,7 +50,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Total Cost of Cars Sold" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_cost_of_cars_sold|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_cost_of_cars_sold|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -60,7 +60,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Total VAT from Cars" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_vat_collected_from_cars|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_vat_collected_from_cars|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -81,7 +81,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "New Cars Revenue" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_revenue_from_new_cars|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_revenue_from_new_cars|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -91,7 +91,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "New Cars Net Profit" %}</p>
<h4 class="fw-bolder text-success mb-3">
{{ net_profit_from_new_cars|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ net_profit_from_new_cars|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -101,7 +101,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "New Cars VAT" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_vat_collected_from_new_cars|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_vat_collected_from_new_cars|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -111,7 +111,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "New Cars Cost" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_cost_of_new_cars_sold|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_cost_of_new_cars_sold|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -132,7 +132,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Used Cars Revenue" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_revenue_from_used_cars|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_revenue_from_used_cars|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -142,7 +142,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Used Cars Net Profit" %}</p>
<h4 class="fw-bolder text-success mb-3">
{{ net_profit_from_used_cars|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ net_profit_from_used_cars|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -152,7 +152,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Used Cars VAT" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_vat_collected_from_used_cars|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_vat_collected_from_used_cars|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -162,7 +162,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Used Cars Cost" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_cost_of_used_cars_sold|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_cost_of_used_cars_sold|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -185,7 +185,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Total Inventory Value" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_inventory_value|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_inventory_value|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -211,7 +211,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "New Cars Inventory Value" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ new_car_value|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ new_car_value|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -221,7 +221,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Used Cars Inventory Value" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ used_car_value|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ used_car_value|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -254,7 +254,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Total Revenue from Services" %}</p>
<h4 class="fw-bolder text-info mb-3">
{{ total_revenue_from_services|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_revenue_from_services|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -264,7 +264,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Total VAT from Services" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_vat_collected_from_services|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_vat_collected_from_services|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -274,7 +274,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Total Revenue Generated" %}</p>
<h4 class="fw-bolder text-success mb-3">
{{ total_revenue_generated|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_revenue_generated|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -284,7 +284,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Total VAT Collected" %}</p>
<h4 class="fw-bolder text-primary mb-3">
{{ total_vat_collected|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_vat_collected|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -294,7 +294,7 @@
<div class="card-body p-4">
<p class="text-uppercase text-muted fw-bold small mb-1">{% trans "Total Expenses" %}</p>
<h4 class="fw-bolder text-danger mb-3">
{{ total_expenses|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ total_expenses|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
</div>
@ -306,11 +306,11 @@
{% if gross_profit|is_negative %}
<h4 class="fw-bolder text-danger mb-3">
{{ gross_profit|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ gross_profit|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
{% else %}
<h4 class="fw-bolder text-success mb-3">
{{ gross_profit|floatformat:2 }}<span class="icon-saudi_riyal"></span>
{{ gross_profit|floatformat:'2g' }}<span class="icon-saudi_riyal"></span>
</h4>
{% endif %}
</div>

View File

@ -51,9 +51,9 @@
href="{% url 'item_expense_update' request.dealer.slug expense.pk %}">
<i class="fa fa-edit me-2"></i>{% trans "Update" %}
</a>
{% comment %} <a class="text-danger dropdown-item" href="#">
<i class="fa fa-trash me-2"></i>{% trans "Delete" %}
</a> {% endcomment %}
<a class="text-info dropdown-item" href="{% url 'bill-create' request.dealer.slug request.entity.slug %}">
<i class="fa fa-plus me-2"></i>{% trans "Create Expense Bill" %}
</a>
</div>
</div>
{% endif %}

View File

@ -121,7 +121,7 @@
<span>{% trans 'Total Revenue from Cars' %}<span class="icon-saudi_riyal"></span></span>
</h5>
<p class="card-text">
<span>{{ total_revenue_from_cars|floatformat:2 }} <span class="icon-saudi_riyal"></span></span>
<span>{{ total_revenue_from_cars|floatformat:'2g' }} <span class="icon-saudi_riyal"></span></span>
</p>
</div>
</div>
@ -133,7 +133,7 @@
<span>{% trans 'Total Revenue from Services' %}<span class="icon-saudi_riyal"></span></span>
</h5>
<p class="card-text">
<span>{{ total_revenue_from_additonals|floatformat:2 }} <span class="icon-saudi_riyal"></span></span>
<span>{{ total_revenue_from_additonals|floatformat:'2g' }} <span class="icon-saudi_riyal"></span></span>
</p>
</div>
</div>
@ -145,7 +145,7 @@
<span>{% trans 'Total Revenue' %}<span class="icon-saudi_riyal"></span></span>
</h5>
<p class="card-text">
<span>{{ total_revenue_collected|floatformat:2 }} <span class="icon-saudi_riyal"></span></span>
<span>{{ total_revenue_collected|floatformat:'2g' }} <span class="icon-saudi_riyal"></span></span>
</p>
</div>
</div>
@ -157,7 +157,7 @@
{% trans 'Total VAT from Cars' %}<i class="fas fa-percent ms-2"></i>
</h5>
<p class="card-text">
<span>{{ total_vat_on_cars|floatformat:2 }} <span class="icon-saudi_riyal"></span></span>
<span>{{ total_vat_on_cars|floatformat:'2g' }} <span class="icon-saudi_riyal"></span></span>
</p>
</div>
</div>
@ -169,7 +169,7 @@
{% trans 'Total VAT from Services' %}<i class="fas fa-percent ms-2"></i>
</h5>
<p class="card-text">
<span>{{ total_vat_from_additonals|floatformat:2 }} <span class="icon-saudi_riyal"></span></span>
<span>{{ total_vat_from_additonals|floatformat:'2g' }} <span class="icon-saudi_riyal"></span></span>
</p>
</div>
</div>
@ -181,7 +181,7 @@
{% trans 'Total VAT' %}<i class="fas fa-percent ms-2"></i>
</h5>
<p class="card-text">
<span>{{ total_vat_collected|floatformat:2 }} <span class="icon-saudi_riyal"></span></span>
<span>{{ total_vat_collected|floatformat:'2g' }} <span class="icon-saudi_riyal"></span></span>
</p>
</div>
</div>
@ -193,7 +193,7 @@
{% trans 'Total Discount Amount' %}<i class="fas fa-tag ms-2"></i>
</h5>
<p class="card-text">
<span>{{ total_discount|floatformat:2 }} <span class="icon-saudi_riyal"></span></span>
<span>{{ total_discount|floatformat:'2g' }} <span class="icon-saudi_riyal"></span></span>
</p>
</div>
</div>

View File

@ -75,7 +75,7 @@
<h5 class="card-title">
{% trans 'Total Purchase Amount' %}<span class="fas fa-money-bill ms-2"></span>
</h5>
<p class="card-text">{{ total_po_amount }}</p>
<p class="card-text">{{ total_po_amount|floatformat:'2g' }}</p>
</div>
</div>
</div>