if avail inv then do:
//Coil has been processed
if inv.stat = 2 then do:
pcRtn = "Only a plant supervisor or quality coordinator can remove this requirement".
if (dynamic-function("isGroupMember","IT Staff",psi-user.logon)
or dynamic-function("isGroupMember","plantSupervisor",psi-user.logon)
or dynamic-function("isGroupMember","HQ Quality",psi-user.logon))
and inv.ppaudit = yes then do:
pcRtn = "Yes".
end.
end. // if in plantSupervisor group or IT
//Coil has not been processed
else if (inv.stat = 0 or inv.stat = 1) then do:
pcRtn = "Only a quality coordinator can remove this requirement".
if dynamic-function("isGroupMember","IT Staff",psi-user.logon)
or dynamic-function("isGroupMember","HQ Quality",psi-user.logon)
and inv.ppaudit = yes then do:
pcRtn = "Yes".
end. //if in IT or PlantSupervisor
end. // else if inv stat = 1 or 2
end. // if avail inv
else do:
pcRtn = "Only a quality coordinator can remove this requirement".
find asn no-lock where asn.inv-id = piInvID no-error.
if (dynamic-function("isGroupMember","IT Staff",psi-user.logon)
or dynamic-function("isGroupMember","HQ Quality",psi-user.logon))
and asn.ppaudit = yes then do:
pcRtn = "Yes".
end. // if group member
end. // else do
//Coil has been processed
if inv.stat = 2 then do:
pcRtn = "Only a plant supervisor or quality coordinator can remove this requirement".
if (dynamic-function("isGroupMember","IT Staff",psi-user.logon)
or dynamic-function("isGroupMember","plantSupervisor",psi-user.logon)
or dynamic-function("isGroupMember","HQ Quality",psi-user.logon))
and inv.ppaudit = yes then do:
pcRtn = "Yes".
end.
end. // if in plantSupervisor group or IT
//Coil has not been processed
else if (inv.stat = 0 or inv.stat = 1) then do:
pcRtn = "Only a quality coordinator can remove this requirement".
if dynamic-function("isGroupMember","IT Staff",psi-user.logon)
or dynamic-function("isGroupMember","HQ Quality",psi-user.logon)
and inv.ppaudit = yes then do:
pcRtn = "Yes".
end. //if in IT or PlantSupervisor
end. // else if inv stat = 1 or 2
end. // if avail inv
else do:
pcRtn = "Only a quality coordinator can remove this requirement".
find asn no-lock where asn.inv-id = piInvID no-error.
if (dynamic-function("isGroupMember","IT Staff",psi-user.logon)
or dynamic-function("isGroupMember","HQ Quality",psi-user.logon))
and asn.ppaudit = yes then do:
pcRtn = "Yes".
end. // if group member
end. // else do