{% extends "base.html" %}
{% block title %}Pengakuan Pendapatan PSAK 72{% endblock %}
{% block breadcrumb %}Akuntansi / Pengakuan Pendapatan{% endblock %}
{% block page_title %}Pengakuan Pendapatan — PSAK 72{% endblock %}
{% block content %}
<div class="card mb-4" style="background:rgba(79,110,247,.06);border-color:rgba(79,110,247,.2)">
    <div style="font-weight:600;color:var(--accent);margin-bottom:6px">ℹ PSAK 72 — Pendapatan dari Kontrak dengan Pelanggan</div>
    <div class="fs-13 text-muted">Pendapatan diakui berdasarkan metode persentase penyelesaian (input method) — biaya aktual dibagi estimasi total biaya × nilai kontrak. Setiap pengakuan didokumentasikan per periode.</div>
</div>
<div class="card">
    <div class="table-wrap">
        <table>
            <thead>
                <tr>
                    <th>Proyek</th><th>Klien</th>
                    <th class="text-right">Nilai Kontrak</th>
                    <th class="text-right">Pendapatan Diakui</th>
                    <th class="text-right">Sisa Belum Diakui</th>
                    <th>% Selesai</th>
                    <th>Metode</th>
                </tr>
            </thead>
            <tbody>
            {% for d in revenue_data %}
            <tr>
                <td>
                    <a href="{{ url_for('projects.detail', id=d.project.id) }}" class="text-accent font-mono fw-600">{{ d.project.project_code }}</a>
                    <div class="fs-13 text-muted">{{ d.project.project_name[:45] }}</div>
                </td>
                <td class="fs-13">{{ d.project.client_name }}</td>
                <td class="text-right font-mono fs-13">Rp {{ "{:,.0f}".format(d.contract_value) }}</td>
                <td class="text-right font-mono fw-600 text-green">Rp {{ "{:,.0f}".format(d.recognized) }}</td>
                <td class="text-right font-mono fs-13 text-muted">Rp {{ "{:,.0f}".format(d.remaining) }}</td>
                <td style="min-width:120px">
                    <div style="display:flex;align-items:center;gap:8px">
                        <div class="progress-bar" style="flex:1">
                            <div class="progress-fill" style="width:{{ d.completion }}%"></div>
                        </div>
                        <span class="fs-13">{{ d.completion }}%</span>
                    </div>
                </td>
                <td><span class="badge badge-info">{{ 'Overtime' if d.project.satisfaction_method == 'overtime' else 'Point in Time' }}</span></td>
            </tr>
            {% else %}
            <tr><td colspan="7" style="text-align:center;padding:40px;color:var(--text-muted)">Belum ada data proyek</td></tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endblock %}
