예제 #1
0
 public function createReport()
 {
     $validator = \Validator::make(\Input::all(), array('phone_number' => 'required', 'message' => 'required', 'category' => 'required', 'mobile_network' => 'required'));
     if ($validator->fails()) {
         return \Response::json(['data' => $validator->messages()], 403);
     } else {
         $report = Report::create(\Input::all());
         return Report::find($report->id);
     }
 }
예제 #2
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Report::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
예제 #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Requests\StoreReportRequest $request)
 {
     if (Report::create($request->all())) {
         //return redirect('pages.home');
         $data = $request->all();
         event(new UserCreateReport($data));
         //return Request::all();
         flash('Usuario guardado correctamente');
         return redirect()->back();
         // es temporal
         //return view('pages.home' , compact('reports' , 'data'));
     }
 }
 /**
  * Store a newly created report in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CreateReportRequest $request)
 {
     $input = $request->all();
     $attendence['user_id'] = $input['user_id'] = Auth::user()->id;
     $work_type = $input['work_type_id'];
     unset($input['work_type_id']);
     $report_id = Report::create($input);
     if ($report_id) {
         $attendence['report_id'] = $report_id->id;
         $attendence['work_type_id'] = $work_type;
         Attendence::create($attendence);
         //            echo $report_id->id; exit;
     }
     \Session::flash('message', 'Your Report has been submitted successfully.!');
     \Session::flash('message-type', 'success');
     return redirect('/reports/create');
 }
예제 #5
0
 public function run()
 {
     DB::table('reports')->delete();
     Report::create(['report' => 'Activity Detail', 'rptPath' => 'actdet', 'is_required' => 1]);
     Report::create(['report' => 'Customer Budget', 'rptPath' => 'cusbud', 'is_required' => 1]);
     Report::create(['report' => 'Account Reconcilliation', 'rptPath' => 'accrecon', 'is_required' => 1]);
     Report::create(['report' => 'Loan Management', 'rptPath' => 'lnman', 'is_required' => 0]);
     /* Revenue Summary Report */
     Report::create(['report' => 'Activity Summary', 'rptPath' => 'actsum', 'is_required' => 0]);
     Report::create(['report' => 'Available Credit', 'rptPath' => 'avcred', 'is_required' => 0]);
     Report::create(['report' => 'Cash Flow & (Risk)/Margin', 'rptPath' => 'cfarm', 'is_required' => 0]);
     Report::create(['report' => 'Farmer History', 'rptPath' => 'fmrhis', 'is_required' => 0]);
     Report::create(['report' => 'Crop Mix', 'rptPath' => 'crpmix', 'is_required' => 1]);
     Report::create(['report' => 'Committee Approval', 'rptPath' => 'comapp', 'is_required' => 0]);
     Report::create(['report' => 'Committee Comment', 'rptPath' => 'comcom', 'is_required' => 0]);
     Report::create(['report' => 'Audit Trail', 'rptPath' => 'usradt', 'is_required' => 0]);
 }
 public function report(Request $request)
 {
     $data = [];
     $data['code'] = 200;
     $validator = Validator::make($request->all(), ['district' => 'required', 'municipality' => 'required', 'candidate' => 'required', 'message' => 'required', 'file' => 'required']);
     if ($validator->fails()) {
         $data['code'] = 403;
         $data['errors'] = $validator->errors()->first();
         return response()->json($data);
     }
     $file_filename = '';
     $file_filename .= str_random(20) . '.' . $request->file->getClientOriginalExtension();
     $destinationPath = public_path('uploads/');
     $request->file->move($destinationPath, $file_filename);
     $report = Report::create(['district' => $request->district, 'municipality' => $request->municipality, 'candidate' => $request->candidate, 'message' => $request->message, 'file' => $file_filename]);
     $data['results'] = $report;
     return response()->json($data);
 }
예제 #7
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     //
     $employees = Employee::all();
     $rules = ['employee_id' => 'unique_with:reports,months'];
     foreach ($employees as $employees) {
         // $report=new Report();
         $report['employee_id'] = $employees->id;
         // $report['months']='2015-08-01';
         $report['months'] = Carbon::now()->firstOfMonth();
         $report['months_string'] = $report['months'];
         $report['fee'] = 0;
         $report['flag_id'] = 1;
         $v = \Validator::make($report, $rules);
         if ($v->fails()) {
         } else {
             $r = Report::create($report);
         }
     }
 }
