Xlsexport_model.php 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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-25 08:08:51";
  20. public function __construct()
  21. {
  22. parent::__construct();
  23. }
  24. // ------------------------------------------------------------------------
  25. // ------------------------------------------------------------------------
  26. public function getLicitaciones($having = "")
  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. maestro_datos_iniciales_licitacion LI
  70. JOIN maestro_contract_folder CF ON CF.id_ajena_licitacion = LI.id_licitacion
  71. JOIN maestro_located_contracting_party LP ON LP.id_ajena_licitacion = LI.id_licitacion
  72. JOIN maestro_party MP ON MP.id_ajena_licitacion = LI.id_licitacion
  73. JOIN maestro_party_party_idenfitication MPI on MPI.id_ajena_licitacion = LI.id_licitacion AND MPI.attr = 'DIR3'
  74. JOIN maestro_procurement_project PROJ ON PROJ.id_ajena_licitacion = LI.id_licitacion
  75. JOIN maestro_procurement_project_itemclass PROJI ON PROJI.id_ajena_licitacion = LI.id_licitacion
  76. JOIN maestro_tendering_process TP ON TP.id_ajena_licitacion = LI.id_licitacion
  77. JOIN maestro_tendering_terms TT ON TT.id_ajena_licitacion = LI.id_licitacion
  78. JOIN relacionada_contract_status RCF ON RCF.CODE = CF.contractFolderStatusCode
  79. JOIN relacionada_located_contracting_party RLP ON RLP.CODE = LP.contractingPartyTypeCode
  80. JOIN relacionada_tipo_contrato TPC ON TPC.CODE = PROJ.typeCode
  81. JOIN relacionada_tender_process RTP ON RTP.CODE = TP.procedureCode
  82. JOIN relacionada_tender_process_contracting_code RTPC ON RTPC.CODE = TP.contractingSystemCode
  83. JOIN relacionada_tender_process_submission RTPS ON RTPS.CODE = TP.submissionMethodCode
  84. JOIN relacionada_tender_process_urgency_code RTPU ON RTPU.CODE = TP.urgencyCode /*WHERE
  85. LI.id < 17174 */
  86. GROUP BY
  87. id_licitacion
  88. $having
  89. ORDER BY
  90. CF.id";
  91. $result = $this->db->query($sql);
  92. $datos['datos'] = $result->result();
  93. $datos['num_rows'] = $result->num_rows();
  94. return $datos;
  95. }
  96. public function getFullDatosUltimasInsertadas()
  97. {
  98. $sql = "SELECT *
  99. FROM
  100. vista_datos_licitacion";
  101. $result = $this->db->query($sql);
  102. $datos['datos'] = $result->result();
  103. $datos['num_rows'] = $result->num_rows();
  104. return $datos;
  105. }
  106. public function getTablaByFechaLog($tabla)
  107. {
  108. $sql = "SELECT * FROM $tabla
  109. WHERE fecha_creacion_log = '$this->fechaLog'";
  110. $result = $this->db->query($sql);
  111. $datos['datos'] = $result->result_array();
  112. $datos['num_rows'] = $result->num_rows();
  113. return $datos;
  114. }
  115. public function getProjectLotItem()
  116. {
  117. $sql = "SELECT
  118. MP.idProcurementLot,
  119. MP.countrySubentity,
  120. MP.countrySubentityCode,
  121. MP.totalAmount,
  122. MP.taxExclusiveAmount,
  123. MP.`name`,
  124. MP.id_ajena_licitacion,
  125. GROUP_CONCAT( MPI.idItem ) AS itemClassification_attr
  126. FROM
  127. maestro_procurement_project_lot MP
  128. JOIN maestro_procurement_project_lot_item MPI ON MP.id_compuesta = MPI.id_compuesta_padre
  129. WHERE
  130. MPI.fecha_creacion_log = '$this->fechaLog'
  131. GROUP BY
  132. MP.id_compuesta";
  133. $result = $this->db->query($sql);
  134. $datos['datos'] = $result->result_array();
  135. $datos['num_rows'] = $result->num_rows();
  136. return $datos;
  137. }
  138. public function getFechasPublicadas($idLicitacion)
  139. {
  140. $sql = "SELECT MIN(fechas) as fecha
  141. FROM
  142. maestro_valid_notice_info_fecha WHERE id_ajena_licitacion = '$idLicitacion'";
  143. $result = $this->db->query($sql);
  144. $datos['datos'] = $result->row();
  145. $datos['num_rows'] = $result->num_rows();
  146. return $datos;
  147. }
  148. public function getTenderingTermsCodes()
  149. {
  150. $sql = "SELECT
  151. TP.*,
  152. RTP.nombre AS tipoTender, /*procedureCode*/
  153. RTPC.nombre AS contrato_sistema, /*urgencyCode*/
  154. RTPS.nombre AS submision, /*contractingSistemCode*/
  155. RTPU.nombre AS urgency /*urgencyCode*/
  156. FROM
  157. maestro_tendering_process TP
  158. JOIN relacionada_tender_process RTP ON RTP.CODE = TP.procedureCode
  159. JOIN relacionada_tender_process_contracting_code RTPC ON RTPC.CODE = TP.contractingSystemCode
  160. JOIN relacionada_tender_process_submission RTPS ON RTPS.CODE = TP.submissionMethodCode
  161. JOIN relacionada_tender_process_urgency_code RTPU ON RTPU.CODE = TP.urgencyCode
  162. WHERE
  163. TP.fecha_creacion_log = '$this->fechaLog'";
  164. $result = $this->db->query($sql);
  165. $datos['datos'] = $result->result_array();
  166. $datos['num_rows'] = $result->num_rows();
  167. return $datos;
  168. }
  169. public function getDatosRelacionadasTablaWithoutLicitacion($tabla, $tablaRelacion, $txtIdAjena, $id = "t1.id")
  170. {
  171. $sql = "SELECT
  172. *,
  173. t2.nombre as code_desc
  174. FROM
  175. $tabla t1
  176. JOIN
  177. $tablaRelacion t2 ON t2." . $txtIdAjena . " = t1." . $id . "
  178. WHERE t1.fecha_creacion_log = '$this->fechaLog'";
  179. $result = $this->db->query($sql);
  180. $datos['datos'] = $result->result_array();
  181. $datos['num_rows'] = $result->num_rows();
  182. return $datos;
  183. }
  184. }
  185. /* End of file Xlsexport_model_model.php */
  186. /* Location: ./application/models/Xlsexport_model_model.php */