Ajout listing des commandes kbis, greffes
This commit is contained in:
parent
ced22937b0
commit
9149661921
@ -36,9 +36,210 @@ class DashboardController extends Zend_Controller_Action
|
||||
*/
|
||||
public function commandesAction()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$type = $request->getParam('type', '');
|
||||
|
||||
$user = new Utilisateur();
|
||||
|
||||
$typesCommande = array('kbis', 'greffes');
|
||||
|
||||
if (in_array($type, $typesCommande)){
|
||||
|
||||
require_once 'Scores/GestionCommandes.php';
|
||||
|
||||
switch($type){
|
||||
case 'kbis':
|
||||
$num = $request->getParam('num');
|
||||
$num = str_replace(' ', '', $num);
|
||||
$etat = $request->getParam('etat');
|
||||
$mode = $request->getParam('mode');
|
||||
$date = $request->getParam('date');
|
||||
|
||||
$modeSelect = array(
|
||||
'-' => array('value'=>'-', 'select'=>'', 'affichage'=>''),
|
||||
'G' => array('value'=>'G', 'select'=> '', 'affichage'=>'courrier infogreffe'),
|
||||
'C' => array('value'=>'C', 'select'=> '', 'affichage'=>'courrier S&D'),
|
||||
'E' => array('value'=>'E', 'select'=> '', 'affichage'=>'e-mail'),
|
||||
);
|
||||
$modeSelect[$mode]['select'] = ' selected';
|
||||
$gestionCommande = new GestionCommande();
|
||||
$status = $gestionCommande->listStatus();
|
||||
$etatSelect = array();
|
||||
$etatSelect[] = array('value'=>0, 'select'=>'', 'affichage'=>'');
|
||||
foreach($status as $item){
|
||||
$select = '';
|
||||
if ($item['id']==$etat){
|
||||
$select = ' selected';
|
||||
}
|
||||
$etatSelect[] = array('value'=>$item['id'], 'select'=>$select, 'affichage'=>$item['libStatut']);
|
||||
}
|
||||
|
||||
//Valeur pour la sélection des dates
|
||||
$dateSelect = array();
|
||||
$dateToday = date('m');
|
||||
$dateIntervalle = 12;
|
||||
if ($user->checkModeEdition()){
|
||||
$dateIntervalle = 24;
|
||||
}
|
||||
for($i=$dateToday-$dateIntervalle; $i<=$dateToday; $i++) {
|
||||
$dateTime = mktime(0, 0, 0, $i+1, 0, date('Y'));
|
||||
$selected = '';
|
||||
if ($date=='' && $i==$dateToday ){
|
||||
$selected = 'selected';
|
||||
}
|
||||
if ($date!='' && $dateTime==$date){
|
||||
$selected = 'selected';
|
||||
}
|
||||
$dateSelect[] = array(
|
||||
'value' => $dateTime,
|
||||
'select' => $selected,
|
||||
'affichage' => date('m/Y', $dateTime)
|
||||
);
|
||||
}
|
||||
$this->view->assign('dateSelect', $dateSelect);
|
||||
$this->view->assign('etatSelect', $etatSelect);
|
||||
$this->view->assign('modeSelect', $modeSelect);
|
||||
$this->view->assign('num', $num);
|
||||
|
||||
if (!empty($num)){
|
||||
if (preg_match('/[0-9]{9}/', $num)){
|
||||
$listCommandes = $gestionCommande->listCommandesKbisBySiren($num);
|
||||
} elseif(substr($num,0,1)=='K'){
|
||||
$listCommandes = $gestionCommande->listCommandesKbisByNum($num);
|
||||
}
|
||||
} elseif (!empty($date)) {
|
||||
$listCommandes = $gestionCommande->listCommandesKbis($date, $etat, $mode);
|
||||
}
|
||||
|
||||
break; //Fin Gestion Kbis
|
||||
|
||||
case 'greffes':
|
||||
|
||||
$num = $request->getParam('num');
|
||||
$num = str_replace(' ', '', $num);
|
||||
$etat = $request->getParam('etat');
|
||||
$mode = $request->getParam('mode');
|
||||
$date = $request->getParam('date');
|
||||
$login = $request->getParam('login');
|
||||
|
||||
$modeSelect = array(
|
||||
'-' => array('value'=>'-', 'select'=>'', 'affichage'=>''),
|
||||
'G' => array('value'=>'G', 'select'=> '', 'affichage'=>'courrier infogreffe'),
|
||||
'C' => array('value'=>'C', 'select'=> '', 'affichage'=>'courrier S&D'),
|
||||
'E' => array('value'=>'E', 'select'=> '', 'affichage'=>'e-mail'),
|
||||
);
|
||||
$modeSelect[$mode]['select'] = ' selected';
|
||||
$gestionCommande = new GestionCommande();
|
||||
$status = $gestionCommande->listStatus();
|
||||
$etatSelect = array();
|
||||
$etatSelect[] = array('value'=>0, 'select'=>'', 'affichage'=>'');
|
||||
foreach($status as $item){
|
||||
$select = '';
|
||||
if ($item['id']==$etat){
|
||||
$select = ' selected';
|
||||
}
|
||||
$etatSelect[] = array('value'=>$item['id'], 'select'=>$select, 'affichage'=>$item['libStatut']);
|
||||
}
|
||||
|
||||
//Valeur pour la sélection des dates
|
||||
$dateSelect = array();
|
||||
$dateToday = date('m');
|
||||
$dateIntervalle = 12;
|
||||
if ($user->checkModeEdition()){
|
||||
$dateIntervalle = 24;
|
||||
}
|
||||
for($i=$dateToday-$dateIntervalle; $i<=$dateToday; $i++) {
|
||||
$dateTime = mktime(0, 0, 0, $i+1, 0, date('Y'));
|
||||
$selected = '';
|
||||
if ($date=='' && $i==$dateToday ){
|
||||
$selected = 'selected';
|
||||
}
|
||||
if ($date!='' && $dateTime==$date){
|
||||
$selected = 'selected';
|
||||
}
|
||||
$dateSelect[] = array(
|
||||
'value' => $dateTime,
|
||||
'select' => $selected,
|
||||
'affichage' => date('m/Y', $dateTime)
|
||||
);
|
||||
}
|
||||
$this->view->assign('dateSelect', $dateSelect);
|
||||
$this->view->assign('etatSelect', $etatSelect);
|
||||
$this->view->assign('modeSelect', $modeSelect);
|
||||
$this->view->assign('num', $num);
|
||||
$this->view->assign('login', $login);
|
||||
|
||||
if (!empty($num)){
|
||||
if (preg_match('/[0-9]{9}/', $num)){
|
||||
$listCommandes = $gestionCommande->listCommandesGreffeBySiren($num);
|
||||
} elseif(substr($num,0,1)=='G' || substr($num,0,1)=='C'){
|
||||
$listCommandes = $gestionCommande->listCommandesGreffeByNum($num);
|
||||
}
|
||||
} elseif (!empty($login)) {
|
||||
$listCommandes = $gestionCommande->listCommandesGreffeByLogin($login);
|
||||
} elseif (!empty($date)) {
|
||||
$listCommandes = $gestionCommande->listCommandesGreffe($date, $etat, $mode);
|
||||
}
|
||||
|
||||
//Parcours de la liste des commandes et vérification document existe
|
||||
if (count($listCommandes)>0) {
|
||||
for($i=0;$i<count($listCommandes);$i++){
|
||||
if ($listCommandes[$i]['typeCommande'] == '') {
|
||||
$listCommandes[$i]['typeCommande'] = 'G';
|
||||
}
|
||||
|
||||
$documentLien = '';
|
||||
switch($type){
|
||||
case 'greffe':
|
||||
if (preg_match('/^([0-9a-zA-Z]{2}-).*?$/', $listCommandes[$i]['refDocument'], $matches)){
|
||||
$documentLien = $this->view->url(array(
|
||||
'controller' => 'pieces',
|
||||
'action' => 'actes',
|
||||
'siret' => $listCommandes[$i]['siren'],
|
||||
));
|
||||
} elseif (preg_match('/^([0-9]{4}).*?$/', $listCommandes[$i]['refDocument'], $matches)){
|
||||
$documentLien = $this->view->url(array(
|
||||
'controller' => 'pieces',
|
||||
'action' => 'bilans',
|
||||
'siret' => $listCommandes[$i]['siren'],
|
||||
));
|
||||
}
|
||||
break;
|
||||
}
|
||||
$listCommandes[$i]['documentLien'] = $documentLien;
|
||||
}
|
||||
}
|
||||
|
||||
break; //Fin Gestion Greffes
|
||||
}
|
||||
$this->view->assign('commandes', $listCommandes);
|
||||
$this->renderScript('dashboard/commandes-'.$type.'.phtml');
|
||||
}
|
||||
|
||||
//Affichage des liens vers les différents types de commande
|
||||
$this->view->assign('typesCommande', $typesCommande);
|
||||
|
||||
}
|
||||
|
||||
public function rsAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$siren = $request->getParam('siren');
|
||||
|
||||
$ws = new WsScores();
|
||||
$infos = $ws->getIdentite($siren);
|
||||
if ($infos==false) {
|
||||
echo 'Erreur';
|
||||
} else {
|
||||
echo $infos->Nom;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Génération automatique du courrier PDF / ODT
|
||||
*/
|
||||
|
@ -2,4 +2,30 @@
|
||||
class Application_Model_Commandes extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes';
|
||||
|
||||
public function getCommandesById($id)
|
||||
{
|
||||
$sql = $this->select()->where('idCommande = ?', $id);
|
||||
$result = $this->getAdapter()->fetchAll($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getCommandesBySiren($siren)
|
||||
{
|
||||
$sql = $this->select()
|
||||
->where('siren = ?', $siren)
|
||||
->order('dateCommande ASC');
|
||||
$result = $this->getAdapter()->fetchAll($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getCommandesByLogin($login)
|
||||
{
|
||||
$sql = $this->select()
|
||||
->where('login = ?', $login)
|
||||
->order('dateCommande ASC');
|
||||
$result = $this->getAdapter()->fetchAll($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,4 +2,22 @@
|
||||
class Application_Model_CommandesKbis extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'commandes_kbis';
|
||||
|
||||
public function getCommandesKbisById($id)
|
||||
{
|
||||
$sql = $this->select()
|
||||
->where('id = ?', $id);
|
||||
$result = $this->getAdapter()->fetchAll($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getCommandesKbisBySiren($siren)
|
||||
{
|
||||
$sql = $this->select()
|
||||
->where('siren = ?', $siren)
|
||||
->order('dateCommande ASC');
|
||||
$result = $this->getAdapter()->fetchAll($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,118 @@
|
||||
<style type="text/css">
|
||||
table {width:100%; border-collapse:collapse; margin:5px 0;}
|
||||
table tr.odd {background-color:#e6eeee;}
|
||||
table tr.even {}
|
||||
table tr {
|
||||
border-top:2px solid;
|
||||
vertical-align:top;
|
||||
border-bottom:2px solid;
|
||||
}
|
||||
table th, table td {border:1px dashed; padding:5px;}
|
||||
select {font-size:11px;}
|
||||
</style>
|
||||
|
||||
<div id="center">
|
||||
<h1>Gestion des commandes KBIS</h1>
|
||||
|
||||
<h2>Rechercher une commande</h2>
|
||||
|
||||
<div class="paragraph">
|
||||
<form>
|
||||
N° de commande ou siren <input type="text" name="num" value="<?=$this->num?>" />
|
||||
<input type="submit" name="submit" value="Ok" />
|
||||
<br/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="paragraph">
|
||||
<form>
|
||||
Login <input type="text" name="login" value="<?=$this->login?>" />
|
||||
<input type="submit" name="submit" value="Ok" />
|
||||
<br/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="paragraph">
|
||||
<form>
|
||||
Etat
|
||||
<select name="etat">
|
||||
<?php foreach($this->etatSelect as $item):?>
|
||||
<option value="<?=$item['value']?>"<?=$item['select']?>><?=$item['affichage']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br/>
|
||||
Mode
|
||||
<select name="mode">
|
||||
<?php foreach($this->modeSelect as $item):?>
|
||||
<option value="<?=$item['value']?>"<?=$item['select']?>><?=$item['affichage']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br/>
|
||||
Mois
|
||||
<select name="date">
|
||||
<?php foreach($this->dateSelect as $item):?>
|
||||
<option value="<?=$item['value']?>"<?=$item['select']?>><?=$item['affichage']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<input type="submit" name="submit" value="Ok" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h2>Liste des commandes</h2>
|
||||
<div class="paragraph">
|
||||
<?php if (count($this->commandes)>0): ?>
|
||||
<table>
|
||||
<tbody>
|
||||
<?php $compteur = 0;?>
|
||||
<?php foreach ($this->commandes as $item):?>
|
||||
<?php
|
||||
if ($compteur%2) $class = ' even';
|
||||
else $class = ' odd';
|
||||
$compteur++;
|
||||
?>
|
||||
<tr class="<?=$class?>">
|
||||
<td><b><?=$item['typeCommande']?><?=$item['idCommande']?></b></td>
|
||||
<td width="26%">
|
||||
<a href="<?=$this->url(array(
|
||||
'controller' => 'identite',
|
||||
'action' => 'fiche',
|
||||
'siret' => $item['siren']
|
||||
), null, true)?>"><?=$this->SirenTexte($item['siren'])?></a><br/>
|
||||
<b><a href="<?=$this->url(array(
|
||||
'controller' => 'dashboard',
|
||||
'action' => 'rs',
|
||||
'siren' => $item['siren'],
|
||||
), null, true)?>" class="rs">Obtenir la raison sociale</a>
|
||||
</b>
|
||||
</td>
|
||||
<td width="34%">
|
||||
<?php if ($item['typeCommande']=='G'):?>
|
||||
<u>Commande Greffe normal</u><br/>
|
||||
<?php elseif ($item['typeCommande']=='C'):?>
|
||||
<u>Commande Greffe par courrier S&D</u><br/>
|
||||
<a href="<?=$this->url(array(
|
||||
'controller'=>'dashboard',
|
||||
'action' => 'courrier',
|
||||
'commande' => 'C'.$item['idCommande'],
|
||||
), null, true)?>" target="_blank">
|
||||
Générer le courrier</a><br/>
|
||||
<?php endif;?>
|
||||
Email : <?=$item['emailCommande']?><br/>
|
||||
Etat : ...
|
||||
</td>
|
||||
<td width="34%">
|
||||
Date de commande : <?=$item['dateCommande']?></br>
|
||||
Date de reception : <?=$item['dateReception']?><br/>
|
||||
Changer l'etat : ...
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else:?>
|
||||
Aucunes commandes.
|
||||
<?php endif;?>
|
||||
</div>
|
||||
|
||||
</div>
|
103
application/views/default/scripts/dashboard/commandes-kbis.phtml
Normal file
103
application/views/default/scripts/dashboard/commandes-kbis.phtml
Normal file
@ -0,0 +1,103 @@
|
||||
<style type="text/css">
|
||||
table {width:100%; border-collapse:collapse; margin:5px 0;}
|
||||
table tr.odd {background-color:#e6eeee;}
|
||||
table tr.even {}
|
||||
table tr {
|
||||
border-top:2px solid;
|
||||
vertical-align:top;
|
||||
border-bottom:2px solid;
|
||||
}
|
||||
table th, table td {border:1px dashed; padding:5px;}
|
||||
select {font-size:11px;}
|
||||
</style>
|
||||
|
||||
<div id="center">
|
||||
<h1>Gestion des commandes KBIS</h1>
|
||||
|
||||
<h2>Rechercher une commande</h2>
|
||||
|
||||
<div class="paragraph">
|
||||
<form>
|
||||
N° de commande ou siren <input type="text" name="num" value="<?=$this->num?>" />
|
||||
<input type="submit" name="submit" value="Ok" />
|
||||
<br/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="paragraph">
|
||||
<form>
|
||||
Etat
|
||||
<select name="etat">
|
||||
<?php foreach($this->etatSelect as $item):?>
|
||||
<option value="<?=$item['value']?>"<?=$item['select']?>><?=$item['affichage']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br/>
|
||||
Mode
|
||||
<select name="mode">
|
||||
<?php foreach($this->modeSelect as $item):?>
|
||||
<option value="<?=$item['value']?>"<?=$item['select']?>><?=$item['affichage']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br/>
|
||||
Mois
|
||||
<select name="date">
|
||||
<?php foreach($this->dateSelect as $item):?>
|
||||
<option value="<?=$item['value']?>"<?=$item['select']?>><?=$item['affichage']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<input type="submit" name="submit" value="Ok" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h2>Liste des commandes</h2>
|
||||
<div class="paragraph">
|
||||
<?php if (count($this->commandes)>0): ?>
|
||||
<table>
|
||||
<tbody>
|
||||
<?php $compteur = 0;?>
|
||||
<?php foreach ($this->commandes as $item):?>
|
||||
<?php
|
||||
if ($compteur%2) $class = ' even';
|
||||
else $class = ' odd';
|
||||
$compteur++;
|
||||
?>
|
||||
<tr class="<?=$class?>">
|
||||
<td><b>K<?=$item['id']?></b></td>
|
||||
<td width="26%">
|
||||
<a href="<?=$this->url(array(
|
||||
'controller' => 'identite',
|
||||
'action' => 'fiche',
|
||||
'siret' => $item['siren']
|
||||
), null, true)?>"><?=$this->SirenTexte($item['siren'])?></a><br/>
|
||||
<b><?=$item['raisonSociale']?></b>
|
||||
</td>
|
||||
<td width="34%">
|
||||
<?php if ($item['type']=='M'):?>
|
||||
<u>Commande de kbis par Mail</u><br/>
|
||||
<?php elseif ($item['type']=='C'):?>
|
||||
<u>Commande de kbis original par Courrier</u><br/>
|
||||
<?=$item['societe']?><br/>
|
||||
<?=$item['nom']?><br/>
|
||||
<?=$item['adresse']?><br/>
|
||||
<?=$item['cp'] . ' ' . $item['ville']?><br/>
|
||||
<?php endif;?>
|
||||
Email : <?=$item['email']?><br/>
|
||||
Etat : ...
|
||||
</td>
|
||||
<td width="34%">
|
||||
Date de commande : <?=$item['dateCommande']?></br>
|
||||
Date de reception : <?=$item['dateReception']?><br/>
|
||||
Changer l'etat : ...
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else:?>
|
||||
Aucunes commandes.
|
||||
<?php endif;?>
|
||||
</div>
|
||||
|
||||
</div>
|
16
application/views/default/scripts/dashboard/commandes.phtml
Normal file
16
application/views/default/scripts/dashboard/commandes.phtml
Normal file
@ -0,0 +1,16 @@
|
||||
<div id="center">
|
||||
<h1>Gestion des commandes</h1>
|
||||
<div class="paragraph">
|
||||
|
||||
<?php foreach($this->typesCommande as $type):?>
|
||||
<a href="<?=$this->url(array(
|
||||
'controller' => 'dashboard',
|
||||
'action' => 'commandes',
|
||||
'type' => $type
|
||||
))?>" title="Gérer vos commandes">Gestion des commandes <?=$type?></a>
|
||||
<br/>
|
||||
|
||||
<?php endforeach;?>
|
||||
|
||||
</div>
|
||||
</div>
|
@ -20,4 +20,12 @@ $(document).ready(function(){
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.rs').click(function(e){
|
||||
e.preventDefault();
|
||||
var item = $(this);
|
||||
$.post(item.attr('href'),
|
||||
function(data){ item.replaceWith('<b>'+data+'</b>'); }
|
||||
);
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user