<?php


abstract class BaseTerceros extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $nitocc;


	
	protected $tipter;


	
	protected $razsoc;


	
	protected $ciudad;


	
	protected $telefo;


	
	protected $telfax;


	
	protected $direcc;


	
	protected $estado = 1;


	
	protected $email;


	
	protected $sueldo;


	
	protected $cargo;


	
	protected $codreg;

	
	protected $collUsuarioss;

	
	protected $lastUsuariosCriteria = null;

	
	protected $collDestinosComisionadoss;

	
	protected $lastDestinosComisionadosCriteria = null;

	
	protected $collComisionadosPlantas;

	
	protected $lastComisionadosPlantaCriteria = null;

	
	protected $collTarifasDestinos;

	
	protected $lastTarifasDestinoCriteria = null;

	
	protected $collComisionadosContratos;

	
	protected $lastComisionadosContratoCriteria = null;

	
	protected $collComisionadosObjss;

	
	protected $lastComisionadosObjsCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getNitocc()
	{

		return $this->nitocc;
	}

	
	public function getTipter()
	{

		return $this->tipter;
	}

	
	public function getRazsoc()
	{

		return $this->razsoc;
	}

	
	public function getCiudad()
	{

		return $this->ciudad;
	}

	
	public function getTelefo()
	{

		return $this->telefo;
	}

	
	public function getTelfax()
	{

		return $this->telfax;
	}

	
	public function getDirecc()
	{

		return $this->direcc;
	}

	
	public function getEstado()
	{

		return $this->estado;
	}

	
	public function getEmail()
	{

		return $this->email;
	}

	
	public function getSueldo()
	{

		return $this->sueldo;
	}

	
	public function getCargo()
	{

		return $this->cargo;
	}

	
	public function getCodreg()
	{

		return $this->codreg;
	}

	
	public function setNitocc($v)
	{

		if ($this->nitocc !== $v) {
			$this->nitocc = $v;
			$this->modifiedColumns[] = TercerosPeer::NITOCC;
		}

	} 
	
	public function setTipter($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->tipter !== $v) {
			$this->tipter = $v;
			$this->modifiedColumns[] = TercerosPeer::TIPTER;
		}

	} 
	
	public function setRazsoc($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->razsoc !== $v) {
			$this->razsoc = $v;
			$this->modifiedColumns[] = TercerosPeer::RAZSOC;
		}

	} 
	
	public function setCiudad($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->ciudad !== $v) {
			$this->ciudad = $v;
			$this->modifiedColumns[] = TercerosPeer::CIUDAD;
		}

	} 
	
	public function setTelefo($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->telefo !== $v) {
			$this->telefo = $v;
			$this->modifiedColumns[] = TercerosPeer::TELEFO;
		}

	} 
	
	public function setTelfax($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->telfax !== $v) {
			$this->telfax = $v;
			$this->modifiedColumns[] = TercerosPeer::TELFAX;
		}

	} 
	
	public function setDirecc($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->direcc !== $v) {
			$this->direcc = $v;
			$this->modifiedColumns[] = TercerosPeer::DIRECC;
		}

	} 
	
	public function setEstado($v)
	{

		if ($this->estado !== $v || $v === 1) {
			$this->estado = $v;
			$this->modifiedColumns[] = TercerosPeer::ESTADO;
		}

	} 
	
	public function setEmail($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->email !== $v) {
			$this->email = $v;
			$this->modifiedColumns[] = TercerosPeer::EMAIL;
		}

	} 
	
	public function setSueldo($v)
	{

		if ($this->sueldo !== $v) {
			$this->sueldo = $v;
			$this->modifiedColumns[] = TercerosPeer::SUELDO;
		}

	} 
	
	public function setCargo($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cargo !== $v) {
			$this->cargo = $v;
			$this->modifiedColumns[] = TercerosPeer::CARGO;
		}

	} 
	
	public function setCodreg($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->codreg !== $v) {
			$this->codreg = $v;
			$this->modifiedColumns[] = TercerosPeer::CODREG;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->nitocc = $rs->getFloat($startcol + 0);

			$this->tipter = $rs->getString($startcol + 1);

			$this->razsoc = $rs->getString($startcol + 2);

			$this->ciudad = $rs->getString($startcol + 3);

			$this->telefo = $rs->getString($startcol + 4);

			$this->telfax = $rs->getString($startcol + 5);

			$this->direcc = $rs->getString($startcol + 6);

			$this->estado = $rs->getFloat($startcol + 7);

			$this->email = $rs->getString($startcol + 8);

			$this->sueldo = $rs->getFloat($startcol + 9);

			$this->cargo = $rs->getString($startcol + 10);

			$this->codreg = $rs->getString($startcol + 11);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 12; 
		} catch (Exception $e) {
			throw new PropelException("Error populating Terceros object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TercerosPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			TercerosPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TercerosPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = TercerosPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setNew(false);
				} else {
					$affectedRows += TercerosPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collUsuarioss !== null) {
				foreach($this->collUsuarioss as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collDestinosComisionadoss !== null) {
				foreach($this->collDestinosComisionadoss as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collComisionadosPlantas !== null) {
				foreach($this->collComisionadosPlantas as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collTarifasDestinos !== null) {
				foreach($this->collTarifasDestinos as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collComisionadosContratos !== null) {
				foreach($this->collComisionadosContratos as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collComisionadosObjss !== null) {
				foreach($this->collComisionadosObjss as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = TercerosPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collUsuarioss !== null) {
					foreach($this->collUsuarioss as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collDestinosComisionadoss !== null) {
					foreach($this->collDestinosComisionadoss as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collComisionadosPlantas !== null) {
					foreach($this->collComisionadosPlantas as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collTarifasDestinos !== null) {
					foreach($this->collTarifasDestinos as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collComisionadosContratos !== null) {
					foreach($this->collComisionadosContratos as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collComisionadosObjss !== null) {
					foreach($this->collComisionadosObjss as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = TercerosPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getNitocc();
				break;
			case 1:
				return $this->getTipter();
				break;
			case 2:
				return $this->getRazsoc();
				break;
			case 3:
				return $this->getCiudad();
				break;
			case 4:
				return $this->getTelefo();
				break;
			case 5:
				return $this->getTelfax();
				break;
			case 6:
				return $this->getDirecc();
				break;
			case 7:
				return $this->getEstado();
				break;
			case 8:
				return $this->getEmail();
				break;
			case 9:
				return $this->getSueldo();
				break;
			case 10:
				return $this->getCargo();
				break;
			case 11:
				return $this->getCodreg();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = TercerosPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getNitocc(),
			$keys[1] => $this->getTipter(),
			$keys[2] => $this->getRazsoc(),
			$keys[3] => $this->getCiudad(),
			$keys[4] => $this->getTelefo(),
			$keys[5] => $this->getTelfax(),
			$keys[6] => $this->getDirecc(),
			$keys[7] => $this->getEstado(),
			$keys[8] => $this->getEmail(),
			$keys[9] => $this->getSueldo(),
			$keys[10] => $this->getCargo(),
			$keys[11] => $this->getCodreg(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = TercerosPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setNitocc($value);
				break;
			case 1:
				$this->setTipter($value);
				break;
			case 2:
				$this->setRazsoc($value);
				break;
			case 3:
				$this->setCiudad($value);
				break;
			case 4:
				$this->setTelefo($value);
				break;
			case 5:
				$this->setTelfax($value);
				break;
			case 6:
				$this->setDirecc($value);
				break;
			case 7:
				$this->setEstado($value);
				break;
			case 8:
				$this->setEmail($value);
				break;
			case 9:
				$this->setSueldo($value);
				break;
			case 10:
				$this->setCargo($value);
				break;
			case 11:
				$this->setCodreg($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = TercerosPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setNitocc($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setTipter($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setRazsoc($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setCiudad($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setTelefo($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setTelfax($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setDirecc($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setEstado($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setEmail($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setSueldo($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setCargo($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setCodreg($arr[$keys[11]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(TercerosPeer::DATABASE_NAME);

		if ($this->isColumnModified(TercerosPeer::NITOCC)) $criteria->add(TercerosPeer::NITOCC, $this->nitocc);
		if ($this->isColumnModified(TercerosPeer::TIPTER)) $criteria->add(TercerosPeer::TIPTER, $this->tipter);
		if ($this->isColumnModified(TercerosPeer::RAZSOC)) $criteria->add(TercerosPeer::RAZSOC, $this->razsoc);
		if ($this->isColumnModified(TercerosPeer::CIUDAD)) $criteria->add(TercerosPeer::CIUDAD, $this->ciudad);
		if ($this->isColumnModified(TercerosPeer::TELEFO)) $criteria->add(TercerosPeer::TELEFO, $this->telefo);
		if ($this->isColumnModified(TercerosPeer::TELFAX)) $criteria->add(TercerosPeer::TELFAX, $this->telfax);
		if ($this->isColumnModified(TercerosPeer::DIRECC)) $criteria->add(TercerosPeer::DIRECC, $this->direcc);
		if ($this->isColumnModified(TercerosPeer::ESTADO)) $criteria->add(TercerosPeer::ESTADO, $this->estado);
		if ($this->isColumnModified(TercerosPeer::EMAIL)) $criteria->add(TercerosPeer::EMAIL, $this->email);
		if ($this->isColumnModified(TercerosPeer::SUELDO)) $criteria->add(TercerosPeer::SUELDO, $this->sueldo);
		if ($this->isColumnModified(TercerosPeer::CARGO)) $criteria->add(TercerosPeer::CARGO, $this->cargo);
		if ($this->isColumnModified(TercerosPeer::CODREG)) $criteria->add(TercerosPeer::CODREG, $this->codreg);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(TercerosPeer::DATABASE_NAME);

		$criteria->add(TercerosPeer::NITOCC, $this->nitocc);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getNitocc();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setNitocc($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setTipter($this->tipter);

		$copyObj->setRazsoc($this->razsoc);

		$copyObj->setCiudad($this->ciudad);

		$copyObj->setTelefo($this->telefo);

		$copyObj->setTelfax($this->telfax);

		$copyObj->setDirecc($this->direcc);

		$copyObj->setEstado($this->estado);

		$copyObj->setEmail($this->email);

		$copyObj->setSueldo($this->sueldo);

		$copyObj->setCargo($this->cargo);

		$copyObj->setCodreg($this->codreg);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getUsuarioss() as $relObj) {
				$copyObj->addUsuarios($relObj->copy($deepCopy));
			}

			foreach($this->getDestinosComisionadoss() as $relObj) {
				$copyObj->addDestinosComisionados($relObj->copy($deepCopy));
			}

			foreach($this->getComisionadosPlantas() as $relObj) {
				$copyObj->addComisionadosPlanta($relObj->copy($deepCopy));
			}

			foreach($this->getTarifasDestinos() as $relObj) {
				$copyObj->addTarifasDestino($relObj->copy($deepCopy));
			}

			foreach($this->getComisionadosContratos() as $relObj) {
				$copyObj->addComisionadosContrato($relObj->copy($deepCopy));
			}

			foreach($this->getComisionadosObjss() as $relObj) {
				$copyObj->addComisionadosObjs($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setNitocc(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new TercerosPeer();
		}
		return self::$peer;
	}

	
	public function initUsuarioss()
	{
		if ($this->collUsuarioss === null) {
			$this->collUsuarioss = array();
		}
	}

	
	public function getUsuarioss($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collUsuarioss === null) {
			if ($this->isNew()) {
			   $this->collUsuarioss = array();
			} else {

				$criteria->add(UsuariosPeer::NITOCC, $this->getNitocc());

				UsuariosPeer::addSelectColumns($criteria);
				$this->collUsuarioss = UsuariosPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(UsuariosPeer::NITOCC, $this->getNitocc());

				UsuariosPeer::addSelectColumns($criteria);
				if (!isset($this->lastUsuariosCriteria) || !$this->lastUsuariosCriteria->equals($criteria)) {
					$this->collUsuarioss = UsuariosPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastUsuariosCriteria = $criteria;
		return $this->collUsuarioss;
	}

	
	public function countUsuarioss($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(UsuariosPeer::NITOCC, $this->getNitocc());

		return UsuariosPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addUsuarios(Usuarios $l)
	{
		$this->collUsuarioss[] = $l;
		$l->setTerceros($this);
	}


	
	public function getUsuariossJoinPerfiles($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collUsuarioss === null) {
			if ($this->isNew()) {
				$this->collUsuarioss = array();
			} else {

				$criteria->add(UsuariosPeer::NITOCC, $this->getNitocc());

				$this->collUsuarioss = UsuariosPeer::doSelectJoinPerfiles($criteria, $con);
			}
		} else {
									
			$criteria->add(UsuariosPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastUsuariosCriteria) || !$this->lastUsuariosCriteria->equals($criteria)) {
				$this->collUsuarioss = UsuariosPeer::doSelectJoinPerfiles($criteria, $con);
			}
		}
		$this->lastUsuariosCriteria = $criteria;

		return $this->collUsuarioss;
	}

	
	public function initDestinosComisionadoss()
	{
		if ($this->collDestinosComisionadoss === null) {
			$this->collDestinosComisionadoss = array();
		}
	}

	
	public function getDestinosComisionadoss($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collDestinosComisionadoss === null) {
			if ($this->isNew()) {
			   $this->collDestinosComisionadoss = array();
			} else {

				$criteria->add(DestinosComisionadosPeer::NITOCC, $this->getNitocc());

				DestinosComisionadosPeer::addSelectColumns($criteria);
				$this->collDestinosComisionadoss = DestinosComisionadosPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(DestinosComisionadosPeer::NITOCC, $this->getNitocc());

				DestinosComisionadosPeer::addSelectColumns($criteria);
				if (!isset($this->lastDestinosComisionadosCriteria) || !$this->lastDestinosComisionadosCriteria->equals($criteria)) {
					$this->collDestinosComisionadoss = DestinosComisionadosPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastDestinosComisionadosCriteria = $criteria;
		return $this->collDestinosComisionadoss;
	}

	
	public function countDestinosComisionadoss($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(DestinosComisionadosPeer::NITOCC, $this->getNitocc());

		return DestinosComisionadosPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addDestinosComisionados(DestinosComisionados $l)
	{
		$this->collDestinosComisionadoss[] = $l;
		$l->setTerceros($this);
	}


	
	public function getDestinosComisionadossJoinMunicipios($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collDestinosComisionadoss === null) {
			if ($this->isNew()) {
				$this->collDestinosComisionadoss = array();
			} else {

				$criteria->add(DestinosComisionadosPeer::NITOCC, $this->getNitocc());

				$this->collDestinosComisionadoss = DestinosComisionadosPeer::doSelectJoinMunicipios($criteria, $con);
			}
		} else {
									
			$criteria->add(DestinosComisionadosPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastDestinosComisionadosCriteria) || !$this->lastDestinosComisionadosCriteria->equals($criteria)) {
				$this->collDestinosComisionadoss = DestinosComisionadosPeer::doSelectJoinMunicipios($criteria, $con);
			}
		}
		$this->lastDestinosComisionadosCriteria = $criteria;

		return $this->collDestinosComisionadoss;
	}


	
	public function getDestinosComisionadossJoinTransportes($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collDestinosComisionadoss === null) {
			if ($this->isNew()) {
				$this->collDestinosComisionadoss = array();
			} else {

				$criteria->add(DestinosComisionadosPeer::NITOCC, $this->getNitocc());

				$this->collDestinosComisionadoss = DestinosComisionadosPeer::doSelectJoinTransportes($criteria, $con);
			}
		} else {
									
			$criteria->add(DestinosComisionadosPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastDestinosComisionadosCriteria) || !$this->lastDestinosComisionadosCriteria->equals($criteria)) {
				$this->collDestinosComisionadoss = DestinosComisionadosPeer::doSelectJoinTransportes($criteria, $con);
			}
		}
		$this->lastDestinosComisionadosCriteria = $criteria;

		return $this->collDestinosComisionadoss;
	}


	
	public function getDestinosComisionadossJoinComisiones($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collDestinosComisionadoss === null) {
			if ($this->isNew()) {
				$this->collDestinosComisionadoss = array();
			} else {

				$criteria->add(DestinosComisionadosPeer::NITOCC, $this->getNitocc());

				$this->collDestinosComisionadoss = DestinosComisionadosPeer::doSelectJoinComisiones($criteria, $con);
			}
		} else {
									
			$criteria->add(DestinosComisionadosPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastDestinosComisionadosCriteria) || !$this->lastDestinosComisionadosCriteria->equals($criteria)) {
				$this->collDestinosComisionadoss = DestinosComisionadosPeer::doSelectJoinComisiones($criteria, $con);
			}
		}
		$this->lastDestinosComisionadosCriteria = $criteria;

		return $this->collDestinosComisionadoss;
	}

	
	public function initComisionadosPlantas()
	{
		if ($this->collComisionadosPlantas === null) {
			$this->collComisionadosPlantas = array();
		}
	}

	
	public function getComisionadosPlantas($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosPlantas === null) {
			if ($this->isNew()) {
			   $this->collComisionadosPlantas = array();
			} else {

				$criteria->add(ComisionadosPlantaPeer::NITOCC, $this->getNitocc());

				ComisionadosPlantaPeer::addSelectColumns($criteria);
				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ComisionadosPlantaPeer::NITOCC, $this->getNitocc());

				ComisionadosPlantaPeer::addSelectColumns($criteria);
				if (!isset($this->lastComisionadosPlantaCriteria) || !$this->lastComisionadosPlantaCriteria->equals($criteria)) {
					$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastComisionadosPlantaCriteria = $criteria;
		return $this->collComisionadosPlantas;
	}

	
	public function countComisionadosPlantas($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ComisionadosPlantaPeer::NITOCC, $this->getNitocc());

		return ComisionadosPlantaPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addComisionadosPlanta(ComisionadosPlanta $l)
	{
		$this->collComisionadosPlantas[] = $l;
		$l->setTerceros($this);
	}


	
	public function getComisionadosPlantasJoinTransportes($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosPlantas === null) {
			if ($this->isNew()) {
				$this->collComisionadosPlantas = array();
			} else {

				$criteria->add(ComisionadosPlantaPeer::NITOCC, $this->getNitocc());

				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinTransportes($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosPlantaPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastComisionadosPlantaCriteria) || !$this->lastComisionadosPlantaCriteria->equals($criteria)) {
				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinTransportes($criteria, $con);
			}
		}
		$this->lastComisionadosPlantaCriteria = $criteria;

		return $this->collComisionadosPlantas;
	}


	
	public function getComisionadosPlantasJoinRegionales($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosPlantas === null) {
			if ($this->isNew()) {
				$this->collComisionadosPlantas = array();
			} else {

				$criteria->add(ComisionadosPlantaPeer::NITOCC, $this->getNitocc());

				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinRegionales($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosPlantaPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastComisionadosPlantaCriteria) || !$this->lastComisionadosPlantaCriteria->equals($criteria)) {
				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinRegionales($criteria, $con);
			}
		}
		$this->lastComisionadosPlantaCriteria = $criteria;

		return $this->collComisionadosPlantas;
	}


	
	public function getComisionadosPlantasJoinComisiones($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosPlantas === null) {
			if ($this->isNew()) {
				$this->collComisionadosPlantas = array();
			} else {

				$criteria->add(ComisionadosPlantaPeer::NITOCC, $this->getNitocc());

				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinComisiones($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosPlantaPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastComisionadosPlantaCriteria) || !$this->lastComisionadosPlantaCriteria->equals($criteria)) {
				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinComisiones($criteria, $con);
			}
		}
		$this->lastComisionadosPlantaCriteria = $criteria;

		return $this->collComisionadosPlantas;
	}

	
	public function initTarifasDestinos()
	{
		if ($this->collTarifasDestinos === null) {
			$this->collTarifasDestinos = array();
		}
	}

	
	public function getTarifasDestinos($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collTarifasDestinos === null) {
			if ($this->isNew()) {
			   $this->collTarifasDestinos = array();
			} else {

				$criteria->add(TarifasDestinoPeer::NITOCC, $this->getNitocc());

				TarifasDestinoPeer::addSelectColumns($criteria);
				$this->collTarifasDestinos = TarifasDestinoPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(TarifasDestinoPeer::NITOCC, $this->getNitocc());

				TarifasDestinoPeer::addSelectColumns($criteria);
				if (!isset($this->lastTarifasDestinoCriteria) || !$this->lastTarifasDestinoCriteria->equals($criteria)) {
					$this->collTarifasDestinos = TarifasDestinoPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastTarifasDestinoCriteria = $criteria;
		return $this->collTarifasDestinos;
	}

	
	public function countTarifasDestinos($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(TarifasDestinoPeer::NITOCC, $this->getNitocc());

		return TarifasDestinoPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addTarifasDestino(TarifasDestino $l)
	{
		$this->collTarifasDestinos[] = $l;
		$l->setTerceros($this);
	}


	
	public function getTarifasDestinosJoinTarifasTaxis($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collTarifasDestinos === null) {
			if ($this->isNew()) {
				$this->collTarifasDestinos = array();
			} else {

				$criteria->add(TarifasDestinoPeer::NITOCC, $this->getNitocc());

				$this->collTarifasDestinos = TarifasDestinoPeer::doSelectJoinTarifasTaxis($criteria, $con);
			}
		} else {
									
			$criteria->add(TarifasDestinoPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastTarifasDestinoCriteria) || !$this->lastTarifasDestinoCriteria->equals($criteria)) {
				$this->collTarifasDestinos = TarifasDestinoPeer::doSelectJoinTarifasTaxis($criteria, $con);
			}
		}
		$this->lastTarifasDestinoCriteria = $criteria;

		return $this->collTarifasDestinos;
	}


	
	public function getTarifasDestinosJoinComisiones($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collTarifasDestinos === null) {
			if ($this->isNew()) {
				$this->collTarifasDestinos = array();
			} else {

				$criteria->add(TarifasDestinoPeer::NITOCC, $this->getNitocc());

				$this->collTarifasDestinos = TarifasDestinoPeer::doSelectJoinComisiones($criteria, $con);
			}
		} else {
									
			$criteria->add(TarifasDestinoPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastTarifasDestinoCriteria) || !$this->lastTarifasDestinoCriteria->equals($criteria)) {
				$this->collTarifasDestinos = TarifasDestinoPeer::doSelectJoinComisiones($criteria, $con);
			}
		}
		$this->lastTarifasDestinoCriteria = $criteria;

		return $this->collTarifasDestinos;
	}

	
	public function initComisionadosContratos()
	{
		if ($this->collComisionadosContratos === null) {
			$this->collComisionadosContratos = array();
		}
	}

	
	public function getComisionadosContratos($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosContratos === null) {
			if ($this->isNew()) {
			   $this->collComisionadosContratos = array();
			} else {

				$criteria->add(ComisionadosContratoPeer::NITOCC, $this->getNitocc());

				ComisionadosContratoPeer::addSelectColumns($criteria);
				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ComisionadosContratoPeer::NITOCC, $this->getNitocc());

				ComisionadosContratoPeer::addSelectColumns($criteria);
				if (!isset($this->lastComisionadosContratoCriteria) || !$this->lastComisionadosContratoCriteria->equals($criteria)) {
					$this->collComisionadosContratos = ComisionadosContratoPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastComisionadosContratoCriteria = $criteria;
		return $this->collComisionadosContratos;
	}

	
	public function countComisionadosContratos($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ComisionadosContratoPeer::NITOCC, $this->getNitocc());

		return ComisionadosContratoPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addComisionadosContrato(ComisionadosContrato $l)
	{
		$this->collComisionadosContratos[] = $l;
		$l->setTerceros($this);
	}


	
	public function getComisionadosContratosJoinTransportes($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosContratos === null) {
			if ($this->isNew()) {
				$this->collComisionadosContratos = array();
			} else {

				$criteria->add(ComisionadosContratoPeer::NITOCC, $this->getNitocc());

				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinTransportes($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosContratoPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastComisionadosContratoCriteria) || !$this->lastComisionadosContratoCriteria->equals($criteria)) {
				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinTransportes($criteria, $con);
			}
		}
		$this->lastComisionadosContratoCriteria = $criteria;

		return $this->collComisionadosContratos;
	}


	
	public function getComisionadosContratosJoinRegionales($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosContratos === null) {
			if ($this->isNew()) {
				$this->collComisionadosContratos = array();
			} else {

				$criteria->add(ComisionadosContratoPeer::NITOCC, $this->getNitocc());

				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinRegionales($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosContratoPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastComisionadosContratoCriteria) || !$this->lastComisionadosContratoCriteria->equals($criteria)) {
				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinRegionales($criteria, $con);
			}
		}
		$this->lastComisionadosContratoCriteria = $criteria;

		return $this->collComisionadosContratos;
	}


	
	public function getComisionadosContratosJoinComisiones($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosContratos === null) {
			if ($this->isNew()) {
				$this->collComisionadosContratos = array();
			} else {

				$criteria->add(ComisionadosContratoPeer::NITOCC, $this->getNitocc());

				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinComisiones($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosContratoPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastComisionadosContratoCriteria) || !$this->lastComisionadosContratoCriteria->equals($criteria)) {
				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinComisiones($criteria, $con);
			}
		}
		$this->lastComisionadosContratoCriteria = $criteria;

		return $this->collComisionadosContratos;
	}

	
	public function initComisionadosObjss()
	{
		if ($this->collComisionadosObjss === null) {
			$this->collComisionadosObjss = array();
		}
	}

	
	public function getComisionadosObjss($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosObjss === null) {
			if ($this->isNew()) {
			   $this->collComisionadosObjss = array();
			} else {

				$criteria->add(ComisionadosObjsPeer::NITOCC, $this->getNitocc());

				ComisionadosObjsPeer::addSelectColumns($criteria);
				$this->collComisionadosObjss = ComisionadosObjsPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ComisionadosObjsPeer::NITOCC, $this->getNitocc());

				ComisionadosObjsPeer::addSelectColumns($criteria);
				if (!isset($this->lastComisionadosObjsCriteria) || !$this->lastComisionadosObjsCriteria->equals($criteria)) {
					$this->collComisionadosObjss = ComisionadosObjsPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastComisionadosObjsCriteria = $criteria;
		return $this->collComisionadosObjss;
	}

	
	public function countComisionadosObjss($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ComisionadosObjsPeer::NITOCC, $this->getNitocc());

		return ComisionadosObjsPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addComisionadosObjs(ComisionadosObjs $l)
	{
		$this->collComisionadosObjss[] = $l;
		$l->setTerceros($this);
	}


	
	public function getComisionadosObjssJoinObjetosGasto($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosObjss === null) {
			if ($this->isNew()) {
				$this->collComisionadosObjss = array();
			} else {

				$criteria->add(ComisionadosObjsPeer::NITOCC, $this->getNitocc());

				$this->collComisionadosObjss = ComisionadosObjsPeer::doSelectJoinObjetosGasto($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosObjsPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastComisionadosObjsCriteria) || !$this->lastComisionadosObjsCriteria->equals($criteria)) {
				$this->collComisionadosObjss = ComisionadosObjsPeer::doSelectJoinObjetosGasto($criteria, $con);
			}
		}
		$this->lastComisionadosObjsCriteria = $criteria;

		return $this->collComisionadosObjss;
	}


	
	public function getComisionadosObjssJoinComisiones($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collComisionadosObjss === null) {
			if ($this->isNew()) {
				$this->collComisionadosObjss = array();
			} else {

				$criteria->add(ComisionadosObjsPeer::NITOCC, $this->getNitocc());

				$this->collComisionadosObjss = ComisionadosObjsPeer::doSelectJoinComisiones($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosObjsPeer::NITOCC, $this->getNitocc());

			if (!isset($this->lastComisionadosObjsCriteria) || !$this->lastComisionadosObjsCriteria->equals($criteria)) {
				$this->collComisionadosObjss = ComisionadosObjsPeer::doSelectJoinComisiones($criteria, $con);
			}
		}
		$this->lastComisionadosObjsCriteria = $criteria;

		return $this->collComisionadosObjss;
	}

} 