Sfoglia il codice sorgente

mostrar excel con las nuevas tablas finales

Nermosis 3 anni fa
parent
commit
829d234089

+ 294 - 206
application/controllers/ExportXls.php Vedi File

11
     private $filaDocumentoAdd = 2;
11
     private $filaDocumentoAdd = 2;
12
     private $filaDocumentoLegal = 2;
12
     private $filaDocumentoLegal = 2;
13
     private $filaProjectLot = 2;
13
     private $filaProjectLot = 2;
14
+    private $filaDatoLicitacion = 2;
14
 
15
 
15
     public function __construct()
16
     public function __construct()
16
     {
17
     {
18
         $this->load->model("Xlsexport_model");
19
         $this->load->model("Xlsexport_model");
19
     }
20
     }
20
 
21
 
22
+    public function index()
23
+    {
24
+        $licitaciones = $this->Xlsexport_model->getLicitaciones("HAVING LI.fecha_creacion_log = '2022-02-23 11:06:44'");
25
+
26
+        insertBucleDuplicateOnKey($licitaciones['datos'], "vista_datos_licitacion", "");
27
+
28
+    }
29
+
21
     public function exportDatosCompletos()
30
     public function exportDatosCompletos()
22
     {
31
     {
23
-        $licitacionesResult = $this->Xlsexport_model->getLicitaciones();
32
+        $licitacionesResult = $this->Xlsexport_model->getFullDatosUltimasInsertadas();
24
         $result = array();
33
         $result = array();
25
 
34
 
26
         //$start = $this->starttime();
35
         //$start = $this->starttime();
28
             $result = $this->mapearDatos($licitacionesResult);
37
             $result = $this->mapearDatos($licitacionesResult);
29
         }
38
         }
30
         $spreadsheet = new Spreadsheet();
39
         $spreadsheet = new Spreadsheet();
31
-        //$sheet = $spreadsheet->getActiveSheet();
32
-        //$sheet->setCellValue('A1', 'Hello World !');
33
-
34
         $spreadsheet->createSheet();
40
         $spreadsheet->createSheet();
35
         $spreadsheet->createSheet();
41
         $spreadsheet->createSheet();
36
         $spreadsheet->createSheet();
42
         $spreadsheet->createSheet();
46
         $spreadsheet->createSheet();
52
         $spreadsheet->createSheet();
47
         $spreadsheet->createSheet();
53
         $spreadsheet->createSheet();
48
 
54
 
49
-        $filaExcel = 1;
50
-        foreach ($result as $dato) {
51
-            if ($filaExcel == 1) {
52
-                $spreadsheet = $this->cabecerasOpenPlacspFirstSheet($spreadsheet);
53
-                /*$spreadsheet = $this->cabecerasOpenPlacsBitacora($spreadsheet, 1);
54
-            $spreadsheet = $this->cabeceraMediosComunicacion($spreadsheet);
55
-            $spreadsheet = $this->cabeceraMediosComunicacionDocumentos($spreadsheet);
56
-            $spreadsheet = $this->cabeceraTenderResult($spreadsheet);
57
-            $spreadsheet = $this->cabeceraTenderingTerms($spreadsheet);
58
-            $spreadsheet = $this->cabeceraTipoProcedimiento($spreadsheet);
59
-            $spreadsheet = $this->cabeceraCriterioADjudicacion($spreadsheet);
60
-            $spreadsheet = $this->cabeceraCriteriosFinancieros($spreadsheet);
61
-            $spreadsheet = $this->cabeceraCriteriosTecnicos($spreadsheet);
62
-            $spreadsheet = $this->cabeceraRequisitosParticipacion($spreadsheet);
63
-            $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 11);
64
-            $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 12);
65
-            $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 13);
66
-            $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 14);*/
67
-            } else {
68
-                $spreadsheet = $this->datosCompletosHojaLicitacion($spreadsheet, $filaExcel, $dato);
69
-                /*$spreadsheet = $this->datosCompletosHojaBitacora($spreadsheet, $dato);
70
-            $spreadsheet = $this->datosCompletosDocumentosGenerales($spreadsheet, $dato);
71
-            $spreadsheet = $this->datosCompletosDocumentosTecnicos($spreadsheet, $dato);
72
-            $spreadsheet = $this->datosCompletosDocumentosAdicionales($spreadsheet, $dato);
73
-            $spreadsheet = $this->datosCompletosDocumentosLegales($spreadsheet, $dato);*/
74
-            }
75
-            //$spreadsheet = $this->datosCompletosMediosPublicacion($spreadsheet);
76
-            //$spreadsheet = $this->datosMedioPublicacion($spreadsheet);
77
-            /*$spreadsheet = $this->datosCompletosResultadoDelProcedimiento($spreadsheet);
78
-            $spreadsheet = $this->datosCompletosOfertas($spreadsheet);
79
-            $spreadsheet = $this->datosCriterioAdjudicacion($spreadsheet);
80
-            $spreadsheet = $this->datosCriterioEvaluacionFinanciera($spreadsheet);
81
-            $spreadsheet = $this->datosCriterioEvaluacionTecnica($spreadsheet);
82
-            $spreadsheet = $this->datosRequisitosParticipacion($spreadsheet);
83
-            $spreadsheet = $this->datosCompletosTipoProcedimiento($spreadsheet);*/
84
-
85
-            $filaExcel++;
86
-        }
55
+        $spreadsheet = $this->cabecerasOpenPlacspFirstSheet($spreadsheet);
56
+        $spreadsheet = $this->cabecerasOpenPlacsBitacora($spreadsheet, 1);
57
+        $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 11);
58
+        $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 12);
59
+        $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 13);
60
+        $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 14);
61
+
62
+        $spreadsheet = $this->datosCompletosHojaLicitacion($spreadsheet, $result['hoja1']);
63
+        $spreadsheet = $this->datosCompletosHojaBitacora($spreadsheet, $result);
64
+        $spreadsheet = $this->datosCompletosMediosPublicacion($spreadsheet, $result['validNoticeInfo']);
65
+        $spreadsheet = $this->datosMedioPublicacion($spreadsheet, $result['validNoticeInfoDocumentos']);
66
+        $spreadsheet = $this->datosCriterioAdjudicacion($spreadsheet, $result['tenderFinancial']);
67
+        $spreadsheet = $this->datosCriterioEvaluacionFinanciera($spreadsheet, $result['tenderAwarding']);
68
+        $spreadsheet = $this->datosCriterioEvaluacionTecnica($spreadsheet, $result['tenderTecnicos']);
69
+        $spreadsheet = $this->datosRequisitosParticipacion($spreadsheet, $result['tenderQualification']);
70
+
71
+        $spreadsheet = $this->datosCompletosDocumentosGenerales($spreadsheet, $result['generalDocs']);
72
+        $spreadsheet = $this->datosCompletosDocumentosAdicionales($spreadsheet, $result['additDocs']);
73
+        $spreadsheet = $this->datosCompletosDocumentosTecnicos($spreadsheet, $result['techDocs']);
74
+        $spreadsheet = $this->datosCompletosDocumentosLegales($spreadsheet, $result['legalDocs']);
75
+        $spreadsheet = $this->datosCompletosTipoProcedimiento($spreadsheet, $result['tenderProcess']);
76
+        $spreadsheet = $this->datosCompletosOfertas($spreadsheet, $result['tenderingTerms']);
77
+        $spreadsheet = $this->datosCompletosResultadoDelProcedimiento($spreadsheet, $result['tenderResult']);
87
 
78
 
88
         $nombreAchivo = 'test.xlsx';
79
         $nombreAchivo = 'test.xlsx';
89
         $ruta = FCPATH . 'uploads/' . $nombreAchivo;
80
         $ruta = FCPATH . 'uploads/' . $nombreAchivo;
90
 
81
 
82
+        guardar_log("Excel", "Guardando Datos en excel--");
91
         $writer = new Xlsx($spreadsheet);
83
         $writer = new Xlsx($spreadsheet);
92
 
84
 
93
         $writer->save($ruta);
85
         $writer->save($ruta);
94
 
86
 
95
         // Write the Excel file to filename some_excel_file.xlsx in the current directory
87
         // Write the Excel file to filename some_excel_file.xlsx in the current directory
96
         // Redirect output to a client’s web browser (Excel5)
88
         // Redirect output to a client’s web browser (Excel5)
89
+        guardar_log("Excel", "Enviando Excel");
97
         header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
90
         header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
98
         header('Content-Disposition: attachment;filename=' . $nombreAchivo . '');
91
         header('Content-Disposition: attachment;filename=' . $nombreAchivo . '');
99
         header('Pragma: cache');
92
         header('Pragma: cache');
120
     public function mapearDatos($licitacionesResult): array
113
     public function mapearDatos($licitacionesResult): array
