<?
    $dow = date('w'); /* Sun = 0, Mon = 1, ... */
    $dow = ($dow == 0)?7:$dow;
    $dowoffset = 5-$dow; /* 5 = Friday */
    $weekoffset = ($dowoffset==0)?0:7;
    if (!$enddate) {
        $enddate= date('Y-m-d',strtotime("-" . ($weekoffset-$dowoffset+1) . 'day'));
    }
    if (!$startdate) {
        $startdate = date('Y-m-d',strtotime("-" . ($weekoffset+7-$dowoffset) . 'day'));
    }
?>
    <form name="bestelllisten" action="<?=$_SERVER['PHP_SELF']?>" method="POST">
      <input type="hidden" name="module" value="<?=$module?>" />
      <input type="hidden" name="action" value="export" />
      <input type="hidden" name="submit" value="submit" />
      <fieldset class="fieldset"><legend>Bestelllisten erstellen</legend>
        <? if (isset($error)) { ?>
        <p style="color: red"><?=$error?></p>
        <? } ?>
        <label class="label" for="startdate">Startdatum <br/>(yyyy-mm-dd)</label></span>
        <input type="text" name="startdate" id="startdate" value="<?=isset($startdate)?$startdate:''?>" />
          <script type="text/javascript">
            $(function() {
              $("#startdate").datepicker({ dateFormat: 'yy-mm-dd' });});
          </script>
        <br/>
        <br/>
        <label class="label" for="enddate">Enddatum <br/>(yyyy-mm-dd)</label>
        <p>
        <input type="text" name="enddate" id="enddate"  value="<?=isset($enddate)?$enddate:''?>" />
        (einschlie&szlig;lich)
        </p>
        <script type="text/javascript">
          $(function() {
            $("#enddate").datepicker({ dateFormat: 'yy-mm-dd' });});
        </script>

        <hr/>
        <span class="label">Teilnehmergruppe</span>
        <p>
          <input style="float: left" type="radio" name="type" id="typeu18" value="U18" <?=(isset($type) && $type=='U18')?'checked="checked"':''?> />
          <label style="float: left" for="typeu18">&nbsp;U18&nbsp;</label>
          <br/>
          <span class="label">&nbsp;</span>
          <input style="float: left" type="radio" name="type" id="typeo18" value="O18" <?=(!isset($type)||$type=='O18')?'checked="checked"':''?> />
          <label style="float: left" for="typeo18">&nbsp;O18&nbsp;</label>
          <br/>
          <span class="label">&nbsp;</span>
          <input style="float: left" type="radio" name="type" id="typeu" value="U" <?=(isset($type)&&$type=='U')?'checked="checked"':''?> />
          <label style="float: left" for="typeu">&nbsp;Zusatz-Pr&auml;mien&nbsp;</label>
          <br/>
          <div style="clear: both"></div>
        </p>
        <hr/>

        <span class="label">Pr&auml;mienart</span>
        <p>
          <input style="float: left" type="radio" name="gutschein" id="gutscheinno" value="0" <?=$gutschein=='0' || !isset($gutschein)?'checked="checked"':''?> />
          <label style="float: left" for="gutscheinno">&nbsp;Sachpr&auml;mien&nbsp;</label>
          <br/>
          <span class="label">&nbsp;</span>
          <input style="float: left" type="radio" name="gutschein" id="gutscheinyes" value="1" <?=$gutschein=='1'?'checked="checked"':''?> />
          <label style="float: left" for="gutscheinyes">&nbsp;Gutscheine&nbsp;</label>
        </p>
        <br/>
        <br/>

        <label class="label" for="submit">&nbsp;</label><input id="submit" type="submit" value="submit" />
        </fieldset>
    </form>
<script type="text/javascript">
  document.forms.bestelllisten.startdate.focus();
</script>
<?
include('views/bestelllisten/oldfiles.php');
?>
