2009-12-04 17:17:09 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2010-02-10 17:27:03 +00:00
|
|
|
* Liste des commandes passées sur infogreffe
|
2009-12-04 17:17:09 +00:00
|
|
|
*
|
|
|
|
*/
|
2010-02-10 17:27:03 +00:00
|
|
|
|
|
|
|
if(isset($_REQUEST['submit']) && $_REQUEST['submit']=='comment')
|
|
|
|
{
|
|
|
|
require_once 'dbbootstrap.php';
|
|
|
|
setDbConn('sdv1');
|
|
|
|
$q = Doctrine_Query::create()
|
|
|
|
->update('Commandes')
|
|
|
|
->set('statutCommande', '?', $_REQUEST['statutCommande'])
|
|
|
|
->set('commentaire', '?', $_REQUEST['commentaire'])
|
|
|
|
->where('idCommande = ?', $_REQUEST['idCommande']);
|
|
|
|
//echo $q->getSql();
|
|
|
|
//print_r($q->getFlattenedParams());
|
|
|
|
echo $rows = $q->execute();
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_REQUEST['ajax']))
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<form>
|
|
|
|
<span id="message"></span><br/>
|
|
|
|
<input type="hidden" name="idCommande" value="<?=$_REQUEST['id']?>"/>
|
|
|
|
<input type="hidden" name="statutCommande" value="<?=$_REQUEST['erreur']?>"/>
|
|
|
|
Commentaire sur la commande G<?=$_REQUEST['id']?><br/>
|
|
|
|
<textarea name="commentaire" cols="40" rows="3"></textarea>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2010-02-17 14:44:28 +00:00
|
|
|
function typeCommandeTarifsWs($ref)
|
|
|
|
{
|
|
|
|
if( preg_match('/^([0-9]{4}_).*?$/', $ref, $matches) )
|
|
|
|
{
|
|
|
|
$output = 'BI';
|
|
|
|
}elseif( preg_match('/^(ST_).*?$/', $ref, $matches) ){
|
|
|
|
$output = 'ST';
|
|
|
|
}else{
|
|
|
|
$output = 'AC';
|
|
|
|
}
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-04 17:17:09 +00:00
|
|
|
?>
|
2010-02-10 17:27:03 +00:00
|
|
|
<link rel="stylesheet" href="./css/jquery-ui.css" type="text/css">
|
|
|
|
|
2010-02-02 10:56:42 +00:00
|
|
|
<style type="text/css">
|
|
|
|
#center{width:760px; padding-right:10px; padding-left:10px;}
|
|
|
|
.blockh2{margin:5px; }
|
2010-02-10 17:27:03 +00:00
|
|
|
table {width:100%; border-collapse:collapse; margin:5px 0;}
|
2010-02-02 10:56:42 +00:00
|
|
|
th, td {border:1px solid; padding:5px;}
|
|
|
|
</style>
|
2010-02-10 17:27:03 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function()
|
|
|
|
{
|
|
|
|
$('.changeEtat').each(function(){
|
|
|
|
var $link = $(this);
|
|
|
|
var $dialog = $('<div></div>')
|
|
|
|
.dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
title: $link.attr('title'),
|
|
|
|
width: 400,
|
|
|
|
height: 200,
|
|
|
|
open: function(event, ui) {
|
|
|
|
$(this).load($link.attr('href'));
|
|
|
|
},
|
|
|
|
buttons: {
|
|
|
|
'Placer la commande en erreur': function() {
|
|
|
|
$.post('./pages/greffescmd.php',
|
|
|
|
{
|
|
|
|
idCommande: $('input[name=idCommande]').val(),
|
|
|
|
commentaire: $('textarea[name=commentaire]').val(),
|
|
|
|
statutCommande: $('input[name=statutCommande]').val(),
|
|
|
|
submit: 'comment'
|
|
|
|
},
|
|
|
|
function(data){
|
|
|
|
if(data==1){ $dialog.dialog('close'); }
|
|
|
|
else $('#message').html('Erreur...');
|
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
'Annuler': function() { $(this).dialog('close'); }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$link.click(function() {
|
|
|
|
$dialog.dialog('open');
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
2009-12-04 17:17:09 +00:00
|
|
|
<div id="center">
|
|
|
|
<h1>Commandes INFOGREFFE</h1>
|
2010-02-02 10:56:42 +00:00
|
|
|
<div class="blockh2">
|
2009-12-04 17:17:09 +00:00
|
|
|
<?php
|
|
|
|
if (!$_SESSION['connected'])
|
|
|
|
{
|
2010-02-10 17:27:03 +00:00
|
|
|
echo 'Vous devez être connecté afin de pouvoir utiliser cette fonctionnalité';
|
2009-12-04 17:17:09 +00:00
|
|
|
}
|
2010-02-10 17:27:03 +00:00
|
|
|
elseif(!hasModeEdition())
|
2009-12-04 17:17:09 +00:00
|
|
|
{
|
2010-02-10 17:27:03 +00:00
|
|
|
echo 'L\'accès à cette page est restreint';
|
2009-12-04 17:17:09 +00:00
|
|
|
}
|
|
|
|
//Affichage des commandes
|
|
|
|
else
|
|
|
|
{
|
2010-02-10 17:27:03 +00:00
|
|
|
isset($_REQUEST['num'])?
|
|
|
|
$num = trim($_REQUEST['num']) :
|
|
|
|
$num = '';
|
|
|
|
isset($_REQUEST['siren'])?
|
|
|
|
$siren = trim(preg_replace('/[^0-9]/','', $_REQUEST['siren'])) :
|
|
|
|
$siren = '';
|
|
|
|
|
|
|
|
isset($_REQUEST['cmd'])?
|
|
|
|
$cmd = $_REQUEST['cmd'] :
|
|
|
|
$cmd = '';
|
|
|
|
|
2009-12-04 17:17:09 +00:00
|
|
|
?>
|
|
|
|
<div class="block">
|
|
|
|
<form name="" method="post" action="./?page=greffescmd">
|
2010-02-10 17:27:03 +00:00
|
|
|
<label>Numéro de gestion</label>
|
|
|
|
<input type="text" name="num" value="<?=$num?>"/>
|
|
|
|
<label>Siren</label>
|
|
|
|
<input type="text" name="siren" value="<?=$siren?>" />
|
2010-02-02 10:56:42 +00:00
|
|
|
<input type="submit" name="submit" value="Rechercher"/>
|
2009-12-04 17:17:09 +00:00
|
|
|
</form>
|
2010-02-10 17:27:03 +00:00
|
|
|
<a href="./?page=greffescmd&cmd=erreur">Liste des commandes en erreur</a>
|
2009-12-04 17:17:09 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
if(!empty($num) || !empty($siren))
|
|
|
|
{
|
|
|
|
require_once 'dbbootstrap.php';
|
2009-12-17 09:31:33 +00:00
|
|
|
require_once 'infogreffe/constantes.php';
|
|
|
|
|
2009-12-04 17:17:09 +00:00
|
|
|
setDbConn('sdv1');
|
|
|
|
if( !empty($siren) && empty($num) )
|
|
|
|
{
|
2010-02-10 17:27:03 +00:00
|
|
|
$q = Doctrine_Query::create()
|
|
|
|
->from('Commandes')
|
|
|
|
->where('siren = ?', $siren);
|
2009-12-04 17:17:09 +00:00
|
|
|
}elseif( empty($siren) && !empty($num) ){
|
2010-02-10 17:27:03 +00:00
|
|
|
$q = Doctrine_Query::create()
|
|
|
|
->from('Commandes')
|
|
|
|
->where('idCommande = ?', $num);
|
2009-12-04 17:17:09 +00:00
|
|
|
}else{
|
2010-02-10 17:27:03 +00:00
|
|
|
$q = Doctrine_Query::create()
|
|
|
|
->from('Commandes')
|
|
|
|
->where('siren = ?', $siren)
|
|
|
|
->andWhere('idCommande = ?', $num);
|
2009-12-04 17:17:09 +00:00
|
|
|
}
|
|
|
|
$commandes = $q->execute();
|
2010-02-10 17:27:03 +00:00
|
|
|
|
2009-12-04 17:17:09 +00:00
|
|
|
?>
|
|
|
|
<div class="block">
|
|
|
|
<table>
|
|
|
|
<tr>
|
2010-02-10 17:27:03 +00:00
|
|
|
<th>N°</th>
|
2009-12-04 17:17:09 +00:00
|
|
|
<th>Siren</th>
|
2009-12-11 12:44:15 +00:00
|
|
|
<th>Email</th>
|
2010-02-02 10:56:42 +00:00
|
|
|
<th>Document</th>
|
2009-12-04 17:17:09 +00:00
|
|
|
<th>dateCommande</th>
|
|
|
|
<th>dateReception</th>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
foreach($commandes as $commande)
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<tr>
|
2009-12-11 12:44:15 +00:00
|
|
|
<td>G<?=$commande->idCommande?></td>
|
2010-02-10 17:27:03 +00:00
|
|
|
<td>
|
|
|
|
<a href="./?page=greffes&vue=actes&siret=<?=$commande->siren?>" target="_blank">
|
|
|
|
<?=$commande->siren?></a>
|
|
|
|
</td>
|
2009-12-04 17:17:09 +00:00
|
|
|
<td><?=$commande->emailCommande?></td>
|
2010-02-02 10:56:42 +00:00
|
|
|
|
|
|
|
<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?>
|
2010-02-10 17:27:03 +00:00
|
|
|
<?php
|
|
|
|
if($commande->statutCommande<2 && $commande->dateReception=='0000-00-00 00:00:00')
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<br/>
|
|
|
|
<a class="changeEtat" title="Erreur sur la commande" target="_blank"
|
|
|
|
href="./pages/greffescmd.php?id=<?=$commande->idCommande?>&erreur=9&ajax=true">
|
|
|
|
Placer cette commande en erreur
|
|
|
|
</a>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
if($commande->statutCommande==9)
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<br/>
|
|
|
|
Erreur sur la commande : <?=$commande->commentaire?>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2010-02-02 10:56:42 +00:00
|
|
|
</td>
|
2009-12-04 17:17:09 +00:00
|
|
|
<td><?=$commande->dateCommande?></td>
|
|
|
|
<td><?=$commande->dateReception?></td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<?php
|
2010-02-10 17:27:03 +00:00
|
|
|
} //Faire recherche num gestion et siren
|
|
|
|
|
|
|
|
//Afficher les commandes en erreur
|
|
|
|
if($cmd=='erreur')
|
|
|
|
{
|
|
|
|
require_once 'dbbootstrap.php';
|
|
|
|
require_once 'infogreffe/constantes.php';
|
|
|
|
|
2010-02-17 14:44:28 +00:00
|
|
|
//Liste des commandes en erreur
|
2010-02-10 17:27:03 +00:00
|
|
|
setDbConn('sdv1');
|
|
|
|
$q = Doctrine_Query::create()
|
|
|
|
->from('Commandes')
|
|
|
|
->where('statutCommande = ?', 9)
|
|
|
|
->andWhere('dateReception = ?', '0000-00-00 00:00:00');
|
|
|
|
$commandes = $q->execute();
|
2010-02-17 14:44:28 +00:00
|
|
|
|
|
|
|
//Liste des tarifs
|
|
|
|
$q = Doctrine_Query::create()
|
|
|
|
->from('CommandesTarifsWs')
|
|
|
|
->where('annee = ?', date('Y'));
|
|
|
|
$tarifs = $q->execute()->toArray();
|
|
|
|
|
|
|
|
?>
|
2010-02-10 17:27:03 +00:00
|
|
|
<div class="block">
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>Référence commande</th>
|
|
|
|
<th>Siren</th>
|
|
|
|
<th>Document</th>
|
2010-02-17 14:44:28 +00:00
|
|
|
<th>Tarifs</th>
|
2010-02-10 17:27:03 +00:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
foreach($commandes as $commande)
|
|
|
|
{
|
2010-02-17 14:44:28 +00:00
|
|
|
|
|
|
|
|
2010-02-10 17:27:03 +00:00
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<td>G<?=$commande->idCommande?></td>
|
|
|
|
<td><?=$commande->siren?></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/>
|
|
|
|
Libellé : <?=$commande->libDocument?>
|
2010-02-11 16:01:21 +00:00
|
|
|
<br/>
|
|
|
|
Commentaires : <?=$commande->commentaire?>
|
2010-02-10 17:27:03 +00:00
|
|
|
</td>
|
2010-02-17 14:44:28 +00:00
|
|
|
<td>
|
|
|
|
<?php
|
|
|
|
$type = typeCommandeTarifsWs($commande->refDocument);
|
|
|
|
foreach($tarifs as $tarif)
|
|
|
|
{
|
|
|
|
if($tarif['type']==$type){ echo $tarif['prix'].' €'; break; }
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</td>
|
2010-02-10 17:27:03 +00:00
|
|
|
</tr>
|
|
|
|
<?php
|
2009-12-04 17:17:09 +00:00
|
|
|
}
|
2010-02-10 17:27:03 +00:00
|
|
|
?>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
} //Fin liste des commandes en erreur
|
|
|
|
|
|
|
|
|
|
|
|
} // Fin permission d'accès
|
2009-12-04 17:17:09 +00:00
|
|
|
?>
|
|
|
|
</div>
|
2010-02-02 10:56:42 +00:00
|
|
|
</div>
|
2009-12-04 17:17:09 +00:00
|
|
|
<?php
|