Project

General

Profile

Download (23.9 KB) Statistics
| Branch: | Tag: | Revision:

calebasse / calebasse / facturation / templates / facturation / detail.html @ 3bb50103

1
{% extends "facturation/base.html" %}
2
{% load url from future %}
3

    
4
{% block appbar %}
5
    <h2>
6

    
7
    {% if service_name == "CMPP" %}
8
        Facturation {{ invoicing.seq_id }}
9
        {% if invoicing.status == "open" %}
10
            ouverte et ayant débuté le {{ invoicing.start_date }}
11
        {% else %}
12
            {% if invoicing.status == "closed" %}
13
            fermée
14
            {% else %}
15
            validée
16
            {% endif %}
17
            couvrant la période du {{ invoicing.start_date }} au {{ invoicing.end_date }}
18
        {% endif %}
19
    {% else %}
20
        Décompte {{ invoicing.seq_id }}
21
        {% if invoicing.status == "validated" %}
22
        validé
23
        {% endif %}
24
        pour le trimestre allant du {{ invoicing.start_date }} au {{ invoicing.end_date }}
25
    {% endif %}</h2>
26
    <a href="..">Retourner à la liste</a>
27
    {% if service_name == "CMPP" %}
28
        {% if invoicing.status == "open" %}<button id="close-invoicing">Clore cette facturation</button>{% endif %}
29
        {% if invoicing.status == "closed" %}<button id="validate"">Valider cette facturation</button>{% endif %}
30
        {% if invoicing.status == "validated" %}
31
            <!--<button id="teletrans-btn">Télétransmission à l'assurance maladie</button>-->
32
            <button onclick="window.location.href=window.location.href+'export/'">Export comptabilité</button>
33
            <button onclick="window.location.href=window.location.href+'download/'">Imprimer</button>
34
        {% endif %}
35
    {% else %}
36
        {% if show_validation_btn %}<button id="validate">Valider ce décompte</button>{% endif %}
37
        {% if invoicing.status == "validated" %}<button id="print-btn" onclick="window.location.href=window.location.href+'download/'">Imprimer</button>{% endif %}
38
    {% endif %}
39
{% endblock %}
40

    
41
{% block content %}
42

    
43
    <div id="facturation-contents">
44
    {% if days_not_locked %}
45
    <h3>Jours non verrouillés</h3>
46
        <ul>
47
        {% for day in days_not_locked %}
48
            <li><a href="../../agenda/{{ day.year }}-{{ day.month }}-{{ day.day }}/validation-des-actes">{{ day.day }}/{{ day.month }}/{{ day.year }}</a></li>
49
        {% endfor %}
50
        </ul>
51
    {% endif %}
52
    <h3>Résumé</h3>
53
    {% if service_name == "CMPP" %}
54
        {% if invoicing.status == "open" or invoicing.status == "closed" %}
55
        <ul>
56
            {% if len_acts_invoiced_hors_pause %}
57
              <li>Actes facturables hors dossiers en pause ou avec des informations de sécurité sociale manquantes : {{ len_acts_invoiced_hors_pause }}
58
                <ul>
59
                  <li>Dossiers concernés : {{ len_patient_invoiced_hors_pause }}</li>
60
                  <li>Nombre de factures : {{ len_invoices_hors_pause }}</li>
61
                </ul>
62
              </li>
63
            {% else %}
64
              <li>Pas d'actes facturables pour des dossiers hors pause.</li>
65
            {% endif %}
66

    
67
            {% if len_acts_invoiced_pause %}
68
              <li>Actes facturables des dossiers en pause : {{ len_acts_invoiced_pause }}
69
                <ul>
70
                  <li>Dossiers concernés : {{ len_patient_invoiced_pause }}</li>
71
                  <li>Nombre de factures : {{ len_invoices_pause }}</li>
72
                </ul>
73
              </li>
74
            {% else %}
75
              <li>Pas d'actes facturables pour des dossiers en pause.</li>
76
            {% endif %}
77

    
78
            {% if len_acts_lost_missing_policy %}
