2026-01-13 15:58:52 +05:30
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
<div class="container mt-4">
|
2026-01-13 15:58:52 +05:30
|
|
|
<h2 class="mb-4 text-center">Generate Subcontractor Report</h2>
|
2026-01-13 15:58:52 +05:30
|
|
|
|
|
|
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
2026-01-16 12:38:38 +05:30
|
|
|
{% if messages %}
|
|
|
|
|
{% for category, message in messages %}
|
|
|
|
|
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
|
|
|
|
{{ message }}
|
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
|
|
|
|
</div>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
{% endif %}
|
2026-01-13 15:58:52 +05:30
|
|
|
{% endwith %}
|
|
|
|
|
|
2026-01-13 15:58:52 +05:30
|
|
|
<div class="card p-4 shadow-sm mx-auto" style="max-width: 600px;">
|
2026-01-15 12:24:40 +05:30
|
|
|
<form method="POST" id="reportForm">
|
2026-01-13 15:58:52 +05:30
|
|
|
<div class="mb-3">
|
|
|
|
|
<label class="form-label fw-semibold">Select Subcontractor</label>
|
|
|
|
|
<select name="subcontractor_id" class="form-select" required>
|
|
|
|
|
<option value="">-- Select Subcontractor --</option>
|
|
|
|
|
{% for sc in subcontractors %}
|
2026-01-16 12:38:38 +05:30
|
|
|
<option value="{{ sc.id }}" {% if selected_sc_id==sc.id|string %}selected{% endif %}>
|
2026-01-15 12:24:40 +05:30
|
|
|
{{ sc.subcontractor_name }}
|
|
|
|
|
</option>
|
2026-01-13 15:58:52 +05:30
|
|
|
{% endfor %}
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-01-13 15:58:52 +05:30
|
|
|
<div class="form-check form-switch mb-3">
|
2026-01-16 12:38:38 +05:30
|
|
|
<input class="form-check-input" type="checkbox" name="download_all" value="true" id="downloadAllSwitch"
|
|
|
|
|
onchange="toggleRAInput(this)" {% if download_all %}checked{% endif %}>
|
2026-01-13 15:58:52 +05:30
|
|
|
<label class="form-check-label fw-bold text-primary" for="downloadAllSwitch">
|
|
|
|
|
Download All RA Bills for this Contractor
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="mb-4" id="ra_bill_container">
|
2026-01-13 15:58:52 +05:30
|
|
|
<label class="form-label fw-semibold">RA Bill Number</label>
|
2026-01-16 12:38:38 +05:30
|
|
|
<input type="text" name="ra_bill_no" id="ra_bill_input" class="form-control" placeholder="e.g. 01"
|
|
|
|
|
value="{{ ra_bill_no or '' }}">
|
2026-01-13 15:58:52 +05:30
|
|
|
<small class="text-muted">Required if "Download All" is off.</small>
|
2026-01-13 15:58:52 +05:30
|
|
|
</div>
|
|
|
|
|
|
2026-01-15 12:24:40 +05:30
|
|
|
<div class="row g-2">
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
|
<button type="submit" name="action" value="preview" class="btn btn-outline-primary w-100 py-2">
|
|
|
|
|
<i class="fas fa-eye me-2"></i>Preview Data
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
|
<button type="submit" name="action" value="download" class="btn btn-primary w-100 py-2">
|
|
|
|
|
<i class="fas fa-download me-2"></i>Download Excel
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-01-13 15:58:52 +05:30
|
|
|
</form>
|
|
|
|
|
</div>
|
2026-01-15 12:24:40 +05:30
|
|
|
|
|
|
|
|
{% if tables %}
|
|
|
|
|
<div class="mt-5 mb-5">
|
|
|
|
|
<hr>
|
|
|
|
|
<h3 class="text-center mb-4">Report Preview</h3>
|
2026-01-16 12:38:38 +05:30
|
|
|
|
2026-01-15 12:24:40 +05:30
|
|
|
<div class="card shadow-sm">
|
|
|
|
|
<div class="card-header bg-light">
|
|
|
|
|
<ul class="nav nav-tabs card-header-tabs" id="reportTabs" role="tablist">
|
|
|
|
|
<li class="nav-item">
|
2026-01-16 12:38:38 +05:30
|
|
|
<button class="nav-link active" id="tr-tab" data-bs-toggle="tab" data-bs-target="#tr"
|
|
|
|
|
type="button">Transport (Tr.Ex.)</button>
|
2026-01-15 12:24:40 +05:30
|
|
|
</li>
|
|
|
|
|
<li class="nav-item">
|
2026-01-16 12:38:38 +05:30
|
|
|
<button class="nav-link" id="mh-tab" data-bs-toggle="tab" data-bs-target="#mh"
|
|
|
|
|
type="button">Manpower (MH.Ex.)</button>
|
2026-01-15 12:24:40 +05:30
|
|
|
</li>
|
|
|
|
|
<li class="nav-item">
|
2026-01-16 12:38:38 +05:30
|
|
|
<button class="nav-link" id="dc-tab" data-bs-toggle="tab" data-bs-target="#dc" type="button">MH
|
|
|
|
|
& DC</button>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<button class="nav-link" id="lay-tab" data-bs-toggle="tab" data-bs-target="#lay" type="button">Laying</button>
|
2026-01-15 12:24:40 +05:30
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card-body tab-content" id="reportTabsContent">
|
|
|
|
|
<div class="tab-pane fade show active" id="tr" role="tabpanel">
|
|
|
|
|
<div class="table-responsive">
|
|
|
|
|
{{ tables.tr | safe }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tab-pane fade" id="mh" role="tabpanel">
|
|
|
|
|
<div class="table-responsive">
|
|
|
|
|
{{ tables.mh | safe }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tab-pane fade" id="dc" role="tabpanel">
|
|
|
|
|
<div class="table-responsive">
|
|
|
|
|
{{ tables.dc | safe }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-01-16 12:38:38 +05:30
|
|
|
<div class="tab-pane fade" id="lay" role="tabpanel">
|
|
|
|
|
<div class="table-responsive">
|
|
|
|
|
{{ tables.lay | safe }}
|
|
|
|
|
</div>
|
2026-01-15 12:24:40 +05:30
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
2026-01-13 15:58:52 +05:30
|
|
|
</div>
|
2026-01-13 15:58:52 +05:30
|
|
|
|
2026-01-15 12:24:40 +05:30
|
|
|
<style>
|
|
|
|
|
/* Styling specifically for pandas output */
|
|
|
|
|
.table-responsive .table {
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
2026-01-16 12:38:38 +05:30
|
|
|
|
2026-01-15 12:24:40 +05:30
|
|
|
.table-responsive thead {
|
|
|
|
|
background-color: #f8f9fa;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
2026-01-13 15:58:52 +05:30
|
|
|
<script>
|
2026-01-16 12:38:38 +05:30
|
|
|
function toggleRAInput(checkbox) {
|
|
|
|
|
const input = document.getElementById('ra_bill_input');
|
|
|
|
|
const container = document.getElementById('ra_bill_container');
|
|
|
|
|
if (checkbox.checked) {
|
|
|
|
|
input.value = "";
|
|
|
|
|
input.disabled = true;
|
|
|
|
|
container.style.opacity = "0.5";
|
|
|
|
|
} else {
|
|
|
|
|
input.disabled = false;
|
|
|
|
|
container.style.opacity = "1";
|
|
|
|
|
}
|
2026-01-13 15:58:52 +05:30
|
|
|
}
|
2026-01-15 12:24:40 +05:30
|
|
|
|
2026-01-16 12:38:38 +05:30
|
|
|
// Check status on load to handle form persistence
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
|
toggleRAInput(document.getElementById('downloadAllSwitch'));
|
|
|
|
|
});
|
2026-01-13 15:58:52 +05:30
|
|
|
</script>
|
2026-01-13 15:58:52 +05:30
|
|
|
{% endblock %}
|