Search This Blog

Release Block User Code

In any login code, aside from status login, logout, I also made use of block. A user has a status of block if his username and password dis not match thrice in a row. This will help in the security of accessing the program.

PUBLIC pBlockUser
IF !EMPTY(THISFORM.Text2.Value)
IF THISFORM.Text4.Value = "BLOCK"
pBlockUser = THISFORM.Text3.Value
lAnswer = MESSAGEBOX("Do you want to release "+ALLTRIM(pBlockUser)+"?", 4, "Confirmation")
IF lAnswer = 6
SELECT SviewAccess
LOCATE FOR IdNum = THISFORM.Text2.Value
IF FOUND()
REPLACE AccessStatus WITH "LOGOUT"
=MESSAGEBOX("Successfully release "+ALLTRIM(pBlockUser)+" .", "Confirmation")
THISFORM.Grid1.REFRESH
ENDIF
ENDIF
ELSE
=MESSAGEBOX("Select a Block User.", "Confirmation")
ENDIF
ELSE
=MESSAGEBOX("Select User.", "Confirmation")
ENDIF

Balance Code

This code will check if textbox 1 is equal to textbox 2. If the two quantities is not equal a messagebox 'Not balance.' will appear but continue printing if balance at all.

IF !EMPTY(THISFORM.Text3.Value)
IF (THISFORM.Text1.Value) = (THISFORM.Text2.Value)
REPORT FORM "C:\GenLed\Reports\ReportJournalEntry" TO PRINTER PROMPT NODIALOG PREVIEW
THISFORM.Refresh()
ELSE
=MESSAGEBOX("Not balance.", "Confirmation")
ENDIF
ELSE
=MESSAGEBOX("Choose Journal Entry.", "Confirmation")
ENDIF

Table Update Code

Sample of table update implemented in replace:

SELECT SviewAccountList
lBranches = pBranchName
=REQUERY("SviewAccountList")
LOCATE FOR (IdNum) = (THISFORM.Text34.Value)
IF FOUND()
REPLACE TotalDebit WITH THISFORM.TEXT15.Value
REPLACE TotalCredit WITH THISFORM.TEXT18.Value
REPLACE EndingBalance WITH THISFORM.TEXT26.Value
REPLACE Lines WITH "POST"
REPLACE LDate WITH DATE()
=TABLEUPDATE(.T.)
ENDIF

Do Case Code

DO CASE
CASE THISFORM.Text33.VALUE = "1"
THISFORM.Text22.Value = "ASSET"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
CASE THISFORM.Text33.VALUE = "2"
THISFORM.Text22.Value = "LIABILITY"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
CASE THISFORM.Text33.VALUE = "3"
THISFORM.Text22.Value = "CAPITAL"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
CASE THISFORM.Text33.VALUE = "4"
THISFORM.Text22.Value = "OPN"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
CASE THISFORM.Text33.VALUE = "5"
THISFORM.Text22.Value = "INCOME"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value - THISFORM.Text10.Value + THISFORM.Text11.Value
CASE THISFORM.Text33.VALUE = "6"
THISFORM.Text22.Value = "EXPENSE"
THISFORM.Text15.Value = THISFORM.Text13.Value + THISFORM.Text10.Value
THISFORM.Text18.Value = THISFORM.Text14.Value + THISFORM.Text11.Value
THISFORM.Text25.Value = THISFORM.Text23.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
THISFORM.Text26.Value = THISFORM.Text24.Value + THISFORM.Text10.Value - THISFORM.Text11.Value
ENDCASE