<?php
class doc_lession_personal_status extends c_doc
{
   var $title='Ведомость прохождения занятия' ;
   public $PDF_page_orientation='P' ; // L P
   public $PDF_page_format='A4' ;

   var $lession_id ;
   var $rec_event_pass ;
   var $rec_personal ;
   var $rec_event ;
   var $rec_lession ;
   var $obj_event ;

   public $h1='Ведомость прохождения занятия сотрудниками' ;

   function init($options=array())
   { if ($this->filter['lession_id'] and !$this->lession_id) $this->lession_id=$this->filter['lession_id'] ;
     if ($this->lession_id)
     { $this->rec_lession=EVENTS()->get_lession_by_id($this->lession_id) ;
       $this->rec_event=EVENTS()->get_event_by_id($this->rec_lession['event_id']) ;
       $this->obj_event=EVENTS()->get_event_obj_by_ext($this->rec_event['ext']) ;
     }
   }

    function setting_small($options=array())
    {    ?><div id="panel_filter">
                <form id="sky-form" class="sky-form"><input type="hidden" name="filter_dir" value="<?echo _CUR_REPORT_DIR?>">
                     <?$this->panel_buttons($options);?>
                 </form>
          </div><br>
        <?
    }

    function panel_buttons($options=array())
        { ?><div id="panel_buttons"><?
            if ($options['hidden_params']) foreach($options['hidden_params'] as $name=>$value) echo '<input type="hidden" name="'.$name.'" value="'.$value.'">' ;
          {?><button class="button v2" cmd="docs/doc_create"  report_code="lession_personal_status">Сохранить в документах</button>&nbsp;&nbsp;
                               <!--<button class="button v2" cmd="report/view_as_html">HTML</button>&nbsp;&nbsp;
                               <button class="button v2" cmd="report/view_as_pdf" mode="HTML2PDF">PDF</button>&nbsp;&nbsp;
                               <button class="button v2" cmd="report/to_print">Печать</button>&nbsp;&nbsp;-->
                             <?}
          ?></div><?
        }



   function view_as_HTML($options=array())
   { ?><h2 class="center">Ведомость проведения занятия<br><?echo $this->obj_event->name?><br>"<?echo $this->rec_event['obj_name']?>"</h2>
       <div class="center">Место занятия: <span class="nowrap bold"><?echo $this->rec_lession['group_name']?>,</span>
                           Лектор:  <span class="nowrap bold"><?echo $this->rec_lession['account_name']?></span>
       </div>
       <br>
       <div class="center">Дата проведения занятия: <span class="nowrap bold"><? echo date('d.m.Y',$this->rec_lession['time_from']).' '.date('H:i',$this->rec_lession['time_from']).' - '.date('H:i',$this->rec_lession['time_to'])?>,</span>
                           Длительность занятия: <span class="nowrap bold"><?echo round(($this->rec_lession['time_to']-$this->rec_lession['time_from'])/60).' мин.'?></span>
       </div>
       <?

     $recs_themes=EVENTS()->get_themes_of_lession($this->lession_id) ;
     ?><h3>Темы занятия:</h3><ul><?
     if (_sizeof($recs_themes)) foreach($recs_themes as $rec){?><li><?echo $rec['obj_name']?></li><?}
     ?></ul><?


   	 $list_recs=execSQL('select * from view_lession_personals where lession_id='.$this->lession_id.' and lession_person_status=4') ;
   	 ?><table class="list_personal_table_img basic fz_small full auto">
   		          <colgroup><col id="c1"><col id="c2"><col id="c3"></colgroup>
   		          <tr><th>№</th>
   		              <th>ФИО, дата рождения</th>
   		              <th>Организация, подразделение</th>
   		              <th>Подпись сотрудника</th>
   		          </tr>
   		          <?  $i=1 ;
   		          if (_sizeof($list_recs)) foreach($list_recs as $rec) if ($rec['pkey'])
   		          {   ?><tr class=item>
                          <td><?echo $i?></td>
   		                  <td class="left"><?echo $rec['obj_name']?>
   		                      <?  if ($rec['uid']) echo '<br><span class="nowrap small">'.$rec['uid'].'</span>' ;
   		                          if (!$rec['enabled'])echo '<br><br><span class="red bold">УВОЛЕН</span> ('.date('d.m.Y H:i',$rec['fired_data']).')' ;
   		                          if ($rec['dr'])echo '<br>'.$rec['dr'] ;
   		                      ?>
   		                  </td>
   		                  <td class="left"><?echo '<strong>'.$rec['_org_name'].'</strong><br><div class="small">'.$rec['_otdel_name'].'</div>'?>
                                           <?echo _IL('IL_works')->recs[$rec['working']]['obj_name'] ?>
                          </td>
   		                  <td><?if ($rec['sign_fname']) echo '<img src="'._PATH_TO_SITE.'/public/instruktions_sign/'.$rec['sign_fname'].'" width=200>' ?></td>
   		              </tr><?
                      $i++ ;
   		          }
   	?></table>

       <br><br>

          <table id="smena_podpis">
                <tr><td>Инструктаж провел:</td><td style="font-size:12px;"><div id=smena_podpis_name><? echo MEMBER()->working.' '.MEMBER()->name?></div></td></tr>
                <tr><td>Дата подписи:</td><td style="font-size:12px;"><div id=smena_podpis_date><? echo date('d.m.Y H:i')?></div></td></tr>
                <tr><td>ЭЦП:</td><td style="font-size:12px;"><div id=smena_podpis_date>с/н <? echo strtoupper(MEMBER()->certificate['SerialNumber'])?></div></td></tr>

           </table><div class=clear></div><?







  }



}

?>
