{# ── Department Card Header ────────────────────────────────────────────── #}
{# ── Mini KPI Cards ────────────────────────────────────────────────── #}
Raw Material
{{ d.raw_cost|floatformat:2|intcomma }}
Labour
{{ d.labour|floatformat:2|intcomma }}
Fuel
{{ d.fuel|floatformat:2|intcomma }}
Grand Total
{{ d.grand|floatformat:2|intcomma }}
{# ── Section B: Raw Material Consumption ─────────────────────────── #}
| # |
Code |
Raw Material Name |
Company |
Total Qty Used |
Total Cost |
{% for pid, raw in d.raw_map.items %}
| {{ forloop.counter }} |
{{ raw.code }} |
{{ raw.name }} |
{{ raw.company }} |
{{ raw.qty|floatformat:4|intcomma }} |
{{ raw.cost|floatformat:2|intcomma }} |
{% empty %}
| No raw material data. |
{% endfor %}
{% if d.raw_map %}
| Total |
{% with raw_tot_qty=0 raw_tot_cost=0 %}
{% with total=d.raw_map.values %}
{# We compute in JS below for display; Django template can't sum nested dicts easily #}
—
{% endwith %}
|
— |
{% endwith %}
{% endif %}
{# ── Section C: Finished Goods Produced ──────────────────────────── #}
| # |
Code |
Finished Item Name |
Qty Produced |
Total Cost |
Avg Unit Cost |
{% for pid, fin in d.fin_map.items %}
| {{ forloop.counter }} |
{{ fin.code }} |
{{ fin.name }} |
{{ fin.qty|floatformat:4|intcomma }}
|
{{ fin.cost|floatformat:2|intcomma }} |
{% if fin.qty %}
{{ fin.cost|floatformat:2 }}
{% else %}—{% endif %}
|
{% empty %}
| No finished goods data. |
{% endfor %}
{# ── Section D: BOM Compliance / Variance ────────────────────────── #}
{% if d.variance_rows %}
{# ── Variance Legend ── #}
Normal (±3%)
Extra Used
Less Used
Not in BOM
Not Used
| # |
Raw Code |
Raw Material |
BOM Expected Qty
(production k hisab se)
|
Actual Used Qty |
Difference |
Diff % |
Actual Cost |
Status |
{% for vr in d.variance_rows %}
| {{ forloop.counter }} |
{{ vr.raw_code }} |
{{ vr.raw_name }} |
{{ vr.expected|floatformat:4|intcomma }} |
{{ vr.actual|floatformat:4|intcomma }} |
{% if vr.diff > 0 %}+{% endif %}{{ vr.diff|floatformat:4 }}
|
{% if vr.diff_pct > 0 %}+{% endif %}{{ vr.diff_pct|floatformat:2 }}%
|
{{ vr.act_cost|floatformat:2|intcomma }} |
{% if vr.status == "Normal" %}
✓ Normal
{% elif vr.status == "Extra Used" %}
Extra Used
{% elif vr.status == "Less Used" %}
Less Used
{% elif vr.status == "Not in BOM" %}
Not in BOM
{% else %}
Not Used
{% endif %}
|
{% endfor %}
| TOTAL |
{% with tot=0 %}
{# Totals computed via JS below for display; Python passes dept-level sums #}
{% endwith %}
—
|
— |
|
{% else %}
Koi BOM define nahi hua is department ke finished items ke liye.
{% endif %}
{# ── Run Detail Collapsible ───────────────────────────────────────── #}
| Run # |
Date |
Staff |
Raw Cost |
Labour |
Fuel |
Other |
Grand Total |
{% for run in d.runs %}
| #{{ run.invoice_no }} |
{{ run.run_date }} |
{{ run.staff }} |
{{ run.raw_cost|floatformat:2 }} |
{{ run.labour|floatformat:2 }} |
{{ run.fuel|floatformat:2 }} |
{{ run.other|floatformat:2 }} |
{{ run.grand|floatformat:2 }} |
{% endfor %}