Parcourir la source

trycatch email, then download at server, get last datetime log for detailview

Nermosis il y a 3 ans
Parent
révision
0be10c34a3

+ 0 - 96
application/config/111database.php Voir le fichier

@@ -1,96 +0,0 @@
1
-<?php
2
-defined('BASEPATH') OR exit('No direct script access allowed');
3
-
4
-/*
5
-| -------------------------------------------------------------------
6
-| DATABASE CONNECTIVITY SETTINGS
7
-| -------------------------------------------------------------------
8
-| This file will contain the settings needed to access your database.
9
-|
10
-| For complete instructions please consult the 'Database Connection'
11
-| page of the User Guide.
12
-|
13
-| -------------------------------------------------------------------
14
-| EXPLANATION OF VARIABLES
15
-| -------------------------------------------------------------------
16
-|
17
-|	['dsn']      The full DSN string describe a connection to the database.
18
-|	['hostname'] The hostname of your database server.
19
-|	['username'] The username used to connect to the database
20
-|	['password'] The password used to connect to the database
21
-|	['database'] The name of the database you want to connect to
22
-|	['dbdriver'] The database driver. e.g.: mysqli.
23
-|			Currently supported:
24
-|				 cubrid, ibase, mssql, mysql, mysqli, oci8,
25
-|				 odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
26
-|	['dbprefix'] You can add an optional prefix, which will be added
27
-|				 to the table name when using the  Query Builder class
28
-|	['pconnect'] TRUE/FALSE - Whether to use a persistent connection
29
-|	['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
30
-|	['cache_on'] TRUE/FALSE - Enables/disables query caching
31
-|	['cachedir'] The path to the folder where cache files should be stored
32
-|	['char_set'] The character set used in communicating with the database
33
-|	['dbcollat'] The character collation used in communicating with the database
34
-|				 NOTE: For MySQL and MySQLi databases, this setting is only used
35
-| 				 as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
36
-|				 (and in table creation queries made with DB Forge).
37
-| 				 There is an incompatibility in PHP with mysql_real_escape_string() which
38
-| 				 can make your site vulnerable to SQL injection if you are using a
39
-| 				 multi-byte character set and are running versions lower than these.
40
-| 				 Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
41
-|	['swap_pre'] A default table prefix that should be swapped with the dbprefix
42
-|	['encrypt']  Whether or not to use an encrypted connection.
43
-|
44
-|			'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
45
-|			'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
46
-|
47
-|				'ssl_key'    - Path to the private key file
48
-|				'ssl_cert'   - Path to the public key certificate file
49
-|				'ssl_ca'     - Path to the certificate authority file
50
-|				'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
51
-|				'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
52
-|				'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not
53
-|
54
-|	['compress'] Whether or not to use client compression (MySQL only)
55
-|	['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
56
-|							- good for ensuring strict SQL while developing
57
-|	['ssl_options']	Used to set various SSL options that can be used when making SSL connections.
58
-|	['failover'] array - A array with 0 or more data for connections if the main should fail.
59
-|	['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
60
-| 				NOTE: Disabling this will also effectively disable both
61
-| 				$this->db->last_query() and profiling of DB queries.
62
-| 				When you run a query, with this setting set to TRUE (default),
63
-| 				CodeIgniter will store the SQL statement for debugging purposes.
64
-| 				However, this may cause high memory usage, especially if you run
65
-| 				a lot of SQL queries ... disable this to avoid that problem.
66
-|
67
-| The $active_group variable lets you choose which connection group to
68
-| make active.  By default there is only one group (the 'default' group).
69
-|
70
-| The $query_builder variables lets you determine whether or not to load
71
-| the query builder class.
72
-*/
73
-$active_group = 'default';
74
-$query_builder = TRUE;
75
-
76
-$db['default'] = array(
77
-	'dsn'	=> '',
78
-	'hostname' => 'localhost',
79
-	'username' => '',
80
-	'password' => '',
81
-	'database' => '',
82
-	'dbdriver' => 'mysqli',
83
-	'dbprefix' => '',
84
-	'pconnect' => FALSE,
85
-	'db_debug' => (ENVIRONMENT !== 'production'),
86
-	'cache_on' => FALSE,
87
-	'cachedir' => '',
88
-	'char_set' => 'utf8',
89
-	'dbcollat' => 'utf8_general_ci',
90
-	'swap_pre' => '',
91
-	'encrypt' => FALSE,
92
-	'compress' => FALSE,
93
-	'stricton' => FALSE,
94
-	'failover' => array(),
95
-	'save_queries' => TRUE
96
-);

+ 0 - 67
application/config/database.php Voir le fichier

@@ -98,70 +98,3 @@ $db['default'] = array(
98 98
     'failover' => array(),
99 99
     'save_queries' => true,
100 100
 );
101
-
102
-/*
103
-if (isset($_SERVER["SERVER_NAME"])) {
104
-switch ($_SERVER["SERVER_NAME"]) {
105
-
106
-//DESARROLLO
107
-case "rielchyc":
108
-$db['default'] = array(
109
-'dsn'    => '',
110
-'hostname' => '217.125.90.43',
111
-//'hostname' => "localhost",
112
-'port' => '33306',
113
-//'port' => '3306',
114
-'username' => 'root',
115
-'password' => 'mindden2017',
116
-//'password' => '',
117
-'database' => 'rielchyc',
118
-'dbdriver' => 'mysqli',
119
-'dbprefix' => '',
120
-'pconnect' => FALSE,
121
-'db_debug' => (ENVIRONMENT !== 'production'),
122
-'cache_on' => FALSE,
123
-'cachedir' => '',
124
-'char_set' => 'utf8',
125
-'dbcollat' => 'utf8_general_ci',
126
-'swap_pre' => '',
127
-'encrypt' => FALSE,
128
-'compress' => FALSE,
129
-'stricton' => FALSE,
130
-'failover' => array(),
131
-'save_queries' => TRUE
132
-);
133
-break;
134
-
135
-//DESARROLLO STP
136
-case "mediosdev.stpnettraining.com":
137
-$db['default'] = array(
138
-'dsn'    => '',
139
-'hostname' => 'localhost',
140
-'port' => '3306',
141
-'username' => 'root_medios',
142
-'password' => 'uRp60x!9',
143
-'database' => 'admin_mediosdev',
144
-'dbdriver' => 'mysqli',
145
-'dbprefix' => '',
146
-'pconnect' => FALSE,
147
-'db_debug' => (ENVIRONMENT !== 'production'),
148
-'cache_on' => FALSE,
149
-'cachedir' => '',
150
-'char_set' => 'utf8',
151
-'dbcollat' => 'utf8_general_ci',
152
-'swap_pre' => '',
153
-'encrypt' => FALSE,
154
-'compress' => FALSE,
155
-'stricton' => FALSE,
156
-'failover' => array(),
157
-'save_queries' => TRUE
158
-);
159
-break;
160
-
161
-}
162
-}
163
-else {
164
-
165
-//CRONS
166
-$db['default']['database'] = 'rielchyc';
167
-}*/

+ 0 - 962
application/controllers/ExportXls.php Voir le fichier

