File size: 3,996 Bytes
6ea020b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!-- templates/net_amounts.html -->
{% extends "base.html" %}

{% block title %}Net Amounts Report - NexLab{% endblock %}
{% block page_title %}Net Amounts 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>

<!-- Date Selection Form -->
<div class="bg-white rounded-xl shadow-sm border border-slate-200 mb-6 overflow-hidden">
    <div class="p-6">
        <form action="/reports/net-amounts" method="GET" class="flex flex-wrap items-end gap-4">
            <div>
                <label class="block text-xs font-bold text-slate-500 uppercase mb-2">From Date</label>
                <input type="text" name="start_date" id="start_date" required value="{{ start_date }}"
                    class="datepicker 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>
            <div>
                <label class="block text-xs font-bold text-slate-500 uppercase mb-2">To Date</label>
                <input type="text" name="end_date" id="end_date" required value="{{ end_date }}"
                    class="datepicker 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">
                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
        });
    });
</script>

<!-- Report Table -->
<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">
            <thead>
                <tr class="bg-slate-50 border-b border-slate-200 text-xs font-bold text-slate-500 uppercase tracking-wider">
                    <th class="px-6 py-4">Date</th>
                    <th class="px-6 py-4 text-right">Net Amount With Tax</th>
                    <th class="px-6 py-4 text-right">Net Amount Without Tax</th>
                </tr>
            </thead>
            <tbody class="divide-y divide-slate-100 text-sm">
                {% if rows %}
                    {% for row in rows %}
                    <tr class="hover:bg-slate-50 transition-colors">
                        <td class="px-6 py-4 font-medium text-slate-800">{{ row.date }}</td>
                        <td class="px-6 py-4 text-right font-medium text-indigo-600">{{ "{:,.0f}".format(row.net_with_tax) }}</td>
                        <td class="px-6 py-4 text-right font-medium text-teal-600">{{ "{:,.0f}".format(row.net_without_tax) }}</td>
                    </tr>
                    {% endfor %}
                {% else %}
                    <tr>
                        <td colspan="3" class="px-6 py-8 text-center text-slate-400 italic">No data found for the selected date range.</td>
                    </tr>
                {% endif %}
            </tbody>
            {% if rows %}
            <tfoot class="bg-slate-50 border-t-2 border-slate-200 font-bold">
                <tr>
                    <td class="px-6 py-4 text-slate-700 uppercase tracking-wider text-sm">Total Summary</td>
                    <td class="px-6 py-4 text-right text-lg text-indigo-700">{{ "{:,.0f}".format(total_net_with_tax) }}</td>
                    <td class="px-6 py-4 text-right text-lg text-teal-700">{{ "{:,.0f}".format(total_net_without_tax) }}</td>
                </tr>
            </tfoot>
            {% endif %}
        </table>
    </div>
</div>
{% endblock %}