79
              <li>Actes de dossiers avec des informations de sécurité sociale manquantes : {{ len_acts_lost_missing_policy }}
80
                <ul>
81
                  <li>Dossiers concernés : {{ len_patient_with_lost_acts_missing_policy }}</li>
82
                </ul>
83
              </li>
84
            {% else %}
85
              <li>Pas d'actes pour des dossiers avec des informations de sécurité sociale manquantes.</li>
86
            {% endif %}
87

    
88
            {% if len_acts_lost %}
89
              <li>Actes facturables mais non pris en charge : {{ len_acts_lost }}
90
                <ul>
91
                  <li>Dossiers concernés : {{ len_patient_with_lost_acts }}</li>
92
        <!--          <li>Quota des actes pris en charge dépassé : 2</li>-->
93
        <!--          <li>Prises en charge expirées : 2</li>-->
94
        <!--          <li>Pas de prise en charge : 1</li>-->
95
                </ul>
96
              </li>
97
            {% else %}
98
              <li>Pas d'actes facturables mais non pris en charge.</li>
99
            {% endif %}
100

    
101
            {% if len_acts_paused %}
102
              <li>Actes facturables en pause facturation : {{ len_acts_paused }}
103
                <ul>
104
                  <li>Dossiers concernés : {{ len_patient_acts_paused }}</li>
105
                </ul>
106
              </li>
107
            {% else %}
108
              <li>Pas d'actes facturables en pause facturation.</li>
109
            {% endif %}
110

    
111
        </ul>
112
        {% else %}
113
        <ul>
114
            {% if len_acts_invoiced %}
115
              <li>Actes facturés : {{ len_acts_invoiced }}
116
                <ul>
117
                  <li>Dossiers concernés : {{ len_patients }}</li>
118
                  <li>Nombre de factures : {{ len_invoices }}</li>
119
                </ul>
120
              </li>
121
            {% else %}
122
              <li>Pas d'actes facturés pour cette facturation.</li>
123
            {% endif %}
124
        </ul>
125
      {% endif %}
126
    {% else %}
127
        {% if service_name == "CAMSP" %}
128
            {% if invoicing.status == "closed" %}
129
            <ul>
130
                {% if len_patient_hors_pause %}
131
                  <li>Actes décomptables hors dossiers en pause : {{ len_acts_hors_pause }}
132
                    <ul>
133
                      <li>Dossiers concernés : {{ len_patient_hors_pause }}</li>
134
                    </ul>
135
                  </li>
136
                {% else %}
137
                  <li>Pas d'actes décomptables pour les dossiers hors pause.</li>
138
                {% endif %}
139

    
140
                {% if len_patient_pause %}
141
                  <li>Actes décomptables des dossiers en pause : {{ len_acts_pause }}
142
                    <ul>
143
                      <li>Dossiers concernés : {{ len_patient_pause }}</li>
144
                    </ul>
145
                  </li>
146
                {% else %}
147
                  <li>Pas d'actes décomptables pour les dossiers en pause.</li>
148
                {% endif %}
149

    
150
                {% if len_acts_paused %}
151
                  <li>Actes décomptables en pause facturation : {{ len_acts_paused }}
152
                    <ul>
153
                      <li>Dossiers concernés : {{ len_patient_acts_paused }}</li>
154
                    </ul>
155
                  </li>
156
                {% else %}
157
                  <li>Pas d'actes décomptables en pause facturation.</li>
158
                {% endif %}
159

    
160
                {% if patients_missing_policy|length %}
161
                  <li>Dossiers avec information de sécurité sociale manquante : {{ patients_missing_policy|length }}
162
                  </li>
163
                {% endif %}
164

    
165
            </ul>
166
            {% else %}
167
            <ul>
168
                {% if len_patient_hors_pause %}
169
                  <li>Actes décomptés: {{ len_acts_hors_pause }}
170
                    <ul>
171
                      <li>Dossiers concernés : {{ len_patient_hors_pause }}</li>
172
                    </ul>
173
                  </li>
174
                {% else %}
175
                  <li>Pas d'actes décomptés pour ce décompte.</li>
176
                {% endif %}
