query("select * from agenti where idagenti = $agente") ; while ($db->next_record()) $nome = $db->f("Nome") ; $tit_ag = "Agente = $nome" ; } else { $wagente = "1 = 1" ; $tit_ag = "Agente = Tutti" ; } if ($profilo == 3) $wagente .= " and O.idagente != 4 and O.idagente != 5 and O.idagente != 9 and O.idagente != 10" ; if ($cliente != 0) { $wcliente = "O.idcliente = $cliente" ; $db->query("select * from clienti where idclienti = $cliente") ; while ($db->next_record()) $nomecl = $db->f("Nome") ; $tit_cl = "Cliente = $nomecl" ; } else { $wcliente = "1 = 1" ; $tit_cl = "Cliente = Tutti" ; } if ($fornitore != 0) { $wfornitore = "O.idfornitore = $fornitore" ; $db->query("select * from fornitori where idfornitori = $fornitore") ; while ($db->next_record()) $nomefor = $db->f("Nome") ; $tit_for = "Fornitore = $nomefor" ; } else { $wfornitore = "1 = 1" ; $tit_for = "Fornitore = Tutti" ; } if ($datadispedizione != "") { $mydata = MySqlDate($datadispedizione) ; $wdata = "O.dataspedizione <= '$mydata'" ; $tit_data = "Data di Spedizione <= $datadispedizione" ; } else { $tit_data = "" ; $wdata = "1 = 1" ; } $titolo = "Ordini con Anticipato senza Assegno: $tit_ag; $tit_cl; $tit_for; $tit_data" ; $str = "" ; $dbtmp = new FC_SQL ; $query = " select *, AVO.AmmontareOrdineConIva, A.nome as NomeAgente, F.Nome as NomeFornitore, C.nome as NomeCliente from ordini O inner join fornitori F on F.IdFornitori = O.IdFornitore inner join clienti C on C.IdClienti = O.IdCliente inner join agenti A on A.IdAgenti = O.IdAgente inner join AmmontareVariOrdini AVO on AVO.IdOrdine = O.IdOrdini and AVO.Anno = $anno where O.Anno = $anno and $wdata and $wagente and $wcliente and $wfornitore and O.IdPagamento = 1 and (O.NumAssegno <= '0' or O.NumAssegno is null) order by O.IdOrdini " ; list($n, $d) = $db->RecuperaDati($query) ; for ($i=0; $i<$n; $i++) { $idOrdine = $d['IdOrdini'][$i] ; $str .= "" ; $str .= "$idOrdine" ; $str .= "" . ItaDate($d['DataOrdine'][$i]) . "" ; $str .= "" . nfe($d['AmmontareOrdineConIva'][$i]) . "" ; $str .= "" . htmlspecialchars($d['NomeAgente'][$i]) . "" ; $str .= "" . htmlspecialchars($d['NomeCliente'][$i]) . "" ; $str .= "" . htmlspecialchars($d['NomeFornitore'][$i]) . "" ; $str .= "" ; } $str .= "" ; $header = "NUM ORDINE,DATA ORDINE,IMPORTO,AGENTE,CLIENTE,FORNITORE" ; $strSort = "int,date,euro,str,str,str" ; $iniWP = "10,12,10,10,29,29" ; $setColType = "ro,ro,ro,ro,ro,ro" ; $setColAlign = "center,center,center,left,left,left" ; ?> <? echo TITLE ?>
Numero Ordini: (per selezionare un'ordine clicca sulla riga corrispondente)