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 : 18.223.205.151


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

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

function clrs_data() {
    $('#div-clnt-list').hide()
    $('#div-empl-list').hide()
    $('#div-mnth-list').hide()
    $('#div-year-list').hide()
    $('#page-container-grid').empty()
    document.getElementById('txtdeptcode').focus()
    document.getElementById('txtrepttype').value = ''
}

function load_dept_data() {
    $.ajax({
        type: 'POST',
        url: 'src/salary_statement.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_empl_data() {
    $.ajax({
        type: 'POST',
        url: 'src/salary_statement.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-clnt-list').hide()
    $('#div-empl-list').hide()
    $('#div-mnth-list').hide()
    $('#div-year-list').hide()

    if (document.getElementById('txtrepttype').value == 'salr_stat') {
        $('#div-clnt-list').show()
        $('#div-mnth-list').show()
        load_attn_mnth()
    }
}

function load_attn_mnth() {
    $.ajax({
        type: 'POST',
        url: 'src/salary_statement.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/salary_statement.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 == 'salr_stat') {
        salary_statement()
    }
}

function salary_statement() {
    if (document.getElementById('txtattnmnth').value == 0) {
        alert('Please select month!')
        txtattnmnth.focus()
        return false
    }
    $host = 'oums'
    $.ajax({
        type: 'POST',
        url: 'src/salary_statement_month_excel.php',
        dataType: 'json',
        data: {
            load_data: 'salr_stat',
            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)
        },
    })
}