1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
$select = new Zend_Db_Select($db);
$select->from(array('l' => 'df_ligne'), array('cot_c' => 'COUNT(COTATION)',
'cot_s' => 'SUM(COTATION)',
'tps_c' => 'COUNT(TEMPS)',
'tps_s' => 'SUM(TEMPS)',
'MISSION','REF_CATEGORIE'));
$select->join(array('d' => 'df_dossier'), 'd.ID = l.REF_DOSSIER', array());
if (isset($_POST['FormeJuridique'])) $select->where('d.FORME_JURIDIQUE = ?', quote($_POST['FormeJuridique']));
if (isset($_POST['CodeApe'])) $select->where('d.CODE_APE = ?',quote($_POST['CodeApe']));
if (isset($_POST['TenueComptable'])) $select->where('d.TENUE_COMPTABLE = ?',$_POST['TenueComptable']);
if (isset($_POST['Departement'])) $select->where('d.DEPARTEMENT = ?',$_POST['Departement']);
if (isset($_POST['NbLigneInfoMin'])) $select->where('d.NB_LIGNE_INFO >= ?',$_POST['NbLigneInfoMin']);
if (isset($_POST['NbLigneInfoMax'])) $select->where('d.NB_LIGNE_INFO <= ?',$_POST['NbLigneInfoMax']);
if (isset($_POST['EffectifMin'])) $select->where('d.EFFECTIF >= ?',$_POST['EffectifMin']);
if (isset($_POST['EffectifMax'])) $select->where('d.EFFECTIF <= ?',$_POST['EffectifMax']);
$select->group(array('MISSION', 'REF_CATEGORIE')); |
Partager