public function getBeneficiariesShareForAccount(ClientAccount $account, $type)
 {
     $dql = "SELECT SUM(b.share) as percent\n                FROM WealthbotClientBundle:Beneficiary b\n                WHERE b.account_id = :account_id AND b.type = :type GROUP BY b.account_id";
     $query = $this->getEntityManager()->createQuery($dql);
     $query->setMaxResults(1)->setParameters(array('account_id' => $account->getId(), 'type' => $type));
     $result = $query->getOneOrNullResult(2);
     return round($result['percent'], 2);
 }
示例#2
0
 /**
  * Get id
  *
  * @return integer 
  */
 public function getId()
 {
     return parent::getId();
 }
示例#3
0
 /**
  * Find account application workflow
  *
  * @param ClientAccount $account
  * @return Workflow|null
  */
 public function findAccountApplicationWorkflow(ClientAccount $account)
 {
     $messageCodes = array(Workflow::MESSAGE_CODE_PAPERWORK_NEW_ACCOUNT, Workflow::MESSAGE_CODE_PAPERWORK_TRANSFER, Workflow::MESSAGE_CODE_PAPERWORK_ROLLOVER);
     $qb = $this->createQueryBuilder('w');
     $qb->where('w.client = :client')->andWhere('w.object_id = :account_id')->andWhere($qb->expr()->in('w.message_code', $messageCodes))->setMaxResults(1)->setParameters(array('client' => $account->getClient(), 'account_id' => $account->getId()));
     return $qb->getQuery()->getOneOrNullResult();
 }
 /**
  * Returns true if transfer account cannot use electronically signing
  * and ria does not allow non electronically signing
  *
  * @param ClientAccount $account
  * @return bool
  */
 public function hasElectronicallySignError(ClientAccount $account)
 {
     if ($account->hasGroup(AccountGroup::GROUP_FINANCIAL_INSTITUTION) && !$this->isUsedDocusign($account->getId())) {
         $ria = $account->getClient()->getRia();
         $riaCompanyInfo = $ria->getRiaCompanyInformation();
         if ($riaCompanyInfo && !$riaCompanyInfo->getAllowNonElectronicallySigning()) {
             return true;
         }
     }
     return false;
 }
 /**
  * Is account owner sign all document signatures for application
  *
  * @param AccountOwnerInterface $accountOwner
  * @param ClientAccount $account
  * @return bool
  */
 public function isOwnerSignApplication(AccountOwnerInterface $accountOwner, ClientAccount $account)
 {
     $signatures = $this->findSignaturesByAccountConsolidatorId($account->getId());
     foreach ($signatures as $signature) {
         if (!$this->isOwnerSignatureCompleted($accountOwner, $signature)) {
             return false;
         }
     }
     return true;
 }
 /**
  * Update account and account owners signatures
  *
  * @param ClientAccount $account
  * @param string $type
  * @return \Wealthbot\SignatureBundle\Entity\DocumentSignature
  */
 public function updateAccountSignatureStatusByAccountAndType(ClientAccount $account, $type)
 {
     $signature = $this->signatureManager->findActiveDocumentSignatureBySourceIdAndType($account->getId(), $type);
     if ($signature) {
         $this->updateDocumentSignaturesStatusByEnvelopeId($signature->getDocusignEnvelopeId(), array($signature));
     }
     return $signature;
 }