当前位置: 首页>>代码示例>>PHP>>正文


PHP CMbDT::workDaysInMonth方法代码示例

本文整理汇总了PHP中CMbDT::workDaysInMonth方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbDT::workDaysInMonth方法的具体用法?PHP CMbDT::workDaysInMonth怎么用?PHP CMbDT::workDaysInMonth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMbDT的用法示例。


在下文中一共展示了CMbDT::workDaysInMonth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: graphPatParHeureReveil

/**
 * Récuparation du graphique de répartition des patients en salle de reveil
 * par tranche horaire
 *
 * @param string $debut         Date de début
 * @param string $fin           Date de fin
 * @param int    $prat_id       Identifiant du praticien
 * @param int    $bloc_id       Identifiant du bloc
 * @param int    $discipline_id Identifiant de la discipline
 * @param string $codeCCAM      Code CCAM
 *
 * @return array
 */
function graphPatParHeureReveil($debut = null, $fin = null, $prat_id = 0, $bloc_id = 0, $func_id = 0, $discipline_id = null, $codeCCAM = '')
{
    // This stats uses temporary table, impossible on slave
    // @todo Get rid of temporary table
    CView::disableSlave();
    $ds = CSQLDataSource::get("std");
    if (!$debut) {
        $debut = CMbDT::date("-1 YEAR");
    }
    if (!$fin) {
        $fin = CMbDT::date();
    }
    $totalWorkDays = 0;
    for ($i = $debut; $i <= $fin; $i = CMbDT::date("+1 MONTH", $i)) {
        $totalWorkDays += CMbDT::workDaysInMonth(CMbDT::transform("+0 DAY", $i, "%Y-%m-01"));
    }
    $prat = new CMediusers();
    $prat->load($prat_id);
    $discipline = new CDiscipline();
    $discipline->load($discipline_id);
    $ticks = array();
    for ($i = 7; $i <= 21; $i++) {
        $ticks[] = array(count($ticks), CMbDT::transform("+0 DAY", "{$i}:00:00", "%Hh%M"));
    }
    $bloc = new CBlocOperatoire();
    if ($bloc_id) {
        $bloc->load($bloc_id);
    }
    $series = array();
    // Nombre de patients par heure
    foreach ($ticks as $i => $tick) {
        $query = "DROP TEMPORARY TABLE IF EXISTS pat_par_heure";
        $ds->exec($query);
        $query = "CREATE TEMPORARY TABLE pat_par_heure\n      SELECT COUNT(operations.operation_id) AS total_by_day,\n             '" . $tick[1] . "' AS heure,\n             operations.date AS date\n      FROM operations\n      INNER JOIN sallesbloc ON operations.salle_id = sallesbloc.salle_id\n      LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\n      WHERE sallesbloc.stats = '1'\n      AND operations.date BETWEEN '{$debut}' AND '{$fin}'\n      AND '" . $tick[1] . ":00' BETWEEN operations.entree_reveil AND operations.sortie_reveil_reel\n      AND operations.annulee = '0'";
        if ($prat_id) {
            $query .= "\nAND operations.chir_id = '{$prat_id}'";
        }
        if ($discipline_id) {
            $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'";
        }
        if ($codeCCAM) {
            $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'";
        }
        if ($bloc_id) {
            $query .= "\nAND sallesbloc.bloc_id = '{$bloc_id}'";
        }
        $query .= "\nGROUP BY operations.date";
        $ds->exec($query);
        $query = "SELECT SUM(total_by_day) AS total, MAX(total_by_day) AS max,heure\n                FROM pat_par_heure\n                GROUP BY heure";
        $result = $ds->loadlist($query);
        if (count($result)) {
            $serie_moyenne["data"][] = array($i, $result[0]["total"] / $totalWorkDays);
            $serie_max["data"][] = array($i, $result[0]["max"]);
        } else {
            $serie_moyenne["data"][] = array($i, 0);
            $serie_max["data"][] = array($i, 0);
        }
    }
    // Nombre de patients non renseignés
    $query = "SELECT COUNT(operations.operation_id) AS total,\n    'err' AS heure\n    FROM operations\n    INNER JOIN sallesbloc ON operations.salle_id = sallesbloc.salle_id\n    LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\n    WHERE sallesbloc.stats = '1'\n    AND operations.date BETWEEN '{$debut}' AND '{$fin}'\n    AND (operations.entree_reveil IS NULL OR operations.sortie_reveil_reel IS NULL)\n    AND operations.annulee = '0'";
    if ($prat_id) {
        $query .= "\nAND operations.chir_id = '{$prat_id}'";
    }
    if ($discipline_id) {
        $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'";
    }
    if ($codeCCAM) {
        $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'";
    }
    if ($bloc_id) {
        $query .= "\nAND sallesbloc.bloc_id = '{$bloc_id}'";
    }
    $query .= "\nGROUP BY heure";
    $result = $ds->loadlist($query);
    if (count($result)) {
        $serie_moyenne["data"][] = array(count($ticks), $result[0]["total"] / $totalWorkDays);
    } else {
        $serie_moyenne["data"][] = array(count($ticks), 0);
    }
    //$serie_max["data"][] = array(count($ticks), 0);
    $ticks[] = array(count($ticks), "Erreurs");
    $serie_moyenne["label"] = "moyenne";
    $serie_max["label"] = "max";
    $series[] = $serie_moyenne;
    $series[] = $serie_max;
    // Set up the title for the graph
    $title = "Patients moyens et max / heure du jour";
//.........这里部分代码省略.........
开发者ID:fbone,项目名称:mediboard4,代码行数:101,代码来源:graph_patparheure_reveil.php


注:本文中的CMbDT::workDaysInMonth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。