0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.138.137.244


Current Path : /var/www/html/oums/js/
Upload File :
Current File : /var/www/html/oums/js/attendance_report.js

function load_page() {
    load_page_data(
        window.location.href.substr(window.location.href.lastIndexOf('/') + 1)
    )
    clrs_data()
    load_dept_data()
    load_desn_data()
}

function clrs_data() {
    document.getElementById('txtattndat1').value = get_today_date()
    document.getElementById('txtattndat2').value = get_today_date()
    $('#div-date-range').hide()
    $('#div-mnth-range').hide()
    $('#div-year-range').hide()
    $('#div-time-delay').hide()

    $('#page-container-grid').empty()
    $(function () {
        $('#txtattndat1').datepicker({ dateFormat: 'dd/mm/yy' })
    })
    $(function () {
        $('#txtattndat2').datepicker({ dateFormat: 'dd/mm/yy' })
    })
    document.getElementById('txtdeptcode').focus()
    document.getElementById('txtrepttype').value = ''
}

function load_dept_data() {
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        data: {
            load_data: 'dept_data',
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            $('#txtdeptcode').html(data)
            hide_process()
            load_empl_data()
        },
    })
}

function load_desn_data() {
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        data: {
            load_data: 'desn_data',
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            $('#txtempldesn').html(data)
            hide_process()
        },
    })
}

function load_empl_data() {
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        data: {
            load_data: 'empl_data',
            dept_code: document.getElementById('txtdeptcode').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            $('#txtemplcode').html(data)
            hide_process()
        },
    })
}

function load_rept_type() {
    $('#div-date-range').hide()
    $('#div-mnth-range').hide()
    $('#div-year-range').hide()
    $('#div-time-delay').hide()

    if (document.getElementById('txtrepttype').value == 'attn_detl_absn') {
        $('#div-date-range').show()
    }

    if (document.getElementById('txtrepttype').value == 'attn_detl_expt') {
        $('#div-date-range').show()
    }

    if (document.getElementById('txtrepttype').value == 'attn_stat_date') {
        $('#div-date-range').show()
    }

    if (document.getElementById('txtrepttype').value == 'attn_summ_empl') {
        $('#div-mnth-range').show()
        load_attn_mnth()
    }

    if (document.getElementById('txtrepttype').value == 'attn_stat_mnth_excl') {
        $('#div-mnth-range').show()
        $('#div-time-delay').show()
        load_attn_mnth()
    }

    if (document.getElementById('txtrepttype').value == 'attn_stat_salr_excl') {
        $('#div-mnth-range').show()
        load_attn_mnth()
    }

    if (document.getElementById('txtrepttype').value == 'attn_stat_mnth') {
        $('#div-mnth-range').show()
        load_attn_mnth()
    }

    if (document.getElementById('txtrepttype').value == 'attn_summ_mnth') {
        $('#div-mnth-range').show()
        load_attn_mnth()
    }

    if (document.getElementById('txtrepttype').value == 'attn_summ_year') {
        load_attn_year()
        $('#div-year-range').show()
    }
}

function load_attn_mnth() {
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        data: {
            load_data: 'attn_mnth',
            dept_code: document.getElementById('txtdeptcode').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            $('#txtattnmnth').html(data)
            hide_process()
        },
        error: function (data) {
            alert('Error')
        },
    })
}

function load_attn_year() {
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        data: {
            load_data: 'attn_year',
            dept_code: document.getElementById('txtdeptcode').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            $('#txtattnyear').html(data)
            hide_process()
        },
        error: function (data) {
            alert('Error')
        },
    })
}

