Files
fuel_track/app/templates/admin_reports.html
T
Mateusz Gruszczyński bb5d992913 zestawienia
2026-07-14 14:09:40 +02:00

33 lines
5.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends 'base.html' %}{% block content %}
<div class="mb-4"><h1 class="h2 mb-1">Zestawienia kosztów</h1><p class="text-body-secondary mb-0">Rzeczywiste koszty, VAT i oszczędność wynikająca z rozliczenia Last Price.</p></div>
{% include '_admin_nav.html' %}
<div class="card mb-4"><div class="card-body">
<form method="get" class="row g-3 ajax-nav-form" action="{{url_for('main.admin_reports')}}">
{% if current_user.role=='admin' %}<div class="col-lg-3"><label class="form-label">Firma</label><select class="form-select" name="company_id"><option value="">Wszystkie firmy</option>{% for c in companies %}<option value="{{c.id}}" {% if company_id==c.id %}selected{% endif %}>{{c.name}}</option>{% endfor %}</select></div>{% endif %}
<div class="col-lg-2"><label class="form-label">Zakres</label><select class="form-select" name="period" id="report-period"><option value="month" {% if period=='month' %}selected{% endif %}>Miesiąc</option><option value="year" {% if period=='year' %}selected{% endif %}>Rok</option><option value="custom" {% if period=='custom' %}selected{% endif %}>Zakres dat</option></select></div>
<div class="col-lg-2 report-filter report-month"><label class="form-label">Miesiąc</label><input class="form-control" type="month" name="month" value="{{month}}"></div>
<div class="col-lg-2 report-filter report-year"><label class="form-label">Rok</label><input class="form-control" type="number" min="2000" max="2100" name="year" value="{{year}}"></div>
<div class="col-lg-2 report-filter report-custom"><label class="form-label">Od</label><input class="form-control" type="date" name="date_from" value="{{date_from}}"></div>
<div class="col-lg-2 report-filter report-custom"><label class="form-label">Do</label><input class="form-control" type="date" name="date_to" value="{{date_to}}"></div>
<div class="col-lg-2 d-flex align-items-end"><button class="btn btn-primary w-100">Pokaż zestawienie</button></div>
</form></div></div>
<p class="small text-body-secondary">Okres: <strong>{{start_date.strftime('%d.%m.%Y')}}{{end_date.strftime('%d.%m.%Y')}}</strong></p>
<div class="row g-3 mb-4">
<div class="col-6 col-xl-2"><div class="card metric h-100"><div class="card-body"><small>Detal z dystrybutora</small><strong>{{'%.2f'|format(totals.retail)}} zł</strong></div></div></div>
<div class="col-6 col-xl-2"><div class="card metric h-100"><div class="card-body"><small>Faktury Last Price*</small><strong>{{'%.2f'|format(totals.invoice)}} zł</strong></div></div></div>
<div class="col-6 col-xl-2"><div class="card metric h-100"><div class="card-body"><small>Koszt po VAT</small><strong>{{'%.2f'|format(totals.effective)}} zł</strong></div></div></div>
<div class="col-6 col-xl-2"><div class="card metric h-100"><div class="card-body"><small>Odliczony VAT</small><strong>{{'%.2f'|format(totals.vat_deducted)}} zł</strong></div></div></div>
<div class="col-6 col-xl-2"><div class="card metric h-100"><div class="card-body"><small>Oszczędność Last Price</small><strong>{{'%.2f'|format(totals.saving)}} zł</strong><span>{{'%.2f'|format(totals.saving_percent)}}%</span></div></div></div>
<div class="col-6 col-xl-2"><div class="card metric h-100"><div class="card-body"><small>Tankowania / litry</small><strong>{{totals.count}} / {{'%.2f'|format(totals.liters)}} l</strong><span>Last Price: {{totals.last_price_count}}</span></div></div></div>
</div>
<div class="alert alert-info small"><strong>* Faktura Last Price</strong> oznacza kwotę obliczoną z ceny Last Price netto, powiększonej o stawkę VAT firmy. Oszczędność Last Price to różnica między wartością detaliczną z dystrybutora a fakturą Last Price brutto.</div>
<div class="card mb-4"><div class="card-body"><h2 class="h5">Koszty w czasie</h2><div class="chart-box"><canvas id="report-cost-chart"></canvas><div id="report-cost-chart-empty" class="chart-empty d-none">Brak danych dla wybranego okresu.</div></div></div></div>
<div class="row g-4">
<div class="col-xl-6"><div class="card h-100"><div class="card-body"><h2 class="h5">Według pojazdu</h2><div class="table-responsive"><table class="table table-hover align-middle"><thead><tr><th>Pojazd</th><th>Tank.</th><th>Litry</th><th>Detal</th><th>Faktura*</th><th>Koszt po VAT</th><th>Oszczędność</th></tr></thead><tbody>{% for name,row in by_vehicle.items() %}<tr><td><strong>{{name}}</strong></td><td>{{row.count}}</td><td>{{'%.2f'|format(row.liters)}}</td><td>{{'%.2f'|format(row.retail)}} zł</td><td>{{'%.2f'|format(row.invoice)}} zł</td><td>{{'%.2f'|format(row.effective)}} zł</td><td><strong>{{'%.2f'|format(row.saving)}} zł</strong></td></tr>{% else %}<tr><td colspan="7" class="text-center text-body-secondary">Brak danych.</td></tr>{% endfor %}</tbody></table></div></div></div></div>
<div class="col-xl-6"><div class="card h-100"><div class="card-body"><h2 class="h5">Według firmy</h2><div class="table-responsive"><table class="table table-hover align-middle"><thead><tr><th>Firma</th><th>Tank.</th><th>Litry</th><th>Detal</th><th>Faktura*</th><th>Koszt po VAT</th><th>Oszczędność</th></tr></thead><tbody>{% for name,row in by_company.items() %}<tr><td><strong>{{name}}</strong></td><td>{{row.count}}</td><td>{{'%.2f'|format(row.liters)}}</td><td>{{'%.2f'|format(row.retail)}} zł</td><td>{{'%.2f'|format(row.invoice)}} zł</td><td>{{'%.2f'|format(row.effective)}} zł</td><td><strong>{{'%.2f'|format(row.saving)}} zł</strong></td></tr>{% else %}<tr><td colspan="7" class="text-center text-body-secondary">Brak danych.</td></tr>{% endfor %}</tbody></table></div></div></div></div>
</div>
{% endblock %}{% block scripts %}<script>
FuelTrack.renderCostReportChart('report-cost-chart', {{by_month|tojson}});
(()=>{const select=document.getElementById('report-period');const refresh=()=>{document.querySelectorAll('.report-filter').forEach(el=>el.classList.add('d-none'));document.querySelectorAll('.report-'+select.value).forEach(el=>el.classList.remove('d-none'));};select?.addEventListener('change',refresh);refresh();})();
</script>{% endblock %}