Преглед на файлове

exportar excel con todos los datos actuales en nuestro sistema

Nermosis преди 3 години
родител
ревизия
bea44c11e3
променени са 3 файла, в които са добавени 607 реда и са изтрити 294 реда
  1. 533 67
      application/controllers/ExportXls.php
  2. 74 227
      application/models/Xlsexport_model.php
  3. BIN
      test.xlsx

+ 533 - 67
application/controllers/ExportXls.php Целия файл

@@ -19,6 +19,11 @@ defined('BASEPATH') or exit('No direct script access allowed');
19 19
 
20 20
 class ExportXls extends CI_Controller
21 21
 {
22
+    private $filaDocumentoGeneral = 2;
23
+    private $filaDocumentoTech = 2;
24
+    private $filaDocumentoAdd = 2;
25
+    private $filaDocumentoLegal = 2;
26
+    private $filaProjectLot = 2;
22 27
 
23 28
     public function __construct()
24 29
     {
@@ -34,74 +39,65 @@ class ExportXls extends CI_Controller
34 39
 
35 40
         //$start = $this->starttime();
36 41
         if ($licitacionesResult['num_rows'] > 0) {
37
-            foreach ($licitacionesResult['datos'] as $licitacion) {
38
-                $result[$licitacion->id]['licitacion'] = $licitacion;
39
-                $result[$licitacion->id]['contract'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_contract_folder", $licitacion->id);
40
-                $result[$licitacion->id]['locatedParty'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_located_contracting_party", $licitacion->id);
41
-                $result[$licitacion->id]['party'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_party", $licitacion->id);
42
-                foreach ($result[$licitacion->id]['party'] as $row) {
43
-                    $result[$licitacion->id]['partyActivity'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_party_party_idenfitication", "id_ajena_party", $row['id']);
44
-                }
45
-
46
-                $result[$licitacion->id]['project'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_procurement_project", $licitacion->id);
47
-                foreach ($result[$licitacion->id]['project'] as $row) {
48
-                    $result[$licitacion->id]['projectActivity'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_procurement_project_itemClass", "id_ajena_pp", $row['id']);
49
-                }
50
-
51
-                $result[$licitacion->id]['projectLot'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_procurement_project_lot", $licitacion->id);
52
-                foreach ($result[$licitacion->id]['projectLot'] as $row) {
53
-                    $result[$licitacion->id]['projectLotActivity'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_procurement_project_lot_item", "id_ajena_ppl", $row['id']);
54
-                }
55
-
56
-                $result[$licitacion->id]['tenderResult'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_tender_result", $licitacion->id);
57
-                $result[$licitacion->id]['tenderProcess'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_tendering_process", $licitacion->id);
58
-                $result[$licitacion->id]['tenderTerms'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_tendering_terms", $licitacion->id);
59
-                foreach ($result[$licitacion->id]['tenderTerms'] as $row) {
60
-                    $result[$licitacion->id]['tenderTermsAwarding'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_tendering_terms_awarding_terms", "id_ajena_tt", $row['id']);
61
-                    $result[$licitacion->id]['tenderTermsFinancial'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_tendering_terms_financial_evaluation", "id_ajena_ttfe", $row['id']);
62
-                    $result[$licitacion->id]['tenderTermsQualification'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_tendering_terms_qualification_request", "id_ajena_tt", $row['id']);
63
-                    $result[$licitacion->id]['tenderTermsSpecific'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_tendering_terms_specific_terms", "id_ajena_tt", $row['id']);
64
-                }
65
-
66
-                $result[$licitacion->id]['validNoticeInfo'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_valid_notice_info", $licitacion->id);
67
-                foreach ($result[$licitacion->id]['validNoticeInfo'] as $row) {
68
-                    $result[$licitacion->id]['validNoticeInfoDocument'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_valid_notice_info_documento", "id_ajena_vni", $row['id']);
69
-                    $result[$licitacion->id]['validNoticeInfoFecha'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_valid_notice_info_fecha", "id_ajena_vni", $row['id']);
70
-                }
71
-
72
-                $result[$licitacion->id]['techDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_technical_documents", $licitacion->id);
73
-                $result[$licitacion->id]['legalDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_legal_documents", $licitacion->id);
74
-                $result[$licitacion->id]['generalDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_general_documents", $licitacion->id);
75
-                $result[$licitacion->id]['additDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_additional_documents", $licitacion->id);
76
-            }
42
+            $result = $this->mapearDatos($licitacionesResult);
77 43
         }
78 44
         //echo ($this->endtime($start));
79
-        //pretty_dump($result);
80
-
81 45
         $objPHPExcel = new PHPExcel();
82
-        // El libro activo el cual exportar sera el 0
46
+        $objPHPExcel->createSheet();
47
+        $objPHPExcel->createSheet();
48
+        $objPHPExcel->createSheet();
49
+        $objPHPExcel->createSheet();
50
+        $objPHPExcel->createSheet();
51
+        $objPHPExcel->createSheet();
52
+        $objPHPExcel->createSheet();
53
+        $objPHPExcel->createSheet();
54
+        $objPHPExcel->createSheet();
55
+        $objPHPExcel->createSheet();
56
+        $objPHPExcel->createSheet();
57
+        $objPHPExcel->createSheet();
58
+        $objPHPExcel->createSheet();
59
+        $objPHPExcel->createSheet();
83 60
 
84 61
         $filaExcel = 1;
85 62
         foreach ($result as $dato) {
86 63
             if ($filaExcel == 1) {
87 64
                 $objPHPExcel = $this->cabecerasOpenPlacspFirstSheet($objPHPExcel);
65
+                $objPHPExcel = $this->cabecerasOpenPlacsBitacora($objPHPExcel, 1);
66
+                $objPHPExcel = $this->cabeceraMediosComunicacion($objPHPExcel);
67
+                $objPHPExcel = $this->cabeceraMediosComunicacionDocumentos($objPHPExcel);
68
+                $objPHPExcel = $this->cabeceraTenderResult($objPHPExcel);
69
+                $objPHPExcel = $this->cabeceraTenderingTerms($objPHPExcel);
70
+                $objPHPExcel = $this->cabeceraTipoProcedimiento($objPHPExcel);
71
+                $objPHPExcel = $this->cabeceraCriterioADjudicacion($objPHPExcel);
72
+                $objPHPExcel = $this->cabeceraCriteriosFinancieros($objPHPExcel);
73
+                $objPHPExcel = $this->cabeceraCriteriosTecnicos($objPHPExcel);
74
+                $objPHPExcel = $this->cabeceraRequisitosParticipacion($objPHPExcel);
75
+                $objPHPExcel = $this->cabecerasOpenPlacspDocumentos($objPHPExcel, 11);
76
+                $objPHPExcel = $this->cabecerasOpenPlacspDocumentos($objPHPExcel, 12);
77
+                $objPHPExcel = $this->cabecerasOpenPlacspDocumentos($objPHPExcel, 13);
78
+                $objPHPExcel = $this->cabecerasOpenPlacspDocumentos($objPHPExcel, 14);
88 79
             } else {
89
-                $objPHPExcel = $this->datosCompletosHojaLicitacion($objPHPExcel, $dato, $filaExcel);
80
+                $objPHPExcel = $this->datosCompletosHojaLicitacion($objPHPExcel, $filaExcel, $dato);
81
+                $objPHPExcel = $this->datosCompletosHojaBitacora($objPHPExcel, $dato);
82
+                $objPHPExcel = $this->datosCompletosDocumentosGenerales($objPHPExcel, $dato);
83
+                $objPHPExcel = $this->datosCompletosDocumentosTecnicos($objPHPExcel, $dato);
84
+                $objPHPExcel = $this->datosCompletosDocumentosAdicionales($objPHPExcel, $dato);
85
+                $objPHPExcel = $this->datosCompletosDocumentosLegales($objPHPExcel, $dato);
90 86
             }
87
+            $objPHPExcel = $this->datosCompletosMediosPublicacion($objPHPExcel);
88
+            $objPHPExcel = $this->datosMedioPublicacion($objPHPExcel);
89
+            $objPHPExcel = $this->datosCompletosResultadoDelProcedimiento($objPHPExcel);
90
+            $objPHPExcel = $this->datosCompletosOfertas($objPHPExcel);
91
+            $objPHPExcel = $this->datosCriterioAdjudicacion($objPHPExcel);
92
+            $objPHPExcel = $this->datosCriterioEvaluacionFinanciera($objPHPExcel);
93
+            $objPHPExcel = $this->datosCriterioEvaluacionTecnica($objPHPExcel);
94
+            $objPHPExcel = $this->datosRequisitosParticipacion($objPHPExcel);
95
+            $objPHPExcel = $this->datosCompletosTipoProcedimiento($objPHPExcel);
91 96
 
92 97
             $filaExcel++;
93 98
         }
94 99
 
95
-/*        //Escribimos las cabeceras de cada columna de la bbdd
96
-if ($rowCount == 1) {
97
-$this->cabecerasOpenPlacspFirstSheet($objPHPExcel);
98
-$concesionNombre = $row->concesionNombre;
99
-$codConc = $row->codConc;
100
-$rowCount++;
101
-}
102
- */
103
-        $nombreAchivo = 'test.xls';
104
-
100
+        $nombreAchivo = 'test.xlsx';
105 101
         $ruta = base_url() . 'uploads/' . $nombreAchivo;
106 102
 
107 103
         // Write the Excel file to filename some_excel_file.xlsx in the current directory
@@ -112,10 +108,6 @@ $rowCount++;
112 108
         header('Cache-Control: private');
113 109
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
114 110
         $objWriter->save(FCPATH . 'uploads/' . $nombreAchivo);
115
-
116
-        $this->output
117
-            ->set_content_type('application/json')
118
-            ->set_output(json_encode(array("url" => $ruta)));
119 111
     }
120 112
 
121 113
     public function starttime()
@@ -133,9 +125,46 @@ $rowCount++;
133 125
         return '<strong>Execution Time</strong>: ' . $r . ' seconds<br />';
134 126
     }
135 127
 
136
-    private function datosCompletosHojaLicitacion($objPHPExcel, $datosLicitacion, $filaExcel)
128
+    public function mapearDatos($licitacionesResult): array
129
+    {
130
+        $result = array();
131
+        foreach ($licitacionesResult['datos'] as $licitacion) {
132
+            $result[$licitacion->id_licitacion]['licitacion'] = $licitacion;
133
+            $result[$licitacion->id_licitacion]['contract'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_contract_folder", $licitacion->id_licitacion);
134
+            $result[$licitacion->id_licitacion]['locatedParty'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_located_contracting_party", $licitacion->id_licitacion);
135
+            $result[$licitacion->id_licitacion]['party'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_party", $licitacion->id_licitacion);
136
+            foreach ($result[$licitacion->id_licitacion]['party'] as $row) {
137
+                $result[$licitacion->id_licitacion]['partyActivity'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_party_party_idenfitication", "id_ajena_party", $row['id']);
138
+            }
139
+
140
+            $result[$licitacion->id_licitacion]['project'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_procurement_project", $licitacion->id_licitacion);
141
+            foreach ($result[$licitacion->id_licitacion]['project'] as $row) {
142
+                $result[$licitacion->id_licitacion]['projectActivity'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_procurement_project_itemClass", "id_ajena_pp", $row['id']);
143
+            }
144
+
145
+            $result[$licitacion->id_licitacion]['projectLot'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_procurement_project_lot", $licitacion->id_licitacion);
146
+            foreach ($result[$licitacion->id_licitacion]['projectLot'] as $row) {
147
+                $result[$licitacion->id_licitacion]['projectLotActivity'] = $this->Xlsexport_model->getDatosRelacionadosByTablaAndLicitacion("maestro_procurement_project_lot_item", "id_ajena_ppl", $row['id']);
148
+            }
149
+
150
+            $result[$licitacion->id_licitacion]['tenderResult'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_tender_result", $licitacion->id_licitacion);
151
+            $result[$licitacion->id_licitacion]['tenderProcess'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_tendering_process", $licitacion->id_licitacion);
152
+            $result[$licitacion->id_licitacion]['tenderTerms'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_tendering_terms", $licitacion->id_licitacion);
153
+            $result[$licitacion->id_licitacion]['validNoticeInfo'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_valid_notice_info", $licitacion->id_licitacion);
154
+            $result[$licitacion->id_licitacion]['techDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_technical_documents", $licitacion->id_licitacion);
155
+            $result[$licitacion->id_licitacion]['legalDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_legal_documents", $licitacion->id_licitacion);
156
+            $result[$licitacion->id_licitacion]['generalDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_general_documents", $licitacion->id_licitacion);
157
+            $result[$licitacion->id_licitacion]['additDocs'] = $this->Xlsexport_model->getDatosByTablaAndLicitacion("maestro_additional_documents", $licitacion->id_licitacion);
158
+        }
159
+
160
+        return $result;
161
+    }
162
+
163
+    private function datosCompletosHojaLicitacion($objPHPExcel, $filaExcel, $datosLicitacion)
137 164
     {
165
+
138 166
         $objPHPExcel->setActiveSheetIndex(0);
167
+        $objPHPExcel->getActiveSheet()->setTitle("Datos Licitación");
139 168
         $styleArr = array(
140 169
             "font" => array(
141 170
                 "bold" => true,
@@ -144,7 +173,6 @@ $rowCount++;
144 173
             ),
145 174
         );
146 175
         $objPHPExcel->getActiveSheet()->getStyle("A1:AB1")->applyFromArray($styleArr);
147
-        //$sharedStyle1->applyFromArray(array('fill' => array('type' => \PHPExcel\Style\Fill::FILL_SOLID, 'color' => array('argb' => 'FFCCFFCC')), 'borders' => array('bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN), 'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM))));
148 176
         $objPHPExcel->getActiveSheet()->SetCellValue('A' . $filaExcel, $datosLicitacion['licitacion']->id_licitacion);
149 177
         $objPHPExcel->getActiveSheet()->SetCellValue('B' . $filaExcel, $datosLicitacion['licitacion']->url_id_licitacion);
150 178
         $objPHPExcel->getActiveSheet()->SetCellValue('C' . $filaExcel, $datosLicitacion['licitacion']->updated);
@@ -175,7 +203,7 @@ $rowCount++;
175 203
         $objPHPExcel->getActiveSheet()->SetCellValue('P' . $filaExcel, $datosLicitacion['party'][0]['partyName']);
176 204
         $objPHPExcel->getActiveSheet()->SetCellValue('Q' . $filaExcel, $datosLicitacion['locatedParty'][0]['contractingPartyTypeCode']);
177 205
         $objPHPExcel->getActiveSheet()->SetCellValue('R' . $filaExcel, $cpvParty);
178
-        $objPHPExcel->getActiveSheet()->SetCellValue('S' . $filaExcel, $datosLicitacion['locatedParty'][0]['buyerProfileURIID']);
206
+        $objPHPExcel->getActiveSheet()->SetCellValue('S' . $filaExcel, $datosLicitacion['locatedParty'][0]['buyerProfileURIID']); //Buscar DIR3
179 207
         $objPHPExcel->getActiveSheet()->SetCellValue('T' . $filaExcel, $datosLicitacion['locatedParty'][0]['contractingPartyTypeCode']);
180 208
         $objPHPExcel->getActiveSheet()->SetCellValue('U' . $filaExcel, $datosLicitacion['party'][0]['codpostal']);
181 209
         $objPHPExcel->getActiveSheet()->SetCellValue('V' . $filaExcel, $datosLicitacion['tenderProcess'][0]['procedureCode']);
@@ -184,7 +212,16 @@ $rowCount++;
184 212
         $objPHPExcel->getActiveSheet()->SetCellValue('Y' . $filaExcel, $datosLicitacion['tenderProcess'][0]['submissionMethodCode']);
185 213
         $objPHPExcel->getActiveSheet()->SetCellValue('Z' . $filaExcel, $datosLicitacion['tenderTerms'][0]['procurementLegislationDocumentReference']);
186 214
         $objPHPExcel->getActiveSheet()->SetCellValue('AA' . $filaExcel, $datosLicitacion['tenderTerms'][0]['allowedSubcontractTerms']);
187
-        $objPHPExcel->getActiveSheet()->SetCellValue('AB' . $filaExcel, "");
215
+        $objPHPExcel->getActiveSheet()->SetCellValue('AB' . $filaExcel, $datosLicitacion['project'][0]['durationMesure']);
216
+        $objPHPExcel->getActiveSheet()->SetCellValue('AC' . $filaExcel, $datosLicitacion['project'][0]['medida']);
217
+        $objPHPExcel->getActiveSheet()->SetCellValue('AD' . $filaExcel, $datosLicitacion['project'][0]['duracion_inicio']);
218
+        $objPHPExcel->getActiveSheet()->SetCellValue('AE' . $filaExcel, $datosLicitacion['project'][0]['duracion_fin']);
219
+        $objPHPExcel->getActiveSheet()->SetCellValue('AF' . $filaExcel, $datosLicitacion['project'][0]['contractExtension']);
220
+        $objPHPExcel->getActiveSheet()->SetCellValue('AG' . $filaExcel, $datosLicitacion['party'][0]['websiteURI']);
221
+        $objPHPExcel->getActiveSheet()->SetCellValue('AH' . $filaExcel, $datosLicitacion['party'][0]['city']);
222
+        $objPHPExcel->getActiveSheet()->SetCellValue('AI' . $filaExcel, $datosLicitacion['party'][0]['direccion']);
223
+        $objPHPExcel->getActiveSheet()->SetCellValue('AJ' . $filaExcel, $datosLicitacion['party'][0]['contact_name']);
224
+        $objPHPExcel->getActiveSheet()->SetCellValue('AK' . $filaExcel, $datosLicitacion['party'][0]['contact_email']);
188 225
 
189 226
         return $objPHPExcel;
190 227
 
@@ -192,31 +229,301 @@ $rowCount++;
192 229
 
193 230
     private function datosCompletosHojaBitacora($objPHPExcel, $datosLicitacion)
194 231
     {
232
+        $objPHPExcel->setActiveSheetIndex(1);
233
+        $objPHPExcel->getActiveSheet()->setTitle("Bitácora");
234
+
235
+        foreach ($datosLicitacion['projectLot'] as $datos) {
236
+            $objPHPExcel->getActiveSheet()->SetCellValue('A' . $this->filaProjectLot, $datos['id_ajena_licitacion']);
237
+            $objPHPExcel->getActiveSheet()->SetCellValue('B' . $this->filaProjectLot, $datos['name']);
238
+            $objPHPExcel->getActiveSheet()->SetCellValue('C' . $this->filaProjectLot, $datos['idProcurementLot']);
239
+            $objPHPExcel->getActiveSheet()->SetCellValue('D' . $this->filaProjectLot, $datos['totalAmount']);
240
+            $objPHPExcel->getActiveSheet()->SetCellValue('E' . $this->filaProjectLot, $datos['taxExclusiveAmount']);
241
+            $objPHPExcel->getActiveSheet()->SetCellValue('F' . $this->filaProjectLot, $datos['countrySubentity']);
242
+            $objPHPExcel->getActiveSheet()->SetCellValue('G' . $this->filaProjectLot, $datos['countrySubentityCode']);
243
+            $objPHPExcel->getActiveSheet()->SetCellValue('H' . $this->filaProjectLot, $datos['nameLocation']);
244
+
245
+            $cpv = "";
246
+            $projectLotActivity = $this->Xlsexport_model->getProjectLotActivityByProjectLot($datos['id']);
247
+
248
+            if ($projectLotActivity['num_rows'] > 0) {
249
+                for ($i = 0; $i < count($projectLotActivity['datos']); $i++) {
250
+
251
+                    $cpv .= $projectLotActivity['datos'][$i]['idItem'] . ";";
252
+                }
253
+                $objPHPExcel->getActiveSheet()->SetCellValue('I' . $this->filaProjectLot, $cpv);
254
+            }
255
+            $this->filaProjectLot++;
256
+        }
257
+        return $objPHPExcel;
258
+    }
259
+
260
+    private function datosCompletosMediosPublicacion($objPHPExcel)
261
+    {
262
+        $objPHPExcel->setActiveSheetIndex(2);
263
+        $objPHPExcel->getActiveSheet()->setTitle("Medios de publicación");
264
+        $datos = $this->Xlsexport_model->getValidNoticeInfoRelacion();
265
+
266
+        if ($datos['num_rows'] > 0) {
267
+            $aux = 2;
268
+            foreach ($datos['datos'] as $datos) {
269
+                $objPHPExcel->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
270
+                $objPHPExcel->getActiveSheet()->SetCellValue('B' . $aux, $datos['noticeTypeCode']);
271
+                $objPHPExcel->getActiveSheet()->SetCellValue('C' . $aux, $datos['publicationMediaName']);
272
+                $aux++;
273
+            }
274
+        }
195 275
 
276
+        return $objPHPExcel;
196 277
     }
197 278
 
198
-    private function datosCompletosDocumentosGenerales($objPHPExcel)
279
+    private function datosMedioPublicacion($objPHPExcel)
199 280
     {
281
+        $objPHPExcel->setActiveSheetIndex(3);
282
+        $objPHPExcel->getActiveSheet()->setTitle("Documentos Medios Comm");
283
+        $datos = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("maestro_valid_notice_info_documento", "maestro_valid_notice_info", "id_ajena_vni");
284
+        if ($datos['num_rows'] > 0) {
285
+            $aux = 2;
286
+            foreach ($datos['datos'] as $row) {
287
+                $objPHPExcel->getActiveSheet()->SetCellValue('A' . $aux, $row['id_ajena_licitacion']);
288
+                $objPHPExcel->getActiveSheet()->SetCellValue('B' . $aux, $row['documento']);
289
+                $objPHPExcel->getActiveSheet()->SetCellValue('C' . $aux, $row['filename']);
290
+
291
+                $aux++;
292
+            }
293
+        }
294
+        return $objPHPExcel;
295
+    }
200 296
 
297
+    private function datosCompletosResultadoDelProcedimiento($objPHPExcel)
298
+    {
299
+        $objPHPExcel->setActiveSheetIndex(4);
300
+        $objPHPExcel->getActiveSheet()->setTitle("Resultado del Procedimiento");
301
+
302
+        $datos = $this->Xlsexport_model->getTenderResult("maestro_tender_result");
303
+        if ($datos['num_rows'] > 0) {
304
+            $aux = 2;
305
+            foreach ($datos['datos'] as $datos) {
306
+                $objPHPExcel->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
307
+                $objPHPExcel->getActiveSheet()->SetCellValue('B' . $aux, $datos['resultCode']);
308
+                $objPHPExcel->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
309
+                $objPHPExcel->getActiveSheet()->SetCellValue('D' . $aux, $datos['awardDate']);
310
+                $objPHPExcel->getActiveSheet()->SetCellValue('E' . $aux, $datos['receivedTenderQuantity']);
311
+                $objPHPExcel->getActiveSheet()->SetCellValue('F' . $aux, $datos['lowerTenderAmount']);
312
+                $objPHPExcel->getActiveSheet()->SetCellValue('G' . $aux, $datos['higherTenderAmount']);
313
+                $objPHPExcel->getActiveSheet()->SetCellValue('H' . $aux, $datos['startDate']);
314
+                $objPHPExcel->getActiveSheet()->SetCellValue('I' . $aux, $datos['smeawardedIndicator']);
315
+                $objPHPExcel->getActiveSheet()->SetCellValue('J' . $aux, $datos['contract_id']);
316
+                $objPHPExcel->getActiveSheet()->SetCellValue('K' . $aux, $datos['contract_issueDate']);
317
+                $objPHPExcel->getActiveSheet()->SetCellValue('L' . $aux, $datos['partyIdentification']);
318
+                $objPHPExcel->getActiveSheet()->SetCellValue('M' . $aux, $datos['partyName']);
319
+                $objPHPExcel->getActiveSheet()->SetCellValue('N' . $aux, $datos['TaxExclusiveAmount']);
320
+                $objPHPExcel->getActiveSheet()->SetCellValue('O' . $aux, $datos['PayableAmount']);
321
+
322
+                $aux++;
323
+            }
324
+        }
325
+        return $objPHPExcel;
201 326
     }
202 327
 
203
-    private function datosCompletosDocumentosAdicionales($objPHPExcel)
328
+    private function datosCompletosTipoProcedimiento($objPHPExcel)
204 329
     {
330
+        $objPHPExcel->setActiveSheetIndex(5);
331
+        $objPHPExcel->getActiveSheet()->setTitle("Tipo Procedimiento");
332
+
333
+        $datos = $this->Xlsexport_model->getTenderProcessRelacion();
334
+        if ($datos['num_rows'] > 0) {
335
+            $aux = 2;
336
+            foreach ($datos['datos'] as $datos) {
337
+                $objPHPExcel->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
338
+                $objPHPExcel->getActiveSheet()->SetCellValue('B' . $aux, $datos['procedureCode']);
339
+                $objPHPExcel->getActiveSheet()->SetCellValue('C' . $aux, $datos['urgencyCode']);
340
+                $objPHPExcel->getActiveSheet()->SetCellValue('D' . $aux, $datos['contractingSystemCode']);
341
+                $objPHPExcel->getActiveSheet()->SetCellValue('E' . $aux, $datos['partPresentationCode']);
342
+                $objPHPExcel->getActiveSheet()->SetCellValue('F' . $aux, $datos['submissionMethodCode']);
343
+                $objPHPExcel->getActiveSheet()->SetCellValue('G' . $aux, $datos['maximumLotPresentationQuantity']);
344
+                $objPHPExcel->getActiveSheet()->SetCellValue('H' . $aux, $datos['maximumTendererAwardedLotsQuantity']);
345
+                $objPHPExcel->getActiveSheet()->SetCellValue('I' . $aux, $datos['lotsCombinationContractingAuthorityRights']);
346
+                $objPHPExcel->getActiveSheet()->SetCellValue('J' . $aux, $datos['deadLineEndDate']);
347
+                $objPHPExcel->getActiveSheet()->SetCellValue('K' . $aux, $datos['deadLineEndTime']);
348
+                $objPHPExcel->getActiveSheet()->SetCellValue('L' . $aux, $datos['deadLineDescription']);
349
+                $objPHPExcel->getActiveSheet()->SetCellValue('M' . $aux, $datos['auctionTerms']);
350
+                $objPHPExcel->getActiveSheet()->SetCellValue('N' . $aux, $datos['documentAvailablePeriod_EndDate']);
351
+                $objPHPExcel->getActiveSheet()->SetCellValue('O' . $aux, $datos['documentAvailablePeriod_EndTime']);
352
+
353
+                $aux++;
354
+            }
355
+        }
205 356
 
357
+        return $objPHPExcel;
206 358
     }
207 359
 
208
-    private function datosCompletosDocumentosTecnicos($objPHPExcel)
360
+    private function datosCompletosOfertas($objPHPExcel)
209 361
     {
362
+        $objPHPExcel->setActiveSheetIndex(6);
363
+        $objPHPExcel->getActiveSheet()->setTitle("Ofertas");
364
+
365
+        $datos = $this->Xlsexport_model->getTenderingTermsGarantia("maestro_tendering_terms");
366
+        if ($datos['num_rows'] > 0) {
367
+            $aux = 2;
368
+            foreach ($datos['datos'] as $datos) {
369
+                $objPHPExcel->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
370
+                $objPHPExcel->getActiveSheet()->SetCellValue('B' . $aux, $datos['requiredCurriculaIndicator']);
371
+                $objPHPExcel->getActiveSheet()->SetCellValue('C' . $aux, $datos['variantConstraintIndicator']);
372
+                $objPHPExcel->getActiveSheet()->SetCellValue('D' . $aux, $datos['fundingProgramCode']);
373
+                $objPHPExcel->getActiveSheet()->SetCellValue('E' . $aux, $datos['guaranteeTypeCode']);
374
+                $objPHPExcel->getActiveSheet()->SetCellValue('F' . $aux, $datos['requiredFinancialGuarantee_Amount']);
375
+                $objPHPExcel->getActiveSheet()->SetCellValue('G' . $aux, $datos['language']);
376
+                $objPHPExcel->getActiveSheet()->SetCellValue('H' . $aux, $datos['allowedSubcontractTerms']);
377
+                $objPHPExcel->getActiveSheet()->SetCellValue('I' . $aux, $datos['description']);
378
+                $objPHPExcel->getActiveSheet()->SetCellValue('J' . $aux, $datos['personalSituation']);
379
+                $objPHPExcel->getActiveSheet()->SetCellValue('K' . $aux, $datos['procurementLegislationDocumentReference']);
380
+                $aux++;
381
+            }
382
+        }
210 383
 
384
+        return $objPHPExcel;
211 385
     }
212 386
 
213
-    private function datosCompletosDocumentosLegales($objPHPExcel)
387
+    private function datosCriterioAdjudicacion($objPHPExcel)
214 388
     {
389
+        $objPHPExcel->setActiveSheetIndex(7);
390
+        $objPHPExcel->getActiveSheet()->setTitle("Criterio Adjudicación");
391
+
392
+        /*$datos = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("maestro_tendering_terms_awarding_terms", "maestro_tendering_terms", "id_ajena_tt");
393
+        if ($datos['num_rows'] > 0) {
394
+        $aux = 2;
395
+
396
+        foreach ($datos['datos'] as $datos) {
397
+        $objPHPExcel->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_tt']);
398
+        $objPHPExcel->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
399
+        $objPHPExcel->getActiveSheet()->SetCellValue('B' . $aux, $datos['description']);
400
+        $aux++;
401
+        }
402
+        }*/
215 403
 
404
+        return $objPHPExcel;
405
+    }
406
+
407
+    private function datosCriterioEvaluacionFinanciera($objPHPExcel)
408
+    {
409
+        $objPHPExcel->setActiveSheetIndex(8);
410
+        $objPHPExcel->getActiveSheet()->setTitle("CriteriosEvaluacionFinanciera");
411
+
412
+        $datos = $this->Xlsexport_model->getTenderingTermsCriteriosFinanciacion();
413
+        if ($datos['num_rows'] > 0) {
414
+            $aux = 2;
415
+            foreach ($datos['datos'] as $datos) {
416
+                $objPHPExcel->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
417
+                $objPHPExcel->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
418
+                $objPHPExcel->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
419
+                $aux++;
420
+            }
421
+        }
422
+        return $objPHPExcel;
423
+    }
424
+
425
+    private function datosCriterioEvaluacionTecnica($objPHPExcel)
426
+    {
427
+        $objPHPExcel->setActiveSheetIndex(9);
428
+        $objPHPExcel->getActiveSheet()->setTitle("Criterios Evaluación Técnica");
429
+
430
+        $datos = $this->Xlsexport_model->getTenderingTermsCriteriosTecnicos();
431
+        if ($datos['num_rows'] > 0) {
432
+            $aux = 2;
433
+            foreach ($datos['datos'] as $datos) {
434
+                $objPHPExcel->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
435
+                $objPHPExcel->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
436
+                $objPHPExcel->getActiveSheet()->SetCellValue('C' . $aux, $datos['description']);
437
+                $aux++;
438
+            }
439
+        }
440
+
441
+        return $objPHPExcel;
442
+    }
443
+
444
+    private function datosRequisitosParticipacion($objPHPExcel)
445
+    {
446
+        $objPHPExcel->setActiveSheetIndex(10);
447
+        $objPHPExcel->getActiveSheet()->setTitle("Requisitos Participación");
448
+
449
+        $datos = $this->Xlsexport_model->getTenderingTermsRequisitos();
450
+        if ($datos['num_rows'] > 0) {
451
+            $aux = 2;
452
+            foreach ($datos['datos'] as $datos) {
453
+                $objPHPExcel->getActiveSheet()->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
454
+                $objPHPExcel->getActiveSheet()->SetCellValue('B' . $aux, $datos['evaluationCriteriaTypeCode']);
455
+                $aux++;
456
+            }
457
+
458
+        }
459
+        return $objPHPExcel;
460
+    }
461
+
462
+    private function datosCompletosDocumentosGenerales($objPHPExcel, $datosLicitacion)
463
+    {
464
+
465
+        $objPHPExcel->setActiveSheetIndex(11);
466
+        $objPHPExcel->getActiveSheet()->setTitle("Documentos Generales");
467
+        foreach ($datosLicitacion['generalDocs'] as $doc) {
468
+            $objPHPExcel->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoGeneral, $doc['id_ajena_licitacion']);
469
+            $objPHPExcel->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoGeneral, $doc['attachment']);
470
+            $objPHPExcel->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoGeneral, $doc['fileName']);
471
+            $objPHPExcel->getActiveSheet()->SetCellValue('D' . $this->filaDocumentoGeneral, $doc['idDoc']);
472
+
473
+            $this->filaDocumentoGeneral++;
474
+        }
475
+
476
+        return $objPHPExcel;
477
+    }
478
+
479
+    private function datosCompletosDocumentosAdicionales($objPHPExcel, $datosLicitacion)
480
+    {
481
+        $objPHPExcel->setActiveSheetIndex(12);
482
+        $objPHPExcel->getActiveSheet()->setTitle("Documentos Adicionales");
483
+        foreach ($datosLicitacion['additDocs'] as $doc) {
484
+            $objPHPExcel->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoAdd, $doc['id_ajena_licitacion']);
485
+            $objPHPExcel->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoAdd, $doc['attachment']);
486
+            $objPHPExcel->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoAdd, $doc['idDoc']);
487
+            $objPHPExcel->getActiveSheet()->SetCellValue('D' . $this->filaDocumentoAdd, $doc['documentHash']);
488
+
489
+            $this->filaDocumentoAdd++;
490
+        }
491
+        return $objPHPExcel;
492
+    }
493
+
494
+    private function datosCompletosDocumentosTecnicos($objPHPExcel, $datosLicitacion)
495
+    {
496
+        $objPHPExcel->setActiveSheetIndex(13);
497
+        $objPHPExcel->getActiveSheet()->setTitle("Documentos Técnicos");
498
+        foreach ($datosLicitacion['techDocs'] as $doc) {
499
+            $objPHPExcel->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoTech, $doc['id_ajena_licitacion']);
500
+            $objPHPExcel->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoTech, $doc['attachment']);
501
+            $objPHPExcel->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoTech, $doc['idDoc']);
502
+            $objPHPExcel->getActiveSheet()->SetCellValue('D' . $this->filaDocumentoTech, $doc['documentHash']);
503
+
504
+            $this->filaDocumentoTech++;
505
+        }
506
+        return $objPHPExcel;
507
+    }
508
+
509
+    private function datosCompletosDocumentosLegales($objPHPExcel, $datosLicitacion)
510
+    {
511
+        $objPHPExcel->setActiveSheetIndex(14);
512
+        $objPHPExcel->getActiveSheet()->setTitle("Documentos Legales");
513
+        foreach ($datosLicitacion['legalDocs'] as $doc) {
514
+            $objPHPExcel->getActiveSheet()->SetCellValue('A' . $this->filaDocumentoLegal, $doc['id_ajena_licitacion']);
515
+            $objPHPExcel->getActiveSheet()->SetCellValue('B' . $this->filaDocumentoLegal, $doc['attachment']);
516
+            $objPHPExcel->getActiveSheet()->SetCellValue('C' . $this->filaDocumentoLegal, $doc['idDoc']);
517
+            $objPHPExcel->getActiveSheet()->SetCellValue('D' . $this->filaDocumentoLegal, $doc['documentHash']);
518
+
519
+            $this->filaDocumentoLegal++;
520
+        }
521
+        return $objPHPExcel;
216 522
     }
217 523
 
218 524
     private function cabecerasOpenPlacspFirstSheet($objPHPExcel)
219 525
     {
526
+        $objPHPExcel->setActiveSheetIndex(0);
220 527
         $objPHPExcel->getActiveSheet()->SetCellValue('A1', "Identificador");
221 528
         $objPHPExcel->getActiveSheet()->SetCellValue('B1', "Link licitación");
222 529
         $objPHPExcel->getActiveSheet()->SetCellValue('C1', "Fecha actualización");
@@ -244,9 +551,168 @@ $rowCount++;
244 551
         $objPHPExcel->getActiveSheet()->SetCellValue('Y1', "Forma de presentación de la oferta");
245 552
         $objPHPExcel->getActiveSheet()->SetCellValue('Z1', "Directiva de aplicación");
246 553
         $objPHPExcel->getActiveSheet()->SetCellValue('AA1', "Subcontratación permitida");
247
-        $objPHPExcel->getActiveSheet()->SetCellValue('AB1', "Subcontratación permitida porcentaje");
554
+        $objPHPExcel->getActiveSheet()->SetCellValue('AB1', "Duración Contrato");
555
+        $objPHPExcel->getActiveSheet()->SetCellValue('AC1', "Tipo de duración");
556
+        $objPHPExcel->getActiveSheet()->SetCellValue('AD1', "Inicio contrato");
557
+        $objPHPExcel->getActiveSheet()->SetCellValue('AE1', "Fin contrato");
558
+        $objPHPExcel->getActiveSheet()->SetCellValue('AF1', "Extension Contrato");
559
+        $objPHPExcel->getActiveSheet()->SetCellValue('AG1', "URL Organo Contratación");
560
+        $objPHPExcel->getActiveSheet()->SetCellValue('AH1', "Ciudad Organo Contratación");
561
+        $objPHPExcel->getActiveSheet()->SetCellValue('AI1', "Dirección Organo Contratación");
562
+        $objPHPExcel->getActiveSheet()->SetCellValue('AJ1', "Nombre Contacto Organo Contratación");
563
+        $objPHPExcel->getActiveSheet()->SetCellValue('AK1', "Email contacto Organo Contratación");
564
+        return $objPHPExcel;
565
+    }
566
+
567
+    //Cabeceras
568
+    private function cabecerasOpenPlacspDocumentos($objPHPExcel, $hojaActiva)
569
+    {
570
+        $objPHPExcel->setActiveSheetIndex($hojaActiva);
571
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', "Identificador");
572
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', "Link Documento");
573
+        $objPHPExcel->getActiveSheet()->SetCellValue('C1', "Nombre Documento");
574
+        $objPHPExcel->getActiveSheet()->SetCellValue('D1', "Hash Documento");
575
+
576
+        return $objPHPExcel;
577
+    }
578
+
579
+    private function cabecerasOpenPlacsBitacora($objPHPExcel, $hojaActiva)
580
+    {
581
+        $objPHPExcel->setActiveSheetIndex($hojaActiva);
582
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', "Identificador");
583
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', "Objeto del lote");
584
+        $objPHPExcel->getActiveSheet()->SetCellValue('C1', "Número de lote");
585
+        $objPHPExcel->getActiveSheet()->SetCellValue('D1', "Importe sin Impuestos");
586
+        $objPHPExcel->getActiveSheet()->SetCellValue('E1', "Importe con Impuestos");
587
+        $objPHPExcel->getActiveSheet()->SetCellValue('F1', "Lugar de ejecución del lote");
588
+        $objPHPExcel->getActiveSheet()->SetCellValue('G1', "Codigo de ejecución del lote");
589
+        $objPHPExcel->getActiveSheet()->SetCellValue('H1', "Ciudad de ejecución del lote");
590
+        $objPHPExcel->getActiveSheet()->SetCellValue('I1', "CPV Project Lot");
591
+
592
+        return $objPHPExcel;
593
+    }
594
+
595
+    private function cabeceraMediosComunicacion($objPHPExcel)
596
+    {
597
+        $objPHPExcel->setActiveSheetIndex(2);
598
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Identificador');
599
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Tipo de anuncio');
600
+        $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Medio de publicación');
601
+
602
+        return $objPHPExcel;
603
+    }
604
+
605
+    private function cabeceraMediosComunicacionDocumentos($objPHPExcel)
606
+    {
607
+        $objPHPExcel->setActiveSheetIndex(3);
608
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Identificador');
609
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Documento');
610
+        $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Nombre Documento');
611
+
612
+        return $objPHPExcel;
613
+    }
614
+
615
+    private function cabeceraTenderResult($objPHPExcel)
616
+    {
617
+        $objPHPExcel->setActiveSheetIndex(4);
618
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Identificador');
619
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Tipo de resultado');
620
+        $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Motivación adjudicación');
621
+        $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Fecha del acuerdo');
622
+        $objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Número de licitadores participadores');
623
+        $objPHPExcel->getActiveSheet()->SetCellValue('F1', 'Importe Oferta mas baja');
624
+        $objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Importe Oferta mas alta');
625
+        $objPHPExcel->getActiveSheet()->SetCellValue('H1', 'Fecha de entrada en vigor');
626
+        $objPHPExcel->getActiveSheet()->SetCellValue('I1', 'Identifica si es una PYME');
627
+        $objPHPExcel->getActiveSheet()->SetCellValue('J1', 'Identificador del contrato');
628
+        $objPHPExcel->getActiveSheet()->SetCellValue('K1', 'Fecha de formalización');
629
+        $objPHPExcel->getActiveSheet()->SetCellValue('L1', 'Adjudicatario CIF');
630
+        $objPHPExcel->getActiveSheet()->SetCellValue('M1', 'Nombre Adjudicatario');
631
+        $objPHPExcel->getActiveSheet()->SetCellValue('N1', 'Importe de adjudicación sin impuestos');
632
+        $objPHPExcel->getActiveSheet()->SetCellValue('O1', 'Importe de adjudicación con impuestos');
633
+
634
+        return $objPHPExcel;
635
+    }
636
+
637
+    private function cabeceraTipoProcedimiento($objPHPExcel)
638
+    {
639
+        $objPHPExcel->setActiveSheetIndex(5);
640
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Identificador');
641
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Tipo de Procedimiento');
642
+        $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Tipo de Tramitación');
643
+        $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Sistema de Contratación');
644
+        $objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Número de lotes a los que se debe ofertar');
645
+        $objPHPExcel->getActiveSheet()->SetCellValue('F1', 'Presentación de la oferta');
646
+        $objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Número de lotes a los que se puede ofertar');
647
+        $objPHPExcel->getActiveSheet()->SetCellValue('H1', 'Número máximo de lotes que se puede adjudicar un licitador');
648
+        $objPHPExcel->getActiveSheet()->SetCellValue('I1', 'El poder adjudicador se reserva el derecho de adjudicar contratos que combinen lotes');
649
+        $objPHPExcel->getActiveSheet()->SetCellValue('J1', 'Fecha limite para la presentación de ofertas');
650
+        $objPHPExcel->getActiveSheet()->SetCellValue('K1', 'Tiempo limite para la presentación de ofertas');
651
+        $objPHPExcel->getActiveSheet()->SetCellValue('L1', 'Texto descriptivo de fecha limite de presentación de ofertas');
652
+        $objPHPExcel->getActiveSheet()->SetCellValue('M1', 'Usa subasta electronica');
653
+        $objPHPExcel->getActiveSheet()->SetCellValue('N1', 'Fecha límite para obtener los pliegos');
654
+        $objPHPExcel->getActiveSheet()->SetCellValue('O1', 'Hora límite para obtener los pliegos');
655
+
656
+        return $objPHPExcel;
657
+    }
658
+
659
+    private function cabeceraTenderingTerms($objPHPExcel)
660
+    {
661
+        $objPHPExcel->setActiveSheetIndex(6);
662
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Identificador');
663
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Se requiere la presentación de Curriculum Vitae de las personas que realizarán el proyecto');
664
+        $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Indica que se pueden ofertar variantes');
665
+        $objPHPExcel->getActiveSheet()->SetCellValue('D1', 'Código descriptivo del tipo de programas que financian este contrato');
666
+        $objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Tipo de garantia');
667
+        $objPHPExcel->getActiveSheet()->SetCellValue('F1', 'Porcentaje de la garantíaa');
668
+        $objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Idioma');
669
+        $objPHPExcel->getActiveSheet()->SetCellValue('H1', 'Porcentaje de subcontratación máximo especificado para este contrato.');
670
+        $objPHPExcel->getActiveSheet()->SetCellValue('I1', 'Descripción del objeto de la subcontratación');
671
+        $objPHPExcel->getActiveSheet()->SetCellValue('J1', 'Descripción textual de los requisitos específicos del operador económico para poder participar en la licitación');
672
+        $objPHPExcel->getActiveSheet()->SetCellValue('K1', 'Contrato sujeto a regulación armonizadaF');
673
+
248 674
         return $objPHPExcel;
249 675
     }
676
+
677
+    private function cabeceraCriterioADjudicacion($objPHPExcel)
678
+    {
679
+        $objPHPExcel->setActiveSheetIndex(7);
680
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Identificador');
681
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Tipo criterio de adjudicación');
682
+        $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Descripción textual del criterio de adjudicación');
683
+
684
+        return $objPHPExcel;
685
+    }
686
+
687
+    private function cabeceraCriteriosFinancieros($objPHPExcel)
688
+    {
689
+        $objPHPExcel->setActiveSheetIndex(8);
690
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Identificador');
691
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Tipo criterio de evaluación financiera');
692
+        $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Descripción textual del criterio de evaluación financiera');
693
+
694
+        return $objPHPExcel;
695
+    }
696
+
697
+    private function cabeceraCriteriosTecnicos($objPHPExcel)
698
+    {
699
+        $objPHPExcel->setActiveSheetIndex(9);
700
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Identificador');
701
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Tipo criterio de evaluación técnica');
702
+        $objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Descripción textual del criterio de evaluación técnica');
703
+
704
+        return $objPHPExcel;
705
+    }
706
+
707
+    private function cabeceraRequisitosParticipacion($objPHPExcel)
708
+    {
709
+        $objPHPExcel->setActiveSheetIndex(10);
710
+        $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Identificador');
711
+        $objPHPExcel->getActiveSheet()->SetCellValue('B1', 'Tipo Requisitos Participacion');
712
+
713
+        return $objPHPExcel;
714
+    }
715
+
250 716
 }
251 717
 
252 718
 /* End of file ExportXls.php */

+ 74 - 227
application/models/Xlsexport_model.php Целия файл

@@ -54,317 +54,164 @@ class Xlsexport_model extends CI_Model
54 54
         return $datos['datos'];
55 55
     }
56 56
 
57
-    public function getDatosRelacionadosByTablaAndLicitacion($tabla, $txtIdAjena, $idAjena)
57
+    public function getTablaWithoutLicitacion($tabla)
58 58
     {
59 59
         $sql = "SELECT
60 60
                     *
61 61
                 FROM
62
-                    $tabla
63
-                WHERE $txtIdAjena = $idAjena";
62
+                    $tabla t1";
64 63
         $result = $this->db->query($sql);
65 64
         $datos['datos'] = $result->result_array();
66 65
         $datos['num_rows'] = $result->num_rows();
67
-        return $datos['datos'];
68
-    }
69
-
70
-    public function getContractInfoByLicitacion($licitacionId)
71
-    {
72
-        $sql = "SELECT *
73
-                    *
74
-                FROM
75
-                    maestro_contract_folder
76
-                WHERE id_ajena_licitacion = $licitacionId";
77
-        $result = $this->db->query($sql);
78
-        $datos['datos'] = $result->result();
79
-        $datos['num_rows'] = $result->num_rows();
80
-        return $datos;
81
-    }
82
-
83
-    public function getProjectByLicitacion($licitacionId)
84
-    {
85
-        $sql = "SELECT *
86
-                    *
87
-                FROM
88
-                    maestro_procurement_project
89
-                WHERE id_ajena_licitacion = $licitacionId";
90
-        $result = $this->db->query($sql);
91
-        $datos['datos'] = $result->result();
92
-        $datos['num_rows'] = $result->num_rows();
93
-        return $datos;
94
-    }
95
-
96
-    public function getProjectByActivityByProject($projectId)
97
-    {
98
-        $sql = "SELECT *
99
-                    *
100
-                FROM
101
-                maestro_procurement_project_itemClass
102
-                WHERE id_ajena_pp = $projectId";
103
-        $result = $this->db->query($sql);
104
-        $datos['datos'] = $result->result();
105
-        $datos['num_rows'] = $result->num_rows();
106
-        return $datos;
107
-    }
108
-
109
-    public function getProjectLotByLicitacion($licitacionId)
110
-    {
111
-        $sql = "SELECT *
112
-                    *
113
-                FROM
114
-                    maestro_procurement_project_lot
115
-                WHERE id_ajena_licitacion = $licitacionId";
116
-        $result = $this->db->query($sql);
117
-        $datos['datos'] = $result->result();
118
-        $datos['num_rows'] = $result->num_rows();
119
-        return $datos;
120
-    }
121
-
122
-    public function getProjectLotActivityByProjectLot($projectLotId)
123
-    {
124
-        $sql = "SELECT *
125
-                    *
126
-                FROM
127
-                    maestro_procurement_project_lot_item
128
-                WHERE id_ajena_ppl = $projectLotId";
129
-        $result = $this->db->query($sql);
130
-        $datos['datos'] = $result->result();
131
-        $datos['num_rows'] = $result->num_rows();
132
-        return $datos;
133
-    }
134
-
135
-    public function getPartyByLicitacion($licitacionId)
136
-    {
137
-        $sql = "SELECT *
138
-                    *
139
-                FROM
140
-                    maestro_party
141
-                WHERE id_ajena_licitacion = $licitacionId";
142
-        $result = $this->db->query($sql);
143
-        $datos['datos'] = $result->result();
144
-        $datos['num_rows'] = $result->num_rows();
145
-        return $datos;
146
-    }
147
-
148
-    public function getPartyIdentificationByLicitacion($partyId)
149
-    {
150
-        $sql = "SELECT *
151
-                    *
152
-                FROM
153
-                    maestro_party_party_idenfitication
154
-                WHERE id_ajena_party = $partyId";
155
-        $result = $this->db->query($sql);
156
-        $datos['datos'] = $result->result();
157
-        $datos['num_rows'] = $result->num_rows();
158
-        return $datos;
159
-    }
160
-
161
-    public function getLocatedPartyByLicitacion($licitacionId)
162
-    {
163
-        $sql = "SELECT *
164
-                    *
165
-                FROM
166
-                maestro_located_contracting_party
167
-                WHERE id_ajena_licitacion = $licitacionId";
168
-        $result = $this->db->query($sql);
169
-        $datos['datos'] = $result->result();
170
-        $datos['num_rows'] = $result->num_rows();
171
-        return $datos;
172
-    }
173
-
174
-    public function getLocatedPartyActivityByLicitacion($locatedPartyId)
175
-    {
176
-        $sql = "SELECT *
177
-                    *
178
-                FROM
179
-                maestro_located_contracting_party_activity
180
-                WHERE id_ajena_lcp = $locatedPartyId";
181
-        $result = $this->db->query($sql);
182
-        $datos['datos'] = $result->result();
183
-        $datos['num_rows'] = $result->num_rows();
184 66
         return $datos;
185 67
     }
186 68
 
187
-    public function getTenderProcessByLicitacion($licitacionId)
69
+    public function getDatosRelacionadosByTablaAndLicitacion($tabla, $txtIdAjena, $idAjena)
188 70
     {
189
-        $sql = "SELECT *
71
+        $sql = "SELECT
190 72
                     *
191 73
                 FROM
192
-                maestro_tendering_process
193
-                WHERE id_ajena_licitacion = $licitacionId";
74
+                    $tabla
75
+                WHERE $txtIdAjena = $idAjena";
194 76
         $result = $this->db->query($sql);
195
-        $datos['datos'] = $result->result();
77
+        $datos['datos'] = $result->result_array();
196 78
         $datos['num_rows'] = $result->num_rows();
197
-        return $datos;
79
+        return $datos['datos'];
198 80
     }
199 81
 
200
-    public function getTenderResultByLicitacion($licitacionId)
82
+    public function getDatosRelacionadasTablaWithoutLicitacion($tablaRelacion, $tabla, $txtIdAjena, $id = "t1.id")
201 83
     {
202
-        $sql = "SELECT *
84
+        $sql = "SELECT
203 85
                     *
204 86
                 FROM
205
-                    maestro_tender_result
206
-                WHERE id_ajena_licitacion = $licitacionId";
87
+                    $tabla t1
88
+                JOIN
89
+                    $tablaRelacion t2 ON t2." . $txtIdAjena . " = t1.id";
207 90
         $result = $this->db->query($sql);
208
-        $datos['datos'] = $result->result();
91
+        $datos['datos'] = $result->result_array();
209 92
         $datos['num_rows'] = $result->num_rows();
210 93
         return $datos;
211 94
     }
212 95
 
213
-    public function getTenderingTermsByLicitacion($licitacionId)
96
+    public function getTenderProcessRelacion()
214 97
     {
215
-        $sql = "SELECT *
216
-                    *
98
+        $sql = "SELECT
99
+                    t2.nombre as procedureCode, t3.nombre as contractingSystemCode, t4.nombre as submissionMethodCode, t5.nombre as urgencyCode,
100
+                    t1.id_ajena_licitacion, t1.partPresentationCode, t1.maximumLotPresentationQuantity, t1.maximumTendererAwardedLotsQuantity, t1.lotsCombinationContractingAuthorityRights,
101
+                    t1.deadLineEndDate, t1.deadLineEndTime, t1.deadLineDescription, t1.auctionTerms, t1.documentAvailablePeriod_EndDate, t1.documentAvailablePeriod_EndTime
217 102
                 FROM
218
-                    maestro_tendering_terms
219
-                WHERE id_ajena_licitacion = $licitacionId";
103
+                maestro_tendering_process t1
104
+                JOIN relacionada_tender_process t2 ON t2.code = t1.procedureCode
105
+                JOIN relacionada_tender_process_contracting_code t3 ON t3.code = t1.contractingSystemCode
106
+                JOIN relacionada_tender_process_submission t4 ON t4.code = t1.submissionMethodCode
107
+                JOIN relacionada_tender_process_urgency_code t5 ON t5.code = t1.urgencyCode";
220 108
         $result = $this->db->query($sql);
221
-        $datos['datos'] = $result->result();
109
+        $datos['datos'] = $result->result_array();
222 110
         $datos['num_rows'] = $result->num_rows();
223 111
         return $datos;
224 112
     }
225 113
 
226
-    public function getTenderingTermsAwardingByTenderTerms($tenderTermsId)
114
+    public function getValidNoticeInfoRelacion()
227 115
     {
228
-        $sql = "SELECT *
229
-                    *
116
+        $sql = "SELECT
117
+                    t2.nombre as noticeTypeCode, t1.id_ajena_licitacion, t1.publicationMediaName
230 118
                 FROM
231
-                    maestro_tendering_terms_awarding_terms
232
-                WHERE id_ajena_tt = $tenderTermsId";
119
+                maestro_valid_notice_info t1
120
+                JOIN relacionada_valid_notice_info t2 ON t2.code = t1.noticeTypeCode";
233 121
         $result = $this->db->query($sql);
234
-        $datos['datos'] = $result->result();
122
+        $datos['datos'] = $result->result_array();
235 123
         $datos['num_rows'] = $result->num_rows();
236 124
         return $datos;
237 125
     }
238 126
 
239
-    public function getTenderingTermsFinancialgByTenderTerms($tenderTermsId)
127
+    public function getTenderResult()
240 128
     {
241
-        $sql = "SELECT *
242
-                    *
129
+        $sql = "SELECT
130
+                    t2.nombre as resultCode, t1.id_ajena_licitacion, t1.description, t1.awardDate, t1.receivedTenderQuantity, t1.lowerTenderAmount , t1.higherTenderAmount, t1.startDate,
131
+                    t1.smeawardedIndicator, t1.contract_id, t1.contract_issueDate, t1.partyIdentification, t1.partyName, t1.TaxExclusiveAmount, t1.PayableAmount
243 132
                 FROM
244
-                maestro_tendering_terms_financial_evaluation
245
-                WHERE id_ajena_tt = $tenderTermsId";
133
+                maestro_tender_result t1
134
+                JOIN relacionada_tender_result t2 ON t2.code = t1.resultCode";
246 135
         $result = $this->db->query($sql);
247
-        $datos['datos'] = $result->result();
136
+        $datos['datos'] = $result->result_array();
248 137
         $datos['num_rows'] = $result->num_rows();
249 138
         return $datos;
250 139
     }
251 140
 
252
-    public function getTenderingTermsQualificationByTenderTerms($tenderTermsId)
141
+    public function getTenderingTermsGarantia()
253 142
     {
254
-        $sql = "SELECT *
255
-                    *
143
+        $sql = "SELECT
144
+                    t1.id_ajena_licitacion, t2.nombre as guaranteeTypeCode, t1.requiredCurriculaIndicator, t1.variantConstraintIndicator, t1.fundingProgramCode, t1.requiredFinancialGuarantee_Amount,
145
+                    t1.language, t1.allowedSubcontractTerms, t1.description, t1.personalSituation, t1.procurementLegislationDocumentReference
256 146
                 FROM
257
-                    maestro_tendering_terms_qualification_request
258
-                WHERE id_ajena_tt = $tenderTermsId";
147
+                maestro_tendering_terms t1
148
+                JOIN relacionada_codigo_tipo_garantia t2 ON t2.code = t1.guaranteeTypeCode";
259 149
         $result = $this->db->query($sql);
260
-        $datos['datos'] = $result->result();
150
+        $datos['datos'] = $result->result_array();
261 151
         $datos['num_rows'] = $result->num_rows();
262 152
         return $datos;
263 153
     }
264 154
 
265
-    public function getTenderingTermsSpecificByTenderTerms($tenderTermsId)
155
+    public function getTenderingTermsCriteriosFinanciacion()
266 156
     {
267
-        $sql = "SELECT *
268
-                    *
269
-                FROM
270
-                    maestro_tendering_terms_specific_terms
271
-                WHERE id_ajena_tt = $tenderTermsId";
272
-        $result = $this->db->query($sql);
273
-        $datos['datos'] = $result->result();
274
-        $datos['num_rows'] = $result->num_rows();
275
-        return $datos;
276
-    }
157
+        $sql = "SELECT
158
+        t2.id_ajena_licitacion,
159
+        t3.nombre AS evaluationCriteriaTypeCode,
160
+        t1.description
161
+    FROM
162
+        maestro_tendering_terms_financial_evaluation t1
163
+        JOIN maestro_tendering_terms t2 ON t1.id_ajena_ttfe = t2.id
164
+        JOIN relacionada_tendering_terms_financial t3 ON t3.CODE = t1.evaluationCriteriaTypeCode";
277 165
 
278
-    public function getValidNoticeInfoByLicitacion($licitacionId)
279
-    {
280
-        $sql = "SELECT *
281
-                    *
282
-                FROM
283
-                    maestro_valid_notice_info
284
-                WHERE id_ajena_licitacion = $licitacionId";
285 166
         $result = $this->db->query($sql);
286
-        $datos['datos'] = $result->result();
167
+        $datos['datos'] = $result->result_array();
287 168
         $datos['num_rows'] = $result->num_rows();
288 169
         return $datos;
289 170
     }
290 171
 
291
-    public function getValidNoticeInfoDocumentByValidId($validNoticeId)
172
+    public function getTenderingTermsCriteriosTecnicos()
292 173
     {
293
-        $sql = "SELECT *
294
-                    *
174
+        $sql = "SELECT
175
+                    t2.id_ajena_licitacion, t3.nombre as evaluationCriteriaTypeCode, t1.description
295 176
                 FROM
296
-                    maestro_valid_notice_info_documento
297
-                WHERE id_ajena_vni = $validNoticeId";
298
-        $result = $this->db->query($sql);
299
-        $datos['datos'] = $result->result();
300
-        $datos['num_rows'] = $result->num_rows();
301
-        return $datos;
302
-    }
177
+                maestro_tendering_terms_qualification_request t1
178
+                JOIN maestro_tendering_terms t2 ON t1.id_ajena_tt = t2.id
179
+                JOIN relacionada_tendering_terms_qualification_request t3 ON t3.code = t1.evaluationCriteriaTypeCode";
303 180
 
304
-    public function getValidNoticeInfoFechaByValidId($validNoticeId)
305
-    {
306
-        $sql = "SELECT *
307
-                    *
308
-                FROM
309
-                    maestro_valid_notice_info_fecha
310
-                WHERE id_ajena_vni = $validNoticeId";
311 181
         $result = $this->db->query($sql);
312
-        $datos['datos'] = $result->result();
182
+        $datos['datos'] = $result->result_array();
313 183
         $datos['num_rows'] = $result->num_rows();
314 184
         return $datos;
315 185
     }
316 186
 
317
-    public function getAdditionalDocumuentsByLicitacion($licitacionId)
187
+    public function getTenderingTermsRequisitos()
318 188
     {
319
-        $sql = "SELECT *
320
-                    *
189
+        $sql = "SELECT
190
+                    t2.id_ajena_licitacion, t3.nombre as evaluationCriteriaTypeCode, t1.description
321 191
                 FROM
322
-                maestro_additional_documents
323
-                WHERE id_ajena_licitacion = $licitacionId";
324
-        $result = $this->db->query($sql);
325
-        $datos['datos'] = $result->result();
326
-        $datos['num_rows'] = $result->num_rows();
327
-        return $datos;
328
-    }
192
+                maestro_tendering_terms_qualification_request t1
193
+                JOIN maestro_tendering_terms t2 ON t1.id_ajena_tt = t2.id
194
+                JOIN relacionada_tendering_terms_qualification_request t3 ON t3.code = t1.evaluationCriteriaTypeCode";
329 195
 
330
-    public function getGeneralDocumuentsByLicitacion($licitacionId)
331
-    {
332
-        $sql = "SELECT *
333
-                    *
334
-                FROM
335
-                maestro_general_documents
336
-                WHERE id_ajena_licitacion = $licitacionId";
337 196
         $result = $this->db->query($sql);
338
-        $datos['datos'] = $result->result();
197
+        $datos['datos'] = $result->result_array();
339 198
         $datos['num_rows'] = $result->num_rows();
340 199
         return $datos;
341 200
     }
342 201
 
343
-    public function getLegalDocumuentsByLicitacion($licitacionId)
202
+    public function getProjectLotActivityByProjectLot($projectLotId)
344 203
     {
345
-        $sql = "SELECT *
204
+        $sql = "SELECT
346 205
                     *
347 206
                 FROM
348
-                maestro_legal_documents
349
-                WHERE id_ajena_licitacion = $licitacionId";
207
+                    maestro_procurement_project_lot_item
208
+                WHERE id_ajena_ppl = $projectLotId";
350 209
         $result = $this->db->query($sql);
351
-        $datos['datos'] = $result->result();
210
+        $datos['datos'] = $result->result_array();
352 211
         $datos['num_rows'] = $result->num_rows();
353 212
         return $datos;
354 213
     }
355 214
 
356
-    public function getTechnicalDocumuentsByLicitacion($licitacionId)
357
-    {
358
-        $sql = "SELECT *
359
-                    *
360
-                FROM
361
-                maestro_technical_documents
362
-                WHERE id_ajena_licitacion = $licitacionId";
363
-        $result = $this->db->query($sql);
364
-        $datos['datos'] = $result->result();
365
-        $datos['num_rows'] = $result->num_rows();
366
-        return $datos;
367
-    }
368 215
 }
369 216
 
370 217
 /* End of file Xlsexport_model_model.php */

BIN
test.xlsx Целия файл