public function all()
 {
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $company = Company::where('id', $department->company_id)->first();
         $messages = CannedMessages::where('company_id', $company->id)->where('department_id', $department->id)->orderBy('id', 'desc')->get();
     } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
         $department_admin = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $company = Company::where('id', $department->company_id)->first();
         $messages = CannedMessages::where('company_id', $company->id)->where('department_id', $department->id)->where('operator_id', Auth::user()->id)->orderBy('id', 'desc')->get();
     } else {
         $messages = CannedMessages::orderBy('id', 'desc')->get();
     }
     foreach ($messages as $message) {
         $operator = User::find($message->operator_id);
         $department = Department::find($message->department_id);
         $company = Company::find($message->company_id);
         $message->operator = $operator;
         $message->department = $department;
         $message->company = $company;
     }
     $this->data['messages'] = $messages;
     return View::make('canned_messages.all', $this->data);
 }
 public function account()
 {
     $doctor = Doctor::where('user_id', Session::get('user.id'))->first();
     $hospital_id = $doctor->department->hospital_id;
     $default_department = $doctor->department_id;
     $departments = Department::where('hospital_id', $hospital_id)->get();
     $render_data = array('name' => $doctor->name, 'photo' => $doctor->photo, 'title' => $doctor->title, 'specialty' => strip_tags($doctor->specialty), 'description' => strip_tags($doctor->description), 'default_department' => $doctor->department_id, 'departments' => $departments, 'top_photo' => Session::get('doctor.photo'));
     return View::make('doctor.account', $render_data);
 }
function department_list($id = null)
{
    if ($id) {
        $dept = new Department($id);
        $list = new Department();
        $list->where('parent_id', $id);
        $list->order_by('orders', 'asc');
        $list->get();
        child_personnel(0, $id, $dept->title);
        foreach ($list as $key_tmp => $tmp) {
            department_list($tmp->id);
        }
    }
}
Beispiel #4
0
 static function getUniCompany()
 {
     $company_id = 0;
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $company_id = $department->company_id;
     } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
         $department_admin = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $company_id = $department->company_id;
     }
     return $company_id;
 }
 public function getProfile()
 {
     if (Auth::check()) {
         $title = "Cambiar Perfil";
         $department = Department::all();
         $user = User::where('id', '=', Auth::id())->first();
         $id = $user->state;
         $userDep = Department::where('id', '=', $id)->pluck('nombre');
         if (!empty($user) && $user != "" && !is_null($user)) {
             return View::make('user.profile')->with('title', $title)->with('user', $user)->with('department', $department)->with('userDep', $userDep);
         }
     } else {
         Session::flash('error', 'Debe iniciar sesión para acceder a esta área');
         return Redirect::to('inicio/login');
     }
 }
Beispiel #6
0
 /**
  * Update the department
  *
  * @param $id
  */
 public function updateAction($id)
 {
     $department = Department::find($id);
     $validation = Validator::make(Input::all(), Department::$rules);
     if (!$validation->passes()) {
         return Redirect::route('departments.edit', $id)->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
     }
     /**
      * Check name duplicates
      */
     if (count(Department::where('name', Input::get('name'))->where('id', '!=', $id)->get())) {
         return Redirect::route('departments.edit', $id)->withInput()->with('message', 'This department already exists.');
     }
     $department->update(Input::all());
     $department->save();
     return Redirect::route('departments.show', $id);
 }
 static function getUpdatedFields($is_fake = false, $ticket_id = 0, $msg_id = 0)
 {
     if (!$is_fake) {
         $ticket = Tickets::where('id', $ticket_id)->first();
         $thread_message = ThreadMessages::where('id', $msg_id)->first();
         $ticket_attachment = TicketAttachments::where('message_id', $msg_id)->first();
         $customer = User::where('id', $ticket->customer_id)->first();
         $operator = User::where('id', $ticket->operator_id)->first();
         $company = Company::where('id', $ticket->company_id)->first();
         $department = Department::where('id', $ticket->department_id)->first();
         $receiver = Input::get('user_id') == $ticket->operator_id ? $customer : $operator;
         $mailer_extra = ['ticket_id' => $ticket->id, 'ticket_subject' => $ticket->subject, 'ticket_description' => $ticket->description, 'ticket_status' => $ticket->status, 'ticket_status_txt' => self::resolveStatus($ticket->status), 'ticket_priority' => $ticket->priority, 'ticket_priority_txt' => self::resolveStatus($ticket->priority), 'company_name' => $company->name, 'company_description' => $company->description, 'company_domain' => $company->domain, 'company_logo' => $company->logo, 'department_name' => $department->name, 'has_attachment' => $ticket_attachment->has_attachment, 'attachment_path' => $ticket_attachment->attachment_path, 'updated_message' => $thread_message->message, 'receiver_name' => $receiver->name, 'receiver_email' => $receiver->email];
     } else {
         $mailer_extra = ['ticket_id' => 1, 'ticket_subject' => "How can i use contact us form", 'ticket_description' => "Hi , Sir how can i use contact us form", 'ticket_status' => 1, 'ticket_status_txt' => self::resolveStatus(1), 'ticket_priority' => 1, 'ticket_priority_txt' => self::resolveStatus(1), 'company_name' => "KODEINFO", 'company_description' => "We are a small and dedicated team of designers/developers. This is our web design and development focused blog.We focus on pushing the boundaries of standards based web technologies.", 'company_domain' => "http://www.kodeinfo.com", 'company_logo' => "http://kodeinfo.com/img/shortlogo.png", 'department_name' => "General Queries", 'has_attachment' => false, 'attachment_path' => "", 'updated_message' => "This is a updated message from customer/operator", 'receiver_name' => "Imran", 'receiver_email' => "*****@*****.**"];
     }
     return $mailer_extra;
 }
 /**
  * Store a newly created resource in storage.
  * POST /department
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make(Input::all(), Department::$rules);
     $row = Department::where('id_dept', '=', Input::get('id_dept'));
     if ($validator->fails()) {
         return Redirect::to('department')->withErrors($validator)->withInput(Input::all());
     } else {
         if (Department::where('id_dept', '=', Input::get('id_dept'))->exists()) {
             $department = Department::find(Input::get('id_dept'));
             $department->nm_dept = Input::get('nm_dept');
             $department->save();
             Session::flash('message', 'Successfully updated Department!');
             return Redirect::to('department');
         } else {
             $department = new Department();
             $department->id_dept = Input::get('id_dept');
             $department->nm_dept = Input::get('nm_dept');
             $department->save();
             Session::flash('message', 'Successfully created Department!');
             return Redirect::to('department');
         }
     }
     //
 }
 public function ticketsRefresh()
 {
     if (Input::get('company_id', 0) > 0 && Input::get('department_id', 0) > 0) {
         $tickets = Tickets::orderBy('priority', 'desc')->where('company_id', Input::get('company_id'))->where('department_id', Input::get('department_id'))->get();
     } else {
         $tickets = Tickets::orderBy('priority', 'desc')->get();
     }
     $tickets_arr = [];
     foreach ($tickets as $ticket) {
         $ticket->customer = User::where('id', $ticket->customer_id)->first();
         $ticket->company = Company::where('id', $ticket->company_id)->first();
         $ticket->department = Department::where('id', $ticket->department_id)->first();
         if ($ticket->operator_id > 0) {
             $ticket->operator = User::where('id', $ticket->operator_id)->first();
         }
         $single_ticket = [];
         $single_ticket[] = $ticket->id;
         $single_ticket[] = isset($ticket->company) ? $ticket->company->name : trans('msgs.none');
         $single_ticket[] = isset($ticket->department) ? $ticket->department->name : trans('msgs.none');
         $single_ticket[] = isset($ticket->customer) ? $ticket->customer->name : trans('msgs.none');
         $single_ticket[] = isset($ticket->customer) ? $ticket->customer->email : trans('msgs.none');
         $single_ticket[] = $ticket->subject;
         $single_ticket[] = isset($ticket->operator) ? $ticket->operator->name : trans('msgs.none');
         if ($ticket->priority == Tickets::PRIORITY_LOW) {
             $single_ticket[] = '<td ><label class="label label-primary" > ' . trans("msgs.low") . ' </label ></td >';
         }
         if ($ticket->priority == Tickets::PRIORITY_MEDIUM) {
             $single_ticket[] = '<td><label class="label label-primary">' . trans("msgs.medium") . '</label></td>';
         }
         if ($ticket->priority == Tickets::PRIORITY_HIGH) {
             $single_ticket[] = '<td><label class="label label-warning">' . trans("msgs.high") . '</label></td>';
         }
         if ($ticket->priority == Tickets::PRIORITY_URGENT) {
             $single_ticket[] = '<td><label class="label label-danger">' . trans("msgs.urgent") . '</label></td>';
         }
         if ($ticket->status == Tickets::TICKET_NEW) {
             $single_ticket[] = '<td><label class="label label-warning">' . trans("msgs.new") . '</label></td>';
         }
         if ($ticket->status == Tickets::TICKET_PENDING) {
             $single_ticket[] = '<td><label class="label label-primary">' . trans("msgs.pending") . '</label></td>';
         }
         if ($ticket->status == Tickets::TICKET_RESOLVED) {
             $single_ticket[] = '<td><label class="label label-success">' . trans("msgs.resolved") . '</label></td>';
         }
         if (!isset($ticket->operator)) {
             $single_ticket[] = '<td><a href="/tickets/read/' . $ticket->thread_id . '" class="btn btn-success btn-sm"> <i class="icon-checkmark4"></i> ' . trans("msgs.accept") . ' </a></td>';
         }
         if (isset($ticket->operator) && $ticket->operator->id == Auth::user()->id) {
             $single_ticket[] = '<td><a href="/tickets/read/' . $ticket->thread_id . '" class="btn btn-success btn-sm"> <i class="icon-checkmark4"></i> ' . trans("msgs.reply") . ' </a></td>';
         }
         if (isset($ticket->operator) && $ticket->operator->id != Auth::user()->id) {
             $single_ticket[] = '<td><a disabled class="btn btn-success btn-sm"> <i class="icon-lock3"></i> ' . trans("msgs.accept") . ' </a></td>';
         }
         $single_ticket[] = '<td><a href="/tickets/transfer/' . $ticket->id . '" class="btn btn-warning btn-sm"> <i class="icon-share3"></i> ' . trans("msgs.transfer") . ' </a></td>';
         $single_ticket[] = '<td><a href="/tickets/delete/' . $ticket->thread_id . '" class="btn btn-danger btn-sm"> <i class="icon-remove3"></i> ' . trans("msgs.delete") . ' </a></td>';
         $tickets_arr[] = $single_ticket;
     }
     return json_encode(['aaData' => $tickets_arr]);
 }
 public function postPropReports()
 {
     $filter = 'go';
     $dept = Input::get('deptid');
     $category = Input::get('category');
     if ($dept == "*") {
         $deptpdf = "*";
     } else {
         $deptpdf = Department::where('id', $dept)->pluck('id');
     }
     if ($category == "*") {
         $categorypdf = "*";
     } else {
         $categorypdf = PropertyCategory::where('id', $category)->pluck('id');
     }
     Session::put('deptpdf', $deptpdf);
     Session::put('categorypdf', $categorypdf);
     $matchThese = array();
     if ($dept != "*") {
         //If true insert this to variable
         $matchThese = array_add($matchThese, 'dept_id', $dept);
         /***********Add Array*****************/
         //If user chooses from dropdown
         if ($category != "*") {
             //If true insert this to variable
             $matchThese = array_add($matchThese, 'cat_id', $category);
             $query = PropertiesUser::where($matchThese)->get();
         } else {
             //All Categoryy
             $query = PropertiesUser::where($matchThese)->get();
         }
         /***********End Add Array*****************/
     } else {
         //All Department
         /*************Add Array***************/
         if ($category != "*") {
             //If true insert this to variable
             $matchThese = array_add($matchThese, 'cat_id', $category);
             $query = PropertiesUser::where($matchThese)->get();
         } else {
             $query = PropertiesUser::all();
         }
         /************End Add Array****************/
     }
     //end of first if statement
     $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'Property Management Admin', 'action' => 'filtered the property reports.']);
     return View::make('prop.prop-reports')->with('query', $query)->with('filter', $filter);
 }
 public function get_departments_ajax()
 {
     $store_id = Input::get('store_id');
     $departments = Department::where('store_id', $store_id)->get();
     $first_department = 0;
     foreach ($departments as $department) {
         $first_department = $department->id;
         break;
     }
     $departments_data = array();
     foreach ($departments as $department) {
         $data = array();
         $data['id'] = $department->id;
         $data['name'] = $department->name;
         $data['shelves'] = Shelf::where('department_id', $department->id)->get()->toArray();
         array_push($departments_data, $data);
     }
     $response_code = 200;
     $response = Response::json($departments_data, $response_code);
     return $response;
 }
 public function all()
 {
     $online_users = OnlineUsers::all();
     foreach ($online_users as $user) {
         $user->user = User::find($user->user_id);
         if ($user->operator_id > 0) {
             $user->operator = User::find($user->operator_id);
         }
     }
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $this->data['department'] = Department::where('id', $department_admin->department_id)->first();
         $this->data["company"] = Company::where('id', $this->data['department']->company_id)->first();
     } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
         $department_operator = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
         $this->data['department'] = Department::where('id', $department_operator->department_id)->first();
         $this->data["company"] = Company::where('id', $this->data['department']->company_id)->first();
     }
     $this->data['online_users'] = $online_users;
     return View::make('conversations.all', $this->data);
 }
 public function delete($company_id)
 {
     $departments = Department::where('company_id', $company_id)->get();
     if (Config::get('site-config.is_demo') && $company_id == 1) {
         Session::flash('error_msg', 'Demo : Feature is disabled');
         return Redirect::to('/dashboard');
     }
     foreach ($departments as $department) {
         if (!empty($department)) {
             $tickets = Tickets::where('department_id', $department->id)->get();
             //Delete tickets
             foreach ($tickets as $ticket) {
                 TicketAttachments::where('thread_id', $ticket->id)->delete();
                 MessageThread::where('id', $ticket->thread_id)->delete();
                 ThreadMessages::where('thread_id', $ticket->thread_id)->delete();
             }
             Tickets::where('department_id', $department->id)->delete();
             //Delete Chat and Conversations
             $online_users = OnlineUsers::where('department_id', $department->id)->get();
             foreach ($online_users as $online_user) {
                 MessageThread::where('id', $online_user->thread_id)->delete();
                 ThreadMessages::where('thread_id', $online_user->thread_id)->delete();
             }
             OnlineUsers::where('department_id', $department->id)->delete();
             $closed_conversations = ClosedConversations::where('department_id', $department->id)->get();
             foreach ($closed_conversations as $closed_conversation) {
                 MessageThread::where('id', $closed_conversation->thread_id)->delete();
                 ThreadMessages::where('thread_id', $closed_conversation->thread_id)->delete();
             }
             ClosedConversations::where('department_id', $department->id)->delete();
             $operators = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
             if (sizeof($operators) > 0) {
                 User::whereIn('id', $operators)->delete();
                 UsersGroups::whereIn('user_id', $operators)->delete();
             }
             OperatorsDepartment::where('department_id', $department->id)->delete();
             $department_admin = DepartmentAdmins::where('department_id', $department->id)->first();
             if (!empty($department_admin)) {
                 UsersGroups::where('user_id', $department_admin->user_id)->delete();
                 User::where("id", $department_admin->user_id)->delete();
                 CompanyDepartmentAdmins::where("user_id", $department_admin->user_id)->delete();
                 CannedMessages::where('operator_id', $operators)->delete();
             }
         }
         DepartmentAdmins::where('department_id', $department->id)->delete();
         Department::where('id', $department->id)->delete();
     }
     $company = Company::where('id', $company_id)->first();
     RecentActivities::createActivity("Company <a href='/companies/all'>" . $company->name . "</a> deleted by User Name " . Auth::user()->name . " User ID " . Auth::user()->id);
     Company::where('id', $company_id)->delete();
     Session::flash('success_msg', trans('msgs.company_deleted_success'));
     return Redirect::to('/companies/all');
 }
 public function online()
 {
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $user_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
     } else {
         $group = Groups::where("name", "operator")->first();
         $user_ids = UsersGroups::where("group_id", $group->id)->lists("user_id");
     }
     if (sizeof($user_ids) > 0) {
         $this->data["operators"] = User::whereIn("id", $user_ids)->where("is_online", 1)->get();
     } else {
         $this->data["operators"] = [];
     }
     foreach ($this->data["operators"] as $operator) {
         $department_id = OperatorsDepartment::where('user_id', $operator->id)->pluck("department_id");
         $department = Department::find($department_id);
         $company = Company::find($department->company_id);
         $operator->department = $department;
         $operator->company = $company;
     }
     $this->data['permissions'] = Permissions::all();
     $this->data['departments'] = Department::all();
     return View::make('operators.all', $this->data);
 }
