%@ Language=VBScript %>
<%
'*************************************************************************
' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK!
' Function : Order Maintenance
' Product : CandyPress Store Administration
' Version : 2.5
' Modified : February 2004
' Copyright: Copyright (C) 2004 CandyPress.Com
' See "license.txt" for this product for details regarding
' licensing, usage, disclaimers, distribution and general
' copyright requirements. If you don't have a copy of this
' file, you may request one at webmaster@candypress.com
'*************************************************************************
Option explicit
Response.Buffer = true
const adminLevel = 1
%>
<%
'Database
dim mySQL, cn, rs, rs2
'cartHead
dim idOrder
dim idCust
dim orderDate
dim orderDateInt
dim randomKey
dim subTotal
dim taxTotal
dim shipmentTotal
dim handlingFeeTotal
dim otherFeeTotal
dim Total
dim shipmentMethod
dim name
dim lastName
dim customerCompany
dim phone
dim email
dim address
dim city
dim locState
dim locCountry
dim zip
dim shippingName
dim shippingLastName
dim shippingPhone
dim shippingAddress
dim shippingCity
dim shippingLocState
dim shippingLocCountry
dim shippingZip
dim paymentType
dim cardType
dim cardNumber
dim cardExpMonth
dim cardExpYear
dim cardVerify
dim cardName
dim generalComments
dim orderStatus
dim auditInfo
dim storeComments
dim storeCommentsPriv
dim adjustAmount
dim adjustReason
dim discCode
dim discPerc
dim discTotal
'cartRows
dim idCartRow
dim idProduct
dim sku
dim quantity
dim unitPrice
dim unitWeight
dim description
dim downloadCount
dim downloadDate
dim discAmt
dim a
dim b
dim c
'CartRowsOptions
dim idCartRowOption
dim idOption
dim optionPrice
dim optionDescrip
'DiscProd
dim idDiscProd
dim discFromQty
dim discToQty
'Work Fields
dim action
'*************************************************************************
'Open Database Connection
call openDB()
'Store Configuration
if loadConfig() = false then
response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Could not load Store Configuration settings.")
end if
'Get action
action = trim(Request.QueryString("action"))
if len(action) = 0 then
action = trim(Request.Form("action"))
end if
action = lCase(action)
if action <> "edit" _
and action <> "del" _
and action <> "view" _
and action <> "inv" then
response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid Action Indicator.")
end if
'If this is an invoice, show different headers
if action = "inv" then
%>
<%
'If this is an invoice, we adjust the next couple of
'rows a little bit to include the store address
if action = "inv" then
%>
<%=replace(pCompanyAddr,chr(10)," ")%> |
| Order Number |
<%=pOrderPrefix & "-" & idOrder%> |
| Order Date |
<%=formatTheDate(orderDate)%> |
| Order Status |
<%=orderStatusDesc(orderStatus)%> |
|
<%
else
%>
| Order Number |
<%=pOrderPrefix & "-" & idOrder%>
[
Edit Customer |
&emailToName=<%=server.URLEncode(name & " " & LastName)%>&emailSubj=<%=server.URLEncode(pCompany & " - Order " & pOrderPrefix & "-" & idOrder)%>">Send Email
]
|
| Order Date |
<%=formatTheDate(orderDate)%> |
| Order Status |
<%=orderStatusDesc(orderStatus)%> |
| Store Comments |
<%=replace(emptyString(storeComments,"None"),Chr(10)," ")%> |
| Private Comments |
<%=replace(emptyString(storeCommentsPriv,"None"),Chr(10)," ")%> |
| Email |
<%=email%> |
| Customer ID |
<%=idCust%> |
| Audit Info |
<%=auditInfo%> |
<%
end if
%>
|
| |
Billing |
Shipping |
| Name |
<%=Name & " " & LastName%> |
<%=emptyString(shippingName,Name) & " " & emptyString(shippingLastName,LastName)%> |
| Address |
<%=address%> |
<%=emptyString(shippingAddress,address)%> |
| City |
<%=city%> |
<%=emptyString(shippingCity,city)%> |
| Location |
<%
if len(locState) > 0 then
Response.Write locState & ", "
end if
Response.Write locCountry
%>
|
<%
if len(shippingLocState) = 0 and len(shippingLocCountry) = 0 then
if len(locState) > 0 then
Response.Write locState & ", "
end if
Response.Write locCountry
else
if len(shippingLocState) > 0 then
Response.Write shippingLocState & ", "
end if
Response.Write shippingLocCountry
end if
%>
|
| Zip/PCode |
<%=zip%> |
<%=emptyString(shippingZip,zip)%> |
| Phone |
<%=phone%> |
<%=emptyString(shippingPhone,phone)%> |
| Company |
<%=customerCompany%> |
|
| Shipping |
<%=shipmentMethod%> |
| Payment |
<%=paymentMsg(paymentType, total, cardNumber)%> |
<%
'Show credit card info if this is a Credit Card payment
'and not an invoice.
if len(cardNumber) > 0 and action <> "inv" then
%>
| Card Type |
<%=cardType%> |
| Card Number |
<%=cardNumber%> |
| Card Expire |
<%=cardExpMonth & "/" & cardExpYear%> (MM/YYYY) |
| Card Verif. # |
<%=cardVerify%> |
| Card Name |
<%=cardName%> |
<%
end if
%>
| Comments |
<%=emptyString(generalComments,"None")%> |
|
<%
'Display all the items and options for this order
call showOrderItems(idOrder)
%>
| Sub Total: |
<%=pCurrencySign & moneyD(subTotal)%> |
<%
'If there's a discount, show discount and sub-total row
if discTotal > 0 then
%>
| <%=discCode%> (<%=formatNumber(discPerc,2)%>%) - Discount Code: |
<%=pCurrencySign & moneyD(discTotal)%> (-) |
| Sub Total: |
<%=pCurrencySign & moneyD(subTotal - discTotal)%> |
<%
end if
%>
| Shipping: |
<%=pCurrencySign & moneyD(shipmentTotal)%> |
<%
'If there's a handling fee, show handling fee row
if handlingFeeTotal > 0 then
%>
| Handling Fee: |
<%=pCurrencySign & moneyD(handlingFeeTotal)%> |
<%
end if
'If there are other fees, show other fee row
if otherFeeTotal > 0 then
%>
| Other Fees: |
<%=pCurrencySign & moneyD(otherFeeTotal)%> |
<%
end if
%>
| Tax: |
<%=pCurrencySign & moneyD(taxTotal)%> |
| *Adjustment: |
<%
if isNumeric(adjustAmount) then
Response.Write pCurrencySign & moneyD(adjustAmount)
else
Response.Write pCurrencySign & moneyD("0")
end if
%>
|
| Total: |
<%=pCurrencySign & moneyD(Total)%> |
|
*Adjustment :
<%
if len(adjustReason) > 0 then
Response.Write adjustReason
else
Response.Write "No Adjustment(s) for this Order "
end if
%>
|
| |
<%
'Only show message if this is not an invoice
if action <> "inv" then
%>
|
NOTE : This Order as it is displayed here closely
resembles the Order as it is displayed to the Customer
when they log on to their Account and view an Order's
detail. However, fields shown in
red are only viewable by the store Administrator.
|
<%
end if
%>
|
<%
end if
if action = "edit" then
%>
Order Status - Changing the Order Status will
automatically result in the following actions :
- Send an email to the Customer notifying them of the change
(if "Email Customer if status changes" box is checked).
- Update the Stock Levels of all Products involved (if
"Adjust Stock Levels if status changes" box is checked).
- Append the Date/Time to the "Store Comments" field.
Store Comments - Any text entered here will be
viewable by the Customer. It's usefull if for some reason there is
a problem with the Order and you want to communicate this to your
Customer.
Private Comments - Text entered here will NOT be
viewable by the Customer. Use this field to store information that
is confidential to your Store.
General Fields - Several other fields are modifiable. These fields
are typically entered by the Customer when placing the Order. Under
certain circumstances it may be necessary to change this information,
mainly due to user error when the Order is placed. The modifications
made to these fields are NOT strictly checked to allow maximum
flexibility.
Order Total Fields - You can change any of the totals for
this order. The only requirement is that you enter a valid numeric
value. To ensure maximum flexiblity, no other checks are performed.
The final Total is automatically recalculated, but the other totals
are not. Therefore you have to make sure that you adjust all related
totals appropriately before clicking the update button.
* Adjustment - This option is useful if you want to
change the order total without changing any of the other totals such
as shipping, taxes, etc. What is also unique about this option, is
that it allows you to enter a text description (or reason) for the
adjustment. Both the adjustment reason and amount is viewable by the
customer. For example, if the customer wants to add another item
to their order, you can enter the item description in the adjustment
"reason" field, and the item value in the adjusment "amount" field.
|
<%
Response.Write Trim(Replace((pOrderPrefix & "-" & idOrder),Left((pOrderPrefix & "-" & idOrder),(len(pOrderPrefix) + 1)),""))
end if
'Close Database Connection
call closedb()
'If this is an invoice, show different footers
if action = "inv" then
%>
<%
else
%>
<%
end if
'*********************************************************************
'Display the Order's Items
'*********************************************************************
sub showOrderItems(idOrder)
'Declare local vars
dim optionGroupsTotal
%>