/** * @param ClientAccount $account * @param float $fee * @param int $year * @param int $quarter * @return float|int */ public function calculateBillSumByPeriod(ClientAccount $account, $fee, $year, $quarter) { $period = $this->feeManager->getPeriod($year, $quarter); $systemAccount = $account->getSystemAccount(); $accountValues = $this->em->getRepository('WealthbotClientBundle:ClientAccountValue')->getAverageAccountValues($account, $period['startDate'], $period['endDate']); $dayInPeriod = $period['endDate']->diff($period['startDate'])->format('%a'); return $this->feeManager->calculateFeeBilled($fee, $accountValues['count_values'], $dayInPeriod); }
public function testFeeBilled() { $feeManager = new FeeManager($this->getMockEntityManager(), $this->getUserManagerMock(), $this->getMockCashCalculationManager(), $this->getMockPeriodManager(), $this->getMockBillingSpecManager()); $fees = $this->returnFees(); $fee = $feeManager->calculateFee(600000, $fees); $c = $feeManager->calculateFeeBilled($fee, 30, 45); $this->assertEquals(11000.0, $c, "Invalid calculated fee billed (FeeManager::calculateFeeBilled): {$c}"); }