Пример #1
0
 protected function isShowAccountType(RiaCompanyInformation $riaCompanyInfo)
 {
     if ($riaCompanyInfo->getAccountManaged() == 1 && !$riaCompanyInfo->getIsAllowRetirementPlan()) {
         return false;
     }
     return true;
 }
 /**
  * Get advisor code
  *
  * @param RiaCompanyInformation $companyInformation
  * @return string
  */
 protected function getAdvisorCode(RiaCompanyInformation $companyInformation = null)
 {
     $code = '';
     if (null !== $companyInformation) {
         /** @var AdvisorCode $advisorCode */
         foreach ($companyInformation->getAdvisorCodes() as $advisorCode) {
             if ($advisorCode->getCustodian() == $companyInformation->getCustodian()) {
                 $code = $advisorCode->getName();
                 break;
             }
         }
     }
     return $code;
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     /** @var \Wealthbot\RiaBundle\Entity\RiaCompanyInformation $info */
     $info = $this->user->getRiaCompanyInformation();
     if ($info) {
         $name = $info->getName() ? $info->getName() : $this->user->getProfile()->getCompany();
         $primaryFirstName = $info->getPrimaryFirstName() ? $info->getPrimaryFirstName() : $this->user->getProfile()->getFirstName();
         $primaryLastName = $info->getPrimaryLastName() ? $info->getPrimaryLastName() : $this->user->getProfile()->getLastName();
         $contactEmail = $info->getContactEmail() ? $info->getContactEmail() : $this->user->getEmail();
     } else {
         $name = $this->user->getProfile()->getCompany();
         $primaryFirstName = $this->user->getProfile()->getFirstName();
         $primaryLastName = $this->user->getProfile()->getLastName();
         $contactEmail = $this->user->getEmail();
     }
     $builder->add('name', 'text', array('data' => $name, 'required' => false))->add('slug', 'text', array('required' => true))->add('primary_first_name', 'text', array('data' => $primaryFirstName, 'required' => false))->add('primary_last_name', 'text', array('data' => $primaryLastName, 'required' => false))->add('website', 'url', array('required' => false))->add('address', 'text', array('required' => false))->add('office', 'text', array('required' => false))->add('city', 'text', array('required' => false))->add('state', 'entity', array('class' => 'WealthbotAdminBundle:State', 'label' => 'State', 'empty_value' => 'Select a State', 'required' => false))->add('zipcode', 'text', array('required' => false))->add('phone_number', 'text', array('required' => false))->add('fax_number', 'text', array('required' => false))->add('contact_email', 'email', array('data' => $contactEmail, 'required' => false));
     //Other information
     $builder->add('min_asset_size', 'number', array('precision' => 2, 'grouping' => true, 'required' => false))->add('logo_file', 'file', array('required' => false));
     //Proposal processing
     $builder->add('portfolio_processing', 'choice', array('choices' => RiaCompanyInformation::getPortfolioProcessingChoices(), 'disabled' => true, 'required' => true, 'expanded' => true));
     $this->addValidator($builder);
     if (!$this->isPreSave) {
         $this->addOnBindValidator($builder);
     }
 }
Пример #4
0
 /**
  * Get Trade Data for generate file
  *
  * @param RiaCompanyInformation $riaCompanyInformation
  * @param array $clientValuesIds
  * @return TradeData[]
  */
 public function getTradeDataCollection(RiaCompanyInformation $riaCompanyInformation, array $clientValuesIds)
 {
     if ($riaCompanyInformation->isHouseholdManagedLevel()) {
         $tradeDataArray = $this->repository->findTradeDataArrayForClientPortfolioValuesIds($clientValuesIds);
     } else {
         $tradeDataArray = $this->repository->findTradeDataArrayForClientAccountValuesIds($clientValuesIds);
     }
     $tradeDataCollection = array();
     foreach ($tradeDataArray as $data) {
         $tradeData = new TradeData();
         $tradeData->loadFromArray($data);
         if (RebalancerQueue::STATUS_SELL === $tradeData->getAction()) {
             $vsps = $this->repository->findVSPForTradeData($tradeData);
             $tradeData->setVsps($vsps);
         }
         $tradeDataCollection[] = $tradeData;
     }
     return $tradeDataCollection;
 }
