HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/web/homefly/vsadmin/dumporders.asp
<%
Response.Buffer = True
'=========================================
'This code is copyright (c) Internet Business Solutions SL, all rights reserved.
'The contents of this file are protect under law as the intellectual property
'of Internet Business Solutions SL. Any use, reproduction, disclosure or copying
'of any kind without the express and written permission of Internet Business 
'Solutions SL is forbidden.
'Author: Vince Reid, vince@virtualred.net
if Session("loggedon") <> "virtualstore" then response.redirect "login.asp"
Response.ContentType = "unknown/exe"
if request.form("act")="dumpinventory" then
Response.AddHeader "Content-Disposition","attachment;filename=dumpinventory.csv"
else
Response.AddHeader "Content-Disposition","attachment;filename=dumporders.csv"
end if
%>
<!--#include file="db_conn_open.asp"-->
<!--#include file="includes.asp"-->
<!--#include file="inc/incfunctions.asp"-->
<%
Dim useEuro, sd, ed, rs, cnn, sSQL, sSQL2, stockManage, hasdetails
if Request.Form("sd") = "" then
	sd=Date()
else
	sd=Request.Form("sd")
end if
if Request.Form("ed") = "" then
	ed=Date()
else
	ed=Request.Form("ed")
end if
hasdetails = request.form("details")="true"
Set rs = Server.CreateObject("ADODB.RecordSet")
Set rs2 = Server.CreateObject("ADODB.RecordSet")
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.open sDSN
if request.form("act")="dumpinventory" then
	sSQL2 = "SELECT pID,pName,pPrice,pInStock FROM products"
	rs.Open sSQL2,cnn,0,1
	response.write """ProductID"",""ProductName"",""Price"",""InStock""" & vbCrLf
	do while NOT rs.EOF
		response.write """"&replace(rs("pID"),"""","""""")&""","
		response.write """"&replace(rs("pName"),"""","""""")&""","
		response.write rs("pPrice")&","
		response.write rs("pInStock")&vbCrLf
		rs.MoveNext
	loop
	rs.Close
else
	if hasdetails then
		sSQL2 = "SELECT ordID,ordName,ordAddress,ordCity,ordState,ordZip,ordCountry,ordEmail,ordPhone,ordShipName,ordShipAddress,ordShipCity,ordShipState,ordShipZip,ordShipCountry,ordPayProvider,ordAuthNumber,ordTotal,ordDate,ordStateTax,ordCountryTax,ordShipping,ordShipType,cartProdId,cartProdName,cartProdPrice,cartQuantity,cartID,ordDiscount,ordAddInfo FROM cart INNER JOIN (orders INNER JOIN payprovider ON payprovider.payProvID=orders.ordPayProvider) ON cart.cartOrderId=orders.ordID WHERE ordDate BETWEEN "&datedelim&sd&datedelim&" AND "&datedelim&DateValue(ed)+1&datedelim&" ORDER BY ordDate"
	else
		sSQL2 = "SELECT ordID,ordName,ordAddress,ordCity,ordState,ordZip,ordCountry,ordEmail,ordPhone,ordShipName,ordShipAddress,ordShipCity,ordShipState,ordShipZip,ordShipCountry,ordPayProvider,ordAuthNumber,ordTotal,ordDate,ordStateTax,ordCountryTax,ordShipping,ordShipType,ordDiscount,ordAddInfo FROM orders INNER JOIN payprovider ON payprovider.payProvID=orders.ordPayProvider WHERE ordDate BETWEEN "&datedelim&sd&datedelim&" AND "&datedelim&DateValue(ed)+1&datedelim&" ORDER BY ordDate"
	end if
	sSQL = "SELECT countryLCID, countryCurrency, adminStockManage FROM admin INNER JOIN countries ON admin.adminCountry=countries.countryID WHERE adminID=1"
	rs.Open sSQL,cnn,0,1
	if Int(rs("countryLCID"))<>0 then Session.LCID = Int(rs("countryLCID"))
	useEuro=(rs("countryCurrency")="EUR")
	stockManage=Int(rs("adminStockManage"))
	rs.Close
	rs.Open sSQL2,cnn,0,1
	response.write """OrderID"",""CustomerName"",""Address"",""City"",""State"",""Zip"",""Country"",""Email"",""Phone"",""ShipName"",""ShipAddress"",""ShipCity"",""ShipState"",""ShipZip"",""ShipCountry"",""PaymentMethod"",""AuthNumber"",""Total"",""Date"",""StateTax"",""CountryTax"",""Shipping"",""Discounts"",""AddInfo"",""ShipingMethod"""
	if hasdetails then
		response.write ",""ProductID"",""ProductName"",""ProductPrice"",""Quantity""" & vbCrLf
	else
		response.write vbCrLf
	end if
	do while NOT rs.EOF
			response.write rs("ordID")&","
			response.write """"&replace(rs("ordName"),"""","""""")&""","
			response.write """"&replace(rs("ordAddress"),"""","""""")&""","
			response.write """"&replace(rs("ordCity"),"""","""""")&""","
			response.write """"&replace(rs("ordState"),"""","""""")&""","
			response.write """"&replace(rs("ordZip"),"""","""""")&""","
			response.write """"&replace(rs("ordCountry"),"""","""""")&""","
			response.write """"&replace(rs("ordEmail"),"""","""""")&""","
			response.write """"&replace(rs("ordPhone"),"""","""""")&""","
			response.write """"&replace(rs("ordShipName"),"""","""""")&""","
			response.write """"&replace(rs("ordShipAddress"),"""","""""")&""","
			response.write """"&replace(rs("ordShipCity"),"""","""""")&""","
			response.write """"&replace(rs("ordShipState"),"""","""""")&""","
			response.write """"&replace(rs("ordShipZip"),"""","""""")&""","
			response.write """"&replace(rs("ordShipCountry"),"""","""""")&""","
			response.write """"&replace(rs("ordPayProvider"),"""","""""")&""","
			response.write """"&replace(rs("ordAuthNumber"),"""","""""")&""","
			response.write rs("ordTotal")&","
			response.write rs("ordDate")&","
			response.write rs("ordStateTax")&","
			response.write rs("ordCountryTax")&","
			response.write rs("ordShipping")&","
			response.write rs("ordDiscount")&","
			response.write """"&replace(rs("ordAddInfo"),"""","""""")&""","
			response.write """"&replace(rs("ordShipType"),"""","""""")&""""
			if hasdetails then
				rs2.Open "SELECT SUM(coPriceDiff) AS sumPDiff FROM cartOptions WHERE coCartID=" & rs("cartID"),cnn,0,1
				response.write ","""&replace(rs("cartProdId"),"""","""""")&""""
				response.write ","""&replace(rs("cartProdName"),"""","""""")&""""
				if NOT IsNull(rs2("sumPDiff")) then
					response.write ","&rs("cartProdPrice")+rs2("sumPDiff")
				else
					response.write ","&rs("cartProdPrice")
				end if
				response.write ","&rs("cartQuantity")
				rs2.Close
			end if
			response.write vbCrLf
		rs.MoveNext
	loop
	rs.Close
end if
%>