Pārlūkot izejas kodu

Merge branch 'dev'

Nermosis 3 gadus atpakaļ
vecāks
revīzija
a021c61abd

+ 76 - 74
application/controllers/ExportXls.php Parādīt failu

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 defined('BASEPATH') or exit('No direct script access allowed');
3 4
 
4 5
 use PhpOffice\PhpSpreadsheet\Spreadsheet;
@@ -30,6 +31,7 @@ class ExportXls extends CI_Controller
30 31
     public function exportDatosCompletos()
31 32
     {
32 33
         $licitacionesResult = $this->Xlsexport_model->getFullDatosUltimasInsertadas();
34
+
33 35
         $result = array();
34 36
 
35 37
         //$start = $this->starttime();
@@ -72,8 +74,8 @@ class ExportXls extends CI_Controller
72 74
         $spreadsheet = $this->datosCompletosHojaBitacora($spreadsheet, $result);
73 75
         $spreadsheet = $this->datosCompletosMediosPublicacion($spreadsheet, $result['validNoticeInfo']);
74 76
         $spreadsheet = $this->datosMedioPublicacion($spreadsheet, $result['validNoticeInfoDocumentos']);
75
-        $spreadsheet = $this->datosCriterioAdjudicacion($spreadsheet, $result['tenderFinancial']);
76
-        $spreadsheet = $this->datosCriterioEvaluacionFinanciera($spreadsheet, $result['tenderAwarding']);
77
+        $spreadsheet = $this->datosCriterioAdjudicacion($spreadsheet, $result['tenderAwarding']);
78
+        $spreadsheet = $this->datosCriterioEvaluacionFinanciera($spreadsheet, $result['tenderFinancial']);
77 79
         $spreadsheet = $this->datosCriterioEvaluacionTecnica($spreadsheet, $result['tenderTecnicos']);
78 80
         $spreadsheet = $this->datosRequisitosParticipacion($spreadsheet, $result['tenderQualification']);
79 81
 
@@ -122,6 +124,7 @@ class ExportXls extends CI_Controller
122 124
     public function mapearDatos($licitacionesResult): array
123 125
     {
124 126
         $result = array();
127
+
125 128
         guardar_log("Excel", "Montando array datos licitacion");
126 129
         foreach ($licitacionesResult['datos'] as $licitacion) {
127 130
 
@@ -129,6 +132,7 @@ class ExportXls extends CI_Controller
129 132
                 'id_licitacion' => $licitacion->id_licitacion,
130 133
                 "link_uri" => $licitacion->link_uri,
131 134
                 "updated" => $licitacion->updated,
135
+                'estadoLicitacion' => $licitacion->estadoLicitacion,
132 136
             );
133 137
             $result['hoja1'][$licitacion->id_licitacion]['contract'] = array(
134 138
                 "descripcion" => $licitacion->contrato_status,
@@ -180,46 +184,46 @@ class ExportXls extends CI_Controller
180 184
         }
181 185
 
182 186
         guardar_log("Excel", "Consulta Valid notice info");
183
-        $result['validNoticeInfo'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_valid_notice_info");
187
+        $result['validNoticeInfo'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_valid_notice_info", "codice_valid_notice_info", "code", "noticeTypeCode");
184 188
 
185 189
         guardar_log("Excel", "Consulta Valid notice info documentos");
186
-        $result['validNoticeInfoDocumentos'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_valid_notice_info_documento");
190
+        $result['validNoticeInfoDocumentos'] = $this->Xlsexport_model->getTablaByFechaLog("global_valid_notice_info_documento");
187 191
 
188 192
         guardar_log("Excel", "Consulta projectLot");
189 193
         $result['projectLot'] = $this->Xlsexport_model->getProjectLotItem();
190 194
 
191 195
         guardar_log("Excel", "Consulta documentos tecnicos");
192
-        $result['techDocs'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_technical_documents");
196
+        $result['techDocs'] = $this->Xlsexport_model->getTablaByFechaLog("global_technical_documents");
193 197
 
194 198
         guardar_log("Excel", "Consulta documentos legales");
195
-        $result['legalDocs'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_legal_documents");
199
+        $result['legalDocs'] = $this->Xlsexport_model->getTablaByFechaLog("global_legal_documents");
196 200
 
197 201
         guardar_log("Excel", "Consulta documentos adicionales");
198
-        $result['additDocs'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_additional_documents");
202
+        $result['additDocs'] = $this->Xlsexport_model->getTablaByFechaLog("global_additional_documents");
199 203
 
200 204
         guardar_log("Excel", "Consulta documentos generales");
201
-        $result['generalDocs'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_general_documents");
205
+        $result['generalDocs'] = $this->Xlsexport_model->getTablaByFechaLog("global_general_documents");
202 206
 
203 207
         guardar_log("Excel", "Consulta tender process");
204 208
         $result['tenderProcess'] = $this->Xlsexport_model->getTenderingTermsCodes();
205 209
 
206 210
         guardar_log("Excel", "Consulta tender terms");
207
-        $result['tenderingTerms'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("maestro_tendering_terms", "relacionada_codigo_tipo_garantia", "code", "guaranteeTypeCode");
211
+        $result['tenderingTerms'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_tendering_terms", "codice_codigo_tipo_garantia", "code", "guaranteeTypeCode");
208 212
 
209 213
         guardar_log("Excel", "Consulta tender result");
210
-        $result['tenderResult'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("maestro_tender_result", "relacionada_tender_result", "code", "resultCode");
214
+        $result['tenderResult'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_tender_result", "codice_tender_result", "code", "resultCode");
211 215
 
212 216
         guardar_log("Excel", "Consulta tender criterio financieros");
213
-        $result['tenderFinancial'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms_financial_evaluation");
217
+        $result['tenderFinancial'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_tendering_terms_financial_evaluation", "codice_tendering_terms_financial", "code", "evaluationCriteriaTypeCode");
214 218
 
215 219
         guardar_log("Excel", "Consulta tender criterio adjudicacion");
216
-        $result['tenderAwarding'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms_awarding_terms");
220
+        $result['tenderAwarding'] = $this->Xlsexport_model->getTablaByFechaLog("global_tendering_terms_awarding_terms");
217 221
 
218 222
         guardar_log("Excel", "Consulta tender criterios tecnicos");
219
-        $result['tenderTecnicos'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms_qualification_request");
223
+        $result['tenderTecnicos'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_tendering_terms_qualification_request", "codice_tendering_terms_qualification_request", "code", "evaluationCriteriaTypeCode");
220 224
 
221 225
         guardar_log("Excel", "Consulta tender requisitos participacion");
222
-        $result['tenderQualification'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms_qualification_request");
226
+        $result['tenderQualification'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_tendering_terms_specific_terms", "codice_tendering_terms_specific_terms", "code", "evaluationCriteriaTypeCode");
223 227
 
224 228
         return $result;
225 229
     }
@@ -253,6 +257,7 @@ class ExportXls extends CI_Controller
253 257
             $sheet->getStyle('C' . $this->filaDatoLicitacion)
254 258
                 ->getNumberFormat()
255 259
                 ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
260
+            $sheet->setCellValue('D' . $this->filaDatoLicitacion, $row['licitacion']['estadoLicitacion']);
256 261
             $sheet->setCellValue('E' . $this->filaDatoLicitacion, $primeraPublicacion);
257 262
             $sheet->getStyle('E' . $this->filaDatoLicitacion)
258 263
                 ->getNumberFormat()
@@ -271,36 +276,34 @@ class ExportXls extends CI_Controller
271 276
 
272 277
             $sheet->setCellValue('K' . $this->filaDatoLicitacion, $row['locatedParty']['itemClassification_attr']);
273 278
             $sheet->setCellValue('L' . $this->filaDatoLicitacion, $row['project']['tipo_contrato']);
274
-            $sheet->setCellValue('M' . $this->filaDatoLicitacion, $row['project']['countrySubentityCode'] . " - " . $row['project']['countrySubentity']);
279
+            $sheet->setCellValue('M' . $this->filaDatoLicitacion, $row['project']['countrySubentity']);
275 280
             $sheet->setCellValue('N' . $this->filaDatoLicitacion, $row['party']['partyName']);
276
-            $sheet->setCellValue('O' . $this->filaDatoLicitacion, ($row['party']['tipoIdParty'] == "ID_PLATAFORMA") ? $row['party']['partyItem'] : "");
277
-            $sheet->setCellValue('P' . $this->filaDatoLicitacion, ($row['party']['tipoIdParty'] == "NIF") ? $row['party']['partyItem'] : "");
278
-            $sheet->setCellValue('Q' . $this->filaDatoLicitacion, ($row['party']['tipoIdParty'] == "DIR3") ? $row['party']['partyItem'] : "");
279
-            $sheet->setCellValue('R' . $this->filaDatoLicitacion, $row['locatedParty']['buyerProfileURIID']);
280
-            $sheet->setCellValue('S' . $this->filaDatoLicitacion, $row['locatedParty']['tipo_administracion']);
281
-            $sheet->setCellValue('T' . $this->filaDatoLicitacion, $row['party']['codpostal']);
282
-            $sheet->setCellValue('U' . $this->filaDatoLicitacion, $row['tenderProcess']['tipoTender']);
283
-            $sheet->setCellValue('V' . $this->filaDatoLicitacion, $row['tenderProcess']['contrato_sistema']);
284
-            $sheet->setCellValue('W' . $this->filaDatoLicitacion, $row['tenderProcess']['urgency']);
285
-            $sheet->setCellValue('X' . $this->filaDatoLicitacion, $row['tenderProcess']['submision']);
286
-            $sheet->setCellValue('ZY' . $this->filaDatoLicitacion, $row['tenderTerms']['procurementLegislationDocumentReference']);
287
-            $sheet->setCellValue('Z' . $this->filaDatoLicitacion, $row['tenderTerms']['allowedSubcontractTerms']);
288
-            $sheet->setCellValue('AA' . $this->filaDatoLicitacion, $row['project']['durationMesure']);
289
-            $sheet->setCellValue('AB' . $this->filaDatoLicitacion, $row['project']['medida']);
290
-            $sheet->setCellValue('AC' . $this->filaDatoLicitacion, $this->formatFechas($row['project']['duracion_inicio']));
291
-            $sheet->getStyle('AC' . $this->filaDatoLicitacion)
281
+            $sheet->setCellValue('O' . $this->filaDatoLicitacion, ($row['party']['tipoIdParty'] == "DIR3") ? $row['party']['partyItem'] : "");
282
+            $sheet->setCellValue('P' . $this->filaDatoLicitacion, $row['locatedParty']['buyerProfileURIID']);
283
+            $sheet->setCellValue('Q' . $this->filaDatoLicitacion, $row['locatedParty']['tipo_administracion']);
284
+            $sheet->setCellValue('R' . $this->filaDatoLicitacion, $row['party']['codpostal']);
285
+            $sheet->setCellValue('S' . $this->filaDatoLicitacion, $row['tenderProcess']['tipoTender']);
286
+            $sheet->setCellValue('T' . $this->filaDatoLicitacion, $row['tenderProcess']['contrato_sistema']);
287
+            $sheet->setCellValue('U' . $this->filaDatoLicitacion, $row['tenderProcess']['urgency']);
288
+            $sheet->setCellValue('V' . $this->filaDatoLicitacion, $row['tenderProcess']['submision']);
289
+            $sheet->setCellValue('W' . $this->filaDatoLicitacion, $row['tenderTerms']['procurementLegislationDocumentReference']);
290
+            $sheet->setCellValue('X' . $this->filaDatoLicitacion, $row['tenderTerms']['allowedSubcontractTerms']);
291
+            $sheet->setCellValue('Y' . $this->filaDatoLicitacion, $row['project']['durationMesure']);
292
+            $sheet->setCellValue('Z' . $this->filaDatoLicitacion, $row['project']['medida']);
293
+            $sheet->setCellValue('AA' . $this->filaDatoLicitacion, $this->formatFechas($row['project']['duracion_inicio']));
294
+            $sheet->getStyle('AA' . $this->filaDatoLicitacion)
292 295
                 ->getNumberFormat()
293 296
                 ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
294
-            $sheet->setCellValue('AD' . $this->filaDatoLicitacion, $this->formatFechas($row['project']['duracion_fin']));
295
-            $sheet->getStyle('AD' . $this->filaDatoLicitacion)
297
+            $sheet->setCellValue('AB' . $this->filaDatoLicitacion, $this->formatFechas($row['project']['duracion_fin']));
298
+            $sheet->getStyle('AB' . $this->filaDatoLicitacion)
296 299
                 ->getNumberFormat()
297 300
                 ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
298
-            $sheet->setCellValue('AE' . $this->filaDatoLicitacion, $row['project']['contractExtension']);
299
-            $sheet->setCellValue('AF' . $this->filaDatoLicitacion, $row['party']['websiteURI']);
300
-            $sheet->setCellValue('AG' . $this->filaDatoLicitacion, $row['party']['city']);
301
-            $sheet->setCellValue('AH' . $this->filaDatoLicitacion, $row['party']['direccion']);
302
-            $sheet->setCellValue('AI' . $this->filaDatoLicitacion, $row['party']['contact_name']);
303
-            $sheet->setCellValue('AJ' . $this->filaDatoLicitacion, $row['party']['contact_email']);
301
+            $sheet->setCellValue('AC' . $this->filaDatoLicitacion, $row['project']['contractExtension']);
302
+            $sheet->setCellValue('AD' . $this->filaDatoLicitacion, $row['party']['websiteURI']);
303
+            $sheet->setCellValue('AE' . $this->filaDatoLicitacion, $row['party']['city']);
304
+            $sheet->setCellValue('AF' . $this->filaDatoLicitacion, $row['party']['direccion']);
305
+            $sheet->setCellValue('AG' . $this->filaDatoLicitacion, $row['party']['contact_name']);
306
+            $sheet->setCellValue('AH' . $this->filaDatoLicitacion, $row['party']['contact_email']);
304 307
             $this->filaDatoLicitacion++;
305 308
         }
306 309
 
@@ -378,7 +381,7 @@ class ExportXls extends CI_Controller
378 381
                 guardar_log("Excel", "Escribir datos medio publicacion--" . $contador);
379 382
                 $contador++;
380 383
                 $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
381
-                $sheet->SetCellValue('B' . $aux, $datos['noticeTypeCode']);
384
+                $sheet->SetCellValue('B' . $aux, $datos['code_desc']);
382 385
                 $sheet->SetCellValue('C' . $aux, $datos['publicationMediaName']);
383 386
                 $aux++;
384 387
             }
@@ -449,6 +452,10 @@ class ExportXls extends CI_Controller
449 452
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
450 453
                 $sheet->SetCellValue('M' . $aux, $datos['partyIdentification']);
451 454
                 $sheet->SetCellValue('N' . $aux, $datos['partyName']);
455
+                $sheet->SetCellValue('O' . $aux, $datos['TaxExclusiveAmount']);
456
+                $sheet->getStyle('O' . $aux)
457
+                    ->getNumberFormat()
458
+                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
452 459
 
453 460
                 $aux++;
454 461
             }
@@ -481,10 +488,7 @@ class ExportXls extends CI_Controller
481 488
                 $sheet->getStyle('J' . $aux)
482 489
                     ->getNumberFormat()
483 490
                     ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
484
-                $sheet->SetCellValue('K' . $aux, $this->formatFechas($datos['deadLineEndTime']));
485
-                $sheet->getStyle('K' . $aux)
486
-                    ->getNumberFormat()
487
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
491
+                $sheet->SetCellValue('K' . $aux, $datos['deadLineEndTime']);
488 492
                 $sheet->SetCellValue('L' . $aux, $datos['deadLineDescription']);
489 493
                 $sheet->SetCellValue('M' . $aux, $datos['auctionTerms']);
490 494
                 $sheet->SetCellValue('N' . $aux, $this->formatFechas($datos['documentAvailablePeriod_EndDate']));
@@ -541,8 +545,8 @@ class ExportXls extends CI_Controller
541 545
                 guardar_log("Excel", "Escribir criterio adjucicacion--" . $contador);
542 546
                 $contador++;
543 547
                 $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
544
-                $sheet->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
545 548
                 $sheet->SetCellValue('B' . $aux, $datos['description']);
549
+                $sheet->SetCellValue('C' . $aux, $datos['evaluationCriteriaTypeCode']);
546 550
                 $aux++;
547 551
             }
548 552
         }
@@ -562,7 +566,7 @@ class ExportXls extends CI_Controller
562 566
                 guardar_log("Excel", "Escribir criterios evaluacion financiera--" . $contador);
563 567
                 $contador++;
564 568
                 $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
565
-                $sheet->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
569
+                $sheet->SetCellValue('B' . $aux, $datos['code_desc']);
566 570
                 $sheet->SetCellValue('C' . $aux, $datos['description']);
567 571
                 $aux++;
568 572
             }
@@ -582,7 +586,7 @@ class ExportXls extends CI_Controller
582 586
                 guardar_log("Excel", "Escribir criterio evaluacion tecnica--" . $contador);
583 587
                 $contador++;
584 588
                 $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
585
-                $sheet->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
589
+                $sheet->SetCellValue('B' . $aux, $datos['code_desc']);
586 590
                 $sheet->SetCellValue('C' . $aux, $datos['description']);
587 591
                 $aux++;
588 592
             }
@@ -603,7 +607,7 @@ class ExportXls extends CI_Controller
603 607
                 guardar_log("Excel", "Escribir requisitos participacion--" . $contador);
604 608
                 $contador++;
605 609
                 $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
606
-                $sheet->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
610
+                $sheet->SetCellValue('B' . $aux, $datos['code_desc']);
607 611
                 $aux++;
608 612
             }
609 613
 
@@ -697,28 +701,26 @@ class ExportXls extends CI_Controller
697 701
         $spreadsheet->getActiveSheet()->SetCellValue('L1', "Tipo de contrato");
698 702
         $spreadsheet->getActiveSheet()->SetCellValue('M1', "Lugar de ejecución");
699 703
         $spreadsheet->getActiveSheet()->SetCellValue('N1', "Órgano de Contratación");
700
-        $spreadsheet->getActiveSheet()->SetCellValue('O1', "ID OC en PLACSP");
701
-        $spreadsheet->getActiveSheet()->SetCellValue('P1', "NIF OC");
702
-        $spreadsheet->getActiveSheet()->SetCellValue('Q1', "DIR3");
703
-        $spreadsheet->getActiveSheet()->SetCellValue('R1', "Enlace al Perfil de Contratante del OC");
704
-        $spreadsheet->getActiveSheet()->SetCellValue('S1', "Tipo de Administración");
705
-        $spreadsheet->getActiveSheet()->SetCellValue('T1', "Código Postal");
706
-        $spreadsheet->getActiveSheet()->SetCellValue('U1', "Tipo de procedimiento");
707
-        $spreadsheet->getActiveSheet()->SetCellValue('V1', "Sistema de contratación");
708
-        $spreadsheet->getActiveSheet()->SetCellValue('W1', "Tramitación");
709
-        $spreadsheet->getActiveSheet()->SetCellValue('X1', "Forma de presentación de la oferta");
710
-        $spreadsheet->getActiveSheet()->SetCellValue('Y1', "Directiva de aplicación");
711
-        $spreadsheet->getActiveSheet()->SetCellValue('Z1', "Subcontratación permitida");
712
-        $spreadsheet->getActiveSheet()->SetCellValue('AA1', "Duración Contrato");
713
-        $spreadsheet->getActiveSheet()->SetCellValue('AB1', "Tipo de duración");
714
-        $spreadsheet->getActiveSheet()->SetCellValue('AC1', "Inicio contrato");
715
-        $spreadsheet->getActiveSheet()->SetCellValue('AD1', "Fin contrato");
716
-        $spreadsheet->getActiveSheet()->SetCellValue('AE1', "Extension Contrato");
717
-        $spreadsheet->getActiveSheet()->SetCellValue('AF1', "URL Organo Contratación");
718
-        $spreadsheet->getActiveSheet()->SetCellValue('AG1', "Ciudad Organo Contratación");
719
-        $spreadsheet->getActiveSheet()->SetCellValue('AH1', "Dirección Organo Contratación");
720
-        $spreadsheet->getActiveSheet()->SetCellValue('AI1', "Nombre Contacto Organo Contratación");
721
-        $spreadsheet->getActiveSheet()->SetCellValue('AJ1', "Email contacto Organo Contratación");
704
+        $spreadsheet->getActiveSheet()->SetCellValue('O1', "DIR3");
705
+        $spreadsheet->getActiveSheet()->SetCellValue('P1', "Enlace al Perfil de Contratante del OC");
706
+        $spreadsheet->getActiveSheet()->SetCellValue('Q1', "Tipo de Administración");
707
+        $spreadsheet->getActiveSheet()->SetCellValue('R1', "Código Postal");
708
+        $spreadsheet->getActiveSheet()->SetCellValue('S1', "Tipo de procedimiento");
709
+        $spreadsheet->getActiveSheet()->SetCellValue('T1', "Sistema de contratación");
710
+        $spreadsheet->getActiveSheet()->SetCellValue('U1', "Tramitación");
711
+        $spreadsheet->getActiveSheet()->SetCellValue('V1', "Forma de presentación de la oferta");
712
+        $spreadsheet->getActiveSheet()->SetCellValue('W1', "Directiva de aplicación");
713
+        $spreadsheet->getActiveSheet()->SetCellValue('X1', "Subcontratación permitida");
714
+        $spreadsheet->getActiveSheet()->SetCellValue('Y1', "Duración Contrato");
715
+        $spreadsheet->getActiveSheet()->SetCellValue('Z1', "Tipo de duración");
716
+        $spreadsheet->getActiveSheet()->SetCellValue('AA1', "Inicio contrato");
717
+        $spreadsheet->getActiveSheet()->SetCellValue('AB1', "Fin contrato");
718
+        $spreadsheet->getActiveSheet()->SetCellValue('AC1', "Extension Contrato");
719
+        $spreadsheet->getActiveSheet()->SetCellValue('AD1', "URL Organo Contratación");
720
+        $spreadsheet->getActiveSheet()->SetCellValue('AE1', "Ciudad Organo Contratación");
721
+        $spreadsheet->getActiveSheet()->SetCellValue('AF1', "Dirección Organo Contratación");
722
+        $spreadsheet->getActiveSheet()->SetCellValue('AG1', "Nombre Contacto Organo Contratación");
723
+        $spreadsheet->getActiveSheet()->SetCellValue('AH1', "Email contacto Organo Contratación");
722 724
         return $spreadsheet;
723 725
     }
724 726
 
@@ -759,7 +761,7 @@ class ExportXls extends CI_Controller
759 761
         $spreadsheet->getActiveSheet()->SetCellValue('C1', "Número de lote");
760 762
         $spreadsheet->getActiveSheet()->SetCellValue('D1', "Importe sin Impuestos");
761 763
         $spreadsheet->getActiveSheet()->SetCellValue('E1', "Lugar de ejecución del lote");
762
-        $spreadsheet->getActiveSheet()->SetCellValue('E1', "CPV");
764
+        $spreadsheet->getActiveSheet()->SetCellValue('F1', "CPV");
763 765
 
764 766
         return $spreadsheet;
765 767
     }
@@ -826,7 +828,7 @@ class ExportXls extends CI_Controller
826 828
         $spreadsheet->getActiveSheet()->SetCellValue('L1', 'Fecha de formalización');
827 829
         $spreadsheet->getActiveSheet()->SetCellValue('M1', 'Adjudicatario CIF');
828 830
         $spreadsheet->getActiveSheet()->SetCellValue('N1', 'Nombre Adjudicatario');
829
-
831
+        $spreadsheet->getActiveSheet()->SetCellValue('O1', 'Importe de adjudicación sin impuestos');
830 832
         return $spreadsheet;
831 833
     }
832 834
 
@@ -895,8 +897,8 @@ class ExportXls extends CI_Controller
895 897
         );
896 898
         $sheet->getStyle("A1:C1")->applyFromArray($styleArr);
897 899
         $spreadsheet->getActiveSheet()->SetCellValue('A1', 'Identificador');
898
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Tipo criterio de adjudicación');
899
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Descripción textual del criterio de adjudicación');
900
+        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Descripción textual del criterio de adjudicación');
901
+        $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Ponderación');
900 902
 
901 903
         return $spreadsheet;
902 904
     }

+ 25 - 49
application/controllers/Parser.php Parādīt failu

@@ -45,8 +45,6 @@ class Parser extends CI_Controller
45 45
 
46 46
                     if ($this->newFolder($rutaPerfil . "/" . $fechaCarpeta)) {
47 47
                         $this->rutaDiariaFecha = $rutaPerfil . "/" . $fechaCarpeta . "/";
48
-
49
-                        //$this->downloadProcess($row->url_descarga);
50 48
                         $this->downloadZip($row->url_descarga);
51 49
                     }
52 50
 
@@ -75,31 +73,11 @@ class Parser extends CI_Controller
75 73
     } */
76 74
     }
77 75
 
78
-    private function downloadProcess($urlXML)
79
-    {
80
-
81
-        $fileName = basename($urlXML);
82
-        $this->downloadFile($fileName, $urlXML, $this->rutaDiariaFecha);
83
-        $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
84
-        $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
85
-
86
-        while ($nuevoAtomAttrNext !== "") {
87
-            //$aux = 0;
88
-            //while ($aux <= 3) {
89
-
90
-            $fileName = basename($nuevoAtomAttrNext);
91
-            $this->downloadFile($fileName, $nuevoAtomAttrNext, $this->rutaDiariaFecha);
92
-            $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
93
-
94
-            $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
95
-            //$aux++;
96
-        }
97
-    }
98
-
99 76
     private function downloadZip($urlXML)
100 77
     {
78
+        $fechaDescarga = $this->getFechaForDownloadZip();
101 79
         $fileName = basename($urlXML);
102
-        $downladedZip = $this->downloadFile($fileName, $urlXML, $this->rutaDiariaFecha);
80
+        $downladedZip = $this->downloadFile($fileName, $urlXML . $fechaDescarga, $this->rutaDiariaFecha);
103 81
 
104 82
         if ($downladedZip) {
105 83
             $zip = new ZipArchive;
@@ -112,10 +90,30 @@ class Parser extends CI_Controller
112 90
                 foreach ($archivosTotales as $file) {
113 91
                     $this->getFile($this->rutaDiariaFecha . $file, $file);
114 92
                 }
115
-
116 93
             }
94
+        }
95
+    }
117 96
 
97
+    private function getFechaForDownloadZip(): String
98
+    {
99
+        $result = "_";
100
+        $anyo = date("Y");
101
+        $mes = date("m");
102
+        $mesPrevious = date("m", strtotime("-1 months"));
103
+        $yearPrevious = date("Y", strtotime("-1 year"));
104
+        $dia = date("d");
105
+
106
+        if (date("m") == "01") {
107
+            $result .= $yearPrevious . $mesPrevious . ".zip";
108
+        } else {
109
+            if ($dia == "01") {
110
+                $result .= $anyo . $mesPrevious . ".zip";
111
+            } else {
112
+                $result .= $anyo . $mes . ".zip";
113
+            }
118 114
         }
115
+
116
+        return $result;
119 117
     }
120 118
 
121 119
     private function getFile($url, $fileName)
@@ -148,26 +146,6 @@ class Parser extends CI_Controller
148 146
         file_put_contents($this->rutaDiariaFecha . "/format/" . $fileName, $closureFormat);
149 147
     }
150 148
 
151
-    private function readNextAttribute($archivo)
152
-    {
153
-        $enlace = "";
154
-        foreach ($archivo['link'] as $row) {
155
-            $attrNext = $row['@attributes']['rel'];
156
-            $attrHref = $row['@attributes']['href'];
157
-
158
-            if ($attrNext === "next") {
159
-                if (!strpos($attrHref, "licitacionesPerfilesContratanteCompleto3_2021")) { //"20220127_")) {
160
-                    $enlace = $attrHref;
161
-                } else {
162
-                    $enlace = "";
163
-                }
164
-                //$enlace = $attrHref;
165
-            }
166
-        }
167
-
168
-        return $enlace;
169
-    }
170
-
171 149
     private function downloadFile($fileName, $url, $ruta)
172 150
     {
173 151
         if (file_put_contents($ruta . $fileName, file_get_contents($url))) {
@@ -179,7 +157,7 @@ class Parser extends CI_Controller
179 157
 
180 158
     private function regExIniciosEsquema($xml)
181 159
     {
182
-        $pattern = "/(<cac:)|(<cbc:)|(<cac-place-ext:)|(<cbc-place-ext:)/";
160
+        $pattern = "/(<cac:)|(<cbc:)|(<cac-place-ext:)|(<cbc-place-ext:)|(<at:)/";
183 161
         $result = preg_replace($pattern, "<", $xml);
184 162
 
185 163
         return $result;
@@ -187,7 +165,7 @@ class Parser extends CI_Controller
187 165
 
188 166
     private function regExFinalesEsquema($xml)
189 167
     {
190
-        $pattern = "/(<\/cac:)|(<\/cbc:)|(<\/cac-place-ext:)|(<\/cbc-place-ext:)/";
168
+        $pattern = "/(<\/cac:)|(<\/cbc:)|(<\/cac-place-ext:)|(<\/cbc-place-ext:)|(<\/at:)/";
191 169
         $result = preg_replace($pattern, "</", $xml);
192 170
 
193 171
         return $result;
@@ -195,8 +173,6 @@ class Parser extends CI_Controller
195 173
 
196 174
     private function tablasCalculadas($idUltimaImportacion)
197 175
     {
198
-        $this->Parser_model->truncateTables("import_licitaciones_temp");
199
-
200 176
         $this->Parser_model->truncateTables("vista_datos_licitacion");
201 177
 
202 178
         $licitaciones = $this->Xlsexport_model->getLicitaciones($idUltimaImportacion);

+ 198 - 0
application/controllers/ParserCompleto.php Parādīt failu

@@ -0,0 +1,198 @@
1
+<?php
2
+defined('BASEPATH') or exit('No direct script access allowed');
3
+
4
+/**
5
+ *
6
+ * Controller ParserCompleto
7
+ *
8
+ * This controller for ...
9
+ *
10
+ * @package   CodeIgniter
11
+ * @category  Controller CI
12
+ * @author    Setiawan Jodi <jodisetiawan@fisip-untirta.ac.id>
13
+ * @author    Raul Guerrero <r.g.c@me.com>
14
+ * @link      https://github.com/setdjod/myci-extension/
15
+ * @param     ...
16
+ * @return    ...
17
+ *
18
+ */
19
+
20
+class ParserCompleto extends CI_Controller
21
+{
22
+
23
+    //TODO: PARAMETRIZAR BBDD -> SI EXISTE UN PROCESO EN MARCHA, NO INICIAR SIGUIENTE DESCARGA, AVISAR
24
+    protected $rutaDiaria = FCPATH . "DOWNLOADS/DAILY/";
25
+    protected $rutaDiariaFecha = "";
26
+
27
+    protected $rutaMensual = FCPATH . "DOWNLOADS/MONTH/";
28
+    protected $enlaceAtom = "";
29
+    protected $fechaCreacionLog = "";
30
+
31
+    public function __construct()
32
+    {
33
+        parent::__construct();
34
+        $this->load->helper('file');
35
+        $this->load->helper('xml');
36
+        $this->load->library('parserfile');
37
+
38
+        $this->load->model("Parser_model");
39
+    }
40
+
41
+    public function index()
42
+    {
43
+        $existCronRun = $this->Parser_model->existCronRun();
44
+        $fechaCarpeta = "";
45
+        if ($existCronRun['num_rows'] > 0) {
46
+            if ($existCronRun['datos']->cron_ejecucion == 0) {
47
+
48
+                $this->Parser_model->inicioParser();
49
+
50
+                $resultSetPerfiles = $this->Parser_model->getUrlArchivos();
51
+                $fechaCarpeta = date("Y-m-d_H-i-s");
52
+                $fechaImportacionLog = date("Y-m-d H:i:s");
53
+
54
+                foreach ($resultSetPerfiles['datos'] as $row) {
55
+
56
+                    $idUltimaImportacion = $this->Parser_model->setFechaNuevaImportacion($fechaImportacionLog);
57
+                    $this->fechaCreacionLog = $fechaCarpeta;
58
+                    $rutaPerfil = $this->rutaDiaria . "/" . $row->prefijos_tablas;
59
+
60
+                    $this->newFolder($rutaPerfil);
61
+
62
+                    if ($this->newFolder($rutaPerfil . "/" . $fechaCarpeta)) {
63
+                        $this->rutaDiariaFecha = $rutaPerfil . "/" . $fechaCarpeta . "/";
64
+                        $this->downloadProcess($row->url_descarga . ".atom");
65
+                    }
66
+
67
+                    $files = get_filenames($this->rutaDiariaFecha . "/format");
68
+                    emailInicioProcesoDescarga($fechaImportacionLog, $files);
69
+
70
+                    $this->parserfile->index($this->rutaDiariaFecha, $fechaCarpeta, $row, $idUltimaImportacion);
71
+                }
72
+
73
+                $this->tablasCalculadas($idUltimaImportacion);
74
+
75
+                emailFinProcesoDescarga($fechaImportacionLog);
76
+
77
+            } else {
78
+                echo "EXISTE UN CRON EN MARCHA.";
79
+            }
80
+        } else {
81
+            echo "No existe parametro que iniciar.";
82
+        }
83
+
84
+        $this->Parser_model->stopParser();
85
+
86
+        /* $resultSetPerfiles = $this->Parser_model->getUrlArchivos();
87
+    foreach ($resultSetPerfiles['datos'] as $row) {
88
+    $this->parserfile->index($this->rutaDiaria . "PER_PCSP_EX/2022-02-17_20-38-16", date("Y-m-d"), $row);
89
+    } */
90
+    }
91
+
92
+    private function downloadProcess($urlXML)
93
+    {
94
+
95
+        $fileName = basename($urlXML);
96
+        $this->downloadFile($fileName, $urlXML, $this->rutaDiariaFecha);
97
+        $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
98
+        $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
99
+
100
+        while ($nuevoAtomAttrNext !== "") {
101
+
102
+            $fileName = basename($nuevoAtomAttrNext);
103
+            $this->downloadFile($fileName, $nuevoAtomAttrNext, $this->rutaDiariaFecha);
104
+            $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
105
+
106
+            $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
107
+        }
108
+    }
109
+
110
+    private function readNextAttribute($archivo)
111
+    {
112
+        $enlace = "";
113
+        foreach ($archivo['link'] as $row) {
114
+            $attrNext = $row['@attributes']['rel'];
115
+            $attrHref = $row['@attributes']['href'];
116
+
117
+            if ($attrNext === "next") {
118
+                if (!strpos($attrHref, "licitacionesPerfilesContratanteCompleto3_2021")) { //"20220127_")) {
119
+                    $enlace = $attrHref;
120
+                } else {
121
+                    $enlace = "";
122
+                }
123
+                //$enlace = $attrHref;
124
+            }
125
+        }
126
+
127
+        return $enlace;
128
+    }
129
+
130
+    private function getFile($url, $fileName)
131
+    {
132
+
133
+        $feed = implode(file($url));
134
+        $xml = simplexml_load_string($feed);
135
+        $json = json_encode($xml);
136
+        $array = json_decode($json, true);
137
+
138
+        $this->formatXml($feed, $fileName);
139
+        return $array;
140
+    }
141
+
142
+    private function newFolder($rutaFinal)
143
+    {
144
+        $result = false;
145
+        if (!is_dir($rutaFinal)) {
146
+            $result = mkdir($rutaFinal);
147
+            mkdir($rutaFinal . "/format");
148
+        }
149
+
150
+        return $result;
151
+    }
152
+
153
+    private function formatXml($xml, $fileName)
154
+    {
155
+        $openingFormat = $this->regExIniciosEsquema($xml);
156
+        $closureFormat = $this->regExFinalesEsquema($openingFormat);
157
+        file_put_contents($this->rutaDiariaFecha . "/format/" . $fileName, $closureFormat);
158
+    }
159
+
160
+    private function downloadFile($fileName, $url, $ruta)
161
+    {
162
+        if (file_put_contents($ruta . $fileName, file_get_contents($url))) {
163
+            return true;
164
+        } else {
165
+            return false;
166
+        }
167
+    }
168
+
169
+    private function regExIniciosEsquema($xml)
170
+    {
171
+        $pattern = "/(<cac:)|(<cbc:)|(<cac-place-ext:)|(<cbc-place-ext:)/";
172
+        $result = preg_replace($pattern, "<", $xml);
173
+
174
+        return $result;
175
+    }
176
+
177
+    private function regExFinalesEsquema($xml)
178
+    {
179
+        $pattern = "/(<\/cac:)|(<\/cbc:)|(<\/cac-place-ext:)|(<\/cbc-place-ext:)/";
180
+        $result = preg_replace($pattern, "</", $xml);
181
+
182
+        return $result;
183
+    }
184
+
185
+    private function tablasCalculadas($idUltimaImportacion)
186
+    {
187
+        $this->Parser_model->truncateTables("vista_datos_licitacion");
188
+
189
+        $licitaciones = $this->Xlsexport_model->getLicitaciones($idUltimaImportacion);
190
+
191
+        insertBucleDuplicateOnKey($licitaciones['datos'], "vista_datos_licitacion", "");
192
+
193
+    }
194
+
195
+}
196
+
197
+/* End of file ParserCompleto.php */
198
+/* Location: ./application/controllers/ParserCompleto.php */

+ 1 - 1
application/helpers/email_templates_helper.php Parādīt failu

@@ -26,7 +26,7 @@ if (!function_exists("emailInicioProcesoDescarga")) {
26 26
 		</html>";
27 27
 
28 28
         $email = "chcalvoleon@mindden.com";
29
-        enviarEmail($asunto, $cuerpo, $email, false);
29
+        enviarEmail($asunto, $cuerpo, $email, true);
30 30
     }
31 31
 }
32 32
 

+ 4 - 8
application/helpers/funciones_helper.php Parādīt failu

@@ -167,12 +167,12 @@ if (!function_exists("enviarEmail")) {
167 167
 
168 168
         $CI->load->library('email');
169 169
 
170
-        $config['protocol'] = 'smtp';
170
+        $config['protocol'] = 'mail';
171 171
         $config['smtp_host'] = 'smtp.gmail.com';
172 172
         $config['smtp_user'] = 'chcalvoleon@mindden.com';
173 173
         $config['smtp_pass'] = '4lb1R2014';
174 174
         $config['smtp_crypto'] = 'ssl';
175
-        $config['smtp_port'] = 465;
175
+        $config['smtp_port'] = 25;
176 176
         $config['mailtype'] = 'html';
177 177
         $config['wordwrap'] = 'TRUE';
178 178
         $config['newline'] = "\r\n";
@@ -188,15 +188,11 @@ if (!function_exists("enviarEmail")) {
188 188
         $CI->email->subject($asunto);
189 189
         $CI->email->message($body);
190 190
 
191
-        foreach ($adjuntos as $row) {
192
-            $CI->email->attach($row);
193
-        }
194
-
195 191
         if ($print_result) {
196
-            $CI->email->send(false);
192
+            $CI->email->send(true);
197 193
             $CI->email->print_debugger();
198 194
         } else {
199
-            $CI->email->send(false);
195
+            $CI->email->send(true);
200 196
         }
201 197
     }
202 198
 }

+ 50 - 21
application/libraries/ParserFile.php Parādīt failu

@@ -40,17 +40,13 @@ class ParserFile
40 40
         $files = get_filenames($this->rutaDiaria, true);
41 41
         $filename = "";
42 42
         $xml = "";
43
-        $json = "";
44 43
         $array = "";
45 44
         $aux = 0;
46 45
         $resultEntries = array();
47
-        $contador = 0;
48
-
49 46
         $stats = array();
50 47
 
51 48
         foreach ($files as $file) {
52 49
             $filename = basename($file);
53
-            $contador++;
54 50
             $entrada = file_get_contents($file);
55 51
             $xml = simplexml_load_string($entrada, "SimpleXMLElement", LIBXML_NOCDATA);
56 52
             $array = json_decode(json_encode($xml), true);
@@ -61,18 +57,16 @@ class ParserFile
61 57
             foreach ($tablasTruncate['datos'] as $row) {
62 58
                 $this->CI->Parser_model->truncateTables($row->tabla_sucia);
63 59
             }
64
-
65
-            gc_mem_caches();
66
-            gc_collect_cycles();
60
+            $arrayDeletedEntries = array();
61
+            $arrayDeletedEntries = $array['deleted-entry'];
67 62
 
68 63
             foreach ($array['entry'] as $clave => $row) {
69 64
 
70 65
                 $existLicitacionActualizada = $this->getDatosLicitacion($row);
71 66
 
72 67
                 if (!$existLicitacionActualizada) {
73
-                    //$arrayDeletedEntries = $xml->children('at', true);
74 68
 
75
-                    $resultEntries[$filename]['general'][$aux] = $this->nodoEntry($row, $xml->entry[$clave], $datosPerfil->id, $idUltimaImportacion);
69
+                    $resultEntries[$filename]['general'][$aux] = $this->nodoEntry($row, $xml->entry[$clave], $datosPerfil->id, $idUltimaImportacion, $arrayDeletedEntries);
76 70
 
77 71
                     $contractFolder = $this->nodoContractFolderStatus($row, $xml->entry[$clave]);
78 72
 
@@ -179,7 +173,7 @@ class ParserFile
179 173
         return $result;
180 174
     }
181 175
 
182
-    private function nodoEntry($xml, $xmlPrimitivo, $tipoPerfil, $idUltimaImportacion)
176
+    private function nodoEntry($xml, $xmlPrimitivo, $tipoPerfil, $idUltimaImportacion, $deletedEntry)
183 177
     {
184 178
         $resultEntries = array();
185 179
         $id_licitacion = (string) substr($xml['id'], strrpos($xml['id'], '/') + 1);
@@ -193,6 +187,26 @@ class ParserFile
193 187
         $resultEntries['tipo_perfil_licitacion'] = $tipoPerfil;
194 188
         $resultEntries['fecha_creacion_log'] = $this->fechaInicioParser;
195 189
         $resultEntries['id_importacion'] = $idUltimaImportacion;
190
+
191
+        $resultEntries['estadoLicitacion'] = "VIGENTE";
192
+        if ($deletedEntry) {
193
+            foreach ($deletedEntry as $row) {
194
+                $idBorrado = (string) substr($row['@attributes']["ref"], strrpos($row['@attributes']["ref"], '/') + 1);
195
+                if ($id_licitacion == $idBorrado) {
196
+                    $anyo1 = date_create($row['@attributes']['when']);
197
+                    $anyo2 = date_create($resultEntries['updated']);
198
+                    $diferencia = $anyo2->diff($anyo1);
199
+                    $diferenciaFormat = $diferencia->y;
200
+                    if ($diferenciaFormat > 5) {
201
+                        $resultEntries['estadoLicitacion'] = "ARCHIVADA";
202
+                    } else {
203
+                        $resultEntries['estadoLicitacion'] = "ANULADA";
204
+                    }
205
+                }
206
+            }
207
+
208
+        }
209
+
196 210
         return $resultEntries;
197 211
     }
198 212
 
@@ -437,8 +451,8 @@ class ParserFile
437 451
                 if (array_key_exists("AwardedTenderedProject", $tenderResult[$i])) {
438 452
                     $awardedTenderedProject = $tenderResult[$i]['AwardedTenderedProject'];
439 453
                     $resultEntries[$i]['procurementProjectLotID'] = $this->existNodo($awardedTenderedProject, 'ProcurementProjectLotID', 'string');
440
-                    $resultEntries[$i]['TaxExclusiveAmount'] = $this->existNodo($awardedTenderedProject->LegalMonetaryTotal, 'TaxExclusiveAmount', 'string');
441
-                    $resultEntries[$i]['PayableAmount'] = $this->existNodo($awardedTenderedProject->LegalMonetaryTotal, 'PayableAmount', 'string');
454
+                    $resultEntries[$i]['TaxExclusiveAmount'] = $this->existNodo($awardedTenderedProject['LegalMonetaryTotal'], 'TaxExclusiveAmount', 'string');
455
+                    $resultEntries[$i]['PayableAmount'] = $this->existNodo($awardedTenderedProject['LegalMonetaryTotal'], 'PayableAmount', 'string');
442 456
                 }
443 457
             }
444 458
         }
@@ -470,11 +484,15 @@ class ParserFile
470 484
             $resultEntries['tenderingTerm']['procurementLegislationDocumentReference'] = $this->existNodo($TenderingTerms['ProcurementLegislationDocumentReference'], 'ID', 'string');
471 485
             $resultEntries['tenderingTerm']['allowedSubcontractTerms'] = $this->existNodo($TenderingTerms['AllowedSubcontractTerms'], 'Description', 'string');
472 486
 
487
+            //Criterio de adjudicación
473 488
             if (array_key_exists("AwardingTerms", $TenderingTerms)) {
474 489
                 $tendererAwardingTerms = $TenderingTerms['AwardingTerms']['AwardingCriteria'];
490
+                if (array_key_first($tendererAwardingTerms) !== 0) {
491
+                    $tendererAwardingTerms = array(0 => $tendererAwardingTerms);
492
+                }
475 493
                 for ($i = 0; $i < count($tendererAwardingTerms); $i++) {
476
-                    $resultEntries["awardingCriteria"][$i]['evaluationCriteriaTypeCode'] = $this->existNodo($tendererAwardingTerms[$i], 'Description', 'string');
477
-                    $resultEntries["awardingCriteria"][$i]['description'] = $this->existNodo($tendererAwardingTerms[$i], 'WeightNumeric', 'string');
494
+                    $resultEntries["awardingCriteria"][$i]['description'] = $this->existNodo($tendererAwardingTerms[$i], 'Description', 'string');
495
+                    $resultEntries["awardingCriteria"][$i]['evaluationCriteriaTypeCode'] = $this->existNodo($tendererAwardingTerms[$i], 'WeightNumeric', 'string');
478 496
                     $resultEntries["awardingCriteria"][$i]['id_ajena_licitacion'] = $this->idLicitacion;
479 497
                     $resultEntries["awardingCriteria"][$i]['id_compuesta'] = $this->idLicitacion . "_07_" . $i;
480 498
                     $resultEntries["awardingCriteria"][$i]['id_compuesta_padre'] = $this->idLicitacion . "_07";
@@ -482,15 +500,21 @@ class ParserFile
482 500
                 }
483 501
             }
484 502
 
503
+            //Criterio de evluación tecnica
485 504
             if (array_key_exists("TendererQualificationRequest", $TenderingTerms)) {
486 505
                 $tendererQualificationRequest = $TenderingTerms['TendererQualificationRequest'];
487 506
                 $resultEntries['tenderingTerm']['description'] = $this->existNodo($tendererQualificationRequest, 'Description', 'string');
488 507
                 $resultEntries['tenderingTerm']['personalSituation'] = $this->existNodo($tendererQualificationRequest, 'PersonalSituation', 'string');
489
-                for ($i = 0; $i < count($tendererQualificationRequest); $i++) {
490
-                    if (isset($tendererQualificationRequest[$i]['EvaluationCriteriaTypeCode'])) {
491
-                        $resultEntries["TendererQualificationRequest"][$i]['evaluationCriteriaTypeCode'] = $this->existNodo($tendererQualificationRequest[$i]['TechnicalEvaluationCriteria'], 'EvaluationCriteriaTypeCode', 'string');
492
-                        $resultEntries["TendererQualificationRequest"][$i]['evaluationCriteriaTypeCode_attr'] = $this->existAttribute($tendererQualificationRequest[$i]['TechnicalEvaluationCriteria'], "EvaluationCriteriaTypeCode", "sting", 'listURI');
493
-                        $resultEntries["TendererQualificationRequest"][$i]['description'] = $this->existNodo($tendererQualificationRequest[$i]['TechnicalEvaluationCriteria'], 'Description', 'string');
508
+                if (isset($tendererQualificationRequest['TechnicalEvaluationCriteria'])) {
509
+                    $techicnalQualifitacion = $tendererQualificationRequest['TechnicalEvaluationCriteria'];
510
+                    if (array_key_first($techicnalQualifitacion) !== 0) {
511
+                        $techicnalQualifitacion = array(0 => $techicnalQualifitacion);
512
+                    }
513
+                    for ($i = 0; $i < count($techicnalQualifitacion); $i++) {
514
+
515
+                        $resultEntries["TendererQualificationRequest"][$i]['evaluationCriteriaTypeCode'] = $this->existNodo($tendererQualificationRequest['TechnicalEvaluationCriteria'][$i], 'EvaluationCriteriaTypeCode', 'string');
516
+                        $resultEntries["TendererQualificationRequest"][$i]['evaluationCriteriaTypeCode_attr'] = $this->existAttribute($tendererQualificationRequest['TechnicalEvaluationCriteria'][$i], "EvaluationCriteriaTypeCode", "sting", 'listURI');
517
+                        $resultEntries["TendererQualificationRequest"][$i]['description'] = $this->existNodo($tendererQualificationRequest['TechnicalEvaluationCriteria'][$i], 'Description', 'string');
494 518
                         $resultEntries["TendererQualificationRequest"][$i]['id_ajena_licitacion'] = $this->idLicitacion;
495 519
                         $resultEntries["TendererQualificationRequest"][$i]['id_compuesta'] = $this->idLicitacion . "_07_" . $i;
496 520
                         $resultEntries["TendererQualificationRequest"][$i]['id_compuesta_padre'] = $this->idLicitacion . "_07";
@@ -499,6 +523,7 @@ class ParserFile
499 523
 
500 524
                 }
501 525
 
526
+                //Criterios de evaluacion financiera
502 527
                 if (array_key_exists("FinancialEvaluationCriteria", $TenderingTerms['TendererQualificationRequest'])) {
503 528
                     $financialEvaluationCriteria = $TenderingTerms['TendererQualificationRequest']['FinancialEvaluationCriteria'];
504 529
                     for ($i = 0; $i < count($financialEvaluationCriteria); $i++) {
@@ -512,12 +537,16 @@ class ParserFile
512 537
                     }
513 538
                 }
514 539
 
540
+                //Requisitos de participación
515 541
                 if (array_key_exists("SpecificTendererRequirement", $TenderingTerms['TendererQualificationRequest'])) {
516 542
                     $specificTendererRequirement = $TenderingTerms['TendererQualificationRequest']['SpecificTendererRequirement'];
543
+                    if (array_key_first($specificTendererRequirement) !== 0) {
544
+                        $specificTendererRequirement = array(0 => $specificTendererRequirement);
545
+                    }
517 546
                     for ($i = 0; $i < count($specificTendererRequirement); $i++) {
518 547
 
519
-                        $resultEntries["SpecificTendererRequirement"][$i]['evaluationCriteriaTypeCode'] = $this->existNodo($specificTendererRequirement[$i]['SpecificTendererRequirement'], 'RequirementTypeCode', 'string');
520
-                        $resultEntries["SpecificTendererRequirement"][$i]['evaluationCriteriaTypeCode_attr'] = $this->existAttribute($specificTendererRequirement[$i]['SpecificTendererRequirement'], "RequirementTypeCode", "string", 'listURI');
548
+                        $resultEntries["SpecificTendererRequirement"][$i]['evaluationCriteriaTypeCode'] = $this->existNodo($specificTendererRequirement[$i], 'RequirementTypeCode', 'string');
549
+                        $resultEntries["SpecificTendererRequirement"][$i]['evaluationCriteriaTypeCode_attr'] = $this->existAttribute($specificTendererRequirement[$i], "RequirementTypeCode", "string", 'listURI');
521 550
                         $resultEntries["SpecificTendererRequirement"][$i]['id_ajena_licitacion'] = $this->idLicitacion;
522 551
                         $resultEntries["SpecificTendererRequirement"][$i]['id_compuesta'] = $this->idLicitacion . "_07_" . $i;
523 552
                         $resultEntries["SpecificTendererRequirement"][$i]['id_compuesta_padre'] = $this->idLicitacion . "_07";

+ 1 - 1
application/models/Parser_model.php Parādīt failu

@@ -62,7 +62,7 @@ class Parser_model extends CI_Model
62 62
 
63 63
     public function getUrlArchivos()
64 64
     {
65
-        $sql = "SELECT * FROM config_tipo_licitacion_tablas";
65
+        $sql = "SELECT * FROM config_tipo_licitacion_tablas WHERE activo = 1";
66 66
         $result = $this->db->query($sql);
67 67
         $datos['datos'] = $result->result();
68 68
         $datos['num_rows'] = $result->num_rows();

+ 11 - 1
application/models/Xlsexport_model.php Parādīt failu

@@ -19,11 +19,20 @@ defined('BASEPATH') or exit('No direct script access allowed');
19 19
 class Xlsexport_model extends CI_Model
20 20
 {
21 21
 
22
-    protected $fechaLog = "2022-02-28 08:42:06";
22
+    protected $fechaLog = "";
23 23
 
24 24
     public function __construct()
25 25
     {
26 26
         parent::__construct();
27
+        $this->fechaLog = $this->getLastDateLog()->fecha_maxima;
28
+    }
29
+
30
+    public function getLastDateLog()
31
+    {
32
+        $sql = "SELECT MAX(fecha) as fecha_maxima FROM config_fecha_importaciones LIMIT 1";
33
+        $result = $this->db->query($sql);
34
+        return $result->row();
35
+
27 36
     }
28 37
 
29 38
     // ------------------------------------------------------------------------
@@ -37,6 +46,7 @@ class Xlsexport_model extends CI_Model
37 46
                     GROUP_CONCAT( PROJI.itemClassification_value ) AS itemClassification_attr,
38 47
                     LI.link_uri,
39 48
                     LI.updated,
49
+                    LI.estadoLicitacion,
40 50
                     CF.contractFolderID,
41 51
                     CF.contractFolderStatusCode,
42 52
                     LP.buyerProfileURIID,