TRANSPORT SECTOR - Online Benchmarking Tools /* Disabled btn look */ .block_submit input[disabled], .block_submit input[disabled="disabled"]{ background-color: #c0c0c0; } .warning_error_total, .warning_error_total2, .warning_error_total3 { font-size: 16px; font-weight:bold; color: #FF0000; } .warning_error_total_bk { font-size: 16px; font-weight:bold; color: #000000; } .oneTbl {background-color:#00B0F0; color:#FFFFFF;} #secondTable tr > td:nth-child(12)+ td { color: #077985; text-decoration: underline;} select { width: 180px !important; } .block label { font-size: 1.2em; } Please select Principal Group of your vehicle: var editor_1; // use a global for the submit and return data rendering in the examples var table_1; var table_2; var table_3; jQuery(document).ready(function () { //jQuery("#block1").css("visibility","visible"); editor_1 = new jQuery.fn.dataTable.Editor({ ajax: "/modules/mod_aa_sector_three/php/sec.php", table: "#firstTable", fields: [{ label: "PID:", name: "gp_parent_id" }, { label: "group_code:", name: "group_code" }, { label: "Name (EN):", name: "name_en" } ] }); // Apply the search var seBxKey = "" var table_1 = jQuery('#firstTable').DataTable({ dom: "t", "table": "#firstTable", ajax: { url: "/modules/mod_aa_sector_three/php/sec.php", type: "POST" }, "order": [[2, 'ASC']], "responsive": true, "searchHighlight": true, "saveStatus": true, "search": { "search": "" }, "serverSide": true, "processing": true, "select": true, columns: [ {data: "ecib_bm_group.id"}, {data: "ecib_bm_group.group_code"}, {data: "ecib_bm_group.name_en"} ], select: true, buttons: [] }); jQuery("#firstTable tbody").on("click", 'td', function () { // jQuery("#block1").css("visibility","hidden"); jQuery("#block2").css("visibility", "visible"); jQuery("#firstForm").css("visibility", "hidden"); // jQuery(".display").css("display","none"); // table data to form input from object var data = table_1.row(jQuery(this).closest('tr')).data(); var pid = data.ecib_bm_group.id; var ppid = data.ecib_bm_group.gp_parent_id; table_2.ajax.url('/modules/mod_aa_sector_three/php/sec2.php?pid=' + pid).load(); table_2.draw(); if (ppid != 3) { jQuery("#block2").css("visibility", "hidden"); // (1) alert('no pid'); } }); var table_2 = jQuery('#secondTable').DataTable({ dom: "t", "table": "#secondTable", "ajax": { url: '/modules/mod_aa_sector_three/php/sec2.php', type: 'POST'}, "order": [[1, 'ASC']], "responsive": true, "searchHighlight": true, "saveStatus": true, "search": { "search": "" }, "serverSide": true, "processing": true, "select": true, columns: [ {data: "ecib_bm_group.gp_parent_id"}, {data: "ecib_bm_group.group_code"}, {data: "ecib_bm_group.name_en"}, {data: "ecib_bm_group.query_ids"} ], select: true, buttons: [] }); jQuery("#secondTable tbody").on("click", 'td', function () { // jQuery("#block1").css("visibility","hidden"); // jQuery("#block2").css("visibility","hidden"); // jQuery(".display").css("display","none"); // jQuery(".display2").css("display","none"); jQuery("#block3").css("visibility", "visible"); jQuery("#firstForm").css("visibility", "visible"); // table data to form input from object var data2 = table_2.row(jQuery(this).closest('tr')).data(); var pid2 = data2.ecib_bm_group.id; var ppid2 = data2.ecib_bm_group.gp_parent_id; //alert(pid2); //var a = $que_records->count(); //var_dump(a) }); }) jQuery("#startBtn").on('click', function () { alert("startBtn press"); }); #cus2 { margin-top:5px; width:160px; height:85px; margin-right:0px; font-weight:bolder; vertical-align: top; -moz-box-shadow:inset 0px 1px 0px 0px #54a3f7; -webkit-box-shadow:inset 0px 1px 0px 0px #54a3f7; box-shadow:inset 0px 1px 0px 0px #54a3f7; background-color:transparent; -moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; border:1px solid #19a3ff; display:inline-block; cursor:pointer; color:#134dc2; font-family:Arial; font-size:14px; padding:5px 5px; text-decoration:none; text-shadow:0px 1px 0px #0f7bff; } button, #cus2:hover { background-color:transparent;; } button, #cus2:active { position:relative; top:1px; } button {border solid 2px transparent !important;} /* button, #cus1 { width:160px; height:70px; margin-top:5px; margin-right:4px; font-weight:bolder; vertical-align: top; -moz-box-shadow:inset 0px 1px 0px 0px #3dc21b; -webkit-box-shadow:inset 0px 1px 0px 0px #3dc21b; box-shadow:inset 0px 1px 0px 0px #3dc21b; background-color:transparent; -moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; border:1px solid #18ab29; display:inline-block; cursor:pointer; color:#288005; font-family:Arial; font-size:13px; padding:5px 5px; text-decoration:none; text-shadow:0px 1px 0px #2f6627; } button, #cus1:hover { background-color:transparent; } button, #cus1:active { position:relative; top:1px; } */ #levelone {border: 1px solid #61bf76; } #leveltwo {border: 1px solid transparent; margin-right: 4px !important; } .arrowSeperator { display: block; text-align: center; border: 1px solid #ddd; width: 100%; height: 0; position: relative; margin-top: 20px; margin-bottom: 30px; } .arrowSeperator:before { content: ""; width: 0; height: 0; border-left: 15px solid transparent; border-right: 15px solid transparent; border-top: 15px solid #ddd; position: absolute; top: 100%; /* left: 20%; right: 20%; */ /* margin: 0 -15px; */ z-index: 1; } var ym_list = null; var ym_first_year = null; var ym_first_month = null; var ym_last_year = null; var ym_last_month = null; jQuery.ajax( { dataType:"json", type:"POST", data:{ ajax_task:'getAllValidYearMonth', }, url:jQuery(location).attr("href") } ).always(function(e){ var re = /(.*)/; var result = re.exec(e.responseText); if( result ){ if( result[1] != "" ){ ym_list = JSON.parse(result[1]); ym_first_year = ym_list.years.replace( /()/, '' ); ym_last_year = ym_list.years.replace( /()(?!.*())/, '' ); ym_first_month = ym_list.months[ym_list.years_name[0]].replace( /()/, '' ); ym_last_month = ym_list.months[ym_list.years_name[ym_list.years_name.length - 1]].replace( /()(?!.*())/, '' ); // ym_first_year = ym_list.years; // ym_last_year = ym_list.years; // ym_first_month = ym_list.months[ym_list.years_name[0]]; // ym_last_month = ym_list.months[ym_list.years_name[ym_list.years_name.length - 1]]; } } }); jQuery(document).ready(function () { //$.get(URL,callback); var a = jQuery.get("/modules/mod_aa_sector_three/php/sec.php", function (data, status) { var strBuilder = []; for (key in a) { if (a.hasOwnProperty(key)) { strBuilder.push("Key is " + key + ", value is " + a[key] + "\n"); } } // (2) alert(strBuilder.join("")); //alert(a[key]); // display "OK" // (3) alert(data); // Fion add alert here // data = $.parseJSON(data); data = JSON.parse(data); jQuery.each(data, function (i, v) { console.log(i, v); }); jQuery("button").click(function () { // jQuery("#block2").load("/modules/mod_aa_sector_three/php/sec.php"); // alert(a); }); }); /*jQuery("#btn5").click(function(){ alert("btn555 clicked...."); if slider : min, mean, max add textField : input_val, xi_value (sec3.php) , cal_value });*/ jQuery(".group_btn_custom").click(function () { var group_id = jQuery(this).attr('data-group-id') console.log("group_id:"+group_id); // (4) alert('Group Id: ' + group_id + ' Clicked'); //hide block 1 Matthew me = jQuery(this)[0]; console.log(me); jQuery("#block1").html(me.outerHTML); jQuery("#arrow1").show(); group_data = jQuery(this).attr('data-all'); //alert(group_data); var block2BtnsHtml = ''; jQuery.ajax({ dataType: "json", type: "GET", data: {'pid': group_id}, url: '/modules/mod_aa_sector_three/php/sec2.php', success: function (response) { // (5) alert(JSON.stringify(response.data)); console.log(response.data); if (response.data === undefined || response.data.length == 0) { // (6) alert('Loading Questions on null with : ' + group_id); showBlock3(group_id); } else { jQuery("#arrow3").show(); jQuery("#block4").hide(); jQuery(".block_submit").hide(); response.data.forEach(function (value, key) /* { block2BtnsHtml += '' + value.ecib_bm_group.group_code + '' + value.ecib_bm_group.name_en + '' + value.ecib_bm_group.id + ' / ' + value.ecib_bm_group.gp_parent_id + ''; } */ { block2BtnsHtml += '' +''+ ''+ value.ecib_bm_group.name_en + ' (' + value.ecib_bm_group.group_code +') '+ ' '; } ); jQuery('html, body').animate({ scrollTop: jQuery( "#arrow1" ).offset().top-100 }, 500); } jQuery('#block2Btns').html(block2BtnsHtml); if (response.data == '') { jQuery('#block3').css('visibility', 'visible'); } } }); }); }); //end function showBlock3(_pid) { //hide block 2 Matthew try{ me = jQuery("button[data-pid=" + _pid + "]")[0]; console.log(me); jQuery("#block2").html(me.outerHTML); jQuery("#arrow2").show(); } catch ( e ) {} jQuery("#block4").show(); jQuery('html, body').animate({ scrollTop: jQuery( "#qTitle" ).offset().top }, 500); jQuery(".block_submit").show(); var cal_title = ""; if( jQuery("[data-group-id="+_pid+"]").length > 0 ){ cal_title = 'BENCHMARKING Tools for ' + jQuery("[data-group-id="+_pid+"] span").html().trim().replace(/(\r\n|\n|\r||)/gm, "").replace(/\s\s+/g," "); }else if( jQuery("[data-pid="+_pid+"]").length > 0 ){ cal_title = 'BENCHMARKING Tools for ' + jQuery("[data-pid="+_pid+"] span").html().trim().replace(/(\r\n|\n|\r||)/gm, "").replace(/\s\s+/g," "); } // (8) alert('Clicked with : ' + _pid); console.log("_pid:"+_pid); jQuery('#block3').css('visibility', 'visible'); jQuery.ajax({ dataType: "json", type: "GET", data: {'pid': _pid}, url: '/modules/mod_aa_sector_three/php/sec3.php', success: function (response) { var is_xi_flag0 = is_xi_flag1 = is_xi_flag2 = is_xi_flag22 = is_xi_flag23 = is_xi_flag3 = is_xi_flag4 = is_xi_flag5 = ''; // (9) alert(JSON.stringify(response.data)); console.log("DATA",response.data); var question_counter = 1; response.data.forEach(function (value, key) { var _value = value; var _html = ''; /* Fion */ var question_no = false; if( _value.ecib_bm_group_xi.xi_id != 1 && _value.ecib_bm_xi_value.is_child != 1) question_no = true; if (_value.ecib_bm_xi_value.is_xi_flag == 0) { _html += ' '; // _html += ''; // comment this line to show Intercept _html += ''; // comment this line to hide Intercept _html += ' ' + _value.ecib_bm_xi_value.que_en + ''; //if is_parent == 1, skip the input box, leave just the label if( _value.ecib_bm_group_xi.is_parent != 1 ){ _html += ''; _html += ' '; _html += ''; _html += ' '; var onkeyup_string = ""; var preCalVal = _value.ecib_bm_group_xi.input_val * _value.ecib_bm_group_xi.xi_value; _html += ' ' + _value.ecib_bm_xi_value.unit_en + ' '; _html += ' '; _html += ' '; _html += ''; _html += ''; _html += ''; _html += 'jQuery(function ()'; _html += '{'; _html += 'jQuery("#slider-range-min' + _value.ecib_bm_group_xi.xi_id + '").slider({'; _html += 'range: "min",'; _html += 'value: ' + _value.ecib_bm_group_xi.input_val + ','; _html += 'min: ' + _value.ecib_bm_group_xi.min + ','; _html += 'max: ' + _value.ecib_bm_group_xi.max + ','; _html += 'step: ' + ( parseInt(_value.ecib_bm_group_xi.step) '; // _html += ck_hundred_total(); // Fion Wrong : now is undefinied } else if( _value.ecib_bm_group_xi.is_parent != 1 ){ _html += '' _html += ''; _html += ''; _html += ''; var preCalVal = _value.ecib_bm_group_xi.input_val * _value.ecib_bm_group_xi.xi_value; // _html += ''; _html += ' % '; // _html += ' '; _html += ' '; _html += ''; _html += ''; _html += ' position 3 : '; _html += ''; _html += ''; _html += ''; _html += 'jQuery(function ()'; _html += '{'; _html += 'jQuery("#slider-range-min' + _value.ecib_bm_group_xi.xi_id + '").slider({'; _html += 'range: "min",'; _html += 'value: ' + _value.ecib_bm_group_xi.input_val + ','; _html += 'min: ' + _value.ecib_bm_group_xi.min + ','; _html += 'max: ' + _value.ecib_bm_group_xi.max + ','; _html += 'step: ' + ( parseInt(_value.ecib_bm_group_xi.step) '; // _html += ck_hundred_total2(); // Fion Wrong : now is undefinied } else if( _value.ecib_bm_group_xi.is_parent != 1 ){ _html += '' _html += ''; _html += ''; _html += ''; var preCalVal = _value.ecib_bm_group_xi.input_val * _value.ecib_bm_group_xi.xi_value; // _html += ''; _html += ' % '; // _html += ' '; _html += ' '; _html += ''; _html += ''; _html += ' position 3 : '; _html += ''; _html += ''; _html += ''; _html += 'jQuery(function ()'; _html += '{'; _html += 'jQuery("#slider-range-min' + _value.ecib_bm_group_xi.xi_id + '").slider({'; _html += 'range: "min",'; _html += 'value: ' + _value.ecib_bm_group_xi.input_val + ','; _html += 'min: ' + _value.ecib_bm_group_xi.min + ','; _html += 'max: ' + _value.ecib_bm_group_xi.max + ','; _html += 'step: ' + ( parseInt(_value.ecib_bm_group_xi.step) '; // _html += ck_hundred_total3(); // Fion Wrong : now is undefinied } else if( _value.ecib_bm_group_xi.is_parent != 1 ){ _html += '' _html += ''; _html += ''; _html += ''; var preCalVal = _value.ecib_bm_group_xi.input_val * _value.ecib_bm_group_xi.xi_value; // _html += ''; _html += ' % '; // _html += ' '; _html += ' '; _html += ''; _html += ''; _html += ' position 3 : '; _html += ''; _html += ''; _html += ''; _html += 'jQuery(function ()'; _html += '{'; _html += 'jQuery("#slider-range-min' + _value.ecib_bm_group_xi.xi_id + '").slider({'; _html += 'range: "min",'; _html += 'value: ' + _value.ecib_bm_group_xi.input_val + ','; _html += 'min: ' + _value.ecib_bm_group_xi.min + ','; _html += 'max: ' + _value.ecib_bm_group_xi.max + ','; _html += 'step: ' + ( parseInt(_value.ecib_bm_group_xi.step) 0 ){ // var sum = 0; // jQuery(".warning_hundred").each(function () // { // if (parseFloat(jQuery(this).val().trim().replace(/\s*,\s*|\s+,/g, '')) != 0) // { // sum = sum + parseFloat(jQuery(this).val().trim().replace(/\s*,\s*|\s+,/g, '')); // } // }); // if (isNaN(sum) == false) // { // jQuery('.warning_error_total').html('Total ' + sum.toFixed(2) + '%'); // } // else // { // jQuery('.warning_error_total_bk').html('Total 0.00%'); // } // if (sum < 100 || sum > 100) // { // jQuery('.warning_error').html('(The total % in four respective area should be equal to 100%)'); // } // else // { // jQuery('.warning_error').html(''); // } // ck_can_submit(); // } // Fion even comment ck_hundred_total seem no affeat ck_hundred_total(); // important here should the Q jQuery("label[add-question-no]").each( function( i, val ){ var org_html = jQuery(val).html(); jQuery(val).html( "Q" + (i+1) + ". " + org_html ); }); }); jQuery(".datePickSelect").on("change", function(e){ var xiid = jQuery(this).attr('xiid'); var dtype = jQuery(this).attr('dtype'); var stype = jQuery(this).attr('stype'); if( dtype == "year" ){ var selYear = jQuery(this).val(); jQuery("#"+stype+"Month"+xiid).html(ym_list.months[selYear]); } validateDate( xiid ); }); function validateDate ( xiid ){ var selStYear = jQuery("#startYear"+xiid).val(); var selStMonth = jQuery("#startMonth"+xiid).val(); var selEdYear = jQuery("#lastYear"+xiid).val(); var selEdMonth = jQuery("#lastMonth"+xiid).val(); if( selStYear > selEdYear ){ jQuery("#lastYear"+xiid).val( selStYear ); selEdYear = selStYear; jQuery("#lastMonth"+xiid).html(ym_list.months[selStYear]).val( selStMonth ); selEdMonth = selStMonth; }else if( selStYear == selEdYear && selStMonth > selEdMonth ){ jQuery("#lastMonth"+xiid).html(ym_list.months[selStYear]).val(selStMonth); selEdMonth = selStMonth; } var stMon = selStYear + "-" + selStMonth; var edMon = selEdYear + "-" + selEdMonth; date_ajax_call( stMon, edMon, xiid ); } jQuery(".warning_hundred .warning_hundred2 .warning_hundred3").on("keypress keyup blur", function (event) { //this.value = this.value.replace(/[^0-9\.]/g,''); jQuery(this).val(jQuery(this).val().replace(/[^0-9\.]/g, '')); if ((event.which != 46 || jQuery(this).val().indexOf('.') != -1) && (event.which < 48 || event.which > 57)) { event.preventDefault(); } // if (jQuery(this).val() == "" || jQuery(this).val() == null) // { // jQuery(this).val(0); // } }); jQuery('.warning_hundred').on( 'keypress keyup blur', function (event) { ck_hundred_total(); }); jQuery('.warning_hundred2').on( 'keypress keyup blur', function (event) { ck_hundred_total2(); }); jQuery('.warning_hundred3').on( 'keypress keyup blur', function (event) { ck_hundred_total3(); }); // Trigger ck_can_submit function whenever disclaimer box is clicked jQuery("#agree").on("change", function(){ ck_can_submit(); }); jQuery(".xi_flag_5_radio_btn").on( 'change', function(){ var cked_xiid = jQuery(this).attr('xiid'); var par_xiid = jQuery(this).attr('par_xiid'); jQuery( '.radio_btn_block' + par_xiid ).each( function(){ var dummy_xiid = jQuery(this).find('.xi_flag_5_radio_btn').attr('xiid'); var cked_opt = ( dummy_xiid == cked_xiid ? true : false ); jQuery(this).attr('valid', 1); jQuery(this).find('.input_val').val( ( cked_opt ? 1 : 0 ) ); jQuery(this).find('.tran_val').val( ( cked_opt ? 1 : 0 ) ); jQuery(this).find('.cal_val').val( ( cked_opt ? jQuery(this).find('.xi_val').val() : 0 ) ); }); ck_can_submit(); } ); // xi_flag_5_radio_btn from 1096 // jQuery('.date-picker').datepicker({ // changeMonth: true, // changeYear: true, // showButtonPanel: true, // dateFormat: 'yy-mm', // // onClose: function (dateText, inst) // // { // // console.log( inst ); // // // console.log( jQuery(this) ); // // jQuery(this).datepicker('setDate', new Date(inst.selectedYear, inst.selectedMonth, 1)); // // } // onChangeMonthYear: function( year, month, inst ) // { // var xi_id = jQuery(this).attr('xi_id'); // // jQuery("#input_val"+xi_id).attr( "cFlag", 1 ); // }, // onClose: function( dateText, inst ) // { // var xi_id = jQuery(this).attr('xi_id'); // // var changeFlag = jQuery("#input_val"+xi_id).attr( "cFlag" ); // // if( changeFlag == 1 ){ // jQuery(this).datepicker('setDate', new Date(inst.selectedYear, inst.selectedMonth, 1)); // date_ajax_call( xi_id ); // } // // jQuery("#input_val"+xi_id).attr( "cFlag", 0 ); // } // }); //date-picker ck_can_submit(); } }); } function onSliderSetInputChange( input_val, xiid, xi_val, min, max, is_xi_flag, needLog, from_slider ){ if( is_xi_flag == 2 && is_xi_flag == 7 && is_xi_flag == 8 && !from_slider && input_val.match(/\d.\d{2}\d+/) ){ input_val = parseFloat(input_val).toFixed(2); } jQuery( '#input_val' + xiid ).val( input_val ); var tranVal = ( needLog ? Math.log( input_val ) : input_val ); jQuery( '#tran_val' + xiid ).val( tranVal ); var floatCalVal = tranVal * xi_val; var stringCalVal = floatCalVal.toString(); var fixedCalPattern = /(-*\d+\.\d*[^0])000[0]*[1-9]$/; var matches = stringCalVal.match(fixedCalPattern); if( matches ){ if( matches[1] ){ floatCalVal = matches[1]; } } if( !from_slider ){ jQuery("#slider-range-min" + xiid).slider("value",input_val); } jQuery( '#cal_val' + xiid ).val( floatCalVal ); check_box_valid( xiid, min, max ); // wrong by if( is_xi_flag == 2 && is_end == 1 ) if( is_xi_flag == 2){ ck_hundred_total(); } else if ( is_xi_flag == 7){ ck_hundred_total2(); } else { ck_hundred_total3(); } } function formatNumber(num) { return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,') } function check_box_valid( xi_id, min_val, max_val ){ if( !min_val ){ min_val = 0; } if( !max_val ){ max_val = 100; } if( xi_id == 1 ) return; var input_val = jQuery("#input_val"+xi_id).val(); // warning msg for inputting non-numeric character e.g. alphabetic character if( isNaN( input_val ) ){ jQuery("#warning_box"+xi_id).html('Please input numeric character'); jQuery("#warning_box"+xi_id).show(); jQuery("#input_val"+xi_id).attr('valid', 0); ck_can_submit(); return; } if( min_val !== false || max_val !== false ){ // warning msg for input value exceeds the given range if( input_val < min_val || input_val > max_val ){ jQuery("#warning_box"+xi_id).html('Please input a number within the range ' + min_val + ' to ' + formatNumber(max_val) + ''); jQuery("#warning_box"+xi_id).show(); jQuery("#input_val"+xi_id).attr('valid', 0); ck_can_submit(); return; } } jQuery("#warning_box"+xi_id).hide(); jQuery("#input_val"+xi_id).attr('valid', 1); ck_can_submit(); } function ck_can_submit(){ var can_submit = true; jQuery("input[valid]").each( function(i, val){ if( jQuery(val).attr("valid") != 1 ){ can_submit = false; return false; } }); if( jQuery('wXiFlagTwo').length > 0 ){ if( jQuery('.warning_error').html() != '' ){ can_submit = false; } } if( jQuery('wXiFlagTwoTwo').length > 0 ){ if( jQuery('.warning_error2').html() != '' ){ can_submit = false; } } if( jQuery('wXiFlagTwoThree').length > 0 ){ if( jQuery('.warning_error3').html() != '' ){ can_submit = false; } } if( jQuery("#agree").is(":not(:checked)") ){ can_submit = false; } jQuery(".radio_btn_block[valid]").each( function(i, val){ if( jQuery(val).attr("valid") != 1 ){ can_submit = false; return false; }else{ jQuery("#arrow4").hide(); jQuery("#arrow5").hide(); } }); jQuery(".datePickSelect").each( function(){ if( !jQuery(this).val() ){ can_submit = false; return false; } }); if( can_submit ){ jQuery('#createRpt').removeAttr("disabled"); // jQuery("#arrow3").hide(); }else{ jQuery("#createRpt").attr("disabled", "disabled"); } // console.log("checked ck submit"); } function ck_hundred_total(){ if( jQuery('wXiFlagTwo').length > 0){ var sum = 0; jQuery('.warning_hundred').each(function () { $input_val = parseFloat(jQuery(this).val().trim().replace(/\s*,\s*|\s+,/g, '')); $input_val = isNaN($input_val) ? 0 : $input_val; sum = sum + $input_val; }); if (isNaN(sum) == false) { jQuery('.warning_error_total').html('Totals ' + sum.toFixed(2) + '%'); } else { jQuery('.warning_error_total').html('Total 0.00%'); } if (sum < 100 || sum > 100) { jQuery('.warning_error').html('(The sum of above % input shall be 100%.)'); } else { jQuery('.warning_error').html(''); } ck_can_submit(); } } function ck_hundred_total2(){ if( jQuery('wXiFlagTwoTwo').length > 0){ var sum = 0; jQuery('.warning_hundred2').each(function () { $input_val = parseFloat(jQuery(this).val().trim().replace(/\s*,\s*|\s+,/g, '')); $input_val = isNaN($input_val) ? 0 : $input_val; sum = sum + $input_val; }); if (isNaN(sum) == false) { jQuery('.warning_error_total2').html('Total ' + sum.toFixed(2) + '%'); } else { jQuery('.warning_error_total2').html('Total 0.00%'); } if (sum < 100 || sum > 100) { jQuery('.warning_error2').html('(The sum of above % input shall be 100%.)'); } else { jQuery('.warning_error2').html(''); } ck_can_submit(); } } function ck_hundred_total3(){ if( jQuery('wXiFlagTwoThree').length > 0){ var sum = 0; jQuery('.warning_hundred3').each(function () { $input_val = parseFloat(jQuery(this).val().trim().replace(/\s*,\s*|\s+,/g, '')); $input_val = isNaN($input_val) ? 0 : $input_val; sum = sum + $input_val; }); if (isNaN(sum) == false) { jQuery('.warning_error_total3').html('Total ' + sum.toFixed(2) + '%'); } else { jQuery('.warning_error_total3').html('Total 0.00%'); } if (sum < 100 || sum > 100) { jQuery('.warning_error3').html('(The sum of above % input shall be 100%.)'); } else { jQuery('.warning_error3').html(''); } ck_can_submit(); } } function date_ajax_call( stMon, ltMon, xi_id ){ // var stMon = jQuery('#startMonth'+xi_id).val(); // var ltMon = jQuery('#lastMonth'+xi_id).val(); if( stMon && ltMon ){ jQuery.ajax( { dataType:"json", type:"POST", data:{ ajax_task:'getMthAvg', startMonth: stMon, lastMonth: ltMon }, url:jQuery(location).attr("href") } ).always(function(e){ var re = /(.*)/; var result = re.exec(e.responseText); if( result ){ if( result[1] != "" ){ console.log(result[1]); var avg_temp_obj = JSON.parse(result[1]); var avg_temp = avg_temp_obj[0].avgTemp !== null ? parseFloat(avg_temp_obj[0].avgTemp) : 0; // add condition to ln avg_temp base on xi_id // e.g // if( xi_id == 12 ){ avg_temp = Math.log( avg_temp ); } jQuery('#input_val'+xi_id).val( avg_temp ); jQuery('#cal_val'+xi_id).val( avg_temp * parseFloat( jQuery('#xi_value'+xi_id).val() ) ); jQuery('#tran_val'+xi_id).val( avg_temp ); jQuery('#remark'+xi_id).val( 'Between ' + stMon + ' to ' + ltMon ); } } ck_can_submit(); }); } } Motorcycle (Petrol) (V1) Private Cars (V2) Private Buses (Diesel) (V3) Public Buses (Diesel) (V4) Private Light Buses (V5) Public Light Buses (V6) Taxis (LPG) (V7) Light Goods Vehicles (Petrol) (V8) Light Goods Vehicles (Diesel) (V9) Medium Goods Vehicles (Diesel) (V10) Heavy Goods Vehicle (Diesel) (V11) Please select Subgroup of your vehicle: START OVER #demo-frame > div.demo { padding: 10px !important; }; .ui-datepicker-calendar { display: none; } I have read the disclaimer and accept the clauses. Disclaimer - Collection of Data: Data that are being entered by individual user through this Online Benchmarking Tools will be used for constructing benchmarking results for that particular user only. As part of our continuous efforts to monitor and improve the Online Benchmarking Tools, the website will store input data and benchmarking results automatically. The Government of Hong Kong Special Administrative Region of the People's Republic of China ("the Government") may record visitor information but will not collect personal data. The collected information will only be used for improvement of website, compilation of statistical reports and the diagnosis of problems with or concerning computer systems. The Government will not transfer the stored data to any external party.