UPDATING ECOMMERCE WEBSITE DATABASE
(ROYALTY ACCOUNT) USING ASP IPN SCRIPT
REM **********************************************************************
(ROYALTY ACCOUNT) USING ASP IPN SCRIPT
REM **********************************************************************
http://www.bobbyreggae.com/ROYALTYIPN_LISTENER.ASP
REM **********************************************************************
REM Retrieve Information Transferred From Pay Pal To IPN Script
REM **********************************************************************
ITEM_NAME = Request.Form("item_name")
HCURRENT_BALANCE = Request.Form("amount")
REM **********************************************************************
SET FROYALTYACCOUNT=SERVER.CREATEOBJECT("ADODB.RECORDSET")
SQLACCOUNT=" SELECT * FROM ROYALTYACCOUNT "
FROYALTYACCOUNT.OPEN SQLACCOUNT, CON
REGGAEFLG=0
IF FROYALTYACCOUNT.BOF THEN
IF FROYALTYACCOUNT.EOF THEN
REGGAEFLG=1
END IF
END IF
IF REGGAEFLG=0 THEN
FROYALTYACCOUNT.MOVEFIRST
DO WHILE NOT FROYALTYACCOUNT.EOF
IF ISNULL(FROYALTYACCOUNT("CODE")) THEN
HCODE=0
ELSE
HCODE=FROYALTYACCOUNT("CODE")
END IF
HDESCRIPTION =FROYALTYACCOUNT("DESCRIPTION")
HDESCRIPTION =TRIM(HDESCRIPTION)
POS = INSTR(HITEM_NAME, HDESCRIPTION)
IF POS=0 THEN
ELSE
HHCODE =HCODE
HHDESCRIPTION =HDESCRIPTION
END IF
FROYALTYACCOUNT.MOVENEXT
END IF
IF HHROYALTYCREDITOR="DISTRIBUTOR" THEN
ZERO = 0
Set FDISTRIBUTOR=Server.CreateObject("ADODB.Recordset")
SQLDISTRIBUTOR=" SELECT * FROM DISTRIBUTOR "
SQLDISTRIBUTOR= SQLDISTRIBUTOR & ” WHERE Instr(ITEM_NAME, ACCOUNT_NAME) <>”
SQLDISTRIBUTOR= SQLDISTRIBUTOR & ZERO
FDISTRIBUTOR.Open SQLDISTRIBUTOR, con
reggaeflg=0
If FDISTRIBUTOR.Bof Then
If FDISTRIBUTOR.Eof then
reggaeflg=1
End If
End If
If reggaeflg=0 Then
If Isnull(FDISTRIBUTOR("ACCNO")) then
HHACCOUNT_NUMBER=0
Else
HHACCOUNT_NUMBER=FDISTRIBUTOR("ACCNO")
End If
End If
END IF
IF HHROYALTYCREDITOR="PRODUCER" THEN
Set FPRODUCER=Server.CreateObject("ADODB.Recordset")
SQLPRODUCER=" SELECT * FROM PRODUCER "
SQLPRODUCER= SQLPRODUCER & ” WHERE Instr(ITEM_NAME, PRODUCER_NAME) <>”
SQLPRODUCER= SQLPRODUCER & ZERO
FPRODUCER.Open SQLPRODUCER, con
reggaeflg=0
If FPRODUCER.Bof Then
If FPRODUCER.Eof then
reggaeflg=1
End If
End If
If reggaeflg=0 Then
If Isnull(FPRODUCER("PRODUCER_CODE")) then
HHACCOUNT_NUMBER=0
Else
HHACCOUNT_NUMBER=FPRODUCER("PRODUCER_CODE")
End If
End If
FPRODUCER.Open SQLPRODUCER, con
reggaeflg=0
If FPRODUCER.Bof Then
If FPRODUCER.Eof then
reggaeflg=1
End If
End If
If reggaeflg=0 Then
If Isnull(FPRODUCER("PRODUCER_CODE")) then
HHACCOUNT_NUMBER =0
Else
HHACCOUNT_NUMBER =FPRODUCER("PRODUCER_CODE")
End If
End If
END IF
IF HHROYALTYCREDITOR="WRITER" THEN
Set FWRITER=Server.CreateObject("ADODB.Recordset")
SQLWRITER=" SELECT * FROM WRITER "
SQLWRITER= SQLWRITER & ” WHERE Instr(ITEM_NAME, WRITER_NAME) <>”
SQLWRITER= SQLWRITER & ZERO
FWRITER.Open SQLWRITER, con
reggaeflg=0
If FWRITER.Bof Then
If FWRITER.Eof then
reggaeflg=1
End If
End If
If reggaeflg=0 Then
If Isnull(FWRITER("WRITER_CODE")) then
HHACCOUNT_NUMBER=0
Else
HHACCOUNT_NUMBER=FWRITER("WRITER_CODE")
End If
End If
END IF
IF HHROYALTYCREDITOR="ARTIST" THEN
Set FARTIST=Server.CreateObject("ADODB.Recordset")
SQLARTIST=" SELECT * FROM ARTIST "
SQLARTIST= SQLARTIST & ” WHERE Instr(ITEM_NAME, ARTIST_NAME) <>”
SQLARTIST= SQLARTIST & ZERO
FARTIST.Open SQLARTIST, con
reggaeflg=0
If FARTIST.Bof Then
If FARTIST.Eof then
reggaeflg=1
End If
End If
If reggaeflg=0 Then
If Isnull(FARTIST("ARTCOD")) then
HHACCOUNT_NUMBER=0
Else
HHACCOUNT_NUMBER=FARTIST("ARTCOD")
End If
END IF
SET FALBUMSINGLE=SERVER.CREATEOBJECT("ADODB.RECORDSET")
SQLALBUM=" SELECT * FROM ALBUMSINGLE "
FALBUMSINGLE.OPEN SQLALBUM, CON
REGGAEFLG=0
IF FALBUMSINGLE.BOF THEN
IF FALBUMSINGLE.EOF THEN
REGGAEFLG=1
END IF
END IF
IF REGGAEFLG=0 THEN
FALBUMSINGLE.MOVEFIRST
DO WHILE NOT FALBUMSINGLE.EOF
IF ISNULL(FALBUMSINGLE("CODE")) THEN
HCODE=0
ELSE
HCODE=FALBUMSINGLE("CODE")
END IF
HDESCRIPTION =FALBUMSINGLE("DESCRIPTION")
HDESCRIPTION =TRIM(HDESCRIPTION)
POS = INSTR(HITEM_NAME, HDESCRIPTION)
IF POS=0 THEN
ELSE
HHCODE =HCODE
HHDESCRIPTION =HDESCRIPTION
END IF
FALBUMSINGLE.MOVENEXT
END IF
IF HHDESCRIPTION="ALBUM" THEN
SET FALBUM=SERVER.CREATEOBJECT("ADODB.RECORDSET")
SQLALBUM=" SELECT * FROM ALBUM "
SQLALBUM= SQLALBUM & ” WHERE Instr(ITEM_NAME, ALBUMNAM) <>”
SQLALBUM= SQLALBUM & ZERO
FALBUM.Open SQLALBUM, con
reggaeflg=0
If FALBUM.Bof Then
If FALBUM.Eof then
reggaeflg=1
End If
End If
If reggaeflg=0 Then
If Isnull(FALBUM("ALBUMCOD")) then
HHALBUMCOD=0
Else
HHALBUMCOD=FALBUM("ALBUMCOD")
End If
END IF
END IF
IF HHDESCRIPTION="SINGLE" THEN
SET FSONGFIL=SERVER.CREATEOBJECT("ADODB.RECORDSET")
SQLSONG=" SELECT * FROM SONGFIL "
SQLSONG= SQLSONG & ” WHERE Instr(ITEM_NAME, SONGTITLE) <>”
SQLSONG= SQLSONG & ZERO
FSONGFIL.Open SQLSONG, con
reggaeflg=0
If FSONGFIL.Bof Then
If FSONGFIL.Eof then
reggaeflg=1
End If
End If
If reggaeflg=0 Then
If Isnull(FSONGFIL("SONGCOD")) then
HHSONGCOD=0
Else
HHSONGCOD=FSONGFIL("SONGCOD")
End If
END IF
END IF
REM **************************************************************
USE INFORMATION SENT FROM PAY PAL TO UPDATE ROYALTY ACCOUNT
With Payment Details made at Pay Pal To Royalty Creditors
( Distributor, Producer, Song Writer, Artist( Singer, Musician )
REM ***************************************************************
HCMPID=1
SET FNUMBERS=SERVER.CREATEOBJECT("ADODB.RECORDSET")
SQLNUMB=" SELECT * FROM NUMBERS "
SQLNUMB=SQLNUMB & " WHERE CMPID=" & HCMPID
FNUMBERS.OPEN SQLNUMB, CON
REGGAEFLG=0
IF FNUMBERS.BOF THEN
IF FNUMBERS.EOF THEN
REGGAEFLG=1
END IF
END IF
IF REGGAEFLG=0 THEN
IF ISNULL(FNUMBERS("TRNSNO")) THEN
HTRNSNO=0
ELSE
HTRNSNO=FNUMBERS("TRNSNO")
END IF
HTRNSNO=HTRNSNO + 1
NUMBSQL=" UPDATE NUMBERS SET "
NUMBSQL=NUMBSQL & " TRNSNO=" & HTRNSNO
NUMBSQL=NUMBSQL & " WHERE CMPID=" & HCMPID
CON.EXECUTE NUMBSQL
END IF
HTRNSDAT = DATE()
HTRNSTYPE = “R” rem Payment
REM ************************************************************
ADDITION OF PAYMENT TRANSACTION TO ROYALTY ACCOUNT
Inorder To ZERO Out Balance To prevent Duplication
Of Payment( Only Account With a Balance Can Result
In a Payment To Royalty Creditors Pay Pal Business
Account.)
REM ************************************************************
SQLSLEDGE=" INSERT INTO ROYALTYLEDGER VALUES "
SQLSLEDGE=SQLSLEDGE & "('"
SQLSLEDGE=SQLSLEDGE & HTRNSNO & "','"
SQLSLEDGE=SQLSLEDGE & HTRNSDAT & "','"
SQLSLEDGE=SQLSLEDGE & HACCOUNT_NUMBER & "','"
SQLSLEDGE=SQLSLEDGE & HTRNSTYPE & "','"
SQLSLEDGE=SQLSLEDGE & HCODE & "','"
SQLSLEDGE=SQLSLEDGE & HHALBUMCOD & "','"
SQLSLEDGE=SQLSLEDGE & HCURRENT_BALANCE & "')"
CON.EXECUTE SQLSLEDGE
REM **************************************************************
No comments:
Post a Comment