{% extends edc_base_template %} {% load static %} {% block extrastyle %} {{ block.super }} {% endblock %} {% block extrahead %} {{ block.super }} {% endblock %} {% block document_ready %} {% endblock %} {% block main %} {{ block.super }}
Edc PharmacyStock requests › {{ stock_request.request_identifier }}
{# ── Stock request summary ── #}
Stock request {{ stock_request.request_identifier }}   {% if stock_request.cancel %} Cancelled {% elif total == 0 %} New {% elif allocated == total %} Fully allocated {% elif allocated > 0 %} Partially allocated ({{ allocated }}/{{ total }}) {% else %} Items created — awaiting allocation {% endif %}
{% if stock_request.subject_identifiers %} {% endif %} {% if stock_request.excluded_subject_identifiers %} {% endif %}
Request date {{ stock_request.request_datetime|date:"d-M-Y" }} Location {{ stock_request.location }}
Formulation {{ stock_request.formulation }} Container {{ stock_request.container }}
Containers per subject {{ stock_request.containers_per_subject }} Request items {{ total }}
Start date {{ stock_request.start_datetime|date:"d-M-Y"|default:"—" }} Cutoff date {{ stock_request.cutoff_datetime|date:"d-M-Y"|default:"—" }}
Allocated {{ allocated }} Pending allocation {{ pending }}
Include only
{{ stock_request.subject_identifiers }}
Excluded
{{ stock_request.excluded_subject_identifiers }}
Created by {{ stock_request.user_created|default:"—" }}
{# ── Action buttons ── #}
{% if not stock_request.cancel %} {# Edit — always available while not cancelled #} Edit {# Prepare — only before items are created #} {% if total == 0 %} Prepare items {% endif %} {# Allocate — once items exist #} {% if total > 0 %} {% if pending > 0 %} Allocate {% else %} Allocate {% endif %} {% endif %} {# Print patient barcodes — once any stock is allocated #} {% if allocated > 0 %}
{% csrf_token %}
{% endif %} {# Confirm labelled stock — shown once allocated; disabled if all already confirmed #} {% if allocated > 0 %}
{% csrf_token %}
{% endif %} {# Cancel — only if no allocations #} {% if allocated == 0 %}
{% csrf_token %}
{% endif %} {% endif %}{# end not cancelled #} Audit trail
{# ── Allocated stock ── #} {% if allocations %}
Allocated stock {{ allocations|length }} item{{ allocations|length|pluralize }}
{% if show_assignment %}{% endif %} {% for alloc in allocations %} {% if show_assignment %} {% endif %} {% endfor %}
Allocation # Stock code SubjectAssignmentDate Confirmed
{{ alloc.allocation_identifier }} {% if alloc.code %} {{ alloc.code }} {% else %}—{% endif %} {{ alloc.subject_identifier }}{{ alloc.assignment.display_name|default:"—" }} {{ alloc.allocation_datetime|date:"d-M-Y H:i" }} {% if alloc.stock.confirmed %} Yes {% else %} No {% endif %}
{% endif %} {# ── Instructions ── #} {% if not stock_request.cancel %}
Instructions
  1. Click Prepare items — the system identifies subjects with upcoming appointments who need stock.
  2. Review the proposed items and click Create items to confirm.
  3. Click Allocate for each treatment assignment — scan stock barcodes to pair stock with subjects.
  4. Click Print patient barcodes — print and affix patient-specific labels to each bottle.
  5. Click Confirm labelled stock — scan each labelled bottle to confirm.
{% endif %}

← All stock requests

{% endblock main %}