浏览代码

traducir codigos a strings. Formatos de fechas y monedas

Nermosis 3 年前
父节点
当前提交
e8662746b6
共有 2 个文件被更改,包括 137 次插入259 次删除
  1. 115 106
      application/controllers/ExportXls.php
  2. 22 153
      application/models/Xlsexport_model.php

+ 115 - 106
application/controllers/ExportXls.php 查看文件

201
         $result['generalDocs'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_general_documents");
201
         $result['generalDocs'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_general_documents");
202
 
202
 
203
         guardar_log("Excel", "Consulta tender process");
203
         guardar_log("Excel", "Consulta tender process");
204
-        $result['tenderProcess'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_process");
204
+        $result['tenderProcess'] = $this->Xlsexport_model->getTenderingTermsCodes();
205
 
205
 
206
         guardar_log("Excel", "Consulta tender terms");
206
         guardar_log("Excel", "Consulta tender terms");
207
-        $result['tenderingTerms'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms");
207
+        $result['tenderingTerms'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("maestro_tendering_terms", "relacionada_codigo_tipo_garantia", "code", "guaranteeTypeCode");
208
 
208
 
209
         guardar_log("Excel", "Consulta tender result");
209
         guardar_log("Excel", "Consulta tender result");
210
-        $result['tenderResult'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tender_result");
210
+        $result['tenderResult'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("maestro_tender_result", "relacionada_tender_result", "code", "resultCode");
211
 
211
 
212
         guardar_log("Excel", "Consulta tender criterio financieros");
212
         guardar_log("Excel", "Consulta tender criterio financieros");
213
         $result['tenderFinancial'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms_financial_evaluation");
213
         $result['tenderFinancial'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms_financial_evaluation");
312
     {
312
     {
313
         $fechaFinal = "";
313
         $fechaFinal = "";
314
 
314
 
315
-        if ($fecha != "0000-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
         }
320
         }
319
 
321
 
320
         return $fechaFinal;
322
         return $fechaFinal;
362
 
364
 
363
     private function datosCompletosMediosPublicacion($spreadsheet, $datos)
365
     private function datosCompletosMediosPublicacion($spreadsheet, $datos)
364
     {
366
     {
365
-        $spreadsheet->setActiveSheetIndex(2);
366
-        $spreadsheet->getActiveSheet()->setTitle("Medios de publicación");
367
+        $sheet = $spreadsheet->getSheet(2);
368
+        $sheet->setTitle("Medios de publicación");
367
 
369
 
368
         if ($datos['num_rows'] > 0) {
370
         if ($datos['num_rows'] > 0) {
369
             $contador = 0;
371
             $contador = 0;
371
             foreach ($datos['datos'] as $datos) {
373
             foreach ($datos['datos'] as $datos) {
372
                 guardar_log("Excel", "Escribir datos medio publicacion--" . $contador);
374
                 guardar_log("Excel", "Escribir datos medio publicacion--" . $contador);
373
                 $contador++;
375
                 $contador++;
374
-                $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
375
-                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['noticeTypeCode']);
376
-                $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['publicationMediaName']);
376
+                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
377
+                $sheet->SetCellValue('B' . $aux, $datos['noticeTypeCode']);
378
+                $sheet->SetCellValue('C' . $aux, $datos['publicationMediaName']);
377
                 $aux++;
379
                 $aux++;
378
             }
380
             }
379
         }
381
         }
383
 
385
 
384
     private function datosMedioPublicacion($spreadsheet, $datos)
386
     private function datosMedioPublicacion($spreadsheet, $datos)
385
     {
387
     {
386
-        $spreadsheet->setActiveSheetIndex(3);
387
-        $spreadsheet->getActiveSheet()->setTitle("Documentos Medios Comm");
388
+        $sheet = $spreadsheet->getSheet(3);
389
+        $sheet->setTitle("Documentos Medios Comm");
388
 
390
 
389
         if ($datos['num_rows'] > 0) {
391
         if ($datos['num_rows'] > 0) {
390
             $aux = 2;
392
             $aux = 2;
392
             foreach ($datos['datos'] as $row) {
394
             foreach ($datos['datos'] as $row) {
393
                 guardar_log("Excel", "Escribir documentios medios comunicacion--" . $contador);
395
                 guardar_log("Excel", "Escribir documentios medios comunicacion--" . $contador);
394
                 $contador++;
396
                 $contador++;
395
-                $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $row['id_ajena_licitacion']);
396
-                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $row['documento']);
397
-                $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $row['filename']);
397
+                $sheet->SetCellValue('A' . $aux, $row['id_ajena_licitacion']);
398
+                $sheet->SetCellValue('B' . $aux, $row['documento']);
399
+                $sheet->SetCellValue('C' . $aux, $row['filename']);
398
 
400
 
399
                 $aux++;
401
                 $aux++;
400
             }
402
             }
404
 
406
 
405
     private function datosCompletosResultadoDelProcedimiento($spreadsheet, $datos)
407
     private function datosCompletosResultadoDelProcedimiento($spreadsheet, $datos)
406
     {
408
     {
407
-        $spreadsheet->setActiveSheetIndex(4);
408
-        $spreadsheet->getActiveSheet()->setTitle("Resultado del Procedimiento");
409
+        $sheet = $spreadsheet->getSheet(4);
410
+        $sheet->setTitle("Resultado del Procedimiento");
409
 
411
 
410
         if ($datos['num_rows'] > 0) {
412
         if ($datos['num_rows'] > 0) {
411
             $aux = 2;
413
             $aux = 2;
413
             foreach ($datos['datos'] as $datos) {
415
             foreach ($datos['datos'] as $datos) {
414
                 guardar_log("Excel", "Escribir tender result--" . $contador);
416
                 guardar_log("Excel", "Escribir tender result--" . $contador);
415
                 $contador++;
417
                 $contador++;
416
-                $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
417
-                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['resultCode']);
418
-                $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
419
-                $spreadsheet->getActiveSheet()->SetCellValue('D' . $aux, $this->formatFechas($datos['awardDate']));
420
-                $spreadsheet->getStyle('D' . $aux)
418
+                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
419
+                $sheet->SetCellValue('B' . $aux, $datos['code_desc']);
420
+                $sheet->SetCellValue('C' . $aux, $datos['description']);
421
+                $sheet->SetCellValue('D' . $aux, $this->formatFechas($datos['awardDate']));
422
+                $sheet->getStyle('D' . $aux)
421
                     ->getNumberFormat()
423
                     ->getNumberFormat()
422
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
424
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
423
-                $spreadsheet->getActiveSheet()->SetCellValue('E' . $aux, $datos['receivedTenderQuantity']);
424
-                $spreadsheet->getActiveSheet()->SetCellValue('F' . $aux, $datos['lowerTenderAmount']);
425
-                $spreadsheet->getActiveSheet()->SetCellValue('G' . $aux, $datos['higherTenderAmount']);
426
-                $spreadsheet->getActiveSheet()->SetCellValue('H' . $aux, $datos['abnormallyLowTendersIndicator']);
427
-                $spreadsheet->getActiveSheet()->SetCellValue('I' . $aux, $this->formatFechas($datos['startDate']));
428
-                $spreadsheet->getStyle('I' . $aux)
425
+                $sheet->SetCellValue('E' . $aux, $datos['receivedTenderQuantity']);
426
+                $sheet->SetCellValue('F' . $aux, $datos['lowerTenderAmount']);
427
+                $sheet->getStyle('F' . $aux)
429
                     ->getNumberFormat()
428
                     ->getNumberFormat()
430
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
431
-                $spreadsheet->getActiveSheet()->SetCellValue('J' . $aux, $datos['smeawardedIndicator']);
432
-                $spreadsheet->getActiveSheet()->SetCellValue('K' . $aux, $datos['contract_id']);
433
-                $spreadsheet->getActiveSheet()->SetCellValue('L' . $aux, $this->formatFechas($datos['contract_issueDate']));
434
-                $spreadsheet->getStyle('L' . $aux)
429
+                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
430
+                $sheet->SetCellValue('G' . $aux, $datos['higherTenderAmount']);
431
+                $sheet->getStyle('G' . $aux)
435
                     ->getNumberFormat()
432
                     ->getNumberFormat()
436
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
437
-                $spreadsheet->getActiveSheet()->SetCellValue('M' . $aux, $datos['partyIdentification']);
438
-                $spreadsheet->getActiveSheet()->SetCellValue('N' . $aux, $datos['partyName']);
439
-                $spreadsheet->getActiveSheet()->SetCellValue('O' . $aux, $datos['TaxExclusiveAmount']);
433
+                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
434
+                $sheet->SetCellValue('H' . $aux, $datos['abnormallyLowTendersIndicator']);
435
+                //$sheet->SetCellValue('I' . $aux, $datos['startDate']);
436
+                $sheet->SetCellValue('I' . $aux, $this->formatFechas($datos['startDate']));
437
+                $sheet->getStyle('I' . $aux)
438
+                    ->getNumberFormat()
439
+                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
440
+                $sheet->SetCellValue('J' . $aux, $datos['smeawardedIndicator']);
441
+                $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']));
444
+                $sheet->getStyle('L' . $aux)
445
+                    ->getNumberFormat()
446
+                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
447
+                $sheet->SetCellValue('M' . $aux, $datos['partyIdentification']);
448
+                $sheet->SetCellValue('N' . $aux, $datos['partyName']);
449
+                $sheet->SetCellValue('O' . $aux, $datos['TaxExclusiveAmount']);
440
 
450
 
441
                 $aux++;
451
                 $aux++;
442
             }
452
             }
446
 
456
 
447
     private function datosCompletosTipoProcedimiento($spreadsheet, $datos)
457
     private function datosCompletosTipoProcedimiento($spreadsheet, $datos)
448
     {
458
     {
449
-        $spreadsheet->setActiveSheetIndex(5);
450
-        $spreadsheet->getActiveSheet()->setTitle("Tipo Procedimiento");
459
+        $sheet = $spreadsheet->getSheet(5);
460
+        $sheet->setTitle("Tipo Procedimiento");
451
 
461
 
452
         //$datos = $this->Xlsexport_model->getTenderProcessRelacion();
462
         //$datos = $this->Xlsexport_model->getTenderProcessRelacion();
453
         if ($datos['num_rows'] > 0) {
463
         if ($datos['num_rows'] > 0) {
456
             foreach ($datos['datos'] as $datos) {
466
             foreach ($datos['datos'] as $datos) {
457
                 guardar_log("Excel", "Escribir tender process--" . $contador);
467
                 guardar_log("Excel", "Escribir tender process--" . $contador);
458
                 $contador++;
468
                 $contador++;
459
-                $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
460
-                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['procedureCode']);
461
-                $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['urgencyCode']);
462
-                $spreadsheet->getActiveSheet()->SetCellValue('D' . $aux, $datos['contractingSystemCode']);
463
-                $spreadsheet->getActiveSheet()->SetCellValue('E' . $aux, $datos['partPresentationCode']);
464
-                $spreadsheet->getActiveSheet()->SetCellValue('F' . $aux, $datos['submissionMethodCode']);
465
-                $spreadsheet->getActiveSheet()->SetCellValue('G' . $aux, $datos['maximumLotPresentationQuantity']);
466
-                $spreadsheet->getActiveSheet()->SetCellValue('H' . $aux, $datos['maximumTendererAwardedLotsQuantity']);
467
-                $spreadsheet->getActiveSheet()->SetCellValue('I' . $aux, $datos['lotsCombinationContractingAuthorityRights']);
468
-                $spreadsheet->getActiveSheet()->SetCellValue('J' . $aux, $this->formatFechas($datos['deadLineEndDate']));
469
-                $spreadsheet->getStyle('J' . $aux)
469
+                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
470
+                $sheet->SetCellValue('B' . $aux, $datos['tipoTender']);
471
+                $sheet->SetCellValue('C' . $aux, $datos['urgency']);
472
+                $sheet->SetCellValue('D' . $aux, $datos['contrato_sistema']);
473
+                $sheet->SetCellValue('E' . $aux, $datos['partPresentationCode']);
474
+                $sheet->SetCellValue('F' . $aux, $datos['submision']);
475
+                $sheet->SetCellValue('G' . $aux, $datos['maximumLotPresentationQuantity']);
476
+                $sheet->SetCellValue('H' . $aux, $datos['maximumTendererAwardedLotsQuantity']);
477
+                $sheet->SetCellValue('I' . $aux, $datos['lotsCombinationContractingAuthorityRights']);
478
+                $sheet->SetCellValue('J' . $aux, $this->formatFechas($datos['deadLineEndDate']));
479
+                $sheet->getStyle('J' . $aux)
470
                     ->getNumberFormat()
480
                     ->getNumberFormat()
471
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
481
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
472
-                $spreadsheet->getActiveSheet()->SetCellValue('K' . $aux, $this->formatFechas($datos['deadLineEndTime']));
473
-                $spreadsheet->getStyle('K' . $aux)
482
+                $sheet->SetCellValue('K' . $aux, $this->formatFechas($datos['deadLineEndTime']));
483
+                $sheet->getStyle('K' . $aux)
474
                     ->getNumberFormat()
484
                     ->getNumberFormat()
475
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
485
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
476
-                $spreadsheet->getActiveSheet()->SetCellValue('L' . $aux, $datos['deadLineDescription']);
477
-                $spreadsheet->getActiveSheet()->SetCellValue('M' . $aux, $datos['auctionTerms']);
478
-                $spreadsheet->getActiveSheet()->SetCellValue('N' . $aux, $this->formatFechas($datos['documentAvailablePeriod_EndDate']));
479
-                $spreadsheet->getStyle('N' . $aux)
486
+                $sheet->SetCellValue('L' . $aux, $datos['deadLineDescription']);
487
+                $sheet->SetCellValue('M' . $aux, $datos['auctionTerms']);
488
+                $sheet->SetCellValue('N' . $aux, $this->formatFechas($datos['documentAvailablePeriod_EndDate']));
489
+                $sheet->getStyle('N' . $aux)
480
                     ->getNumberFormat()
490
                     ->getNumberFormat()
481
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
491
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
482
-                $spreadsheet->getActiveSheet()->SetCellValue('O' . $aux, $datos['documentAvailablePeriod_EndTime']);
492
+                $sheet->SetCellValue('O' . $aux, $datos['documentAvailablePeriod_EndTime']);
483
 
493
 
484
                 $aux++;
494
                 $aux++;
485
             }
495
             }
490
 
500
 
491
     private function datosCompletosOfertas($spreadsheet, $datos)
501
     private function datosCompletosOfertas($spreadsheet, $datos)
492
     {
502
     {
493
-        $spreadsheet->setActiveSheetIndex(6);
494
-        $spreadsheet->getActiveSheet()->setTitle("Ofertas");
503
+        $sheet = $spreadsheet->getSheet(6);
504
+        $sheet->setTitle("Ofertas");
495
 
505
 
496
         if ($datos['num_rows'] > 0) {
506
         if ($datos['num_rows'] > 0) {
497
             $aux = 2;
507
             $aux = 2;
499
             foreach ($datos['datos'] as $datos) {
509
             foreach ($datos['datos'] as $datos) {
500
                 guardar_log("Excel", "Escribir tender process--" . $contador);
510
                 guardar_log("Excel", "Escribir tender process--" . $contador);
501
                 $contador++;
511
                 $contador++;
502
-                $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
503
-                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['variantConstraintIndicator']);
504
-                $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['guaranteeTypeCode']);
505
-                $spreadsheet->getActiveSheet()->SetCellValue('D' . $aux, $datos['requiredFinancialGuarantee_Amount']);
506
-                $spreadsheet->getActiveSheet()->SetCellValue('E' . $aux, $datos['allowedSubcontractTerms']);
507
-                $spreadsheet->getActiveSheet()->SetCellValue('F' . $aux, $datos['description']);
508
-                $spreadsheet->getActiveSheet()->SetCellValue('G' . $aux, $datos['personalSituation']);
509
-                $spreadsheet->getActiveSheet()->SetCellValue('H' . $aux, $datos['procurementLegislationDocumentReference']);
512
+                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
513
+                $sheet->SetCellValue('B' . $aux, $datos['variantConstraintIndicator']);
514
+                $sheet->SetCellValue('C' . $aux, $datos['code_desc']);
515
+                $sheet->SetCellValue('D' . $aux, $datos['requiredFinancialGuarantee_Amount']);
516
+                $sheet->SetCellValue('E' . $aux, $datos['allowedSubcontractTerms']);
517
+                $sheet->SetCellValue('F' . $aux, $datos['description']);
518
+                $sheet->SetCellValue('G' . $aux, $datos['personalSituation']);
519
+                $sheet->SetCellValue('H' . $aux, $datos['procurementLegislationDocumentReference']);
510
                 $aux++;
520
                 $aux++;
511
             }
521
             }
512
         }
522
         }
516
 
526
 
517
     private function datosCriterioAdjudicacion($spreadsheet, $datos)
527
     private function datosCriterioAdjudicacion($spreadsheet, $datos)
518
     {
528
     {
519
-        $spreadsheet->setActiveSheetIndex(7);
520
-        $spreadsheet->getActiveSheet()->setTitle("Criterio Adjudicación");
529
+        $sheet = $spreadsheet->getSheet(7);
530
+        $sheet->setTitle("Criterio Adjudicación");
521
 
531
 
522
         if ($datos['num_rows'] > 0) {
532
         if ($datos['num_rows'] > 0) {
523
             $aux = 2;
533
             $aux = 2;
525
             foreach ($datos['datos'] as $datos) {
535
             foreach ($datos['datos'] as $datos) {
526
                 guardar_log("Excel", "Escribir criterio adjucicacion--" . $contador);
536
                 guardar_log("Excel", "Escribir criterio adjucicacion--" . $contador);
527
                 $contador++;
537
                 $contador++;
528
-                $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
529
-                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
530
-                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['description']);
538
+                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
539
+                $sheet->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
540
+                $sheet->SetCellValue('B' . $aux, $datos['description']);
531
                 $aux++;
541
                 $aux++;
532
             }
542
             }
533
         }
543
         }
537
 
547
 
538
     private function datosCriterioEvaluacionFinanciera($spreadsheet, $datos)
548
     private function datosCriterioEvaluacionFinanciera($spreadsheet, $datos)
539
     {
549
     {
540
-        $spreadsheet->setActiveSheetIndex(8);
541
-        $spreadsheet->getActiveSheet()->setTitle("CriteriosEvaluacionFinanciera");
550
+        $sheet = $spreadsheet->getSheet(8);
551
+        $sheet->setTitle("CriteriosEvaluacionFinanciera");
542
 
552
 
543
         if ($datos['num_rows'] > 0) {
553
         if ($datos['num_rows'] > 0) {
544
             $aux = 2;
554
             $aux = 2;
546
             foreach ($datos['datos'] as $datos) {
556
             foreach ($datos['datos'] as $datos) {
547
                 guardar_log("Excel", "Escribir criterios evaluacion financiera--" . $contador);
557
                 guardar_log("Excel", "Escribir criterios evaluacion financiera--" . $contador);
548
                 $contador++;
558
                 $contador++;
549
-                $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
550
-                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
551
-                $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
559
+                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
560
+                $sheet->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
561
+                $sheet->SetCellValue('C' . $aux, $datos['description']);
552
                 $aux++;
562
                 $aux++;
553
             }
563
             }
554
         }
564
         }
557
 
567
 
558
     private function datosCriterioEvaluacionTecnica($spreadsheet, $datos)
568
     private function datosCriterioEvaluacionTecnica($spreadsheet, $datos)
559
     {
569
     {
560
-        $spreadsheet->setActiveSheetIndex(9);
561
-        $spreadsheet->getActiveSheet()->setTitle("Criterios Evaluación Técnica");
570
+        $sheet = $spreadsheet->getSheet(9);
571
+        $sheet->setTitle("Criterios Evaluación Técnica");
562
 
572
 
563
         if ($datos['num_rows'] > 0) {
573
         if ($datos['num_rows'] > 0) {
564
             $aux = 2;
574
             $aux = 2;
566
             foreach ($datos['datos'] as $datos) {
576
             foreach ($datos['datos'] as $datos) {
567
                 guardar_log("Excel", "Escribir criterio evaluacion tecnica--" . $contador);
577
                 guardar_log("Excel", "Escribir criterio evaluacion tecnica--" . $contador);
568
                 $contador++;
578
                 $contador++;
569
-                $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
570
-                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
571
-                $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
579
+                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
580
+                $sheet->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
581
+                $sheet->SetCellValue('C' . $aux, $datos['description']);
572
                 $aux++;
582
                 $aux++;
573
             }
583
             }
574
         }
584
         }
578
 
588
 
579
     private function datosRequisitosParticipacion($spreadsheet, $datos)
589
     private function datosRequisitosParticipacion($spreadsheet, $datos)
580
     {
590
     {
581
-        $spreadsheet->setActiveSheetIndex(10);
582
-        $spreadsheet->getActiveSheet()->setTitle("Requisitos Participación");
591
+        $sheet = $spreadsheet->getSheet(10);
592
+        $sheet->setTitle("Requisitos Participación");
583
 
593
 
584
         if ($datos['num_rows'] > 0) {
594
         if ($datos['num_rows'] > 0) {
585
             $aux = 2;
595
             $aux = 2;
587
             foreach ($datos['datos'] as $datos) {
597
             foreach ($datos['datos'] as $datos) {
588
                 guardar_log("Excel", "Escribir requisitos participacion--" . $contador);
598
                 guardar_log("Excel", "Escribir requisitos participacion--" . $contador);
589
                 $contador++;
599
                 $contador++;
590
-                $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
591
-                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
600
+                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
601
+                $sheet->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
592
                 $aux++;
602
                 $aux++;
593
             }
603
             }
594
 
604
 
598
 
608
 
599
     private function datosCompletosDocumentosGenerales($spreadsheet, $datosLicitacion)
609
     private function datosCompletosDocumentosGenerales($spreadsheet, $datosLicitacion)
600
     {
610
     {
601
-
602
-        $spreadsheet->setActiveSheetIndex(11);
603
-        $spreadsheet->getActiveSheet()->setTitle("Documentos Generales");
611
+        $sheet = $spreadsheet->getSheet(11);
612
+        $sheet->setTitle("Documentos Generales");
604
         $contador = 0;
613
         $contador = 0;
605
         foreach ($datosLicitacion['datos'] as $doc) {
614
         foreach ($datosLicitacion['datos'] as $doc) {
606
             guardar_log("Excel", "Escribir documentos generales--" . $contador);
615
             guardar_log("Excel", "Escribir documentos generales--" . $contador);
607
             $contador++;
616
             $contador++;
608
-            $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoGeneral, $doc['id_ajena_licitacion']);
609
-            $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoGeneral, $doc['attachment']);
610
-            $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoGeneral, $doc['fileName']);
617
+            $sheet->SetCellValue('A' . $this->filaDocumentoGeneral, $doc['id_ajena_licitacion']);
618
+            $sheet->SetCellValue('B' . $this->filaDocumentoGeneral, $doc['attachment']);
619
+            $sheet->SetCellValue('C' . $this->filaDocumentoGeneral, $doc['fileName']);
611
 
620
 
612
             $this->filaDocumentoGeneral++;
621
             $this->filaDocumentoGeneral++;
613
         }
622
         }
617
 
626
 
618
     private function datosCompletosDocumentosAdicionales($spreadsheet, $datosLicitacion)
627
     private function datosCompletosDocumentosAdicionales($spreadsheet, $datosLicitacion)
619
     {
628
     {
620
-        $spreadsheet->setActiveSheetIndex(12);
621
-        $spreadsheet->getActiveSheet()->setTitle("Documentos Adicionales");
629
+        $sheet = $spreadsheet->getSheet(12);
630
+        $sheet->setTitle("Documentos Adicionales");
622
         $contador = 0;
631
         $contador = 0;
623
         foreach ($datosLicitacion['datos'] as $doc) {
632
         foreach ($datosLicitacion['datos'] as $doc) {
624
             guardar_log("Excel", "Escribir documentos adicionales--" . $contador);
633
             guardar_log("Excel", "Escribir documentos adicionales--" . $contador);
625
             $contador++;
634
             $contador++;
626
-            $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoAdd, $doc['id_ajena_licitacion']);
627
-            $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoAdd, $doc['attachment']);
628
-            $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoAdd, $doc['idDoc']);
635
+            $sheet->SetCellValue('A' . $this->filaDocumentoAdd, $doc['id_ajena_licitacion']);
636
+            $sheet->SetCellValue('B' . $this->filaDocumentoAdd, $doc['attachment']);
637
+            $sheet->SetCellValue('C' . $this->filaDocumentoAdd, $doc['idDoc']);
629
 
638
 
630
             $this->filaDocumentoAdd++;
639
             $this->filaDocumentoAdd++;
631
         }
640
         }
634
 
643
 
635
     private function datosCompletosDocumentosTecnicos($spreadsheet, $datosLicitacion)
644
     private function datosCompletosDocumentosTecnicos($spreadsheet, $datosLicitacion)
636
     {
645
     {
637
-        $spreadsheet->setActiveSheetIndex(13);
638
-        $spreadsheet->getActiveSheet()->setTitle("Documentos Técnicos");
646
+        $sheet = $spreadsheet->getSheet(13);
647
+        $sheet->setTitle("Documentos Técnicos");
639
         $contador = 0;
648
         $contador = 0;
640
         foreach ($datosLicitacion['datos'] as $doc) {
649
         foreach ($datosLicitacion['datos'] as $doc) {
641
             guardar_log("Excel", "Escribir documentos tecnicos--" . $contador);
650
             guardar_log("Excel", "Escribir documentos tecnicos--" . $contador);
642
             $contador++;
651
             $contador++;
643
-            $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoTech, $doc['id_ajena_licitacion']);
644
-            $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoTech, $doc['attachment']);
645
-            $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoTech, $doc['idDoc']);
652
+            $sheet->SetCellValue('A' . $this->filaDocumentoTech, $doc['id_ajena_licitacion']);
653
+            $sheet->SetCellValue('B' . $this->filaDocumentoTech, $doc['attachment']);
654
+            $sheet->SetCellValue('C' . $this->filaDocumentoTech, $doc['idDoc']);
646
 
655
 
647
             $this->filaDocumentoTech++;
656
             $this->filaDocumentoTech++;
648
         }
657
         }
651
 
660
 
652
     private function datosCompletosDocumentosLegales($spreadsheet, $datosLicitacion)
661
     private function datosCompletosDocumentosLegales($spreadsheet, $datosLicitacion)
653
     {
662
     {
654
-        $spreadsheet->setActiveSheetIndex(14);
655
-        $spreadsheet->getActiveSheet()->setTitle("Documentos Legales");
663
+        $sheet = $spreadsheet->getSheet(14);
664
+        $sheet->setTitle("Documentos Legales");
656
         $contador = 0;
665
         $contador = 0;
657
         foreach ($datosLicitacion['datos'] as $doc) {
666
         foreach ($datosLicitacion['datos'] as $doc) {
658
             guardar_log("Excel", "Escribir documentos legales--" . $contador);
667
             guardar_log("Excel", "Escribir documentos legales--" . $contador);
659
             $contador++;
668
             $contador++;
660
-            $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoLegal, $doc['id_ajena_licitacion']);
661
-            $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoLegal, $doc['attachment']);
662
-            $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoLegal, $doc['idDoc']);
669
+            $sheet->SetCellValue('A' . $this->filaDocumentoLegal, $doc['id_ajena_licitacion']);
670
+            $sheet->SetCellValue('B' . $this->filaDocumentoLegal, $doc['attachment']);
671
+            $sheet->SetCellValue('C' . $this->filaDocumentoLegal, $doc['idDoc']);
663
 
672
 
664
             $this->filaDocumentoLegal++;
673
             $this->filaDocumentoLegal++;
665
         }
674
         }

+ 22 - 153
application/models/Xlsexport_model.php 查看文件

19
 class Xlsexport_model extends CI_Model
19
 class Xlsexport_model extends CI_Model
20
 {
20
 {
21
 
21
 
22
-    // ------------------------------------------------------------------------
22
+    protected $fechaLog = "2022-02-25 08:08:51";
23
 
23
 
24
     public function __construct()
24
     public function __construct()
25
     {
25
     {
115
     public function getTablaByFechaLog($tabla)
115
     public function getTablaByFechaLog($tabla)
116
     {
116
     {
117
         $sql = "SELECT * FROM $tabla
117
         $sql = "SELECT * FROM $tabla
118
-                WHERE fecha_creacion_log = '2022-02-24 14:38:36'";
118
+                WHERE fecha_creacion_log = '$this->fechaLog'";
119
         $result = $this->db->query($sql);
119
         $result = $this->db->query($sql);
120
         $datos['datos'] = $result->result_array();
120
         $datos['datos'] = $result->result_array();
121
         $datos['num_rows'] = $result->num_rows();
121
         $datos['num_rows'] = $result->num_rows();
138
                     maestro_procurement_project_lot MP
138
                     maestro_procurement_project_lot MP
139
                     JOIN maestro_procurement_project_lot_item MPI ON MP.id_compuesta = MPI.id_compuesta_padre
139
                     JOIN maestro_procurement_project_lot_item MPI ON MP.id_compuesta = MPI.id_compuesta_padre
140
                 WHERE
140
                 WHERE
141
-                    MPI.fecha_creacion_log = '2022-02-24 14:38:36'
141
+                    MPI.fecha_creacion_log = '$this->fechaLog'
142
                     GROUP BY
142
                     GROUP BY
143
                     MP.id_compuesta";
143
                     MP.id_compuesta";
144
         $result = $this->db->query($sql);
144
         $result = $this->db->query($sql);
158
         return $datos;
158
         return $datos;
159
     }
159
     }
160
 
160
 
161
-    public function getDatosByTablaAndLicitacion($tabla, $licitacionID)
162
-    {
163
-        $sql = "SELECT *
164
-                FROM
165
-                    $tabla
166
-                WHERE id_ajena_licitacion = $licitacionID";
167
-        $result = $this->db->query($sql);
168
-        $datos['datos'] = $result->result_array();
169
-        $datos['num_rows'] = $result->num_rows();
170
-        return $datos['datos'];
171
-    }
172
-    public function getTablaWithoutLicitacion($tabla)
161
+    public function getTenderingTermsCodes()
173
     {
162
     {
174
         $sql = "SELECT
163
         $sql = "SELECT
175
-                    *
164
+                    TP.*,
165
+                    RTP.nombre AS tipoTender, /*procedureCode*/
166
+                    RTPC.nombre AS contrato_sistema, /*urgencyCode*/
167
+                    RTPS.nombre AS submision, /*contractingSistemCode*/
168
+                    RTPU.nombre AS urgency /*urgencyCode*/
176
                 FROM
169
                 FROM
177
-                    $tabla t1";
178
-        $result = $this->db->query($sql);
179
-        $datos['datos'] = $result->result_array();
180
-        $datos['num_rows'] = $result->num_rows();
181
-        return $datos;
182
-    }
170
+                maestro_tendering_process TP
171
+                JOIN relacionada_tender_process RTP ON RTP.CODE = TP.procedureCode
172
+                JOIN relacionada_tender_process_contracting_code RTPC ON RTPC.CODE = TP.contractingSystemCode
173
+                JOIN relacionada_tender_process_submission RTPS ON RTPS.CODE = TP.submissionMethodCode
174
+                JOIN relacionada_tender_process_urgency_code RTPU ON RTPU.CODE = TP.urgencyCode
183
 
175
 
184
-    public function getDatosRelacionadosByTablaAndLicitacion($tabla, $tablaAjena, $idRelacionada, $idAjenaLicitacion)
185
-    {
186
-        $sql = "SELECT
187
-                    *
188
-                FROM
189
-                    $tabla
190
-                JOIN $tablaAjena TBAJ ON TBAJ.code = " . $tabla . "." . $idRelacionada . "
191
-                WHERE id_ajena_licitacion = $idAjenaLicitacion";
176
+                WHERE
177
+                    TP.fecha_creacion_log = '$this->fechaLog'";
192
         $result = $this->db->query($sql);
178
         $result = $this->db->query($sql);
193
         $datos['datos'] = $result->result_array();
179
         $datos['datos'] = $result->result_array();
194
         $datos['num_rows'] = $result->num_rows();
180
         $datos['num_rows'] = $result->num_rows();
195
-        return $datos['datos'];
181
+        return $datos;
196
     }
182
     }
197
 
183
 
198
-    public function getDatosRelacionadasTablaWithoutLicitacion($tablaRelacion, $tabla, $txtIdAjena, $id = "t1.id")
184
+    public function getDatosRelacionadasTablaWithoutLicitacion($tabla, $tablaRelacion, $txtIdAjena, $id = "t1.id")
199
     {
185
     {
200
         $sql = "SELECT
186
         $sql = "SELECT
201
-                    *
187
+                    *,
188
+                    t2.nombre as code_desc
202
                 FROM
189
                 FROM
203
                     $tabla t1
190
                     $tabla t1
204
                 JOIN
191
                 JOIN
205
-                    $tablaRelacion t2 ON t2." . $txtIdAjena . " = t1.id";
206
-        $result = $this->db->query($sql);
207
-        $datos['datos'] = $result->result_array();
208
-        $datos['num_rows'] = $result->num_rows();
209
-        return $datos;
210
-    }
211
-
212
-    public function getTenderProcessRelacion()
213
-    {
214
-        $sql = "SELECT
215
-                    t2.nombre as procedureCode, t3.nombre as contractingSystemCode, t4.nombre as submissionMethodCode, t5.nombre as urgencyCode,
216
-                    t1.id_ajena_licitacion, t1.partPresentationCode, t1.maximumLotPresentationQuantity, t1.maximumTendererAwardedLotsQuantity, t1.lotsCombinationContractingAuthorityRights,
217
-                    t1.deadLineEndDate, t1.deadLineEndTime, t1.deadLineDescription, t1.auctionTerms, t1.documentAvailablePeriod_EndDate, t1.documentAvailablePeriod_EndTime
218
-                FROM
219
-                maestro_tendering_process t1
220
-                JOIN relacionada_tender_process t2 ON t2.code = t1.procedureCode
221
-                JOIN relacionada_tender_process_contracting_code t3 ON t3.code = t1.contractingSystemCode
222
-                JOIN relacionada_tender_process_submission t4 ON t4.code = t1.submissionMethodCode
223
-                JOIN relacionada_tender_process_urgency_code t5 ON t5.code = t1.urgencyCode";
224
-        $result = $this->db->query($sql);
225
-        $datos['datos'] = $result->result_array();
226
-        $datos['num_rows'] = $result->num_rows();
227
-        return $datos;
228
-    }
229
-
230
-    public function getValidNoticeInfoRelacion()
231
-    {
232
-        $sql = "SELECT
233
-                    t2.nombre as noticeTypeCode, t1.id_ajena_licitacion, t1.publicationMediaName
234
-                FROM
235
-                maestro_valid_notice_info t1
236
-                JOIN relacionada_valid_notice_info t2 ON t2.code = t1.noticeTypeCode";
237
-        $result = $this->db->query($sql);
238
-        $datos['datos'] = $result->result_array();
239
-        $datos['num_rows'] = $result->num_rows();
240
-        return $datos;
241
-    }
242
-
243
-    public function getTenderResult()
244
-    {
245
-        $sql = "SELECT
246
-                    t2.nombre as resultCode, t1.id_ajena_licitacion, t1.description, t1.awardDate, t1.receivedTenderQuantity, t1.lowerTenderAmount , t1.higherTenderAmount, t1.startDate,
247
-                    t1.smeawardedIndicator, t1.contract_id, t1.contract_issueDate, t1.partyIdentification, t1.partyName, t1.TaxExclusiveAmount, t1.PayableAmount
248
-                FROM
249
-                maestro_tender_result t1
250
-                JOIN relacionada_tender_result t2 ON t2.code = t1.resultCode";
251
-        $result = $this->db->query($sql);
252
-        $datos['datos'] = $result->result_array();
253
-        $datos['num_rows'] = $result->num_rows();
254
-        return $datos;
255
-    }
256
-
257
-    public function getTenderingTermsGarantia()
258
-    {
259
-        $sql = "SELECT
260
-                    t1.id_ajena_licitacion, t2.nombre as guaranteeTypeCode, t1.requiredCurriculaIndicator, t1.variantConstraintIndicator, t1.fundingProgramCode, t1.requiredFinancialGuarantee_Amount,
261
-                    t1.language, t1.allowedSubcontractTerms, t1.description, t1.personalSituation, t1.procurementLegislationDocumentReference
262
-                FROM
263
-                maestro_tendering_terms t1
264
-                JOIN relacionada_codigo_tipo_garantia t2 ON t2.code = t1.guaranteeTypeCode";
265
-        $result = $this->db->query($sql);
266
-        $datos['datos'] = $result->result_array();
267
-        $datos['num_rows'] = $result->num_rows();
268
-        return $datos;
269
-    }
270
-
271
-    public function getTenderingTermsCriteriosFinanciacion()
272
-    {
273
-        $sql = "SELECT
274
-        t2.id_ajena_licitacion,
275
-        t3.nombre AS evaluationCriteriaTypeCode,
276
-        t1.description
277
-    FROM
278
-        maestro_tendering_terms_financial_evaluation t1
279
-        JOIN maestro_tendering_terms t2 ON t1.id_ajena_licitacion = t2.id
280
-        JOIN relacionada_tendering_terms_financial t3 ON t3.CODE = t1.evaluationCriteriaTypeCode";
281
-
282
-        $result = $this->db->query($sql);
283
-        $datos['datos'] = $result->result_array();
284
-        $datos['num_rows'] = $result->num_rows();
285
-        return $datos;
286
-    }
287
-
288
-    public function getTenderingTermsCriteriosTecnicos()
289
-    {
290
-        $sql = "SELECT
291
-                    t2.id_ajena_licitacion, t3.nombre as evaluationCriteriaTypeCode, t1.description
292
-                FROM
293
-                maestro_tendering_terms_qualification_request t1
294
-                JOIN maestro_tendering_terms t2 ON t1.id_ajena_licitacion = t2.id
295
-                JOIN relacionada_tendering_terms_qualification_request t3 ON t3.code = t1.evaluationCriteriaTypeCode";
296
-
297
-        $result = $this->db->query($sql);
298
-        $datos['datos'] = $result->result_array();
299
-        $datos['num_rows'] = $result->num_rows();
300
-        return $datos;
301
-    }
302
-
303
-    public function getTenderingTermsRequisitos()
304
-    {
305
-        $sql = "SELECT
306
-                    t2.id_ajena_licitacion, t3.nombre as evaluationCriteriaTypeCode, t1.description
307
-                FROM
308
-                maestro_tendering_terms_qualification_request t1
309
-                JOIN maestro_tendering_terms t2 ON t1.id_ajena_licitacion = t2.id
310
-                JOIN relacionada_tendering_terms_qualification_request t3 ON t3.code = t1.evaluationCriteriaTypeCode";
311
-
312
-        $result = $this->db->query($sql);
313
-        $datos['datos'] = $result->result_array();
314
-        $datos['num_rows'] = $result->num_rows();
315
-        return $datos;
316
-    }
317
-
318
-    public function getProjectLotActivityByProjectLot($projectLotId)
319
-    {
320
-        $sql = "SELECT
321
-                    *
322
-                FROM
323
-                    maestro_procurement_project_lot_item
324
-                WHERE id_compuesta_padre = '$projectLotId'";
192
+                    $tablaRelacion t2 ON t2." . $txtIdAjena . " = t1." . $id . "
193
+                WHERE t1.fecha_creacion_log = '$this->fechaLog'";
325
         $result = $this->db->query($sql);
194
         $result = $this->db->query($sql);
326
         $datos['datos'] = $result->result_array();
195
         $datos['datos'] = $result->result_array();
327
         $datos['num_rows'] = $result->num_rows();
196
         $datos['num_rows'] = $result->num_rows();