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

{% 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 show_internal_price and roles.sales_order.view %} {% if total_internal_part_price %} {% 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 'Internal Price' %} {% trans 'Unit Cost' %} {% include "price.html" with price=unit_internal_part_price %}
{% trans 'Total Cost' %} {% include "price.html" with price=total_internal_part_price %}
{% 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 %}

{% trans "Calculation parameters" %}

{% csrf_token %} {{ form|crispy }}
{% endblock %} {% block post_content_panel %} {% default_currency as currency %} {% settings_value "PART_INTERNAL_PRICE" as show_internal_price %} {% if part.purchaseable and roles.purchase_order.view %}

{% trans "Supplier Cost" %}

{% trans "Suppliers" %}

{% trans "Manufacturers" %}

{% trans "Purchase Price" %}

{% if price_history %}

{% trans 'Stock Pricing' %}

{% if price_history|length > 0 %}
{% else %}
{% trans 'No stock pricing history is available for this part.' %}
{% endif %} {% endif %}
{% endif %} {% if show_internal_price and roles.sales_order.view %}

{% trans "Internal Cost" %}

{% endif %} {% if part.has_bom and roles.sales_order.view %}

{% trans "BOM Cost" %}

{% if part.bom_count > 0 %}

{% trans 'BOM Pricing' %}

{% endif %}
{% endif %} {% if part.salable and roles.sales_order.view %}

{% trans "Sale Cost" %}

{% trans "Sale Price" %}

{% if sale_history|length > 0 %}
{% else %}
{% trans 'No sale pice history available for this part.' %}
{% endif %}
{% endif %} {% endblock %} {% block js_ready %} {{ block.super }} {% default_currency as currency %} loadSupplierPartTable( "#supplier-table", "{% url 'api-supplier-part-list' %}", { params: { part: {{ part.id }}, part_detail: false, supplier_detail: true, manufacturer_detail: true, }, } ); loadManufacturerPartTable( "#manufacturer-table", "{% url 'api-manufacturer-part-list' %}", { params: { part: {{ part.id }}, part_detail: false, manufacturer_detail: true, }, } ); // history graphs {% if price_history %} var purchasepricedata = { 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($('#StockPriceChart'), purchasepricedata) {% endif %} {% if bom_parts %} var bom_colors = randomColor({hue: 'green', count: {{ bom_parts|length }} }) var bomdata = { labels: [{% for line in bom_parts %}'{{ line.name }}',{% endfor %}], datasets: [ { label: 'Price', data: [{% for line in bom_parts %}{{ line.min_price }},{% endfor %}], backgroundColor: bom_colors, }, {% if bom_pie_max %} { label: 'Max Price', data: [{% for line in bom_parts %}{{ line.max_price }},{% endfor %}], backgroundColor: bom_colors, }, {% endif %} ] }; var BomChart = loadBomChart(document.getElementById('BomChart'), bomdata) {% endif %} // Internal pricebreaks {% settings_value "PART_INTERNAL_PRICE" as show_internal_price %} {% if show_internal_price and roles.sales_order.view %} initPriceBreakSet( $('#internal-price-break-table'), { part_id: {{part.id}}, pb_human_name: 'internal price break', pb_url_slug: 'internal-price', pb_url: '{% url 'api-part-internal-price-list' %}', pb_new_btn: $('#new-internal-price-break'), pb_new_url: '{% url 'internal-price-break-create' %}', linkedGraph: $('#InternalPriceBreakChart'), }, ); {% endif %} // Load the BOM table data loadBomTable($("#bom-table"), { editable: {{ editing_enabled }}, bom_url: "{% url 'api-bom-list' %}", part_url: "{% url 'api-part-list' %}", parent_id: {{ part.id }} , sub_part_detail: true, }); // Sales pricebreaks {% if part.salable and roles.sales_order.view %} initPriceBreakSet( $('#price-break-table'), { part_id: {{part.id}}, pb_human_name: 'sale price break', pb_url_slug: 'sale-price', pb_url: "{% url 'api-part-sale-price-list' %}", pb_new_btn: $('#new-price-break'), pb_new_url: '{% url 'sale-price-break-create' %}', linkedGraph: $('#SalePriceBreakChart'), }, ); {% endif %} // Sale price history {% if sale_history %} var salepricedata = { labels: [ {% for line in sale_history %}'{{ line.date }}',{% endfor %} ], datasets: [{ label: '{% blocktrans %}Unit Price - {{currency}}{% endblocktrans %}', backgroundColor: 'rgba(255, 99, 132, 0.2)', borderColor: 'rgb(255, 99, 132)', yAxisID: 'y', data: [ {% for line in sale_history %}{{ line.price|stringformat:".2f" }},{% endfor %} ], borderWidth: 1, }, { label: '{% trans "Quantity" %}', backgroundColor: 'rgba(255, 206, 86, 0.2)', borderColor: 'rgb(255, 206, 86)', yAxisID: 'y1', data: [ {% for line in sale_history %}{{ line.qty|stringformat:"f" }},{% endfor %} ], borderWidth: 1, type: 'bar', }] } var SalePriceChart = loadSellPricingChart($('#SalePriceChart'), salepricedata) {% endif %} {% endblock %}