|
{% extends "facturation/base.html" %}
|
|
{% load url from future %}
|
|
|
|
{% block appbar %}
|
|
<h2>
|
|
|
|
{% if service_name == "CMPP" %}
|
|
Facturation {{ invoicing.seq_id }}
|
|
{% if invoicing.status == "open" %}
|
|
ouverte et ayant débuté le {{ invoicing.start_date }}
|
|
{% else %}
|
|
{% if invoicing.status == "closed" %}
|
|
fermée
|
|
{% else %}
|
|
validée
|
|
{% endif %}
|
|
couvrant la période du {{ invoicing.start_date }} au {{ invoicing.end_date }}
|
|
{% endif %}
|
|
{% else %}
|
|
Décompte {{ invoicing.seq_id }}
|
|
{% if invoicing.status == "validated" %}
|
|
validé
|
|
{% endif %}
|
|
pour le trimestre allant du {{ invoicing.start_date }} au {{ invoicing.end_date }}
|
|
{% endif %}</h2>
|
|
<a href="..">Retourner à la liste</a>
|
|
{% if service_name == "CMPP" %}
|
|
{% if invoicing.status == "open" %}<button id="close"">Clôre cette facturation</button>{% endif %}
|
|
{% if invoicing.status == "closed" %}<button id="validate"">Valider cette facturation</button>{% endif %}
|
|
{% if invoicing.status == "validated" %}
|
|
<button id="teletrans-btn">Télétransmission à l'assurance maladie</button>
|
|
<button id="expcompt-btn">Export comptabilité</button>
|
|
{% endif %}
|
|
{% else %}
|
|
{% if show_validation_btn %}<button id="validate">Valider ce décompte</button>{% endif %}
|
|
{% if invoicing.status == "validated" %}<button id="print-btn">Imprimer</button>{% endif %}
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<div id="facturation-contents">
|
|
{% if days_not_locked %}
|
|
<h3>Jours non verrouillés</h3>
|
|
<ul>
|
|
{% for day in days_not_locked %}
|
|
<li><a href="../../agenda/{{ day.year }}-{{ day.month }}-{{ day.day }}/validation-des-actes">{{ day.day }}/{{ day.month }}/{{ day.year }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
<h3>Résumé</h3>
|
|
{% if service_name == "CMPP" %}
|
|
{% if invoicing.status == "open" or invoicing.status == "closed" %}
|
|
<ul>
|
|
{% if len_acts_invoiced_hors_pause %}
|
|
<li>Actes facturables hors dossiers en pause : {{ len_acts_invoiced_hors_pause }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_invoiced_hors_pause }}</li>
|
|
<li>Nombre de factures : {{ len_invoices_hors_pause }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes facturables pour les dossiers hors pause.</li>
|
|
{% endif %}
|
|
|
|
{% if len_acts_invoiced_pause %}
|
|
<li>Actes facturables des dossiers en pause : {{ len_acts_invoiced_pause }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_invoiced_pause }}</li>
|
|
<li>Nombre de factures : {{ len_invoices_pause }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes facturables pour les dossiers en pause.</li>
|
|
{% endif %}
|
|
|
|
{% if len_acts_lost %}
|
|
<li>Actes facturables mais non pris en charge : {{ len_acts_lost }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_with_lost_acts }}</li>
|
|
<!-- <li>Quota des actes pris en charge dépassé : 2</li>-->
|
|
<!-- <li>Prises en charge expirées : 2</li>-->
|
|
<!-- <li>Pas de prise en charge : 1</li>-->
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes facturables mais non pris en charge.</li>
|
|
{% endif %}
|
|
|
|
{% if len_acts_paused %}
|
|
<li>Actes facturables en pause facturation : {{ len_acts_paused }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_acts_paused }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes facturables en pause facturation.</li>
|
|
{% endif %}
|
|
|
|
</ul>
|
|
{% else %}
|
|
<ul>
|
|
{% if len_acts_invoiced %}
|
|
<li>Actes facturés : {{ len_acts_invoiced }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patients }}</li>
|
|
<li>Nombre de factures : {{ len_invoices }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes facturés pour cette facturation.</li>
|
|
{% endif %}
|
|
</ul>
|
|
{% endif %}
|
|
{% else %}
|
|
{% if service_name == "CAMSP" %}
|
|
{% if invoicing.status == "closed" %}
|
|
<ul>
|
|
{% if len_patient_hors_pause %}
|
|
<li>Actes décomptables hors dossiers en pause : {{ len_acts_hors_pause }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_hors_pause }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes décomptables pour les dossiers hors pause.</li>
|
|
{% endif %}
|
|
|
|
{% if len_patient_pause %}
|
|
<li>Actes décomptables des dossiers en pause : {{ len_acts_pause }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_pause }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes décomptables pour les dossiers en pause.</li>
|
|
{% endif %}
|
|
|
|
{% if len_acts_paused %}
|
|
<li>Actes décomptables en pause facturation : {{ len_acts_paused }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_acts_paused }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes décomptables en pause facturation.</li>
|
|
{% endif %}
|
|
|
|
</ul>
|
|
{% else %}
|
|
<ul>
|
|
{% if len_patient_hors_pause %}
|
|
<li>Actes décomptés: {{ len_acts_hors_pause }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_hors_pause }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes décomptés pour ce décompte.</li>
|
|
{% endif %}
|
|
</ul>
|
|
{% endif %}
|
|
{% else %}
|
|
{% if invoicing.status == "closed" %}
|
|
<ul>
|
|
{% if len_patient_hors_pause %}
|
|
<li>Actes décomptables hors dossiers en pause : {{ len_acts_hors_pause }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_hors_pause }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes décomptables pour les dossiers hors pause.</li>
|
|
{% endif %}
|
|
|
|
{% if len_patient_missing_notif %}
|
|
<li>Actes décomptables mais non couverts par une notification : {{ len_acts_missing_notif }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_missing_notif }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes décomptables avec une notification manquante.</li>
|
|
{% endif %}
|
|
|
|
{% if len_patient_pause %}
|
|
<li>Actes décomptables des dossiers en pause : {{ len_acts_pause }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_pause }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes décomptables pour les dossiers en pause.</li>
|
|
{% endif %}
|
|
|
|
{% if len_acts_paused %}
|
|
<li>Actes décomptables en pause facturation : {{ len_acts_paused }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_acts_paused }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes décomptables en pause facturation.</li>
|
|
{% endif %}
|
|
|
|
</ul>
|
|
{% else %}
|
|
<ul>
|
|
{% if len_patient_hors_pause %}
|
|
<li>Actes décomptés : {{ len_acts_hors_pause }}
|
|
<ul>
|
|
<li>Dossiers concernés : {{ len_patient_hors_pause }}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>Pas d'actes décomptés pour ce décompte.</li>
|
|
{% endif %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if service_name == "CMPP" and patients_stats %}
|
|
<div id="dossiers">
|
|
<h3>Dossiers concernés</h3>
|
|
{% if invoicing.status == "open" or invoicing.status == "closed" %}
|
|
<p id="filtre-dossiers">
|
|
<input type="checkbox" id="hide-dossiers-cb"><label for="hide-dossiers-cb">N'afficher que les dossiers en pause facturation ou
|
|
avec des actes facturables mais non prise en charge.</label></input>
|
|
</p>
|
|
<div id="dossiers-concernes">
|
|
{% for patient, detail in patients_stats.items %}
|
|
{% if patient.pause or "losts" in detail.keys or "acts_paused" in detail.keys %}
|
|
<div class="frame dossier facturable">
|
|
{% else %}
|
|
<div class="frame dossier">
|
|
{% endif %}
|
|
<h3><a href="../../dossiers/{{ patient.pk }}/view">
|
|
{% if patient.paper_id %}{{ patient.paper_id }}/{% endif %}{{ patient.pk }} {{ patient.first_name }} <strong>{{ patient.last_name }}</strong></a></h3>
|
|
<div class="info">
|
|
</div>
|
|
{% if patient.pause %}<p id="pause-fac"><span class="hi-fact">Le dossier patient est en pause facturation.</span></p>{% endif %}
|
|
{% if "losts" in detail.keys %}<p id="pause-fac"><span class="hi-fact">Le dossier présente des actes facturables non pris en charge.</span></p>{% endif %}
|
|
{% if "acts_paused" in detail.keys %}<p id="pause-fac"><span class="hi-fact">Le dossier présente des actes facturables en pause facturation.</span></p>{% endif %}
|
|
<ul>
|
|
{% for key, value in detail.items %}
|
|
{% if key == "invoices" %}
|
|
<li>Actes facturables <button class="blind">détails</button>
|
|
<ul>
|
|
{% for invoice in value %}
|
|
{% for k, v in invoice.items %}
|
|
{% if k == "acts" %}
|
|
{% for act, hc in v %}
|
|
<li>{{ act.date }} {{ act.act_type }}</li>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% if key == "losts" %}
|
|
<li>Actes facturables non pris en charge <button class="blind">détails</button>
|
|
<ul>
|
|
{% for act in value %}
|
|
<li>{{ act.date }} {{ act.act_type }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% if key == "acts_paused" %}
|
|
<li>Actes facturables en pause facturation <button class="blind">détails</button>
|
|
<ul>
|
|
{% for act in value %}
|
|
<li>{{ act.date }} {{ act.act_type }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<div id="dossiers-concernes">
|
|
{% for patient, detail in patients_stats.items %}
|
|
<div class="frame dossier" id="to-hide">
|
|
<h3><a href="../../dossiers/{{ patient.pk }}/view">
|
|
{% if patient.paper_id %}{{ patient.paper_id }}/{% endif %}{{ patient.pk }} {{ patient.first_name }} <strong>{{ patient.last_name }}</strong></a></h3>
|
|
<div class="info">
|
|
</div>
|
|
<ul>
|
|
{% for key, value in detail.items %}
|
|
{% if key == "invoices" %}
|
|
<li>Actes facturés <button class="blind">détails</button>
|
|
<ul>
|
|
{% for invoice in value %}
|
|
<li>Facture {{ invoice.number }}
|
|
<ul>
|
|
{% for act in invoice.acts.all %}
|
|
<li>{{ act.date }} {{ act.act_type }}<button>Refacturer</button></li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
{% if service_name == "CAMSP" and patients_stats %}
|
|
<div id="dossiers">
|
|
<h3>Dossiers concernés</h3>
|
|
{% if invoicing.status == "closed" %}
|
|
<p id="filtre-dossiers">
|
|
<input type="checkbox" id="hide-dossiers-cb"><label for="hide-dossiers-cb">N'afficher que les dossiers en pause facturation ou avec un acte en pause.</label></input>
|
|
</p>
|
|
<div id="dossiers-concernes">
|
|
{% for patient, detail in patients_stats.items %}
|
|
{% if patient.pause or "acts_paused" in detail.keys %}
|
|
<div class="frame dossier facturable">
|
|
{% else %}
|
|
<div class="frame dossier">
|
|
{% endif %}
|
|
<h3><a href="../../dossiers/{{ patient.pk }}/view">
|
|
{% if patient.paper_id %}{{ patient.paper_id }}/{% endif %}{{ patient.pk }} {{ patient.first_name }} <strong>{{ patient.last_name }}</strong></a></h3>
|
|
<div class="info">
|
|
</div>
|
|
{% if patient.pause %}<p id="pause-fac"><span class="hi-fact">Le dossier patient est en pause facturation.</span></p>{% endif %}
|
|
{% if "acts_paused" in detail.keys %}<p id="pause-fac"><span class="hi-fact">Le dossier présente des actes facturables en pause facturation.</span></p>{% endif %}
|
|
<ul>
|
|
{% for key, value in detail.items %}
|
|
{% if key == "accepted" %}
|
|
<li>Actes décomptables <button class="blind">détails</button>
|
|
<ul>
|
|
{% for act in value %}
|
|
<li>{{ act.date }} {{ act.act_type }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% if key == "acts_paused" %}
|
|
<li>Actes décomptables en pause facturation <button class="blind">détails</button>
|
|
<ul>
|
|
{% for act in value %}
|
|
<li>{{ act.date }} {{ act.act_type }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<div id="dossiers-concernes">
|
|
{% for patient, detail in patients_stats.items %}
|
|
<div class="frame dossier" id="to-hide">
|
|
<h3><a href="../../dossiers/{{ patient.pk }}/view">
|
|
{% if patient.paper_id %}{{ patient.paper_id }}/{% endif %}{{ patient.pk }} {{ patient.first_name }} <strong>{{ patient.last_name }}</strong></a></h3>
|
|
<div class="info">
|
|
</div>
|
|
<ul>
|
|
{% for key, value in detail.items %}
|
|
{% if key == "accepted" %}
|
|
<li>Actes décomptés <button class="blind">détails</button>
|
|
<ul>
|
|
{% for act in value %}
|
|
<li>{{ act.date }} {{ act.act_type }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
{% if service_name == "SESSAD DYS" or service_name == "SESSAD TED" %}
|
|
{% if patients_stats %}
|
|
<div id="dossiers">
|
|
<h3>Dossiers concernés</h3>
|
|
{% if invoicing.status == "closed" %}
|
|
<p id="filtre-dossiers">
|
|
<input type="checkbox" id="hide-dossiers-cb"><label for="hide-dossiers-cb">N'afficher que les dossiers en pause facturation ou avec un acte en pause.</label></input>
|
|
</p>
|
|
<div id="dossiers-concernes">
|
|
{% for patient, detail in patients_stats.items %}
|
|
{% if patient.pause or "acts_paused" in detail.keys %}
|
|
<div class="frame dossier facturable">
|
|
{% else %}
|
|
<div class="frame dossier">
|
|
{% endif %}
|
|
<h3><a href="../../dossiers/{{ patient.pk }}/view">
|
|
{% if patient.paper_id %}{{ patient.paper_id }}/{% endif %}{{ patient.pk }} {{ patient.first_name }} <strong>{{ patient.last_name }}</strong></a></h3>
|
|
<div class="info">
|
|
</div>
|
|
{% if patient.pause %}<p id="pause-fac"><span class="hi-fact">Le dossier patient est en pause facturation.</span></p>{% endif %}
|
|
{% if "acts_paused" in detail.keys %}<p id="pause-fac"><span class="hi-fact">Le dossier présente des actes facturables en pause facturation.</span></p>{% endif %}
|
|
<ul>
|
|
{% for key, value in detail.items %}
|
|
{% if key == "accepted" %}
|
|
<li>Actes décomptables <button class="blind">détails</button>
|
|
<ul>
|
|
{% for act in value %}
|
|
<li>{{ act.date }} {{ act.act_type }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% if key == "missings" %}
|
|
<li>Actes décomptables non couverts par une notification <button class="blind">détails</button>
|
|
<ul>
|
|
{% for act in value %}
|
|
<li>{{ act.date }} {{ act.act_type }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% if key == "acts_paused" %}
|
|
<li>Actes décomptables en pause facturation <button class="blind">détails</button>
|
|
<ul>
|
|
{% for act in value %}
|
|
<li>{{ act.date }} {{ act.act_type }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<div id="dossiers-concernes">
|
|
{% for patient, detail in patients_stats.items %}
|
|
<div class="frame dossier" id="to-hide">
|
|
<h3><a href="../../dossiers/{{ patient.pk }}/view">
|
|
{% if patient.paper_id %}{{ patient.paper_id }}/{% endif %}{{ patient.pk }} {{ patient.first_name }} <strong>{{ patient.last_name }}</strong></a></h3>
|
|
<div class="info">
|
|
</div>
|
|
<ul>
|
|
{% for key, value in detail.items %}
|
|
{% if key == "accepted" %}
|
|
<li>Actes décomptés <button class="blind">détails</button>
|
|
<ul>
|
|
{% for act in value %}
|
|
<li>{{ act.date }} {{ act.act_type }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block dialogs %}
|
|
<div id="close-dialog" title="Clôture">
|
|
<div id="close-dialog-content">
|
|
</div>
|
|
<form method="post" action="clore/">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="Close" value="1">
|
|
</form>
|
|
</div>
|
|
|
|
<div id="validate-dialog" title="Validation {% if service_name == "CMPP" %}de la facturation{% else %}du décompte{% endif %}">
|
|
<div id="validate-dialog-content">
|
|
</div>
|
|
<form method="post" action="validate/">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="Close" value="1">
|
|
</form>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block page-end %}
|
|
<script>
|
|
$('#close-dialog').dialog({
|
|
autoOpen: false,
|
|
modal: true,
|
|
buttons: {
|
|
"Valider": function () { $('#close-dialog form').submit(); },
|
|
"Annuler": function () { $(this).dialog("close"); },
|
|
},
|
|
});
|
|
$('#close').click(function () {
|
|
$('#close-dialog-content').load('clore/',
|
|
function () {
|
|
$('#close-dialog').dialog('open');
|
|
}
|
|
);
|
|
});
|
|
$('#validate-dialog').dialog({
|
|
autoOpen: false,
|
|
modal: true,
|
|
buttons: {
|
|
"Valider": function () { $('#validate-dialog form').submit(); },
|
|
"Annuler": function () { $(this).dialog("close"); },
|
|
},
|
|
});
|
|
$('#validate').click(function () {
|
|
$('#validate-dialog-content').load('validate/',
|
|
function () {
|
|
$('#validate-dialog').dialog('open');
|
|
}
|
|
);
|
|
});
|
|
$('button.blind').next().hide();
|
|
$('button.blind').click(function() {
|
|
$(this).next().toggle('blind');
|
|
});
|
|
</script>
|
|
{% endblock %}
|