HEX
Server: nginx/1.22.1
System: Linux VM-16-9-centos 3.10.0-1160.99.1.el7.x86_64 #1 SMP Wed Sep 13 14:19:20 UTC 2023 x86_64
User: www (1001)
PHP: 7.3.31
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/oa.sanjiangapp.com/app/oa/refund/js/common.js
$(document).ready(function()
{    
    $('.side .leftmenu ul').find('a[href*=' + config.currentMethod + ']').parent().addClass('active');
    $('.switchStatus').click(function()
    {
        url = $(this).attr('href');

        $.getJSON(url, function(response)
        {
            if(response.message)
            {
                bootbox.alert(response.message, function()
                {
                    if(response.locate) 
                    {
                        location.href = response.locate;
                        return false;
                    }
                    location.reload();
                });
            }
            else
            {
                if(response.locate) 
                {
                    location.href = response.locate;
                    return false;
                }
                location.reload();
            }
        });
        return false;
    });

    $('#money').change(function(){ if(!$('#invoice').val()) $('#invoice').val($(this).val()); });

    /* update money. */
    function updateMoney()
    {
        if(!$(this).parent('td').parent('tr').find('input[name^=invoiceList]').val())
        {
            $(this).parent('td').parent('tr').find('input[name^=invoiceList]').val($(this).val());
            updateInvoice();
        }

        var money = 0;
        $('input[name^=moneyList]').each(function()
        {
            if($.isNumeric($(this).val()))
            {
                money += parseFloat($(this).val());
            }
        });
        money = Math.round(money * 100) / 100;
        $('#money').val(money);
        updateInvoice();
        return false;
    }

    function updateInvoice()
    {
        var invoice = 0;
        $('input[name^=invoiceList]').each(function()
        {
            var currentMoney = $(this).parent('td').parent('tr').find('input[name^=moneyList]').val();
            if($.isNumeric(currentMoney) && $.isNumeric($(this).val()))
            {
                invoice += parseFloat($(this).val());
            }
        });
        invoice = Math.round(invoice * 100) / 100;
        $('#invoice').val(invoice);
        return false;
    }

    $('input[name^=moneyList]').change(updateMoney);
    $('input[name^=invoiceList]').change(updateInvoice);

    /* Add a trade detail item. */
    $(document).on('click', '.table-detail .plus', function()
    {
        var tr = $(this).closest('tr');
        tr.after($('#detailTpl').html().replace(/key/g, v.key));
        tr.next().find('input[name^=dateList]').val($('#date').val()).fixedDate().datetimepicker(
        {
            language:  config.clientLang,
            weekStart: 1,
            todayBtn:  1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0,
            format: 'yyyy-mm-dd'
        });
        tr.next().find('select[name^=categoryList]').val($('#category').val()).chosen();
        tr.next().find('select[name^=relatedList]').val($('#related').val()).chosen();
        tr.next().find('textarea[name^=descList]').val($('#desc').val());
        $('input[name^=moneyList]').change(updateMoney);
        $('input[name^=invoiceList]').change(updateInvoice);
        v.key++;
        return false;
    });

    /* Remove a trade detail item. */
    $(document).on('click', '.table-detail .minus', function()
    {
        if($('#detailBox tr').size() > 1)
        {
            $(this).closest('tr').remove();
        }
        else
        {
            $(this).closest('tr').find('input,select').val('');
        }
        $('input[name^=moneyList]').change();
        $('input[name^=invoiceList]').change();
        return false;
    });
})

function getOrders(customer)
{
    var order = $('#order').val();
    $('#order').load(createLink('crm.order', 'ajaxGetOrders', 'customer=' + customer), function()
    {
        $('#order').val(order).trigger('chosen:updated');
    });
}

function getContracts(customer)
{
    var contract = $('#contract').val();
    $('#contract').load(createLink('crm.contract', 'ajaxGetOptionMenu', 'customer=' + customer), function()
    {
        $('#contract').val(contract).trigger('chosen:updated');
    });
}