<%@LANGUAGE="VBScript" CODEPAGE=932 %> <% Option Explicit 'Response.Expires = 0 %> ご注文ありがとうございました。
<% '========================== Dim systemMailAddress,shopName,signature, description '店名 shopName = "自然舘" '通販用メールアドレス systemMailAddress = "info@jinenkan.com" '署名 signature = "====================" & vbNewLine & "〒263-0001 千葉長沼原郵便局留め" & vbNewLine & " 自然舘本部 加藤弘明" & vbNewLine & " info@jinenkan.com" '注文者への説明 description = "料金は、現金、郵便小切手、または郵便為替にて" & vbNewLine & "自然舘本部 加藤弘明宛て(下記)に郵送してください。" & vbNewLine & "料金を受け取り次第、商品を発送いたします。" '========================== Dim con,rec,sql,recOrders,recOitems,errFlg Dim i,sesSize,addFlg Dim customerID,orderID Dim fromName,fromAddress,toName,toAddress,subject,body,bodyOrder,hiduke writeHeader '終了後にブラウザの更新ボタンを押したとき、エラー回避 If IsEmpty(Session("sesSelectProduct")) Then Response.Write "購入手続きは終了いたしました

" Else Set con = Server.CreateObject("ADODB.Connection") con.Open "Data Source=//nawinfs03/home/users/web/b1922/rh.jinenkan/database/jinenkan_jp.mdb;Provider=Microsoft.Jet.OLEDB.4.0;" con.BeginTrans Set rec = Server.CreateObject("ADODB.Recordset") 'customerテーブル追加 addFlg = true rec.ActiveConnection = con rec.CursorType = adOpenKeyset rec.LockType = adLockOptimistic sql="select * from customers where name='" & Session("name") & "' And zipCode= '" & Session("zip") & "' And tel= '" & Session("tel") & "' And email = '" & Session("email") & "'" rec.Open sql,con If rec.EOF Then rec.AddNew rec("name") = Session("name") rec("zipCode") = Session("zip") rec("address") = Session("add") rec("tel") = Session("tel") rec("email") = Session("email") rec.Update Else End If customerID = rec("customerID") rec.Close 'ordersテーブル追加 rec.CursorType = adOpenKeyset rec.LockType = adLockOptimistic sql="orders " rec.Open sql rec.AddNew rec("customerID") = customerID rec("date") = Date rec("amount") = Session("total") rec("shipCost") = Session("shipCost") rec("totalAmount") = Session("totalAmount") rec("name") = Session("name") rec("zipCode") = Session("zip") rec("address") = Session("prefectureName") & Session("add") rec("tel") = Session("tel") rec("email") = Session("email") rec("shipName") = Session("sName") rec("shipZipCode") = Session("sZip") rec("shipAddress") = Session("sPrefectureName") & Session("sAdd") rec("shipTel") = Session("sTel") rec.Update orderID = rec("orderID") rec.Close 'oItemsテーブル追加 rec.CursorType = adOpenKeyset rec.LockType = adLockOptimistic sql="oItems " rec.Open sql For i=0 to UBound(Session("sesSelectProduct"))-1 rec.AddNew rec("orderID") = orderID rec("productID") = Session("sesSelectProduct")(i,0) rec("productName") = Session("sesSelectProduct")(i,1) rec("price") = Session("sesSelectProduct")(i,2) rec("count") = Session("sesSelectProduct")(i,3) rec("amount") = Session("sesSelectProduct")(i,4) rec.Update Next If con.Errors.Count > 0 Then 'DBエラーの場合 con.RollbackTrans rec.Colose con.Close Response.Write "システムに不具合が起こりました。" Else con.CommitTrans rec.Close con.Close Set rec = Nothing Set con = Nothing 'Mail送信 '======== 注文内容 ========== bodyOrder="" For i=0 to UBound(Session("sesSelectProduct"))-1 bodyOrder = bodyOrder & Session("sesSelectProduct")(i,0) & " " & Session("sesSelectProduct")(i,1) & " " & Session("sesSelectProduct")(i,3) & "個 \" & FormatNumber(Session("sesSelectProduct")(i,4),0) & vbNewLine Next '============================ hiduke = Date 'shop宛 body = "" fromName = Session("name") fromAddress = Session("email") toName = shopName toAddress = systemMailAddress subject = "[order] No." & orderID body = body & "注文番号:" & orderID & vbNewLine body = body & "受注日:" & hiduke & vbNewLine & vbNewLine body = body & "<< 注文者 >>" & vbNewLine body = body & "氏名:" & fromName & vbNewLine body = body & "住所:〒" & Session("zip") & vbNewLine body = body & "   " & Session("prefectureName") & Session("add") & vbNewLine body = body & "電話:" & Session("tel") & vbNewLine body = body & "email:" & fromAddress & vbNewLine & vbNewLine body = body & "<< 届け先 >>" & vbNewLine if Session("sName") <> "" then body = body & "氏名:" & Session("sName") & vbNewLine body = body & "住所:〒" & Session("sZip") & vbNewLine body = body & "   " & Session("sPrefectureName") & Session("sAdd") & vbNewLine body = body & "電話:" & Session("sTel") & vbNewLine & vbNewLine else body = body & "同上" & vbNewLine & vbNewLine end If body = body & "<< 受注明細 >>" & vbNewLine body = body & "============================== " & vbNewLine body = body & bodyOrder body = body & "============================== " & vbNewLine body = body & " 小計 \" & FormatNumber(Session("total"),0) & vbNewLine body = body & " 送料 \" & FormatNumber(Session("shipCost"),0) & vbNewLine body = body & "-------------------- " & vbNewLine body = body & " 合計 \" & FormatNumber(Session("totalAmount"),0) & vbNewLine body = body & vbNewLine if Session("message") <> "" Then body = body & vbNewLine & "<< 伝言 >>" & vbNewLine body = body & Session("message") & vbNewLine end if SendMail fromName, fromAddress, toName, toAddress, subject, body '注文者あて body = "" fromName = shopName '店名 fromAddress = systemMailAddress 'システムアドレス toName = Session("name") toAddress = Session("email") subject = "[jinenkan] ご注文ありがとうございました" body = toName & "様" & vbNewLine body = body & "ご注文ありがとうございました" & vbNewLine body = body & vbNewLine body = body & "注文番号:" & orderID & vbNewLine body = body & "ご注文日:" & hiduke & vbNewLine If Session("sName") = "" Then body = body & "お届け先:〒" & Session("zip") & vbNewLine body = body & "     " & Session("prefectureName") & Session("add") & vbNewLine body = body & "     TEL:" & Session("tel") & vbNewLine Else body = body & "お届け先:〒" & Session("sZip") & vbNewLine body = body & "     " & Session("sPrefectureName") & Session("sAdd") & vbNewLine body = body & "     " & Session("sName") & "様" & vbNewLine body = body & "     TEL:" & Session("sTel") & vbNewLine End If body = body & vbNewLine & "ご注文商品 " & vbNewLine body = body & "======================================== " & vbNewLine body = body & bodyOrder body = body & "======================================== " & vbNewLine body = body & " 小計 \" & FormatNumber(Session("total"),0) & vbNewLine body = body & " 送料 \" & FormatNumber(Session("shipCost"),0) & vbNewLine body = body & "-------------------- " & vbNewLine body = body & " 合計 \" & FormatNumber(Session("totalAmount"),0) & vbNewLine body = body & vbNewLine & vbNewLine body = body & description & vbNewLine & vbNewLine body = body & signature & vbNewLine '署名 SendMail fromName, fromAddress, toName, toAddress, subject, body 'セーブ情報のクリア Session("categoryID") = 0 Session("howManyRecs") = 0 Session("sesSelectProduct") = Empty Session("total") = 0 Session("totalAmount") = 0 Session("shipCost") = 0 Session("cateSuryo1") = 0 Session("cateSuryo2") = 0 %>

ご注文ありがとうございました。


お客様の注文番号:<%= orderID %>

直ちに注文確認メールを送信いたします。 万一、注文確認メールが届かない場合は、注文番号を明記の上、 info@jinenkan.com までご連絡ください。
またのご利用をお待ちいたしております。
<% End If End If writeFooter %>