<% '********************************************************************************** ' Call Function to send order transaction '********************************************************************************** 'this function returns 'F' for failue / MacsOrderID, if success Function OrderTransaction(sOrderID, debugflag, ByRef orderDebugString) 'n error resume next 'remove previously stored order info set Session("ortn") = nothing if debugflag = "true" then orderDebugString = orderDebugString & "MACS_COMPANY :" & MACS_COMPANY & "
" orderDebugString = orderDebugString & "MACS_DIVISION :" & MACS_DIVISION & "
" orderDebugString = orderDebugString & "HOST_NAME :" & HOST_NAME & "
" orderDebugString = orderDebugString & "WEBREQST :" & WEBREQST & "
" orderDebugString = orderDebugString & "WEBORDER :" & WEBORDER & "
" end if '============================================================================= '============================================================================= Dim ReturnOrderTransactionResponse(25) Dim ErrorMessages Dim webResponse Dim IS_CAT_REQ_REQUESTED Dim MACS_MSG Dim MACS_UID Dim MACS_CUST_EDP Dim ENCRYPT_EDP Dim MAIN_ORDER_ID Dim Source_Code 'sourcecode Dim OrderTotal Dim Send_zero_Priced_Item Dim bSend_PricedItem Dim Bill_Email Dim Bill_Pwd Dim Bill_Firstname Dim Bill_MiddleInitial Dim Bill_Lastname Dim Bill_CompanyName Dim Bill_Address1 Dim Bill_Address2 Dim Bill_City Dim Bill_State Dim Bill_Zip Dim Bill_CountryCode Dim Bill_DayPhone Dim Bill_NightPhone Dim Bill_OrderMessage1 Dim Bill_OrderMessage2 Dim Ship_OrderMessage1 Dim Ship_OrderMessage2 Dim SShipmethod Dim CouponCode Dim GCTotalAvialableAmount Dim CCType Dim CCNumber Dim CCYY Dim CCMM Dim ISGiftCard Dim GiftProdNum Dim GiftAssocType Dim NoPromo Dim NoRent Dim ShipTo_Count 'other than billing Dim ShipTo_MacsID() ' to hold all shipto numbers (other than billing if any) Dim ortn Dim ortn_order Dim ortn_order_review Dim macsmsg Dim additionalmacsmsg Dim gwtotperzlines Dim gwtotline Dim iLineCount Dim nextjcount Dim sCustomizeText Dim sCustomizeText2 Dim WEB_RESPONSE Dim CUSTOMERID Dim ItmCustCd Dim SGwrapFlag Dim Susergiftwrap Dim sDefaultShipMethodForR15 macsmsg="" additionalmacsmsg="" WEB_RESPONSE="" MACS_MSG="" MACS_CUST_EDP="" ENCRYPT_EDP="" IS_CAT_REQ_REQUESTED="N" MAIN_ORDER_ID = "1000000000000000000000000000" '************************************************************* 'Get Order Info from DB '************************************************************* 'iBillIndex and iShipIndex are defined in maininclude.asp Dim Order_Customer_info() Dim Order_Customer_Shipinfo_for_bill() Dim Order_BasketItems Dim basketItems Dim ip Dim ShipToItems Dim bOrderWithShiptoBilltoSame Dim iShiptoStart Dim shiptovarItem Redim Order_Customer_info(billshiparraysize) Redim Order_Customer_Shipinfo_for_bill(billshiparraysize) getOrderHeaderInfo Order_Customer_info, iBillIndex getOrderAddressInfo Order_Customer_info, iBillIndex, 0, false getOrderAddressInfo Order_Customer_Shipinfo_for_bill, iShipIndex, 1, true lssql = "exec p_WP_ORDER_GET_ITEMS_PER_SHIPTO " & sOrderID & ",1," & Application("GIFTBOX_PRODUCT_ID") basketItems = getRecordSetList(lssql) '=============================================================================== ' Order Data '=============================================================================== MAIN_ORDER_ID = sOrderID CUSTOMERID = "" MACS_CUST_EDP = Order_Customer_info(4) Source_Code = Order_Customer_info(25) if Source_Code = "" then Source_Code = Order_Customer_info(24) 'catalog code end if CouponCode = "" Send_zero_Priced_Item = "true" GiftProdNum= "GIFTWRAP" GiftAssocType= "G" 'order info OrderTotal ="" 'Billing Info Bill_Email =Order_Customer_info(iBillIndex) Bill_Pwd =Order_Customer_info(iBillIndex+1) Bill_Firstname =Order_Customer_info(iBillIndex+2) Bill_MiddleInitial =Order_Customer_info(iBillIndex+3) Bill_Lastname =Order_Customer_info(iBillIndex+4) Bill_CompanyName =Order_Customer_info(iBillIndex+5) Bill_Address1 =Order_Customer_info(iBillIndex+6) Bill_Address2 =Order_Customer_info(iBillIndex+7) Bill_City =Order_Customer_info(iBillIndex+8) Bill_State =getStateCode(Order_Customer_info(iBillIndex+9)) Bill_Zip =Order_Customer_info(iBillIndex+10) Bill_CountryCode =getCountryCode(Order_Customer_info(iBillIndex+11)) Bill_DayPhone =Order_Customer_info(iBillIndex+12) Bill_NightPhone =Order_Customer_info(iBillIndex+13) CCType=Order_Customer_info(19) CCNumber=Order_Customer_info(20) CCMM=trim(Order_Customer_info(21)) if len(CCMM)<2 then CCMM = "0" & CCMM end if CCYY=Order_Customer_info(22) NoPromo="I" 'I NoRent="R" ISGiftCard="false" if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
" orderDebugString = orderDebugString & "Bill_Email: " & Bill_Email & "
" orderDebugString = orderDebugString & "Bill_Pwd: " & Bill_Pwd & "
" orderDebugString = orderDebugString & "Bill_Firstname: " & Bill_Firstname & "
" orderDebugString = orderDebugString & "Bill_MiddleInitial: " & Bill_MiddleInitial & "
" orderDebugString = orderDebugString & "Bill_Lastname: " & Bill_Lastname & "
" orderDebugString = orderDebugString & "Bill_CompanyName: " & Bill_CompanyName & "
" orderDebugString = orderDebugString & "Bill_Address1: " & Bill_Address1 & "
" orderDebugString = orderDebugString & "Bill_Address2: " & Bill_Address2 & "
" orderDebugString = orderDebugString & "Bill_State: " & Bill_State & "
" orderDebugString = orderDebugString & "Bill_Zip: " & Bill_Zip & "
" orderDebugString = orderDebugString & "Bill_CountryCode: " & Bill_CountryCode & "
" orderDebugString = orderDebugString & "Bill_DayPhone: " & Bill_DayPhone & "
" orderDebugString = orderDebugString & "Bill_NightPhone: " & Bill_NightPhone & "
" orderDebugString = orderDebugString & "NoPromo: " & NoPromo & "
" orderDebugString = orderDebugString & "NoRent: " & NoRent & "
" end if 'shiptos ShipTo_Count = "" 'If Order_Customer_info(29) = "2" then 'when 2 then shipto is 1 ' ShipTo_Count = "1" 'end if '=============================================================================== ' determine whether order has shipping to bill info '=============================================================================== bOrderWithShiptoBilltoSame = false Dim tmpShipTo_Count Dim sBillShipSlNo tmpShipTo_Count = 0 lssql = "exec p_WP_ORDER_GET_SHIPTO_COUNT " & sOrderID ShipToItems = getRecordSetList(lssql) For iShiptoStart=1 to UBound(ShipToItems) shiptovarItem = ShipToItems(iShiptoStart) sBillShipSlNo = shiptovarItem(1) if sBillShipSlNo = "1" or sBillShipSlNo = "0" then ' order has ship to bill 'determine whether bill adrres and ship address are same if Bill_Firstname = trim(shiptovarItem(2)) and Bill_Lastname = trim(shiptovarItem(3)) and Bill_Address1 = trim(shiptovarItem(4)) and Bill_Zip = trim(shiptovarItem(5)) then bOrderWithShiptoBilltoSame = true else tmpShipTo_Count = tmpShipTo_Count + 1 end if sDefaultShipMethodForR15 = trim(shiptovarItem(6)) else tmpShipTo_Count = tmpShipTo_Count + 1 end if Next ShipTo_Count = cstr(tmpShipTo_Count) if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
" orderDebugString = orderDebugString & "MAIN_ORDER_ID:" & MAIN_ORDER_ID & "
" orderDebugString = orderDebugString & "CUSTOMERID:" & CUSTOMERID & "
" orderDebugString = orderDebugString & "ShipTo_Count: " & ShipTo_Count & "
" orderDebugString = orderDebugString & "bOrderWithShiptoBilltoSame: " & trim(bOrderWithShiptoBilltoSame) & "
" orderDebugString = orderDebugString & "sDefaultShipMethodForR15: " & trim(sDefaultShipMethodForR15) & "
" orderDebugString = orderDebugString & "---------------------------------------------------
" end if '=============================================================================== ' End Order Data '=============================================================================== '************************************************************************************** 'STEP 1 '************************************************************************************** '////////////////////////////////////////////////////////////////////////////////// 'Transac 9 -- get userid/EDP Numbers thro trans0009 '////////////////////////////////////////////////////////////////////////////////// Dim trans0009 Set trans0009 = server.CreateObject(webcom & "Trans0009") trans0009.Company = MACS_COMPANY trans0009.Division = MACS_DIVISION trans0009.Host=HOST_NAME trans0009.Port=WEBREQST trans0009.FName = Bill_Firstname trans0009.Lname=Bill_Lastname trans0009.ZipCode = Bill_Zip trans0009.Email = Bill_Email trans0009.Password= Bill_Pwd if MACS_CUST_EDP <> "" then trans0009.CustEDP = MACS_CUST_EDP trans0009.LogOn = "Y" end if if MACS_UID <> "" then trans0009.CartID = MACS_UID end if trans0009.CartUpdate = "Y" MACS_UID = trim(trans0009.GetValue("UserID",0)) MACS_CUST_EDP = trim(trans0009.GetValue("CustEdp",0)) ENCRYPT_EDP = trim(trans0009.GetValue("EncryptCustEdp",0)) if Left(MACS_UID,1) >= "0" AND Left(MACS_UID,1) <= "9" then 'response is there else MACS_UID = "" end if if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
" orderDebugString = orderDebugString & "SuccessFlag " & trans0009.GetValue("SuccessFlag",0) orderDebugString = orderDebugString & "
" orderDebugString = orderDebugString & "Return Cust Flag:" & trans0009.GetValue("RetCustFlag",0) orderDebugString = orderDebugString & "
" orderDebugString = orderDebugString & "MACS UserID :" & MACS_UID orderDebugString = orderDebugString & "
" orderDebugString = orderDebugString & "Encrypted Cust EDP :" & ENCRYPT_EDP orderDebugString = orderDebugString & "
" orderDebugString = orderDebugString & "---------------------------------------------------
" end if set trans0009 = nothing IF MACS_UID = "" then 'MACS LISTENER not up ErrorMessages = MACS_CONNECTION_ERROR_STRING ReturnOrderTransactionResponse(1) = MACS_ERROR_MESSAGES(1) ReturnOrderTransactionResponse(2) = ErrorMessages ReturnOrderTransactionResponse(3) = MACS_UID OrderTransaction =ReturnOrderTransactionResponse 'return False ELSE '************************************************************************************** 'STEP 2 '************************************************************************************** '////////////////////////////////////////////////////////////////////////////////// 'Transac 11 -- Source Code update '////////////////////////////////////////////////////////////////////////////////// if Source_Code <> "" then Dim trans0011 set trans0011 = Server.CreateObject(webcom & "Trans0011") trans0011.Host=HOST_NAME trans0011.Port = WEBREQST trans0011.Company = MACS_COMPANY trans0011.Division = MACS_DIVISION trans0011.CartID = MACS_UID trans0011.SourceCode= Source_Code trans0011.ActionFlag="U" webResponse = trim(trans0011.GetValue("SuccessFlag",0)) if webResponse = " " then webResponse = "Y" if webResponse = "" then webResponse = "Y" if debugflag = "true" then orderDebugString = orderDebugString & "Begin Transac 11 -- Source Code " & Source_Code & webResponse & "
" orderDebugString = orderDebugString & "Is Valid Sourcecode " & trans0011.GetValue("ValidSrc",0) orderDebugString = orderDebugString & "
End Trans 11
" orderDebugString = orderDebugString & "---------------------------------------------------
" end if if webResponse <> "Y" then if webResponse <> "N" then set trans0011 = nothing 'return false //MACS LISTENER Not available ErrorMessages = MACS_CONNECTION_ERROR_STRING ReturnOrderTransactionResponse(1) = MACS_ERROR_MESSAGES(1) ReturnOrderTransactionResponse(2) = ErrorMessages ReturnOrderTransactionResponse(3) = MACS_UID OrderTransaction =ReturnOrderTransactionResponse 'return False end if end if set trans0011 = nothing end if 'validate coupon code if any.... if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
" orderDebugString = orderDebugString & "CouponCode: " & CouponCode & "
" end if if CouponCode <> "" then Dim trans0077 Dim iCouponNo iCouponNo = cint("1") set trans0077 = Server.CreateObject(webcom & "trans0077") trans0077.Host=HOST_NAME trans0077.Port = WEBREQST trans0077.Company = MACS_COMPANY trans0077.Division = MACS_DIVISION trans0077.CartID = MACS_UID trans0077.SetCouponNo CouponCode, iCouponNo if(trans0077.GetValue("SuccessFlag",0)="Y") then if ucase( trim( trans0077.GetValue("GoodNumber",iCouponNo))) = ucase(CouponCode) then 'good coupon if debugflag = "true" then orderDebugString = orderDebugString & " Valid CouponCode
" end if else CouponCode="" additionalmacsmsg = additionalmacsmsg & "
  • Invalid Coupon Code " & CouponCode if debugflag = "true" then orderDebugString = orderDebugString & additionalmacsmsg & "
    " end if end if end if if(trans0077.GetValue("SuccessFlag",0)="N") then additionalmacsmsg = additionalmacsmsg & "
  • Invalid Coupon Code " & CouponCode CouponCode="" if debugflag = "true" then orderDebugString = orderDebugString & additionalmacsmsg & "
    " end if end if set trans0077=nothing end if if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " end if '************************************************************************************** 'STEP 3 '************************************************************************************** '////////////////////////////////////////////////////////////////////////////////// 'for any ship to's (other than billing) send a transaction Trans0035 and get the '//'shiptonum and update orderplacedflag=0 means user order has not been placed '////////////////////////////////////////////////////////////////////////////////// Dim shipnums Dim iShipCount Dim S1_Num Dim i shipnums="" if ShipTo_Count = "0" then ShipTo_Count = "" if ShipTo_Count <> "" then iShipCount = cint(ShipTo_Count) ReDim ShipTo_MacsID(iShipCount) For iShiptoStart=1 to UBound(ShipToItems) shiptovarItem = ShipToItems(iShiptoStart) sBillShipSlNo = shiptovarItem(1) if (sBillShipSlNo = "1" or sBillShipSlNo = "0") and bOrderWithShiptoBilltoSame then 'bill and ship are same so donot process else Dim trans0035 set trans0035=Server.CreateObject(webcom & "Trans0035") trans0035.Company=MACS_COMPANY trans0035.Division=MACS_DIVISION trans0035.Host=HOST_NAME trans0035.Port=WEBREQST trans0035.CartID=MACS_UID trans0035.ShipToFName = trim(shiptovarItem(2)) 'Order_Customer_Shipinfo(iShipIndex+2) trans0035.ShipToLName = trim(shiptovarItem(3))'Order_Customer_Shipinfo(iShipIndex+4) trans0035.ShipToEDP = "" trans0035.ShipToNo = "" S1_Num = Trim(trans0035.GetValue("ShipToNum",0)) if S1_Num <> "" then ShipTo_MacsID(i) = S1_Num shipnums = shipnums & "For ShipuserID " & i & "-" & trans0035.ShipToFName & " ShipToNum = " & S1_Num & "
    " end if set trans0035 = nothing end if Next end if if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "ShipTo_Count --" & ShipTo_Count & "
    " 'orderDebugString = orderDebugString & "For " & Order_Customer_Shipinfo(iShipIndex+2) & " " & Order_Customer_Shipinfo(iShipIndex+4) & "
    " if ShipTo_Count <> "" then orderDebugString = orderDebugString & "Begin Transac 35 -- Get ShipNums
    " orderDebugString = orderDebugString & (shipnums) orderDebugString = orderDebugString & "End Trans 35
    " end if orderDebugString = orderDebugString & "---------------------------------------------------
    " end if '************************************************************************************** 'STEP 4 '************************************************************************************** '////////////////////////////////////////////////////////////////////////////////// 'Build WebOrder - Record Types ' '////////////////////////////////////////////////////////////////////////////////// '4.1****************** 'Build WebOrder Objects '********************** set ortn_order_review =Server.CreateObject(webcom & "weborder") set ortn_order =Server.CreateObject(webcom & "weborder") ortn_order.Company=MACS_COMPANY ortn_order_review.Company=MACS_COMPANY ortn_order.Division=MACS_DIVISION ortn_order_review.Division=MACS_DIVISION ortn_order.Host=HOST_NAME ortn_order_review.Host=HOST_NAME ortn_order.Port=WEBORDER ortn_order_review.Port=WEBORDER ortn_order.userid = MACS_UID ortn_order_review.userid = MACS_UID '4.2 ******************* 'Get User Info and build Record Type 10 and RecordType20 and RecordType13 '*********************** Dim oR10 Dim oR20 Dim oR21 Dim oR13 Dim oR13_review set oR10=Server.CreateObject(webcom & "RecordType10") set oR13=Server.CreateObject(webcom & "RecordType13") set oR13_review=Server.CreateObject(webcom & "RecordType13") if Bill_Firstname<>"" then oR10.Source= Source_Code oR10.FirstName=Bill_Firstname oR10.MiddleInit=Bill_MiddleInitial oR10.LastName=Bill_Lastname oR10.CompanyName=Bill_CompanyName oR10.Street=Bill_Address1 oR10.Ref1=Bill_Address2 oR10.City=Bill_City oR10.State=Bill_State oR10.CountryCode=Bill_CountryCode oR10.ZipCode=Bill_Zip oR10.DayPhone=Bill_DayPhone oR10.NightPhone=Bill_NightPhone if CCType <> "" then oR10.PayMethod = CCType else oR10.PayMethod = "OA" end if 'oR10.NoPromo = NoPromo 'oR10.NoRent = NoRent if MACS_CUST_EDP <> "" then oR10.CustEDP = MACS_CUST_EDP end if oR13.Email = Bill_Email oR13.NetPassword = Bill_Pwd 'oR13.RecapFlag = "R" 'if recap oR13.Userid = MACS_UID oR13_review.Email = Bill_Email oR13_review.NetPassword = Bill_Pwd oR13_review.RecapFlag = "R" 'if recap oR13_review.Userid = MACS_UID end if 'Assign ortn_order.RecordType10=oR10.SetRecord ortn_order.RecordType13=oR13.SetRecord ortn_order_review.RecordType10=oR10.SetRecord ortn_order_review.RecordType13=oR13_review.SetRecord 'only 13 changes for review if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "Begin Record Type 10, 13 for " & oR10.FirstName & "," & oR10.LastName & "
    " orderDebugString = orderDebugString & "End Record Type 10, 13
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if set oR10=nothing set oR13=nothing set oR13_review=nothing '4.3******************* 'need to pass this with or without billing shipmethod '*********************** Dim shpmd0 Dim oR15 if sDefaultShipMethodForR15 = "" then sDefaultShipMethodForR15="0" shpmd0=getShippingMethodCode ( sDefaultShipMethodForR15 ) set oR15=Server.CreateObject(webcom & "RecordType15") oR15.ShipMethod=shpmd0 ortn_order.RecordType15=oR15.SetRecord ortn_order_review.RecordType15=oR15.SetRecord set oR15=nothing if debugflag = "true" then orderDebugString = orderDebugString & "Begin Record Type 15 with ShipMethod " & shpmd0 & "
    " orderDebugString = orderDebugString & "End Record Type 15
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if '4.3.2************************************* 'Coupon code '************************************* if CouponCode <> "" then set oR17=server.CreateObject(webcom & "RecordType17") oR17.CouponNo_1 = CouponCode ortn_order.RecordType17=oR17.SetRecord ortn_order_review.RecordType17=oR17.SetRecord set oR17 = nothing end if if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "Coupon Code " & CouponCode & "
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if '4.4************************************* 'Gift certificates '***************************************** Dim iGCount Dim iGCount2 Dim GCNumbers() Dim GCAmounts() Dim GiftCertificateNo Dim GiftCertificateAmt Dim chkGift Dim oR17 Dim iHowManyGC Dim EGCount iHowManyGC = 5 iGCount = 0 iGCount2 = 1 EGCount = 0 redim GCNumbers(iHowManyGC) redim GCAmounts(iHowManyGC) Dim ij Dim iGCIndex Dim certificateAmt iGCIndex=30 iGCount2=0 GCTotalAvialableAmount=0 For ij=1 to iHowManyGC 'gC start index in Order_Customer_info is 30 GiftCertificateNo = Order_Customer_info(iGCIndex) certificateAmt = "00" iGCIndex = iGCIndex +1 'validate chkGift=call_trans00063(GiftCertificateNo,MACS_UID, certificateAmt) if chkGift = "S" then EGCount = EGCount + 1 GCNumbers(EGCount) = GiftCertificateNo GCAmounts(EGCount) = certificateAmt GCTotalAvialableAmount = GCTotalAvialableAmount + cdbl(certificateAmt) if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "GiftCertificateNo: " & GiftCertificateNo & " is valid
    " orderDebugString = orderDebugString & "GiftCertificate Amt: " & certificateAmt & "
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if 'GCAmounts(EGCount) = GiftCertificateAmt end if next if EGCount > 0 then Dim oR18 set oR18=Server.CreateObject(webcom & "RecordType18") oR18.GCNo1 = GCNumbers(1) oR18.GCAmt1 = GCAmounts(1) oR18.GCNo2 = GCNumbers(2) oR18.GCAmt2 = GCAmounts(2) oR18.GCNo3 = GCNumbers(3) oR18.GCAmt3 = GCAmounts(3) oR18.GCNo4 = GCNumbers(4) oR18.GCAmt4 = GCAmounts(4) oR18.GCNo5 = GCNumbers(5) oR18.GCAmt5 = GCAmounts(5) 'oR18.GCNo6 = GCNumbers(6) 'oR18.GCAmt6 = GCAmounts(6) 'oR18.GCNo7 = GCNumbers(7) 'oR18.GCAmt7 = GCAmounts(7) 'oR18.GCNo8 = GCNumbers(8) 'oR18.GCAmt8 = GCAmounts(8) 'oR18.GCNo9 = GCNumbers(9) 'oR18.GCAmt9 = GCAmounts(9) 'oR18.GCNo10 = GCNumbers(10) 'oR18.GCAmt10 = GCAmounts(10) 'add ortn_order.RecordType18=oR18.SetRecord ortn_order_review.RecordType18=oR18.SetRecord set oR18=nothing if debugflag = "true" then Dim jk orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "Begin Record Type 18 with giftCertificates " & "
    " For jk=1 to iGCount orderDebugString = orderDebugString & "giftCertificate " & GCNumbers(jk) & " Amount: " & GiftCertificateAmt & "
    " next orderDebugString = orderDebugString & "End Record Type 18
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if end if '4.5******************* 'Assign record type 20 or 22 Gift Card '*********************** 'if ISGiftCard = "true" then ' set oR22=server.CreateObject(webcom & "RecordType22") ' oR22.GiftCardNO = CCType ' oR22.GiftCardSecCode = CCNumber ' oR22.GiftCardAmt = OrderTotal ' oR22.GiftCardExpYY = CCYY ' oR22.GiftCardExpMM = CCMM ' ortn_order.RecordType22=oR22.SetRecord ' set oR22 = nothing 'else if CCType <> "" then set oR20=server.CreateObject(webcom & "RecordType20") oR20.CcType = CCType oR20.CcCardNo = CCNumber oR20.CcExpYY = right(CCYY,2) oR20.CcExpMM = CCMM oR20.CcAuthFlag = " " ortn_order.RecordType20=oR20.SetRecord ortn_order_review.RecordType20=oR20.SetRecord set oR20 = nothing if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "Begin Record Type 20 with CCType " & CCType & "
    " orderDebugString = orderDebugString & "CcExpMM/CcExpYY " & CCMM & "/" & right(CCYY,2) & "
    " orderDebugString = orderDebugString & "End Record Type 15
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if end if 'end if '4.6******************* 'Build the order level comments '*********************** if bOrderWithShiptoBilltoSame=true then Bill_OrderMessage1 = Order_Customer_Shipinfo_for_bill(27) Bill_OrderMessage2 = Order_Customer_Shipinfo_for_bill(28) if Bill_OrderMessage1 <> "" or Bill_OrderMessage2 <> "" then set oR21=server.CreateObject(webcom & "RecordType21") if len(Bill_OrderMessage1)>60 then oR21.OcComment1 = Mid(Bill_OrderMessage1,1,60) else oR21.OcComment1 = Bill_OrderMessage1 end if if Bill_OrderMessage2 <> "" then if len(Bill_OrderMessage2)>60 then oR21.OcComment2 = Mid(Bill_OrderMessage2,1,60) else oR21.OcComment2 = Bill_OrderMessage2 end if oR21.OcLabel2 = "X" oR21.OcPkslp2 = "X" oR21.OcInvoice2 = "X" end if if Bill_OrderMessage1 <> "" then oR21.OcPkslp1 = "X" oR21.OcLabel1 = "X" oR21.OcInvoice1 = "X" end if ortn_order.RecordType21=oR21.SetRecord ortn_order_review.RecordType21=oR21.SetRecord set oR21 = nothing end if if debugflag = "true" then orderDebugString = orderDebugString & "
    ---------------------------------------------------
    " orderDebugString = orderDebugString & "Billing GiftMessage1:" & Bill_OrderMessage1 & "...GiftMessage2:" & Bill_OrderMessage2 & "
    " orderDebugString = orderDebugString & "------------------------------------------
    " end if end if '4.6******************* 'Build the 40/41 records that are not ship tos(to the same user) '*********************** if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "Build the 40/41 records
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if 'check if shpmd0 is "". If it is then there are no self shipto for this order Dim lineitemno Dim iTotalProductCount Dim ProdNum Dim IQty Dim gift_wrap Dim gift_comments Dim sucflag Dim billProdCount Dim Price Dim PriceOverRide Dim GwrapFlag lineitemno=0 iTotalProductCount=0 if bOrderWithShiptoBilltoSame=true then 'if billing billProdCount = Trim(UBound(basketItems)) end if if billProdCount ="" then billProdCount="0" iTotalProductCount = cint(billProdCount) if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "ShipTo_Count:" & ShipTo_Count & " iTotalProductCount: " & iTotalProductCount & "
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if if iTotalProductCount > 0 then For ip=1 to iTotalProductCount Order_BasketItems = basketItems(ip) 'Build RecordType 40 for buyer ProdNum = Trim(Order_BasketItems(7)) IQty= Trim(Order_BasketItems(4)) Price = Trim(Order_BasketItems(6)) PriceOverRide = "" if cdbl( Order_BasketItems(6) ) < cdbl( Order_BasketItems(5) ) then PriceOverRide = "Y" end if bSend_PricedItem="true" if cdbl(Price)<=0 then if Send_zero_Priced_Item="false" then bSend_PricedItem ="false" end if end if if bSend_PricedItem="true" then gift_comments="" 'getValueFormQueryString("Bill_ItemMessage" & ip) gift_wrap="" 'Trim(getValueFormQueryString("Bill_ItemGiftWrap" & ip)) If Len(IQty) = 1 Then IQty = "000" & IQty ElseIf Len(IQty) = 2 Then IQty = "00" & IQty ElseIf Len(IQty) = 3 Then IQty = "0" & IQty Else IQty = Left(IQty, 4) End If '6.001******************* '///use the transaction01/02 to get whether the prod is available or not '*********************** Dim trans01 set trans01 = server.CreateObject(webcom & "Trans0001") trans01.Company = MACS_COMPANY trans01.Division = MACS_DIVISION trans01.CartID = MACS_UID trans01.Host=HOST_NAME trans01.Port=WEBREQST trans01.ItemNo= ProdNum trans01.Quantity= IQty sucflag = "" sucflag = Trim(trans01.GetValue("SuccessFlag",0)) if ucase(sucflag) = "N" then macsmsg = macsmsg & "
  • ERROR: " & ProdNum & " item is not available at this time
    " else lineitemno = lineitemno + 1 GwrapFlag = Trim(trans01.GetValue("GwrapFlag",0)) 'ItmCustCd = Trim(trans01.GetValue("ItmCustCd",0)) if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "GiftWrap Flag
    " orderDebugString = orderDebugString & ProdNum & ":-" & GwrapFlag & "
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "setting up ProdNum:" & ProdNum & "
    " orderDebugString = orderDebugString & "setting up ItemQty:" & IQty & "
    " orderDebugString = orderDebugString & "setting up shpmd0:" & shpmd0 & "
    " orderDebugString = orderDebugString & "------------------------------------------
    " end if set oR40=Server.CreateObject(webcom & "RecordType40") oR40.ItemQty=IQty oR40.ItemNo=ProdNum if PriceOverRide = "Y" then 'override price Price = formatPrice(Price, 9) oR40.Price=Price oR40.PriceOveride = "Y" end if oR40.ShipMethod = shpmd0 'Assign ortn_order.RecordType40=oR40.SetRecord ortn_order_review.RecordType40=oR40.SetRecord set oR40=nothing 'BUILD Personalization Data ItmCustCd = CheckPersonalization(ProdNum, MACS_UID) if ItmCustCd = "true" then if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "CheckPersonalization: " & ItmCustCd & " for ProdNum:" & ProdNum & "
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if 'get total personalization gwtotperzlines = "" 'getValueFormQueryString( "0~" & cstr(ip) & "~TotalPerzLines") if gwtotperzlines ="" then gwtotline=0 else gwtotline=cint(gwtotperzlines) end if if debugflag = "true" then orderDebugString = orderDebugString & "Total Lines perz passed[gwtotperzlines]: " & gwtotperzlines & "
    " end if iLineCount=1 for jcount = 1 to gwtotline step 2 nextjcount = jcount + 1 set oR41=Server.CreateObject(webcom & "RecordType41") sCustomizeTextAll = "" 'trim(getValueFormQueryString( "0~" & cstr(ip) & "~PerzLine~" & cstr(jcount))) sCustomizeText1 ="" sCustomizeText2 ="" if len(sCustomizeTextAll)>60 then sCustomizeText1 = mid(sCustomizeTextAll, 1, 60) 'sCustomizeText2 = mid(sCustomizeTextAll, 61) 'if len(sCustomizeText2)>60 then sCustomizeText2 = mid(sCustomizeText2, 1, 60) else sCustomizeText1 = sCustomizeTextAll end if sCustomizeTextAll = "" 'trim(getValueFormQueryString( "0~" & cstr(ip) & "~PerzLine~" & cstr(nextjcount))) if len(sCustomizeTextAll)>60 then sCustomizeText2 = mid(sCustomizeTextAll, 1, 60) 'sCustomizeText2 = mid(sCustomizeTextAll, 61) 'if len(sCustomizeText2)>60 then sCustomizeText2 = mid(sCustomizeText2, 1, 60) else sCustomizeText2 = sCustomizeTextAll end if if debugflag = "true" then orderDebugString = orderDebugString & "sCustomizeText1: " & sCustomizeText1 & "
    " orderDebugString = orderDebugString & "jcount: " & cstr(jcount) & "
    " orderDebugString = orderDebugString & " ***********************************
    " end if oR41.Customize1 = sCustomizeText1 if nextjcount <= gwtotline then oR41.Customize2 = sCustomizeText2 if debugflag = "true" then 'send only if there orderDebugString = orderDebugString & "nextjcount: " & cstr(nextjcount) & "
    " orderDebugString = orderDebugString & "sCustomizeText2: " & sCustomizeText2 & "
    " end if end if 'oR41.EdpNo = cstr(jcount) 'oR41.ItemNo = ProdNum ortn_order.RecordType41=oR41.SetRecord ortn_order_review.RecordType41=oR41.SetRecord set oR41=nothing iLineCount=iLineCount+1 next end if 'BUILD GIFT WRAP if GwrapFlag = "A" and (gift_wrap="true" or gift_comments<>"") then if debugflag = "true" then orderDebugString = orderDebugString & "-----------------
    " orderDebugString = orderDebugString & "In GwrapFlag for billto-
    " end if strlineno = Trim(cstr(lineitemno)) if len(strlineno) = 1 then strlineno = "00" & Trim(lineitemno) elseif len(strlineno) = 2 then strlineno = "0" & Trim(lineitemno) else strlineno = Trim(lineitemno) end if set oRG40=Server.CreateObject(webcom & "RecordType40") oRG40.ItemQty=IQty '"0001" oRG40.ItemNo=GiftProdNum oRG40.AssocNo=strlineno 'oRG40.Assoctype=GiftAssocType ortn_order.RecordType40=oRG40.SetRecord ortn_order_review.RecordType40=oRG40.SetRecord set oRG40=nothing if gift_comments <> "" then set oRG41=Server.CreateObject(webcom & "RecordType41") oRG41.Customize1=gift_comments ortn_order.RecordType41=oRG41.SetRecord ortn_order_review.RecordType41=oRG41.SetRecord set oRG41=nothing end if end if set trans01 = nothing End if End if 'Send_zero_Priced_Item Next End if '4.6******************* 'After building the recordtype40 for base user , build recordtype40 for rest of the shipto's '*********************** SShipmethod="" if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "Begin Process ShipTo_Count:" & ShipTo_Count & "
    " orderDebugString = orderDebugString & "------------------------------------------
    " end if Dim Order_Customer_Shipinfo() if ShipTo_Count <> "" then iShipCount = cint(ShipTo_Count) 'For i=1 to iShipCount For iShiptoStart=1 to UBound(ShipToItems) shiptovarItem = ShipToItems(iShiptoStart) sBillShipSlNo = shiptovarItem(1) if (sBillShipSlNo = "1" or sBillShipSlNo = "0") and bOrderWithShiptoBilltoSame then 'bill and ship are same so donot process else Redim Order_Customer_Shipinfo(billshiparraysize) getOrderAddressInfo Order_Customer_Shipinfo, iShipIndex, shiptovarItem(1), true lssql = "exec p_WP_ORDER_GET_ITEMS_PER_SHIPTO " & sOrderID & "," & sBillShipSlNo & "," & Application("GIFTBOX_PRODUCT_ID") basketItems = getRecordSetList(lssql) SShipmethod = getShippingMethodCode ( trim(shiptovarItem(6)) ) Dim oR30 Dim oR33 set oR30=Server.CreateObject(webcom & "RecordType30") oR30.FirstName= Order_Customer_Shipinfo(iShipIndex+2) oR30.MiddleInit=Order_Customer_Shipinfo(iShipIndex+3) oR30.LastName=Order_Customer_Shipinfo(iShipIndex+4) oR30.CompanyName=Order_Customer_Shipinfo(iShipIndex+5) oR30.Street=Order_Customer_Shipinfo(iShipIndex+6) oR30.Ref1=Order_Customer_Shipinfo(iShipIndex+7) oR30.City=Order_Customer_Shipinfo(iShipIndex+8) oR30.State=getStateCode(Order_Customer_Shipinfo(iShipIndex+9)) oR30.ZipCode=Order_Customer_Shipinfo(iShipIndex+10) oR30.CountryCode=getCountryCode(Order_Customer_Shipinfo(iShipIndex+11)) oR30.PhoneNo=Order_Customer_Shipinfo(iShipIndex+12) oR30.ShipMethod = SShipmethod 'oR30.FutureDate=trans45.GetValue("ShipFutureDate",0) oR30.ShipToNum=ShipTo_MacsID(i) ortn_order.RecordType30=oR30.SetRecord ortn_order_review.RecordType30=oR30.SetRecord '4.6******************* 'Build the order level comments '*********************** Ship_OrderMessage1 = Order_Customer_Shipinfo(27) Ship_OrderMessage2 = Order_Customer_Shipinfo(28) if Ship_OrderMessage1 <> "" or Ship_OrderMessage2 <> "" then Dim oR31 set oR31=server.CreateObject(webcom & "RecordType21") if len(Ship_OrderMessage1)>60 then oR31.OcComment1 = Mid(Ship_OrderMessage1,1,60) else oR31.OcComment1 = Ship_OrderMessage1 end if if Ship_OrderMessage2 <> "" then if len(Ship_OrderMessage2)>60 then oR31.OcComment2 = Mid(Ship_OrderMessage2,1,60) else oR31.OcComment2 = Ship_OrderMessage2 end if oR31.OcLabel2 = "X" oR31.OcPkslp2 = "X" oR31.OcInvoice2 = "X" end if if Bill_OrderMessage1 <> "" then oR31.OcPkslp1 = "X" oR31.OcLabel1 = "X" oR31.OcInvoice1 = "X" end if ortn_order.RecordType31=oR31.SetRecord ortn_order_review.RecordType31=oR31.SetRecord set oR31 = nothing end if if debugflag = "true" then orderDebugString = orderDebugString & "
    ---------------------------------------------------
    " orderDebugString = orderDebugString & "Shipto GiftMessage1:" & Ship_OrderMessage1 & "...GiftMessage2:" & Ship_OrderMessage2 & "
    " orderDebugString = orderDebugString & "------------------------------------------
    " end if Dim ShiptoEmail ShiptoEmail = Order_Customer_Shipinfo(iShipIndex) if ShiptoEmail <> "" then set oR33=Server.CreateObject(webcom & "RecordType33") oR33.Email=ShiptoEmail ortn_order.RecordType33=oR33.SetRecord ortn_order_review.RecordType33=oR33.SetRecord end if if debugflag = "true" then orderDebugString = orderDebugString & "
    Shitp Info:
    " orderDebugString = orderDebugString & "Ship To:  " & Order_Customer_Shipinfo(iShipIndex+2) & "," & Order_Customer_Shipinfo(iShipIndex+4) & "
    " orderDebugString = orderDebugString & "Ship To:  " & Order_Customer_Shipinfo(iShipIndex+6) & "," & Order_Customer_Shipinfo(iShipIndex+7) & "
    " orderDebugString = orderDebugString & "Ship Address:  " & Order_Customer_Shipinfo(iShipIndex+9) & ".." & Order_Customer_Shipinfo(iShipIndex+10) & "," & Order_Customer_Shipinfo(iShipIndex+11) & "
    " orderDebugString = orderDebugString & "ShipMethod: " orderDebugString = orderDebugString & SShipmethod & "
    " orderDebugString = orderDebugString & " ***********************************
    " end if lineitemno=0 iTotalProductCount=UBound(basketItems) Dim SProdNum Dim SIQty Dim SPrice Dim SPriceOverRide Dim Sgift_comments Dim Sgift_wrap Dim Ssucflag if iTotalProductCount > 0 then For ip=1 to iTotalProductCount Order_BasketItems = basketItems(ip) 'Build RecordType 40 for buyer SProdNum = Trim(Order_BasketItems(7)) SIQty = Trim(Order_BasketItems(4)) SPrice = Trim(Order_BasketItems(6)) SPriceOverRide = "" if cdbl( Order_BasketItems(6) ) < cdbl( Order_BasketItems(5) ) then SPriceOverRide = "Y" end if 'item level gift info Sgift_comments="" 'Trim(getValueFormQueryString("Shipto_ItemMessage" & cstr(i) & "~" & ip)) Sgift_wrap="" 'Trim(getValueFormQueryString("Shipto_ItemGiftWrap" & cstr(i) & "~" & ip)) bSend_PricedItem="true" if cdbl(SPrice)<=0 then if Send_zero_Priced_Item="false" then bSend_PricedItem ="false" end if end if if bSend_PricedItem="true" then If Len(SIQty) = 1 Then SIQty = "000" & SIQty ElseIf Len(SIQty) = 2 Then SIQty = "00" & SIQty ElseIf Len(SIQty) = 3 Then SIQty = "0" & SIQty Else SIQty = Left(SIQty, 4) End If lineitemno=lineitemno +1 'Build RecordType 40 Dim Strans01 set Strans01 = server.CreateObject(webcom & "Trans0001") Strans01.Company = MACS_COMPANY Strans01.Division = MACS_DIVISION Strans01.CartID = MACS_UID Strans01.Host=HOST_NAME Strans01.Port=WEBREQST Strans01.ItemNo= SProdNum Strans01.Quantity= SIQty Ssucflag = "" Ssucflag = Trim(Strans01.GetValue("SuccessFlag",0)) if Ssucflag = "N" then macsmsg = macsmsg & "
  • ERROR: " & SProdNum & " item is not available at this time
    " else Dim oR40 set oR40=Server.CreateObject(webcom & "RecordType40") oR40.ItemQty=SIQty oR40.ItemNo=SProdNum if SPriceOverRide = "Y" then 'override price SPrice = formatPrice(SPrice, 9) oR40.Price=SPrice oR40.PriceOveride = "Y" end if oR40.ShipMethod = SShipmethod ortn_order.RecordType40=oR40.SetRecord ortn_order_review.RecordType40=oR40.SetRecord set oR40=nothing 'BUILD Personalization Data ItmCustCd = CheckPersonalization(SProdNum, MACS_UID) if ItmCustCd = "true" then if debugflag = "true" then orderDebugString = orderDebugString & "---------------------------------------------------
    " orderDebugString = orderDebugString & "CheckPersonalization: " & ItmCustCd & " for ProdNum:" & ProdNum & "
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if 'get total personalization gwtotperzlines = "" 'getValueFormQueryString( cstr(i) & "~" & cstr(ip) & "~TotalPerzLines") if gwtotperzlines ="" then gwtotline=0 else gwtotline=cint(gwtotperzlines) end if if debugflag = "true" then orderDebugString = orderDebugString & "Total Lines perz passed[gwtotperzlines]: " & gwtotperzlines & "
    " end if iLineCount=1 for jcount = 1 to gwtotline step 2 nextjcount = jcount + 1 set oR41=server.CreateObject(webcom & "RecordType41") sCustomizeTextAll = "" 'trim(getValueFormQueryString(cstr(i) & "~" & cstr(ip) & "~PerzLine~" & cstr(jcount))) sCustomizeText1 ="" sCustomizeText2 ="" if len(sCustomizeTextAll)>60 then sCustomizeText1 = mid(sCustomizeTextAll, 1, 60) 'sCustomizeText2 = mid(sCustomizeTextAll, 61) 'if len(sCustomizeText2)>60 then sCustomizeText2 = mid(sCustomizeText2, 1, 60) else sCustomizeText1 = sCustomizeTextAll end if sCustomizeTextAll = "" 'trim(getValueFormQueryString(cstr(i) & "~" & cstr(ip) & "~PerzLine~" & cstr(nextjcount))) if len(sCustomizeTextAll)>60 then sCustomizeText2 = mid(sCustomizeTextAll, 1, 60) 'sCustomizeText2 = mid(sCustomizeTextAll, 61) 'if len(sCustomizeText2)>60 then sCustomizeText2 = mid(sCustomizeText2, 1, 60) else sCustomizeText2 = sCustomizeTextAll end if if debugflag = "true" then orderDebugString = orderDebugString & "sCustomizeText1: " & sCustomizeText1 & "
    " orderDebugString = orderDebugString & "jcount: " & cstr(jcount) & "
    " orderDebugString = orderDebugString & " ***********************************
    " end if oR41.Customize1 = sCustomizeText1 if nextjcount <= gwtotline then oR41.Customize2 = sCustomizeText2 if debugflag = "true" then 'send only if there orderDebugString = orderDebugString & "nextjcount: " & cstr(nextjcount) & "
    " orderDebugString = orderDebugString & "sCustomizeText2: " & sCustomizeText2 & "
    " end if end if 'oR41.EdpNo = cstr(jcount) 'oR41.ItemNo = ProdNum ortn_order.RecordType41=oR41.SetRecord ortn_order_review.RecordType41=oR41.SetRecord set oR41=nothing iLineCount=iLineCount+1 next end if 'BUILD GIFT WRAP SGwrapFlag = Trim(Strans01.GetValue("GwrapFlag",0)) if debugflag = "true" then orderDebugString = orderDebugString & " In ShipTo...
    " orderDebugString = orderDebugString & "
  • " & SProdNum & " SGwrapFlag :-" & SGwrapFlag & "
    " orderDebugString = orderDebugString & "
  • Sgift_wrap:-" & Sgift_wrap & "
    " orderDebugString = orderDebugString & "
  • User Sgift_wrap:-" & Susergiftwrap & "
    " orderDebugString = orderDebugString & "
  • Ship Method:-" & SShipMethod & "
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if if SGwrapFlag = "A" and (Sgift_wrap ="true" or Sgift_comments<>"") then lineitemno = lineitemno + 1 strlineno = Trim(lineitemno) if len(strlineno) = 1 then strlineno = "00" & Trim(lineitemno) elseif len(strlineno) = 2 then strlineno = "0" & Trim(lineitemno) else strlineno = Trim(lineitemno) end if if debugflag = "true" then orderDebugString = orderDebugString & "
  • giftAssocType:=" & giftAssocType & ",
    Comments:-" & Sgift_comments & "
    " orderDebugString = orderDebugString & "---------------------------------------------------
    " end if set SoRG40=Server.CreateObject(webcom & "RecordType40") SoRG40.ItemQty=SIQty '"0001" SoRG40.ItemNo=giftProdNum SoRG40.AssocNo=strlineno SoRG40.AssocType=giftAssocType ortn_order.RecordType40=SoRG40.SetRecord ortn_order_review.RecordType40=SoRG40.SetRecord set SoRG40=nothing if Sgift_comments <> "" then set SoRG41=Server.CreateObject(webcom & "RecordType41") SoRG41.Customize1=Sgift_comments ortn_order.RecordType41=SoRG41.SetRecord ortn_order_review.RecordType41=SoRG41.SetRecord set SoRG41=nothing end if if debugflag = "true" then orderDebugString = orderDebugString & "-- Item: " & giftProdNum & "(Qty:" & SIQty & ")
    " orderDebugString = orderDebugString & " ***********************************
    " end if end if end if set Strans01 = nothing set oR30 = nothing set oR33 = nothing set oR40=nothing End if 'Send_zero_Priced_Item Next ''to handle express shiping for shiptos ''don't add "express", if there 1 shipto + express shipping ''don't add to 1 level "express", if there is no bill-shipto but there are multiple shiptos + express shipping 'if SShipmethod = "01" and shpmd0="" then ' if iShipCount=1 or i=1 then ' bSendExpressShipItem="false" ' end if 'end if 'if bSendExpressShipItem="true" then ' 'if shpmd0="24" and SShipmethod<>"24" then ' if SShipmethod = "01" then ' if debugflag = "true" then ' orderDebugString = orderDebugString & "***********************************
    " ' orderDebugString = orderDebugString & "-Adding Express Item, shipto has Express shipping
    " ' orderDebugString = orderDebugString & "***********************************
    " ' end if ' set oR40=Server.CreateObject(webcom & "RecordType40") ' oR40.ItemQty="0001" ' oR40.ItemNo="EXPRESS" ' oR40.ShipMethod = SShipmethod ' ortn_order.RecordType40=oR40.SetRecord ' ' end if 'end if End If End if 'if (sBillShipSlNo = "1" or sBillShipSlNo = "0") and bOrderWithShiptoBilltoSame then Next end if 'if ShipTo_Count <> "" then if debugflag = "true" then orderDebugString = orderDebugString & "-----------------------------------------------------
    " orderDebugString = orderDebugString & "The Transaction Returns Values
    " end if '************************************************************************************** '************************************************************************************** '////////////////////////////////////////////////////////////////////////////////// 'Setp5 :- The Transaction Returns Values ' '////////////////////////////////////////////////////////////////////////////////// 'ONLY FROM REVIEW GET THE DETAILS Dim ordersucessflag ordersucessflag = ortn_order_review.GetValue("SuccessFlag", 0) if debugflag = "true" then orderDebugString = orderDebugString & "ordersucessflag: " & ordersucessflag orderDebugString = orderDebugString & "Message: " & ortn_order_review.GetValue("Message", 0) end if if ucase(trim(ordersucessflag)) <> "Y" then macsmsg = macsmsg & "
  • Error: " & ortn_order_review.GetValue("Message",0) if debugflag = "true" then orderDebugString = orderDebugString & "There Was an Error in The WebOrder Transaction!

    " orderDebugString = orderDebugString & (ortn_order_review.GetValue("Message",0)) orderDebugString = orderDebugString & "
    " orderDebugString = orderDebugString & (ortn_order_review.GetValue("ShipToNum",0)) orderDebugString = orderDebugString & "
    " orderDebugString = orderDebugString & (ortn_order_review.GetValue("ShipMethod",0)) orderDebugString = orderDebugString & "
    " orderDebugString = orderDebugString & (ortn_order_review.GetValue("PayMethod",0)) orderDebugString = orderDebugString & "
    " set ortn_order = nothing end if ErrorMessages = macsmsg & additionalmacsmsg 'ERROR MESSAGES ReturnOrderTransactionResponse(1) = MACS_ERROR_MESSAGES(2) 'if trim(ErrorMessages) ="" then ' ErrorMessages = MACS_CONNECTION_ERROR_STRING 'end if ReturnOrderTransactionResponse(2) = ErrorMessages ReturnOrderTransactionResponse(3) = MACS_UID OrderTransaction = ReturnOrderTransactionResponse else Dim OrderNum Dim OrderCustEDP Dim itemtotal Dim discount Dim tax Dim shipping Dim pmethod Dim gFlagType Dim giftwraptotal Dim ptypayer Dim total 'do not get order number 'OrderNum = Trim(ortn_order_review.GetValue("OrderNo",0)) 'Order Number OrderNum = "" OrderCustEDP = Trim(ortn_order_review.GetValue("CustEdp", 0)) itemtotal = Trim(ortn_order_review.GetValue("ProductDol",0)) 'Pricing/Shipping discount = Trim(ortn_order_review.GetValue("DiscountDol",0)) 'Discount Amt tax = Trim(ortn_order_review.GetValue("TaxDol",0)) 'Tax(if applicable) shipping = Trim(ortn_order_review.GetValue("PostageDol",0)) 'Shipping pmethod = ortn_order_review.GetValue("PayMethod",0) 'Pay Method gFlagType = ortn_order_review.GetValue("GiftFlagType",0) 'Gift Flag Type giftwraptotal = Trim(ortn_order_review.GetValue("GiftWrapDol",0)) 'Gift Wrap Total ptypayer = ortn_order_review.GetValue("3PtyPayerFlag",0) '3rd Party Payer Flag total = Trim(ortn_order_review.GetValue("TotalDol",0)) if debugflag = "true" then orderDebugString = orderDebugString & "
    --------------------------------------------------
    " 'orderDebugString = orderDebugString & "OrderNum :" & OrderNum & "
    " 'orderDebugString = orderDebugString & "CustEDP :" & OrderCustEDP & "
    " orderDebugString = orderDebugString & "itemtotal :" & itemtotal & "
    " orderDebugString = orderDebugString & "discount :" & discount & "
    " orderDebugString = orderDebugString & "tax :" & tax & "
    " orderDebugString = orderDebugString & "shipping :" & shipping & "
    " orderDebugString = orderDebugString & "total :" & total & "
    " orderDebugString = orderDebugString & "pmethod :" & pmethod & "
    " orderDebugString = orderDebugString & "gFlagType :" & gFlagType & "
    " orderDebugString = orderDebugString & "giftwraptotal :" & giftwraptotal & "
    " orderDebugString = orderDebugString & "ptypayer :" & ptypayer & "
    " orderDebugString = orderDebugString & "GiftDollar :" & Trim(ortn_order_review.GetValue("GiftDollar",0)) & "
    " orderDebugString = orderDebugString & "--------------------------------------------------
    " end if ReturnOrderTransactionResponse(1) = MACS_ERROR_MESSAGES(3) 'success ReturnOrderTransactionResponse(2) = ErrorMessages ReturnOrderTransactionResponse(3) = MACS_UID ReturnOrderTransactionResponse(4) = "" ReturnOrderTransactionResponse(5) = itemtotal ReturnOrderTransactionResponse(6) = shipping ReturnOrderTransactionResponse(7) = tax ReturnOrderTransactionResponse(8) = giftwraptotal ReturnOrderTransactionResponse(9) = discount ReturnOrderTransactionResponse(10) = total Dim AllTotals AllTotals=0 AllTotals = cdbl(itemtotal) + cdbl(shipping) + cdbl(tax)+ cdbl(giftwraptotal)- cdbl(discount) GCTotalAvialableAmount = GCTotalAvialableAmount - AllTotals if cdbl(GCTotalAvialableAmount)<0 then GCTotalAvialableAmount =0 end if ReturnOrderTransactionResponse(11) = GCTotalAvialableAmount 'put the non review order in session set Session("ortn") = ortn_order set ortn_order = nothing set ortn_order_review = nothing OrderTransaction = ReturnOrderTransactionResponse end if end if OrderTransaction = ReturnOrderTransactionResponse End Function %> <% Function CheckPersonalization(ProdNum, MACS_UID) Dim returnVal Dim trans0015 Dim lsCustomFlag returnVal = "" Set trans0015 = Server.CreateObject(webcom & "Trans0015") trans0015.Company = MACS_COMPANY trans0015.Division = MACS_DIVISION trans0015.CartID = MACS_UID trans0015.Host = HOST_NAME trans0015.Port = WEBREQST trans0015.ItemNo = ProdNum lsCustomFlag = "" lsCustomFlag = UCase(Trim(trans0015.GetValue("CustomFlag", 0))) If lsCustomFlag <> "" Then returnVal = "true" End if set trans0015 = nothing CheckPersonalization =returnVal End Function Function formatPrice(padPrice, padlength) Dim iPadLen Dim spadzeros Dim returnPrice iPadLen = cint(padlength) For ipad=1 to iPadLen spadzeros = spadzeros & "0" Next If InStr(1, padPrice, ".") > 0 Then If Len(Mid(padPrice, InStr(1, padPrice, ".") + 1)) = 1 Then padPrice = padPrice & "0" End If Else padPrice = padPrice & "00" End If returnPrice = replace(padPrice,".", "") returnPrice = Right(spadzeros & returnPrice, cint(iPadLen)) formatPrice = returnPrice End function %>