public static function get_db($filter_group, $filter_value) { if ($filter_group == 1) { $paymant = Payment::where('user_id', '=', $filter_value)->where('pay_amt', '!=', 0)->whereNotNull('pay_amt')->get(); $office_salary = office_salary::where('user_id', '=', $filter_value)->where('pay_amt', '!=', 0)->whereNotNull('pay_amt')->get(); } else { if ($filter_value == 3) { $paymant = Payment::where('pay_amt', '!=', 0)->whereNotNull('pay_amt')->orderBy('user_id')->get(); $office_salary = office_salary::where('pay_amt', '!=', 0)->whereNotNull('pay_amt')->orderBy('user_id')->get(); } else { $paymant = Payment::where('pay_status', '=', $filter_value)->where('pay_amt', '!=', 0)->whereNotNull('pay_amt')->orderBy('user_id')->get(); $office_salary = office_salary::where('pay_status', '=', $filter_value)->where('pay_amt', '!=', 0)->whereNotNull('pay_amt')->orderBy('user_id')->get(); } } if (isset($paymant) && $paymant) { $return_data = []; foreach ($paymant as $record) { $return_data[] = ['id' => $record->id, 'user_id' => $record->user_id, 'user_name' => $record->user->nickname . " - " . $record->user->name . " " . $record->user->surname, 'event_id' => $record->event_id, 'event_name' => $record->event->event_name, 'pay_amt' => $record->pay_amt, 'pay_status' => $record->pay_status, 'note' => $record->note, 'db' => 'assignment']; } foreach ($office_salary as $record) { $return_data[] = ['id' => $record->id, 'user_id' => $record->user_id, 'user_name' => $record->user->nickname . " - " . $record->user->name . " " . $record->user->surname, 'event_id' => 0, 'event_name' => $record->pay_name, 'pay_amt' => $record->pay_amt, 'pay_status' => $record->pay_status, 'note' => $record->note, 'db' => 'office_salary']; } return $return_data; } }
public static function Send_new_assign() { $event_id = Request::input('event_id'); $assingment = Assignment::where("event_id", "=", $event_id)->get(); if (count($assingment) > 0) { foreach ($assingment as $record) { $assign_id = $record->id; $assign_status = $record->assign_status; if ($assign_status == 1) { sendmailAssign::New_Assign($assign_id); } } } }
public static function Update_Status() { $assignstatus = Request::input('asst'); $officestatus = Request::input('ofst'); if (!empty(Request::input('removepay_select'))) { $removepay_select = explode(",", Request::input('removepay_select')); foreach ($removepay_select as $record) { if (!empty($record)) { $Payupdate = AssignmentDB::where('id', '=', $record)->first(); $Payupdate->pay_status = 0; $Payupdate->save(); } } } if (!empty(Request::input('removeoffice_select'))) { $removepay_select = explode(",", Request::input('removeoffice_select')); foreach ($removepay_select as $record) { if (!empty($record)) { $officeupdate = office_salary::where('id', '=', $record)->first(); $officeupdate->pay_status = 0; $officeupdate->save(); } } } if (isset($assignstatus)) { $assign_id_select = array_keys($assignstatus); foreach ($assign_id_select as $record) { $Payupdate = AssignmentDB::where('id', '=', $record)->first(); $Payupdate->pay_status = 2; $Payupdate->save(); } } if (isset($officestatus)) { $office_id_status = array_keys($officestatus); foreach ($office_id_status as $record) { $officeupdate = office_salary::where('id', '=', $record)->first(); $officeupdate->pay_status = 2; $officeupdate->save(); } } }
public static function Get_assign_user($event_id) { $array_data = []; $count_result = Assignment::where('event_id', '=', $event_id)->count(); if ($count_result > 0) { $user_list = Assignment::where('event_id', '=', $event_id)->get(); foreach ($user_list as $data) { $user_id = $data->user_id; $event_date = AS_Requestjob::get_event_date($event_id); $userstatus = Check_busy::main($user_id, $event_date); $usernameall = AS_Member::get_user_data($user_id, 'fullname'); $usergrade = AS_Member::get_user_detail($user_id, 'grade'); $sortgrade = AS_Member::get_user_detail($user_id, 'sortgrade'); $assign_id = $data->id; $category = "assignment_user"; $array_data[] = ["user_id" => $user_id, "usernameall" => $usernameall, "usergrade" => $usergrade, "sortgrade" => $sortgrade, "userstatus" => $userstatus, "assign_id" => $assign_id, "category" => $category]; //array_push($array_data,$data->user_id); } usort($array_data, function ($a, $b) { return $b["sortgrade"] - $a["sortgrade"]; }); return $array_data; } else { //return "ไม่มีผู้สมัครทำงานนี้"; } }
public static function response() { $root_url = dirname($_SERVER['PHP_SELF']); $assign_id = Request::input('id'); $status = Request::input('status'); if ($status == "Confirm") { $status = 2; } else { if ($status == "Reject") { $status = 3; } else { return redirect::to(".." . $root_url . '/'); exit; } } $assignment = Assignment::where('id', '=', $assign_id)->first(); if (count($assignment) > 0) { $assignment->assign_status = $status; $assignment->save(); } return redirect::to(".." . $root_url . '/'); }
public static function updatedata() { $assign_id = Request::input('assignid'); $status = Request::input('status'); $position = Request::input('position'); $event_id = Request::input('event_id'); if (count($assign_id) > 0) { for ($i = 1; $i <= count($assign_id); $i++) { $assign = AssignmentDB::where('id', '=', $assign_id[$i])->first(); $assign->assign_status = $status[$i]; $assign->position = $position[$i]; $assign->save(); } return redirect::to('assigment/' . $event_id)->with('status', "บันทึกสำเร็จ"); } else { return redirect::to('assigment/' . $event_id)->with('status', "บันทึกสำเร็จ"); } }
public static function get_assign_event($date, $user_id) { $event_data = "<td valign='top'>"; $event = event::where('event_date', '=', $date)->get(); foreach ($event as $data) { //เช็คช่วงเวลา request if ($data->meeting_period == 2) { $event_color_class = "event_color_morning"; } else { if ($data->meeting_period == 3) { $event_color_class = "event_color_afternoon"; } else { $event_color_class = "event_color_allday"; } } $count = Assignment::where('event_id', '=', $data->id)->where('user_id', '=', $user_id)->count(); if ($count > 0) { $assignment = Assignment::where('event_id', '=', $data->id)->where('user_id', '=', $user_id)->get(); foreach ($assignment as $data_assign) { //$event_data .= "<div id='". $date ."' class='st-c st-s'>".$data_assign->id."</div>"; $event_data .= "<div id='" . $data->id . "' class='st-c-pos goto_assign'>\n <div class='rb-n " . $event_color_class . "' >\n <div class='rb-ni'>" . $data->event_name . "</div>\n </div>\n </div>"; } } } $event_data .= "</td>"; return $event_data; }