I have two text fields, they are identical in set up and formatting. One holds a cash gross value the other the total daily gross value. They get the exact same inputs and yet the text field that holds the daily gross value will NOT display any digits on the right of the decimal.
Example:
I calculate a gross value of 12.45 then put that value in both text fields, the cash text field will display correctly the daily gross will only display 12.00. BUT it gets better, when I go to another calculation THAT will update the gross field correctly. I am pulling my hair out trying to figure this out!
To explain, I have a Window set up with multiple fields. The user enters an integer value (count of money ex: the user counts 10 $1.00 bills they enter 10 in the $1.00 bill field and so forth.) when the user presses the TAB, ENTER or RETURN key a method is called that will calculate total values then assign the results into the appropriate fields for display.
When it comes to calculating the change when I step through the code in debug mode itâs working as designed and one of the two Text Fields is updating correctly while the other is not. But when I move to entering credit card and checks the field that doesnât update with the cash entries works fine. Itâs making me crazy trying to find where the issue isâŠ
Youâve restarted the computer? Xojo is prone to bouts of insanity, especially when it has been running for a long time. Whenever I get something weird like that I restart and the issue is usually gone.
It must be your code, especially if you have separate calculation routines .
Can you post the code here?
If you create a method that takes two parameters and updates the text boxes, then pass your output values into that, you can be sure that the code is always the same.
Linux OS⊠only time I reboot is for a kernel update that requires it. Otherwise I have a memory routine that flushes cache and recycles memory regularly.
// Variable declarations...
Var A As Integer // This holds the count...
Var B As Currency // Holds the cash total for additional calculation...
Var C As Currency // The Total for a given entry...
Var D As Currency // Hold the last value...
Var E As Currency // Hold the value of the opening till amount...
Var F As Currency // Test value...
Var curConvert As Currency // Convert the text field value to currency value for calculations...
Var strJulien As String = modSysFunc.mthJulianCalc // Get the Julien date....
Var recSet As RecordSet = modSel.mthSelTill( strJulien, "" ) // IdxField( 25 ).DoubleValue
// Function(s)...
E = recSet. IdxField( 25 ).DoubleValue // Opening till amount
txtOpenTotal.Value = E.ToText // Display the opening till amount for validation...
// Start with ones...
If( btnAddUpd.Caption = "Open Till" ) Then
frmTillCnts.mthCalculateOpenTill
Exit
Else
curConvert = txtOnes.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtOnes.Value.ToInteger
B = 1.00
C = A * B + D
D = C
txtCash.Value = C.ToText
txtCashGross.Value = C.ToText
txtTotal.Value = txtCash.Value
txtDailyGross.Value = txtCashGross.Value
End If
// Next with Fives...
curConvert = txtFives.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtFives.Value.ToInteger
B = 5.00
C = A * B + D
D = C
txtCash.Value = C.ToText
txtCashGross.Value = C.ToText
txtTotal.Value = txtCash.Value
txtDailyGross.Value = txtCashGross.Value
End If
// Next with Tens...
curConvert = txtTens.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtTens.Value.ToInteger
B = 10.00
C = A * B + D
D = C
txtCash.Value = C.ToText
txtCashGross.Value = C.ToText
txtTotal.Value = txtCash.Value
txtDailyGross.Value = txtCashGross.Value
End If
// Next with Twenties...
curConvert = txtTwenties.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtTwenties.Value.ToInteger
B = 20.00
C = A * B + D
D = C
txtCash.Value = C.ToText
txtCashGross.Value = C.ToText
txtTotal.Value = txtCash.Value
txtDailyGross.Value = txtCashGross.Value
End If
// Next with Fifties...
curConvert = txtFiftys.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtFiftys.Value.ToInteger
B = 50.00
C = A * B + D
D = C
txtCash.Value = C.ToText
txtCashGross.Value = C.ToText
txtTotal.Value = txtCash.Value
txtDailyGross.Value = txtCashGross.Value
End If
// Next with Hundreds...
curConvert = txtHundreds.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtHundreds.Value.ToInteger
B = 100.00
C = A * B + D
D = C
txtCash.Value = C.ToText
txtCashGross.Value = C.ToText
txtTotal.Value = txtCash.Value
txtDailyGross.Value = txtCashGross.Value
End If
//*****************************************************
' Change calculations...
//*****************************************************
// Next with Quarters...
curConvert = txtQuarters.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtQuarters.Value.ToInteger
B = 0.25
C = A * B + D
D = C
txtCash.Value = C.ToText
txtCashGross.Value = C.ToText
txtTotal.Value = txtCash.Value
txtDailyGross.Value =C.ToText
End If
// Next with Dimes...
curConvert = txtDimes.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtDimes.Value.ToInteger
B = 0.10
C = A * B + D
D = C
txtCash.Value = C.ToText
txtCashGross.Value = C.ToText
txtTotal.Value = txtCash.Value
txtDailyGross.Value = C.ToText
End If
// Next with Nickles...
curConvert = txtNickles.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtNickles.Value.ToInteger
B = 0.05
C = A * B + D
D = C
txtCash.Value = C.ToText
txtCashGross.Value = C.ToText
txtTotal.Value = txtCash.Value
txtDailyGross.Value = C.ToText
End If
// Next with Pennies...
curConvert = txtPennies.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtPennies.Value.ToInteger
B = 0.01
C = A * B + D
txtTotal.Value = C.ToText
txtCash.Value = C.ToText
C = C - E
D = C
txtCashGross.Value = C.ToText
txtDailyGross.Value = C.ToText
End If
// Credit Card list box...
For i As Integer = 0 To lstBoxCreditPurch.LastRowIndex
B = lstBoxCreditPurch.CellValueAt(lstBoxCreditPurch.SelectedRowIndex, 1 ).ToDouble
C = B + D
D = C
txtTotal.Value = txtCash.Value
txtDailyGross.Value = C.ToText
Next
I am stumped, I just finished a line by line review and cannot find anything anywhere that would account for this. I even deleted the field and created a new one from scratchâŠ
Your code follows a rigid structure like this for everything:
// Next with Nickles...
curConvert = txtNickles.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtNickles.Value.ToInteger
B = 0.05
C = A * B + D
D = C
txtCash.Value = C.ToText
txtCashGross.Value = C.ToText
txtTotal.Value = txtCash.Value
txtDailyGross.Value = C.ToText
End If
except pennies where it becomes
// Next with Pennies...
curConvert = txtPennies.Value.ToDouble
If( curConvert >= 1 ) Then
A = txtPennies.Value.ToInteger
B = 0.01
C = A * B + D
txtTotal.Value = C.ToText
txtCash.Value = C.ToText
C = C - E
D = C
txtCashGross.Value = C.ToText
txtDailyGross.Value = C.ToText
End If
I leave it to you to decide if this is correct (it just seems weird to me).
Pennies are the end of all cash calculations so I close out that section there with a couple changes. From there it moves to credit cards then checks then petty cash deductions.
What is strange is the credit card code and check code and petty cash code all will display the correct values. Itâs only in the cash section that I am having this discrepancy.
I think I am going to revise the code completely and use a different approach. See if that corrects the issue. I am already working on the pseudocode for the new method.