<%
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, "'", "''")
End Function
%>
<!DOCTYPE html>
<HTML>
<HEAD>
<meta charset="ISO-8859-1" />
<TITLE>SISTEMA MIM <%= Session("Mybussiness") %> USUARIO: <%= Session("MyName") %></TITLE>
<link href="css/Modulo5.css" rel="stylesheet" />
<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
Dim Rs11, Rs12, Rs13, Rs14, Rs15, Rs16
Dim Sql11, Sql12, Sql13, Sql14, Sql15, Sql16
'***** 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") &""
'***** 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>
<%
Dim Registro
Dim ClaveCp, NombreCp, ClaveV, NombreV
Dim TipoC
Dim KardexU, UcostoE, CPromedioE, PrecioE, CostoOperado
Registro = Request("Registro")
'***** Conexion A la Tabla Movimiento al Inventario ****
Set Rs12 = Server.CreateObject("ADODB.Recordset")
Sql12="Select CodmInv, Nominv, CanMinv, Udminv, CPRMinv, TipoC, PrvMinv, UcoMinv, Cpminv, Tcaminv, DocMinv, Dlacim, FecMinv " &_
"from Movinv, Inventarios, Movcon " &_
"where Regminv = "& Registro &" and Cveinv = Codminv and Tmominv = Cvecim;"
Rs12.Open Sql12,Cn1,1,2
ClaveCp = Rs12("CPRMinv")
TipoC = Rs12("TipoC")
If ClaveCp = "" or Isnull(ClaveCp) or ClaveCp = "00000000" or ClaveCp = "0" Then
NombreCp = ""
ClaveV = "-"
NombreV = "-"
Else If TipoC = "V" Then
'***** Conexion A la Tabla Clientes ****
Set Rs13 = Server.CreateObject("ADODB.Recordset")
Sql13="Select Nomcli, vencli, Nomvend " &_
"from Clientes left join Vendedores on Vencli = Cvevend " &_
"where Clacli = '"& ClaveCp &"';"
Rs13.Open Sql13,Cn1,1,2
NombreCp = Rs13("Nomcli")
ClaveV = Rs13("vencli")
NombreV = Rs13("Nomvend")
CostoOperado = Cdbl(Rs12("PrvMinv")) / Cdbl(Rs12("Tcaminv"))
Else
'***** Conexion A la Tabla Clientes ****
Set Rs13 = Server.CreateObject("ADODB.Recordset")
Sql13="Select Nomprv " &_
"from Proveedores " &_
"where Cveprv = '"& ClaveCp &"';"
Rs13.Open Sql13,Cn1,1,2
NombreCp = Rs13("Nomprv")
ClaveV = "-"
NombreV = "-"
CostoOperado = Cdbl(Rs12("UcoMinv")) / Cdbl(Rs12("Tcaminv"))
End If
End If
'***** Conexion A la Tabla Empresa ****
Set Rs14 = Server.CreateObject("ADODB.Recordset")
Sql14="Select Kardex " &_
"From Users " &_
"where ClaUsr = '"& Session("MyName") &"';"
Rs14.Open Sql14,Cn1,1,2
KardexU = Rs14("Kardex")
If KardexU = 0 Then
UcostoE = 0
CPromedioE = 0
PrecioE = 0
CostoOperado = 0
Else
UcostoE = Rs12("UcoMinv")
CPromedioE = Rs12("Cpminv")
PrecioE = Rs12("PrvMinv")
CostoOperado = CostoOperado
End If
%>
<Table Id="KardexTd">
<Tr>
<Td Bgcolor="E2E6E7">Clave</Td>
<Td Bgcolor="E2E6E7" Colspan="4">Cliente/ Proveedor</Td>
</Tr>
<Tr>
<Td><%= Rs12("CPRMinv") %></Td>
<Td colspan="4"><%= NombreCp %></Td>
</Tr>
<Tr>
<Td Bgcolor="E2E6E7">Vendedor</Td>
<Td Bgcolor="E2E6E7" Colspan="4">Nombre</Td>
</Tr>
<Tr>
<Td><%= ClaveV %></Td>
<Td colspan="4"><%= NombreV %></Td>
</Tr>
<Tr>
<Td Bgcolor="E2E6E7">Tipo Doc</Td>
<Td Bgcolor="E2E6E7">Documento</Td>
<Td Bgcolor="E2E6E7" Colspan="3">Fecha</Td>
</Tr>
<Tr>
<Td><%= Rs12("Dlacim") %></Td>
<Td><%= Rs12("DocMinv") %></Td>
<Td colspan="3"><%= Rs12("FecMinv") %></Td>
</Tr>
<Tr>
<Td Bgcolor="E2E6E7">Codigo</Td>
<Td Bgcolor="E2E6E7" Colspan="2">Descripcion</Td>
<Td Bgcolor="E2E6E7">Cantidad</Td>
<Td Bgcolor="E2E6E7">UDM</Td>
</Tr>
<Tr>
<Td><%= Rs12("Codminv") %></Td>
<Td Colspan="2"><%= Rs12("Nominv") %></Td>
<Td Align="Right"><%= Formatnumber(Rs12("Canminv")) %></Td>
<Td><%= Rs12("UDMInv") %></Td>
</Tr>
<Tr>
<Td Bgcolor="E2E6E7">Precio Venta</Td>
<Td Bgcolor="E2E6E7">Ult. Costo</Td>
<Td Bgcolor="E2E6E7">Costo Prom</Td>
<Td Bgcolor="E2E6E7">T_Cambio</Td>
<Td Bgcolor="E2E6E7">Equivalente </Td>
</Tr>
<Tr>
<Td Align="Right"><%= Formatnumber(PrecioE) %></Td>
<Td Align="Right"><%= Formatnumber(UcostoE) %></Td>
<Td Align="Right"><%= Formatnumber(CPromedioE) %></Td>
<Td Align="Right"><%= Formatnumber(Rs12("TcaMinv")) %></Td>
<Td Align="Right"><%= Formatnumber(CostoOperado) %> </Td>
</Tr>
</Table>
</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
%>