<?php

namespace Modules\Additional\Specifique\Client28\Modules\Panier\Repository;

use Helpers\QueryBuilder\AbsRepository;

//use Helpers\Filter\FilterTable;

class Panier extends AbsRepository
{
    /**
     * @return array<mixed>
     */
    public function getListFrsForArtFMExtPanel(string $listeFrs = '')
    {

        if (!$listeFrs) {
            $listeFrs = "''";
        }

        $req = "
            SELECT distinct FOU.CODE COD_FOURN, FOU.RS RS_FOURN, FOU.ENSCOMM EC_FOURN, FOU.VILLE VILLE_FOURN
            FROM FOURNISS FOU WITH(NOLOCK)
            left outer join FOURNCTR FCTR WITH(NOLOCK) ON FCTR.CODE_FOUR = FOU.CODE
            WHERE
            FCTR.CODE_CTR = :centre AND FCTR.ASSOCIE = 0x54
            AND FOU.DTEVALMIN <= :date1
            AND (FOU.DTEVALMAX >= :date2 OR FOU.DTEVALMAX = '00000000') 
            AND FOU.AUTOCC = 0x54 AND FOU.MTMAXCC>0
            AND FOU.CODE NOT IN (".$listeFrs.")
            order by FOU.CODE 
        ";

        $arrayReq = [
            ':centre' => $_SESSION['Session_CodeCtrEmetteur'],
            ':date1' => date('Ymd'),
            ':date2' => date('Ymd'),
        ];

        return $this->fetchAssocAll($req, $arrayReq);
    }
}
