View | Details | Raw Unified | Return to bug 30139
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-14 / +14 lines)
Lines 476-503 Link Here
476
            var newValue = textObj.value;
476
            var newValue = textObj.value;
477
            var decAmount = "";
477
            var decAmount = "";
478
            var dolAmount = "";
478
            var dolAmount = "";
479
            var decFlag   = false;
479
            var dolFlag   = false;
480
            var aChar     = "";
480
            var aChar     = "";
481
481
482
            for(i=0; i < newValue.length; i++) {
482
            for(var i = newValue.length; 0 < i; i--) {
483
                aChar = newValue.substring(i, i+1);
483
                aChar = newValue.substring(i-1, i);
484
                if (aChar >= "0" && aChar <= "9") {
484
                if ("0" <= aChar && aChar <= "9") {
485
                    if(decFlag) {
485
                    if(dolFlag) {
486
                        decAmount = "" + decAmount + aChar;
486
                        dolAmount = "" + aChar + dolAmount;
487
                    }
487
                    }
488
                    else {
488
                    else {
489
                        dolAmount = "" + dolAmount + aChar;
489
                        decAmount = "" + aChar + decAmount;
490
                    }
490
                    }
491
                }
491
                }
492
                if (aChar == ".") {
492
                if (aChar == "." || aChar == ",") {
493
                    if (decFlag) {
493
                    dolFlag = true;
494
                        dolAmount = "";
495
                        break;
496
                    }
497
                    decFlag = true;
498
                }
494
                }
499
            }
495
            }
500
496
497
            if (!dolFlag) {
498
                dolAmount = decAmount;
499
                decAmount = "";
500
            }
501
501
            if (dolAmount == "") {
502
            if (dolAmount == "") {
502
                dolAmount = "0";
503
                dolAmount = "0";
503
            }
504
            }
504
- 

Return to bug 30139