Selaa lähdekoodia

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

Nermosis 3 vuotta sitten
vanhempi
commit
da18293c14

+ 6 - 1
application/controllers/ExportXls.php Näytä tiedosto

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

+ 2 - 2
application/controllers/Parser.php Näytä tiedosto

157
 
157
 
158
     private function regExIniciosEsquema($xml)
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
         $result = preg_replace($pattern, "<", $xml);
161
         $result = preg_replace($pattern, "<", $xml);
162
 
162
 
163
         return $result;
163
         return $result;
165
 
165
 
166
     private function regExFinalesEsquema($xml)
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
         $result = preg_replace($pattern, "</", $xml);
169
         $result = preg_replace($pattern, "</", $xml);
170
 
170
 
171
         return $result;
171
         return $result;

+ 24 - 3
application/libraries/ParserFile.php Näytä tiedosto

57
             foreach ($tablasTruncate['datos'] as $row) {
57
             foreach ($tablasTruncate['datos'] as $row) {
58
                 $this->CI->Parser_model->truncateTables($row->tabla_sucia);
58
                 $this->CI->Parser_model->truncateTables($row->tabla_sucia);
59
             }
59
             }
60
+            $arrayDeletedEntries = array();
61
+            $arrayDeletedEntries = $array['deleted-entry'];
60
 
62
 
61
             foreach ($array['entry'] as $clave => $row) {
63
             foreach ($array['entry'] as $clave => $row) {
62
 
64
 
63
                 $existLicitacionActualizada = $this->getDatosLicitacion($row);
65
                 $existLicitacionActualizada = $this->getDatosLicitacion($row);
64
 
66
 
65
                 if (!$existLicitacionActualizada) {
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
                     $contractFolder = $this->nodoContractFolderStatus($row, $xml->entry[$clave]);
71
                     $contractFolder = $this->nodoContractFolderStatus($row, $xml->entry[$clave]);
71
 
72
 
172
         return $result;
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
         $resultEntries = array();
178
         $resultEntries = array();
178
         $id_licitacion = (string) substr($xml['id'], strrpos($xml['id'], '/') + 1);
179
         $id_licitacion = (string) substr($xml['id'], strrpos($xml['id'], '/') + 1);
186
         $resultEntries['tipo_perfil_licitacion'] = $tipoPerfil;
187
         $resultEntries['tipo_perfil_licitacion'] = $tipoPerfil;
187
         $resultEntries['fecha_creacion_log'] = $this->fechaInicioParser;
188
         $resultEntries['fecha_creacion_log'] = $this->fechaInicioParser;
188
         $resultEntries['id_importacion'] = $idUltimaImportacion;
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
         return $resultEntries;
210
         return $resultEntries;
190
     }
211
     }
191
 
212
 

+ 1 - 0
application/models/Xlsexport_model.php Näytä tiedosto

46
                     GROUP_CONCAT( PROJI.itemClassification_value ) AS itemClassification_attr,
46
                     GROUP_CONCAT( PROJI.itemClassification_value ) AS itemClassification_attr,
47
                     LI.link_uri,
47
                     LI.link_uri,
48
                     LI.updated,
48
                     LI.updated,
49
+                    LI.estadoLicitacion,
49
                     CF.contractFolderID,
50
                     CF.contractFolderID,
50
                     CF.contractFolderStatusCode,
51
                     CF.contractFolderStatusCode,
51
                     LP.buyerProfileURIID,
52
                     LP.buyerProfileURIID,