177
            </ul>
178
            {% endif %}
179
        {% else %}
180
            {% if invoicing.status == "closed" %}
181
            <ul>
182
                {% if len_patient_hors_pause %}
183
                  <li>Actes décomptables hors dossiers en pause : {{ len_acts_hors_pause }}
184
                    <ul>
185
                      <li>Dossiers concernés : {{ len_patient_hors_pause }}</li>
186
                    </ul>
187
                  </li>
188
                {% else %}
189
                  <li>Pas d'actes décomptables pour les dossiers hors pause.</li>
190
                {% endif %}
191

    
192
                {% if len_patient_missing_notif %}
193
                  <li>Actes décomptables mais non couverts par une notification : {{ len_acts_missing_notif }}
194
                    <ul>
195
                      <li>Dossiers concernés : {{ len_patient_missing_notif }}</li>
196
                    </ul>
197
                  </li>
198
                {% else %}
199
                  <li>Pas d'actes décomptables avec une notification manquante.</li>
200
                {% endif %}
201

    
202
                {% if len_patient_pause %}
203
                  <li>Actes décomptables des dossiers en pause : {{ len_acts_pause }}
204
                    <ul>
205
                      <li>Dossiers concernés : {{ len_patient_pause }}</li>
206
                    </ul>
207
                  </li>
208
                {% else %}
209
                  <li>Pas d'actes décomptables pour les dossiers en pause.</li>
210
                {% endif %}
211

    
212
                {% if len_acts_paused %}
213
                  <li>Actes décomptables en pause facturation : {{ len_acts_paused }}
214
                    <ul>
215
                      <li>Dossiers concernés : {{ len_patient_acts_paused }}</li>
216
                    </ul>
217
                  </li>
218
                {% else %}
219
                  <li>Pas d'actes décomptables en pause facturation.</li>
220
                {% endif %}
221

    
222
                {% if patients_missing_policy|length %}
223
                  <li>Dossiers avec information de sécurité sociale manquante : {{ patients_missing_policy|length }}
224
                  </li>
225
                {% endif %}
226

    
227
            </ul>
228
            {% else %}
229
            <ul>
230
                {% if len_patient_hors_pause %}
231
                  <li>Actes décomptés : {{ len_acts_hors_pause }}
232
                    <ul>
233
                      <li>Dossiers concernés : {{ len_patient_hors_pause }}</li>
234
                    </ul>
235
                  </li>
236
                {% else %}
237
                  <li>Pas d'actes décomptés pour ce décompte.</li>
238
                {% endif %}
239
            </ul>
240
            {% endif %}
241

    
242
        {% endif %}
243
    {% endif %}
244
    </div>
245

    
246
    {% if service_name == "CMPP" and patients_stats %}
247
    <div id="dossiers">
248
        <h3>Dossiers concernés</h3>
249
        {% if invoicing.status == "open" or invoicing.status == "closed" %}
250
        <p id="filtre-dossiers">
251
         <input type="checkbox" id="hide-dossiers-cb"><label for="hide-dossiers-cb">N'afficher que les dossiers en pause facturation ou
252
         avec des actes facturables mais non prise en charge.</label></input>
253
        </p>
254
        <div id="dossiers-concernes">
255
        {% for patient, detail in patients_stats %}
256
            {% if patient.pause or "losts" in detail.keys or "acts_paused" in detail.keys or "losts_missing_policy" in detail.keys %}
257
             <div class="frame dossier facturable">
258
            {% else %}
259
            <div class="frame dossier">
260
            {% endif %}
261
                <h3><a href="../../dossiers/{{ patient.pk }}/view" target="_blank">
262
                {% if patient.paper_id %}{{ patient.paper_id }} {% endif %}({{ patient.pk }}) {{ patient.first_name }} <span class="lastname">{{ patient.last_name }}</span></a></h3>
263
                <div class="info">
264
                </div>
265
                {% if patient.pause %}<p id="pause-fac"><span class="hi-fact">Le dossier patient est en pause facturation.</span></p>{% endif %}
266
                {% 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 %}
