MRncs : getListeDepots
This commit is contained in:
parent
334d5230b1
commit
794fdd3ede
@ -499,36 +499,36 @@ class Metier_Partenaires_MRncs
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Liste des depots
|
||||
* @param string $siren
|
||||
* @param string $dateDepot AAAA-MM-JJ
|
||||
* @return array
|
||||
*/
|
||||
public function getListeDepots($siren, $dateDepot = null)
|
||||
{
|
||||
$where = "e.siren=$siren ORDER BY e.dateDepot DESC, e.codeInterne ASC";
|
||||
$sql = "SELECT e.siren, e.codeInterne, e.dateDepot, e.codeEven, l.libEven, e.flux, DATE(e.dateInsert) AS dateInsert
|
||||
FROM jo.rncs_even e LEFT JOIN jo.tabEvenRncs l ON e.codeEven=l.codeEven";
|
||||
$where = " e.siren=$siren ORDER BY e.dateDepot DESC, e.codeInterne ASC";
|
||||
if (null != $dateDepot) {
|
||||
$where = "e.siren=$siren AND e.dateDepot='$dateDepot'";
|
||||
$where = " e.siren=$siren AND e.dateDepot='$dateDepot'";
|
||||
}
|
||||
|
||||
$rep=$this->iDb->select(
|
||||
'jo.rncs_even e LEFT JOIN jo.tabEvenRncs l ON e.codeEven=l.codeEven',
|
||||
'e.siren, e.codeInterne, e.dateDepot, e.codeEven, l.libEven, e.flux, DATE(e.dateInsert) AS dateInsert',
|
||||
$where, false, MYSQL_ASSOC);
|
||||
|
||||
$tabDepots=array();
|
||||
if (count($rep)>0) {
|
||||
foreach ($rep as $iDepot=>$depot) {
|
||||
$sql.= " WHERE ".$where;
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$tabDepots = array();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$tabDepots[] = array(
|
||||
'codDepot' => $depot['codeEven'],
|
||||
'libDepot' => $depot['libEven'],
|
||||
'datDepot' => $depot['dateDepot'],
|
||||
'refDepot' => $depot['codeInterne'],
|
||||
'datRncs' => $depot['flux'],
|
||||
'datSed' => $depot['dateInsert'],
|
||||
'codDepot' => $result['codeEven'],
|
||||
'libDepot' => $result['libEven'],
|
||||
'datDepot' => $result['dateDepot'],
|
||||
'refDepot' => $result['codeInterne'],
|
||||
'datRncs' => $result['flux'],
|
||||
'datSed' => $result['dateInsert'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $tabDepots;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user