
<%
set rsStock=Server.CreateObject("ADODB.Recordset")
sreload=false
rsStock.Open "select * from Stocks where ItemProductNumber='" & rsproducts("itemproductnumber") & "' and ItemString<>''", dbMain, adOpenStatic, adLockPessimistic, adCmdText
if not(rsStock.bof and rsStock.eof) then
sreload=true
end if
rsStock.close
rsStock.Open "select * from Stocks where ItemProductNumber='" & rsproducts("itemproductnumber") & "' and ItemString=''", dbMain, adOpenStatic, adLockPessimistic, adCmdText
itsthere=false
if not(rsStock.eof and rsStock.bof) then
if rsStock("StockNo")<>"" then
if cint(rsStock("StockNo"))>0 then
itsthere=true
end if
end if
else
itsthere=true
end if
if itsthere=false then
if rsStock("IsLocked")=true then
IsLoc="yes"
else
IsLoc=""
end if
tmpSText=rsStock("FinishedText")
end if
rsStock.close
dim rabatt, sprabatt, staffrabatt
if (session("cust")="") or (rsproducts("ProductDiscountAccess")=false) then
rabatt=1
sprabatt=1
staffrabatt=1
else
set rscust=Server.CreateObject("ADODB.Recordset")
rscust.Open "SELECT * FROM Customers WHERE CustomerID=" & session("cust"), dbMain, adOpenStatic, adLockPessimistic, adCmdText
if rscust("DiscountPercent")>0 then
Set rsaf = Server.CreateObject("ADODB.Recordset")
rsaf.Open "SELECT af" & cstr(rscust("DiscountPercent")) & " FROM RetailPrices WHERE ItemProductNumber='" & rsproducts("itemproductnumber") & "'", dbMain, adOpenStatic, adLockPessimistic, adCmdText
If Not (rsaf.BOF And rsaf.EOF) Then
rabatt = (100 - rsaf("af" & CStr(rscust("DiscountPercent")))) / 100
Else
rabatt = 1
End If
rsaf.Close
Set rsaf = Nothing
Else
rabatt = 1
End If
if rscust("SpecialPriceAccess")=true then
sprabatt=rabatt
else
sprabatt=1
end if
if rscust("StafflingAccess")=true then
staffrabatt=rabatt
else
staffrabatt=1
end if
rscust.close
set rscust=nothing
end if
ptmp=0
if rsproducts("ispackage")=true then
set prs = Server.CreateObject("ADODB.Recordset")
prs.Open "SELECT * FROM Packages WHERE ProductNumber='" & rsproducts("itemproductnumber") & "'", dbMain, adOpenStatic, adLockOptimistic
if not(prs.bof and prs.eof) then
prs.movefirst
for pind=1 to prs.recordcount
if prs("isdefault")=true then
ptmp=ptmp+prs("Price")
end if
prs.movenext
next
end if
prs.close
set prs=nothing
end if
sTemp=""
if rsproducts("StfCheck")=true then
set rsstaff=Server.CreateObject("ADODB.Recordset")
rsstaff.Open "SELECT * FROM StafflingTable WHERE ItemProductNumber='" & rsproducts("ItemProductNumber") & "'", dbMain, adOpenStatic, adLockPessimistic, adCmdText
if not(rsstaff.eof and rsstaff.bof) then
if rsproducts("StartKostnad")=true then
If (rsproducts("itemsaleprice") > 0) and (rsproducts("beginspecial") <= Date AND rsproducts("endspecial") >= Date) then
sTemp = "| Nätpris startavgift SEK " & Formatnumber(cdbl(rsproducts("itemsaleprice")+ptmp)*sprabatt) & " | | (Ordinarie start avgift SEK " & FormatNumber(cdbl(rsproducts("itemregularprice")+ptmp)) & ") | "
Else
sTemp = "| Startavgift SEK " & FormatNumber(cdbl(rsproducts("itemregularprice")+ptmp)*rabatt) & " | "
if ((session("cust")<>"") and rabatt<>1) and rabatt<>1 then
sTemp=sTemp & "| (Ordinarie start avgift SEK " & FormatNumber(cdbl(rsproducts("itemregularprice")+ptmp)) & "" & ") | "
end if
End If
else
If (rsproducts("itemsaleprice") > 0) and (rsproducts("beginspecial") <= Date AND rsproducts("endspecial") >= Date) Then
sTemp = "| Nätpris: SEK " & FormatNumber(cdbl(rsproducts("itemsaleprice"))*sprabatt) & " | | (Ordinarie pris: SEK " & FormatNumber(cdbl(rsproducts("itemregularprice")+ptmp)) & ") | "
Else
sTemp = "| Pris: SEK " & FormatNumber(cdbl(rsproducts("itemregularprice")+ptmp)*rabatt) & " | "
if ((session("cust")<>"") and rabatt<>1) and rabatt<>1 then
sTemp=sTemp & "| (Ordinarie pris: SEK " & FormatNumber(cdbl(rsproducts("itemregularprice")+ptmp)) & ") | "
end if
End If
end if
sTemp = sTemp & "| Antal | | Pris per st. | "
for i=1 to 12
if rsstaff("StartNumber" & i)<>"" then
if cint(rsstaff("StartNumber" & i))<=cint(rsstaff("StopNumber" & i)) then
sTemp=sTemp & "| " & rsstaff("StartNumber" & i) & " | till"
sTemp=sTemp & " | " & rsstaff("StopNumber" & i) & " | : | SEK " & FormatNumber((cdbl(rsstaff("StaffPrice" & i)+ptmp)*staffrabatt)) & " | "
else
sTemp=sTemp & "| " & rsstaff("StartNumber" & i) & " eller fler | : | SEK " & FormatNumber((cdbl(rsstaff("StaffPrice" & i)+ptmp)*staffrabatt)) & " | "
end if
end if
next
stemp=stemp & "
| "
end if
rsstaff.close
set rsstaff=nothing
end if
if sTemp="" then
If (rsproducts("itemsaleprice") > 0) and (rsproducts("beginspecial") <= Date AND rsproducts("endspecial") >= Date) Then
sTemp = " | Nätpris: SEK " & FormatNumber(cdbl(rsproducts("itemsaleprice")+ptmp)*sprabatt) & " | | (Ordinarie pris: SEK " & FormatNumber(cdbl(rsproducts("itemregularprice")+ptmp)) & ") | "
Else
sTemp = "| Pris: SEK " & FormatNumber(cdbl(rsproducts("itemregularprice")+ptmp)*rabatt) & " | "
if ((session("cust")<>"") and rabatt<>1) and rabatt<>1 then
sTemp=sTemp & "| (Ordinarie pris: SEK " & FormatNumber(cdbl(rsproducts("itemregularprice")+ptmp)) & ") | "
end if
End If
End If
response.Write ""
if rsproducts("ispackage")=true then
response.write " "
'Response.Write " |