= $numOrdDa" ; if (isset($numOrdA) and ($numOrdA != '')) $where .= " and O.IdOrdini <= $numOrdA" ; /************************* * filtro Cliente **************************/ if (isset($cliente) and ($cliente != 'tutti') and ($cliente != '')) $where .= " and C.IdClienti = $cliente" ; /************************* * filtro Fornitore **************************/ if (isset($fornitore) and ($fornitore != 'tutti') and ($fornitore != '')) $where .= " and F.IdFornitori = $fornitore" ; /************************* * filtro Agente **************************/ if (isset($agente) and ($agente != 'tutti') and ($agente != '')) $where .= " and A.IdAgenti = $agente" ; if ($from == "InserimentoAssegni") { $where .= " and O.Anno = $anno and ((O.NumAssegno = '' or O.NumAssegno is null) or (O.ImpAssegno = 0 or O.ImpAssegno is null)) and O.SaldoFattura = 0" ; $titolo = "Lista Ordini senza Assegno - Anno $anno" ; } else { $where .= " and (O.numfattura = 0 or O.numfattura is null) and O.Anno = $anno" ; $titolo = "Lista Ordini senza Fattura - Anno $anno" ; } /*************************************** * controllo la colonna da ordinare ***************************************/ switch($ordinaper) { case 1: // Numero Ordine $orderBy = "O.IdOrdini $direction" ; break ; case 2: // Nome Cliente $orderBy = "C.Nome $direction, O.IdOrdini ASC" ; break ; case 3: // Nome Fornitore $orderBy = "F.Nome $direction, O.IdOrdini ASC" ; break ; case 4: // Nome Agente $orderBy = "A.Nome $direction, O.IdOrdini ASC" ; break ; case 6: // Ammontare Ordine Con Iva $orderBy = "AVO.AmmontareOrdineConIva $direction, O.IdOrdini ASC" ; break ; default: // Numero Ordine $orderBy = "O.IdOrdini $direction" ; break ; } $query = " select O.*, A.Nome as NomeAgente, C.Nome as NomeCliente, F.Nome as NomeFornitore, F.IdFornitori, P.modalita as ModalitaPagamenti, AVO.AmmontareOrdineConIva from ordini O inner join clienti C on C.idclienti = O.idcliente inner join fornitori F on F.idfornitori = O.idfornitore inner join pagamenti P on P.idpagamenti = O.idpagamento inner join agenti A on A.idagenti = O.idagente inner join AmmontareVariOrdini AVO on AVO.IdOrdine = O.IdOrdini and AVO.Anno = $anno where $where order by $orderBy " ; debug (0, $query) ; list($n, $arrVal) = $db->RecuperaDati($query) ; $arrParGen = array() ; $arrParGen = RecuperaParametriGenerali($arrParGen, $tparametri) ; $nome = $arrParGen['NomeAgenzia'] ; $sede = "Sede operativa: " . $arrParGen['IndirizzoAgenzia'] ; $datisede = "Telefono: " . $arrParGen['TelefonoAgenzia'] . " Fax: " . $arrParGen['FaxAgenzia'] . " -- P.I. " . $arrParGen['PartitaIvaAgenzia'] ; $emailsede = "Email: " . $arrParGen['MailAgenzia'] ; ?> New Document




al
N.Ord Cliente Fornitore Agente Tot. Ordine