/* * Copyright Time for Chopin (C)2018 * Autor: Andrzej Kraszewski */ //-----------------------------Rozsterowanie menu głównego z wywołaniem stron ----------------------- function menu_TFC_Finanse (e, str, menu_item) { if (str != 0) {if (!zapisano_rec()) { return;}} switch (menu_item) { case 'wyn-przy': case 'wyn-kosz': case 'wyn-pmng': location = "TFC_Finanse_WYN.php?" + menu_item; break; case 'rap-opod': case 'rap-rgot': case 'rap-fkos': case 'rap-fprz': case 'rap-plac': location = "TFC_Finanse_RAP.php?" + menu_item; break; case 'prs-prac': case 'prs-list': location = "TFC_Finanse_PRC.php?" + menu_item; break; case 'pla-rokr': case 'pla-staw': case 'pla-list': case 'pla-hote': location = "TFC_Finanse_ROK.php?" + menu_item; break; case 'fvp-wyfv': case 'fvp-mofv': case 'fvp-list': case 'fvp-kont': case 'fvp-koli': location = "TFC_Finanse_FWY.php?" + menu_item; break; } } /* -------------------------------------- DO PDF -----------------------------------------------------*/ function zapisz_PDF(div_id){ printdiv(div_id); //Tu wywołanie zrzutu do PDF - na razie drukowanie //Do PDF } //-----------------------------------PRINT PAGE-------------------------------------------- //Funkcja drukuje zawartość wybranego kontenera div id=printpage function printdiv(printpage) { printcolor ='#116211;'; printcolor ='#000000;'; var contents = document.getElementById(printpage).innerHTML; var frame1 = document.createElement('iframe'); frame1.name = "frame1"; frame1.style.position = "absolute"; frame1.style.top = "-1000000px"; frame1.style.fontFamily = "11px Helvetica"; frame1.className = "rez_data_title"; hd1 = document.getElementById('fv_poz_hdr'); // hd1.className = "fv_data_hdr"; document.body.appendChild(frame1); var frameDoc = (frame1.contentWindow) ? frame1.contentWindow : (frame1.contentDocument.document) ? frame1.contentDocument.document : frame1.contentDocument; frameDoc.document.open(); //frameDoc.document.write(''); frameDoc.document.write(''); frameDoc.document.write(''); // frameDoc.document.write(''); frameDoc.document.write(''); frameDoc.document.write(''); // frameDoc.style.backgroundColor = "#EAF6ED"; //frameDoc.document.write('') frameDoc.document.write('Time for Chopin'); frameDoc.document.write(''); frameDoc.document.write(contents); frameDoc.document.write(''); frameDoc.document.close(); setTimeout(function () { window.frames["frame1"].focus(); frame1.style.fontFamily = "11px Helvetica"; window.frames["frame1"].print(); document.body.removeChild(frame1); }, 500); return false; } /* function PrintElem(elem) { var mywindow = window.open('', 'PRINT', 'height=400,width=600'); mywindow.document.write('' + document.title + ''); mywindow.document.write(''); mywindow.document.write('

' + document.title + '

