PageRenderTime 58ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/model/nomina/om/BaseNpinteresesprestaciones.php

https://github.com/cidesa/roraima
PHP | 559 lines | 398 code | 161 blank | 0 comment | 70 complexity | 304018e41c03f8f0a352735f2be3aaee MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. abstract class BaseNpinteresesprestaciones extends BaseObject implements Persistent {
  3. protected static $peer;
  4. protected $codnom;
  5. protected $codemp;
  6. protected $fecpago;
  7. protected $feccalculo;
  8. protected $acufondoantiguedad;
  9. protected $acuinteres;
  10. protected $id;
  11. protected $alreadyInSave = false;
  12. protected $alreadyInValidation = false;
  13. public function getCodnom()
  14. {
  15. return trim($this->codnom);
  16. }
  17. public function getCodemp()
  18. {
  19. return trim($this->codemp);
  20. }
  21. public function getFecpago($format = 'Y-m-d')
  22. {
  23. if ($this->fecpago === null || $this->fecpago === '') {
  24. return null;
  25. } elseif (!is_int($this->fecpago)) {
  26. $ts = adodb_strtotime($this->fecpago);
  27. if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecpago] as date/time value: " . var_export($this->fecpago, true));
  28. }
  29. } else {
  30. $ts = $this->fecpago;
  31. }
  32. if ($format === null) {
  33. return $ts;
  34. } elseif (strpos($format, '%') !== false) {
  35. return adodb_strftime($format, $ts);
  36. } else {
  37. return @adodb_date($format, $ts);
  38. }
  39. }
  40. public function getFeccalculo($format = 'Y-m-d')
  41. {
  42. if ($this->feccalculo === null || $this->feccalculo === '') {
  43. return null;
  44. } elseif (!is_int($this->feccalculo)) {
  45. $ts = adodb_strtotime($this->feccalculo);
  46. if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [feccalculo] as date/time value: " . var_export($this->feccalculo, true));
  47. }
  48. } else {
  49. $ts = $this->feccalculo;
  50. }
  51. if ($format === null) {
  52. return $ts;
  53. } elseif (strpos($format, '%') !== false) {
  54. return adodb_strftime($format, $ts);
  55. } else {
  56. return @adodb_date($format, $ts);
  57. }
  58. }
  59. public function getAcufondoantiguedad($val=false)
  60. {
  61. if($val) return number_format($this->acufondoantiguedad,2,',','.');
  62. else return $this->acufondoantiguedad;
  63. }
  64. public function getAcuinteres($val=false)
  65. {
  66. if($val) return number_format($this->acuinteres,2,',','.');
  67. else return $this->acuinteres;
  68. }
  69. public function getId()
  70. {
  71. return $this->id;
  72. }
  73. public function setCodnom($v)
  74. {
  75. if ($this->codnom !== $v) {
  76. $this->codnom = $v;
  77. $this->modifiedColumns[] = NpinteresesprestacionesPeer::CODNOM;
  78. }
  79. }
  80. public function setCodemp($v)
  81. {
  82. if ($this->codemp !== $v) {
  83. $this->codemp = $v;
  84. $this->modifiedColumns[] = NpinteresesprestacionesPeer::CODEMP;
  85. }
  86. }
  87. public function setFecpago($v)
  88. {
  89. if (is_array($v)){
  90. $value_array = $v;
  91. $v = (isset($value_array['hour']) ? ' '.$value_array['hour'].':'.$value_array['minute'].(isset($value_array['second']) ? ':'.$value_array['second'] : '') : '');
  92. }
  93. if ($v !== null && !is_int($v)) {
  94. $ts = adodb_strtotime($v);
  95. if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecpago] from input: " . var_export($v, true));
  96. }
  97. } else {
  98. $ts = $v;
  99. }
  100. if ($this->fecpago !== $ts) {
  101. $this->fecpago = $ts;
  102. $this->modifiedColumns[] = NpinteresesprestacionesPeer::FECPAGO;
  103. }
  104. }
  105. public function setFeccalculo($v)
  106. {
  107. if (is_array($v)){
  108. $value_array = $v;
  109. $v = (isset($value_array['hour']) ? ' '.$value_array['hour'].':'.$value_array['minute'].(isset($value_array['second']) ? ':'.$value_array['second'] : '') : '');
  110. }
  111. if ($v !== null && !is_int($v)) {
  112. $ts = adodb_strtotime($v);
  113. if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [feccalculo] from input: " . var_export($v, true));
  114. }
  115. } else {
  116. $ts = $v;
  117. }
  118. if ($this->feccalculo !== $ts) {
  119. $this->feccalculo = $ts;
  120. $this->modifiedColumns[] = NpinteresesprestacionesPeer::FECCALCULO;
  121. }
  122. }
  123. public function setAcufondoantiguedad($v)
  124. {
  125. if ($this->acufondoantiguedad !== $v) {
  126. $this->acufondoantiguedad = Herramientas::toFloat($v);
  127. $this->modifiedColumns[] = NpinteresesprestacionesPeer::ACUFONDOANTIGUEDAD;
  128. }
  129. }
  130. public function setAcuinteres($v)
  131. {
  132. if ($this->acuinteres !== $v) {
  133. $this->acuinteres = Herramientas::toFloat($v);
  134. $this->modifiedColumns[] = NpinteresesprestacionesPeer::ACUINTERES;
  135. }
  136. }
  137. public function setId($v)
  138. {
  139. if ($this->id !== $v) {
  140. $this->id = $v;
  141. $this->modifiedColumns[] = NpinteresesprestacionesPeer::ID;
  142. }
  143. }
  144. public function hydrate(ResultSet $rs, $startcol = 1)
  145. {
  146. try {
  147. $this->codnom = $rs->getString($startcol + 0);
  148. $this->codemp = $rs->getString($startcol + 1);
  149. $this->fecpago = $rs->getDate($startcol + 2, null);
  150. $this->feccalculo = $rs->getDate($startcol + 3, null);
  151. $this->acufondoantiguedad = $rs->getFloat($startcol + 4);
  152. $this->acuinteres = $rs->getFloat($startcol + 5);
  153. $this->id = $rs->getInt($startcol + 6);
  154. $this->resetModified();
  155. $this->setNew(false);
  156. $this->afterHydrate();
  157. return $startcol + 7;
  158. } catch (Exception $e) {
  159. throw new PropelException("Error populating Npinteresesprestaciones object", $e);
  160. }
  161. }
  162. protected function afterHydrate()
  163. {
  164. }
  165. public function __call($m, $a)
  166. {
  167. $prefijo = substr($m,0,3);
  168. $metodo = strtolower(substr($m,3));
  169. if($prefijo=='get'){
  170. if(isset($this->$metodo)) return $this->$metodo;
  171. else return '';
  172. }elseif($prefijo=='set'){
  173. if(isset($this->$metodo)) $this->$metodo = $a[0];
  174. }else call_user_func_array($m, $a);
  175. }
  176. public function delete($con = null)
  177. {
  178. if ($this->isDeleted()) {
  179. throw new PropelException("This object has already been deleted.");
  180. }
  181. if ($con === null) {
  182. $con = Propel::getConnection(NpinteresesprestacionesPeer::DATABASE_NAME);
  183. }
  184. try {
  185. $con->begin();
  186. NpinteresesprestacionesPeer::doDelete($this, $con);
  187. $this->setDeleted(true);
  188. $con->commit();
  189. } catch (PropelException $e) {
  190. $con->rollback();
  191. throw $e;
  192. }
  193. }
  194. public function save($con = null)
  195. {
  196. if ($this->isDeleted()) {
  197. throw new PropelException("You cannot save an object that has been deleted.");
  198. }
  199. if ($con === null) {
  200. $con = Propel::getConnection(NpinteresesprestacionesPeer::DATABASE_NAME);
  201. }
  202. try {
  203. $con->begin();
  204. $affectedRows = $this->doSave($con);
  205. $con->commit();
  206. return $affectedRows;
  207. } catch (PropelException $e) {
  208. $con->rollback();
  209. throw $e;
  210. }
  211. }
  212. protected function doSave($con)
  213. {
  214. $affectedRows = 0; if (!$this->alreadyInSave) {
  215. $this->alreadyInSave = true;
  216. if ($this->isModified()) {
  217. if ($this->isNew()) {
  218. $pk = NpinteresesprestacionesPeer::doInsert($this, $con);
  219. $affectedRows += 1;
  220. $this->setId($pk);
  221. $this->setNew(false);
  222. } else {
  223. $affectedRows += NpinteresesprestacionesPeer::doUpdate($this, $con);
  224. }
  225. $this->resetModified(); }
  226. $this->alreadyInSave = false;
  227. }
  228. return $affectedRows;
  229. }
  230. protected $validationFailures = array();
  231. public function getValidationFailures()
  232. {
  233. return $this->validationFailures;
  234. }
  235. public function validate($columns = null)
  236. {
  237. $res = $this->doValidate($columns);
  238. if ($res === true) {
  239. $this->validationFailures = array();
  240. return true;
  241. } else {
  242. $this->validationFailures = $res;
  243. return false;
  244. }
  245. }
  246. protected function doValidate($columns = null)
  247. {
  248. if (!$this->alreadyInValidation) {
  249. $this->alreadyInValidation = true;
  250. $retval = null;
  251. $failureMap = array();
  252. if (($retval = NpinteresesprestacionesPeer::doValidate($this, $columns)) !== true) {
  253. $failureMap = array_merge($failureMap, $retval);
  254. }
  255. $this->alreadyInValidation = false;
  256. }
  257. return (!empty($failureMap) ? $failureMap : true);
  258. }
  259. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  260. {
  261. $pos = NpinteresesprestacionesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  262. return $this->getByPosition($pos);
  263. }
  264. public function getByPosition($pos)
  265. {
  266. switch($pos) {
  267. case 0:
  268. return $this->getCodnom();
  269. break;
  270. case 1:
  271. return $this->getCodemp();
  272. break;
  273. case 2:
  274. return $this->getFecpago();
  275. break;
  276. case 3:
  277. return $this->getFeccalculo();
  278. break;
  279. case 4:
  280. return $this->getAcufondoantiguedad();
  281. break;
  282. case 5:
  283. return $this->getAcuinteres();
  284. break;
  285. case 6:
  286. return $this->getId();
  287. break;
  288. default:
  289. return null;
  290. break;
  291. } }
  292. public function toArray($keyType = BasePeer::TYPE_PHPNAME)
  293. {
  294. $keys = NpinteresesprestacionesPeer::getFieldNames($keyType);
  295. $result = array(
  296. $keys[0] => $this->getCodnom(),
  297. $keys[1] => $this->getCodemp(),
  298. $keys[2] => $this->getFecpago(),
  299. $keys[3] => $this->getFeccalculo(),
  300. $keys[4] => $this->getAcufondoantiguedad(),
  301. $keys[5] => $this->getAcuinteres(),
  302. $keys[6] => $this->getId(),
  303. );
  304. return $result;
  305. }
  306. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  307. {
  308. $pos = NpinteresesprestacionesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  309. return $this->setByPosition($pos, $value);
  310. }
  311. public function setByPosition($pos, $value)
  312. {
  313. switch($pos) {
  314. case 0:
  315. $this->setCodnom($value);
  316. break;
  317. case 1:
  318. $this->setCodemp($value);
  319. break;
  320. case 2:
  321. $this->setFecpago($value);
  322. break;
  323. case 3:
  324. $this->setFeccalculo($value);
  325. break;
  326. case 4:
  327. $this->setAcufondoantiguedad($value);
  328. break;
  329. case 5:
  330. $this->setAcuinteres($value);
  331. break;
  332. case 6:
  333. $this->setId($value);
  334. break;
  335. } }
  336. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  337. {
  338. $keys = NpinteresesprestacionesPeer::getFieldNames($keyType);
  339. if (array_key_exists($keys[0], $arr)) $this->setCodnom($arr[$keys[0]]);
  340. if (array_key_exists($keys[1], $arr)) $this->setCodemp($arr[$keys[1]]);
  341. if (array_key_exists($keys[2], $arr)) $this->setFecpago($arr[$keys[2]]);
  342. if (array_key_exists($keys[3], $arr)) $this->setFeccalculo($arr[$keys[3]]);
  343. if (array_key_exists($keys[4], $arr)) $this->setAcufondoantiguedad($arr[$keys[4]]);
  344. if (array_key_exists($keys[5], $arr)) $this->setAcuinteres($arr[$keys[5]]);
  345. if (array_key_exists($keys[6], $arr)) $this->setId($arr[$keys[6]]);
  346. }
  347. public function buildCriteria()
  348. {
  349. $criteria = new Criteria(NpinteresesprestacionesPeer::DATABASE_NAME);
  350. if ($this->isColumnModified(NpinteresesprestacionesPeer::CODNOM)) $criteria->add(NpinteresesprestacionesPeer::CODNOM, $this->codnom);
  351. if ($this->isColumnModified(NpinteresesprestacionesPeer::CODEMP)) $criteria->add(NpinteresesprestacionesPeer::CODEMP, $this->codemp);
  352. if ($this->isColumnModified(NpinteresesprestacionesPeer::FECPAGO)) $criteria->add(NpinteresesprestacionesPeer::FECPAGO, $this->fecpago);
  353. if ($this->isColumnModified(NpinteresesprestacionesPeer::FECCALCULO)) $criteria->add(NpinteresesprestacionesPeer::FECCALCULO, $this->feccalculo);
  354. if ($this->isColumnModified(NpinteresesprestacionesPeer::ACUFONDOANTIGUEDAD)) $criteria->add(NpinteresesprestacionesPeer::ACUFONDOANTIGUEDAD, $this->acufondoantiguedad);
  355. if ($this->isColumnModified(NpinteresesprestacionesPeer::ACUINTERES)) $criteria->add(NpinteresesprestacionesPeer::ACUINTERES, $this->acuinteres);
  356. if ($this->isColumnModified(NpinteresesprestacionesPeer::ID)) $criteria->add(NpinteresesprestacionesPeer::ID, $this->id);
  357. return $criteria;
  358. }
  359. public function buildPkeyCriteria()
  360. {
  361. $criteria = new Criteria(NpinteresesprestacionesPeer::DATABASE_NAME);
  362. $criteria->add(NpinteresesprestacionesPeer::ID, $this->id);
  363. return $criteria;
  364. }
  365. public function getPrimaryKey()
  366. {
  367. return $this->getId();
  368. }
  369. public function setPrimaryKey($key)
  370. {
  371. $this->setId($key);
  372. }
  373. public function copyInto($copyObj, $deepCopy = false)
  374. {
  375. $copyObj->setCodnom($this->codnom);
  376. $copyObj->setCodemp($this->codemp);
  377. $copyObj->setFecpago($this->fecpago);
  378. $copyObj->setFeccalculo($this->feccalculo);
  379. $copyObj->setAcufondoantiguedad($this->acufondoantiguedad);
  380. $copyObj->setAcuinteres($this->acuinteres);
  381. $copyObj->setNew(true);
  382. $copyObj->setId(NULL);
  383. }
  384. public function copy($deepCopy = false)
  385. {
  386. $clazz = get_class($this);
  387. $copyObj = new $clazz();
  388. $this->copyInto($copyObj, $deepCopy);
  389. return $copyObj;
  390. }
  391. public function getPeer()
  392. {
  393. if (self::$peer === null) {
  394. self::$peer = new NpinteresesprestacionesPeer();
  395. }
  396. return self::$peer;
  397. }
  398. }