267
                {% if "losts_missing_policy" in detail.keys %}<p id="pause-fac"><span class="hi-fact">Le dossier présente des informations de sécurité sociale manquantes.</span></p>{% endif %}
268
                {% 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 %}
269
                <ul>
270
                {% for key, value in detail.items %}
271
                  {% if key == "invoices" %}
272
                  <li>Actes facturables <button class="blind">détails</button>
273
                    <ul>
274
                        {% for invoice in value %}
275
                        {% for k, v in invoice.items %}
276
                            {% if k == "acts" %}
277
                              {% for act, hc in v %}
278
                                <li>{{ act.date }} {{ act.act_type }}</li>
279
                              {% endfor %}
280
                            {% endif %}
281
                        {% endfor %}
282
                        {% endfor %}
283
                    </ul>
284
                  </li>
285
                  {% endif %}
286
                  {% if key == "losts" %}
287
                  <li>Actes facturables non pris en charge <button class="blind">détails</button>
288
                    <ul>
289
                      {% for act in value %}
290
                        <li>{{ act.date }} {{ act.act_type }}</li>
291
                      {% endfor %}
292
                    </ul>
293
                  </li>
294
                  {% endif %}
295
                  {% if key == "losts_missing_policy" %}
296
                  <li>Actes facturables <button class="blind">détails</button>
297
                    <ul>
298
                      {% for act in value %}
299
                        <li>{{ act.date }} {{ act.act_type }}</li>
300
                      {% endfor %}
301
                    </ul>
302
                  </li>
303
                  {% endif %}
304
                  {% if key == "acts_paused" %}
305
                  <li>Actes facturables en pause facturation <button class="blind">détails</button>
306
                    <ul>
307
                      {% for act in value %}
308
                        <li>{{ act.date }} {{ act.act_type }}</li>
309
                      {% endfor %}
310
                    </ul>
311
                  </li>
312
                  {% endif %}
313
                {% endfor %}
314
                </ul>
315
            </div>
316
        {% endfor %}
317
        </div>
318
        {% else %}
319
        <div id="dossiers-concernes">
320
        {% for patient, detail in patients_stats %}
321
            <div class="frame dossier" id="to-hide">
322
                <h3>{% if patient.pk %}<a href="../../dossiers/{{ patient.pk }}/view" target="_blank">{% endif %}
323
                {% if patient.paper_id %}{{ patient.paper_id }} {% endif %}{% if patient.pk %}({{ patient.pk }}) {% endif %}{{ patient.first_name }} <span class="lastname">{{ patient.last_name }}</span>{% if patient.pk %}</a>{% endif %}</h3>
324
                <div class="info">
325
                </div>
326
                <ul>
327
                {% for key, value in detail.items %}
328
                  {% if key == "invoices" %}
329
                  <li>Actes facturés <button class="blind">détails</button>
330
                    <ul>
331
                        {% for invoice in value %}
332
                        <li>{% if invoice.rejected %}Facture {{ invoice.number }} <strong>rejetée</strong>
333
                          <ul>
334
                          {% for act in invoice.acts.all %}
335
                            <li>{{ act.date }} {{ act.act_type }} </li>
336
                          {% endfor %}
337
                          </ul>
338
                          {% else %}Facture {{ invoice.number }} <button data-id="{{ invoice.id }}" class="rebill-btn">Rejeter cette facture</button>
339
                          <ul>
340
                          {% for act in invoice.acts.all %}
341
                            <li>{{ act.get_hc_tag }} : {{ act.date }} {{ act.act_type }} </li>
342
                          {% endfor %}
343
                          </ul>
344
                          {% endif %}
345
                        </li>
346
                        {% endfor %}
347
                    </ul>
348
                  </li>
349
                  {% endif %}
350
                {% endfor %}
351
                </ul>
352
            </div>
353
        {% endfor %}
354
        </div>
355
        {% endif %}
356
    </div>
357
    {% endif %}
358
    {% if service_name == "CAMSP" and patients_stats %}
359
    <div id="dossiers">
360
        <h3>Dossiers concernés</h3>
361
        {% if invoicing.status == "closed" %}
