示例#1
0
 protected function updateDateCodage()
 {
     $ds = $this->ds;
     $query = "SELECT * FROM `codage_ccam`;";
     $rows = $ds->exec($query);
     while ($_codage = $ds->fetchObject($rows, 'CCodageCCAM')) {
         $_codage->loadCodable();
         $date = null;
         switch ($_codage->codable_class) {
             case 'CConsultation':
                 $_codage->_ref_codable->loadRefPlageConsult();
                 $date = $_codage->_ref_codable->_date;
                 break;
             case 'COperation':
                 $date = $_codage->_ref_codable->date;
                 break;
             case 'CSejour':
                 $date = CMbDT::date('', $_codage->_ref_codable->entree);
                 break;
         }
         $query = "UPDATE `codage_ccam`\r\n                  SET `date` = '{$date}' WHERE `codage_ccam_id` = {$_codage->_id};";
         $ds->exec($query);
     }
     return true;
 }
/**
 * Récupération des statistiques du nombre de consultations par mois
 * selon plusieurs filtres
 *
 * @param string $debut   Date de début
 * @param string $fin     Date de fin
 * @param int    $prat_id Identifiant du praticien
 *
 * @return array
 */
function graphConsultations($debut = null, $fin = null, $prat_id = 0)
{
    if (!$debut) {
        $debut = CMbDT::date("-1 YEAR");
    }
    if (!$fin) {
        $fin = CMbDT::date();
    }
    $rectif = CMbDT::transform("+0 DAY", $debut, "%d") - 1;
    $debutact = CMbDT::date("-{$rectif} DAYS", $debut);
    $rectif = CMbDT::transform("+0 DAY", $fin, "%d") - 1;
    $finact = CMbDT::date("-{$rectif} DAYS", $fin);
    $finact = CMbDT::date("+ 1 MONTH", $finact);
    $finact = CMbDT::date("-1 DAY", $finact);
    $pratSel = new CMediusers();
    $pratSel->load($prat_id);
    $ticks = array();
    $serie_total = array('label' => 'Total', 'data' => array(), 'markers' => array('show' => true), 'bars' => array('show' => false));
    for ($i = $debut; $i <= $fin; $i = CMbDT::date("+1 MONTH", $i)) {
        $ticks[] = array(count($ticks), CMbDT::transform("+0 DAY", $i, "%m/%Y"));
        $serie_total['data'][] = array(count($serie_total['data']), 0);
    }
    $ds = CSQLDataSource::get("std");
    $total = 0;
    $series = array();
    $query = "SELECT COUNT(consultation.consultation_id) AS total,\r\n    DATE_FORMAT(plageconsult.date, '%m/%Y') AS mois,\r\n    DATE_FORMAT(plageconsult.date, '%Y%m') AS orderitem\r\n    FROM consultation\r\n    INNER JOIN plageconsult\r\n    ON consultation.plageconsult_id = plageconsult.plageconsult_id\r\n    INNER JOIN users_mediboard\r\n    ON plageconsult.chir_id = users_mediboard.user_id\r\n    WHERE plageconsult.date BETWEEN '{$debutact}' AND '{$finact}'\r\n    AND consultation.annule = '0'";
    if ($prat_id) {
        $query .= "\nAND plageconsult.chir_id = '{$prat_id}'";
    }
    $query .= "\nGROUP BY mois ORDER BY orderitem";
    $serie = array('data' => array());
    $result = $ds->loadlist($query);
    foreach ($ticks as $i => $tick) {
        $f = true;
        foreach ($result as $r) {
            if ($tick[1] == $r["mois"]) {
                $serie["data"][] = array($i, $r["total"]);
                $serie_total["data"][$i][1] += $r["total"];
                $total += $r["total"];
                $f = false;
                break;
            }
        }
        if ($f) {
            $serie["data"][] = array(count($serie["data"]), 0);
        }
    }
    $series[] = $serie;
    // Set up the title for the graph
    $title = "Nombre de consultations";
    $subtitle = "- {$total} consultations -";
    if ($prat_id) {
        $subtitle .= " Dr {$pratSel->_view} -";
    }
    $options = CFlotrGraph::merge("bars", array('title' => utf8_encode($title), 'subtitle' => utf8_encode($subtitle), 'xaxis' => array('ticks' => $ticks), 'bars' => array('stacked' => true, 'barWidth' => 0.8)));
    return array('series' => $series, 'options' => $options);
}
 /**
  * Fill other identifiers
  *
  * @param array         &$identifiers Identifiers
  * @param CPatient      $patient      Person
  * @param CInteropActor $actor        Interop actor
  *
  * @return null
  */
 function fillOtherIdentifiers(&$identifiers, CPatient $patient, CInteropActor $actor = null)
 {
     $ins = $patient->loadLastINS();
     if ($ins) {
         $identifiers[] = array($ins->ins, null, null, $this->getAssigningAuthority("INS-{$ins->type}"), "INS-{$ins->type}", null, CMbDT::date($ins->date));
     }
     if ($patient->matricule) {
         $identifiers[] = array($patient->matricule, null, null, $this->getAssigningAuthority("INSEE"), "SS");
     }
     if ($actor->_configs["send_own_identifier"]) {
         $identifiers[] = array($patient->_id, null, null, $this->getAssigningAuthority("mediboard"), $actor->_configs["build_identifier_authority"] == "PI_AN" ? "PI" : "RI");
     }
 }
示例#4
0
 /**
  * @see parent::store()
  */
 function store()
 {
     // Transfert de séjours vers un autre technicien
     if ($this->_transfer_id) {
         foreach ($this->loadRefsSejours(CMbDT::date()) as $_sejour) {
             $bilan = $_sejour->loadRefBilanSSR();
             $bilan->technicien_id = $this->_transfer_id;
             if ($msg = $bilan->store()) {
                 return $msg;
             }
         }
     }
     return parent::store();
 }
