Example #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;
     }
 }
        $where["patient_date_reglement"] = "IS NULL";
        $where["du_patient"] = "> 0";
    }
    if ($filter->_etat_reglement_tiers == "reglee") {
        $where["tiers_date_reglement"] = "IS NOT NULL";
    }
    if ($filter->_etat_reglement_tiers == "non_reglee") {
        $where["tiers_date_reglement"] = "IS NULL";
        $where["du_tiers"] = "> 0";
    }
}
// Reglements via les factures de consultation
$where["cloture"] = "IS NOT NULL";
$where["patient_id"] = "IS NOT NULL";
$order = "ouverture, praticien_id";
$facture = new CFactureCabinet();
if ($all_group_money) {
    $listFactures = $facture->loadList($where, $order, null, null, $ljoin);
} else {
    $listFactures = $facture->loadGroupList($where, $order, null, null, $ljoin);
}
$listPlages = array();
CMbObject::massLoadFwdRef($listFactures, "praticien_id");
CMbObject::massLoadFwdRef($listFactures, "patient_id");
CMbObject::massCountBackRefs($listFactures, "reglements");
CMbObject::massCountBackRefs($listFactures, "notes");
foreach ($listFactures as $_facture) {
    /* @var CFactureCabinet $_facture */
    $_facture->loadRefGroup();
    $_facture->loadRefPatient();
    $_facture->loadRefPraticien();
 /**
  * Fonction permettant à partir d'un numéro de référence de retrouver la facture correspondante
  * 
  * @param string $num_reference le numéro de référence 
  * 
  * @return CFactureCabinet
  **/
 function findFacture($num_reference)
 {
     $facture = new CFactureCabinet();
     $facture->num_reference = $num_reference;
     $facture->loadMatchingObject();
     return $facture;
 }
Example #4
0
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 22159 $
 */
CCanDo::checkEdit();
// Récupération des paramètres
$date_min = CValue::getOrSession("_date_min", CMbDT::date());
$date_max = CValue::getOrSession("_date_max", CMbDT::date());
$chir_id = CValue::getOrSession("chir");
$taux_factures = array();
$list_taux = array();
// Filtre sur les praticiens
$listPrat = CConsultation::loadPraticiensCompta($chir_id);
$where = array();
$where["ouverture"] = "BETWEEN '{$date_min}' AND '{$date_max}'";
$where["facture_cabinet.praticien_id"] = CSQLDataSource::prepareIn(array_keys($listPrat));
$facture = new CFactureCabinet();
$list_taux = explode("|", CAppUI::conf("dPcabinet CConsultation default_taux_tva"));
foreach ($list_taux as $taux) {
    $where["taux_tva"] = " = '{$taux}'";
    $factures = $facture->loadGroupList($where, "ouverture, praticien_id");
    $taux_factures[$taux] = $factures;
}
$total_tva = 0;
$nb_factures = 0;
foreach ($taux_factures as $taux => $factures) {
    $nb_factures += count($factures);
    $total = $totalht = $totalttc = $totalst = 0;
    foreach ($factures as $facture) {
        $facture->loadRefPatient();
        $facture->loadRefPraticien();
        $facture->loadRefsObjects();
 /**
  * Chargement du garant de la facture
  *
  * @param CFactureCabinet|CFactureEtablissement $facture la facture
  *
  * @return string
  */
 function loadGarant($facture)
 {
     $patient = $facture->_ref_patient;
     $facture->loadRefAssurance();
     if (strlen($patient->cp) > 4) {
         $patient->cp = substr($patient->cp, 1);
     }
     $assurance_patient = null;
     $view = "_longview";
     $send_assur = !$facture->send_assur_base && $facture->type_facture == "maladie";
     if ($facture->assurance_maladie && $send_assur && $facture->_ref_assurance_maladie->type_pec != "TG") {
         $assurance_patient = $facture->_ref_assurance_maladie;
     } elseif ($facture->assurance_accident && !$facture->send_assur_compl && $facture->type_facture == "accident") {
         $assurance_patient = $facture->_ref_assurance_accident->type_pec == "TG" ? $patient : $facture->_ref_assurance_accident;
     } else {
         $assurance_patient = $patient;
         $view = "_view";
     }
     return $assurance_patient->{$view};
 }
Example #6
0
if ($patient_id) {
    $where["patient_id"] = " = '{$patient_id}'";
}
if ($numero && !CAppUI::conf("dPfacturation Other use_search_easy") && ($etat_relance || $search_easy == 7)) {
    $where["facture_relance.numero"] = " = '{$numero}'";
}
if ($search_easy == 1) {
    $where["definitive"] = " = '1'";
}
if ($num_facture) {
    $where["facture_id"] = " = '{$num_facture}' ";
}
if ($xml_etat != "") {
    $where["facture"] = " = '{$xml_etat}' ";
}
$facture = new CFactureCabinet();
$factures = $facture->loadList($where, "ouverture ASC", "0, 25", null, $ljoin);
$total_factures = $facture->countMultipleList($where, "facture_id", $ljoin);
$total_factures = $total_factures[0]['total'];
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]);
    }
 /**
  * Charge l'ensemble des reglements sur la consultation, les classe par émetteur et calcul les dus résiduels
  *
  * @return CReglement[]
  */
 function loadRefsReglements()
 {
     // Classement reglements patient et tiers
     $this->_ref_reglements_patient = array();
     $this->_ref_reglements_tiers = array();
     $this->loadRefFacture();
     if ($this->_ref_facture) {
         $this->_ref_reglements = $this->_ref_facture->loadRefsReglements();
         foreach ($this->_ref_reglements as $_reglement) {
             $_reglement->loadRefBanque();
             if ($_reglement->emetteur == "patient") {
                 $this->_ref_reglements_patient[$_reglement->_id] = $_reglement;
             }
             if ($_reglement->emetteur == "tiers") {
                 $this->_ref_reglements_tiers[$_reglement->_id] = $_reglement;
             }
         }
     }
     // Calcul de la somme du restante du patient
     $this->_du_restant_patient = $this->du_patient;
     $this->_reglements_total_patient = 0;
     foreach ($this->_ref_reglements_patient as $_reglement) {
         $this->_du_restant_patient -= $_reglement->montant;
         $this->_reglements_total_patient += $_reglement->montant;
     }
     $this->_du_restant_patient = round($this->_du_restant_patient, 2);
     $this->_reglements_total_patient = round($this->_reglements_total_patient, 2);
     // Calcul de la somme du restante du tiers
     $this->_du_restant_tiers = $this->du_tiers;
     $this->_reglements_total_tiers = 0;
     foreach ($this->_ref_reglements_tiers as $_reglement) {
         $this->_du_restant_tiers -= $_reglement->montant;
         $this->_reglements_total_tiers += $_reglement->montant;
     }
     $this->_du_restant_tiers = round($this->_du_restant_tiers, 2);
     $this->_reglements_total_tiers = round($this->_reglements_total_tiers, 2);
     return $this->_ref_reglements;
 }
/**
 * $Id: $
 *
 * @package    Mediboard
 * @subpackage Cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: $
 */
CCanDo::checkRead();
$facture_id = CValue::get("facture_id");
$patient_id = CValue::get("patient_id");
//Patient sélectionné
$patient = new CPatient();
$patient->load($patient_id);
$patient->loadRefsCorrespondantsPatient();
$facture = new CFactureCabinet();
$facture->load($facture_id);
$facture->loadRefPatient();
$facture->_ref_patient->loadRefsCorrespondantsPatient();
$facture->loadRefPraticien();
$facture->loadRefAssurance();
$facture->loadRefsObjects();
$facture->loadRefsReglements();
$facture->loadRefsRelances();
$facture->loadRefsNotes();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("patient", $patient);
$smarty->assign("facture", $facture);
$smarty->display("inc_vw_assurances.tpl");