NexLab_System / templates /remain_report.html
alisaleem97's picture
Upload folder using huggingface_hub
6ea020b verified
Raw History Blame Contribute Delete
7.68 kB
<!-- templates/remain_report.html -->
{% extends "base.html" %}
{% block title %}Remain Report - NexLab{% endblock %}
{% block page_title %}Remain Report{% endblock %}
{% block content %}
<!-- Flatpickr for Date Selection -->
<link rel="stylesheet" href="/static/vendor/flatpickr/flatpickr.min.css">
<script src="/static/vendor/flatpickr/flatpickr.min.js"></script>
<!-- Filter Form -->
<div class="bg-white rounded-xl shadow-sm border border-slate-200 mb-6 overflow-hidden">
<div class="p-6">
<form action="/reports/remain" method="GET" class="flex flex-wrap items-end gap-4">
<!-- Dates and Times -->
<div>
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">From Date</label>
<input type="text" name="start_date" required value="{{ start_date }}"
class="datepicker w-36 border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm">
</div>
<div>
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">From Time</label>
<input type="text" name="start_time" required value="{{ start_time }}"
class="timepicker w-24 border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm">
</div>
<div class="ml-4">
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">To Date</label>
<input type="text" name="end_date" required value="{{ end_date }}"
class="datepicker w-36 border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm">
</div>
<div>
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">To Time</label>
<input type="text" name="end_time" required value="{{ end_time }}"
class="timepicker w-24 border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm">
</div>
<!-- Additional Filters -->
<div class="ml-4">
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">User</label>
<select name="user_id" class="w-48 border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm bg-white cursor-pointer hover:bg-slate-50">
<option value="all">All Users</option>
{% for u in users %}
<option value="{{ u.id }}" {% if user_filter == u.id|string %}selected{% endif %}>{{ u.full_name }}</option>
{% endfor %}
</select>
</div>
<div class="ml-4">
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">Patient ID</label>
<input type="text" name="patient_id" placeholder="Ex: PT-45..." value="{{ patient_id_filter }}"
class="w-40 border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm">
</div>
<div class="ml-4">
<label class="block text-xs font-bold text-slate-500 uppercase mb-2">Patient Name</label>
<input type="text" name="patient_name" placeholder="Name..." value="{{ patient_name_filter }}"
class="w-48 border border-slate-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-500 focus:outline-none text-sm">
</div>
<button type="submit"
class="bg-indigo-600 hover:bg-indigo-700 text-white px-6 py-2 rounded-lg text-sm font-semibold transition shadow-sm ml-auto">
Generate Report
</button>
</form>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
flatpickr(".datepicker", {
dateFormat: "Y-m-d",
altInput: true,
altFormat: "d-m-Y",
allowInput: true
});
flatpickr(".timepicker", {
enableTime: true,
noCalendar: true,
dateFormat: "H:i",
time_24hr: true,
allowInput: true
});
});
</script>
<!-- Table Results -->
<div class="bg-white rounded-xl shadow-sm border border-slate-200 overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full text-left border-collapse" style="min-width: 1100px">
<thead>
<tr
class="bg-amber-50 border-b border-amber-100 text-xs font-bold text-amber-700 uppercase tracking-wider">
<th class="px-4 py-4" style="width:45px">No</th>
<th class="px-4 py-4" style="width:115px">Patient ID</th>
<th class="px-4 py-4" style="width:180px">Patient Name</th>
<th class="px-4 py-4" style="width:135px">Visit Date</th>
<th class="px-4 py-4 text-right" style="width:110px">Total Amount</th>
<th class="px-4 py-4 text-right" style="width:90px">Paid</th>
<th class="px-4 py-4 text-right" style="width:100px">Discount</th>
<th class="px-4 py-4 text-right" style="width:100px">Remain</th>
<th class="px-4 py-4" style="width:120px">Username</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 text-sm">
{% if records %}
{% for row in records %}
<tr class="hover:bg-amber-50/40 transition-colors">
<td class="px-4 py-4 font-bold text-slate-500">{{ row.no }}</td>
<td class="px-4 py-4">
<span class="font-mono text-xs text-indigo-600 font-bold bg-indigo-50 px-2 py-1 rounded">{{ row.patient_code }}</span>
</td>
<td class="px-4 py-4 font-bold text-slate-700">{{ row.patient_name }}</td>
<td class="px-4 py-4 font-medium text-slate-800">{{ row.visit_date }}</td>
<td class="px-4 py-4 text-right font-medium text-slate-800">{{ "{:,.0f}".format(row.total_amount) }}</td>
<td class="px-4 py-4 text-right font-medium text-emerald-600">{{ "{:,.0f}".format(row.paid) }}</td>
<td class="px-4 py-4 text-right font-medium text-slate-500">{{ "{:,.0f}".format(row.discount_amount) }}</td>
<td class="px-4 py-4 text-right font-bold text-red-600">{{ "{:,.0f}".format(row.remain_amount) }}</td>
<td class="px-4 py-4 text-slate-600">{{ row.username }}</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="9" class="px-4 py-8 text-center text-slate-400 italic">No remaining balances found for the selected criteria.</td>
</tr>
{% endif %}
</tbody>
{% if records %}
<tfoot class="bg-amber-50 border-t-2 border-amber-200 font-bold">
<tr>
<td colspan="7" class="px-4 py-4 text-slate-700 uppercase tracking-wider text-sm text-right">Total Remaining</td>
<td class="px-4 py-4 text-right text-lg text-red-700">{{ "{:,.0f}".format(total_remain) }}</td>
<td class="px-4 py-4"></td>
</tr>
</tfoot>
{% endif %}
</table>
</div>
</div>
{% endblock %}