@@ -1,962 +0,0 @@
1
-<?php
2
-
3
-defined('BASEPATH') or exit('No direct script access allowed');
4
-
5
-use PhpOffice\PhpSpreadsheet\Spreadsheet;
6
-use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
7
-
8
-class ExportXls extends CI_Controller
9
-{
10
-    private $filaDocumentoGeneral = 2;
11
-    private $filaDocumentoTech = 2;
12
-    private $filaDocumentoAdd = 2;
13
-    private $filaDocumentoLegal = 2;
14
-    private $filaProjectLot = 2;
15
-    private $filaDatoLicitacion = 2;
16
-
17
-    public function __construct()
18
-    {
19
-        parent::__construct();
20
-        $this->load->model("Xlsexport_model");
21
-    }
22
-
23
-    public function index()
24
-    {
25
-        $licitaciones = $this->Xlsexport_model->getLicitaciones("HAVING LI.fecha_creacion_log = '2022-02-23 11:06:44'");
26
-
27
-        insertBucleDuplicateOnKey($licitaciones['datos'], "vista_datos_licitacion", "");
28
-
29
-    }
30
-
31
-    public function exportDatosCompletos()
32
-    {
33
-        $licitacionesResult = $this->Xlsexport_model->getFullDatosUltimasInsertadas();
34
-
35
-        $result = array();
36
-
37
-        //$start = $this->starttime();
38
-        if ($licitacionesResult['num_rows'] > 0) {
39
-            $result = $this->mapearDatos($licitacionesResult);
40
-        }
41
-        $spreadsheet = new Spreadsheet();
42
-        $spreadsheet->createSheet();
43
-        $spreadsheet->createSheet();
44
-        $spreadsheet->createSheet();
45
-        $spreadsheet->createSheet();
46
-        $spreadsheet->createSheet();
47
-        $spreadsheet->createSheet();
48
-        $spreadsheet->createSheet();
49
-        $spreadsheet->createSheet();
50
-        $spreadsheet->createSheet();
51
-        $spreadsheet->createSheet();
52
-        $spreadsheet->createSheet();
53
-        $spreadsheet->createSheet();
54
-        $spreadsheet->createSheet();
55
-        $spreadsheet->createSheet();
56
-
57
-        $spreadsheet = $this->cabecerasOpenPlacspFirstSheet($spreadsheet);
58
-        $spreadsheet = $this->cabecerasOpenPlacsBitacora($spreadsheet, 1);
59
-        $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 11);
60
-        $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 12);
61
-        $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 13);
62
-        $spreadsheet = $this->cabecerasOpenPlacspDocumentos($spreadsheet, 14);
63
-        $spreadsheet = $this->cabeceraMediosComunicacion($spreadsheet);
64
-        $spreadsheet = $this->cabeceraMediosComunicacionDocumentos($spreadsheet);
65
-        $spreadsheet = $this->cabeceraTenderResult($spreadsheet);
66
-        $spreadsheet = $this->cabeceraTipoProcedimiento($spreadsheet);
67
-        $spreadsheet = $this->cabeceraTenderingTerms($spreadsheet);
68
-        $spreadsheet = $this->cabeceraCriterioADjudicacion($spreadsheet);
69
-        $spreadsheet = $this->cabeceraCriteriosFinancieros($spreadsheet);
70
-        $spreadsheet = $this->cabeceraCriteriosTecnicos($spreadsheet);
71
-        $spreadsheet = $this->cabeceraRequisitosParticipacion($spreadsheet);
72
-
73
-        $spreadsheet = $this->datosCompletosHojaLicitacion($spreadsheet, $result['hoja1']);
74
-        $spreadsheet = $this->datosCompletosHojaBitacora($spreadsheet, $result);
75
-        $spreadsheet = $this->datosCompletosMediosPublicacion($spreadsheet, $result['validNoticeInfo']);
76
-        $spreadsheet = $this->datosMedioPublicacion($spreadsheet, $result['validNoticeInfoDocumentos']);
77
-        $spreadsheet = $this->datosCriterioAdjudicacion($spreadsheet, $result['tenderAwarding']);
78
-        $spreadsheet = $this->datosCriterioEvaluacionFinanciera($spreadsheet, $result['tenderFinancial']);
79
-        $spreadsheet = $this->datosCriterioEvaluacionTecnica($spreadsheet, $result['tenderTecnicos']);
80
-        $spreadsheet = $this->datosRequisitosParticipacion($spreadsheet, $result['tenderQualification']);
81
-
82
-        $spreadsheet = $this->datosCompletosDocumentosGenerales($spreadsheet, $result['generalDocs']);
83
-        $spreadsheet = $this->datosCompletosDocumentosAdicionales($spreadsheet, $result['additDocs']);
84
-        $spreadsheet = $this->datosCompletosDocumentosTecnicos($spreadsheet, $result['techDocs']);
85
-        $spreadsheet = $this->datosCompletosDocumentosLegales($spreadsheet, $result['legalDocs']);
86
-        $spreadsheet = $this->datosCompletosTipoProcedimiento($spreadsheet, $result['tenderProcess']);
87
-        $spreadsheet = $this->datosCompletosOfertas($spreadsheet, $result['tenderingTerms']);
88
-        $spreadsheet = $this->datosCompletosResultadoDelProcedimiento($spreadsheet, $result['tenderResult']);
89
-
90
-        $nombreAchivo = 'test.xlsx';
91
-        $ruta = FCPATH . 'uploads/' . $nombreAchivo;
92
-
93
-        guardar_log("Excel", "Guardando Datos en excel--");
94
-        $writer = new Xlsx($spreadsheet);
95
-
96
-        $writer->save($ruta);
97
-
98
-        // Write the Excel file to filename some_excel_file.xlsx in the current directory
99
-        // Redirect output to a client’s web browser (Excel5)
100
-        guardar_log("Excel", "Enviando Excel");
101
-        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
102
-        header('Content-Disposition: attachment;filename=' . $nombreAchivo . '');
103
-        header('Pragma: cache');
104
-        header('Cache-Control: private');
105
-        //$objWriter = PHPExcel_IOFactory::createWriter($spreadsheet, 'Excel2007');
106
-        //$objWriter->save(FCPATH . 'uploads/' . $nombreAchivo);*/
107
-    }
108
-
109
-    public function starttime()
110
-    {
111
-        $r = explode(' ', microtime());
112
-        $r = $r[1] + $r;
113
-        return $r;
114
-    }
115
-
116
-    public function endtime($starttime)
117
-    {
118
-        $r = explode(' ', microtime());
119
-        $r = $r[1] + $r;
120
-        $r = round($r - $starttime, 4);
121
-        return '<strong>Execution Time</strong>: ' . $r . ' seconds<br />';
122
-    }
123
-
124
-    public function mapearDatos($licitacionesResult): array
125
-    {
126
-        $result = array();
127
-
128
-        guardar_log("Excel", "Montando array datos licitacion");
129
-        foreach ($licitacionesResult['datos'] as $licitacion) {
130
-
131
-            $result['hoja1'][$licitacion->id_licitacion]['licitacion'] = array(
132
-                'id_licitacion' => $licitacion->id_licitacion,
133
-                "link_uri" => $licitacion->link_uri,
134
-                "updated" => $licitacion->updated,
135
-                'estadoLicitacion' => $licitacion->estadoLicitacion,
136
-            );
137
-            $result['hoja1'][$licitacion->id_licitacion]['contract'] = array(
138
-                "descripcion" => $licitacion->contrato_status,
139
-                "contractFolderStatusCode" => $licitacion->contractFolderStatusCode,
140
-                "contractFolderID" => $licitacion->contractFolderID,
141
-            );
142
-            $result['hoja1'][$licitacion->id_licitacion]['locatedParty'] = array(
143
-                "contractingPartyTypeCode" => $licitacion->contractingPartyTypeCode,
144
-                "buyerProfileURIID" => $licitacion->buyerProfileURIID,
145
-                "tipo_administracion" => $licitacion->tipo_administracion,
146
-                "itemClassification_attr" => $licitacion->itemClassification_attr,
147
-            );
148
-            $result['hoja1'][$licitacion->id_licitacion]['party'] = array(
149
-                "partyName" => $licitacion->partyName,
150
-                "codpostal" => $licitacion->codpostal,
151
-                "websiteURI" => $licitacion->websiteURI,
152
-                "city" => $licitacion->city,
153
-                "direccion" => $licitacion->direccion,
154
-                "contact_name" => $licitacion->contact_name,
155
-                "contact_email" => $licitacion->contact_email,
156
-                "partyItem" => $licitacion->partyItem,
157
-                "tipoIdParty" => $licitacion->tipoIdParty,
158
-            );
159
-            $result['hoja1'][$licitacion->id_licitacion]['project'] = array(
160
-                "name" => $licitacion->nameProject,
161
-                "estimatedOverallContractAmount" => $licitacion->estimatedOverallContractAmount,
162
-                "taxExclusiveAmount" => $licitacion->taxExclusiveAmount,
163
-                "totalAmount" => $licitacion->totalAmount,
164
-                "tipo_contrato" => $licitacion->tipo_contrato,
165
-                "countrySubentityCode" => $licitacion->countrySubentityCode,
166
-                "countrySubentity" => $licitacion->countrySubentity,
167
-                "durationMesure" => $licitacion->durationMesure,
168
-                "medida" => $licitacion->medida,
169
-                "duracion_inicio" => $licitacion->duracion_inicio,
170
-                "duracion_fin" => $licitacion->duracion_fin,
171
-                "contractExtension" => $licitacion->contractExtension,
172
-
173
-            );
174
-            $result['hoja1'][$licitacion->id_licitacion]['tenderProcess'] = array(
175
-                "tipoTender" => $licitacion->tipoTender,
176
-                "contrato_sistema" => $licitacion->contrato_sistema,
177
-                "urgency" => $licitacion->urgency,
178
-                "submision" => $licitacion->submision,
179
-            );
180
-            $result['hoja1'][$licitacion->id_licitacion]['tenderTerms'] = array(
181
-                "procurementLegislationDocumentReference" => $licitacion->procurementLegislationDocumentReference,
182
-                "allowedSubcontractTerms" => $licitacion->allowedSubcontractTerms,
183
-            );
184
-        }
185
-
186
-        guardar_log("Excel", "Consulta Valid notice info");
187
-        $result['validNoticeInfo'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_valid_notice_info", "codice_valid_notice_info", "code", "noticeTypeCode");
188
-
189
-        guardar_log("Excel", "Consulta Valid notice info documentos");
190
-        $result['validNoticeInfoDocumentos'] = $this->Xlsexport_model->getTablaByFechaLog("global_valid_notice_info_documento");
191
-
192
-        guardar_log("Excel", "Consulta projectLot");
193
-        $result['projectLot'] = $this->Xlsexport_model->getProjectLotItem();
194
-
195
-        guardar_log("Excel", "Consulta documentos tecnicos");
196
-        $result['techDocs'] = $this->Xlsexport_model->getTablaByFechaLog("global_technical_documents");
197
-
198
-        guardar_log("Excel", "Consulta documentos legales");
199
-        $result['legalDocs'] = $this->Xlsexport_model->getTablaByFechaLog("global_legal_documents");
200
-
201
-        guardar_log("Excel", "Consulta documentos adicionales");
202
-        $result['additDocs'] = $this->Xlsexport_model->getTablaByFechaLog("global_additional_documents");
203
-
204
-        guardar_log("Excel", "Consulta documentos generales");
205
-        $result['generalDocs'] = $this->Xlsexport_model->getTablaByFechaLog("global_general_documents");
206
-
207
-        guardar_log("Excel", "Consulta tender process");
208
-        $result['tenderProcess'] = $this->Xlsexport_model->getTenderingTermsCodes();
209
-
210
-        guardar_log("Excel", "Consulta tender terms");
211
-        $result['tenderingTerms'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_tendering_terms", "codice_codigo_tipo_garantia", "code", "guaranteeTypeCode");
212
-
213
-        guardar_log("Excel", "Consulta tender result");
214
-        $result['tenderResult'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_tender_result", "codice_tender_result", "code", "resultCode");
215
-
216
-        guardar_log("Excel", "Consulta tender criterio financieros");
217
-        $result['tenderFinancial'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_tendering_terms_financial_evaluation", "codice_tendering_terms_financial", "code", "evaluationCriteriaTypeCode");
218
-
219
-        guardar_log("Excel", "Consulta tender criterio adjudicacion");
220
-        $result['tenderAwarding'] = $this->Xlsexport_model->getTablaByFechaLog("global_tendering_terms_awarding_terms");
221
-
222
-        guardar_log("Excel", "Consulta tender criterios tecnicos");
223
-        $result['tenderTecnicos'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_tendering_terms_qualification_request", "codice_tendering_terms_qualification_request", "code", "evaluationCriteriaTypeCode");
224
-
225
-        guardar_log("Excel", "Consulta tender requisitos participacion");
226
-        $result['tenderQualification'] = $this->Xlsexport_model->getDatosRelacionadasTablaWithoutLicitacion("global_tendering_terms_specific_terms", "codice_tendering_terms_specific_terms", "code", "evaluationCriteriaTypeCode");
227
-
228
-        return $result;
229
-    }
230
-
231
-    private function datosCompletosHojaLicitacion($spreadsheet, $datosLicitacion)
232
-    {
233
-
234
-        $sheet = $spreadsheet->getSheet(0);
235
-        $sheet->setTitle("Datos Licitación");
236
-        $styleArr = array(
237
-            "font" => array(
238
-                "bold" => true,
239
-                "color" => array("rgb" => "22B9FF"),
240
-                "size" => 13,
241
-            ),
242
-        );
243
-
244
-        //Primera Publicacion
245
-        $contador = 0;
246
-        foreach ($datosLicitacion as $row) {
247
-            guardar_log("Excel", "Escribir excel datos licitacion--" . $contador);
248
-            $contador++;
249
-            $primeraPublicacion = $this->primeraPublicacion($row['licitacion']['id_licitacion']);
250
-
251
-            $updated = $this->formatFechas($row['licitacion']['updated']);
252
-
253
-            $sheet->getStyle("A1:AJ1")->applyFromArray($styleArr);
254
-            $sheet->setCellValue('A' . $this->filaDatoLicitacion, $row['licitacion']['id_licitacion']);
255
-            $sheet->setCellValue('B' . $this->filaDatoLicitacion, $row['licitacion']['link_uri']);
256
-            $sheet->setCellValue('C' . $this->filaDatoLicitacion, $updated);
257
-            $sheet->getStyle('C' . $this->filaDatoLicitacion)
258
-                ->getNumberFormat()
259
-                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
260
-            $sheet->setCellValue('D' . $this->filaDatoLicitacion, $row['licitacion']['estadoLicitacion']);
261
-            $sheet->setCellValue('E' . $this->filaDatoLicitacion, $primeraPublicacion);
262
-            $sheet->getStyle('E' . $this->filaDatoLicitacion)
263
-                ->getNumberFormat()
264
-                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
265
-            $sheet->setCellValue('F' . $this->filaDatoLicitacion, $row['contract']['descripcion']);
266
-            $sheet->setCellValue('G' . $this->filaDatoLicitacion, $row['contract']['contractFolderID']);
267
-            $sheet->setCellValue('H' . $this->filaDatoLicitacion, $row['project']['name']);
268
-            $sheet->setCellValue('I' . $this->filaDatoLicitacion, $row['project']['estimatedOverallContractAmount']);
269
-            $sheet->getStyle('I' . $this->filaDatoLicitacion)
270
-                ->getNumberFormat()
271
-                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
272
-            $sheet->setCellValue('J' . $this->filaDatoLicitacion, $row['project']['taxExclusiveAmount']);
273
-            $sheet->getStyle('J' . $this->filaDatoLicitacion)
274
-                ->getNumberFormat()
275
-                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
276
-
277
-            $sheet->setCellValue('K' . $this->filaDatoLicitacion, $row['locatedParty']['itemClassification_attr']);
278
-            $sheet->setCellValue('L' . $this->filaDatoLicitacion, $row['project']['tipo_contrato']);
279
-            $sheet->setCellValue('M' . $this->filaDatoLicitacion, $row['project']['countrySubentity']);
280
-            $sheet->setCellValue('N' . $this->filaDatoLicitacion, $row['party']['partyName']);
281
-            $sheet->setCellValue('O' . $this->filaDatoLicitacion, ($row['party']['tipoIdParty'] == "DIR3") ? $row['party']['partyItem'] : "");
282
-            $sheet->setCellValue('P' . $this->filaDatoLicitacion, $row['locatedParty']['buyerProfileURIID']);
283
-            $sheet->setCellValue('Q' . $this->filaDatoLicitacion, $row['locatedParty']['tipo_administracion']);
284
-            $sheet->setCellValue('R' . $this->filaDatoLicitacion, $row['party']['codpostal']);
285
-            $sheet->setCellValue('S' . $this->filaDatoLicitacion, $row['tenderProcess']['tipoTender']);
286
-            $sheet->setCellValue('T' . $this->filaDatoLicitacion, $row['tenderProcess']['contrato_sistema']);
287
-            $sheet->setCellValue('U' . $this->filaDatoLicitacion, $row['tenderProcess']['urgency']);
288
-            $sheet->setCellValue('V' . $this->filaDatoLicitacion, $row['tenderProcess']['submision']);
289
-            $sheet->setCellValue('W' . $this->filaDatoLicitacion, $row['tenderTerms']['procurementLegislationDocumentReference']);
290
-            $sheet->setCellValue('X' . $this->filaDatoLicitacion, $row['tenderTerms']['allowedSubcontractTerms']);
291
-            $sheet->setCellValue('Y' . $this->filaDatoLicitacion, $row['project']['durationMesure']);
292
-            $sheet->setCellValue('Z' . $this->filaDatoLicitacion, $row['project']['medida']);
293
-            $sheet->setCellValue('AA' . $this->filaDatoLicitacion, $this->formatFechas($row['project']['duracion_inicio']));
294
-            $sheet->getStyle('AA' . $this->filaDatoLicitacion)
295
-                ->getNumberFormat()
296
-                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
297
-            $sheet->setCellValue('AB' . $this->filaDatoLicitacion, $this->formatFechas($row['project']['duracion_fin']));
298
-            $sheet->getStyle('AB' . $this->filaDatoLicitacion)
299
-                ->getNumberFormat()
300
-                ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
301
-            $sheet->setCellValue('AC' . $this->filaDatoLicitacion, $row['project']['contractExtension']);
302
-            $sheet->setCellValue('AD' . $this->filaDatoLicitacion, $row['party']['websiteURI']);
303
-            $sheet->setCellValue('AE' . $this->filaDatoLicitacion, $row['party']['city']);
304
-            $sheet->setCellValue('AF' . $this->filaDatoLicitacion, $row['party']['direccion']);
305
-            $sheet->setCellValue('AG' . $this->filaDatoLicitacion, $row['party']['contact_name']);
306
-            $sheet->setCellValue('AH' . $this->filaDatoLicitacion, $row['party']['contact_email']);
307
-            $this->filaDatoLicitacion++;
308
-        }
309
-
310
-        return $spreadsheet;
311
-
312
-    }
313
-
314
-    private function formatFechas($fecha)
315
-    {
316
-        $fechaFinal = "";
317
-
318
-        if ($fecha != "0000-00-00" && $fecha != "0000-00-00 00:00:00") {
319
-            $fechaFormat = new DateTime($fecha);
320
-            $fechaFinal = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($fechaFormat);
321
-        } else if ($fecha === "0000-00-00") {
322
-            //$fechaFinal = "00/00/0000";
323
-            $fechaFinal = "";
324
-        } else if ($fecha === "0000-00-00 00:00:00") {
325
-            //$fechaFinal = "00/00/0000 00:00";
326
-            $fechaFinal = "";
327
-        }
328
-
329
-        return $fechaFinal;
330
-    }
331
-
332
-    private function primeraPublicacion($idLicitacion)
333
-    {
334
-        $result = "";
335
-
336
-        $fechasPublicaciones = $this->Xlsexport_model->getFechasPublicadas($idLicitacion);
337
-
338
-        if ($fechasPublicaciones['num_rows'] > 0) {
339
-            $primeraFechaFormat = new Datetime($fechasPublicaciones['datos']->fecha);
340
-            $result = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($primeraFechaFormat);
341
-        }
342
-        return $result;
343
-    }
344
-
345
-    private function datosCompletosHojaBitacora($spreadsheet, $datosLicitacion)
346
-    {
347
-        $sheet = $spreadsheet->getSheet(1);
348
-        $sheet->setTitle("Bitacora");
349
-        $styleArr = array(
350
-            "font" => array(
351
-                "bold" => true,
352
-                "color" => array("rgb" => "22B9FF"),
353
-                "size" => 13,
354
-            ),
355
-        );
356
-        $sheet->getStyle("A1:F1")->applyFromArray($styleArr);
357
-        $contador = 0;
358
-        foreach ($datosLicitacion['projectLot']['datos'] as $bitacora) {
359
-            guardar_log("Excel", "Escribir bitacora--" . $contador);
360
-            $contador++;
361
-            $sheet->SetCellValue('A' . $this->filaProjectLot, $bitacora['id_ajena_licitacion']);
362
-            $sheet->SetCellValue('B' . $this->filaProjectLot, $bitacora['name']);
363
-            $sheet->setCellValue('C' . $this->filaProjectLot, $bitacora['idProcurementLot']);
364
-            $sheet->SetCellValue('D' . $this->filaProjectLot, $bitacora['taxExclusiveAmount']);
365
-            $sheet->SetCellValue('E' . $this->filaProjectLot, $bitacora['countrySubentity']);
366
-            $sheet->SetCellValue('F' . $this->filaProjectLot, $bitacora['itemClassification_attr']);
367
-            $this->filaProjectLot++;
368
-        }
369
-        return $spreadsheet;
370
-    }
371
-
372
-    private function datosCompletosMediosPublicacion($spreadsheet, $datos)
373
-    {
374
-        $sheet = $spreadsheet->getSheet(2);
375
-        $sheet->setTitle("Medios de publicación");
376
-
377
-        if ($datos['num_rows'] > 0) {
378
-            $contador = 0;
379
-            $aux = 2;
380
-            foreach ($datos['datos'] as $datos) {
381
-                guardar_log("Excel", "Escribir datos medio publicacion--" . $contador);
382
-                $contador++;
383
-                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
384
-                $sheet->SetCellValue('B' . $aux, $datos['code_desc']);
385
-                $sheet->SetCellValue('C' . $aux, $datos['publicationMediaName']);
386
-                $aux++;
387
-            }
388
-        }
389
-
390
-        return $spreadsheet;
391
-    }
392
-
393
-    private function datosMedioPublicacion($spreadsheet, $datos)
394
-    {
395
-        $sheet = $spreadsheet->getSheet(3);
396
-        $sheet->setTitle("Documentos Medios Comm");
397
-
398
-        if ($datos['num_rows'] > 0) {
399
-            $aux = 2;
400
-            $contador = 0;
401
-            foreach ($datos['datos'] as $row) {
402
-                guardar_log("Excel", "Escribir documentios medios comunicacion--" . $contador);
403
-                $contador++;
404
-                $sheet->SetCellValue('A' . $aux, $row['id_ajena_licitacion']);
405
-                $sheet->SetCellValue('B' . $aux, $row['documento']);
406
-                $sheet->SetCellValue('C' . $aux, $row['filename']);
407
-
408
-                $aux++;
409
-            }
410
-        }
411
-        return $spreadsheet;
412
-    }
413
-
414
-    private function datosCompletosResultadoDelProcedimiento($spreadsheet, $datos)
415
-    {
416
-        $sheet = $spreadsheet->getSheet(4);
417
-        $sheet->setTitle("Resultado del Procedimiento");
418
-
419
-        if ($datos['num_rows'] > 0) {
420
-            $aux = 2;
421
-            $contador = 0;
422
-            foreach ($datos['datos'] as $datos) {
423
-                guardar_log("Excel", "Escribir tender result--" . $contador);
424
-                $contador++;
425
-                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
426
-                $sheet->SetCellValue('B' . $aux, $datos['code_desc']);
427
-                $sheet->SetCellValue('C' . $aux, $datos['description']);
428
-                $sheet->SetCellValue('D' . $aux, $this->formatFechas($datos['awardDate']));
429
-                $sheet->getStyle('D' . $aux)
430
-                    ->getNumberFormat()
431
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
432
-                $sheet->SetCellValue('E' . $aux, $datos['receivedTenderQuantity']);
433
-                $sheet->SetCellValue('F' . $aux, $datos['lowerTenderAmount']);
434
-                $sheet->getStyle('F' . $aux)
435
-                    ->getNumberFormat()
436
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
437
-                $sheet->SetCellValue('G' . $aux, $datos['higherTenderAmount']);
438
-                $sheet->getStyle('G' . $aux)
439
-                    ->getNumberFormat()
440
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
441
-                $sheet->SetCellValue('H' . $aux, $datos['abnormallyLowTendersIndicator']);
442
-                //$sheet->SetCellValue('I' . $aux, $datos['startDate']);
443
-                $sheet->SetCellValue('I' . $aux, $this->formatFechas($datos['startDate']));
444
-                $sheet->getStyle('I' . $aux)
445
-                    ->getNumberFormat()
446
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
447
-                $sheet->SetCellValue('J' . $aux, $datos['smeawardedIndicator']);
448
-                $sheet->SetCellValue('K' . $aux, $datos['contract_id']);
449
-                $sheet->SetCellValue('L' . $aux, $this->formatFechas($datos['contract_issueDate']));
450
-                $sheet->getStyle('L' . $aux)
451
-                    ->getNumberFormat()
452
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
453
-                $sheet->SetCellValue('M' . $aux, $datos['partyIdentification']);
454
-                $sheet->SetCellValue('N' . $aux, $datos['partyName']);
455
-                $sheet->SetCellValue('O' . $aux, $datos['TaxExclusiveAmount']);
456
-                $sheet->getStyle('O' . $aux)
457
-                    ->getNumberFormat()
458
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
459
-
460
-                $aux++;
461
-            }
462
-        }
463
-        return $spreadsheet;
464
-    }
465
-
466
-    private function datosCompletosTipoProcedimiento($spreadsheet, $datos)
467
-    {
468
-        $sheet = $spreadsheet->getSheet(5);
469
-        $sheet->setTitle("Tipo Procedimiento");
470
-
471
-        //$datos = $this->Xlsexport_model->getTenderProcessRelacion();
472
-        if ($datos['num_rows'] > 0) {
473
-            $aux = 2;
474
-            $contador = 0;
475
-            foreach ($datos['datos'] as $datos) {
476
-                guardar_log("Excel", "Escribir tender process--" . $contador);
477
-                $contador++;
478
-                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
479
-                $sheet->SetCellValue('B' . $aux, $datos['tipoTender']);
480
-                $sheet->SetCellValue('C' . $aux, $datos['urgency']);
481
-                $sheet->SetCellValue('D' . $aux, $datos['contrato_sistema']);
482
-                $sheet->SetCellValue('E' . $aux, $datos['partPresentationCode']);
483
-                $sheet->SetCellValue('F' . $aux, $datos['submision']);
484
-                $sheet->SetCellValue('G' . $aux, $datos['maximumLotPresentationQuantity']);
485
-                $sheet->SetCellValue('H' . $aux, $datos['maximumTendererAwardedLotsQuantity']);
486
-                $sheet->SetCellValue('I' . $aux, $datos['lotsCombinationContractingAuthorityRights']);
487
-                $sheet->SetCellValue('J' . $aux, $this->formatFechas($datos['deadLineEndDate']));
488
-                $sheet->getStyle('J' . $aux)
489
-                    ->getNumberFormat()
490
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
491
-                $sheet->SetCellValue('K' . $aux, $datos['deadLineEndTime']);
492
-                $sheet->SetCellValue('L' . $aux, $datos['deadLineDescription']);
493
-                $sheet->SetCellValue('M' . $aux, $datos['auctionTerms']);
494
-                $sheet->SetCellValue('N' . $aux, $this->formatFechas($datos['documentAvailablePeriod_EndDate']));
495
-                $sheet->getStyle('N' . $aux)
496
-                    ->getNumberFormat()
497
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
498
-                $sheet->SetCellValue('O' . $aux, $datos['documentAvailablePeriod_EndTime']);
499
-                $sheet->getStyle('O' . $aux)
500
-                    ->getNumberFormat()
501
-                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
502
-
503
-                $aux++;
504
-            }
505
-        }
506
-
507
-        return $spreadsheet;
508
-    }
509
-
510
-    private function datosCompletosOfertas($spreadsheet, $datos)
511
-    {
512
-        $sheet = $spreadsheet->getSheet(6);
513
-        $sheet->setTitle("Ofertas");
514
-
515
-        if ($datos['num_rows'] > 0) {
516
-            $aux = 2;
517
-            $contador = 0;
518
-            foreach ($datos['datos'] as $datos) {
519
-                guardar_log("Excel", "Escribir tender process--" . $contador);
520
-                $contador++;
521
-                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
522
-                $sheet->SetCellValue('B' . $aux, $datos['variantConstraintIndicator']);
523
-                $sheet->SetCellValue('C' . $aux, $datos['code_desc']);
524
-                $sheet->SetCellValue('D' . $aux, $datos['requiredFinancialGuarantee_Amount']);
525
-                $sheet->SetCellValue('E' . $aux, $datos['allowedSubcontractTerms']);
526
-                $sheet->SetCellValue('F' . $aux, $datos['description']);
527
-                $sheet->SetCellValue('G' . $aux, $datos['personalSituation']);
528
-                $sheet->SetCellValue('H' . $aux, $datos['procurementLegislationDocumentReference']);
529
-                $aux++;
530
-            }
531
-        }
532
-
533
-        return $spreadsheet;
534
-    }
535
-
536
-    private function datosCriterioAdjudicacion($spreadsheet, $datos)
537
-    {
538
-        $sheet = $spreadsheet->getSheet(7);
539
-        $sheet->setTitle("Criterio Adjudicación");
540
-
541
-        if ($datos['num_rows'] > 0) {
542
-            $aux = 2;
543
-            $contador = 0;
544
-            foreach ($datos['datos'] as $datos) {
545
-                guardar_log("Excel", "Escribir criterio adjucicacion--" . $contador);
546
-                $contador++;
547
-                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
548
-                $sheet->SetCellValue('B' . $aux, $datos['description']);
549
-                $sheet->SetCellValue('C' . $aux, $datos['evaluationCriteriaTypeCode']);
550
-                $aux++;
551
-            }
552
-        }
553
-
554
-        return $spreadsheet;
555
-    }
556
-
557
-    private function datosCriterioEvaluacionFinanciera($spreadsheet, $datos)
558
-    {
559
-        $sheet = $spreadsheet->getSheet(8);
560
-        $sheet->setTitle("CriteriosEvaluacionFinanciera");
561
-
562
-        if ($datos['num_rows'] > 0) {
563
-            $aux = 2;
564
-            $contador = 0;
565
-            foreach ($datos['datos'] as $datos) {
566
-                guardar_log("Excel", "Escribir criterios evaluacion financiera--" . $contador);
567
-                $contador++;
568
-                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
569
-                $sheet->SetCellValue('B' . $aux, $datos['code_desc']);
570
-                $sheet->SetCellValue('C' . $aux, $datos['description']);
571
-                $aux++;
572
-            }
573
-        }
574
-        return $spreadsheet;
575
-    }
576
-
577
-    private function datosCriterioEvaluacionTecnica($spreadsheet, $datos)
578
-    {
579
-        $sheet = $spreadsheet->getSheet(9);
580
-        $sheet->setTitle("Criterios Evaluación Técnica");
581
-
582
-        if ($datos['num_rows'] > 0) {
583
-            $aux = 2;
584
-            $contador = 0;
585
-            foreach ($datos['datos'] as $datos) {
586
-                guardar_log("Excel", "Escribir criterio evaluacion tecnica--" . $contador);
587
-                $contador++;
588
-                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
589
-                $sheet->SetCellValue('B' . $aux, $datos['code_desc']);
590
-                $sheet->SetCellValue('C' . $aux, $datos['description']);
591
-                $aux++;
592
-            }
593
-        }
594
-
595
-        return $spreadsheet;
596
-    }
597
-
598
-    private function datosRequisitosParticipacion($spreadsheet, $datos)
599
-    {
600
-        $sheet = $spreadsheet->getSheet(10);
601
-        $sheet->setTitle("Requisitos Participación");
602
-
603
-        if ($datos['num_rows'] > 0) {
604
-            $aux = 2;
605
-            $contador = 0;
606
-            foreach ($datos['datos'] as $datos) {
607
-                guardar_log("Excel", "Escribir requisitos participacion--" . $contador);
608
-                $contador++;
609
-                $sheet->SetCellValue('A' . $aux, $datos['id_ajena_licitacion']);
610
-                $sheet->SetCellValue('B' . $aux, $datos['code_desc']);
611
-                $aux++;
612
-            }
613
-
614
-        }
615
-        return $spreadsheet;
616
-    }
617
-
618
-    private function datosCompletosDocumentosGenerales($spreadsheet, $datosLicitacion)
619
-    {
620
-        $sheet = $spreadsheet->getSheet(11);
621
-        $sheet->setTitle("Documentos Generales");
622
-        $contador = 0;
623
-        foreach ($datosLicitacion['datos'] as $doc) {
624
-            guardar_log("Excel", "Escribir documentos generales--" . $contador);
625
-            $contador++;
626
-            $sheet->SetCellValue('A' . $this->filaDocumentoGeneral, $doc['id_ajena_licitacion']);
627
-            $sheet->SetCellValue('B' . $this->filaDocumentoGeneral, $doc['attachment']);
628
-            $sheet->SetCellValue('C' . $this->filaDocumentoGeneral, $doc['fileName']);
629
-
630
-            $this->filaDocumentoGeneral++;
631
-        }
632
-
633
-        return $spreadsheet;
634
-    }
635
-
636
-    private function datosCompletosDocumentosAdicionales($spreadsheet, $datosLicitacion)
637
-    {
638
-        $sheet = $spreadsheet->getSheet(12);
639
-        $sheet->setTitle("Documentos Adicionales");
640
-        $contador = 0;
641
-        foreach ($datosLicitacion['datos'] as $doc) {
642
-            guardar_log("Excel", "Escribir documentos adicionales--" . $contador);
643
-            $contador++;
644
-            $sheet->SetCellValue('A' . $this->filaDocumentoAdd, $doc['id_ajena_licitacion']);
645
-            $sheet->SetCellValue('B' . $this->filaDocumentoAdd, $doc['attachment']);
646
-            $sheet->SetCellValue('C' . $this->filaDocumentoAdd, $doc['idDoc']);
647
-
648
-            $this->filaDocumentoAdd++;
649
-        }
650
-        return $spreadsheet;
651
-    }
652
-
653
-    private function datosCompletosDocumentosTecnicos($spreadsheet, $datosLicitacion)
654
-    {
655
-        $sheet = $spreadsheet->getSheet(13);
656
-        $sheet->setTitle("Documentos Técnicos");
657
-        $contador = 0;
658
-        foreach ($datosLicitacion['datos'] as $doc) {
659
-            guardar_log("Excel", "Escribir documentos tecnicos--" . $contador);
660
-            $contador++;
661
-            $sheet->SetCellValue('A' . $this->filaDocumentoTech, $doc['id_ajena_licitacion']);
662
-            $sheet->SetCellValue('B' . $this->filaDocumentoTech, $doc['attachment']);
663
-            $sheet->SetCellValue('C' . $this->filaDocumentoTech, $doc['idDoc']);
664
-
665
-            $this->filaDocumentoTech++;
666
-        }
667
-        return $spreadsheet;
668
-    }
669
-
670
-    private function datosCompletosDocumentosLegales($spreadsheet, $datosLicitacion)
671
-    {
672
-        $sheet = $spreadsheet->getSheet(14);
673
-        $sheet->setTitle("Documentos Legales");
674
-        $contador = 0;
675
-        foreach ($datosLicitacion['datos'] as $doc) {
676
-            guardar_log("Excel", "Escribir documentos legales--" . $contador);
677
-            $contador++;
678
-            $sheet->SetCellValue('A' . $this->filaDocumentoLegal, $doc['id_ajena_licitacion']);
679
-            $sheet->SetCellValue('B' . $this->filaDocumentoLegal, $doc['attachment']);
680
-            $sheet->SetCellValue('C' . $this->filaDocumentoLegal, $doc['idDoc']);
681
-
682
-            $this->filaDocumentoLegal++;
683
-        }
684
-        return $spreadsheet;
685
-    }
686
-
687
-    private function cabecerasOpenPlacspFirstSheet($spreadsheet)
688
-    {
689
-        $spreadsheet->setActiveSheetIndex(0);
690
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', "Identificador");
691
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', "Link licitación");
692
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', "Fecha actualización");
693
-        $spreadsheet->getActiveSheet()->SetCellValue('D1', "Vigente/Anulada/Archivada");
694
-        $spreadsheet->getActiveSheet()->SetCellValue('E1', "Primera publicación");
695
-        $spreadsheet->getActiveSheet()->SetCellValue('F1', "Estado");
696
-        $spreadsheet->getActiveSheet()->SetCellValue('G1', "Número de expediente");
697
-        $spreadsheet->getActiveSheet()->SetCellValue('H1', "Objeto del Contrato");
698
-        $spreadsheet->getActiveSheet()->SetCellValue('I1', "Valor estimado del contrato");
699
-        $spreadsheet->getActiveSheet()->SetCellValue('J1', "Presupuesto base sin impuestos");
700
-        $spreadsheet->getActiveSheet()->SetCellValue('K1', "CPV");
701
-        $spreadsheet->getActiveSheet()->SetCellValue('L1', "Tipo de contrato");
702
-        $spreadsheet->getActiveSheet()->SetCellValue('M1', "Lugar de ejecución");
703
-        $spreadsheet->getActiveSheet()->SetCellValue('N1', "Órgano de Contratación");
704
-        $spreadsheet->getActiveSheet()->SetCellValue('O1', "DIR3");
705
-        $spreadsheet->getActiveSheet()->SetCellValue('P1', "Enlace al Perfil de Contratante del OC");
706
-        $spreadsheet->getActiveSheet()->SetCellValue('Q1', "Tipo de Administración");
707
-        $spreadsheet->getActiveSheet()->SetCellValue('R1', "Código Postal");
708
-        $spreadsheet->getActiveSheet()->SetCellValue('S1', "Tipo de procedimiento");
709
-        $spreadsheet->getActiveSheet()->SetCellValue('T1', "Sistema de contratación");
710
-        $spreadsheet->getActiveSheet()->SetCellValue('U1', "Tramitación");
711
-        $spreadsheet->getActiveSheet()->SetCellValue('V1', "Forma de presentación de la oferta");
712
-        $spreadsheet->getActiveSheet()->SetCellValue('W1', "Directiva de aplicación");
713
-        $spreadsheet->getActiveSheet()->SetCellValue('X1', "Subcontratación permitida");
714
-        $spreadsheet->getActiveSheet()->SetCellValue('Y1', "Duración Contrato");
715
-        $spreadsheet->getActiveSheet()->SetCellValue('Z1', "Tipo de duración");
716
-        $spreadsheet->getActiveSheet()->SetCellValue('AA1', "Inicio contrato");
717
-        $spreadsheet->getActiveSheet()->SetCellValue('AB1', "Fin contrato");
718
-        $spreadsheet->getActiveSheet()->SetCellValue('AC1', "Extension Contrato");
719
-        $spreadsheet->getActiveSheet()->SetCellValue('AD1', "URL Organo Contratación");
720
-        $spreadsheet->getActiveSheet()->SetCellValue('AE1', "Ciudad Organo Contratación");
721
-        $spreadsheet->getActiveSheet()->SetCellValue('AF1', "Dirección Organo Contratación");
722
-        $spreadsheet->getActiveSheet()->SetCellValue('AG1', "Nombre Contacto Organo Contratación");
723
-        $spreadsheet->getActiveSheet()->SetCellValue('AH1', "Email contacto Organo Contratación");
724
-        return $spreadsheet;
725
-    }
726
-
727
-    //Cabeceras
728
-    private function cabecerasOpenPlacspDocumentos($spreadsheet, $hojaActiva)
729
-    {
730
-        $sheet = $spreadsheet->getSheet($hojaActiva);
731
-        $styleArr = array(
732
-            "font" => array(
733
-                "bold" => true,
734
-                "color" => array("rgb" => "22B9FF"),
735
-                "size" => 13,
736
-            ),
737
-        );
738
-        $sheet->getStyle("A1:D1")->applyFromArray($styleArr);
739
-        $spreadsheet->setActiveSheetIndex($hojaActiva);
740
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', "Identificador");
741
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', "Link Documento");
742
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', "Nombre Documento");
743
-
744
-        return $spreadsheet;
745
-    }
746
-
747
-    private function cabecerasOpenPlacsBitacora($spreadsheet, $hojaActiva)
748
-    {
749
-        $sheet = $spreadsheet->getSheet($hojaActiva);
750
-        $styleArr = array(
751
-            "font" => array(
752
-                "bold" => true,
753
-                "color" => array("rgb" => "22B9FF"),
754
-                "size" => 13,
755
-            ),
756
-        );
757
-        $sheet->getStyle("A1:F1")->applyFromArray($styleArr);
758
-        $spreadsheet->setActiveSheetIndex($hojaActiva);
759
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', "Identificador");
760
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', "Objeto del lote");
761
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', "Número de lote");
762
-        $spreadsheet->getActiveSheet()->SetCellValue('D1', "Importe sin Impuestos");
763
-        $spreadsheet->getActiveSheet()->SetCellValue('E1', "Lugar de ejecución del lote");
764
-        $spreadsheet->getActiveSheet()->SetCellValue('F1', "CPV");
765
-
766
-        return $spreadsheet;
767
-    }
768
-
769
-    private function cabeceraMediosComunicacion($spreadsheet)
770
-    {
771
-        $sheet = $spreadsheet->getSheet(2);
772
-        $styleArr = array(
773
-            "font" => array(
774
-                "bold" => true,
775
-                "color" => array("rgb" => "22B9FF"),
776
-                "size" => 13,
777
-            ),
778
-        );
779
-        $sheet->getStyle("A1:C1")->applyFromArray($styleArr);
780
-        $spreadsheet->setActiveSheetIndex(2);
781
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', 'Identificador');
782
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Tipo de anuncio');
783
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Medio de publicación');
784
-
785
-        return $spreadsheet;
786
-    }
787
-
788
-    private function cabeceraMediosComunicacionDocumentos($spreadsheet)
789
-    {
790
-        $sheet = $spreadsheet->getSheet(3);
791
-        $styleArr = array(
792
-            "font" => array(
793
-                "bold" => true,
794
-                "color" => array("rgb" => "22B9FF"),
795
-                "size" => 13,
796
-            ),
797
-        );
798
-        $sheet->getStyle("A1:C1")->applyFromArray($styleArr);
799
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', 'Identificador');
800
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Documento');
801
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Nombre Documento');
802
-
803
-        return $spreadsheet;
804
-    }
805
-
806
-    private function cabeceraTenderResult($spreadsheet)
807
-    {
808
-        $sheet = $spreadsheet->getSheet(4);
809
-        $styleArr = array(
810
-            "font" => array(
811
-                "bold" => true,
812
-                "color" => array("rgb" => "22B9FF"),
813
-                "size" => 13,
814
-            ),
815
-        );
816
-        $sheet->getStyle("A1:O1")->applyFromArray($styleArr);
817
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', 'Identificador');
818
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Tipo de resultado');
819
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Motivación adjudicación');
820
-        $spreadsheet->getActiveSheet()->SetCellValue('D1', 'Fecha del acuerdo');
821
-        $spreadsheet->getActiveSheet()->SetCellValue('E1', 'Número de licitadores participadores');
822
-        $spreadsheet->getActiveSheet()->SetCellValue('F1', 'Importe Oferta mas baja');
823
-        $spreadsheet->getActiveSheet()->SetCellValue('G1', 'Importe Oferta mas alta');
824
-        $spreadsheet->getActiveSheet()->SetCellValue('H1', 'Ofertas Temerarias Descartadas');
825
-        $spreadsheet->getActiveSheet()->SetCellValue('I1', 'Fecha de entrada en vigor');
826
-        $spreadsheet->getActiveSheet()->SetCellValue('J1', 'Identifica si es una PYME');
827
-        $spreadsheet->getActiveSheet()->SetCellValue('K1', 'Identificador del contrato');
828
-        $spreadsheet->getActiveSheet()->SetCellValue('L1', 'Fecha de formalización');
829
-        $spreadsheet->getActiveSheet()->SetCellValue('M1', 'Adjudicatario CIF');
830
-        $spreadsheet->getActiveSheet()->SetCellValue('N1', 'Nombre Adjudicatario');
831
-        $spreadsheet->getActiveSheet()->SetCellValue('O1', 'Importe de adjudicación sin impuestos');
832
-        return $spreadsheet;
833
-    }
834
-
835
-    private function cabeceraTipoProcedimiento($spreadsheet)
836
-    {
837
-        $sheet = $spreadsheet->getSheet(5);
838
-        $styleArr = array(
839
-            "font" => array(
840
-                "bold" => true,
841
-                "color" => array("rgb" => "22B9FF"),
842
-                "size" => 13,
843
-            ),
844
-        );
845
-        $sheet->getStyle("A1:O1")->applyFromArray($styleArr);
846
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', 'Identificador');
847
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Tipo de Procedimiento');
848
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Tipo de Tramitación');
849
-        $spreadsheet->getActiveSheet()->SetCellValue('D1', 'Sistema de Contratación');
850
-        $spreadsheet->getActiveSheet()->SetCellValue('E1', 'Número de lotes a los que se debe ofertar');
851
-        $spreadsheet->getActiveSheet()->SetCellValue('F1', 'Presentación de la oferta');
852
-        $spreadsheet->getActiveSheet()->SetCellValue('G1', 'Número de lotes a los que se puede ofertar');
853
-        $spreadsheet->getActiveSheet()->SetCellValue('H1', 'Número máximo de lotes que se puede adjudicar un licitador');
854
-        $spreadsheet->getActiveSheet()->SetCellValue('I1', 'El poder adjudicador se reserva el derecho de adjudicar contratos que combinen lotes');
855
-        $spreadsheet->getActiveSheet()->SetCellValue('J1', 'Fecha limite para la presentación de ofertas');
856
-        $spreadsheet->getActiveSheet()->SetCellValue('K1', 'Tiempo limite para la presentación de ofertas');
857
-        $spreadsheet->getActiveSheet()->SetCellValue('L1', 'Texto descriptivo de fecha limite de presentación de ofertas');
858
-        $spreadsheet->getActiveSheet()->SetCellValue('M1', 'Usa subasta electronica');
859
-        $spreadsheet->getActiveSheet()->SetCellValue('N1', 'Fecha límite para obtener los pliegos');
860
-        $spreadsheet->getActiveSheet()->SetCellValue('O1', 'Hora límite para obtener los pliegos');
861
-
862
-        return $spreadsheet;
863
-    }
864
-
865
-    private function cabeceraTenderingTerms($spreadsheet)
866
-    {
867
-        $sheet = $spreadsheet->getSheet(6);
868
-        $styleArr = array(
869
-            "font" => array(
870
-                "bold" => true,
871
-                "color" => array("rgb" => "22B9FF"),
872
-                "size" => 13,
873
-            ),
874
-        );
875
-        $sheet->getStyle("A1:K1")->applyFromArray($styleArr);
876
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', 'Identificador');
877
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Indica que se pueden ofertar variantes');
878
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Tipo de garantia');
879
-        $spreadsheet->getActiveSheet()->SetCellValue('D1', 'Porcentaje de la garantíaa');
880
-        $spreadsheet->getActiveSheet()->SetCellValue('E1', 'Porcentaje de subcontratación máximo especificado para este contrato.');
881
-        $spreadsheet->getActiveSheet()->SetCellValue('F1', 'Descripción del objeto de la subcontratación');
882
-        $spreadsheet->getActiveSheet()->SetCellValue('G1', 'Descripción textual de los requisitos específicos del operador económico para poder participar en la licitación');
883
-        $spreadsheet->getActiveSheet()->SetCellValue('H1', 'Contrato sujeto a regulación armonizadaF');
884
-
885
-        return $spreadsheet;
886
-    }
887
-
888
-    private function cabeceraCriterioADjudicacion($spreadsheet)
889
-    {
890
-        $sheet = $spreadsheet->getSheet(7);
891
-        $styleArr = array(
892
-            "font" => array(
893
-                "bold" => true,
894
-                "color" => array("rgb" => "22B9FF"),
895
-                "size" => 13,
896
-            ),
897
-        );
898
-        $sheet->getStyle("A1:C1")->applyFromArray($styleArr);
899
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', 'Identificador');
900
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Descripción textual del criterio de adjudicación');
901
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Ponderación');
902
-
903
-        return $spreadsheet;
904
-    }
905
-
906
-    private function cabeceraCriteriosFinancieros($spreadsheet)
907
-    {
908
-        $sheet = $spreadsheet->getSheet(8);
909
-        $styleArr = array(
910
-            "font" => array(
911
-                "bold" => true,
912
-                "color" => array("rgb" => "22B9FF"),
913
-                "size" => 13,
914
-            ),
915
-        );
916
-        $sheet->getStyle("A1:C1")->applyFromArray($styleArr);
917
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', 'Identificador');
918
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Tipo criterio de evaluación financiera');
919
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Descripción textual del criterio de evaluación financiera');
920
-
921
-        return $spreadsheet;
922
-    }
923
-
924
-    private function cabeceraCriteriosTecnicos($spreadsheet)
925
-    {
926
-        $sheet = $spreadsheet->getSheet(9);
927
-        $styleArr = array(
928
-            "font" => array(
929
-                "bold" => true,
930
-                "color" => array("rgb" => "22B9FF"),
931
-                "size" => 13,
932
-            ),
933
-        );
934
-        $sheet->getStyle("A1:C1")->applyFromArray($styleArr);
935
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', 'Identificador');
936
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Tipo criterio de evaluación técnica');
937
-        $spreadsheet->getActiveSheet()->SetCellValue('C1', 'Descripción textual del criterio de evaluación técnica');
938
-
939
-        return $spreadsheet;
940
-    }
941
-
942
-    private function cabeceraRequisitosParticipacion($spreadsheet)
943
-    {
944
-        $sheet = $spreadsheet->getSheet(10);
945
-        $styleArr = array(
946
-            "font" => array(
947
-                "bold" => true,
948
-                "color" => array("rgb" => "22B9FF"),
949
-                "size" => 13,
950
-            ),
951
-        );
952
-        $sheet->getStyle("A1:B1")->applyFromArray($styleArr);
953
-        $spreadsheet->getActiveSheet()->SetCellValue('A1', 'Identificador');
954
-        $spreadsheet->getActiveSheet()->SetCellValue('B1', 'Tipo Requisitos Participacion');
955
-
956
-        return $spreadsheet;
957
-    }
958
-
959
-}
960
-
961
-/* End of file ExportXls.php */
962
-/* Location: ./application/controllers/ExportXls.php */

+ 22 - 36
application/controllers/Parser.php Voir le fichier

@@ -17,60 +17,48 @@ class Parser extends CI_Controller
17 17
         parent::__construct();
18 18
         $this->load->helper('file');
19 19
         $this->load->helper('xml');
20
-        $this->load->library('parserfile');
20
+        $this->load->library('Parserfile');
21 21
 
22 22
         $this->load->model("Parser_model");
23 23
     }
24 24
 
25 25
     public function index()
26 26
     {
27
-        $existCronRun = $this->Parser_model->existCronRun();
28 27
         $fechaCarpeta = "";
29
-        if ($existCronRun['num_rows'] > 0) {
30
-            if ($existCronRun['datos']->cron_ejecucion == 0) {
31 28
 
32
-                $this->Parser_model->inicioParser();
29
+        $this->Parser_model->inicioParser();
33 30
 
34
-                $resultSetPerfiles = $this->Parser_model->getUrlArchivos();
35
-                $fechaCarpeta = date("Y-m-d_H-i-s");
36
-                $fechaImportacionLog = date("Y-m-d H:i:s");
31
+        $resultSetPerfiles = $this->Parser_model->getUrlArchivos();
32
+        $fechaCarpeta = date("Y-m-d_H-i-s");
33
+        $fechaImportacionLog = date("Y-m-d H:i:s");
37 34
 
38
-                foreach ($resultSetPerfiles['datos'] as $row) {
35
+        foreach ($resultSetPerfiles['datos'] as $row) {
39 36
 
40
-                    $idUltimaImportacion = $this->Parser_model->setFechaNuevaImportacion($fechaImportacionLog);
41
-                    $this->fechaCreacionLog = $fechaCarpeta;
42
-                    $rutaPerfil = $this->rutaDiaria . "/" . $row->prefijos_tablas;
37
+            $idUltimaImportacion = $this->Parser_model->setFechaNuevaImportacion($fechaImportacionLog);
38
+            $this->Xlsexport_model->getLastDateLog($idUltimaImportacion);
39
+            $this->fechaCreacionLog = $fechaCarpeta;
40
+            $rutaPerfil = $this->rutaDiaria . "/" . $row->prefijos_tablas;
43 41
 
44
-                    $this->newFolder($rutaPerfil);
42
+            $this->newFolder($rutaPerfil);
45 43
 
46
-                    if ($this->newFolder($rutaPerfil . "/" . $fechaCarpeta)) {
47
-                        $this->rutaDiariaFecha = $rutaPerfil . "/" . $fechaCarpeta . "/";
48
-                        $this->downloadZip($row->url_descarga);
49
-                    }
44
+            if ($this->newFolder($rutaPerfil . "/" . $fechaCarpeta)) {
45
+                $this->rutaDiariaFecha = $rutaPerfil . "/" . $fechaCarpeta . "/";
46
+                $this->downloadZip($row->url_descarga);
47
+            }
50 48
 
51
-                    $files = get_filenames($this->rutaDiariaFecha . "/format");
52
-                    emailInicioProcesoDescarga($fechaImportacionLog, $files);
49
+            $files = get_filenames($this->rutaDiariaFecha . "/format");
50
+            emailInicioProcesoDescarga($fechaImportacionLog, $files);
53 51
 
54
-                    $this->parserfile->index($this->rutaDiariaFecha, $fechaCarpeta, $row, $idUltimaImportacion);
55
-                }
52
+            $this->Parserfile->index($this->rutaDiariaFecha, $fechaCarpeta, $row, $idUltimaImportacion);
53
+        }
56 54
 
57
-                $this->tablasCalculadas($idUltimaImportacion);
55
+        $this->tablasCalculadas($idUltimaImportacion);
58 56
 
59
-                emailFinProcesoDescarga($fechaImportacionLog);
57
+        $this->load->library('exportXls');
60 58
 
61
-            } else {
62
-                echo "EXISTE UN CRON EN MARCHA.";
63
-            }
64
-        } else {
65
-            echo "No existe parametro que iniciar.";
66
-        }
59
+        $this->exportxls->exportDatosCompletos();
67 60
 
68 61
         $this->Parser_model->stopParser();
69
-
70
-        /* $resultSetPerfiles = $this->Parser_model->getUrlArchivos();
71
-    foreach ($resultSetPerfiles['datos'] as $row) {
72
-    $this->parserfile->index($this->rutaDiaria . "PER_PCSP_EX/2022-02-17_20-38-16", date("Y-m-d"), $row);
73
-    } */
74 62
     }
75 63
 
76 64
     private function downloadZip($urlXML)
@@ -178,7 +166,5 @@ class Parser extends CI_Controller
178 166
         $licitaciones = $this->Xlsexport_model->getLicitaciones($idUltimaImportacion);
179 167
 
180 168
         insertBucleDuplicateOnKey($licitaciones['datos'], "vista_datos_licitacion", "");
181
-
182 169
     }
183
-
184 170
 }

+ 26 - 46
application/controllers/ParserCompleto.php Voir le fichier

@@ -17,10 +17,9 @@ defined('BASEPATH') or exit('No direct script access allowed');
17 17
  *
18 18
  */
19 19
 
20
-class ParserCompleto extends CI_Controller
20
+class Parsercompleto extends CI_Controller
21 21
 {
22 22
 
23
-    //TODO: PARAMETRIZAR BBDD -> SI EXISTE UN PROCESO EN MARCHA, NO INICIAR SIGUIENTE DESCARGA, AVISAR
24 23
     protected $rutaDiaria = FCPATH . "DOWNLOADS/DAILY/";
25 24
     protected $rutaDiariaFecha = "";
26 25
 
@@ -33,60 +32,45 @@ class ParserCompleto extends CI_Controller
33 32
         parent::__construct();
34 33
         $this->load->helper('file');
35 34
         $this->load->helper('xml');
36
-        $this->load->library('parserfile');
35
+        $this->load->library('Parserfile');
37 36
 
38 37
         $this->load->model("Parser_model");
39 38
     }
40 39
 
41 40
     public function index()
42 41
     {
43
-        $existCronRun = $this->Parser_model->existCronRun();
44 42
         $fechaCarpeta = "";
45
-        if ($existCronRun['num_rows'] > 0) {
46
-            if ($existCronRun['datos']->cron_ejecucion == 0) {
47 43
 
48
-                $this->Parser_model->inicioParser();
44
+        $this->Parser_model->inicioParser();
49 45
 
50
-                $resultSetPerfiles = $this->Parser_model->getUrlArchivos();
51
-                $fechaCarpeta = date("Y-m-d_H-i-s");
52
-                $fechaImportacionLog = date("Y-m-d H:i:s");
46
+        $resultSetPerfiles = $this->Parser_model->getUrlArchivos();
47
+        $fechaCarpeta = date("Y-m-d_H-i-s");
48
+        $fechaImportacionLog = date("Y-m-d H:i:s");
53 49
 
54
-                foreach ($resultSetPerfiles['datos'] as $row) {
50
+        foreach ($resultSetPerfiles['datos'] as $row) {
55 51
 
56
-                    $idUltimaImportacion = $this->Parser_model->setFechaNuevaImportacion($fechaImportacionLog);
57
-                    $this->fechaCreacionLog = $fechaCarpeta;
58
-                    $rutaPerfil = $this->rutaDiaria . "/" . $row->prefijos_tablas;
52
+            $idUltimaImportacion = $this->Parser_model->setFechaNuevaImportacion($fechaImportacionLog);
53
+            $this->fechaCreacionLog = $fechaCarpeta;
54
+            $rutaPerfil = $this->rutaDiaria . "/" . $row->prefijos_tablas;
59 55
 
60
-                    $this->newFolder($rutaPerfil);
56
+            $this->newFolder($rutaPerfil);
61 57
 
62
-                    if ($this->newFolder($rutaPerfil . "/" . $fechaCarpeta)) {
63
-                        $this->rutaDiariaFecha = $rutaPerfil . "/" . $fechaCarpeta . "/";
64
-                        $this->downloadProcess($row->url_descarga . ".atom");
65
-                    }
66
-
67
-                    $files = get_filenames($this->rutaDiariaFecha . "/format");
68
-                    emailInicioProcesoDescarga($fechaImportacionLog, $files);
69
-
70
-                    $this->parserfile->index($this->rutaDiariaFecha, $fechaCarpeta, $row, $idUltimaImportacion);
71
-                }
72
-
73
-                $this->tablasCalculadas($idUltimaImportacion);
58
+            if ($this->newFolder($rutaPerfil . "/" . $fechaCarpeta)) {
59
+                $this->rutaDiariaFecha = $rutaPerfil . "/" . $fechaCarpeta . "/";
60
+                $this->downloadProcess($row->url_descarga . ".atom");
61
+            }
74 62
 
75
-                emailFinProcesoDescarga($fechaImportacionLog);
63
+            $files = get_filenames($this->rutaDiariaFecha . "/format");
64
+            emailInicioProcesoDescarga($fechaImportacionLog, $files);
76 65
 
77
-            } else {
78
-                echo "EXISTE UN CRON EN MARCHA.";
79
-            }
80
-        } else {
81
-            echo "No existe parametro que iniciar.";
66
+            $this->parserfile->index($this->rutaDiariaFecha, $fechaCarpeta, $row, $idUltimaImportacion);
82 67
         }
83 68
 
84
-        $this->Parser_model->stopParser();
69
+        $this->tablasCalculadas($idUltimaImportacion);
70
+
71
+        $this->load->library('exportXls');
85 72
 
86
-        /* $resultSetPerfiles = $this->Parser_model->getUrlArchivos();
87
-    foreach ($resultSetPerfiles['datos'] as $row) {
88
-    $this->parserfile->index($this->rutaDiaria . "PER_PCSP_EX/2022-02-17_20-38-16", date("Y-m-d"), $row);
89
-    } */
73
+        $this->exportxls->exportDatosCompletos();
90 74
     }
91 75
 
92 76
     private function downloadProcess($urlXML)
@@ -115,15 +99,13 @@ class ParserCompleto extends CI_Controller
115 99
             $attrHref = $row['@attributes']['href'];
116 100
 
117 101
             if ($attrNext === "next") {
118
-                if (!strpos($attrHref, "licitacionesPerfilesContratanteCompleto3_2021")) { //"20220127_")) {
119
-                    $enlace = $attrHref;
120
-                } else {
121
-                    $enlace = "";
122
-                }
123
-                //$enlace = $attrHref;
102
+                $enlace = $attrHref;
103
+            } else {
104
+                $enlace = "";
124 105
             }
125 106
         }
126 107
 
108
+
127 109
         return $enlace;
128 110
     }
