private void btnPrint_Click(object sender, EventArgs e) { cCustomer iCustomer = new cCustomer(); RentClass iRent = new RentClass(); cUtilities iUtilities = new cUtilities(); ExpensesClass expenses = new ExpensesClass(); //Linking methods created in expenses class with textboxes expenses.theClothing = Double.Parse(txtClothing.Text); expenses.theElectricity = Double.Parse(txtElectricity.Text); expenses.theEntertainment = Double.Parse(txtEntertainment.Text); expenses.theGroceries = Double.Parse(txtGroceries.Text); expenses.theInvestment = Double.Parse(txtInvestments.Text); expenses.thePhone = Double.Parse(txtPhone.Text); expenses.theTransport = Double.Parse(txtTTransport.Text); expenses.theWater = Double.Parse(txtWater.Text); expenses.theTax = Double.Parse(txtTax.Text); expenses.theGrossIncome = Double.Parse(txtGross.Text); //Calculations String t = String.Format("{0:C}", expenses.theClothing + expenses.theElectricity + expenses.theEntertainment + expenses.theGroceries + expenses.theInvestment + expenses.thePhone + expenses.theTax + expenses.theTransport + expenses.theWater); txtTotal.Text = t; //the software will printout this as a reciept rptExpenses.AppendText("\t\tMY EXPENSES" + "\n" + "---------------------------------------------" + "\n"); rptExpenses.AppendText("Clothing" + "\t\t\t" + txtClothing.Text + "\n"); rptExpenses.AppendText("Electricity" + "\t\t\t" + txtElectricity.Text + "\n"); rptExpenses.AppendText("Entertainement" + "\t\t" + txtEntertainment.Text + "\n"); rptExpenses.AppendText("Groceries" + "\t\t\t" + txtGroceries.Text + "\n"); rptExpenses.AppendText("Transport " + "\t\t" + txtTTransport.Text + "\n"); rptExpenses.AppendText("Investments" + "\t\t" + txtInvestments.Text + "\n"); rptExpenses.AppendText("Phone" + "\t\t\t" + txtPhone.Text + "\n"); rptExpenses.AppendText("Water" + "\t\t\t" + txtWater.Text + "\n"); rptExpenses.AppendText("Tax" + "\t\t\t" + txtTax.Text + "\n"); rptExpenses.AppendText("-------------------------------------------------------------------\n"); rptExpenses.AppendText("Total" + "\t\t\t" + txtTotal.Text + "\n"); rptExpenses.AppendText("------------------------------------------------------------------\n"); }
private void btnRental_Click(object sender, EventArgs e) { //creating new classes cCustomer iCustomer = new cCustomer(); RentClass iRent = new RentClass(); cUtilities iUtilities = new cUtilities(); // linking methods created in rent class iCustomer.theDeposit = Double.Parse(txtDeposit.Text); iRent.theCost = Double.Parse(txtCost.Text); iRent.theNumberofroom = Double.Parse(nudRoom.Text); iUtilities.theElectricity = Double.Parse(txtEletricity.Text); iUtilities.theLocalTax = Double.Parse(txtWaterBill.Text); iUtilities.theWaterBill = Double.Parse(txtWaterBill.Text); //Calculations String q = String.Format("{0:C}", iCustomer.theDeposit + (iRent.theCost * iRent.theNumberofroom) + iUtilities.theElectricity + iUtilities.theLocalTax + iUtilities.theWaterBill); txtTotalPayment.Text = q; // Creating printout for the recipts rptRent.AppendText("\t\tRENT" + "\n" + "-------------------------------------------------------------------------------" + "\n"); rptRent.AppendText("Customer ID" + "\t\t" + txtCustomerID.Text + "\n"); rptRent.AppendText("Firstname" + "\t\t\t" + txtFirstname.Text + "\n"); rptRent.AppendText("Surname" + "\t\t\t" + txtSurname.Text + "\n"); rptRent.AppendText("Address" + "\t\t\t" + txtAddress.Text + "\n"); rptRent.AppendText("Postal Code" + "\t\t" + txtPostalCode.Text + "\n"); rptRent.AppendText("Proof of ID" + "\t\t" + cmbMonth.Text + "\n"); rptRent.AppendText("Town" + "\t\t\t" + txtTown.Text + "\n"); rptRent.AppendText("--------------------------------------------------------------------------\n"); rptRent.AppendText("Electricity" + "\t\t\t" + txtElectricity.Text + "\n"); rptRent.AppendText("Local Tax" + "\t\t\t" + txtlocaltax.Text + "\n"); rptRent.AppendText("Water Bill" + "\t\t\t" + txtWaterBill.Text + "\n"); rptRent.AppendText("-------------------------------------------------------------------------\n"); rptRent.AppendText("Total Payment" + "\t\t" + txtTotalPayment.Text + "\n"); rptRent.AppendText("--------------------------------------------------------------------------"); }