Beispiel #15
0
 public function getDepartmentCodeById($depid)
 {
     $rs = Department::where('department_id', '=', $depid)->get()->toArray();
     $code = $rs[0]['department_code'];
     return $code;
 }
 public function checkNewMessages()
 {
     $v_data = ["user_id" => Input::get('user_id'), "thread_id" => Input::get('thread_id'), "company_id" => Input::get('company_id'), "last_message_id" => Input::get('last_message_id')];
     $v_rules = ["user_id" => 'required', "thread_id" => 'required', "company_id" => 'required', "last_message_id" => 'required'];
     //Check any operators online from company_id
     //Check if we have any messages from user_id , thread_id
     $v = Validator::make($v_data, $v_rules);
     $response['is_online'] = false;
     if ($v->passes()) {
         //check any operator online
         $response['is_online'] = Company::operatorsOnline(Input::get('company_id'));
         $response['success_msg'] = "";
         $company = Company::find(Input::get('company_id'));
         $response['departments'] = Department::where('company_id', Input::get('company_id'))->get();
         foreach ($response['departments'] as $department) {
             $department_admin = DepartmentAdmins::where('department_id', $department->id)->first();
             $status = trans('msgs._offline_');
             $admin = User::where('id', $company->user_id)->first();
             if (!empty($admin)) {
                 if ($admin->is_online == 1) {
                     $status = trans('msgs._online_');
                 }
             }
             if (!empty($department_admin)) {
                 $user = User::where('id', $department_admin->user_id)->first();
                 if (!empty($user) && $user->is_online == 1) {
                     $status = trans('msgs._online_');
                 }
             }
             $operators = OperatorsDepartment::where('department_id', $department->id)->get();
             foreach ($operators as $operator) {
                 if (sizeof(User::where('id', $operator->user_id)->get()) > 0) {
                     $user = User::find($operator->user_id);
                     if ($user->is_online == 1) {
                         $status = trans('msgs._online_');
                     }
                 }
             }
             $department->name = $department->name . $status;
         }
         if (Input::has('token') && sizeof(OnlineUsers::where('token', Input::get('token'))->get()) > 0) {
             $token = Input::get('token');
             $response['token'] = $token;
             $online_user = OnlineUsers::where('token', $token)->first();
             $response['in_conversation'] = 1;
             $response['conversation_closed'] = 0;
             $response['thread_id'] = $online_user->thread_id;
             $thread_geo_info = ThreadGeoInfo::where('thread_id', $online_user->thread_id)->first();
             $this->fillPage(Input::get('page'), $thread_geo_info);
             $response['user_id'] = $online_user->user_id;
             $response['messages'] = MessageThread::getClientMessages($online_user->thread_id, Input::get('last_message_id'));
         } else {
             $response['in_conversation'] = 0;
             $response['token'] = "";
             $response['messages'] = [];
             $response['conversation_closed'] = 0;
             //Is conversation already closed
             if (sizeof(ClosedConversations::where('thread_id', Input::get('thread_id'))->get()) > 0) {
                 $response['success_msg'] = trans('msgs.thanks_for_contacting_support');
                 $response['token'] = 0;
                 $response['in_conversation'] = 1;
                 $response['conversation_closed'] = 1;
                 $response['thread_id'] = 0;
                 $response['user_id'] = 0;
             }
         }
     }
     return $this->send($response);
 }
 /**
  * function name : delete
  * edit data Department
  * get
  */
 public function delete($id)
 {
     if (Auth::check()) {
         $result = Department::where('department_id', $id)->delete();
         if ($result) {
             return Redirect::to('admin/departments')->with('success_message', 'ลบข้อมูลเรียบร้อยแล้ว');
         } else {
             return Redirect::to('admin/departments')->with('error_message', 'ไม่สามารถลบข้อมูลได้ กรุณาแจ้งผู้ดูแลระบบ');
         }
     } else {
         return View::make('users.index');
     }
 }
