Originally posted by fddizon
View Post
Code:
IF mod( number, 10 ) = 0 <do this> ELSE <do that> END IF
Code:
IF( mod( number, 10 ) = 0, <do this>, <do that )
Alpha Software Mobile Development Tools: Alpha Anywhere | Alpha TransForm | ![]() ![]() ![]() ![]() |
IF mod( number, 10 ) = 0 <do this> ELSE <do that> END IF
IF( mod( number, 10 ) = 0, <do this>, <do that )
if IMEI_Valid = .f. then
if .NOT.(IMEI_Valid) then
'Date Created: 01-Aug-2010 01:09:31 PM 'Last Updated: 16-Aug-2010 01:37:53 PM 'Created By : fdd 'Updated By : fdd FUNCTION IMEI_Valid AS L (IMEI AS C) dim ln as n = 0 dim d1 as n = 0 dim d2 as n = 0 dim d3 as n = 0 dim d4 as n = 0 dim d5 as n = 0 dim d6 as n = 0 dim d7 as n = 0 dim d8 as n = 0 dim d9 as n = 0 dim d10 as n = 0 dim d11 as n = 0 dim d12 as n = 0 dim d13 as n = 0 dim d14 as n = 0 dim d15 as n = val(substr(IMEI,15,1)) dim x as c="" ln = len(imei)-1 for i=1 to ln x=substr(IMEI,i,1) if i = 1 then d1 = val(x) elseif i = 2 then d2 = val(x) elseif i = 3 then d3 = val(x) elseif i = 4 then d4 = val(x) elseif i = 5 then d5 = val(x) elseif i = 6 then d6 = val(x) elseif i = 7 then d7 = val(x) elseif i = 8 then d8 = val(x) elseif i = 9 then d9 = val(x) elseif i = 10 then d10 = val(x) elseif i = 11 then d11 = val(x) elseif i = 12 then d12 = val(x) elseif i = 13 then d13 = val(x) elseif i = 14 then d14 = val(x) end if next d1 = d1 * 2 d3 = d3 * 2 d5 = d5 * 2 d7 = d7 * 2 d9 = d9 * 2 d11 = d11 * 2 d13 = d13 * 2 dim vFinal as n if len(alltrim(str(d1))) = 2 then dim dtmp as c = "" dim dtmp1 as c = "" dim dtmp2 as c = "" dim fin1 as n dim fin2 as n dim tmpfinal as n if len(alltrim(str(d1))) then dtmp = alltrim(str(d1)) dtmp1 = substr(dtmp,1,1) dtmp2 = substr(dtmp,2,1) tmpfinal = val(dtmp1) + val(dtmp2) d1 = tmpfinal end if elseif len(alltrim(str(d3))) = 2 then dim dtmp as c = "" dim dtmp1 as c = "" dim dtmp2 as c = "" dim fin1 as n dim fin2 as n dim tmpfinal as n if len(alltrim(str(d3))) then dtmp = alltrim(str(d3)) dtmp1 = substr(dtmp,1,1) dtmp2 = substr(dtmp,2,1) tmpfinal = val(dtmp1) + val(dtmp2) d3 = tmpfinal end if elseif len(alltrim(str(d5))) = 2 then dim dtmp as c = "" dim dtmp1 as c = "" dim dtmp2 as c = "" dim fin1 as n dim fin2 as n dim tmpfinal as n if len(alltrim(str(d5))) then dtmp = alltrim(str(d5)) dtmp1 = substr(dtmp,1,1) dtmp2 = substr(dtmp,2,1) tmpfinal = val(dtmp1) + val(dtmp2) d5 = tmpfinal end if elseif len(alltrim(str(d7))) = 2 then dim dtmp as c = "" dim dtmp1 as c = "" dim dtmp2 as c = "" dim fin1 as n dim fin2 as n dim tmpfinal as n if len(alltrim(str(d7))) then dtmp = alltrim(str(d7)) dtmp1 = substr(dtmp,1,1) dtmp2 = substr(dtmp,2,1) tmpfinal = val(dtmp1) + val(dtmp2) d7 = tmpfinal end if elseif len(alltrim(str(d9))) = 2 then dim dtmp as c = "" dim dtmp1 as c = "" dim dtmp2 as c = "" dim fin1 as n dim fin2 as n dim tmpfinal as n if len(alltrim(str(d9))) then dtmp = alltrim(str(d9)) dtmp1 = substr(dtmp,1,1) dtmp2 = substr(dtmp,2,1) tmpfinal = val(dtmp1) + val(dtmp2) d9 = tmpfinal end if elseif len(alltrim(str(d11))) = 2 then dim dtmp as c = "" dim dtmp1 as c = "" dim dtmp2 as c = "" dim fin1 as n dim fin2 as n dim tmpfinal as n if len(alltrim(str(d11))) then dtmp = alltrim(str(d11)) dtmp1 = substr(dtmp,1,1) dtmp2 = substr(dtmp,2,1) tmpfinal = val(dtmp1) + val(dtmp2) d11 = tmpfinal end if elseif len(alltrim(str(d13))) = 2 then dim dtmp as c = "" dim dtmp1 as c = "" dim dtmp2 as c = "" dim fin1 as n dim fin2 as n dim tmpfinal as n if len(alltrim(str(d13))) then dtmp = alltrim(str(d13)) dtmp1 = substr(dtmp,1,1) dtmp2 = substr(dtmp,2,1) tmpfinal = val(dtmp1) + val(dtmp2) d13 = tmpfinal end if end if vFinal = d1 + d3 + d5 + d7 + d9 + d11 + d13 + d2 + d4 + d6 + d8 + d10 + d12 + d14 IMEI_Valid= if(mod(vFinal, 10) = 0,.t.,.f.) if IMEI_Valid(.f.) then cancel() msgbox(vSystem_Name, "Invalid IMEI. Please enter the correct IMEI to continue.",UI_ATTENTION_SYMBOL+UI_OK) else msgbox(vSystem_name, "IMEI is valid") end if END FUNCTION
Leave a comment: