Bläddra i källkod

[Backend] Divers : findAllByDateStartEnd() dans CreditHistoryRepository + getDocumentInvoice() dans OrderShop

feature/export_comptable
Guillaume 4 år sedan
förälder
incheckning
669f8498f1
2 ändrade filer med 24 tillägg och 0 borttagningar
  1. +10
    -0
      ShopBundle/Model/OrderShop.php
  2. +14
    -0
      ShopBundle/Repository/CreditHistoryRepository.php

+ 10
- 0
ShopBundle/Model/OrderShop.php Visa fil

@@ -513,6 +513,16 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
return $this;
}

public function getDocumentInvoice(): Document
{
foreach($this->getDocuments() as $document) {
if($document->getType() == Document::TYPE_INVOICE) {
return $document ;
}
}

return false ;
}

/**
* @return Collection|Ticket[]

+ 14
- 0
ShopBundle/Repository/CreditHistoryRepository.php Visa fil

@@ -18,6 +18,20 @@ class CreditHistoryRepository extends BaseRepository implements DefaultRepositor
return CreditHistoryInterface::class;
}

public function findAllByDateStartEnd($merchant, $dateStart, $dateEnd)
{
return $this->createQueryBuilder('e')
->innerJoin('e.userMerchant', 'user_merchant')
->andWhere('user_merchant.merchant = :merchant')
->setParameter(':merchant', $merchant)
->andWhere('e.createdAt >= :dateStart')
->andWhere('e.createdAt <= :dateEnd')
->setParameter(':dateStart', $dateStart)
->setParameter(':dateEnd', $dateEnd)
->addOrderBy('e.createdAt', 'ASC')
->getQuery()->getResult();
}

public function findAllByUserMerchant($userMerchant)
{
return $this->createQueryBuilder('e')

Laddar…
Avbryt
Spara