From 3eef0a56cac8323980a6b72eee57f7865b1e2e90 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 21 Apr 2022 22:05:02 +0200 Subject: [PATCH] Added example --- docs/report/bom.md | 113 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/docs/report/bom.md b/docs/report/bom.md index a15c000..f5cc11b 100644 --- a/docs/report/bom.md +++ b/docs/report/bom.md @@ -3,5 +3,118 @@ title: BOM Generation --- ## BOM Generation +The bill of materials is an essential part of the documentation that needs to be send to the facctory. A sinple csv export is OK to be importet into SMT machines. But for human redable documentation it might not be suficcient. Additional information ist needed. The Inventree report system allows to generate BOM well formatted BOM reports. + +### A simple example +The following picture shows a simple example for a PCB with just three components from two different parts. {% with id="report-options", url="report/bom_example.png", description="Report Options" %} {% include 'img.html' %} {% endwith %} + +This example has been created using the following html template: + +```html +{% raw %} +{% extends "report/inventree_report_base.html" %} + +{% load i18n %} +{% load report %} +{% load inventree_extras %} + +{% block page_margin %} +margin-left: 2cm; +margin-right: 1cm; +margin-top: 4cm; +{% endblock %} + +{% block bottom_left %} +content: "v{{report_revision}} - {{ date.isoformat }}"; +{% endblock %} + +{% block bottom_center %} +content: "InvenTree v{% inventree_version %}"; +{% endblock %} + +{% block style %} +.header-left { + text-align: left; + float: left; +} +table { + border: 1px solid #eee; + border-radius: 3px; + border-collapse: collapse; + width: 100%; + font-size: 80%; +} +table td { + border: 1px solid #eee; +} +{% endblock %} + +{% block header_content %} +
+

{% trans "Bill of Materials" %}

+
+{% endblock %} + +{% block page_content %} + + + + + + + + + + + + + + + + +
Board{{ part.IPN }}
Description{{ part.description }}
User{{ user }}
Date{{ date }}
Number of different components (codes){{ bom_items.count }}
+
+ + + + + + + + + + + + + {% for line in bom_items.all %} + + + + + + + + + {% endfor %} + +
{% trans "IPN" %}{% trans "MPN" %}{% trans "Manufacturer" %}{% trans "Quantity" %}{% trans "Reference" %}{% trans "Substitute" %}
{{ line.sub_part.IPN }}{{ line.sub_part.name }} + {% for manf in line.sub_part.manufacturer_parts.all %} + {{ manf.manufacturer.name }} + {% endfor %} + {% decimal line.quantity %}{{ line.reference }} + {% for sub in line.substitutes.all %} + {{ sub.part.IPN }}
+ {% endfor %} +
+ +{% endblock %} +{% endraw %} +``` + +### Context variables +| Variable | Description | +| --- | --- | +| bom_items | Query set that contains all BOM items | +| bom_items.sub_part | One part of the BOM |