<?php

namespace Modules\Additional\Specifique\Client89\Modules\Suivi\Repository;

use Helpers\QueryBuilder\AbsRepository;
use Helpers\Outil\Sql;

class SpecSuviDa
{
    public static function getJointureSepcifique(\PDO $pdo) : string
    {
        $sqlParam = Sql::dilispec($pdo, 'PARAMNGE', 'NCS_DA_ENTET_UO_SIGNATAIRE');
        $numCS = $sqlParam? $sqlParam:'-1';
        return " left join CS_DON CS_DON_89 with (nolock) on CS_DON_89.COD_TAB='DA_ENTET' and NUM_FIX='".$numCS."' and COD_ENR = right('000000000' + cast(DA_ENTET.NO_DA as varchar), 9) ";
    }

    public static function getClauseUOSpecifique(): string
    {
        return ' or ltrim(rtrim(CS_DON_89.VALEUR))  in (select CodeUO from LstUO) ';
    }
}
