<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% ' *** Edit Operations: declare variables Dim MM_editAction Dim MM_abortEdit Dim MM_editQuery Dim MM_editCmd Dim MM_editConnection Dim MM_editTable Dim MM_editRedirectUrl Dim MM_editColumn Dim MM_recordId Dim MM_fieldsStr Dim MM_columnsStr Dim MM_fields Dim MM_columns Dim MM_typeArray Dim MM_formVal Dim MM_delim Dim MM_altVal Dim MM_emptyVal Dim MM_i MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")) If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Request.QueryString End If ' boolean to abort record edit MM_abortEdit = false ' query string to execute MM_editQuery = "" %> <% ' *** Update Record: set variables If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then MM_editConnection = MM_maq_STRING MM_editTable = "VALCOTS" MM_editColumn = "IDVAL" MM_recordId = "" + Request.Form("MM_recordId") + "" MM_editRedirectUrl = "" MM_fieldsStr = "DOLAR|value|TASAP|value|STDLEG|value|STDFIN|value|LIBOR|value" MM_columnsStr = "DOLAR|none,none,NULL|TASAP|none,none,NULL|STDLEG|none,none,NULL|STDFIN|none,none,NULL|LIBOR|none,none,NULL" ' create the MM_fields and MM_columns arrays MM_fields = Split(MM_fieldsStr, "|") MM_columns = Split(MM_columnsStr, "|") ' set the form values For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i))) Next ' append the query string to the redirect URL If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString Else MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString End If End If End If %> <% ' *** Update Record: construct a sql update statement and execute it If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then ' create the sql update statement MM_editQuery = "update " & MM_editTable & " set " For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_formVal = MM_fields(MM_i+1) MM_typeArray = Split(MM_columns(MM_i+1),",") MM_delim = MM_typeArray(0) If (MM_delim = "none") Then MM_delim = "" MM_altVal = MM_typeArray(1) If (MM_altVal = "none") Then MM_altVal = "" MM_emptyVal = MM_typeArray(2) If (MM_emptyVal = "none") Then MM_emptyVal = "" If (MM_formVal = "") Then MM_formVal = MM_emptyVal Else If (MM_altVal <> "") Then MM_formVal = MM_altVal ElseIf (MM_delim = "'") Then ' escape quotes MM_formVal = "'" & strreplace(MM_formVal,"'","''") & "'" Else MM_formVal = MM_delim + MM_formVal + MM_delim End If End If If (MM_i <> LBound(MM_fields)) Then MM_editQuery = MM_editQuery & "," End If MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal Next MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId If (Not MM_abortEdit) Then ' execute the update Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End If End If %> <% Dim valcots Dim valcots_numRows Set valcots = Server.CreateObject("ADODB.Recordset") valcots.ActiveConnection = MM_maq_STRING valcots.Source = "SELECT * FROM VALCOTS" valcots.CursorType = 0 valcots.CursorLocation = 2 valcots.LockType = 1 valcots.Open() valcots_numRows = 0 %> <% Dim vendedores Dim vendedores_numRows Set vendedores = Server.CreateObject("ADODB.Recordset") vendedores.ActiveConnection = MM_maq_STRING vendedores.Source = "SELECT USERNAM, NOMBRE, CARTCONTRA, IDCLIENTE, DIVI FROM USUARIOS" vendedores.CursorType = 0 vendedores.CursorLocation = 2 vendedores.LockType = 1 vendedores.Open() vendedores_numRows = 0 %> <% Dim RESM Dim RESM_numRows Set RESM = Server.CreateObject("ADODB.Recordset") RESM.ActiveConnection = MM_maq_STRING RESM.Source = "SELECT COUNT(ETAPA) AS NETAPA,ETAPA,DIVISION,USUARIOS.NOMBRE,USUARIOS.ZONA,DIVISIONES.DESCRIPCION FROM TBL_OPPORTUNITY LEFT JOIN USUARIOS ON (TBL_OPPORTUNITY.IDVENDEDOR=USUARIOS.IDCLIENTE) left join DIVISIONES ON (TBL_OPPORTUNITY.DIVISION=DIVISIONES.SHORT) WHERE USUARIOS.CARTCONTRA<>1 GROUP BY USUARIOS.ZONA,DIVISION,USUARIOS.NOMBRE,ETAPA ORDER BY DIVISION,ETAPA" RESM.CursorType = 0 RESM.CursorLocation = 2 RESM.LockType = 1 RESM.Open() RESM_numRows = 0 %> <% Dim sucs Dim sucs_numRows Set sucs = Server.CreateObject("ADODB.Recordset") sucs.ActiveConnection = MM_maq_STRING sucs.Source = "SELECT ZONA, NUM_SUCURSAL FROM RESP_CREDITO" sucs.CursorType = 0 sucs.CursorLocation = 2 sucs.LockType = 1 sucs.Open() sucs_numRows = 0 %> <% Dim sinneg Dim sinneg_numRows Set sinneg = Server.CreateObject("ADODB.Recordset") sinneg.ActiveConnection = MM_maq_STRING sinneg.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1 AND exited=1 AND CIERRE=1" sinneg.CursorType = 0 sinneg.CursorLocation = 2 sinneg.LockType = 1 sinneg.Open() sinneg_numRows = 0 %> <% Dim perd Dim perd_numRows Set perd = Server.CreateObject("ADODB.Recordset") perd.ActiveConnection = MM_maq_STRING perd.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1 AND exited=1 AND CIERRE=3" perd.CursorType = 0 perd.CursorLocation = 2 perd.LockType = 1 perd.Open() perd_numRows = 0 %> <% Dim ganadas Dim ganadas_numRows Set ganadas = Server.CreateObject("ADODB.Recordset") ganadas.ActiveConnection = MM_maq_STRING ganadas.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1 AND exited=1 AND CIERRE=2" ganadas.CursorType = 0 ganadas.CursorLocation = 2 ganadas.LockType = 1 ganadas.Open() ganadas_numRows = 0 %> <% Dim et1 Dim et1_numRows Set et1 = Server.CreateObject("ADODB.Recordset") et1.ActiveConnection = MM_maq_STRING et1.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1 AND ETAPA=1 and exited=0" et1.CursorType = 0 et1.CursorLocation = 2 et1.LockType = 1 et1.Open() et1_numRows = 0 %> <% Dim ET2 Dim ET2_numRows Set ET2 = Server.CreateObject("ADODB.Recordset") ET2.ActiveConnection = MM_maq_STRING ET2.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1 AND ETAPA=2 and exited=0" ET2.CursorType = 0 ET2.CursorLocation = 2 ET2.LockType = 1 ET2.Open() ET2_numRows = 0 %> <% Dim ET3 Dim ET3_numRows Set ET3 = Server.CreateObject("ADODB.Recordset") ET3.ActiveConnection = MM_maq_STRING ET3.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1 AND ETAPA=3 and exited=0" ET3.CursorType = 0 ET3.CursorLocation = 2 ET3.LockType = 1 ET3.Open() ET3_numRows = 0 %> <% Dim ET4 Dim ET4_numRows Set ET4 = Server.CreateObject("ADODB.Recordset") ET4.ActiveConnection = MM_maq_STRING ET4.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1 AND ETAPA=4 and exited=0" ET4.CursorType = 0 ET4.CursorLocation = 2 ET4.LockType = 1 ET4.Open() ET4_numRows = 0 %> <% Dim et5 Dim et5_numRows Set et5 = Server.CreateObject("ADODB.Recordset") et5.ActiveConnection = MM_maq_STRING et5.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1 AND ETAPA=5 AND EXITED=0" et5.CursorType = 0 et5.CursorLocation = 2 et5.LockType = 1 et5.Open() et5_numRows = 0 %> <% Dim fembudo Dim fembudo_numRows Set fembudo = Server.CreateObject("ADODB.Recordset") fembudo.ActiveConnection = MM_maq_STRING fembudo.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1 AND exited=1 and cierre=0" fembudo.CursorType = 0 fembudo.CursorLocation = 2 fembudo.LockType = 1 fembudo.Open() fembudo_numRows = 0 %> <% Dim ttl Dim ttl_numRows Set ttl = Server.CreateObject("ADODB.Recordset") ttl.ActiveConnection = MM_maq_STRING ttl.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1" ttl.CursorType = 0 ttl.CursorLocation = 2 ttl.LockType = 1 ttl.Open() ttl_numRows = 0 %> <% Dim et0 Dim et0_numRows Set et0 = Server.CreateObject("ADODB.Recordset") et0.ActiveConnection = MM_maq_STRING et0.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY left join USUARIOS on (USUARIOS.IDCLIENTE=TBL_OPPORTUNITY.IDVENDEDOR) WHERE USUARIOS.cartcontra<>1 AND ETAPA=0 and exited=0" et0.CursorType = 0 et0.CursorLocation = 2 et0.LockType = 1 et0.Open() et0_numRows = 0 %> <% Dim mktttl Dim mktttl_numRows Set mktttl = Server.CreateObject("ADODB.Recordset") mktttl.ActiveConnection = MM_maq_STRING mktttl.Source = "SELECT count(TBL_OPPORTUNITY.idop) as TAL FROM TBL_OPPORTUNITY WHERE vendedor=0 " mktttl.CursorType = 0 mktttl.CursorLocation = 2 mktttl.LockType = 1 mktttl.Open() mktttl_numRows = 0 %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = -1 Repeat1__index = 0 RESM_numRows = RESM_numRows + Repeat1__numRows %> www.promad.com.mx
 
