← Back
Editing: prezzi_ed.php
<?php #______________________________________________________________________# ### made with SmaDIB: Smart Database Interface Builder 0.4.0 ### ### by Smartmedia 2000 http://www.smartmedia2000.it/ ### ### info email: smadib@smartmedia2000.it ### ###___###___###___###___###____###____###____###___###___###___###___### require_once ("../funct.php"); require_once ("../lan_it.php"); require_once ("sess.php"); require_once ("conn.php"); $ptitolo = "Prezzi"; $table = "prezzi"; $parole = array ('Listino Prezzi', array ('','Prezzo Giornaliero a Persona','Prezzo Giornaliero','Prezzo Settimanale a Persona','Prezzo Settimanale', 'Prezzo Weekend a Persona', 'Prezzo Weekend'), 'Nome', 'Tipologia', 'N?Letti', 'Incluso', 'Prezzo unico', 'Bassa', 'Media', 'Alta', 'Altissima', 'Stagione', array ('','Camera singola','Camera doppia uso singola','Supp. doppia uso singola','Camera doppia','Camera tripla','Camera quadrupla','Monolocale','Bilocale','Trilocale','Quadrilocale','Appartamento','Casa Indipendente','Villa','Suite','Bungalow','Casa mobile','Extra'), array ('','OB solo pernottamento','BB pernottamento e colazione','HB mezza pensione','FB pensione completa'), 'Stagioni', 'CONDIZIONI DI PRENOTAZIONE', 'Arrivo', 'Partenza', 'Soggiorno Minimo', 'Il prezzo comprende', 'Il prezzo non comprende', 'Modalit? di pagamento', 'Cancellazione', 'Cauzione', 'Carte di credito', 'NOTE', ''); $pNome = 16; $stag = array ($parole[6],'A','B','C','D','E','F','G','H','I','J', array ('Min','Max'), array ($parole[7],$parole[9]), array ($parole[7],$parole[8],$parole[9]), array ($parole[7],$parole[8],$parole[9],$parole[10]) ); $numStag = array ('', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '2', '2', '3', '4'); $jScript = "controllo()"; require_once ("testacoda.php"); $query = new doQuery(); $id_listino = $_REQUEST['id_listino']; $tipologia = $_REQUEST['tipologia']; $n_letti = $_REQUEST['n_letti']; $incluso = $_REQUEST['incluso']; $A_pr = $_REQUEST['A_pr']; $B_pr = $_REQUEST['B_pr']; $C_pr = $_REQUEST['C_pr']; $D_pr = $_REQUEST['D_pr']; $E_pr = $_REQUEST['E_pr']; $F_pr = $_REQUEST['F_pr']; $G_pr = $_REQUEST['G_pr']; $H_pr = $_REQUEST['H_pr']; $I_pr = $_REQUEST['I_pr']; $J_pr = $_REQUEST['J_pr']; $novuoto = array('tipologia', 'n_letti'); $ordine = $_REQUEST['ordine']; $ordineOld = $_REQUEST['ordineOld']; $id_listino_id = array (); $id_listino_tipo_pr = array (); $id_listino_tipo = array (); $id_listino_anno = array (); $id_listino_fine = array (); $id_listino_numero = array (); $id_listino_nome = array (); $arNumero = array ('','Prezzo unico','2 Stagioni','3 Stagioni','4 Stagioni','5 Stagioni','6 Stagioni','7 Stagioni','8 Stagioni','9 Stagioni','10 Stagioni','Min - Max','Bassa/Alta','Bassa/Media/Alta','Bassa/Media/Alta/Altiss.'); $arTipoPr = $PREZZO_B; $arTipo = $TIPO_LIST_B; $arNomi = $NOMI_B; $arCateg = $TIPO_PREZZI_B; $ordAr = array (); # array per ultimo numero di ordine di tutti i listini prezzi if ($op == "ord") { $rows = $query->freeQuery ("SELECT `id`, `ordine` FROM `$table` WHERE `id_listino`='$id_listino' ORDER BY `ordine` ASC, `id` ASC", 0); foreach ($rows as $i=>$row0) $query->freeQuery ("UPDATE `$table` SET `ordine`='".($i+1)."' WHERE `id`=".$row0->id, 0); } $prezzi_id = array (0); $prezzi_ordine = array (1000); $sql = "SELECT `id`, `ordine` FROM `$table` WHERE `id_utente` = $id_utente AND `id_listino` = '$id_listino' ORDER BY `ordine`, `id` ASC"; $rowsO = $query->freeQuery ($sql, 0); foreach ($rowsO as $n=>$rowO) { array_push ($prezzi_id, $rowO->id); array_push ($prezzi_ordine, $rowO->ordine); $maxOrd = $rowO->ordine; } $posOrd = array_search ($ordine, $prezzi_ordine); if ($posOrd == "") $posOrd = count($prezzi_ordine); if ($ordine == "") $ordine = $maxOrd+1; $rowsL = $query->freeQuery ("SELECT `listini`.`id`, `listini`.`tipo`, `listini`.`tipo_pr`, `anno`, DATE_FORMAT(`stagioni`.`fine`, '%d/%m/%y') AS `fine`, `stagioni`.`nome_it` AS `nome`, `stagioni`.`numero` FROM `listini`, `stagioni` WHERE `stagioni`.`id`=`listini`.`id_stagione` AND `listini`.`id_utente`=$id_utente ORDER BY `anno` DESC, `id_stagione`, `tipo`, `tipo_pr`", 0); foreach ($rowsL as $n=>$rowL) { $id_listino_id[] = $rowL->id; $id_listino_tipo[] = $arTipo[$rowL->tipo]; $id_listino_tipo_pr[] = $arTipoPr[$rowL->tipo_pr]; $id_listino_anno[] = $rowL->anno; $id_listino_fine[] = $rowL->fine; $id_listino_numero[] = $rowL->numero; $id_listino_nome[] = $rowL->nome; } if ($az=="canc") { $query->delete (); for ($i=$posOrd; $i<count($prezzi_ordine); $i++) { $sql = "UPDATE `$table` SET `ordine` = ".($prezzi_ordine[$i]-1)." WHERE `id` = ".$prezzi_id[$i]; $query->freeQuery ($sql, 0); } header("Location: ".$_SERVER['PHP_SELF']); } if ($op == "ds") { $sql = "INSERT INTO `$table` (`id_utente`,`id_listino`, `nome_it`, `nome_en`, `nome_de`,`nome_fr`, `nome_es`, `nome_ne`, `nome_sv`, `nome_hu`, `tipologia`,`n_letti`, `incluso`, `A_pr`,`B_pr`, `C_pr`,`D_pr`, `E_pr`, `F_pr`,`G_pr`,`H_pr`,`I_pr`, `J_pr`, `ordine`) VALUES ($id_utente, '$id_listino', '$nome_it','$nome_en','$nome_de','$nome_fr', '$nome_es', '$nome_ne', '$nome_sv', '$nome_hu', '$tipologia', '$n_letti', '$incluso', '".str_replace (',', '.', $A_pr)."','".str_replace (',', '.',$B_pr)."','".str_replace (',', '.',$C_pr)."', '$D_pr', '$E_pr', '$F_pr', '$G_pr', '$H_pr', '$I_pr', '$J_pr', '$ordine')"; $query->freeQuery ($sql, 0); for ($i=$posOrd; $i<count($prezzi_ordine); $i++) $query->freeQuery ("UPDATE `$table` SET `ordine` = ".($prezzi_ordine[$i]+1)." WHERE `id` = ".$prezzi_id[$i], 0); } else if ($op == "up") { $sql = "UPDATE `$table` SET `id_listino`='$id_listino', `nome_it`='$nome_it', `nome_en`='$nome_en',`nome_de`='$nome_de', `nome_fr`='$nome_fr', `nome_es`='$nome_es', `nome_ne`='$nome_ne', `nome_sv`='$nome_sv', `tipologia`='$tipologia', `n_letti`='$n_letti', `incluso`='$incluso', `A_pr`='$A_pr', `B_pr`='$B_pr', `C_pr`='$C_pr', `D_pr`='$D_pr', `E_pr`='$E_pr', `F_pr`='$F_pr', `G_pr`='$G_pr', `H_pr`='$H_pr', `I_pr`='$I_pr',`J_pr`='$J_pr', `ordine`='$ordine' WHERE id=$id LIMIT 1"; $query->freeQuery ($sql, 0); if ($ordine >= $ordineOld) { $nn = -1; $posOrd = array_search ($ordineOld+1, $prezzi_ordine); $limO = $ordine+1; } else { $nn = 1; $limO = $ordineOld; } if ($ordine != $ordineOld) for ($i=$posOrd; $i<$limO; $i++) { $sql = "UPDATE `$table` SET `ordine` = ".($prezzi_ordine[$i]+$nn)." WHERE `id` = ".$prezzi_id[$i]; if ($prezzi_id[$i] != $id) $query->freeQuery ($sql, 0); } } if ($az=="ed") { $row = $query->selectById (1); $id = $row['id']; $ordine = $row['ordine']; $rowL = $query->freequery ("SELECT * FROM `listini` WHERE `id` = ".$row['id_listino'], 0); $valop = "up"; $id_listino0 = array_search($row['id_listino'],$id_listino_id); $id_listinosel[$id_listino0] = "selected"; $primoTpN = $row['tipologia']; $primoTp = $arNomi[$rowL[0]->tipo][$primoTpN]; $primoTpCN = $row['incluso']; $primoTpC = $arCateg[$rowL[0]->tipo][$primoTpCN]; } else { $valop = "ds"; if ($id_listino > 0) { $id_listino0 = array_search($id_listino, $id_listino_id); $id_listinosel[$id_listino0] = "selected"; } else { $id_listino0 = array_search(0, $id_listino_id); $id_listinosel[$id_listino0] = "selected"; } } $elenco.= "<tr bgcolor=\"white\"> <td colspan=\"4\" align=\"center\"> <select name=\"id_listino\" onchange=\"javascript:controllo();\">\n"; for ($s=0;$s<count($id_listino_id);$s++) $elenco.= "<option value=\"".$id_listino_id[$s]."\" ".$id_listinosel[$s].">".$id_listino_anno[$s]." scad.".$id_listino_fine[$s]." ".$id_listino_nome[$s]." ".$arNumero[$id_listino_numero[$s]]." ".$id_listino_tipo[$s]." ".$id_listino_tipo_pr[$s]."</option>\n"; $elenco.= "</select></td> </tr><tr bgcolor=\"white\"> <td colspan=\"2\" width=\"50%\"><b>Tipologia prezzo</b></td> <td width=\"50%\"><b><div id=\"classifNm\">Classificazione</div></b></td> <td><b>Ordine</b></td> </tr><tr bgcolor=\"#EEEEEE\"> <td colspan=\"2\" width=\"50%\"> <select name=\"tipologia\" onchange=\"javascript:extra();\"> <qption value=\"\"></qption> </select></td> <td width=\"50%\"><div id=\"classif\"> <select name=\"incluso\"> <qption value=\"\"></qption> </select></div></td> <td><input name=\"ordine\" type=\"text\" size=\"2\" value=\"$ordine\"></td> </tr><tr bgcolor=\"white\"> <td colspan=\"4\"><div id=\"nomi\"> <table width=\"100%\"><tr bgcolor=\"white\">\n"; for ($i=0; $i<count($lingue); $i++) $elenco.= "<td><b>Nome ".$nomiLng[$lingue[$i]]."</b></td>\n"; $elenco.= "</tr><tr>"; for ($i=0; $i<count($lingue); $i++) { $k = array_search ($lingue[$i], $sigLng); $elenco.= "<td><input name=\"nome_".$lingue[$i]."\" type=\"text\" size=\"25\" maxlenght=\"\" value=\"".$row[$k+16]."\"></td>\n"; } $elenco.= "</tr></table></div> </td></tr> <tr><td colspan=\"4\"> <table width=100%><tr bgcolor=\"white\"> <td width=\"10%\"><b><span id=\"nomeA\">_ </span></b></td> <td width=\"10%\"><b><span id=\"nomeB\">_ </span></b></td> <td width=\"10%\"><b><span id=\"nomeC\">_ </span></b></td> <td width=\"10%\"><b><span id=\"nomeD\">_ </span></b></td> <td width=\"10%\"><b><span id=\"nomeE\">_ </span></b></td> <td width=\"10%\"><b><span id=\"nomeF\">_ </span></b></td> <td width=\"10%\"><b><span id=\"nomeG\">_ </span></b></td> <td width=\"10%\"><b><span id=\"nomeH\">_ </span></b></td> <td width=\"10%\"><b><span id=\"nomeI\">_ </span></b></td> <td width=\"10%\"><b><span id=\"nomeJ\">_ </span></b></td> </tr><tr bgcolor=\"#EEEEEE\"> <td width=\"10%\"><span id=\"fA\" style=\"visibility:visible;position:relative;top:0;left:0\"><input name=\"A_pr\" type=\"text\" size=\"5\" maxlenght=\"\" value=\"".$row['A_pr']."\"></span></td> <td width=\"10%\"><span id=\"fB\" style=\"visibility:hidden;position:relative;top:0;left:0\"><input name=\"B_pr\" type=\"text\" size=\"5\" maxlenght=\"\" value=\"".$row['B_pr']."\"></span></td> <td width=\"10%\"><span id=\"fC\" style=\"visibility:hidden;position:relative;top:0;left:0\"><input name=\"C_pr\" type=\"text\" size=\"5\" maxlenght=\"\" value=\"".$row['C_pr']."\"></span></td> <td width=\"10%\"><span id=\"fD\" style=\"visibility:hidden;position:relative;top:0;left:0\"><input name=\"D_pr\" type=\"text\" size=\"5\" maxlenght=\"\" value=\"".$row['D_pr']."\"></span></td> <td width=\"10%\"><span id=\"fE\" style=\"visibility:hidden;position:relative;top:0;left:0\"><input name=\"E_pr\" type=\"text\" size=\"5\" maxlenght=\"\" value=\"".$row['E_pr']."\"></span></td> <td width=\"10%\"><span id=\"fF\" style=\"visibility:hidden;position:relative;top:0;left:0\"><input name=\"F_pr\" type=\"text\" size=\"5\" maxlenght=\"\" value=\"".$row['F_pr']."\"></span></td> <td width=\"10%\"><span id=\"fG\" style=\"visibility:hidden;position:relative;top:0;left:0\"><input name=\"G_pr\" type=\"text\" size=\"5\" maxlenght=\"\" value=\"".$row['G_pr']."\"></span></td> <td width=\"10%\"><span id=\"fH\" style=\"visibility:hidden;position:relative;top:0;left:0\"><input name=\"H_pr\" type=\"text\" size=\"5\" maxlenght=\"\" value=\"".$row['H_pr']."\"></span></td> <td width=\"10%\"><span id=\"fI\" style=\"visibility:hidden;position:relative;top:0;left:0\"><input name=\"I_pr\" type=\"text\" size=\"5\" maxlenght=\"\" value=\"".$row['I_pr']."\"></span></td> <td width=\"10%\"><span id=\"fJ\" style=\"visibility:hidden;position:relative;top:0;left:0\"><input name=\"J_pr\" type=\"text\" size=\"5\" maxlenght=\"\" value=\"".$row['J_pr']."\"></span></td></tr></table></td> </tr><tr bgcolor=\"white\"> <td colspan=\"4\" align=\"center\"><input type=\"submit\" name=\"invio\" value=\"$intesta\"> $noMod <input type=\"hidden\" name=\"numero\"> <input type=\"hidden\" name=\"tipol\"> <input type=\"hidden\" name=\"id\" value=\"$id\"> <input type=\"hidden\" name=\"ordineOld\" value=\"$ordine\" /> </td> </tr><tr> <td colspan=\"4\" bgcolor=\"black\" height=\"4\"> <input type=\"hidden\" name=\"op\" value=\"$valop\"> </tr><tr>\n"; $rows = $query->SelectAll ($table, array ('ordine'=>'ASC'), 0); foreach ($rows AS $cc=>$row) { $row->B_pr == "0.00" ? $Bpr="" : $Bpr=$row->B_pr; $row->C_pr == "0.00" ? $Cpr="" : $Cpr=$row->C_pr; $row->D_pr == "0.00" ? $Dpr="" : $Dpr=$row->D_pr; $row->E_pr == "0.00" ? $Epr="" : $Epr=$row->E_pr; $row->F_pr == "0.00" ? $Fpr="" : $Fpr=$row->F_pr; $row->G_pr == "0.00" ? $Gpr="" : $Gpr=$row->G_pr; $row->H_pr == "0.00" ? $Hpr="" : $Hpr=$row->H_pr; $row->I_pr == "0.00" ? $Ipr="" : $Ipr=$row->I_pr; $row->J_pr == "0.00" ? $Jpr="" : $Jpr=$row->J_pr; $cc++; $bgcolor = fmod ($cc, 2) ? $coldisp : $colpari; $id_listino = array_search($row->id_listino,$id_listino_id); $id_listinosel[$id_listino] = "selected"; $tipologia = $row->tipologia; $tipologiasel[$tipologia] = "selected"; $incluso = $row->incluso; $inclusosel[$incluso] = "selected"; } for ($n=0;$n<count ($id_listino_id);$n++) $caseNum.= " case '".$id_listino_id[$n]."': frm.numero.value = ".$id_listino_numero[$n]."; break;\n"; echo "$testa <h2 align=\"center\">$ptitolo</h2> <form name=\"form1\" method=\"post\" action=\"".$_SERVER['PHP_SELF']."\" > <table align=\"center\"> $elenco </table></form>\n"; //$sql3 = "SELECT `arrivo_it` AS arrivo , `partenza_it` AS partenza , `sogg_minimo_it` AS sogg_minimo , `comprende_it` AS comprende , `non_comprende_it` AS non_comprende , `pagamento_it` AS pagamento , `cancellazione_it` AS cancellazione , `cauzione_it` AS cauzione , `carte_it` AS carte , `note_it` AS note FROM `condizioni` WHERE `id_utente` = ".$id_utente; //$ris3 = mysql_query ($sql3,$conn) or die($sql3.": ".mysql_error()); //$row3 = mysql_fetch_object($ris3); $sql = "SELECT `stagioni`.`id`, `anno`, DATE_FORMAT(fine, '%d/%m/%Y') AS fine, `numero`, `testo_it` AS `testo`, `stagioni`.`nome_it` AS `nome`, `listini`.`tipo`, `listini`.`id` as `idListino` FROM `stagioni`, `listini` WHERE `stagioni`.`id_utente` = $id_utente AND `listini`.`id_stagione` = `stagioni`.`id` ORDER BY `anno` DESC, `stagioni`.`id` ASC"; $rows = $query->freeQuery ($sql, 0); foreach ($rows as $n=>$row) { $elencoPr.= "<div id=\"listino".$row->idListino."\" align=\"center\"><font face=\"Verdana<\" size=\"2\" color=\"#3E301E\"><b>".$parole[0]." anno ".$row->anno." ".$arTipo[$row->tipo]."</b> (scadenza ".$row->fine.")</font></p> <table cellspacing=\"1\" cellpadding=\"2\" width=\"100%\" align=\"center\">"; $sql2 = "SELECT `prezzi`.*, `prezzi`.`id` AS `prId`, `listini`.`id`, `listini`.`id_stagione`, `listini`.`tipo_pr`, `listini`.`tipo` FROM `prezzi`,`listini`,`stagioni` WHERE `listini`.`id` = ".$row->idListino." AND `prezzi`.`id_listino` = `listini`.`id` AND `listini`.`id_stagione` = `stagioni`.`id` AND `prezzi`.`id_utente` = $id_utente ORDER BY `ordine` ASC"; $rows2 = $query->freeQuery ($sql2, 1); $tpold = ""; foreach ($rows2 as $n=>$row2) { if ($row2['tipo_pr'] != $tpold) { # etichetta eventuale nome della stagione if ($row->nome != "") $elencoPr.= " <tr> <td align=\"center\" colspan=\"14\"><b> <font face=\"Verdana\" size=\"2\" color=\"#9A3400\">".$row->nome."</font></b></td> </tr>\n"; # etichetta prezzo giorrnaliero / settimanale / ... if ($row2['tipo_pr'] > 1) $elencoPr.= " <tr> <td colspan=\"7\"><b> <font face=\"Verdana\" size=\"2\" color=\"#9A3400\">".$arTipoPr[$row2['tipo_pr']]."</font></b></td> </tr>\n"; $elencoPr.= " <tr><td> funzioni </td> <td bgColor=\"#D8C7B1\"><font face=\"Verdana\" size=\"1\"> <div align=\"center\"><b>Nome Tipologia Prezzi / Categoria</b></div></font></td>\n"; if ($row->numero == 1) $elencoPr.= " <td bgColor=\"#D8C7B1\"><font face=\"Verdana\" size=\"1\"> <div align=\"center\"><b>".$stag[$row->numero][0]."</b></div></font></td>\n"; else if ($row->numero <= 10) for ($i=1;$i<=$row->numero;$i++) $elencoPr.= " <td bgColor=\"#D8C7B1\"><font face=\"Verdana\" size=\"1\"> <div align=\"center\"><b>".$stag[$i]."</b></div></font></td>\n"; else for ($i=0;$i<$numStag[$row->numero];$i++) $elencoPr.= " <td bgColor=\"#D8C7B1\"><font face=\"Verdana\" size=\"1\"> <div align=\"center\"><b>".$stag[$row->numero][$i]."</b></div></font></td>\n"; $elencoPr.= " <td bgColor=\"#D8C7B1\">ord</td></tr></tr>\n"; } $nomeTipo = $row2['nome_it'] != "" ? $row2['nome_it'] : $arNomi[$row2['tipo']][$row2['tipologia']]; //eco($row2['tipo']);eco($row2['tipoligia']); if ($row2['incluso']) $nomeTipo.= " / ".$arCateg[$row2['tipo']][$row2['incluso']]; $elencoPr.= " <tr> <td bgcolor=\"white\" width=\"65\"><a href=\"".$_SERVER['PHP_SELF']."?id={$row2['prId']}&az=ed\"><img src=\"images/edit.gif\" border=\"0\" hspace=\"3\" title=\"modifica riga\"></a> <a href=\"#\" onclick=\"javascript:confDel(".$row2['prId'].")\"><img src=\"images/delete.gif\" border=\"0\" title=\"cancella riga\"></a></td> <td bgColor=\"#F5F4EB\"><font face=\"Verdana\" size=\"1\"> <div align=\"center\">".$nomeTipo."</div></font></td>\n"; for ($i=0;$i<$numStag[$row->numero];$i++) $elencoPr.= " <td bgColor=\"#F5F4EB\"><font face=\"Verdana\" size=\"1\"> <div align=\"center\">€ ".$row2[6+$i]."</div></font></td>\n"; $elencoPr.= " <td>".$row2['ordine']."</td></tr>\n"; $tpold = $row2['tipo_pr']; $ordAr[$row->idListino] = $row2['ordine']+1; } if ($ordAr[$row->idListino] == "") $ordAr[$row->idListino] = 1; $sqlP = "SELECT `periodo`, DATE_FORMAT(`data_in`, '%d.%m.%y') AS `data_in2`, DATE_FORMAT(`data_fi`, '%d.%m.%y') AS `data_fi2` FROM `periodi`, `listini`, `stagioni` WHERE `periodi`.`id_utente`= ".$id_utente." AND`listini`.`id` = ".$row->idListino." AND `periodi`.`id_stagione` = ".$row->id." AND `listini`.`id_stagione` = `stagioni`.`id` ORDER BY `periodo` ASC, `data_in` ASC"; $rowP = $query->freeQuery ($sqlP, 0); $elencoPr.= "</table> <p align=\"center\"><b>Stagioni</b></p> <table cellSpacing=\"1\" cellPadding=\"2\" width=\"100%\" border=\"0\">\n"; for ($rP=0; $rP<count($rowP); $rP++) { if ($rowP[$rP]->periodo != $perold || $perold == "") { if ($rowP[$rP]->periodo == 0 || $rowP[$rP]->periodo == 11 || $rowP[$rP]->periodo == 12) $elencoPr.= " <tr><td valign=\"top\"><b>".$PERIODO[$rowP[$rP]->periodo]."</b>: </td><td width=\"75%\">"; else if ($rowP[$rP]->periodo <= 10) $elencoPr.= " <tr><td valign=\"top\"><b>".STAGIONE." ".$PERIODO[$rowP[$rP]->periodo]."</b>: </td><td width=\"75%\">\n"; else $elencoPr.= " <tr><td valign=\"top\"><b>".$PERIODO[$rowP[$rP]->periodo]." ".STAGIONE."</b>: </td><td width=\"75%\">\n"; $rc = 1; } else { if (fmod ($rc, 3)) $elencoPr.= "; "; else $elencoPr.= "<br />"; $rc++; } if (substr ($rowP[$rP]->data_in2, 6, 2) == substr ($anno, 2, 2)) $dataIn = substr ($rowP[$rP]->data_in2, 0, 5); else $dataIn = $rowP[$rP]->data_in2; if (substr ($rowP[$rP]->data_fi2, 6, 2) == substr ($anno, 2, 2)) $dataFi = substr ($rowP[$rP]->data_fi2, 0, 5); else $dataFi = $rowP[$rP]->data_fi2; $elencoPr.= $dataIn." - ".$dataFi; $perold = $rowP[$rP]->periodo; } $elencoPr.= " </td></tr> <tr> <td colspan=\"2\" align=\"left\">".$row->testo."</td> </tr> </table> </div>\n"; } echo $elencoPr; $elencoJs = "<script language=\"javascript\" type=\"text/javascript\" > var isIE = document.all?true:false; var isDOM = document.getElementById?true:false; var isNS4 = document.layers?true:false;\n\n"; #costruzione liste select $varSel = ""; $varSelN = ""; Foreach ($arTipo as $num=>$nmT) { $varSel.= "var ".str_replace (' ', '_', $nmT)." = new Array ('$primoTp',"; $varSelN.= "var ".str_replace (' ', '_', $nmT)."N = new Array ('$primoTpN',"; foreach ($arNomi[$num] as $i=>$v) { $varSel.= "'$v',"; $varSelN.= "'$i',"; } $varSel.= "'Extra');\n"; $varSelN.= "'100');\n"; } $elencoJs.= $varSel; $elencoJs.= $varSelN; $varSel = ""; $varSelN = ""; Foreach ($arTipo as $num=>$nmT) { $varSel.= "var ".str_replace (' ', '_', $nmT)."C = new Array ('',"; $varSelN.= "var ".str_replace (' ', '_', $nmT)."CN = new Array ('',"; if (count ($arCateg[$num])) foreach ($arCateg[$num] as $i=>$v) { $varSel.= "'$v',"; $varSelN.= "'$i',"; } $varSel = rtrim ($varSel, ',').");\n"; $varSelN = rtrim ($varSelN, ',').");\n"; } for ($i=0; $i<count ($id_listino_id); $i++)//{ $elencoJsDN.= "document.getElementById('listino".$id_listino_id[$i]."').style.display='none';\n"; //eco($i);}eco($id_listino_id); $elencoJs.= $varSel. $varSelN. $elencoJsDN; $elencoJs.= " document.getElementById('nomi').style.display='none'; document.getElementById('classif').style.display='none'; document.getElementById('classifNm').style.display='none'; function controllo() { var sel_listino = document.form1.id_listino; var sel_tipologia = document.form1.tipologia; var sel_incluso = document.form1.incluso var selected_listino = sel_listino.options[sel_listino.selectedIndex].value; sel_tipologia.options.length=0; sel_incluso.options.length=0;\n"; foreach ($id_listino_id as $n=>$v) $elencoJs.= " if (selected_listino == '$v') { document.forms.form1.ordine.value = ".$ordAr[$v]."; for(var i=0; i<".str_replace (' ', '_', $id_listino_tipo[$n]).".length; i++) sel_tipologia.options[sel_tipologia.options.length] = new Option(".str_replace (' ', '_', $id_listino_tipo[$n])."[i], ".str_replace (' ', '_', $id_listino_tipo[$n])."N[i]); for(var i=0; i<".str_replace (' ', '_', $id_listino_tipo[$n])."C.length; i++) sel_incluso.options[sel_incluso.options.length] = new Option(".str_replace (' ', '_', $id_listino_tipo[$n])."C[i], ".str_replace (' ', '_', $id_listino_tipo[$n])."CN[i]); if (".str_replace (' ', '_', $id_listino_tipo[$n])."C.length == 1) { document.getElementById('classif').style.display='none'; document.getElementById('classifNm').style.display='none'; } else { document.getElementById('classif').style.display='block'; document.getElementById('classifNm').style.display='block'; } }\n"; $elencoJs.= " $elencoJsDN document.getElementById('listino'+selected_listino).style.display='block'; document.getElementById('nomi').style.display='none'; var frm = document.form1; var nmA = document.getElementById('nomeA').lastChild; var nmB = document.getElementById('nomeB').lastChild; var nmC = document.getElementById('nomeC').lastChild; var nmD = document.getElementById('nomeD').lastChild; var nmE = document.getElementById('nomeE').lastChild; var nmF = document.getElementById('nomeF').lastChild; var nmG = document.getElementById('nomeG').lastChild; var nmH = document.getElementById('nomeH').lastChild; var nmI = document.getElementById('nomeI').lastChild; var nmJ = document.getElementById('nomeJ').lastChild; switch (frm.id_listino.value) { $caseNum } switch (frm.numero.value) { case '1': toggleT('fB','h'); toggleT('fC','h'); toggleT('fD','h'); toggleT('fE','h'); toggleT('fF','h'); toggleT('fG','h'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Prezzo unico'; nmB.nodeValue = ' '; nmC.nodeValue = ' '; nmD.nodeValue = ' '; nmE.nodeValue = ' '; nmF.nodeValue = ' '; nmG.nodeValue = ' '; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '2': toggleT('fB','s'); toggleT('fC','h'); toggleT('fD','h'); toggleT('fE','h'); toggleT('fF','h'); toggleT('fG','h'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Stag. A'; nmB.nodeValue = 'Stag. B'; nmC.nodeValue = ' '; nmD.nodeValue = ' '; nmE.nodeValue = ' '; nmF.nodeValue = ' '; nmG.nodeValue = ' '; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '3': toggleT('fB','s'); toggleT('fC','s'); toggleT('fD','h'); toggleT('fE','h'); toggleT('fF','h'); toggleT('fG','h'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Stag. A'; nmB.nodeValue = 'Stag. B'; nmC.nodeValue = 'Stag. C'; nmD.nodeValue = ' '; nmE.nodeValue = ' '; nmF.nodeValue = ' '; nmG.nodeValue = ' '; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '4': toggleT('fB','s'); toggleT('fC','s'); toggleT('fD','s'); toggleT('fE','h'); toggleT('fF','h'); toggleT('fG','h'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Stag. A'; nmB.nodeValue = 'Stag. B'; nmC.nodeValue = 'Stag. C'; nmD.nodeValue = 'Stag. D'; nmE.nodeValue = ' '; nmF.nodeValue = ' '; nmG.nodeValue = ' '; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '5': toggleT('fB','s'); toggleT('fC','s'); toggleT('fD','s'); toggleT('fE','s'); toggleT('fF','h'); toggleT('fG','h'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Stag. A'; nmB.nodeValue = 'Stag. B'; nmC.nodeValue = 'Stag. C'; nmD.nodeValue = 'Stag. D'; nmE.nodeValue = 'Stag. E'; nmF.nodeValue = ' '; nmG.nodeValue = ' '; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '6': toggleT('fB','s'); toggleT('fC','s'); toggleT('fD','s'); toggleT('fE','s'); toggleT('fF','s'); toggleT('fG','h'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Stag. A'; nmB.nodeValue = 'Stag. B'; nmC.nodeValue = 'Stag. C'; nmD.nodeValue = 'Stag. D'; nmE.nodeValue = 'Stag. E'; nmF.nodeValue = 'Stag. F'; nmG.nodeValue = ' '; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '7': toggleT('fB','s'); toggleT('fC','s'); toggleT('fD','s'); toggleT('fE','s'); toggleT('fF','s'); toggleT('fG','s'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Stag. A'; nmB.nodeValue = 'Stag. B'; nmC.nodeValue = 'Stag. C'; nmD.nodeValue = 'Stag. D'; nmE.nodeValue = 'Stag. E'; nmF.nodeValue = 'Stag. F'; nmG.nodeValue = 'Stag. G'; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '8': toggleT('fB','s'); toggleT('fC','s'); toggleT('fD','s'); toggleT('fE','s'); toggleT('fF','s'); toggleT('fG','s'); toggleT('fH','s'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Stag. A'; nmB.nodeValue = 'Stag. B'; nmC.nodeValue = 'Stag. C'; nmD.nodeValue = 'Stag. D'; nmE.nodeValue = 'Stag. E'; nmF.nodeValue = 'Stag. F'; nmG.nodeValue = 'Stag. G'; nmH.nodeValue = 'Stag. H'; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '9': toggleT('fB','s'); toggleT('fC','s'); toggleT('fD','s'); toggleT('fE','s'); toggleT('fF','s'); toggleT('fG','s'); toggleT('fH','s'); toggleT('fI','s'); toggleT('fJ','h'); nmA.nodeValue = 'Stag. A'; nmB.nodeValue = 'Stag. B'; nmC.nodeValue = 'Stag. C'; nmD.nodeValue = 'Stag. D'; nmE.nodeValue = 'Stag. E'; nmF.nodeValue = 'Stag. F'; nmG.nodeValue = 'Stag. G'; nmH.nodeValue = 'Stag. H'; nmI.nodeValue = 'Stag. I'; nmJ.nodeValue = ' '; break; case '10': toggleT('fB','s'); toggleT('fC','s'); toggleT('fD','s'); toggleT('fE','s'); toggleT('fF','s'); toggleT('fG','s'); toggleT('fH','s'); toggleT('fI','s'); toggleT('fJ','s'); nmA.nodeValue = 'Stag. A'; nmB.nodeValue = 'Stag. B'; nmC.nodeValue = 'Stag. C'; nmD.nodeValue = 'Stag. D'; nmE.nodeValue = 'Stag. E'; nmF.nodeValue = 'Stag. F'; nmG.nodeValue = 'Stag. G'; nmH.nodeValue = 'Stag. H'; nmI.nodeValue = 'Stag. I'; nmJ.nodeValue = 'Stag. J'; break; case '11': toggleT('fB','s'); toggleT('fC','h'); toggleT('fD','h'); toggleT('fE','h'); toggleT('fF','h'); toggleT('fG','h'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Min'; nmB.nodeValue = 'Max'; nmC.nodeValue = ' '; nmD.nodeValue = ' '; nmE.nodeValue = ' '; nmF.nodeValue = ' '; nmG.nodeValue = ' '; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '12': toggleT('fB','s'); toggleT('fC','h'); toggleT('fD','h'); toggleT('fE','h'); toggleT('fF','h'); toggleT('fG','h'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Bassa'; nmB.nodeValue = 'Alta'; nmC.nodeValue = ' '; nmD.nodeValue = ' '; nmE.nodeValue = ' '; nmF.nodeValue = ' '; nmG.nodeValue = ' '; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '13': toggleT('fB','s'); toggleT('fC','s'); toggleT('fD','h'); toggleT('fE','h'); toggleT('fF','h'); toggleT('fG','h'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Bassa'; nmB.nodeValue = 'Media'; nmC.nodeValue = 'Alta'; nmD.nodeValue = ' '; nmE.nodeValue = ' '; nmF.nodeValue = ' '; nmG.nodeValue = ' '; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; case '14': toggleT('fB','s'); toggleT('fC','s'); toggleT('fD','s'); toggleT('fE','h'); toggleT('fF','h'); toggleT('fG','h'); toggleT('fH','h'); toggleT('fI','h'); toggleT('fJ','h'); nmA.nodeValue = 'Bassa'; nmB.nodeValue = 'Media'; nmC.nodeValue = 'Alta'; nmD.nodeValue = 'Altissima'; nmE.nodeValue = ' '; nmF.nodeValue = ' '; nmG.nodeValue = ' '; nmH.nodeValue = ' '; nmI.nodeValue = ' '; nmJ.nodeValue = ' '; break; } } function toggleT(fld,atr) { if (isDOM) { if (atr=='s') document.getElementById(fld).style.visibility='visible'; if (atr=='h') document.getElementById(fld).style.visibility='hidden'; } else if (isIE) { if (atr=='s') eval(\"document.all.\"+fld+\".style.visibility='visible';\"); if (atr=='h') eval(\"document.all.\"+fld+\".style.visibility='hidden';\"); } else if(isNS4) { if (atr=='s') eval(\"document.layers['\"+fld+\"'].visibility='show';\"); if (atr=='h') eval(\"document.layers['\"+fld+\"'].visibility='hide';\"); } } function extra () { if (document.form1.tipologia.value == '100') document.getElementById('nomi').style.display='block'; else document.getElementById('nomi').style.display='none'; } </script>"; echo "$elencoJs $coda"; ?>
Save File
Cancel