function callroomdeclarationStph() { $('#page_main_div').load( '../html_modules/roomdeclaration_stph.html', function () { document.getElementById('display_module_name').innerHTML = 'Room Declaration and Capacity ' document.getElementById('module_name_for_save').value = 'Room Declaration and Capacity' getDefaultHeadFooterLinks('Room Declaration and Capacity MultiQP'); if (db == "demo") { $("#totalrooms").val("5"); } } ) } function DisplayRoomDeclarationDetatilsStph() { var roomcnt = trim(document.getElementById('totalrooms').value) document.getElementById('roomdeclaration').innerHTML = '' if (roomcnt == '') { alert('Enter Total Rooms') document.getElementById('totalrooms').focus() return false } $.ajax({ type: 'POST', url: $host_url + 'displayroomdeclarationdetailsStph', success: function (responce) { responce = eval('(' + responce + ')') var roomdecl = responce.data var rtable = "" rtable += "" rtable += "" rtable += "" rtable += "" rtable += "" rtable += "" rtable += "" rtable += '' var hval = '' for ( var i = 1, j = 0, k = roomdecl.length; i <= roomcnt; i++, j++, k-- ) { var roomtitle = '' var roomcap = '' var order = '' var roomno = '000' + i var qpcnt = '' roomno = roomno.substring(roomno.length - 3) if (k > 0) { if (roomdecl[j].roomname != undefined) roomtitle = roomdecl[j].roomname if (roomdecl[j].capacity != undefined) roomcap = roomdecl[j].capacity if (roomdecl[j].forder != undefined) order = roomdecl[j].forder if (roomdecl[j].fmaxqpcnt != undefined) qpcnt = roomdecl[j].fmaxqpcnt if (roomdecl[j].fprefix != undefined) prefix = roomdecl[j].fprefix hval = '' } else { hval = 'i' prefix = '' } rtable += "" rtable += "" rtable += "" rtable += "" rtable += "" rtable += '' } rtable += '
Room NoRoom NameCapacityOrderNo. of QP'sPrefix
' document.getElementById('roomdeclaration').innerHTML = rtable }, }) } function updatehval(i) { if (document.getElementById('HGT' + i).value != 'i') document.getElementById('HGT' + i).value = 'u' } function saveroomdeclarationStph() { var inputFileds = document.getElementsByTagName('input') var chkCnt = 0 var rowCnt = 0 var room_arru = {} var room_arri = {} for (var counter = 0; counter < inputFileds.length; counter++) { if ( inputFileds[counter].type.toUpperCase() == 'TEXT' && inputFileds[counter].name == 'roomdecl' ) { ++chkCnt if (trim(document.getElementById('2GT' + chkCnt).value) == '') { alert( 'Enter Title for the Room No :' + document.getElementById('1GT' + chkCnt).value ) document.getElementById('2GT' + chkCnt).focus() return false } if (trim(document.getElementById('3GT' + chkCnt).value) == '') { alert( 'Enter Capacity for the Room No :' + document.getElementById('1GT' + chkCnt).value ) document.getElementById('3GT' + chkCnt).focus() return false } if (trim(document.getElementById('5GT' + chkCnt).value) == '') { alert( 'Enter No. of qpcodes for the Room No :' + document.getElementById('1GT' + chkCnt).value ) document.getElementById('5GT' + chkCnt).focus() return false } if (trim(document.getElementById('6GT' + chkCnt).value) == '') { alert( 'Enter Prefix :' + document.getElementById('1GT' + chkCnt).value ) document.getElementById('6GT' + chkCnt).focus() return false } if (trim(document.getElementById('HGT' + chkCnt).value) == 'u') { room_arru[chkCnt] = new Object() room_arru[chkCnt]['roomno'] = document.getElementById( '1GT' + chkCnt ).value room_arru[chkCnt]['roomname'] = document.getElementById( '2GT' + chkCnt ).value room_arru[chkCnt]['capacity'] = document.getElementById( '3GT' + chkCnt ).value room_arru[chkCnt]['order'] = document.getElementById( '4GT' + chkCnt ).value room_arru[chkCnt]['qpcnt'] = document.getElementById( '5GT' + chkCnt ).value room_arru[chkCnt]['prefix'] = document.getElementById( '6GT' + chkCnt ).value } if (trim(document.getElementById('HGT' + chkCnt).value) == 'i') { room_arri[chkCnt] = new Object() room_arri[chkCnt]['roomno'] = document.getElementById( '1GT' + chkCnt ).value room_arri[chkCnt]['roomname'] = document.getElementById( '2GT' + chkCnt ).value room_arri[chkCnt]['capacity'] = document.getElementById( '3GT' + chkCnt ).value room_arri[chkCnt]['order'] = document.getElementById( '4GT' + chkCnt ).value room_arri[chkCnt]['qpcnt'] = document.getElementById( '5GT' + chkCnt ).value room_arri[chkCnt]['prefix'] = document.getElementById( '6GT' + chkCnt ).value } } } var parameters = '&room_arri=' + encodeURIComponent(JSON.stringify(room_arri)) + '&room_arru=' + encodeURIComponent(JSON.stringify(room_arru)) $.ajax({ type: 'POST', url: $host_url + 'saveroomdeclarationdetailsStph', data: parameters, success: function (responce) { responce = eval('(' + responce + ')') alert(responce.data) document.getElementById('roomdeclaration').innerHTML = '' }, }) }