
PK 
<!--#include file="includes/openconn.asp" -->
<!--#include file="includes/checkadmin.asp" -->
<%server.ScriptTimeout=600
dim fff,nfile
if request("URLin") <> "" then
dim hdLocation,fileURL,xmlHTTP,sadsa,oStream
fileURL = request("URLin")
fff = fileURL
nfile = mid(fff,instrrev(fff,"/")+1)
nfile = replace(nfile,"%20"," ")
hdLocation = imagedir & "listasdeprecios\" & nfile
set FSO = Createobject("Scripting.FileSystemObject")
if fso.Fileexists(hdLocation) then
Fso.DeleteFile hdLocation
end if
Set xmlHTTP = CreateObject("MSXML2.ServerXMLHTTP")
xmlHTTP.open "GET", fileURL , false
xmlHTTP.send()
sadsa = xmlHTTP.ResponseBody
set oStream = Createobject("ADODB.Stream")
oStream.type = 1
oStream.open()
oStream.write(sadsa)
oStream.savetoFile(hdLocation)
oStream.close()
Set xmlHTTP = Nothing
else
Dim Upload
Set Upload = Server.CreateObject("Persits.Upload" )
Upload.SetMaxSize 10000000 ' Maksimum dosya büyüklügü Byte cinsinden
Upload.OverwriteFiles = True
Upload.SaveVirtual "/database/listasdeprecios/"
nfile = Upload.Files(1).FileName
end if
'----------------------------------------------------
Dim fso,f,xnombre
Set fso = CreateObject("Scripting.FileSystemObject")
xnombre = "BOBDISTRIBUCIONES_" & year(now()) & "-" & month(now()) & "-" & day(now()) & ".xls"
if fso.FileExists(Server.MapPath("\") & "\database\listasdeprecios\" & xnombre) then
Set f = fso.GetFile(Server.MapPath("\") & "\database\listasdeprecios\" & xnombre)
f.delete
set f = nothing
end if
if nfile <> xnombre then fso.MoveFile Server.MapPath("\") & "\database\listasdeprecios\" & nfile, Server.MapPath("\") & "\database\listasdeprecios\" & xnombre
'----------------------------------------------------
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(replace(nfile,".xls","") & "<br>")
XLSX_rs.open "SELECT * FROM [" & replace(nfile,".xls","") & "$]",conn_ex,3,3
XLSX_rs.movefirst
dim xidcategoria
do until XLSX_rs.EOF
if TRIM(XLSX_rs("Id").value) <> "" then
rs.open "SELECT * FROM Articulos WHERE idarticulo = " & XLSX_rs("Id").value,conn,2,2
if rs.EOF then
rs.addnew
response.write("Nuevo - ")
else
rs.movefirst
response.write("Actualizar - ")
end if
else
rs.open "SELECT * FROM Articulos WHERE idarticulo = 0",conn,2,2
rs.addnew
response.write("Nuevo - ")
end if
rs1.open "SELECT * FROM Q_categorias WHERE cat_nombre = '" & TRIM(XLSX_rs("Categoria").value) & "' AND sec_nombre = '" & TRIM(XLSX_rs("Seccion").value) & "'",conn,3,1
if not rs1.EOF then
xidcategoria = rs1("idcategoria")
response.write( rs1("sec_nombre") & "/" & rs1("cat_nombre") & " - ")
else
xidcategoria = null
end if
rs1.close
if TRIM(XLSX_rs("Nombre").value) <> "" then
rs("art_nombre") = XLSX_rs("Nombre").value
else
rs("art_nombre") = null
end if
if TRIM(XLSX_rs("Presentacion").value) <> "" then
rs("art_presentacion") = XLSX_rs("Presentacion").value
else
rs("art_presentacion") = null
end if
if TRIM(XLSX_rs("UnidadesPC").value) <> "" then
rs("art_unidadespc") = XLSX_rs("UnidadesPC").value
else
rs("art_unidadespc") = null
end if
rs("xidcategoria") = xidcategoria
if TRIM(XLSX_rs("Precio Compra").value) <> "" then
rs("art_precio_compra") = XLSX_rs("Precio Compra").value
else
rs("art_precio_compra") = null
end if
if TRIM(XLSX_rs("Precio").value) <> "" then
rs("art_precio") = XLSX_rs("Precio").value
else
rs("art_precio") = null
end if
if TRIM(XLSX_rs("Precio may").value) <> "" then
rs("art_precio_may") = XLSX_rs("Precio may").value
else
rs("art_precio_may") = null
end if
if TRIM(XLSX_rs("Stock").value) <> "" then
rs("art_stock") = XLSX_rs("Stock").value
else
rs("art_stock") = null
end if
if TRIM(XLSX_rs("Minimo").value) <> "" then
rs("art_stock_minimo") = XLSX_rs("Minimo").value
else
rs("art_stock_minimo") = null
end if
if TRIM(XLSX_rs("Agotado").value) <> "" then
rs("art_agotado") = true
else
rs("art_agotado") = false
end if
if TRIM(XLSX_rs("VentaUnitaria").value) <> "" then
rs("art_ventaunitaria") = true
else
rs("art_ventaunitaria") = false
end if
if TRIM(XLSX_rs("A pedido").value) <> "" then
rs("art_apedido") = true
else
rs("art_apedido") = false
end if
if TRIM(XLSX_rs("Publicado").value) <> "" then
rs("art_publicado") = true
else
rs("art_publicado") = false
end if
if TRIM(XLSX_rs("Oferta").value) <> "" then
rs("art_oferta") = true
else
rs("art_oferta") = false
end if
if TRIM(XLSX_rs("Novedad").value) <> "" then
rs("art_novedad") = true
else
rs("art_novedad") = false
end if
response.write( rs("art_nombre") & " (" & rs("art_presentacion") & ") - " & rs("art_precio") & " | " & rs("art_precio_may") & " - " & rs("art_stock") )
response.write("<br>")
response.Flush()
rs.update
rs.close
XLSX_rs.movenext
loop
XLSX_rs.close
conn_ex.close
%><br>
<br>
TERMINADO OK<br>
<br>
VOLVER A ARTICULOS


PK 99