コード例 #1
0
 public function getCashOnDate(User $user, \DateTime $date)
 {
     /** @var ClientAccount[] $accounts */
     $accounts = $user->getClientAccounts();
     $sum = 0;
     foreach ($accounts as $account) {
         $systemAccount = $account->getSystemAccount();
         if ($systemAccount) {
             $sum += $this->em->getRepository('WealthbotClientBundle:ClientAccountValue')->getFreeCashBeforeDate($systemAccount, $date);
         }
     }
     return $sum;
 }
コード例 #2
0
ファイル: LoadBillData.php プロジェクト: junjinZ/wealthbot
 public function createBill(User $user, $dateStr, ObjectManager $manager)
 {
     $date = new \DateTime($dateStr);
     $period = $this->periodManager->getPreviousQuarter($date);
     $accounts = $user->getClientAccounts();
     $bill = new Bill();
     $bill->setCreatedAt(new \DateTime($dateStr));
     $bill->setClient($user);
     $bill->setYear($period['year']);
     $bill->setQuarter($period['quarter']);
     $manager->persist($bill);
     foreach ($accounts as $account) {
         $systemAccount = $account->getSystemAccount();
         if ($systemAccount) {
             $billItem = new BillItem();
             $billItem->setSystemAccount($systemAccount);
             $billItem->setBill($bill);
             $billItem->setFeeBilled($this->feeManager->getRiaFee($account, $period['year'], $period['quarter']));
             $billItem->setCreatedAt(new \DateTime($dateStr));
             $manager->persist($billItem);
         }
     }
     $manager->flush();
 }