<%
Option Explicit
Session.LCID = 2058
'***** SI NO HA INICIADO SESION ***
If Session("Mybussiness") = "" then
Response.redirect("default.asp")
Else
Session.Timeout = 1200
'******* EN CASO DE ERROR ****
Err.Clear
On Error Resume Next
'*** REMPLAZA
Function Sanea(Texto)
Sanea = Replace(Texto, "'", "''")
Sanea2 = Replace(Texto, ",", ".")
End Function
%>
<!DOCTYPE html>
<HTML>
<HEAD>
<meta charset="ISO-8859-1" />
<TITLE>SISTEMA MIM <%= Session("Mybussiness") %> USUARIO: <%= Session("MyName") %></TITLE>
<link href="css/IndicadorA.css" rel="stylesheet" />
<!-- Scripts para la grafica Meses -->
<script src="RGraph/RGraph.svg.common.core.js"></script>
<script src="RGraph/RGraph.svg.common.tooltips.js"></script>
<script src="RGraph/RGraph.svg.common.bar.js"></script>
<script src="RGraph/RGraph.svg.common.line.js"></script>
<script src="RGraph/RGraph.svg.common.pie.js"></script>
<script src="RGraph/RGraph.svg.bar.js"></script>
<script src="RGraph/RGraph.svg.Pie.js"></script>
<!-- JavaScript para enviar a una pagina emergente -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
// End -->
</script>
</HEAD>
<BODY>
<%
'***** Variables a la base de datos ****
Dim Cn1, Cn2, Cn3,
Dim Cn14, Cn15, Cn16, Cn17, Cn18, Cn19, Cn20, Cn21, Cn22, Cn23, Cn24, Cn25, Cn26, Cn27, Cn28, Cn29
Dim Rs11, Rs12, Rs13, Rs14, Rs15, Rs16, Rs17, Rs18, Rs19, Rs20, Rs21, Rs22, Rs23, Rs24, Rs25, Rs26, Rs27, Rs28, Rs29
Dim Sql11, Sql12, Sql13, Sql14, Sql15, Sql16, Sql17, Sql18, Sql19, Sql20, Sql21, Sql22, Sql23, Sql24, Sql25, Sql26, Sql27, Sql28, Sql29
'***** Conexion a la Base de Datos
Set Cn1 = Server.CreateObject( "ADODB.Connection" )
Cn1.Open "DRIVER={SQL Server};SERVER=172.17.0.5;UID="& Session("MyName") &";PWD="& Session("MyPass") &";Database="& Session("Mybussiness") &""
Set Cn2 = Server.CreateObject( "ADODB.Connection" )
Cn2.Open "DRIVER={SQL Server};SERVER=172.17.0.5;UID=ADMINDMEX;PWD=IW2BF01;Database=REPORTES"
'***** Conexion A la Tabla Empresa ****
Set Rs11 = Server.CreateObject("ADODB.Recordset")
Sql11="Select * from Empresa;"
Rs11.Open Sql11,Cn1,1,2
%>
<Header>
<%= Rs11("Nombre") %><br>
<%= Rs11("Direccion") %>, <%= Rs11("colonia") %><br>
<%= Rs11("Poblacion") %>
</header>
<SECTION>
<center>
<br><br>
<%
'--------------- ELIMINO LA TABLA TEMPORAL
Set Rs12 = server.CreateObject("ADODB.Recordset")
Sql12="if exists (select * from dbo.sysobjects where id = object_id(N'" & Session("MyName")&"MIN" & "') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table " & Session("MyName")&"MIN" & ";"
Rs12.open Sql12,Cn2,1,2
'------------ CREO LA NUEVA TABLA TEMPORAL
Set Rs13=server.CreateObject("ADODB.recordset")
Set Rs13=Cn2.Execute("CREATE TABLE " & Session("MyName")&"MIN" & "( " &_
"[EMPRESA] [varchar](50) NULL, " &_
"[CODIGO] [varchar](50) NULL, " &_
"[DESCRIPCION] [varchar](200) NULL, " &_
"[UDM] [varchar](50) NULL, " &_
"[EXISTENCIAS] [decimal](18, 2) NULL, " &_
"[APARTADOS] [decimal](18, 2) NULL, " &_
"[PROCESAR] [decimal](18, 2) NULL, " &_
"[RECIBIR] [decimal](18, 2) NULL, " &_
"[MINIMO] [decimal](18, 2) NULL, " &_
"[MAXIMO] [decimal](18, 2) NULL, " &_
"[CLALIN] [int] NULL, " &_
"[LINEA] [varchar](200) NULL, " &_
"[DISPONIBLE] [decimal](18, 2) NULL, " &_
"[CALIFICACION] [int] NULL " &_
")" )
'//******* VACIAMOS DATOS DEL STOCK MINIMO BD MEXICO*****//
Set Rs14=server.CreateObject("ADODB.recordset")
Sql14="INSERT INTO REPORTES.DBO." & Session("MyName")&"MIN" & " " &_
"(REPORTES.DBO." & Session("MyName")&"MIN" & ".EMPRESA, REPORTES.DBO." & Session("MyName")&"MIN" & ".CODIGO, " &_
"REPORTES.DBO." & Session("MyName")&"MIN" & ".DESCRIPCION, REPORTES.DBO." & Session("MyName")&"MIN" & ".UDM, " &_
"REPORTES.DBO." & Session("MyName")&"MIN" & ".EXISTENCIAS, REPORTES.DBO." & Session("MyName")&"MIN" & ".APARTADOS, " &_
"REPORTES.DBO." & Session("MyName")&"MIN" & ".PROCESAR, REPORTES.DBO." & Session("MyName")&"MIN" & ".RECIBIR, " &_
"REPORTES.DBO." & Session("MyName")&"MIN" & ".MINIMO, REPORTES.DBO." & Session("MyName")&"MIN" & ".MAXIMO, " &_
"REPORTES.DBO." & Session("MyName")&"MIN" & ".CLALIN, REPORTES.DBO." & Session("MyName")&"MIN" & ".LINEA, " &_
"REPORTES.DBO." & Session("MyName") & ".DISPONIBLE, REPORTES.DBO." & Session("MyName") & ".CALIFICACION) " &_
"SELECT 'MEXICO', CVEINV, NOMINV, UDMINV, " &_
"EXIRMUL, CAPMUL, RSEM, CXRMUL, SMIMUL, SMAMUL, LININV, DESLIN, (Exirmul - Capmul - RSEM), " &_
"CASE WHEN (Exirmul - Capmul - RSEM + Cxrmul) < Smimul THEN 1 ELSE 0 END " &_
"From MULTIALMACEN left join INVENTARIOS on CVEINV = ARTMUL " &_
"LEFT JOIN LINEAS ON LININV = CLALIN " &_
"where ALMMUL = 1 " &_
"order by ARTMUL;"
Cn1.Execute Sql14
'*************************************************
'* *
'* REENVIA AL DASHBOARD DE INVENTARIOS *
'* *
'*************************************************
Response.redirect("InvDashGra.asp")
%>
</SECTION>
<%
If Err.Number <> 0 Then
%>
<br><br>
Número de Error: <%= Err.Number %><BR>
Descripción: <%= Err.Description %><BR>
Origen: <%= Err.Source %><BR>
Linea: <%= Err.Line %><BR>
<br>
<%
Else
'****** FIN DE LOS ERRORES ***
End If
%>
</BODY>
</HTML>
<%
'FIN DE SESION
End If
%>