{% extends "pos/base.html" %} {% block content %}

FIFO Full Reset Script

Warning: Ye script har product ki saari purani FIFO layers ki quantity ZERO kar degi (delete nahi karegi — purani FIFOAllocation history intact rahegi), aur product_details.present_stock qty par, product_details.purchase_price rate se ek NAYI single fresh layer bana degi. Ye action reverse nahi ho sakta — pehle Preview zaroor dekhein.
{% if messages %} {% for message in messages %}
{{ message }}
{% endfor %} {% endif %}

Flow: {{ scope }} | Total checked: {{ total_checked }} | Total planned: {{ total_planned }} | Need reset: {{ total_affected }} | Preview limit: {{ preview_limit }}

{% if scope == "one" and not product_code %}
One Product flow ke liye pehle code/prod id/db id enter karo.
{% elif total_planned > 0 %}
{% csrf_token %}
{% else %}
No product found for this flow.
{% endif %}
{% for row in preview_rows %} {% empty %} {% endfor %}
DB IDProd IDCodeName Current Layers Current Weighted Avg New Layer (Target) Status
{{ row.id }} {{ row.prod_id }} {{ row.product_code }} {{ row.name }} Layers: {{ row.layers_count }} (active: {{ row.active_count }})
Total Qty: {{ row.current_total_qty }}
Distinct Rates: {{ row.distinct_rates }}
{{ row.current_weighted_avg }} Qty: {{ row.target_qty }}
Rate: {{ row.new_rate }}
{% if row.needs_reset %} Reset needed
{% if row.multi_layer %}Multiple active layers found.
{% endif %} {% if row.qty_mismatch %}Qty mismatch vs present_stock.
{% endif %} {% if row.zero_layers %}No active layer but stock exists.
{% endif %} {% else %} Already single clean layer {% endif %}
No products found.
{% endblock %}