<%
|
Function delFollower(ServiceOrderID)
|
sql = "DELETE FROM ServiceOrderCommissionDetails WHERE ServiceOrderID = " & ServiceOrderID & " AND PersonType = 'Follower'"
|
objConn.Execute sql
|
End Function
|
|
Function SaveFollower(ServiceOrderID,userId,userName,userRatio)
|
if userId<>"" and userName<>"" and userRatio<>"" then
|
' 如果不存在,则插入新记录
|
sql = "INSERT INTO ServiceOrderCommissionDetails (ServiceOrderID, PersonID, PersonName, CommissionRatio, PersonType) VALUES (" & ServiceOrderID & ", " & userId & ", '" & userName & "', " & userRatio & ", 'Follower')"
|
objConn.Execute sql
|
End if
|
End Function
|
|
Function SaveFollowers(ServiceOrderID)
|
' 先删除所有跟单人记录
|
followerCount = SafeRequest(Request.form("FollowersCount"))
|
If Trim(followerCount)<>"" and IsNumeric(followerCount) then
|
numericFollowerCount = CInt(Trim(followerCount))
|
|
if numericFollowerCount>0 then
|
delFollower ServiceOrderID
|
for i=1 to numericFollowerCount
|
userId = SafeRequest(Request.form("FollowerId_" & i ))
|
userName = SafeRequest(Request.form("FollowerName_" & i))
|
userRatio = SafeRequest(Request.form("FollowerRatio_" & i))
|
SaveFollower ServiceOrderID, userId, userName, userRatio
|
next
|
end if
|
end if
|
End Function
|
|
|
' 保存开单人及提成比例的函数
|
Function SaveOpenerCommission(ServiceOrderID)
|
OpenerID = SafeRequest(Request.form("OpenUserID")) '开单人ID
|
OpenerName = SafeRequest(Request.form("OpenUserName")) '开单人名称
|
OpenerRatio = SafeRequest(Request.form("OpenUserRatio")) '开单人提成比例
|
if OpenerID<>"" and OpenerName<>"" and OpenerRatio<>"" then
|
|
' 先检查是否已经存在该服务单的开单人记录
|
sql = "SELECT ID FROM ServiceOrderCommissionDetails WHERE ServiceOrderID = " & ServiceOrderID & " AND PersonType = 'Opener'"
|
|
rs.Open sql, objConn, 1, 1
|
|
If rs.EOF Then
|
' 如果不存在,则插入新记录
|
sql = "INSERT INTO ServiceOrderCommissionDetails (ServiceOrderID, PersonID, PersonName, CommissionRatio, PersonType) VALUES (" & ServiceOrderID & ", " & OpenerID & ", '" & OpenerName & "', " & OpenerRatio & ", 'Opener')"
|
Else
|
' 如果存在,则更新记录
|
sql = "UPDATE ServiceOrderCommissionDetails SET PersonID = " & OpenerID & ", PersonName = '" & OpenerName & "', " &"CommissionRatio = " & OpenerRatio & " WHERE ID = " & rs("ID")
|
End If
|
'response.write sql
|
rs.Close
|
objConn.Execute sql
|
End if
|
End Function
|
%>
|