function rept_data() {
    if (document.getElementById('txtdeptcode').value == 0) {
        alert('Please select client!')
        txtdeptcode.focus()
        return false
    }

    if (document.getElementById('txtrepttype').value == 0) {
        alert('Please select report type!')
        txtrepttype.focus()
        return false
    }

    if (document.getElementById('txtrepttype').value == 'attn_stat_mnth_excl') {
        report_attn_stat_mnth_excl()
    }

    if (document.getElementById('txtrepttype').value == 'attn_stat_salr_excl') {
        report_attn_stat_salr_excl()
    }

    if (document.getElementById('txtrepttype').value == 'attn_detl_absn') {
        report_attn_detl_absn()
    }

    if (document.getElementById('txtrepttype').value == 'attn_detl_expt') {
        report_attn_detl_expt()
    }
    if (document.getElementById('txtrepttype').value == 'attn_stat_date') {
        report_attn_stat_date()
    }

    if (document.getElementById('txtrepttype').value == 'attn_summ_empl') {
        report_attn_summ_empl()
    }

    if (document.getElementById('txtrepttype').value == 'attn_summ_mnth') {
        report_attn_summ_mnth()
    }

    if (document.getElementById('txtrepttype').value == 'attn_stat_mnth') {
        report_attn_stat_mnth()
    }

    if (document.getElementById('txtrepttype').value == 'attn_summ_year') {
        report_yearwise_summary()
    }
}

function report_attn_stat_date() {
    if (document.getElementById('txtattndat1').value == '') {
        alert('Please select starting date!')
        txtattndat1.focus()
        return false
    }

    if (document.getElementById('txtattndat2').value == '') {
        alert('Please select ending date!')
        txtattndat2.focus()
        return false
    }

    $host = 'oums'
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        dataType: 'json',
        data: {
            load_data: 'attn_stat_date',
            dept_code: document.getElementById('txtdeptcode').value,
            attn_dat1: document.getElementById('txtattndat1').value,
            attn_dat2: document.getElementById('txtattndat2').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            hide_process()
            if (data.stat != 'F') {
                window.open('src/' + data.file, '_blank')
            } else {
                alert(data.mesg)
            }
            //$('#page-container-grid').html('Success: '+data);
        },
        error: function (data) {
            hide_process()
            $('#page-container-grid').html('Error: ' + data)
        },
    })
}

function report_attn_summ_empl() {
    if (document.getElementById('txtattnmnth').value == 0) {
        alert('Please select month!')
        txtattnmnth.focus()
        return false
    }

    $host = 'oums'
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        dataType: 'json',
        data: {
            load_data: 'attn_summ_empl',
            dept_code: document.getElementById('txtdeptcode').value,
            attn_mnth: document.getElementById('txtattnmnth').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            hide_process()
            if (data.stat != 'F') {
                window.open('src/' + data.file, '_blank')
            } else {
                alert(data.mesg)
            }
            //$('#page-container-grid').html(data);
        },
        error: function (data) {
            hide_process()
            $('#page-container-grid').html('Error: ' + data)
        },
    })
}

function report_attn_stat_mnth() {
    if (document.getElementById('txtattnmnth').value == 0) {
        alert('Please select month!')
        txtattnmnth.focus()
        return false
    }
    $host = 'oums'
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        dataType: 'json',
        data: {
            load_data: 'attn_stat_mnth',
            dept_code: document.getElementById('txtdeptcode').value,
            attn_mnth: document.getElementById('txtattnmnth').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            hide_process()
            if (data.stat != 'F') {
                window.open('src/' + data.file, '_blank')
            } else {
                alert(data.mesg)
            }
            //$('#page-container-grid').html('Success: '+data);
        },
        error: function (data) {
            hide_process()
            $('#page-container-grid').html('Error: ' + data)
        },
    })
}

function report_attn_summ_mnth() {
    if (document.getElementById('txtattnmnth').value == 0) {
        alert('Please select month!')
        txtattnmnth.focus()
        return false
    }

    $host = 'oums'
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        dataType: 'json',
        data: {
            load_data: 'attn_summ_mnth',
            dept_code: document.getElementById('txtdeptcode').value,
            attn_mnth: document.getElementById('txtattnmnth').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            hide_process()
            if (data.stat != 'F') {
                window.open('src/' + data.file, '_blank')
            } else {
                alert(data.mesg)
            }
            //$('#page-container-grid').html('Success: '+data);
        },
        error: function (data) {
            hide_process()
            $('#page-container-grid').html('Error: ' + data)
        },
    })
}

function report_yearwise_summary() {
    if (document.getElementById('txtattnyear').value == 0) {
        alert('Please select year!')
        txtattnyear.focus()
        return false
    }

    $host = 'oums'
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        dataType: 'json',
        data: {
            load_data: 'attn_summ_year',
            dept_code: document.getElementById('txtdeptcode').value,
            attn_year: document.getElementById('txtattnyear').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            hide_process()
            if (data.stat != 'F') {
                window.open('src/' + data.file, '_blank')
            } else {
                alert(data.mesg)
            }
            //$('#page-container-grid').html('Success: '+data);
        },
        error: function (data) {
            hide_process()
            $('#page-container-grid').html('Error: ' + data)
        },
    })
}

