"); $dbtot = new FC_SQL ; $log = false ; if ($log) $handle = fopen('log_LoadListaAssegni.txt', 'a+') ; $posStart = $_GET['posStart'] ; $count = $_GET['count'] ; if ($log) { fwrite($handle, "posStart = " . $posStart . "\n") ; fwrite($handle, "count = " . $count . "\n") ; } /*************************************************************************** * where-list ***************************************************************************/ $selOrd = $_GET["selord"] ; $selFat = $_GET["selfat"] ; $selDataFat = $_GET["seldatafat"] ; $selFor = $_GET["selfor"] ; $selCli = $_GET["selcli"] ; $selBan = $_GET["selban"] ; $selAss = $_GET["selass"] ; $selDataAss = $_GET["seldataass"] ; $selSpe = $_GET["selspe"] ; $ordinaper = $_GET["ordinaper"] ; $direction = $_GET["direction"] ; $where = "1=1" ; /************************* * filtro Num Ordine **************************/ if (isset($selOrd) and ($selOrd != '')) $where .= " and O.IdOrdini = $selOrd" ; /************************* * filtro Numero Fattura **************************/ if (isset($selFat) and ($selFat != '')) $where .= " and O.NumFattura = $selFat" ; /************************* * filtro Data Fattura **************************/ if (isset($selDataFat) and ($selDataFat != '')) { $selDataFat = MySqlDate($selDataFat) ; $where .= " and O.DataSpedFattura = '$selDataFat'" ; } /************************* * filtro Fornitori **************************/ if (isset($selFor) and ($selFor != 'tutti')) $where .= " and O.idfornitore = $selFor" ; /************************* * filtro Clienti **************************/ if (isset($selCli) and ($selCli != 'tutti')) $where .= " and O.idcliente = $selCli" ; /************************* * filtro Banca **************************/ if (isset($selBan) and ($selBan != '')) $where .= " and O.BancaOrdine like '%$selBan%'" ; /************************* * filtro Numero Assegno **************************/ if (isset($selAss) and ($selAss != '')) $where .= " and O.NumAssegno like '%$selAss%'" ; /************************* * filtro Data Fattura **************************/ if (isset($selDataAss) and ($selDataAss != '')) { $selDataAss = MySqlDate($selDataAss) ; $where .= " and O.DataInvAss = '$selDataAss'" ; } /************************* * filtro Spedito **************************/ if (isset($selSpe) and ($selSpe != 'tutti')) { if ($selSpe == 'No') $where .= " and O.DaSpedire = 1" ; else $where .= " and O.DaSpedire = 0" ; } /*************************************** * controllo la colonna da ordinare ***************************************/ switch($ordinaper) { case 0: // numero ordine $order_by = "O.idordini $direction" ; break ; case 1: // numero fattura $order_by = "O.NumFattura $direction, O.idordini" ; break ; case 2: // data fattura $order_by = "O.DataSpedFattura $direction, O.idordini" ; break ; case 3: // fornitore $order_by = "F.Nome $direction, O.idordini" ; break ; case 4: // cliente $order_by = "C.Nome $direction, O.idordini" ; break ; case 5: // banca $order_by = "O.BancaOrdine $direction, O.idordini" ; break ; case 6: // numero assegno $order_by = "O.NumAssegno $direction, O.idordini" ; break ; case 7: // data invio assegno $order_by = "O.DataInvAss $direction, O.idordini" ; break ; case 8: // importo assegno $order_by = "O.ImpAssegno $direction, O.idordini" ; break ; case 9: // spedito $order_by = "O.DaSpedire $direction, O.idordini" ; break ; } $qcli = " select O.*, F.nome as NomeFornitore, C.nome as NomeCliente from ordini O, fornitori F, clienti C where O.Anno = $anno and O.bancaordine <> '' and O.idfornitore = F.idfornitori and O.idcliente = C.idclienti and $where order by $order_by " ; if ($log) fwrite($handle, "$qcli \n") ; list($nrowsdati, $dati) = $db->RecuperaDati($qcli) ; if ($log) fwrite($handle, "\n") ; print("") ; $arrClienti = array() ; for ($i = 0; $i < $nrowsdati ; $i++ ) { $idordine = $dati['IdOrdini'][$i] ; if ($dati['DaSpedire'][$i]) $sn = "No" ; else $sn = "Si" ; $str = "" ; $str .= "$idordine" ; $str .= "" . $dati['NumFattura'][$i] . "" ; $str .= "" . ItaDate($dati['DataSpedFattura'][$i]) . "" ; $str .= "" . htmlspecialchars($dati['NomeFornitore'][$i]) . "" ; $str .= "" . htmlspecialchars($dati['NomeCliente'][$i]) . "" ; $str .= "" . htmlspecialchars($dati['BancaOrdine'][$i]) . "" ; $str .= "" . $dati['NumAssegno'][$i] . "" ; $str .= "" . ItaDate($dati['DataInvAss'][$i]) . "" ; $str .= "" . nfe($dati['ImpAssegno'][$i]) . "" ; $str .= "" . $sn . "" ; $str .= "" ; if ($log) fwrite($handle, "$str\n") ; print ("$str") ; } print ("") ; if ($log) fclose($handle) ; ?>