Tri des commandes selon l'année et le mois

This commit is contained in:
Michael RICOIS 2012-12-21 10:52:17 +00:00
parent afcd6f0b4d
commit 30c312b067
3 changed files with 58 additions and 3 deletions

View File

@ -124,6 +124,11 @@ class GestionController extends Zend_Controller_Action
{
$request = $this->getRequest();
$month = $request->getParam('month', date('m'));
$year = $request->getParam('year', date('Y'));
$this->view->assign('month', $month);
$this->view->assign('year', $year);
$commandesM = new Application_Model_EnrichissementIdentifiants();
$sql = $commandesM->select()->setIntegrityCheck(false)
@ -139,7 +144,8 @@ class GestionController extends Zend_Controller_Action
'ciblage_criteres.login',
))
->where('e.dateStart = ?', "0000-00-00 00:00:00")
->where('fichier = ""')
->where('fichier = ""')
->where("e.dateAdded LIKE '".$year."-".$month."%'")
->order('e.dateAdded DESC');
$this->view->commandes = $commandesM->fetchAll($sql)->toArray();
@ -151,7 +157,15 @@ class GestionController extends Zend_Controller_Action
*/
public function enrichissementsAction()
{
$commandesM = new Application_Model_EnrichissementIdentifiants();
$request = $this->getRequest();
$month = $request->getParam('month', date('m'));
$year = $request->getParam('year', date('Y'));
$this->view->assign('month', $month);
$this->view->assign('year', $year);
$commandesM = new Application_Model_EnrichissementIdentifiants();
$sql = $commandesM->select()->setIntegrityCheck(false)
->from('enrichissement_identifiants AS e', array(
'e.id',
@ -165,7 +179,8 @@ class GestionController extends Zend_Controller_Action
'ciblage_criteres.reference AS critereReference',
'ciblage_criteres.login',
))
->where('fichier != ""')
->where('fichier != ""')
->where("e.dateAdded LIKE '".$year."-".$month."%'")
->order('e.dateAdded DESC');
$this->view->commandes = $commandesM->fetchAll($sql)->toArray();

View File

@ -1,4 +1,25 @@
<?php
$YearBegin = 2012;
$Years = date('Y') - $YearsBegin;
?>
<div id="dashboard">
<div>
<form method="post" action="">
<select name="year">
<?php for ($i=0 ; $i<$Years ; $i++ ) {?>
<?php $select=''; if ($i==$this->year) $select = ' selected';?>
<option value="<?=$YearBegin+$i?>"<?=$slect?>><?=$YearBegin+$i?></option>
<?php }?>
</select>
<select name="month">
<?php for ( $i=1 ; $i<=12 ; $i++ ) {?>
<?php $select=''; if ($i==$this->month) $select = ' selected';?>
<option value="<?=$i?>"<?=$select?>><?=str_pad($i, 2, '0', STR_PAD_LEFT)?></option>
<?php }?>
</select>
<input type="submit" name="submit" value="Ok"/>
</form>
</div>
<h2>Liste des commandes</h2>
<div>
<table>

View File

@ -1,4 +1,23 @@
<?php
$YearBegin = 2012;
$Years = date('Y') - $YearsBegin;
?>
<div id="dashboard">
<form method="post" action="">
<select name="year">
<?php for ($i=0 ; $i<$Years ; $i++ ) {?>
<?php $select=''; if ($i==$this->year) $select = ' selected';?>
<option value="<?=$YearBegin+$i?>"<?=$slect?>><?=$YearBegin+$i?></option>
<?php }?>
</select>
<select name="month">
<?php for ( $i=1 ; $i<=12 ; $i++ ) {?>
<?php $select=''; if ($i==$this->month) $select = ' selected';?>
<option value="<?=$i?>"<?=$select?>><?=str_pad($i, 2, '0', STR_PAD_LEFT)?></option>
<?php }?>
</select>
<input type="submit" name="submit" value="Ok"/>
</form>
<h2>Liste des commandes</h2>
<div>
<table>