示例#1
0
 /**
  * constructor
  *
  * @param string $date date chosen
  */
 public function __construct($date = null)
 {
     if (!$date) {
         $date = CMbDT::date();
     }
     $this->date = $date;
     $this->number = (int) CMbDT::transform("", $date, "%j");
     $dateTmp = explode("-", $date);
     $this->name = CMbDate::$days_name[(int) $dateTmp[1]][(int) ($dateTmp[2] - 1)];
     $this->_nbDaysYear = CMbDT::format($date, "L") ? 366 : 365;
     $this->days_left = $this->_nbDaysYear - $this->number;
     //jour férie ?
     $holidays = CMbDate::getHolidays($this->date);
     if (array_key_exists($this->date, $holidays)) {
         $this->ferie = $holidays[$this->date];
     }
 }
示例#2
0
 /**
  * load Holidays for the current year
  *
  * @return array _ref_holidays
  */
 function loadHolidays()
 {
     return $this->_ref_holidays = CMbDate::getHolidays($this->date) + CMbDate::getHolidays(CMbDT::date("-1 YEAR", $this->date));
 }
示例#3
0
 * $Id:$
 *
 * @package    Mediboard
 * @subpackage dPpersonnel
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
//CCanDo::checkRead();
$choix = CValue::get("choix", "mois");
$filter = new CPlageConge();
$filter->user_id = CValue::get("user_id", CAppUI::$user->_id);
$filter->date_debut = CValue::get("date_debut", CMbDT::date());
// Tableau des jours fériés sur 2 ans, car
// en mode semaine : 31 décembre - 1 janvier
$bank_holidays = array_merge(CMbDate::getHolidays($filter->date_debut), CMbDate::getHolidays(CMbDT::transform("+1 YEAR", $filter->date_debut, "%Y-%m-%d")));
$mediuser = new CMediusers();
$mediusers = $mediuser->loadListFromType();
if (!$filter->date_debut) {
    $filter->date_debut = Date("Y-m-d");
}
// Si la date rentrée par l'utilisateur est un lundi,
// on calcule le dimanche d'avant et on rajoute un jour.
$tab_start = array();
if ($choix == "semaine") {
    $last_sunday = CMbDT::transform('last sunday', $filter->date_debut, '%Y-%m-%d');
    $last_monday = CMbDT::transform('+1 day', $last_sunday, '%Y-%m-%d');
    $debut_periode = $last_monday;
    $fin_periode = CMbDT::transform('+6 day', $debut_periode, '%Y-%m-%d');
} elseif ($choix == "annee") {
    list($year, $m, $j) = explode("-", $filter->date_debut);
 */
CCanDo::checkRead();
$ds = CSQLDataSource::get("std");
// Initialisation de variables
$date = CValue::getOrSession("date", CMbDT::date());
$month_min = CMbDT::date("first day of +0 month", $date);
$lastmonth = CMbDT::date("last day of -1 month", $date);
$nextmonth = CMbDT::date("first day of +1 month", $date);
$current_m = CValue::get("current_m");
$selSortis = CValue::getOrSession("selSortis", "0");
$type = CValue::getOrSession("type");
$services_ids = CValue::getOrSession("services_ids");
$prat_id = CValue::getOrSession("prat_id");
$only_confirmed = CValue::getOrSession("only_confirmed");
$enabled_service = CValue::getOrSession("active_filter_services", 0);
$bank_holidays = CMbDate::getHolidays($date);
if (is_array($services_ids)) {
    CMbArray::removeValue("", $services_ids);
}
$hier = CMbDT::date("- 1 day", $date);
$demain = CMbDT::date("+ 1 day", $date);
// Initialisation des totaux
$days = array();
for ($day = $month_min; $day < $nextmonth; $day = CMbDT::date("+1 DAY", $day)) {
    $days[$day]["sorties"] = 0;
    $days[$day]["sorties_non_effectuees"] = 0;
    $days[$day]["sorties_non_preparees"] = 0;
    $days[$day]["sorties_non_facturees"] = 0;
}
// filtre sur les types de sortie
$filterType = "";
 /**
  * Récupère les congés pour un pays
  *
  * @param string $date          the date to check
  * @param bool   $includeRegion are the territory holidays included ?
  *
  * @deprecated use CMbDate::getHolidays instead
  * @return array
  *
  */
 function getHolidays($date = null, $includeRegion = true)
 {
     return CMbDate::getHolidays($date, $includeRegion);
 }
        $smarty_plageop = htmlspecialchars_decode(CMbString::htmlEntities($smarty_plageop, ENT_NOQUOTES), ENT_NOQUOTES);
        $event = new CPlanningEvent($_plage->_guid, $debut, $duree, $smarty_plageop, "#efbf99", true, null, $_plage->_guid, false);
        $event->below = true;
        $event->type = "plage_planning";
        $event->plage["id"] = $_plage->_id;
        if ($can_edit) {
            $event->addMenuItem("edit", CMbString::htmlEntities("Modifier cette plage"));
            $event->addMenuItem("list", CMbString::htmlEntities("Gestion des interventions"));
        }
        $planning->addEvent($event);
    }
}
$m = $save_m;
$planning->rearrange(true);
//ReArrange the planning
$bank_holidays = CMbDate::getHolidays($date_planning);
$smarty = new CSmartyDP();
$smarty->assign("planning", $planning);
$smarty->assign("salles", $salles);
$smarty->assign("salles_ids", $salles_ids);
$smarty->assign("date_planning", $date_planning);
$smarty->assign("scroll_top", $scroll_top);
$smarty->assign("show_cancelled", $show_cancelled);
$smarty->assign("show_operations", $show_operations);
$smarty->assign("bank_holidays", $bank_holidays);
$smarty->assign("bloc_id", $bloc_id);
$smarty->assign("prestations", $prestations_journalieres);
$smarty->assign("height_planning_resa", CAppUI::pref("planning_resa_height", 1500));
$smarty->assign("nbIntervNonPlacees", $nbIntervNonPlacees);
$smarty->assign("nbIntervHorsPlage", $nbIntervHorsPlage);
$smarty->assign("nbAlertesInterv", $nbAlertesInterv);
CCanDo::checkRead();
global $period, $periods, $listPraticiens, $chir_id, $function_id, $date, $ndate, $pdate, $plageconsult_id, $print, $consultation_id;
$plageconsult_id = 0;
$_line_element_id = CValue::get("_line_element_id");
if (!$chir_id) {
    $chir_id = reset($listPraticiens);
}
$prat = new CMediusers();
$prat->load($chir_id);
//Planning au format  CPlanningWeek
$today = CMbDT::date();
$debut = $date;
$debut = CMbDT::date("-1 week", $debut);
$debut = CMbDT::date("next monday", $debut);
$fin = CMbDT::date("next sunday", $debut);
$bank_holidays = array_merge(CMbDate::getHolidays($debut), CMbDate::getHolidays($fin));
// Nombre de jours
$nbDays = 5;
$plage = new CPlageconsult();
$whereInterv = array();
$whereHP = array();
$where = array();
$whereInterv["chir_id"] = $whereHP["chir_id"] = " = '{$chir_id}'";
$where[] = "chir_id = '{$chir_id}' OR remplacant_id = '{$chir_id}'";
$where["date"] = $whereInterv["date"] = $whereHP["date"] = "= '{$fin}'";
if ($_line_element_id) {
    $where["pour_tiers"] = "= '1'";
}
if ($plage->countList($where)) {
    $nbDays = 7;
} else {
示例#8
0
        }
    }
}
$empty_liaison = new CItemLiaison();
$empty_liaison->_id = "temp";
$empty_liaison->loadRefItem();
$empty_liaison->loadRefItemRealise();
// La date pour l'ajout d'une prestation ponctuelle doit être dans les dates du séjour
// Si la date actuelle est hors des bornes, alors réinitialisation à la date d'entrée du séjour
$today_ponctuelle = CMbDT::date();
if ($today_ponctuelle < CMbDT::date($sejour->entree) || $today_ponctuelle > CMbDT::date($sejour->sortie)) {
    $today_ponctuelle = CMbDT::date($sejour->entree);
}
$smarty = new CSmartyDP();
$smarty->assign("today", CMbDT::date());
$smarty->assign("today_ponctuelle", $today_ponctuelle);
$smarty->assign("dates", $dates);
$smarty->assign("dates_after", $dates_after);
$smarty->assign("relative_date", $relative_date);
$smarty->assign("sejour", $sejour);
$smarty->assign("affectations", $affectations);
$smarty->assign("prestations_j", $prestations_j);
$smarty->assign("prestations_p", $prestations_p);
$smarty->assign("empty_liaison", $empty_liaison);
$smarty->assign("liaisons_p", $liaisons_p);
$smarty->assign("liaisons_j", $liaisons_j);
$smarty->assign("date_modified", $date_modif);
$smarty->assign("context", $context);
$smarty->assign("editRights", $editRights);
$smarty->assign("bank_holidays", CMbDate::getHolidays(CMbDT::date()));
$smarty->display("inc_vw_prestations.tpl");
示例#9
0
 /**
  * @see parent::check()
  */
 function check()
 {
     // Data checking
     $msg = null;
     if (!$this->plageconsult_id) {
         if (!$this->chir_id) {
             $msg .= "Praticien non valide<br />";
         }
     }
     //plage blocked by holiday config if not immediate consultation
     if (!$this->_immediate_plage) {
         $holidays = CMbDate::getHolidays();
         if (!CAppUI::pref("allow_plage_holiday") && array_key_exists($this->date, $holidays) && !$this->_id) {
             $msg .= CAppUI::tr("CPlageConsult-errror-plage_blocked_by_holidays", $holidays[$this->date]);
         }
     }
     //chir_id se remplace lui même
     if ($this->chir_id == $this->pour_compte_id) {
         $msg .= CAppUI::tr("CPlageConsult-error-pour_compte-equal-chir_id");
     }
     if ($this->chir_id == $this->remplacant_id) {
         $msg .= CAppUI::tr("CPlageConsult-error-remplacant_id-equal-chir_id");
     }
     return $msg . parent::check();
 }
    case "4weeks":
        $minDate = CMbDT::date("last sunday", $date);
        $maxDate = CMbDT::date("+ 3 weeks", CMbDT::date("next saturday", $date));
        $refDate = CMbDT::date("+1 day", $minDate);
        break;
    case "month":
        $minDate = CMbDT::format($date, "%Y-%m-01");
        $maxDate = CMbDT::transform("+1 month", $minDate, "%Y-%m-01");
        $maxDate = CMbDT::date("-1 day", $maxDate);
        $refDate = $minDate;
        break;
    default:
        trigger_error("Période '{$period}' inconnue");
        break;
}
$bank_holidays = array_merge(CMbDate::getHolidays($minDate), CMbDate::getHolidays($maxDate));
$where["date"] = $ds->prepare("BETWEEN %1 AND %2", $minDate, $maxDate);
$where[] = "libelle != 'automatique' OR libelle IS NULL";
$ljoin["users"] = "users.user_id = plageconsult.chir_id OR users.user_id = plageconsult.remplacant_id ";
$order = "date, user_last_name, user_first_name, debut";
// Chargement des plages disponibles
/** @var CPlageconsult[] $listPlage */
$listPlage = $plage->loadList($where, $order, null, "plageconsult_id", $ljoin);
if (!array_key_exists($plageconsult_id, $listPlage)) {
    $plage->_id = $plageconsult_id = null;
}
foreach ($listPlage as $currPlage) {
    if (!$plageconsult_id && $date == $currPlage->date) {
        $plageconsult_id = $currPlage->_id;
    }
    $currPlage->_ref_chir = $listPrat[$currPlage->chir_id];
示例#11
0
 /**
  * Calculate the bank holidays in France
  *
  * @param string $date The relative date, used to calculate the bank holidays of a specific year
  *
  * @deprecated Use CMbDate::getHolidays($date) instead
  * @return array List of bank holidays as dates
  **/
 static function bankHolidays($date = null)
 {
     return CMbDate::getHolidays($date);
 }
    $consultation->countDocItems();
}
if ($chirSel && $plageSel->chir_id != $chirSel) {
    $plageconsult_id = null;
    $plageSel = new CPlageconsult();
}
CValue::setSession("plageconsult_id", $plageconsult_id);
// Liste des chirurgiens
$mediusers = new CMediusers();
$listChirs = $mediusers->loadProfessionnelDeSanteByPref(PERM_EDIT);
$listDaysSelect = array();
for ($i = 0; $i < 7; $i++) {
    $dateArr = CMbDT::date("+{$i} day", $debut);
    $listDaysSelect[$dateArr] = $dateArr;
}
$holidays = CMbDate::getHolidays();
// Variable permettant de compter les jours pour la suppression du samedi et du dimanche
$i = 0;
// Détermination des bornes du semainier
$min = CPlageconsult::$hours_start . ":" . reset(CPlageconsult::$minutes) . ":00";
$max = CPlageconsult::$hours_stop . ":" . end(CPlageconsult::$minutes) . ":00";
// Extension du semainier s'il y a des plages qui dépassent des bornes
// de configuration hours_start et hours_stop
$hours = CPlageconsult::$hours;
$min_hour = sprintf("%01d", CMbDT::transform($min, null, "%H"));
$max_hour = sprintf("%01d", CMbDT::transform($max, null, "%H"));
if (!isset($hours[$min_hour])) {
    for ($i = $min_hour; $i < CPlageconsult::$hours_start; $i++) {
        $hours[$i] = sprintf("%02d", $i);
    }
}
// Bornes de dates
list($period_count, $period_type) = explode("-", $period);
$period_count++;
$date_min = CMbDT::date($date);
$date_max = CMbDT::date("first day of this month", $date);
$date_max = CMbDT::date("+ {$period_count} {$period_type} - 1 day", $date_max);
// Chargement de toutes les plages concernées
$where["chir_id"] = CSQLDataSource::prepareIn(array_keys($praticiens));
$where["date"] = $ds->prepare("BETWEEN %1 AND %2", $date_min, $date_max);
$order = "date, debut";
$plage = new CPlageconsult();
/** @var CPlageconsult[] $plages */
$plages = $plage->loadList($where, $order);
/** @var CPlageconsult[][] $plages Plages par mois*/
$listPlages = array();
$bank_holidays = array_merge(CMbDate::getHolidays($date_min), CMbDate::getHolidays($date_max));
$totals = array();
// Chargement des places disponibles pour chaque plage
foreach ($plages as $_plage) {
    // Classement par mois
    $month = CMbDT::format($_plage->date, "%B %Y");
    $listPlages[$month][] = $_plage;
    // Praticien
    $_plage->_ref_chir = $praticiens[$_plage->chir_id];
    $_plage->_ref_chir->loadRefFunction();
    // Totaux
    if (!isset($totals[$month])) {
        $totals[$month] = array("affected" => 0, "total" => 0);
    }
    $_plage->loadFillRate();
    $totals[$month]["affected"] += $_plage->_affected;