示例#5
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];
     }
 }
 /**
  * @see parent::getValue()
  */
 function getValue($object, $smarty = null, $params = array())
 {
     if ($smarty) {
         include_once $smarty->_get_plugin_filepath('modifier', 'date_format');
     }
     $propValue = $object->{$this->fieldName};
     $format = CMbArray::extract($params, "format", CAppUI::conf("datetime"));
     if ($format === "relative") {
         $relative = CMbDate::relative($propValue, CMbDT::dateTime());
         return $relative["count"] . " " . CAppUI::tr($relative["unit"] . ($relative["count"] > 1 ? "s" : ""));
     }
     $date = CMbArray::extract($params, "date");
     if ($date && CMbDT::date($propValue) == $date) {
         $format = CAppUI::conf("time");
     }
     return $propValue && $propValue != "0000-00-00 00:00:00" ? smarty_modifier_date_format($propValue, $format) : "";
 }
 /**
  * Standard constructor
  *
  * @param date   $date        Reference ISO date
  * @param string $period      One of day, week, month, year
  * @param string $date_column SELECT-like column, might be a expression such as DATE(when)
  * @param int    $nb_periods  Number of periods to display
  */
 public function __construct($date, $period, $date_column, $nb_periods = 30)
 {
     // Prepare periods
     switch ($period) {
         case "day":
             $php_period = "days";
             $sql_date = "{$date_column}";
             break;
         case "week":
             $date = CMbDT::date("next monday", $date);
             $php_period = "weeks";
             $sql_date = "DATE_ADD({$date_column}, INTERVAL (2 - DAYOFWEEK({$date_column})) DAY)";
             break;
         case "month":
             $date = CMbDT::date("first day of +0 month", $date);
             $php_period = "months";
             $sql_date = "DATE_ADD({$date_column}, INTERVAL (1 - DAYOFMONTH({$date_column})) DAY)";
             break;
         case "year":
             $date = CMbDT::format($date, "%Y-01-01");
             $php_period = "years";
             $sql_date = "DATE_ADD({$date_column}, INTERVAL (1 - DAYOFYEAR({$date_column})) DAY)";
             break;
         default:
             $php_period = null;
             $min_date = null;
             $sql_date = null;
             break;
     }
     // Prepare dates
     $dates = array();
     foreach (range(0, $nb_periods - 1) as $n) {
         $dates[] = $min_date = CMbDT::date("- {$n} {$php_period}", $date);
     }
     $dates = array_reverse($dates);
     $min_date = reset($dates);
     $max_date = CMbDT::date("+1 {$this->period} -1 day", end($dates));
     // Members
     $this->date = $date;
     $this->period = $period;
     $this->dates = $dates;
     $this->min_date = $min_date;
     $this->max_date = $max_date;
     $this->php_period = $php_period;
     $this->sql_date = $sql_date;
 }
示例#8
0
 /**
  * add an event to the present planning
  *
  * @param CPlanningEvent $event an event
  *
  * @return null
  */
 function addEvent(CPlanningEvent $event)
 {
     //start plage out of borne
     $date_start = CMbDT::date($event->start);
     if ($date_start != $this->date) {
         $event->day = $this->date;
         $event->start = $this->date . " 00:00:00";
         $event->hour = "00";
         $event->minutes = "00";
         $event->length = CMbDT::minutesRelative($event->start, $event->end);
     }
     //end of plage is out of borne
     $date_end = CMbDT::date($event->end);
     if ($date_end != $this->date) {
         $event->length = CMbDT::minutesRelative($event->start, $this->date . " 23:59:59");
     }
     parent::addEvent($event);
 }
示例#9
0
/**
 * Fonction de construction du cache d'info des durées
 * d'hospi et d'interv
 *
 * @param string $tableName   Nom de la table de cache
 * @param string $tableFields Champs de la table de cache
 * @param array  $queryFields Liste des champs du select
 * @param string $querySelect Chaine contenant les éléments SELECT à utiliser
 * @param array  $queryWhere  Chaine contenant les éléments WHERE à utiliser
 *
 * @return void
 */
function buildPartialTables($tableName, $tableFields, $queryFields, $querySelect, $queryWhere)
{
    $ds = CSQLDataSource::get("std");
    $joinedFields = join(", ", $queryFields);
    // Intervale de temps
    $intervalle = CValue::get("intervalle");
    switch ($intervalle) {
        case "month":
            $deb = CMbDT::date("-1 month");
            break;
        case "6month":
            $deb = CMbDT::date("-6 month");
            break;
        case "year":
            $deb = CMbDT::date("-1  year");
            break;
        default:
            $deb = CMbDT::date("-10 year");
    }
    $fin = CMbDT::date();
    // Suppression si existe
    $drop = "DROP TABLE IF EXISTS `{$tableName}`";
    $ds->exec($drop);
    // Création de la table partielle
    $create = "CREATE TABLE `{$tableName}` (" . "\n`chir_id` int(11) unsigned NOT NULL default '0'," . "{$tableFields}" . "\n`ccam` varchar(255) NOT NULL default ''," . "\nKEY `chir_id` (`chir_id`)," . "\nKEY `ccam` (`ccam`)" . "\n) /*! ENGINE=MyISAM */;";
    $ds->exec($create);
    // Remplissage de la table partielle
    $query = "INSERT INTO `{$tableName}` ({$joinedFields}, `chir_id`, `ccam`)\r\n    SELECT {$querySelect}\r\n    operations.chir_id,\r\n    operations.codes_ccam AS ccam\r\n    FROM operations\r\n    LEFT JOIN users\r\n    ON operations.chir_id = users.user_id\r\n    LEFT JOIN plagesop\r\n    ON operations.plageop_id = plagesop.plageop_id\r\n    WHERE operations.annulee = '0'\r\n    {$queryWhere}\r\n    AND operations.date BETWEEN '{$deb}' AND '{$fin}'\r\n    GROUP BY operations.chir_id, ccam\r\n    ORDER BY ccam;";
    $ds->exec($query);
    CAppUI::stepAjax("Nombre de valeurs pour la table '{$tableName}': " . $ds->affectedRows(), UI_MSG_OK);
    // Insert dans la table principale si vide
    if (!$ds->loadResult("SELECT COUNT(*) FROM temps_op")) {
        $query = "INSERT INTO temps_op ({$joinedFields}, `chir_id`, `ccam`)\r\n      SELECT {$joinedFields}, `chir_id`, `ccam`\r\n      FROM {$tableName}";
        $ds->exec($query);
    } else {
        $query = "UPDATE temps_op, {$tableName} SET ";
        foreach ($queryFields as $queryField) {
            $query .= "\ntemps_op.{$queryField} = {$tableName}.{$queryField}, ";
        }
        $query .= "temps_op.chir_id = {$tableName}.chir_id" . "\nWHERE temps_op.chir_id = {$tableName}.chir_id" . "\nAND temps_op.ccam = {$tableName}.ccam";
        $ds->exec($query);
    }
}
 /**
  * Range constructor
  *
  * @param string $guid      GUID
  * @param string $date      Date
  * @param int    $length    Length
  * @param string $title     Title
  * @param null   $color     Color
  * @param null   $css_class CSS class
  */
 function __construct($guid, $date, $length = 0, $title = "", $color = null, $css_class = null)
 {
     $this->guid = $guid;
     $this->internal_id = "CPlanningRange-" . uniqid();
     $this->start = $date;
     $this->length = $length;
     $this->title = CMbString::htmlEntities($title);
     $this->color = $color;
     $this->css_class = is_array($css_class) ? implode(" ", $css_class) : $css_class;
     if (preg_match("/[0-9]+ /", $this->start)) {
         $parts = split(" ", $this->start);
         $this->end = "{$parts[0]} " . CMbDT::time("+{$this->length} MINUTES", $parts[1]);
         $this->day = $parts[0];
         $this->hour = CMbDT::format($parts[1], "%H");
         $this->minutes = CMbDT::format($parts[1], "%M");
     } else {
         $this->day = CMbDT::date($date);
         $this->end = CMbDT::dateTime("+{$this->length} MINUTES", $date);
         $this->hour = CMbDT::format($date, "%H");
         $this->minutes = CMbDT::format($date, "%M");
     }
 }