362
            <p id="filtre-dossiers">
363
             <input type="checkbox" id="hide-dossiers-cb"><label for="hide-dossiers-cb">N'afficher que les dossiers en pause facturation, avec un acte en pause ou avec une information de sécurité sociale manquante.</label></input>
364
            </p>
365
        <div id="dossiers-concernes">
366
        {% for patient, detail in patients_stats %}
367
            {% if patient.pause or "acts_paused" in detail.keys or patient in patients_missing_policy %}
368
             <div class="frame dossier facturable">
369
            {% else %}
370
            <div class="frame dossier">
371
            {% endif %}
372
                <h3><a href="../../dossiers/{{ patient.pk }}/view" target="_blank">
373
                {% if patient.paper_id %}{{ patient.paper_id }} {% endif %}({{ patient.pk }}) {{ patient.first_name }} <span class="lastname">{{ patient.last_name }}</span></a></h3>
374
                <div class="info">
375
                </div>
376
                {% if patient.pause %}<p id="pause-fac"><span class="hi-fact">Le dossier patient est en pause facturation.</span></p>{% endif %}
377
                {% 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 %}
378
                {% if patient in patients_missing_policy %}<p id="pause-fac"><span class="hi-fact">Le dossier présente une information de sécurité sociale manquante.</span></p>{% endif %}
379
                <ul>
380
                {% for key, value in detail.items %}
381
                  {% if key == "accepted" %}
382
                  <li>Actes décomptables <button class="blind">détails</button>
383
                    <ul>
384
                      {% for act in value %}
385
                        <li>{{ act.date }} {{ act.act_type }}</li>
386
                      {% endfor %}
387
                    </ul>
388
                  </li>
389
                  {% endif %}
390
                  {% if key == "acts_paused" %}
391
                  <li>Actes décomptables en pause facturation <button class="blind">détails</button>
392
                    <ul>
393
                      {% for act in value %}
394
                        <li>{{ act.date }} {{ act.act_type }}</li>
395
                      {% endfor %}
396
                    </ul>
397
                  </li>
398
                  {% endif %}
399
                {% endfor %}
400
                </ul>
401
            </div>
402
        {% endfor %}
403
        </div>
404
        {% else %}
405
        <div id="dossiers-concernes">
406
        {% for patient, detail in patients_stats %}
407
            <div class="frame dossier" id="to-hide">
408
                <h3><a href="../../dossiers/{{ patient.pk }}/view" target="_blank">
409
                {% if patient.paper_id %}{{ patient.paper_id }} {% endif %}({{ patient.pk }}) {{ patient.first_name }} <span class="lastname">{{ patient.last_name }}</span></a></h3>
410
                <div class="info">
411
                </div>
412
                <ul>
413
                {% for key, value in detail.items %}
414
                  {% if key == "accepted" %}
415
                  <li>Actes décomptés <button class="blind">détails</button>
416
                    <ul>
417
                      {% for act in value %}
418
                        <li>{{ act.date }} {{ act.act_type }}</li>
419
                      {% endfor %}
420
                    </ul>
421
                  </li>
422
                  {% endif %}
423
                {% endfor %}
424
                </ul>
425
            </div>
426
        {% endfor %}
427
        </div>
428
        {% endif %}
429
    </div>
430
    {% endif %}
431
    {% if service_name == "SESSAD DYS" or service_name == "SESSAD TED" %}
432
        {% if patients_stats %}
433
    <div id="dossiers">
434
        <h3>Dossiers concernés</h3>
435
        {% if invoicing.status == "closed" %}
436
            <p id="filtre-dossiers">
437
             <input type="checkbox" id="hide-dossiers-cb"><label for="hide-dossiers-cb">N'afficher que les dossiers avec une notification manquante, en pause facturation, avec un acte en pause ou avec une information de sécurité sociale manquante.</label></input>
438
            </p>
439
        <div id="dossiers-concernes">
440
        {% for patient, detail in patients_stats %}
441
            {% if patient.pause or "acts_paused" in detail.keys or patient in patients_missing_policy or patient in patients_missing_notif %}
