Revision 38c89917
Added by Mikaël Ates almost 12 years ago
calebasse/facturation/models.py | ||
---|---|---|
418 | 418 |
if self.status in Invoicing.STATUS.closed: |
419 | 419 |
(acts_not_locked, days_not_locked, acts_not_valide, |
420 | 420 |
acts_not_billable, acts_pause, acts_bad_state, |
421 |
acts_accepted) = self.list_for_billing() |
|
421 |
acts_accepted, patients_missing_policy) = self.list_for_billing()
|
|
422 | 422 |
len_patient_pause = 0 |
423 | 423 |
len_patient_hors_pause = 0 |
424 | 424 |
len_acts_pause = 0 |
... | ... | |
459 | 459 |
len_patient_acts_paused = 0 |
460 | 460 |
len_acts_paused = 0 |
461 | 461 |
days_not_locked = [] |
462 |
patients_missing_policy = [] |
|
462 | 463 |
for act in self.acts.all(): |
463 | 464 |
if act.patient in patients_stats.keys(): |
464 | 465 |
patients_stats[act.patient]['accepted'].append(act) |
... | ... | |
472 | 473 |
return (len_patient_pause, len_patient_hors_pause, |
473 | 474 |
len_acts_pause, len_acts_hors_pause, patients_stats, |
474 | 475 |
days_not_locked, len_patient_acts_paused, |
475 |
len_acts_paused) |
|
476 |
len_acts_paused, patients_missing_policy)
|
|
476 | 477 |
else: |
477 | 478 |
if self.status in Invoicing.STATUS.closed: |
478 | 479 |
(acts_not_locked, days_not_locked, acts_not_valide, |
479 | 480 |
acts_not_billable, acts_pause, acts_bad_state, |
480 |
acts_missing_valid_notification, acts_accepted) = \ |
|
481 |
acts_missing_valid_notification, acts_accepted, |
|
482 |
patients_missing_policy) = \ |
|
481 | 483 |
self.list_for_billing() |
482 | 484 |
|
483 | 485 |
len_patient_pause = 0 |
... | ... | |
488 | 490 |
len_acts_paused = 0 |
489 | 491 |
len_patient_missing_notif = 0 |
490 | 492 |
len_acts_missing_notif = 0 |
491 |
patients = set(acts_accepted.keys() + acts_pause.keys()) |
|
493 |
patients = set(acts_accepted.keys() + \ |
|
494 |
acts_missing_valid_notification.keys() + \ |
|
495 |
acts_pause.keys()) |
|
492 | 496 |
patients_stats = [] |
497 |
patients_missing_notif = [] |
|
493 | 498 |
for patient in patients: |
494 | 499 |
dic = {} |
495 | 500 |
if patient in acts_accepted.keys(): |
... | ... | |
505 | 510 |
for act in acts: |
506 | 511 |
self.acts.add(act) |
507 | 512 |
if patient in acts_missing_valid_notification.keys(): |
513 |
patients_missing_notif.append(patient) |
|
508 | 514 |
acts = acts_missing_valid_notification[patient] |
509 | 515 |
dic['missings'] = acts |
510 | 516 |
len_patient_missing_notif = len_patient_missing_notif + 1 |
511 | 517 |
len_acts_missing_notif = len_acts_missing_notif + len(acts) |
512 | 518 |
if not 'accepted' in dic: |
513 |
len_patient_hors_pause = len_patient_hors_pause + 1 |
|
519 |
if patient.pause: |
|
520 |
len_patient_pause = len_patient_pause + 1 |
|
521 |
len_acts_pause = len_acts_pause + len(acts) |
|
522 |
else: |
|
523 |
len_patient_hors_pause = len_patient_hors_pause + 1 |
|
524 |
len_acts_hors_pause = len_acts_hors_pause + len(acts) |
|
514 | 525 |
if commit: |
515 | 526 |
for act in acts: |
516 | 527 |
self.acts.add(act) |
... | ... | |
535 | 546 |
len_patient_missing_notif = 0 |
536 | 547 |
len_acts_missing_notif = 0 |
537 | 548 |
days_not_locked = [] |
549 |
patients_missing_policy = [] |
|
550 |
patients_missing_notif = [] |
|
538 | 551 |
for act in self.acts.all(): |
539 | 552 |
if act.patient in patients_stats.keys(): |
540 | 553 |
patients_stats[act.patient]['accepted'].append(act) |
... | ... | |
549 | 562 |
len_acts_pause, len_acts_hors_pause, |
550 | 563 |
len_patient_missing_notif, len_acts_missing_notif, |
551 | 564 |
patients_stats, days_not_locked, |
552 |
len_patient_acts_paused, len_acts_paused) |
|
565 |
len_patient_acts_paused, len_acts_paused, |
|
566 |
patients_missing_policy, patients_missing_notif) |
|
553 | 567 |
|
554 | 568 |
def save(self, *args, **kwargs): |
555 | 569 |
if not self.seq_id: |
Also available in: Unified diff
facturation: invoicing stat method returns patients with missing policy.