Selaa lähdekoodia

Filtro de fechas con y sin horas para excel

Nermosis 3 vuotta sitten
vanhempi
commit
9ed17e2203
1 muutettua tiedostoa jossa 9 lisäystä ja 5 poistoa
  1. 9 5
      application/controllers/ExportXls.php

+ 9 - 5
application/controllers/ExportXls.php Näytä tiedosto

315
         if ($fecha != "0000-00-00" && $fecha != "0000-00-00 00:00:00") {
315
         if ($fecha != "0000-00-00" && $fecha != "0000-00-00 00:00:00") {
316
             $fechaFormat = new DateTime($fecha);
316
             $fechaFormat = new DateTime($fecha);
317
             $fechaFinal = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($fechaFormat);
317
             $fechaFinal = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($fechaFormat);
318
-        } else {
319
-            $fechaFinal = "00/00/0000";
318
+        } else if ($fecha === "0000-00-00") {
319
+            //$fechaFinal = "00/00/0000";
320
+            $fechaFinal = "";
321
+        } else if ($fecha === "0000-00-00 00:00:00") {
322
+            //$fechaFinal = "00/00/0000 00:00";
323
+            $fechaFinal = "";
320
         }
324
         }
321
 
325
 
322
         return $fechaFinal;
326
         return $fechaFinal;
439
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
443
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
440
                 $sheet->SetCellValue('J' . $aux, $datos['smeawardedIndicator']);
444
                 $sheet->SetCellValue('J' . $aux, $datos['smeawardedIndicator']);
441
                 $sheet->SetCellValue('K' . $aux, $datos['contract_id']);
445
                 $sheet->SetCellValue('K' . $aux, $datos['contract_id']);
442
-                $sheet->SetCellValue('L' . $aux, $datos['contract_issueDate']);
443
                 $sheet->SetCellValue('L' . $aux, $this->formatFechas($datos['contract_issueDate']));
446
                 $sheet->SetCellValue('L' . $aux, $this->formatFechas($datos['contract_issueDate']));
444
                 $sheet->getStyle('L' . $aux)
447
                 $sheet->getStyle('L' . $aux)
445
                     ->getNumberFormat()
448
                     ->getNumberFormat()
446
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
449
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
447
                 $sheet->SetCellValue('M' . $aux, $datos['partyIdentification']);
450
                 $sheet->SetCellValue('M' . $aux, $datos['partyIdentification']);
448
                 $sheet->SetCellValue('N' . $aux, $datos['partyName']);
451
                 $sheet->SetCellValue('N' . $aux, $datos['partyName']);
449
-                $sheet->SetCellValue('O' . $aux, $datos['TaxExclusiveAmount']);
450
 
452
 
451
                 $aux++;
453
                 $aux++;
452
             }
454
             }
490
                     ->getNumberFormat()
492
                     ->getNumberFormat()
491
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
493
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
492
                 $sheet->SetCellValue('O' . $aux, $datos['documentAvailablePeriod_EndTime']);
494
                 $sheet->SetCellValue('O' . $aux, $datos['documentAvailablePeriod_EndTime']);
495
+                $sheet->getStyle('O' . $aux)
496
+                    ->getNumberFormat()
497
+                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
493
 
498
 
494
                 $aux++;
499
                 $aux++;
495
             }
500
             }
821
         $spreadsheet->getActiveSheet()->SetCellValue('L1', 'Fecha de formalización');
826
         $spreadsheet->getActiveSheet()->SetCellValue('L1', 'Fecha de formalización');
822
         $spreadsheet->getActiveSheet()->SetCellValue('M1', 'Adjudicatario CIF');
827
         $spreadsheet->getActiveSheet()->SetCellValue('M1', 'Adjudicatario CIF');
823
         $spreadsheet->getActiveSheet()->SetCellValue('N1', 'Nombre Adjudicatario');
828
         $spreadsheet->getActiveSheet()->SetCellValue('N1', 'Nombre Adjudicatario');
824
-        $spreadsheet->getActiveSheet()->SetCellValue('O1', 'Importe de adjudicación sin impuestos');
825
 
829
 
826
         return $spreadsheet;
830
         return $spreadsheet;
827
     }
831
     }