121
     {
114
     {
122
         $result = array();
115
         $result = array();
116
+        guardar_log("Excel", "Montando array datos licitacion");
123
         foreach ($licitacionesResult['datos'] as $licitacion) {
117
         foreach ($licitacionesResult['datos'] as $licitacion) {
124
-            $result[$licitacion->id_licitacion]['licitacion'] = array(
118
+
119
+            $result['hoja1'][$licitacion->id_licitacion]['licitacion'] = array(
125
                 'id_licitacion' => $licitacion->id_licitacion,
120
                 'id_licitacion' => $licitacion->id_licitacion,
126
                 "link_uri" => $licitacion->link_uri,
121
                 "link_uri" => $licitacion->link_uri,
127
                 "updated" => $licitacion->updated,
122
                 "updated" => $licitacion->updated,
128
             );
123
             );
129
-            $result[$licitacion->id_licitacion]['contract'] = array(
124
+            $result['hoja1'][$licitacion->id_licitacion]['contract'] = array(
130
                 "descripcion" => $licitacion->contrato_status,
125
                 "descripcion" => $licitacion->contrato_status,
131
                 "contractFolderStatusCode" => $licitacion->contractFolderStatusCode,
126
                 "contractFolderStatusCode" => $licitacion->contractFolderStatusCode,
132
                 "contractFolderID" => $licitacion->contractFolderID,
127
                 "contractFolderID" => $licitacion->contractFolderID,
133
             );
128
             );
134
-            $result[$licitacion->id_licitacion]['locatedParty'] = array(
129
+            $result['hoja1'][$licitacion->id_licitacion]['locatedParty'] = array(
135
                 "contractingPartyTypeCode" => $licitacion->contractingPartyTypeCode,
130
                 "contractingPartyTypeCode" => $licitacion->contractingPartyTypeCode,
136
                 "buyerProfileURIID" => $licitacion->buyerProfileURIID,
131
                 "buyerProfileURIID" => $licitacion->buyerProfileURIID,
137
                 "tipo_administracion" => $licitacion->tipo_administracion,
132
                 "tipo_administracion" => $licitacion->tipo_administracion,
133
+                "itemClassification_attr" => $licitacion->itemClassification_attr,
138
             );
134
             );
139
-            $result[$licitacion->id_licitacion]['party'] = array(
135
+            $result['hoja1'][$licitacion->id_licitacion]['party'] = array(
140
                 "partyName" => $licitacion->partyName,
136
                 "partyName" => $licitacion->partyName,
141
                 "codpostal" => $licitacion->codpostal,
137
                 "codpostal" => $licitacion->codpostal,
142
                 "websiteURI" => $licitacion->websiteURI,
138
                 "websiteURI" => $licitacion->websiteURI,
144
                 "direccion" => $licitacion->direccion,
140
                 "direccion" => $licitacion->direccion,
145
                 "contact_name" => $licitacion->contact_name,
141
                 "contact_name" => $licitacion->contact_name,
146
                 "contact_email" => $licitacion->contact_email,
142
                 "contact_email" => $licitacion->contact_email,
143
+                "partyItem" => $licitacion->partyItem,
144
+                "tipoIdParty" => $licitacion->tipoIdParty,
147
             );
145
             );
148
 
146
 
149
-            /*foreach ($result[$licitacion->id_licitacion]['party'] as $row) {
150
-            $result[$licitacion->id_licitacion]['partyActivity'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_party_party_idenfitication", "id_ajena_licitacion", $row['id']);
151
-            }*/
152
-
153
-            $result[$licitacion->id_licitacion]['project'] = array(
154
-                "name" => $licitacion->name,
147
+            $result['hoja1'][$licitacion->id_licitacion]['project'] = array(
148
+                "name" => $licitacion->nameProject,
155
                 "estimatedOverallContractAmount" => $licitacion->estimatedOverallContractAmount,
149
                 "estimatedOverallContractAmount" => $licitacion->estimatedOverallContractAmount,
156
                 "taxExclusiveAmount" => $licitacion->taxExclusiveAmount,
150
                 "taxExclusiveAmount" => $licitacion->taxExclusiveAmount,
157
                 "totalAmount" => $licitacion->totalAmount,
151
                 "totalAmount" => $licitacion->totalAmount,
166
 
160
 
167
             );
161
             );
168
 
162
 
169
-            $result[$licitacion->id_licitacion]['tenderProcess'] = array(
163
+            $result['hoja1'][$licitacion->id_licitacion]['tenderProcess'] = array(
170
                 "tipoTender" => $licitacion->tipoTender,
164
                 "tipoTender" => $licitacion->tipoTender,
171
                 "contrato_sistema" => $licitacion->contrato_sistema,
165
                 "contrato_sistema" => $licitacion->contrato_sistema,
172
                 "urgency" => $licitacion->urgency,
166
                 "urgency" => $licitacion->urgency,
173
                 "submision" => $licitacion->submision,
167
                 "submision" => $licitacion->submision,
174
             );
168
             );
175
 
169
 
176
-            $result[$licitacion->id_licitacion]['tenderTerms'] = array(
170
+            $result['hoja1'][$licitacion->id_licitacion]['tenderTerms'] = array(
177
                 "procurementLegislationDocumentReference" => $licitacion->procurementLegislationDocumentReference,
171
                 "procurementLegislationDocumentReference" => $licitacion->procurementLegislationDocumentReference,
178
                 "allowedSubcontractTerms" => $licitacion->allowedSubcontractTerms,
172
                 "allowedSubcontractTerms" => $licitacion->allowedSubcontractTerms,
179
             );
173
             );
180
-            /*foreach ($result[$licitacion->id_licitacion]['project'] as $row) {
181
-            //$result[$licitacion->id_licitacion]['projectActivity'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_procurement_project_itemClass", "id_ajena_licitacion", $row['id']);
182
-            }*/
183
-
184
-            /*$result[$licitacion->id_licitacion]['projectLot'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_procurement_project_lot", $licitacion->id_licitacion);
185
-            foreach ($result[$licitacion->id_licitacion]['projectLot'] as $row) {
186
-            //$result[$licitacion->id_licitacion]['projectLotActivity'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_procurement_project_lot_item", "id_ajena_licitacion", $row['id']);
187
-            }*/
188
-
189
-            /*$result[$licitacion->id_licitacion]['tenderResult'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_tender_result", $licitacion->id_licitacion);
190
-        $result[$licitacion->id_licitacion]['tenderProcess'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_tendering_process", $licitacion->id_licitacion);
191
-        $result[$licitacion->id_licitacion]['tenderTerms'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_tendering_terms", $licitacion->id_licitacion);
192
-        $result[$licitacion->id_licitacion]['validNoticeInfo'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_valid_notice_info", $licitacion->id_licitacion);
193
-        $result[$licitacion->id_licitacion]['techDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_technical_documents", $licitacion->id_licitacion);
194
-        $result[$licitacion->id_licitacion]['legalDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_legal_documents", $licitacion->id_licitacion);
195
-        $result[$licitacion->id_licitacion]['generalDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_general_documents", $licitacion->id_licitacion);
196
-        $result[$licitacion->id_licitacion]['additDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_additional_documents", $licitacion->id_licitacion);*/
197
         }
174
         }
198
 
175
 
176
+        guardar_log("Excel", "Consulta Valid notice info");
177
+        $result['validNoticeInfo'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_valid_notice_info");
178
+
179
+        guardar_log("Excel", "Consulta Valid notice info documentos");
180
+        $result['validNoticeInfoDocumentos'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_valid_notice_info_documento");
181
+
182
+        /* guardar_log("Excel", "Consulta Valid notice info");
183
+        $result['validNoticeInfo'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_valid_notice_fechas"); */
184
+
185
+        guardar_log("Excel", "Consulta projectLot");
186
+        $result['projectLot'] = $this->Xlsexport_model->getProjectLotItem();
187
+
188
+        guardar_log("Excel", "Consulta documentos tecnicos");
189
+        $result['techDocs'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_technical_documents");
190
+
191
+        guardar_log("Excel", "Consulta documentos legales");
192
+        $result['legalDocs'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_legal_documents");
193
+
194
+        guardar_log("Excel", "Consulta documentos adicionales");
195
+        $result['additDocs'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_additional_documents");
196
+
197
+        guardar_log("Excel", "Consulta documentos generales");
198
+        $result['generalDocs'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_general_documents");
199
+
200
+        guardar_log("Excel", "Consulta tender process");
201
+        $result['tenderProcess'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_process");
202
+
203
+        guardar_log("Excel", "Consulta tender terms");
204
+        $result['tenderingTerms'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms");
205
+
206
+        guardar_log("Excel", "Consulta tender result");
207
+        $result['tenderResult'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tender_result");
208
+
209
+        guardar_log("Excel", "Consulta tender criterio financieros");
210
+        $result['tenderFinancial'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms_financial_evaluation");
211
+
212
+        guardar_log("Excel", "Consulta tender criterio adjudicacion");
213
+        $result['tenderAwarding'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms_awarding_terms");
214
+
215
+        guardar_log("Excel", "Consulta tender criterios tecnicos");
216
+        $result['tenderTecnicos'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms_qualification_request");
217
+
218
+        guardar_log("Excel", "Consulta tender requisitos participacion");
219
+        $result['tenderQualification'] = $this->Xlsexport_model->getTablaByFechaLog("maestro_tendering_terms_qualification_request");
220
+
199
         return $result;
221
         return $result;
200
     }
222
     }
201
 
223
 
202
-    private function datosCompletosHojaLicitacion($spreadsheet, $filaExcel, $datosLicitacion)
224
+    private function datosCompletosHojaLicitacion($spreadsheet, $datosLicitacion)
203
     {
225
     {
204
 
226
 
205
         $sheet = $spreadsheet->getSheet(0);
227
         $sheet = $spreadsheet->getSheet(0);
211
                 "size" => 13,
233
                 "size" => 13,
212
             ),
234
             ),
213
         );
235
         );
214
-        $updatedFormat = new DateTime($datosLicitacion['licitacion']['updated']);
215
-        $updated = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($updatedFormat);
216
-        $sheet->getStyle("A1:AB1")->applyFromArray($styleArr);
217
-        $sheet->setCellValue('A' . $filaExcel, $datosLicitacion['licitacion']['id_licitacion']);
218
-        $sheet->setCellValue('B' . $filaExcel, $datosLicitacion['licitacion']['link_uri']);
219
-        $sheet->setCellValue('C' . $filaExcel, $updated);
220
-        $sheet->getStyle('C' . $filaExcel)
221
-            ->getNumberFormat()
222
-            ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
223
-        $sheet->setCellValue('E' . $filaExcel, "");
224
-        $sheet->setCellValue('F' . $filaExcel, $datosLicitacion['contract']['descripcion']);
225
-        $sheet->setCellValue('G' . $filaExcel, $datosLicitacion['contract']['contractFolderID']);
226
-        $sheet->setCellValue('H' . $filaExcel, $datosLicitacion['project']['name']);
227
-        $sheet->setCellValue('I' . $filaExcel, $datosLicitacion['project']['estimatedOverallContractAmount']);
228
-        $sheet->setCellValue('J' . $filaExcel, $datosLicitacion['project']['taxExclusiveAmount']);
229
-        $sheet->setCellValue('K' . $filaExcel, $datosLicitacion['project']['totalAmount']);
230
-
231
-        /*$cpvProject = "";
232
-        for ($i = 0; $i < count($datosLicitacion['projectActivity']); $i++) {
233
-        $cpvProject .= $datosLicitacion['projectActivity'][$i]['itemClassification_value'] . ";";
234
-        }*/
235
-
236
-        /*$cpvParty = "";
237
-        //TODO OBtener solo el DIR3
238
-        for ($i = 0; $i < count($datosLicitacion['partyActivity']); $i++) {
239
-        $cpvParty .= $datosLicitacion['partyActivity'][$i]['idPartyIdent'] . ";";
240
-        }*/
241
-
242
-        $sheet->setCellValue('L' . $filaExcel, ""); //$cpvProject);
243
-        $sheet->setCellValue('M' . $filaExcel, $datosLicitacion['project']['tipo_contrato']);
244
-        $sheet->setCellValue('N' . $filaExcel, $datosLicitacion['project']['countrySubentityCode'] . " - " . $datosLicitacion['project']['countrySubentity']);
245
-        $sheet->setCellValue('O' . $filaExcel, $datosLicitacion['party']['partyName']);
246
-        $sheet->setCellValue('P' . $filaExcel, "");
247
-        $sheet->setCellValue('Q' . $filaExcel, $datosLicitacion['locatedParty']['contractingPartyTypeCode']);
248
-        $sheet->setCellValue('R' . $filaExcel, ""); //$cpvParty);
249
-        $sheet->setCellValue('S' . $filaExcel, $datosLicitacion['locatedParty']['buyerProfileURIID']); //Buscar DIR3
250
-        $sheet->setCellValue('T' . $filaExcel, $datosLicitacion['locatedParty']['tipo_administracion']);
251
-        $sheet->setCellValue('U' . $filaExcel, $datosLicitacion['party']['codpostal']);
252
-        $sheet->setCellValue('V' . $filaExcel, $datosLicitacion['tenderProcess']['tipoTender']);
253
-        $sheet->setCellValue('W' . $filaExcel, $datosLicitacion['tenderProcess']['contrato_sistema']);
254
-        $sheet->setCellValue('X' . $filaExcel, $datosLicitacion['tenderProcess']['urgency']);
255
-        $sheet->setCellValue('Y' . $filaExcel, $datosLicitacion['tenderProcess']['submision']);
256
-        $sheet->setCellValue('Z' . $filaExcel, $datosLicitacion['tenderTerms']['procurementLegislationDocumentReference']);
257
-        $sheet->setCellValue('AA' . $filaExcel, $datosLicitacion['tenderTerms']['allowedSubcontractTerms']);
258
-        $sheet->setCellValue('AB' . $filaExcel, $datosLicitacion['project']['durationMesure']);
259
-        $sheet->setCellValue('AC' . $filaExcel, $datosLicitacion['project']['medida']);
260
-        $sheet->setCellValue('AD' . $filaExcel, $datosLicitacion['project']['duracion_inicio']);
261
-        $sheet->setCellValue('AE' . $filaExcel, $datosLicitacion['project']['duracion_fin']);
262
-        $sheet->setCellValue('AF' . $filaExcel, $datosLicitacion['project']['contractExtension']);
263
-        $sheet->setCellValue('AG' . $filaExcel, $datosLicitacion['party']['websiteURI']);
264
-        $sheet->setCellValue('AH' . $filaExcel, $datosLicitacion['party']['city']);
265
-        $sheet->setCellValue('AI' . $filaExcel, $datosLicitacion['party']['direccion']);
266
-        $sheet->setCellValue('AJ' . $filaExcel, $datosLicitacion['party']['contact_name']);
267
-        $sheet->setCellValue('AK' . $filaExcel, $datosLicitacion['party']['contact_email']);
236
+
237
+        //Primera Publicacion
238
+        $contador = 0;
239
+        foreach ($datosLicitacion as $row) {
240
+            guardar_log("Excel", "Escribir excel datos licitacion--" . $contador);
241
+            $contador++;
242
+            $primeraPublicacion = $this->primeraPublicacion($row['licitacion']['id_licitacion']);
243
+
244
+            $updated = $this->formatFechas($row['licitacion']['updated']);
245
+
246
+            $sheet->getStyle("A1:AJ1")->applyFromArray($styleArr);
247
+            $sheet->setCellValue('A' . $this->filaDatoLicitacion, $row['licitacion']['id_licitacion']);
248
+            $sheet->setCellValue('B' . $this->filaDatoLicitacion, $row['licitacion']['link_uri']);
249
+            $sheet->setCellValue('C' . $this->filaDatoLicitacion, $updated);
250
+            $sheet->getStyle('C' . $this->filaDatoLicitacion)
251
+                ->getNumberFormat()
252
+                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
253
+            $sheet->setCellValue('E' . $this->filaDatoLicitacion, $primeraPublicacion);
254
+            $sheet->getStyle('E' . $this->filaDatoLicitacion)
255
+                ->getNumberFormat()
256
+                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
257
+            $sheet->setCellValue('F' . $this->filaDatoLicitacion, $row['contract']['descripcion']);
258
+            $sheet->setCellValue('G' . $this->filaDatoLicitacion, $row['contract']['contractFolderID']);
259
+            $sheet->setCellValue('H' . $this->filaDatoLicitacion, $row['project']['name']);
260
+            $sheet->setCellValue('I' . $this->filaDatoLicitacion, $row['project']['estimatedOverallContractAmount']);
261
+            $sheet->getStyle('I' . $this->filaDatoLicitacion)
262
+                ->getNumberFormat()
263
+                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
264
+            $sheet->setCellValue('J' . $this->filaDatoLicitacion, $row['project']['taxExclusiveAmount']);
265
+            $sheet->getStyle('J' . $this->filaDatoLicitacion)
266
+                ->getNumberFormat()
267
+                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
268
+
269
+            $sheet->setCellValue('K' . $this->filaDatoLicitacion, $row['locatedParty']['itemClassification_attr']);
270
+            $sheet->setCellValue('L' . $this->filaDatoLicitacion, $row['project']['tipo_contrato']);
271
+            $sheet->setCellValue('M' . $this->filaDatoLicitacion, $row['project']['countrySubentityCode'] . " - " . $row['project']['countrySubentity']);
272
+            $sheet->setCellValue('N' . $this->filaDatoLicitacion, $row['party']['partyName']);
273
+            $sheet->setCellValue('O' . $this->filaDatoLicitacion, ($row['party']['tipoIdParty'] == "ID_PLATAFORMA") ? $row['party']['partyItem'] : "");
274
+            $sheet->setCellValue('P' . $this->filaDatoLicitacion, ($row['party']['tipoIdParty'] == "NIF") ? $row['party']['partyItem'] : "");
275
+            $sheet->setCellValue('Q' . $this->filaDatoLicitacion, ($row['party']['tipoIdParty'] == "DIR3") ? $row['party']['partyItem'] : "");
276
+            $sheet->setCellValue('R' . $this->filaDatoLicitacion, $row['locatedParty']['buyerProfileURIID']);
277
+            $sheet->setCellValue('S' . $this->filaDatoLicitacion, $row['locatedParty']['tipo_administracion']);
278
+            $sheet->setCellValue('T' . $this->filaDatoLicitacion, $row['party']['codpostal']);
279
+            $sheet->setCellValue('U' . $this->filaDatoLicitacion, $row['tenderProcess']['tipoTender']);
280
+            $sheet->setCellValue('V' . $this->filaDatoLicitacion, $row['tenderProcess']['contrato_sistema']);
281
+            $sheet->setCellValue('W' . $this->filaDatoLicitacion, $row['tenderProcess']['urgency']);
282
+            $sheet->setCellValue('X' . $this->filaDatoLicitacion, $row['tenderProcess']['submision']);
283
+            $sheet->setCellValue('ZY' . $this->filaDatoLicitacion, $row['tenderTerms']['procurementLegislationDocumentReference']);
284
+            $sheet->setCellValue('Z' . $this->filaDatoLicitacion, $row['tenderTerms']['allowedSubcontractTerms']);
285
+            $sheet->setCellValue('AA' . $this->filaDatoLicitacion, $row['project']['durationMesure']);
286
+            $sheet->setCellValue('AB' . $this->filaDatoLicitacion, $row['project']['medida']);
287
+            $sheet->setCellValue('AC' . $this->filaDatoLicitacion, $this->formatFechas($row['project']['duracion_inicio']));
288
+            $sheet->getStyle('AC' . $this->filaDatoLicitacion)
289
+                ->getNumberFormat()
290
+                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
291
+            $sheet->setCellValue('AD' . $this->filaDatoLicitacion, $this->formatFechas($row['project']['duracion_fin']));
292
+            $sheet->getStyle('AD' . $this->filaDatoLicitacion)
293
+                ->getNumberFormat()
294
+                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
295
+            $sheet->setCellValue('AE' . $this->filaDatoLicitacion, $row['project']['contractExtension']);
296
+            $sheet->setCellValue('AF' . $this->filaDatoLicitacion, $row['party']['websiteURI']);
297
+            $sheet->setCellValue('AG' . $this->filaDatoLicitacion, $row['party']['city']);
298
+            $sheet->setCellValue('AH' . $this->filaDatoLicitacion, $row['party']['direccion']);
299
+            $sheet->setCellValue('AI' . $this->filaDatoLicitacion, $row['party']['contact_name']);
300
+            $sheet->setCellValue('AJ' . $this->filaDatoLicitacion, $row['party']['contact_email']);
301
+            $this->filaDatoLicitacion++;
302
+        }
268
 
303
 
269
         return $spreadsheet;
304
         return $spreadsheet;
270
 
305
 
271
     }
306
     }
272
 
307
 
273
-    private function datosCompletosHojaBitacora($spreadsheet, $datosLicitacion)
308
+    private function formatFechas($fecha)
274
     {
309
     {
275
-        $spreadsheet->setActiveSheetIndex(1);
276
-        $spreadsheet->getActiveSheet()->setTitle("Bitácora");
310
+        $fechaFinal = "";
277
 
311
 
278
-        foreach ($datosLicitacion['projectLot'] as $datos) {
279
-            $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaProjectLot, $datos['id_ajena_licitacion']);
280
-            $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaProjectLot, $datos['name']);
281
-            $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaProjectLot, $datos['idProcurementLot']);
282
-            $spreadsheet->getActiveSheet()->SetCellValue('D' . $this->filaProjectLot, $datos['totalAmount']);
283
-            $spreadsheet->getActiveSheet()->SetCellValue('E' . $this->filaProjectLot, $datos['taxExclusiveAmount']);
284
-            $spreadsheet->getActiveSheet()->SetCellValue('F' . $this->filaProjectLot, $datos['countrySubentity']);
285
-            $spreadsheet->getActiveSheet()->SetCellValue('G' . $this->filaProjectLot, $datos['countrySubentityCode']);
286
-            $spreadsheet->getActiveSheet()->SetCellValue('H' . $this->filaProjectLot, $datos['nameLocation']);
312
+        if ($fecha != "0000-00-00") {
313
+            $fechaFormat = new DateTime($fecha);
314
+            $fechaFinal = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($fechaFormat);
315
+        }
287
 
316
 
288
-            $cpv = "";
289
-            $projectLotActivity = $this->Xlsexport_model->getProjectLotActivityByProjectLot($datos['id']);
317
+        return $fechaFinal;
318
+    }
290
 
319
 
291
-            if ($projectLotActivity['num_rows'] > 0) {
292
-                for ($i = 0; $i < count($projectLotActivity['datos']); $i++) {
320
+    private function primeraPublicacion($idLicitacion)
321
+    {
322
+        $result = "";
293
 
323
 
294
-                    $cpv .= $projectLotActivity['datos'][$i]['idItem'] . ";";
295
-                }
296
-                $spreadsheet->getActiveSheet()->SetCellValue('I' . $this->filaProjectLot, $cpv);
297
-            }
324
+        $fechasPublicaciones = $this->Xlsexport_model->getFechasPublicadas($idLicitacion);
325
+
326
+        if ($fechasPublicaciones['num_rows'] > 0) {
327
+            $primeraFechaFormat = new Datetime($fechasPublicaciones['datos']->fecha);
328
+            $result = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($primeraFechaFormat);
329
+        }
330
+        return $result;
331
+    }
332
+
333
+    private function datosCompletosHojaBitacora($spreadsheet, $datosLicitacion)
334
+    {
335
+        $sheet = $spreadsheet->getSheet(1);
336
+        $sheet->setTitle("Bitacora");
337
+        $styleArr = array(
338
+            "font" => array(
339
+                "bold" => true,
340
+                "color" => array("rgb" => "22B9FF"),
341
+                "size" => 13,
342
+            ),
343
+        );
344
+        $sheet->getStyle("A1:F1")->applyFromArray($styleArr);
345
+        $contador = 0;
346
+        foreach ($datosLicitacion['projectLot']['datos'] as $bitacora) {
347
+            guardar_log("Excel", "Escribir bitacora--" . $contador);
348
+            $contador++;
349
+            $sheet->SetCellValue('A' . $this->filaProjectLot, $bitacora['id_ajena_licitacion']);
350
+            $sheet->SetCellValue('B' . $this->filaProjectLot, $bitacora['name']);
351
+            $sheet->setCellValue('C' . $this->filaProjectLot, $bitacora['idProcurementLot']);
352
+            $sheet->SetCellValue('D' . $this->filaProjectLot, $bitacora['taxExclusiveAmount']);
353
+            $sheet->SetCellValue('F' . $this->filaProjectLot, $bitacora['countrySubentity']);
354
+            $sheet->SetCellValue('I' . $this->filaProjectLot, $bitacora['itemClassification_attr']);
298
             $this->filaProjectLot++;
355
             $this->filaProjectLot++;
299
         }
356
         }
300
         return $spreadsheet;
357
         return $spreadsheet;
301
     }
358
     }
302
 
359
 
303
-    private function datosCompletosMediosPublicacion($spreadsheet)
360
+    private function datosCompletosMediosPublicacion($spreadsheet, $datos)
304
     {
361
     {
305
         $spreadsheet->setActiveSheetIndex(2);
362
         $spreadsheet->setActiveSheetIndex(2);
306
         $spreadsheet->getActiveSheet()->setTitle("Medios de publicación");
363
         $spreadsheet->getActiveSheet()->setTitle("Medios de publicación");
307
-        $datos = $this->Xlsexport_model->getValidNoticeInfoRelacion();
308
 
364
 
309
         if ($datos['num_rows'] > 0) {
365
         if ($datos['num_rows'] > 0) {
366
+            $contador = 0;
310
             $aux = 2;
367
             $aux = 2;
311
             foreach ($datos['datos'] as $datos) {
368
             foreach ($datos['datos'] as $datos) {
369
+                guardar_log("Excel", "Escribir datos medio publicacion--" . $contador);
370
+                $contador++;
312
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
371
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
313
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['noticeTypeCode']);
372
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['noticeTypeCode']);
314
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['publicationMediaName']);
373
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['publicationMediaName']);
319
         return $spreadsheet;
378
         return $spreadsheet;
320
     }
379
     }
321
 
380
 
322
-    private function datosMedioPublicacion($spreadsheet)
381
+    private function datosMedioPublicacion($spreadsheet, $datos)
323
     {
382
     {
324
         $spreadsheet->setActiveSheetIndex(3);
383
         $spreadsheet->setActiveSheetIndex(3);
325
         $spreadsheet->getActiveSheet()->setTitle("Documentos Medios Comm");
384
         $spreadsheet->getActiveSheet()->setTitle("Documentos Medios Comm");
326
-        $datos = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("maestro_valid_notice_info_documento", "maestro_valid_notice_info", "id_ajena_vni");
385
+
327
         if ($datos['num_rows'] > 0) {
386
         if ($datos['num_rows'] > 0) {
328
             $aux = 2;
387
             $aux = 2;
388
+            $contador = 0;
329
             foreach ($datos['datos'] as $row) {
389
             foreach ($datos['datos'] as $row) {
390
+                guardar_log("Excel", "Escribir documentios medios comunicacion--" . $contador);
391
+                $contador++;
330
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $row['id_ajena_licitacion']);
392
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $row['id_ajena_licitacion']);
331
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $row['documento']);
393
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $row['documento']);
332
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $row['filename']);
394
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $row['filename']);
337
         return $spreadsheet;
399
         return $spreadsheet;
338
     }
400
     }
339
 
401
 
340
-    private function datosCompletosResultadoDelProcedimiento($spreadsheet)
402
+    private function datosCompletosResultadoDelProcedimiento($spreadsheet, $datos)
341
     {
403
     {
342
         $spreadsheet->setActiveSheetIndex(4);
404
         $spreadsheet->setActiveSheetIndex(4);
343
         $spreadsheet->getActiveSheet()->setTitle("Resultado del Procedimiento");
405
         $spreadsheet->getActiveSheet()->setTitle("Resultado del Procedimiento");
344
 
406
 
345
-        $datos = $this->Xlsexport_model->getTenderResult("maestro_tender_result");
346
         if ($datos['num_rows'] > 0) {
407
         if ($datos['num_rows'] > 0) {
347
             $aux = 2;
408
             $aux = 2;
409
+            $contador = 0;
348
             foreach ($datos['datos'] as $datos) {
410
             foreach ($datos['datos'] as $datos) {
411
+                guardar_log("Excel", "Escribir tender result--" . $contador);
412
+                $contador++;
349
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
413
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
350
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['resultCode']);
414
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['resultCode']);
351
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
415
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
368
         return $spreadsheet;
432
         return $spreadsheet;
369
     }
433
     }
370
 
434
 
371
-    private function datosCompletosTipoProcedimiento($spreadsheet)
435
+    private function datosCompletosTipoProcedimiento($spreadsheet, $datos)
372
     {
436
     {
373
         $spreadsheet->setActiveSheetIndex(5);
437
         $spreadsheet->setActiveSheetIndex(5);
374
         $spreadsheet->getActiveSheet()->setTitle("Tipo Procedimiento");
438
         $spreadsheet->getActiveSheet()->setTitle("Tipo Procedimiento");
375
 
439
 
376
-        $datos = $this->Xlsexport_model->getTenderProcessRelacion();
440
+        //$datos = $this->Xlsexport_model->getTenderProcessRelacion();
377
         if ($datos['num_rows'] > 0) {
441
         if ($datos['num_rows'] > 0) {
378
             $aux = 2;
442
             $aux = 2;
443
+            $contador = 0;
379
             foreach ($datos['datos'] as $datos) {
444
             foreach ($datos['datos'] as $datos) {
445
+                guardar_log("Excel", "Escribir tender process--" . $contador);
446
+                $contador++;
380
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
447
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
381
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['procedureCode']);
448
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['procedureCode']);
382
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['urgencyCode']);
449
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['urgencyCode']);
400
         return $spreadsheet;
467
         return $spreadsheet;
401
     }
468
     }
402
 
469
 
403
-    private function datosCompletosOfertas($spreadsheet)
470
+    private function datosCompletosOfertas($spreadsheet, $datos)
404
     {
471
     {
405
         $spreadsheet->setActiveSheetIndex(6);
472
         $spreadsheet->setActiveSheetIndex(6);
406
         $spreadsheet->getActiveSheet()->setTitle("Ofertas");
473
         $spreadsheet->getActiveSheet()->setTitle("Ofertas");
407
 
474
 
408
-        $datos = $this->Xlsexport_model->getTenderingTermsGarantia("maestro_tendering_terms");
409
         if ($datos['num_rows'] > 0) {
475
         if ($datos['num_rows'] > 0) {
410
             $aux = 2;
476
             $aux = 2;
477
+            $contador = 0;
411
             foreach ($datos['datos'] as $datos) {
478
             foreach ($datos['datos'] as $datos) {
479
+                guardar_log("Excel", "Escribir tender process--" . $contador);
480
+                $contador++;
412
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
481
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
413
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['requiredCurriculaIndicator']);
482
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['requiredCurriculaIndicator']);
414
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['variantConstraintIndicator']);
483
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['variantConstraintIndicator']);
427
         return $spreadsheet;
496
         return $spreadsheet;
428
     }
497
     }
429
 
498
 
430
-    private function datosCriterioAdjudicacion($spreadsheet)
499
+    private function datosCriterioAdjudicacion($spreadsheet, $datos)
431
     {
500
     {
432
         $spreadsheet->setActiveSheetIndex(7);
501
         $spreadsheet->setActiveSheetIndex(7);
433
         $spreadsheet->getActiveSheet()->setTitle("Criterio Adjudicación");
502
         $spreadsheet->getActiveSheet()->setTitle("Criterio Adjudicación");
434
 
503
 
435
-        /*$datos = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("maestro_tendering_terms_awarding_terms", "maestro_tendering_terms", "id_ajena_tt");
504
+        //$datos = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("maestro_tendering_terms_awarding_terms", "maestro_tendering_terms", "id_ajena_tt");
436
         if ($datos['num_rows'] > 0) {
505
         if ($datos['num_rows'] > 0) {
437
-        $aux = 2;
438
-
439
-        foreach ($datos['datos'] as $datos) {
440
-        $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_tt']);
441
-        $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
442
-        $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['description']);
443
-        $aux++;
506
+            $aux = 2;
507
+            $contador = 0;
508
+            foreach ($datos['datos'] as $datos) {
509
+                guardar_log("Excel", "Escribir criterio adjucicacion--" . $contador);
510
+                $contador++;
511
+                $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
512
+                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
513
+                $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['description']);
514
+                $aux++;
515
+            }
444
         }
516
         }
445
-        }*/
446
 
517
 
447
         return $spreadsheet;
518
         return $spreadsheet;
448
     }
519
     }
449
 
520
 
450
-    private function datosCriterioEvaluacionFinanciera($spreadsheet)
521
+    private function datosCriterioEvaluacionFinanciera($spreadsheet, $datos)
451
     {
522
     {
452
         $spreadsheet->setActiveSheetIndex(8);
523
         $spreadsheet->setActiveSheetIndex(8);
453
         $spreadsheet->getActiveSheet()->setTitle("CriteriosEvaluacionFinanciera");
524
         $spreadsheet->getActiveSheet()->setTitle("CriteriosEvaluacionFinanciera");
454
 
525
 
455
-        $datos = $this->Xlsexport_model->getTenderingTermsCriteriosFinanciacion();
526
+        //$datos = $this->Xlsexport_model->getTenderingTermsCriteriosFinanciacion();
456
         if ($datos['num_rows'] > 0) {
527
         if ($datos['num_rows'] > 0) {
457
             $aux = 2;
528
             $aux = 2;
529
+            $contador = 0;
458
             foreach ($datos['datos'] as $datos) {
530
             foreach ($datos['datos'] as $datos) {
531
+                guardar_log("Excel", "Escribir criterios evaluacion financiera--" . $contador);
532
+                $contador++;
459
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
533
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
460
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
534
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
461
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
535
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
465
         return $spreadsheet;
539
         return $spreadsheet;
466
     }
540
     }
467
 
541
 
468
-    private function datosCriterioEvaluacionTecnica($spreadsheet)
542
+    private function datosCriterioEvaluacionTecnica($spreadsheet, $datos)
469
     {
543
     {
470
         $spreadsheet->setActiveSheetIndex(9);
544
         $spreadsheet->setActiveSheetIndex(9);
471
         $spreadsheet->getActiveSheet()->setTitle("Criterios Evaluación Técnica");
545
         $spreadsheet->getActiveSheet()->setTitle("Criterios Evaluación Técnica");
472
 
546
 
473
-        $datos = $this->Xlsexport_model->getTenderingTermsCriteriosTecnicos();
547
+        //$datos = $this->Xlsexport_model->getTenderingTermsCriteriosTecnicos();
474
         if ($datos['num_rows'] > 0) {
548
         if ($datos['num_rows'] > 0) {
475
             $aux = 2;
549
             $aux = 2;
550
+            $contador = 0;
476
             foreach ($datos['datos'] as $datos) {
551
             foreach ($datos['datos'] as $datos) {
552
+                guardar_log("Excel", "Escribir criterio evaluacion tecnica--" . $contador);
553
+                $contador++;
477
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
554
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
478
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
555
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
479
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
556
                 $spreadsheet->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
484
         return $spreadsheet;
561
         return $spreadsheet;
485
     }
562
     }
486
 
563
 
487
-    private function datosRequisitosParticipacion($spreadsheet)
564
+    private function datosRequisitosParticipacion($spreadsheet, $datos)
488
     {
565
     {
489
         $spreadsheet->setActiveSheetIndex(10);
566
         $spreadsheet->setActiveSheetIndex(10);
490
         $spreadsheet->getActiveSheet()->setTitle("Requisitos Participación");
567
         $spreadsheet->getActiveSheet()->setTitle("Requisitos Participación");
491
 
568
 
492
-        $datos = $this->Xlsexport_model->getTenderingTermsRequisitos();
569
+        //$datos = $this->Xlsexport_model->getTenderingTermsRequisitos();
493
         if ($datos['num_rows'] > 0) {
570
         if ($datos['num_rows'] > 0) {
494
             $aux = 2;
571
             $aux = 2;
572
+            $contador = 0;
495
             foreach ($datos['datos'] as $datos) {
573
             foreach ($datos['datos'] as $datos) {
574
+                guardar_log("Excel", "Escribir requisitos participacion--" . $contador);
575
+                $contador++;
496
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
576
                 $spreadsheet->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
497
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
577
                 $spreadsheet->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
498
                 $aux++;
578
                 $aux++;
507
 
587
 
508
         $spreadsheet->setActiveSheetIndex(11);
588
         $spreadsheet->setActiveSheetIndex(11);
509
         $spreadsheet->getActiveSheet()->setTitle("Documentos Generales");
589
         $spreadsheet->getActiveSheet()->setTitle("Documentos Generales");
510
-        foreach ($datosLicitacion['generalDocs'] as $doc) {
590
+        $contador = 0;
591
+        foreach ($datosLicitacion['datos'] as $doc) {
592
+            guardar_log("Excel", "Escribir documentos generales--" . $contador);
593
+            $contador++;
511
             $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoGeneral, $doc['id_ajena_licitacion']);
594
             $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoGeneral, $doc['id_ajena_licitacion']);
512
             $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoGeneral, $doc['attachment']);
595
             $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoGeneral, $doc['attachment']);
513
             $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoGeneral, $doc['fileName']);
596
             $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoGeneral, $doc['fileName']);
523
     {
606
     {
524
         $spreadsheet->setActiveSheetIndex(12);
607
         $spreadsheet->setActiveSheetIndex(12);
525
         $spreadsheet->getActiveSheet()->setTitle("Documentos Adicionales");
608
         $spreadsheet->getActiveSheet()->setTitle("Documentos Adicionales");
526
-        foreach ($datosLicitacion['additDocs'] as $doc) {
609
+        $contador = 0;
610
+        foreach ($datosLicitacion['datos'] as $doc) {
611
+            guardar_log("Excel", "Escribir documentos adicionales--" . $contador);
612
+            $contador++;
527
             $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoAdd, $doc['id_ajena_licitacion']);
613
             $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoAdd, $doc['id_ajena_licitacion']);
528
             $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoAdd, $doc['attachment']);
614
             $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoAdd, $doc['attachment']);
529
             $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoAdd, $doc['idDoc']);
615
             $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoAdd, $doc['idDoc']);
538
     {
624
     {
539
         $spreadsheet->setActiveSheetIndex(13);
625
         $spreadsheet->setActiveSheetIndex(13);
540
         $spreadsheet->getActiveSheet()->setTitle("Documentos Técnicos");
626
         $spreadsheet->getActiveSheet()->setTitle("Documentos Técnicos");
541
-        foreach ($datosLicitacion['techDocs'] as $doc) {
627
+        $contador = 0;
628
+        foreach ($datosLicitacion['datos'] as $doc) {
629
+            guardar_log("Excel", "Escribir documentos tecnicos--" . $contador);
630
+            $contador++;
542
             $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoTech, $doc['id_ajena_licitacion']);
631
             $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoTech, $doc['id_ajena_licitacion']);
543
             $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoTech, $doc['attachment']);
632
             $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoTech, $doc['attachment']);
544
             $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoTech, $doc['idDoc']);
633
             $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoTech, $doc['idDoc']);
553
     {
642
     {
554
         $spreadsheet->setActiveSheetIndex(14);
643
         $spreadsheet->setActiveSheetIndex(14);
555
         $spreadsheet->getActiveSheet()->setTitle("Documentos Legales");
644
         $spreadsheet->getActiveSheet()->setTitle("Documentos Legales");
556
-        foreach ($datosLicitacion['legalDocs'] as $doc) {
645
+        $contador = 0;
646
+        foreach ($datosLicitacion['datos'] as $doc) {
647
+            guardar_log("Excel", "Escribir documentos legales--" . $contador);
648
+            $contador++;
557
             $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoLegal, $doc['id_ajena_licitacion']);
649
             $spreadsheet->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoLegal, $doc['id_ajena_licitacion']);
558
             $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoLegal, $doc['attachment']);
650
             $spreadsheet->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoLegal, $doc['attachment']);
559
             $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoLegal, $doc['idDoc']);
651
             $spreadsheet->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoLegal, $doc['idDoc']);
577
         $spreadsheet->getActiveSheet()->SetCellValue('H1', "Objeto del Contrato");
669
         $spreadsheet->getActiveSheet()->SetCellValue('H1', "Objeto del Contrato");
578
         $spreadsheet->getActiveSheet()->SetCellValue('I1', "Valor estimado del contrato");
670
         $spreadsheet->getActiveSheet()->SetCellValue('I1', "Valor estimado del contrato");
579
         $spreadsheet->getActiveSheet()->SetCellValue('J1', "Presupuesto base sin impuestos");
671
         $spreadsheet->getActiveSheet()->SetCellValue('J1', "Presupuesto base sin impuestos");
580
-        $spreadsheet->getActiveSheet()->SetCellValue('K1', "Presupuesto base con impuestos");
581
-        $spreadsheet->getActiveSheet()->SetCellValue('L1', "CPV");
582
-        $spreadsheet->getActiveSheet()->SetCellValue('M1', "Tipo de contrato");
583
-        $spreadsheet->getActiveSheet()->SetCellValue('N1', "Lugar de ejecución");
584
-        $spreadsheet->getActiveSheet()->SetCellValue('O1', "Órgano de Contratación");
585
-        $spreadsheet->getActiveSheet()->SetCellValue('P1', "ID OC en PLACSP");
586
-        $spreadsheet->getActiveSheet()->SetCellValue('Q1', "NIF OC");
587
-        $spreadsheet->getActiveSheet()->SetCellValue('R1', "DIR3");
588
-        $spreadsheet->getActiveSheet()->SetCellValue('S1', "Enlace al Perfil de Contratante del OC");
589
-        $spreadsheet->getActiveSheet()->SetCellValue('T1', "Tipo de Administración");
590
-        $spreadsheet->getActiveSheet()->SetCellValue('U1', "Código Postal");
591
-        $spreadsheet->getActiveSheet()->SetCellValue('V1', "Tipo de procedimiento");
592
-        $spreadsheet->getActiveSheet()->SetCellValue('W1', "Sistema de contratación");
593
-        $spreadsheet->getActiveSheet()->SetCellValue('X1', "Tramitación");
594
-        $spreadsheet->getActiveSheet()->SetCellValue('Y1', "Forma de presentación de la oferta");
595
-        $spreadsheet->getActiveSheet()->SetCellValue('Z1', "Directiva de aplicación");
596
-        $spreadsheet->getActiveSheet()->SetCellValue('AA1', "Subcontratación permitida");
597
-        $spreadsheet->getActiveSheet()->SetCellValue('AB1', "Duración Contrato");
598
-        $spreadsheet->getActiveSheet()->SetCellValue('AC1', "Tipo de duración");
599
-        $spreadsheet->getActiveSheet()->SetCellValue('AD1', "Inicio contrato");
600
-        $spreadsheet->getActiveSheet()->SetCellValue('AE1', "Fin contrato");
601
-        $spreadsheet->getActiveSheet()->SetCellValue('AF1', "Extension Contrato");
602
-        $spreadsheet->getActiveSheet()->SetCellValue('AG1', "URL Organo Contratación");
603
-        $spreadsheet->getActiveSheet()->SetCellValue('AH1', "Ciudad Organo Contratación");
604
-        $spreadsheet->getActiveSheet()->SetCellValue('AI1', "Dirección Organo Contratación");
605
-        $spreadsheet->getActiveSheet()->SetCellValue('AJ1', "Nombre Contacto Organo Contratación");
606
-        $spreadsheet->getActiveSheet()->SetCellValue('AK1', "Email contacto Organo Contratación");
672
+        $spreadsheet->getActiveSheet()->SetCellValue('K1', "CPV");
673
+        $spreadsheet->getActiveSheet()->SetCellValue('L1', "Tipo de contrato");
674
+        $spreadsheet->getActiveSheet()->SetCellValue('M1', "Lugar de ejecución");
675
+        $spreadsheet->getActiveSheet()->SetCellValue('N1', "Órgano de Contratación");
676
+        $spreadsheet->getActiveSheet()->SetCellValue('O1', "ID OC en PLACSP");
677
+        $spreadsheet->getActiveSheet()->SetCellValue('P1', "NIF OC");
678
+        $spreadsheet->getActiveSheet()->SetCellValue('Q1', "DIR3");
679
+        $spreadsheet->getActiveSheet()->SetCellValue('R1', "Enlace al Perfil de Contratante del OC");
680
+        $spreadsheet->getActiveSheet()->SetCellValue('S1', "Tipo de Administración");
681
+        $spreadsheet->getActiveSheet()->SetCellValue('T1', "Código Postal");
682
+        $spreadsheet->getActiveSheet()->SetCellValue('U1', "Tipo de procedimiento");
683
+        $spreadsheet->getActiveSheet()->SetCellValue('V1', "Sistema de contratación");
684
+        $spreadsheet->getActiveSheet()->SetCellValue('W1', "Tramitación");
685
+        $spreadsheet->getActiveSheet()->SetCellValue('X1', "Forma de presentación de la oferta");
686
+        $spreadsheet->getActiveSheet()->SetCellValue('Y1', "Directiva de aplicación");
687
+        $spreadsheet->getActiveSheet()->SetCellValue('Z1', "Subcontratación permitida");
688
+        $spreadsheet->getActiveSheet()->SetCellValue('AA1', "Duración Contrato");
689
+        $spreadsheet->getActiveSheet()->SetCellValue('AB1', "Tipo de duración");
690
+        $spreadsheet->getActiveSheet()->SetCellValue('AC1', "Inicio contrato");
691
+        $spreadsheet->getActiveSheet()->SetCellValue('AD1', "Fin contrato");
692
+        $spreadsheet->getActiveSheet()->SetCellValue('AE1', "Extension Contrato");
693
+        $spreadsheet->getActiveSheet()->SetCellValue('AF1', "URL Organo Contratación");
694
+        $spreadsheet->getActiveSheet()->SetCellValue('AG1', "Ciudad Organo Contratación");
695
+        $spreadsheet->getActiveSheet()->SetCellValue('AH1', "Dirección Organo Contratación");
696
+        $spreadsheet->getActiveSheet()->SetCellValue('AI1', "Nombre Contacto Organo Contratación");
697
+        $spreadsheet->getActiveSheet()->SetCellValue('AJ1', "Email contacto Organo Contratación");
607
         return $spreadsheet;
698
         return $spreadsheet;
608
     }
699
     }
609
 
700
 
628
         $spreadsheet->getActiveSheet()->SetCellValue('D1', "Importe sin Impuestos");
719
         $spreadsheet->getActiveSheet()->SetCellValue('D1', "Importe sin Impuestos");
629
         $spreadsheet->getActiveSheet()->SetCellValue('E1', "Importe con Impuestos");
720
         $spreadsheet->getActiveSheet()->SetCellValue('E1', "Importe con Impuestos");
630
         $spreadsheet->getActiveSheet()->SetCellValue('F1', "Lugar de ejecución del lote");
721
         $spreadsheet->getActiveSheet()->SetCellValue('F1', "Lugar de ejecución del lote");
631
-        $spreadsheet->getActiveSheet()->SetCellValue('G1', "Codigo de ejecución del lote");
632
-        $spreadsheet->getActiveSheet()->SetCellValue('H1', "Ciudad de ejecución del lote");
633
-        $spreadsheet->getActiveSheet()->SetCellValue('I1', "CPV Project Lot");
634
 
722
 
635
         return $spreadsheet;
723
         return $spreadsheet;
636
     }
724
     }

+ 3 - 26
application/libraries/ParserFile.php Vedi File

390
                                 "id_compuesta_padre" => $this->idLicitacion . "_05_" . $i,
390
                                 "id_compuesta_padre" => $this->idLicitacion . "_05_" . $i,
391
                                 "fecha_creacion_log" => $this->fechaInicioParser,
391
                                 "fecha_creacion_log" => $this->fechaInicioParser,
392
                                 "id_attr" => $this->existAttribute($xmlPrimitivo->ContractFolderStatus->ProcurementProjectLot->RequiredCommodityClassification, "ItemClassificationCode", "string", 'listURI'),
392
                                 "id_attr" => $this->existAttribute($xmlPrimitivo->ContractFolderStatus->ProcurementProjectLot->RequiredCommodityClassification, "ItemClassificationCode", "string", 'listURI'),
393
-                                //$resultEntries["itemClassification"][$i]['itemClassification'][$j]['id_attr'] = $this->existAttribute($clasificacionItems[$j], "ItemClassificationCode", "string", 'listURI');
394
                             );
393
                             );
395
                         }
394
                         }
396
                     }
