/* NovaPA - 888 Software Products S.r.l. Il codice è di esclusiva proprietà di 888SP ed è protetto dal Codice della Proprietà Industriale e Intellettuale (D.Lgs. n. 30/2005), dalla legge italiana sul diritto d'autore (L. 633/1941), dalle norme contenute nei trattati internazionali, nonché dalle leggi in vigore nel Paese in cui esso viene usato. La struttura, l'organizzazione e il codice del SOFTWARE costituiscono importanti segreti industriali, commerciali ed informazioni confidenziali di 888SP e dei suoi fornitori e pertanto l’utilizzatore si obbliga a non divulgare in alcun modo le suddette informazioni riservate. Fatta eccezione per quanto espressamente previsto nel contratto di LICENZA D’USO, non è concesso alcun diritto di proprietà intellettuale sul codice. Tutti i diritti non espressamente concessi sono riservati da 888SP e dei suoi FORNITORI. Ogni abuso nella commercializzazione o nell'utilizzo del codice verrà punito secondo la normativa italiana, comunitaria ed internazionale. */ function salva() { if (document.all) { document.execCommand("SaveAs"); }else{ alert('Disponibile solo per Internet Explorer.'); } } function myLink(){ if (document.all) { v_myLink= "javascript:salva()"; }else{ v_myLink= window.location.href.toString(); } return v_myLink; } function Contenuto (myCell){ Esito = "Nessun valore definito" if (myCell.innerText) Esito = myCell.innerText; else Esito = myCell.textContent; return Esito; } function dettaglioCella (oRiga,nColonna,idHTML){ var vHTML=document.getElementById(idHTML); newHTML = oRiga.cells[nColonna].innerHTML; vHTML.innerHTML = newHTML; } function visualizza(tabella){ var odiv = document.getElementById(tabella); odiv.style.display = ''; } function nascondi(oggetto){ var vOggetto = document.getElementById(oggetto); vOggetto.style.display = 'none'; } function setBGC (idOggetto, vBGC){ var vOggetto= document.getElementById(idOggetto); vOggetto.style.backgroundColor = vBGC; } function controlla(){ var myFiltro = document.Ricerca.FindCIG.value; pager.serch (myFiltro); var nRighe = document.Ricerca.NumRighe.value; pager.change(nRighe); pager.showPageNav('pager', 'pageNavPosition'); pager.showPage(1,'pager', 'pageNavPosition'); pager.viewRecords('pageRecords'); } function Pager(tableName, itemsPerPage) { this.tableName = tableName; this.itemsPerPage = itemsPerPage; this.currentPage = 1; this.currentRow = null; this.pages = 0; this.inited = false; this.Records = 0; this.serchRecords=0; this.Filtro="" // ******** Funzione viewRecords ********** this.viewRecords = function( lbl_pageRecords) { var element2 = document.getElementById(lbl_pageRecords); var pagerHtml = ' Appalti individuati: ' + this.serchRecords +' ( su ' + this.Records +' totali)'; element2.innerHTML = pagerHtml; } // ******** Funzione serch(myFiltro) ********** this.serch = function(myFiltro){ var rows = document.getElementById(tableName).rows; var serchRecords = 0; // i starts from 1 to skip table header row for (var i = 1; i < rows.length; i++) { var myCell = Contenuto (rows[i].cells[0]); myCell = myCell + Contenuto (rows[i].cells[1]); myCell = myCell.toLowerCase(); myFiltro = myFiltro.toLowerCase(); if (myCell.indexOf(myFiltro) != -1) { serchRecords = serchRecords +1; } } this.serchRecords=serchRecords; this.Filtro = myFiltro; } // ******** Funzione init() ********** this.init = function() { var rows = document.getElementById(tableName).rows; var records = (rows.length - 1); this.pages = Math.ceil(records / itemsPerPage); this.inited = true; this.Records=records; this.serchRecords=records; } // ******** Funzione selectRow (oRow) ********* this.selectRow = function (oRow){ if (this.currentRow == null) { oRow.style.backgroundColor = '#ABCDEF'; } else { this.currentRow.style.backgroundColor = '#FFFFFF'; oRow.style.backgroundColor = '99CBFF'; } this.currentRow = oRow; } // ******** Funzione change(NewItemsPerPage) ********* this.change = function(NewItemsPerPage) { var records = this.serchRecords; itemsPerPage = NewItemsPerPage; this.itemsPerPage = itemsPerPage; pages = Math.ceil(records / itemsPerPage); this.pages = pages; this.currentPage = 1; } // ******** Funzione showRecordsSerch ********** this.showRecordsSerch = function(from, to) { var myFiltro = this.Filtro; var rows = document.getElementById(tableName).rows; var j = 0; // i starts from 1 to skip table header row for (var i = 1; i < rows.length; i++) { var myCell = Contenuto (rows[i].cells[0]); myCell = myCell + Contenuto (rows[i].cells[1]); myCell = myCell.toLowerCase(); myFiltro = myFiltro.toLowerCase(); if (myCell.indexOf(myFiltro) != -1) { j = j +1 if (j < from || j > to) rows[i].style.display = 'none'; else rows[i].style.display = ''; } else { rows[i].style.display = 'none'; } } } // ******** Funzione showPage ********** this.showPage = function(pageNumber,pagerName, positionId) { if (! this.inited) { alert("not inited"); return; } if (pageNumber > this.pages) { this.showRecordsSerch(0,0);} else { var oldPageAnchor = document.getElementById('pg'+this.currentPage); oldPageAnchor.className = 'pg-normal'; this.currentPage = pageNumber; this.showPageNav('pager', 'pageNavPosition'); var newPageAnchor = document.getElementById('pg'+this.currentPage); newPageAnchor.className = 'pg-selected'; var from = (pageNumber - 1) * itemsPerPage + 1; var iniziale = parseInt(from) var step = parseInt(itemsPerPage) var to = iniziale+step-1; this.showRecordsSerch(from,to); } } // ******** Funzione prev ********** this.prev = function() { if (this.currentPage > 1) this.showPage(this.currentPage - 1); } // ******** Funzione next ********** this.next = function() { if (this.currentPage < this.pages) { this.showPage(this.currentPage + 1); } } // ******** Funzione last ********** this.last = function() { if (this.pages > 0) { this.showPage(this.pages); } } // ******** Funzione first ********** this.first = function() { if (this.pages > 0) { this.showPage(1); } } // ******** showPageNav ********** this.showPageNav = function(pagerName, positionId) { if (! this.inited) { alert("not inited"); return; } var element = document.getElementById(positionId); var maxviewpage = 9; var multiplo = (maxviewpage -1 )/2; if (this.currentPage < (multiplo+1)) {PaginaInizio = 1} else { if( (this.pages - this.currentPage) < (multiplo) ) {PaginaInizio = (this.pages - maxviewpage)+1} else {PaginaInizio = (this.currentPage - multiplo);} } if (PaginaInizio < 1) {PaginaInizio = 1} if (this.pages < maxviewpage) {PaginaFine = this.pages;} else { PaginaFine = this.currentPage +multiplo; if (PaginaFine < maxviewpage) PaginaFine = maxviewpage; if (PaginaFine > this.pages) PaginaFine = this.pages; } var pagerHtml = ' « Inizio'; pagerHtml += ' | Indietro | '; for (var page = PaginaInizio; page <= PaginaFine; page++) pagerHtml += '' + page + ' '; pagerHtml += '| Avanti |'; pagerHtml += ' Fine »'; element.innerHTML = pagerHtml; } }