  <?php 
    $year=isset($wf_time)?date('Y',strtotime($wf_time)):date('Y');
    $month=isset($wf_time)?date('m',strtotime($wf_time)):date('m',strtotime("+1 month"));
    $month_n=isset($wf_time)?date('n',strtotime($wf_time)):date('n',strtotime("+1 month"));
    $days=cal_days_in_month(CAL_GREGORIAN,$month,$year);
    $weekarray=array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
  ?>
  <style type="text/css">
.rotatable{background: #fff;}
table th{font-weight: normal;font-size: 13px;text-align: center;}
.rotatable_bg{background: #eee !important;}
table th,table td{padding: 5px;font-size: 12px;text-align: center;vertical-align: middle;height: 25px;}
  </style>
    <table class="rotatable" border="0" cellpadding="0" cellspacing="1" style="border:1px solid #aaa;width:1020px;">
    <tr class="rotatable_bg">
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="70">星期</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="70">日期</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="80">英文组中午值班</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="150">CH销售</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="80">CT</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="80">商务</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="80">德语</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" colspan="2">国际</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="100">技术</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="80">计调</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="80">APP</th>
    </tr>
    <tr class="rotatable_bg">
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" height="35" colspan="2">值班时间</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;">12点-13点</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" colspan="2">9:30-12:00,13:00-17:00</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" colspan="2">10:00-16:00</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="80">到办公室</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="150">VPN</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="100">技术远程值班</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="80">无团电话值班</th>
      <th style="border-bottom:1px solid #aaa;border-left:1px solid #aaa;" width="80">VPN(8:30-23:00)</th>
    </tr>
    <?php for ($i=1; $i <= $days; $i++) { ?> 
      <?php 
      $week_no=date('w',strtotime($year.'-'.$month.'-'.$i));
      $ymd=$year.$month.$i;
      if (isset($flow_data)) {
        $en_uname=$flow_data['en_uname_'.$ymd];
        $ch_uname=$flow_data['ch_uname_'.$ymd];
        $ct_uname=$flow_data['ct_uname_'.$ymd];
        $sw_uname=$flow_data['sw_uname_'.$ymd];
        $de_uname=$flow_data['de_uname_'.$ymd];
        $eu_uname=$flow_data['eu_uname_'.$ymd];
        $vpn_uname=$flow_data['vpn_uname_'.$ymd];
        $js_uname=$flow_data['js_uname_'.$ymd];
        $jd_uname=$flow_data['jd_uname_'.$ymd];
        $app_uname=isset($flow_data['app_uname_'.$ymd])?$flow_data['app_uname_'.$ymd]:'';
        isset($flow_data['weekend_'.$ymd])? $weekend=$flow_data['weekend_'.$ymd]:$weekend=0;
      }
      ?>
    <tr <?php if((!isset($wf_sn) && ($week_no==0 || $week_no==6)) || (isset($weekend) && $weekend==1)) echo 'class="rotatable_bg"'; ?>>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;width:70px;"><?php echo $weekarray[$week_no]; ?></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;width:70px;"><?php echo $month_n.'月'.$i."日"; ?></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;"><?php if(isset($en_uname))echo $en_uname; ?></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;"></p><?php if(isset($ch_uname))echo $ch_uname; ?></p></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;"></p><?php if(isset($ct_uname))echo $ct_uname; ?></p></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;"></p><?php if(isset($sw_uname))echo $sw_uname; ?></p></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;"></p><?php if(isset($de_uname))echo $de_uname; ?></p></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;"></p><?php if(isset($eu_uname))echo $eu_uname; ?></p></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;"></p><?php if(isset($vpn_uname))echo $vpn_uname;?></p></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;"></p><?php if(isset($js_uname))echo $js_uname; ?></p></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;"></p><?php if(isset($jd_uname))echo $jd_uname; ?></p></td>
      <td style="border-left:1px solid #aaa;border-bottom:1px solid #aaa;"></p><?php if(isset($app_uname))echo $app_uname; ?></p></td>
    </tr>
    <?php } ?>
    </table>