public function onPreSetData(FormEvent $event)
 {
     $form = $event->getForm();
     if ($this->account->isRothIraType() || $this->account->isTraditionalIraType()) {
         $form->add($this->factory->createNamed('distribution_method', 'choice', null, array('choices' => Distribution::getDistributionMethodChoices(), 'expanded' => true, 'multiple' => false, 'required' => false)))->add($this->factory->createNamed('federal_withholding', 'choice', null, array('choices' => Distribution::getFederalWithholdingChoices(), 'expanded' => true, 'multiple' => false, 'required' => false)))->add($this->factory->createNamed('state_withholding', 'choice', null, array('choices' => Distribution::getStateWithholdingChoices(), 'expanded' => true, 'multiple' => false, 'required' => false)))->add($this->factory->createNamed('federal_withhold_percent', 'percent', null, array('required' => false)))->add($this->factory->createNamed('federal_withhold_money', 'number', null, array('precision' => 2, 'grouping' => true, 'required' => false)))->add($this->factory->createNamed('state_withhold_percent', 'percent', null, array('required' => false)))->add($this->factory->createNamed('state_withhold_money', 'number', null, array('precision' => 2, 'grouping' => true, 'required' => false)))->add($this->factory->createNamed('residenceState', 'entity', null, array('class' => 'WealthbotAdminBundle:State', 'label' => 'State', 'empty_value' => 'Select a State', 'required' => false)));
     }
 }
 /**
  * Build data for contribution form
  *
  * @param string $action
  * @param SystemAccount $account
  * @return AccountContribution|OneTimeContribution
  */
 private function buildFormData($action, SystemAccount $account)
 {
     $clientAccount = $account->getClientAccount();
     $existContribution = $account->getAccountContribution();
     switch ($action) {
         case 'one_time':
             $data = $this->buildOneTimeContributionData($clientAccount, $existContribution);
             break;
         case 'create':
             $data = $this->buildCreateContributionData($clientAccount, $existContribution);
             break;
         default:
             $data = $this->buildUpdateContributionData($existContribution);
             break;
     }
     return $data;
 }
Exemple #3
0
 private function createClientAccounts(ObjectManager $manager, User $clientUser)
 {
     $lastAccount = null;
     foreach ($this->accounts as $index => $item) {
         /** @var AccountGroupType $groupType */
         $groupType = $this->getReference('client-account-group-type-' . $item['group_key'] . '-' . $item['type_key']);
         $account = new ClientAccount();
         $account->setGroupType($groupType);
         $account->setClient($clientUser);
         $account->setFinancialInstitution($item['financial_institution']);
         $account->setValue($item['value']);
         $account->setMonthlyContributions($item['monthly_contributions']);
         $account->setMonthlyDistributions($item['monthly_distributions']);
         $account->setSasCash($item['sas_cash']);
         $accountOwner = new ClientAccountOwner();
         $accountOwner->setAccount($account);
         $accountOwner->setClient($clientUser);
         $accountOwner->setOwnerType(ClientAccountOwner::OWNER_TYPE_SELF);
         if (isset($item['consolidator_key']) && null !== $item['consolidator_key']) {
             /** @var ClientAccount $consolidator */
             $consolidator = $this->getReference('user-client-account-' . $item['consolidator_key']);
             $account->setConsolidator($consolidator);
         }
         if (isset($item['funds']) && $item['group_key'] === AccountGroup::GROUP_EMPLOYER_RETIREMENT) {
             foreach ($item['funds'] as $fundItem) {
                 //                    ToDo: CE-402: check that code is not needed more
                 //                    $outsideFund = $manager->getRepository('WealthbotAdminBundle:Security')->findOneBySymbol($fundItem['symbol']);
                 //                    if (!$outsideFund) {
                 //                        /** @var SecurityType $securityType */
                 //                        $securityType = $this->getReference('security-type-' . $fundItem['type']);
                 //
                 //                        $outsideFund = new Security();
                 //                        $outsideFund->setName($fundItem['name']);
                 //                        $outsideFund->setSymbol($fundItem['symbol']);
                 //                        $outsideFund->setSecurityType($securityType);
                 //                        $outsideFund->setExpenseRatio($fundItem['exp_ratio']);
                 //                    }
                 //                    $securityAssignment = new SecurityAssignment();
                 //                    $securityAssignment->setSecurity($outsideFund);
                 //                    $securityAssignment->setRia($clientUser->getRia());  Deprecated
                 //                    $securityAssignment->setIsPreferred(false);
                 //                    $accountOutsideFund = new AccountOutsideFund();
                 //                    $accountOutsideFund->setAccount($account);
                 //                    $accountOutsideFund->setSecurityAssignment($securityAssignment);
                 //                    $accountOutsideFund->setIsPreferred(false);
                 //                    $account->addAccountOutsideFund($accountOutsideFund);
                 //
                 //                    $manager->persist($accountOutsideFund);
             }
         }
         $manager->persist($account);
         $manager->persist($accountOwner);
         $this->addReference('user-client-account-' . ($index + 1), $account);
         if (!$account->isRetirementType()) {
             $lastAccount = $account;
         }
     }
     if ($lastAccount) {
         $systemAccount = new SystemAccount();
         $systemAccount->setClient($clientUser);
         $systemAccount->setClientAccount($lastAccount);
         $systemAccount->setAccountNumber('916985328');
         $systemAccount->setAccountDescription($lastAccount->getOwnersAsString() . ' ' . $lastAccount->getTypeName());
         $systemAccount->setType($lastAccount->getSystemType());
         $systemAccount->setSource(SystemAccount::SOURCE_SAMPLE);
         $clientUser->addSystemAccount($systemAccount);
         $this->addReference('system-account', $systemAccount);
         $manager->persist($systemAccount);
     }
 }
 private function createSystemAccount(array $data, ClientAccount $account)
 {
     $systemAccount = new SystemAccount();
     $systemAccount->setClientAccount($account);
     $systemAccount->setClient($account->getClient());
     $systemAccount->setAccountNumber($data['account_number']);
     $systemAccount->setAccountDescription($data['account_description']);
     $systemAccount->setType($data['type']);
     $systemAccount->setStatus($data['status']);
     if ($data['status'] === SystemAccount::STATUS_ACTIVE) {
         $systemAccount->setActivatedOn(new \DateTime());
     } elseif ($data['status'] === SystemAccount::STATUS_CLOSED) {
         $systemAccount->setClosed(new \DateTime());
     }
     $systemAccount->setSource(SystemAccount::SOURCE_SAMPLE);
     return $systemAccount;
 }
