rendered paste body<?// script hacks/*All script css for production table is hard-coded in css files.*/ if(isset($_REQUEST['user_style'])){ // set user style echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"css_tables/".$_REQUEST['user_style'].".css\" title=\"".$_REQUEST['user_style']."\" media=\"screen\" />"; }else{?><link rel="stylesheet" type="text/css" href="css_tables/chrome.css" title="chrome" media="screen" /><?// set default style $_REQUEST['user_style'] = "css-tables-gallery";}// ******* UPDATE DE L ETAPE ... if($_REQUEST['intent'] == 'insert'){ // echo "Updating table ..."; $_REQUEST['intent'] = ''; $ip = $_SERVER['REMOTE_ADDR']; $nouvel_etat = $_REQUEST['nouvel_etat']; $id_commande = $_REQUEST['id_commande']; $id_etape = $_REQUEST['id_etape']; $sql = "insert into commande_etapes_production (id_commande, id_etape, etat, date_changement, ip) values ('$id_commande','$id_etape','$nouvel_etat',NOW(),'$ip')"; //nestage if($id_etape == '2'){ //update tab1, tab2 set tab1.name=tab2.name,// tab2.name=tab1.name where tab1.id=tab2.id $id_nesteur = $_REQUEST['nesteur']; $sqlt = "update commandes set id_nesteur = '$id_nesteur' where id_commande = '$id_commande'"; mysql_query($sqlt) or die(mysql_error()); // echo $sqlt; } // installation if($id_etape == '8'){ $id_installeur = $_REQUEST['installeur']; $sqlt = "update commandes set id_installeur = '$id_installeur' where id_commande = '$id_commande'"; mysql_query($sqlt) or die(mysql_error()); } mysql_query($sql) or die(mysql_error());}?><div style="margin-left:30px;"><?// get css for our table state.echo get_state_styles();// Stuff for table styles.$directory = "css_tables";$dirlist = dirList($directory);echo "<h4 style=\"color:#FFFFFF;margin-top:-0px;\">Choisir un style:</h4>";echo "<form name=\"styleswitch\">";echo "<select name=\"style_select\" onChange=\"go()\">";foreach($dirlist as $key => $value){ if($_REQUEST['user_style'] == substr($value,0,-4)) { $select = " selected"; }else{ $select = ""; } echo "<option value=\"".substr($value,0,-4)."\" ".$select.">".substr($value,0,-4)."</option>";}echo "</select>";echo "</form>";?></div><div style="width:100%;padding-top:30px;"><table class="" id="itsthetable" style="margin-left:auto;margin-right:auto;border:solid;" align="center" border="1"><tr valign="bottom" style="font-size:1.2em;"> <!-- Ligne 1 - 5 --> <th class="vertical">V<br />e<br />n<br />d<br />e<br />u<br />r</th> <th>Contrat</th> <th>Client</th> <th style="width:20px;padding:5px;text-align:bottom;">C<br>u<br>i<br>s<br>i<br>n<br>e</th> <th class="vertical">M<br />a<br />t<br />é<br />r<br />i<br />e<br />l</th> <!-- Ligne 5 - 10 --> <th class="vertical">V<br />a<br />n<br />i<br />t<br /> é <br /><span style="font-size:.6em;">(l)</span></th> <th class="vertical">M<br />a<br />t<br />e<br />r<br />i<br />e<br />l</th> <th class="vertical">V<br />a<br />n<br />i<br />t<br />é<br /><span style="font-size:.6em;">(2)</span></th> <th class="vertical">M<br />a<br />t<br />e<br />r<br />i<br />e<br />l</th> <th>Livraison</th> <th class="vertical">C<br>o<br>m<br>m<br>a<br>n<br>d<br>e</th> <th class="vertical">A<br>r<br>r<br>i<br>v<br>é</th> <th class="vertical">N<br>e<br>s<br>t<br>a<br>g<br>e</th> <th class="vertical">D<br>é<br>b<br>i<br>t<br>a<br>g<br>e</th> <th class="vertical">E<br>d<br>g<br>a<br>g<br>e</th> <th class="vertical">S<br>p<br>é<br>c<br>i<br>a<br>l</th> <th class="vertical">P<br>e<br>i<br>n<br>t<br>u<br>r<br>e</th> <th class="vertical">M<br>o<br>n<br>t<br>a<br>g<br>e</th> <th class="vertical">P<br>r<br>e<br>p<br>a<br>r<br>a<br>t<br>i<br>o<br>n</th> <th class="vertical">L<br>i<br>v<br>r<br>a<br>i<br>s<br>o<br>n</th> <th class="vertical">I<br>n<br>s<br>t<br>a<br>l<br>l<br>a<br>t<br>i<br>o<br>n</th> <th>S<br />e<br />r<br />v<br />i<br />c<br />e</th> <th>P<br />a<br />y<br />e<br />r</th> <th>Couleur/Teint.</th> <th>Prix</th></tr><?$sql = "SELECT * FROM client,commandes,representant WHERE client.id_client = commandes.id_client and commandes.id_vendeur = representant.id_vendeur";$result = mysql_query($sql) or die(mysql_error . "<br>sql = " . $sql);$sql_materiel = "select * from materiel order by id_materiel";$rez_materiel = mysql_query($sql_materiel) or die(mysql_error());while ($row_mat = mysql_fetch_row($rez_materiel)){ $id_mat = $row_mat[0]; $materiel[$id_mat] = $row_mat[2]; }// tout les contrats, while($row = mysql_fetch_row($result)){// echo "<br>";// var_dump($row);// echo "<br>"; $id_commande = $row[9]; $id_vendeur = $row[27]; $id_contrat = $row[13]; $mat_cuisine = $row[19]; $mat_van1 = $row[22]; $mat_van2 = $row[25]; $prix = $row[15];$sql1 = "select * from commande_etapes_production, etapes_production where id_commande = '$id_commande' and commande_etapes_production.id_etape = etapes_production.id_etape order by commande_etapes_production.date_changement desc";// les etapes de production ... $result1 = mysql_query($sql1) or die(mysql_error . "<br>sql1 = " . $sql1); // on sort toutes les etapes ... while($row1 = mysql_fetch_assoc($result1)){ //echo "<pre>"; //var_dump($row1); //echo "</pre>"; //exit; $etape = $row1['nom']; $id_etape = $row1['id_etape']; $etat = $row1['etat']; $state[$etape] = $etat; } // echo " = " . $sql1; echo "<pre>"; var_dump($state); echo "</pre>";// echo "<tr>"; // AFFICHAGE // TD Abbrev . vendeur abbrev_vendeur($row); // var_dump($row); // contrat echo case_contrat($id_commande,$id_contrat); // client echo "<td>".$row[1]. " " . $row[2]; if($row[3] != ""){ echo "<br>( " . $row[3]. ")</td>"; }else{ echo "</td>"; } // # de cuisine if($row[18] > 0){ echo "<td style=\"background-color:yellow;\">".$row[18]."</td>"; }else{ echo "<td></td>"; } // materiel cuisne if($row[19] != "Matériel"){ echo "<td>".$materiel[$mat_cuisine]."</td>"; }else{ echo "<td></td>"; } // vanite 1 if($row[21] == "on"){ echo "<td style=\"background-color:purple;\"></td>"; }else{ echo "<td></td>"; } // materiel vanite 1 if($row[22] != "Matériel"){ echo "<td>".$materiel[$mat_van1]."</td>"; }else{ echo "<td></td>"; } // vanite 2 if($row[24] == "on"){ echo "<td style=\"background-color:purple;\"></td>"; }else{ echo "<td></td>"; } // materiel vanité 2 if($row[25] != "Matériel"){ echo "<td>".$materiel[$mat_van2]."</td>"; }else{ echo "<td></td>"; } // date de livraison $date_installation = $row[17]; //format the date for mktime() function -- you need day, month, year $year = substr($date_installation, 0,4); $month = substr($date_installation, 5, 2); $day = substr($date_installation, 8, 2); $jour = date("D", mktime(0, 0, 0, $month, $day, $year)); $mois = date("F", mktime(0, 0, 0, $month, $day, $year)); $jour = getJour($jour); $mois = getMois($mois); $ladate = $jour . ", " . $day . " " . $mois; // $new_date = date("D, Y-m-d", mktime(0, 0, 0, $month, $day, $year)); echo "<td>".$ladate."</td>"; // echo "id_commande = " .$id_commande; // etape commande ... // Get current state of commande, for this job echo "<td class=\"etat_".$state['commande']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=1&id_commande=".$id_commande."&height=360&width=400'); return false;\">"; echo "</td>"; // etape stock_en_main ... // Get current state of commande, for this job echo "<td class=\"etat_".$state['stock_en_main']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=12&id_commande=".$id_commande."&height=360&width=400'); return false;\">"; // etape nestage ... // Get current state of commande, for this job // -> $sqlz = "select nesteur.id_nesteur, nesteur.nom, nesteur.abbrev from commandes, nesteur where id_commande = '$id_commande' and nesteur.id_nesteur = commandes.id_nesteur"; $rezz = mysql_query($sqlz); $rowz = mysql_fetch_assoc($rezz); if($rowz['id_nesteur'] > 1){ $html_nesteur = $rowz['abbrev']; }else{ $html_nesteur = ""; } echo "<td class=\"etat_".$state['nestage']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=2&id_commande=".$id_commande."&height=400&width=400'); return false;\">".$html_nesteur."</td>"; // etape débitage ... // Get current state of commande, for this job echo "<td class=\"etat_".$state['debitage']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=3&id_commande=".$id_commande."&height=360&width=400'); return false;\"></td>"; // etape edgage ... // Get current state of commande, for this job echo "<td class=\"etat_".$state['edgage']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=4&id_commande=".$id_commande."&height=360&width=400'); return false;\"></td>"; // etape special ... // Get current state of commande, for this job echo "<td class=\"etat_".$state['special']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=7&id_commande=".$id_commande."&height=360&width=400'); return false;\"></td>"; // etape peinture ... // Get current state of commande, for this job echo "<td class=\"etat_".$state['peinture']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=6&id_commande=".$id_commande."&height=360&width=400'); return false;\"></td>"; // etape montage ... // Get current state of commande, for this job echo "<td class=\"etat_".$state['montage']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=5&id_commande=".$id_commande."&height=360&width=400'); return false;\"></td>"; // etape preparation echo "<td class=\"etat_".$state['preparation']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=13&id_commande=".$id_commande."&height=360&width=400'); return false;\"></td>"; // etape livraison echo "<td class=\"etat_".$state['livraison']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=9&id_commande=".$id_commande."&height=360&width=400'); return false;\"></td>"; // etape installation $sqlv = "select installeur.id_installeur, installeur.nom, installeur.abbrev from commandes, installeur where id_commande = '$id_commande' and installeur.id_installeur = commandes.id_installeur"; $rezv = mysql_query($sqlv); $rowv = mysql_fetch_assoc($rezv); if($rowv['id_installeur'] > 1){ $html_installation = $rowv['abbrev']; }else{ $html_installation = ""; } echo "<td class=\"etat_".$state['installation']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=8&id_commande=".$id_commande."&height=360&width=400'); return false;\">".$html_installation."</td>"; // etape service echo "<td class=\"etat_".$state['service']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=10&id_commande=".$id_commande."&height=360&width=400'); return false;\">"; // etape paiement echo "<td class=\"etat_".$state['paiement']."\" onClick=\"javascript:tb_show(this.innerHTML,'includes/change_etape.php?id_etape=11&id_commande=".$id_commande."&height=360&width=400'); return false;\">"; // couleurs echo "<td>"; if($row[20] !=""){ echo "<a href=\"#\" onclick=\"javascript:alert('Couleur pour cuisine de la commande " .$id_contrat .": ".$row[20]."')\">Cuisine</a><br>"; } if($row[23] !=""){ echo "<a href=\"#\" onclick=\"javascript:alert('Couleur pour vanité 1 de la commande " .$id_contrat . ": " .$row[23]. "')\">Van 1</a> "; } if($row[26] !=""){ echo "<a href=\"#\" onclick=\"javascript:alert('Couleur pour la vanité 2 de la commande " .$id_contrat .": ".$row[26]."')\">Van 2</a> "; } echo "</td>"; echo "<td>".$prix."</td>"; echo "</tr>";}?></table></div><?//var_dump($state);// function that returns list of styles in directoryfunction dirList ($directory) { // create an array to hold directory list $results = array(); // create a handler for the directory $handler = opendir($directory); // keep going until all files in directory have been read while ($file = readdir($handler)) { // if $file isn't this directory or its parent, // add it to the results array if ($file != '.' && $file != '..') $results[] = $file; } // tidy up: close the handler closedir($handler); // done! return $results;}?><script type="text/javascript">function go(){ box = document.forms[0].style_select; user_style = box.options[box.selectedIndex].value; location.href = "horaire.php?user_style=" + user_style;}</script></body></html><?// function that returns the .css for the state of our tasks.function get_state_styles(){ $sql = "select * from codecouleur;"; $result = mysql_query($sql); $html = "<style type=\"text/css\">"; while($row = mysql_fetch_row($result)){ $etat = $row[0]; $color = $row[1]; $html .= "td.etat_" . $etat . "{"; $html .= "background-color: #" . $color . ";"; $html .= "}"; } $html .= "</style>"; return $html; }// case 1 - abbrev vendeurfunction abbrev_vendeur($row ){ $color = $row[32]; echo "<td style=\"background-color:#".$color."\">".$row[29]."</td>"; }// case contratfunction case_contrat($id_commande,$id_contrat){ $html = "<td><a class=\"thickbox\" href=\"includes/etat_production.php?id_contrat=".$id_contrat."&id_commande=".$id_commande."&keepThis=true&TB_iframe=true&height=640&width=500\">".$id_contrat."</a></td>"; return $html;}function getJour($day) { $jour["Mon"] = "Lun";$jour["Tue"] = "Mar";$jour["Wed"] = "Mer";$jour["Thu"] = "Jeu";$jour["Fri"] = "Ven";$jour["Sat"] = "Sam";$jour["Sun"] = "Dim"; return $jour[$day];}function getMois($month){$mois["January"] = "Jan.";$mois["Febrary"] = "Fév.";$mois["March"] = "Mars";$mois["April"] = "Avril";$mois["May"] = "Mai";$mois["June"] = "Juin";$mois["July"] = "Jui.";$mois["August"] = "Août";$mois["September"] = "Sept.";$mois["October"] = "Oct.";$mois["November"] = "Nov.";$mois["December"] = "Déc.";return $mois[$month];}?>