Last active
April 10, 2021 01:13
-
-
Save dalibor-sojic/1dbe448c3c51912711027009093cd0fe to your computer and use it in GitHub Desktop.
EMBG Macedonia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title> | |
</title> | |
</head> | |
<body> | |
<!-- Javascript below this line --> | |
<script type="text/javascript"> | |
function IsNumeric(str){ return !/\D/.test(str);} | |
function checksum(sEDB_EMBG) { | |
var strMaska = '765432765432'; | |
var intSuma = 0; | |
var intI = 0; | |
for (intI = 0; intI <= 12; intI++) { | |
intSuma = intSuma + (sEDB_EMBG.charAt(intI) * strMaska.charAt(intI)) | |
} | |
var intOstatok = 11 - intSuma % 11 | |
if (intOstatok >= 10) { | |
intOstatok = 0; | |
} | |
return intOstatok; | |
} | |
function maticen(sEDB_EMBG) { | |
if (!IsNumeric(sEDB_EMBG)) { | |
return false; | |
} | |
if (sEDB_EMBG.toString().length != 13 || sEDB_EMBG == '0000000000000' || sEDB_EMBG == '1111111111111') { | |
return false; | |
} | |
var strMaska = '765432765432'; | |
var intKB = sEDB_EMBG.charAt(sEDB_EMBG.toString().length - 1); | |
var intSuma = 0; | |
var intI = 0; | |
for (intI = 0; intI <= 12; intI++) { | |
intSuma = intSuma + (sEDB_EMBG.charAt(intI) * strMaska.charAt(intI)) | |
} | |
var intOstatok = 11 - intSuma % 11 | |
if (intOstatok >= 10) { | |
intOstatok = 0; | |
} | |
if (intOstatok == intKB) { | |
return true; | |
} | |
else { | |
return false; | |
} | |
return false; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Прифатено. Сменето.