示例#11
0
 function is_actif($date)
 {
     $date_debut = CMbDT::date("last sunday", $this->debut);
     $date_debut = CMbDT::date("+1 day", $date_debut);
     $numDayMenu = CMbDT::daysRelative($date_debut, $this->debut);
     $nb_weeks = $this->nb_repet * $this->repetition - 1;
     $date_fin = CMbDT::date("+{$nb_weeks} week", $date_debut);
     $date_fin = CMbDT::date("next monday", $date_fin);
     $date_fin = CMbDT::date("-1 day", $date_fin);
     if ($date < $this->debut || $date > $date_fin) {
         return false;
     }
     $nbDays = CMbDT::daysRelative($date_debut, $date);
     $nbWeeks = floor($nbDays / 7);
     $numDay = $nbDays - $nbWeeks * 7;
     if (!$nbWeeks || !fmod($nbWeeks, $this->repetition)) {
         if ($numDay == $numDayMenu) {
             return true;
         }
     }
     return false;
 }
示例#12
0
 /**
  * @see parent::checkProperty()
  */
 function checkProperty($object)
 {
     $propValue =& $object->{$this->fieldName};
     // Vérification du format
     $matches = array();
     if (!preg_match("/^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})\$/", $propValue, $matches)) {
         if ($propValue === 'current' || $propValue === 'now') {
             $propValue = CMbDT::date();
             return null;
         }
         return "Format de date invalide : '{$propValue}'";
     }
     // Mois grégorien
     $mois = intval($matches[2]);
     if (!CMbRange::in($mois, $this->progressive ? 0 : 1, 12)) {
         // Possibilité de mettre des mois vides ()
         return "Mois '{$mois}' non compris entre 1 et 12 ('{$propValue}')";
     }
     // Jour grégorien
     $jour = intval($matches[3]);
     if (!CMbRange::in($jour, $this->progressive ? 0 : 1, 31)) {
         return "Jour '{$jour}' non compris entre 1 et 31 ('{$propValue}')";
     }
 }
