Exemple #1
0
<?php

/**
 * $Id: vw_codes_tarif.php 19425 2013-06-04 18:04:05Z mytto $
 *
 * @package    Mediboard
 * @subpackage Cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 19425 $
 */
CCanDo::checkEdit();
$tarif_id = CValue::getOrSession("tarif_id");
$tarif = new CTarif();
$tarif->load($tarif_id);
$tarif->loadActes();
$tab = array();
if (CAppui::conf("dPccam CCodeCCAM use_cotation_ccam")) {
    $tab["ccam"] = "_ref_code_ccam";
    $tab["ngap"] = "_libelle";
}
if (CModule::getActive("tarmed") && CAppui::conf("tarmed CCodeTarmed use_cotation_tarmed")) {
    $tab["tarmed"] = "_ref_tarmed";
    $tab["caisse"] = "_ref_prestation_caisse";
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("tarif", $tarif);
$smarty->assign("tab", $tab);
$smarty->display("vw_codes_tarif.tpl");
 $tarifs = array();
 $order = "description";
 $where = array();
 $where["chir_id"] = "= '{$chir->_id}'";
 $tarifs["user"] = $tarif->loadList($where, $order);
 foreach ($tarifs["user"] as $_tarif) {
     /**@var CTarif $_tarif */
     $_tarif->getPrecodeReady();
 }
 $where = array();
 $where["function_id"] = "= '{$chir->function_id}'";
 $tarifs["func"] = $tarif->loadList($where, $order);
 foreach ($tarifs["func"] as $_tarif) {
     $_tarif->getPrecodeReady();
 }
 if (CAppui::conf("dPcabinet Tarifs show_tarifs_etab")) {
     $where = array();
     $where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
     $tarifs["group"] = $tarif->loadList($where, $order);
     foreach ($tarifs["group"] as $_tarif) {
         $_tarif->getPrecodeReady();
     }
 }
 $consult = new CConsultation();
 if ($consult_id) {
     $consult->load($consult_id);
 }
 $smarty = new CSmartyDP();
 $smarty->assign("consult", $consult);
 $smarty->assign("sejour", $sejour);
 $smarty->assign("tarifs", $tarifs);
    foreach ($tarifs["func"] as $_tarif) {
        $_tarif->getPrecodeReady();
    }
    if (CAppui::conf("dPcabinet Tarifs show_tarifs_etab")) {
        $where = array();
        $where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
        $tarifs["group"] = $tarif->loadList($where, $order);
        foreach ($tarifs["group"] as $_tarif) {
            $_tarif->getPrecodeReady();
        }
    }
}
//Recherche de la facture pour cette consultation
$facture = $consult->_ref_facture;
$divers = array();
if (CAppui::conf("dPccam CCodable use_frais_divers CConsultation")) {
    $divers = $consult->loadRefsFraisDivers(count($consult->_ref_factures) + 1);
    $consult->loadRefsFraisDivers(null);
}
//Si on a pas de facture on recherche d'une facture ouverte
if (!$facture->_id && CAppUI::conf("ref_pays") == 2) {
    $where = array();
    $where["patient_id"] = "= '{$consult->patient_id}'";
    $plage = $consult->_ref_plageconsult;
    $praticien_id = $plage->pour_compte_id ? $plage->pour_compte_id : $prat_id;
    $where["praticien_id"] = "= '{$praticien_id}'";
    $where["cloture"] = " IS NULL";
    $facture->loadObject($where);
}
if ($facture->_id) {
    $facture->loadRefPatient();