Esempio n. 1
0
// Selection des salles
$listSalles = new CSalle();
$listSalles = $listSalles->loadGroupList();
$totalOp = 0;
$counts = array("sejours" => array("total" => 0, "facturees" => 0), "operations" => array("total" => 0, "facturees" => 0), "urgences" => array("total" => 0, "facturees" => 0));
/**
 * Comptage des Interventions planifiées
 */
$plage = new CPlageOp();
$where = array();
$where["date"] = "= '{$date}'";
$where["salle_id"] = CSQLDataSource::prepareIn(array_keys($listSalles));
/** @var CPlageOp[] $plages */
$plages = $plage->loadList($where);
/** @var COperation[] $operations */
$operations = CPlageOp::massLoadBackRefs($plages, "operations", null, array("annulee" => "= '0'"));
foreach ($plages as $_plage) {
    $_plage->_ref_operations = $_plage->_back["operations"];
    foreach ($_plage->_ref_operations as $_operation) {
        $counts["operations"]["total"]++;
        if ($_operation->facture) {
            $counts["operations"]["facturees"]++;
        }
    }
    $totalOp += count($_plage->_ref_operations);
}
/**
 * Comptage des Interventions hors plages
 */
$operation = new COperation();
$where = array();