function report_attn_detl_absn() {
    if (document.getElementById('txtattndat1').value == '') {
        alert('Please select starting date!')
        txtattndat1.focus()
        return false
    }

    if (document.getElementById('txtattndat2').value == '') {
        alert('Please select ending date!')
        txtattndat2.focus()
        return false
    }

    $host = 'oums'
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        dataType: 'json',
        data: {
            load_data: 'attn_detl_absn',
            dept_code: document.getElementById('txtdeptcode').value,
            dept_name: $('#txtdeptcode option:selected').text(),
            empl_desn: document.getElementById('txtempldesn').value,
            desn_name: $('#txtempldesn option:selected').text(),
            attn_dat1: document.getElementById('txtattndat1').value,
            attn_dat2: document.getElementById('txtattndat2').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            hide_process()
            if (data.stat != 'F') {
                window.open('src/' + data.file, '_blank')
            } else {
                alert(data.mesg)
            }
            //$('#page-container-grid').html('Success: '+data);
        },
        error: function (data) {
            hide_process()
            $('#page-container-grid').html('Error: ' + data)
        },
    })
}

function report_attn_detl_expt() {
    if (document.getElementById('txtattndat1').value == '') {
        alert('Please select starting date!')
        txtattndat1.focus()
        return false
    }

    if (document.getElementById('txtattndat2').value == '') {
        alert('Please select ending date!')
        txtattndat2.focus()
        return false
    }

    $host = 'oums'
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report.php',
        dataType: 'json',
        data: {
            load_data: 'attn_detl_expt',
            dept_code: document.getElementById('txtdeptcode').value,
            dept_name: $('#txtdeptcode option:selected').text(),
            empl_desn: document.getElementById('txtempldesn').value,
            desn_name: $('#txtempldesn option:selected').text(),
            attn_dat1: document.getElementById('txtattndat1').value,
            attn_dat2: document.getElementById('txtattndat2').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            hide_process()
            if (data.stat != 'F') {
                window.open('src/' + data.file, '_blank')
            } else {
                alert(data.mesg)
            }
            //$('#page-container-grid').html('Success: '+data);
        },
        error: function (data) {
            hide_process()
            $('#page-container-grid').html('Error: ' + data)
        },
    })
}

function report_attn_stat_mnth_excl() {
    if (document.getElementById('txtattnmnth').value == 0) {
        alert('Please select month!')
        txtattnmnth.focus()
        return false
    }
    $host = 'oums'
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report_attn_stat_mnth_excl.php',
        dataType: 'json',
        data: {
            load_data: 'attn_stat_mnth_excl',
            dept_code: document.getElementById('txtdeptcode').value,
            attn_mnth: document.getElementById('txtattnmnth').value,
            late_time: document.getElementById('txtlatetime').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            hide_process()
            if (data.stat != 'F') {
                window.open('src/' + data.file, '_blank')
            } else {
                alert(data.mesg)
            }
        },
        error: function (data) {
            hide_process()
            $('#page-container-grid').html('Error: ' + data)
        },
    })
}

function report_attn_stat_salr_excl() {
    if (document.getElementById('txtattnmnth').value == 0) {
        alert('Please select month!')
        txtattnmnth.focus()
        return false
    }
    $host = 'oums'
    $.ajax({
        type: 'POST',
        url: 'src/attendance_report_attn_stat_salr_excl.php',
        dataType: 'json',
        data: {
            load_data: 'attn_stat_mnth_excl',
            dept_code: document.getElementById('txtdeptcode').value,
            attn_mnth: document.getElementById('txtattnmnth').value,
        },
        cache: false,
        beforeSend: function () {
            show_process()
        },
        success: function (data) {
            hide_process()
            if (data.stat != 'F') {
                window.open('src/' + data.file, '_blank')
            } else {
                alert(data.mesg)
            }
        },
        error: function (data) {
            hide_process()
            $('#page-container-grid').html('Error: ' + data)
        },
    })
}