129 111
 
@@ -189,9 +171,7 @@ class ParserCompleto extends CI_Controller
189 171
         $licitaciones = $this->Xlsexport_model->getLicitaciones($idUltimaImportacion);
190 172
 
191 173
         insertBucleDuplicateOnKey($licitaciones['datos'], "vista_datos_licitacion", "");
192
-
193 174
     }
194
-
195 175
 }
196 176
 
197 177
 /* End of file ParserCompleto.php */

+ 42 - 18
application/helpers/email_templates_helper.php Voir le fichier

@@ -1,13 +1,13 @@
1 1
 <?php
2 2
 if (!function_exists("emailInicioProcesoDescarga")) {
3
-    function emailInicioProcesoDescarga($fechaInicioProceso, $arrayArchivos)
4
-    {
5
-        $asunto = "Inicio descarga y proceso de archivos de licitaciones";
6
-        $archivosEmail = "";
7
-        foreach ($arrayArchivos as $file) {
8
-            $archivosEmail .= "<p>" . $file . "</p>";
9
-        }
10
-        $cuerpo = "<!DOCTYPE html>
3
+	function emailInicioProcesoDescarga($fechaInicioProceso, $arrayArchivos)
4
+	{
5
+		$asunto = "Inicio descarga y proceso de archivos de licitaciones";
6
+		$archivosEmail = "";
7
+		foreach ($arrayArchivos as $file) {
8
+			$archivosEmail .= "<p>" . $file . "</p>";
9
+		}
10
+		$cuerpo = "<!DOCTYPE html>
11 11
 		<html lang='en'>
12 12
 		<head>
13 13
 			<meta charset='UTF-8'>
@@ -25,17 +25,16 @@ if (!function_exists("emailInicioProcesoDescarga")) {
25 25
 		</body>
26 26
 		</html>";
27 27
 
28
-        $email = "chcalvoleon@mindden.com";
29
-        enviarEmail($asunto, $cuerpo, $email, true);
30
-    }
28
+		enviarEmail($asunto, $cuerpo, array(), false);
29
+	}
31 30
 }
32 31
 
33 32
 if (!function_exists("emailFinProcesoDescarga")) {
34
-    function emailFinProcesoDescarga($fechaInicioProceso)
35
-    {
36
-        $asunto = "Fin descarga y proceso de archivos de licitaciones";
33
+	function emailFinProcesoDescarga($fechaInicioProceso)
34
+	{
35
+		$asunto = "Fin descarga y proceso de archivos de licitaciones";
37 36
 
38
-        $cuerpo = "<!DOCTYPE html>
37
+		$cuerpo = "<!DOCTYPE html>
39 38
 		<html lang='en'>
40 39
 		<head>
41 40
 			<meta charset='UTF-8'>
@@ -50,7 +49,32 @@ if (!function_exists("emailFinProcesoDescarga")) {
50 49
 		</body>
51 50
 		</html>";
52 51
 
53
-        $email = "chcalvoleon@mindden.com";
54
-        enviarEmail($asunto, $cuerpo, $email, false);
55
-    }
52
+		enviarEmail($asunto, $cuerpo, array(), false);
53
+	}
54
+}
55
+
56
+if (!function_exists("emailEnvioExcel")) {
57
+	function emailEnvioExcel()
58
+	{
59
+		$asunto = "Envio Excel Licitaciones Dia " . date("d-m-Y");
60
+
61
+		$cuerpo = "<!DOCTYPE html>
62
+		<html lang='en'>
63
+		<head>
64
+			<meta charset='UTF-8'>
65
+		</head>
66
+
67
+		<body style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 15px;'>
68
+			<div class='contenedor' style='max-width:900px; width:100%; margin:0px auto;'>
69
+				<div class='texto-inicio'>
70
+					<p><strong>Se adjunta excel de licitaciones día " . date("d-m-Y") . ".</strong></p>
71
+				</div>
72
+			</div>
73
+		</body>
74
+		</html>";
75
+
76
+		$email = "chcalvoleon@mindden.com";
77
+		$rutaArray = array(FCPATH . 'uploads/Licitaciones_' . date("d-m-Y") . ".xlsx");
78
+		enviarEmail($asunto, $cuerpo, $rutaArray, false);
79
+	}
56 80
 }

+ 54 - 32
application/helpers/funciones_helper.php Voir le fichier

@@ -73,7 +73,6 @@ if (!function_exists("insertBucle")) {
73 73
         if (count($conjunto) > 0) {
74 74
             guardar_log($nombreLog, count($conjunto));
75 75
             $CI->db->insert_batch($nombreTabla, $conjunto);
76
-
77 76
         }
78 77
 
79 78
         gc_collect_cycles();
@@ -160,39 +159,62 @@ if (!function_exists("pretty_dump")) {
160 159
 }
161 160
 
162 161
 if (!function_exists("enviarEmail")) {
163
-    function enviarEmail($asunto, $body, $email_envio, $adjuntos = array(), $print_result = true)
162
+    function enviarEmail($asunto, $body, $adjuntos = array(), $print_result = false)
164 163
     {
165
-        print_r($body);
166 164
         $CI = &get_instance();
167
-
168
-        $CI->load->library('email');
169
-
170
-        $config['protocol'] = 'mail';
171
-        $config['smtp_host'] = 'smtp.gmail.com';
172
-        $config['smtp_user'] = 'chcalvoleon@mindden.com';
173
-        $config['smtp_pass'] = '4lb1R2014';
174
-        $config['smtp_crypto'] = 'ssl';
175
-        $config['smtp_port'] = 25;
176
-        $config['mailtype'] = 'html';
177
-        $config['wordwrap'] = 'TRUE';
178
-        $config['newline'] = "\r\n";
179
-        $config['priority'] = 5;
180
-        $config['crlf'] = "\r\n";
181
-
182
-        $CI->email->initialize($config);
183
-        $CI->email->clear(true);
184
-
185
-        $CI->email->from('chcalvoleon@mindden.com');
186
-        $CI->email->to($email_envio);
187
-        $CI->email->bcc("chcalvoleon@mindden.com");
188
-        $CI->email->subject($asunto);
189
-        $CI->email->message($body);
190
-
191
-        if ($print_result) {
192
-            $CI->email->send(true);
193
-            $CI->email->print_debugger();
194
-        } else {
195
-            $CI->email->send(true);
165
+        $CI->load->model("Parser_model");
166
+
167
+        $datosEmails = $CI->Parser_model->getDatosEmailEnvio();
168
+        if ($datosEmails['num_rows'] > 0) {
169
+            $userSmtp = $datosEmails['datos']->userSMTP;
170
+            $passSMTP = $datosEmails['datos']->passSMTP;
171
+            $emailToSend = $datosEmails['datos']->emailToSend;
172
+            $hostname = $datosEmails['datos']->hostname;
173
+            $port = $datosEmails['datos']->port;
174
+
175
+
176
+            if (trim($userSmtp) && trim($passSMTP) && trim($emailToSend) && trim($hostname) && trim($port)) {
177
+
178
+                try {
179
+                    $CI = &get_instance();
180
+
181
+                    $CI->load->library('email');
182
+
183
+                    $config['protocol'] = 'mail';
184
+                    $config['smtp_host'] = $hostname;
185
+                    $config['smtp_user'] = $userSmtp;
186
+                    $config['smtp_pass'] = $passSMTP;
187
+                    $config['smtp_crypto'] = 'ssl';
188
+                    $config['smtp_port'] = $port;
189
+                    $config['mailtype'] = 'html';
190
+                    $config['wordwrap'] = 'TRUE';
191
+                    $config['newline'] = "\r\n";
192
+                    $config['priority'] = 5;
193
+                    $config['crlf'] = "\r\n";
194
+
195
+                    $CI->email->initialize($config);
196
+                    $CI->email->clear(true);
197
+
198
+                    $CI->email->from($userSmtp);
199
+                    $CI->email->to($emailToSend);
200
+                    $CI->email->subject($asunto);
201
+                    $CI->email->message($body);
202
+
203
+                    if ($adjuntos) {
204
+                        foreach ($adjuntos as $row) {
205
+                            $CI->email->attach($row);
206
+                        }
207
+                    }
208
+                    if ($print_result) {
209
+                        $CI->email->send(true);
210
+                        $CI->email->print_debugger();
211
+                    } else {
212
+                        $CI->email->send(true);
213
+                    }
214
+                } catch (\Throwable $th) {
215
+                    guardar_log("ErrorEnvioEmail_" . date("d-m-Y"), "Se ha producido un error al enviar el email de inicio y/o el excel", false, 2);
216
+                }
217
+            }
196 218
         }
197 219
     }
198 220
 }

+ 3 - 10
application/libraries/ParserFile.php Voir le fichier

@@ -1,7 +1,7 @@
1 1
 <?php
2 2
 defined('BASEPATH') or exit('No direct script access allowed');
3 3
 error_reporting(E_ALL & ~E_NOTICE);
4
-class ParserFile
4
+class Parserfile
5 5
 {
6 6
 
7 7
     protected $idLicitacion = 0;
@@ -25,8 +25,8 @@ class ParserFile
25 25
         $this->CI = &get_instance();
26 26
         $this->CI->load->helper('file');
27 27
         $this->CI->load->model("Parser_model");
28
-        $this->CI->load->library('parserdatabasebruto');
29
-        $this->CI->load->library('parserdatabaselimpio');
28
+        $this->CI->load->library('Parserdatabasebruto');
29
+        $this->CI->load->library('Parserdatabaselimpio');
30 30
     }
31 31
 
32 32
     public function __destruct()
@@ -113,9 +113,7 @@ class ParserFile
113 113
 
114 114
             gc_mem_caches();
115 115
             gc_collect_cycles();
116
-
117 116
         }
118
-
119 117
     }
120 118
 
121 119
     public function echo_memory_usage()
@@ -163,7 +161,6 @@ class ParserFile
163 161
 
164 162
             if ($fechaExistente >= $fechaUpdated) {
165 163
                 $result = true;
166
-
167 164
             } else {
168 165
                 $this->arrayLicitacionExiste[$idLicitacion] = $fechaUpdated;
169 166
                 $result = false;
@@ -204,7 +201,6 @@ class ParserFile
204 201
                     }
205 202
                 }
206 203
             }
207
-
208 204
         }
209 205
 
210 206
         return $resultEntries;
@@ -292,7 +288,6 @@ class ParserFile
292 288
             $resultEntries['party']['id_ajena_licitacion'] = $this->idLicitacion;
293 289
             $resultEntries['party']['id_compuesta'] = $this->idLicitacion . "_03";
294 290
             $resultEntries['party']['fecha_creacion_log'] = $this->fechaInicioParser;
295
-
296 291
         }
297 292
         return $resultEntries;
298 293
     }
@@ -478,7 +473,6 @@ class ParserFile
478 473
                 $resultEntries['tenderingTerm']['guaranteeTypeCode'] = $this->existNodo($TenderingTerms['RequiredFinancialGuarantee'], 'GuaranteeTypeCode', 'string');
479 474
                 $resultEntries['tenderingTerm']['guaranteeTypeCode_attr'] = $this->existAttribute($TenderingTerms['RequiredFinancialGuarantee'], "GuaranteeTypeCode", "string", 'listURI');
480 475
                 $resultEntries['tenderingTerm']['requiredFinancialGuarantee_Amount'] = $this->existNodo($TenderingTerms['RequiredFinancialGuarantee'], 'AmountRate', 'string');
481
-
482 476
             }
483 477
 
484 478
             $resultEntries['tenderingTerm']['procurementLegislationDocumentReference'] = $this->existNodo($TenderingTerms['ProcurementLegislationDocumentReference'], 'ID', 'string');
@@ -520,7 +514,6 @@ class ParserFile
520 514
                         $resultEntries["TendererQualificationRequest"][$i]['id_compuesta_padre'] = $this->idLicitacion . "_07";
521 515
                         $resultEntries['TendererQualificationRequest'][$i]['fecha_creacion_log'] = $this->fechaInicioParser;
522 516
                     }
523
-
524 517
                 }
525 518
 
526 519
                 //Criterios de evaluacion financiera

+ 0 - 7
application/libraries/Parserdatabaselimpio.php Voir le fichier

@@ -19,9 +19,6 @@ class Parserdatabaselimpio
19 19
         $totalInserted = array();
20 20
         if ($tablasInsert['num_rows'] > 0) {
21 21
 
22
-            //$licitacionDeleteCascada = $this->CI->Parser_model->getLicitacionesNuevasBruto();
23
-
24
-            //if ($licitacionDeleteCascada['num_rows'] > 0) {
25 22
             $this->CI->Parser_model->deleteCascadaNuevasLicitaciones();
26 23
 
27 24
             foreach ($tablasInsert['datos'] as $row) {
@@ -31,16 +28,12 @@ class Parserdatabaselimpio
31 28
                 if ($datosTablaToInsert['num_rows'] > 0) {
32 29
                     guardar_log("inToGlobal_" . $fechaInicioParser, "ARCHIVO--" . $row->tabla_maestra . "_" . $fechaInicioParser . " - " . $filename);
33 30
                     $totalInserted[$row->tabla_maestra] = insertBucle($datosTablaToInsert['datos'], $row->tabla_maestra, "inToGlobal_" . $fechaInicioParser);
34
-
35 31
                 }
36 32
             }
37 33
 
38
-            //}
39 34
             return $totalInserted;
40
-
41 35
         }
