SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Strict On
  2. Option Explicit On
  3. Public Class Form2
  4.     Dim strfullname() As String
  5.     Private Sub btnDefault_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDefault.Click
  6.         txtName.Text = "Bryan Chau"
  7.         txtID.Text = "123456"
  8.         txtAdult.Text = "2"
  9.         txtKid.Text = "1"
  10.         txtStartDate.Text = CStr(Today)
  11.         optOutside.Checked = True
  12.         opt7.Checked = True
  13.         chkVIP.Checked = False
  14.         chkRestaurant.Checked = False
  15.         chkExcursion.Checked = True
  16.     End Sub
  17.     Private Function GenID() As String
  18.         strfullname = txtName.Text.Split(" "c)
  19.         Return strfullname(0).Substring(0, 1) + strfullname(1).Substring(0, 1) + txtID.Text.Substring(0, 3)
  20.     End Function
  21.     Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
  22.         Dim strFormat1 As String = "{0,-35}{1,13}"
  23.         Dim strFormat2 As String = "{0,-35}{1,13:c}"
  24.         Dim dtStart As Date = CDate(txtStartDate.Text)
  25.         Dim dtEnd As Date
  26.         Dim bytDay, bytAdult, bytKid As Byte
  27.         Dim dblCharge, dblCategory, dblPackage, dblV, dblE, dblR, dblAmt As Double
  28.         Dim strPackage As String
  29.         bytAdult = CByte(txtAdult.Text)
  30.         bytKid = CByte(txtKid.Text)
  31.         If opt7.Checked = True Then
  32.             bytDay = 7
  33.             dblCharge = 700
  34.             dblV = 100
  35.             dblR = 70
  36.             dblE = 200
  37.         Else
  38.             bytDay = 10
  39.             dblCharge = 900
  40.             dblV = 150
  41.             dblR = 100
  42.             dblE = 300
  43.         End If
  44.         dtEnd = DateAdd(DateInterval.Day, bytDay, dtStart)
  45.         If optInside.Checked = True Then
  46.             dblCategory = 0
  47.         End If
  48.         If optOutside.Checked = True Then
  49.             dblCategory = 20 * bytAdult * bytDay + 5 * bytKid * bytDay
  50.         End If
  51.         If optBalcony.Checked = True Then
  52.             dblCategory = 35 * bytAdult * bytDay + 10 * bytKid * bytDay
  53.         End If
  54.         If optDeluxe.Checked = True Then
  55.             dblCategory = 50 * bytAdult * bytDay + 20 * bytAdult * bytDay
  56.         End If
  57.         If chkVIP.Checked = True Then
  58.             dblPackage = dblV
  59.             strPackage = "V"
  60.         End If
  61.         If chkRestaurant.Checked = True Then
  62.             dblPackage = dblPackage + dblR
  63.             strPackage = strPackage + "R"
  64.         End If
  65.         If chkExcursion.Checked = True Then
  66.             dblPackage = dblPackage + dblE
  67.             strPackage = strPackage + "E"
  68.         End If
  69.         dblAmt = dblPackage + dblCategory + dblCharge
  70.         lstInvoice.Items.Clear()
  71.         lstInvoice.Items.Add(String.Format(strFormat1, "Printed on", txtStartDate.Text))
  72.         lstInvoice.Items.Add(String.Format(strFormat1, "Invoice ID", GenID))
  73.         lstInvoice.Items.Add(String.Format(strFormat1, "Cruise Starts on", txtStartDate.Text))
  74.         lstInvoice.Items.Add(String.Format(strFormat1, "Cruise ends on", dtEnd.ToShortDateString))
  75.         lstInvoice.Items.Add(String.Format(strFormat1, "Number of Adults", txtAdult.Text))
  76.         lstInvoice.Items.Add(String.Format(strFormat1, "Number of Kids", txtKid.Text))
  77.         lstInvoice.Items.Add(String.Format(strFormat2, "Cruise basic charge", dblCharge))
  78.         lstInvoice.Items.Add(String.Format(strFormat2, "Cruise category charge", dblCategory))
  79.         lstInvoice.Items.Add(String.Format(strFormat2, "Cruise package charge", dblPackage))
  80.         lstInvoice.Items.Add(String.Format(strFormat1, "Packages", strPackage))
  81.         lstInvoice.Items.Add(" ")
  82.         lstInvoice.Items.Add(String.Format(strFormat2, "Total Charges", dblAmt))
  83.     End Sub
  84.     Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
  85.         Me.Close()
  86.  
  87.     End Sub
  88. End Class
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top