예제 #8
0
파일: DemoSeeder.php 프로젝트: ppawlas/swop
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('results')->delete();
     DB::table('group_indicator')->delete();
     DB::table('group_user')->delete();
     DB::table('indicator_organization')->delete();
     DB::table('indicator_report')->delete();
     DB::table('report_user')->delete();
     DB::table('users')->delete();
     DB::table('organizations')->delete();
     DB::table('roles')->delete();
     DB::table('indicators')->delete();
     DB::table('groups')->delete();
     DB::table('reports')->delete();
     $roles = array(['name' => 'admin', 'display_name' => 'Admin'], ['name' => 'manager', 'display_name' => 'Manager'], ['name' => 'employee', 'display_name' => 'Employee']);
     foreach ($roles as $role) {
         Role::create($role);
     }
     $faker = Faker::create('pl_PL');
     $indicators = array(['name' => 'Wydane skierowania', 'function_name' => 'wyd_skier_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba skierowań wydanych przez pracownika w badanym okresie.'], ['name' => 'Obsłużone wizyty', 'function_name' => 'obsluz_wiz_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba wizyt obsłużonych przez pracownika w badanym okresie.'], ['name' => 'Udzielone ind. porady zawodowe', 'function_name' => 'ind_por_zaw_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba indywidualnych porad zawodowych udzielonych przez pracownika w badanym okresie.'], ['name' => 'Udzielone grupowe porady zawodowe', 'function_name' => 'grup_por_zaw_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba grupowych porad zawodowych udzielonych przez pracownika w badanym okresie.'], ['name' => 'Udzielone indywidualne inf. zawodowe', 'function_name' => 'ind_inf_zaw_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba indywidualnych informacji zawodowych udzielonych przez pracownika w badanym okresie.'], ['name' => 'Zorganizowane grupowe inf. zawodowe', 'function_name' => 'grup_inf_zaw_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba grupowych informacji zawodowych zorganizowanych przez pracownika w badanym okresie.'], ['name' => 'Badania kwest. do profilowania', 'function_name' => 'bad_kwest_prof_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba badań kwestionariuszem do profilowania przeprowadzonych przez pracownika w badanym okresie.'], ['name' => 'Sporządzone IPD', 'function_name' => 'sporz_ipd_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba indywidualnych planów działania sporządzonych przez pracownika w badanym okresie.'], ['name' => 'Zarejestrowani kontrahenci', 'function_name' => 'zarej_kontr_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba kontrahentów zarejestrowanych przez pracownika w badanym okresie.'], ['name' => 'Kontakty z kontrahentami', 'function_name' => 'kont_kontr_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba kontaktów z kontrahentami zrealizowanych przez pracownika w badanym okresie.']);
     foreach ($indicators as $indicator) {
         Indicator::create($indicator);
     }
     $organizations = array(['code' => 'demo', 'name' => 'Powiatowy Urząd Pracy Demo', 'active' => true], ['code' => '24780', 'name' => 'Powiatowy Urząd Pracy w Zabrzu', 'active' => true]);
     foreach ($organizations as $organization) {
         $newOrganization = Organization::create($organization);
         foreach (Indicator::all() as $indicator) {
             $newOrganization->indicators()->attach($indicator->id, ['coefficient' => $faker->randomFloat(3, 0, 10)]);
         }
     }
     foreach (range(1, 50) as $index) {
         $organization = Organization::all()->random(1);
         $gender = $faker->randomElement(['male', 'female']);
         $lastName = $faker->lastName($gender);
         $user = User::create(['login' => $organization->code . '_' . $faker->numerify($lastName . '###'), 'name' => $faker->firstName($gender), 'surname' => $lastName, 'password' => Hash::make('secret'), 'active' => $faker->boolean(), 'organization_id' => $organization->id]);
         $role = Role::all()->random(1);
         $user->attachRole($role);
     }
     foreach (Organization::all() as $organization) {
         foreach (range(1, rand(5, 10)) as $index) {
             $group = Group::create(['organization_id' => $organization->id, 'name' => $faker->numerify('Grupa testowa ####')]);
             $users = $organization->users()->orderBy(DB::raw('random()'))->take(rand(5, 10))->get();
             foreach ($users as $user) {
                 $group->users()->attach($user->id);
             }
             $indicators = Indicator::all()->random(rand(3, 7));
             foreach ($indicators as $indicator) {
                 $group->indicators()->attach($indicator->id);
             }
         }
     }
     $managers = User::whereHas('roles', function ($role) {
         $role->where('name', 'manager');
     })->get();
     foreach ($managers as $manager) {
         foreach (range(1, rand(3, 6)) as $index) {
             $endDate = $faker->dateTimeThisDecade();
             $report = Report::create(['owner_id' => $manager->id, 'name' => $faker->numerify('Raport testowy ####'), 'start_date' => $faker->dateTimeThisDecade($endDate), 'end_date' => $endDate]);
             $indicators = Indicator::all()->random(rand(2, 5));
             foreach ($indicators as $indicator) {
                 $report->indicators()->attach($indicator->id, ['show_value' => $faker->boolean(), 'show_points' => $faker->boolean()]);
             }
             $users = $manager->organization->users()->orderBy(DB::raw('random()'))->take(rand(5, 10))->get();
             foreach ($users as $user) {
                 $report->users()->attach($user->id, ['view_self' => $faker->boolean(), 'view_all' => $faker->boolean()]);
             }
         }
     }
     Model::reguard();
 }
