Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15541 | Rev 15545 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15541 Rev 15544
Línea 104... Línea 104...
104
                    }
104
                    }
Línea 105... Línea 105...
105
                    
105
                    
106
                }
106
                }
Línea 107... Línea -...
107
            }
-
 
-
 
107
            }
108
            
108
            
Línea 109... Línea 109...
109
 
109
           // $isJson = true;
110
            if($isJson) {
110
            if($isJson) {
111
                
111
                
Línea 143... Línea 143...
143
                $climate_on_your_organization = $dailyPulseRecordMapper->fetchAllDataChartOrExcelByCompanyIdAndTypeAndDateRange($company->id, DailyPulseRecord::TYPE_CLIMATE_ON_YOUR_ORGANIZATION, $startDate, $endDate);
143
                $climate_on_your_organization = $dailyPulseRecordMapper->fetchAllDataChartOrExcelByCompanyIdAndTypeAndDateRange($company->id, DailyPulseRecord::TYPE_CLIMATE_ON_YOUR_ORGANIZATION, $startDate, $endDate);
Línea 144... Línea 144...
144
                
144
                
-
 
145
                
-
 
146
 
-
 
147
                $data = [
145
                
148
                    'labels'             => [],
-
 
149
                    'users' => [
-
 
150
                       
146
 
151
                        'how_are_you_feel' => [],
147
                $data = [
152
                        'climate_on_your_organization' => [],
148
                   'how_are_you_feel' => [
153
                    ],
-
 
154
                    'points' => [
-
 
155
                        'how_are_you_feel' => [],
149
                       'average_points'     => 0,
156
                        'climate_on_your_organization' => [],
150
                       'average_users'      => 0,
157
                    ],
151
                       'labels'             => [],
158
                    'how_are_you_feel' => [
152
                       'dataset1'           => [],
159
                        'average_points'     => 0,
153
                       'dataset2'           => [],
160
                        'average_users'      => 0,
154
                    ],    
161
                    ],
155
                    'climate_on_your_organization' => [
-
 
156
                        'average_points'    => 0,
-
 
157
                        'average_users'     => 0,
-
 
158
                        'labels'            => [],
162
                    'climate_on_your_organization' => [
-
 
163
                        'average_points'    => 0,
-
 
164
                        'average_users'     => 0,
159
                        'dataset1'          => [],
165
                    ]
-
 
166
                     
Línea 160... Línea 167...
160
                        'dataset2'          => [],
167
                  
161
                    ]
168
                ];
Línea 175... Línea 182...
175
                do {
182
                do {
176
                    $count++;
183
                    $count++;
177
                    $date = $dt->format('Y-m-d');
184
                    $date = $dt->format('Y-m-d');
178
                    $label = $dt->format('d/m/Y');
185
                    $label = $dt->format('d/m/Y');
Línea -... Línea 186...
-
 
186
                    
-
 
187
                    array_push($data['labels'], $label); 
Línea 179... Línea 188...
179
                    
188
 
180
                    
189
                    
181
                    $dataset1 = 0;
190
                    $points = 0;
182
                    $dataset2 = 0;
191
                    $users = 0;
183
                    foreach($how_are_you_feel as $record)
192
                    foreach($how_are_you_feel as $record)
184
                    {
193
                    {
185
                        if($date == $record['date']) {
194
                        if($date == $record['date']) {
186
                            $dataset1 = $record['points'];
195
                            $points = $record['points'];
187
                            $dataset2 = $record['users'];
196
                            $users = $record['users'];
Línea 188... Línea -...
188
                        }
-
 
189
                    }
-
 
Línea 190... Línea -...
190
                    
-
 
191
                    $how_are_you_feel_points += $dataset1;
-
 
192
                    $how_are_you_feel_users += $dataset2;
-
 
193
                    
-
 
Línea -... Línea 197...
-
 
197
                        }
-
 
198
                    }
-
 
199
                    
-
 
200
                    
-
 
201
                    
-
 
202
                    array_push($data['points']['how_are_you_feel'], $points);
-
 
203
                    array_push($data['users']['how_are_you_feel'], $users);
194
                    array_push($data['how_are_you_feel']['labels'], $label); 
204
                    
195
                    array_push($data['how_are_you_feel']['dataset1'], $dataset1);
205
                    
196
                    array_push($data['how_are_you_feel']['dataset2'], $dataset2);
206
                    $how_are_you_feel_points += $points;
197
 
207
                    $how_are_you_feel_users += $users;
198
                    
208
 
199
                    $dataset1 = 0;
209
                    $points = 0;
200
                    $dataset2 = 0;
210
                    $users = 0;
201
                    foreach($climate_on_your_organization as $record)
211
                    foreach($climate_on_your_organization as $record)
202
                    {
212
                    {
Línea 203... Línea -...
203
                        if($date == $record['date']) {
-
 
204
                            $dataset1 = $record['points'];
-
 
Línea -... Línea 213...
-
 
213
                        if($date == $record['date']) {
-
 
214
                            $points = $record['points'];
Línea 205... Línea -...
205
                            $dataset2 = $record['users'];
-
 
206
                        }
-
 
207
                    }
-
 
Línea 208... Línea -...
208
                    
-
 
-
 
215
                            $users = $record['users'];
-
 
216
                        }
Línea 209... Línea 217...
209
                    $climate_on_your_organization_points += $dataset1;
217
                    }
Línea 238... Línea 246...
238
                
246
                
239
                
-
 
240
                
-
 
241
                
-
 
242
            } else {
247
                
243
            
248
                
244
                //$form = new BehaviorForm();
249
                
245
                
-
 
246
                $this->layout()->setTemplate('layout/layout-backend');
250
            } else {
247
                $viewModel = new ViewModel();
251
                $this->layout()->setTemplate('layout/layout-backend');
Línea 248... Línea 252...
248
                $viewModel->setTemplate('leaders-linked/daily-pulse-reports/overview.phtml');
252
                $viewModel = new ViewModel();
Línea 310... Línea 314...
310
            $climate_on_your_organization = $dailyPulseRecordMapper->fetchAllDataChartOrExcelByCompanyIdAndTypeAndDateRange($company->id, DailyPulseRecord::TYPE_CLIMATE_ON_YOUR_ORGANIZATION, $startDate, $endDate);
314
            $climate_on_your_organization = $dailyPulseRecordMapper->fetchAllDataChartOrExcelByCompanyIdAndTypeAndDateRange($company->id, DailyPulseRecord::TYPE_CLIMATE_ON_YOUR_ORGANIZATION, $startDate, $endDate);
Línea 311... Línea 315...
311
            
315
            
-
 
316
            
-
 
317
            
-
 
318
            $data = [
-
 
319
                'labels'             => [],
-
 
320
                'users' => [
-
 
321
                    
-
 
322
                    'how_are_you_feel' => [],
-
 
323
                    'climate_on_your_organization' => [],
-
 
324
                ],
-
 
325
                'points' => [
312
            
326
                    'how_are_you_feel' => [],
313
            
327
                    'climate_on_your_organization' => [],
314
            $data = [
328
                ],
315
                'how_are_you_feel' => [
-
 
316
                    'average_points'    => 0,
329
                'how_are_you_feel' => [
317
                    'average_users'     => 0,
330
                    'average_points'     => 0,
318
                    'items'             => [],
331
                    'average_users'      => 0,
319
                ],
332
                ],
320
                'climate_on_your_organization' => [
-
 
321
                    'average_points'    => 0,
333
                'climate_on_your_organization' => [
-
 
334
                    'average_points'    => 0,
-
 
335
                    'average_users'     => 0,
322
                    'average_users'     => 0,
336
                ]
Línea -... Línea 337...
-
 
337
                
323
                    'items'             => [],
338
                
324
                ]
339
            ];
Línea 325... Línea 340...
325
            ];
340
            
326
            
341
            
Línea 338... Línea 353...
338
            do {
353
            do {
339
                $count++;
354
                $count++;
340
                $date = $dt->format('Y-m-d');
355
                $date = $dt->format('Y-m-d');
341
                $label = $dt->format('d/m/Y');
356
                $label = $dt->format('d/m/Y');
Línea -... Línea 357...
-
 
357
                
-
 
358
                array_push($data['labels'], $label);
Línea 342... Línea 359...
342
                
359
 
343
                
360
                
344
                $dataset1 = 0;
361
                $points = 0;
345
                $dataset2 = 0;
362
                $users = 0;
346
                foreach($how_are_you_feel as $record)
363
                foreach($how_are_you_feel as $record)
347
                {
364
                {
348
                    if($date == $record['date']) {
365
                    if($date == $record['date']) {
349
                        $dataset1 = $record['points'];
366
                        $points = $record['points'];
350
                        $dataset2 = $record['users'];
367
                        $users = $record['users'];
Línea 351... Línea -...
351
                    }
-
 
352
                }
-
 
Línea 353... Línea -...
353
                
-
 
354
                $how_are_you_feel_points += $dataset1;
-
 
355
                $how_are_you_feel_users += $dataset2;
-
 
356
                
-
 
357
                array_push($data['how_are_you_feel']['items'], [
-
 
Línea -... Línea 368...
-
 
368
                    }
-
 
369
                }
Línea -... Línea 370...
-
 
370
                
-
 
371
                
-
 
372
                
-
 
373
                array_push($data['points']['how_are_you_feel'], $points);
358
                    'label' => $label, 
374
                array_push($data['users']['how_are_you_feel'], $users);
359
                    'dataset1' =>  $dataset1,
375
                
360
                    'dataset2' => $dataset2
376
                
361
                ]);
377
                $how_are_you_feel_points += $points;
362
                
378
                $how_are_you_feel_users += $users;
363
                
379
                
364
                $dataset1 = 0;
380
                $points = 0;
365
                $dataset2 = 0;
381
                $users = 0;
366
                foreach($climate_on_your_organization as $record)
382
                foreach($climate_on_your_organization as $record)
Línea 367... Línea -...
367
                {
-
 
368
                    if($date == $record['date']) {
-
 
Línea 369... Línea 383...
369
                        $dataset1 = $record['points'];
383
                {
370
                        $dataset2 = $record['users'];
384
                    if($date == $record['date']) {
-
 
385
                        $points = $record['points'];
-
 
386
                        $users = $record['users'];
371
                    }
387
                    }
372
                }
388
                }
373
                
-
 
Línea 374... Línea 389...
374
                $climate_on_your_organization_points += $dataset1;
389
                
Línea 412... Línea 427...
412
            $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Hasta:');
427
            $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Hasta:');
413
            $spreadsheet->getActiveSheet()->SetCellValue('D1', $dt->format('d/m/Y'));
428
            $spreadsheet->getActiveSheet()->SetCellValue('D1', $dt->format('d/m/Y'));
Línea 414... Línea 429...
414
            
429
            
-
 
430
            
415
            
431
            $spreadsheet->getActiveSheet()->SetCellValue('A3', 'Como te sientes hoy');
416
            $spreadsheet->getActiveSheet()->SetCellValue('A3', 'Como te sientes hoy');
432
            $spreadsheet->getActiveSheet()->setMergeCells(['A3', 'B3', 'C3', 'D3']);
417
            $spreadsheet->getActiveSheet()->SetCellValue('A4', 'Puntos promedios');
433
            $spreadsheet->getActiveSheet()->SetCellValue('A4', 'Puntos promedios');
418
            $spreadsheet->getActiveSheet()->SetCellValue('B4',  $data['how_are_you_feel']['average_points']);
434
            $spreadsheet->getActiveSheet()->SetCellValue('B4',  $data['how_are_you_feel']['average_points']);
Línea 419... Línea 435...
419
            $spreadsheet->getActiveSheet()->SetCellValue('C4', 'Usuarios promedios');
435
            $spreadsheet->getActiveSheet()->SetCellValue('C4', 'Usuarios promedios');
-
 
436
            $spreadsheet->getActiveSheet()->SetCellValue('D4',  $data['how_are_you_feel']['average_users']);
420
            $spreadsheet->getActiveSheet()->SetCellValue('D4',  $data['how_are_you_feel']['average_users']);
437
            
421
            
438
            
422
            
439
            $spreadsheet->getActiveSheet()->SetCellValue('F3', 'Clima en su organización');
423
            $spreadsheet->getActiveSheet()->SetCellValue('F3', 'Clima en su organización');
440
            $spreadsheet->getActiveSheet()->setMergeCells(['F3', 'G3', 'H3', 'I3']);
Línea 424... Línea -...
424
            $spreadsheet->getActiveSheet()->SetCellValue('F4', 'Puntos promedios');
-
 
425
            $spreadsheet->getActiveSheet()->SetCellValue('G4',  $data['climate_on_your_organization']['average_points']);
-
 
426
            $spreadsheet->getActiveSheet()->SetCellValue('H4', 'Usuarios promedios');
-
 
Línea -... Línea 441...
-
 
441
            $spreadsheet->getActiveSheet()->SetCellValue('F4', 'Puntos promedios');
-
 
442
            $spreadsheet->getActiveSheet()->SetCellValue('G4',  $data['climate_on_your_organization']['average_points']);
-
 
443
            $spreadsheet->getActiveSheet()->SetCellValue('H4', 'Usuarios promedios');
-
 
444
            $spreadsheet->getActiveSheet()->SetCellValue('I4',  $data['climate_on_your_organization']['average_users']);
-
 
445
            
-
 
446
            
427
            $spreadsheet->getActiveSheet()->SetCellValue('I4',  $data['climate_on_your_organization']['average_users']);
447
            $spreadsheet->getActiveSheet()->SetCellValue('A6', 'Usuarios');
428
            
448
            $spreadsheet->getActiveSheet()->setMergeCells(['A6', 'B6', 'C6']);
-
 
449
            $spreadsheet->getActiveSheet()->SetCellValue('A7', 'Fecha');
-
 
450
            $spreadsheet->getActiveSheet()->SetCellValue('B7', 'Puntos promedios');
429
            $spreadsheet->getActiveSheet()->SetCellValue('A6', 'Fecha');
451
            $spreadsheet->getActiveSheet()->SetCellValue('C7', 'Cantidad de usuarios');
430
            $spreadsheet->getActiveSheet()->SetCellValue('B6', 'Puntos promedios');
452
            
431
            $spreadsheet->getActiveSheet()->SetCellValue('C6', 'Cantidad de usuarios');
453
            $row = 8;
432
            
454
            $max = count($data['labels']);
433
            $i = 7;
-
 
434
            foreach($data['how_are_you_feel']['items'] as $record)
455
            
435
            {
456
            for($i = 0; $i< $max; $i++)
-
 
457
            {
-
 
458
                $spreadsheet->getActiveSheet()->SetCellValue('A' . $row, $data['labels'][$i]);
-
 
459
                $spreadsheet->getActiveSheet()->SetCellValue('B' . $row, $data['users']['how_are_you_feel'][$i]);
-
 
460
                $spreadsheet->getActiveSheet()->SetCellValue('C' . $row, $data['users']['climate_on_your_organization'][$i]);
-
 
461
                $row++;
-
 
462
            }
-
 
463
 
Línea -... Línea 464...
-
 
464
            
Línea 436... Línea 465...
436
                $spreadsheet->getActiveSheet()->SetCellValue('A' . $i, $record['label']);
465
            $spreadsheet->getActiveSheet()->SetCellValue('F6', 'Puntos');
437
                $spreadsheet->getActiveSheet()->SetCellValue('B' . $i, $record['dataset1']);
466
            $spreadsheet->getActiveSheet()->setMergeCells(['F6', 'G6', 'H6']);
438
                $spreadsheet->getActiveSheet()->SetCellValue('C' . $i, $record['dataset2']);
-
 
Línea 439... Línea 467...
439
                
467
            $spreadsheet->getActiveSheet()->SetCellValue('F7', 'Fecha');
440
                $i++;
-
 
441
            }
468
            $spreadsheet->getActiveSheet()->SetCellValue('G7', 'Puntos promedios');
442
            
469
            $spreadsheet->getActiveSheet()->SetCellValue('H7', 'Cantidad de usuarios');
443
            
470
            
444
            $spreadsheet->getActiveSheet()->SetCellValue('F6', 'Fecha');
471
 
445
            $spreadsheet->getActiveSheet()->SetCellValue('G6', 'Puntos promedios');
-
 
446
            $spreadsheet->getActiveSheet()->SetCellValue('H6', 'Cantidad de usuarios');
472
            
447
            
473
            $row = 8;
Línea 448... Línea 474...
448
            $i = 7;
474
            $max = count($data['labels']);
449
            foreach($data['climate_on_your_organization']['items'] as $record)
475