mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improve pricing display
This commit is contained in:
parent
ffda5a1b29
commit
a54760b219
@ -6,37 +6,77 @@
|
||||
Calculate pricing information for {{ part }}.
|
||||
</div>
|
||||
|
||||
<h4>Quantity</h4>
|
||||
<table class='table table-striped table-condensed'>
|
||||
<tr>
|
||||
<td><b>Part</b></td>
|
||||
<td>{{ part }}</td>
|
||||
<td colspan='2'>{{ part }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Quantity</b></td>
|
||||
<td>{{ quantity }}</td>
|
||||
<td colspan='2'>{{ quantity }}</td>
|
||||
</tr>
|
||||
{% if buy_price %}
|
||||
</table>
|
||||
{% if part.supplier_count > 0 %}
|
||||
<h4>Supplier Pricing</h4>
|
||||
<table class='table table-striped table-condensed'>
|
||||
{% if min_total_buy_price %}
|
||||
<tr>
|
||||
<td><b>Buy Cost</b></td>
|
||||
<td>{{ buy_price }}</td>
|
||||
<td><b>Unit Cost</b></td>
|
||||
<td>Min: {{ min_unit_buy_price }}</td>
|
||||
<td>Max: {{ max_unit_buy_price }}</td>
|
||||
</tr>
|
||||
{% if quantity > 1 %}
|
||||
<tr>
|
||||
<td><b>Total Cost</b></td>
|
||||
<td>Min: {{ min_total_buy_price }}</td>
|
||||
<td>Max: {{ max_total_buy_price }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if bom_price %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td><b>BOM Cost</b></td>
|
||||
<td>{{ bom_price }}</td>
|
||||
<td colspan='3'>
|
||||
<span class='warning-msg'><i>No supplier pricing available</i></span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if part.bom_count > 0 %}
|
||||
<h4>BOM Pricing</h4>
|
||||
<table class='table table-striped table-condensed'>
|
||||
{% if min_total_bom_price %}
|
||||
<tr>
|
||||
<td><b>Unit Cost</b></td>
|
||||
<td>Min: {{ min_unit_bom_price }}</td>
|
||||
<td>Max: {{ max_unit_bom_price }}</td>
|
||||
</tr>
|
||||
{% if quantity > 1 %}
|
||||
<tr>
|
||||
<td><b>Total Cost</b></td>
|
||||
<td>Min: {{ min_total_bom_price }}</td>
|
||||
<td>Max: {{ max_total_bom_price }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if part.has_complete_bom_pricing == False %}
|
||||
<tr>
|
||||
<td colspan='2'>
|
||||
<td colspan='3'>
|
||||
<span class='warning-msg'><i>Note: BOM pricing is incomplete for this part</i></span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan='3'>
|
||||
<span class='warning-msg'><i>No BOM pricing available</i></span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if buy_price or bom_price %}
|
||||
{% if min_unit_buy_price or min_unit_bom_price %}
|
||||
{% else %}
|
||||
<div class='alert alert-danger alert-block'>
|
||||
No pricing information is available for this part.
|
||||
|
@ -577,14 +577,32 @@ class PartPricing(AjaxView):
|
||||
if part is None:
|
||||
return ctx
|
||||
|
||||
buy_price = part.get_price_info(quantity, bom=False)
|
||||
bom_price = part.get_price_info(quantity, buy=False)
|
||||
# Supplier pricing information
|
||||
if part.supplier_count > 0:
|
||||
min_buy_price = part.get_min_supplier_price(quantity)
|
||||
max_buy_price = part.get_max_supplier_price(quantity)
|
||||
|
||||
if buy_price:
|
||||
ctx['buy_price'] = buy_price
|
||||
if min_buy_price:
|
||||
ctx['min_total_buy_price'] = min_buy_price
|
||||
ctx['min_unit_buy_price'] = min_buy_price / quantity
|
||||
|
||||
if bom_price:
|
||||
ctx['bom_price'] = bom_price
|
||||
if max_buy_price:
|
||||
ctx['max_total_buy_price'] = max_buy_price
|
||||
ctx['max_unit_buy_price'] = max_buy_price / quantity
|
||||
|
||||
# BOM pricing information
|
||||
if part.bom_count > 0:
|
||||
|
||||
min_bom_price = part.get_min_bom_price(quantity)
|
||||
max_bom_price = part.get_max_bom_price(quantity)
|
||||
|
||||
if min_bom_price:
|
||||
ctx['min_total_bom_price'] = min_bom_price
|
||||
ctx['min_unit_bom_price'] = min_bom_price / quantity
|
||||
|
||||
if max_bom_price:
|
||||
ctx['max_total_bom_price'] = max_bom_price
|
||||
ctx['max_unit_bom_price'] = max_bom_price / quantity
|
||||
|
||||
return ctx
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user