<?php
include_once('c_personal_person_db.php') ;
class c_page_cab_personal_person_work_order extends c_page_cab_personal_person_db
{
 public $h1='Карточка сотрудника - Наряд на работы' ;

 function get_cur_page_meta_tags()
 {
   //if ($this->rec_personal['pkey']) $this->h1='Статистика по сотруднику '.$this->rec_personal['obj_name'] ;
 }

 function block_main()
 { $this->page_title() ;
   $this->panel_work_order_create() ;
   $this->panel_work_order_list() ;


 }

 function panel_work_order_list()
 { $recs_wo=execSQL('select * from list_work_orders where personal_id='.$this->rec_personal['pkey'].' order by pkey desc') ;
   ?><table class="basic fz_small"><tr><th>ID</th><th>Дата от</th><th>Дата до</th><th>Номер автомобиля</th><th>ID MO</th><th>Решение техника</th></tr><?
   if (_sizeof($recs_wo)) foreach($recs_wo as $rec_wo)
   {?><tr><td><?echo $rec_wo['pkey']?></td>
                 <td><?echo date('d.m.Y H:i',$rec_wo['data_from'])?></td>
                 <td><?echo date('d.m.Y H:i',$rec_wo['data_to'])?></td>
                 <td><?echo $rec_wo['car_number']?></td>
                 <td><?echo $rec_wo['mo_id']?></td>
                 <td><? if (!$rec_wo['tech_status']){?><button class="button v2" cmd="work_order/create_response_technic" wo_id="<?echo $rec_wo['pkey']?>">Положительные решение техника</button><?}
                        else echo 'ТО пройден, '.date('d.m.Y H:i',$rec_wo['tech_data']) ;
                 ?></td>
      </tr>
    <?}?></table><?
 }

 function panel_work_order_create()
   {   //execSQL_update('delete from list_work_orders where pkey in (1,2,3)',2)
       ?><div id="panel_filter"><form id="sky-form" class="sky-form">
           <fieldset id="fieldset_group">
               <div class="row">
               <?    $this->filter_section_input_text('data_from','Дата/время от:',2,array('class'=>'datetimepicker')) ;
                     $this->filter_section_input_text('data_to','Дата/время до:',2,array('class'=>'datetimepicker')) ;
                     $this->filter_section_input_text('car_number','Номер авто:',2,array()) ;
                ?>
               </div>
             </fieldset>
           <div id="panel_buttons">
                <button class="button v2" cmd="work_order/create_personal_workorder" personal_id="<?echo $this->rec_personal['pkey']?>">Добавить наряд на работы</button>

           </div>
          </form></div>
        <?

       //execSQL('select * from list_work_orders where personal_id='.$this->rec_personal['pkey'].' order by pkey desc',2) ;

   }
}

?>