'); mywindow.document.write(document.getElementById(elem).innerHTML); mywindow.document.write(''); mywindow.document.close(); // necessary for IE >= 10 mywindow.focus(); // necessary for IE >= 10 mywindow.print(); mywindow.close(); return true; } function printContent(el){ var restorepage = $('body').html(); var printcontent = $('#' + el).clone(); $('body').empty().html(printcontent); window.print(); $('body').html(restorepage); } */ //--------------------------------------FORMATTED TABLE---------------------------------------- // Dane: w tabl. tableData. id kontenera: cont_id // {"CONT_ID":tab_id, "SZER":szer_tabeli, "TYT_1":tytul, "TYT_2":""; "TYT_D":tyt_d, "HDR":hdr_names, "FONT_H":wysokość czcionki, // "FONT_C":wektor kolorów czcionki, "FONT_B":wektor kolorów tła headera, "ALIGN":Wektor justacji kolumn, "CLASS_H":klasa headera, // "CLASS_T":klasa tabeli, "PUSTA":false} // Jeśli któraś watość w wektorze jest pusta "" - obowiązuje wartość z danej klasy function formattedTable(tableData, dMode) { if (tableData.length == 0) { return;} n_rows = tableData.length; n_cells = tableData[0].length; var cont_id = dMode.CONT_ID; // Alias div id=cont_id (do cont). var cont = document.getElementById(cont_id); if (dMode.TYT_1 != "") { // Utwórz span w div i wyświetl tytuł 1 $(('#' + cont_id)).append('
'); var t1 = document.getElementById(cont_id + "_ty1"); var dty1 = document.getElementById(cont_id + "_dty1"); dty1.style.marginBottom = '10px'; t1.className = "rez_data_title"; t1.innerHTML = dMode.TYT_1; } if (dMode.TYT_2 != "") { // Utwórz span w div i wyświetl tytuł 2 $(('#' + cont_id)).append('
'); var t2 = document.getElementById(cont_id + "_ty2"); var dty2 = document.getElementById(cont_id + "_dty2"); dty2.style.marginBottom = '10px'; t2.className = "rez_data_title"; t2.innerHTML = dMode.TYT_2; } $(('#' + cont_id)).append('
'); // Utwódz tabelę w div id=cont_id (alias cont). Alias tabeli: xr var xr = document.getElementById(cont_id + "_rdt"); // xr.className = dMode.CLASS_T; // xr.style.fontFamily = "10px Arial"; // zakoment. i do css xr.style.width = dMode.SZER; var header = xr.createTHead(); //Header tabeli. Nazwy kolumn w hdr_names[] var drow = header.insertRow(0); drow.id = cont_id + "_hdr"; drow.className = dMode.CLASS_H; // "rez_data_hdr"; // drow.style.height = "30px"; // do css? // drow.style.fontWeight = "bold"; // drow.style.padding = "10px"; // drow.style.textAlign = 'center'; var hdr = dMode.HDR; for (i = 0; i < hdr.length; i++) { var dcell = drow.insertCell(i); // ew. dcell.style.width = dMode.WIDTH[i]; /* switch (dMode.ALIGN[i]) { case -1: dcell.style.textAlign = 'left'; break; case 0: dcell.style.textAlign = 'center'; break; case 1: dcell.style.textAlign = 'right'; break; } */ dcell.innerHTML = hdr[i]; } var tableBody = document.createElement('tbody'); //body tabeli tableBody.className = dMode.CLASS_T; if (dMode.PUSTA) {return;} rezerw_id.length = 0; lp = 1; tableData.forEach(function(rowData) { //Kreator wierszy tabeli: licznik lp var row = document.createElement('tr'); row.style.height = "20px"; // row.style.backgroundColor = "white"; lc = 0; rowData.forEach(function(cellData) { //Kreator komórek w wierszu: licznik lc var cell = document.createElement('td'); cell.appendChild(document.createTextNode(cellData)); cell.style.textAlign = dMode.ALIGN[lc]; if (dMode.ALIGN[lc] == 'left') cell.style.paddingLeft = '10px'; if (dMode.ALIGN[lc] == 'right') cell.style.paddingRight = '10px'; row.appendChild(cell); lc +=1; }); tableBody.appendChild(row); //Gotowy wiersz dołącz do body }); xr.appendChild(tableBody); //Kompletne Body dołacz do tabeli cont.appendChild(xr); //Dołącz tabelę do kontenera div /* $('tr').each( function () // *JUSTYFIKACJA*: dla każdego wiersza { $(this).children('td').filter(function() // dla kolejnych komórek od 2-giej :gt(0) { lc = 0; switch (dMode.ALIGN[lc++]) { case -1: // dcell.style.textAlign = 'left'; $(this).css('text-align','left'); // justuj do lewej $(this).css('padding-left', '10px'); $(".testclass").css('text-align','left'); $(".testclass").css('padding-left','10px'); just = 'left'; break; case 0: // dcell.style.textAlign = 'center'; $(this).css('text-align','center'); // wyśrodkuj // $(this).css('padding-left', '10px'); $(".testclass").css('text-align','center'); just = 'center'; // $(".testclass").css('padding-left','10px'); break; case 1: // dcell.style.textAlign = 'right'; $(this).css('text-align','right'); // justuj do prawej $(this).css('padding-right', '10px'); $(".testclass").css('text-align','right'); $(".testclass").css('padding-right','10px'); just = 'right'; break; } }).css('text-align',just); }); */ if (dMode.TYT_D != "") { // Utwórz span i wyświetl tytuł dolny $(('#' + cont_id)).append('
'); var tyd = document.getElementById(cont_id + "_tyd"); var dyd = document.getElementById(cont_id + "_dyd"); tyd.className = "rez_data_title"; dyd.style.width = dMode.SZER; dyd.style.textAlign = 'right'; dyd.style.marginTop = '10px'; tyd.innerHTML = dMode.TYT_D; } // d_r.disabled = true; //Deaktywuj przycisk "Wyświetl" // if (nav_rez.m === 1 && tabelarez_on) { tabelarez_on = true; } // if (nav_rez.m === 1) {document.getElementById("b_print").style.display = "inline"; } //Wyświetl przycisk "Drukuj" // if (nav_rez.m === 3) {document.getElementById("w_print").style.display = "inline"; } //Wyświetl przycisk "Drukuj" // console.log(JSON.stringify(rezerw_id)); // if (nav_rez.m > 3) { console.log(JSON.stringify(czybyli)); } } //--------------------------------------CREATETABLE---------------------------------------- // Dane: w tabl. tableData. id konteneta: cont_id // {"CONT_ID":tab_id, "SZER":szer_tabeli, "TYT_1":tytul, "TYT_2":""; "TYT_D":tyt_d, "HDR":hdr6_names, "PUSTA":false} function createTable(tableData, dMode) { if (tableData.length == 0) { return;} n_rows = tableData.length; n_cells = tableData[0].length; var cont_id = dMode.CONT_ID; // Alias div id=cont_id (do cont). var cont = document.getElementById(cont_id); if (dMode.TYT_1 != "") { // Utwórz span w div i wyświetl tytuł 1 $(('#' + cont_id)).append('
'); var t1 = document.getElementById(cont_id + "_ty1"); var dty1 = document.getElementById(cont_id + "_dty1"); dty1.style.marginBottom = '10px'; t1.className = "rez_data_title"; t1.innerHTML = dMode.TYT_1; } if (dMode.TYT_2 != "") { // Utwórz span w div i wyświetl tytuł 2 $(('#' + cont_id)).append('
'); var t2 = document.getElementById(cont_id + "_ty2"); var dty2 = document.getElementById(cont_id + "_dty2"); dty2.style.marginBottom = '10px'; t2.className = "rez_data_title"; t2.innerHTML = dMode.TYT_2; } $(('#' + cont_id)).append('
'); // Utwódz tabelę w div id=cont_id (alias cont). Alias tabeli: xr var xr = document.getElementById(cont_id + "_rdt"); xr.className = "rez_data"; xr.style.fontFamily = "10px Arial"; // zakoment. i do css xr.style.width = dMode.SZER; var header = xr.createTHead(); //Header tabeli. Nazwy kolumn w hdr_names[] var drow = header.insertRow(0); drow.id = "rez_dt_hdr"; drow.className = "rez_data_hdr"; drow.style.height = "30px"; // do css? drow.style.fontWeight = "bold"; drow.style.padding = "10px"; drow.style.textAlign = 'center'; var hdr = dMode.HDR; for (i = 0; i < hdr.length; i++) { var dcell = drow.insertCell(i); // ew. dcell.style.textAlign = dMode.ALIGN[i]; dcell.innerHTML = hdr[i]; } var tableBody = document.createElement('tbody'); //body tabeli tableBody.className = "rez_body"; if (dMode.PUSTA) {return;} rezerw_id.length = 0; lp = 0; tableData.forEach(function(rowData) { //Kreator wierszy tabeli: licznik lp var row = document.createElement('tr'); row.style.height = "20px"; // row.style.backgroundColor = "white"; lc = 1 var cell = document.createElement('td'); //Wyświetl numer wiersza w 1-szej komórce cell.appendChild(document.createTextNode(lp+1)); row.appendChild(cell); rowData.forEach(function(cellData) { //Kreator komórek w wierszu: licznik lc var cell = document.createElement('td'); if (lc==1) cell.style.width = "70px"; if (nav_rez.m !== 3 && lc++ === 1) { rezerw_id[lp] = parseInt(cellData); cell.style.textAlign = 'right'; cell.style.paddingRight = '10px'; } else { if (nav_rez.m === 4 && lc === n_cells+1) { var chkbox = document.createElement('input'); chkbox.type = "checkbox"; chkbox.id = "chk_" + lp; chkbox.className = "chk" ; chkbox.setAttribute('onchange', 'rez_chb(' + lp + ')'); chkbox.checked = czybyli[lp]; cell.appendChild(chkbox); cellData = "TAK/NIE"; cell.style.width = "100px"; cell.style.textAlign = 'center'; } cell.appendChild(document.createTextNode(cellData)); //---- var cond1 = cell.innerHTML.match(/^[0-9\s\.,()\-'\xa0''zł']+$/); // jesli to liczba ew. z . lub , if (cond1){ cell.style.textAlign = 'right'; cell.style.paddingRight = '10px'; } //---- row.appendChild(cell); } }); tableBody.appendChild(row); //Gotowy wiersz dołącz do body lp += 1; }); xr.appendChild(tableBody); //Kompletne Body dołacz do tabeli cont.appendChild(xr); //Dołącz tabelę do kontenera div /* $('tr').each( function () // *JUSTYFIKACJA*: dla każdego wiersza { $(this).children('td').filter(function() // dla kolejnych komórek od 2-giej :gt(0) { var cond1 = this.innerHTML.match(/^[0-9\s\.,()\-'\xa0''zł']+$/); // jesli to liczba ew. z . lub , if (cond1){ $(this).css('text-align','right'); // justuj do prawej this.style.paddingRight = '20px'; // $(this).css('padding-right', '20px'); // $(".testclass").css('text-align','right'); // $(".testclass").css('padding-right','20px'); } }).css('text-align','right'); }); */ if (dMode.TYT_D != "") { // Utwórz span i wyświetl tytuł dolny $(('#' + cont_id)).append('
'); var tyd = document.getElementById(cont_id + "_tyd"); var dyd = document.getElementById(cont_id + "_dyd"); tyd.className = "rez_data_title"; dyd.style.width = dMode.SZER; dyd.style.textAlign = 'right'; dyd.style.marginTop = '10px'; tyd.innerHTML = dMode.TYT_D; } // d_r.disabled = true; //Deaktywuj przycisk "Wyświetl" if (nav_rez.m === 1 && tabelarez_on) { tabelarez_on = true; } if (nav_rez.m === 1) {document.getElementById("b_print").style.display = "inline"; } //Wyświetl przycisk "Drukuj" if (nav_rez.m === 3) {document.getElementById("w_print").style.display = "inline"; } //Wyświetl przycisk "Drukuj" // console.log(JSON.stringify(rezerw_id)); // if (nav_rez.m > 3) { console.log(JSON.stringify(czybyli)); } } //------------------------------------ADD_TABLE_ROW ------------------------------------------ function addTableRow (tableData, cont_id) { var akt_oper = nav_rez.m; nav_rez.m = 4; var xr = document.getElementById(cont_id + "_rdt"); if (!xr){ //Czy istnieje tabela? var tableData_1 = [[]]; tableData_1[0] = tableData; createTable(tableData_1, cont_id, true); var xr = document.getElementById(cont_id + "_rdt"); } var row = document.createElement('tr'); // var cont = document.getElementById("rez_dn"); row.className = "rez_data"; row.style.fontFamily = "10px Arial"; row.style.height = "20px"; // row.style.backgroundColor = "white"; tableData.forEach(function(cellData) { //Kreator komórek w wierszu: licznik lc var cell = document.createElement('td'); cell.appendChild(document.createTextNode(cellData)); row.appendChild(cell); }); xr.appendChild(row); //Gotowy wiersz dołącz do body nav_rez.m = akt_oper; } //----------------------------------REMOVE_TABLE--------------------------------------------- function removeTable(cont_id) { var tt1 = document.getElementById(cont_id + "_dty1"); if (tt1) tt1.parentNode.removeChild(tt1); var tt2 = document.getElementById(cont_id + "_dty2"); if (tt2) tt2.parentNode.removeChild(tt2); var tbl = document.getElementById(cont_id + "_rdt"); if (tbl) tbl.parentNode.removeChild(tbl); //Usuń ją z DOM var ttd = document.getElementById(cont_id + "_dyd"); if (ttd) ttd.parentNode.removeChild(ttd); // if (tyt) {document.getElementById("rpr_title").innerHTML = "";} return; if (nav_rez.m !== 3 ) { document.getElementById("rez_title1").innerHTML = ""; if (nav_rez.m > 3) {document.getElementById("rez_title2").innerHTML = "";} document.getElementById("b_print").style.display = "none"; //Ukryj przycisk "Drukuj" } else { document.getElementById("wys_title").innerHTML = ""; document.getElementById("w_print").style.display = "none"; //Ukryj przycisk "Drukuj" } } //----------------------------------REMOVE ALL OPTIONS--------------------------------------- //Usunięcie wszystkich opcji z listy select_id function removeAllOptions(select_id){ var select_menu = document.getElementById(select_id); select_menu.options.length = 0; } //-----------------------------------DZISIEJSZA DATA---------------------------------------- function theday () { var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! var yyyy = today.getFullYear(); if (dd < 10) { dd = '0'+dd; } if (mm < 10) { mm = '0'+mm; } today = yyyy + '-' + mm + '-' + dd; return (today); } function from_today (nd) { var d = new Date(); d.setDate(d.getDate() + nd); // var today = new Date(); var dd = d.getDate(); var mm = d.getMonth()+1; //January is 0! var yyyy = d.getFullYear(); if (dd < 10) { dd = '0'+dd; } if (mm < 10) { mm = '0'+mm; } var today = yyyy + '-' + mm + '-' + dd; return (today); } function from_theday (theday, nd) { var d = new Date(theday); d.setDate(d.getDate() + nd); // var today = new Date(); var dd = d.getDate(); var mm = d.getMonth()+1; //January is 0! var yyyy = d.getFullYear(); if (dd < 10) { dd = '0'+dd; } if (mm < 10) { mm = '0'+mm; } today = yyyy + '-' + mm + '-' + dd; return (today); } function caly_miesiac(dt1, dt2) { var d = new Date(dt1); var mt1 = d.getMonth(); var dp = from_theday (dt1, -1); var d = new Date(dp); var mt2 = d.getMonth(); var poczatek = mt1 != mt2; if (prawda_ze(theday(), "<", dt2)) return (false); var d = new Date(dt2); var mt1 = d.getMonth(); var dn = from_theday (dt2, 1); var d = new Date(dn); var mt2 = d.getMonth(); var koniec = mt1 != mt2; return(poczatek && koniec); } function ustaw_poprz_mc(mpt, dt1, dt2) { var d = new Date(); var dd = d.getDate(); var mm = d.getMonth()+1; //January is 0! $(mpt).val(mm-1); var yyyy = d.getFullYear(); if (mm < 10) { mc = '0'+mm; } else {mc = mm;} var pocz_mc = yyyy + '-' + mc + '-01'; if (mm == 12) { mm = 1; yyyy += 1; } else mm += 1; if (mm < 10) { mc = '0'+mm; } else {mc = mm;} var konc_mc = yyyy + '-' + mc + '-01'; konc_mc = from_theday (konc_mc, -1); $(dt1).val(pocz_mc); $(dt2).val(konc_mc); return; } function now (){ var now = new Date(); var czas = new Date(); now = theday(); var hh = czas.getHours(); var min = czas.getMinutes(); if (hh < 10) { hh = '0'+hh; }; if (min < 10) { min = '0'+min; }; now += ' ' + hh + ':' + min; return (now); } function prawda_ze (data1, relacja, data2) { var newdate1 = new Date(data1); var newdate2 = new Date(data2); switch (relacja) { case ">": if ( newdate1.setDate(newdate1.getDate()) > newdate2.setDate(newdate2.getDate()) ) { return (true); } break; case ">=": if ( newdate1.setDate(newdate1.getDate()) >= newdate2.setDate(newdate2.getDate()) ) { return (true); } break; case "<": if ( newdate1.setDate(newdate1.getDate()) < newdate2.setDate(newdate2.getDate()) ) { return (true); } break; case "<=": if ( newdate1.setDate(newdate1.getDate()) <= newdate2.setDate(newdate2.getDate()) ) { return (true); } break; case "=": if ( newdate1.setDate(newdate1.getDate()) === newdate2.setDate(newdate2.getDate()) ) { return (true); } break; case "!=": if ( newdate1.setDate(newdate1.getDate()) !== newdate2.setDate(newdate2.getDate()) ) { return (true); } break; } return (false); } /*------------------------------- SPRAWDŹ, CZY DATA JEST W DOPUSZCZALNYM PRZEDZIALE ----------------------------*/ function data_poprawna (data1) { if (prawda_ze (data1, ">", today())) { window.alert("Nie można wpisać do rejestru prac przyszłych"); $('#dt').val(today); $('#dt_m').val(today); $('#dk').val(today); $('#dk_m').val(today); $('#df1').val(today); $('#dg_m').val(today); return false; } if (prawda_ze (data1, "<", data_zamkniecia)) { window.alert("Data zamkniecia rozliczeń to:-- " + data_zamkniecia + " --wczesniejsze dane nie mogą być wprowadzane ani modyfikowane"); $('#dt').val(data_zamkniecia); $('#dt_m').val(data_zamkniecia); $('#dk').val(data_zamkniecia); $('#dk_m').val(data_zamkniecia); $('#df1').val(today); $('#dg_m').val(today); return false; } else { return true; } } /*---------------------------------- RÓŻNICA W DNIACH POMIĘDZY DWIEMA DATAMI -------------------------------*/ var date_diff_indays = function(date1, date2) { dt1 = new Date(date1); dt2 = new Date(date2); return Math.floor((Date.UTC(dt2.getFullYear(), dt2.getMonth(), dt2.getDate()) - Date.UTC(dt1.getFullYear(), dt1.getMonth(), dt1.getDate()) ) /(1000 * 60 * 60 * 24)); } /* ------------------------------------- ZAMIEŃ STRING NA LICZBĘ LUB BŁĄD ---------------------------------- */ function liczba_wpr (x){ if(!x || !(x = $.trim(x))) { x = "0";} var f2 = parseFloat(x.replace(',','.')); if (isNaN(f2)) { window.alert("Wpis kwoty nie jest prawidłową liczbą"); return(0); } return(f2); } //-----------------znajdź substr w string i zwróć kolejny substr o dł. len znaków ----------------- function parse_String (string, substr, len) { var pos = string.indexOf(substr); if (pos >= 0) { return (string.substring(pos+1, pos+len+1)); } else { return (""); } } //------------------------------- SUMA REZERWACJI KOL NR_KOL TABELI TABELA-------------------------- function suma_rezerw(tabela, l_rows, nr_kol) { var sum_r = 0; for (i=0; i 0) { var s = Math.floor((liczba % 1000)/100); var n = 0; var d = Math.floor((liczba % 100)/10); var j = Math.floor(liczba % 10); if (d == 1 && j>0) { n = j; d = 0; j = 0; } var k = 2; if (j == 1 && s+d+n == 0) k = 0; if (j == 2 || j == 3 || j == 4) k = 1; if (s+d+n+j > 0) wynik = setki[s]+dziesiatki[d]+nascie[n]+jednosci[j]+grupy[g][k]+wynik; g++; liczba = Math.floor(liczba/1000); } return(znak + wynik + ' ' + liczba_gro +"/100"); } else { return "Błędna kwota"; } } // -------------------------------------Kwota słownie jęz. angielski --------------------------------- function inwords(liczba) { var jednosci = ["", " one", " two", " three", " four", " five", " six", " seven", " eight", " nine"]; var nascie = ["", " eleven", " twelve", " thirteen", " fourteen", " fifteen", " sixteen", " seventeen", " eighteen", " nineteen"]; var dziesiatki = ["", " ten", " twenty", " thirty", " fourty", " fivety", " sixty", " seventy", " eighty", " ninety"]; var setki = ["", " one hundred", " two hundred", " three hundred", " four hundred", " five hundred", " six hundred", " seven hundred", " eight hundred", " nine hundred"]; var grupy = [ ["" ,"" ,""], [" thousand" ," thousands" ," thousands"], [" million" ," millions" ," millions"], [" billion"," billions"," billions"], [" trillion" ," trillions" ," trillions"], [" quadrillion"," quadrillions"," quadrillions"], [" quintillion"," quintillions"," quintillions"]]; if (!isNaN(liczba)){ var wynik = ''; var znak = ''; if (liczba == 0) wynik = "zero"; if (liczba < 0) { znak = "minus"; liczba = -liczba; } liczba_dec = parseFloat(liczba).toFixed(2); liczba_clk = Math.trunc(liczba_dec); liczba_gro = Math.trunc((liczba_dec - liczba_clk) * 100); var g = 0; while (liczba > 0) { var s = Math.floor((liczba % 1000)/100); var n = 0; var d = Math.floor((liczba % 100)/10); var j = Math.floor(liczba % 10); if (d == 1 && j>0) { n = j; d = 0; j = 0; } var k = 2; if (j == 1 && s+d+n == 0) k = 0; if (j == 2 || j == 3 || j == 4) k = 1; if (s+d+n+j > 0) wynik = setki[s]+dziesiatki[d]+nascie[n]+jednosci[j]+grupy[g][k]+wynik; g++; liczba = Math.floor(liczba/1000); } return(znak + wynik + ' ' + liczba_gro +"/100"); } else { return "Błędna kwota"; } }