1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
| <?php
$conn = mysql_connect(...);
$base2='commun_agences';
mysql_query("SET NAMES 'utf8'");
session_start();
$base1=$_SESSION['base'];
$agence=$_SESSION['agence'];
//echo $agence;
$order_by = (isset($_GET['order'])&& in_array($_GET['order'], $tri_possibles)) ? $_GET['order']:'date_vente';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/modeles/general.css"/>
<title>Suivi Portefeuille</title>
</head>
<body>
<div id="header">
<?php
require "../modeles/header.php";
?>
</div>
<div id="menu">
<?php
require "../modeles/menu.php";
?>
</div>
<p>La liste des ventes peut s'afficher sous le menu, en bas de la page.</p>
<div id="contenu" >
<h2 style="text-align: center">Suivi Portefeuille (Ventes en cours facturation non complète)</h2>
<br>
<form name="suivi_ventes" method="post" action="save_suivi_ventes.php">
<?php
//Tris sur colonnes
$tri_possibles = array('date_vente','vente_produit','clientnom','ville','userprenom','date_prev_pose','statut_vente', 'mois_fact');
$order_by = (isset($_GET['order'])&& in_array($_GET['order'], $tri_possibles)) ? $_GET['order']:'date_vente';
//sens du tri
$order_dir = isset($_GET['inverse']) ? 'DESC' : 'ASC';
//requetes
$sql="select * from ventes_cours_view order by {$order_by} {$order_dir}";
$sql_mmsm="select * from ventes_cours_view where libelle_agence='$agence' order by {$order_by} {$order_dir}";
if(isset($_GET['venteid'])){
$vente=$_GET['venteid'];
$sql_vente_unique="select * from ventes_cours_view where venteid='$vente' ";
$result = mysql_db_query($base1,$sql_vente_unique) or exit(mysql_error()); }
elseif($base1=='MMSM' ){
$result = mysql_db_query($base1,$sql_mmsm) or exit(mysql_error());
}
else {
$result = mysql_db_query($base1,$sql) or exit(mysql_error()); }
// fonction qui affiche les liens
function sort_link($text, $order=false)
{
global $order_by, $order_dir;
if(!$order)
$order = $text;
$link = '<a href="?order=' . $order;
if($order_by==$order && $order_dir=='ASC')
$link .= '&inverse=true';
$link .= '"';
if($order_by==$order && $order_dir=='ASC')
$link .= ' class="order_asc"';
elseif($order_by==$order && $order_dir=='DESC')
$link .= ' class="order_desc"';
$link .= '>' . $text . '</a>';
return $link;
}
?>
<a href="export_portefeuille.php?exporter=export">Exporter la liste</a>
<input type="submit" name="enregistrer" value="Enregistrer">
<table style="font-size: medium">
<tr style="height: 40px">
<th style="text-align: center; width:60px"><?php echo sort_link('Date Vente', 'date_vente') ?> </th>
<th style="text-align: center; width:120px"><?php echo sort_link('Vendeur', 'userprenom') ?> </th>
<th style="text-align: center; width: 150px"><?php echo sort_link('Client', 'clientnom') ?> </th>
<th style="text-align: center; width:auto"><?php echo sort_link('Ville', 'ville') ?> </th>
<th style="text-align: center; width:100px"><?php echo sort_link('Produit', 'vente_produit') ?> </th>
<th style="text-align: center; width:100px"><?php echo sort_link('Statut', 'statut_vente') ?> </th>
<th style="text-align: center; width:50px">Date statut</th>
<th style="text-align: center; width:50px">Statut à enreg.</th>
<th style="text-align: center; width:50px">Nb acpte </th>
<th style="text-align: center; width:70px"><?php echo sort_link('Métré', 'date_metre') ?> </th>
<th style="text-align: center; width:40px"><?php echo sort_link('Prev. Pose', 'date_prev_pose') ?> </th>
<th style="text-align: center; width:50px">Temps de pose</th>
<th style="text-align: center;width:70px"><?php echo sort_link('Mois Fact.', 'mois_fact') ?> </th>
</tr>
<?php
while($row_liste = mysql_fetch_assoc($result)) {
$venteid=$row_liste['venteid'];
$result_acompte=mysql_db_query($base1, "select libelle_acompte from acomptes where venteid_acompte='$venteid'") or exit (mysql_error());
$nb_acompte=mysql_num_rows( $result_acompte);
?>
<tr>
<td><?php echo date('d/m/Y',strtotime($row_liste['date_vente']))?> </td>
<td><?php echo $row_liste['userprenom'].' '.$row_liste['usernom']?></td>
<td><?php echo $row_liste['clientnom']; ?> </td>
<td><?php echo $row_liste['ville']?></td>
<td style="text-align: center;"><?php echo $row_liste['vente_produit']; ?> </td>
<td><select name="statut_vente[<?php echo $row_liste['venteid']?>]"
id="statut_vente[<?php echo $row_liste['venteid']?>]" onchange="document.getElementById('modif[<?php echo $row_liste['venteid']?>]').checked=true;"><option value="">Sélectionner le statut</option>
<?php
$result_statut = mysql_db_query($base2,"select etat_vente_libelle from etat_vente order by etat_vente_ordre");
while
($row_statut = mysql_fetch_assoc($result_statut))
{
if ($row_statut['etat_vente_libelle']==$row_liste['statut_vente']) { ?>
<OPTION VALUE="<?php echo $row_liste['statut_vente'];?>"selected="selected">
<?php echo $row_liste['statut_vente']; ?> </OPTION>
<?php }
else { ?>
<OPTION VALUE="<?php echo $row_statut['etat_vente_libelle'];?>">
<?php echo $row_statut['etat_vente_libelle']; ?>
</OPTION>
<?php
} }
?>
</select> </td>
<td style="width: 50px"><input type="date" style="width: 120px; font-weight: bold; font-size: small" name="date_statut[<?php echo $row_liste['venteid']?>]" value="<?php echo $row_liste['date_statut']?>"></td>
<td style="br"><input type="checkbox" style="width: 20px; height: 20px" name="idligne_statut[<?php echo $row_liste['venteid']?>]" id="modif[<?php echo $row_liste['venteid']?>]"
value="<?php echo $row_liste['venteid']?>"></td>
<td><?php echo $nb_acompte; ?> <a href="../ventes/ajouter_acompte_direct.php?venteid=<?php echo $venteid ?>" target=blank title="Ajouter un acompte"><IMG src="../images/ajouter.png"></a></td>
<td><input type="date" style="width: 120px; font-weight: bold; font-size: small" name="metre[<?php echo $row_liste['venteid']?>]" value="<?php echo $row_liste['date_metre']?>"> </td>
<td><select name="date_prev_pose[<?php echo $row_liste['venteid']?>]" style="width: 80px;"><option value="">Chois Sem. pose</option>
<?php
$result_semaine = mysql_db_query($base2,"select * from semaines order by idsemaine");
?>
<?php
while
($row_sem = mysql_fetch_assoc($result_semaine))
{
if ($row_sem['idsemaine']==$row_liste['date_prev_pose']) { ?>
<OPTION VALUE="<?php echo $row_liste['date_prev_pose'];?>"selected="selected">
<?php if ($row_liste['date_prev_pose']=='0') {echo 'Sans Pose'; } else {echo Sem.' '.$row_liste['date_prev_pose'];} ?> </OPTION>
<?php }
else { ?>
<OPTION VALUE="<?php echo $row_sem['numsemaine'];?>">
<?php if ($row_sem['idsemeine']=='0') {echo 'Sans Pose'; } else {echo Sem.' '.$row_sem['idsemaine'];} ?>
</OPTION>
<?php
} }
?>
</select> </td>
<td><input type="text" style="width: 120px; font-size: small" name="temps_pose[<?php echo $row_liste['venteid']?>]" value="<?php echo $row_liste['duree_pose'] ?>"></td>
<td style="width: 70px;"><input type="month" style="width: 120px; font-weight: bold; font-size: small" name="mois_fact[<?php echo $row_liste['venteid']?>]" value="<?php echo $row_liste['mois_fact'] ?>">
<input type="hidden" name="idligne[<?php echo $row_liste['venteid']?>]" value="<?php echo $row_liste['venteid']?>"></td>
<td style="width:60px"><a href="../ventes/recap_vente.php?venteid=<?php echo $row_liste['venteid'];?>" target="_blank">Voir récap.</a></td>
</tr>
<?php
}
?>
</table>
</form>
</div>
</body>
</html> |
Partager