// ================================================================================================= // Single Flight Report Functionality ============================================================== // ================================================================================================= private void single_report_button_Click(object sender, EventArgs e) { int flightID = int.Parse(flights_dataview.CurrentRow.Cells["id"].Value.ToString()); DataTable bookedFlightInfo = FormDatabaseHelper.returnFlightInformation(flightID); DataTable flightTransactions = FormDatabaseHelper.returnSingleFlightTransactions(flightID); fillSingleReport(bookedFlightInfo, flightTransactions); tools_groupbox.Hide(); singleflight_report_groupbox.Show(); }
private void fillFullReport() { DataTable allBookedFlights = FormDatabaseHelper.returnFlightInformation(); allBookedFlights.Columns.Add("percCapacity", typeof(double)); allBookedFlights.Columns.Add("cardRev", typeof(double)); allBookedFlights.Columns.Add("rewardRev", typeof(double)); int count = allBookedFlights.Rows.Count; full_flightCount_label.Text = count.ToString(); int flightID; int currentRow = 0; double cardRev = 0.00; double rewardRev = 0.00; foreach (DataRow row in allBookedFlights.Rows) { flightID = row.Field <int>("id"); DataTable transactions = FormDatabaseHelper.returnSingleFlightTransactions(flightID); double currentCardRev = findRevenue(transactions, 1); currentCardRev = Math.Round(currentCardRev, 2); double currentRewardRev = findRevenue(transactions, 2); allBookedFlights.Rows[currentRow].SetField <double>("cardRev", currentCardRev); allBookedFlights.Rows[currentRow].SetField <double>("rewardRev", currentRewardRev); cardRev = cardRev + currentCardRev; rewardRev = rewardRev + currentRewardRev; double maxCap = row.Field <int>("maxCapacity"); double currCap = row.Field <int>("currCapacity"); double percCap = (currCap / maxCap) * 100.00; percCap = Math.Round(percCap, 2); allBookedFlights.Rows[currentRow].SetField <double>("percCapacity", percCap); currentRow++; } full_cardRev_label.Text = cardRev.ToString(); full_pointRev_label.Text = rewardRev.ToString(); BindingSource SBind = new BindingSource(); SBind.DataSource = allBookedFlights; full_report_datagridview.Columns.Clear(); fullTransactionsTableColumnSetup(); full_report_datagridview.DataSource = SBind; full_report_datagridview.Refresh(); }
// ================================================================================================= // Print Manifest Functionality ==================================================================== // ================================================================================================= private void printManifest_btn_Click(object sender, EventArgs e) { flight_search_groupbox.Hide(); manifest_groupbox.Show(); int flightID = int.Parse(flights_dataview.CurrentRow.Cells["id"].Value.ToString()); DataTable bookedFlightInfo = FormDatabaseHelper.returnFlightInformation(flightID); DataTable flightTransactions = FormDatabaseHelper.returnSingleFlightTransactions(flightID); fillDataManifest(bookedFlightInfo, flightTransactions); }