Browse Source

Export par véhicules

feature/export_comptable
Fab 4 years ago
parent
commit
3b3f61579a
2 changed files with 22 additions and 0 deletions
  1. +19
    -0
      ShopBundle/Repository/OrderShopRepository.php
  2. +3
    -0
      ShopBundle/Services/CsvGenerator.php

+ 19
- 0
ShopBundle/Repository/OrderShopRepository.php View File

$query->select('count(e.id)'); $query->select('count(e.id)');
} }


if (isset($params['select'])) {
$query->select( $params['select']);
}

if (isset($params['dateStart']) || isset($params['dateEnd'])) { if (isset($params['dateStart']) || isset($params['dateEnd'])) {
$params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate'; $params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate';
} }
$query->andWhere('e.deliveryAddress = :address OR e.invoiceAddress = :address')->setParameter('address', $params['address']); $query->andWhere('e.deliveryAddress = :address OR e.invoiceAddress = :address')->setParameter('address', $params['address']);
} }


if(isset($params['weekDeliveryTruck'])) {
$query->andWhere('e.weekDeliveryTruck = :weekDeliveryTruck')->setParameter('weekDeliveryTruck', $params['weekDeliveryTruck']);
}

if(isset($params['deliveryDate'])) {
$query->andWhere('e.deliveryDate >= :deliveryDateStart');
$query->andWhere('e.deliveryDate < :deliveryDateEnd');
$query->setParameter('deliveryDateStart', $params['deliveryDate']->format('Y-m-d 00:00:00'));
$query->setParameter('deliveryDateEnd', $params['deliveryDate']->modify('+1 day')->format('Y-m-d 00:00:00'));
}

if (isset($params['mergeComplementaryOrderShops'])) { if (isset($params['mergeComplementaryOrderShops'])) {
$query->andWhere('e.mainOrderShop IS NULL'); $query->andWhere('e.mainOrderShop IS NULL');
$query->leftJoin('e.complementaryOrderShops', 'complementaryOrderShops'); $query->leftJoin('e.complementaryOrderShops', 'complementaryOrderShops');
} }




if (isset($params['groupBy'])) {
$query->groupBy( $params['groupBy']);
}

if (isset($params['count']) && $params['count']) { if (isset($params['count']) && $params['count']) {
return $query->getQuery()->getSingleScalarResult(); return $query->getQuery()->getSingleScalarResult();
} else { } else {

+ 3
- 0
ShopBundle/Services/CsvGenerator.php View File










} }

Loading…
Cancel
Save