<% 'print_r(request.querystring) Dim ClientID Dim DivisionID Dim strStartDate Dim strEndDate Dim i Dim s Dim R Dim cmbC Dim cmbCD Dim arrType(6,4) ClientID = request.querystring("CID") DivisionID = request.querystring("DID") strStartDate = request.querystring("strStartDate") strEndDate = request.querystring("strEndDate") if len(strStartDate) > 0 then strWhere = "WHERE tblClientPublication.strDate >= '" & strStartDate & "' AND tblClientPublication.strDate <= '" & strEndDate & "'" if ClientID > 0 then strWhere = strWhere & " AND tblClient.ClientID=" & ClientID if DivisionID > 0 then strWhere = strWhere & " AND tblClientDivision.ClientDivisionID=" & DivisionID s = "SELECT tblPublication.strPublicationName, tblClientPublication.Vaule1, tblClientPublication.Vaule2, tblClientPublication.Vaule3, tblClientPublication.Vaule4, tblClientPublication.Vaule5, tblClientPublication.Vaule6, tblClientPublication.Vaule7, tblClientPublication.Vaule8, tblClientPublication.refSubPubID, tblClientPublication.strSelctedField, tblPublication.strType, tblClientPublication.blnFD, tblClient.ClientID, tblClient.strClient, tblClientDivision.ClientDivisionID, tblClientDivision.strClientDivision, tblStaff.StaffID, tblStaff.strStaff, tblPublication.PublicationID, tblClientPublication.strClientPublication, tblClientPublication.strDate " & _ "FROM (((tblClientPublication LEFT JOIN tblClientDivision ON tblClientPublication.refClientDivisionID = tblClientDivision.ClientDivisionID) INNER JOIN tblClient ON tblClientPublication.refClientID = tblClient.ClientID) LEFT JOIN tblPublication ON tblClientPublication.refPublicationID = tblPublication.PublicationID) INNER JOIN tblStaff ON tblClientPublication.refStaffID = tblStaff.StaffID " & _ strWhere & " ORDER BY tblPublication.strType, tblPublication.strPublicationName;" 'response.write s set rst = cn.execute(s) if not rst.eof then c = rst("strClient") d = rst("strClientDivision") end if R = R & "" & _ "" R = R & "" 'Loop Results while not rst.eof s = "SELECT strPublication FROM tblPublication_" & rst("strType") & " WHERE SubPubID = " & rst("refSubPubID") 'response.write s set rstSub = cn.execute(s) if NOT pTYPE = rst("strType") then 'write Type heading R = R & "" pTYPE = rst("strType") end if R = R & "" & _ "" & _ "" 'inc totals select case rst("strType") case "Magazine" i=0 case "Newspaper" i=1 case "Radio" i=2 case "Tv" i=3 case "Web" i=4 end select arrType(i,0) = arrType(i,0) + rst(1) arrType(i,1) = arrType(i,1) + 1 arrType(i,2) = arrType(i,2) + rst(8) arrType(i,3) = rst("strType") arrType(5,0) = arrType(5,0) + rst(1) arrType(5,1) = arrType(5,1) + rst(7) arrType(5,2) = arrType(5,2) + rst(8) rst.movenext j = j + 1 wend 'Totals..1 R = R & "" R = R & "" R = R & "" 'Totals..2 R = R & "" R = R & "" R = R & "" for i = 0 to 4 if len(arrType(i,3)) > 0 then R = R & "" end if next R = R & "" R = R & "" R = R & "
Client Publicity Report - " & c & " " & d & " - " & apDate(strStartDate) & " to " & apDate(strEndDate) & "
PublicationExposureCirculationSubjectBaseCol.cm Airtime piColumns Minutes ArticlesRateAd CostPR Value
Category: " & rst("strType") & "
" & rst(0) & " - " & rstSub("strPublication") & "" & formatnumber(rst(1),0) & "" & formatnumber(rst(2),0) & "" & rst("strClientPublication") & "" & rst(3) & "" & rst(4) & "" & rst(5) & "R " & rst(6) & "R " & formatnumber(rst(7),2) & "R " & formatnumber(rst(8),2) & "
Totals:" & formatnumber(arrType(5,0),0) & " R " & formatnumber(arrType(5,1),2) & "R " & formatnumber(arrType(5,2),2) & "
Number of Articles:" & j & "   
  
 
Summary
Media TypeExposurePR ValueNumber of Articles
" & arrType(i,3) & "" & formatnumber(arrType(i,0),0) & "R " & formatnumber(arrType(i,2),2) & "" & arrType(i,1) & "
" & formatnumber(arrType(5,0),0) & "R " & formatnumber(arrType(5,2),2) & "" & j & "
 
" 'R = Replace(chr(34),chr(39),R) response.write R response.write "" 'Report END 'rst = nothing 'rstSub = nothing end if %>