Esempio n. 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(InstitutionRequest $request, $id)
 {
     $institution = Institution::findOrFail($id);
     $institution->update($request->all());
     $request->session()->flash('alert-success', 'Update was successful!');
     return redirect('/tvi/' . $institution->id . '/profile');
 }
Esempio n. 2
0
 public function team($id)
 {
     $faker = Faker::create();
     for ($i = 1; $i <= $faker->numberBetween(24, 30); $i++) {
         Team::create(['institution_id' => $faker->numberBetween('1', count(Institution::get())), 'name' => 'Team ' . $i, 'name_altered' => 'Team ' . $i, 'robot_name' => 'Robot ' . $i, 'gender' => $faker->randomElement(['MAS', 'FEM', 'MIX']), 'challenge_id' => $id, 'degree_id' => $faker->numberBetween('1', count(Degree::get()))]);
     }
 }
 public function total()
 {
     $result = Trainer::select(DB::raw('sum(full_time_male) as male,
                                         sum(full_time_female) as female,
                                         sum(full_time_male) + sum(full_time_female) as total'))->whereIn('report_date_id', ReportDate::select('id')->where('petsa', $this->petsa)->lists('id'))->whereIn('institution_id', Institution::select('id')->where('region_id', $this->region_id)->lists('id'))->get();
     return $result;
 }
 /**
  * Display the specified resource.
  *
  * @param Request $request
  * @return Response
  * @internal param int $id
  */
 public function show(Request $request)
 {
     $institution = Institution::findOrFail($request->get('institution_id'));
     $trainer_ratio = new TVIIndicator1TrainerRatio($request->get('institution_id'), $request->get('report_date_id'));
     $student_ratio = new TVIIndicator2StudentRatio($request->get('institution_id'), $request->get('report_date_id'));
     $industry_extension = new TVIIndicatorIndustryExtension($request->get('institution_id'), $request->get('report_date_id'));
     return view('tviadmin.indicators.show', array('institution' => $institution, 'trainer_ratio' => $trainer_ratio, 'student_ratio' => $student_ratio, 'industry_extension' => $industry_extension));
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $array = ['Academia Maddox', 'Bachillerato Anáhuac Xalapa', 'Coelgio Everest Zacatecas', 'Colegio CECVAC', 'Colegio CEYCA Bachillerato', 'Colegio del Boque Puebla ', 'Colegio del Bosque México', 'Colegio del Bosque San Luis Potosí', 'Colegio Everest México', 'Colegio Highlands Monterrey', 'Colegio Highlands San Salvador', 'Colegio Himalaya Monterrey', 'Colegio Oxford Bachillerato', 'Insituto Cumbres del Bosque León', 'Instittuo Cumbres Cozumel', 'Instituto Alpes  Cumbres Guadalajara', 'Instituto Alpes Aguascalientes', 'Instituto Alpes San Javier', 'Instituto Andes Culiacan', 'Instituto Andes Los Mochis', 'Instituto Andes Puebla', 'Instituto Andes San Luis Potosí', 'Instituto Andes Tuxtla', 'Instituto Cumbres  Durango', 'Instituto Cumbres Aguascalientes', 'Instituto Cumbres Bosques', 'Instituto Cumbres Campeche', 'Instituto Cumbres Cancún', 'Instituto Cumbres Celaya', 'Instituto Cumbres Chetumal', 'Instituto Cumbres Cuernavaca', 'Instituto Cumbres Godwin Mérida', 'Instituto Cumbres Irapuato', 'Instituto Cumbres Lomas', 'Instituto Cumbres México', 'Instituto Cumbres Monclova', 'Instituto Cumbres Morelia', 'Instituto Cumbres Oaxaca', 'Instituto Cumbres San Javier', 'Instituto Cumbres Tapachula', 'Instituto Cumbres Tijuana', 'Instituto Cumbres Toluca', 'Instituto Cumbres Veracruz', 'Instituto Cumbres Villahermosa', 'Instituto Cumbres y Alpes Piedras Negras', 'Instituto Cumbres y Alpes Querétaro', 'Instituto Cumbres y Alpes Saltillo', 'Instituto Cumbres y Alpes Torreón', 'Instituto Everest Chihuahua', 'Instituto Godwin México', 'Instituto Highlands Pedregal', 'Instituto Irlándes Hermosillo', 'Instituto Irlandés Nuevo Laredo', 'Instituto Kilimanjaro Monterrey', 'Instituto Oxford', 'Instituto Rosedal Lomas', 'Instituto Rosedal Vista Hermosa', 'Irish Institute Femenino', 'Irish Institute Masculino', 'Irish Institute Monterrey', 'Pinecrest Institute'];
     foreach ($array as $d) {
         Institution::create(['name' => $d, 'user_id' => 1, 'mas' => $faker->randomElement([0, 1]), 'fem' => $faker->randomElement([0, 1]), 'mix' => $faker->randomElement([0, 1]), 'active' => $faker->randomElement([0, 1]), 'country_id' => $faker->randomElement([32, 76, 152, 188, 218, 222, 320, 340, 484, 558, 591, 600, 604, 620, 724, 840, 858, 859]), 'state_id' => $faker->randomElement([50, 33, 34, 43, 39, 44, 47, 42, 37, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 38, 36, 40, 49, 35, 48, 41]), 'city_id' => $faker->randomElement([1, 11, 10, 7, 4, 8, 9, 6, 2, 3, 5, 2, 3, 4, 5, 1, 3, 8, 1, 9, 2, 2, 3, 7, 11, 9, 4, 6, 10, 8, 5, 1, 30, 4, 15, 26, 8, 31, 1, 5, 10, 18, 6, 27, 11, 25, 22, 2, 20, 14, 38, 19, 3, 37, 12, 13, 28, 32, 35, 17, 36, 23, 21, 34, 7, 16, 29, 33, 9, 24, 2, 9, 7, 1, 4, 3, 5, 6, 8, 10, 101, 79, 12, 61, 86, 27, 63, 78, 23, 44, 111, 2, 28, 110, 94, 7, 24, 64, 38, 93, 56, 74, 48, 68, 88, 62, 33, 43, 84, 45, 92, 21, 29, 18, 67, 90, 60, 25, 5, 39, 42, 91, 73, 72, 47, 13, 85, 112, 76, 81, 118, 14, 22, 49, 119, 26, 113, 66, 82, 77, 96, 100, 109, 31, 59, 114, 116, 65, 50, 16, 19, 104, 30, 11, 34, 99, 41, 115, 52, 4, 106, 98, 58, 75, 20, 8, 117, 83, 17, 46, 9, 108, 97, 107, 69, 51, 3, 1, 32, 71, 40, 54, 37, 103, 89, 87, 35, 55, 102, 105, 15, 57, 53, 6, 10, 36, 70, 80, 19, 17, 54, 4, 6, 31, 50, 5, 35, 13, 23, 10, 25, 34, 40, 48, 63, 43, 37, 28, 53, 1, 15, 52, 2, 38, 42, 21, 55, 45, 22, 61, 57, 49, 27, 9, 18, 26, 24, 12, 66, 51, 47, 20, 41, 30, 8, 65, 46, 29, 59, 56, 33, 64, 7, 60, 11, 62, 67, 16, 58, 32, 3, 39, 44, 36, 14, 10, 2, 14, 3, 4, 15, 5, 6, 7, 8, 16, 9, 11, 12, 17, 13, 5, 1, 39, 3, 28, 2, 37, 34, 32, 19, 26, 8, 21, 20, 22, 16, 38, 33, 23, 14, 7, 12, 13, 36, 10, 17, 9, 25, 11, 30, 35, 18, 15, 29, 24, 4, 31, 27, 6, 15, 37, 26, 31, 25, 8, 17, 27, 24, 23, 12, 1, 16, 20, 30, 22, 3, 14, 29, 33, 43, 45, 6, 34, 13, 40, 32, 7, 5, 9, 35, 44, 11, 42, 18, 4, 19, 10, 2, 39, 38, 21, 28, 46, 36, 41, 29, 32, 40, 61, 12, 44, 51, 56, 1, 39, 53, 35, 34, 59, 75, 55, 15, 60, 49, 58, 37, 47, 31, 7, 6, 26, 17, 67, 27, 50, 64, 22, 3, 73, 54, 68, 48, 16, 38, 57, 11, 14, 21, 45, 8, 19, 24, 28, 79, 2, 74, 42, 33, 70, 5, 66, 65, 69, 72, 76, 10, 20, 41, 81, 63, 9, 52, 43, 78, 4, 46, 62, 71, 30, 25, 18, 13, 80, 77, 23, 36, 48, 38, 39, 5, 52, 51, 82, 31, 49, 47, 40, 18, 30, 84, 43, 15, 58, 6, 29, 59, 44, 3, 55, 54, 23, 9, 41, 50, 19, 67, 70, 76, 63, 17, 64, 65, 74, 10, 13, 28, 46, 32, 25, 11, 26, 80, 78, 42, 62, 34, 73, 71, 33, 81, 14, 79, 68, 12, 20, 37, 36, 35, 27, 53, 4, 60, 24, 1, 45, 22, 77, 2, 16, 56, 57, 69, 83, 75, 66, 8, 72, 7, 21, 61, 39, 120, 71, 45, 83, 9, 5, 101, 124, 1, 29, 98, 97, 70, 2, 114, 119, 10, 50, 44, 51, 30, 66, 123, 42, 61, 115, 19, 104, 25, 81, 41, 31, 76, 94, 40, 55, 36, 75, 7, 6, 3, 95, 77, 38, 62, 58, 80, 73, 46, 78, 74, 8, 125, 91, 116, 35, 118, 60, 117, 111, 53, 64, 109, 72, 93, 105, 13, 63, 47, 18, 16, 48, 33, 110, 17, 12, 28, 11, 84, 67, 20, 100, 24, 88, 90, 52, 32, 34, 54, 37, 102, 106, 68, 43, 15, 21, 27, 22, 23, 79, 26, 14, 89, 92, 82, 86, 4, 96, 107, 57, 59, 112, 69, 121, 85, 113, 99, 122, 108, 103, 65, 87, 49, 56, 106, 1, 3, 85, 14, 102, 56, 64, 74, 124, 48, 42, 47, 87, 5, 114, 111, 32, 41, 78, 66, 116, 110, 7, 86, 118, 82, 123, 77, 8, 105, 80, 97, 21, 113, 117, 4, 40, 107, 119, 51, 115, 67, 76, 54, 55, 18, 27, 73, 90, 72, 49, 88, 52, 63, 12, 6, 98, 101, 43, 19, 62, 37, 13, 57, 104, 71, 45, 79, 112, 26, 60, 38, 46, 95, 23, 35, 121, 91, 24, 53, 109, 108, 33, 120, 96, 10, 36, 20, 81, 44, 125, 59, 92, 75, 2, 65, 16, 61, 84, 100, 28, 69, 93, 99, 30, 11, 31, 29, 70, 39, 25, 122, 83, 22, 103, 17, 89, 68, 50, 94, 9, 15, 34, 58, 53, 37, 16, 73, 100, 48, 1, 49, 71, 113, 4, 63, 107, 94, 70, 44, 54, 36, 20, 27, 18, 88, 78, 3, 110, 40, 72, 76, 11, 74, 103, 62, 105, 86, 106, 42, 69, 60, 28, 109, 67, 51, 45, 104, 23, 108, 30, 85, 25, 43, 84, 19, 95, 91, 102, 21, 65, 24, 56, 90, 75, 68, 83, 58, 12, 89, 2, 6, 64, 14, 26, 15, 8, 96, 10, 52, 31, 17, 93, 34, 50, 41, 80, 22, 10, 92, 7, 5, 98, 61, 47, 112, 99, 46, 81, 66, 32, 39, 82, 97, 111, 87, 33, 59, 55, 79, 9, 35, 29, 57, 13, 38, 77, 7, 9, 20, 23, 26, 11, 18, 15, 5, 21, 14, 1, 17, 4, 29, 6, 8, 24, 31, 28, 22, 30, 27, 2, 16, 33, 32, 12, 19, 13, 3, 10, 25, 17, 18, 15, 1, 16, 5, 9, 19, 11, 10, 4, 20, 12, 8, 13, 14, 7, 2, 6, 3, 39, 5, 32, 37, 8, 44, 51, 50, 40, 45, 12, 47, 1, 28, 25, 2, 23, 11, 35, 18, 21, 48, 19, 46, 10, 6, 41, 34, 16, 42, 27, 3, 15, 20, 13, 26, 31, 49, 4, 22, 9, 38, 43, 33, 30, 17, 29, 14, 7, 24, 36, 67, 338, 175, 161, 179, 150, 487, 294, 193, 45, 483, 178, 77, 63, 102, 84, 539, 531, 33, 293, 135, 227, 426, 494, 553, 157, 91, 87, 519, 409, 184, 44, 169, 21, 2, 278, 9, 309, 166, 134, 417, 232, 559, 136, 41, 406, 354, 228, 142, 322, 374, 29, 490, 545, 434, 244, 163, 396, 40, 187, 234, 109, 171, 249, 116, 58, 206, 431, 416, 177, 24, 355, 27, 330, 276, 438, 98, 139, 19, 527, 182, 425, 220, 326, 558, 313, 436, 311, 478, 62, 214, 336, 458, 1, 296, 42, 173, 335, 260, 544, 359, 196, 419, 267, 191, 247, 504, 496, 35, 363, 288, 365, 262, 443, 473, 156, 457, 222, 471, 223, 280, 541, 201, 128, 432, 514, 442, 97, 216, 257, 100, 120, 114, 503, 38, 138, 246, 303, 522, 299, 460, 468, 205, 498, 212, 189, 39, 459, 22, 340, 181, 373, 476, 160, 568, 89, 456, 4, 400, 462, 484, 186, 567, 199, 290, 34, 99, 259, 251, 183, 549, 32, 455, 165, 245, 261, 55, 381, 352, 237, 164, 529, 520, 524, 176, 548, 18, 464, 552, 151, 47, 256, 283, 287, 488, 129, 422, 537, 501, 230, 81, 11, 376, 65, 152, 461, 339, 556, 540, 321, 547, 106, 486, 521, 405, 105, 93, 341, 221, 121, 499, 346, 518, 423, 536, 332, 479, 6, 270, 264, 395, 451, 404, 304, 463, 523, 96, 224, 215, 493, 140, 250, 569, 469, 286, 348, 528, 208, 242, 16, 397, 210, 317, 239, 383, 480, 408, 172, 370, 127, 258, 240, 50, 119, 379, 86, 532, 110, 252, 430, 320, 445, 218, 46, 562, 281, 54, 147, 331, 144, 492, 195, 94, 217, 511, 564, 329, 274, 255, 43, 14, 30, 505, 441, 66, 130, 5, 141, 557, 265, 525, 75, 143, 327, 25, 502, 517, 190, 207, 554, 60, 437, 394, 454, 31, 337, 435, 275, 3, 323, 231, 427, 10, 551, 343, 560, 411, 546, 145, 349, 356, 298, 475, 506, 78, 219, 380, 51, 550, 197, 233, 194, 118, 226, 333, 325, 449, 131, 125, 200, 64, 357, 204, 122, 410, 8, 316, 428, 74, 361, 79, 470, 418, 440, 472, 36, 508, 412, 52, 53, 305, 421, 515, 307, 308, 248, 124, 453, 282, 59, 289, 351, 235, 170, 538, 146, 353, 384, 61, 154, 362, 167, 126, 209, 319, 391, 159, 344, 291, 254, 533, 95, 424, 263, 347, 279, 512, 148, 495, 236, 211, 324, 509, 366, 85, 113, 401, 117, 439, 12, 71, 306, 253, 413, 266, 73, 20, 37, 447, 300, 76, 415, 26, 446, 133, 371, 481, 372, 269, 510, 297, 382, 392, 88, 444, 500, 377, 570, 123, 378, 271, 399, 92, 375, 390, 385, 310, 107, 83, 23, 174, 350, 342, 565, 403, 115, 389, 13, 108, 555, 295, 273, 292, 388, 387, 104, 48, 369, 398, 358, 386, 137, 566, 491, 450, 448, 516, 158, 277, 420, 535, 229, 429, 149, 155, 477, 28, 243, 530, 192, 68, 360, 452, 103, 7, 315, 132, 49, 284, 368, 112, 301, 393, 162, 101, 72, 561, 328, 238, 241, 69, 17, 15, 203, 80, 542, 268, 563, 534, 482, 185, 180, 56, 345, 111, 402, 474, 285, 485, 168, 507, 467, 302, 188, 466, 312, 70, 225, 82, 90, 367, 489, 414, 334, 543, 213, 272, 364, 314, 497, 202, 433, 526, 153, 318, 114, 181, 136, 90, 34, 41, 140, 119, 106, 15, 64, 111, 194, 86, 187, 178, 197, 109, 57, 100, 71, 8, 91, 183, 213, 89, 184, 53, 208, 49, 6, 167, 123, 14, 162, 215, 68, 107, 30, 28, 77, 210, 78, 202, 72, 84, 80, 158, 192, 29, 88, 216, 101, 43, 25, 76, 2, 39, 16, 172, 200, 207, 211, 83, 212, 105, 94, 174, 186, 204, 75, 173, 17, 54, 199, 44, 170, 132, 180, 134, 143, 122, 48, 74, 60, 26, 138, 19, 102, 126, 125, 188, 175, 148, 69, 121, 166, 85, 22, 5, 33, 165, 185, 168, 176, 51, 21, 159, 133, 201, 62, 7, 31, 146, 52, 206, 169, 160, 87, 73, 47, 32, 198, 56, 81, 11, 191, 157, 42, 147, 24, 59, 9, 139, 155, 113, 66, 82, 37, 196, 190, 3, 127, 141, 112, 135, 55, 117, 128, 108, 137, 67, 179, 93, 58, 116, 50, 163, 1, 104, 96, 152, 4, 142, 65, 12, 130, 164, 40, 153, 97, 151, 193, 150, 95, 131, 70, 118, 38, 144, 115, 154, 110, 45, 23, 63, 99, 182, 189, 20, 171, 79, 98, 203, 205, 177, 92, 156, 161, 46, 149, 103, 18, 120, 209, 124, 27, 195, 10, 61, 217, 145, 13, 214, 129, 35, 36, 14, 11, 5, 2, 9, 10, 3, 13, 4, 15, 18, 7, 12, 17, 16, 1, 6, 8, 4, 2, 7, 3, 5, 1, 8, 9, 6, 28, 35, 9, 1, 21, 46, 44, 7, 6, 15, 25, 33, 49, 20, 48, 47, 17, 22, 45, 56, 51, 4, 13, 16, 40, 10, 58, 2, 5, 8, 52, 30, 50, 55, 32, 43, 24, 11, 27, 36, 23, 3, 19, 31, 12, 41, 34, 26, 42, 39, 14, 18, 54, 53, 38, 29, 37, 57, 6, 18, 3, 5, 13, 11, 1, 15, 2, 7, 10, 17, 12, 9, 4, 8, 14, 16, 30, 56, 20, 55, 48, 70, 17, 4, 65, 7, 46, 60, 16, 64, 47, 43, 35, 59, 36, 39, 2, 27, 41, 15, 10, 31, 40, 28, 8, 23, 32, 38, 67, 58, 19, 6, 22, 11, 57, 24, 63, 68, 45, 34, 13, 66, 1, 14, 53, 50, 18, 42, 33, 12, 26, 71, 25, 29, 72, 21, 37, 62, 52, 54, 61, 9, 5, 51, 49, 44, 3, 69, 4, 10, 13, 5, 8, 2, 14, 6, 12, 3, 11, 16, 9, 15, 17, 1, 7, 41, 19, 13, 8, 22, 40, 35, 10, 36, 37, 18, 34, 1, 30, 16, 20, 42, 39, 17, 26, 6, 31, 29, 27, 25, 14, 24, 15, 7, 32, 33, 23, 5, 38, 9, 3, 2, 12, 43, 11, 21, 4, 28, 87, 182, 92, 79, 25, 128, 26, 136, 1, 132, 194, 177, 187, 36, 93, 112, 106, 2, 166, 95, 9, 4, 38, 164, 46, 65, 17, 134, 191, 126, 16, 193, 123, 133, 152, 161, 121, 155, 129, 56, 55, 63, 35, 78, 13, 205, 60, 154, 150, 34, 167, 153, 151, 72, 76, 202, 170, 198, 27, 180, 83, 58, 160, 189, 175, 157, 33, 203, 64, 50, 103, 67, 37, 51, 40, 66, 131, 124, 69, 158, 102, 211, 183, 86, 23, 10, 107, 156, 163, 114, 109, 96, 57, 197, 42, 192, 88, 24, 162, 188, 146, 179, 71, 29, 8, 47, 127, 62, 186, 80, 165, 43, 200, 7, 148, 100, 90, 105, 28, 118, 135, 101, 81, 22, 85, 68, 44, 99, 115, 138, 30, 18, 6, 147, 74, 184, 19, 195, 20, 168, 140, 185, 98, 113, 41, 117, 53, 52, 196, 14, 21, 125, 31, 49, 201, 159, 110, 137, 171, 173, 174, 181, 75, 11, 97, 207, 208, 45, 84, 5, 12, 178, 139, 119, 176, 190, 54, 169, 130, 212, 77, 94, 141, 143, 15, 73, 32, 149, 104, 209, 122, 59, 3, 142, 144, 116, 145, 172, 89, 199, 120, 48, 206, 82, 111, 39, 204, 108, 70, 91, 61, 210, 33, 15, 56, 24, 36, 29, 60, 53, 6, 20, 45, 14, 34, 21, 12, 5, 3, 11, 31, 40, 55, 43, 39, 35, 38, 52, 13, 30, 47, 46, 4, 8, 7, 16, 37, 2, 1, 26, 9, 18, 19, 23, 57, 32, 49, 51, 44, 54, 58, 42, 41, 10, 48, 50, 28, 22, 59, 17, 27, 25, 50, 59, 20, 39, 13, 105, 38, 100, 44, 87, 11, 41, 90, 2, 95, 101, 82, 26, 83, 9, 68, 106, 52, 4, 51, 54, 7, 5, 93, 35, 74, 27, 84, 78, 88, 72, 86, 77, 40, 34, 103, 67, 15, 36, 64, 37, 29, 28, 57, 65, 6, 70, 12, 31, 97, 60, 30, 42, 71, 80, 69, 96, 61, 32, 85, 8, 91, 17, 21, 92, 43, 14, 81, 19, 102, 99, 48, 63, 55, 23, 45, 76, 1, 33, 53, 62, 47, 25, 18, 89, 56, 66, 46, 24, 49, 75, 10, 104, 58, 22, 73, 94, 16, 98, 79, 3, 56, 32, 50, 7, 27, 26, 41, 22, 29, 14, 39, 51, 6, 5, 37, 13, 17, 57, 12, 8, 36, 16, 25, 24, 53, 35, 52, 38, 54, 10, 42, 40, 49, 9, 21, 20, 31, 43, 55, 46, 15, 19, 44, 18, 48, 30, 3, 45, 4, 47, 58, 11, 28, 34, 2, 1, 23, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 130, 10, 18, 3, 141, 142, 143, 144, 145, 82, 19, 44, 107, 146, 73, 18, 53, 2, 19, 147, 148, 149, 150, 20, 21, 151, 152, 22, 23, 24, 153, 213, 571, 218, 219, 19, 20, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 25, 21, 19, 220, 221, 61, 26, 214, 154, 155, 27, 59, 74, 115, 28, 156, 29, 30, 2, 157, 158, 159, 12, 160, 161, 162, 45, 31, 11, 11, 85, 60, 571, 12, 116, 127, 68, 69, 54, 20, 32, 222, 34, 55, 6, 46, 33, 163, 34, 56, 164, 35, 61, 128, 165, 13, 21, 10, 36, 129, 47, 37, 130, 38, 131, 595, 39, 223, 596, 597, 598, 599])]);
     }
     /*factory(Institution::class,1000)->create();*/
 }
Esempio n. 6
0
 public function show(Request $request)
 {
     $report_date = ReportDate::findOrFail($request->get('report_date_id'));
     $institution = Institution::findOrFail($request->get('institution_id'));
     $data_summary_trainers = new DataSummaryTrainers($request->get('institution_id'), $request->get('report_date_id'));
     $data_summary_trainees = new DataSummaryTrainees($request->get('institution_id'), $request->get('report_date_id'));
     $data_summary_cooperative_trainings = new DataSummaryCooperativeTrainings($request->get('institution_id'), $request->get('report_date_id'));
     $data_summary_industry_extension = new DataSummaryIndustryExtension($request->get('institution_id'), $request->get('report_date_id'));
     return view('tviadmin.report.show', array('data_summary_trainers' => $data_summary_trainers, 'data_summary_trainees' => $data_summary_trainees, 'data_summary_cooperative_trainings' => $data_summary_cooperative_trainings, 'data_summary_industry_extension' => $data_summary_industry_extension, 'institution' => $institution, 'report_date' => $report_date));
 }
use App\Sale;
use App\Client;
use App\Institution;
use App\CashReceipt;
use App\Transport;
use App\Branch;
// Get the sale.
$creditDue = Sale::find($sale['Id']);
// Get the branch.
$branch = Branch::find($creditDue->BranchId);
// Get the creditor.
$creditor = null;
if ($sale->CreditorType == 1) {
    $creditor = Client::find($sale->CreditorId);
} else {
    $creditor = Institution::find($sale->CreditorId);
}
// Get the transport request.
$paymentCollection = Transport::find($transport['Id']);
$payments = CashReceipt::where('Type', '=', 2)->where('TypeId', '=', $sale->Id)->get();
$totalDue = $creditDue->Value + $creditDue->Tax;
foreach ($payments as $payment) {
    $totalDue -= $payment->Value;
}
?>
<p>{{ $creditor->Name }},</p>
<p>Les enviamos el siguiente correo para dejarles saber que el {{ $transport->Date }} estaremos llegando a recoger el pago de la factura numero {{ $sale->Id }}. El total pendiente es de C$ {{ $totalDue }}.</p>
<p>Si por algun motivo no podra pagar ese dia puede reprogramar nuestra visita respondiendo a este correo de la siguiente manera:</p>
<p>Reprogramar:{{ date('Y-m-d', strtotime("+5 days")) }}</p>
<p>Se despide cordialmente,</p>
<p>Aergia AI (Inteligencia Artificial)</p>
Esempio n. 8
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Let's get all credit sales that have not been paid yet.
     $creditSales = Sale::where('Credit', '=', true)->where('Cancelled', '=', false)->get();
     // Check if any of them are due soon.
     $today = date('Y-m-d H:i:s');
     foreach ($creditSales as $sale) {
         // Get the client or institution that made the credit purchase.
         $creditor = null;
         if ($sale->CreditorType == 1) {
             $creditor = Client::find($sale->CreditorId);
         } else {
             $creditor = Institution::find($sale->CreditorId);
         }
         // First check if the payment is late.
         if (date('Y-m-d H:i:s', strtotime($sale->Created) + $creditor->CreditDays * 86400) < $today) {
             // If it's past due for more than a month notify admins so they can deal with it.
             if (date('Y-m-d H:i:s', strtotime($sale->Created) + ($creditor->CreditDays + 30) * 86400) < $today) {
                 // In this case we don't have a vehicle and the provider doesn't provide delivery so we must notify an administrator.
                 $users = User::where('UserLevel', '=', 1)->get();
                 foreach ($users as $admin) {
                     Notification::create(array('UserId' => $admin->Id, 'Created' => date('Y-m-d H:i:s'), 'Reason' => 'Aergia ha tratado de cobrar la venta de credito con factura: ' . $sale->Id . ', sin embargo no se ha registrado el pago de la factura y esta tiene mas de un mes de vencimiento. Aergia no seguira tratando de cobrar esta factura, por favor darle seguimiento al caso.', 'Url' => '/creditdue/' . $sale->Id, 'Seen' => false));
                 }
             } else {
                 // Check to see if there is a transport request active to collect payment.
                 $transport = Transport::where('Type', '=', 7)->where('ReasonId', '=', $sale->Id)->where('Date', '>', date('Y-m-d'))->get();
                 if (count($transport) == 0) {
                     // Get a vehicle that can be used to go to charge creditor.
                     $vehicles = Vehicle::where('BranchId', '=', $sale->BranchId)->where('Repair', '=', false)->get();
                     $vehicle = null;
                     foreach ($vehicles as $v) {
                         if (!$vehicle) {
                             $vehicle = $v;
                         }
                         // In this case the smaller the vehicle the more suitable it should be.
                         // TODO: This could be improved.
                         if ($v->Type < $vehicle->Type) {
                             $vehicle = $v;
                         }
                     }
                     if (!$vehicle) {
                         // In this case we don't have a vehicle to go charge creditor so we must notify an administrator.
                         $users = User::where('UserLevel', '=', 1)->get();
                         foreach ($users as $admin) {
                             Notification::create(array('UserId' => $admin->Id, 'Created' => date('Y-m-d H:i:s'), 'Reason' => 'Aergia no fue capaz de organizar el cobro de la factura: ' . $sale->Id . ' ya que no tuvo vehiculos disponibles para hacerlo. Por favor organizar el cobro de la factura.', 'Url' => '/creditdue/' . $sale->Id, 'Seen' => false));
                         }
                     } else {
                         // Get location of creditor.
                         $location = Location::find($creditor->LocationId);
                         $paymentCollection = Transport::create(array('Date' => date('Y-m-d', strtotime("+1 day")), 'Time' => '00:00:00', 'VehicleId' => $vehicle->Id, 'DriverId' => 0, 'StartLatitude' => 0, 'StartLongitude' => 0, 'Journey' => '[]', 'EndLatitude' => $location->Latitude, 'EndLongitude' => $location->Longitude, 'EndAddress' => $creditor->Address, 'Distance' => 0, 'ReasonId' => $sale->Id, 'Type' => 7, 'State' => 2, 'Order' => 0, 'Depreciation' => 0));
                         // Inform creditor of when you shall collect payment.
                         if ($creditor->Email != '') {
                             Mail::send('emails.ai.creditorReminder', ['sale' => $sale, 'creditor' => $creditor, 'transport' => $paymentCollection], function ($message) use($sale, $creditor) {
                                 $message->to($creditor->Email);
                                 $message->subject('Cobro Factura: ' . $sale->Id);
                             });
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 9
0
        'user_id'       => 1,
        'mas'           =>$faker->randomElement([0,1]),
        'fem'           =>$faker->randomElement([0,1]),
        'mix'           =>$faker->randomElement([0,1]),
        'active'        =>$faker->randomElement([0,1]),
        'country_id'    =>$faker->randomElement([32,76,152,188,218,222,320,340,484,558,591,600,604,620,724,840,858,859]),
        'state_id'      =>$faker->randomElement([50,33,34,43,39,44,47,42,37,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,38,36,40,49,35,48,41]),
        'city_id'       =>$faker->randomElement([
            1,11, 10,7,4,8,9,6,2,3,5,2,3,4,5,1,3,8,1,9,2,2,3,7,11,9,4,6,10,8,5,1,30,4,15,26,8,31,1,5,10,18,6,27,11,25,22,2,20,14,38,19,3,37,12,13,28,32,35,17,36,23,21,34,7,16,29,33,9,24,2,9,7,1,4,3,5,6,8,10,101,79,12,61,86,27,63,78,23,44,111,2,28,110,94,7,24,64,38,93,56,74,48,68,88,62,33,43,84,45,92,21,29,18,67,90,60,25,5,39,42,91,73,72,47,13,85,112,76,81,118,14,22,49,119,26,113,66,82,77,
            96,100,109, 31,59,114,116, 65,50,16,19,104,30,11,34, 99,41,115,52,4,106,98,58, 75,20,8,117,83,17,46,9, 108,97,107,69, 51,3,1,32,71,40,54,37, 103,89,87,35,55,102,105,15, 57,53,6,10,36,70,80, 19,17,54,4,6,31, 50,5, 35, 13, 23, 10, 25, 34, 40, 48, 63, 43, 37, 28, 53, 1, 15, 52, 2, 38, 42, 21, 55, 45, 22, 61, 57, 49, 27, 9, 18, 26, 24, 12, 66, 51, 47, 20, 41, 30, 8, 65,46,
            29, 59, 56, 33, 64, 7, 60, 11, 62, 67, 16, 58, 32, 3,39, 44, 36, 14, 10, 2, 14, 3, 4, 15, 5, 6, 7, 8, 16, 9, 11, 12, 17, 13, 5, 1, 39, 3, 28, 2, 37, 34, 32, 19, 26, 8, 21, 20, 22, 16, 38, 33, 23, 14, 7, 12, 13, 36, 10, 17, 9, 25, 11, 30, 35, 18, 15, 29, 24, 4, 31, 27, 6, 15, 37, 26, 31, 25, 8, 17, 27, 24, 23, 12, 1, 16, 20, 30, 22, 3, 14, 29, 33, 43, 45, 6, 34, 13, 40, 32, 7, 5, 9, 35, 44, 11, 42, 18, 4, 19, 10, 2, 39, 38, 21, 28, 46, 36, 41, 29, 32, 40, 61, 12, 44, 51, 56, 1, 39, 53, 35, 34, 59, 75, 55, 15, 60, 49, 58, 37, 47, 31, 7, 6, 26, 17, 67, 27, 50, 64, 22, 3, 73, 54, 68, 48, 16, 38, 57, 11, 14, 21, 45, 8, 19, 24, 28, 79, 2, 74, 42, 33, 70, 5, 66, 65, 69, 72, 76, 10, 20, 41, 81, 63, 9, 52, 43, 78, 4, 46, 62, 71, 30, 25, 18, 13, 80, 77, 23, 36, 48, 38, 39, 5, 52, 51, 82, 31, 49, 47, 40, 18, 30, 84, 43, 15, 58, 6, 29, 59, 44, 3, 55, 54, 23, 9, 41, 50, 19, 67, 70, 76, 63, 17, 64, 65, 74, 10, 13, 28, 46, 32, 25, 11, 26, 80, 78, 42, 62, 34, 73, 71, 33, 81, 14, 79, 68, 12, 20, 37, 36, 35, 27, 53, 4, 60, 24, 1, 45, 22, 77, 2, 16, 56, 57, 69, 83, 75, 66, 8, 72, 7, 21, 61, 39, 120, 71, 45, 83, 9, 5, 101, 124, 1, 29, 98, 97, 70, 2, 114, 119, 10, 50, 44, 51, 30, 66, 123, 42, 61, 115, 19, 104, 25, 81, 41, 31, 76, 94, 40, 55, 36, 75, 7, 6, 3, 95, 77, 38, 62, 58, 80, 73, 46, 78, 74, 8, 125, 91, 116, 35, 118, 60, 117, 111, 53, 64, 109, 72, 93, 105, 13, 63, 47, 18, 16, 48, 33, 110, 17, 12, 28, 11, 84, 67, 20, 100, 24, 88, 90, 52, 32, 34, 54, 37, 102, 106, 68, 43, 15,
            21, 27, 22, 23, 79, 26, 14, 89, 92, 82, 86, 4, 96, 107, 57, 59, 112, 69, 121, 85, 113, 99, 122, 108, 103, 65, 87, 49, 56, 106, 1, 3, 85, 14, 102, 56, 64, 74, 124, 48, 42, 47, 87, 5, 114, 111,
            32, 41, 78, 66, 116, 110,7, 86, 118, 82, 123, 77, 8, 105, 80, 97, 21, 113, 117, 4, 40, 107, 119, 51, 115, 67, 76, 54, 55, 18, 27, 73, 90, 72, 49, 88, 52, 63, 12, 6, 98, 101, 43, 19, 62, 37, 13, 57, 104, 71, 45, 79, 112, 26, 60, 38, 46, 95, 23, 35, 121,91, 24, 53, 109, 108, 33, 120, 96, 10, 36, 20, 81, 44, 125, 59, 92, 75, 2, 65, 16, 61, 84, 100, 28, 69, 93, 99, 30, 11, 31, 29, 70, 39, 25, 122, 83, 22, 103, 17, 89, 68, 50, 94, 9, 15, 34, 58, 53, 37, 16, 73, 100, 48, 1, 49, 71, 113, 4, 63, 107, 94, 70, 44, 54, 36, 20, 27, 18, 88, 78, 3, 110, 40, 72, 76, 11, 74, 103, 62, 105, 86, 106, 42, 69, 60, 28, 109, 67, 51, 45, 104, 23, 108, 30, 85, 25, 43, 84, 19, 95, 91, 102, 21, 65, 24, 56, 90, 75, 68, 83, 58, 12, 89, 2, 6, 64, 14, 26, 15, 8, 96, 10, 52, 31, 17, 93, 34, 50, 41, 80, 22, 10, 92, 7, 5, 98, 61, 47, 112, 99, 46, 81, 66, 32, 39, 82, 97, 111, 87, 33, 59, 55, 79, 9, 35, 29, 57, 13, 38, 77, 7, 9, 20, 23, 26, 11, 18, 15, 5, 21, 14, 1, 17, 4, 29, 6, 8, 24, 31, 28, 22, 30, 27, 2, 16, 33, 32, 12, 19, 13, 3, 10, 25, 17, 18, 15, 1, 16, 5, 9, 19, 11, 10, 4, 20, 12, 8, 13, 14, 7, 2, 6, 3, 39, 5, 32, 37, 8, 44, 51, 50, 40, 45, 12, 47, 1, 28, 25, 2, 23, 11, 35, 18, 21, 48, 19, 46, 10, 6, 41, 34, 16, 42, 27, 3, 15, 20, 13, 26, 31, 49, 4, 22, 9, 38, 43, 33, 30, 17, 29, 14, 7, 24, 36, 67, 338, 175, 161, 179, 150, 487, 294, 193, 45, 483, 178, 77, 63, 102, 84, 539, 531, 33, 293, 135, 227, 426, 494, 553, 157, 91, 87, 519, 409, 184, 44, 169, 21, 2, 278, 9, 309, 166, 134, 417, 232, 559, 136, 41, 406, 354, 228, 142, 322, 374, 29, 490, 545, 434, 244, 163, 396, 40, 187, 234, 109, 171, 249, 116, 58, 206, 431, 416, 177, 24, 355, 27, 330, 276, 438, 98, 139, 19, 527, 182, 425, 220, 326, 558, 313, 436, 311, 478, 62, 214, 336, 458, 1, 296, 42, 173, 335, 260, 544, 359, 196, 419, 267, 191, 247, 504, 496, 35, 363, 288, 365, 262, 443, 473, 156, 457, 222, 471, 223, 280, 541, 201, 128, 432, 514, 442, 97, 216, 257, 100, 120, 114, 503, 38, 138, 246, 303, 522, 299, 460, 468, 205, 498, 212, 189, 39, 459, 22, 340, 181, 373, 476, 160, 568, 89, 456, 4, 400, 462, 484, 186, 567, 199, 290, 34, 99, 259, 251, 183, 549, 32, 455, 165, 245, 261, 55, 381, 352, 237, 164, 529, 520, 524, 176, 548, 18, 464, 552, 151, 47, 256, 283, 287, 488, 129, 422, 537, 501, 230, 81, 11, 376, 65, 152, 461, 339, 556, 540, 321, 547, 106, 486, 521, 405, 105, 93, 341, 221, 121, 499, 346, 518, 423, 536, 332, 479, 6, 270, 264, 395, 451, 404, 304, 463, 523, 96, 224, 215, 493, 140, 250, 569, 469, 286, 348, 528, 208, 242, 16, 397, 210, 317, 239, 383, 480, 408, 172, 370, 127, 258, 240, 50, 119, 379, 86, 532, 110, 252, 430, 320, 445, 218, 46, 562, 281, 54, 147, 331, 144, 492, 195, 94, 217, 511, 564, 329, 274, 255, 43, 14, 30, 505, 441, 66, 130, 5, 141, 557, 265, 525, 75, 143, 327, 25, 502, 517, 190, 207, 554, 60, 437, 394, 454, 31, 337, 435, 275, 3, 323, 231, 427, 10, 551, 343, 560, 411, 546, 145, 349, 356, 298, 475, 506, 78, 219, 380, 51, 550, 197, 233, 194, 118, 226, 333, 325, 449, 131, 125, 200, 64, 357, 204, 122, 410, 8, 316, 428, 74, 361, 79, 470, 418, 440, 472, 36, 508, 412, 52, 53, 305, 421, 515, 307, 308, 248, 124, 453, 282, 59, 289, 351, 235, 170, 538, 146, 353, 384, 61, 154, 362, 167, 126, 209, 319, 391, 159, 344, 291, 254, 533, 95, 424, 263, 347, 279, 512, 148, 495, 236, 211, 324, 509, 366, 85, 113, 401, 117, 439, 12, 71, 306, 253, 413, 266, 73, 20, 37, 447, 300, 76, 415, 26, 446, 133, 371, 481, 372, 269, 510, 297, 382, 392, 88, 444, 500, 377, 570, 123, 378, 271, 399, 92, 375, 390, 385, 310, 107, 83, 23, 174, 350, 342, 565, 403, 115, 389, 13, 108, 555, 295, 273, 292, 388, 387, 104, 48, 369, 398, 358, 386, 137, 566, 491, 450, 448, 516, 158, 277, 420, 535, 229, 429, 149, 155, 477, 28, 243, 530, 192, 68, 360, 452, 103, 7, 315, 132, 49, 284, 368, 112, 301, 393, 162, 101, 72, 561, 328, 238, 241, 69, 17, 15, 203, 80, 542, 268, 563, 534, 482, 185, 180, 56, 345, 111, 402, 474, 285, 485, 168, 507, 467, 302, 188, 466, 312, 70, 225, 82, 90, 367, 489, 414, 334, 543, 213, 272, 364, 314, 497, 202, 433, 526, 153, 318, 114, 181, 136, 90, 34, 41, 140, 119, 106, 15, 64, 111, 194, 86, 187, 178, 197, 109, 57, 100, 71, 8, 91, 183, 213, 89, 184, 53, 208, 49, 6, 167, 123, 14, 162, 215, 68, 107, 30, 28, 77, 210, 78, 202, 72, 84, 80, 158, 192, 29, 88, 216, 101, 43, 25, 76, 2, 39, 16, 172, 200, 207, 211, 83, 212, 105,94, 174, 186, 204, 75, 173, 17, 54, 199, 44, 170, 132, 180, 134, 143, 122, 48, 74, 60, 26, 138, 19, 102, 126, 125, 188, 175, 148, 69, 121, 166, 85, 22, 5, 33, 165, 185, 168, 176, 51, 21, 159, 133, 201, 62, 7, 31, 146, 52, 206, 169, 160, 87, 73, 47, 32, 198, 56, 81, 11, 191, 157, 42, 147, 24, 59, 9, 139, 155, 113, 66, 82, 37, 196, 190, 3, 127, 141, 112, 135, 55, 117, 128, 108, 137, 67, 179, 93, 58, 116, 50, 163, 1, 104, 96, 152, 4, 142, 65, 12, 130, 164, 40, 153, 97, 151, 193, 150, 95, 131,70, 118, 38, 144, 115, 154, 110, 45, 23, 63, 99, 182, 189, 20, 171, 79, 98, 203, 205, 177, 92, 156, 161, 46,149, 103, 18, 120, 209, 124, 27, 195, 10, 61, 217, 145, 13, 214, 129, 35, 36, 14, 11, 5, 2, 9, 10, 3, 13, 4, 15, 18, 7, 12, 17, 16, 1, 6, 8, 4, 2, 7, 3, 5, 1, 8, 9, 6, 28, 35, 9, 1, 21, 46, 44, 7, 6, 15, 25, 33, 49, 20, 48, 47, 17, 22, 45, 56, 51, 4, 13, 16, 40, 10, 58, 2, 5, 8, 52, 30, 50, 55, 32, 43, 24, 11, 27, 36, 23, 3, 19, 31, 12, 41, 34, 26, 42, 39, 14, 18, 54, 53, 38, 29, 37, 57, 6, 18, 3, 5, 13, 11, 1, 15, 2, 7, 10, 17, 12, 9, 4, 8, 14, 16, 30, 56, 20, 55, 48, 70, 17, 4, 65, 7, 46, 60, 16, 64, 47, 43, 35, 59, 36, 39, 2, 27, 41, 15, 10, 31, 40, 28, 8, 23, 32, 38, 67, 58, 19, 6, 22, 11, 57, 24, 63, 68, 45, 34, 13, 66, 1, 14, 53, 50, 18, 42, 33, 12, 26, 71, 25, 29, 72, 21, 37, 62, 52, 54, 61, 9, 5, 51, 49, 44, 3, 69, 4, 10, 13, 5, 8, 2, 14, 6, 12, 3, 11, 16, 9, 15, 17, 1, 7, 41, 19, 13, 8, 22, 40, 35, 10, 36, 37, 18, 34, 1, 30, 16, 20, 42, 39, 17, 26, 6, 31, 29, 27, 25, 14, 24, 15, 7, 32, 33, 23, 5, 38, 9, 3, 2, 12, 43, 11, 21, 4, 28, 87, 182, 92, 79, 25, 128, 26, 136, 1, 132, 194, 177, 187, 36, 93, 112, 106, 2, 166, 95, 9, 4, 38, 164, 46, 65, 17, 134, 191, 126, 16, 193, 123, 133, 152, 161, 121, 155, 129, 56, 55, 63, 35, 78, 13, 205, 60, 154, 150, 34, 167, 153, 151, 72, 76, 202, 170, 198, 27, 180, 83, 58, 160, 189, 175, 157, 33, 203, 64, 50, 103, 67, 37, 51, 40, 66, 131, 124, 69, 158, 102, 211, 183, 86, 23, 10, 107, 156, 163, 114, 109, 96, 57, 197, 42, 192, 88, 24, 162, 188, 146, 179, 71, 29, 8, 47, 127, 62, 186, 80, 165, 43, 200, 7, 148, 100, 90, 105, 28, 118, 135, 101, 81, 22, 85, 68, 44, 99, 115, 138, 30, 18, 6, 147, 74, 184, 19, 195, 20,168, 140, 185, 98, 113, 41, 117, 53, 52, 196, 14, 21, 125, 31, 49, 201, 159, 110, 137, 171, 173, 174, 181, 75, 11, 97, 207, 208, 45, 84, 5, 12, 178, 139, 119, 176, 190, 54, 169, 130, 212, 77, 94, 141, 143, 15, 73, 32, 149, 104, 209, 122, 59, 3, 142, 144, 116, 145, 172, 89, 199, 120, 48, 206, 82, 111, 39, 204, 108, 70, 91, 61, 210, 33, 15, 56, 24, 36, 29, 60, 53, 6, 20, 45, 14, 34, 21, 12, 5, 3, 11, 31, 40, 55, 43, 39, 35, 38, 52, 13, 30, 47, 46, 4, 8, 7, 16, 37, 2, 1, 26, 9, 18, 19, 23, 57, 32, 49, 51, 44, 54, 58, 42, 41, 10, 48, 50, 28, 22, 59, 17, 27, 25, 50, 59, 20, 39, 13, 105, 38, 100, 44, 87, 11, 41, 90, 2, 95, 101, 82, 26, 83, 9, 68, 106, 52, 4, 51, 54, 7, 5, 93, 35, 74, 27, 84, 78, 88, 72, 86, 77, 40, 34, 103, 67, 15, 36, 64,
            37, 29, 28, 57, 65, 6, 70, 12, 31, 97, 60, 30, 42, 71, 80, 69, 96, 61, 32, 85, 8, 91, 17, 21, 92, 43, 14, 81, 19, 102, 99, 48, 63, 55, 23, 45, 76, 1, 33, 53,62, 47, 25, 18, 89, 56, 66, 46, 24, 49, 75, 10, 104, 58, 22, 73, 94, 16, 98, 79, 3, 56, 32, 50, 7, 27, 26, 41, 22, 29, 14, 39, 51, 6, 5, 37, 13, 17, 57, 12, 8, 36, 16, 25, 24, 53, 35, 52, 38, 54, 10, 42, 40, 49, 9, 21, 20, 31, 43, 55, 46, 15, 19, 44, 18, 48, 30,3, 45, 4, 47, 58, 11, 28, 34, 2, 1, 23, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 130, 10, 18, 3, 141, 142, 143, 144, 145, 82, 19, 44, 107, 146, 73, 18, 53, 2, 19, 147, 148, 149, 150, 20, 21, 151, 152, 22, 23, 24, 153, 213, 571, 218, 219, 19, 20, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 25, 21, 19, 220, 221, 61,26, 214, 154, 155, 27, 59, 74, 115, 28, 156,29, 30, 2, 157, 158, 159, 12, 160, 161, 162, 45, 31, 11, 11, 85, 60, 571, 12, 116, 127, 68, 69, 54, 20, 32, 222, 34, 55, 6, 46, 33, 163, 34, 56, 164, 35, 61, 128, 165, 13, 21, 10, 36, 129, 47, 37, 130, 38, 131, 595, 39, 223, 596,597, 598, 599
        ]),
    ];
});*/
$factory->define(App\Stage::class, function (Faker\Generator $faker) {
    $faker->addProvider(new Faker\Provider\Internet($faker));
    return ['name' => $faker->userName, 'challenge_id' => $faker->numberBetween(1, 8)];
});
$factory->define(App\Group::class, function (Faker\Generator $faker) {
    $faker->addProvider(new Faker\Provider\DateTime($faker));
    return ['name' => $faker->century, 'challenge_id' => $faker->numberBetween('1', count(Challenge::get())), 'stage_id' => $faker->numberBetween('1', count(Stage::get()))];
});
$factory->define(App\User::class, function (Faker\Generator $faker) {
    return ['name' => $faker->name, 'last_name' => $faker->lastName, 'last_name_m' => $faker->lastName, 'email' => $faker->unique()->email, 'username' => $faker->unique()->userName, 'email_alter' => $faker->email, 'password' => bcrypt('123'), 'password_two' => base64_encode('123'), 'role_id' => 1];
});
$factory->define(App\Team::class, function (Faker\Generator $faker) {
    return ['institution_id' => $faker->numberBetween('1', count(Institution::get())), 'name' => $faker->name, 'name_altered' => $faker->name, 'robot_name' => $faker->userName, 'gender' => $faker->randomElement(['MAS', 'FEM', 'MIX']), 'challenge_id' => $faker->numberBetween('1', count(Challenge::get())), 'degree_id' => $faker->numberBetween('1', count(Degree::get()))];
});
 public function decline_inst(Request $request)
 {
     $user = User::find($request->input('inst_id'));
     $institution = Institution::where('admin_id', $user['id']);
     $user->delete();
     $institution->delete();
     return redirect('main-admin/institutions-pending');
 }
        // Get the client.
        $client = Client::find($bill->CreditorId);
        if ($days > $client->CreditDays) {
            // Get any payments made to it.
            $paid = 0;
            $payments = CashReceipt::where('Type', '=', 2)->where('TypeId', '=', $bill->Id)->get();
            foreach ($payments as $payment) {
                $paid += $payment->Value;
            }
            $total = $bill->Value + $bill->Tax;
            $pending = $total - $paid;
            array_push($lateBills, array('Id' => $bill->Id, 'Total' => $total, 'Pending' => $pending, 'State' => 'Atrasado'));
        }
    } else {
        // Get the institution.
        $institution = Institution::find($bill->CreditorId);
        if ($days > $institution->CreditDays) {
            // Get any payments made to it.
            $paid = 0;
            $payments = CashReceipt::where('Type', '=', 2)->where('TypeId', '=', $bill->Id)->get();
            foreach ($payments as $payment) {
                $paid += $payment->Value;
            }
            $total = $bill->Value + $bill->Tax;
            $pending = $total - $paid;
            array_push($lateBills, array('Id' => $bill->Id, 'Total' => $total, 'Pending' => $pending, 'State' => 'Atrasado'));
        }
    }
}
?>
@foreach($lateBills as $bill)
 public function disabilities()
 {
     $result = FormalTraining::select(DB::raw('sum(mental_male) as mental_male,
                   sum(mental_female) as mental_female,
                   sum(visual_male) as visual_male,
                   sum(visual_female) as visual_female,
                   sum(hearing_male) as hearing_male,
                   sum(hearing_female) as hearing_female,
                   sum(physical_male) as physical_male,
                   sum(physical_female) as physical_female'))->whereIn('report_date_id', ReportDate::select('id')->where('petsa', $this->petsa)->lists('id'))->whereIn('institution_id', Institution::select('id')->where('region_id', $this->region_id)->lists('id'))->get();
     return $result;
 }
Esempio n. 13
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     /**
      * academic institution
      */
     factory(Member::class, 'institution', 5)->create()->each(function ($member) use($faker) {
         Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]);
         $this->command->info('address done!');
         Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]);
         $this->command->info('phone done!');
         $institution = Institution::create(['member_id' => $member->id, 'membership_type_id' => 1, 'salutation_id' => 1, 'name' => $faker->company, 'head_name' => $faker->name, 'head_designation' => $faker->word, 'email' => $faker->email, 'mobile' => 1234567890]);
         $this->command->info('institution done!');
         AcademicMember::create(['id' => $institution->id, 'institution_type_id' => 2]);
         $this->command->info('academic done!');
         $head = PaymentHead::getHead(1, 1)->first();
         $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]);
         $this->command->info('payment done!' . $member->id);
         $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']);
         $this->command->info('narration done!');
         Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]);
         $this->command->info('Journal done!');
         RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]);
         $this->command->info('request done!');
     });
     /**
      * non academic institution
      */
     factory(Member::class, 'institution', 5)->create()->each(function ($member) use($faker) {
         Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]);
         $this->command->info('address done!');
         Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]);
         $this->command->info('phone done!');
         $institution = Institution::create(['member_id' => $member->id, 'membership_type_id' => 2, 'salutation_id' => 1, 'name' => $faker->company, 'head_name' => $faker->name, 'head_designation' => $faker->word, 'email' => $faker->email, 'mobile' => 1234567890]);
         $this->command->info('institution done!');
         $head = PaymentHead::getHead(9, 1)->first();
         $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]);
         $this->command->info('payment done!' . $member->id);
         $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']);
         $this->command->info('narration done!');
         Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]);
         $this->command->info('Journal done!');
         RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]);
         $this->command->info('request done!');
     });
     /**
      * professional individual
      */
     factory(Member::class, 'individual', 5)->create()->each(function ($member) use($faker) {
         Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]);
         $this->command->info('address done!');
         Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]);
         $this->command->info('phone done!');
         $individual = Individual::create(['member_id' => $member->id, 'membership_type_id' => 4, 'salutation_id' => $faker->randomElement(range(1, 5)), 'first_name' => $faker->firstName, 'middle_name' => $faker->word, 'last_name' => $faker->lastname, 'card_name' => $faker->name, 'gender' => $faker->randomElement(['m', 'f']), 'dob' => $faker->date('d/m/Y')]);
         $this->command->info('individual done!');
         $professional = ProfessionalMember::create(['id' => $individual->id, 'organisation' => $faker->company, 'designation' => $faker->word]);
         $this->command->info('professional done!');
         $head = PaymentHead::getHead(17, 1)->first();
         $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]);
         $this->command->info('payment done!' . $member->id);
         $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']);
         $this->command->info('narration done!');
         Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]);
         $this->command->info('Journal done!');
         RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]);
         $this->command->info('request done!');
     });
     /**
      * academic individual
      */
     factory(Member::class, 'individual', 5)->create()->each(function ($member) use($faker) {
         Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]);
         $this->command->info('address done!');
         Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]);
         $this->command->info('phone done!');
         $individual = Individual::create(['member_id' => $member->id, 'membership_type_id' => 3, 'salutation_id' => $faker->randomElement(range(1, 5)), 'first_name' => $faker->firstName, 'middle_name' => $faker->word, 'last_name' => $faker->lastname, 'card_name' => $faker->name, 'gender' => $faker->randomElement(['m', 'f']), 'dob' => $faker->date('d/m/Y')]);
         $this->command->info('individual done!');
         $student_details = StudentMember::create(['id' => $individual->id, 'student_branch_id' => 1, 'college_name' => $faker->company, 'course_name' => $faker->word, 'course_branch' => $faker->word, 'course_duration' => 3]);
         $this->command->info('student done!');
         $head = PaymentHead::getHead(21, 1)->first();
         $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]);
         $this->command->info('payment done!' . $member->id);
         $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']);
         $this->command->info('narration done!');
         Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]);
         $this->command->info('Journal done!');
         RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]);
         $this->command->info('request done!');
     });
 }