示例#13
0
/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage SSR
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
// Plateau du contexte
$plateau = new CPlateauTechnique();
$plateau->load(CValue::get("plateau_id"));
// Détails des techniciens
$date = CMbDT::date();
foreach ($plateau->loadRefsTechniciens(false) as $_technicien) {
    $_technicien->countSejoursDate($date);
}
// Technicien à editer
$technicien = new CTechnicien();
$technicien->load(CValue::get("technicien_id"));
$technicien->plateau_id = $plateau->_id;
$technicien->loadRefsNotes();
$technicien->loadRefPlateau();
$technicien->loadRefKine();
$technicien->countSejoursDate($date);
// Alter egos pour les transferts de séjours
$where["kine_id"] = "= '{$technicien->kine_id}'";
/** @var CTechnicien[] $alteregos */
$alteregos = $technicien->loadList($where);
 /**
  * Main parse function, trying all barcode standards sequentially
  * 
  * @param string $barcode Row barcode
  * 
  * @return array Array of data
  * @todo Way too long, explode in smaller functions
  */
 static function parse($barcode)
 {
     $orig_barcode = $barcode;
     $barcode = str_replace("    ", "\t", $barcode);
     $comp = array();
     $type = "raw";
     $patt = "";
     if (!$barcode) {
         return array("type" => $type, "comp" => $comp, "patt" => $patt);
     }
     // code 128 with sepataror char
     $separator = self::$code128separator;
     if (preg_match('/^[0-9a-z]+' . $separator . '[0-9a-z]+[0-9a-z\\' . $separator . ']*$/ims', $barcode)) {
         $type = "code128";
         $parts = explode($separator, $barcode);
         foreach ($parts as $p) {
             foreach (self::$code128prefixes as $code => $text) {
                 //if (strpos($p, $code) === 0) { // strpos won't work :(
                 if (substr($p, 0, strlen($code)) == $code) {
                     $comp[self::$code128table[$code]] = substr($p, strlen($code), strlen($p) - strlen($code));
                     break;
                 }
             }
         }
     }
     // code 128
     if (empty($comp) && preg_match('/^(?:(01)(\\d{14}))?(10)([a-z0-9\\/-]{4,20})[^a-z0-9\\/-]?(17)(\\d{6})$/ims', $barcode, $parts) || preg_match('/^(?:(01)(\\d{14}))?(17)(\\d{6})(10)([a-z0-9\\/-]{4,20})[^a-z0-9\\/-]?$/ims', $barcode, $parts) || preg_match('/^(?:(01)(\\d{14}))?(17)(\\d{6})(21)([a-z0-9]{6,20})(30)(\\d{1,2})$/ims', $barcode, $parts) || preg_match('/^(?:(01)(\\d{14}))?(17)(\\d{6})(21)([a-z0-9]{6,20})$/ims', $barcode, $parts) || preg_match('/^(01)(\\d{14})$/i', $barcode, $parts)) {
         $type = "code128";
         $prop = null;
         foreach ($parts as $p) {
             if (array_key_exists($p, self::$code128table)) {
                 $prop = $p;
             } else {
                 if ($prop) {
                     $comp[self::$code128table[$prop]] = $p;
                 } else {
                     $prop = null;
                 }
             }
         }
     }
     // EAN code (13 digits)
     $pattern = '/^(\\d{13})$/ims';
     if (empty($comp) && preg_match($pattern, $barcode, $parts)) {
         $type = "ean13";
         $comp["scc"] = "0{$parts[1]}";
     }
     // 2016-08
     if (empty($comp) && preg_match('/^(20\\d{2})-(\\d{2})$/ms', $barcode, $parts)) {
         $type = "date";
         $date = CMbDT::date("+1 MONTH", $parts[1] . "-" . $parts[2] . "-01");
         $comp["per"] = CMbDT::date("-1 DAY", $date);
     }
     // 130828
     /*if (empty($comp) && preg_match('/^(\d{2})(\d{2})(\d{2})$/ms', $barcode, $parts)){
         $type = "date";
         $comp = CMbDT::date("+1 MONTH", "20".$parts[1]."-".$parts[2]."-01");
         $comp = CMbDT::date("-1 DAY", $comp);
       }*/
     if (empty($comp) && $barcode[0] === "+") {
         $type = "code39";
         $barcode = self::decodeCode39($barcode);
         //     _PER__ __LOT__
         // +$$3130331 3414899 .
         if (empty($comp) && preg_match('/^\\+?\\$\\$[23456789](\\d{6})(\\d+).{2}$/ms', $barcode, $parts)) {
             $comp["per"] = $parts[1];
             $comp["lot"] = $parts[2];
         }
         //        _LOT__
         // +$$03151005377M
         //        __LOT___
         // +$$01150910199AD6
         if (empty($comp) && preg_match('/^\\+?\\$\\$(\\d{4})([A-Z0-9]+).{2}$/ms', $barcode, $parts)) {
             $comp["per"] = $parts[1];
             $comp["lot"] = $parts[2];
         }
         //       __REF___    PER_ __LOT__
         // +M423104003921/$$081309091602Y
         if (empty($comp) && preg_match('/^[a-z]\\d{3}(\\d+).\\/\\$\\$(\\d{4})(.+).$/ms', $barcode, $parts)) {
             $comp["ref"] = $parts[1];
             $comp["per"] = $parts[2];
             $comp["lot"] = $parts[3];
         }
         //       __REF______  ____LOT___
         // +M114EC1YHPAL2301/$1089171008M
         if (empty($comp) && preg_match('/^[a-z]\\d{3}.([^\\/]+)\\/\\$(.+).$/ms', $barcode, $parts)) {
             $comp["ref"] = $parts[1];
             $comp["lot"] = $parts[2];
         }
         //      ___REF___  PER_ __LOT___
         // +H7036307002101/1830461324862J09C
         // +H703630701210 1/1827361332390I09C
         if (empty($comp) && preg_match('/^[a-z](\\d{3})(\\d+.)(\\d)\\/(\\d{5})([A-Z0-9]+)(.{4})$/ms', $barcode, $parts)) {
             $comp["ref"] = $parts[2];
             $comp["per"] = $parts[4];
             $comp["lot"] = $parts[5];
         }
         // Medacta
         //      ___REF____
         // +EMIN012654MBTL15
         if (empty($comp) && preg_match('/^eMIN(.{4,})(.{2})$/ms', $barcode, $parts)) {
             $comp["ref"] = $parts[1];
         }
         // Alcon SN60
         //      ___REF___
         // +H530SN60WF170P1W
         // +H530SN60WF230P1T
         if (empty($comp) && preg_match('/^h\\d{3}SN60WF(\\d{3})P\\d[a-z]$/i', $barcode, $parts)) {
             $type = "alcon";
             $comp["ref"] = "SN60WF.{$parts['1']}";
         }
         //      __REF__
         // +H920246020502
         //      ____REF____
         // +M412RM51100004B1D
         // +M412RM45320004C1L
         if (empty($comp) && preg_match('/^[a-z](\\d{3})([A-Z0-9]+)\\s?.{2}$/ms', $barcode, $parts)) {
             $comp["ref"] = $parts[2];
         }
         //  _PER_ ____LOT___
         // +1512021009296068W$
         // +1530460548095J06RE
         if (empty($comp) && preg_match('/^\\+(\\d{5})(\\d{4,})[A-Z0-9\\$]{2,5}$/ms', $barcode, $parts)) {
             $comp["per"] = self::parsePeremptionDate($parts[1], true);
             $comp["lot"] = $parts[2];
         }
         //   __SN___
         // +$11393812M  // $ or \v
         if (empty($comp) && preg_match('/^\\+.(.+).{2}$/ms', $barcode, $parts)) {
             $comp["lot"] = $parts[1];
         }
     }
     //  __REF______ __LOT___
     // EC1YHPAL20011964210120813E
     if (empty($comp) && preg_match('/^[A-Z](C1YHPAL\\d{4})(\\d{9})(\\d{4})[A-Z]$/ms', $barcode, $parts)) {
         $comp["ref"] = $parts[1];
         $comp["lot"] = $parts[2];
         $comp["per"] = $parts[3];
     }
     // __LOT___ _SN__
     // 09091602/00736
     if (empty($comp) && preg_match('/^(\\d{8})\\/(\\d{5})$/', $barcode, $parts)) {
         $type = "unknown";
         $comp["lot"] = $parts[1];
     }
     // _PER__ _LOT__
     // 032015 A00798
     if (empty($comp) && preg_match('/^(\\d{6})([A-Z]\\d{5})$/', $barcode, $parts)) {
         $type = "code39";
         $comp["per"] = self::parsePeremptionDate($parts[1], true);
         $comp["lot"] = $parts[2];
     }
     //    _REF__ _LOT__
     // SEM241320^P32072L
     if (empty($comp) && preg_match('/^SEM(\\d{6,8})\\^(P\\d+)[A-Z]$/', $barcode, $parts)) {
         $type = "sem";
         $comp["ref"] = $parts[1];
         $comp["lot"] = $parts[2];
     }
     // CIP
     if (empty($comp) && preg_match('/^([3569]\\d{6})$/', $barcode, $parts)) {
         $type = "cip";
         $comp["cip"] = $parts[1];
     }
     // Medicament
     if (empty($comp) && preg_match('/^([2459])(\\d{7})(\\d{6})(0[01])$/', $barcode, $parts)) {
         $type = "med";
         $comp["remb"] = $parts[1];
         $comp["cip"] = $parts[2];
         $comp["price"] = $parts[3];
         $comp["key"] = $parts[4];
     }
     // Arthrex specific
     // REF : PAR-1934BF-2   >>  AR-1934BF-2  (without leading P)
     if (empty($comp) && preg_match('/^P(AR-[A-Z0-9-]+)$/', $barcode, $parts)) {
         $type = "arthrex";
         $comp["ref"] = $parts[1];
     }
     // LOT : T314998   >>  314998  (without leading T)
     if (empty($comp) && preg_match('/^T(\\d{4,9})$/', $barcode, $parts)) {
         $type = "arthrex";
         $comp["lot"] = $parts[1];
     }
     // QTY : Q1   >>  1  (without leading T)
     if (empty($comp) && preg_match('/^Q(\\d{1})$/', $barcode, $parts)) {
         $type = "arthrex";
         $comp["qty"] = $parts[1];
     }
     // Physiol
     // __REF___ __SN__ __STE_ _ __PER_ _
     // 28081230 053653 100609 1 130630 1
     if (empty($comp) && preg_match('/^(\\d{4}[012]\\d{3})(\\d{6})([0123]\\d[01]\\d\\d\\d)\\d([0123]\\d[01]\\d\\d\\d)\\d$/', $barcode, $parts)) {
         $type = "physiol";
         $comp["ref"] = $parts[1];
         $comp["sn"] = $parts[2];
         $comp["per"] = $parts[4];
     }
     // Invent (Karl Zeiss)
     //             _REF__
     // +M303INVENT-ZO24.0124
     if (empty($comp) && preg_match('/^[a-z]\\d{3}INVENT-ZO(\\d{2}\\.\\d)\\d{3}$/i', $barcode, $parts)) {
         $type = "karl_zeiss";
         $comp["ref"] = "invent zo +{$parts['1']}";
     }
     // Quatuorevo
     // QUATUOREVO +15.0 1199914028 2016-08
     if (empty($comp) && preg_match('/^(QUATUOREVO \\+\\d{2}\\.[05]) (\\d{10}) (\\d{4}-\\d{2})$/ms', $barcode, $parts)) {
         $comp["ref"] = $parts[1];
         $comp["lot"] = $parts[2];
         $comp["per"] = $parts[3];
     }
     //  ___LOT__
     // S12345678
     if (empty($comp) && preg_match('/^(S\\d{8})$/', $barcode, $parts)) {
         $type = "medicalens";
         $comp["lot"] = $parts[1];
     }
     //   ___SN__
     // SN0123456
     if (empty($comp) && preg_match('/^SN(\\d{7})$/', $barcode, $parts)) {
         $type = "sn";
         $comp["sn"] = $parts[1];
     }
     // Mediboard
     //   ___ID___
     // MB01234567
     if (empty($comp) && preg_match('/^MB(\\d{8})$/', $barcode, $parts)) {
         $type = "mb";
         $comp["id"] = intval($parts[1]);
     }
     // final process
     if (isset($comp["per"])) {
         $comp["per"] = self::parsePeremptionDate($comp["per"]);
     }
     if (isset($comp["scc"])) {
         preg_match('/\\d{3}(\\d{5})(\\d{5})\\d/', $comp["scc"], $parts);
         $comp["scc_manuf"] = $parts[1];
         $comp["scc_part"] = $parts[2];
         $comp["scc_prod"] = $parts[1] . $parts[2];
     }
     if (isset($comp["sn"]) && empty($comp["lot"])) {
         $comp["lot"] = $comp["sn"];
     }
     $comp["raw"] = $orig_barcode;
     $comp += array("raw" => null, "ref" => null, "lot" => null, "per" => null, "sn" => null, "scc" => null, "scc_manuf" => null, "scc_prod" => null, "scc_part" => null, "remb" => null, "cip" => null, "price" => null, "key" => null, "qty" => null);
     return array("type" => $type, "comp" => $comp);
 }