예제 #9
0
 public function store(Request $request)
 {
     $request['id_reporter'] = Auth::user()->id;
     Report::create($request->all());
     header('location:javascript:history(-1)');
 }
예제 #10
0
파일: FakeSeeder.php 프로젝트: ppawlas/swop
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('results')->delete();
     DB::table('group_indicator')->delete();
     DB::table('group_user')->delete();
     DB::table('indicator_organization')->delete();
     DB::table('indicator_report')->delete();
     DB::table('report_user')->delete();
     DB::table('users')->delete();
     DB::table('organizations')->delete();
     DB::table('roles')->delete();
     DB::table('indicators')->delete();
     DB::table('groups')->delete();
     DB::table('reports')->delete();
     $roles = array(['name' => 'admin', 'display_name' => 'Admin'], ['name' => 'manager', 'display_name' => 'Manager'], ['name' => 'employee', 'display_name' => 'Employee']);
     foreach ($roles as $role) {
         Role::create($role);
     }
     $faker = Faker::create();
     foreach (range(1, 5) as $index) {
         Indicator::create(['name' => $faker->sentence(3), 'function_name' => $faker->numerify($faker->sentence(3) . '###'), 'type' => $faker->randomElement(['value', 'ratio']), 'default_coefficient' => $faker->randomFloat(3, 0, 1), 'description' => $faker->text()]);
     }
     foreach (range(1, 5) as $index) {
         $organization = Organization::create(['code' => $faker->randomNumber(6), 'name' => $faker->company, 'active' => $faker->boolean()]);
         foreach (Indicator::all() as $indicator) {
             $organization->indicators()->attach($indicator->id, ['coefficient' => $faker->randomFloat(3, 0, 10)]);
         }
     }
     foreach (range(1, 100) as $index) {
         $organization = Organization::all()->random(1);
         $user = User::create(['login' => $organization->code . '_' . $faker->userName, 'name' => $faker->firstName, 'surname' => $faker->lastName, 'password' => Hash::make('secret'), 'active' => $faker->boolean(), 'organization_id' => $organization->id]);
         $role = Role::all()->random(1);
         $user->attachRole($role);
     }
     foreach (Organization::all() as $organization) {
         foreach (range(1, rand(5, 10)) as $index) {
             $group = Group::create(['organization_id' => $organization->id, 'name' => $faker->sentence(3)]);
             $users = $organization->users()->orderBy(DB::raw('random()'))->take(rand(5, 10))->get();
             foreach ($users as $user) {
                 $group->users()->attach($user->id);
             }
             $indicators = Indicator::all()->random(rand(2, 5));
             foreach ($indicators as $indicator) {
                 $group->indicators()->attach($indicator->id);
             }
         }
     }
     $managers = User::whereHas('roles', function ($role) {
         $role->where('name', 'manager');
     })->get();
     foreach ($managers as $manager) {
         foreach (range(1, rand(3, 6)) as $index) {
             $endDate = $faker->date('Y-m-d');
             $report = Report::create(['owner_id' => $manager->id, 'name' => $faker->sentence(4), 'start_date' => $faker->date('Y-m-d', $endDate), 'end_date' => $endDate]);
             $indicators = Indicator::all()->random(rand(2, 5));
             foreach ($indicators as $indicator) {
                 $report->indicators()->attach($indicator->id, ['show_value' => $faker->boolean(), 'show_points' => $faker->boolean()]);
             }
             $users = $manager->organization->users()->orderBy(DB::raw('random()'))->take(rand(5, 10))->get();
             foreach ($users as $user) {
                 $report->users()->attach($user->id, ['view_self' => $faker->boolean(), 'view_all' => $faker->boolean()]);
             }
         }
     }
     Model::reguard();
 }