395
                     }
665
                 $resultEntries['noticeInfo'][$i]['noticeTypeCode'] = $this->existNodo($validNoticeInfo[$i], 'NoticeTypeCode', 'string');
664
                 $resultEntries['noticeInfo'][$i]['noticeTypeCode'] = $this->existNodo($validNoticeInfo[$i], 'NoticeTypeCode', 'string');
666
                 $resultEntries['noticeInfo'][$i]['id_ajena_licitacion'] = $this->idLicitacion;
665
                 $resultEntries['noticeInfo'][$i]['id_ajena_licitacion'] = $this->idLicitacion;
667
                 $resultEntries['noticeInfo'][$i]['id_compuesta'] = $this->idLicitacion . "_12_" . $i;
666
                 $resultEntries['noticeInfo'][$i]['id_compuesta'] = $this->idLicitacion . "_12_" . $i;
667
+                $resultEntries['noticeInfo'][$i]['fecha_creacion_log'] = $this->fechaInicioParser;
668
 
668
 
669
                 if (array_key_exists("AdditionalPublicationStatus", $validNoticeInfo[$i])) {
669
                 if (array_key_exists("AdditionalPublicationStatus", $validNoticeInfo[$i])) {
670
                     $AdditionalPublicationStatus = $validNoticeInfo[$i]['AdditionalPublicationStatus'];
670
                     $AdditionalPublicationStatus = $validNoticeInfo[$i]['AdditionalPublicationStatus'];
689
                                     $resultEntries['fechas'][$x]['id_ajena_licitacion'] = $this->idLicitacion;
689
                                     $resultEntries['fechas'][$x]['id_ajena_licitacion'] = $this->idLicitacion;
690
                                     $resultEntries['fechas'][$x]['id_compuesta'] = $this->idLicitacion . "_12_" . $i . "_" . $j . "_" . $x;
690
                                     $resultEntries['fechas'][$x]['id_compuesta'] = $this->idLicitacion . "_12_" . $i . "_" . $j . "_" . $x;
691
                                     $resultEntries['fechas'][$x]['id_compuesta_padre'] = $this->idLicitacion . "_12_" . $i;
691
                                     $resultEntries['fechas'][$x]['id_compuesta_padre'] = $this->idLicitacion . "_12_" . $i;
692
+                                    $resultEntries['fechas'][$x]['fecha_creacion_log'] = $this->fechaInicioParser;
692
                                 }
693
                                 }
