Skip to content

Instantly share code, notes, and snippets.

@quique123
Created July 29, 2010 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quique123/498219 to your computer and use it in GitHub Desktop.
Save quique123/498219 to your computer and use it in GitHub Desktop.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Option Explicit
Dim objConn, objRS, strSQL, strConnection ' Conexion-RS-query y string de conexion
Dim i, a, b, ventasdelmes ' contador, dia, mes, ventasdelmes
Dim xmlDoc, text
' -- Create objects
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
' open db
objConn.Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=C:\SINCO\SINCO\fac\bases;Exclusive=No"
' month day if
for a = 1 to 6
if a = 1 then b = 31
if a = 3 then b = 31
if a = 5 then b = 31
if a = 7 then b = 31
if a = 8 then b = 31
if a = 10 then b = 31
if a = 12 then b = 31
if a = 2 then b = 28
if a = 4 then b = 30
if a = 6 then b = 30
if a = 9 then b = 30
if a = 11 then b = 30
' create sql per each iteration or
strSQL="select SUM(total) AS ventasdelmes from facturas where fecha BETWEEN date(2010,"&a&",1) AND date(2010,"&a&","&b&");"
set objRS=objConn.Execute(strSQL)
text="<?xml version='1.0' encoding='ISO-8859-1'?>"
text=text & "<plist><array><dict>"
'while (not objRS.EOF)
text=text & "<key>" & a & "</key>"
text=text & "<string>" & objRS("ventasdelmes") & "</string>"
objRS.MoveNext()
'wend
next ' this closes the for loop & now finish the xml file code
text=text & "</dict></array></plist>"
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.loadXML(text)
xmlDoc.Save("C:\Inetpub\wwwroot\sales\xml\test.xml")
'==========================================================================================================
if (objRS.BOF and objRS.EOF) then
response.write "No records found"
response.end
End if
objRS.Close
set objRS = Nothing
objConn.Close
set objConn = Nothing
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment