I h ave a function thats needs to be coded on php. no testing, just code so i can be implemented on php.
$10-30 USD
Cancelled
Posted almost 9 years ago
$10-30 USD
Paid on delivery
CheckforNewRepLevel(rep id ) {
get from table rep RepGQVolume , Directreps , Directclients, read qualifications that should be in a table Qualifications -Q- ( we will manage Ranks 1 through 8)
read table on an array Q so [login to view URL]). value should be 1, [login to view URL](2). value should be 2 / [login to view URL](4). value is 3
for i= 1 to #8
if DirectReps < [login to view URL](i) then reprank = I ; exit for
if DirectClients < [login to view URL](i) then reprank = I ; exit for
if GQV < [login to view URL](i) Then reprank = I ; exit for
read from table in an arraydirects() select all repid from rep table where directrep = repid
repneeded = 1
k= 1
z = 0
//loop through all the directreps looking for the # of reps needed to qualify
while k <= count how many rows in arraydirects() and repneeded <= [login to view URL](i) {
// numberof levels to look down is 8 – 1beacuse we just read direct rep that are level 1
RepstoUSeforadvancerank(z)= istherearepundertoqualify(arraydirects(k),I,7)
if RepstoUSeforadvancerank(z) <> “” the repneeded = repneeded + 1
k = k + 1
z = z + 1
}
if repneeded >= [login to view URL](i) then {
//get the repid to use for the qualification and update the field of rephelpedtoqualified
Z = 0
for z to [login to view URL](i) -1
update rephelpedtoqualified = repid from tablerep where repid = RepstoUSeforadvancerank(z)
next z
}
next i
update field reprank = I on table rep
--
}
//recursive function search reps under RepId that have Rank i and rephelpedtoqualified = “”
istherearepundertoqualify (RepID,Ranksearched,levels) {
select rank, rephelpedtoqualified from table rep where repid = repid
if ranksearched = rank and rephelpedtoqualified = "" then return repid ; exit function
read from table in an arraydirects() select all repid from rep table where directrep = repid
I = 1
for i to levels{
istherearepundertoqualify(arraydirects(i),ranksearched,levels - 1)
}
return “”
}