693
 
694
 
694
                                 if (array_key_exists("DocumentTypeCode", $additionalPublicationDocument[$x])) {
695
                                 if (array_key_exists("DocumentTypeCode", $additionalPublicationDocument[$x])) {
698
                                     $resultEntries['documento'][$x]['id_ajena_licitacion'] = $this->idLicitacion;
699
                                     $resultEntries['documento'][$x]['id_ajena_licitacion'] = $this->idLicitacion;
699
                                     $resultEntries['documento'][$x]['id_compuesta'] = $this->idLicitacion . "_12_" . $i . "_" . $j . "_" . $x;
700
                                     $resultEntries['documento'][$x]['id_compuesta'] = $this->idLicitacion . "_12_" . $i . "_" . $j . "_" . $x;
700
                                     $resultEntries['documento'][$x]['id_compuesta_padre'] = $this->idLicitacion . "_12_" . $i;
701
                                     $resultEntries['documento'][$x]['id_compuesta_padre'] = $this->idLicitacion . "_12_" . $i;
702
+                                    $resultEntries['documento'][$x]['fecha_creacion_log'] = $this->fechaInicioParser;
701
                                 }
703
                                 }
702
                             }
704
                             }
703
                         }
705
                         }
704
                         unset($additionalPublicationDocument);
