Click here to Skip to main content
15,887,326 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: file reading and writing problems Pin
Expert Coming15-Mar-09 5:45
Expert Coming15-Mar-09 5:45 
AnswerRe: file reading and writing problems Pin
StarTrekCafe15-Mar-09 16:04
StarTrekCafe15-Mar-09 16:04 
AnswerRe: file reading and writing problems Pin
StarTrekCafe15-Mar-09 18:06
StarTrekCafe15-Mar-09 18:06 
QuestionNot Gorogrian Calander In Asp.net Pin
Mohamed Ibrahim Omar15-Mar-09 0:25
Mohamed Ibrahim Omar15-Mar-09 0:25 
AnswerRe: Not Gorogrian Calander In Asp.net Pin
Mustafa Ismail Mustafa15-Mar-09 3:49
Mustafa Ismail Mustafa15-Mar-09 3:49 
General[Message Deleted] Pin
Mohamed Ibrahim Omar15-Mar-09 20:43
Mohamed Ibrahim Omar15-Mar-09 20:43 
GeneralRe: Not Gorogrian Calander In Asp.net Pin
Mohamed Ibrahim Omar15-Mar-09 20:43
Mohamed Ibrahim Omar15-Mar-09 20:43 
Questionvb mail project problems Pin
StarTrekCafe15-Mar-09 0:25
StarTrekCafe15-Mar-09 0:25 
Hi. got a project where you enter details for an order, name, address, city, state, zip code, description, quantity, weight and price, then you click the add this button, which adds individual items to an order. then it calculates individual items. then you click the up date summary button, and then calculate all items for the entire order. then it displays the dollar amount, sales tax, if shipped to a california address, and is 8% of the total price, shows the shipping charge for a given weight. and then the total amount. the problem, is not showing the correct dollar amount, sales tax, if i put in the state which is:
CA, not showing the correct amount. what am i doing wrong? can any one help me to get this working? any suggestions, code samples, code snippets would be fine. cheers Marvin.

'Program: VBMail
'Programmer: Marvin Hunkin
'Date: Tuesday Febuary 24 2009
'Description: Keep track of mail orders


Partial Class VBMail
Inherits System.Web.UI.Page


'Declare Constants


Const Handling As Decimal = 0.25


'Declare Module Level Variables

Dim intTotalWeightShipped As Integer = 0
Dim decTotalPriceCharged As Decimal = 0.0


Protected Sub btnAddThisButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddThisButton.Click


'Declare Variables


Dim intItemQuantity As Integer = 0
Dim intItemWeight As Integer = 0
Dim intTotalOrderWeight As Integer = 0
Dim decItemPrice As Decimal = 0.0
Dim decTotalOrderPrice As Decimal = 0.0
Dim decShippingCharge As Decimal = 0.0
Dim decHandling As Decimal = 0.0
Dim decTax As Decimal = 0.0
Dim decTotalAmount As Decimal = 0.0



'Convert Variables


intItemQuantity = integer.parse(tbQuantityTextbox.Text)
intItemWeight = integer.Parse(tbWeightTextBox.Text)
decItemPrice = decimal.parse(tbPriceTextBox.Text)



'Calculate Items


decTotalOrderPrice = intItemQuantity * decItemPrice
intTotalOrderWeight = intItemQuantity * intItemWeight
decTotalPriceCharged = decTotalPriceCharged + decTotalOrderPrice
intTotalWeightShipped = intTotalWeightShipped + intTotalOrderWeight


tbPriceTextBox.Text = decItemPrice.ToString("C")
tbNameTextBox.Focus()


End Sub

Protected Sub btnClearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClearButton.Click


'Clear Text Boxes


tbNameTextBox.Text = ""
tbAddressTextBox.Text = ""
tbCityTextBox.Text = ""
tbStateTextBox.Text = ""
tbZipCodeTextBox.Text = ""
tbDescriptionTextBox.Text = ""
tbQuantityTextBox.Text = ""
tbWeightTextBox.Text = ""
tbPriceTextBox.Text = ""
tbDollarAmountTextBox.Text = ""
tbSalesTaxTextBox.Text = ""
tbShippingChargeTextBox.Text = ""
tbTotalAmountTextBox.Text = ""
decTotalPriceCharged =0.0
intTotalWeightShipped = 0
tbNameTextBox.Focus()


End Sub

Protected Sub btnSummaryButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSummaryButton.Click


Dim strState As String = "CA"
Dim intItemWeight As Integer = 0
Dim intTotalOrderWeight As Integer = 0
Dim decTotalOrderPrice As Decimal = 0.0
Dim decItemPrice As Decimal = 0.0
Dim decShippingCharge As Decimal = 0.0
Dim decTotalAmount As Decimal = 0.0


'Check For shipping Charge


If intTotalWeightShipped < 10 Then
decShippingCharge = 1.0
ElseIf (intTotalWeightShipped > 10) And (intTotalWeightShipped <= 100) Then
decShippingCharge = 3.0
ElseIf intTotalWeightShipped > 100 Then
decShippingCharge = 5.0


