示例#1
0
 /**
  * Redefinition du store
  * 
  * @return void|string
  **/
 function store()
 {
     if (!$this->_id && $this->object_class && $this->object_id) {
         $this->_ref_object = new $this->object_class();
         $this->_ref_object->load($this->object_id);
         $this->_ref_object->loadRefPatient();
         $this->_ref_object->loadRefPraticien();
         $this->_ref_object->loadRefsObjects();
         $this->_ref_object->loadRefsReglements();
         $this->_ref_object->loadRefsRelances();
         $this->date = CMbDT::date();
         $this->du_patient = $this->_ref_object->_du_restant_patient + $this->_ref_object->_reglements_total_patient;
         $this->du_tiers = $this->_ref_object->_du_restant_tiers + $this->_ref_object->_reglements_total_tiers;
         $der_relance = $this->_ref_object->_ref_last_relance;
         if ($der_relance->_id) {
             if ($der_relance->statut == "inactive") {
                 return "La derniere relance est inactive";
             }
             if ($der_relance->etat != "regle") {
                 $this->numero = $der_relance->numero + 1;
                 $der_relance->etat = "renouvelle";
                 $der_relance->store();
             } else {
                 return "La derniere relance est reglee";
             }
         }
         if (!$this->numero) {
             $this->numero = 1;
         }
         switch ($this->numero) {
             case "1":
                 $this->du_patient += CAppUI::conf("dPfacturation CRelance add_first_relance");
                 $this->statut = "first";
                 break;
             case "2":
                 $this->du_patient += CAppUI::conf("dPfacturation CRelance add_second_relance");
                 $this->statut = "second";
                 break;
             case "3":
                 $this->du_patient += CAppUI::conf("dPfacturation CRelance add_third_relance");
                 $this->statut = "third";
                 break;
         }
     }
     // Standard store
     if ($msg = parent::store()) {
         return $msg;
     }
 }
示例#2
0
foreach ($factures as $key => $_facture) {
    /* @var CFactureCabinet $_facture*/
    $_facture->loadRefPatient();
    $_facture->loadRefsItems();
    $_facture->loadRefsConsultation();
    $nb_tarmed = count($_facture->_ref_actes_tarmed);
    $nb_caisse = count($_facture->_ref_actes_caisse);
    $nb_ngap = count($_facture->_ref_actes_ngap);
    $nb_ccam = count($_facture->_ref_actes_ccam);
    if (count($_facture->_ref_consults) == 0) {
        unset($factures[$key]);
    }
}
$derconsult_id = null;
if ($facture_id && isset($factures[$facture_id])) {
    $facture->load($facture_id);
    $facture->loadRefPatient();
    $facture->_ref_patient->loadRefsCorrespondantsPatient();
    $facture->loadRefPraticien();
    $facture->loadRefAssurance();
    $facture->loadRefsObjects();
    $facture->loadRefsReglements();
    $facture->loadRefsRelances();
    $facture->loadRefsNotes();
    if ($facture->_ref_consults) {
        $derconsult_id = $facture->_ref_last_consult->_id;
    }
    $facture->_ref_patient->loadRefsCorrespondantsPatient();
}
$reglement = new CReglement();
$banque = new CBanque();