706
                         unset($additionalPublicationDocument);
705
                     }
707
                     }
706
-
707
-                    /*$firstKey = array_key_first($additionalPublicationDocument['AdditionalPublicationDocumentReference']);
708
-                if ($firstKey !== 0) {
709
-                $additionalPublicationDocument['AdditionalPublicationDocumentReference'] = array(0 => $additionalPublicationDocument['AdditionalPublicationDocumentReference']);
710
-                }
711
-                for ($j = 0; $j < count($additionalPublicationDocument['AdditionalPublicationDocumentReference']); $j++) {
712
-
713
-                $firstKey = array_key_first($additionalPublicationDocument['AdditionalPublicationDocumentReference']);
714
-
715
-                if ($additionalPublicationDocument['AdditionalPublicationDocumentReference'][$j]['IssueDate']) {
716
-                $resultEntries[$i]['fechas'][$j]['fechas'] = $this->existNodo($additionalPublicationDocument['AdditionalPublicationDocumentReference'][$j], 'IssueDate', 'string');
717
-                $resultEntries[$i]['fechas'][$j]['id_ajena_licitacion'] = $this->idLicitacion;
718
-                $resultEntries[$i]['fechas'][$j]['id_compuesta'] = $this->idLicitacion . "_12_" . $i . "_" . $j;
719
-                $resultEntries[$i]['fechas'][$j]['id_compuesta_padre'] = $this->idLicitacion . "_12_" . $i;
720
-                }
721
-
722
-                if ($additionalPublicationDocument['AdditionalPublicationDocumentReference'][$j]['DocumentTypeCode']) {
723
-                $resultEntries[$i]['documento'][$j]['documento'] = $this->existNodo($additionalPublicationDocument['AdditionalPublicationDocumentReference'][$j]['Attachment']['ExternalReference'], 'URI', 'string');
724
-                $resultEntries[$i]['documento'][$j]['filename'] = $this->existNodo($additionalPublicationDocument['AdditionalPublicationDocumentReference'][$j]['Attachment']['ExternalReference'], 'FileName', 'string');
725
-                $resultEntries[$i]['documento'][$j]['id_ajena_licitacion'] = $this->idLicitacion;
726
-                $resultEntries[$i]['documento'][$j]['id_compuesta'] = $this->idLicitacion . "_12_" . $i . "_" . $j;
727
-                $resultEntries[$i]['documento'][$j]['id_compuesta_padre'] = $this->idLicitacion . "_12_" . $i;
728
-                }
729
-                }*/
730
                 }
