* @link https://github.com/setdjod/myci-extension/ * @param ... * @return ... * */ class Xlsexport_model extends CI_Model { protected $fechaLog = "2022-02-28 08:42:06"; public function __construct() { parent::__construct(); } // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ public function getLicitaciones($idUltimaImportacion) { $sql = " SELECT CF.id, LI.id_licitacion, GROUP_CONCAT( PROJI.itemClassification_value ) AS itemClassification_attr, LI.link_uri, LI.updated, CF.contractFolderID, CF.contractFolderStatusCode, LP.buyerProfileURIID, LP.contractingPartyTypeCode, MP.partyName, MP.codpostal, MP.websiteURI, MP.city, MP.direccion, MP.contact_name, MP.contact_email, MPI.idPartyIdent AS partyItem, MPI.attr as tipoIdParty, PROJ.NAME as nameProject, PROJ.estimatedOverallContractAmount, PROJ.taxExclusiveAmount, PROJ.totalAmount, PROJ.countrySubentityCode, PROJ.countrySubentity, PROJ.durationMesure, PROJ.medida, PROJ.duracion_inicio, PROJ.duracion_fin, PROJ.contractExtension, TT.procurementLegislationDocumentReference, TT.allowedSubcontractTerms, RCF.descripcion AS contrato_status, RLP.nombre AS tipo_administracion, TPC.descripcion AS tipo_contrato, RTP.nombre AS tipoTender, RTPC.nombre AS contrato_sistema, RTPS.nombre AS submision, RTPU.nombre AS urgency, LI.fecha_creacion_log FROM maestro_datos_iniciales_licitacion LI JOIN maestro_contract_folder CF ON CF.id_ajena_licitacion = LI.id_licitacion JOIN maestro_located_contracting_party LP ON LP.id_ajena_licitacion = LI.id_licitacion JOIN maestro_party MP ON MP.id_ajena_licitacion = LI.id_licitacion JOIN maestro_party_party_idenfitication MPI on MPI.id_ajena_licitacion = LI.id_licitacion AND MPI.attr = 'DIR3' JOIN maestro_procurement_project PROJ ON PROJ.id_ajena_licitacion = LI.id_licitacion JOIN maestro_procurement_project_itemclass PROJI ON PROJI.id_ajena_licitacion = LI.id_licitacion JOIN maestro_tendering_process TP ON TP.id_ajena_licitacion = LI.id_licitacion JOIN maestro_tendering_terms TT ON TT.id_ajena_licitacion = LI.id_licitacion JOIN relacionada_contract_status RCF ON RCF.CODE = CF.contractFolderStatusCode JOIN relacionada_located_contracting_party RLP ON RLP.CODE = LP.contractingPartyTypeCode JOIN relacionada_tipo_contrato TPC ON TPC.CODE = PROJ.typeCode JOIN relacionada_tender_process RTP ON RTP.CODE = TP.procedureCode JOIN relacionada_tender_process_contracting_code RTPC ON RTPC.CODE = TP.contractingSystemCode JOIN relacionada_tender_process_submission RTPS ON RTPS.CODE = TP.submissionMethodCode JOIN relacionada_tender_process_urgency_code RTPU ON RTPU.CODE = TP.urgencyCode WHERE LI.id_importacion = $idUltimaImportacion GROUP BY id_licitacion"; $result = $this->db->query($sql); $datos['datos'] = $result->result(); $datos['num_rows'] = $result->num_rows(); return $datos; } public function getFullDatosUltimasInsertadas() { $sql = "SELECT * FROM vista_datos_licitacion"; $result = $this->db->query($sql); $datos['datos'] = $result->result(); $datos['num_rows'] = $result->num_rows(); return $datos; } public function getTablaByFechaLog($tabla) { $sql = "SELECT * FROM $tabla WHERE fecha_creacion_log = '$this->fechaLog'"; $result = $this->db->query($sql); $datos['datos'] = $result->result_array(); $datos['num_rows'] = $result->num_rows(); return $datos; } public function getProjectLotItem() { $sql = "SELECT MP.idProcurementLot, MP.countrySubentity, MP.countrySubentityCode, MP.totalAmount, MP.taxExclusiveAmount, MP.`name`, MP.id_ajena_licitacion, GROUP_CONCAT( MPI.idItem ) AS itemClassification_attr FROM maestro_procurement_project_lot MP JOIN maestro_procurement_project_lot_item MPI ON MP.id_compuesta = MPI.id_compuesta_padre WHERE MPI.fecha_creacion_log = '$this->fechaLog' GROUP BY MP.id_compuesta"; $result = $this->db->query($sql); $datos['datos'] = $result->result_array(); $datos['num_rows'] = $result->num_rows(); return $datos; } public function getFechasPublicadas($idLicitacion) { $sql = "SELECT MIN(fechas) as fecha FROM maestro_valid_notice_info_fecha WHERE id_ajena_licitacion = '$idLicitacion'"; $result = $this->db->query($sql); $datos['datos'] = $result->row(); $datos['num_rows'] = $result->num_rows(); return $datos; } public function getTenderingTermsCodes() { $sql = "SELECT TP.*, RTP.nombre AS tipoTender, /*procedureCode*/ RTPC.nombre AS contrato_sistema, /*urgencyCode*/ RTPS.nombre AS submision, /*contractingSistemCode*/ RTPU.nombre AS urgency /*urgencyCode*/ FROM maestro_tendering_process TP JOIN relacionada_tender_process RTP ON RTP.CODE = TP.procedureCode JOIN relacionada_tender_process_contracting_code RTPC ON RTPC.CODE = TP.contractingSystemCode JOIN relacionada_tender_process_submission RTPS ON RTPS.CODE = TP.submissionMethodCode JOIN relacionada_tender_process_urgency_code RTPU ON RTPU.CODE = TP.urgencyCode WHERE TP.fecha_creacion_log = '$this->fechaLog'"; $result = $this->db->query($sql); $datos['datos'] = $result->result_array(); $datos['num_rows'] = $result->num_rows(); return $datos; } public function getDatosRelacionadasTablaWithoutLicitacion($tabla, $tablaRelacion, $txtIdAjena, $id = "t1.id") { $sql = "SELECT *, t2.nombre as code_desc FROM $tabla t1 JOIN $tablaRelacion t2 ON t2." . $txtIdAjena . " = t1." . $id . " WHERE t1.fecha_creacion_log = '$this->fechaLog'"; $result = $this->db->query($sql); $datos['datos'] = $result->result_array(); $datos['num_rows'] = $result->num_rows(); return $datos; } } /* End of file Xlsexport_model_model.php */ /* Location: ./application/models/Xlsexport_model_model.php */