<?php

/**
 * Subclass for performing query and update operations on the 'OBJETOS_GASTO' table.
 *
 *
 *
 * @package lib.model
 */
class ObjetosGastoPeer extends BaseObjetosGastoPeer
{
  public static function getSumaObjeto($id_comision,$codobj,$vigencia)
  {
   
    $c = new Criteria();
    $c->add(ComisionadosObjsPeer::ID_COMISION, $id_comision);
    $c->add(ComisionadosObjsPeer::VIGENCIA, $vigencia);
    $c->add(ComisionadosObjsPeer::CODOBJ, $codobj);
    $c->add(ComisionadosObjsPeer::ESTADO, 1);
    $objs = ComisionadosObjsPeer::doSelect($c);
    $suma = 0;

    foreach ($objs as $obj):
      $suma += round($obj->getValor());
    
    endforeach;
   
    return $suma;
  }
}