708
                 }
731
             }
709
             }
732
         }
710
         }
733
 
711
 
734
         unset($AdditionalPublicationStatus);
712
         unset($AdditionalPublicationStatus);
735
         unset($validNoticeInfo);
713
         unset($validNoticeInfo);
736
-        //$resultFinal = $this->checkArrayValuesEmpty($resultEntries);
737
         return $resultEntries;
714
         return $resultEntries;
738
     }
715
     }
739
 
716
 

+ 77 - 18
application/models/Xlsexport_model.php Vedi File

48
                     MP.direccion,
48
                     MP.direccion,
49
                     MP.contact_name,
49
                     MP.contact_name,
50
                     MP.contact_email,
50
                     MP.contact_email,
51
-                    PROJ.NAME as name,
51
+                    MPI.idPartyIdent AS partyItem,
52
+                    MPI.attr as tipoIdParty,
53
+                    PROJ.NAME as nameProject,
52
                     PROJ.estimatedOverallContractAmount,
54
                     PROJ.estimatedOverallContractAmount,
53
                     PROJ.taxExclusiveAmount,
55
                     PROJ.taxExclusiveAmount,
54
                     PROJ.totalAmount,
56
                     PROJ.totalAmount,
70
                     RTPU.nombre AS urgency,
72
                     RTPU.nombre AS urgency,