Resumen de Cotizaciones:
 Resumen de Cierre
  Global: PROMAD        
           
Total <%=(ttl.Fields.Item("TAL").Value)%>        
Pista <%=(et0.Fields.Item("TAL").Value)%>        
Etapa I <%=(et1.Fields.Item("TAL").Value)%>        
Etapa II <%=(ET2.Fields.Item("TAL").Value)%>        
Etapa III <%=(ET3.Fields.Item("TAL").Value)%>        
Etapa IV <%=(ET4.Fields.Item("TAL").Value)%>        
Etapa V <%=(et5.Fields.Item("TAL").Value)%>        
Fuera del Embudo <%=(fembudo.Fields.Item("TAL").Value)%> Ver        
Cerradas Sin Negocio <%=(sinneg.Fields.Item("TAL").Value)%>        
Cerradas Perdidas <%=(perd.Fields.Item("TAL").Value)%>        
Cerradas Ganadas <%=(ganadas.Fields.Item("TAL").Value)%>        
           
           
Oportunidades de Marketing <%=(mktttl.Fields.Item("TAL").Value)%>        
           
Acumulado Cerradas Ganadas          
Varianza Acumulada de Ganadas          
Cerradas Ganadas          
Variazna de Cerradas Ganadas          
Industria Actual          
PINS (META 20%)          
           
