%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><%'Response.Buffer = false
Response.ContentType = "application/vnd.ms-excel"
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="ADMIN,SYSOP,GERENTE,RESP_ZONA,ESPECIALISTA"
MM_authFailedURL="login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim zonas
Dim zonas_numRows
Set zonas = Server.CreateObject("ADODB.Recordset")
zonas.ActiveConnection = MM_maq_STRING
zonas.Source = "SELECT distinct(ZONA) FROM USUARIOS where ZONA<>''"
zonas.CursorType = 0
zonas.CursorLocation = 2
zonas.LockType = 1
zonas.Open()
zonas_numRows = 0
%>
<%
Dim ents__VZONA
ents__VZONA = " AND USUARIOS.ZONA='" + strreplace(session("ZONA"), "'", "''") + "' "
If (request("ZONA") <> "") Then
if Session("MM_UserAuthorization")="ADMIN" then ents__VZONA = " AND TBL_OPPORTUNITY.SUCURSAL='" + strreplace(request("ZONA"), "'", "''") + "' "
End If
If Session("MM_UserAuthorization")="ADMIN" then if (request("ZONA") = "*") or (request("ZONA") = "") Then ents__VZONA =""
'" +ents__VZONA + "
lazo=1
if session("ZONA_TARIFA")<>"" then lazo=session("ZONA_TARIFA")
If Session("MM_UserAuthorization")="RESP_ZONA" then if (request("ZONA") = "*") or (request("ZONA") = "") Then ents__VZONA =" and USUARIOS.ZONA_TARIFA=" +session("ZONA_TARIFA")
%>
<%
if request("IDVENDEDOR")<>"" AND request("IDVENDEDOR")<>"-1" THEN ents__VZONA =" AND TBL_OPPORTUNITY.IDVENDEDOR="+replace(request("IDVENDEDOR"),"'","''") 'FILTRO DE VENDEDOR
%>
<%
VARFL2=""
if request("EXITED")<>"" THEN VARFL2=" AND EXITED=1" else VARFL2=" AND EXITED<>1 " 'SI SE SACO DEL EMBUDO FITLRAR
if request("ETAPA")<>"" THEN VARFL2=VARFL2 + " AND ETAPA=" + REPLACE(REQUEST("ETAPA"),"'","''") 'FILTRA ETAPA
if request("CIERRE")<>"" THEN VARFL2=VARFL2 + " AND CIERRE=" + REPLACE(REQUEST("CIERRE"),"'","''") 'FILTRA ETAPA
if request("DIVISION")<>"" and request("DIVISION")<>"*" THEN VARFL2=VARFL2 + " AND (TBL_OPPORTUNITY.DIVISION='" + REPLACE(REQUEST("DIVISION"),"'","''")+"' OR (TBL_OPPORTUNITY.DIVISION IS NULL AND USUARIOS.DIVI='"+REPLACE(REQUEST("DIVISION"),"'","''")+"')) " 'FILTRA DIVISION EQUIPO-VENDEDOR
if request("GRP")<>"" and request("GRP")<>"*" THEN VARFL2=VARFL2 + " AND TBL_OPPORTUNITY.GRP='" + REPLACE(REQUEST("GRP"),"'","''")+"' " 'FILTRA DIVISION OPP
if request("ORIGENOP")<>"" and request("ORIGENOP")<>"*" THEN VARFL2=VARFL2 + " AND TBL_OPPORTUNITY.ORIGENOP=" + REPLACE(REQUEST("ORIGENOP"),"'","")+" " 'FILTRA DIVISION OPP
if request("TIPO")<>"" and request("TIPO")<>"*" THEN VARFL2=VARFL2 + " AND TIPO=" + REPLACE(REQUEST("TIPO"),"'","''")+" " 'FILTRA venta renta
ents__VZONA=ents__VZONA + VARFL2 +" "
%>
<%
Dim rp__DESD
rp__DESD = "1/1/04"
If (DES <> "") Then
rp__DESD = DES
End If
%>
<%
Dim rp__HASD
rp__HASD = "1/1/05"
If (HAS <> "") Then
rp__HASD = HAS
End If
%><%SQOP="SELECT TBL_OPPORTUNITY.*,PROSPECTOS.COMPANIA,USUARIOS.NOMBRE,USUARIOS.DIVI,USUARIOS.ZONA,USUARIOS.ZONA_TARIFA FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) left join PROSPECTOS ON (TBL_OPPORTUNITY.IDPROSPECTO=PROSPECTOS.IDCLIENTE) WHERE USUARIOS.cartcontra<>1 " + ents__VZONA + " ORDER BY USUARIOS.ZONA,FECHA_CIERRE,IDOP DESC " '((TBL_OPPORTUNITY.FECHA_CIERRE>='" + strreplace(rp__DESD, "'", "''") + "' AND TBL_OPPORTUNITY.FECHA_CIERRE<='" + strreplace(rp__HASD, "'", "''") + "') OR ( TBL_OPPORTUNITY.FECHA_CIERRE IS NULL ))%>
<%
Dim opps
Dim opps_numRows
Set opps = Server.CreateObject("ADODB.Recordset")
opps.ActiveConnection = MM_maq_STRING
opps.Source = SQOP
opps.CursorType = 0
opps.CursorLocation = 2
opps.LockType = 1
opps.Open()
opps_numRows = 0
%>
<%
Dim vemds__ztar
vemds__ztar = "0"
If (session("ZONA_TARIFA") <> "") Then
vemds__ztar = " AND ZONA_TARIFA=" +session("ZONA_TARIFA")
End If
%>
<%
Dim vemds
Dim vemds_numRows
Set vemds = Server.CreateObject("ADODB.Recordset")
vemds.ActiveConnection = MM_maq_STRING
vemds.Source = "SELECT USERNAM, NOMBRE, APELLIDO, ZONA, IDCLIENTE FROM USUARIOS WHERE CARTCONTRA<>1 " + strreplace(vemds__ztar, "'", "''") + ""
vemds.CursorType = 0
vemds.CursorLocation = 2
vemds.LockType = 1
vemds.Open()
vemds_numRows = 0
%>
<%
Dim divis
Dim divis_numRows
Set divis = Server.CreateObject("ADODB.Recordset")
divis.ActiveConnection = MM_maq_STRING
divis.Source = "SELECT SHORT, DESCRIPCION FROM DIVISIONES ORDER BY DESCRIPCION"
divis.CursorType = 0
divis.CursorLocation = 2
divis.LockType = 1
divis.Open()
divis_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
opps_numRows = opps_numRows + Repeat1__numRows
%>
www.promad.com.mx
<%
zonas.Close()
Set zonas = Nothing
%>
<%
opps.Close()
Set opps = Nothing
%>
<%
vemds.Close()
Set vemds = Nothing
%>
<%
divis.Close()
Set divis = Nothing
%>