Simple Flight Billing System using VB.Net

The program will accept if it is First class, Economy or Third Class and the Insurance or Luggage, a simple receipt is also include using the textbox and a checkbox for Tax. The receipt will save with the extension file of (.txt).

Output:


Source Code:

Imports System.Drawing.Printing
Public Class Form1
    Dim mcSubtotal As Double
    Dim mcTotal As Double
    Const cFirstClass = 250
    Const cEconomy = 200
    Const cThirdClass = 150
    Const ccTravelInsurance = 10
    Const ccCostLuggage = 5
    Const taxrate = 0.7
    Dim a, s, f, op As Double
    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        Dim cPrice, ePrice, dPrice As Double
        Dim jLength, iLength, kLength As Double
        Dim iTotalLabor, iTotalTravel As Double
        Dim bItemAmount, cItemAmount, dItemAmount, eItemAmount As Double
        Dim cTotalLabor, cTotalTravel, cTax As Double
        If chkFirst.Checked = True Then
            cPrice = cFirstClass
        End If
        If chkEconomy.Checked = True Then
            dPrice = cEconomy
        End If
        If chkThird.Checked = True Then
            ePrice = cThirdClass
        End If

        If IsNumeric(txtFirst.Text) Then
            iLength = Val(txtFirst.Text)
            cItemAmount = cPrice * iLength
            bItemAmount = cItemAmount + dItemAmount + eItemAmount
        End If
        If IsNumeric(txtEconomy.Text) Then
            jLength = Val(txtEconomy.Text)
            dItemAmount = dPrice * jLength
            bItemAmount = cItemAmount + dItemAmount + eItemAmount
        End If
        If IsNumeric(txtThird.Text) Then
            kLength = Val(txtThird.Text)
            eItemAmount = ePrice * kLength
            bItemAmount = cItemAmount + dItemAmount + eItemAmount
        End If
        If chkFirst.Checked = True Then
        ElseIf chkThird.Checked = True Then
        ElseIf chkEconomy.Checked = True Then
        Else : MsgBox("Please select an option", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Warning")
        End If

        If IsNumeric(txtInsurance.Text) Then
            iTotalLabor = Val(txtInsurance.Text)
            cTotalLabor = ccTravelInsurance * iTotalLabor
        Else
            MsgBox("Please enter Insurance Details", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Warning")
        End If
        If IsNumeric(txtLuggage.Text) Then
            iTotalTravel = Val(txtLuggage.Text)
            cTotalTravel = ccCostLuggage * iTotalTravel
        Else
            MsgBox("Please enter Luggage Details", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Warning")
            txtLuggage.Focus()
        End If
        If chkTax.Checked = True Then
            cTax = cFindTax(bItemAmount)
        End If
        mcSubtotal = bItemAmount + cTotalLabor + cTotalTravel
        mcTotal = mcSubtotal + cTax
        lblItemAmount.Text = FormatCurrency$(bItemAmount + cTax)
        lblTotalLabor.Text = FormatCurrency$(cTotalLabor)
        lblTotalTravel.Text = FormatCurrency$(cTotalTravel)
        lblSubTotal.Text = FormatCurrency$(mcSubtotal)
        lblTax.Text = FormatCurrency$(cTax)
        lblTotal.Text = FormatCurrency$(mcTotal)
        Dim Hours, Miles As String
        Dim Plastic, Copper, Chrome As Double
        Dim Name(10), ItemNumber(10) As String
        Dim x As Integer
        txtReceiptPrint.AppendText(" " + vbNewLine)
        Name(1) = txtFirst.Text
        Name(2) = txtEconomy.Text
        Name(3) = txtThird.Text
        Name(4) = txtInsurance.Text
        Name(5) = txtLuggage.Text
        ItemNumber(1) = chkFirst.Text
        ItemNumber(2) = chkEconomy.Text
        ItemNumber(3) = chkThird.Text
        ItemNumber(4) = lblInsurance.Text
        ItemNumber(5) = lblLuggage.Text
        Plastic = Val(txtFirst.Text) * cPrice
        Copper = Val(txtEconomy.Text) * dPrice
        Chrome = Val(txtThird.Text) * ePrice
        Hours = Val(txtInsurance.Text) * ccTravelInsurance
        Miles = Val(txtLuggage.Text) * ccCostLuggage
        txtReceiptPrint.AppendText(" " + vbNewLine)
        txtReceiptPrint.AppendText(vbTab + vbTab + vbTab + "Capt. John Smith" + vbNewLine)
        txtReceiptPrint.AppendText("========================================================" + vbNewLine)
        txtReceiptPrint.AppendText(vbTab + vbTab + vbTab + "Up and Up, Fly!" + vbNewLine)
        txtReceiptPrint.AppendText("========================================================" + vbNewLine)
        txtReceiptPrint.AppendText(" " + vbNewLine)
        For x = 1 To 5
            txtReceiptPrint.AppendText(vbTab + ItemNumber(x) + vbTab + vbTab + vbTab + Name(x) + vbTab + vbNewLine)
        Next x
        txtReceiptPrint.AppendText(" " + vbNewLine)
        txtReceiptPrint.AppendText(vbTab & "Sub Total: " + vbTab + vbTab + lblSubTotal.Text + vbNewLine)
        txtReceiptPrint.AppendText(vbTab & "Tax: " + vbTab + vbTab + vbTab + lblTax.Text + vbNewLine)
        txtReceiptPrint.AppendText(vbTab & "Total Amount: " + vbTab + vbTab + lblTotal.Text + vbNewLine)
        txtReceiptPrint.AppendText(" " & vbNewLine)
        txtReceiptPrint.AppendText("========================================================" + vbNewLine)
        'txtReceiptPrint.AppendText(txtNotes.Text + vbNewLine)
        txtReceiptPrint.AppendText("========================================================" + vbNewLine)
        txtReceiptPrint.AppendText(" " & vbNewLine)
        txtReceiptPrint.AppendText(vbTab & Today & vbTab & TimeOfDay + vbNewLine)
        txtReceiptPrint.AppendText("========================================================" + vbNewLine)
        txtReceiptPrint.AppendText("=T=H=A=N=K==Y=O=U==F=O=R==F=L=Y=I=N=G==W=I=T=H==U=S=" + vbNewLine)
        txtReceiptPrint.AppendText("========================================================" + vbNewLine)
    End Sub
    Private Function cFindTax(ByVal bItemAmount As Double) As Double
        cFindTax = bItemAmount * taxrate
    End Function
    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim savedata As New SaveFileDialog()
        savedata.FileName = "Order Number 000000"
        savedata.Filter = "txt files (*.txt)|*.txt"
        savedata.FilterIndex = 2
        savedata.RestoreDirectory = False
        If savedata.ShowDialog() = DialogResult.OK Then
            IO.File.WriteAllText(savedata.FileName, txtReceiptPrint.Text)
        End If
    End Sub
 
    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        chkEconomy.Checked = False
        chkFirst.Checked = False
        chkTax.Checked = False
        chkThird.Checked = False
        txtEconomy.Clear()
        txtFirst.Clear()
        txtInsurance.Clear()
        txtLuggage.Clear()
        txtReceiptPrint.Clear()
        txtThird.Clear()
        lblItemAmount.Text = "0.00"
        lblTotalLabor.Text = "0.00"
        lblTotalTravel.Text = "0.00"
        lblSubTotal.Text = "0.00"
        lblTax.Text = "0.00"
        lblTotal.Text = "0.00"
    End Sub
    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub
End Class

DOWNLOAD LINK: Billingvb2010.rar


Simple Flight Billing System using VB.Net Simple Flight Billing System using VB.Net Reviewed by code-dev on 3:57 PM Rating: 5

3 comments:

Powered by Blogger.