Xlsexport_model.php 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <?php
  2. defined('BASEPATH') or exit('No direct script access allowed');
  3. /**
  4. *
  5. * Model Xlsexport_model_model
  6. *
  7. * This Model for ...
  8. *
  9. * @package CodeIgniter
  10. * @category Model
  11. * @author Setiawan Jodi <jodisetiawan@fisip-untirta.ac.id>
  12. * @link https://github.com/setdjod/myci-extension/
  13. * @param ...
  14. * @return ...
  15. *
  16. */
  17. class Xlsexport_model extends CI_Model
  18. {
  19. protected $fechaLog = "2022-02-28 08:42:06";
  20. public function __construct()
  21. {
  22. parent::__construct();
  23. }
  24. // ------------------------------------------------------------------------
  25. // ------------------------------------------------------------------------
  26. public function getLicitaciones($idUltimaImportacion)
  27. {
  28. $sql = " SELECT
  29. CF.id,
  30. LI.id_licitacion,
  31. GROUP_CONCAT( PROJI.itemClassification_value ) AS itemClassification_attr,
  32. LI.link_uri,
  33. LI.updated,
  34. CF.contractFolderID,
  35. CF.contractFolderStatusCode,
  36. LP.buyerProfileURIID,
  37. LP.contractingPartyTypeCode,
  38. MP.partyName,
  39. MP.codpostal,
  40. MP.websiteURI,
  41. MP.city,
  42. MP.direccion,
  43. MP.contact_name,
  44. MP.contact_email,
  45. MPI.idPartyIdent AS partyItem,
  46. MPI.attr as tipoIdParty,
  47. PROJ.NAME as nameProject,
  48. PROJ.estimatedOverallContractAmount,
  49. PROJ.taxExclusiveAmount,
  50. PROJ.totalAmount,
  51. PROJ.countrySubentityCode,
  52. PROJ.countrySubentity,
  53. PROJ.durationMesure,
  54. PROJ.medida,
  55. PROJ.duracion_inicio,
  56. PROJ.duracion_fin,
  57. PROJ.contractExtension,
  58. TT.procurementLegislationDocumentReference,
  59. TT.allowedSubcontractTerms,
  60. RCF.descripcion AS contrato_status,
  61. RLP.nombre AS tipo_administracion,
  62. TPC.descripcion AS tipo_contrato,
  63. RTP.nombre AS tipoTender,
  64. RTPC.nombre AS contrato_sistema,
  65. RTPS.nombre AS submision,
  66. RTPU.nombre AS urgency,
  67. LI.fecha_creacion_log
  68. FROM
  69. global_datos_iniciales_licitacion LI
  70. JOIN global_contract_folder CF ON CF.id_ajena_licitacion = LI.id_licitacion
  71. JOIN global_located_contracting_party LP ON LP.id_ajena_licitacion = LI.id_licitacion
  72. JOIN global_party MP ON MP.id_ajena_licitacion = LI.id_licitacion
  73. JOIN global_party_party_idenfitication MPI on MPI.id_ajena_licitacion = LI.id_licitacion AND MPI.attr = 'DIR3'
  74. JOIN global_procurement_project PROJ ON PROJ.id_ajena_licitacion = LI.id_licitacion
  75. JOIN global_procurement_project_itemclass PROJI ON PROJI.id_ajena_licitacion = LI.id_licitacion
  76. JOIN global_tendering_process TP ON TP.id_ajena_licitacion = LI.id_licitacion
  77. JOIN global_tendering_terms TT ON TT.id_ajena_licitacion = LI.id_licitacion
  78. JOIN codice_contract_status RCF ON RCF.CODE = CF.contractFolderStatusCode
  79. JOIN codice_located_contracting_party RLP ON RLP.CODE = LP.contractingPartyTypeCode
  80. JOIN codice_tipo_contrato TPC ON TPC.CODE = PROJ.typeCode
  81. JOIN codice_tender_process RTP ON RTP.CODE = TP.procedureCode
  82. JOIN codice_tender_process_contracting_code RTPC ON RTPC.CODE = TP.contractingSystemCode
  83. JOIN codice_tender_process_submission RTPS ON RTPS.CODE = TP.submissionMethodCode
  84. JOIN codice_tender_process_urgency_code RTPU ON RTPU.CODE = TP.urgencyCode
  85. WHERE LI.id_importacion = $idUltimaImportacion
  86. GROUP BY
  87. id_licitacion";
  88. $result = $this->db->query($sql);
  89. $datos['datos'] = $result->result();
  90. $datos['num_rows'] = $result->num_rows();
  91. return $datos;
  92. }
  93. public function getFullDatosUltimasInsertadas()
  94. {
  95. $sql = "SELECT *
  96. FROM
  97. vista_datos_licitacion";
  98. $result = $this->db->query($sql);
  99. $datos['datos'] = $result->result();
  100. $datos['num_rows'] = $result->num_rows();
  101. return $datos;
  102. }
  103. public function getTablaByFechaLog($tabla)
  104. {
  105. $sql = "SELECT * FROM $tabla
  106. WHERE fecha_creacion_log = '$this->fechaLog'";
  107. $result = $this->db->query($sql);
  108. $datos['datos'] = $result->result_array();
  109. $datos['num_rows'] = $result->num_rows();
  110. return $datos;
  111. }
  112. public function getProjectLotItem()
  113. {
  114. $sql = "SELECT
  115. MP.idProcurementLot,
  116. MP.countrySubentity,
  117. MP.countrySubentityCode,
  118. MP.totalAmount,
  119. MP.taxExclusiveAmount,
  120. MP.`name`,
  121. MP.id_ajena_licitacion,
  122. GROUP_CONCAT( MPI.idItem ) AS itemClassification_attr
  123. FROM
  124. global_procurement_project_lot MP
  125. JOIN global_procurement_project_lot_item MPI ON MP.id_compuesta = MPI.id_compuesta_padre
  126. WHERE
  127. MPI.fecha_creacion_log = '$this->fechaLog'
  128. GROUP BY
  129. MP.id_compuesta";
  130. $result = $this->db->query($sql);
  131. $datos['datos'] = $result->result_array();
  132. $datos['num_rows'] = $result->num_rows();
  133. return $datos;
  134. }
  135. public function getFechasPublicadas($idLicitacion)
  136. {
  137. $sql = "SELECT MIN(fechas) as fecha
  138. FROM
  139. global_valid_notice_info_fecha WHERE id_ajena_licitacion = '$idLicitacion'";
  140. $result = $this->db->query($sql);
  141. $datos['datos'] = $result->row();
  142. $datos['num_rows'] = $result->num_rows();
  143. return $datos;
  144. }
  145. public function getTenderingTermsCodes()
  146. {
  147. $sql = "SELECT
  148. TP.*,
  149. RTP.nombre AS tipoTender, /*procedureCode*/
  150. RTPC.nombre AS contrato_sistema, /*urgencyCode*/
  151. RTPS.nombre AS submision, /*contractingSistemCode*/
  152. RTPU.nombre AS urgency /*urgencyCode*/
  153. FROM
  154. global_tendering_process TP
  155. JOIN codice_tender_process RTP ON RTP.CODE = TP.procedureCode
  156. JOIN codice_tender_process_contracting_code RTPC ON RTPC.CODE = TP.contractingSystemCode
  157. JOIN codice_tender_process_submission RTPS ON RTPS.CODE = TP.submissionMethodCode
  158. JOIN codice_tender_process_urgency_code RTPU ON RTPU.CODE = TP.urgencyCode
  159. WHERE
  160. TP.fecha_creacion_log = '$this->fechaLog'";
  161. $result = $this->db->query($sql);
  162. $datos['datos'] = $result->result_array();
  163. $datos['num_rows'] = $result->num_rows();
  164. return $datos;
  165. }
  166. public function getDatosRelacionadasTablaWithoutLicitacion($tabla, $tablaRelacion, $txtIdAjena, $id = "t1.id")
  167. {
  168. $sql = "SELECT
  169. *,
  170. t2.nombre as code_desc
  171. FROM
  172. $tabla t1
  173. JOIN
  174. $tablaRelacion t2 ON t2." . $txtIdAjena . " = t1." . $id . "
  175. WHERE t1.fecha_creacion_log = '$this->fechaLog'";
  176. $result = $this->db->query($sql);
  177. $datos['datos'] = $result->result_array();
  178. $datos['num_rows'] = $result->num_rows();
  179. return $datos;
  180. }
  181. }
  182. /* End of file Xlsexport_model_model.php */
  183. /* Location: ./application/models/Xlsexport_model_model.php */