diff --git a/InvenTree/part/templates/part/part_pricing.html b/InvenTree/part/templates/part/part_pricing.html
index bfff341049..6d82549bb2 100644
--- a/InvenTree/part/templates/part/part_pricing.html
+++ b/InvenTree/part/templates/part/part_pricing.html
@@ -6,37 +6,77 @@
Calculate pricing information for {{ part }}.
+
Quantity
Part |
- {{ part }} |
+ {{ part }} |
Quantity |
- {{ quantity }} |
+ {{ quantity }} |
- {% if buy_price %}
+
+ {% if part.supplier_count > 0 %}
+ Supplier Pricing
+
+ {% if min_total_buy_price %}
- Buy Cost |
- {{ buy_price }} |
+ Unit Cost |
+ Min: {{ min_unit_buy_price }} |
+ Max: {{ max_unit_buy_price }} |
+
+ {% if quantity > 1 %}
+
+ Total Cost |
+ Min: {{ min_total_buy_price }} |
+ Max: {{ max_total_buy_price }} |
{% endif %}
- {% if bom_price %}
+ {% else %}
- BOM Cost |
- {{ bom_price }} |
+
+ No supplier pricing available
+ |
+ {% endif %}
+
+ {% endif %}
+
+ {% if part.bom_count > 0 %}
+ BOM Pricing
+
+ {% if min_total_bom_price %}
+
+ Unit Cost |
+ Min: {{ min_unit_bom_price }} |
+ Max: {{ max_unit_bom_price }} |
+
+ {% if quantity > 1 %}
+
+ Total Cost |
+ Min: {{ min_total_bom_price }} |
+ Max: {{ max_total_bom_price }} |
+
+ {% endif %}
{% if part.has_complete_bom_pricing == False %}
-
+ |
Note: BOM pricing is incomplete for this part
|
{% endif %}
+ {% else %}
+
+
+ No BOM pricing available
+ |
+
{% endif %}
+ {% endif %}
-{% if buy_price or bom_price %}
+{% if min_unit_buy_price or min_unit_bom_price %}
{% else %}
No pricing information is available for this part.
diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py
index 7a7a85ae2d..d5824b2dab 100644
--- a/InvenTree/part/views.py
+++ b/InvenTree/part/views.py
@@ -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