SHARE
TWEET

Untitled

a guest Jan 18th, 2019 66 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 Form1
  4.     Dim strfullname() As String
  5.     Private Sub btnDefault_Click(sender As System.Object, e As System.EventArgs) Handles btnDefault.Click
  6.         txtName.Text = "Bryan Chau"
  7.         txtMonth.Text = "6"
  8.         txtID.Text = "123456789"
  9.         txtStart.Text = CStr(Today)
  10.         optTpart.Checked = True
  11.         optPfull.Checked = True
  12.         chkMeal.Checked = False
  13.         chkCare.Checked = False
  14.         txtToddler.Text = "1"
  15.         txtPreschooler.Text = "1"
  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, 4)).ToUpper
  20.     End Function
  21.     Private Function GenName() As String
  22.         strfullname = txtName.Text.Split(" "c)
  23.         Return (strfullname(1) + ", " + strfullname(0))
  24.     End Function
  25.     Private Sub btnCompute_Click(sender As System.Object, e As System.EventArgs) Handles btnCompute.Click
  26.         Dim strFormat1 As String = "{0,-35}{1,13}"
  27.         Dim strFormat2 As String = "{0,-35}{1,13:c2}"
  28.         Dim dtStart, dtEnd As Date
  29.         Dim bytMonth As Byte = CByte(txtMonth.Text)
  30.         Dim bytToddler, bytPreschooler As Byte
  31.         Dim dblMeal, dblCare As Double
  32.         Dim strMeal, strCare As String
  33.         Dim dblToddlerAmt, dblPreschoolerAmt, dblTotalAmt As Double
  34.         dtStart = CDate(txtStart.Text)
  35.         dtEnd = DateAdd(DateInterval.Month, bytMonth, dtStart)
  36.         bytToddler = CByte(txtToddler.Text)
  37.         bytPreschooler = CByte(txtPreschooler.Text)
  38.         If chkMeal.Checked = True Then
  39.             dblMeal = 150 * bytMonth * bytToddler + 200 * bytMonth * bytPreschooler
  40.             strMeal = "Meal plan Required"
  41.         Else
  42.             dblMeal = 0
  43.             strMeal = "Meal plan not needed"
  44.         End If
  45.         If chkCare.Checked = True Then
  46.             dblCare = 100 * bytMonth * (bytToddler + bytPreschooler)
  47.             strCare = "After school care required"
  48.         Else
  49.             dblCare = 0
  50.             strCare = "After school care not needed"
  51.         End If
  52.         If optTFull.Checked = True Then
  53.             dblToddlerAmt = 300 * bytToddler * bytMonth
  54.         Else
  55.             dblToddlerAmt = 200 * bytToddler * bytMonth
  56.         End If
  57.         If optPfull.Checked = True Then
  58.             dblPreschoolerAmt = 450 * bytPreschooler * bytMonth
  59.         Else
  60.             dblPreschoolerAmt = 400 * bytPreschooler * bytMonth
  61.         End If
  62.         dblTotalAmt = dblPreschoolerAmt + dblToddlerAmt + dblCare + dblMeal
  63.         lstInvoice.Items.Clear()
  64.         lstInvoice.Items.Add(String.Format(strFormat1, "Invoice ID ", GenID))
  65.         lstInvoice.Items.Add(String.Format(strFormat1, "Parent Name", GenName))
  66.         lstInvoice.Items.Add(String.Format(strFormat1, "Start Date ", FormatDateTime(dtStart, DateFormat.ShortDate)))
  67.         lstInvoice.Items.Add(String.Format(strFormat1, "End Date ", FormatDateTime(dtEnd, DateFormat.ShortDate)))
  68.         lstInvoice.Items.Add(String.Format(strFormat1, "Number of Toddlers", txtToddler.Text))
  69.         lstInvoice.Items.Add(String.Format(strFormat1, "Number of Preschoolers", txtPreschooler.Text))
  70.         lstInvoice.Items.Add(String.Format(strFormat2, strMeal, dblMeal))
  71.         lstInvoice.Items.Add(String.Format(strFormat2, strCare, dblCare))
  72.         lstInvoice.Items.Add(String.Format(strFormat2, "Toddler amt", dblToddlerAmt))
  73.         lstInvoice.Items.Add(String.Format(strFormat2, "Preschooler amt", dblPreschoolerAmt))
  74.         lstInvoice.Items.Add(" ")
  75.         lstInvoice.Items.Add(String.Format(strFormat2, "Total amt", dblTotalAmt))
  76.     End Sub
  77. 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