{% extends "part/part_base.html" %} {% load static %} {% load i18n %} {% load crispy_forms_tags %} {% load inventree_extras %} {% block menubar %} {% include 'part/navbar.html' with tab='order-prices' %} {% endblock %} {% block heading %} {% trans "Order Price Information" %} {% endblock %} {% block details %} {% default_currency as currency %}
{% csrf_token %}
{{ form|crispy }}

{% trans "Pricing ranges" %}

{% if part.supplier_count > 0 %} {% if min_total_buy_price %} {% if quantity > 1 %} {% endif %} {% else %} {% endif %} {% endif %} {% if part.bom_count > 0 %} {% if min_total_bom_price %} {% if quantity > 1 %} {% endif %} {% if part.has_complete_bom_pricing == False %} {% endif %} {% else %} {% endif %} {% endif %} {% if total_part_price %} {% endif %}
{% trans 'Supplier Pricing' %} {% trans 'Unit Cost' %} Min: {% include "price.html" with price=min_unit_buy_price %} Max: {% include "price.html" with price=max_unit_buy_price %}
{% trans 'Total Cost' %} Min: {% include "price.html" with price=min_total_buy_price %} Max: {% include "price.html" with price=max_total_buy_price %}
{% trans 'No supplier pricing available' %}
{% trans 'BOM Pricing' %} {% trans 'Unit Cost' %} Min: {% include "price.html" with price=min_unit_bom_price %} Max: {% include "price.html" with price=max_unit_bom_price %}
{% trans 'Total Cost' %} Min: {% include "price.html" with price=min_total_bom_price %} Max: {% include "price.html" with price=max_total_bom_price %}
{% trans 'Note: BOM pricing is incomplete for this part' %}
{% trans 'No BOM pricing available' %}
{% trans 'Sale Price' %} {% trans 'Unit Cost' %} {% include "price.html" with price=unit_part_price %}
{% trans 'Total Cost' %} {% include "price.html" with price=total_part_price %}
{% if min_unit_buy_price or min_unit_bom_price %} {% else %}
{% trans 'No pricing information is available for this part.' %}
{% endif %}
{% if part.bom_count > 0 %}

{% trans 'BOM Pricing' %}

{% endif %}
{% if price_history %}

{% trans 'Stock Pricing' %}

{% if price_history|length > 1 %}
{% else %}
{% trans 'No stock pricing history is available for this part.' %}
{% endif %} {% endif %} {% endblock %} {% block js_ready %} {{ block.super }} {% default_currency as currency %} {% if price_history %} var pricedata = { labels: [ {% for line in price_history %}'{{ line.date }}',{% endfor %} ], datasets: [{ label: '{% blocktrans %}Single Price - {{currency}}{% endblocktrans %}', backgroundColor: 'rgba(255, 99, 132, 0.2)', borderColor: 'rgb(255, 99, 132)', yAxisID: 'y', data: [ {% for line in price_history %}{{ line.price|stringformat:".2f" }},{% endfor %} ], borderWidth: 1, type: 'line' }, {% if 'price_diff' in price_history.0 %} { label: '{% blocktrans %}Single Price Difference - {{currency}}{% endblocktrans %}', backgroundColor: 'rgba(68, 157, 68, 0.2)', borderColor: 'rgb(68, 157, 68)', yAxisID: 'y2', data: [ {% for line in price_history %}{{ line.price_diff|stringformat:".2f" }},{% endfor %} ], borderWidth: 1, type: 'line', hidden: true, }, { label: '{% blocktrans %}Part Single Price - {{currency}}{% endblocktrans %}', backgroundColor: 'rgba(70, 127, 155, 0.2)', borderColor: 'rgb(70, 127, 155)', yAxisID: 'y', data: [ {% for line in price_history %}{{ line.price_part|stringformat:".2f" }},{% endfor %} ], borderWidth: 1, type: 'line', hidden: true, }, {% endif %} { label: '{% trans "Quantity" %}', backgroundColor: 'rgba(255, 206, 86, 0.2)', borderColor: 'rgb(255, 206, 86)', yAxisID: 'y1', data: [ {% for line in price_history %}{{ line.qty|stringformat:"f" }},{% endfor %} ], borderWidth: 1 }] } var StockPriceChart = loadStockPricingChart(document.getElementById('StockPriceChart'), pricedata) var bom_colors = randomColor({hue: 'green', count: {{ bom_parts|length }} }) var bomdata = { labels: [{% for line in bom_parts %}'{{ line.name }}',{% endfor %}], datasets: [ {% if bom_pie_min %} { label: 'Max Price', data: [{% for line in bom_parts %}{{ line.max_price }},{% endfor %}], backgroundColor: bom_colors, }, {% endif %} { label: 'Price', data: [{% for line in bom_parts %}{% if bom_pie_min %}{{ line.min_price }}{% else %}{{ line.price }}{% endif%},{% endfor %}], backgroundColor: bom_colors, } ] }; var BomChart = loadBomChart(document.getElementById('BomChart'), bomdata) {% endif %} {% endblock %}