fix quote payments show
This commit is contained in:
parent
169a9bd624
commit
dd64b7b47c
2 changed files with 6 additions and 6 deletions
|
|
@ -137,11 +137,11 @@ class Quote(NameSlugModel):
|
||||||
return '<span class="badge bg-{}">{}</span>'.format(color, self.get_status_display())
|
return '<span class="badge bg-{}">{}</span>'.format(color, self.get_status_display())
|
||||||
|
|
||||||
def get_paid_amount(self):
|
def get_paid_amount(self):
|
||||||
"""مبلغ پرداخت شده برای این پیشفاکتور بر اساس پرداختهای فاکتور مرتبط"""
|
"""خالص پرداختی (دریافتی از مشتری منهای پرداختی به مشتری) برای این پیشفاکتور بر اساس پرداختهای فاکتور مرتبط"""
|
||||||
invoice = Invoice.objects.filter(quote=self).first()
|
invoice = Invoice.objects.filter(quote=self).first()
|
||||||
if not invoice:
|
if not invoice:
|
||||||
return Decimal('0')
|
return Decimal('0')
|
||||||
return sum(p.amount for p in invoice.payments.filter(is_deleted=False).all())
|
return sum((p.amount if p.direction == 'in' else -p.amount) for p in invoice.payments.filter(is_deleted=False).all())
|
||||||
|
|
||||||
def get_remaining_amount(self):
|
def get_remaining_amount(self):
|
||||||
"""مبلغ باقیمانده بر اساس پرداختها"""
|
"""مبلغ باقیمانده بر اساس پرداختها"""
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,7 @@
|
||||||
<table class="table table-striped mb-0">
|
<table class="table table-striped mb-0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>نوع</th>
|
||||||
<th>مبلغ</th>
|
<th>مبلغ</th>
|
||||||
<th>تاریخ پرداخت/سررسید چک</th>
|
<th>تاریخ پرداخت/سررسید چک</th>
|
||||||
<th>روش</th>
|
<th>روش</th>
|
||||||
|
|
@ -163,7 +164,8 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for p in payments %}
|
{% for p in payments %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ p.amount|floatformat:0|intcomma:False }} تومان</td>
|
<td>{% if p.direction == 'in' %}<span class="badge bg-success">دریافتی{% else %}<span class="badge bg-warning text-dark">پرداختی{% endif %}</span></td>
|
||||||
|
<td class="{% if p.direction == 'in' %}text-success{% else %}text-danger{% endif %}">{{ p.amount|floatformat:0|intcomma:False }} تومان</td>
|
||||||
<td>{{ p.jpayment_date }}</td>
|
<td>{{ p.jpayment_date }}</td>
|
||||||
<td>{{ p.get_payment_method_display }}</td>
|
<td>{{ p.get_payment_method_display }}</td>
|
||||||
<td>{{ p.reference_number|default:'-' }}</td>
|
<td>{{ p.reference_number|default:'-' }}</td>
|
||||||
|
|
@ -175,9 +177,7 @@
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_broker %}
|
{% if is_broker %}
|
||||||
<button type="button" class="btn btn-sm btn-outline-danger" onclick="openDeleteModal('{{ p.id }}')" title="حذف" aria-label="حذف">
|
<button type="button" class="btn btn-sm btn-outline-danger" onclick="openDeleteModal('{{ p.id }}')" title="حذف" aria-label="حذف"><i class="bx bx-trash"></i></button>
|
||||||
<i class="bx bx-trash"></i>
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue