The amount of the financial case conversion

// ========================== financial processes, currency lowercase to uppercase === ======== [Start] ============================================ 
// the corresponding database [LR_Form_SchemeInfo ] the f_id 
// double-digit group definition: [ "form name / number", "amount in labeling," "amount of capital logo"] 
// form name: correspondence [name] in the form design, rather than the flow 
/ * 
var new new Array = (needTransForm    
    [ "21. The cost reimbursement process (shares)," "reimbursement amount (yuan)," "reimbursement amount of capital"], 
    [ "22 travel reimbursement process (shares)", "The total cost (yuan) "" The total cost (capital) "], 
    [" 23 single expenditure for the process (shares), "" spending money (dollars) "," the amount of capital expenditure, "], 
    [" single borrower 24. (shares) " "loan amount (dollars)", "borrowing the amount of capital"], 
    [ "25 communication fee reimbursement process (shares)," "reimbursement amount (yuan)," "reimbursement amount of capital"], 
    [ "26 speed back customers process models (shares), "" spending money (dollars) "," the amount of capital expenditures "],
    [ "27 customers speed the refund process (Science and Technology)," "spending money (dollars)", "the amount of capital expenditure,"], 
    [ "28 regular customer refund process (shares)," "spending money (dollars)" "amount of capital expenditure,"], 
    [ "29 regular customer refund process (Science and Technology)," "spending money (dollars)", "the amount of capital expenditures"] 
);
** / 
        / *
flag_CurrencyTransformation = var "CWBD_CurrencyTransformation"; 
var smallControl; // lowercase control 
var bigControl; // uppercase control 
var CurrencyTransformationFromSamllToBig = { 

    // contains 
    IsInclude: function (formName) { 
        var lstResult = CommonMethod.GetSettingByCode (flag_CurrencyTransformation); 
        IF (lstResult! ) 
            return null; 

        var targetItem; // selected target data 
        for (var I = 0; I <lstResult.length; I ++) { 
            IF (lstResult [I] == .Item1 formName) { 
                targetItem = [I] lstResult; 
                BREAK ; 
            } 
        } 

        return targetItem;
        for (var I = 0; I <needTransForm.length; I ++) { 
            IF (needTransForm [I] [0] == formName) { 
                currSamllControlFlagIndex = I; 
                BREAK; 
            } 
        } 
        return currSamllControlFlagIndex> -1; 
        * / 
    }, 

    // performing 
    Excute: function (formName) { 
        smallControl = null; 
        bigControl = null; 

        // the form name, form acquired configuration information corresponding 
        var targetItem = CurrencyTransformationFromSamllToBig.IsInclude (formName); 
        IF (targetItem!) 
            return; 
 
        IF ((targetItem! .Item2) || (! targetItem.Item3)) {
            the console.log (targetItem .Item1 + ", or lack Item2 Item3 configuration (lowercase Item2 configuration controls, Item3 configured capital controls).");
            return; 
        } 

        // find the amount in uppercase and controls, and changes the control ID 
        smallControl = CommonMethod.FindControl (targetItem.Item2,. 1); 
        bigControl = CommonMethod.FindControl (targetItem.Item3,. 1); 

        IF (smallControl && bigControl) { 
            / / change ID 
            // $ (smallControl) .attr ( "ID", "smallCurrency"); 
            // $ (bigControl) .attr ( "ID", "bigCurrency"); 

            $ (smallControl) .attr ( "onInput", "CurrencyTransformationFromSamllToBig.CurrencyTransformation ()") 
        } 
        the else {  
            Console.log ( "not looking to uppercase or lowercase controls controls Please check the form and multi-dimensional configuration of the dictionary form..");
        } 

        //console.log ($ ( '# smallCurrency') Val ());. 
    },

    @ Currency Conversion: lowercase to uppercase 
    CurrencyTransformation: function () {
        smallVal $ = var (smallControl) .val (); 
        var = CurrencyTransformationFromSamllToBig.smalltoBIG BIGVAL (smallVal); 

        CommonMethod.SetControlVal ($ (bigControl), BIGVAL) 
    }, 

    / ** digital conversion the amount of capital (can handle integer, decimal, negative ) * / 
    smalltoBIG: function (n-) { 
        var fraction = [ 'angles', 'partial']; 
        var digit for = [ 'zero', 'One', 'II', 'three', 'store', 'Ng' , 'LU', 'qi', 'split', 'ND']; 
        var Unit = [[ 'element,' the '', 'one hundred million'] [ ',' pick up ',' Bai ',' Qian ']]; 
        var = n-head <0?' under ':' '; 
        n-the Math.abs = (n-); 

        var S =' ';floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
        }
        s = s || '整';

        for (var i = 0; i < fraction.length; i++) {
            s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
        n = Math.floor(n);

        for (var i = 0; i < unit[0].length && n > 0; i++) {
            var p = '';
            for (var j = 0; j < unit[1].length && n > 0; j++) {
                p = digit[n % 10] + unit[1][j] + p;
                n = Math.floor(n / 10);
            }
            s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
        }
        return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整');
// ========================== financial processes, currency lowercase to uppercase ========= [end] ==============================================
}
    }

  

Guess you like

Origin www.cnblogs.com/qiupiaohujie/p/12124048.html