219 lines
4.8 KiB
PHP
219 lines
4.8 KiB
PHP
<?php
|
|
/*
|
|
* Liste des commandes passés en mode courrier
|
|
*
|
|
*/
|
|
|
|
if (!$_SESSION['connected'])
|
|
{
|
|
?>
|
|
<div id="center">
|
|
Vous devez être connecté afin de pouvoir utiliser cette fonctionnalité
|
|
</div>
|
|
<?php
|
|
}
|
|
elseif(!hasModeEdition())
|
|
{
|
|
?>
|
|
<div id="center">
|
|
L'accès à cette page est restreint
|
|
</div>
|
|
<?php
|
|
}
|
|
//Affichage des commandes
|
|
else
|
|
{
|
|
//Données
|
|
isset($_REQUEST['num'])?
|
|
$num = trim($_REQUEST['num']) :
|
|
$num = '';
|
|
isset($_REQUEST['siren'])?
|
|
$siren = trim(preg_replace('/[^0-9]/','', $_REQUEST['siren'])) :
|
|
$siren = '';
|
|
isset($_REQUEST['statut'])?
|
|
$statut = trim($_REQUEST['statut']) :
|
|
$statut = 0;
|
|
isset($_REQUEST['date'])?
|
|
$date = trim($_REQUEST['date']) :
|
|
$date = date('m');
|
|
|
|
require_once 'dbbootstrap.php';
|
|
require_once 'infogreffe/constantes.php';
|
|
setDbConn('sdv1');
|
|
|
|
$dateToday = date('m');
|
|
$dateTime1 = date('Y-m-d H:i:s', mktime(0,0,0,$date,0,date('Y')));
|
|
$dateTime2 = date('Y-m-d H:i:s', mktime(0,0,0,$date+1,0,date('Y')));
|
|
$dateIntervalle = 6;
|
|
|
|
//Liste des statuts
|
|
$q = Doctrine_Query::create()
|
|
->from('CommandesStatut')
|
|
->where('typeCommande = ?', 'C')
|
|
->orderBy('ordre ASC');
|
|
$cStatuts = $q->execute();
|
|
|
|
//Liste des commandes
|
|
$q = Doctrine_Query::create()
|
|
->from('Commandes')
|
|
->where('typeCommande = ?', 'C')
|
|
->andWhere('statutCommande = ?', $statut)
|
|
->andWhere('dateCommande > ?', $dateTime1)
|
|
->andWhere('dateCommande < ?', $dateTime2);
|
|
|
|
$firephp->log($q->getSql(),'SQL');
|
|
$firephp->log($q->getParams(),'PARAMS');
|
|
$commandes = $q->execute();
|
|
|
|
?>
|
|
<style type="text/css">
|
|
#center{width:760px; padding-right:10px; padding-left:10px;}
|
|
.blockh2{margin:5px; }
|
|
table {border-collapse:collapse; margin:5px 0; width:100%;}
|
|
th, td {border:1px solid; padding:5px;}
|
|
</style>
|
|
<script type="text/javascript">
|
|
$(document).ready(function()
|
|
{
|
|
var url = './pages/ajax/greffescmd_courrier.php';
|
|
|
|
$('.changeEtat').change(function(){
|
|
var newEtat = $(this).val();
|
|
$.post(url, {
|
|
changeEtat: newEtat },
|
|
function(data){ $('select[name=Etat]').replaceWith(data); }
|
|
);
|
|
});
|
|
|
|
});
|
|
</script>
|
|
<div id="center">
|
|
<h1>Commandes Courrier Greffes</h1>
|
|
<div class="blockh2">
|
|
<form name="" method="post" action="./?page=greffescmd_courrier">
|
|
|
|
<label>Etat</label>
|
|
<select name="statut">
|
|
<option value="0">Non traité</option>
|
|
<?php
|
|
foreach ($cStatuts as $cStatut)
|
|
{
|
|
$selected = '';
|
|
if( $cStatut->ordre == $statut) $selected = 'selected';
|
|
?>
|
|
<option value="<?=$cStatut->ordre?>" <?=$selected?>>
|
|
<?=$cStatut->libStatut?>
|
|
</option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
<label>Date</label>
|
|
<select name="date">
|
|
<option>-</option>
|
|
<?php
|
|
|
|
for($i=$dateToday-$dateIntervalle; $i<=$dateToday; $i++)
|
|
{
|
|
$dateTime = mktime(0, 0, 0, $i+1, 0, date('Y'));
|
|
$selected = '';
|
|
if( $i==$date ){ $selected = 'selected'; }
|
|
?>
|
|
<option value="<?=$i?>" <?=$selected?>>
|
|
<?=date('m/Y', $dateTime)?>
|
|
</option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
<br/>
|
|
|
|
<label>Numéro de gestion</label>
|
|
<input type="text" name="num" value="<?=$num?>"/>
|
|
<label>Siren</label>
|
|
<input type="text" name="siren" value="<?=$siren?>" />
|
|
<input type="submit" name="submit" value="Rechercher"/>
|
|
</form>
|
|
|
|
<table>
|
|
<tr>
|
|
<th>N°</th>
|
|
<th>Siren</th>
|
|
<th>Email</th>
|
|
<th>Document</th>
|
|
<th>dateCommande</th>
|
|
<th>dateReception</th>
|
|
</tr>
|
|
<?php
|
|
if( $commandes->count() > 0 )
|
|
{
|
|
foreach($commandes as $commande)
|
|
{
|
|
?>
|
|
<tr>
|
|
<td>C<?=$commande->idCommande?></td>
|
|
<td>
|
|
<a href="./?page=greffes&vue=actes&siret=<?=$commande->siren?>" target="_blank">
|
|
<?=$commande->siren?></a>
|
|
</td>
|
|
<td><?=$commande->emailCommande?></td>
|
|
|
|
<td>
|
|
Ref : <?=$commande->refDocument?> <br/>
|
|
Type : <?=(array_key_exists('a'.substr($commande->refDocument, 0, 2), $typeActes)) ?
|
|
$typeActes['a'.substr($commande->refDocument, 0, 2)] : '';
|
|
?>
|
|
<br/>
|
|
Lib : <?=$commande->libDocument?>
|
|
<br/>
|
|
<select class="changeEtat" name="Etat">
|
|
<?php
|
|
if($commande->statutCommande == 0)
|
|
{
|
|
?>
|
|
<option value="0">Non traité</option>
|
|
<?php
|
|
}
|
|
foreach ($cStatuts as $cStatut)
|
|
{
|
|
$selected = '';
|
|
//Selection du statut en cours
|
|
if($cStatut->ordre == $commande->statutCommande)
|
|
{
|
|
$selected = 'selected';
|
|
}
|
|
//Ne pas afficher les états précedents et les états suivant +2
|
|
if( $cStatut->ordre == $commande->statutCommande ||
|
|
$cStatut->ordre == $commande->statutCommande+1 )
|
|
{
|
|
?>
|
|
<option value="<?=$commande->idCommande?>-<?=$cStatut->ordre?>" <?=$selected?>>
|
|
<?=$cStatut->libStatut?></option>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
<?php
|
|
if($commande->statutCommande == 3)
|
|
{
|
|
?>
|
|
<br/>
|
|
<a href="./pages_saisie/gencourrier.php?id=<?=$commande->idCommande?>" target="_blank">Générer le courrier</a>
|
|
<?php
|
|
}
|
|
?>
|
|
</td>
|
|
<td><?=$commande->dateCommande?></td>
|
|
<td><?=$commande->dateReception?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
} // Fin permission d'accès
|