Vote count:
0
Is anyone able to help me convert this code (from a windows EXE) into JavaScript to run from a webpage? I've been given the code (that I didn't create) and asked to turn it into a web accessible version.
The app (and the webpage) is a form with 7 user entry fields, which then calculates a figure and produces a response.
I have the web form created with the fields and the submit button configured to run JavaScript, but don't know where to start with regards to turning the code in JavaScript.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'When form loads process the following into variables
boilertype(1) = "WM1"
boilertype(2) = "WM2"
boilertype(3) = "WM3"
boilertype(4) = "WM4"
boilertype(5) = "WM5"
boilertype(6) = "WM6"
boilertype(7) = "FS1"
boilertype(8) = "FS2"
boilertype(9) = "FS3"
boilertype(10) = "FS4"
boilertype(11) = "BB1"
boilertype(12) = "BB2"
boilertype(13) = "BB3"
' Wall Mounted Conventional Flue per age costs
boilervalue(1, 1) = 570.0
boilervalue(1, 2) = 513.0
boilervalue(1, 3) = 461.7
boilervalue(1, 4) = 415.53
boilervalue(1, 5) = 373.98
boilervalue(1, 6) = 336.58
boilervalue(1, 7) = 302.92
boilervalue(1, 8) = 272.63
boilervalue(1, 9) = 245.37
boilervalue(1, 10) = 220.83
' Wall Mounted Balanced Flue per age costs
boilervalue(2, 1) = 570.0
boilervalue(2, 2) = 513.0
boilervalue(2, 3) = 461.7
boilervalue(2, 4) = 415.53
boilervalue(2, 5) = 373.98
boilervalue(2, 6) = 336.58
boilervalue(2, 7) = 302.92
boilervalue(2, 8) = 272.63
boilervalue(2, 9) = 245.37
boilervalue(2, 10) = 220.83
' Wall Mounted Fan Flue per age costs
boilervalue(3, 1) = 617.0
boilervalue(3, 2) = 555.75
boilervalue(3, 3) = 500.18
boilervalue(3, 4) = 450.16
boilervalue(3, 5) = 405.14
boilervalue(3, 6) = 364.63
boilervalue(3, 7) = 328.16
boilervalue(3, 8) = 295.35
boilervalue(3, 9) = 265.81
boilervalue(3, 10) = 239.23
' Wall Mounted Combination per age costs
boilervalue(4, 1) = 641.5
boilervalue(4, 2) = 577.35
boilervalue(4, 3) = 519.62
boilervalue(4, 4) = 467.65
boilervalue(4, 5) = 420.89
boilervalue(4, 6) = 378.8
boilervalue(4, 7) = 340.92
boilervalue(4, 8) = 306.83
boilervalue(4, 9) = 276.14
boilervalue(4, 10) = 248.53
' Wall Mounted Condensing per age costs
boilervalue(5, 1) = 736.5
boilervalue(5, 2) = 662.85
boilervalue(5, 3) = 596.57
boilervalue(5, 4) = 536.91
boilervalue(5, 5) = 483.22
boilervalue(5, 6) = 434.9
boilervalue(5, 7) = 391.41
boilervalue(5, 8) = 352.27
boilervalue(5, 9) = 317.04
boilervalue(5, 10) = 285.34
' Wall Mounted Condensing Combination per age costs
boilervalue(6, 1) = 784.0
boilervalue(6, 2) = 705.6
boilervalue(6, 3) = 635.04
boilervalue(6, 4) = 571.54
boilervalue(6, 5) = 514.38
boilervalue(6, 6) = 462.94
boilervalue(6, 7) = 416.65
boilervalue(6, 8) = 374.98
boilervalue(6, 9) = 337.49
boilervalue(6, 10) = 303.74
' Floor Standing Conventional Flue per age costs
boilervalue(7, 1) = 546.5
boilervalue(7, 2) = 491.85
boilervalue(7, 3) = 442.67
boilervalue(7, 4) = 398.4
boilervalue(7, 5) = 358.56
boilervalue(7, 6) = 322.7
boilervalue(7, 7) = 290.43
boilervalue(7, 8) = 261.39
boilervalue(7, 9) = 235.25
boilervalue(7, 10) = 211.73
' Floor Standing Balanced Flue per age costs
boilervalue(8, 1) = 570.0
boilervalue(8, 2) = 513.0
boilervalue(8, 3) = 461.7
boilervalue(8, 4) = 415.53
boilervalue(8, 5) = 373.98
boilervalue(8, 6) = 336.58
boilervalue(8, 7) = 302.92
boilervalue(8, 8) = 272.63
boilervalue(8, 9) = 245.37
boilervalue(8, 10) = 220.83
' Floor Standing Fan Flue per age costs
boilervalue(9, 1) = 594.0
boilervalue(9, 2) = 534.6
boilervalue(9, 3) = 481.14
boilervalue(9, 4) = 433.03
boilervalue(9, 5) = 389.72
boilervalue(9, 6) = 350.75
boilervalue(9, 7) = 315.68
boilervalue(9, 8) = 284.11
boilervalue(9, 9) = 255.7
boilervalue(9, 10) = 230.13
' Floor Standing Combination per age costs
boilervalue(10, 1) = 736.5
boilervalue(10, 2) = 662.85
boilervalue(10, 3) = 596.57
boilervalue(10, 4) = 536.91
boilervalue(10, 5) = 483.22
boilervalue(10, 6) = 434.9
boilervalue(10, 7) = 391.41
boilervalue(10, 8) = 352.27
boilervalue(10, 9) = 317.04
boilervalue(10, 10) = 285.34
' Back Boiler Standard per age costs
boilervalue(11, 1) = 617.5
boilervalue(11, 2) = 555.75
boilervalue(11, 3) = 500.18
boilervalue(11, 4) = 450.16
boilervalue(11, 5) = 405.14
boilervalue(11, 6) = 364.63
boilervalue(11, 7) = 328.16
boilervalue(11, 8) = 295.35
boilervalue(11, 9) = 265.81
boilervalue(11, 10) = 239.23
' Back Boiler Inset per age costs
boilervalue(12, 1) = 807.5
boilervalue(12, 2) = 726.75
boilervalue(12, 3) = 654.08
boilervalue(12, 4) = 588.67
boilervalue(12, 5) = 529.8
boilervalue(12, 6) = 476.82
boilervalue(12, 7) = 429.14
boilervalue(12, 8) = 386.22
boilervalue(12, 9) = 347.6
boilervalue(12, 10) = 312.84
' Back Boiler Boiler Only per age costs
boilervalue(13, 1) = 380.0
boilervalue(13, 2) = 342.0
boilervalue(13, 3) = 307.8
boilervalue(13, 4) = 277.02
boilervalue(13, 5) = 249.32
boilervalue(13, 6) = 224.39
boilervalue(13, 7) = 201.95
boilervalue(13, 8) = 181.75
boilervalue(13, 9) = 163.58
boilervalue(13, 10) = 147.22
' parts values
parts_id(1) = "PCB"
parts_id(2) = "FAN"
parts_id(3) = "GAS VALVE"
parts_id(4) = "APS"
parts_id(5) = "PUMP"
parts_id(6) = "DIVERTER VALVE"
parts_id(7) = "DIVERTER VALVE MOTOR"
parts_id(8) = "CH THERMISTOR"
parts_id(9) = "HW THERMISTOR"
parts_id(10) = "PRIMARY HEAT EX"
parts_id(11) = "PLATE HEAT EX"
parts_id(12) = "IGNITION ELECTRODE"
parts_id(13) = "FLAME SENS ELECTRODE"
parts_id(14) = "BURNER"
parts_id(15) = "BURNER SEALS"
parts_id(16) = "MANIFOLD"
parts_id(17) = "HARNESS"
parts_id(18) = "PRV"
parts_id(19) = "EXPANSION VESSEL"
parts_id(20) = "HT LEAD"
parts_id(21) = "HORIZONTAL FLUE"
parts_id(22) = "INTEGRAL TIME CLOCK"
parts_id(23) = "PRESSURE GAUGE"
parts_id(24) = "FILLING LOOP"
parts_value(1) = 200.0 'PCB
parts_value(2) = 140.0 'FAN
parts_value(3) = 120.0 'GAS VALVE
parts_value(4) = 30.0 'APS
parts_value(5) = 80.0 'PUMP
parts_value(6) = 90.0 'DIVERTER VALVE
parts_value(7) = 60.0 'MOTOR FOR DIVERTER VALVE
parts_value(8) = 20.0 'CH THERMISTOR
parts_value(9) = 20.0 'HW THERMISTOR
parts_value(10) = 400.0 'PRIMARY HEAT EX
parts_value(11) = 120.0 'PLATE HEAT EX
parts_value(12) = 30.0 'IGNITION ELECTRODE
parts_value(13) = 30.0 'FLAME SENS ELECTRODE
parts_value(14) = 90.0 'BURNER
parts_value(15) = 20.0 'BURNER SEALS
parts_value(16) = 140.0 'MANIFOLD
parts_value(17) = 50.0 'HARNESS
parts_value(18) = 15.0 'PRV
parts_value(19) = 120.0 'EXPANSION VESSEL
parts_value(20) = 20.0 'HT LEAD
parts_value(21) = 70.0 'HORIZONTAL FLUE
parts_value(22) = 60.0 'INTEGRAL TIME CLOCK
parts_value(23) = 20.0 'PRESSURE GAUGE
parts_value(24) = 30.0 'FILLING LOOP
End Sub
Private Sub CmdProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdProcess.Click
'Variables
Dim boiler_code$, fnd$, partsfnd$, btype%, age%, parts%, partsb%, partsc%, partsd%, labour%, total_parts, total_gross_cost, vat, total_net_cost, partsone$, partstwo$, partsthree$, partsfour$
Dim parts_txt$
boiler_code = Mid(CmboBoilerType.Text, 1, 3)
fnd$ = "False"
For btype% = 1 To 13
If boiler_code = boilertype(btype%) Then
fnd$ = "True"
Exit For
End If
Next
' Validation
If fnd$ = "False" Then
MsgBox("Please enter boiler type")
Exit Sub
End If
'Validation
If CmboAge.Text = "" Then
MsgBox("Please enter age")
Exit Sub
ElseIf CmboAge.Text = "10+" Then
age% = 10
Else
age% = Val(CmboAge.Text)
End If
'Validation
If CmboLabour.Text = "" Then
MsgBox("Please enter hours labour")
Exit Sub
Else
labour% = Val(CmboLabour.Text)
End If
TxtBerLimit.Text = boilervalue(btype%, age%)
' parts_sel$(parts% + 1) = "Y"
' total_parts = total_parts + parts_value(parts% + 1)
'parts1 combo box
total_parts = get_parts_val(CmboParts1.Text) + get_parts_val(CmboParts2.Text) + get_parts_val(CmboParts3.Text) + get_parts_val(CmboParts4.Text)
If total_parts = 0 Then
MsgBox("please make a parts selection")
Exit Sub
End If
'For parts% = 1 To 24
' parts_sel$(parts%) = "N"
'Next
'total_parts = 0
'For parts% = 0 To CmboParts1.Items.Count - 1
' If CmboParts1.GetItemCheckState(parts%) = CheckState.Checked Then
' parts_sel$(parts% + 1) = "Y"
' total_parts = total_parts + parts_value(parts% + 1)
' End If
'Next
'Calculating total cost
total_net_cost = total_parts + labour% * 35 + 60
vat = total_net_cost * 0.2
total_gross_cost = total_net_cost + vat
TxtTotal.Text = total_gross_cost
'Displaying BER Descison
If total_gross_cost > boilervalue(btype%, age%) Then
MsgBox("Boiler BER please leave letter")
Else
MsgBox("Fine to order parts")
End If
End Sub
Private Sub CmdClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdClear.Click
'Clear all date from fields
CmboBoilerType.SelectedIndex = -1
CmboAge.SelectedIndex = -1
CmboParts1.SelectedIndex = -1
CmboParts2.SelectedIndex = -1
CmboParts3.SelectedIndex = -1
CmboParts4.SelectedIndex = -1
CmboLabour.SelectedIndex = -1
TxtBerLimit.Text = ""
TxtTotal.Text = ""
End Sub
Private Function get_parts_val(ByVal parts_txt)
Dim parts%
get_parts_val = 0
For parts% = 1 To 24
If parts_txt = parts_id(parts%) Then
get_parts_val = parts_value(parts%)
Exit For
End If
Next
End Function
End Class
In a module
Module Module2
Public boilertype(30)
Public boilervalue(30, 10)
Public parts_sel$(40)
Public parts_id(24), parts_value(40)
Public labour_cost(24)
End Module
asked 42 secs ago
convert visual basic app to javascript
Aucun commentaire:
Enregistrer un commentaire