Esempio n. 14
0
 private function storeNonAcademicInstitution()
 {
     $var = DB::transaction(function ($connection) {
         $membership_period = Input::get('membership-period');
         $nameOfInstitution = Input::get('nameOfInstitution');
         $country = Input::get('country');
         $state = Input::get('state');
         $chapter = Input::get('chapter');
         $address = Input::get('address');
         $city = Input::get('city');
         $pincode = Input::get('pincode');
         $email1 = Input::get('email1');
         $email2 = Input::get('email2');
         $std = Input::get('std');
         $phone = Input::get('phone');
         $salutation = Input::get('salutation');
         $headName = Input::get('headName');
         $headDesignation = Input::get('headDesignation');
         $headEmail = Input::get('headEmail');
         $country_code = Input::get('country-code');
         $mobile = Input::get('mobile');
         $paymentMode = Input::get('paymentMode');
         $tno = Input::get('tno');
         $drawn = Input::get('drawn');
         $bank = Input::get('bank');
         $branch = Input::get('branch');
         $paymentReciept = Input::file('paymentReciept');
         $amountPaid = Input::get('amountPaid');
         $member = new Member();
         $num = $country_code . '-' . $mobile;
         $member->membership_id = 1;
         // institutional membership type ID
         $membership_type = 2;
         // non academic membership type id
         $member->csi_chapter_id = $chapter;
         $member->email = $email1;
         $member->email_extra = $email2;
         $member->password = bcrypt('1234');
         $member->save();
         $member->id;
         $filename = $member->id . '.';
         $filename .= $paymentReciept->getClientOriginalExtension();
         Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => $country, 'state_code' => $state, 'address_line_1' => $address, 'city' => $city, 'pincode' => $pincode]);
         Phone::create(['member_id' => $member->id, 'std_code' => $std, 'landline' => $phone]);
         $paymentReciept->move(storage_path('uploads/payment_proofs'), $filename);
         $institution = Institution::create(['member_id' => $member->id, 'membership_type_id' => $membership_type, 'salutation_id' => $salutation, 'name' => $nameOfInstitution, 'head_name' => $headName, 'head_designation' => $headDesignation, 'email' => $headEmail, 'country_code' => $country_code, 'mobile' => $mobile]);
         // 2nd arg is currency.. needs to be queried to put here
         $head = PaymentHead::getHead($membership_period, 1)->first();
         $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]);
         $narration = Narration::create(['payer_id' => $member->id, 'mode' => $paymentMode, 'transaction_number' => $tno, 'bank' => $bank, 'branch' => $branch, 'date_of_payment' => $drawn, 'drafted_amount' => $head->amount, 'paid_amount' => $amountPaid, 'proof' => $filename]);
         $journal = Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id]);
         if (!is_null($member->id) && $member->id > 0) {
             $user = $member;
         }
         return $member;
     });
     return $var;
 }
