Xlsexport_model.php 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. // ------------------------------------------------------------------------
  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.url_id_licitacion,
  33. LI.updated,
  34. CF.contractFolderID,
  35. LP.buyerProfileURIID,
  36. MP.partyName,
  37. MP.codpostal,
  38. MP.websiteURI,
  39. MP.city,
  40. MP.direccion,
  41. MP.contact_name,
  42. MP.contact_email,
  43. PROJ.NAME,
  44. PROJ.estimatedOverallContractAmount,
  45. PROJ.taxExclusiveAmount,
  46. PROJ.totalAmount,
  47. PROJ.countrySubentityCode,
  48. PROJ.countrySubentity,
  49. PROJ.durationMesure,
  50. PROJ.medida,
  51. PROJ.duracion_inicio,
  52. PROJ.duracion_fin,
  53. PROJ.contractExtension,
  54. TT.procurementLegislationDocumentReference,
  55. TT.allowedSubcontractTerms,
  56. RCF.descripcion AS contrato_status,
  57. RLP.nombre AS tipo_administracion,
  58. TPC.descripcion AS tipo_contrato,
  59. RTP.nombre AS tipoTender,
  60. RTPC.nombre AS contrato_sistema,
  61. RTPS.nombre AS submision,
  62. RTPU.nombre AS urgency,
  63. LI.fecha_creacion_log
  64. FROM
  65. maestro_datos_iniciales_licitacion LI /*JOIN import_licitaciones_temp temp ON LI.id_licitacion = temp.id_licitacion*/
  66. LEFT JOIN maestro_contract_folder CF ON CF.id_ajena_licitacion = LI.id_licitacion
  67. LEFT JOIN maestro_located_contracting_party LP ON LP.id_ajena_licitacion = LI.id_licitacion
  68. LEFT JOIN maestro_party MP ON MP.id_ajena_licitacion = LI.id_licitacion
  69. LEFT JOIN maestro_procurement_project PROJ ON PROJ.id_ajena_licitacion = LI.id_licitacion
  70. LEFT JOIN maestro_procurement_project_itemclass PROJI ON PROJI.id_ajena_licitacion = LI.id_licitacion
  71. LEFT JOIN maestro_tendering_process TP ON TP.id_ajena_licitacion = LI.id_licitacion
  72. LEFT JOIN maestro_tendering_terms TT ON TT.id_ajena_licitacion = LI.id_licitacion
  73. LEFT JOIN relacionada_contract_status RCF ON RCF.CODE = CF.contractFolderStatusCode
  74. LEFT JOIN relacionada_located_contracting_party RLP ON RLP.CODE = LP.contractingPartyTypeCode
  75. LEFT JOIN relacionada_tipo_contrato TPC ON TPC.CODE = PROJ.typeCode
  76. LEFT JOIN relacionada_tender_process RTP ON RTP.CODE = TP.procedureCode
  77. LEFT JOIN relacionada_tender_process_contracting_code RTPC ON RTPC.CODE = TP.contractingSystemCode
  78. LEFT JOIN relacionada_tender_process_submission RTPS ON RTPS.CODE = TP.submissionMethodCode
  79. LEFT JOIN relacionada_tender_process_urgency_code RTPU ON RTPU.CODE = TP.urgencyCode /*WHERE
  80. LI.id < 17174 */
  81. GROUP BY
  82. id_licitacion
  83. $having
  84. ORDER BY
  85. CF.id";
  86. $result = $this->db->query($sql);
  87. $datos['datos'] = $result->result();
  88. $datos['num_rows'] = $result->num_rows();
  89. return $datos;
  90. }
  91. public function getDatosByTablaAndLicitacion($tabla, $licitacionID)
  92. {
  93. $sql = "SELECT *
  94. FROM
  95. $tabla
  96. WHERE id_ajena_licitacion = $licitacionID";
  97. $result = $this->db->query($sql);
  98. $datos['datos'] = $result->result_array();
  99. $datos['num_rows'] = $result->num_rows();
  100. return $datos['datos'];
  101. }
  102. public function getTablaWithoutLicitacion($tabla)
  103. {
  104. $sql = "SELECT
  105. *
  106. FROM
  107. $tabla t1";
  108. $result = $this->db->query($sql);
  109. $datos['datos'] = $result->result_array();
  110. $datos['num_rows'] = $result->num_rows();
  111. return $datos;
  112. }
  113. public function getDatosRelacionadosByTablaAndLicitacion($tabla, $tablaAjena, $idRelacionada, $idAjenaLicitacion)
  114. {
  115. $sql = "SELECT
  116. *
  117. FROM
  118. $tabla
  119. JOIN $tablaAjena TBAJ ON TBAJ.code = " . $tabla . "." . $idRelacionada . "
  120. WHERE id_ajena_licitacion = $idAjenaLicitacion";
  121. $result = $this->db->query($sql);
  122. $datos['datos'] = $result->result_array();
  123. $datos['num_rows'] = $result->num_rows();
  124. return $datos['datos'];
  125. }
  126. public function getDatosRelacionadasTablaWithoutLicitacion($tablaRelacion, $tabla, $txtIdAjena, $id = "t1.id")
  127. {
  128. $sql = "SELECT
  129. *
  130. FROM
  131. $tabla t1
  132. JOIN
  133. $tablaRelacion t2 ON t2." . $txtIdAjena . " = t1.id";
  134. $result = $this->db->query($sql);
  135. $datos['datos'] = $result->result_array();
  136. $datos['num_rows'] = $result->num_rows();
  137. return $datos;
  138. }
  139. public function getTenderProcessRelacion()
  140. {
  141. $sql = "SELECT
  142. t2.nombre as procedureCode, t3.nombre as contractingSystemCode, t4.nombre as submissionMethodCode, t5.nombre as urgencyCode,
  143. t1.id_ajena_licitacion, t1.partPresentationCode, t1.maximumLotPresentationQuantity, t1.maximumTendererAwardedLotsQuantity, t1.lotsCombinationContractingAuthorityRights,
  144. t1.deadLineEndDate, t1.deadLineEndTime, t1.deadLineDescription, t1.auctionTerms, t1.documentAvailablePeriod_EndDate, t1.documentAvailablePeriod_EndTime
  145. FROM
  146. maestro_tendering_process t1
  147. JOIN relacionada_tender_process t2 ON t2.code = t1.procedureCode
  148. JOIN relacionada_tender_process_contracting_code t3 ON t3.code = t1.contractingSystemCode
  149. JOIN relacionada_tender_process_submission t4 ON t4.code = t1.submissionMethodCode
  150. JOIN relacionada_tender_process_urgency_code t5 ON t5.code = t1.urgencyCode";
  151. $result = $this->db->query($sql);
  152. $datos['datos'] = $result->result_array();
  153. $datos['num_rows'] = $result->num_rows();
  154. return $datos;
  155. }
  156. public function getValidNoticeInfoRelacion()
  157. {
  158. $sql = "SELECT
  159. t2.nombre as noticeTypeCode, t1.id_ajena_licitacion, t1.publicationMediaName
  160. FROM
  161. maestro_valid_notice_info t1
  162. JOIN relacionada_valid_notice_info t2 ON t2.code = t1.noticeTypeCode";
  163. $result = $this->db->query($sql);
  164. $datos['datos'] = $result->result_array();
  165. $datos['num_rows'] = $result->num_rows();
  166. return $datos;
  167. }
  168. public function getTenderResult()
  169. {
  170. $sql = "SELECT
  171. t2.nombre as resultCode, t1.id_ajena_licitacion, t1.description, t1.awardDate, t1.receivedTenderQuantity, t1.lowerTenderAmount , t1.higherTenderAmount, t1.startDate,
  172. t1.smeawardedIndicator, t1.contract_id, t1.contract_issueDate, t1.partyIdentification, t1.partyName, t1.TaxExclusiveAmount, t1.PayableAmount
  173. FROM
  174. maestro_tender_result t1
  175. JOIN relacionada_tender_result t2 ON t2.code = t1.resultCode";
  176. $result = $this->db->query($sql);
  177. $datos['datos'] = $result->result_array();
  178. $datos['num_rows'] = $result->num_rows();
  179. return $datos;
  180. }
  181. public function getTenderingTermsGarantia()
  182. {
  183. $sql = "SELECT
  184. t1.id_ajena_licitacion, t2.nombre as guaranteeTypeCode, t1.requiredCurriculaIndicator, t1.variantConstraintIndicator, t1.fundingProgramCode, t1.requiredFinancialGuarantee_Amount,
  185. t1.language, t1.allowedSubcontractTerms, t1.description, t1.personalSituation, t1.procurementLegislationDocumentReference
  186. FROM
  187. maestro_tendering_terms t1
  188. JOIN relacionada_codigo_tipo_garantia t2 ON t2.code = t1.guaranteeTypeCode";
  189. $result = $this->db->query($sql);
  190. $datos['datos'] = $result->result_array();
  191. $datos['num_rows'] = $result->num_rows();
  192. return $datos;
  193. }
  194. public function getTenderingTermsCriteriosFinanciacion()
  195. {
  196. $sql = "SELECT
  197. t2.id_ajena_licitacion,
  198. t3.nombre AS evaluationCriteriaTypeCode,
  199. t1.description
  200. FROM
  201. maestro_tendering_terms_financial_evaluation t1
  202. JOIN maestro_tendering_terms t2 ON t1.id_ajena_licitacion = t2.id
  203. JOIN relacionada_tendering_terms_financial t3 ON t3.CODE = t1.evaluationCriteriaTypeCode";
  204. $result = $this->db->query($sql);
  205. $datos['datos'] = $result->result_array();
  206. $datos['num_rows'] = $result->num_rows();
  207. return $datos;
  208. }
  209. public function getTenderingTermsCriteriosTecnicos()
  210. {
  211. $sql = "SELECT
  212. t2.id_ajena_licitacion, t3.nombre as evaluationCriteriaTypeCode, t1.description
  213. FROM
  214. maestro_tendering_terms_qualification_request t1
  215. JOIN maestro_tendering_terms t2 ON t1.id_ajena_licitacion = t2.id
  216. JOIN relacionada_tendering_terms_qualification_request t3 ON t3.code = t1.evaluationCriteriaTypeCode";
  217. $result = $this->db->query($sql);
  218. $datos['datos'] = $result->result_array();
  219. $datos['num_rows'] = $result->num_rows();
  220. return $datos;
  221. }
  222. public function getTenderingTermsRequisitos()
  223. {
  224. $sql = "SELECT
  225. t2.id_ajena_licitacion, t3.nombre as evaluationCriteriaTypeCode, t1.description
  226. FROM
  227. maestro_tendering_terms_qualification_request t1
  228. JOIN maestro_tendering_terms t2 ON t1.id_ajena_licitacion = t2.id
  229. JOIN relacionada_tendering_terms_qualification_request t3 ON t3.code = t1.evaluationCriteriaTypeCode";
  230. $result = $this->db->query($sql);
  231. $datos['datos'] = $result->result_array();
  232. $datos['num_rows'] = $result->num_rows();
  233. return $datos;
  234. }
  235. public function getProjectLotActivityByProjectLot($projectLotId)
  236. {
  237. $sql = "SELECT
  238. *
  239. FROM
  240. maestro_procurement_project_lot_item
  241. WHERE id_ajena_ppl = $projectLotId";
  242. $result = $this->db->query($sql);
  243. $datos['datos'] = $result->result_array();
  244. $datos['num_rows'] = $result->num_rows();
  245. return $datos;
  246. }
  247. }
  248. /* End of file Xlsexport_model_model.php */
  249. /* Location: ./application/models/Xlsexport_model_model.php */