42 36
     }
43
-
44 37
 }
45 38
 
46 39
 /* End of file Parserdatabaselimpio.php */

+ 8 - 1
application/models/Parser_model.php Voir le fichier

@@ -131,7 +131,6 @@ class Parser_model extends CI_Model
131 131
         $datos['num_rows'] = $result->num_rows();
132 132
         $result->free_result();
133 133
         return $datos;
134
-
135 134
     }
136 135
 
137 136
     public function setFechaNuevaImportacion($fechaImportacionLog)
@@ -143,6 +142,14 @@ class Parser_model extends CI_Model
143 142
         return $this->db->insert_id();
144 143
     }
145 144
 
145
+    public function getDatosEmailEnvio()
146
+    {
147
+        $sql = "SELECT * FROM config_datos_emails";
148
+        $result = $this->db->query($sql);
149
+        $datos['datos'] = $result->row();
150
+        $datos['num_rows'] = $result->num_rows();
151
+        return $datos;
152
+    }
146 153
 }
147 154
 
148 155
 /* End of file Parser_model.php */

+ 5 - 9
application/models/Xlsexport_model.php Voir le fichier

@@ -24,20 +24,17 @@ class Xlsexport_model extends CI_Model
24 24
     public function __construct()
25 25
     {
26 26
         parent::__construct();
27
-        $this->fechaLog = $this->getLastDateLog()->fecha_maxima;
27
+        $this->fechaLog = "";
28 28
     }
29 29
 
30
-    public function getLastDateLog()
30
+    public function getLastDateLog($idImportacion)
31 31
     {
32
-        $sql = "SELECT MAX(fecha) as fecha_maxima FROM config_fecha_importaciones LIMIT 1";
32
+        $sql = "SELECT MAX(fecha) as fecha_maxima FROM config_fecha_importaciones WHERE id = $idImportacion";
33 33
         $result = $this->db->query($sql);
34
-        return $result->row();
35
-
34
+        $this->fechaLog = $result->row()->fecha_maxima;
35
+        return;
36 36
     }
37 37
 
38
-    // ------------------------------------------------------------------------
39
-
40
-    // ------------------------------------------------------------------------
41 38
     public function getLicitaciones($idUltimaImportacion)
42 39
     {
43 40
         $sql = " SELECT
@@ -202,7 +199,6 @@ class Xlsexport_model extends CI_Model
202 199
         $datos['num_rows'] = $result->num_rows();
203 200
         return $datos;
204 201
     }
205
-
206 202
 }
207 203
 
208 204
 /* End of file Xlsexport_model_model.php */