71
                     LI.fecha_creacion_log
73
                     LI.fecha_creacion_log
72
                 FROM
74
                 FROM
73
-                    maestro_datos_iniciales_licitacion LI
74
-                    JOIN import_licitaciones_temp temp ON LI.id_licitacion = temp.id_licitacion
75
-                    LEFT JOIN maestro_contract_folder CF ON CF.id_ajena_licitacion = LI.id_licitacion
76
-                    LEFT JOIN maestro_located_contracting_party LP ON LP.id_ajena_licitacion = LI.id_licitacion
77
-                    LEFT JOIN maestro_party MP ON MP.id_ajena_licitacion = LI.id_licitacion
78
-                    LEFT JOIN maestro_procurement_project PROJ ON PROJ.id_ajena_licitacion = LI.id_licitacion
79
-                    LEFT JOIN maestro_procurement_project_itemclass PROJI ON PROJI.id_ajena_licitacion = LI.id_licitacion
80
-                    LEFT JOIN maestro_tendering_process TP ON TP.id_ajena_licitacion = LI.id_licitacion
81
-                    LEFT JOIN maestro_tendering_terms TT ON TT.id_ajena_licitacion = LI.id_licitacion
82
-                    LEFT JOIN relacionada_contract_status RCF ON RCF.CODE = CF.contractFolderStatusCode
83
-                    LEFT JOIN relacionada_located_contracting_party RLP ON RLP.CODE = LP.contractingPartyTypeCode
84
-                    LEFT JOIN relacionada_tipo_contrato TPC ON TPC.CODE = PROJ.typeCode
85
-                    LEFT JOIN relacionada_tender_process RTP ON RTP.CODE = TP.procedureCode
86
-                    LEFT JOIN relacionada_tender_process_contracting_code RTPC ON RTPC.CODE = TP.contractingSystemCode
87
-                    LEFT JOIN relacionada_tender_process_submission RTPS ON RTPS.CODE = TP.submissionMethodCode
88
-                    LEFT JOIN relacionada_tender_process_urgency_code RTPU ON RTPU.CODE = TP.urgencyCode /*WHERE
75
+                maestro_datos_iniciales_licitacion LI
76
+                JOIN maestro_contract_folder CF ON CF.id_ajena_licitacion = LI.id_licitacion
77
+                JOIN maestro_located_contracting_party LP ON LP.id_ajena_licitacion = LI.id_licitacion
78
+                JOIN maestro_party MP ON MP.id_ajena_licitacion = LI.id_licitacion
79
+                JOIN maestro_party_party_idenfitication MPI on MPI.id_ajena_licitacion = LI.id_licitacion AND MPI.attr = 'DIR3'
80
+                JOIN maestro_procurement_project PROJ ON PROJ.id_ajena_licitacion = LI.id_licitacion
81
+                JOIN maestro_procurement_project_itemclass PROJI ON PROJI.id_ajena_licitacion = LI.id_licitacion
82
+                JOIN maestro_tendering_process TP ON TP.id_ajena_licitacion = LI.id_licitacion
83
+                JOIN maestro_tendering_terms TT ON TT.id_ajena_licitacion = LI.id_licitacion
84
+                JOIN relacionada_contract_status RCF ON RCF.CODE = CF.contractFolderStatusCode
85
+                JOIN relacionada_located_contracting_party RLP ON RLP.CODE = LP.contractingPartyTypeCode
86
+                JOIN relacionada_tipo_contrato TPC ON TPC.CODE = PROJ.typeCode
87
+                JOIN relacionada_tender_process RTP ON RTP.CODE = TP.procedureCode
88
+                JOIN relacionada_tender_process_contracting_code RTPC ON RTPC.CODE = TP.contractingSystemCode
89
+                JOIN relacionada_tender_process_submission RTPS ON RTPS.CODE = TP.submissionMethodCode
90
+                JOIN relacionada_tender_process_urgency_code RTPU ON RTPU.CODE = TP.urgencyCode /*WHERE
89
                 LI.id < 17174 */
