Django_Basic_Manufacturing_3/templates/purchasing/gr_detail.html
2025-08-22 17:05:22 +07:00

187 lines
8.3 KiB
HTML

{% extends 'base.html' %}
{% load indonesian_filters %}
{% block title %}Goods Receipt {{ gr.gr_number }} - Manufacturing App{% endblock %}
{% block content %}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Goods Receipt: {{ gr.gr_number }}</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<a href="{% url 'purchasing:po_detail' gr.po.po_number %}" class="btn btn-outline-primary">
<i class="fas fa-arrow-left"></i> View Purchase Order
</a>
</div>
</div>
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endfor %}
{% endif %}
<div class="row">
<div class="col-lg-8">
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">Goods Receipt Information</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<table class="table table-borderless">
<tr>
<th width="40%">GR Number:</th>
<td>{{ gr.gr_number }}</td>
</tr>
<tr>
<th>Purchase Order:</th>
<td>
<a href="{% url 'purchasing:po_detail' gr.po.po_number %}">
{{ gr.po.po_number }}
</a>
</td>
</tr>
<tr>
<th>Supplier:</th>
<td><strong>{{ gr.po.supplier.name }}</strong></td>
</tr>
<tr>
<th>Receipt Date:</th>
<td>{{ gr.receipt_date|date:"M d, Y" }}</td>
</tr>
<tr>
<th>Received By:</th>
<td>{{ gr.received_by.get_full_name|default:gr.received_by.username }}</td>
</tr>
</table>
</div>
<div class="col-md-6">
<table class="table table-borderless">
<tr>
<th width="40%">Total Items:</th>
<td>{{ gr.items.count }} items</td>
</tr>
<tr>
<th>Total Quantity:</th>
<td>{{ total_quantity|floatformat:0 }}</td>
</tr>
<tr class="table-info">
<th><strong>Total Value:</strong></th>
<td><strong>{{ total_value|format_rupiah }}</strong></td>
</tr>
<tr>
<th>PO Status:</th>
<td>
{% if gr.po.status == 'completed' %}
<span class="badge bg-success">Completed</span>
{% elif gr.po.status == 'ordered' %}
<span class="badge bg-warning">Ordered</span>
{% else %}
<span class="badge bg-secondary">{{ gr.po.get_status_display }}</span>
{% endif %}
</td>
</tr>
<tr>
<th>Created:</th>
<td>{{ gr.created_at|date:"M d, Y H:i" }}</td>
</tr>
</table>
</div>
</div>
{% if gr.notes %}
<div class="mt-3">
<h6>Notes:</h6>
<p class="mb-0">{{ gr.notes|linebreaks }}</p>
</div>
{% endif %}
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="mb-0">Received Items</h5>
</div>
<div class="card-body">
{% if gr.items.all %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="table-dark">
<tr>
<th>Product</th>
<th>Ordered Quantity</th>
<th>Previously Received</th>
<th>Now Received</th>
<th>Total Received</th>
<th>Unit Price</th>
<th>Total Value</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
{% for item in gr.items.all %}
<tr>
<td>
<strong>{{ item.po_item.product.name }}</strong><br>
<small class="text-muted">{{ item.po_item.product.code }}</small>
</td>
<td>{{ item.po_item.quantity|floatformat:0 }}</td>
<td>{{ item.previously_received|floatformat:0 }}</td>
<td>{{ item.received_quantity|floatformat:0 }}</td>
<td>{{ item.po_item.received_quantity|floatformat:0 }}</td>
<td>{{ item.po_item.unit_price|format_rupiah }}</td>
<td>{{ item.item_total|format_rupiah }}</td>
<td>
{% if item.notes %}
<small>{{ item.notes }}</small>
{% else %}
<span class="text-muted">No notes</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-muted">No items in this goods receipt.</p>
{% endif %}
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">Purchase Order Summary</h5>
</div>
<div class="card-body">
<h6>{{ gr.po.po_number }}</h6>
<p class="mb-1"><i class="fas fa-building"></i> {{ gr.po.supplier.name }}</p>
<p class="mb-1"><i class="fas fa-calendar"></i> {{ gr.po.order_date|date:"M d, Y" }}</p>
<p class="mb-1"><i class="fas fa-money-bill"></i> {{ gr.po.total_amount|format_rupiah }}</p>
<a href="{% url 'purchasing:po_detail' gr.po.po_number %}" class="btn btn-sm btn-outline-primary">
View Purchase Order
</a>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="mb-0">Quick Actions</h5>
</div>
<div class="card-body">
<a href="{% url 'purchasing:gr_list' %}" class="btn btn-secondary w-100 mb-2">
<i class="fas fa-list"></i> View All Receipts
</a>
<a href="{% url 'purchasing:po_detail' gr.po.po_number %}" class="btn btn-primary w-100">
<i class="fas fa-shopping-cart"></i> Back to Purchase Order
</a>
</div>
</div>
</div>
</div>
{% endblock %}