Permanences légumes

L’AMAP Légumes Notre producteur partenaire Les distributions  Actualités

[insert_php]
global $wpdb;
$wpdb->show_errors();
$Amap=3;
$Nbl=23;
$sql = “SELECT * FROM distributions,contrats , amap where distributions.Amap_id = amap.Amap_Id and distributions.contrat_id = contrats.contrat_id and distributions.Amap_Id =”;
$sql = $sql .$Amap. ” and contrats.CONTRAT_DFIN > SYSDATE() ORDER BY `distributions`.`DISTRIB_DATE` ASC LIMIT “.$Nbl;
$Distrib_pains= $wpdb->get_results($sql);
$Amap=2;
$Nbl=23;
$PermMax=1;
$sql = “SELECT * FROM distributions,contrats , amap where distributions.Amap_id = amap.Amap_Id and distributions.contrat_id = contrats.contrat_id and distributions.Amap_Id =”;
$sql = $sql . $Amap .” and contrats.CONTRAT_DFIN > SYSDATE() ORDER BY `distributions`.`DISTRIB_DATE` ASC LIMIT “.$Nbl;
$Distrib_oeufs = $wpdb->get_results($sql);
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
foreach ($Distrib_pains as $DTab)
{
$pain=”Oui”;
$sql = “SELECT count(*) as ‘verif’ FROM distributions where distributions.Amap_id = 2 and distributions.DISTRIB_DATE = ‘”.$DTab->DISTRIB_DATE.”‘”;
$Coeufs = $wpdb->get_row($sql);
if ($Coeufs->verif==1)
{$oeuf=”Oui”;}
else
{$oeuf=”Non”;}
$date = new DateTime($DTab->DISTRIB_DATE);
$PDate=$date->format(‘d/m/Y’);
$PClass=”TD_PermOK”;
echo ‘<tr

CONTRAT_REF.'” amap=”PERMA_’.$DTab->AMAP_ID.'” height=”18″>

‘;
echo ‘

‘;
echo ‘

‘;
$sql = “SELECT * FROM permanences , adherents where permanences.AMAP_ID = 3
and permanences.ADHERENT_ID = adherents.ADHERENT_ID and permanences.PERM_DATE = ‘”.$DTab->DISTRIB_DATE.”‘
and permanences.PERM_ANNUL ‘OUI’ ORDER BY permanences.PERM_ID ASC LIMIT 1″;
$Perm = $wpdb->get_row($sql);
if ( $Perm == FALSE )
{echo ‘

‘;}
else
{echo ‘

‘;}
echo ‘

‘;
}
[/insert_php]

Date Pains Oeufs Nom
‘.$PDate.’ ‘.$pain.’ ‘.$oeuf.’ ? ‘.$Perm->ADHERENT_PRENOM.’ ‘.$Perm->ADHERENT_NOM.’