<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% IF session("ACTIVO")<>"1" THEN RESPONSE.REDIRECT("main.asp") %> <% ' *** Restrict Access To Page: Grant or deny access to this page MM_authorizedUsers="ADMIN,ENTER" 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 %> <% Randomize function ZeroPad(sWork, nDigits) ZeroPad = right(string(nDigits, "0") & trim(sWork), nDigits) end function function GetIndexNumber() sDay = Day(Now()) sMonth = Month(Now()) sYear = Year(Now()) sHour = Hour(Now()) sMinute = Minute(Now()) sSecond = Second(Now()) Tail = Int(1000000 * Rnd) GetIndexNumber = ZeroPad(sYear, 4) & ZeroPad(sMonth, 2) & ZeroPad(sDay, 2) & ZeroPad(sHour, 2) & ZeroPad(sMinute, 2) & ZeroPad(sSecond, 2) & ZeroPad(Tail, 6) end function %> <%'Soporte para maquinaria Usada ADDU="" if request("U")="U" then ADDU="U" %> <% head=split(session("FALIAS"),"|") 'Array de Encabezados cpos=split(session("FLDS"),"|") 'Array de Campos edt=split(session("EDITAR"),"|") 'Array de Permisos DIM SZ() 'array Variable REdim SZ(Ubound(head)) 'Tamaņo de los campos %> <% ' *** Edit Operations: declare variables MM_editAction = CStr(Request("URL")) ' boolean to abort record edit MM_abortEdit = false ' query string to execute MM_editQuery = "" %> <% ' *** Update Record: set variables If CStr(Request("MM_insert")) <> "" Then MM_editConnection = MM_entradas_STRING MM_editTable = "ENTRADAS" +ADDU MM_editColumn = "ID" MM_recordId = "" + Request.Form("MM_recordId") + "" MM_editRedirectUrl = "consulta.asp" if ADDU<>"" then MM_editRedirectUrl = "insu.asp" ' create the sql update statement comm="" fldse="" vals="" for i=0 to Ubound(head) 'Crea loop segun capos de edicion if edt(i)=1 then if cpos(i)<>"ID_UNIQUE" then fldse=fldse+comm +cpos(i) vals = vals + comm + "'" + strreplace(request(cpos(i)),"'","''") + "'" comm="," end if end if next uid=GetIndexNumber() MM_editQuery = "insert into " & MM_editTable & " " & "(ID_UNIQUE," & fldse & ") values ('" & uid & "'," & vals & ")" 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 'response.write(MM_editQuery) MM_editCmd.Execute MM_editCmd.ActiveConnection.Close If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End If End If %> <% set maxid = Server.CreateObject("ADODB.Recordset") maxid.ActiveConnection = MM_entradas_STRING maxid.Source = "SELECT ID as NUMERO,PEDIDO AS PEDID FROM ENTRADAS" + ADDU + " WHERE ID = (SELECT MAX(ID) FROM ENTRADAS" + ADDU +")" 'if ADDU="U" THEN Response.Redirect("escribes.asp?cmd=" +"SELECT ID as NUMERO,PEDIDO AS PEDID FROM ENTRADAS" + ADDU + " WHERE ID = (SELECT MAX(ID) FROM ENTRADAS" + ADDU +")") maxid.CursorType = 0 maxid.CursorLocation = 2 maxid.LockType = 3 maxid.Open() maxid_numRows = 0 %> <% Dim Repeat1__numRows Repeat1__numRows = 30 Dim Repeat1__index Repeat1__index = 0 ents_numRows = ents_numRows + Repeat1__numRows %> PROMAD
 
Agregar Nuevo Pedido:
Para agregar unnuevo pedido, Llene los campos a los que tiene acceso, y presione el Botón de , Después de Crear el pedido sera enviado al Listado General de Pedidos, Recuerde que el Orden de los Pedidos se Basa en el Número de Entrada, Considere el Numero de se sugiere Automaticamente antes de Guardar y Corrija en Caso de Ser necesario.
<% head=split(session("FALIAS"),"|") cpos=split(session("FLDS"),"|") edt=split(session("EDITAR"),"|") for n=0 to Ubound(head) ' SZ(n)= cstr(ents.Fields.Item(cpos(n)).DefinedSize ) next %> <%for i=0 to Ubound(head)%> <% If (i Mod 2) Then Response.Write("") %> <% next %>
<%str=(maxid.Fields.Item("PEDID").Value) if str<>"" then V=0 if ADDU="U" then v=1 str=right(str,len(str)-(2+V)) str=left(str,4) IF instr(str,"-")>0 then str=right(str,3) end if str=replace(str,"-","") str=replace(str,"I","") str=replace(str,"IRP","") str=replace(str,"RP","") str=replace(str,"R","") if not isnumeric(str) then str=0 str=str+1 response.write(str) %>
<%=head(i) %> <% val="" if cpos(i)="PEDIDO" THEN val="M-" + cstr(str) if cpos(i)="FECHA" THEN val=CSTR(DATE()) if edt(i)=1 then response.write ("" ) else response.write ("" + cstr(val)) %>
 
 

  
 
 
<% maxid.Close() %>