* @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
$sejour_id = CValue::get('sejour_id');
$date = CValue::get('date', CMbDT::date());
$from = CValue::get('from');
$to = Cvalue::get('to');
$sejour = new CSejour();
$sejour->load($sejour_id);
$sejour->loadRefsFwd();
$sejour->countExchanges();
$sejour->isCoded();
$sejour->canDo();
$sejour->getAssociationCodesActes();
$sejour->loadPossibleActes();
/* Gestion des dates */
$date_entree = CMbDT::date(null, $sejour->entree);
$date_sortie = CMbDT::date(null, $sejour->sortie);
if (is_null($from) || is_null($to)) {
    if (CMbDT::daysRelative($date, $date_sortie) < 0) {
        $date = $date_sortie;
    } elseif (CMbDT::daysRelative($date_entree, $date) < 0) {
        $date = $date_entree;
    }
    if (CMbDT::daysRelative($date_entree, $date_sortie) < 6) {
        $from = $date_entree;
        $to = $date_sortie;
    } elseif (CMbDT::daysRelative($date_entree, $date) < 2) {
        $from = $date_entree;