"); $log = true ; if ($log) $handle = fopen('log_loadListaOrdini.txt', 'a+') ; $posStart = $_GET['posStart'] ; $count = $_GET['count'] ; if ($log) { fwrite($handle, "posStart = " . $posStart . "\n") ; fwrite($handle, "count = " . $count . "\n") ; } /*************************************************************************** * where-list ***************************************************************************/ $selIdOrd = $_GET["selidord"] ; $selIdOrdDa = $_GET["selidordda"] ; $selIdOrdA = $_GET["selidorda"] ; $selCli = $_GET["selcli"] ; $selFor = $_GET["selfor"] ; $selAge = $_GET["selage"] ; $NumFattPre = $_GET["numfattpre"] ; $selNumFatt = $_GET["selnumfatt"] ; $selSalFatt = $_GET["selsalfatt"] ; $selSalFor = $_GET["selsalfor"] ; $selSalAge = $_GET["selsalage"] ; $selModPag = $_GET["selmodpag"] ; $selNumAss = $_GET["selnumass"] ; $selDaInv = $_GET["seldainv"] ; $selEpoca = $_GET["selepoca"] ; $ordinaper = $_GET["ordinaper"] ; $direction = $_GET["direction"] ; $profilo = $_GET["profilo"] ; $where = "1=1" ; if ($profilo == 3) $ordinaper = $ordinaper + 2 ; /************************* * filtro Id Ordine **************************/ if (isset($selIdOrd) and ($selIdOrd != '')) $where .= " and O.IdOrdini = $selIdOrd" ; if (isset($selIdOrdDa) and ($selIdOrdDa != '')) $where .= " and O.IdOrdini >= $selIdOrdDa" ; if (isset($selIdOrdA) and ($selIdOrdA != '')) $where .= " and O.IdOrdini <= $selIdOrdA" ; /************************* * filtro Cliente **************************/ if (isset($selCli) and ($selCli != 'tutti')) $where .= " and C.IdClienti = $selCli" ; /************************* * filtro Fornitore **************************/ if (isset($selFor) and ($selFor != 'tutti')) $where .= " and F.IdFornitori = $selFor" ; /************************* * filtro Agente **************************/ if (isset($selAge) and ($selAge != 'tutti')) $where .= " and A.IdAgenti = $selAge" ; if (isset($profilo) and ($profilo == 3)) $where .= " and A.idAgenti != 1 and A.idAgenti != 5 and A.idAgenti != 9 and A.idAgenti != 10 " ; /**************************** * filtro sulla data Ordine *****************************/ if (isset($dataOrdDa) and ($dataOrdDa != '')) $where .= " and O.DataOrdine >= '$dataOrdDa'" ; if (isset($dataOrdA) and ($dataOrdA != '')) $where .= " and O.DataOrdine <= '$dataOrdA'" ; /************************* * filtro Numero Fattura **************************/ if (isset($selNumFatt) and ($selNumFatt != '')) { if ($selNumFatt == 0) $where .= " and (O.NumFattura = '' or O.NumFattura is null)" ; else $where .= " and O.NumFattura = $selNumFatt" ; } /********************************* * filtro Numero Fattura Presente * = 0 Numero Fattura Non Presente * = 1 Numero Fatura Presente **********************************/ if (isset($NumFattPre) and ($NumFattPre != '')) { if ($NumFattPre == 0) $where .= " and (O.NumFattura = '')" ; else $where .= " and O.NumFattura > 0" ; } /**************************** * filtro sulla data Fattura *****************************/ if (isset($dataFatDa) and ($dataFatDa != '')) $where .= " and O.DataSpedFattura >= '$dataFatDa'" ; if (isset($dataFatA) and ($dataFatA != '')) $where .= " and O.DataSpedFattura <= '$dataFatA'" ; /************************* * filtro Fattura Saldata **************************/ if (isset($selSalFatt) and ($selSalFatt != -1)) $where .= " and O.SaldoFattura = $selSalFatt" ; /************************************* * filtro sulla data pagamento Fattura *************************************/ if (isset($dataPagDa) and ($dataPagDa != '')) $where .= " and O.DataRichiesta >= '$dataPagDa'" ; if (isset($dataPagA) and ($dataPagA != '')) $where .= " and O.DataRichiesta <= '$dataPagA'" ; /***************************************** * filtro Provvigione Saldata Fornitore *****************************************/ if (isset($selSalFor) and ($selSalFor != -1)) $where .= " and O.SaldoProvvigione = $selSalFor" ; /***************************************** * filtro Provvigione Saldata Agente *****************************************/ if (isset($selSalAge) and ($selSalAge != -1)) $where .= " and O.SaldoProvvigioneAgente = $selSalAge" ; /***************************************** * filtro Modalita di Pagamento *****************************************/ if (isset($selModPag) and ($selModPag != 0)) $where .= " and O.IdPagamento = $selModPag" ; /***************************************** * filtro Numero Assegno *****************************************/ if (isset($selNumAss)) if ($selNumAss == '-99') $where .= " and (O.NumAssegno = '' or O.NumAssegno is null)" ; else if ($selNumAss != 0) $where .= " and O.NumAssegno = '$selNumAss'" ; /***************************************** * filtro Da Inviare *****************************************/ if (isset($selDaInv) and ($selDaInv != -1)) $where .= " and O.DaInviare = $selDaInv" ; /***************************************** * filtro Epoca di Consegna *****************************************/ if (isset($selEpoca) and ($selEpoca != '')) $where .= " and O.EpocaDiConsegna = '$selEpoca'" ; /*************************************** * controllo la colonna da ordinare ***************************************/ switch($ordinaper) { case 3: // id ordine $order_by = "O.IdOrdini $direction" ; break ; case 4: // cliente $order_by = "C.Nome $direction, O.IdOrdini" ; break ; case 5: // fornitore $order_by = "F.Nome $direction, O.IdOrdini" ; break ; case 6: // agente $order_by = "A.Nome $direction, O.IdOrdini" ; break ; case 7: // data ordine $order_by = "O.DataOrdine $direction, O.IdOrdini" ; break ; /* case 5: // data spedizione $order_by = "O.DataSpedizione $direction, O.IdOrdini" ; break ; */ case 8: // numero fattura $order_by = "O.NumFattura $direction, O.IdOrdini" ; break ; case 9: // data fattura $order_by = "O.DataSpedFattura $direction, O.IdOrdini" ; break ; case 10: // importo fattura $order_by = "O.ImportoFattura $direction, O.IdOrdini" ; break ; case 11: // fattura saldata ? $order_by = "O.SaldoFattura $direction, O.IdOrdini" ; break ; case 12: // data richiesta che sarebbe la data pagamento fattura $order_by = "O.DataRichiesta $direction, O.IdOrdini" ; break ; case 13: // provvigione fornitore saldata? $order_by = "O.SaldoProvvigione $direction, O.IdOrdini" ; break ; case 14: // provvigione agente saldata? $order_by = "O.SaldoProvvigioneAgente $direction, O.IdOrdini" ; break ; case 15: // modalita di pagamento $order_by = "O.ModalitaPagamenti $direction, O.IdOrdini" ; break ; case 16: // numero di assegno $order_by = "O.NumAssegno $direction, O.IdOrdini" ; break ; case 17: // Da inviare di pagamento $order_by = "O.DaInviare $direction, O.IdOrdini" ; break ; case 18: // epoca di consegna $order_by = "O.EpocaDiConsegna $direction, O.IdOrdini" ; break ; } if ($log) { fwrite($handle, "where = " . $where . "\n") ; fwrite($handle, "order_by = " . $order_by . "\n") ; } $listaOrdini = new Ordine ; $listaOrdini->ListaOrdini($where, $order_by) ; print("") ; if ($profilo == 3) { foreach($listaOrdini->ArrayListaOrdini as $idOrdine => $arrVal) { print ("../imgs/pdf.png^Stampa PDF^javascript:OrdinePdf($idOrdine)^_self$idOrdine" . $arrVal['NomeCliente'] . "" . $arrVal['NomeFornitore'] . "" . $arrVal['NomeAgente'] . "" . $arrVal['DataOrdine'] . "" . $arrVal['NumFattura'] . "" . $arrVal['DataFattura'] . "" . $arrVal['ImportoFattura'] . "" . $arrVal['FatturaSaldata'] . "" . $arrVal['DataPagamentoFattura'] . "" . $arrVal['SaldoProvvigione'] . "" . $arrVal['SaldoProvvigioneAgente'] . "" . $arrVal['ModalitaPagamento'] . "" . $arrVal['NumAssegno'] . "" . $arrVal['Sconto1'] . " - " . $arrVal['Sconto2'] . " - " . $arrVal['Sconto3'] . "" . $arrVal['OrdineDaInviare'] . "" . $arrVal['EpocaConsegna'] . "" . $arrVal['Note'] . "") ; } } else { foreach($listaOrdini->ArrayListaOrdini as $idOrdine => $arrVal) { print ("../imgs/b_edit.png^Modifica^javascript:Modifica($idOrdine)^_self../imgs/b_drop.png^Elimina^javascript:EliminaOrdine($idOrdine)^_self../imgs/pdf.png^Stampa PDF^javascript:OrdinePdf($idOrdine)^_self$idOrdine" . $arrVal['NomeCliente'] . "" . $arrVal['NomeFornitore'] . "" . $arrVal['NomeAgente'] . "" . $arrVal['DataOrdine'] . "" . $arrVal['NumFattura'] . "" . $arrVal['DataFattura'] . "" . $arrVal['ImportoFattura'] . "" . $arrVal['FatturaSaldata'] . "" . $arrVal['DataPagamentoFattura'] . "" . $arrVal['SaldoProvvigione'] . "" . $arrVal['SaldoProvvigioneAgente'] . "" . $arrVal['ModalitaPagamento'] . "" . $arrVal['NumAssegno'] . "" . $arrVal['Sconto1'] . " - " . $arrVal['Sconto2'] . " - " . $arrVal['Sconto3'] . "" . $arrVal['OrdineDaInviare'] . "" . $arrVal['EpocaConsegna'] . "" . $arrVal['Note'] . "") ; } } print ("") ; ?>