Subversion Repositories SmartDukaan

Rev

Rev 35459 | Rev 35533 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35459 Rev 35510
Line 123... Line 123...
123
            $(ele).html(numberToComma($(ele).html(), true));
123
            $(ele).html(numberToComma($(ele).html(), true));
124
        }
124
        }
125
    });
125
    });
126
    $('.currency').each(function (index, ele) {
126
    $('.currency').each(function (index, ele) {
127
        if (!isNaN(parseInt($(ele).html()))) {
127
        if (!isNaN(parseInt($(ele).html()))) {
128
            $(ele).html(numberToComma($(ele).html()));
128
            $(ele).html(formatValueInCrore($(ele).html()));
129
        }
129
        }
130
    });
130
    });
131
 
131
 
132
}
132
}
133
 
133
 
Line 490... Line 490...
490
    return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
490
    return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
491
        + x2;
491
        + x2;
492
 
492
 
493
}
493
}
494
 
494
 
-
 
495
function formatValueInCrore(value) {
-
 
496
    if (isNaN(value)) return value;
-
 
497
    value = parseFloat(value);
-
 
498
 
-
 
499
    if (value >= 10000000) {  // >= 1 Crore
-
 
500
        var croreValue = value / 10000000;
-
 
501
        // Remove trailing zeros: 1.500 -> 1.5, 1.000 -> 1
-
 
502
        var formatted = croreValue.toFixed(3).replace(/\.?0+$/, '');
-
 
503
        return formatted + ' Cr';
-
 
504
    } else {
-
 
505
        // Less than 1 Crore - show full number with Indian comma format
-
 
506
        return numberToComma(value);
-
 
507
    }
-
 
508
}
-
 
509
 
495
function getSingleDatePicker(startMoment) {
510
function getSingleDatePicker(startMoment) {
496
    var singleDatePicker = {
511
    var singleDatePicker = {
497
        "todayHighlight": true,
512
        "todayHighlight": true,
498
        "startDate": startMoment || moment(),
513
        "startDate": startMoment || moment(),
499
        "autoclose": true,
514
        "autoclose": true,