浏览代码

anyadir columna vigente/anulada/archivada en excel y su logica

Nermosis 3 年前
父节点
当前提交
da18293c14

+ 6 - 1
application/controllers/ExportXls.php 查看文件

@@ -1,5 +1,5 @@
1 1
 <?php
2
-ini_set('max_execution_time', '300');
2
+
3 3
 defined('BASEPATH') or exit('No direct script access allowed');
4 4
 
5 5
 use PhpOffice\PhpSpreadsheet\Spreadsheet;
@@ -132,6 +132,7 @@ class ExportXls extends CI_Controller
132 132
                 'id_licitacion' => $licitacion->id_licitacion,
133 133
                 "link_uri" => $licitacion->link_uri,
134 134
                 "updated" => $licitacion->updated,
135
+                'estadoLicitacion' => $licitacion->estadoLicitacion,
135 136
             );
136 137
             $result['hoja1'][$licitacion->id_licitacion]['contract'] = array(
137 138
                 "descripcion" => $licitacion->contrato_status,
@@ -256,6 +257,7 @@ class ExportXls extends CI_Controller
256 257
             $sheet->getStyle('C' . $this->filaDatoLicitacion)
257 258
                 ->getNumberFormat()
258 259
                 ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
260
+            $sheet->setCellValue('D' . $this->filaDatoLicitacion, $row['licitacion']['estadoLicitacion']);
259 261
             $sheet->setCellValue('E' . $this->filaDatoLicitacion, $primeraPublicacion);
260 262
             $sheet->getStyle('E' . $this->filaDatoLicitacion)
261 263
                 ->getNumberFormat()
@@ -451,6 +453,9 @@ class ExportXls extends CI_Controller
451 453
                 $sheet->SetCellValue('M' . $aux, $datos['partyIdentification']);
452 454
                 $sheet->SetCellValue('N' . $aux, $datos['partyName']);
453 455
                 $sheet->SetCellValue('O' . $aux, $datos['TaxExclusiveAmount']);
456
+                $sheet->getStyle('O' . $aux)
457
+                    ->getNumberFormat()
458
+                    ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_ACCOUNTING_EUR);
454 459
 
455 460
                 $aux++;
456 461
             }

+ 2 - 2
application/controllers/Parser.php 查看文件

@@ -157,7 +157,7 @@ class Parser extends CI_Controller
157 157
 
158 158
     private function regExIniciosEsquema($xml)
159 159
     {
160
-        $pattern = "/(<cac:)|(<cbc:)|(<cac-place-ext:)|(<cbc-place-ext:)/";
160
+        $pattern = "/(<cac:)|(<cbc:)|(<cac-place-ext:)|(<cbc-place-ext:)|(<at:)/";
161 161
         $result = preg_replace($pattern, "<", $xml);
162 162
 
163 163
         return $result;
@@ -165,7 +165,7 @@ class Parser extends CI_Controller
165 165
 
166 166
     private function regExFinalesEsquema($xml)
167 167
     {
168
-        $pattern = "/(<\/cac:)|(<\/cbc:)|(<\/cac-place-ext:)|(<\/cbc-place-ext:)/";
168
+        $pattern = "/(<\/cac:)|(<\/cbc:)|(<\/cac-place-ext:)|(<\/cbc-place-ext:)|(<\/at:)/";
169 169
         $result = preg_replace($pattern, "</", $xml);
170 170
 
171 171
         return $result;

+ 24 - 3
application/libraries/ParserFile.php 查看文件

@@ -57,15 +57,16 @@ class ParserFile
57 57
             foreach ($tablasTruncate['datos'] as $row) {
58 58
                 $this->CI->Parser_model->truncateTables($row->tabla_sucia);
59 59
             }
60
+            $arrayDeletedEntries = array();
61
+            $arrayDeletedEntries = $array['deleted-entry'];
60 62
 
61 63
             foreach ($array['entry'] as $clave => $row) {
62 64
 
63 65
                 $existLicitacionActualizada = $this->getDatosLicitacion($row);
64 66
 
65 67
                 if (!$existLicitacionActualizada) {
66
-                    //$arrayDeletedEntries = $xml->children('at', true);
67 68
 
68
-                    $resultEntries[$filename]['general'][$aux] = $this->nodoEntry($row, $xml->entry[$clave], $datosPerfil->id, $idUltimaImportacion);
69
+                    $resultEntries[$filename]['general'][$aux] = $this->nodoEntry($row, $xml->entry[$clave], $datosPerfil->id, $idUltimaImportacion, $arrayDeletedEntries);
69 70
 
70 71
                     $contractFolder = $this->nodoContractFolderStatus($row, $xml->entry[$clave]);
71 72
 
@@ -172,7 +173,7 @@ class ParserFile
172 173
         return $result;
173 174
     }
174 175
 
175
-    private function nodoEntry($xml, $xmlPrimitivo, $tipoPerfil, $idUltimaImportacion)
176
+    private function nodoEntry($xml, $xmlPrimitivo, $tipoPerfil, $idUltimaImportacion, $deletedEntry)
176 177
     {
177 178
         $resultEntries = array();
178 179
         $id_licitacion = (string) substr($xml['id'], strrpos($xml['id'], '/') + 1);
@@ -186,6 +187,26 @@ class ParserFile
186 187
         $resultEntries['tipo_perfil_licitacion'] = $tipoPerfil;
187 188
         $resultEntries['fecha_creacion_log'] = $this->fechaInicioParser;
188 189
         $resultEntries['id_importacion'] = $idUltimaImportacion;
190
+
191
+        $resultEntries['estadoLicitacion'] = "VIGENTE";
192
+        if ($deletedEntry) {
193
+            foreach ($deletedEntry as $row) {
194
+                $idBorrado = (string) substr($row['@attributes']["ref"], strrpos($row['@attributes']["ref"], '/') + 1);
195
+                if ($id_licitacion == $idBorrado) {
196
+                    $anyo1 = date_create($row['@attributes']['when']);
197
+                    $anyo2 = date_create($resultEntries['updated']);
198
+                    $diferencia = $anyo2->diff($anyo1);
199
+                    $diferenciaFormat = $diferencia->y;
200
+                    if ($diferenciaFormat > 5) {
201
+                        $resultEntries['estadoLicitacion'] = "ARCHIVADA";
202
+                    } else {
203
+                        $resultEntries['estadoLicitacion'] = "ANULADA";
204
+                    }
205
+                }
206
+            }
207
+
208
+        }
209
+
189 210
         return $resultEntries;
190 211
     }
191 212
 

+ 1 - 0
application/models/Xlsexport_model.php 查看文件

@@ -46,6 +46,7 @@ class Xlsexport_model extends CI_Model
46 46
                     GROUP_CONCAT( PROJI.itemClassification_value ) AS itemClassification_attr,
47 47
                     LI.link_uri,
48 48
                     LI.updated,
49
+                    LI.estadoLicitacion,
49 50
                     CF.contractFolderID,
50 51
                     CF.contractFolderStatusCode,
51 52
                     LP.buyerProfileURIID,