aturner51
Posts: 6
|
| Posted: 03/11/2005, 7:02 AM |
|
I have created a Receipt form that has a detail section much like an order form that allows a user to enter quantity, select an item from a drop down listbox, enter a feecost (textbox), fee total and extended total. The user wants the ability to select an item from the drop down and automatically populate the feecost with the cost of the item.
I am currently using Code Charge Studio 2.3.2.24 and building the application using ASP and MS SQL.
Here is the table design:
CREATE TABLE [dbo].[ReceiptDetails] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[ReceiptID] [int] NULL ,
[FeeType] [varchar] (75) ,
[FeeCost] [money] NULL ,
[FeeQty] [numeric](18, 0) NULL ,
[FeeTotal] [money] NULL ,
[Waived] [bit] NULL ,
[WaivedReason] [varchar] (512)
) ON [PRIMARY]
GO
I have also written custom code to insert and update calculations performed based upon the user entering a quantity, select an item from the list box and entering a fee cost based upon the fields shown above.
Here is the update code:
'fees1 UpdateRow Method @17-8E71B481
Function UpdateRow()
CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeUpdate", Me)
If NOT UpdateAllowed Then UpdateRow = False : Exit Function
DataSource.feeqty.Value = feeqty.Value
DataSource.feetype.Value = feetype.Value
DataSource.feecost.Value = feecost.Value
DataSource.total.Value = total.Value
'-------Custom code--------------
'DataSource.feecost.Value = CCDLookUp("feecost","feetypes","feetype='" & feetype.value & "'", DBIPRBKUP)
'DataSource.total.Value = feeqty.value * DataSource.feecost.Value
if waive.value = 0 then
DataSource.feecost.Value = CCDLookUp("feecost","feetypes","feetype='" & feetype.value & "'", DBIPRBKUP)
DataSource.total.Value = feeqty.value * DataSource.feecost.Value
else
DataSource.feecost.value = 0
DataSource.total.Value = 0
end if
'--------------------------------
DataSource.ReceiptID.Value = ReceiptID.Value
DataSource.waive.Value = waive.Value
DataSource.reason.Value = reason.Value
DataSource.Update(Command)
CCSEventResult = CCRaiseEvent(CCSEvents, "AfterUpdate", Me)
If DataSource.Errors.Count > 0 Then
Errors.AddErrors(DataSource.Errors)
DataSource.Errors.Clear
End If
UpdateRow = (Errors.Count = 0)
End Function
'End fees1 UpdateRow Method
I hope the explanation is clear.
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/11/2005, 10:08 AM |
|
Hi,
I think that the same topic was recently posted at http://forums.codecharge.com/posts.php?post_id=57085
Not much there but may answer your question.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
|