@extends('layouts.base')

@section('content')
<div class="row">
	<div class="col-md-12">

		<div class="row">
			<h1>
				Review Employee Evaluation<br>
				<small><a href="{{ route('profile', $perf->user->id) }}">
					{{ $perf->user->formatName(':ln, :fn :mi') }}<br>
					<?php 
$department = Department::where('id', $perf->dept_id)->get();
?>
				      	 @foreach ($department as $d)
				      	 	{{$d->name}}
				      	 @endforeach

				</a>
				</small>
			</h1>
		</div>

		<div class="row">
			<h2>Utilization</h2>
		</div>

			<form method="post" autocomplete="off" novalidate>
				<input type="hidden" name="id" value="{{ $perf->id }}">

				<div class="row">
Beispiel #19
0
 function update()
 {
     $this->filter_access('Departement', 'roled_edit', 'departments/index');
     $dept = new Department();
     $dept->where('dept_id', $this->input->post('id'))->update('dept_name', $this->input->post('dept_name'));
     $this->session->set_flashdata('message', 'Department Update successfuly.');
     redirect('departments/');
 }
 public function postLeavesList()
 {
     $dept = Input::get('deptid');
     if ($dept == "*") {
         $users = User::orderBy('lastname')->get();
         $deptid = "*";
     } else {
         $users = User::where('department_id', $dept)->orderBy('lastname', 'desc')->get();
         $deptid = Department::where('id', $dept)->get();
     }
     return View::make('emp.leaves-list')->with('users', $users)->with('deptid', $deptid);
 }
 public function getPerfReportsPdf()
 {
     $deptL = Session::get('deptpdf');
     $sem = Session::get('sempdf');
     $year = Session::get('yearpdf');
     if ($deptL == 'All') {
         $deptL = '*';
     }
     //------------------------------
     if ($sem == 'All') {
         $sem = '*';
     }
     $users = 'Performance';
     $matchThese = array();
     //If user chooses from dropdown
     if ($deptL != "*") {
         //If true insert this to variable
         $matchThese = array_add($matchThese, 'dept_id', $deptL);
         /***********Add Array*****************/
         //If user chooses from dropdown
         if ($sem != "*") {
             //If true insert this to variable
             $matchThese = array_add($matchThese, 'semester', $sem);
             if ($year != "All") {
                 $matchThese = array_add($matchThese, 'year', $year);
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             } else {
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             }
         } else {
             //===========Else of Semester
             if ($year != "All") {
                 $matchThese = array_add($matchThese, 'year', $year);
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             } else {
                 //===========Else of Year
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             }
             $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
         }
         /***********End Add Array*****************/
     } else {
         //===========Else of Department
         /*************Add Array***************/
         if ($sem != "*") {
             //If true insert this to variable
             $matchThese = array_add($matchThese, 'semester', $sem);
             if ($year != "All") {
                 $matchThese = array_add($matchThese, 'year', $year);
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             } else {
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             }
         } else {
             //===========Else of Semester
             if ($year != "All") {
                 $matchThese = array_add($matchThese, 'year', $year);
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             } else {
                 //===========Else of Year
                 $query = $users::all();
             }
         }
         /************End Add Array****************/
     }
     Fpdf::AddPage();
     Fpdf::PageNo();
     Fpdf::AliasNbPages();
     Fpdf::Image('img/dap.jpg', 10, 5, 150);
     Fpdf::Ln(5);
     Fpdf::SetFont('Arial', 'B', 8);
     Fpdf::Cell(300, 20, 'Date Generated: ' . date("Y/m/d"), 0, 2, 'C', 0);
     Fpdf::Cell(30, 10, 'Performance Results', 0, 2, 'C', 0);
     if ($deptL == '*') {
         Fpdf::Cell(22, 10, 'Department: All', 0, 2, 'C', 0);
     } else {
         $filterDepartment = Department::where('id', $deptL)->first();
         Fpdf::Cell(30, 10, 'Department: ' . $filterDepartment->name, 0, 2, 'C', 0);
     }
     //------------------------------
     if ($sem == '*') {
         Fpdf::Cell(22, 10, 'Semester: All', 0, 2, 'C', 0);
     } else {
         Fpdf::Cell(30, 10, 'Semester: ' . $sem, 0, 2, 'C', 0);
     }
     if ($year == 'All') {
         Fpdf::Cell(30, 10, 'Year: All', 0, 2, 'C', 0);
     } else {
         Fpdf::Cell(30, 10, 'Year: ' . $year, 0, 2, 'C', 0);
     }
     Fpdf::SetFont('Arial', 'B', 5.5);
     Fpdf::Cell(5, 5, 'Id', 1, 0, 'C', 0);
     Fpdf::Cell(24.5, 5, 'Employee Name', 1, 0, 'C', 0);
     Fpdf::Cell(24.5, 5, 'Department', 1, 0, 'C', 0);
     Fpdf::SetFillColor(51, 51, 225);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::Cell(25, 5, 'Utilities', 1, 0, 'C', true);
     Fpdf::Cell(25, 5, 'Quality of Work', 1, 0, 'C', true);
     Fpdf::Cell(30, 5, 'Potential for future performance', 1, 0, 'C', true);
     Fpdf::SetFillColor(96, 96, 96);
     Fpdf::Cell(25, 5, 'Overall Rating', 1, 0, 'C', true);
     Fpdf::Cell(15, 5, 'Semester', 1, 0, 'C', 0);
     Fpdf::Cell(16, 5, 'Year', 1, 0, 'C', 0);
     Fpdf::Ln();
     foreach ($query as $perf) {
         Fpdf::Cell(5, 5, $perf->user->id, 1, 0, 'C', 0);
         Fpdf::Cell(24.5, 5, $perf->user->formatName(':ln, :fn :mi'), 1, 0, 'C', 0);
         $department = Department::where('id', $perf->dept_id)->first();
         Fpdf::Cell(24.5, 5, $department->name, 1, 0, 'C', 0);
         Fpdf::SetFillColor(204, 229, 225);
         Fpdf::Cell(5, 5, $perf->utilities, 1, 0, 'C', true);
         Fpdf::Cell(20, 5, $perf->equivalent('utilities')->description, 1, 0, 'C', true);
         Fpdf::Cell(5, 5, $perf->workQuality, 1, 0, 'C', true);
         Fpdf::Cell(20, 5, $perf->equivalent('workQuality')->description, 1, 0, 'C', true);
         Fpdf::Cell(5, 5, $perf->potential, 1, 0, 'C', true);
         Fpdf::Cell(25, 5, $perf->equivalent('potential')->description, 1, 0, 'C', true);
         $u = $perf->utilities;
         $qow = $perf->workQuality;
         $pffp = $perf->potential;
         $overall = number_format(($u + $qow + $pffp) / 3, 2);
         $rating = ParRatingsRef::where('upper_limit', '>=', $overall)->where('lower_limit', '<=', $overall)->first();
         $overpercent = number_format($overall / 6 * 100, 2);
         Fpdf::SetFillColor(192, 192, 192);
         Fpdf::Cell(20, 5, $overall, 1, 0, 'C', true);
         Fpdf::Cell(5, 5, $rating->adjectival, 1, 0, 'C', true);
         Fpdf::Cell(15, 5, $perf->semester, 1, 0, 'C', 0);
         Fpdf::Cell(16, 5, $perf->year, 1, 0, 'C', 0);
         Fpdf::Ln();
     }
     Fpdf::SetY(-30.5);
     Fpdf::SetFont('Arial', 'I', 6);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::Cell(0, 10, 'Page ' . Fpdf::PageNo() . "/{nb}", 0, 0, 'C');
     Fpdf::Output();
     exit;
     Session::forget('deptpdf');
     Session::forget('sempdf');
     Session::forget('yearpdf');
 }
 public function all()
 {
     $user_ids = [];
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $department_ids = Department::where('company_id', $department->company_id)->lists('id');
         $user_ids = DepartmentAdmins::whereIn('department_id', $department_ids)->lists('user_id');
     } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $department_ids = Department::where('company_id', $department->company_id)->lists('id');
         $user_ids = DepartmentAdmins::whereIn('department_id', $department_ids)->lists('user_id');
     } else {
         $group = Groups::where("name", "department-admin")->first();
         $user_ids = UsersGroups::where("group_id", $group->id)->lists("user_id");
     }
     if (sizeof($user_ids) > 0) {
         $this->data["admins"] = User::whereIn("id", $user_ids)->orderBy('id', 'desc')->get();
     } else {
         $this->data["admins"] = [];
     }
     foreach ($this->data["admins"] as $admin) {
         $department_admin = DepartmentAdmins::where('user_id', $admin->id)->first();
         if (!empty($department_admin)) {
             $admin->department = Department::find($department_admin->department_id);
         }
         $company_id = CompanyDepartmentAdmins::where("user_id", $admin->id)->pluck('company_id');
         $admin->company = Company::find($company_id);
     }
     return View::make('department_admins.all', $this->data);
 }
 public function change_zipcode()
 {
     $zipcode = Input::get('zipcode');
     $store = StoreLocation::where('zipcode', $zipcode)->first();
     if (!$store) {
         $response_array = array('success' => 'false', 'error_code' => '403', 'error' => 'No nearby stores found.');
         $response_code = 200;
         if (Request::format() == 'html') {
             Session::put('zipcode', $zipcode);
             Session::put('store_id', 0);
             return Redirect::to('/store/0');
         } else {
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     } else {
         $user = User::find($this->user_id);
         $user->zipcode = $zipcode;
         $user->save();
         if (Request::format() == 'html') {
             Session::put('zipcode', $zipcode);
             Session::put('store_id', $store->store_id);
         }
         $slot = Slot::where('store_id', $store->store_id)->select('start_time', 'end_time')->first();
         if (!$slot) {
             $slot = 'No Slots Available';
         }
         $response_array['success'] = 'true';
         $default_store_id = $store->store_id;
         $response_array['store'] = $store->toArray();
         $response_array['store']['delivery_slot'] = $slot;
         $response_array['store']['depatments'] = Department::where('store_id', $default_store_id)->get()->toArray();
         $response_array['user'] = $user->toArray();
         $response_array['stores_all'] = DB::table('stores')->leftJoin('store_locations', 'stores.id', '=', 'store_locations.store_id')->leftJoin('slots', 'stores.id', '=', 'slots.store_id')->where('store_locations.zipcode', $user->zipcode)->select('stores.*', 'store_locations.store_id', 'slots.start_time', 'slots.end_time')->get();
         if (Request::format() == 'html') {
             return Redirect::to('/store/' . $store->store_id);
         } else {
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     }
 }
 public function all()
 {
     $tickets = Tickets::orderBy('priority', 'desc')->where('customer_id', Auth::user()->id)->get();
     foreach ($tickets as $ticket) {
         $ticket->customer = User::where('id', $ticket->customer_id)->first();
         $ticket->company = Company::where('id', $ticket->company_id)->first();
         $ticket->department = Department::where('id', $ticket->department_id)->first();
         if ($ticket->operator_id > 0) {
             $ticket->operator = User::where('id', $ticket->operator_id)->first();
         }
     }
     $this->data['tickets'] = $tickets;
     return View::make('tickets.customers_all', $this->data);
 }
 public function all()
 {
     $customer_ids = [];
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $customer_ids = CompanyCustomers::where("company_id", $department->company_id)->lists('customer_id');
     } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
         $department_admin = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $customer_ids = CompanyCustomers::where("company_id", $department->company_id)->lists('customer_id');
     } else {
         $customer_ids = CompanyCustomers::lists('customer_id');
     }
     if (sizeof($customer_ids) > 0) {
         $this->data["customers"] = User::whereIn("id", $customer_ids)->orderBy('id', 'desc')->get();
     } else {
         $this->data["customers"] = [];
     }
     foreach ($this->data["customers"] as $customer) {
         $company_id = CompanyCustomers::where("customer_id", $customer->id)->pluck('company_id');
         $customer->company = Company::find($company_id);
         $customer->all_ticket_count = Tickets::where('customer_id', $customer->id)->count();
         $customer->pending_ticket_count = Tickets::where('customer_id', $customer->id)->where('status', Tickets::TICKET_PENDING)->count();
         $customer->resolved_ticket_count = Tickets::where('customer_id', $customer->id)->where('status', Tickets::TICKET_RESOLVED)->count();
     }
     return View::make('customers.all', $this->data);
 }