Esempio n. 15
0
 /**
  * Function that creates a new Institution.
  *
  * @return Response
  */
 public function createInstitution()
 {
     // Validate Input.
     $validator = Validator::make(Input::all(), array('name' => 'required', 'id' => 'required', 'phone' => 'required', 'address' => 'required', 'lat' => 'required', 'lon' => 'required'));
     if ($validator->fails()) {
         return response()->json(['error' => 'No se envio la informacion completa!']);
     }
     // Check that user is part of authorized staff.
     if (Auth::user()->Type != 1) {
         // If they are unauthorized no point in returning anything.
         return response()->json(['state' => 'Unauthorized']);
     }
     // Save location.
     $location = Location::create(array('Name' => 'Direccion de ' . Input::get('name'), 'Latitude' => Input::get('lat'), 'Longitude' => Input::get('lon'), 'Type' => 2));
     // Get the credit value.
     $credit = Input::get('credit') ? true : false;
     $creditLimit = Input::get('creditLimit');
     // Reset creditLimit just in case.
     if (!$credit) {
         $creditLimit = 0;
     }
     // Now save it.
     Institution::create(array('Name' => Input::get('name'), 'RUC' => Input::get('id'), 'Phone' => Input::get('phone'), 'Email' => Input::get('email'), 'Address' => Input::get('address'), 'Excempt' => Input::get('excemption'), 'Credit' => $credit, 'CreditLimit' => $creditLimit, 'LocationId' => $location->Id));
     return response()->json(['state' => 'Success']);
 }
 public function ie_mse_operators()
 {
     $result = IndustryExtension2::select(DB::raw('sum(starter_enterprise) as starter_enterprise,
                 sum(starter_mse_operator_male) as starter_mse_operator_male,
                 sum(starter_mse_operator_female) as starter_mse_operator_female,
                 sum(starter_mse_operator_supported_male) as starter_mse_operator_supported_male,
                 sum(starter_mse_operator_supported_female) as starter_mse_operator_supported_female,
                 sum(advance_enterprise) as advance_enterprise,
                 sum(advance_mse_operator_male) as advance_mse_operator_male,
                 sum(advance_mse_operator_female) as advance_mse_operator_female,
                 sum(advance_mse_operator_supported_male) as advance_mse_operator_supported_male,
                 sum(advance_mse_operator_supported_female) as advance_mse_operator_supported_female,
                 sum(competent_enterprise) as competent_enterprise,
                 sum(competent_mse_operator_male) as competent_mse_operator_male,
                 sum(competent_mse_operator_female) as competent_mse_operator_female,
                 sum(competent_mse_operator_supported_male) as competent_mse_operator_supported_male,
                 sum(competent_mse_operator_supported_female) as competent_mse_operator_supported_female'))->whereIn('report_date_id', ReportDate::select('id')->where('petsa', $this->petsa)->lists('id'))->whereIn('institution_id', Institution::select('id')->where('region_id', $this->region_id)->lists('id'))->get();
     return $result;
 }
Esempio n. 17
0
 public function delete($id)
 {
     $institution = Institution::findOrFail($id);
     return view('sysadmin.institutions.delete', compact('institution'));
 }
Esempio n. 18
0
use App\User;
use App\Institution;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
/**
 * Model Factory for Users
 */
$factory->define(App\User::class, function (Faker\Generator $faker) {
    return ['firstName' => $faker->firstName, 'lastName' => $faker->lastName, 'email' => $faker->email, 'address' => $faker->streetAddress(), 'city' => $faker->city(), 'zip' => $faker->postcode(), 'country' => $faker->country(), 'password' => bcrypt(str_random(10)), 'isAdmin' => 0, 'remember_token' => str_random(10)];
});
/**
 * Model Factory for Courses
 */
$factory->define(App\Course::class, function (Faker\Generator $faker) {
    return ['assignedOwner' => User::orderByRaw("RAND()")->first()->id, 'assignedInstitution' => Institution::orderByRaw("RAND()")->first()->id, 'courseName' => $faker->sentence(4), 'description' => $faker->text(250), 'price' => $faker->randomNumber(4), 'startDate' => $faker->dateTimeBetween('now', '+3 years'), 'duration' => $faker->randomNumber(1), 'created_at' => $faker->dateTime($max = 'now'), 'confirmed' => 0, 'participantNum' => 20];
});
/**
 * Model Factory for Institutions
 */
$factory->define(App\Institution::class, function (Faker\Generator $faker) {
    return ['name' => $faker->company(), 'slug' => $faker->word(), 'address' => $faker->streetAddress(), 'city' => $faker->city(), 'zip' => $faker->postcode(), 'country' => $faker->country(), 'created_at' => $faker->dateTime($max = 'now')];
});
Esempio n. 19
0
 /**
  * Function that gets data of specified client.
  *
  * @return Response
  */
 public function loadInstitutions()
 {
     // Check that user is part of authorized staff.
     if (Auth::user()->Type != 1) {
         // If they are unauthorized no point in returning anything.
         return response()->json(['state' => 'Unauthorized']);
     }
     // Get the institutions.
     $institutions = Institution::all();
     $dataset = array();
     foreach ($institutions as $institution) {
         array_push($dataset, array('id' => $institution->Id, 'name' => $institution->Name));
     }
     // Return client info.
     $response['state'] = 'Success';
     $response['dataset'] = $dataset;
     return response()->json($response);
 }
Esempio n. 20
0
 public function reject_payment($typeId, $id, $narration_id)
 {
     $user = Institution::find($id);
     return view('backend.institutions.payment_reject', compact('typeId', 'id', 'narration_id'));
 }
 /**
  * Function that gets reservation information.
  *
  * @return Response
  */
 public function getReservationData()
 {
     // Validate Input.
     $validator = Validator::make(Input::all(), array('id' => 'required'));
     if ($validator->fails()) {
         return response()->json(['error' => 'No se recibieron los datos necesarios!']);
     }
     // Check that user is part of authorized staff.
     if (Auth::user()->Type != 1) {
         $response['state'] = 'No Autorizado';
         $response['error'] = 'Usuario no autorizado!';
         return response()->json($response);
     }
     // Get user branch.
     $worker = Worker::find(Auth::user()->TypeId);
     $userBranch = $worker->BranchId;
     // Get the reservation.
     $reservation = Reservation::find(Input::get('id'));
     // Get the breakdown of the reservation.
     $reservationBreakdown = ReservationBreakdown::where('ReservationId', '=', $reservation->Id)->get();
     $reservationItems = array();
     foreach ($reservationBreakdown as $breakdown) {
         // Try getting the product.
         $product = Stock::where('Code', '=', $breakdown->Code)->where('BranchId', '=', $userBranch)->first();
         if (!$product) {
             // If it's not a product it's a service.
             $service = Service::where('Code', '=', $breakdown->Code)->where('BranchId', '=', $userBranch)->first();
             array_push($reservationItems, array('quantity' => $breakdown->Quantity, 'description' => $service->Description, 'price' => $service->Price));
         } else {
             array_push($reservationItems, array('quantity' => $breakdown->Quantity, 'note' => $product->Description, 'price' => $product->Price));
         }
     }
     // Get the client's or institution's information.
     $client;
     if ($reservation->CreditorId != 0) {
         if ($reservation->CreditorType != 1) {
             $temp = Institution::find($reservation->CreditorId);
             $client = array('Name' => $temp->Name, 'Address' => $temp->Address, 'Id' => $temp->RUC);
         } else {
             $temp = Client::find($reservation->CreditorId);
             $client = array('Name' => $temp->Name, 'Address' => $temp->Address, 'Id' => $temp->Id);
         }
     } else {
         $client = array('Name' => 'No asignado', 'Address' => 'No asignado', 'Id' => 'No asignado');
     }
     // Get configuration info.
     $config = Configuration::find(0);
     //  Now prepare all the information to be returned to user.
     $response['state'] = 'Success';
     $response['clientInfo'] = $client;
     $response['reservationInfo'] = array('Date' => date('Y-m-d', strtotime($reservation->Created)), 'Life' => $config->ReservationLife, 'ReservationId' => $reservation->Id, 'SubTotal' => $reservation->Value, 'Discount' => $reservation->Discount, 'Tax' => $reservation->Tax, 'Deposit' => $reservation->Deposit, 'Total' => $reservation->Value + $reservation->Tax - $reservation->Discount);
     $response['reservationItems'] = $reservationItems;
     // Return response.
     return response()->json($response);
 }
Esempio n. 22
0
 public function show_report2_non_government(Request $request)
 {
     $user = Auth::user();
     $region = Region::findOrFail($user->region_id);
     $report_date = ReportDate::findOrFail($request->get('petsa'));
     $rpt2 = new RTAReport2NonGovernment($report_date->id, $user->region_id);
     switch ($request->get('report')) {
         case 0:
             $institutions = Institution::where('region_id', $region->id)->where('ownership', '!=', 'Public')->whereIn('id', NewEnrollee::where('report_date_id', $request->get('petsa'))->lists('institution_id'))->orderBy('name')->get();
             return view('rtaadmin.show_rpt2nongov_1', compact('rpt2', 'region', 'report_date', 'institutions'));
             break;
         case 1:
             $institutions = Institution::where('region_id', $region->id)->where('ownership', '!=', 'Public')->whereIn('id', ReEnrollee::where('report_date_id', $request->get('petsa'))->lists('institution_id'))->orderBy('name')->get();
             return view('rtaadmin.show_rpt2nongov_2', compact('rpt2', 'region', 'report_date', 'institutions'));
             break;
         case 2:
             $institutions = Institution::where('region_id', $region->id)->where('ownership', '!=', 'Public')->whereIn('id', Transferee::where('report_date_id', $request->get('petsa'))->lists('institution_id'))->orderBy('name')->get();
             return view('rtaadmin.show_rpt2nongov_3', compact('rpt2', 'region', 'report_date', 'institutions'));
             break;
         case 3:
             $institutions = Institution::where('region_id', $region->id)->where('ownership', '!=', 'Public')->whereIn('id', Graduate::where('report_date_id', $request->get('petsa'))->lists('institution_id'))->orderBy('name')->get();
             return view('rtaadmin.show_rpt2nongov_4', compact('rpt2', 'region', 'report_date', 'institutions'));
             break;
         case 4:
             $institutions = Institution::where('region_id', $region->id)->where('ownership', '!=', 'Public')->whereIn('id', ShortTermTrainee::where('report_date_id', $request->get('petsa'))->lists('institution_id'))->orderBy('name')->get();
             return view('rtaadmin.show_rpt2nongov_5', compact('rpt2', 'region', 'report_date', 'institutions'));
             break;
         case 5:
             $institutions = Institution::where('region_id', $region->id)->where('ownership', '!=', 'Public')->whereIn('id', DropoutTransferee::where('report_date_id', $request->get('petsa'))->lists('institution_id'))->orderBy('name')->get();
             return view('rtaadmin.show_rpt2nongov_6', compact('rpt2', 'region', 'report_date', 'institutions'));
             break;
         case 6:
             $institutions = Institution::where('region_id', $region->id)->where('ownership', '!=', 'Public')->whereIn('id', DropoutGraduate::where('report_date_id', $request->get('petsa'))->lists('institution_id'))->orderBy('name')->get();
             return view('rtaadmin.show_rpt2nongov_7', compact('rpt2', 'region', 'report_date', 'institutions'));
             break;
     }
 }
Esempio n. 23
0
<?php

$regions = \App\Region::orderBy('name', 'asc')->lists('name', 'id');
$institutions = \App\Institution::orderBy('name', 'asc')->lists('name', 'id');
?>

<div class="col-md-8 col-md-offset-2">

@if($submitButtonText=='Update')

    <div class="form-group">
        {!! Form::label('name', 'School Name : ') !!}
        {!! Form::text('name', null, ['placeholder' => 'School Name',
                                      'class' => 'form-control',
                                      'value' => '{{ old("name") }}']) !!}
    </div>

    <div class="form-group">
        {!! Form::label('year_establish', 'Year Establish : ') !!}
        {!! Form::input('date', 'year_establish', null, ['placeholder' => '', 'class' => 'form-control']) !!}
    </div>

    <div class="form-group">
        {!! Form::label('status', 'Status : ') !!}
        {!! Form::select('status', array('Cluster Head' => 'Cluster Head',
                                        'Polytechnic College' => 'Polytechnic College',
                                        'College' => 'College',
                                        'Institute' => 'Institute'
                                      ), $status,
                                      ['class' => 'form-control']) !!}
    </div>
Esempio n. 24
0
 /**
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  *
  */
 private function storeORUpdate(Request $request, Course $course)
 {
     $this->validate($request, ['institution' => 'required|integer', 'courseName' => 'required|max:64', 'description' => 'required|min:10', 'price' => 'numeric|required|min:0|max:9999', 'startDate' => 'required|date', 'duration' => 'required|min:0|max:480|integer', 'participantNum' => 'required|min:1|max:50|Integer']);
     $institution = Institution::find($request->institution);
     #TODO validate the institute here.
     #$this->validator->after(function($validator) {
     #    if ($this->somethingElseIsInvalid()) {
     #        $validator->errors()->add('field', 'Something is wrong with this field!');
     #    }
     #});
     $course->institution()->associate($institution);
     $course->courseName = $request->courseName;
     $course->description = $request->description;
     $course->price = $request->price;
     $course->startDate = $request->startDate;
     $course->duration = $request->duration;
     $course->participantNum = $request->participantNum;
     $course->user()->associate(Auth::user());
     if ($course->save()) {
         \Session::flash('flash_message', "Der Kurs wurde erfolgreich gespeichert");
         \Session::flash('flash_message_type', "success");
         return redirect()->action('CourseController@show', [$course->id]);
     } else {
         return Redirect::back()->withError("Der Kurs konnte leider nicht gespeichert werden.")->withInput();
     }
 }
Esempio n. 25
0
 public function getExtensionDropoutGraduatesByOccupation($occupation_id)
 {
     $result = DropoutGraduate::select(DB::raw('
                     sum(extension_level1_male) as ext_level1_male,
                     sum(extension_level1_female) as ext_level1_female,
                     sum(extension_level1_male) + sum(extension_level1_female) as ext_level1_total,
                     sum(extension_level2_male) as ext_level2_male,
                     sum(extension_level2_female) as ext_level2_female,
                     sum(extension_level2_male) + sum(extension_level2_female) as ext_level2_total,
                     sum(extension_level3_male) as ext_level3_male,
                     sum(extension_level3_female) as ext_level3_female,
                     sum(extension_level3_male) + sum(extension_level3_female) as ext_level3_total,
                     sum(extension_level4_male) as ext_level4_male,
                     sum(extension_level4_female) as ext_level4_female,
                     sum(extension_level4_male) + sum(extension_level4_female) as ext_level4_total,
                     sum(extension_level5_male) as ext_level5_male,
                     sum(extension_level5_female) as ext_level5_female,
                     sum(extension_level5_male) + sum(extension_level5_female) as ext_level5_total'))->where('report_date_id', $this->report_date_id)->where('occupation_id', $occupation_id)->whereIn('institution_id', Institution::select('id')->where('region_id', $this->region_id)->where('ownership', 'Public')->lists('id'))->get();
     return $result;
 }
Esempio n. 26
0
<?php

$regions = \App\Region::all()->sortBy('name');
$institutions = \App\Institution::all()->sortBy('name');
?>

@extends('sysadmin')
@section('content')
    @include('errors.list')
    <div class="container">
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">Register</div>
                    <div class="panel-body">
                        {!! Form::open(['url'=>'/users/register', 'role'=>'form', 'class'=>'form-horizontal']) !!}
                        <div class="col-md-8 col-md-offset-2">
                            <div class="form-group">
                                <label for="name">Name:</label>
                                <input type="text" placeholder="Full Name" class="form-control" name="name"
                                    value="{{ old('name') }}" >
                            </div>
                            <div class="form-group">
                                <label for="email">Email:</label>
                                <input type="text" placeholder="Email" class="form-control" name="email"
                                    value="{{ old('email') }}">
                            </div>
                            <div class="form-group">
                                <label for="password">Password:</label>
                                <input type="password" placeholder="Password" class="form-control" name="password">
                            </div>
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->middleware('auth');
     if (Gate::denies('manage_institutions')) {
         abort(403);
     }
     if (Gate::denies('update_institution', Institution::findOrFail($id))) {
         abort(403);
     }
     $institution = Institution::findOrFail($id);
     $institution->update($request->all());
     if ($institution->save()) {
         \Session::flash('flash_message', "Die Institution wurde erfolgreich angepasst");
         \Session::flash('flash_message_type', "success");
         return redirect()->action('InstitutionController@show', [$institution->id]);
     } else {
         return Redirect::back()->withError("Die Institution konnte nicht bearbeitet werden.")->withInput();
     }
 }
Esempio n. 28
0
 /**
  * Function that searches for past trips.
  *
  * @return Response
  */
 public function searchVehicleTrips()
 {
     // Validate Input.
     $validator = Validator::make(Input::all(), array('vehicle' => 'required', 'start' => 'required', 'end' => 'required'));
     if ($validator->fails()) {
         return response()->json(['error' => 'Informacion incompleta!']);
     }
     // Check that user is part of authorized staff.
     if (Auth::user()->Type != 1) {
         // If they are unauthorized no point in returning anything.
         return response()->json(array());
     }
     // Get trips.
     $start = date('Y-m-d', strtotime(Input::get('start')));
     $end = date('Y-m-d', strtotime(Input::get('end')));
     $trips = Transport::where('VehicleId', '=', Input::get('vehicle'))->where('Date', '>=', $start)->where('Date', '<=', $end)->where('State', '=', 1)->groupBy('Date')->orderBy('Order')->get();
     $tripData = array();
     foreach ($trips as $trip) {
         $driver = Worker::find($trip->DriverId);
         $reason = '';
         switch ($trip->Type) {
             case 1:
                 // Get sale breakdown.
                 $breakdown = SaleBreakdown::find($trip->ReasonId);
                 // Get product or service.
                 $product = Stock::where('Code', '=', $breakdown->Code)->where('BranchId', '=', $driver->BranchId)->first();
                 if ($product) {
                     $reason = 'Venta de ' . $product->Description;
                 } else {
                     $service = Service::where('Code', '=', $breakdown->Code)->where('BranchId', '=', $driver->BranchId)->first();
                     $reason = 'Venta de ' . $service->Description;
                 }
                 break;
             case 2:
                 // Get sale.
                 $sale = Sale::find($trip->ReasonId);
                 // Get client or institution.
                 if ($sale->CreditorType == 1) {
                     if ($sale->CreditorId == 0) {
                         $reason = 'Venta a cliente no definido';
                     } else {
                         $client = Client::find($sale->CreditorId);
                         $reason = 'Venta a ' . $client->Name;
                     }
                 } else {
                     $institution = Institution::find($sale->CreditorId);
                     $reason = 'Venta a ' . $institution->Name;
                 }
                 break;
             case 3:
                 // Get order breakdown.
                 $breakdown = OrderBreakdown::find('OrderId', '=', $trip->ReasonId);
                 // Get product or service.
                 $product = Stock::where('Code', '=', $breakdown->Code)->where('BranchId', '=', $driver->BranchId)->first();
                 $reason = 'Produccion de ' . $product->Description;
                 break;
             case 4:
                 // Get order.
                 $order = Order::find($trip->ReasonId);
                 // Get client or institution.
                 $client = Client::find($order->ClientId);
                 if ($client->InstitutionId == 0) {
                     $reason = 'Orden de Produccion de ' . $client->Name;
                 } else {
                     $institution = Institution::find($client->InstitutionId);
                     $reason = 'Orden de Produccion de ' . $institution->Name;
                 }
                 break;
             case 5:
                 // Get storage request.
                 $request = StorageRequest::find($trip->ReasonId);
                 $reason = $request->Reason;
                 break;
             case 6:
                 // Get visit.
                 $visit = Visit::find($trip->ReasonId);
                 $reason = 'Visita ' . $visit->Result;
                 break;
             case 7:
                 // Get credit bill.
                 $creditBill = Sale::find($trip->ReasonId);
                 $reason = 'Cobro de Facturo: ' . $creditBill->Id;
                 break;
             case 8:
                 // Contract Payment.
                 $contract = Contract::find($trip->ReasonId);
                 $reason = 'Cobro de Contrato: ' . $contract->Code;
                 break;
             case 9:
                 // Provider purchase.
                 $aiOrder = AIOrder::find($trip->ReasonId);
                 $reason = 'Compra automatica ' . $aiOrder->Id;
                 break;
             case 10:
                 $reason = 'Generado por usuario.';
                 break;
         }
         array_push($tripData, array('Id' => $trip->Id, 'Date' => $trip->Date, 'Driver' => $driver->Name, 'Reason' => $reason, 'Distance' => $trip->Distance, 'Journey' => json_decode($trip->Journey, true), 'StartLat' => $trip->StartLatitude, 'StartLon' => $trip->StartLongitude, 'EndLat' => $trip->EndLatitude, 'EndLon' => $trip->EndLongitude));
     }
     $response['state'] = 'Success';
     $response['trips'] = $tripData;
     return response()->json($response);
 }
Esempio n. 29
0
 public function postProfRegister(Request $request)
 {
     $validator = $this->professor_validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $user = $this->create_user($request->all());
     $user->role_id = 3;
     $user->save();
     $credentials = $request->all();
     $credentials['user_id'] = $user->id;
     $institution = Institution::where('inst_name', $request->institution)->first();
     $credentials['inst_id'] = $institution->id;
     $professor = $this->create_professor($credentials);
     $imageName = "prof_" . $professor->id . '.' . Input::file('image')->getClientOriginalExtension();
     Input::file('image')->move(base_path() . '/public/images/professor/', $imageName);
     $professor->prof_image = $imageName . "";
     $professor->save();
     return redirect('thankyou');
 }
 public function add_course(Request $request)
 {
     $validator = $this->course_validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $inst_id = Institution::where('admin_id', \Auth::user()->id)->first()->id;
     $categ_id = CourseCategory::where('categ_name', $request->category)->first()->id;
     $course = Course::create(['course_name' => $request->name, 'course_description' => $request->description, 'course_image' => $request->image, 'prof_id' => $request->professor, 'category_id' => $categ_id, 'inst_id' => $inst_id]);
     $imageName = "course_" . $course->id . '.' . Input::file('image')->getClientOriginalExtension();
     Input::file('image')->move(base_path() . '/public/images/course/', $imageName);
     $course->course_image = $imageName;
     $course->save();
     return redirect('institution/courses')->with('status', 'You have successfully added a course!');
 }