<?php
namespace App\Controller;
use App\Entity\Eirsaliye;
use App\Repository\EirsaliyeRepository;
use Doctrine\Common\Collections\Criteria;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/eirsaliye", name="eirsaliye-")
*/
class EirsaliyeController extends AbstractFoodsoftController
{
/**
* @Route("/", name="index")
*/
public function index(Request $request): Response
{
$this->checkDisabled($request);
$config = $this->getParameter('foodsoft');
$criteria = Criteria::create();
$criteria->where($criteria->expr()->eq('IrsTuru', 'SATIŞ İRSALİYESİ'));
$criteria->andWhere($criteria->expr()->eq('CariKodu', $this->getUser()->getCari()->getAktifFirma()));
$criteria->andWhere($criteria->expr()->gte('Tarih', new \DateTime(date('Y-m-d',
time() - $config['eirsaliye']['eirsaliye_limit'] * 24 * 3600))));
$criteria->orderBy(['SevkTarih' => 'DESC']);
/** @var EirsaliyeRepository $rep */
$rep = $this->getdoctrine()->getmanager()->getrepository(Eirsaliye::class);
$liste = $rep->matching($criteria);
// $rep->setConfig($config);
// $liste = $rep->findBy([
// 'IrsTuru' => 'SATIŞ İRSALİYESİ',
// 'CariKodu' => $this->getUser()->getCari()->getFirmaKodu(),
// //-'TARIH' => date('Y-m-d', time()-$this->cfg['eirsaliye_limit']*24*3600)
// 'Tarih' => new \DateTime(date('Y-m-d', time()-30*24*3600))
// ],
// ['Tarih' => 'DESC']);
return $this->render('eirsaliye/index.html.twig', [
'liste' => $liste,
'eirsaliye_url' => $config['eirsaliye']['eirsaliye_url'],
]);
}
}