$vw_cancelled = CValue::get("vw_cancelled", 0);
// Récuperation du patient sélectionné
$patient = new CPatient();
if (CValue::get("new", 0)) {
    $patient->load(null);
    CValue::setSession("id", null);
} else {
    $patient->load($patient_id);
}
$nb_sejours_annules = 0;
$nb_ops_annulees = 0;
$nb_consults_annulees = 0;
if ($patient->_id) {
    $patient->loadDossierComplet(null, false);
    $patient->loadIPP();
    $patient->loadPatientLinks();
    $patient->countINS();
    if (CModule::getActive("fse")) {
        $cv = CFseFactory::createCV();
        if ($cv) {
            $cv->loadIdVitale($patient);
        }
    }
    if (!$vw_cancelled) {
        foreach ($patient->_ref_sejours as $_key => $_sejour) {
            foreach ($_sejour->_ref_operations as $_key_op => $_operation) {
                if ($_operation->annulee) {
                    unset($_sejour->_ref_operations[$_key_op]);
                    $nb_ops_annulees++;
                }
            }