Beispiel #26
0
 public static function getCompanyDepartments($company_id)
 {
     $departments = Department::where("company_id", $company_id)->get();
     return $departments;
 }
 public function single_department()
 {
     $store_id = Request::segment(2);
     $department_id = Request::segment(4);
     $department = Department::where('id', $department_id)->where('store_id', $store_id)->first();
     if (!$department) {
         if (Request::format() == 'html') {
             // Not Found Page
             die;
         } else {
             $response_array = array('success' => 'false', 'error_code' => '401', 'error' => 'Department not found in the choosen store');
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     }
     $department_data = $department->toArray();
     $shelves_data = array();
     $shelves = Shelf::where('department_id', $department_id)->orderBy('name')->get();
     foreach ($shelves as $shelf) {
         $shelf_data = $shelf->toArray();
         $shelf_data['products'] = array();
         $products = Product::where('shelf_id', $shelf->id)->where('store_id', $store_id)->limit(8)->orderBy('total_sale', 'desc')->get();
         foreach ($products as $product) {
             $shelf_product = $product->toarray();
             array_push($shelf_data['products'], $shelf_product);
         }
         array_push($shelves_data, $shelf_data);
     }
     $response_array['department'] = $department_data;
     $response_array['department']['shelves'] = $shelves_data;
     if (Request::format() == 'html') {
         Session::put('store_id', $store_id);
         return View::make('department')->with('data', $response_array)->with('store', $this->store)->with('departments', $this->departments)->with('zipcode', $this->zipcode)->with('city', $this->city)->with('stores', $this->stores);
     } else {
         $response_array['success'] = 'true';
         $response_code = 200;
         $response = Response::json($response_array, $response_code);
         return $response;
     }
 }
 function index()
 {
     if (\KodeInfo\Utilities\Utils::isCustomer(Auth::user()->id)) {
         return Redirect::to('/tickets/customer/all');
     }
     $past_hr = \Carbon\Carbon::now()->subHour();
     $today = \Carbon\Carbon::now()->subDay();
     $this_week = \Carbon\Carbon::now()->subWeek();
     $this_month = \Carbon\Carbon::now()->subMonth();
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $company = Company::where('id', $department->company_id)->first();
         $this->data['tickets_past_hr'] = DB::table('tickets')->where('requested_on', '>', $past_hr)->where('company_id', $company->id)->where('department_id', $department->id)->count();
         $this->data['tickets_today'] = DB::table('tickets')->where('requested_on', '>', $today)->where('company_id', $company->id)->where('department_id', $department->id)->count();
         $this->data['tickets_this_week'] = DB::table('tickets')->where('requested_on', '>', $this_week)->where('company_id', $company->id)->where('department_id', $department->id)->count();
         $this->data['tickets_this_month'] = DB::table('tickets')->where('requested_on', '>', $this_month)->where('company_id', $company->id)->where('department_id', $department->id)->count();
         $this->data['tickets_total'] = sizeof(DB::table('tickets')->get());
         $department->all_tickets = sizeof(DB::table('tickets')->where('department_id', $department->id)->get());
         $department->pending_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_PENDING)->where('department_id', $department->id)->get());
         $department->resolved_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_RESOLVED)->where('department_id', $department->id)->get());
         $operator_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
         if (sizeof($operator_ids) > 0) {
             $department->operators_online = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 1)->get());
             $department->operators_offline = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 0)->get());
         } else {
             $department->operators_online = 0;
             $department->operators_offline = 0;
         }
         $this->data['department_stats'] = $department;
     } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
         $department_operator = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_operator->department_id)->first();
         $company = Company::where('id', $department->company_id)->first();
         $this->data['tickets_past_hr'] = DB::table('tickets')->where('requested_on', '>', $past_hr)->where('company_id', $company->id)->where('department_id', $department->id)->count();
         $this->data['tickets_today'] = DB::table('tickets')->where('requested_on', '>', $today)->where('company_id', $company->id)->where('department_id', $department->id)->count();
         $this->data['tickets_this_week'] = DB::table('tickets')->where('requested_on', '>', $this_week)->where('company_id', $company->id)->where('department_id', $department->id)->count();
         $this->data['tickets_this_month'] = DB::table('tickets')->where('requested_on', '>', $this_month)->where('company_id', $company->id)->where('department_id', $department->id)->count();
         $this->data['tickets_total'] = sizeof(DB::table('tickets')->get());
         $department->all_tickets = sizeof(DB::table('tickets')->where('department_id', $department->id)->get());
         $department->pending_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_PENDING)->where('department_id', $department->id)->get());
         $department->resolved_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_RESOLVED)->where('department_id', $department->id)->get());
         $operator_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
         if (sizeof($operator_ids) > 0) {
             $department->operators_online = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 1)->get());
             $department->operators_offline = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 0)->get());
         } else {
             $department->operators_online = 0;
             $department->operators_offline = 0;
         }
         $this->data['department_stats'] = $department;
     } else {
         $this->data['tickets_past_hr'] = DB::table('tickets')->where('requested_on', '>', $past_hr)->count();
         $this->data['tickets_today'] = DB::table('tickets')->where('requested_on', '>', $today)->count();
         $this->data['tickets_this_week'] = DB::table('tickets')->where('requested_on', '>', $this_week)->count();
         $this->data['tickets_this_month'] = DB::table('tickets')->where('requested_on', '>', $this_month)->count();
         $this->data['tickets_total'] = sizeof(DB::table('tickets')->get());
         $companies = Company::all();
         foreach ($companies as $company) {
             $departments = Department::where('company_id', $company->id)->get();
             foreach ($departments as $department) {
                 $department->all_tickets = sizeof(DB::table('tickets')->where('department_id', $department->id)->get());
                 $department->pending_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_PENDING)->where('department_id', $department->id)->get());
                 $department->resolved_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_RESOLVED)->where('department_id', $department->id)->get());
                 $operator_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
                 if (sizeof($operator_ids) > 0) {
                     $department->operators_online = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 1)->get());
                     $department->operators_offline = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 0)->get());
                 } else {
                     $department->operators_online = 0;
                     $department->operators_offline = 0;
                 }
             }
             $company->departments = $departments;
         }
         $this->data['department_stats'] = $companies;
     }
     return View::make('index', $this->data);
 }
						{{ Form::twbsText('Height: ', 'height', ['fromModel' => $user], ['maxlength' => '30']) }}

					</div>

					<div class="col-md-3">
						{{ Form::twbsText('Weight: ', 'weight', ['fromModel' => $user], ['maxlength' => '30']) }}

					</div>
					<div class="col-md-3">
						{{ Form::twbsText('Citizenship: ', 'citizenship', ['fromModel' => $user], ['maxlength' => '30']) }}

					</div>
				</div>
				<?php 
