Example #1
0
 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;
     }
 }
Example #2
0
 public static function get_filter_data()
 {
     $filter_group = Request::input('filter_group');
     if ($filter_group == 1) {
         $splite_user_id = explode(" ", Request::input('filter_value'));
         $user_id = str_replace("]", "", str_replace("[", "", $splite_user_id[0]));
         $office_salary = office_salary::where('user_id', '=', $user_id)->get();
     } else {
         $filter_status = Request::input('filter_value');
         $office_salary = office_salary::where('pay_status', '=', $filter_status)->get();
     }
     if (count($office_salary) > 0) {
         foreach ($office_salary as $record) {
             $fullname = $record->user->nickname . " - " . $record->user->name . " " . $record->user->surname;
             $data[] = ["id" => $record->id, "pay_name" => $record->pay_name, "pay_amt" => $record->pay_amt, "note" => $record->note, "name" => $fullname];
         }
     } else {
         $data = [];
     }
     echo office_payment::generate_html($data);
 }
Example #3
0
 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();
         }
     }
 }