Private Sub txtSPRDiscount_Change()
Dim SPRTemp As Single ' for temporary storage of SPRDiscount
lstProgram.Enabled = False
If txtSPRDiscount <> "" Then SPRTemp = rPlace(txtSPRDiscount)
If Not IsNull(SPRTemp) Then
If IsNumeric(SPRTemp) Then
If SPRTemp > 0 And SPRTemp < 100 Then
SPRChange = True
SPR2 = Val(Replace(txtSPRDiscount, "%", "")) / 100
If Not performComputeData Then ' Compute Data based from the SPR input
Debug.Print "Error Computing Data"
Else ' if there's no error lstProgram will be enabled and function performComputeData will be initiated
SPRTemp = SPRTemp / 100
performComputeData
'---- Update out_03_DealConfigs based from SPR changes ----
performMoveData
editSPRTruckNotes txtNumber, ModelID, currConfigID, _
"SPR=" & SPRTemp & _
", DealerNet=" & FinalDealerNet & _
", FinalCost=" & FinalCost & _
", FinalCurrentCost=" & FinalCurrentCost & _
", FinalGoingToCost=" & FinalGoingToCost & _
", Margin=" & FinalMargin & _
", CurrentMargin=" & FinalCurrentMargin & _
", GoingToMargin=" & FinalGoingToMargin & _
", MarginPercent=" & AdjustMarginPercent & _
", CurrentMarginPercent=" & AdjustCurrentMarginPercent & _
", GoingToMarginPercent=" & AdjustGoingToMarginPercent
SPR2 = SPRTemp
lstProgram.Enabled = True
End If
Else
txtSPR = 0
End If
End If
End If
MsgBox Val(SPRTemp)
End Sub
Function editSPRTruckNotes(ByVal DealNumber As String, ByVal ModelID As Long, _
ByVal ConfigId As Long, ByVal editString As String)
'---- Function that will edit SPR in out_03_DealConfigs -----
Dim rs As Recordset
Dim dbObj As New dbFunctions
Dim i As Integer
dbObj.dbProp = strConn
mSQL = "SELECT * FROM out_03_DealConfigs WHERE DealNo = '" & DealNumber & "' AND " & _
" ModelID = " & ModelID & " AND ConfigurationID = " & ConfigId
Set rs = dbObj.getRS(mSQL, isException, errDesc)
If isException = 0 Then
If Not rs.EOF Then
If Not dbObj.editRecord("out_03_DealConfigs", editString, "DealNo = '" & DealNumber & "' AND " & _
" ModelID = " & ModelID & " AND ConfigurationID = " & ConfigId, errDesc) Then
Debug.Print "Error Editing SPR"
End If
End If
End If
Set rs = Nothing
Set dbObj = Nothing
End Function