CreaListaAnni() ; if ($_POST["anno"] != "") { $GLOBALS["anno"] = $_POST["anno"] ; $_SESSION["anno"] = $_POST["anno"] ; } if ($cliente != "") { $clienteRic = $cliente ; $whereCli = "C.Nome like '%$cliente%' and" ; } if ($agente != "" and $agente != "tutti") { $agenteRic = $agente ; $whereAge = "A.idagenti = $agente and" ; } if ($profilo == 3) $whereAge = " A.idAgenti != 1 and A.idAgenti != 5 and A.idAgenti != 9 and A.idAgenti != 10 and" ; if ($tot != "" and $tot != "tutti") { $totRic = $tot ; if ($tot == "zero") $havingTot = "having NumOrdini = 0" ; else $havingTot = "having NumOrdini > 0" ; } else $havingTot = "" ; if ($categoria != "" and $categoria != "tutti") { $categoriaRic = $categoria ; $whereCat = "T.idtipologie = $categoria and" ; } if ($piva != "") { $pivaRic = $piva ; $wherePIva = "C.piva like '%$piva%' and" ; } if ($codfis != "") { $codfiscRic = $codfis ; $whereCodFisc = "C.codfisc like '%$codfis%' and" ; } if ($ind != "") { $indirizzoRic = $ind ; $whereInd = "C.indirizzo like '%$ind%' and" ; } if ($cap != "") { $capRic = $cap ; $whereCap = "C.cap like '%$cap%' and" ; } if ($citta != "") { $cittaRic = $citta ; $whereCitta = "C.citta like '%$citta%' and" ; } if ($zona != "" and $zona != "tutti") { $zonaRic = $zona ; $whereZona = "C.idzona = $zona and" ; } if ($prov != "") { $provinciaRic = $prov ; $whereProv = "C.provincia like '%$prov%' and" ; } if ($tel != "") { $telefonoRic = $tel ; $whereTel = "C.telefono like '%$tel%' and" ; } if ($fax != "") { $faxRic = $fax ; $whereFax = "C.fax like '%$fax%' and" ; } if ($email != "") { $emailRic = $email ; $whereEmail = "C.email like '%$email%' and" ; } if ($consegna != "") { $consegnaRic = $consegna ; $whereCons = "C.consegna like '%$consegna%' and" ; } if ($note != "") { $noteRic = $note ; $whereNote = "C.note like '%$note %' and" ; } $str = "" ; $arrNOrdini = array() ; $order = array("\r\n", "\n", "\r"); $qcli = " select count(O.idordini) as NumOrdini, C.idclienti as IdClienti, C.cap as CapCliente, C.citta as CittaCliente, Z.NomeZona as ZonaCliente, C.provincia as ProvinciaCliente, C.telefono as TelefonoCliente, C.fax as FaxCliente, C.indirizzo as IndirizzoCliente, C.piva as PivaCliente, C.codfisc as CodFiscCliente, C.nome as NomeCliente, C.Email as Email, A.Nome as NomeAgente, C.Note as NoteCliente, C.consegna as Consegna, T.Descrizione as Categoria from clienti C left join ordini O on O.idcliente = C.idclienti and O.Anno = $anno left join zone Z on Z.IdZone = C.idzona, agenti A, tipologie T where (C.Attivo = 1 or (C.Attivo = 0 and Year(C.DataDisattivazione) > '$anno')) and A.IdAgenti = C.IdAgente and C.idtipologia = T.idtipologie and $whereCli $whereAge $whereTot $whereCat $wherePIva $whereCodFisc $whereInd $whereCap $whereCitta $whereZona $whereProv $whereTel $whereFax $whereEmail $whereCons $whereNote 1=1 group by C.Nome $havingTot order by C.Nome ASC" ; debug (0, $qcli) ; list($tot_clienti, $dati) = $db->RecuperaDati($qcli) ; for ($i = 0; $i < $tot_clienti ; $i++ ) { if (!in_array($dati['NumOrdini'][$i], $arrNOrdini)) $arrNOrdini[] = $dati["NumOrdini"][$i] ; $id = $dati['IdClienti'][$i] ; $tot_ordini = $dati['NumOrdini'][$i] ; $Ncliente = TogliNL($dati['NomeCliente'][$i]) ; $Nagente = htmlspecialchars($dati['NomeAgente'][$i]) ; $Ncategoria = $dati['Categoria'][$i] ; $Piva = $dati['PivaCliente'][$i] ; $Codfis = $dati['CodFiscCliente'][$i] ; $Indirizzo = htmlspecialchars($dati['IndirizzoCliente'][$i]) ; $Cap = $dati['CapCliente'][$i] ; $Citta = $dati['CittaCliente'][$i] ; $Zona = $dati['ZonaCliente'][$i] ; $Prov = $dati['ProvinciaCliente'][$i] ; $Telefono = $dati['TelefonoCliente'][$i] ; $Fax = $dati['FaxCliente'][$i] ; $Email = $dati['Email'][$i] ; $Consegna = TogliNL($dati['Consegna'][$i]) ; $Note = TogliNL($dati['NoteCliente'][$i]) ; if ($profilo == 3) { $str .= "$Ncliente$Nagente$Ncategoria$tot_ordini$Piva$Codfis$Indirizzo$Cap$Citta$Zona$Prov$Telefono$Fax$Email$Consegna$Note" ; } else { $str .= "../imgs/b_edit.png^Modifica^javascript:ModificaCliente($id)^_self../imgs/b_drop.png^Elimina^javascript:EliminaCliente($id)^_self$Ncliente$Nagente$Ncategoria$tot_ordini$Piva$Codfis$Indirizzo$Cap$Citta$Zona$Prov$Telefono$Fax$Email$Consegna$Note" ; } } $str .= "" ; @sort($arrNOrdini) ; /**************************** * Mi costruisco i filtri ****************************/ $filtri = new Filtri ; $filtri->CreaFiltriListaClienti($profilo) ; if ($profilo == 3) { $header = "CLIENTE,AGENTE,CATEGORIA,TOT ORD,PARTITA IVA,CODICE FISCALE,INDIRIZZO,CAP,CITTA',ZONA,PROV,TELEFONO,FAX,E-MAIL,CONSEGNA,NOTE CHIUSURA" ; $strSort = "str,str,,str,str,str,str,str,str,str,str,str,date,int,date,int,str,int" ; $iniW = "220,140,140,80,110,130,200,80,80,130,60,90,90,140,430,430" ; $setColType = "ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro" ; $setColAlign = "left,center,center,center,left,center,center,left,center,center,center,left,left,left" ; } else { $header = ",,CLIENTE,AGENTE,CATEGORIA,TOT ORD,PARTITA IVA,CODICE FISCALE,INDIRIZZO,CAP,CITTA',ZONA,PROV,TELEFONO,FAX,E-MAIL,CONSEGNA,NOTE CHIUSURA" ; $strSort = "na,na,str,str,,str,str,str,str,str,str,str,str,str,date,int,date,int,str,int" ; $iniW = "25,25,220,140,140,80,110,130,200,80,80,130,60,90,90,140,430,430" ; $setColType = "img,img,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro" ; $setColAlign = "left,left,left,center,center,center,left,center,center,left,center,center,center,left,left,left" ; } $label = explode(",", $header) ; /******************************************************************************* * controllo se devo eseguire degli ordinamenti e qual è la colonna da ordinare *******************************************************************************/ if (! isset($colToSort) or $colToSort == '') $colToSort = 0 ; ?> New Document 0) : ?>
Totale Clienti = ;  Selezionati =   (Per selezionare un cliente clicca sulla riga corrispondente)
Anno:


- Nessun cliente presente