Merge pull request 'small fix' (#255) from frontend into main

Reviewed-on: #255
This commit is contained in:
ismail 2025-09-11 20:55:37 +03:00
commit 35942e2b3c
18 changed files with 65 additions and 45 deletions

View File

@ -505,7 +505,7 @@ def general_dashboard(request,dealer_slug):
total_revenue_generated = total_revenue_from_cars + total_revenue_from_services
# total_expenses=sum([x.amount_paid for x in dealer.entity.get_bills().filter(bill_items__item_role="expense")])
total_expenses=dealer.entity.get_bills().filter(bill_items__item_role="expense").aggregate(total=Sum('amount_paid'))['total'] or 0
gross_profit = net_profit_from_cars - total_expenses
gross_profit = net_profit_from_cars+total_revenue_from_services - total_expenses
# ----------------------------------------------------
# 4. Chart Data Aggregation

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 KiB

View File

@ -3,6 +3,7 @@
{% load static %}
{% load django_ledger %}
{% load custom_filters %}
{% load tenhal_tag %}
{% block title %}{% trans "Bill Details" %}{% endblock %}
{% block content %}
<div class="row mt-4">
@ -24,7 +25,7 @@
{% endif %}
</h6>
<h4 class="mb-0" id="djl-bill-detail-amount-paid">
{% currency_symbol %}{{ bill.get_amount_cash | absolute | currency_format }}
{{ bill.get_amount_cash | absolute | currency_format }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
{% if bill.accrue %}
@ -39,7 +40,7 @@
{% endif %}
</h6>
<h4 class="text-success mb-0" id="djl-bill-detail-amount-prepaid">
{% currency_symbol %}{{ bill.get_amount_prepaid | currency_format }}
{{ bill.get_amount_prepaid | currency_format }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
<div class="col-12 col-md-3">
@ -53,18 +54,18 @@
{% endif %}
</h6>
<h4 class="text-danger mb-0" id="djl-bill-detail-amount-unearned">
{% currency_symbol %}{{ bill.get_amount_unearned | currency_format }}
{{ bill.get_amount_unearned | currency_format }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
<div class="col-12 col-md-3">
<h6 class="text-uppercase text-xs text-muted mb-2">{% trans 'Accrued' %} {{ bill.get_progress | percentage }}</h6>
<h4 class="mb-0">{% currency_symbol %}{{ bill.get_amount_earned | currency_format }}</h4>
<h4 class="mb-0">{{ bill.get_amount_earned | currency_format }}<span class="icon-saudi_riyal"></span></h4>
</div>
{% else %}
<div class="col-12 col-md-3 offset-md-6">
<h6 class="text-uppercase text-xs text-muted mb-2">{% trans 'You Still Owe' %}</h6>
<h4 class="text-danger mb-0" id="djl-bill-detail-amount-owed">
{% currency_symbol %}{{ bill.get_amount_open | currency_format }}
{{ bill.get_amount_open | currency_format }}<span class="icon-saudi_riyal"></span>
</h4>
</div>
{% endif %}
@ -109,13 +110,13 @@
</span>
</td>
<td class="align-middle white-space-nowrap">
<span class="text-xs font-weight-bold">{{ bill_item.unit_cost | currency_format }}</span>
<span class="text-xs font-weight-bold">{{ bill_item.unit_cost | currency_format }}<span class="icon-saudi_riyal"></span></span>
</td>
<td class="align-middle white-space-nowrap">
<span class="text-xs font-weight-bold">{{ bill_item.quantity }}</span>
</td>
<td class="align-middle white-space-nowrap">
<span class="text-xs font-weight-bold">{{ bill_item.total_amount | currency_format }}</span>
<span class="text-xs font-weight-bold">{{ bill_item.total_amount | currency_format }}<span class="icon-saudi_riyal"></span></span>
</td>
<td class="align-items-start white-space-nowrap pe-2">
{% if bill_item.po_model_id %}
@ -137,7 +138,7 @@
<strong>{% trans 'Total' %}</strong>
</td>
<td class="text-end">
<strong>{% currency_symbol %}{{ total_amount__sum | currency_format }}</strong>
<strong>{{ total_amount__sum | currency_format }}<span class="icon-saudi_riyal"></span></strong>
</td>
<td></td>
</tr>

View File

@ -33,10 +33,10 @@
</div>
<div class="mb-4">
<p class="text-danger fw-bold mb-1">
{% trans 'Amount Due' %}: {% currency_symbol %}{{ bill.get_amount_open | currency_format }}
{% trans 'Amount Due' %}:&nbsp;{{ bill.get_amount_open | currency_format }}<span class="icon-saudi_riyal"></span>
</p>
<p class="text-success mb-1">
{% trans 'Amount Paid' %}: {% currency_symbol %}{{ bill.amount_paid | currency_format }}
{% trans 'Amount Paid' %}:&nbsp; {{ bill.amount_paid | currency_format }}<span class="icon-saudi_riyal"></span>
</p>
<p class="mb-1">{% trans 'Progress' %}: {{ bill.get_progress | percentage }}</p>
<div class="progress mt-2">
@ -116,7 +116,7 @@
<div class="border-bottom pb-2 mb-4">
<p class="mb-2">
<span class="fw-bold">{% trans 'Amount Due' %}:</span>
{% currency_symbol %}{{ bill.amount_due | currency_format }}
{{ bill.amount_due | currency_format }}<span class="icon-saudi_riyal"></span>
</p>
<p class="mb-2">
<span class="fw-bold">{% trans 'Due Date' %}:</span>
@ -178,7 +178,7 @@
<div class="border-bottom pb-2 mb-4">
<p class="mb-2">
<span class="fw-bold">{% trans 'Amount Paid' %}:</span>
{% currency_symbol %}{{ bill.amount_paid | currency_format }}
{{ bill.amount_paid | currency_format }}<span class="icon-saudi_riyal"></span>
</p>
<p class="mb-0">
<span class="fw-bold">{% trans 'Paid Date' %}:</span>
@ -192,7 +192,7 @@
<div class="border-bottom pb-2 mb-4">
<p class="mb-2">
<span class="fw-bold">{% trans 'Bill Amount' %}:</span>
{% currency_symbol %}{{ bill.amount_due | currency_format }}
{{ bill.amount_due | currency_format }}<span class="icon-saudi_riyal"></span>
</p>
<p class="text-danger fw-bold">{{ bill.get_bill_status_display | upper }}</p>
</div>

View File

@ -61,7 +61,7 @@
<td class="text-center">
{% if f.instance.po_total_amount %}
<div class="d-flex flex-column">
<span class="text-xs font-weight-bold">{% currency_symbol %}{{ f.instance.po_total_amount | currency_format }}</span>
<span class="text-xs font-weight-bold">{{ f.instance.po_total_amount | currency_format }}<span class="icon-saudi_riyal"></span></span>
<a class="btn btn-sm btn-phoenix-info mt-1"
href="{% url 'purchase_order_detail' dealer_slug entity_slug f.instance.po_model_id %}">
{% trans 'View PO' %}
@ -82,7 +82,7 @@
<!-- Total Amount -->
<td class="text-end">
<span class="text-xs font-weight-bold">
<span>{% currency_symbol %}</span>{{ f.instance.total_amount | currency_format }}
<span></span>{{ f.instance.total_amount | currency_format }}<span class="icon-saudi_riyal"></span>
</span>
</td>
<!-- Delete Checkbox -->
@ -100,7 +100,7 @@
<strong>{% trans 'Total' %}</strong>
</td>
<td class="text-end">
<strong>{% currency_symbol %}{{ total_amount__sum | currency_format }}</strong>
<strong>{{ total_amount__sum | currency_format }}<span class="icon-saudi_riyal"></span></strong>
</td>
<td></td>
</tr>

View File

@ -21,8 +21,8 @@
<td>{{ bill.get_bill_status_display }}</td>
<td>{{ bill.get_status_action_date }}</td>
<td>{{ bill.vendor.vendor_name }}</td>
<td id="{{ bill.get_html_amount_due_id }}">{% currency_symbol %}{{ bill.amount_due | currency_format }}</td>
<td id="{{ bill.get_html_amount_paid_id }}">{% currency_symbol %}{{ bill.amount_paid | currency_format }}</td>
<td id="{{ bill.get_html_amount_due_id }}">{{ bill.amount_due | currency_format }}<span class="icon-saudi_riyal"></span></td>
<td id="{{ bill.get_html_amount_paid_id }}">{{ bill.amount_paid | currency_format }}<span class="icon-saudi_riyal"></span></td>
<td class="has-text-centered">
{% if bill.is_past_due %}
<span class="icon is-small has-text-danger">{% icon 'bi:check-circle-fill' 24 %}</span>

View File

@ -38,9 +38,9 @@
<td class=" white-space-nowrap align-middle" colspan="3"></td>
<td class=" white-space-nowrap align-middle" scope="col">{% trans 'Total' %}</td>
<td class=" white-space-nowrap align-middle" scope="col">
{% currency_symbol %}{{ total_credits | currency_format }}
{{ total_credits | currency_format }}<span class="icon-saudi_riyal"></span>
</td>
<td class=" white-space-nowrap align-middle" scope="col">{% currency_symbol %}{{ total_debits | currency_format }}</td>
<td class=" white-space-nowrap align-middle" scope="col">{{ total_debits | currency_format }}<span class="icon-saudi_riyal"></span></td>
<td class=" white-space-nowrap align-middle" scope="col"></td>
</tr>
</tbody>
@ -76,8 +76,8 @@
<tr class="fw-bold">
<td class=" white-space-nowrap align-middle" colspan="1"></td>
<td class=" white-space-nowrap align-middle text-end">{% trans 'Total' %}</td>
<td class="white-space-nowrap align-middle">{% currency_symbol %}{{ total_credits | currency_format }}</td>
<td class=" white-space-nowrap align-middle">{% currency_symbol %}{{ total_debits | currency_format }}</td>
<td class="white-space-nowrap align-middle">{{ total_credits | currency_format }}<span class="icon-saudi_riyal"></span></td>
<td class=" white-space-nowrap align-middle">{{ total_debits | currency_format }}<span class="icon-saudi_riyal"></span></td>
<td class="white-space-nowrap align-middle"></td>
</tr>
</tbody>

View File

@ -73,7 +73,7 @@
<div class="d-flex align-items-center mb-4">
{% if opportunity.car.marked_price %}
<h5 class="mb-0 me-4">
{{ opportunity.car.total }} <span class="fw-light"><span class="icon-saudi_riyal"></span></span>
{{ opportunity.car.marked_price }} <span class="fw-light"><span class="icon-saudi_riyal"></span></span>
</h5>
{% endif %}
</div>
@ -229,7 +229,7 @@
</div>
</div>
<div class="col-xl-7 col-xxl-8">
<div class="card mb-5">
{% comment %} <div class="card mb-5">
<div class="card-body">
<div class="row g-4 g-xl-1 g-xxl-3 justify-content-between">
<div class="col-sm-auto">
@ -268,7 +268,7 @@
</div>
</div>
</div>
</div> {% endcomment %}
<div class="px-xl-4 mb-7">
<div class="row mx-0 mx-sm-3 mx-lg-0 px-lg-0">
@ -513,11 +513,11 @@
data-sort="subject"
style="width:31%;
min-width:350px">{% trans "Notes" %}</th>
<th class="sort align-middle pe-3 text-uppercase"
{% comment %} <th class="sort align-middle pe-3 text-uppercase"
scope="col"
data-sort="sent"
style="width:15%;
min-width:130px">{% trans "Assigned to" %}</th>
min-width:130px">{% trans "Assigned to" %}</th> {% endcomment %}
<th class="sort align-middle text-start text-uppercase"
scope="col"
data-sort="date"
@ -535,7 +535,7 @@
</tbody>
</table>
</div>
<div class="row align-items-center justify-content-between py-2 pe-0 fs-9">
{% comment %} <div class="row align-items-center justify-content-between py-2 pe-0 fs-9">
<div class="col-auto d-flex">
<p class="mb-0 d-none d-sm-block me-3 fw-semibold text-body"
data-list-info="data-list-info"></p>
@ -551,7 +551,7 @@
<span class="fas fa-chevron-right"></span>
</button>
</div>
</div>
</div> {% endcomment %}
</div>
</div>
</div>

View File

@ -24,9 +24,9 @@
{% endif %}
</div>
{% if opportunity.customer %}
<h5 class="mb-4">Opportunity for {{ opportunity.customer }}</h5>
<h5 class="mb-4">{% trans "Opportunity for" %} {{ opportunity.customer }}</h5>
{% elif opportunity.organization %}
<h5 class="mb-4">Opportunity for {{ opportunity.organization }}</h5>
<h5 class="mb-4">{% trans "Opportunity for" %} {{ opportunity.organization }}</h5>
{% endif %}
<div class="d-flex align-items-center justify-content-between mb-3">
<div class="d-flex gap-2">
@ -71,7 +71,7 @@
</div>
</div>
<table class="mb-3 w-100">
<tr>
{% comment %} <tr>
<td class="py-1">
<div class="d-flex align-items-center">
<span class="me-2 text-body-tertiary"><span class="icon-saudi_riyal"></span></span>
@ -83,6 +83,21 @@
<span class="icon-saudi_riyal"></span>{{ opportunity.expected_revenue }}
</p>
</td>
</tr> {% endcomment %}
<tr>
<td class="py-1">
<div class="d-flex align-items-center">
<p class="fw-semibold fs-9 mb-0 text-body-tertiary">
{% trans "Marked Price" %}
</p>
</div>
</td>
<td class="text-end">
<p class="fw-semibold fs-9 mb-0 text-body-emphasis">
<span class="icon-saudi_riyal"></span>{{ opportunity.car.marked_price }}
</p>
</td>
</tr>
<tr>
<td class="py-1">

View File

@ -12,7 +12,7 @@
<i class="fas fa-box-open text-danger ms-2"></i>
</h2>
<h4 class="text-muted mb-3 ">
{% trans "Aging Inventory Total" %} :: <span class=" text-danger">{{ total_aging_inventory_value|default:0.00 }}<span class="icon-saudi_riyal"></span></span>
{% trans "Aging Inventory Total" %} :: <span class=" text-danger">{{ total_aging_inventory_value|floatformat:'2g'|default:0.00 }}<span class="icon-saudi_riyal"></span></span>
</h4>
<p class="text-muted mb-0">{% trans "Cars in inventory for more than 60 days." %}</p>
</div>

View File

@ -1,5 +1,6 @@
{% extends 'base.html' %}
{% load i18n static custom_filters %}
{% load tenhal_tag %}
{% block title %}{{ _("Car Details") }}{% endblock %}
{% block customCSS %}
<style>
@ -263,14 +264,14 @@
<tr>
<th>{% trans "Cost Price"|capfirst %}</th>
{% if request.is_dealer or request.is_accountant or request.manager%}
<td>{{ car.cost_price|floatformat:2 }}</td>
<td class="text-nowrap">{{ car.cost_price|floatformat:2 }}<span class="icon-saudi_riyal"></span></td>
{% else %}
<td class="d-none">{{ car.cost_price|floatformat:2 }}</td>
<td class="d-none text-nowrap">{{ car.cost_price|floatformat:2 }}<span class="icon-saudi_riyal"></span></td>
{% endif %}
</tr>
<tr>
<th>{% trans "Marked Price"|capfirst %}</th>
<td>{{ car.marked_price|floatformat:2 }}</td>
<td>{{ car.marked_price|floatformat:2 }}<span class="icon-saudi_riyal"></span></td>
</tr>
<tr>

View File

@ -57,7 +57,7 @@
<div class="col-md-6">
<label for="end_date" class="form-label">{% trans 'End Date' %}</label>
<input type="date" class="form-control" id="end_date" name="end_date" value="{{ end_date }}">
</div>
</div> 65000.00
<div class="col-md-2">
<label for="make-select" class="form-label">{% trans 'Make' %}</label>
<select id="make-select" name="make" class="form-select">

View File

@ -1,6 +1,7 @@
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load tenhal_tag %}
{% block title %}
{{ _("Car Purchase Report")|capfirst }}
{% endblock title %}
@ -75,7 +76,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|floatformat:'2g' }}</p>
<p class="card-text">{{ total_po_amount|floatformat:'2g' }}<span class="icon-saudi_riyal"></span></p>
</div>
</div>
</div>
@ -128,7 +129,7 @@
<td>{{ po.po_number }}</td>
<td>{{ po.po_created|date }}</td>
<td>{{ po.po_status }}</td>
<td>{{ po.po_amount }}</td>
<td class="text-nowrap">{{ po.po_amount|floatformat:'g' }}<span class="icon-saudi_riyal"></span></td>
<td>
{% if po.po_fulfilled_date %}
{{ po.po_fulfilled_date }}

View File

@ -79,15 +79,15 @@
<div class="col-6 border-end">
<div class="p-2">
<h6 class="text-muted mb-2">{% trans 'PO Amount' %}</h6>
<h3 class="fw-light mb-0">
<span class="currency">{{ CURRENCY }}</span>{{ po_model.po_amount | absolute | currency_format }}
<h3 class="fw-light mb-0 text-wrap">
{{ po_model.po_amount | absolute | currency_format }}<span class="icon-saudi_riyal"></span>
</h3>
</div>
</div>
<div class="col-6">
<h6 class="text-muted mb-2">{% trans 'Amount Received' %}</h6>
<h3 class="fw-light mb-0 text-success">
<span class="currency">{{ CURRENCY }}</span>{{ po_model.po_amount_received | currency_format }}
<h3 class="fw-light mb-0 text-success text-wrap">
{{ po_model.po_amount_received | currency_format }}<span class="icon-saudi_riyal"></span>
</h3>
</div>
</div>

View File

@ -1,5 +1,6 @@
{% load django_ledger %}
{% load i18n %}
{%load tenhal_tag %}
<div class="table-container">
<table class="table is-fullwidth is-narrow is-striped is-bordered django-ledger-table-bottom-margin-75">
<thead>
@ -30,7 +31,7 @@
<button class="button is-small is-rounded is-outlined is-dark"
aria-haspopup="true"
aria-controls="dropdown-menu">
<span>Actions</span>
<span>{% trans "Actions" %}</span>
<span class="icon is-small">{% icon 'bi:arrow-down' 24 %}</span>
</button>
</div>

View File

@ -2,6 +2,7 @@
{% load i18n %}
{% load static %}
{% load django_ledger %}
{% load tenhal_tag %}
{% load custom_filters %}
{% block title %}
{% trans "Purchase Order Detail" %}