Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //package dbGUI;
- import java.awt.Component;
- import java.awt.EventQueue;
- //import com.toedter.calendar.JDateChooser;
- //import com.toedter.calendar.JDayChooser;
- import java.util.*;
- import java.util.Date;
- import java.text.DecimalFormat;
- import javax.swing.*;
- import javax.swing.table.DefaultTableModel;
- import java.awt.*;
- import java.awt.event.*;
- import java.awt.print.*;
- import java.sql.*;
- public class HMSNEW implements Printable{
- String [] NumdaysStayed = {"", "1", "2", "3"};
- String [] NumGuestsStayed = {"", "1","2"};
- String [] RoomTypeDesc = {"", "Luxury - 1 Queen Bed", "Luxury - 2 Queen Bed", "Luxury - Two Room", "Luxury - Three Room", "Luxury - Bridal", "Cottage - Two Room", "Cottage - Three Room", "Cottage - Four Room"};
- String [] ViewTypeDesc = {"", "Patio", "Forest"};
- String [] ListStates = {"AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"};
- private Connection connection;
- private Statement statement, statement1, statement2, statement3, statement4, statement5, statement6, statement7, statement8, statement9, statement10, statement11, statement12, statement13, statement14;
- private ResultSet resultset, SearchBooking, SearchGuest, SearchRoom, DayOneExtra, DayTwoExtra, DayThreeExtra, ExtraPerson, RoomPrice, ExtraPrice_DAY1, ExtraPrice_DAY2, ExtraPrice_DAY3, ExtraPersonPrice, RoomTaxPrice, SecondRoomPrice, SecondRoomTaxPrice, BillTotal, getRoomNum; // result sets for later Queries
- // strings for the Check-Out Pane
- public String RoomNumberSearchA, FNameSearchA, LNameSearchA, RoomTypeSearchA, ViewTypeSearchA, NumGuestsSearchA;
- private JFrame frame;
- private JTextField Fname;
- private JTextField Lname;
- private JTextField Adr1;
- private JTextField Adr2;
- private JTextField City;
- private JTextField Zip;
- private JTextField departDay;
- private JTextField RoomNum;
- private JTextField F_name;
- private JTextField L_name;
- private JTextField Room_Type;
- private JTextField View_Type;
- private JTextField Num_Guests;
- private JTextField FnameBILL;
- private JTextField LnameBILL;
- private JTextField Adr1BILL;
- private JTextField Adr2BILL;
- private JTextField RoomNum_BILL;
- private JTextField DAY1_BILL;
- private JTextField Room_BILLDAY1;
- private JTextField ExtraPerson_DAY1;
- private JTextField RoomTax_DAY1;
- private JTextField Extra1_DAY1;
- private JTextField Extra2_DAY1;
- private JTextField Extra3_DAY1;
- private JTextField Extra4_DAY1;
- private JTextField ROOMAMOUNTDAY1;
- private JTextField ROOMAMOUNT2_DAY1;
- private JTextField ROOMAMOUNT3_DAY1;
- private JTextField ROOMAMOUNT4_DAY1;
- private JTextField ROOMAMOUNT5_DAY1;
- private JTextField ROOMAMOUNT6_DAY1;
- private JTextField ROOMAMOUNT7_DAY1;
- private JTextField DAY2_BILL;
- private JTextField Room_DAY2;
- private JTextField ExtraPerson_DAY2;
- private JTextField RoomTax_DAY2;
- private JTextField Extra1_DAY2;
- private JTextField Extra2_DAY2;
- private JTextField Extra3_DAY2;
- private JTextField Extra4_DAY2;
- private JTextField ROOMAMOUNTDAY2;
- private JTextField ROOMAMOUNT2_DAY2;
- private JTextField ROOMAMOUNT3_DAY2;
- private JTextField ROOMAMOUNT4_DAY2;
- private JTextField ROOMAMOUNT5_DAY2;
- private JTextField ROOMAMOUNT6_DAY2;
- private JTextField ROOMAMOUNT7_DAY2;
- private JTextField DAY3_BILL;
- private JTextField Room_BILLDAY3;
- private JTextField ExtraPerson_DAY3;
- private JTextField RoomTax_DAY3;
- private JTextField Extra1_DAY3;
- private JTextField Extra2_DAY3;
- private JTextField Extra3_DAY3;
- private JTextField Extra4_DAY3;
- private JTextField ROOMAMOUNTDAY3;
- private JTextField ROOMAMOUNT2_DAY3;
- private JTextField ROOMAMOUNT3_DAY3;
- private JTextField ROOMAMOUNT4_DAY3;
- private JTextField ROOMAMOUNT5_DAY3;
- private JTextField ROOMAMOUNT6_DAY3;
- private JTextField ROOMAMOUNT7_DAY3;
- private JTextField TotalBILL;
- private JTextField search;
- private JTable vacantTABLE;
- private JComboBox states = new JComboBox(ListStates);
- private JComboBox daysStayed = new JComboBox(NumdaysStayed);
- private JComboBox NumGuests = new JComboBox(NumGuestsStayed);
- private JComboBox daysStayed_Avail = new JComboBox(NumdaysStayed);
- //private JDateChooser arrival_Avail = new JDateChooser();
- //private JDateChooser arrival_CheckIN = new JDateChooser();
- private JComboBox RoomType_Avail = new JComboBox(RoomTypeDesc);
- private JComboBox ViewType_Avail = new JComboBox(ViewTypeDesc);
- private JComboBox ROOMtypeCI = new JComboBox(RoomTypeDesc);
- private JComboBox VIEWtypeCI = new JComboBox(ViewTypeDesc);
- private JRadioButton phone_Day1;
- private JRadioButton RoomSer_Day1;
- private JRadioButton Dining_Day1;
- private JRadioButton EquineAdv_Day1 ;
- private String telephoneDAY1;
- private String diningDAY1;
- private String roomserviceDAY1;
- private String adventureDAY1;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- HMSNEW window = new HMSNEW();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public HMSNEW() {
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frame = new JFrame();
- frame.setBounds(100, 100, 492, 968);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(new CardLayout(0, 0));
- final JPanel mainMenu = new JPanel();
- frame.getContentPane().add(mainMenu, "name_1500680688397675");
- mainMenu.setLayout(null);
- final JPanel checkIn = new JPanel();
- frame.getContentPane().add(checkIn, "name_1500684888589853");
- checkIn.setLayout(null);
- final JPanel checkOut = new JPanel();
- frame.getContentPane().add(checkOut, "name_1500687027710804");
- checkOut.setLayout(null);
- final JPanel checkAvail = new JPanel();
- frame.getContentPane().add(checkAvail, "name_1500814470163147");
- checkAvail.setLayout(null);
- final JPanel extraServices = new JPanel();
- frame.getContentPane().add(extraServices, "name_1500862929041108");
- extraServices.setLayout(null);
- final JPanel bill = new JPanel();
- frame.getContentPane().add(bill, "name_1500882336028312");
- bill.setLayout(null);
- //Buttons for main menu.
- JButton CheckINButton = new JButton("Check In");
- CheckINButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Going in to the Check in Pain");
- mainMenu.setVisible(false);
- checkIn.setVisible(true);
- }
- });
- CheckINButton.setFont(new Font("Tahoma", Font.PLAIN, 28));
- CheckINButton.setBounds(12, 135, 450, 158);
- mainMenu.add(CheckINButton);
- JLabel lblNewLabel = new JLabel("Hotel Management System");
- lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
- lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 24));
- lblNewLabel.setBounds(12, 22, 450, 100);
- mainMenu.add(lblNewLabel);
- JButton CheckOUTButton = new JButton("Check Out");
- CheckOUTButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Going to Checking OUT Pane");
- mainMenu.setVisible(false);
- checkOut.setVisible(true);
- }
- });
- CheckOUTButton.setFont(new Font("Tahoma", Font.PLAIN, 28));
- CheckOUTButton.setBounds(12, 306, 450, 158);
- mainMenu.add(CheckOUTButton);
- JButton availButton = new JButton("Check Availability");
- availButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Going to Checking In Pane");
- mainMenu.setVisible(false);
- checkAvail.setVisible(true);
- }
- });
- availButton.setFont(new Font("Tahoma", Font.PLAIN, 28));
- availButton.setBounds(12, 477, 450, 158);
- mainMenu.add(availButton);
- JLabel lblNewLabel_1 = new JLabel("First Name:");
- lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblNewLabel_1.setBounds(10, 45, 82, 14);
- checkIn.add(lblNewLabel_1);
- JLabel lblLastName = new JLabel("Last Name:");
- lblLastName.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblLastName.setBounds(10, 85, 82, 14);
- checkIn.add(lblLastName);
- JLabel lblAddress = new JLabel("Address 1:");
- lblAddress.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblAddress.setBounds(10, 126, 82, 14);
- checkIn.add(lblAddress);
- JLabel lblAddress_1 = new JLabel("Address 2:");
- lblAddress_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblAddress_1.setBounds(10, 171, 82, 14);
- checkIn.add(lblAddress_1);
- JLabel lblCity = new JLabel("City:");
- lblCity.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblCity.setBounds(10, 213, 82, 14);
- checkIn.add(lblCity);
- JLabel lblState = new JLabel("State:");
- lblState.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblState.setBounds(10, 253, 82, 14);
- checkIn.add(lblState);
- JLabel lblZipcode = new JLabel("Zipcode:");
- lblZipcode.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblZipcode.setBounds(10, 296, 82, 14);
- checkIn.add(lblZipcode);
- JLabel lblLengthOfStay = new JLabel("Length of stay:");
- lblLengthOfStay.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblLengthOfStay.setBounds(10, 386, 111, 14);
- checkIn.add(lblLengthOfStay);
- JLabel lblDeparture = new JLabel("Departure");
- lblDeparture.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblDeparture.setBounds(10, 428, 82, 14);
- checkIn.add(lblDeparture);
- JLabel lblNumberOfGuests = new JLabel("Number of guests:");
- lblNumberOfGuests.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblNumberOfGuests.setBounds(10, 462, 132, 14);
- checkIn.add(lblNumberOfGuests);
- Fname = new JTextField();
- Fname.setBounds(184, 44, 240, 20);
- checkIn.add(Fname);
- Fname.setColumns(10);
- Lname = new JTextField();
- Lname.setColumns(10);
- Lname.setBounds(184, 84, 240, 20);
- checkIn.add(Lname);
- Adr1 = new JTextField();
- Adr1.setColumns(10);
- Adr1.setBounds(184, 125, 240, 20);
- checkIn.add(Adr1);
- Adr2 = new JTextField();
- Adr2.setColumns(10);
- Adr2.setBounds(184, 170, 240, 20);
- checkIn.add(Adr2);
- City = new JTextField();
- City.setColumns(10);
- City.setBounds(184, 212, 240, 20);
- checkIn.add(City);
- Zip = new JTextField();
- Zip.setColumns(10);
- Zip.setBounds(184, 295, 240, 20);
- checkIn.add(Zip);
- departDay = new JTextField();
- departDay.setColumns(10);
- departDay.setBounds(184, 427, 240, 20);
- checkIn.add(departDay);
- states.setBounds(184, 252, 240, 20);
- checkIn.add(states);
- daysStayed.setBounds(184, 385, 240, 20);
- checkIn.add(daysStayed);
- NumGuests.setBounds(184, 460, 240, 20);
- checkIn.add(NumGuests);
- JLabel lblArrival = new JLabel("Arrival:");
- lblArrival.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblArrival.setBounds(10, 344, 82, 14);
- checkIn.add(lblArrival);
- /*JDateChooser arrival_CheckIN = new JDateChooser();
- arrival_CheckIN.getCalendarButton().addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- }
- });
- arrival_CheckIN.setBounds(184, 338, 240, 20);
- checkIn.add(arrival_CheckIN);*/
- //Buttons for check in
- JButton Check_Avail = new JButton("Check Availability");
- Check_Avail.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Going to the Checking Room Availability");
- checkIn.setVisible(false);
- checkAvail.setVisible(true);
- }
- });
- Check_Avail.setFont(new Font("Tahoma", Font.PLAIN, 18));
- Check_Avail.setBounds(10, 598, 184, 54);
- checkIn.add(Check_Avail);
- JButton checkOUTbutton = new JButton("Check Out");
- checkOUTbutton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Going to Checking OUT Pane");
- checkIn.setVisible(false);
- checkOut.setVisible(true);
- }
- });
- checkOUTbutton.setFont(new Font("Tahoma", Font.PLAIN, 18));
- checkOUTbutton.setBounds(285, 598, 177, 54);
- checkIn.add(checkOUTbutton);
- JButton Book_Button = new JButton("Book");
- Book_Button.setFont(new Font("Tahoma", Font.PLAIN, 18));
- Book_Button.setBounds(10, 681, 184, 54);
- checkIn.add(Book_Button);
- Book_Button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Booking Room");
- BookingRoom();
- }
- });
- JButton button = new JButton("Main Menu");
- button.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Going to Main Menu");
- checkIn.setVisible(false);
- mainMenu.setVisible(true);
- }
- });
- button.setFont(new Font("Tahoma", Font.PLAIN, 18));
- button.setBounds(285, 681, 177, 54);
- checkIn.add(button);
- JLabel lblRoomType_2 = new JLabel("Room Type:");
- lblRoomType_2.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblRoomType_2.setBounds(10, 499, 132, 14);
- checkIn.add(lblRoomType_2);
- JLabel lblViewType_2 = new JLabel("View Type:");
- lblViewType_2.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblViewType_2.setBounds(10, 532, 132, 14);
- checkIn.add(lblViewType_2);
- ROOMtypeCI.setBounds(184, 493, 240, 20);
- checkIn.add(ROOMtypeCI);
- VIEWtypeCI.setBounds(184, 530, 240, 20);
- checkIn.add(VIEWtypeCI);
- JLabel lblBooking = new JLabel("Room #");
- lblBooking.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblBooking.setBounds(10, 45, 82, 14);
- checkOut.add(lblBooking);
- JLabel label_1 = new JLabel("First Name:");
- label_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
- label_1.setBounds(10, 88, 82, 14);
- checkOut.add(label_1);
- JLabel label_2 = new JLabel("Last Name:");
- label_2.setFont(new Font("Tahoma", Font.PLAIN, 16));
- label_2.setBounds(10, 128, 82, 14);
- checkOut.add(label_2);
- JLabel lblRoomType = new JLabel("Room Type:");
- lblRoomType.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblRoomType.setBounds(10, 166, 88, 14);
- checkOut.add(lblRoomType);
- JLabel lblViewType = new JLabel("View type:");
- lblViewType.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblViewType.setBounds(10, 204, 82, 14);
- checkOut.add(lblViewType);
- JLabel lblNumberOfGuests_1 = new JLabel("Number of Guests:");
- lblNumberOfGuests_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblNumberOfGuests_1.setBounds(10, 246, 134, 14);
- checkOut.add(lblNumberOfGuests_1);
- //Buttons for check out
- JButton btnSearchAccount = new JButton("Search Account");
- btnSearchAccount.setFont(new Font("Tahoma", Font.PLAIN, 18));
- btnSearchAccount.setBounds(10, 297, 184, 54);
- checkOut.add(btnSearchAccount);
- btnSearchAccount.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Searching for a Guest Account");
- searchAccount();
- }
- });
- JButton btnAddCharges = new JButton("Add Charges");
- btnAddCharges.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- System.out.println("Going to extra services pane");
- checkOut.setVisible(false);
- extraServices.setVisible(true);
- }
- });
- btnAddCharges.setFont(new Font("Tahoma", Font.PLAIN, 18));
- btnAddCharges.setBounds(10, 376, 184, 54);
- checkOut.add(btnAddCharges);
- JButton btnPreviewBill = new JButton("Preview Bill");
- btnPreviewBill.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Searching();
- checkOut.setVisible(false);
- bill.setVisible(true);
- }
- });
- btnPreviewBill.setFont(new Font("Tahoma", Font.PLAIN, 18));
- btnPreviewBill.setBounds(10, 457, 184, 54);
- checkOut.add(btnPreviewBill);
- RoomNum = new JTextField();
- RoomNum.setColumns(10);
- RoomNum.setBounds(184, 44, 240, 20);
- checkOut.add(RoomNum);
- F_name = new JTextField();
- F_name.setColumns(10);
- F_name.setBounds(184, 87, 240, 20);
- checkOut.add(F_name);
- L_name = new JTextField();
- L_name.setColumns(10);
- L_name.setBounds(184, 127, 240, 20);
- checkOut.add(L_name);
- Room_Type = new JTextField();
- Room_Type.setColumns(10);
- Room_Type.setBounds(184, 165, 240, 20);
- checkOut.add(Room_Type);
- View_Type = new JTextField();
- View_Type.setColumns(10);
- View_Type.setBounds(184, 203, 240, 20);
- checkOut.add(View_Type);
- Num_Guests = new JTextField();
- Num_Guests.setColumns(10);
- Num_Guests.setBounds(184, 245, 240, 20);
- checkOut.add(Num_Guests);
- JButton button_1 = new JButton("Main Menu");
- button_1.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Going to Main Menu");
- checkOut.setVisible(false);
- mainMenu.setVisible(true);
- }
- });
- button_1.setFont(new Font("Tahoma", Font.PLAIN, 18));
- button_1.setBounds(10, 534, 184, 54);
- checkOut.add(button_1);
- JLabel lblRoomType_1 = new JLabel("Room type:");
- lblRoomType_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblRoomType_1.setBounds(10, 49, 111, 14);
- checkAvail.add(lblRoomType_1);
- RoomType_Avail.setBounds(184, 47, 240, 20);
- checkAvail.add(RoomType_Avail);
- JLabel lblViewType_1 = new JLabel("View type:");
- lblViewType_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblViewType_1.setBounds(10, 114, 111, 14);
- checkAvail.add(lblViewType_1);
- ViewType_Avail.setBounds(184, 112, 240, 20);
- checkAvail.add(ViewType_Avail);
- JLabel lblRoomResults = new JLabel("Room Results:");
- lblRoomResults.setHorizontalAlignment(SwingConstants.CENTER);
- lblRoomResults.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblRoomResults.setBounds(10, 195, 452, 14);
- checkAvail.add(lblRoomResults);
- JButton Check_IN_Button = new JButton("Check In");
- Check_IN_Button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- System.out.println("Going to Checking In Pane");
- checkAvail.setVisible(false);
- checkIn.setVisible(true);
- }
- });
- Check_IN_Button.setFont(new Font("Tahoma", Font.PLAIN, 28));
- Check_IN_Button.setBounds(10, 448, 452, 121);
- checkAvail.add(Check_IN_Button);
- JButton btnSearch = new JButton("Search");
- btnSearch.setFont(new Font("Tahoma", Font.PLAIN, 28));
- btnSearch.setBounds(10, 582, 452, 121);
- checkAvail.add(btnSearch);
- JButton MMButton = new JButton("Main Menu");
- MMButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Going to Main Menu");
- checkAvail.setVisible(false);
- mainMenu.setVisible(true);
- }
- });
- MMButton.setFont(new Font("Tahoma", Font.PLAIN, 28));
- MMButton.setBounds(10, 716, 452, 121);
- checkAvail.add(MMButton);
- vacantTABLE = new JTable();
- vacantTABLE.setModel(new DefaultTableModel(
- new Object[][] {
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- },
- new String[] {
- "New column", "New column", "New column", "New column", "New column"
- }
- ));
- vacantTABLE.setBounds(10, 222, 452, 213);
- checkAvail.add(vacantTABLE);
- JLabel lblExtraServicesOffered = new JLabel("Extra Services Offered");
- lblExtraServicesOffered.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblExtraServicesOffered.setBounds(10, 11, 166, 14);
- extraServices.add(lblExtraServicesOffered);
- JLabel lblTelephone = new JLabel("Telephone");
- lblTelephone.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblTelephone.setBounds(10, 65, 82, 14);
- extraServices.add(lblTelephone);
- JLabel lblRoomService = new JLabel("Room Service:");
- lblRoomService.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblRoomService.setBounds(10, 113, 103, 14);
- extraServices.add(lblRoomService);
- JLabel lblDiningRoom = new JLabel("Dining Room:");
- lblDiningRoom.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblDiningRoom.setBounds(10, 158, 103, 14);
- extraServices.add(lblDiningRoom);
- JLabel lblAquestrineAdventure = new JLabel("Equine Adventure:");
- lblAquestrineAdventure.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblAquestrineAdventure.setBounds(10, 206, 132, 14);
- extraServices.add(lblAquestrineAdventure);
- JLabel lblExtraPerson = new JLabel("Extra Person:");
- lblExtraPerson.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblExtraPerson.setBounds(10, 253, 103, 14);
- extraServices.add(lblExtraPerson);
- JRadioButton phone_Day1 = new JRadioButton("Telephone");
- phone_Day1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra1_DAY1.setText(radioButton.getText());
- ROOMAMOUNT4_DAY1.setText("2.47");
- }
- else
- {
- Extra1_DAY1.setText("0.00");
- ROOMAMOUNT4_DAY1.setText("0.00");
- }
- System.out.println("Applying Phone Charges to Day 1 of your Bill");
- } //applyCharges();
- }
- });
- phone_Day1.setBounds(223, 65, 21, 23);
- extraServices.add(phone_Day1);
- JRadioButton RoomSer_Day1 = new JRadioButton("Room Service");
- RoomSer_Day1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra2_DAY1.setText(radioButton.getText());
- ROOMAMOUNT5_DAY1.setText("33.50");
- }
- else
- {
- Extra2_DAY1.setText("0.00");
- ROOMAMOUNT5_DAY1.setText("0.00");
- }
- System.out.println("Applying Room Service Charges to Day 1 of your Bill");
- } //applyCharges();
- }
- });
- RoomSer_Day1.setBounds(223, 111, 21, 23);
- extraServices.add(RoomSer_Day1);
- JRadioButton Dining_Day1 = new JRadioButton("Dining Room");
- Dining_Day1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra3_DAY1.setText(radioButton.getText());
- ROOMAMOUNT6_DAY1.setText("87.50");
- }
- else
- {
- Extra3_DAY1.setText("0.00");
- ROOMAMOUNT6_DAY1.setText("0.00");
- }
- System.out.println("Applying Dining Charges to Day 1 of your Bill");
- } //applyCharges();
- }
- });
- Dining_Day1.setBounds(223, 156, 21, 23);
- extraServices.add(Dining_Day1);
- JRadioButton EquineAdv_Day1 = new JRadioButton("Equestrian Adventure");
- EquineAdv_Day1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra4_DAY1.setText(radioButton.getText());
- ROOMAMOUNT7_DAY1.setText("195.00");
- }
- else
- {
- Extra4_DAY1.setText("0.00");
- ROOMAMOUNT7_DAY1.setText("0.00");
- }
- System.out.println("Applying Equestrian Adventure Charges to Day 1 of your Bill");
- } //applyCharges();
- }
- });
- EquineAdv_Day1.setBounds(223, 204, 21, 23);
- extraServices.add(EquineAdv_Day1);
- JRadioButton ExtraPerson_Day1 = new JRadioButton("Extra Person");
- ExtraPerson_Day1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- ExtraPerson_DAY1.setText(radioButton.getText());
- ROOMAMOUNT2_DAY1.setText("22.00");
- }
- else
- {
- ExtraPerson_DAY1.setText("0.00");
- ROOMAMOUNT2_DAY1.setText("0.00");
- }
- System.out.println("Applying Extra Person Charges to Day 1 of your Bill");
- //applyCharges();
- }
- }
- });
- ExtraPerson_Day1.setBounds(223, 251, 21, 23);
- extraServices.add(ExtraPerson_Day1);
- JRadioButton phone_Day2 = new JRadioButton("Telephone");
- phone_Day2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra1_DAY2.setText(radioButton.getText());
- ROOMAMOUNT4_DAY2.setText("2.47");
- }
- else
- {
- Extra1_DAY2.setText("0.00");
- ROOMAMOUNT4_DAY2.setText("0.00");
- }
- System.out.println("Applying Phone Charges to Day 2 of your Bill");
- } //applyCharges();
- }
- });
- phone_Day2.setBounds(293, 63, 21, 23);
- extraServices.add(phone_Day2);
- JRadioButton phone_Day3 = new JRadioButton("Telephone");
- phone_Day3.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra1_DAY3.setText(radioButton.getText());
- ROOMAMOUNT4_DAY3.setText("2.47");
- }
- else
- {
- Extra1_DAY3.setText("0.00");
- ROOMAMOUNT4_DAY3.setText("0.00");
- }
- System.out.println("Applying Phone Charges to Day 3 of your Bill");
- } //applyCharges();
- }
- });
- phone_Day3.setBounds(362, 63, 21, 23);
- extraServices.add(phone_Day3);
- JRadioButton RoomSer_Day2 = new JRadioButton("Room Service");
- RoomSer_Day2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra2_DAY2.setText(radioButton.getText());
- ROOMAMOUNT5_DAY2.setText("33.50");
- }
- else
- {
- Extra2_DAY2.setText("0.00");
- ROOMAMOUNT5_DAY2.setText("0.00");
- }
- System.out.println("Applying Room Service Charges to Day 2 of your Bill");
- } //applyCharges();
- }
- });
- RoomSer_Day2.setBounds(293, 111, 21, 23);
- extraServices.add(RoomSer_Day2);
- JRadioButton RoomSer_Day3 = new JRadioButton("Room Service");
- RoomSer_Day3.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra2_DAY3.setText(radioButton.getText());
- ROOMAMOUNT5_DAY3.setText("33.50");
- }
- else
- {
- Extra2_DAY3.setText("0.00");
- ROOMAMOUNT5_DAY3.setText("0.00");
- }
- System.out.println("Applying Room Service Charges to Day 3 of your Bill");
- } //applyCharges();
- }
- });
- RoomSer_Day3.setBounds(362, 111, 21, 23);
- extraServices.add(RoomSer_Day3);
- JRadioButton Dining_Day2 = new JRadioButton("Dining Room");
- Dining_Day2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra3_DAY2.setText(radioButton.getText());
- ROOMAMOUNT6_DAY2.setText("87.50");
- }
- else
- {
- Extra3_DAY2.setText("0.00");
- ROOMAMOUNT6_DAY2.setText("0.00");
- }
- System.out.println("Applying Dining Charges to Day 2 of your Bill");
- } //applyCharges();
- }
- });
- Dining_Day2.setBounds(293, 156, 21, 23);
- extraServices.add(Dining_Day2);
- JRadioButton Dining_Day3 = new JRadioButton("Dining Room");
- Dining_Day3.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra3_DAY3.setText(radioButton.getText());
- ROOMAMOUNT6_DAY3.setText("87.50");
- }
- else
- {
- Extra3_DAY3.setText("0.00");
- ROOMAMOUNT6_DAY3.setText("0.00");
- }
- System.out.println("Applying Dining Charges to Day 3 of your Bill");
- } //applyCharges();
- }
- });
- Dining_Day3.setBounds(362, 156, 21, 23);
- extraServices.add(Dining_Day3);
- JRadioButton EquineAdv_Day2 = new JRadioButton("Equestrian Adventure");
- EquineAdv_Day2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra4_DAY2.setText(radioButton.getText());
- ROOMAMOUNT7_DAY2.setText("195.00");
- }
- else
- {
- Extra4_DAY2.setText("0.00");
- ROOMAMOUNT7_DAY2.setText("0.00");
- }
- System.out.println("Applying Equestrian Adventure Charges to Day 2 of your Bill");
- } //applyCharges();
- }
- });
- EquineAdv_Day2.setBounds(293, 204, 21, 23);
- extraServices.add(EquineAdv_Day2);
- JRadioButton EquineAdv_Day3 = new JRadioButton("Equestrian Adventure");
- EquineAdv_Day3.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- Extra4_DAY3.setText(radioButton.getText());
- ROOMAMOUNT7_DAY3.setText("195.00");
- }
- else
- {
- Extra4_DAY3.setText("0.00");
- ROOMAMOUNT7_DAY3.setText("0.00");
- }
- System.out.println("Applying Equestrian Adventure Charges to Day 3 of your Bill");
- } //applyCharges();
- }
- });
- EquineAdv_Day3.setBounds(362, 204, 21, 23);
- extraServices.add(EquineAdv_Day3);
- JRadioButton ExtraPerson_Day2 = new JRadioButton("Extra Person");
- ExtraPerson_Day2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- ExtraPerson_DAY2.setText(radioButton.getText());
- ROOMAMOUNT2_DAY2.setText("22.00");
- }
- else
- {
- ExtraPerson_DAY2.setText("0.00");
- ROOMAMOUNT2_DAY2.setText("0.00");
- }
- System.out.println("Applying Extra Person Charges to Day 2 of your Bill");
- //applyCharges();
- }
- }
- });
- ExtraPerson_Day2.setBounds(293, 251, 21, 23);
- extraServices.add(ExtraPerson_Day2);
- JRadioButton ExtraPerson_Day3 = new JRadioButton("Extra Person");
- ExtraPerson_Day3.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof JRadioButton){
- JRadioButton radioButton = (JRadioButton) e.getSource();
- if(radioButton.isSelected()){
- ExtraPerson_DAY3.setText(radioButton.getText());
- ROOMAMOUNT2_DAY3.setText("22.00");
- }
- else
- {
- ExtraPerson_DAY3.setText("0.00");
- ROOMAMOUNT2_DAY3.setText("0.00");
- }
- System.out.println("Applying Extra Person Charges to Day 3 of your Bill");
- //applyCharges();
- }
- }
- });
- ExtraPerson_Day3.setBounds(362, 251, 21, 23);
- extraServices.add(ExtraPerson_Day3);
- JLabel lblDay = new JLabel("Day 1");
- lblDay.setFont(new Font("Tahoma", Font.PLAIN, 14));
- lblDay.setBounds(210, 40, 46, 14);
- extraServices.add(lblDay);
- JLabel lblDay_1 = new JLabel("Day 2");
- lblDay_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
- lblDay_1.setBounds(279, 40, 46, 14);
- extraServices.add(lblDay_1);
- JLabel lblDay_2 = new JLabel("Day 3");
- lblDay_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
- lblDay_2.setBounds(351, 40, 46, 14);
- extraServices.add(lblDay_2);
- JButton btnApplyCharges = new JButton("Apply Charges");
- btnApplyCharges.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- System.out.println("Applying Charges to your Bill");
- applyCharges();
- }
- });
- btnApplyCharges.setFont(new Font("Tahoma", Font.PLAIN, 18));
- btnApplyCharges.setBounds(10, 360, 184, 54);
- extraServices.add(btnApplyCharges);
- JButton btnPreviewBill_1 = new JButton("Preview Bill");
- btnPreviewBill_1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Searching();
- System.out.println("Previewing your Bill");
- extraServices.setVisible(false);
- bill.setVisible(true);
- }
- });
- btnPreviewBill_1.setFont(new Font("Tahoma", Font.PLAIN, 18));
- btnPreviewBill_1.setBounds(10, 459, 184, 54);
- extraServices.add(btnPreviewBill_1);
- JButton btnBackToCheck = new JButton("Back to Check Out");
- btnBackToCheck.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Going to Checking OUT Pane");
- checkOut.setVisible(true);
- extraServices.setVisible(false);
- }
- });
- btnBackToCheck.setFont(new Font("Tahoma", Font.PLAIN, 18));
- btnBackToCheck.setBounds(279, 360, 183, 54);
- extraServices.add(btnBackToCheck);
- JLabel lblGuest = new JLabel("Guest:");
- lblGuest.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblGuest.setBounds(10, 11, 46, 14);
- bill.add(lblGuest);
- FnameBILL = new JTextField();
- FnameBILL.setColumns(10);
- FnameBILL.setBounds(107, 10, 150, 20);
- bill.add(FnameBILL);
- LnameBILL = new JTextField();
- LnameBILL.setColumns(10);
- LnameBILL.setBounds(274, 10, 150, 20);
- bill.add(LnameBILL);
- Adr1BILL = new JTextField();
- Adr1BILL.setColumns(10);
- Adr1BILL.setBounds(107, 41, 317, 20);
- bill.add(Adr1BILL);
- RoomNum_BILL = new JTextField();
- RoomNum_BILL.setColumns(10);
- RoomNum_BILL.setBounds(107, 111, 150, 20);
- bill.add(RoomNum_BILL);
- Adr2BILL = new JTextField();
- Adr2BILL.setColumns(10);
- Adr2BILL.setBounds(107, 74, 317, 24);
- bill.add(Adr2BILL);
- JLabel lblDate = new JLabel("Date");
- lblDate.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblDate.setBounds(10, 176, 46, 14);
- bill.add(lblDate);
- JLabel lblCharge = new JLabel("Charge");
- lblCharge.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblCharge.setBounds(141, 176, 92, 14);
- bill.add(lblCharge);
- JLabel lblAmount = new JLabel("Amount");
- lblAmount.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblAmount.setBounds(391, 176, 57, 14);
- bill.add(lblAmount);
- JButton btnPrintBill = new JButton("Print Bill");
- btnPrintBill.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- PrinterJob job = PrinterJob.getPrinterJob();
- //job.setPrintable(this);
- boolean ok = job.printDialog();
- if (ok) {
- try {
- job.print();
- } catch (PrinterException ex) {
- //The job did not successfully complete
- }
- System.out.println("Printing your Bill");
- extraServices.setVisible(false);
- bill.setVisible(true);
- }
- }
- });
- btnPrintBill.setFont(new Font("Tahoma", Font.PLAIN, 18));
- btnPrintBill.setBounds(0, 867, 97, 54);
- bill.add(btnPrintBill);
- JLabel lblTotal = new JLabel("Total:");
- lblTotal.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblTotal.setBounds(256, 837, 46, 14);
- bill.add(lblTotal);
- TotalBILL = new JTextField();
- TotalBILL.setColumns(10);
- TotalBILL.setBounds(314, 835, 150, 20);
- bill.add(TotalBILL);
- JLabel lblRoom = new JLabel("Room #");
- lblRoom.setFont(new Font("Tahoma", Font.PLAIN, 16));
- lblRoom.setBounds(10, 96, 87, 48);
- bill.add(lblRoom);
- DAY1_BILL = new JTextField();
- DAY1_BILL.setBounds(12, 203, 116, 22);
- bill.add(DAY1_BILL);
- DAY1_BILL.setColumns(10);
- DAY2_BILL = new JTextField();
- DAY2_BILL.setBounds(12, 403, 116, 22);
- bill.add(DAY2_BILL);
- DAY2_BILL.setColumns(10);
- DAY3_BILL = new JTextField();
- DAY3_BILL.setBounds(12, 610, 116, 22);
- bill.add(DAY3_BILL);
- DAY3_BILL.setColumns(10);
- Room_BILLDAY1 = new JTextField();
- Room_BILLDAY1.setBounds(141, 203, 230, 22);
- bill.add(Room_BILLDAY1);
- Room_BILLDAY1.setColumns(10);
- Room_DAY2 = new JTextField();
- Room_DAY2.setBounds(141, 403, 230, 22);
- bill.add(Room_DAY2);
- Room_DAY2.setColumns(10);
- Extra2_DAY1 = new JTextField();
- Extra2_DAY1.setBounds(141, 302, 230, 24);
- bill.add(Extra2_DAY1);
- Extra2_DAY1.setColumns(10);
- Room_BILLDAY3 = new JTextField();
- Room_BILLDAY3.setBounds(141, 610, 230, 22);
- bill.add(Room_BILLDAY3);
- Room_BILLDAY3.setColumns(10);
- ROOMAMOUNTDAY1 = new JTextField();
- ROOMAMOUNTDAY1.setBounds(391, 203, 71, 22);
- bill.add(ROOMAMOUNTDAY1);
- ROOMAMOUNTDAY1.setColumns(10);
- ROOMAMOUNTDAY2 = new JTextField();
- ROOMAMOUNTDAY2.setBounds(391, 403, 70, 22);
- bill.add(ROOMAMOUNTDAY2);
- ROOMAMOUNTDAY2.setColumns(10);
- ROOMAMOUNTDAY3 = new JTextField();
- ROOMAMOUNTDAY3.setColumns(10);
- ROOMAMOUNTDAY3.setBounds(388, 610, 73, 22);
- bill.add(ROOMAMOUNTDAY3);
- ExtraPerson_DAY1 = new JTextField();
- ExtraPerson_DAY1.setColumns(10);
- ExtraPerson_DAY1.setBounds(141, 229, 230, 22);
- bill.add(ExtraPerson_DAY1);
- RoomTax_DAY1 = new JTextField();
- RoomTax_DAY1.setColumns(10);
- RoomTax_DAY1.setBounds(141, 253, 230, 22);
- bill.add(RoomTax_DAY1);
- Extra1_DAY1 = new JTextField();
- Extra1_DAY1.setColumns(10);
- Extra1_DAY1.setBounds(141, 277, 230, 22);
- bill.add(Extra1_DAY1);
- Extra3_DAY1 = new JTextField();
- Extra3_DAY1.setColumns(10);
- Extra3_DAY1.setBounds(141, 328, 230, 24);
- bill.add(Extra3_DAY1);
- Extra4_DAY1 = new JTextField();
- Extra4_DAY1.setColumns(10);
- Extra4_DAY1.setBounds(141, 353, 230, 24);
- bill.add(Extra4_DAY1);
- ROOMAMOUNT2_DAY1 = new JTextField();
- ROOMAMOUNT2_DAY1.setColumns(10);
- ROOMAMOUNT2_DAY1.setBounds(391, 229, 71, 22);
- bill.add(ROOMAMOUNT2_DAY1);
- ROOMAMOUNT3_DAY1 = new JTextField();
- ROOMAMOUNT3_DAY1.setColumns(10);
- ROOMAMOUNT3_DAY1.setBounds(391, 253, 71, 22);
- bill.add(ROOMAMOUNT3_DAY1);
- ROOMAMOUNT4_DAY1 = new JTextField();
- ROOMAMOUNT4_DAY1.setColumns(10);
- ROOMAMOUNT4_DAY1.setBounds(391, 277, 71, 22);
- bill.add(ROOMAMOUNT4_DAY1);
- ROOMAMOUNT5_DAY1 = new JTextField();
- ROOMAMOUNT5_DAY1.setColumns(10);
- ROOMAMOUNT5_DAY1.setBounds(391, 303, 71, 22);
- bill.add(ROOMAMOUNT5_DAY1);
- ROOMAMOUNT6_DAY1 = new JTextField();
- ROOMAMOUNT6_DAY1.setColumns(10);
- ROOMAMOUNT6_DAY1.setBounds(391, 329, 71, 22);
- bill.add(ROOMAMOUNT6_DAY1);
- ROOMAMOUNT7_DAY1 = new JTextField();
- ROOMAMOUNT7_DAY1.setColumns(10);
- ROOMAMOUNT7_DAY1.setBounds(391, 354, 71, 22);
- bill.add(ROOMAMOUNT7_DAY1);
- ExtraPerson_DAY2 = new JTextField();
- ExtraPerson_DAY2.setColumns(10);
- ExtraPerson_DAY2.setBounds(141, 431, 230, 22);
- bill.add(ExtraPerson_DAY2);
- RoomTax_DAY2 = new JTextField();
- RoomTax_DAY2.setColumns(10);
- RoomTax_DAY2.setBounds(141, 456, 230, 22);
- bill.add(RoomTax_DAY2);
- Extra1_DAY2 = new JTextField();
- Extra1_DAY2.setColumns(10);
- Extra1_DAY2.setBounds(141, 482, 230, 22);
- bill.add(Extra1_DAY2);
- Extra2_DAY2 = new JTextField();
- Extra2_DAY2.setColumns(10);
- Extra2_DAY2.setBounds(141, 508, 230, 22);
- bill.add(Extra2_DAY2);
- Extra3_DAY2 = new JTextField();
- Extra3_DAY2.setColumns(10);
- Extra3_DAY2.setBounds(141, 534, 230, 22);
- bill.add(Extra3_DAY2);
- Extra4_DAY2 = new JTextField();
- Extra4_DAY2.setColumns(10);
- Extra4_DAY2.setBounds(141, 561, 230, 22);
- bill.add(Extra4_DAY2);
- ROOMAMOUNT2_DAY2 = new JTextField();
- ROOMAMOUNT2_DAY2.setColumns(10);
- ROOMAMOUNT2_DAY2.setBounds(391, 431, 71, 22);
- bill.add(ROOMAMOUNT2_DAY2);
- ROOMAMOUNT3_DAY2 = new JTextField();
- ROOMAMOUNT3_DAY2.setColumns(10);
- ROOMAMOUNT3_DAY2.setBounds(391, 456, 71, 22);
- bill.add(ROOMAMOUNT3_DAY2);
- ROOMAMOUNT4_DAY2 = new JTextField();
- ROOMAMOUNT4_DAY2.setColumns(10);
- ROOMAMOUNT4_DAY2.setBounds(391, 482, 71, 22);
- bill.add(ROOMAMOUNT4_DAY2);
- ROOMAMOUNT5_DAY2 = new JTextField();
- ROOMAMOUNT5_DAY2.setColumns(10);
- ROOMAMOUNT5_DAY2.setBounds(391, 508, 71, 22);
- bill.add(ROOMAMOUNT5_DAY2);
- ROOMAMOUNT6_DAY2 = new JTextField();
- ROOMAMOUNT6_DAY2.setColumns(10);
- ROOMAMOUNT6_DAY2.setBounds(391, 534, 71, 22);
- bill.add(ROOMAMOUNT6_DAY2);
- ROOMAMOUNT7_DAY2 = new JTextField();
- ROOMAMOUNT7_DAY2.setColumns(10);
- ROOMAMOUNT7_DAY2.setBounds(391, 561, 71, 22);
- bill.add(ROOMAMOUNT7_DAY2);
- ExtraPerson_DAY3 = new JTextField();
- ExtraPerson_DAY3.setColumns(10);
- ExtraPerson_DAY3.setBounds(141, 639, 230, 22);
- bill.add(ExtraPerson_DAY3);
- RoomTax_DAY3 = new JTextField();
- RoomTax_DAY3.setColumns(10);
- RoomTax_DAY3.setBounds(141, 663, 230, 22);
- bill.add(RoomTax_DAY3);
- Extra1_DAY3 = new JTextField();
- Extra1_DAY3.setColumns(10);
- Extra1_DAY3.setBounds(141, 688, 230, 22);
- bill.add(Extra1_DAY3);
- Extra2_DAY3 = new JTextField();
- Extra2_DAY3.setColumns(10);
- Extra2_DAY3.setBounds(141, 719, 230, 22);
- bill.add(Extra2_DAY3);
- Extra3_DAY3 = new JTextField();
- Extra3_DAY3.setColumns(10);
- Extra3_DAY3.setBounds(141, 754, 230, 22);
- bill.add(Extra3_DAY3);
- Extra4_DAY3 = new JTextField();
- Extra4_DAY3.setColumns(10);
- Extra4_DAY3.setBounds(141, 789, 230, 22);
- bill.add(Extra4_DAY3);
- ROOMAMOUNT2_DAY3 = new JTextField();
- ROOMAMOUNT2_DAY3.setColumns(10);
- ROOMAMOUNT2_DAY3.setBounds(388, 639, 73, 22);
- bill.add(ROOMAMOUNT2_DAY3);
- ROOMAMOUNT3_DAY3 = new JTextField();
- ROOMAMOUNT3_DAY3.setColumns(10);
- ROOMAMOUNT3_DAY3.setBounds(391, 663, 73, 22);
- bill.add(ROOMAMOUNT3_DAY3);
- ROOMAMOUNT4_DAY3 = new JTextField();
- ROOMAMOUNT4_DAY3.setColumns(10);
- ROOMAMOUNT4_DAY3.setBounds(391, 688, 73, 22);
- bill.add(ROOMAMOUNT4_DAY3);
- ROOMAMOUNT5_DAY3 = new JTextField();
- ROOMAMOUNT5_DAY3.setColumns(10);
- ROOMAMOUNT5_DAY3.setBounds(391, 719, 73, 22);
- bill.add(ROOMAMOUNT5_DAY3);
- ROOMAMOUNT6_DAY3 = new JTextField();
- ROOMAMOUNT6_DAY3.setColumns(10);
- ROOMAMOUNT6_DAY3.setBounds(388, 754, 73, 22);
- bill.add(ROOMAMOUNT6_DAY3);
- ROOMAMOUNT7_DAY3 = new JTextField();
- ROOMAMOUNT7_DAY3.setColumns(10);
- ROOMAMOUNT7_DAY3.setBounds(388, 789, 73, 22);
- bill.add(ROOMAMOUNT7_DAY3);
- JButton btnMainMenu = new JButton("Main Menu");
- btnMainMenu.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("Going to Main Menu");
- bill.setVisible(false);
- mainMenu.setVisible(true);
- }
- });
- btnMainMenu.setFont(new Font("Tahoma", Font.PLAIN, 18));
- btnMainMenu.setBounds(337, 867, 125, 54);
- bill.add(btnMainMenu);
- }
- /*private void SearchRooms()
- {
- try
- {
- // load database driver class
- Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
- connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB" );
- Statement statement = connection.createStatement();
- ResultSet resultSet = statement.executeQuery("SELECT * FROM RoomInfo");
- StringBuffer results = new StringBuffer();
- ResultSetMetaData metaData = resultSet.getMetaData();
- int numberOfColumns = metaData.getColumnCount();
- for (int i = 1; i <= numberOfColumns; i++){
- results.append( metaData.getColumnName(i)
- + "\t");
- }
- results.append("\n");
- while(resultSet.next())
- {
- for (int i = 1; i <= numberOfColumns; i++)
- {
- results.append(resultSet.getObject(i)
- + "\t");
- }
- results.append("\n");
- }
- statement.close();
- connection.close();
- // vacantTABLE.setText(String.valueOf(results));
- }
- // detect problems interacting with the database
- catch (SQLException sqlException ){
- JOptionPane.showMessageDialog( null,
- sqlException.getMessage(), "Database Error",
- JOptionPane.ERROR_MESSAGE );
- System.exit (1);
- }
- // detect problems loading database driver
- catch (ClassNotFoundException classNotFound){
- JOptionPane.showMessageDialog(null,
- classNotFound.getMessage(), "Driver Not Found",
- JOptionPane.ERROR_MESSAGE );
- System.exit(1);
- }
- }
- */
- private void searchAccount()
- {
- RoomNumberSearchA = String.valueOf(RoomNum.getText());
- try
- {
- // load database driver class
- Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
- connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB" );
- statement = connection.createStatement(); // Create statement to query database to get the Room Number
- statement2 = connection.createStatement(); // Create Statement to query database for BookingInfo table
- statement1 = connection.createStatement(); // Create Statement to query database for Guest table
- int GuestNum = 0; // will be using GuestID to search database by using RoomNumber
- resultset = statement.executeQuery("SELECT GuestID FROM BookingInfo WHERE RoomNumber = '"+ RoomNumberSearchA +"'"); // query database for guestID
- if (resultset.next())
- {
- GuestNum = resultset.getInt(1);
- SearchGuest = statement1.executeQuery("SELECT FirstName, LastName FROM Guest WHERE GuestID = " + GuestNum);
- SearchBooking = statement2.executeQuery("SELECT RoomType, ViewType, NumPeople FROM BookingInfo WHERE GuestID = " + GuestNum);
- System.out.println("now searching for room number '" + RoomNumberSearchA + '"');
- while (SearchGuest.next())
- {
- String SFName = SearchGuest.getString("FirstName");
- String SLName = SearchGuest.getString("LastName");
- System.out.println("LAST NAME: " + SLName);
- System.out.println("FIRST NAME: " + SFName);
- F_name.setText(String.valueOf(SFName));
- L_name.setText(String.valueOf(SLName));
- }
- while (SearchBooking.next())
- {
- String SRT = SearchBooking.getString("RoomType");
- String SVT = SearchBooking.getString("ViewType");
- String SNumP = SearchBooking.getString("NumPeople");
- System.out.println("ROOM TYPE: " + SRT);
- System.out.println("VIEW TYPE: " + SVT);
- System.out.println("NUMBER OF GUESTS: " + SNumP);
- Room_Type.setText(String.valueOf(SRT));
- View_Type.setText(String.valueOf(SVT));
- Num_Guests.setText(String.valueOf(SNumP));
- }
- }
- else{
- Component frame3 = null;
- JOptionPane.showMessageDialog(frame3, " Record Not Found");
- }
- statement.close();
- connection.close();
- }
- // detect problems interacting with the database
- catch (SQLException sqlException ){
- JOptionPane.showMessageDialog( null,
- sqlException.getMessage(), "Database Error",
- JOptionPane.ERROR_MESSAGE );
- System.exit (1);
- }
- // detect problems loading database driver
- catch (ClassNotFoundException classNotFound){
- JOptionPane.showMessageDialog(null,
- classNotFound.getMessage(), "Driver Not Found",
- JOptionPane.ERROR_MESSAGE );
- System.exit(1);
- }
- } // end HotelManager constructor definition
- public void checkIn(String RoomTypeCI, String ViewTypeCI, int guestID) throws ClassNotFoundException
- {
- String room = "";
- String view = "";
- String aval = "";
- boolean checked = false;
- try{
- connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB"); // Connect to database
- statement = connection.createStatement();
- }
- catch (SQLException sqlException )
- {
- JOptionPane.showMessageDialog( null, sqlException.getMessage(), "Database Error", JOptionPane.ERROR_MESSAGE );
- System.exit (1);
- }
- for(int i = 1; i <=48; i++)
- {
- try
- {
- resultset = statement.executeQuery("SELECT RoomType, ViewType, Availability FROM RoomInfo WHERE RoomID="+i+";");
- if(resultset.next())
- {
- room = (resultset.getString(1));
- view = (resultset.getString(2));
- aval = (resultset.getString(3));
- }
- //System.out.print(RoomTypeCI);
- //System.out.print(ViewTypeCI);
- //System.out.print(room);
- //System.out.println(checked);
- if(RoomTypeCI.equals(room)&&ViewTypeCI.equals(view)&&aval.equals("VACANT")&&checked==false)
- {
- //System.out.println("check................................"+i);
- checked=true;
- statement.executeUpdate("UPDATE RoomInfo SET GuestID = "+ guestID + ", Availability = 'OCCUPIED' WHERE RoomType = '"+RoomTypeCI+"' AND ViewType = '"+ViewTypeCI+"' AND RoomID = "+i+";");
- //statement.executeUpdate("UPDATE RoomInfo SET GuestID = "+ guestID + ", Availability = 'OCCUPIED' WHERE RoomType = '"+RoomTypeCI+"' AND ViewType = '"+ViewTypeCI+"' AND RoomID = "+i+";");
- //resultset = statement.executeQuery("SELECT RoomNumber FROM RoomInfo WHERE GuestID="+guestID+";");
- //resultset.next();
- //int RmNum = (Integer) resultset.getObject(1);
- //System.out.println(RmNum);
- //statement.executeUpdate("UPDATE BookingInfo SET RoomNumber = " + RmNum + ", WHERE GuestID = '"+guestID+";");
- }
- }
- catch (SQLException sqlException )
- {
- JOptionPane.showMessageDialog( null, sqlException.getMessage(), "Database Error", JOptionPane.ERROR_MESSAGE );
- System.exit (1);
- }
- }
- }
- public void BookingRoom()
- {
- // get user input
- String fname = String.valueOf(Fname.getText());
- String lname = String.valueOf(Lname.getText());
- String adr1 = String.valueOf(Adr1.getText());
- String adr2 = String.valueOf(Adr2.getText());
- String city = String.valueOf(City.getText());
- String state = states.getSelectedItem().toString();
- String NGuests = NumGuests.getSelectedItem().toString();
- //String DAYONE = arrival_CheckIN.getDate().toString();
- //System.out.println(DAYONE);
- String zip = String.valueOf(Zip.getText());
- String RoomTypeCI = ROOMtypeCI.getSelectedItem().toString();
- String ViewTypeCI = VIEWtypeCI.getSelectedItem().toString();
- //int guestID = 5;
- //checking if the user entered valid info to prevent empty spots in the database
- if (fname.equals("") && lname.equals("") && adr1.equals("") && adr2.equals("") && city.equals("") && zip.equals(""))
- {
- Component frame = null;
- JOptionPane.showMessageDialog(frame, "Please Enter Valid Information");
- }
- else
- {
- try {
- Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); // load database driver class
- connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB"); // Connect to database
- statement = connection.createStatement(); // Create Statement to query database
- // creating a statement and different int variables
- int guest1, booking1; // TO CHECK FOR PROPER INSERTION
- guest1 = statement.executeUpdate("INSERT INTO Guest (FirstName, LastName, Address1, Address2, City, State, Zip) VALUES ('" + fname + "', '" + lname+ "','"+ adr1 + "', '" + adr2 + "', '" + city + "', '" + state+ "','" + zip + "');");
- resultset = statement.executeQuery("SELECT GuestID FROM Guest WHERE (Guest.LastName) = '"+lname+"'"); // query database
- resultset.next();
- int GuestID = (Integer) resultset.getObject(1);
- checkIn(RoomTypeCI, ViewTypeCI, GuestID);
- booking1 = statement.executeUpdate("INSERT INTO BookingInfo (GuestID, RoomType, ViewType,NumPeople) VALUES ('" + GuestID + "','"+ RoomTypeCI + "', '" + ViewTypeCI + "', '" + NGuests + "');");
- if (guest1 == 1 && booking1 == 1)
- {
- Component frame = null;
- JOptionPane.showMessageDialog(frame, " Enjoy Your Stay With Us!");
- }
- statement.close();
- connection.close();
- }
- catch (SQLException sqlException )
- {
- JOptionPane.showMessageDialog( null, sqlException.getMessage(), "Database Error", JOptionPane.ERROR_MESSAGE );
- System.exit (1);
- }
- // detect problems loading database driver
- catch (ClassNotFoundException classNotFound)
- {
- JOptionPane.showMessageDialog(null, classNotFound.getMessage(), "Driver Not Found", JOptionPane.ERROR_MESSAGE );
- System.exit(1);
- }
- }
- }// end DbConnection constructor definition
- public void Searching(){
- JFrame SearchPane = new JFrame();
- SearchPane.setSize(500, 200);
- SearchPane.setTitle("Search");
- SearchPane.setLocation(150, 150);
- SearchPane.setBackground(Color.gray);
- JPanel SearchPanel = new JPanel();
- SearchPanel.setLayout(new FlowLayout());
- SearchPanel.setSize(450, 150);
- SearchPanel.setLayout (new FlowLayout());
- JLabel searcH = new JLabel("Room Number:");
- SearchPanel.add(searcH);
- JPanel SEArch = new JPanel();
- JTextField search = new JTextField();
- search.setPreferredSize( new Dimension( 200, 24 ) );
- SEArch.add(search);
- SearchPanel.add(SEArch);
- JButton OKbutton = new JButton("Ok");
- OKbutton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- System.out.println("Searching bill for guest.");
- previewBill();
- double Total = Double.parseDouble(ROOMAMOUNTDAY1.getText())+Double.parseDouble(ROOMAMOUNTDAY2.getText())+Double.parseDouble(ROOMAMOUNTDAY3.getText())+Double.parseDouble(ROOMAMOUNT3_DAY1.getText())+Double.parseDouble(ROOMAMOUNT3_DAY2.getText())+Double.parseDouble(ROOMAMOUNT3_DAY3.getText())+Double.parseDouble(ROOMAMOUNT2_DAY1.getText())+Double.parseDouble(ROOMAMOUNT4_DAY1.getText())+Double.parseDouble(ROOMAMOUNT5_DAY1.getText())+Double.parseDouble(ROOMAMOUNT6_DAY1.getText())+Double.parseDouble(ROOMAMOUNT7_DAY1.getText())
- +Double.parseDouble(ROOMAMOUNT2_DAY2.getText())+Double.parseDouble(ROOMAMOUNT4_DAY2.getText())+Double.parseDouble(ROOMAMOUNT5_DAY2.getText())+Double.parseDouble(ROOMAMOUNT6_DAY2.getText())+Double.parseDouble(ROOMAMOUNT7_DAY2.getText())
- +Double.parseDouble(ROOMAMOUNT2_DAY3.getText())+Double.parseDouble(ROOMAMOUNT4_DAY3.getText())+Double.parseDouble(ROOMAMOUNT5_DAY3.getText())+Double.parseDouble(ROOMAMOUNT6_DAY3.getText())+Double.parseDouble(ROOMAMOUNT7_DAY3.getText());
- DecimalFormat decimalFormat = new DecimalFormat("0.00");
- TotalBILL.setText(String.valueOf(decimalFormat.format(Total)));
- System.out.println("Total is:" +Total);
- }
- });
- OKbutton.setPreferredSize( new Dimension( 60, 25) );
- SearchPanel.add(OKbutton);
- SearchPane.add(SearchPanel);
- SearchPane.setVisible(true);
- }
- private void previewBill()
- {
- String NGuests = NumGuests.getSelectedItem().toString();
- RoomNumberSearchA = String.valueOf(RoomNum.getText());
- /*String RoomPrice_DAY1 = String.valueOf(Room_BILLDAY1.getText());
- String RoomPrice_DAY2 = String.valueOf(Room_DAY2.getText());
- String RoomPrice_DAY3 = String.valueOf(Room_BILLDAY3.getText());
- String Tax_DAY1 = String.valueOf(RoomTax_DAY1.getText());
- String Tax_DAY2 = String.valueOf(RoomTax_DAY2.getText());
- String Tax_DAY3 = String.valueOf(RoomTax_DAY3.getText());*/
- try
- {
- // load database driver class
- Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
- connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB" );
- statement = connection.createStatement();
- statement1 = connection.createStatement();
- statement2 = connection.createStatement();
- statement3 = connection.createStatement();
- statement4 = connection.createStatement();
- statement5 = connection.createStatement();
- statement6 = connection.createStatement();
- statement7 = connection.createStatement();
- statement8 = connection.createStatement();
- statement9 = connection.createStatement();
- statement10 = connection.createStatement();
- statement11 = connection.createStatement();
- statement12 = connection.createStatement();
- statement13 = connection.createStatement();
- int GuestNum = 0;
- resultset = statement.executeQuery("SELECT GuestID FROM BookingInfo WHERE RoomNumber = '"+ RoomNumberSearchA +"'");
- if (resultset.next())
- {
- GuestNum = resultset.getInt(1);
- SearchGuest = statement1.executeQuery("SELECT FirstName, LastName, Address1, Address2, City, State, Zip FROM Guest WHERE GuestID = " + GuestNum);
- SearchRoom = statement2.executeQuery("SELECT RoomNumber FROM BookingInfo WHERE GuestID = " +GuestNum);
- /*DayOneExtra = statement3.executeQuery("SELECT ServiceType, ServiceType2, ServiceType3, ServiceType4 FROM ExtraServicesDAY1 WHERE GuestID = " +GuestNum);
- DayTwoExtra = statement4.executeQuery("SELECT ServiceType, ServiceType2, ServiceType3, ServiceType4 FROM ExtraServicesDAY2 WHERE GuestID = " +GuestNum);
- DayThreeExtra = statement5.executeQuery("SELECT ServiceType, ServiceType2, ServiceType3, ServiceType4 FROM ExtraServicesDAY3 WHERE GuestID = " +GuestNum);*/
- ExtraPerson = statement6.executeQuery("SELECT NumPeople FROM BookingInfo WHERE GuestID = " +GuestNum);
- RoomPrice = statement7.executeQuery("SELECT RoomPrice FROM RoomInfo WHERE GuestID = " +GuestNum);
- /*Second*/RoomPrice = statement12.executeQuery("SELECT SecondPersonPrice FROM RoomInfo WHERE GuestID = " +GuestNum);
- RoomTaxPrice = statement11.executeQuery("SELECT RoomTax FROM RoomInfo WHERE GuestID = " +GuestNum);
- /*Second*/RoomTaxPrice = statement13.executeQuery("SELECT SecondPersonRoomTax FROM RoomInfo WHERE GuestID = " +GuestNum);
- ExtraPrice_DAY1 = statement8.executeQuery("SELECT Price, Price2, Price3, Price4 FROM ExtraServicesDAY1 WHERE GuestID = " +GuestNum);
- ExtraPrice_DAY2 = statement9.executeQuery("SELECT Price, Price2, Price3, Price4 FROM ExtraServicesDAY2 WHERE GuestID = " +GuestNum);
- ExtraPrice_DAY3 = statement10.executeQuery("SELECT Price, Price2, Price3, Price4 FROM ExtraServicesDAY3 WHERE GuestID = " +GuestNum);
- while (SearchGuest.next())
- {
- String SFName = SearchGuest.getString("FirstName");
- String SLName = SearchGuest.getString("LastName");
- String SAdr1 = SearchGuest.getString("Address1");
- String SAdr2 = SearchGuest.getString("Address2");
- String SCity = SearchGuest.getString("City");
- String SState = SearchGuest.getString("State");
- String SZip = SearchGuest.getString("Zip");
- System.out.println("FIRST NAME: " + SFName);
- System.out.println("LAST NAME: " + SLName);
- System.out.println("ADDRESS 1: " + SAdr1);
- System.out.println("ADDRESS 2: " + SAdr2);
- System.out.println("CITY: " + SCity);
- System.out.println("STATE: " + SState);
- System.out.println("ZIP: " + SZip);
- FnameBILL.setText(String.valueOf(SFName));
- LnameBILL.setText(String.valueOf(SLName));
- Adr1BILL.setText(String.valueOf(SAdr1) + " " +String.valueOf(SAdr2));
- Adr2BILL.setText(String.valueOf(SCity) + ", " +String.valueOf(SState) + " " +String.valueOf(SZip));
- }
- while (SearchRoom.next())
- {
- String SRoomNum = SearchRoom.getString("RoomNumber");
- System.out.println("ROOM NUMBER: " + SRoomNum);
- RoomNum_BILL.setText(String.valueOf(SRoomNum));
- }
- /*while (DayOneExtra.next())
- {
- String SExtraCharge = DayOneExtra.getString("ServiceType");
- String SExtra2Charge = DayOneExtra.getString("ServiceType2");
- String SExtra3Charge = DayOneExtra.getString("ServiceType3");
- String SExtra4Charge = DayOneExtra.getString("ServiceType4");
- System.out.println("DAY ONE SERVICE: " +SExtraCharge);
- System.out.println("DAY ONE SERVICE: " +SExtra2Charge);
- System.out.println("DAY ONE SERVICE: " +SExtra3Charge);
- System.out.println("DAY ONE SERVICE: " +SExtra4Charge);
- Room_BILLDAY1.setText("Room");
- RoomTax_DAY1.setText("Room Tax");
- if(SExtraCharge == null)
- Extra1_DAY1.setText("");
- Extra1_DAY1.setText(String.valueOf(SExtraCharge));
- if(SExtra2Charge == null)
- Extra1_DAY1.setText("");
- Extra2_DAY1.setText(String.valueOf(SExtra2Charge));
- if(SExtra3Charge == null)
- Extra1_DAY1.setText("");
- Extra3_DAY1.setText(String.valueOf(SExtra3Charge));
- if(SExtra4Charge == null)
- Extra1_DAY1.setText("");
- Extra4_DAY1.setText(String.valueOf(SExtra4Charge));
- }
- while (DayTwoExtra.next())
- {
- String SExtraCharge = DayTwoExtra.getString("ServiceType");
- String SExtra2Charge = DayTwoExtra.getString("ServiceType2");
- String SExtra3Charge = DayTwoExtra.getString("ServiceType3");
- String SExtra4Charge = DayTwoExtra.getString("ServiceType4");
- System.out.println("DAY TWO SERVICE: " +SExtraCharge);
- System.out.println("DAY TWO SERVICE: " +SExtra2Charge);
- System.out.println("DAY TWO SERVICE: " +SExtra3Charge);
- System.out.println("DAY TWO SERVICE: " +SExtra4Charge);
- Room_DAY2.setText("Room");
- RoomTax_DAY2.setText("Room Tax");
- if(SExtraCharge == null)
- Extra1_DAY2.setText("");
- Extra1_DAY2.setText(String.valueOf(SExtraCharge));
- if(SExtraCharge == null)
- Extra2_DAY2.setText("");
- Extra2_DAY2.setText(String.valueOf(SExtra2Charge));
- if(SExtraCharge == null)
- Extra3_DAY2.setText("");
- Extra3_DAY2.setText(String.valueOf(SExtra3Charge));
- if(SExtraCharge == null)
- Extra4_DAY2.setText("");
- Extra4_DAY2.setText(String.valueOf(SExtra4Charge));
- }
- while (DayThreeExtra.next())
- {
- String SExtraCharge = DayThreeExtra.getString("ServiceType");
- String SExtra2Charge = DayThreeExtra.getString("ServiceType2");
- String SExtra3Charge = DayThreeExtra.getString("ServiceType3");
- String SExtra4Charge = DayThreeExtra.getString("ServiceType4");
- System.out.println("DAY THREE SERVICE: " +SExtraCharge);
- System.out.println("DAY THREE SERVICE: " +SExtra2Charge);
- System.out.println("DAY THREE SERVICE: " +SExtra3Charge);
- System.out.println("DAY THREE SERVICE: " +SExtra4Charge);
- Room_BILLDAY3.setText("Room");
- RoomTax_DAY3.setText("Room Tax");
- if(SExtraCharge == null)
- Extra1_DAY3.setText("");
- Extra1_DAY3.setText(String.valueOf(SExtraCharge));
- if(SExtraCharge == null)
- Extra2_DAY3.setText("");
- Extra2_DAY3.setText(String.valueOf(SExtra2Charge));
- if(SExtraCharge == null)
- Extra3_DAY3.setText("");
- Extra3_DAY3.setText(String.valueOf(SExtra3Charge));
- if(SExtraCharge == null)
- Extra4_DAY3.setText("");
- Extra4_DAY3.setText(String.valueOf(SExtra4Charge));
- }*/
- while (ExtraPerson.next())
- {
- Room_BILLDAY1.setText("Room");
- RoomTax_DAY1.setText("Room Tax");
- Room_DAY2.setText("Room");
- RoomTax_DAY2.setText("Room Tax");
- Room_BILLDAY3.setText("Room");
- RoomTax_DAY3.setText("Room Tax");
- /*String SExtraPerson = ExtraPerson.getString("NumPeople");
- System.out.println("NUMBER OF EXTRA PEOPLE: " +SExtraPerson);
- if(SExtraPerson == null)
- ExtraPerson_DAY1.setText("");
- ExtraPerson_DAY1.setText(String.valueOf(SExtraPerson));
- if(SExtraPerson == null)
- ExtraPerson_DAY2.setText("");
- ExtraPerson_DAY2.setText(String.valueOf(SExtraPerson));
- if(SExtraPerson == null)
- ExtraPerson_DAY3.setText("");
- ExtraPerson_DAY3.setText(String.valueOf(SExtraPerson));*/
- }
- while (RoomPrice.next())
- {
- if(NGuests == "1")
- {
- String SRoomPrice = RoomPrice.getString("RoomPrice");
- System.out.println("ROOM PRICE: " +SRoomPrice);
- if(SRoomPrice == null)
- Extra1_DAY1.setText("");
- ROOMAMOUNTDAY1.setText(String.valueOf(SRoomPrice));
- ROOMAMOUNTDAY2.setText(String.valueOf(SRoomPrice));
- ROOMAMOUNTDAY3.setText(String.valueOf(SRoomPrice));
- }
- else
- {
- String S2RoomPrice = RoomPrice.getString("SecondPersonPrice");
- System.out.println("ROOM PRICE: " +S2RoomPrice);
- if(S2RoomPrice == null)
- Extra1_DAY1.setText("");
- ROOMAMOUNTDAY1.setText(String.valueOf(S2RoomPrice));
- ROOMAMOUNTDAY2.setText(String.valueOf(S2RoomPrice));
- ROOMAMOUNTDAY3.setText(String.valueOf(S2RoomPrice));
- }
- }
- while (RoomTaxPrice.next())
- {
- if(NGuests == "1")
- {
- String SRoomTaxPrice = RoomTaxPrice.getString("RoomTax");
- System.out.println("ROOM TAX: " +SRoomTaxPrice);
- ROOMAMOUNT3_DAY1.setText(String.valueOf(SRoomTaxPrice));
- ROOMAMOUNT3_DAY2.setText(String.valueOf(SRoomTaxPrice));
- ROOMAMOUNT3_DAY3.setText(String.valueOf(SRoomTaxPrice));
- }
- else
- {
- String S2RoomTaxPrice = RoomTaxPrice.getString("SecondPersonRoomTax");
- System.out.println("ROOM TAX: " +S2RoomTaxPrice);
- ROOMAMOUNT3_DAY1.setText(String.valueOf(S2RoomTaxPrice));
- ROOMAMOUNT3_DAY2.setText(String.valueOf(S2RoomTaxPrice));
- ROOMAMOUNT3_DAY3.setText(String.valueOf(S2RoomTaxPrice));
- }
- }
- /*while (ExtraPrice_DAY1.next())
- {
- String SExtraPrice = ExtraPrice_DAY1.getString("Price");
- String SExtraPrice2 = ExtraPrice_DAY1.getString("Price2");
- String SExtraPrice3 = ExtraPrice_DAY1.getString("Price3");
- String SExtraPrice4 = ExtraPrice_DAY1.getString("Price4");
- System.out.println("1ST EXTRA PRICE: " +SExtraPrice);
- System.out.println("2ND EXTRA PRICE: " +SExtraPrice2);
- System.out.println("3RD EXTRA PRICE: " +SExtraPrice3);
- System.out.println("4TH EXTRA PRICE: " +SExtraPrice4);
- if(SExtraPrice.equals(0))
- ROOMAMOUNT4_DAY1.setText("");
- ROOMAMOUNT4_DAY1.setText(String.valueOf(SExtraPrice));
- if(SExtraPrice2.equals(0))
- ROOMAMOUNT5_DAY1.setText("");
- ROOMAMOUNT5_DAY1.setText(String.valueOf(SExtraPrice2));
- if(SExtraPrice3.equals(0))
- ROOMAMOUNT6_DAY1.setText("");
- ROOMAMOUNT6_DAY1.setText(String.valueOf(SExtraPrice3));
- if(SExtraPrice4.equals(0))
- ROOMAMOUNT7_DAY1.setText("");
- ROOMAMOUNT7_DAY1.setText(String.valueOf(SExtraPrice4));
- }
- while (ExtraPrice_DAY2.next())
- {
- String SExtraPrice = ExtraPrice_DAY2.getString("Price");
- String SExtraPrice2 = ExtraPrice_DAY2.getString("Price2");
- String SExtraPrice3 = ExtraPrice_DAY2.getString("Price3");
- String SExtraPrice4 = ExtraPrice_DAY2.getString("Price4");
- System.out.println("1ST EXTRA PRICE: " +SExtraPrice);
- System.out.println("2ND EXTRA PRICE: " +SExtraPrice2);
- System.out.println("3RD EXTRA PRICE: " +SExtraPrice3);
- System.out.println("4TH EXTRA PRICE: " +SExtraPrice4);
- if(SExtraPrice.equals(0))
- ROOMAMOUNT4_DAY2.setText("");
- ROOMAMOUNT4_DAY2.setText(String.valueOf(SExtraPrice));
- if(SExtraPrice2.equals(0))
- ROOMAMOUNT5_DAY2.setText("");
- ROOMAMOUNT5_DAY2.setText(String.valueOf(SExtraPrice2));
- if(SExtraPrice3.equals(0))
- ROOMAMOUNT6_DAY2.setText("");
- ROOMAMOUNT6_DAY2.setText(String.valueOf(SExtraPrice3));
- if(SExtraPrice4.equals(0))
- ROOMAMOUNT7_DAY2.setText("");
- ROOMAMOUNT7_DAY2.setText(String.valueOf(SExtraPrice4));
- }
- while (ExtraPrice_DAY3.next())
- {
- String SExtraPrice = ExtraPrice_DAY3.getString("Price");
- String SExtraPrice2 = ExtraPrice_DAY3.getString("Price2");
- String SExtraPrice3 = ExtraPrice_DAY3.getString("Price3");
- String SExtraPrice4 = ExtraPrice_DAY3.getString("Price4");
- System.out.println("1ST EXTRA PRICE: " +SExtraPrice);
- System.out.println("2ND EXTRA PRICE: " +SExtraPrice2);
- System.out.println("3RD EXTRA PRICE: " +SExtraPrice3);
- System.out.println("4TH EXTRA PRICE: " +SExtraPrice4);
- if(SExtraPrice.equals(0))
- ROOMAMOUNT4_DAY3.setText("");
- ROOMAMOUNT4_DAY3.setText(String.valueOf(SExtraPrice));
- if(SExtraPrice2.equals(0))
- ROOMAMOUNT5_DAY3.setText("");
- ROOMAMOUNT5_DAY3.setText(String.valueOf(SExtraPrice2));
- if(SExtraPrice3.equals(0))
- ROOMAMOUNT6_DAY3.setText("");
- ROOMAMOUNT6_DAY3.setText(String.valueOf(SExtraPrice3));
- if(SExtraPrice4.equals(0))
- ROOMAMOUNT7_DAY3.setText("");
- ROOMAMOUNT7_DAY3.setText(String.valueOf(SExtraPrice4));
- }*/
- }
- else{
- Component frame3 = null;
- JOptionPane.showMessageDialog(frame3, " Record Not Found");
- }
- statement.close();
- connection.close();
- }
- // detect problems interacting with the database
- catch (SQLException sqlException )
- {
- JOptionPane.showMessageDialog( null, sqlException.getMessage(), "Database Error", JOptionPane.ERROR_MESSAGE );
- System.exit (1);
- }
- // detect problems loading database driver
- catch (ClassNotFoundException classNotFound)
- {
- JOptionPane.showMessageDialog(null, classNotFound.getMessage(), "Driver Not Found", JOptionPane.ERROR_MESSAGE );
- System.exit(1);
- }
- }
- private void applyCharges()
- { String Service1_DAY1 = String.valueOf(Extra1_DAY1.getText());
- String Service2_DAY1 = String.valueOf(Extra2_DAY1.getText());
- String Service3_DAY1 = String.valueOf(Extra3_DAY1.getText());
- String Service4_DAY1 = String.valueOf(Extra4_DAY1.getText());
- String Price1_DAY1 = String.valueOf(ROOMAMOUNT4_DAY1.getText());
- String Price2_DAY1 = String.valueOf(ROOMAMOUNT5_DAY1.getText());
- String Price3_DAY1 = String.valueOf(ROOMAMOUNT6_DAY1.getText());
- String Price4_DAY1 = String.valueOf(ROOMAMOUNT7_DAY1.getText());
- String Service1_DAY2 = String.valueOf(Extra1_DAY2.getText());
- String Service2_DAY2 = String.valueOf(Extra2_DAY2.getText());
- String Service3_DAY2 = String.valueOf(Extra3_DAY2.getText());
- String Service4_DAY2 = String.valueOf(Extra4_DAY2.getText());
- String Price1_DAY2 = String.valueOf(ROOMAMOUNT4_DAY2.getText());
- String Price2_DAY2 = String.valueOf(ROOMAMOUNT5_DAY2.getText());
- String Price3_DAY2 = String.valueOf(ROOMAMOUNT6_DAY2.getText());
- String Price4_DAY2 = String.valueOf(ROOMAMOUNT7_DAY2.getText());
- String Service1_DAY3 = String.valueOf(Extra1_DAY3.getText());
- String Service2_DAY3 = String.valueOf(Extra2_DAY3.getText());
- String Service3_DAY3 = String.valueOf(Extra3_DAY3.getText());
- String Service4_DAY3 = String.valueOf(Extra4_DAY3.getText());
- String Price1_DAY3 = String.valueOf(ROOMAMOUNT4_DAY3.getText());
- String Price2_DAY3 = String.valueOf(ROOMAMOUNT5_DAY3.getText());
- String Price3_DAY3 = String.valueOf(ROOMAMOUNT6_DAY3.getText());
- String Price4_DAY3 = String.valueOf(ROOMAMOUNT7_DAY3.getText());
- RoomNumberSearchA = String.valueOf(RoomNum.getText());
- try {
- Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); // load database driver class
- connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB"); // Connect to database
- statement = connection.createStatement(); // Create Statement to query database
- resultset = statement.executeQuery("SELECT GuestID FROM BookingInfo WHERE RoomNumber = '"+ RoomNumberSearchA +"'");
- resultset.next();
- int GuestID = (Integer)resultset.getObject(1);
- // creating a statement and different int variables
- int serv_1, serv_2, serv_3; // TO CHECK FOR PROPER INSERTION
- serv_1 = statement.executeUpdate("INSERT INTO ExtraServicesDAY1 (ServiceType, ServiceType2, ServiceType3, ServiceType4, Price, Price2, Price3, Price4, GuestID) VALUES('" + Service1_DAY1 + "', '" + Service2_DAY1 + "','"+ Service3_DAY1+ "', '" + Service4_DAY1 + "', '" + Price1_DAY1 + "', '" + Price2_DAY1 + "', '" + Price3_DAY1 + "', '" + Price4_DAY1 + "', '" + GuestID + "');");
- serv_2 = statement.executeUpdate("INSERT INTO ExtraServicesDAY2 (ServiceType, ServiceType2, ServiceType3, ServiceType4, Price, Price2, Price3, Price4, GuestID) VALUES('" + Service1_DAY2 + "', '" + Service2_DAY2 + "','"+ Service3_DAY2+ "', '" + Service4_DAY2 + "', '" + Price1_DAY2 + "', '" + Price2_DAY2 + "', '" + Price3_DAY2 + "', '" + Price4_DAY2 + "', '" + GuestID + "');");
- serv_3 = statement.executeUpdate("INSERT INTO ExtraServicesDAY3 (ServiceType, ServiceType2, ServiceType3, ServiceType4, Price, Price2, Price3, Price4, GuestID) VALUES('" + Service1_DAY3 + "', '" + Service2_DAY3 + "','"+ Service3_DAY3+ "', '" + Service4_DAY3 + "', '" + Price1_DAY3 + "', '" + Price2_DAY3 + "', '" + Price3_DAY3 + "', '" + Price4_DAY3 + "', '" + GuestID + "');");
- System.out.println("Charges applied");
- }
- catch (SQLException sqlException )
- {
- JOptionPane.showMessageDialog( null, sqlException.getMessage(), "Database Error", JOptionPane.ERROR_MESSAGE );
- System.exit (1);
- }
- // detect problems loading database driver
- catch (ClassNotFoundException classNotFound)
- {
- JOptionPane.showMessageDialog(null, classNotFound.getMessage(), "Driver Not Found", JOptionPane.ERROR_MESSAGE );
- System.exit(1);
- }
- }
- public int print(Graphics g, PageFormat pf, int page) throws
- PrinterException {
- if (page > 0) {
- return NO_SUCH_PAGE;
- }
- Graphics2D g2d = (Graphics2D)g;
- g2d.translate(pf.getImageableX(), pf.getImageableY());
- //this.printAll(g);
- return PAGE_EXISTS;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement