
PK 
<!--#include file="includes/openconn.asp" -->
<!--#include file="includes/checkadmin.asp" -->
<!DOCTYPE html>
<html lang="en">
<head>
<!--#include file="includes/metatags.asp" -->
<link rel="stylesheet" href="lightbox/css/bootstrap-lightbox.min.css">
<link rel="stylesheet" href="lightbox/prettify/prettify.css">
</head>
<body>
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<!--#include file="includes/navup.asp" -->
<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<%session("seccion") = "Articulos"%>
<!--#include file="includes/navizq.asp" -->
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Articulos <small>importar XLS</small></h1>
</div>
</div>
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<%server.ScriptTimeout=600
'----------------------------------------------------
Dim fso,f,xnombre
Set fso = CreateObject("Scripting.FileSystemObject")
xnombre = "FECORT_" & year(now()) & "-" & month(now()) & "-" & day(now()) & ".xls"
'----------------------------------------------------
dim conn_ex, XLSX_rs
Set conn_ex = Server.CreateObject("ADODB.Connection")
Set XLSX_rs = server.createobject("ADODB.Recordset")
conn_ex.Open("Data Source=" & virtualdir & "\listasdeprecios\" & xnombre & ";Provider=Microsoft.ACE.OLEDB.12.0; Extended Properties=Excel 12.0;")
'conn_ex.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & virtualdir & "\listasdeprecios\" & xnombre & ";Propiedades extendidas=""Excel 8.0;""")
'conn_ex.Open("DRIVER={Microsoft Excel Driver (*.xls)}; DBQ=" & virtualdir & "\listasdeprecios\" & xnombre)
'--------------------------- DOLAR
response.Write(xnombre & "<br>")
XLSX_rs.open "SELECT * FROM [Sheet1$]",conn_ex,3,3
XLSX_rs.movefirst
for a = 0 to XLSX_rs.fields.count - 1
response.Write(a & " - " & XLSX_rs.fields(a).name & "<br>")
next
response.Write("<hr>")
dim xidcategoria
do until XLSX_rs.EOF
if TRIM(XLSX_rs("Familia").value) <> "" then
rs1.open "SELECT * FROM Familias WHERE fam_codigo = '" & XLSX_rs("Familia").value & "'",conn,2,2
if rs1.EOF then
rs1.addnew
response.write("Nueva Familia - " & XLSX_rs("Detalle").value & " - " & XLSX_rs("Familia").value & "<br>" )
rs1("fam_codigo") = XLSX_rs("Familia").value
rs1("fam_nombre") = XLSX_rs("Detalle").value
rs1.update
end if
rs1.close
end if
if TRIM(XLSX_rs("SubFamilia").value) <> "" then
rs1.open "SELECT * FROM SubFamilias WHERE sfam_codigo = '" & XLSX_rs("SubFamilia").value & "'",conn,2,2
if rs1.EOF then
rs1.addnew
response.write("Nueva SubFamilia - " & XLSX_rs("Detalle1").value & " - " & XLSX_rs("SubFamilia").value & "<br>" )
rs1("sfam_codigo") = XLSX_rs("SubFamilia").value
rs1("sfam_nombre") = XLSX_rs("Detalle1").value
rs1("xfam_codigo") = XLSX_rs("Familia").value
rs1.update
end if
rs1.close
end if
if TRIM(XLSX_rs("Proveedor").value) <> "" then
rs1.open "SELECT * FROM Proveedores WHERE prov_codigo = '" & XLSX_rs("Proveedor").value & "'",conn,2,2
if rs1.EOF then
rs1.addnew
response.write("Nuevo Proveedor - " & XLSX_rs("Nombre").value & " - " & XLSX_rs("Proveedor").value & "<br>" )
rs1("prov_codigo") = XLSX_rs("Proveedor").value
rs1("prov_nombre") = XLSX_rs("Nombre").value
rs1.update
end if
rs1.close
end if
if TRIM(XLSX_rs("Codigo").value) <> "" then
rs.open "SELECT * FROM Articulos WHERE art_codigo = '" & XLSX_rs("Codigo").value & "'",conn,2,2
if rs.EOF then
rs.addnew
response.write("Nuevo - ")
else
rs.movefirst
response.write("Actualizar - ")
end if
if TRIM(XLSX_rs("Codigo").value) <> "" then
rs("art_codigo") = XLSX_rs("Codigo").value
else
rs("art_codigo") = null
end if
if TRIM(XLSX_rs("Descripcion").value) <> "" then
rs("art_nombre") = XLSX_rs("Descripcion").value
else
rs("art_nombre") = null
end if
if TRIM(XLSX_rs("Proveedor").value) <> "" then
rs("xprov_codigo") = XLSX_rs("Proveedor").value
else
rs("xprov_codigo") = null
end if
if TRIM(XLSX_rs("Familia").value) <> "" then
rs("xfam_codigo") = XLSX_rs("Familia").value
else
rs("xfam_codigo") = null
end if
if TRIM(XLSX_rs("Subfamilia").value) <> "" then
rs("xsfam_codigo") = XLSX_rs("Subfamilia").value
else
rs("xsfam_codigo") = null
end if
if TRIM(XLSX_rs("Punto de Reposicion").value) <> "" then
rs("art_stock_minimo") = XLSX_rs("Punto de Reposicion").value
else
rs("art_stock_minimo") = null
end if
if TRIM(XLSX_rs("Uni x Bulto").value) <> "" then
rs("art_unidadespc") = XLSX_rs("Uni x Bulto").value
else
rs("art_unidadespc") = null
end if
if TRIM(XLSX_rs("Precio de Costo").value) <> "" then
rs("art_precio_compra") = XLSX_rs("Precio de Costo").value
else
rs("art_precio_compra") = null
end if
if TRIM(XLSX_rs("PRECIO 1").value) <> "" then
rs("art_precio") = XLSX_rs("PRECIO 1").value
else
rs("art_precio") = null
end if
if TRIM(XLSX_rs("PRECIO 2").value) <> "" then
rs("art_precio_may") = XLSX_rs("PRECIO 2").value
else
rs("art_precio_may") = null
end if
if TRIM(XLSX_rs("Stock Unidad 1").value) <> "" then
rs("art_stock") = XLSX_rs("Stock Unidad 1").value
else
rs("art_stock") = null
end if
if XLSX_rs("Inhabilitado").value = "No" then
rs("art_publicado") = true
else
rs("art_publicado") = false
end if
response.write( rs("art_nombre") & " (" & rs("art_codigo") & ") - " & rs("art_precio") & " | " & rs("art_stock") )
response.write("<br>")
end if
response.Flush()
rs.update
rs.close
XLSX_rs.movenext
loop
XLSX_rs.close
conn_ex.close
%><br>
<br>
TERMINADO OK<br>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script src="lightbox/js/scale.fix.js"></script>
<script src="lightbox/prettify/prettify.js"></script>
<script src="lightbox/js/bootstrap-lightbox.min.js"></script>
</body>
</html>
<!--#include file="includes/closeconn.asp" -->


PK 99