Exemplo n.º 1
0
 function index($page = 1)
 {
     $app = get_app();
     $limit = 15;
     $pages = ceil(Staff::count() / $limit);
     $staffs = Staff::find('all', array('order' => 'id desc', 'limit' => $limit, 'offset' => ($page - 1) * $limit));
     render_with_layout('misc.php', 'Staffs/index.php', compact('staffs', 'pages', 'page'));
 }
Exemplo n.º 2
0
 function staff($short)
 {
     // 按照员工拼音缩写查找员工
     // 如果执行查询操作的是 操作者 权限的用户
     // 只允许查询与其同一班组的员工 : team_id
     if (has_perm(8, 4)) {
         $team_id = $_SESSION['team_id'];
         $staffs = Staff::find('all', array('conditions' => " short LIKE '{$short}%' AND group_id = {$team_id} ", 'order' => 'id desc'));
     } else {
         $staffs = Staff::find('all', array('conditions' => "short like '{$short}%'", 'order' => 'id desc'));
     }
     $results = array();
     if (!empty($staffs)) {
         foreach ($staffs as $staff) {
             $results[] = array('id' => $staff->id, 'name' => $staff->name);
         }
     }
     echo json_encode($results);
 }
Exemplo n.º 3
0
 function staff_rest_work_hours()
 {
     $staffs = Staff::find('all');
     $resutls = array();
     foreach ($staffs as $staff) {
         $results[] = array('staff' => $staff->name, 'work_hours' => get_staff_rest_work_hours($staff));
     }
     //debug( $results );
     render_with_layout('misc.php', 'Misc/staff_rest_work_hours.php', compact('results'));
 }
Exemplo n.º 4
0
 function quick_list_get_html($part)
 {
     $app = get_app();
     $cur_proc_id = '';
     // 查找当前工序
     foreach ($part->processes as $proc) {
         if (!empty($proc->production_date) && !$proc->is_done) {
             $cur_proc_id = $proc->id;
         }
     }
     if (empty($cur_proc_id)) {
         $processes = $part->processes;
         $cur_proc_id = $processes[0]->id;
     }
     // 渲染现场工时列表View
     $staffs = Staff::find('all', array('order' => 'id asc'));
     $works = Work::find_all_by_process_id($cur_proc_id, array('order' => 'id asc'));
     if (count($works)) {
         $slider_step = get_slider_step($works);
         $loongest_float_work = get_loongest_float_num_work($works);
         $fixed_num = get_float_num($loongest_float_work->count);
     } else {
         $slider_step = 1;
         $fixed_num = 2;
     }
     $available_count = Process::get_available_count($cur_proc_id, $fixed_num);
     $proc_id = $cur_proc_id;
     return array('html' => $app->view->fetch('Works/list.php', compact('proc_id', 'works', 'staffs', 'available_count', 'slider_step')), 'cur_proc_id' => $cur_proc_id);
 }