91
                 LI.id < 17174 */
90
 
92
 
91
                 GROUP BY
93
                 GROUP BY
99
         return $datos;
101
         return $datos;
100
     }
102
     }
101
 
103
 
104
+    public function getFullDatosUltimasInsertadas()
105
+    {
106
+        $sql = "SELECT *
107
+                FROM
108
+                vista_datos_licitacion";
109
+        $result = $this->db->query($sql);
110
+        $datos['datos'] = $result->result();
111
+        $datos['num_rows'] = $result->num_rows();
112
+        return $datos;
113
+    }
114
+
115
+    public function getTablaByFechaLog($tabla)
116
+    {
117
+        $sql = "SELECT * FROM $tabla
118
+                WHERE fecha_creacion_log = '2022-02-24 14:38:36'";
119
+        $result = $this->db->query($sql);
120
+        $datos['datos'] = $result->result_array();
121
+        $datos['num_rows'] = $result->num_rows();
122
+        return $datos;
123
+    }
124
+
125
+    public function getProjectLotItem()
126
+    {
127
+        $sql = "SELECT
128
+                    MP.idProcurementLot,
129
+                    MP.countrySubentity,
130
+                    MP.countrySubentityCode,
131
+                    MP.totalAmount,
132
+                    MP.taxExclusiveAmount,
133
+                    MP.`name`,
134
+                    MP.id_ajena_licitacion,
135
+                    GROUP_CONCAT( MPI.idItem ) AS itemClassification_attr
136
+
137
+                FROM
138
+                    maestro_procurement_project_lot MP
139
+                    JOIN maestro_procurement_project_lot_item MPI ON MP.id_compuesta = MPI.id_compuesta_padre
140
+                WHERE
141
+                    MPI.fecha_creacion_log = '2022-02-24 14:38:36'
142
+                    GROUP BY
143
+                    MP.id_compuesta";
144
+        $result = $this->db->query($sql);
145
+        $datos['datos'] = $result->result_array();
146
+        $datos['num_rows'] = $result->num_rows();
147
+        return $datos;
148
+    }
149
+
150
+    public function getFechasPublicadas($idLicitacion)
151
+    {
152
+        $sql = "SELECT MIN(fechas) as fecha
153
+                FROM
154
+                maestro_valid_notice_info_fecha WHERE id_ajena_licitacion = '$idLicitacion'";
155
+        $result = $this->db->query($sql);
156
+        $datos['datos'] = $result->row();
157
+        $datos['num_rows'] = $result->num_rows();
158
+        return $datos;
159
+    }
160
+
102
     public function getDatosByTablaAndLicitacion($tabla, $licitacionID)
161
     public function getDatosByTablaAndLicitacion($tabla, $licitacionID)
103
     {
162
     {
104
         $sql = "SELECT *
163
         $sql = "SELECT *
262
                     *
321
                     *
263
                 FROM
322
                 FROM
264
                     maestro_procurement_project_lot_item
323
                     maestro_procurement_project_lot_item
265
-                WHERE id_ajena_ppl = $projectLotId";
324
+                WHERE id_compuesta_padre = '$projectLotId'";
266
         $result = $this->db->query($sql);
325
         $result = $this->db->query($sql);
267
         $datos['datos'] = $result->result_array();
326
         $datos['datos'] = $result->result_array();
268
         $datos['num_rows'] = $result->num_rows();
327
         $datos['num_rows'] = $result->num_rows();