$canEditPlage = $plage->getPerm(PERM_EDIT); // Praticien selectionné $chirSel = CValue::getOrSession("chirSel", $chir ? $chir->user_id : null); // function selected $function_id = CValue::getOrSession("function_id"); $listFnc = array(); if ($function_id) { $listChir = CConsultation::loadPraticiens(PERM_EDIT, $function_id, null, true); foreach ($listChir as $_chir) { $_chir->loadRefFunction(); } } else { $listChir = CConsultation::loadPraticiens(PERM_EDIT); } // Liste des consultations a avancer si desistement $ds = $plage->getDS(); $now = CMbDT::date(); // get desistements $count_si_desistement = CConsultation::countDesistementsForDay($function_id ? array_keys($listChir) : array($chirSel), $now); // Liste des praticiens $fnc = new CFunctions(); $listFnc = $fnc->loadListWithPerms(PERM_READ, array("group_id" => " = '{$group->_id}' "), 'text'); $mediuser = new CMediusers(); foreach ($listFnc as $id => $_fnc) { $users = $mediuser->loadProfessionnelDeSanteByPref(PERM_READ, $_fnc->_id, null, true); if (!count($users)) { unset($listFnc[$id]); } } // if only one function and function_id if (count($listFnc) == 1 && !$chirSel) {
$function = $mediuser->loadRefFunction(); // Filter $filter = new CPlageconsult(); $filter->_function_id = CValue::get("_function_id", $function->type == "cabinet" ? $function->_id : null); $filter->_date_min = CValue::get("_date_min", CMbDT::date("last month")); $filter->_date_max = CValue::get("_date_max", CMbDT::date()); $filter->_user_id = CValue::get("_user_id", null); $compute_mode = CValue::get("compute_mode"); $csv = CValue::get("csv"); $page = (int) CValue::get("page", 0); $limit = 1000; if ($csv) { $limit = 10000; } $group_id = CGroups::loadCurrent()->_id; $ds = $filter->getDS(); $list = array(); if ($compute_mode == "adresse_par") { $query = "SELECT\n consultation.adresse_par_prat_id,\n COUNT(consultation.consultation_id) AS total\n FROM consultation\n LEFT JOIN plageconsult ON plageconsult.plageconsult_id = consultation.plageconsult_id\n LEFT JOIN users_mediboard ON users_mediboard.user_id = plageconsult.chir_id\n LEFT JOIN functions_mediboard ON functions_mediboard.function_id = users_mediboard.function_id\n WHERE\n functions_mediboard.group_id = ?1 AND\n consultation.adresse_par_prat_id IS NOT NULL"; $query = $ds->prepare($query, $group_id); if ($filter->_date_min) { $query .= $ds->prepare(" AND plageconsult.date >= ?", $filter->_date_min); } if ($filter->_date_max) { $query .= $ds->prepare(" AND plageconsult.date <= ?", $filter->_date_max); } if ($filter->_user_id) { $query .= $ds->prepare(" AND users_mediboard.user_id = ?", $filter->_user_id); } if ($filter->_function_id) { $query .= $ds->prepare(" AND functions_mediboard.function_id = ?", $filter->_function_id);
global $date, $chir_id, $print; $print = 1; $function_id = CValue::get("function_id"); $date = CValue::get("date"); $start = CMbDT::date("this monday", $date); if ($start > $date) { $start = CMbDT::date("last monday", $date); } $end = CMbDT::date("next sunday", $start); $muser = new CMediusers(); $musers = $muser->loadProfessionnelDeSanteByPref(PERM_READ, $function_id); $function = new CFunctions(); $function->load($function_id); echo "<h1>" . $function->_view . " (" . CMbDT::format($start, CAppUI::conf('longdate')) . " - " . CMbDT::format($end, CAppUI::conf('longdate')) . ")</h1>"; $pconsult = new CPlageconsult(); $ds = $pconsult->getDS(); $where = array(); $where[] = "chir_id " . $ds->prepareIn(array_keys($musers)) . " OR remplacant_id " . $ds->prepareIn(array_keys($musers)); $where["date"] = " BETWEEN '{$start}' AND '{$end}' "; /** @var CPlageconsult[] $pconsults */ $pconsults = $pconsult->loadList($where, "date", null, "chir_id"); $pconsults_by_date_and_prat = array(); if (!count($pconsults)) { echo "<div class='small-info'>Les praticiens de ce cabinet n'ont pas de plages de consultations sur cette période</div>"; CApp::rip(); } foreach ($pconsults as $_pc) { $chir_id = CValue::get("chir_id", $_pc->chir_id); $_pc->loadRefChir(); $_pc->loadRefRemplacant(); echo "<h2>";
* @version $Revision$ * @link http://www.mediboard.org */ CCanDo::checkRead(); $type = CValue::get("type"); $nb = CValue::get("number", 1); $date = CValue::get("date"); $chir_id = CValue::get("chir_id"); $function_id = CValue::get("function_id"); $plages = array(); if (!$type || !$nb) { CApp::json($plages); } // get current $plage_consult = new CPlageconsult(); $ds = $plage_consult->getDS(); $where = array(); $where['date'] = " = '{$date}' "; $where['locked'] = " != '1' "; if ($chir_id) { $where['chir_id'] = " = '{$chir_id}' "; $plage_consult->loadObject($where); } if (!$plage_consult->_id && $function_id) { $mediuser = new CMediusers(); $users = $mediuser->loadProfessionnelDeSante(PERM_READ, $function_id); $where["chir_id"] = $ds->prepareIn(array_keys($users)); $plage_consult->loadObject($where); } if (!$plage_consult->_id) { CApp::json($plages);