442
             <div class="frame dossier facturable">
443
            {% else %}
444
            <div class="frame dossier">
445
            {% endif %}
446
                <h3><a href="../../dossiers/{{ patient.pk }}/view" target="_blank">
447
                {% if patient.paper_id %}{{ patient.paper_id }} {% endif %}({{ patient.pk }}) {{ patient.first_name }} <span class="lastname">{{ patient.last_name }}</span></a></h3>
448
                <div class="info">
449
                </div>
450
                {% if patient.pause %}<p id="pause-fac"><span class="hi-fact">Le dossier patient est en pause facturation.</span></p>{% endif %}
451
                {% 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 %}
452
                {% if patient in patients_missing_policy %}<p id="pause-fac"><span class="hi-fact">Le dossier présente une information de sécurité sociale manquante.</span></p>{% endif %}
453
                {% if patient in patients_missing_notif %}<p id="pause-fac"><span class="hi-fact">Le dossier n'a pas de notification couvrant tous les actes.</span></p>{% endif %}
454
                <ul>
455
                {% for key, value in detail.items %}
456
                  {% if key == "accepted" %}
457
                  <li>Actes décomptables <button class="blind">détails</button>
458
                    <ul>
459
                      {% for act in value %}
460
                        <li>{{ act.date }} {{ act.act_type }}</li>
461
                      {% endfor %}
462
                    </ul>
463
                  </li>
464
                  {% endif %}
465
                  {% if key == "missings" %}
466
                  <li>Actes décomptables non couverts par une notification <button class="blind">détails</button>
467
                    <ul>
468
                      {% for act in value %}
469
                        <li>{{ act.date }} {{ act.act_type }}</li>
470
                      {% endfor %}
471
                    </ul>
472
                  </li>
473
                  {% endif %}
474
                  {% if key == "acts_paused" %}
475
                  <li>Actes décomptables en pause facturation <button class="blind">détails</button>
476
                    <ul>
477
                      {% for act in value %}
478
                        <li>{{ act.date }} {{ act.act_type }}</li>
479
                      {% endfor %}
480
                    </ul>
481
                  </li>
482
                  {% endif %}
483
                {% endfor %}
484
                </ul>
485
            </div>
486
        {% endfor %}
487
        </div>
488
        {% else %}
489
        <div id="dossiers-concernes">
490
        {% for patient, detail in patients_stats %}
491
            <div class="frame dossier" id="to-hide">
492
                <h3><a href="../../dossiers/{{ patient.pk }}/view" target="_blank">
493
                {% if patient.paper_id %}{{ patient.paper_id }} {% endif %}({{ patient.pk }}) {{ patient.first_name }} <span class="lastname">{{ patient.last_name }}</span></a></h3>
494
                <div class="info">
495
                </div>
496
                <ul>
497
                {% for key, value in detail.items %}
498
                  {% if key == "accepted" %}
499
                  <li>Actes décomptés <button class="blind">détails</button>
500
                    <ul>
501
                      {% for act in value %}
502
                        <li>{{ act.date }} {{ act.act_type }}</li>
503
                      {% endfor %}
504
                    </ul>
505
                  </li>
506
                  {% endif %}
507
                {% endfor %}
508
                </ul>
509
            </div>
510
        {% endfor %}
511
        </div>
512
        {% endif %}
513
    </div>
514
        {% endif %}
515
    {% endif %}
516

    
517
{% endblock %}
518

    
519
{% block dialogs %}
520
<div id="change-record" style="display: none;" data-id="{{ invoicing.id }}" data-service-name="{{ service_name }}">
521
 </div>
522

    
523
<div id="rebill" style="display: none;"  data-id="">
524
 </div>
525

    
526
<div id="validate-dialog" title="Validation {% if service_name == "CMPP" %}de la facturation{% else %}du décompte{% endif %}">
527
  <div id="validate-dialog-content">
528
  </div>
529
  <form method="post" action="validate/">
530
    {% csrf_token %}
531
    <input type="hidden" name="Close" value="1">
532
  </form>
533
</div>
534
{% endblock %}
(6-6/13)