/** * @param User $modelUser * @param Salary $modelSalary * @param Subordination $modelSub * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View */ public function index(User $modelUser, Salary $modelSalary, Subordination $modelSub) { $users = $modelUser->getUsers(); if ($this->request->ajax() && $this->request->has('id')) { $id = $this->request->get('id'); $salary = $modelSalary->getSalary($id); $average = $modelSalary->getAverage($id); return response()->json(view('inc_payment_report', ['salary' => $salary, 'average' => $average])->render()); } if ($this->request->ajax() && $this->request->has('subordination')) { $people = $modelSub->getSubordinate($this->request->get('subordination')); return response()->json(view('inc_subordination_report', ['people' => $people])->render()); } return view('welcome', ['users' => $users]); }
public function payable($eid) { $basic = Salary::all()->where('eid', $eid)->pluck('basic')->first(); $advanceDeduction = $this->advanceDeduction($eid); //dd($basic - 1000); //$t = $basic + $this->balance($eid) - $advanceDeduction; //dd($t); return $basic - ($advanceDeduction != null ? $advanceDeduction : 0); }
/** * Delete a created salary * Created by smartrahat Date: 2016.01.14 Time: 03:15 AM * @param $id * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * @throws \Exception */ public function destroy($id) { Salary::query()->findOrFail($id)->delete(); Session::flash('success_message', 'Salary deleted successfully'); return redirect('salary'); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('salary')->delete(); Salary::create(['user_id' => '1', 'month_id' => '1', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '1', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '1', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '1', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '1', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '1', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '1', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '1', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '2', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '2', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '2', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '2', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '2', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '2', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '2', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '2', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '3', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '3', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '3', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '3', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '3', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '3', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '3', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '3', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '4', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '4', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '4', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '4', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '4', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '4', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '4', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '4', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '5', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '5', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '5', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '5', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '5', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '5', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '5', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '5', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '6', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '6', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '6', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '6', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '6', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '6', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '6', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '6', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '7', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '7', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '7', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '7', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '7', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '7', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '7', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '7', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '8', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '8', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '8', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '8', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '8', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '8', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '8', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '8', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '9', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '9', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '9', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '9', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '9', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '9', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '9', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '9', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '10', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '10', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '10', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '10', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '10', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '10', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '10', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '10', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '11', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '11', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '11', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '11', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '11', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '11', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '11', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '11', 'value' => '20000']); Salary::create(['user_id' => '1', 'month_id' => '12', 'value' => '50000']); Salary::create(['user_id' => '2', 'month_id' => '12', 'value' => '30000']); Salary::create(['user_id' => '3', 'month_id' => '12', 'value' => '30000']); Salary::create(['user_id' => '4', 'month_id' => '12', 'value' => '20000']); Salary::create(['user_id' => '5', 'month_id' => '12', 'value' => '20000']); Salary::create(['user_id' => '6', 'month_id' => '12', 'value' => '20000']); Salary::create(['user_id' => '7', 'month_id' => '12', 'value' => '20000']); Salary::create(['user_id' => '8', 'month_id' => '12', 'value' => '20000']); }