Exemple #5
0
 /**
  * Get client account object
  *
  * @return \Wealthbot\ClientBundle\Model\ClientAccount
  */
 public function getClientAccount()
 {
     return $this->systemClientAccount ? $this->systemClientAccount->getClientAccount() : null;
 }
 /**
  * @param SystemAccount $account
  * @return ClientAccountValue|null
  */
 public function getLatestValueBySystemAccount(SystemAccount $account)
 {
     return $this->repo->getLatestValueForSystemClientAccountId($account->getId());
 }
 public function __construct(FormFactoryInterface $factory, EntityManager $em, SystemAccount $systemAccount)
 {
     $this->systemAccount = $systemAccount;
     parent::__construct($factory, $em, $systemAccount->getClientAccount());
 }
 /**
  * @param array $accounts
  * @param $year
  * @param $quarter
  * @param $billItemStatus
  *
  * @return array
  */
 public function getAccountsInfo(array $accounts, $year, $quarter, $billItemStatus = null)
 {
     $data = array();
     $total = 0;
     $period = $this->periodManager->getPeriod($year, $quarter);
     foreach ($accounts as $account) {
         $billItem = $this->em->getRepository('WealthbotClientBundle:BillItem')->getByAccountAndPeriod($account, $year, $quarter);
         $feeBilled = $this->summaryInformationManager->getAccountFeeBilled($account, $year, $quarter);
         $item = array('name' => $account->getOwnerNames(), 'type' => SystemAccount::getTypeName($account->getSystemType()), 'number' => $this->summaryInformationManager->getAccountNumber($account), 'status' => $this->summaryInformationManager->getAccountStatus($account), 'averageAccountValue' => $this->summaryInformationManager->getAccountAverageValue($account, $period['startDate'], $period['endDate']), 'daysInPortfolio' => $this->summaryInformationManager->getAccountDaysInPortfolio($account, $period['startDate'], $period['endDate']), 'fee' => $feeBilled);
         if (!empty($billItemStatus)) {
             if ($billItem && $billItem->getStatus() == $billItemStatus) {
                 $data[] = $item;
             }
         } else {
             $data[] = $item;
         }
         $total += $feeBilled;
     }
     return array($data, $total);
 }
 public function getOneBySecurityAndAccount(Security $security, SystemAccount $systemAccount)
 {
     $qb = $this->createQueryBuilder('s')->leftJoin('s.subclass', 'sc')->where('sc.owner = :ria')->setParameter('ria', $systemAccount->getClient()->getRia())->andWhere('s.security = :security')->setParameter('security', $security);
     return $qb->getQuery()->getOneOrNullResult();
 }
 /**
  * Get client account object
  *
  * @return \Wealthbot\ClientBundle\Model\ClientAccount
  */
 public function getClientAccount()
 {
     return $this->systemAccount->getClientAccount();
 }
 public function __construct(EntityManager $em, SystemAccount $account, EventSubscriberInterface $subscriber = null)
 {
     parent::__construct($em, $account->getClientAccount(), $subscriber, false);
 }
 /**
  * Return new system account with client, client account, account number and account description
  *
  * @param ClientAccount $clientAccount
  * @return SystemAccount
  */
 private function createAccount(ClientAccount $clientAccount)
 {
     // If system account is exist then update it
     $systemAccount = $clientAccount->getSystemAccount();
     if (!$systemAccount) {
         $systemAccount = new SystemAccount();
     }
     $systemAccount->setClient($clientAccount->getClient());
     $systemAccount->setClientAccount($clientAccount);
     $systemAccount->setType($clientAccount->getSystemType());
     $systemAccount->setAccountNumber('CE-000-' . rand(100000000, 999999999));
     $systemAccount->setAccountDescription($clientAccount->getOwnersAsString() . ' ' . $clientAccount->getTypeName());
     return $systemAccount;
 }