Пример #5
0
 public function setUp()
 {
     $questions = array();
     for ($i = 0; $i < 4; $i++) {
         $question = new RiskQuestion();
         $question->setTitle('Question ' . ($i + 1));
         for ($j = 0; $j < 4; $j++) {
             $answer = new RiskAnswer();
             $answer->setTitle('Answer ' . ($i + 1) . ' - ' . ($j + 1));
             $answer->setQuestion($question);
             $answer->setPoint($j);
             $question->addAnswer($answer);
         }
         $questions[] = $question;
     }
     $userAnswers = array();
     foreach ($questions as $key => $question) {
         $userAnswer = new ClientQuestionnaireAnswer();
         $userAnswer->setQuestion($question);
         $questionAnswers = $question->getAnswers();
         $userAnswer->setAnswer($questionAnswers[$key]);
         $userAnswers[] = $userAnswer;
     }
     $portfolio = new CeModel();
     for ($i = 0; $i < 4; $i++) {
         $modelMock = $this->getMock('Wealthbot\\AdminBundle\\Entity\\CeModel', array('getId'));
         $modelMock->expects($this->any())->method('getId')->will($this->returnValue($i + 1));
         $modelMock->setName('Model ' . ($i + 1));
         $modelMock->setRiskRating($i + 1);
         $portfolio->addChildren($modelMock);
     }
     $riaCompanyInformation = new RiaCompanyInformation();
     $riaCompanyInformation->setPortfolioModel($portfolio);
     $ria = new User();
     $ria->setRoles(array('ROLE_RIA'));
     $ria->setRiaCompanyInformation($riaCompanyInformation);
     $userProfile = new Profile();
     $userProfile->setRia($ria);
     $user = new User();
     $user->setRoles(array('ROLE_CLIENT'));
     $user->setProfile($userProfile);
     $this->riskTolerance = new RiskTolerance($user, $userAnswers);
 }
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     if ($confirmation) {
         $user->setEnabled(false);
         if (null === $user->getConfirmationToken()) {
             $user->setConfirmationToken($this->tokenGenerator->generateToken());
         }
         $this->mailer->sendConfirmationEmailMessage($user);
     } else {
         $user->setEnabled(true);
     }
     $user->setRoles(array('ROLE_RIA'));
     $riaCompanyInformation = new RiaCompanyInformation();
     $riaCompanyInformation->setName($user->getProfile()->getCompany());
     $riaCompanyInformation->setRia($user);
     $user->setRiaCompanyInformation($riaCompanyInformation);
     $this->userManager->updateUser($user);
     if ($riaCompanyInformation->getRelationshipType() === RiaCompanyInformation::RELATIONSHIP_TYPE_LICENSE_FEE) {
         $this->feeManager->resetRiaFee($user);
     }
 }
Пример #7
0
 private function createRiaCompanyInformation(ObjectManager $manager, User $riaUser)
 {
     $riaCompanyInfo = new RiaCompanyInformation();
     $riaCompanyInfo->setRia($riaUser);
     $riaCompanyInfo->setAccountManaged(1);
     $riaCompanyInfo->setAddress('Ekvator');
     $riaCompanyInfo->setCity('Nsk');
     $riaCompanyInfo->setAdvCopy('none.pdf');
     $riaCompanyInfo->setClientsTaxBracket(0.12);
     $riaCompanyInfo->setContactEmail('contact_' . $riaUser->getEmail());
     $riaCompanyInfo->setIsAllowRetirementPlan(true);
     $riaCompanyInfo->setIsSearchableDb(true);
     $riaCompanyInfo->setIsShowClientExpectedAssetClass(true);
     $riaCompanyInfo->setMinAssetSize(10000);
     $riaCompanyInfo->setMinimumBillingFee(10);
     $riaCompanyInfo->setName('Wealthbot');
     $riaCompanyInfo->setOffice('408');
     $riaCompanyInfo->setState($this->getReference('state-Nevada'));
     $riaCompanyInfo->setPhoneNumber('3333333333');
     $riaCompanyInfo->setPortfolioModel(NULL);
     $riaCompanyInfo->setPrimaryFirstName('RiaFirst');
     $riaCompanyInfo->setPrimaryLastName('RiaLast');
     $riaCompanyInfo->setRebalancedFrequency(1);
     $riaCompanyInfo->setRebalancedMethod(1);
     $riaCompanyInfo->setRiskAdjustment(1);
     $riaCompanyInfo->setUseMunicipalBond(true);
     $riaCompanyInfo->setWebsite('leningrad.com');
     $riaCompanyInfo->setZipcode('12334');
     $riaCompanyInfo->setAllowNonElectronicallySigning(true);
     $riaCompanyInfo->setPortfolioModel($this->createRiaPortfolioModel($manager, $riaUser));
     $riaCompanyInfo->setPortfolioProcessing(RiaCompanyInformation::PORTFOLIO_PROCESSING_COLLABORATIVE);
     $riaCompanyInfo->setTaxLossHarvestingMinimumPercent(10);
     /** @var Custodian $custodian */
     $custodian = $this->getReference('custodian-td-ameritrade');
     $riaCompanyInfo->setCustodian($custodian);
     $manager->persist($riaCompanyInfo);
     return $riaCompanyInfo;
 }
