extranet/www/pages/international_commandes.php

80 lines
2.4 KiB
PHP

<?php
if (!$_SESSION['connected']) {
die();
}
if (isset($_POST['type_enq']) == false) {
$type_enq = 'Delivered';
} else {
$type_enq = $_POST['type_enq'];
}
require_once 'dbbootstrap.php';
require_once 'user/user.php';
$etatsEnq = array('Toutes' => 'Toutes',
'Initialised' => 'Initialis&eacute;es',
'Assigned' => 'Assign&eacute;es',
'Completed' => 'Complet&eacute;es',
'Delivered' => 'D&eacute;livr&eacute;es',
'NonD' => 'Non d&eacute;livr&eacute;es');
function ajouteOption(&$etatsEnq, $type_enq, $index) {
print '<option value="'.$index.'"';
if ($type_enq == $index) {
print ' selected';
}
print '>'.$etatsEnq[$index].'</option>';
}
?>
<div id="center">
<h1>Commandes Internationales</h1>
<form method="post">
<label>Type d&apos;enqu&ecirc;te:</label>
<select name="type_enq" onchange="this.form.submit();">
<?php
foreach ($etatsEnq as $index => $valeur) {
ajouteOption($etatsEnq, $type_enq, $index);
}
?>
</select>
</form>
<br/>
<?php
setDbConn('graydon');
$tabCommandes = Doctrine_Query::create()
->from('Commandes')
->where('user = ?', $_SESSION['tabInfo']['login'])
->orderby('id')
->execute();
foreach ($tabCommandes as $commande) {
if (($type_enq != 'Toutes' &&
$type_enq != 'NonD' &&
$type_enq != $commande->orderstate) ||
($type_enq == 'NonD' &&
$commande->orderstate == 'Delivered')) {
continue;
}
$detail = Doctrine_Query::create()
->from('CommandesDetail')
->where('commandes_id = ?', $commande->id)
->fetchOne();
print $detail->eName.'<br/>'.
$detail->eAdresse.'<br/>'.
'Type d&apos;enqu&ecirc;te: '.$commande->servicespeed.'<br/>'.
'&Eacute;tat: '.$commande->orderstate.'<br/>'.
'Prix: '.$commande->prix.' euros<br/>'.
'Date de la commande: ' .$commande->dateordered.'<br/>'.
'Date de r&eacute;ception pr&eacute;vue: '.$commande->datedue.'<br/>';
if ($commande->orderstate == 'Completed' ||
$commande->orderstate == 'CompletedwithUpdate' ||
$commande->orderstate == 'ReCompleted') {
print 'Date de r&eacute;ception: '.$commande->datecompleted.'<br/>';
print '<a href="">T&eacute;l&eacute;charger le rapport</a><br/>';
}
print '<br/>';
}
?>
</div>