| @@ 157-169 (lines=13) @@ | ||
| 154 | * |
|
| 155 | * @return QueryBuilder |
|
| 156 | */ |
|
| 157 | protected function createLeadsCountQb(DateTime $start, DateTime $end) |
|
| 158 | { |
|
| 159 | $qb = $this->createQueryBuilder('l'); |
|
| 160 | ||
| 161 | $qb |
|
| 162 | ->select('COUNT(DISTINCT l.id)') |
|
| 163 | ->andWhere($qb->expr()->between('l.createdAt', ':start', ':end')) |
|
| 164 | ->innerJoin('l.opportunities', 'o') |
|
| 165 | ->setParameter('start', $start) |
|
| 166 | ->setParameter('end', $end); |
|
| 167 | ||
| 168 | return $qb; |
|
| 169 | } |
|
| 170 | } |
|
| 171 | ||
| @@ 304-315 (lines=12) @@ | ||
| 301 | * |
|
| 302 | * @return QueryBuilder |
|
| 303 | */ |
|
| 304 | public function createOpportunitiesCountQb(DateTime $start, DateTime $end) |
|
| 305 | { |
|
| 306 | $qb = $this->createQueryBuilder('o'); |
|
| 307 | ||
| 308 | $qb |
|
| 309 | ->select('COUNT(o.id)') |
|
| 310 | ->andWhere($qb->expr()->between('o.createdAt', ':start', ':end')) |
|
| 311 | ->setParameter('start', $start) |
|
| 312 | ->setParameter('end', $end); |
|
| 313 | ||
| 314 | return $qb; |
|
| 315 | } |
|
| 316 | ||
| 317 | /** |
|
| 318 | * @param AclHelper $aclHelper |
|
| @@ 376-387 (lines=12) @@ | ||
| 373 | * |
|
| 374 | * @return double |
|
| 375 | */ |
|
| 376 | public function getWeightedPipelineAmount(AclHelper $aclHelper, DateTime $start, DateTime $end) |
|
| 377 | { |
|
| 378 | $qb = $this->createQueryBuilder('o'); |
|
| 379 | ||
| 380 | $qb |
|
| 381 | ->select('SUM(o.budgetAmount * o.probability)') |
|
| 382 | ->andWhere($qb->expr()->between('o.createdAt', ':start', ':end')) |
|
| 383 | ->setParameter('start', $start) |
|
| 384 | ->setParameter('end', $end); |
|
| 385 | ||
| 386 | return $aclHelper->apply($qb)->getSingleScalarResult(); |
|
| 387 | } |
|
| 388 | ||
| 389 | /** |
|
| 390 | * @param AclHelper $aclHelper |
|