Пример #8
0
 private function createRiaCompanyInformation(User $riaUser)
 {
     $riaCompanyInfo = new RiaCompanyInformation();
     $riaCompanyInfo->setRia($riaUser);
     $riaCompanyInfo->setState($this->getReference('state-New York'));
     $riaCompanyInfo->setName('Mortal Kombat Advisors');
     $riaCompanyInfo->setPrimaryFirstName('Lord');
     $riaCompanyInfo->setPrimaryLastName('Raiden');
     $riaCompanyInfo->setWebsite('http://www.wealthbot.io');
     $riaCompanyInfo->setAddress('1 Commercial St');
     $riaCompanyInfo->setOffice('Suite 555');
     $riaCompanyInfo->setCity('New York');
     $riaCompanyInfo->setZipcode('12334');
     $riaCompanyInfo->setPhoneNumber('5558588888');
     $riaCompanyInfo->setContactEmail('*****@*****.**');
     $riaCompanyInfo->setAccountManaged(3);
     $riaCompanyInfo->setIsAllowRetirementPlan(true);
     $riaCompanyInfo->setMinimumBillingFee(500);
     $riaCompanyInfo->setIsShowClientExpectedAssetClass(true);
     $riaCompanyInfo->setClientsTaxBracket(0.1);
     $riaCompanyInfo->setUseMunicipalBond(true);
     $riaCompanyInfo->setRebalancedMethod(1);
     $riaCompanyInfo->setRebalancedFrequency(4);
     $riaCompanyInfo->setIsSearchableDb(true);
     $riaCompanyInfo->setMinAssetSize(50000);
     $riaCompanyInfo->setActivated(true);
     $riaCompanyInfo->setTransactionAmount(200);
     $riaCompanyInfo->setIsTransactionFees(true);
     $riaCompanyInfo->setIsTransactionMinimums(true);
     $riaCompanyInfo->setIsTransactionRedemptionFees(true);
     $riaCompanyInfo->setIsTaxLossHarvesting(true);
     $riaCompanyInfo->setTaxLossHarvesting(50000);
     $riaCompanyInfo->setTaxLossHarvestingPercent(0.1);
     $riaCompanyInfo->setTaxLossHarvestingMinimum(100);
     $riaCompanyInfo->setTaxLossHarvestingMinimumPercent(0.1);
     $riaCompanyInfo->setIsUseQualifiedModels(false);
     $riaCompanyInfo->setPortfolioProcessing(RiaCompanyInformation::PORTFOLIO_PROCESSING_COLLABORATIVE);
     $riaCompanyInfo->setAllowNonElectronicallySigning(true);
     $riaCompanyInfo->setStopTlhValue(4.2);
     /** @var Custodian $custodian */
     $custodian = $this->getReference('custodian-td-ameritrade');
     $riaCompanyInfo->setCustodian($custodian);
     return $riaCompanyInfo;
 }
 protected function buildRetirementForm(FormBuilderInterface $builder, RiaCompanyInformation $riaCompanyInfo, User $client)
 {
     $clientPortfolios = $client->getClientPortfolios();
     if ($clientPortfolios->count() == 1) {
         if ($clientPortfolios[0]->isProposed()) {
             if ($riaCompanyInfo->isClientByClientManagedLevel()) {
                 $builder->add('client_account_managed', 'choice', array('choices' => Profile::$client_account_managed_choices, 'expanded' => false, 'constraints' => array(new NotBlank(array('message' => 'Choose a Asset Location.')))));
             } else {
                 $builder->add('client_account_managed', 'hidden', array('data' => $riaCompanyInfo->getAccountManaged()));
             }
         } else {
             $builder->add('client_account_managed', 'choice', array('choices' => Profile::$client_account_managed_choices, 'expanded' => false, 'constraints' => array(new NotBlank(array('message' => 'Choose a Asset Location.'))), 'attr' => array('disabled' => true)));
         }
     }
 }
 protected function addOnBindValidator(FormBuilderInterface $builder)
 {
     $em = $this->em;
     $ria = $this->user;
     $isModels = $this->isModels;
     $builder->addEventListener(FormEvents::BIND, function (FormEvent $event) use($em, $ria, $isModels) {
         /** @var $form */
         $form = $event->getForm();
         /** @var \Wealthbot\RiaBundle\Entity\RiaCompanyInformation $data */
         $data = $event->getData();
         /** @var $repo CeModelRepository */
         $repo = $em->getRepository('WealthbotAdminBundle:CeModel');
         /** @var $ceModelEntityRepo CeModelEntityRepository */
         $ceModelEntityRepo = $em->getRepository('WealthbotAdminBundle:CeModelEntity');
         if ($isModels) {
             $modelType = $form->get('model_type')->getData();
             if (!$modelType) {
                 $form->get('model_type')->addError(new FormError('Required.'));
             } else {
                 switch ($modelType) {
                     case CeModel::TYPE_STRATEGY:
                         $strategyParentModelId = $form->get('strategy_model')->getData();
                         if (!$strategyParentModelId) {
                             $form->get('strategy_model')->addError(new FormError('Please specify the model.'));
                         } else {
                             /** @var $strategyParentModel CeModel */
                             $strategyParentModel = $repo->find($strategyParentModelId);
                             if (!$strategyParentModel) {
                                 $form->get('strategy_model')->addError(new FormError('Model does not exist'));
                             }
                         }
                         break;
                     case CeModel::TYPE_CUSTOM:
                         break;
                     default:
                         $form->get('model_type')->addError(new FormError('Type does not exist.'));
                 }
             }
         }
         if ($form->has('portfolio_processing')) {
             $portfolioProcessing = $data->getPortfolioProcessing();
             if (is_null($portfolioProcessing) || !array_key_exists($portfolioProcessing, RiaCompanyInformation::getPortfolioProcessingChoices())) {
                 $form->get('portfolio_processing')->addError(new FormError('Invalid.'));
             }
         }
         if (!$data->getAccountManaged()) {
             $form->get('account_managed')->addError(new FormError('Required.'));
         } elseif ($data->isClientByClientManagedLevel() && $data->isStraightThroughProcessing()) {
             $form->get('account_managed')->addError(new FormError('Must be Account or Household level for Straight Through portfolio processing.'));
         }
         if (!$data->getRebalancedMethod()) {
             $form->get('rebalanced_method')->addError(new FormError('Required.'));
         }
         if (!$data->getRebalancedFrequency()) {
             $form->get('rebalanced_frequency')->addError(new FormError('Required.'));
         }
         if ($data->getUseMunicipalBond() && !$data->getClientsTaxBracket()) {
             $form->get('clients_tax_bracket')->addError(new FormError('Required.'));
         }
         //            if (!is_numeric($data->getIsShowClientExpectedAssetClass())) {
         //                $form->get('is_show_client_expected_asset_class')->addError(new FormError('Required.'));
         //            }
         if ($data->getIsTaxLossHarvesting() && !$data->getTaxLossHarvestingMinimumPercent()) {
             $form->get('tax_loss_harvesting_minimum_percent')->addError(new FormError('Required.'));
         }
         if (is_null($data->getIsAllowRetirementPlan())) {
             $form->get('is_allow_retirement_plan')->addError(new FormError('Required.'));
         }
         if (!$data->getUseMunicipalBond() && $ceModelEntityRepo->isMuniBondSecuritiesInRiaModels($ria->getId())) {
             $form->get('use_municipal_bond')->addError(new FormError('You have "municipal substitution" securities in model.'));
         }
         //            isTaxLossHarvestingSecuritiesInModels
         if (!$data->getIsTaxLossHarvesting() && $ceModelEntityRepo->isTaxLossHarvestingSecuritiesInModels($ria->getId())) {
             $form->get('is_tax_loss_harvesting')->addError(new FormError('You have "tax loss harvesting" securities in model.'));
         }
     });
 }
Пример #11
0
 /**
  * Returns login url string with subdomain
  *
  * @param RiaCompanyInformation $companyInformation
  * @param string $name
  * @param array $parameters
  * @return string
  */
 public function generateSubDomainUrl(RiaCompanyInformation $companyInformation, $name, $parameters = array())
 {
     $slug = $companyInformation->getSlug();
     $this->router->getContext()->setHost($slug . '.' . $this->getDomain());
     return $this->router->generate($name, $parameters, true);
 }