// JavaScript Document function loadNote() { var docid = "id=" + document.getElementById("dispatch_note").value; var req = new Request( { method : 'post', data : docid, url : "/stock/ajax/load_transfer_note.php", onSuccess : function(result) { if(result.toString().indexOf("Transfer Orde") != -1 ) { alert(result); } else{ var jObj = JSON.decode(result); document.getElementById("document_number").value = jObj["header"][0]["document_id"]; document.getElementById('depot').value = jObj["header"][0]["storage_location"]; /* * document.getElementById('document_date').innerHTML = * jObj["header"][0]["document_date"]; * document.getElementById('reigon').innerHTML = * jObj["header"][0]["region_text"]; * document.getElementById('depot_t').innerHTML = * jObj["header"][0]["depot_txt"]; * document.getElementById('coupe').innerHTML = * jObj["header"][0]["coupe_txt"]; * document.getElementById('hammer').innerHTML = * jObj["header"][0]["var_text2"]; * document.getElementById('contractor').innerHTML = * jObj["header"][0]["contractor_txt"]; * * document.getElementById('document_number').value = * jObj["header"][0]["document_id"]; * */ for ( var i = 0; i < jObj["item"].length; i++) { rows++; var container = document.getElementById("grid_content"); var row = document.createElement("div"); row.className = "gridRow"; row.id = "row_" + rows; var colHead = document.createElement("div"); colHead.className = "gridRowHandle"; colHead.id = "colHead_" + rows; colHead.onclick = function() { markRow(this); } row.appendChild(colHead); var col1 = document.createElement("div"); col1.className = "gridCol"; col1.innerHTML = jObj["item"][i]["category"]; var input1 = document.createElement("input"); input1.type = "hidden"; input1.id = "col1_" + rows; input1.className = "gridField"; input1.value = jObj["item"][i]["material_no"]; col1.appendChild(input1); row.appendChild(col1); // // var col2 = document.createElement("div"); // col2.className = "gridCol"; // col2.innerHTML = jObj["item"][i]["old_ref_no"]; // row.appendChild(col2); var col2 = document.createElement("div"); col2.className = "gridCol"; col2.innerHTML = jObj["item"][i]["visible_material_no"]; var input2 = document.createElement("input"); input2.type = "hidden"; input2.id = "col2_" + rows; input2.className = "gridField"; input2.value = jObj["item"][i]["visible_material_no"]; col2.appendChild(input2); row.appendChild(col2); var col3 = document.createElement("div"); col3.className = "gridCol"; col3.innerHTML = jObj["item"][i]["class_txt"]; row.appendChild(col3); var col4 = document.createElement("div"); col4.className = "gridCol"; col4.innerHTML = jObj["item"][i]["species_txt"]; row.appendChild(col4); var col5 = document.createElement("div"); col5.className = "gridCol"; var input5 = document.createElement("input"); input5.id = "col5_" + rows; input5.className = "gridField"; input5.value = jObj["item"][i]["length"]; input5.onclick = function() { resetRow(); selectAxis(this); } col5.appendChild(input5); row.appendChild(col5); var col6 = document.createElement("div"); col6.className = "gridCol"; var input6 = document.createElement("input"); input6.id = "col6_" + rows; input6.className = "gridField"; input6.value = jObj["item"][i]["girth"]; input6.onclick = function() { resetRow(); selectAxis(this); } col6.appendChild(input6); row.appendChild(col6); var col7 = document.createElement("div"); col7.className = "gridCol"; var input7 = document.createElement("input"); input7.id = "col7_" + rows; input7.className = "gridField"; input7.value = jObj["item"][i]["volume"]; input7.onclick = function() { resetRow(); selectAxis(this); } col7.appendChild(input7); row.appendChild(col7); var col8 = document.createElement("div"); col8.className = "gridCol"; var input8 = document.createElement("input"); input8.id = "col8_" + rows; input8.className = "gridField"; col8.appendChild(input8); row.appendChild(col8); container.appendChild(row); printRowOrder(); } } } }); req.send(); document.getElementById('waitingDiv').style.display = ""; }