"); $log = false ; if ($log) $handle = fopen('log_LoadInserimentoFatture.txt', 'a+') ; $posStart = $_GET['posStart'] ; $count = $_GET['count'] ; if ($log) { fwrite($handle, "posStart = " . $posStart . "\n") ; fwrite($handle, "count = " . $count . "\n") ; } /*************************************************************************** * where-list ***************************************************************************/ $numOrdDa = $_GET["numOrdDa"] ; $numOrdA = $_GET["numOrdA"] ; $idCliente = $_GET["idCliente"] ; $idFornitore = $_GET["idFornitore"] ; $idAgente = $_GET["idAgente"] ; $ordinaper = $_GET["ordinaper"] ; $direction = $_GET["direction"] ; $where = "1=1" ; /************************* * filtro Id Ordine **************************/ if (isset($idOrdine) and ($idOrdine != '')) $where .= " and O.IdOrdini = $idOrdine" ; /************************* * filtro Cliente **************************/ if (isset($idCliente) and ($idCliente != 'tutti') and ($idCliente != '')) $where .= " and C.IdClienti = $idCliente" ; /************************* * filtro Fornitore **************************/ if (isset($idFornitore) and ($idFornitore != 'tutti') and ($idFornitore != '')) $where .= " and F.IdFornitori = $idFornitore" ; /************************* * filtro Agente **************************/ if (isset($idAgente) and ($idAgente != 'tutti') and ($idAgente != '')) $where .= " and A.IdAgenti = $idAgente" ; /*************************************** * 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 5: // Data Spedizione Ordine $orderBy = "O.DataSpedizione $direction, O.IdOrdini ASC" ; break ; case 6: // Ammontare Ordine Con Iva $orderBy = "AVO.AmmontareOrdineConIva $direction, O.IdOrdini ASC" ; break ; case 7: // Numero Fattura $orderBy = "O.NumFattura $direction, O.IdOrdini ASC" ; break ; case 8: // Data Spedizione Fattura $orderBy = "O.DataSpedFattura $direction, O.IdOrdini ASC" ; break ; case 9: // Importo Fattura $orderBy = "O.ImportoFattura $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 O.Anno = $anno and ((O.NumAssegno = '' or O.NumAssegno is null) or (O.ImpAssegno = 0 or O.ImpAssegno is null)) and O.SaldoFattura = 0 and $where order by $orderBy " ; debug(0, $query) ; if ($log) fwrite($handle, "$query \n") ; list($nrowsdati, $dati) = $db->RecuperaDati($query) ; if ($log) fwrite($handle, "\n") ; print("") ; list($n, $d) = $db->RecuperaDati($query) ; for ($i=0; $i<$n; $i++) { $idOrdine = $d['IdOrdini'][$i] ; $nomecliente = htmlspecialchars($d['NomeCliente'][$i]) ; $nomefornitore = htmlspecialchars($d['NomeFornitore'][$i]) ; $nomeagente = htmlspecialchars($d['NomeAgente'][$i]) ; $dataSpedizioneOrdine = ItaDate($d['DataSpedizione'][$i]) ; $numFattura = $d['NumFattura'][$i] ; $dataFattura = ItaDate($d['DataSpedFattura'][$i]) ; $importoFattura = nfe($d['ImportoFattura'][$i]) ; $ammontareOrdine = nfe($d['AmmontareOrdineConIva'][$i]) ; if ($log) fwrite($handle, "$idOrdine$nomecliente$nomefornitore$nomeagente$dataSpedizioneOrdine$ammontareOrdine$numFattura$dataFattura$importoFattura") ; print ("../imgs/b_edit.png^Modifica^javascript:ModificaOrdine($idOrdine)^_self$idOrdine$nomecliente$nomefornitore$nomeagente$dataSpedizioneOrdine$ammontareOrdine$numFattura$dataFattura$importoFattura") ; } print ("") ; if ($log) fclose($handle) ; ?>