示例#15
0
<?php

/**
 * $Id$
 *
 * @category Admissions
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
//Initialisations des variables
$date = CValue::getOrSession("date", CMbDT::date());
$today = CMbDT::date();
$hour = CMbDT::time(null);
$board = CValue::get("board", 1);
$boardItem = CValue::get("boardItem", 1);
$consult = new CConsultation();
// Récupération des fonctions
$cabinets = CMediusers::loadFonctions();
// Récupération de la liste des anesthésistes
$mediuser = new CMediusers();
$anesthesistes = $mediuser->loadAnesthesistes(PERM_READ);
if ($consult->consultation_id) {
    $date = $consult->_ref_plageconsult->date;
    CValue::setSession("date", $date);
}
// Récupération des plages de consultation du jour et chargement des références
$listPlages = array();
$width = CValue::get('width', 400);
$height = CValue::get('height', 100);
$product = new CProduct();
$product->load($product_id);
$product->loadRefStock();
$series = array(array("label" => utf8_encode("Entrées"), "color" => "#66CC00", "data" => array()), array("label" => utf8_encode("Sorties"), "color" => "#CB4B4B", "data" => array()), array("label" => utf8_encode("Périmés"), "color" => "#6600CC", "data" => array()));
$ticks = array();
$max = 1;
$now = CMbDT::date();
$date = CMbDT::date("-6 MONTHS");
$i = 0;
while ($date < $now) {
    //$to = CMbDT::date("+1 MONTH", $date);
    //$ticks[] = "Du ".CMbDT::dateToLocale($date)." au ".CMbDT::dateToLocale($to);
    $date = CMbDT::format($date, "%Y-%m-01");
    $to = CMbDT::date("+1 MONTH", $date);
    $ticks[] = array(count($ticks) * 2 - 0.4, utf8_encode(CMbDT::format($date, "%b")));
    // Input //////////////////
    $where = array("product.product_id" => "= '{$product->_id}'", "product_order_item_reception.date" => "BETWEEN '{$date}' AND '{$to}'");
    $ljoin = array("product_order_item" => "product_order_item.order_item_id = product_order_item_reception.order_item_id", "product_reference" => "product_reference.reference_id = product_order_item.reference_id", "product" => "product.product_id = product_reference.product_id");
    $lot = new CProductOrderItemReception();
    /** @var CProductOrderItemReception[] $lots */
    $lots = $lot->loadList($where, null, null, null, $ljoin);
    $total = 0;
    foreach ($lots as $_lot) {
        $total += $_lot->quantity;
    }
    $max = max($max, $total);
    $series[0]["data"][] = array(count($series[0]["data"]) * 2 - 0.6, $total);
    // Hack pour les etablissements qui ont un service "Périmés"
    $where_services = array("nom" => "= 'Périmés'");
