Jump to content

help to pass this function to php. Thanks in advance


jatl2014

Recommended Posts

 

I need help to make this code a working functions on php. It doesnt need to be tested, I just need it in php code. It doesnt have to be perfect but a start..

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 cool.gif 
//image with con as well
https://docs.google.com/document/d/14aeX9sKpu95cSf3wT7WXX4gLQVsEfNdWiF9KCh71ypc/edit?usp=sharing
read table on an array Q so Q.rank1). value should be 1, Q.rank(2). value should be 2 / Q.rank(4). value is 3 

for i= 1 to #8

if DirectReps < Q.DR(i) then reprank = I ; exit for

if DirectClients < Q.DC(i) then reprank = I ; exit for

if GQV < Q.GQV(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 <= Q.UR(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 >= Q.UR(i) then {
//get the repid to use for the qualification and update the field of rephelpedtoqualified 
Z = 0
for z to Q.UR(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 “”
}

A first draw will help as well. Logic might not make much of sense but I need to start somewhere. any comments appreciate. thanks again.
I dont know php Im gonna have to pick a book this weekend and start learning.

Link to comment
Share on other sites

What you have posted makes no sense at all to me. If you are going to post code then wrap in


tag or click the <> button in the editor.

 

 

I dont know php Im gonna have to pick a book this weekend and start learning.

If you are new to PHP then I would suggest you look the PHP documentation first. Start with the Language Reference chapter first, this will explain the PHP syntax.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.