End If


' Calculate Tax


Dim decTax As Decimal = 0.0


If tbStateTextBox.Text = "CA" Then


decTax = decTotalPriceCharged * 0.08
Else
decTax = 0.0


End If


'Calculate Total Order


Dim decTotalAmountWithExpenses As Decimal = 0.0


decTotalAmountWithExpenses = decTotalPriceCharged + decTax + decShippingCharge


'Format Text Boxes


tbDollarAmountTextBox.Text = decTotalPriceCharged.ToString("C")
tbSalesTaxTextBox.Text = decTax.ToString("C")
tbShippingChargeTextBox.Text = decShippingCharge.ToString("C")
tbTotalAmountTextBox.Text = decTotalAmountWithExpenses.ToString("C")
tbNameTextBox.Focus()


End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


'Declare Variables


Dim strState As String = "CA"
Dim intItemWeight As Integer = 0
Dim intTotalOrderWeight As Integer = 0
Dim decTotalOrderPrice As Decimal = 0.0
Dim decItemPrice As Decimal = 0.0
Dim decShippingCharge As Decimal = 0.0
Dim decTotalAmount As Decimal = 0.0


'Check For shipping Charge


If intTotalWeightShipped < 10 Then
decShippingCharge = 1.0
ElseIf (intTotalWeightShipped > 10) And (intTotalWeightShipped <= 100) Then
decShippingCharge = 3.0
ElseIf intTotalWeightShipped > 100 Then
decShippingCharge = 5.0


End If


' Calculate Tax


Dim decTax As Decimal = 0.0


If tbStateTextBox.Text = "CA" Then


decTax = decTotalPriceCharged * 0.08
Else
decTax = 0.0


End If


decTax = session("SavedSalesTax")


'Calculate Total Order


Dim decTotalAmountWithExpenses As Decimal = 0.0


decTotalAmountWithExpenses = decTotalPriceCharged + decTax + decShippingCharge

decTotalAmountWithExpenses = session("SavedTotalAmountWithExpenses")



session("SavedTotalPriceCharged ") = decTotalPriceCharged
session("SavedSalesTax") = decTax
session("SavedShippingCharge") = decShippingCharge
session("SavedTotalAmountWithExpenses") = decTotalAmountWithExpenses




End Sub
End Class
AnswerRe: vb mail project problems Pin
Christian Graus15-Mar-09 9:59
protectorChristian Graus15-Mar-09 9:59 
Questiontickets Project Help Pin
StarTrekCafe15-Mar-09 0:11
StarTrekCafe15-Mar-09 0:11 
AnswerRe: tickets Project Help Pin
Christian Graus15-Mar-09 10:08
protectorChristian Graus15-Mar-09 10:08 
AnswerRe: tickets Project Help Pin
StarTrekCafe15-Mar-09 13:33
StarTrekCafe15-Mar-09 13:33 
AnswerRe: tickets Project Help Pin
StarTrekCafe15-Mar-09 13:35
StarTrekCafe15-Mar-09 13:35 
QuestionLogin Project Problems Pin
StarTrekCafe15-Mar-09 0:02
StarTrekCafe15-Mar-09 0:02 
AnswerRe: Login Project Problems Pin
Abhijit Jana15-Mar-09 2:13
professionalAbhijit Jana15-Mar-09 2:13 
GeneralRe: Login Project Problems Pin
Colin Angus Mackay15-Mar-09 3:05
Colin Angus Mackay15-Mar-09 3:05 
AnswerRe: Login Project Problems Pin
StarTrekCafe15-Mar-09 13:41
StarTrekCafe15-Mar-09 13:41 
Questionproblem in cast value from money to decimal Pin
Sneha Bisht14-Mar-09 23:34
Sneha Bisht14-Mar-09 23:34 
AnswerRe: problem in cast value from money to decimal Pin
Colin Angus Mackay15-Mar-09 3:10
Colin Angus Mackay15-Mar-09 3:10 
Questionasp.net grid view [modified] Pin
PleaseHelpCP14-Mar-09 22:12
PleaseHelpCP14-Mar-09 22:12 
AnswerRe: asp.net grid view Pin
Christian Graus14-Mar-09 22:36
protectorChristian Graus14-Mar-09 22:36 
GeneralRe: asp.net grid view Pin
Alok Sharma ji15-Mar-09 17:55
Alok Sharma ji15-Mar-09 17:55 
Questionproblem in updating database via datagrid Pin
rosae61914-Mar-09 21:28
rosae61914-Mar-09 21:28 
AnswerRe: problem in updating database via datagrid Pin
Christian Graus14-Mar-09 21:44
protectorChristian Graus14-Mar-09 21:44 
Questioncan onblur method of javascript is also possible in c#.net scripting i am trying it but it not works have any similar method there ? Pin
Alok Sharma ji14-Mar-09 11:49
Alok Sharma ji14-Mar-09 11:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.