示例#17
0
/**
 * $Id: vw_rapport.php 20186 2013-08-19 07:47:12Z phenxdesign $
 *
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 20186 $
 */
$date = CValue::getOrSession("date");
// Chargement des praticiens
$med = new CMediusers();
$listPrat = $med->loadPraticiens(PERM_READ);
$dateEntree = CMbDT::dateTime("23:59:00", $date);
$dateSortie = CMbDT::dateTime("00:01:00", $date);
$hierEntree = CMbDT::date("- 1 day", $dateEntree);
$hierEntree = CMbDT::dateTime("23:59:00", $hierEntree);
// Chargement des services
$service = new CService();
$whereServices = array();
$whereServices["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
$whereServices["cancelled"] = "= '0'";
$services = $service->loadListWithPerms(PERM_READ, $whereServices, "nom");
// Initialisations
$totalHospi = 0;
$totalAmbulatoire = 0;
$totalMedecin = 0;
$total_prat = array();
foreach ($listPrat as $key => $prat) {
    $totalPrat[$prat->_id]["prat"] = $prat;
    $totalPrat[$prat->_id]["hospi"] = 0;
示例#18
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;
     }
 }
                }
            }
        }
    }
    foreach ($prescription->_ref_lines_inscriptions as $inscriptions_by_type) {
        foreach ($inscriptions_by_type as $_inscription) {
            $_inscription->loadRefsAdministrations(null, $where);
            foreach ($_inscription->_ref_administrations as $_adm_inscription) {
                $_adm_inscription->loadRefAdministrateur();
                if ($_inscription instanceof CPrescriptionLineMedicament) {
                    $chapitre = "medicament";
                } else {
                    $chapitre = $_inscription->_chapitre;
                }
                $list_lines[$chapitre][$_inscription->_id] = $_inscription;
                $dossier[CMbDT::date($_adm_inscription->dateTime)][$chapitre][$_inscription->_id][$_adm_inscription->quantite][$_adm_inscription->_id] = $_adm_inscription;
            }
        }
    }
    if (CModule::getActive("dmi")) {
        foreach ($prescription->loadRefsLinesDMI() as $_line_dmi) {
            $_line_dmi->loadRefProduct();
            $_line_dmi->loadRefPraticien();
            $_line_dmi->loadRefProductOrderItemReception()->loadRefOrderItem()->loadReference()->loadRefSociete();
        }
    }
}
ksort($dossier);
// Constantes du séjour
$where = array();
if ($datetime_min) {
/**
 * Génération des données des graphiques du palmarès ressources
 *
 * @param string $module   Module concerné
 * @param string $date     Date de référence
 * @param string $element  Type de données à afficher
 * @param string $interval Interval de temps à analyser
 * @param int    $numelem  Nombre d'éléments maximum
 *
 * @return array Les données de palmarès
 */
function graphRessourceLog($module, $date, $element = 'duration', $interval = 'day', $numelem = 4)
{
    if (!$date) {
        $date = CMbDT::date();
    }
    switch ($interval) {
        default:
        case "day":
            $startx = "{$date} 00:00:00";
            $endx = "{$date} 23:59:59";
            break;
        case "month":
            $startx = CMbDT::dateTime("-1 MONTH", "{$date} 00:00:00");
            $endx = "{$date} 23:59:59";
            break;
        case "year":
            $startx = CMbDT::dateTime("-27 WEEKS", "{$date} 00:00:00");
            $endx = "{$date} 23:59:59";
            break;
    }
    if ($module == "total") {
        $groupmod = 0;
        $module_name = null;
    } elseif ($module == "modules") {
        $groupmod = 1;
        $module_name = null;
    } else {
        $groupmod = 0;
        $module_name = $module;
    }
    $logs = CAccessLog::loadAggregation($startx, $endx, $groupmod, $module_name);
    $series = array();
    $i = 0;
    foreach ($logs as $data) {
        $series[$i]["data"] = array(array(0, $data->{$element}));
        $series[$i]["label"] = $module != 'modules' ? $data->_action : $data->_module;
        $i++;
    }
    if (!function_exists('compareDataPie')) {
        /**
         * Comparaison entre deux données du graphique en pie
         *
         * @param array $a Première donnée
         * @param array $b Deuxième donnée
         *
         * @return bool La première valeur est-elle inférieure à la deuxième
         */
        function compareDataPie($a, $b)
        {
            return $a["data"][0][1] < $b["data"][0][1];
        }
    }
    usort($series, "compareDataPie");
    $seriesNew = array_slice($series, 0, $numelem);
    if (count($series) > $numelem) {
        $other = array_slice($series, $numelem);
        $seriesNew[$numelem]["data"] = array(array(0, 0));
        $seriesNew[$numelem]["label"] = "Autres";
        $n = 0;
        foreach ($other as $_other) {
            $seriesNew[$numelem]["data"][0][1] += $_other["data"][0][1];
            $n++;
        }
        $seriesNew[$numelem]["label"] .= " ({$n})";
    }
    $series = $seriesNew;
    // Set up the title for the graph
    $title = CMbDT::format($date, "%A %d %b %Y");
    if ($module) {
        $title .= " : " . CAppUI::tr($module);
    }
    $options = array('title' => utf8_encode($title), 'HtmlText' => false, 'grid' => array('verticalLines' => false, 'horizontalLines' => false, 'outlineWidth' => 0), 'xaxis' => array('showLabels' => false), 'yaxis' => array('showLabels' => false), 'pie' => array('show' => true, 'sizeRatio' => 0.5), 'legend' => array('backgroundOpacity' => 0.3));
    return array('series' => $series, 'options' => $options);
}
示例#21
0
/**
 * $Id:$
 *
 * @package    Mediboard
 * @subpackage dPfacturation
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
CCanDo::checkEdit();
$date_min = CValue::getOrSession("_date_min", CMbDT::date());
$date_max = CValue::getOrSession("_date_max", CMbDT::date());
$type_journal = CValue::get("type_journal");
$date_min = CMbDT::dateTime($date_min);
$date_max = CMbDT::dateTime(CMbDT::date("+1 day", $date_max));
$ljoin = array();
$ljoin["facture_journal"] = "facture_journal.journal_id = files_mediboard.object_id";
$where = array();
$where["object_class"] = " = 'CJournalBill'";
$where["file_date"] = "BETWEEN '{$date_min}' AND '{$date_max}'";
$where["facture_journal.type"] = "= '{$type_journal}'";
$file = new CFile();
$files = $file->loadList($where, null, null, null, $ljoin);
foreach ($files as $_file) {
    $_file->canDo();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("files", $files);
$smarty->assign("name_readonly", 1);
示例#22
0
$listSpec = $listSpec->loadSpecialites(PERM_READ);
// Récupération de la liste des services
$where = array();
$where["externe"] = "= '0'";
$where["cancelled"] = "= '0'";
$service = new CService();
$services = $service->loadGroupList($where);
$yesterday = CMbDT::date("-1 day", $today);
$tomorrow = CMbDT::date("+1 day", $today);
$j2 = CMbDT::date("+2 day", $today);
$j3 = CMbDT::date("+3 day", $today);
$week_deb = CMbDT::date("last sunday", $today);
$week_fin = CMbDT::date("next sunday", $week_deb);
$week_deb = CMbDT::date("+1 day", $week_deb);
$next_week_deb = CMbDT::date("+1 day", $week_fin);
$next_week_fin = CMbDT::date("next sunday", $next_week_deb);
$yesterday_deb = "{$yesterday} 06:00:00";
$yesterday_fin = "{$yesterday} 21:00:00";
$today_deb = "{$today} 06:00:00";
$today_fin = "{$today} 21:00:00";
$tomorrow_deb = "{$tomorrow} 06:00:00";
$tomorrow_fin = "{$tomorrow} 21:00:00";
$j2_deb = "{$j2} 06:00:00";
$j2_fin = "{$j2} 21:00:00";
$j3_deb = "{$j3} 06:00:00";
$j3_fin = "{$j3} 21:00:00";
$next_week_deb = "{$next_week_deb} 06:00:00";
$next_week_fin = "{$next_week_fin} 21:00:00";
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("yesterday_deb", $yesterday_deb);
示例#23
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$medecin_id = CValue::get("medecin_id");
$medecin = new CMedecin();
$medecin->load($medecin_id);
if (!$medecin || !$medecin->_id) {
    CAppUI::stepAjax('common-error-Invalid object', UI_MSG_ERROR);
}
$smarty = new CSmartyDP();
$smarty->assign("medecin", $medecin);
$smarty->assign("date", CMbDT::date());
$smarty->display("print_medecin.tpl");
示例#24
0
$web_service = CValue::getOrSession("web_service");
$fonction = CValue::getOrSession("fonction");
$services = array();
$ds = CSQLDataSource::get("std");
$services = $ds->loadColumn("SELECT type FROM echange_soap GROUP BY type");
if (!$date_min) {
    $date_min = CMbDT::date("-7 DAYS");
}
if (!$date_max) {
    $date_max = CMbDT::date();
}
$query = null;
$series = $ticks = array();
$options = array();
if ($service) {
    for ($day = $date_min; $day <= $date_max; $day = CMbDT::date("+1 day", $day)) {
        $ticks[] = array(count($ticks), "{$day}");
        $query = "SELECT COUNT(DISTINCT `echange_soap_id`) as `nb_echanges`, SUM(`response_time`) as `resp`\n              FROM `echange_soap`\n              WHERE `date_echange` BETWEEN '{$day} 00:00:00' AND '{$day} 23:59:59'\n              AND `type` = '{$service}'";
        if ($web_service) {
            $query .= "AND `web_service_name` = '{$web_service}'";
        }
        if ($fonction) {
            $query .= "AND `function_name` = '{$fonction}'";
        }
        $ds = CSQLDataSource::get("std");
        $results = $ds->loadList($query);
        $datas[$day] = $results[0];
    }
    $series[0]["label"] = "Hits";
    $series[0]["color"] = "#00A8F0";
    $series[0]["bars"] = array("show" => true);
// Initialisation des variables
$plageconsult_id = CValue::get("plageconsult_id");
$consult_id = CValue::get("consult_id");
$slot_id = CValue::get("slot_id");
$heure = CValue::get("heure");
$multiple = CValue::get("multipleMode", false);
$display_nb_consult = CAppUI::conf("dPcabinet display_nb_consult");
$quotas = null;
// Récupération des consultations de la plage séléctionnée
$plage = new CPlageconsult();
if ($plageconsult_id) {
    $plage->load($plageconsult_id);
    $plage->loadRefsNotes();
    $date = $plage->date;
} else {
    $date = CValue::get("date", CMbDT::date());
}
// consultation précise
$consultation_target = new CConsultation();
if ($consult_id) {
    $consultation_target->load($consult_id);
} elseif ($heure) {
    $consultation_target->heure = $heure;
}
$consultation_target->loadRefElementPrescription();
// Chargement des places disponibles
$listPlace = array();
$listBefore = array();
$listAfter = array();
$next_plage = $previous_plage = new CPlageconsult();
$function_id = null;
$smarty->assign("heure_sortie_ambu", $heure_sortie_ambu);
$smarty->assign("heure_sortie_autre", $heure_sortie_autre);
$smarty->assign("heure_entree_veille", $heure_entree_veille);
$smarty->assign("heure_entree_jour", $heure_entree_jour);
$smarty->assign("op", $op);
$smarty->assign("plage", $op->plageop_id ? $op->_ref_plageop : new CPlageOp());
$smarty->assign("sejour", $sejour);
$smarty->assign("chir", $chir);
$smarty->assign("praticien", $prat);
$smarty->assign("patient", $patient);
$smarty->assign("sejours", $sejours);
$smarty->assign("ufs", CUniteFonctionnelle::getUFs());
$smarty->assign("_functions", $_functions);
$smarty->assign("modurgence", 1);
$smarty->assign("date_min", CMbDT::date());
$smarty->assign("date_max", CMbDT::date("+" . CAppUI::conf("dPplanningOp COperation nb_jours_urgence") . " days", CMbDT::date()));
$smarty->assign("listAnesthType", $listAnesthType);
$smarty->assign("anesthesistes", $anesthesistes);
$smarty->assign("listServices", $services);
$smarty->assign("etablissements", $etablissements);
$smarty->assign("hours", $hours);
$smarty->assign("mins", $mins);
$smarty->assign("hours_duree", $hours_duree);
$smarty->assign("hours_urgence", $hours_urgence);
$smarty->assign("mins_duree", $mins_duree);
$smarty->assign("prestations", $prestations);
$smarty->assign("blocages_lit", $blocages_lit);
$smarty->assign("correspondantsMedicaux", $correspondantsMedicaux);
$smarty->assign("count_etab_externe", $count_etab_externe);
$smarty->assign("medecin_adresse_par", $medecin_adresse_par);
$smarty->assign("listBlocs", $listBlocs);
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CAppUI::requireLibraryFile("jpgraph/src/mbjpgraph");
CAppUI::requireLibraryFile("jpgraph/src/jpgraph_bar");
$debut = CValue::get("debut", CMbDT::date("-1 YEAR"));
$fin = CValue::get("fin", CMbDT::date());
$prat_id = CValue::get("prat_id", 0);
$service_id = CValue::get("service_id", 0);
$pratSel = new CMediusers();
$pratSel->load($prat_id);
$service = new CSalle();
$service->load($service_id);
$datax = array();
for ($i = $debut; $i <= $fin; $i = CMbDT::date("+1 MONTH", $i)) {
    $datax[] = CMbDT::transform("+0 DAY", $i, "%m/%Y");
}
$sql = "SELECT * FROM service WHERE";
if ($service_id) {
    $sql .= "\nAND id = '{$service_id}'";
}
$ds = CSQLDataSource::get("std");
$services = $ds->loadlist($sql);
$opbysalle = array();
foreach ($services as $service) {
    $id = $service["service_id"];
    $opbysalle[$id]["nom"] = $salle["nom"];
    $sql = "SELECT COUNT(sejour.sejour_id) AS total," . "\nDATE_FORMAT(sejour.entree_prevue, '%m/%Y') AS mois," . "\nDATE_FORMAT(sejour.entre_prevue, '%Y%m') AS orderitem," . "\nservice.nom AS nom" . "\nFROM sejour, affectation, services, chambre, lit" . "\nWHERE sejour.annule = '0'" . "\nAND sejour.entree_prevue BETWEEN '{$debut}' AND '{$fin}'";
    if ($prat_id) {
        $sql .= "\nAND sejour.praticien_id = '{$prat_id}'";
示例#28
0
        break;
    case "one-week":
        $from = CMbDT::date("-1 WEEK", $to);
        break;
    case "height-weeks":
        $from = CMbDT::date("-8 WEEK", $to);
        break;
    case "one-year":
        $from = CMbDT::date("-1 YEAR", $to);
        break;
    case "four-years":
        $from = CMbDT::date("-4 YEARS", $to);
        break;
    case "twenty-years":
        $from = CMbDT::date("-20 YEARS", $to);
        break;
    default:
        $from = CMbDT::date("-1 DAY", $to);
}
$graph = graphUserLog($from, $to, $interval, $user_id);
// Chargement des utilisateurs
$user = new CMediusers();
$users = $user->loadListFromType();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("graph", $graph);
$smarty->assign("date", $date);
$smarty->assign("user_id", $user_id);
$smarty->assign("users", $users);
$smarty->assign("interval", $interval);
$smarty->display("vw_user_logs.tpl");
示例#29
0
<?php

/**
 * $Id: inc_edit_planning.php 22873 2014-04-22 07:51:07Z mytto $
 *
 * @package    Mediboard
 * @subpackage dPbloc
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 22873 $
 */
$plageop_id = CValue::getOrSession("plageop_id");
$date = CValue::getOrSession("date", CMbDT::date());
$bloc_id = CValue::get("bloc_id");
// Informations sur la plage demandée
$plagesel = new CPlageOp();
$plagesel->load($plageop_id);
$plagesel->loadRefSalle();
$listBlocs = CGroups::loadCurrent()->loadBlocs(PERM_READ, null, "nom");
//curent bloc if $bloc_id
$bloc = new CBlocOperatoire();
$bloc->load($bloc_id);
$listSalles = $bloc->loadRefsSalles();
$arrKeySalle = array_keys($listSalles);
// cleanup listBlocs
foreach ($listBlocs as $key => $curr_bloc) {
    $salles = $curr_bloc->loadRefsSalles();
    foreach ($salles as $id => $_salle) {
        if (count($arrKeySalle) && !in_array($id, $arrKeySalle)) {
            unset($salles[$id]);
            continue;
 * @category DPpatients
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
if (!CAppUI::pref("allowed_modify_identity_status")) {
    CAppUI::redirect("m=system&a=access_denied");
}
$number_day = CValue::getOrSession("_number_day", 8);
$number_day = $number_day ?: 8;
$now = CValue::getOrSession("_date_end", CMbDT::date());
$before = CMbDT::date("-{$number_day} DAY", $now);
$csv = new CCSVFile();
$line = array("Date", CAppUI::tr("CPatient.status.PROV"), CAppUI::tr("CPatient.status.DPOT"), CAppUI::tr("CPatient.status.ANOM"), CAppUI::tr("CPatient.status.CACH"), CAppUI::tr("CPatient.status.VALI"));
$csv->writeLine($line);
$results = CPatientStateTools::getPatientStateByDate($before, $now);
$values = array();
for ($i = $number_day; $i >= 0; $i--) {
    $values[CMbDT::date("-{$i} DAY", $now)] = array("PROV" => 0, "DPOT" => 0, "ANOM" => 0, "CACH" => 0, "VALI" => 0);
}
foreach ($results as $_result) {
    $values[$_result["date"]][$_result["state"]] = $_result["total"];
}
foreach ($values as $_date => $_value) {
    $line = array($_date);
    $line = array_merge($line, array_values($_value));
    $csv->writeLine($line);
}
$csv->stream("statut_patient_par_date");