$position = EmpPos::where('id', $user->pos_id)->get();
$department = Department::where('id', $user->department_id)->get();
?>
				 <div class="row">
				
				@foreach ($department as $d)
					<div class="col-md-4">
						<div class="form-group">
							<label for="department_id" class="control-label">Department</label>
							<select class="form-control" id="department_id" name="department_id">
								<option value="{{ $d->id }}">{{ $d->name }}</option>
								<option value=" ">------------------------------------</option>
								@foreach ($alldepartments as $dept)
								<option value="{{ $dept->id }}">{{ $dept->name}}</option>
								@endforeach

							</select>
 public function getViewResultsPdf($id)
 {
     $result = Performance::find($id);
     $perf = Performance::find($id);
     $user = Performance::find($id);
     $rating = Performance::find($id);
     $u = $perf->utilities;
     $qow = $perf->workQuality;
     $pffp = $perf->potential;
     $overall = number_format(($u + $qow + $pffp) / 3, 2);
     $rating = ParRatingsRef::where('upper_limit', '>=', $overall)->where('lower_limit', '<=', $overall)->first();
     $overpercent = number_format($overall / 6 * 100, 2);
     $department = Department::where('id', $perf->dept_id)->first();
     Fpdf::AddPage();
     Fpdf::PageNo();
     Fpdf::AliasNbPages('{nb}');
     Fpdf::Image('img/dap.jpg', 40, 0, 150);
     Fpdf::Ln(30);
     Fpdf::SetFont('Arial', 'B', 11);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::Cell(300, 20, 'Date Generated: ' . date("F j, Y"), 0, 2, 'C', 0);
     Fpdf::SetFont('Arial', 'B', 15);
     Fpdf::Cell(0, 0, 'Performance Evaluation', 0, 1, 'L', 0);
     Fpdf::Ln(8);
     Fpdf::SetFont('Arial', 'B', 11);
     Fpdf::Cell(0, 0, 'Name: ' . $perf->user->formatName(':ln, :fn :mn'), 0, 1, 'L', 0);
     Fpdf::Ln(8);
     Fpdf::Cell(0, 0, 'Department: ' . $department->name, 0, 1, 'L', 0);
     Fpdf::Ln(8);
     Fpdf::Cell(0, 0, 'Semester: ' . $perf->semester, 0, 1, 'L', 0);
     Fpdf::Ln(10);
     Fpdf::SetFont('Arial', '', 20);
     Fpdf::SetDrawColor(224, 224, 224);
     Fpdf::SetFillColor(51, 51, 225);
     Fpdf::SetTextColor(255, 255, 255);
     Fpdf::Cell(110, 10, 'Utilities', 1, 1, 'C', true);
     Fpdf::SetFont('Arial', 'B', 7);
     Fpdf::SetFillColor(204, 229, 225);
     Fpdf::SetTextColor(96, 96, 96);
     Fpdf::Cell(50, 10, 'Intra-group Involvements', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->util1, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util1')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util1')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Inter-group Involvements', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->util2, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util2')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util2')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Committee Work', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->util3, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util3')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util3')->description, 1, 1, 'C', 0);
     Fpdf::SetTextColor(204, 0, 0);
     Fpdf::Cell(50, 10, 'Average Rating', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->util_overall, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('utilities')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('utilities')->description, 1, 1, 'C', 0);
     //Quality of work table
     Fpdf::Ln(10);
     Fpdf::SetFont('Arial', '', 20);
     Fpdf::SetDrawColor(224, 224, 224);
     Fpdf::SetFillColor(51, 51, 225);
     Fpdf::SetTextColor(255, 255, 255);
     Fpdf::Cell(110, 10, 'Quality of Work', 1, 2, 'C', true);
     Fpdf::SetFont('Arial', 'B', 7);
     Fpdf::SetFillColor(204, 229, 225);
     Fpdf::SetTextColor(96, 96, 96);
     Fpdf::Cell(50, 10, 'Relevance to Project/unit objectives', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow1, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow1')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow1')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Timeliness', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow2, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow2')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow2')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Thoroughness', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow3, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow3')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow3')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'High-Rate', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow4, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow4')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow4')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Accuracy', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow5, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow5')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow5')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Foresight', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow6, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow6')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow6')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Neatness and Presentability', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow7, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow7')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow7')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Cost-effectiveness', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow8, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow8')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow8')->description, 1, 1, 'C', 0);
     Fpdf::SetTextColor(204, 0, 0);
     Fpdf::Cell(50, 10, 'Average Rating', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow_overall, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow_overall')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow_overall')->description, 1, 1, 'C', 0);
     //Potential for Future Performance table
     Fpdf::Ln(10);
     Fpdf::SetFont('Arial', '', 20);
     Fpdf::SetDrawColor(224, 224, 224);
     Fpdf::SetFillColor(51, 51, 225);
     Fpdf::SetTextColor(255, 255, 255);
     Fpdf::Cell(110, 10, 'Potential for Future Performance', 1, 2, 'C', true);
     Fpdf::SetFont('Arial', 'B', 7);
     Fpdf::SetFillColor(204, 229, 225);
     Fpdf::SetTextColor(96, 96, 96);
     Fpdf::Cell(50, 10, 'Appropriate Expertise', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp1, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp1')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp1')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Professional Interest', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp2, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp2')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp2')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Ability to Learn', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp3, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp3')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp3')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Professional Integrity ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp4, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp4')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp4')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Work standards ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp5, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp5')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp5')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Innovativeness ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp6, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp6')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp6')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Maturity ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp7, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp7')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp7')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Collaboration ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp8, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp8')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp8')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Initiative', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp9, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp9')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp9')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Responsiveness', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp10, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp10')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp10')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Adaptability and Consistent track record ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp11, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp11')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp11')->description, 1, 1, 'C', 0);
     Fpdf::SetTextColor(204, 0, 0);
     Fpdf::Cell(50, 10, 'Average Rating', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp_overall, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp_overall')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp_overall')->description, 1, 1, 'C', 0);
     //Overall Rating table
     Fpdf::Ln(10);
     Fpdf::SetFont('Arial', '', 20);
     Fpdf::SetDrawColor(224, 224, 224);
     Fpdf::SetFillColor(51, 51, 225);
     Fpdf::SetTextColor(255, 255, 255);
     Fpdf::Cell(140, 10, 'Overall Rating', 1, 2, 'C', true);
     Fpdf::SetFont('Arial', 'B', 7);
     Fpdf::SetFillColor(204, 229, 225);
     Fpdf::SetTextColor(96, 96, 96);
     Fpdf::Cell(30, 10, 'Superior Remarks', 1, 0, 'C', true);
     Fpdf::Cell(110, 10, $perf->comments, 1, 1, 'C', 0);
     Fpdf::Cell(30, 10, 'Overall rating', 1, 0, 'C', true);
     Fpdf::Cell(30, 10, $result->overall, 1, 0, 'C', 0);
     Fpdf::Cell(30, 10, $rating->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(50, 10, $rating->description, 1, 0, 'C', 0);
     Fpdf::SetY(-35);
     Fpdf::AliasNbPages('{nb}');
     Fpdf::SetFont('Arial', 'I', 10);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::Cell(0, 10, 'Page ' . Fpdf::PageNo() . '/{nb}', 0, 0, 'C');
     Fpdf::Output();
     exit;
 }