I have the following codes:
<!--- Begin Read database --->
Assuming a successful read
<!--- End of read Database --->
<!--- If some courses are found, then add up all the course fees --->
<CFIF qryRegister_Course.recordcount GT 0>
<CFLOOP FROM="1" TO="#qryRegister_Course.recordcount#" INDEX="i">
<!--- Add all the course fee that belongs to this student --->
<CFSET Total_Course_Fee = Total_Course_Fee + qryRegister_Course.Course_fee>
</CFLOOP>
</CFIF>
...
<!--- Begin Read database --->
Assuming a successful read
<!--- End of read Database --->
<CFSET TotalBalance = 0.00>
<!--- Verify this student's total balance. If the accumulated courses fees does not equal to the total balance, then display error message. --->
<CFIF qryBalance.recordcount GT 0>
<CFSET TotalBalance = qryBalance.Total_Balance>
<SCRIPT LANGUAGE="JavaScript">
window.alert(<CFOUTPUT>#TotalBalance#</CFOUTPUT> + " NEQ " + <CFOUTPUT>#Total_Course_Fee#</CFOUTPUT>)
window.alert("Error = " + <CFOUTPUT>#ERROR#</CFOUTPUT>)
</SCRIPT>
<CFIF TotalBalance NEQ Total_Course_Fee>
<CFSET ERROR = 1>
<SCRIPT LANGUAGE="JavaScript">
window.alert("Now ... Error = " + <CFOUTPUT>#ERROR#</CFOUTPUT>)
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
// Recorded balance and calculated balance are not the same.
window.alert("There is a descrepency on the recorded balance for this student."
</SCRIPT>
</CFIF>
</CFIF>
I have a bunch or records that this codes gets applied to but only one record when it gets to the compare statement:
<CFIF TotalBalance NEQ Total_Course_Fee>
it always falls through except the rest.
My data:
record #1: TotalBalance = 90.30 and Total_Course_Fee = 90.30
record #2: TotalBalance = 0.00 and Total_Course_Fee = 0.00
record #3: TotalBalance = 0.00 and Total_Course_Fee = 0.00
record #4: TotalBalance = 60.45 and Total_Course_Fee = 60.45
record #5: TotalBalance = 90.30 and Total_Course_Fee = 90.30
For Record #5, somehow, the condition is always true! I can figure out even when I try displaying the values of these two variables.
Would someone know what's wrong???
<!--- Begin Read database --->
Assuming a successful read
<!--- End of read Database --->
<!--- If some courses are found, then add up all the course fees --->
<CFIF qryRegister_Course.recordcount GT 0>
<CFLOOP FROM="1" TO="#qryRegister_Course.recordcount#" INDEX="i">
<!--- Add all the course fee that belongs to this student --->
<CFSET Total_Course_Fee = Total_Course_Fee + qryRegister_Course.Course_fee>
</CFLOOP>
</CFIF>
...
<!--- Begin Read database --->
Assuming a successful read
<!--- End of read Database --->
<CFSET TotalBalance = 0.00>
<!--- Verify this student's total balance. If the accumulated courses fees does not equal to the total balance, then display error message. --->
<CFIF qryBalance.recordcount GT 0>
<CFSET TotalBalance = qryBalance.Total_Balance>
<SCRIPT LANGUAGE="JavaScript">
window.alert(<CFOUTPUT>#TotalBalance#</CFOUTPUT> + " NEQ " + <CFOUTPUT>#Total_Course_Fee#</CFOUTPUT>)
window.alert("Error = " + <CFOUTPUT>#ERROR#</CFOUTPUT>)
</SCRIPT>
<CFIF TotalBalance NEQ Total_Course_Fee>
<CFSET ERROR = 1>
<SCRIPT LANGUAGE="JavaScript">
window.alert("Now ... Error = " + <CFOUTPUT>#ERROR#</CFOUTPUT>)
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
// Recorded balance and calculated balance are not the same.
window.alert("There is a descrepency on the recorded balance for this student."
</SCRIPT>
</CFIF>
</CFIF>
I have a bunch or records that this codes gets applied to but only one record when it gets to the compare statement:
<CFIF TotalBalance NEQ Total_Course_Fee>
it always falls through except the rest.
My data:
record #1: TotalBalance = 90.30 and Total_Course_Fee = 90.30
record #2: TotalBalance = 0.00 and Total_Course_Fee = 0.00
record #3: TotalBalance = 0.00 and Total_Course_Fee = 0.00
record #4: TotalBalance = 60.45 and Total_Course_Fee = 60.45
record #5: TotalBalance = 90.30 and Total_Course_Fee = 90.30
For Record #5, somehow, the condition is always true! I can figure out even when I try displaying the values of these two variables.
Would someone know what's wrong???