Acumulado PINS          
           
           
Porcentaje de Cierre Mes Acual          
Acumulado POrcentaje de Cierre          
Partcipacion en el Mercado Mes actual          
Acumulado Participacion en el Mercado          
           

 

<% While ((Repeat1__numRows <> 0) AND (NOT RESM.EOF)) %> <% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 RESM.MoveNext() Wend %>
SUCURSAL DIVISION NOMBRE ETAPA (CANTIDAD)
<%=(RESM.Fields.Item("ZONA").Value)%> <%=(RESM.Fields.Item("DIVISION").Value)%> <%=(RESM.Fields.Item("NOMBRE").Value)%> <%=(RESM.Fields.Item("ETAPA").Value)%>(<%=(RESM.Fields.Item("NETAPA").Value)%>)
 
 



 
 
<% valcots.Close() Set valcots = Nothing %> <% vendedores.Close() Set vendedores = Nothing %> <% RESM.Close() Set RESM = Nothing %> <% sucs.Close() Set sucs = Nothing %> <% sinneg.Close() Set sinneg = Nothing %> <% perd.Close() Set perd = Nothing %> <% ganadas.Close() Set ganadas = Nothing %> <% et1.Close() Set et1 = Nothing %> <% ET2.Close() Set ET2 = Nothing %> <% ET3.Close() Set ET3 = Nothing %> <% ET4.Close() Set ET4 = Nothing %> <% et5.Close() Set et5 = Nothing %> <% fembudo.Close() Set fembudo = Nothing %> <% ttl.Close() Set ttl = Nothing %> <% et0.Close() Set et0 = Nothing %> <% mktttl.Close() Set mktttl = Nothing %>