Advertisement
Guest User

Untitled

a guest
May 6th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 73.25 KB | None | 0 0
  1. //package dbGUI;
  2.  
  3. import java.awt.Component;
  4. import java.awt.EventQueue;
  5. //import com.toedter.calendar.JDateChooser;
  6. //import com.toedter.calendar.JDayChooser;
  7. import java.util.*;
  8. import java.util.Date;
  9. import java.text.DecimalFormat;
  10.  
  11. import javax.swing.*;
  12. import javax.swing.table.DefaultTableModel;
  13.  
  14. import java.awt.*;
  15. import java.awt.event.*;
  16. import java.awt.print.*;
  17. import java.sql.*;
  18.  
  19. public class HMSNEW implements Printable{
  20.  
  21.     String [] NumdaysStayed = {"", "1", "2", "3"};
  22.     String [] NumGuestsStayed = {"", "1","2"};
  23.     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"};
  24.     String [] ViewTypeDesc = {"", "Patio", "Forest"};
  25.     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"};
  26.  
  27.     private Connection connection;
  28.     private Statement statement, statement1, statement2, statement3, statement4, statement5, statement6, statement7, statement8, statement9, statement10, statement11, statement12, statement13, statement14;
  29.     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
  30.  
  31.     // strings for the Check-Out Pane
  32.     public String RoomNumberSearchA, FNameSearchA, LNameSearchA, RoomTypeSearchA, ViewTypeSearchA, NumGuestsSearchA;
  33.  
  34.     private JFrame frame;
  35.     private JTextField Fname;
  36.     private JTextField Lname;
  37.     private JTextField Adr1;
  38.     private JTextField Adr2;
  39.     private JTextField City;
  40.     private JTextField Zip;
  41.     private JTextField departDay;
  42.     private JTextField RoomNum;
  43.     private JTextField F_name;
  44.     private JTextField L_name;
  45.     private JTextField Room_Type;
  46.     private JTextField View_Type;
  47.     private JTextField Num_Guests;
  48.  
  49.     private JTextField FnameBILL;
  50.     private JTextField LnameBILL;
  51.     private JTextField Adr1BILL;
  52.     private JTextField Adr2BILL;
  53.     private JTextField RoomNum_BILL;
  54.     private JTextField DAY1_BILL;
  55.     private JTextField Room_BILLDAY1;
  56.     private JTextField ExtraPerson_DAY1;
  57.     private JTextField RoomTax_DAY1;
  58.     private JTextField Extra1_DAY1;
  59.     private JTextField Extra2_DAY1;
  60.     private JTextField Extra3_DAY1;
  61.     private JTextField Extra4_DAY1;
  62.     private JTextField ROOMAMOUNTDAY1;
  63.     private JTextField ROOMAMOUNT2_DAY1;
  64.     private JTextField ROOMAMOUNT3_DAY1;
  65.     private JTextField ROOMAMOUNT4_DAY1;
  66.     private JTextField ROOMAMOUNT5_DAY1;
  67.     private JTextField ROOMAMOUNT6_DAY1;
  68.     private JTextField ROOMAMOUNT7_DAY1;
  69.  
  70.     private JTextField DAY2_BILL;
  71.     private JTextField Room_DAY2;
  72.     private JTextField ExtraPerson_DAY2;
  73.     private JTextField RoomTax_DAY2;
  74.     private JTextField Extra1_DAY2;
  75.     private JTextField Extra2_DAY2;
  76.     private JTextField Extra3_DAY2;
  77.     private JTextField Extra4_DAY2;
  78.     private JTextField ROOMAMOUNTDAY2;
  79.     private JTextField ROOMAMOUNT2_DAY2;
  80.     private JTextField ROOMAMOUNT3_DAY2;
  81.     private JTextField ROOMAMOUNT4_DAY2;
  82.     private JTextField ROOMAMOUNT5_DAY2;
  83.     private JTextField ROOMAMOUNT6_DAY2;
  84.     private JTextField ROOMAMOUNT7_DAY2;
  85.  
  86.     private JTextField DAY3_BILL;
  87.     private JTextField Room_BILLDAY3;
  88.     private JTextField ExtraPerson_DAY3;
  89.     private JTextField RoomTax_DAY3;
  90.     private JTextField Extra1_DAY3;
  91.     private JTextField Extra2_DAY3;
  92.     private JTextField Extra3_DAY3;
  93.     private JTextField Extra4_DAY3;
  94.     private JTextField ROOMAMOUNTDAY3;
  95.     private JTextField ROOMAMOUNT2_DAY3;
  96.     private JTextField ROOMAMOUNT3_DAY3;
  97.     private JTextField ROOMAMOUNT4_DAY3;
  98.     private JTextField ROOMAMOUNT5_DAY3;
  99.     private JTextField ROOMAMOUNT6_DAY3;
  100.     private JTextField ROOMAMOUNT7_DAY3;
  101.     private JTextField TotalBILL;
  102.  
  103.     private JTextField search;
  104.     private JTable vacantTABLE;
  105.     private JComboBox states = new JComboBox(ListStates);
  106.     private JComboBox daysStayed = new JComboBox(NumdaysStayed);
  107.     private JComboBox NumGuests = new JComboBox(NumGuestsStayed);
  108.     private JComboBox daysStayed_Avail = new JComboBox(NumdaysStayed);
  109.     //private JDateChooser arrival_Avail = new JDateChooser();
  110.     //private JDateChooser arrival_CheckIN = new JDateChooser();
  111.     private JComboBox RoomType_Avail = new JComboBox(RoomTypeDesc);
  112.     private JComboBox ViewType_Avail = new JComboBox(ViewTypeDesc);
  113.     private JComboBox ROOMtypeCI = new JComboBox(RoomTypeDesc);
  114.     private JComboBox VIEWtypeCI = new JComboBox(ViewTypeDesc);
  115.     private JRadioButton phone_Day1;
  116.     private JRadioButton RoomSer_Day1;
  117.     private JRadioButton Dining_Day1;
  118.     private JRadioButton EquineAdv_Day1 ;
  119.     private String telephoneDAY1;
  120.     private String diningDAY1;
  121.     private String roomserviceDAY1;
  122.     private String adventureDAY1;
  123.  
  124.     /**
  125.      * Launch the application.
  126.      */
  127.     public static void main(String[] args) {
  128.         EventQueue.invokeLater(new Runnable() {
  129.             public void run() {
  130.                 try {
  131.                     HMSNEW window = new HMSNEW();
  132.                     window.frame.setVisible(true);
  133.                 } catch (Exception e) {
  134.                     e.printStackTrace();
  135.                 }
  136.             }
  137.         });
  138.     }
  139.  
  140.     /**
  141.      * Create the application.
  142.      */
  143.     public HMSNEW() {
  144.         initialize();
  145.     }
  146.  
  147.     /**
  148.      * Initialize the contents of the frame.
  149.      */
  150.     private void initialize() {
  151.         frame = new JFrame();
  152.         frame.setBounds(100, 100, 492, 968);
  153.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  154.         frame.getContentPane().setLayout(new CardLayout(0, 0));
  155.  
  156.         final JPanel mainMenu = new JPanel();
  157.         frame.getContentPane().add(mainMenu, "name_1500680688397675");
  158.         mainMenu.setLayout(null);
  159.  
  160.         final JPanel checkIn = new JPanel();
  161.         frame.getContentPane().add(checkIn, "name_1500684888589853");
  162.         checkIn.setLayout(null);
  163.  
  164.         final JPanel checkOut = new JPanel();
  165.         frame.getContentPane().add(checkOut, "name_1500687027710804");
  166.         checkOut.setLayout(null);
  167.  
  168.         final JPanel checkAvail = new JPanel();
  169.         frame.getContentPane().add(checkAvail, "name_1500814470163147");
  170.         checkAvail.setLayout(null);
  171.  
  172.         final JPanel extraServices = new JPanel();
  173.         frame.getContentPane().add(extraServices, "name_1500862929041108");
  174.         extraServices.setLayout(null);
  175.  
  176.         final JPanel bill = new JPanel();
  177.         frame.getContentPane().add(bill, "name_1500882336028312");
  178.         bill.setLayout(null);
  179.  
  180.  
  181.         //Buttons for main menu.
  182.         JButton CheckINButton = new JButton("Check In");
  183.         CheckINButton.addActionListener(new ActionListener() {
  184.             public void actionPerformed(ActionEvent e)
  185.             {
  186.                 System.out.println("Going in to the Check in Pain");
  187.                 mainMenu.setVisible(false);
  188.                 checkIn.setVisible(true);
  189.             }
  190.         });
  191.         CheckINButton.setFont(new Font("Tahoma", Font.PLAIN, 28));
  192.         CheckINButton.setBounds(12, 135, 450, 158);
  193.         mainMenu.add(CheckINButton);
  194.  
  195.         JLabel lblNewLabel = new JLabel("Hotel Management System");
  196.         lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
  197.         lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 24));
  198.         lblNewLabel.setBounds(12, 22, 450, 100);
  199.         mainMenu.add(lblNewLabel);
  200.  
  201.         JButton CheckOUTButton = new JButton("Check Out");
  202.         CheckOUTButton.addActionListener(new ActionListener() {
  203.             public void actionPerformed(ActionEvent e)
  204.             {
  205.                 System.out.println("Going to Checking OUT Pane");
  206.                 mainMenu.setVisible(false);
  207.                 checkOut.setVisible(true);
  208.             }
  209.             });
  210.         CheckOUTButton.setFont(new Font("Tahoma", Font.PLAIN, 28));
  211.         CheckOUTButton.setBounds(12, 306, 450, 158);
  212.         mainMenu.add(CheckOUTButton);
  213.  
  214.         JButton availButton = new JButton("Check Availability");
  215.         availButton.addActionListener(new ActionListener() {
  216.             public void actionPerformed(ActionEvent e)
  217.             {
  218.                 System.out.println("Going to Checking In Pane");
  219.                 mainMenu.setVisible(false);
  220.                 checkAvail.setVisible(true);
  221.             }
  222.             });
  223.         availButton.setFont(new Font("Tahoma", Font.PLAIN, 28));
  224.         availButton.setBounds(12, 477, 450, 158);
  225.         mainMenu.add(availButton);
  226.  
  227.  
  228.  
  229.         JLabel lblNewLabel_1 = new JLabel("First Name:");
  230.         lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
  231.         lblNewLabel_1.setBounds(10, 45, 82, 14);
  232.         checkIn.add(lblNewLabel_1);
  233.  
  234.         JLabel lblLastName = new JLabel("Last Name:");
  235.         lblLastName.setFont(new Font("Tahoma", Font.PLAIN, 16));
  236.         lblLastName.setBounds(10, 85, 82, 14);
  237.         checkIn.add(lblLastName);
  238.  
  239.         JLabel lblAddress = new JLabel("Address 1:");
  240.         lblAddress.setFont(new Font("Tahoma", Font.PLAIN, 16));
  241.         lblAddress.setBounds(10, 126, 82, 14);
  242.         checkIn.add(lblAddress);
  243.  
  244.         JLabel lblAddress_1 = new JLabel("Address 2:");
  245.         lblAddress_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
  246.         lblAddress_1.setBounds(10, 171, 82, 14);
  247.         checkIn.add(lblAddress_1);
  248.  
  249.         JLabel lblCity = new JLabel("City:");
  250.         lblCity.setFont(new Font("Tahoma", Font.PLAIN, 16));
  251.         lblCity.setBounds(10, 213, 82, 14);
  252.         checkIn.add(lblCity);
  253.  
  254.         JLabel lblState = new JLabel("State:");
  255.         lblState.setFont(new Font("Tahoma", Font.PLAIN, 16));
  256.         lblState.setBounds(10, 253, 82, 14);
  257.         checkIn.add(lblState);
  258.  
  259.         JLabel lblZipcode = new JLabel("Zipcode:");
  260.         lblZipcode.setFont(new Font("Tahoma", Font.PLAIN, 16));
  261.         lblZipcode.setBounds(10, 296, 82, 14);
  262.         checkIn.add(lblZipcode);
  263.  
  264.         JLabel lblLengthOfStay = new JLabel("Length of stay:");
  265.         lblLengthOfStay.setFont(new Font("Tahoma", Font.PLAIN, 16));
  266.         lblLengthOfStay.setBounds(10, 386, 111, 14);
  267.         checkIn.add(lblLengthOfStay);
  268.  
  269.         JLabel lblDeparture = new JLabel("Departure");
  270.         lblDeparture.setFont(new Font("Tahoma", Font.PLAIN, 16));
  271.         lblDeparture.setBounds(10, 428, 82, 14);
  272.         checkIn.add(lblDeparture);
  273.  
  274.         JLabel lblNumberOfGuests = new JLabel("Number of guests:");
  275.         lblNumberOfGuests.setFont(new Font("Tahoma", Font.PLAIN, 16));
  276.         lblNumberOfGuests.setBounds(10, 462, 132, 14);
  277.         checkIn.add(lblNumberOfGuests);
  278.  
  279.         Fname = new JTextField();
  280.         Fname.setBounds(184, 44, 240, 20);
  281.         checkIn.add(Fname);
  282.         Fname.setColumns(10);
  283.  
  284.         Lname = new JTextField();
  285.         Lname.setColumns(10);
  286.         Lname.setBounds(184, 84, 240, 20);
  287.         checkIn.add(Lname);
  288.  
  289.         Adr1 = new JTextField();
  290.         Adr1.setColumns(10);
  291.         Adr1.setBounds(184, 125, 240, 20);
  292.         checkIn.add(Adr1);
  293.  
  294.         Adr2 = new JTextField();
  295.         Adr2.setColumns(10);
  296.         Adr2.setBounds(184, 170, 240, 20);
  297.         checkIn.add(Adr2);
  298.  
  299.         City = new JTextField();
  300.         City.setColumns(10);
  301.         City.setBounds(184, 212, 240, 20);
  302.         checkIn.add(City);
  303.  
  304.         Zip = new JTextField();
  305.         Zip.setColumns(10);
  306.         Zip.setBounds(184, 295, 240, 20);
  307.         checkIn.add(Zip);
  308.  
  309.         departDay = new JTextField();
  310.         departDay.setColumns(10);
  311.         departDay.setBounds(184, 427, 240, 20);
  312.         checkIn.add(departDay);
  313.  
  314.         states.setBounds(184, 252, 240, 20);
  315.         checkIn.add(states);
  316.  
  317.         daysStayed.setBounds(184, 385, 240, 20);
  318.         checkIn.add(daysStayed);
  319.  
  320.         NumGuests.setBounds(184, 460, 240, 20);
  321.         checkIn.add(NumGuests);
  322.  
  323.         JLabel lblArrival = new JLabel("Arrival:");
  324.         lblArrival.setFont(new Font("Tahoma", Font.PLAIN, 16));
  325.         lblArrival.setBounds(10, 344, 82, 14);
  326.         checkIn.add(lblArrival);
  327.  
  328.         /*JDateChooser arrival_CheckIN = new JDateChooser();
  329.         arrival_CheckIN.getCalendarButton().addActionListener(new ActionListener() {
  330.             public void actionPerformed(ActionEvent e) {
  331.             }
  332.         });
  333.         arrival_CheckIN.setBounds(184, 338, 240, 20);
  334.         checkIn.add(arrival_CheckIN);*/
  335.  
  336.         //Buttons for check in
  337.         JButton Check_Avail = new JButton("Check Availability");
  338.         Check_Avail.addActionListener(new ActionListener() {
  339.             public void actionPerformed(ActionEvent e)
  340.             {
  341.                 System.out.println("Going to the Checking Room Availability");
  342.                 checkIn.setVisible(false);
  343.                 checkAvail.setVisible(true);
  344.             }
  345.             });
  346.         Check_Avail.setFont(new Font("Tahoma", Font.PLAIN, 18));
  347.         Check_Avail.setBounds(10, 598, 184, 54);
  348.         checkIn.add(Check_Avail);
  349.  
  350.         JButton checkOUTbutton = new JButton("Check Out");
  351.         checkOUTbutton.addActionListener(new ActionListener() {
  352.             public void actionPerformed(ActionEvent e)
  353.             {
  354.                 System.out.println("Going to Checking OUT Pane");
  355.                 checkIn.setVisible(false);
  356.                 checkOut.setVisible(true);
  357.             }
  358.             });
  359.         checkOUTbutton.setFont(new Font("Tahoma", Font.PLAIN, 18));
  360.         checkOUTbutton.setBounds(285, 598, 177, 54);
  361.         checkIn.add(checkOUTbutton);
  362.  
  363.         JButton Book_Button = new JButton("Book");
  364.         Book_Button.setFont(new Font("Tahoma", Font.PLAIN, 18));
  365.         Book_Button.setBounds(10, 681, 184, 54);
  366.         checkIn.add(Book_Button);
  367.         Book_Button.addActionListener(new ActionListener() {
  368.             public void actionPerformed(ActionEvent e)
  369.             {
  370.                 System.out.println("Booking Room");
  371.                 BookingRoom();
  372.             }
  373.         });
  374.  
  375.         JButton button = new JButton("Main Menu");
  376.         button.addActionListener(new ActionListener()
  377.         {
  378.             public void actionPerformed(ActionEvent e)
  379.             {
  380.                 System.out.println("Going to Main Menu");
  381.                 checkIn.setVisible(false);
  382.                 mainMenu.setVisible(true);
  383.             }
  384.         });
  385.         button.setFont(new Font("Tahoma", Font.PLAIN, 18));
  386.         button.setBounds(285, 681, 177, 54);
  387.         checkIn.add(button);
  388.  
  389.         JLabel lblRoomType_2 = new JLabel("Room Type:");
  390.         lblRoomType_2.setFont(new Font("Tahoma", Font.PLAIN, 16));
  391.         lblRoomType_2.setBounds(10, 499, 132, 14);
  392.         checkIn.add(lblRoomType_2);
  393.  
  394.         JLabel lblViewType_2 = new JLabel("View Type:");
  395.         lblViewType_2.setFont(new Font("Tahoma", Font.PLAIN, 16));
  396.         lblViewType_2.setBounds(10, 532, 132, 14);
  397.         checkIn.add(lblViewType_2);
  398.  
  399.         ROOMtypeCI.setBounds(184, 493, 240, 20);
  400.         checkIn.add(ROOMtypeCI);
  401.  
  402.         VIEWtypeCI.setBounds(184, 530, 240, 20);
  403.         checkIn.add(VIEWtypeCI);
  404.  
  405.         JLabel lblBooking = new JLabel("Room #");
  406.         lblBooking.setFont(new Font("Tahoma", Font.PLAIN, 16));
  407.         lblBooking.setBounds(10, 45, 82, 14);
  408.         checkOut.add(lblBooking);
  409.  
  410.         JLabel label_1 = new JLabel("First Name:");
  411.         label_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
  412.         label_1.setBounds(10, 88, 82, 14);
  413.         checkOut.add(label_1);
  414.  
  415.         JLabel label_2 = new JLabel("Last Name:");
  416.         label_2.setFont(new Font("Tahoma", Font.PLAIN, 16));
  417.         label_2.setBounds(10, 128, 82, 14);
  418.         checkOut.add(label_2);
  419.  
  420.         JLabel lblRoomType = new JLabel("Room Type:");
  421.         lblRoomType.setFont(new Font("Tahoma", Font.PLAIN, 16));
  422.         lblRoomType.setBounds(10, 166, 88, 14);
  423.         checkOut.add(lblRoomType);
  424.  
  425.         JLabel lblViewType = new JLabel("View type:");
  426.         lblViewType.setFont(new Font("Tahoma", Font.PLAIN, 16));
  427.         lblViewType.setBounds(10, 204, 82, 14);
  428.         checkOut.add(lblViewType);
  429.  
  430.         JLabel lblNumberOfGuests_1 = new JLabel("Number of Guests:");
  431.         lblNumberOfGuests_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
  432.         lblNumberOfGuests_1.setBounds(10, 246, 134, 14);
  433.         checkOut.add(lblNumberOfGuests_1);
  434.  
  435.         //Buttons for check out
  436.         JButton btnSearchAccount = new JButton("Search Account");
  437.         btnSearchAccount.setFont(new Font("Tahoma", Font.PLAIN, 18));
  438.         btnSearchAccount.setBounds(10, 297, 184, 54);
  439.         checkOut.add(btnSearchAccount);
  440.         btnSearchAccount.addActionListener(new ActionListener() {
  441.             public void actionPerformed(ActionEvent e)
  442.             {
  443.                 System.out.println("Searching for a Guest Account");
  444.                 searchAccount();
  445.             }
  446.         });
  447.  
  448.         JButton btnAddCharges = new JButton("Add Charges");
  449.         btnAddCharges.addActionListener(new ActionListener() {
  450.             public void actionPerformed(ActionEvent e) {
  451.                 System.out.println("Going to extra services pane");
  452.                 checkOut.setVisible(false);
  453.                 extraServices.setVisible(true);
  454.             }
  455.         });
  456.         btnAddCharges.setFont(new Font("Tahoma", Font.PLAIN, 18));
  457.         btnAddCharges.setBounds(10, 376, 184, 54);
  458.         checkOut.add(btnAddCharges);
  459.  
  460.         JButton btnPreviewBill = new JButton("Preview Bill");
  461.         btnPreviewBill.addActionListener(new ActionListener() {
  462.             public void actionPerformed(ActionEvent e) {
  463.                 Searching();
  464.                 checkOut.setVisible(false);
  465.                 bill.setVisible(true);
  466.             }
  467.         });
  468.         btnPreviewBill.setFont(new Font("Tahoma", Font.PLAIN, 18));
  469.         btnPreviewBill.setBounds(10, 457, 184, 54);
  470.         checkOut.add(btnPreviewBill);
  471.  
  472.  
  473.  
  474.         RoomNum = new JTextField();
  475.         RoomNum.setColumns(10);
  476.         RoomNum.setBounds(184, 44, 240, 20);
  477.         checkOut.add(RoomNum);
  478.  
  479.         F_name = new JTextField();
  480.         F_name.setColumns(10);
  481.         F_name.setBounds(184, 87, 240, 20);
  482.         checkOut.add(F_name);
  483.  
  484.         L_name = new JTextField();
  485.         L_name.setColumns(10);
  486.         L_name.setBounds(184, 127, 240, 20);
  487.         checkOut.add(L_name);
  488.  
  489.         Room_Type = new JTextField();
  490.         Room_Type.setColumns(10);
  491.         Room_Type.setBounds(184, 165, 240, 20);
  492.         checkOut.add(Room_Type);
  493.  
  494.         View_Type = new JTextField();
  495.         View_Type.setColumns(10);
  496.         View_Type.setBounds(184, 203, 240, 20);
  497.         checkOut.add(View_Type);
  498.  
  499.         Num_Guests = new JTextField();
  500.         Num_Guests.setColumns(10);
  501.         Num_Guests.setBounds(184, 245, 240, 20);
  502.         checkOut.add(Num_Guests);
  503.  
  504.         JButton button_1 = new JButton("Main Menu");
  505.         button_1.addActionListener(new ActionListener()
  506.         {
  507.             public void actionPerformed(ActionEvent e)
  508.             {
  509.                 System.out.println("Going to Main Menu");
  510.                 checkOut.setVisible(false);
  511.                 mainMenu.setVisible(true);
  512.             }
  513.         });
  514.         button_1.setFont(new Font("Tahoma", Font.PLAIN, 18));
  515.         button_1.setBounds(10, 534, 184, 54);
  516.         checkOut.add(button_1);
  517.  
  518.         JLabel lblRoomType_1 = new JLabel("Room type:");
  519.         lblRoomType_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
  520.         lblRoomType_1.setBounds(10, 49, 111, 14);
  521.         checkAvail.add(lblRoomType_1);
  522.  
  523.  
  524.         RoomType_Avail.setBounds(184, 47, 240, 20);
  525.         checkAvail.add(RoomType_Avail);
  526.  
  527.         JLabel lblViewType_1 = new JLabel("View type:");
  528.         lblViewType_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
  529.         lblViewType_1.setBounds(10, 114, 111, 14);
  530.         checkAvail.add(lblViewType_1);
  531.  
  532.  
  533.         ViewType_Avail.setBounds(184, 112, 240, 20);
  534.         checkAvail.add(ViewType_Avail);
  535.  
  536.         JLabel lblRoomResults = new JLabel("Room Results:");
  537.         lblRoomResults.setHorizontalAlignment(SwingConstants.CENTER);
  538.         lblRoomResults.setFont(new Font("Tahoma", Font.PLAIN, 16));
  539.         lblRoomResults.setBounds(10, 195, 452, 14);
  540.         checkAvail.add(lblRoomResults);
  541.  
  542.         JButton Check_IN_Button = new JButton("Check In");
  543.         Check_IN_Button.addActionListener(new ActionListener() {
  544.             public void actionPerformed(ActionEvent e) {
  545.  
  546.                 System.out.println("Going to Checking In Pane");
  547.                 checkAvail.setVisible(false);
  548.                 checkIn.setVisible(true);
  549.             }
  550.         });
  551.         Check_IN_Button.setFont(new Font("Tahoma", Font.PLAIN, 28));
  552.         Check_IN_Button.setBounds(10, 448, 452, 121);
  553.         checkAvail.add(Check_IN_Button);
  554.  
  555.         JButton btnSearch = new JButton("Search");
  556.         btnSearch.setFont(new Font("Tahoma", Font.PLAIN, 28));
  557.         btnSearch.setBounds(10, 582, 452, 121);
  558.         checkAvail.add(btnSearch);
  559.  
  560.         JButton MMButton = new JButton("Main Menu");
  561.         MMButton.addActionListener(new ActionListener()
  562.         {
  563.             public void actionPerformed(ActionEvent e)
  564.             {
  565.                 System.out.println("Going to Main Menu");
  566.                 checkAvail.setVisible(false);
  567.                 mainMenu.setVisible(true);
  568.             }
  569.         });
  570.  
  571.         MMButton.setFont(new Font("Tahoma", Font.PLAIN, 28));
  572.         MMButton.setBounds(10, 716, 452, 121);
  573.         checkAvail.add(MMButton);
  574.  
  575.         vacantTABLE = new JTable();
  576.         vacantTABLE.setModel(new DefaultTableModel(
  577.             new Object[][] {
  578.                 {null, null, null, null, null},
  579.                 {null, null, null, null, null},
  580.                 {null, null, null, null, null},
  581.                 {null, null, null, null, null},
  582.                 {null, null, null, null, null},
  583.                 {null, null, null, null, null},
  584.                 {null, null, null, null, null},
  585.                 {null, null, null, null, null},
  586.                 {null, null, null, null, null},
  587.                 {null, null, null, null, null},
  588.                 {null, null, null, null, null},
  589.                 {null, null, null, null, null},
  590.                 {null, null, null, null, null},
  591.                 {null, null, null, null, null},
  592.             },
  593.             new String[] {
  594.                 "New column", "New column", "New column", "New column", "New column"
  595.             }
  596.         ));
  597.         vacantTABLE.setBounds(10, 222, 452, 213);
  598.         checkAvail.add(vacantTABLE);
  599.  
  600.         JLabel lblExtraServicesOffered = new JLabel("Extra Services Offered");
  601.         lblExtraServicesOffered.setFont(new Font("Tahoma", Font.PLAIN, 16));
  602.         lblExtraServicesOffered.setBounds(10, 11, 166, 14);
  603.         extraServices.add(lblExtraServicesOffered);
  604.  
  605.         JLabel lblTelephone = new JLabel("Telephone");
  606.         lblTelephone.setFont(new Font("Tahoma", Font.PLAIN, 16));
  607.         lblTelephone.setBounds(10, 65, 82, 14);
  608.         extraServices.add(lblTelephone);
  609.  
  610.         JLabel lblRoomService = new JLabel("Room Service:");
  611.         lblRoomService.setFont(new Font("Tahoma", Font.PLAIN, 16));
  612.         lblRoomService.setBounds(10, 113, 103, 14);
  613.         extraServices.add(lblRoomService);
  614.  
  615.         JLabel lblDiningRoom = new JLabel("Dining Room:");
  616.         lblDiningRoom.setFont(new Font("Tahoma", Font.PLAIN, 16));
  617.         lblDiningRoom.setBounds(10, 158, 103, 14);
  618.         extraServices.add(lblDiningRoom);
  619.  
  620.         JLabel lblAquestrineAdventure = new JLabel("Equine Adventure:");
  621.         lblAquestrineAdventure.setFont(new Font("Tahoma", Font.PLAIN, 16));
  622.         lblAquestrineAdventure.setBounds(10, 206, 132, 14);
  623.         extraServices.add(lblAquestrineAdventure);
  624.  
  625.         JLabel lblExtraPerson = new JLabel("Extra Person:");
  626.         lblExtraPerson.setFont(new Font("Tahoma", Font.PLAIN, 16));
  627.         lblExtraPerson.setBounds(10, 253, 103, 14);
  628.         extraServices.add(lblExtraPerson);
  629.  
  630.         JRadioButton phone_Day1 = new JRadioButton("Telephone");
  631.         phone_Day1.addActionListener(new ActionListener() {
  632.             public void actionPerformed(ActionEvent e) {
  633.                 if(e.getSource() instanceof JRadioButton){
  634.                      JRadioButton radioButton = (JRadioButton) e.getSource();
  635.                          if(radioButton.isSelected()){
  636.                             Extra1_DAY1.setText(radioButton.getText());
  637.                             ROOMAMOUNT4_DAY1.setText("2.47");
  638.             }
  639.                         else
  640.                         {
  641.                             Extra1_DAY1.setText("0.00");
  642.                             ROOMAMOUNT4_DAY1.setText("0.00");
  643.                         }
  644.                     System.out.println("Applying Phone Charges to Day 1 of your Bill");
  645.             }       //applyCharges();
  646.             }
  647.         });
  648.         phone_Day1.setBounds(223, 65, 21, 23);
  649.         extraServices.add(phone_Day1);
  650.  
  651.         JRadioButton RoomSer_Day1 = new JRadioButton("Room Service");
  652.         RoomSer_Day1.addActionListener(new ActionListener() {
  653.             public void actionPerformed(ActionEvent e) {
  654.                     if(e.getSource() instanceof JRadioButton){
  655.                         JRadioButton radioButton = (JRadioButton) e.getSource();
  656.                             if(radioButton.isSelected()){
  657.                                Extra2_DAY1.setText(radioButton.getText());
  658.                                ROOMAMOUNT5_DAY1.setText("33.50");
  659.             }
  660.                         else
  661.                         {
  662.                             Extra2_DAY1.setText("0.00");
  663.                             ROOMAMOUNT5_DAY1.setText("0.00");
  664.                         }
  665.                 System.out.println("Applying Room Service Charges to Day 1 of your Bill");
  666.             }   //applyCharges();
  667.             }
  668.         });
  669.         RoomSer_Day1.setBounds(223, 111, 21, 23);
  670.         extraServices.add(RoomSer_Day1);
  671.  
  672.         JRadioButton Dining_Day1 = new JRadioButton("Dining Room");
  673.         Dining_Day1.addActionListener(new ActionListener() {
  674.             public void actionPerformed(ActionEvent e) {
  675.                     if(e.getSource() instanceof JRadioButton){
  676.                         JRadioButton radioButton = (JRadioButton) e.getSource();
  677.                             if(radioButton.isSelected()){
  678.                                   Extra3_DAY1.setText(radioButton.getText());
  679.                                   ROOMAMOUNT6_DAY1.setText("87.50");
  680.             }
  681.                         else
  682.                         {
  683.                             Extra3_DAY1.setText("0.00");
  684.                             ROOMAMOUNT6_DAY1.setText("0.00");
  685.                         }
  686.                 System.out.println("Applying Dining Charges to Day 1 of your Bill");
  687.             }   //applyCharges();
  688.             }
  689.         });
  690.         Dining_Day1.setBounds(223, 156, 21, 23);
  691.         extraServices.add(Dining_Day1);
  692.  
  693.         JRadioButton EquineAdv_Day1 = new JRadioButton("Equestrian Adventure");
  694.         EquineAdv_Day1.addActionListener(new ActionListener() {
  695.             public void actionPerformed(ActionEvent e) {
  696.                     if(e.getSource() instanceof JRadioButton){
  697.                             JRadioButton radioButton = (JRadioButton) e.getSource();
  698.                                   if(radioButton.isSelected()){
  699.                                        Extra4_DAY1.setText(radioButton.getText());
  700.                                        ROOMAMOUNT7_DAY1.setText("195.00");
  701.             }
  702.                         else
  703.                         {
  704.                             Extra4_DAY1.setText("0.00");
  705.                             ROOMAMOUNT7_DAY1.setText("0.00");
  706.                         }
  707.                 System.out.println("Applying Equestrian Adventure Charges to Day 1 of your Bill");
  708.             }   //applyCharges();
  709.             }
  710.         });
  711.         EquineAdv_Day1.setBounds(223, 204, 21, 23);
  712.         extraServices.add(EquineAdv_Day1);
  713.  
  714.         JRadioButton ExtraPerson_Day1 = new JRadioButton("Extra Person");
  715.         ExtraPerson_Day1.addActionListener(new ActionListener() {
  716.             public void actionPerformed(ActionEvent e) {
  717.                 if(e.getSource() instanceof JRadioButton){
  718.                         JRadioButton radioButton = (JRadioButton) e.getSource();
  719.                         if(radioButton.isSelected()){
  720.                         ExtraPerson_DAY1.setText(radioButton.getText());
  721.                         ROOMAMOUNT2_DAY1.setText("22.00");
  722.             }
  723.                     else
  724.                     {
  725.                         ExtraPerson_DAY1.setText("0.00");
  726.                         ROOMAMOUNT2_DAY1.setText("0.00");
  727.                     }
  728.                 System.out.println("Applying Extra Person Charges to Day 1 of your Bill");
  729.                 //applyCharges();
  730.             }
  731.             }
  732.         });
  733.         ExtraPerson_Day1.setBounds(223, 251, 21, 23);
  734.         extraServices.add(ExtraPerson_Day1);
  735.  
  736.         JRadioButton phone_Day2 = new JRadioButton("Telephone");
  737.         phone_Day2.addActionListener(new ActionListener() {
  738.             public void actionPerformed(ActionEvent e) {
  739.                 if(e.getSource() instanceof JRadioButton){
  740.                     JRadioButton radioButton = (JRadioButton) e.getSource();
  741.                         if(radioButton.isSelected()){
  742.                             Extra1_DAY2.setText(radioButton.getText());
  743.                             ROOMAMOUNT4_DAY2.setText("2.47");
  744.             }
  745.                         else
  746.                         {
  747.                             Extra1_DAY2.setText("0.00");
  748.                             ROOMAMOUNT4_DAY2.setText("0.00");
  749.                         }
  750.                 System.out.println("Applying Phone Charges to Day 2 of your Bill");
  751.             }   //applyCharges();
  752.             }
  753.         });
  754.         phone_Day2.setBounds(293, 63, 21, 23);
  755.         extraServices.add(phone_Day2);
  756.  
  757.         JRadioButton phone_Day3 = new JRadioButton("Telephone");
  758.         phone_Day3.addActionListener(new ActionListener() {
  759.             public void actionPerformed(ActionEvent e) {
  760.                 if(e.getSource() instanceof JRadioButton){
  761.                         JRadioButton radioButton = (JRadioButton) e.getSource();
  762.                              if(radioButton.isSelected()){
  763.                                     Extra1_DAY3.setText(radioButton.getText());
  764.                                     ROOMAMOUNT4_DAY3.setText("2.47");
  765.             }
  766.                         else
  767.                         {
  768.                             Extra1_DAY3.setText("0.00");
  769.                             ROOMAMOUNT4_DAY3.setText("0.00");
  770.                         }
  771.                 System.out.println("Applying Phone Charges to Day 3 of your Bill");
  772.             }   //applyCharges();
  773.             }
  774.         });
  775.         phone_Day3.setBounds(362, 63, 21, 23);
  776.         extraServices.add(phone_Day3);
  777.  
  778.         JRadioButton RoomSer_Day2 = new JRadioButton("Room Service");
  779.         RoomSer_Day2.addActionListener(new ActionListener() {
  780.             public void actionPerformed(ActionEvent e) {
  781.                 if(e.getSource() instanceof JRadioButton){
  782.                     JRadioButton radioButton = (JRadioButton) e.getSource();
  783.                         if(radioButton.isSelected()){
  784.                             Extra2_DAY2.setText(radioButton.getText());
  785.                             ROOMAMOUNT5_DAY2.setText("33.50");
  786.             }
  787.                         else
  788.                         {
  789.                             Extra2_DAY2.setText("0.00");
  790.                             ROOMAMOUNT5_DAY2.setText("0.00");
  791.                         }
  792.                 System.out.println("Applying Room Service Charges to Day 2 of your Bill");
  793.             }   //applyCharges();
  794.             }
  795.         });
  796.         RoomSer_Day2.setBounds(293, 111, 21, 23);
  797.         extraServices.add(RoomSer_Day2);
  798.  
  799.         JRadioButton RoomSer_Day3 = new JRadioButton("Room Service");
  800.         RoomSer_Day3.addActionListener(new ActionListener() {
  801.             public void actionPerformed(ActionEvent e) {
  802.                 if(e.getSource() instanceof JRadioButton){
  803.                     JRadioButton radioButton = (JRadioButton) e.getSource();
  804.                         if(radioButton.isSelected()){
  805.                             Extra2_DAY3.setText(radioButton.getText());
  806.                             ROOMAMOUNT5_DAY3.setText("33.50");
  807.             }
  808.                         else
  809.                         {
  810.                             Extra2_DAY3.setText("0.00");
  811.                             ROOMAMOUNT5_DAY3.setText("0.00");
  812.                         }
  813.                 System.out.println("Applying Room Service Charges to Day 3 of your Bill");
  814.             }   //applyCharges();
  815.             }
  816.         });
  817.         RoomSer_Day3.setBounds(362, 111, 21, 23);
  818.         extraServices.add(RoomSer_Day3);
  819.  
  820.         JRadioButton Dining_Day2 = new JRadioButton("Dining Room");
  821.         Dining_Day2.addActionListener(new ActionListener() {
  822.             public void actionPerformed(ActionEvent e) {
  823.                 if(e.getSource() instanceof JRadioButton){
  824.                     JRadioButton radioButton = (JRadioButton) e.getSource();
  825.                         if(radioButton.isSelected()){
  826.                                 Extra3_DAY2.setText(radioButton.getText());
  827.                                 ROOMAMOUNT6_DAY2.setText("87.50");
  828.             }
  829.                         else
  830.                         {
  831.                             Extra3_DAY2.setText("0.00");
  832.                             ROOMAMOUNT6_DAY2.setText("0.00");
  833.                         }
  834.                 System.out.println("Applying Dining Charges to Day 2 of your Bill");
  835.             }   //applyCharges();
  836.             }
  837.         });
  838.         Dining_Day2.setBounds(293, 156, 21, 23);
  839.         extraServices.add(Dining_Day2);
  840.  
  841.         JRadioButton Dining_Day3 = new JRadioButton("Dining Room");
  842.         Dining_Day3.addActionListener(new ActionListener() {
  843.             public void actionPerformed(ActionEvent e) {
  844.                 if(e.getSource() instanceof JRadioButton){
  845.                     JRadioButton radioButton = (JRadioButton) e.getSource();
  846.                         if(radioButton.isSelected()){
  847.                             Extra3_DAY3.setText(radioButton.getText());
  848.                             ROOMAMOUNT6_DAY3.setText("87.50");
  849.             }
  850.                         else
  851.                         {
  852.                             Extra3_DAY3.setText("0.00");
  853.                             ROOMAMOUNT6_DAY3.setText("0.00");
  854.                         }
  855.                 System.out.println("Applying Dining Charges to Day 3 of your Bill");
  856.             }   //applyCharges();
  857.            }
  858.         });
  859.         Dining_Day3.setBounds(362, 156, 21, 23);
  860.         extraServices.add(Dining_Day3);
  861.  
  862.         JRadioButton EquineAdv_Day2 = new JRadioButton("Equestrian Adventure");
  863.         EquineAdv_Day2.addActionListener(new ActionListener() {
  864.             public void actionPerformed(ActionEvent e) {
  865.                 if(e.getSource() instanceof JRadioButton){
  866.                     JRadioButton radioButton = (JRadioButton) e.getSource();
  867.                         if(radioButton.isSelected()){
  868.                             Extra4_DAY2.setText(radioButton.getText());
  869.                             ROOMAMOUNT7_DAY2.setText("195.00");
  870.             }
  871.                         else
  872.                         {
  873.                             Extra4_DAY2.setText("0.00");
  874.                             ROOMAMOUNT7_DAY2.setText("0.00");
  875.                         }
  876.                 System.out.println("Applying Equestrian Adventure Charges to Day 2 of your Bill");
  877.             }   //applyCharges();
  878.             }
  879.         });
  880.         EquineAdv_Day2.setBounds(293, 204, 21, 23);
  881.         extraServices.add(EquineAdv_Day2);
  882.  
  883.         JRadioButton EquineAdv_Day3 = new JRadioButton("Equestrian Adventure");
  884.         EquineAdv_Day3.addActionListener(new ActionListener() {
  885.             public void actionPerformed(ActionEvent e) {
  886.                     if(e.getSource() instanceof JRadioButton){
  887.                         JRadioButton radioButton = (JRadioButton) e.getSource();
  888.                             if(radioButton.isSelected()){
  889.                                   Extra4_DAY3.setText(radioButton.getText());
  890.                                   ROOMAMOUNT7_DAY3.setText("195.00");
  891.             }
  892.                         else
  893.                         {
  894.                             Extra4_DAY3.setText("0.00");
  895.                             ROOMAMOUNT7_DAY3.setText("0.00");
  896.                         }
  897.                 System.out.println("Applying Equestrian Adventure Charges to Day 3 of your Bill");
  898.             }   //applyCharges();
  899.             }
  900.         });
  901.         EquineAdv_Day3.setBounds(362, 204, 21, 23);
  902.         extraServices.add(EquineAdv_Day3);
  903.  
  904.         JRadioButton ExtraPerson_Day2 = new JRadioButton("Extra Person");
  905.         ExtraPerson_Day2.addActionListener(new ActionListener() {
  906.             public void actionPerformed(ActionEvent e) {
  907.                 if(e.getSource() instanceof JRadioButton){
  908.                         JRadioButton radioButton = (JRadioButton) e.getSource();
  909.                             if(radioButton.isSelected()){
  910.                                 ExtraPerson_DAY2.setText(radioButton.getText());
  911.                                 ROOMAMOUNT2_DAY2.setText("22.00");
  912.             }
  913.                         else
  914.                         {
  915.                             ExtraPerson_DAY2.setText("0.00");
  916.                             ROOMAMOUNT2_DAY2.setText("0.00");
  917.                         }
  918.                 System.out.println("Applying Extra Person Charges to Day 2 of your Bill");
  919.                 //applyCharges();
  920.             }
  921.             }
  922.         });
  923.         ExtraPerson_Day2.setBounds(293, 251, 21, 23);
  924.         extraServices.add(ExtraPerson_Day2);
  925.  
  926.         JRadioButton ExtraPerson_Day3 = new JRadioButton("Extra Person");
  927.         ExtraPerson_Day3.addActionListener(new ActionListener() {
  928.             public void actionPerformed(ActionEvent e) {
  929.                 if(e.getSource() instanceof JRadioButton){
  930.                         JRadioButton radioButton = (JRadioButton) e.getSource();
  931.                             if(radioButton.isSelected()){
  932.                                 ExtraPerson_DAY3.setText(radioButton.getText());
  933.                                 ROOMAMOUNT2_DAY3.setText("22.00");
  934.             }
  935.                         else
  936.                         {
  937.                             ExtraPerson_DAY3.setText("0.00");
  938.                             ROOMAMOUNT2_DAY3.setText("0.00");
  939.                         }
  940.                 System.out.println("Applying Extra Person Charges to Day 3 of your Bill");
  941.                 //applyCharges();
  942.             }
  943.             }
  944.         });
  945.         ExtraPerson_Day3.setBounds(362, 251, 21, 23);
  946.         extraServices.add(ExtraPerson_Day3);
  947.  
  948.         JLabel lblDay = new JLabel("Day 1");
  949.         lblDay.setFont(new Font("Tahoma", Font.PLAIN, 14));
  950.         lblDay.setBounds(210, 40, 46, 14);
  951.         extraServices.add(lblDay);
  952.  
  953.         JLabel lblDay_1 = new JLabel("Day 2");
  954.         lblDay_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
  955.         lblDay_1.setBounds(279, 40, 46, 14);
  956.         extraServices.add(lblDay_1);
  957.  
  958.         JLabel lblDay_2 = new JLabel("Day 3");
  959.         lblDay_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
  960.         lblDay_2.setBounds(351, 40, 46, 14);
  961.         extraServices.add(lblDay_2);
  962.  
  963.         JButton btnApplyCharges = new JButton("Apply Charges");
  964.         btnApplyCharges.addActionListener(new ActionListener() {
  965.                     public void actionPerformed(ActionEvent e) {
  966.                         System.out.println("Applying Charges to your Bill");
  967.                         applyCharges();
  968.                     }
  969.         });
  970.         btnApplyCharges.setFont(new Font("Tahoma", Font.PLAIN, 18));
  971.         btnApplyCharges.setBounds(10, 360, 184, 54);
  972.         extraServices.add(btnApplyCharges);
  973.  
  974.         JButton btnPreviewBill_1 = new JButton("Preview Bill");
  975.         btnPreviewBill_1.addActionListener(new ActionListener() {
  976.             public void actionPerformed(ActionEvent e) {
  977.  
  978.                 Searching();
  979.                 System.out.println("Previewing your Bill");
  980.                 extraServices.setVisible(false);
  981.                 bill.setVisible(true);
  982.             }
  983.         });
  984.         btnPreviewBill_1.setFont(new Font("Tahoma", Font.PLAIN, 18));
  985.         btnPreviewBill_1.setBounds(10, 459, 184, 54);
  986.         extraServices.add(btnPreviewBill_1);
  987.  
  988.         JButton btnBackToCheck = new JButton("Back to Check Out");
  989.         btnBackToCheck.addActionListener(new ActionListener()
  990.         {
  991.             public void actionPerformed(ActionEvent e)
  992.             {
  993.                 System.out.println("Going to Checking OUT Pane");
  994.                 checkOut.setVisible(true);
  995.                 extraServices.setVisible(false);
  996.             }
  997.         });
  998.         btnBackToCheck.setFont(new Font("Tahoma", Font.PLAIN, 18));
  999.         btnBackToCheck.setBounds(279, 360, 183, 54);
  1000.         extraServices.add(btnBackToCheck);
  1001.  
  1002.         JLabel lblGuest = new JLabel("Guest:");
  1003.         lblGuest.setFont(new Font("Tahoma", Font.PLAIN, 16));
  1004.         lblGuest.setBounds(10, 11, 46, 14);
  1005.         bill.add(lblGuest);
  1006.  
  1007.         FnameBILL = new JTextField();
  1008.         FnameBILL.setColumns(10);
  1009.         FnameBILL.setBounds(107, 10, 150, 20);
  1010.         bill.add(FnameBILL);
  1011.  
  1012.         LnameBILL = new JTextField();
  1013.         LnameBILL.setColumns(10);
  1014.         LnameBILL.setBounds(274, 10, 150, 20);
  1015.         bill.add(LnameBILL);
  1016.  
  1017.         Adr1BILL = new JTextField();
  1018.         Adr1BILL.setColumns(10);
  1019.         Adr1BILL.setBounds(107, 41, 317, 20);
  1020.         bill.add(Adr1BILL);
  1021.  
  1022.         RoomNum_BILL = new JTextField();
  1023.         RoomNum_BILL.setColumns(10);
  1024.         RoomNum_BILL.setBounds(107, 111, 150, 20);
  1025.         bill.add(RoomNum_BILL);
  1026.  
  1027.         Adr2BILL = new JTextField();
  1028.         Adr2BILL.setColumns(10);
  1029.         Adr2BILL.setBounds(107, 74, 317, 24);
  1030.         bill.add(Adr2BILL);
  1031.  
  1032.         JLabel lblDate = new JLabel("Date");
  1033.         lblDate.setFont(new Font("Tahoma", Font.PLAIN, 16));
  1034.         lblDate.setBounds(10, 176, 46, 14);
  1035.         bill.add(lblDate);
  1036.  
  1037.         JLabel lblCharge = new JLabel("Charge");
  1038.         lblCharge.setFont(new Font("Tahoma", Font.PLAIN, 16));
  1039.         lblCharge.setBounds(141, 176, 92, 14);
  1040.         bill.add(lblCharge);
  1041.  
  1042.         JLabel lblAmount = new JLabel("Amount");
  1043.         lblAmount.setFont(new Font("Tahoma", Font.PLAIN, 16));
  1044.         lblAmount.setBounds(391, 176, 57, 14);
  1045.         bill.add(lblAmount);
  1046.  
  1047.         JButton btnPrintBill = new JButton("Print Bill");
  1048.         btnPrintBill.addActionListener(new ActionListener() {
  1049.                     public void actionPerformed(ActionEvent e) {
  1050.  
  1051.                         PrinterJob job = PrinterJob.getPrinterJob();
  1052.                         //job.setPrintable(this);
  1053.                         boolean ok = job.printDialog();
  1054.                         if (ok) {
  1055.                             try {
  1056.                                     job.print();
  1057.                                 } catch (PrinterException ex) {
  1058.                                                   //The job did not successfully complete
  1059.                                 }
  1060.                         System.out.println("Printing your Bill");
  1061.                         extraServices.setVisible(false);
  1062.                         bill.setVisible(true);
  1063.                     }
  1064.                 }
  1065.         });
  1066.         btnPrintBill.setFont(new Font("Tahoma", Font.PLAIN, 18));
  1067.         btnPrintBill.setBounds(0, 867, 97, 54);
  1068.         bill.add(btnPrintBill);
  1069.  
  1070.         JLabel lblTotal = new JLabel("Total:");
  1071.         lblTotal.setFont(new Font("Tahoma", Font.PLAIN, 16));
  1072.         lblTotal.setBounds(256, 837, 46, 14);
  1073.         bill.add(lblTotal);
  1074.  
  1075.         TotalBILL = new JTextField();
  1076.         TotalBILL.setColumns(10);
  1077.         TotalBILL.setBounds(314, 835, 150, 20);
  1078.         bill.add(TotalBILL);
  1079.  
  1080.         JLabel lblRoom = new JLabel("Room #");
  1081.         lblRoom.setFont(new Font("Tahoma", Font.PLAIN, 16));
  1082.         lblRoom.setBounds(10, 96, 87, 48);
  1083.         bill.add(lblRoom);
  1084.  
  1085.         DAY1_BILL = new JTextField();
  1086.         DAY1_BILL.setBounds(12, 203, 116, 22);
  1087.         bill.add(DAY1_BILL);
  1088.         DAY1_BILL.setColumns(10);
  1089.  
  1090.         DAY2_BILL = new JTextField();
  1091.         DAY2_BILL.setBounds(12, 403, 116, 22);
  1092.         bill.add(DAY2_BILL);
  1093.         DAY2_BILL.setColumns(10);
  1094.  
  1095.         DAY3_BILL = new JTextField();
  1096.         DAY3_BILL.setBounds(12, 610, 116, 22);
  1097.         bill.add(DAY3_BILL);
  1098.         DAY3_BILL.setColumns(10);
  1099.  
  1100.         Room_BILLDAY1 = new JTextField();
  1101.         Room_BILLDAY1.setBounds(141, 203, 230, 22);
  1102.         bill.add(Room_BILLDAY1);
  1103.         Room_BILLDAY1.setColumns(10);
  1104.  
  1105.         Room_DAY2 = new JTextField();
  1106.         Room_DAY2.setBounds(141, 403, 230, 22);
  1107.         bill.add(Room_DAY2);
  1108.         Room_DAY2.setColumns(10);
  1109.  
  1110.         Extra2_DAY1 = new JTextField();
  1111.         Extra2_DAY1.setBounds(141, 302, 230, 24);
  1112.         bill.add(Extra2_DAY1);
  1113.         Extra2_DAY1.setColumns(10);
  1114.  
  1115.         Room_BILLDAY3 = new JTextField();
  1116.         Room_BILLDAY3.setBounds(141, 610, 230, 22);
  1117.         bill.add(Room_BILLDAY3);
  1118.         Room_BILLDAY3.setColumns(10);
  1119.  
  1120.         ROOMAMOUNTDAY1 = new JTextField();
  1121.         ROOMAMOUNTDAY1.setBounds(391, 203, 71, 22);
  1122.         bill.add(ROOMAMOUNTDAY1);
  1123.         ROOMAMOUNTDAY1.setColumns(10);
  1124.  
  1125.         ROOMAMOUNTDAY2 = new JTextField();
  1126.         ROOMAMOUNTDAY2.setBounds(391, 403, 70, 22);
  1127.         bill.add(ROOMAMOUNTDAY2);
  1128.         ROOMAMOUNTDAY2.setColumns(10);
  1129.  
  1130.         ROOMAMOUNTDAY3 = new JTextField();
  1131.         ROOMAMOUNTDAY3.setColumns(10);
  1132.         ROOMAMOUNTDAY3.setBounds(388, 610, 73, 22);
  1133.         bill.add(ROOMAMOUNTDAY3);
  1134.  
  1135.         ExtraPerson_DAY1 = new JTextField();
  1136.         ExtraPerson_DAY1.setColumns(10);
  1137.         ExtraPerson_DAY1.setBounds(141, 229, 230, 22);
  1138.         bill.add(ExtraPerson_DAY1);
  1139.  
  1140.         RoomTax_DAY1 = new JTextField();
  1141.         RoomTax_DAY1.setColumns(10);
  1142.         RoomTax_DAY1.setBounds(141, 253, 230, 22);
  1143.         bill.add(RoomTax_DAY1);
  1144.  
  1145.         Extra1_DAY1 = new JTextField();
  1146.         Extra1_DAY1.setColumns(10);
  1147.         Extra1_DAY1.setBounds(141, 277, 230, 22);
  1148.         bill.add(Extra1_DAY1);
  1149.  
  1150.         Extra3_DAY1 = new JTextField();
  1151.         Extra3_DAY1.setColumns(10);
  1152.         Extra3_DAY1.setBounds(141, 328, 230, 24);
  1153.         bill.add(Extra3_DAY1);
  1154.  
  1155.         Extra4_DAY1 = new JTextField();
  1156.         Extra4_DAY1.setColumns(10);
  1157.         Extra4_DAY1.setBounds(141, 353, 230, 24);
  1158.         bill.add(Extra4_DAY1);
  1159.  
  1160.         ROOMAMOUNT2_DAY1 = new JTextField();
  1161.         ROOMAMOUNT2_DAY1.setColumns(10);
  1162.         ROOMAMOUNT2_DAY1.setBounds(391, 229, 71, 22);
  1163.         bill.add(ROOMAMOUNT2_DAY1);
  1164.  
  1165.         ROOMAMOUNT3_DAY1 = new JTextField();
  1166.         ROOMAMOUNT3_DAY1.setColumns(10);
  1167.         ROOMAMOUNT3_DAY1.setBounds(391, 253, 71, 22);
  1168.         bill.add(ROOMAMOUNT3_DAY1);
  1169.  
  1170.         ROOMAMOUNT4_DAY1 = new JTextField();
  1171.         ROOMAMOUNT4_DAY1.setColumns(10);
  1172.         ROOMAMOUNT4_DAY1.setBounds(391, 277, 71, 22);
  1173.         bill.add(ROOMAMOUNT4_DAY1);
  1174.  
  1175.         ROOMAMOUNT5_DAY1 = new JTextField();
  1176.         ROOMAMOUNT5_DAY1.setColumns(10);
  1177.         ROOMAMOUNT5_DAY1.setBounds(391, 303, 71, 22);
  1178.         bill.add(ROOMAMOUNT5_DAY1);
  1179.  
  1180.         ROOMAMOUNT6_DAY1 = new JTextField();
  1181.         ROOMAMOUNT6_DAY1.setColumns(10);
  1182.         ROOMAMOUNT6_DAY1.setBounds(391, 329, 71, 22);
  1183.         bill.add(ROOMAMOUNT6_DAY1);
  1184.  
  1185.         ROOMAMOUNT7_DAY1 = new JTextField();
  1186.         ROOMAMOUNT7_DAY1.setColumns(10);
  1187.         ROOMAMOUNT7_DAY1.setBounds(391, 354, 71, 22);
  1188.         bill.add(ROOMAMOUNT7_DAY1);
  1189.  
  1190.         ExtraPerson_DAY2 = new JTextField();
  1191.         ExtraPerson_DAY2.setColumns(10);
  1192.         ExtraPerson_DAY2.setBounds(141, 431, 230, 22);
  1193.         bill.add(ExtraPerson_DAY2);
  1194.  
  1195.         RoomTax_DAY2 = new JTextField();
  1196.         RoomTax_DAY2.setColumns(10);
  1197.         RoomTax_DAY2.setBounds(141, 456, 230, 22);
  1198.         bill.add(RoomTax_DAY2);
  1199.  
  1200.         Extra1_DAY2 = new JTextField();
  1201.         Extra1_DAY2.setColumns(10);
  1202.         Extra1_DAY2.setBounds(141, 482, 230, 22);
  1203.         bill.add(Extra1_DAY2);
  1204.  
  1205.         Extra2_DAY2 = new JTextField();
  1206.         Extra2_DAY2.setColumns(10);
  1207.         Extra2_DAY2.setBounds(141, 508, 230, 22);
  1208.         bill.add(Extra2_DAY2);
  1209.  
  1210.         Extra3_DAY2 = new JTextField();
  1211.         Extra3_DAY2.setColumns(10);
  1212.         Extra3_DAY2.setBounds(141, 534, 230, 22);
  1213.         bill.add(Extra3_DAY2);
  1214.  
  1215.         Extra4_DAY2 = new JTextField();
  1216.         Extra4_DAY2.setColumns(10);
  1217.         Extra4_DAY2.setBounds(141, 561, 230, 22);
  1218.         bill.add(Extra4_DAY2);
  1219.  
  1220.         ROOMAMOUNT2_DAY2 = new JTextField();
  1221.         ROOMAMOUNT2_DAY2.setColumns(10);
  1222.         ROOMAMOUNT2_DAY2.setBounds(391, 431, 71, 22);
  1223.         bill.add(ROOMAMOUNT2_DAY2);
  1224.  
  1225.         ROOMAMOUNT3_DAY2 = new JTextField();
  1226.         ROOMAMOUNT3_DAY2.setColumns(10);
  1227.         ROOMAMOUNT3_DAY2.setBounds(391, 456, 71, 22);
  1228.         bill.add(ROOMAMOUNT3_DAY2);
  1229.  
  1230.         ROOMAMOUNT4_DAY2 = new JTextField();
  1231.         ROOMAMOUNT4_DAY2.setColumns(10);
  1232.         ROOMAMOUNT4_DAY2.setBounds(391, 482, 71, 22);
  1233.         bill.add(ROOMAMOUNT4_DAY2);
  1234.  
  1235.         ROOMAMOUNT5_DAY2 = new JTextField();
  1236.         ROOMAMOUNT5_DAY2.setColumns(10);
  1237.         ROOMAMOUNT5_DAY2.setBounds(391, 508, 71, 22);
  1238.         bill.add(ROOMAMOUNT5_DAY2);
  1239.  
  1240.         ROOMAMOUNT6_DAY2 = new JTextField();
  1241.         ROOMAMOUNT6_DAY2.setColumns(10);
  1242.         ROOMAMOUNT6_DAY2.setBounds(391, 534, 71, 22);
  1243.         bill.add(ROOMAMOUNT6_DAY2);
  1244.  
  1245.         ROOMAMOUNT7_DAY2 = new JTextField();
  1246.         ROOMAMOUNT7_DAY2.setColumns(10);
  1247.         ROOMAMOUNT7_DAY2.setBounds(391, 561, 71, 22);
  1248.         bill.add(ROOMAMOUNT7_DAY2);
  1249.  
  1250.         ExtraPerson_DAY3 = new JTextField();
  1251.         ExtraPerson_DAY3.setColumns(10);
  1252.         ExtraPerson_DAY3.setBounds(141, 639, 230, 22);
  1253.         bill.add(ExtraPerson_DAY3);
  1254.  
  1255.         RoomTax_DAY3 = new JTextField();
  1256.         RoomTax_DAY3.setColumns(10);
  1257.         RoomTax_DAY3.setBounds(141, 663, 230, 22);
  1258.         bill.add(RoomTax_DAY3);
  1259.  
  1260.         Extra1_DAY3 = new JTextField();
  1261.         Extra1_DAY3.setColumns(10);
  1262.         Extra1_DAY3.setBounds(141, 688, 230, 22);
  1263.         bill.add(Extra1_DAY3);
  1264.  
  1265.         Extra2_DAY3 = new JTextField();
  1266.         Extra2_DAY3.setColumns(10);
  1267.         Extra2_DAY3.setBounds(141, 719, 230, 22);
  1268.         bill.add(Extra2_DAY3);
  1269.  
  1270.         Extra3_DAY3 = new JTextField();
  1271.         Extra3_DAY3.setColumns(10);
  1272.         Extra3_DAY3.setBounds(141, 754, 230, 22);
  1273.         bill.add(Extra3_DAY3);
  1274.  
  1275.         Extra4_DAY3 = new JTextField();
  1276.         Extra4_DAY3.setColumns(10);
  1277.         Extra4_DAY3.setBounds(141, 789, 230, 22);
  1278.         bill.add(Extra4_DAY3);
  1279.  
  1280.         ROOMAMOUNT2_DAY3 = new JTextField();
  1281.         ROOMAMOUNT2_DAY3.setColumns(10);
  1282.         ROOMAMOUNT2_DAY3.setBounds(388, 639, 73, 22);
  1283.         bill.add(ROOMAMOUNT2_DAY3);
  1284.  
  1285.         ROOMAMOUNT3_DAY3 = new JTextField();
  1286.         ROOMAMOUNT3_DAY3.setColumns(10);
  1287.         ROOMAMOUNT3_DAY3.setBounds(391, 663, 73, 22);
  1288.         bill.add(ROOMAMOUNT3_DAY3);
  1289.  
  1290.         ROOMAMOUNT4_DAY3 = new JTextField();
  1291.         ROOMAMOUNT4_DAY3.setColumns(10);
  1292.         ROOMAMOUNT4_DAY3.setBounds(391, 688, 73, 22);
  1293.         bill.add(ROOMAMOUNT4_DAY3);
  1294.  
  1295.         ROOMAMOUNT5_DAY3 = new JTextField();
  1296.         ROOMAMOUNT5_DAY3.setColumns(10);
  1297.         ROOMAMOUNT5_DAY3.setBounds(391, 719, 73, 22);
  1298.         bill.add(ROOMAMOUNT5_DAY3);
  1299.  
  1300.         ROOMAMOUNT6_DAY3 = new JTextField();
  1301.         ROOMAMOUNT6_DAY3.setColumns(10);
  1302.         ROOMAMOUNT6_DAY3.setBounds(388, 754, 73, 22);
  1303.         bill.add(ROOMAMOUNT6_DAY3);
  1304.  
  1305.         ROOMAMOUNT7_DAY3 = new JTextField();
  1306.         ROOMAMOUNT7_DAY3.setColumns(10);
  1307.         ROOMAMOUNT7_DAY3.setBounds(388, 789, 73, 22);
  1308.         bill.add(ROOMAMOUNT7_DAY3);
  1309.  
  1310.         JButton btnMainMenu = new JButton("Main Menu");
  1311.         btnMainMenu.addActionListener(new ActionListener()
  1312.         {
  1313.             public void actionPerformed(ActionEvent e)
  1314.             {
  1315.                 System.out.println("Going to Main Menu");
  1316.                 bill.setVisible(false);
  1317.                 mainMenu.setVisible(true);
  1318.             }
  1319.         });
  1320.         btnMainMenu.setFont(new Font("Tahoma", Font.PLAIN, 18));
  1321.         btnMainMenu.setBounds(337, 867, 125, 54);
  1322.         bill.add(btnMainMenu);
  1323.     }
  1324.  
  1325.  
  1326. /*private void SearchRooms()
  1327. {
  1328.     try
  1329.     {
  1330.     // load database driver class
  1331.     Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
  1332.     connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB" );
  1333.  
  1334.     Statement statement = connection.createStatement();
  1335.     ResultSet resultSet = statement.executeQuery("SELECT * FROM RoomInfo");
  1336.  
  1337.     StringBuffer results = new StringBuffer();
  1338.     ResultSetMetaData metaData = resultSet.getMetaData();
  1339.     int numberOfColumns = metaData.getColumnCount();
  1340.     for (int i = 1; i <= numberOfColumns; i++){
  1341.         results.append( metaData.getColumnName(i)
  1342.                 + "\t");
  1343.     }
  1344.     results.append("\n");
  1345.     while(resultSet.next())
  1346.     {
  1347.         for (int i = 1; i <= numberOfColumns; i++)
  1348.         {
  1349.             results.append(resultSet.getObject(i)
  1350.                     + "\t");
  1351.         }
  1352.         results.append("\n");
  1353.     }
  1354.        statement.close();
  1355.        connection.close();
  1356.  
  1357.       // vacantTABLE.setText(String.valueOf(results));
  1358. }
  1359.     // detect problems interacting with the database
  1360.     catch (SQLException sqlException ){
  1361.     JOptionPane.showMessageDialog( null,
  1362.     sqlException.getMessage(), "Database Error",
  1363.     JOptionPane.ERROR_MESSAGE );
  1364.     System.exit (1);
  1365.     }
  1366.     // detect problems loading database driver
  1367.     catch (ClassNotFoundException classNotFound){
  1368.     JOptionPane.showMessageDialog(null,
  1369.     classNotFound.getMessage(), "Driver Not Found",
  1370.     JOptionPane.ERROR_MESSAGE );
  1371.     System.exit(1);
  1372.     }
  1373. }
  1374. */
  1375. private void searchAccount()
  1376. {
  1377.     RoomNumberSearchA = String.valueOf(RoomNum.getText());
  1378.  
  1379.     try
  1380.     {
  1381.     // load database driver class
  1382.     Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
  1383.     connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB" );
  1384.     statement = connection.createStatement(); // Create statement to query database to get the Room Number
  1385.     statement2 = connection.createStatement(); // Create Statement to query database for BookingInfo table
  1386.     statement1 = connection.createStatement(); // Create Statement to query database for Guest table
  1387.  
  1388.     int GuestNum = 0; // will be using GuestID to search database by using RoomNumber
  1389.  
  1390.     resultset = statement.executeQuery("SELECT GuestID FROM BookingInfo WHERE RoomNumber = '"+ RoomNumberSearchA +"'"); // query database for guestID
  1391.  
  1392.     if (resultset.next())
  1393.     {
  1394.         GuestNum = resultset.getInt(1);
  1395.  
  1396.         SearchGuest = statement1.executeQuery("SELECT FirstName, LastName FROM Guest WHERE GuestID = " + GuestNum);
  1397.         SearchBooking = statement2.executeQuery("SELECT RoomType, ViewType, NumPeople FROM BookingInfo WHERE GuestID = " + GuestNum);
  1398.  
  1399.         System.out.println("now searching for room number '" + RoomNumberSearchA + '"');
  1400.  
  1401.         while (SearchGuest.next())
  1402.         {
  1403.             String SFName = SearchGuest.getString("FirstName");
  1404.             String SLName = SearchGuest.getString("LastName");
  1405.             System.out.println("LAST NAME: " + SLName);
  1406.             System.out.println("FIRST NAME: " + SFName);
  1407.             F_name.setText(String.valueOf(SFName));
  1408.             L_name.setText(String.valueOf(SLName));
  1409.         }
  1410.         while (SearchBooking.next())
  1411.         {
  1412.             String SRT = SearchBooking.getString("RoomType");
  1413.             String SVT = SearchBooking.getString("ViewType");
  1414.             String SNumP = SearchBooking.getString("NumPeople");
  1415.             System.out.println("ROOM TYPE: " + SRT);
  1416.             System.out.println("VIEW TYPE: " + SVT);
  1417.             System.out.println("NUMBER OF GUESTS: " + SNumP);
  1418.             Room_Type.setText(String.valueOf(SRT));
  1419.             View_Type.setText(String.valueOf(SVT));
  1420.             Num_Guests.setText(String.valueOf(SNumP));
  1421.         }
  1422.     }
  1423.     else{
  1424.         Component frame3 = null;
  1425.         JOptionPane.showMessageDialog(frame3, "   Record Not Found");
  1426.     }
  1427.        statement.close();
  1428.        connection.close();
  1429. }
  1430.     // detect problems interacting with the database
  1431.     catch (SQLException sqlException ){
  1432.     JOptionPane.showMessageDialog( null,
  1433.     sqlException.getMessage(), "Database Error",
  1434.     JOptionPane.ERROR_MESSAGE );
  1435.     System.exit (1);
  1436.     }
  1437.     // detect problems loading database driver
  1438.     catch (ClassNotFoundException classNotFound){
  1439.     JOptionPane.showMessageDialog(null,
  1440.     classNotFound.getMessage(), "Driver Not Found",
  1441.     JOptionPane.ERROR_MESSAGE );
  1442.     System.exit(1);
  1443.     }
  1444. } // end HotelManager constructor definition
  1445. public void checkIn(String RoomTypeCI, String ViewTypeCI, int guestID) throws ClassNotFoundException
  1446. {
  1447.     String room = "";
  1448.     String view = "";
  1449.     String aval = "";
  1450.  
  1451.     boolean checked = false;
  1452.     try{
  1453.         connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB"); // Connect to database
  1454.         statement = connection.createStatement();
  1455.     }
  1456.     catch (SQLException sqlException )
  1457.     {
  1458.          JOptionPane.showMessageDialog( null, sqlException.getMessage(), "Database Error", JOptionPane.ERROR_MESSAGE );
  1459.          System.exit (1);
  1460.     }
  1461.  
  1462.     for(int i = 1; i <=48; i++)
  1463.     {
  1464.         try
  1465.         {
  1466.             resultset = statement.executeQuery("SELECT RoomType, ViewType, Availability FROM RoomInfo WHERE RoomID="+i+";");
  1467.             if(resultset.next())
  1468.             {
  1469.                 room = (resultset.getString(1));
  1470.                 view = (resultset.getString(2));
  1471.                 aval = (resultset.getString(3));
  1472.             }
  1473.             //System.out.print(RoomTypeCI);
  1474.             //System.out.print(ViewTypeCI);
  1475.             //System.out.print(room);
  1476.             //System.out.println(checked);
  1477.             if(RoomTypeCI.equals(room)&&ViewTypeCI.equals(view)&&aval.equals("VACANT")&&checked==false)
  1478.             {
  1479.                 //System.out.println("check................................"+i);
  1480.                 checked=true;
  1481.                 statement.executeUpdate("UPDATE RoomInfo SET GuestID = "+ guestID + ", Availability = 'OCCUPIED' WHERE RoomType = '"+RoomTypeCI+"' AND ViewType = '"+ViewTypeCI+"' AND RoomID = "+i+";");
  1482.                 //statement.executeUpdate("UPDATE RoomInfo SET GuestID = "+ guestID + ", Availability = 'OCCUPIED' WHERE RoomType = '"+RoomTypeCI+"' AND ViewType = '"+ViewTypeCI+"' AND RoomID = "+i+";");
  1483.                 //resultset = statement.executeQuery("SELECT RoomNumber FROM RoomInfo WHERE GuestID="+guestID+";");
  1484.                 //resultset.next();
  1485.                 //int RmNum = (Integer) resultset.getObject(1);
  1486.                 //System.out.println(RmNum);
  1487.                 //statement.executeUpdate("UPDATE BookingInfo SET RoomNumber = " + RmNum + ",  WHERE GuestID = '"+guestID+";");
  1488.             }
  1489.  
  1490.         }
  1491.         catch (SQLException sqlException )
  1492.         {
  1493.              JOptionPane.showMessageDialog( null, sqlException.getMessage(), "Database Error", JOptionPane.ERROR_MESSAGE );
  1494.              System.exit (1);
  1495.         }
  1496.  
  1497.     }
  1498. }
  1499. public void BookingRoom()
  1500. {
  1501.     // get user input
  1502.             String fname = String.valueOf(Fname.getText());
  1503.             String lname = String.valueOf(Lname.getText());
  1504.             String adr1 = String.valueOf(Adr1.getText());
  1505.             String adr2 = String.valueOf(Adr2.getText());
  1506.             String city = String.valueOf(City.getText());
  1507.             String state = states.getSelectedItem().toString();
  1508.             String NGuests = NumGuests.getSelectedItem().toString();
  1509.             //String DAYONE = arrival_CheckIN.getDate().toString();
  1510.             //System.out.println(DAYONE);
  1511.             String zip = String.valueOf(Zip.getText());
  1512.             String RoomTypeCI = ROOMtypeCI.getSelectedItem().toString();
  1513.             String ViewTypeCI = VIEWtypeCI.getSelectedItem().toString();
  1514.             //int guestID = 5;
  1515.  
  1516.  
  1517.             //checking if the user entered valid info to prevent empty spots in the database
  1518.         if (fname.equals("") && lname.equals("") && adr1.equals("") && adr2.equals("") && city.equals("") && zip.equals(""))
  1519.         {
  1520.             Component frame = null;
  1521.             JOptionPane.showMessageDialog(frame, "Please Enter Valid Information");
  1522.         }
  1523.         else
  1524.         {
  1525.             try {
  1526.                 Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); // load database driver class
  1527.                 connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB"); // Connect to database
  1528.                 statement = connection.createStatement(); // Create Statement to query database
  1529.  
  1530.                 // creating a statement and different int variables
  1531.                 int guest1, booking1; // TO CHECK FOR PROPER INSERTION
  1532.  
  1533.                 guest1 = statement.executeUpdate("INSERT INTO Guest (FirstName, LastName, Address1, Address2, City, State, Zip) VALUES ('" + fname + "', '" + lname+ "','"+ adr1 + "', '" + adr2 + "', '" + city + "', '" + state+ "','" + zip + "');");
  1534.                 resultset = statement.executeQuery("SELECT GuestID FROM Guest WHERE (Guest.LastName) = '"+lname+"'"); // query database
  1535.                 resultset.next();
  1536.                 int GuestID = (Integer) resultset.getObject(1);
  1537.                 checkIn(RoomTypeCI, ViewTypeCI, GuestID);
  1538.                 booking1 = statement.executeUpdate("INSERT INTO BookingInfo (GuestID, RoomType, ViewType,NumPeople) VALUES ('" + GuestID + "','"+ RoomTypeCI + "', '" + ViewTypeCI + "', '" + NGuests + "');");
  1539.             if (guest1 == 1 && booking1 == 1)
  1540.             {
  1541.                 Component frame = null;
  1542.                 JOptionPane.showMessageDialog(frame, "   Enjoy Your Stay With Us!");
  1543.             }
  1544.             statement.close();
  1545.             connection.close();
  1546.             }
  1547.             catch (SQLException sqlException )
  1548.             {
  1549.                  JOptionPane.showMessageDialog( null, sqlException.getMessage(), "Database Error", JOptionPane.ERROR_MESSAGE );
  1550.                  System.exit (1);
  1551.             }
  1552.                 // detect problems loading database driver
  1553.             catch (ClassNotFoundException classNotFound)
  1554.             {
  1555.                 JOptionPane.showMessageDialog(null, classNotFound.getMessage(), "Driver Not Found", JOptionPane.ERROR_MESSAGE );
  1556.                 System.exit(1);
  1557.             }
  1558.  
  1559.     }
  1560.     }// end DbConnection constructor definition
  1561.  
  1562.  
  1563.         public void Searching(){
  1564.                     JFrame SearchPane = new JFrame();
  1565.                     SearchPane.setSize(500, 200);
  1566.                     SearchPane.setTitle("Search");
  1567.                     SearchPane.setLocation(150, 150);
  1568.                     SearchPane.setBackground(Color.gray);
  1569.  
  1570.  
  1571.                     JPanel SearchPanel = new JPanel();
  1572.                     SearchPanel.setLayout(new FlowLayout());
  1573.                     SearchPanel.setSize(450, 150);
  1574.                     SearchPanel.setLayout (new FlowLayout());
  1575.  
  1576.                     JLabel searcH = new JLabel("Room Number:");
  1577.                     SearchPanel.add(searcH);
  1578.                     JPanel SEArch = new JPanel();
  1579.                     JTextField search = new JTextField();
  1580.                     search.setPreferredSize( new Dimension( 200, 24 ) );
  1581.  
  1582.  
  1583.                     SEArch.add(search);
  1584.                     SearchPanel.add(SEArch);
  1585.                     JButton OKbutton = new JButton("Ok");
  1586.                     OKbutton.addActionListener(new ActionListener() {
  1587.                     public void actionPerformed(ActionEvent e) {
  1588.                         System.out.println("Searching bill for guest.");
  1589.                         previewBill();
  1590.                         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())
  1591.                         +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())
  1592.                         +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());
  1593.                         DecimalFormat decimalFormat = new DecimalFormat("0.00");
  1594.                         TotalBILL.setText(String.valueOf(decimalFormat.format(Total)));
  1595.                         System.out.println("Total is:" +Total);
  1596.  
  1597.                     }
  1598.                 });
  1599.                     OKbutton.setPreferredSize( new Dimension( 60, 25) );
  1600.  
  1601.  
  1602.                     SearchPanel.add(OKbutton);
  1603.                     SearchPane.add(SearchPanel);
  1604.                     SearchPane.setVisible(true);
  1605.             }
  1606.  
  1607.  
  1608.     private void previewBill()
  1609.     {
  1610.         String NGuests = NumGuests.getSelectedItem().toString();
  1611.         RoomNumberSearchA = String.valueOf(RoomNum.getText());
  1612.         /*String RoomPrice_DAY1 = String.valueOf(Room_BILLDAY1.getText());
  1613.         String RoomPrice_DAY2 = String.valueOf(Room_DAY2.getText());
  1614.         String RoomPrice_DAY3 = String.valueOf(Room_BILLDAY3.getText());
  1615.         String Tax_DAY1 = String.valueOf(RoomTax_DAY1.getText());
  1616.         String Tax_DAY2 = String.valueOf(RoomTax_DAY2.getText());
  1617.         String Tax_DAY3 = String.valueOf(RoomTax_DAY3.getText());*/
  1618.  
  1619.         try
  1620.             {
  1621.             // load database driver class
  1622.             Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
  1623.             connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB" );
  1624.             statement = connection.createStatement();
  1625.             statement1 = connection.createStatement();
  1626.             statement2 = connection.createStatement();
  1627.             statement3 = connection.createStatement();
  1628.             statement4 = connection.createStatement();
  1629.             statement5 = connection.createStatement();
  1630.             statement6 = connection.createStatement();
  1631.             statement7 = connection.createStatement();
  1632.             statement8 = connection.createStatement();
  1633.             statement9 = connection.createStatement();
  1634.             statement10 = connection.createStatement();
  1635.             statement11 = connection.createStatement();
  1636.             statement12 = connection.createStatement();
  1637.             statement13 = connection.createStatement();
  1638.  
  1639.             int GuestNum = 0;
  1640.             resultset = statement.executeQuery("SELECT GuestID FROM BookingInfo WHERE RoomNumber = '"+ RoomNumberSearchA +"'");
  1641.  
  1642.             if (resultset.next())
  1643.                 {
  1644.                     GuestNum = resultset.getInt(1);
  1645.                     SearchGuest = statement1.executeQuery("SELECT FirstName, LastName, Address1, Address2, City, State, Zip FROM Guest WHERE GuestID = " + GuestNum);
  1646.                     SearchRoom = statement2.executeQuery("SELECT RoomNumber FROM BookingInfo WHERE GuestID = " +GuestNum);
  1647.                     /*DayOneExtra = statement3.executeQuery("SELECT ServiceType, ServiceType2, ServiceType3, ServiceType4 FROM ExtraServicesDAY1 WHERE GuestID = " +GuestNum);
  1648.                     DayTwoExtra = statement4.executeQuery("SELECT ServiceType, ServiceType2, ServiceType3, ServiceType4 FROM ExtraServicesDAY2 WHERE GuestID = " +GuestNum);
  1649.                     DayThreeExtra = statement5.executeQuery("SELECT ServiceType, ServiceType2, ServiceType3, ServiceType4 FROM ExtraServicesDAY3 WHERE GuestID = " +GuestNum);*/
  1650.                     ExtraPerson = statement6.executeQuery("SELECT NumPeople FROM BookingInfo WHERE GuestID = " +GuestNum);
  1651.                     RoomPrice = statement7.executeQuery("SELECT RoomPrice FROM RoomInfo WHERE GuestID = " +GuestNum);
  1652.                     /*Second*/RoomPrice = statement12.executeQuery("SELECT SecondPersonPrice FROM RoomInfo WHERE GuestID = " +GuestNum);
  1653.                     RoomTaxPrice = statement11.executeQuery("SELECT RoomTax FROM RoomInfo WHERE GuestID = " +GuestNum);
  1654.                     /*Second*/RoomTaxPrice = statement13.executeQuery("SELECT SecondPersonRoomTax FROM RoomInfo WHERE GuestID = " +GuestNum);
  1655.                     ExtraPrice_DAY1 = statement8.executeQuery("SELECT Price, Price2, Price3, Price4 FROM ExtraServicesDAY1 WHERE GuestID = " +GuestNum);
  1656.                     ExtraPrice_DAY2 = statement9.executeQuery("SELECT Price, Price2, Price3, Price4 FROM ExtraServicesDAY2 WHERE GuestID = " +GuestNum);
  1657.                     ExtraPrice_DAY3 = statement10.executeQuery("SELECT Price, Price2, Price3, Price4 FROM ExtraServicesDAY3 WHERE GuestID = " +GuestNum);
  1658.  
  1659.  
  1660.                    while (SearchGuest.next())
  1661.                         {
  1662.                             String SFName = SearchGuest.getString("FirstName");
  1663.                             String SLName = SearchGuest.getString("LastName");
  1664.                             String SAdr1 = SearchGuest.getString("Address1");
  1665.                             String SAdr2 = SearchGuest.getString("Address2");
  1666.                             String SCity = SearchGuest.getString("City");
  1667.                             String SState = SearchGuest.getString("State");
  1668.                             String SZip = SearchGuest.getString("Zip");
  1669.                             System.out.println("FIRST NAME: " + SFName);
  1670.                             System.out.println("LAST NAME: " + SLName);
  1671.                             System.out.println("ADDRESS 1: " + SAdr1);
  1672.                             System.out.println("ADDRESS 2: " + SAdr2);
  1673.                             System.out.println("CITY: " + SCity);
  1674.                             System.out.println("STATE: " + SState);
  1675.                             System.out.println("ZIP: " + SZip);
  1676.                             FnameBILL.setText(String.valueOf(SFName));
  1677.                             LnameBILL.setText(String.valueOf(SLName));
  1678.                             Adr1BILL.setText(String.valueOf(SAdr1) + " " +String.valueOf(SAdr2));
  1679.                             Adr2BILL.setText(String.valueOf(SCity) + ", " +String.valueOf(SState) + " " +String.valueOf(SZip));
  1680.                         }
  1681.                     while (SearchRoom.next())
  1682.                     {
  1683.                         String SRoomNum = SearchRoom.getString("RoomNumber");
  1684.                         System.out.println("ROOM NUMBER: " + SRoomNum);
  1685.                         RoomNum_BILL.setText(String.valueOf(SRoomNum));
  1686.                     }
  1687.                     /*while (DayOneExtra.next())
  1688.                     {
  1689.                         String SExtraCharge = DayOneExtra.getString("ServiceType");
  1690.                         String SExtra2Charge = DayOneExtra.getString("ServiceType2");
  1691.                         String SExtra3Charge = DayOneExtra.getString("ServiceType3");
  1692.                         String SExtra4Charge = DayOneExtra.getString("ServiceType4");
  1693.                         System.out.println("DAY ONE SERVICE: " +SExtraCharge);
  1694.                         System.out.println("DAY ONE SERVICE: " +SExtra2Charge);
  1695.                         System.out.println("DAY ONE SERVICE: " +SExtra3Charge);
  1696.                         System.out.println("DAY ONE SERVICE: " +SExtra4Charge);
  1697.                         Room_BILLDAY1.setText("Room");
  1698.                         RoomTax_DAY1.setText("Room Tax");
  1699.                         if(SExtraCharge == null)
  1700.                         Extra1_DAY1.setText("");
  1701.                         Extra1_DAY1.setText(String.valueOf(SExtraCharge));
  1702.                         if(SExtra2Charge == null)
  1703.                         Extra1_DAY1.setText("");
  1704.                         Extra2_DAY1.setText(String.valueOf(SExtra2Charge));
  1705.                         if(SExtra3Charge == null)
  1706.                         Extra1_DAY1.setText("");
  1707.                         Extra3_DAY1.setText(String.valueOf(SExtra3Charge));
  1708.                         if(SExtra4Charge == null)
  1709.                         Extra1_DAY1.setText("");
  1710.                         Extra4_DAY1.setText(String.valueOf(SExtra4Charge));
  1711.                     }
  1712.                     while (DayTwoExtra.next())
  1713.                     {
  1714.                         String SExtraCharge = DayTwoExtra.getString("ServiceType");
  1715.                         String SExtra2Charge = DayTwoExtra.getString("ServiceType2");
  1716.                         String SExtra3Charge = DayTwoExtra.getString("ServiceType3");
  1717.                         String SExtra4Charge = DayTwoExtra.getString("ServiceType4");
  1718.                         System.out.println("DAY TWO SERVICE: " +SExtraCharge);
  1719.                         System.out.println("DAY TWO SERVICE: " +SExtra2Charge);
  1720.                         System.out.println("DAY TWO SERVICE: " +SExtra3Charge);
  1721.                         System.out.println("DAY TWO SERVICE: " +SExtra4Charge);
  1722.                         Room_DAY2.setText("Room");
  1723.                         RoomTax_DAY2.setText("Room Tax");
  1724.                         if(SExtraCharge == null)
  1725.                         Extra1_DAY2.setText("");
  1726.                         Extra1_DAY2.setText(String.valueOf(SExtraCharge));
  1727.                         if(SExtraCharge == null)
  1728.                         Extra2_DAY2.setText("");
  1729.                         Extra2_DAY2.setText(String.valueOf(SExtra2Charge));
  1730.                         if(SExtraCharge == null)
  1731.                         Extra3_DAY2.setText("");
  1732.                         Extra3_DAY2.setText(String.valueOf(SExtra3Charge));
  1733.                         if(SExtraCharge == null)
  1734.                         Extra4_DAY2.setText("");
  1735.                         Extra4_DAY2.setText(String.valueOf(SExtra4Charge));
  1736.                     }
  1737.                     while (DayThreeExtra.next())
  1738.                    {
  1739.                         String SExtraCharge = DayThreeExtra.getString("ServiceType");
  1740.                         String SExtra2Charge = DayThreeExtra.getString("ServiceType2");
  1741.                         String SExtra3Charge = DayThreeExtra.getString("ServiceType3");
  1742.                         String SExtra4Charge = DayThreeExtra.getString("ServiceType4");
  1743.                         System.out.println("DAY THREE SERVICE: " +SExtraCharge);
  1744.                         System.out.println("DAY THREE SERVICE: " +SExtra2Charge);
  1745.                         System.out.println("DAY THREE SERVICE: " +SExtra3Charge);
  1746.                         System.out.println("DAY THREE SERVICE: " +SExtra4Charge);
  1747.                         Room_BILLDAY3.setText("Room");
  1748.                         RoomTax_DAY3.setText("Room Tax");
  1749.                         if(SExtraCharge == null)
  1750.                         Extra1_DAY3.setText("");
  1751.                         Extra1_DAY3.setText(String.valueOf(SExtraCharge));
  1752.                         if(SExtraCharge == null)
  1753.                         Extra2_DAY3.setText("");
  1754.                         Extra2_DAY3.setText(String.valueOf(SExtra2Charge));
  1755.                         if(SExtraCharge == null)
  1756.                         Extra3_DAY3.setText("");
  1757.                         Extra3_DAY3.setText(String.valueOf(SExtra3Charge));
  1758.                         if(SExtraCharge == null)
  1759.                         Extra4_DAY3.setText("");
  1760.                         Extra4_DAY3.setText(String.valueOf(SExtra4Charge));
  1761.                     }*/
  1762.  
  1763.                     while (ExtraPerson.next())
  1764.                    {
  1765.                        Room_BILLDAY1.setText("Room");
  1766.                        RoomTax_DAY1.setText("Room Tax");
  1767.                        Room_DAY2.setText("Room");
  1768.                        RoomTax_DAY2.setText("Room Tax");
  1769.                        Room_BILLDAY3.setText("Room");
  1770.                        RoomTax_DAY3.setText("Room Tax");
  1771.                        /*String SExtraPerson = ExtraPerson.getString("NumPeople");
  1772.                        System.out.println("NUMBER OF EXTRA PEOPLE: " +SExtraPerson);
  1773.                        if(SExtraPerson == null)
  1774.                        ExtraPerson_DAY1.setText("");
  1775.                        ExtraPerson_DAY1.setText(String.valueOf(SExtraPerson));
  1776.                        if(SExtraPerson == null)
  1777.                        ExtraPerson_DAY2.setText("");
  1778.                        ExtraPerson_DAY2.setText(String.valueOf(SExtraPerson));
  1779.                        if(SExtraPerson == null)
  1780.                        ExtraPerson_DAY3.setText("");
  1781.                        ExtraPerson_DAY3.setText(String.valueOf(SExtraPerson));*/
  1782.                    }
  1783.  
  1784.                    while (RoomPrice.next())
  1785.                    {
  1786.                         if(NGuests == "1")
  1787.                         {
  1788.                             String SRoomPrice = RoomPrice.getString("RoomPrice");
  1789.                             System.out.println("ROOM PRICE: " +SRoomPrice);
  1790.                             if(SRoomPrice == null)
  1791.                             Extra1_DAY1.setText("");
  1792.                             ROOMAMOUNTDAY1.setText(String.valueOf(SRoomPrice));
  1793.                             ROOMAMOUNTDAY2.setText(String.valueOf(SRoomPrice));
  1794.                             ROOMAMOUNTDAY3.setText(String.valueOf(SRoomPrice));
  1795.                         }
  1796.                         else
  1797.                         {
  1798.                             String S2RoomPrice = RoomPrice.getString("SecondPersonPrice");
  1799.                             System.out.println("ROOM PRICE: " +S2RoomPrice);
  1800.                             if(S2RoomPrice == null)
  1801.                             Extra1_DAY1.setText("");
  1802.                             ROOMAMOUNTDAY1.setText(String.valueOf(S2RoomPrice));
  1803.                             ROOMAMOUNTDAY2.setText(String.valueOf(S2RoomPrice));
  1804.                             ROOMAMOUNTDAY3.setText(String.valueOf(S2RoomPrice));
  1805.                         }
  1806.                     }
  1807.  
  1808.                     while (RoomTaxPrice.next())
  1809.                    {
  1810.                        if(NGuests == "1")
  1811.                        {
  1812.                            String SRoomTaxPrice = RoomTaxPrice.getString("RoomTax");
  1813.                            System.out.println("ROOM TAX: " +SRoomTaxPrice);
  1814.                            ROOMAMOUNT3_DAY1.setText(String.valueOf(SRoomTaxPrice));
  1815.                            ROOMAMOUNT3_DAY2.setText(String.valueOf(SRoomTaxPrice));
  1816.                            ROOMAMOUNT3_DAY3.setText(String.valueOf(SRoomTaxPrice));
  1817.                        }
  1818.  
  1819.                        else
  1820.                        {
  1821.                           String S2RoomTaxPrice = RoomTaxPrice.getString("SecondPersonRoomTax");
  1822.                           System.out.println("ROOM TAX: " +S2RoomTaxPrice);
  1823.                           ROOMAMOUNT3_DAY1.setText(String.valueOf(S2RoomTaxPrice));
  1824.                           ROOMAMOUNT3_DAY2.setText(String.valueOf(S2RoomTaxPrice));
  1825.                           ROOMAMOUNT3_DAY3.setText(String.valueOf(S2RoomTaxPrice));
  1826.                        }
  1827.                    }
  1828.  
  1829.                     /*while (ExtraPrice_DAY1.next())
  1830.                    {
  1831.                         String SExtraPrice = ExtraPrice_DAY1.getString("Price");
  1832.                         String SExtraPrice2 = ExtraPrice_DAY1.getString("Price2");
  1833.                         String SExtraPrice3 = ExtraPrice_DAY1.getString("Price3");
  1834.                         String SExtraPrice4 = ExtraPrice_DAY1.getString("Price4");
  1835.                         System.out.println("1ST EXTRA PRICE: " +SExtraPrice);
  1836.                         System.out.println("2ND EXTRA PRICE: " +SExtraPrice2);
  1837.                         System.out.println("3RD EXTRA PRICE: " +SExtraPrice3);
  1838.                         System.out.println("4TH EXTRA PRICE: " +SExtraPrice4);
  1839.                         if(SExtraPrice.equals(0))
  1840.                         ROOMAMOUNT4_DAY1.setText("");
  1841.                         ROOMAMOUNT4_DAY1.setText(String.valueOf(SExtraPrice));
  1842.                         if(SExtraPrice2.equals(0))
  1843.                         ROOMAMOUNT5_DAY1.setText("");
  1844.                         ROOMAMOUNT5_DAY1.setText(String.valueOf(SExtraPrice2));
  1845.                         if(SExtraPrice3.equals(0))
  1846.                         ROOMAMOUNT6_DAY1.setText("");
  1847.                         ROOMAMOUNT6_DAY1.setText(String.valueOf(SExtraPrice3));
  1848.                         if(SExtraPrice4.equals(0))
  1849.                         ROOMAMOUNT7_DAY1.setText("");
  1850.                         ROOMAMOUNT7_DAY1.setText(String.valueOf(SExtraPrice4));
  1851.                     }
  1852.  
  1853.                     while (ExtraPrice_DAY2.next())
  1854.                     {
  1855.                         String SExtraPrice = ExtraPrice_DAY2.getString("Price");
  1856.                         String SExtraPrice2 = ExtraPrice_DAY2.getString("Price2");
  1857.                         String SExtraPrice3 = ExtraPrice_DAY2.getString("Price3");
  1858.                         String SExtraPrice4 = ExtraPrice_DAY2.getString("Price4");
  1859.                         System.out.println("1ST EXTRA PRICE: " +SExtraPrice);
  1860.                         System.out.println("2ND EXTRA PRICE: " +SExtraPrice2);
  1861.                         System.out.println("3RD EXTRA PRICE: " +SExtraPrice3);
  1862.                         System.out.println("4TH EXTRA PRICE: " +SExtraPrice4);
  1863.                         if(SExtraPrice.equals(0))
  1864.                         ROOMAMOUNT4_DAY2.setText("");
  1865.                         ROOMAMOUNT4_DAY2.setText(String.valueOf(SExtraPrice));
  1866.                         if(SExtraPrice2.equals(0))
  1867.                         ROOMAMOUNT5_DAY2.setText("");
  1868.                         ROOMAMOUNT5_DAY2.setText(String.valueOf(SExtraPrice2));
  1869.                         if(SExtraPrice3.equals(0))
  1870.                         ROOMAMOUNT6_DAY2.setText("");
  1871.                         ROOMAMOUNT6_DAY2.setText(String.valueOf(SExtraPrice3));
  1872.                         if(SExtraPrice4.equals(0))
  1873.                         ROOMAMOUNT7_DAY2.setText("");
  1874.                         ROOMAMOUNT7_DAY2.setText(String.valueOf(SExtraPrice4));
  1875.                     }
  1876.  
  1877.                     while (ExtraPrice_DAY3.next())
  1878.                     {
  1879.                         String SExtraPrice = ExtraPrice_DAY3.getString("Price");
  1880.                         String SExtraPrice2 = ExtraPrice_DAY3.getString("Price2");
  1881.                         String SExtraPrice3 = ExtraPrice_DAY3.getString("Price3");
  1882.                         String SExtraPrice4 = ExtraPrice_DAY3.getString("Price4");
  1883.                         System.out.println("1ST EXTRA PRICE: " +SExtraPrice);
  1884.                         System.out.println("2ND EXTRA PRICE: " +SExtraPrice2);
  1885.                         System.out.println("3RD EXTRA PRICE: " +SExtraPrice3);
  1886.                         System.out.println("4TH EXTRA PRICE: " +SExtraPrice4);
  1887.                         if(SExtraPrice.equals(0))
  1888.                         ROOMAMOUNT4_DAY3.setText("");
  1889.                         ROOMAMOUNT4_DAY3.setText(String.valueOf(SExtraPrice));
  1890.                         if(SExtraPrice2.equals(0))
  1891.                         ROOMAMOUNT5_DAY3.setText("");
  1892.                         ROOMAMOUNT5_DAY3.setText(String.valueOf(SExtraPrice2));
  1893.                         if(SExtraPrice3.equals(0))
  1894.                         ROOMAMOUNT6_DAY3.setText("");
  1895.                         ROOMAMOUNT6_DAY3.setText(String.valueOf(SExtraPrice3));
  1896.                         if(SExtraPrice4.equals(0))
  1897.                         ROOMAMOUNT7_DAY3.setText("");
  1898.                         ROOMAMOUNT7_DAY3.setText(String.valueOf(SExtraPrice4));
  1899.                     }*/
  1900.  
  1901.                 }
  1902.              else{
  1903.                    Component frame3 = null;
  1904.                     JOptionPane.showMessageDialog(frame3, "   Record Not Found");
  1905.                  }
  1906.        statement.close();
  1907.        connection.close();
  1908.         }
  1909.         // detect problems interacting with the database
  1910.         catch (SQLException sqlException )
  1911.         {
  1912.             JOptionPane.showMessageDialog( null, sqlException.getMessage(), "Database Error", JOptionPane.ERROR_MESSAGE );
  1913.             System.exit (1);
  1914.         }
  1915.         // detect problems loading database driver
  1916.         catch (ClassNotFoundException classNotFound)
  1917.         {
  1918.             JOptionPane.showMessageDialog(null, classNotFound.getMessage(), "Driver Not Found", JOptionPane.ERROR_MESSAGE );
  1919.             System.exit(1);
  1920.         }
  1921.     }
  1922.  
  1923.         private void applyCharges()
  1924.         {   String Service1_DAY1 = String.valueOf(Extra1_DAY1.getText());
  1925.             String Service2_DAY1 = String.valueOf(Extra2_DAY1.getText());
  1926.             String Service3_DAY1 = String.valueOf(Extra3_DAY1.getText());
  1927.             String Service4_DAY1 = String.valueOf(Extra4_DAY1.getText());
  1928.             String Price1_DAY1 = String.valueOf(ROOMAMOUNT4_DAY1.getText());
  1929.             String Price2_DAY1 = String.valueOf(ROOMAMOUNT5_DAY1.getText());
  1930.             String Price3_DAY1 = String.valueOf(ROOMAMOUNT6_DAY1.getText());
  1931.             String Price4_DAY1 = String.valueOf(ROOMAMOUNT7_DAY1.getText());
  1932.             String Service1_DAY2 = String.valueOf(Extra1_DAY2.getText());
  1933.             String Service2_DAY2 = String.valueOf(Extra2_DAY2.getText());
  1934.             String Service3_DAY2 = String.valueOf(Extra3_DAY2.getText());
  1935.             String Service4_DAY2 = String.valueOf(Extra4_DAY2.getText());
  1936.             String Price1_DAY2 = String.valueOf(ROOMAMOUNT4_DAY2.getText());
  1937.             String Price2_DAY2 = String.valueOf(ROOMAMOUNT5_DAY2.getText());
  1938.             String Price3_DAY2 = String.valueOf(ROOMAMOUNT6_DAY2.getText());
  1939.             String Price4_DAY2 = String.valueOf(ROOMAMOUNT7_DAY2.getText());
  1940.             String Service1_DAY3 = String.valueOf(Extra1_DAY3.getText());
  1941.             String Service2_DAY3 = String.valueOf(Extra2_DAY3.getText());
  1942.             String Service3_DAY3 = String.valueOf(Extra3_DAY3.getText());
  1943.             String Service4_DAY3 = String.valueOf(Extra4_DAY3.getText());
  1944.             String Price1_DAY3 = String.valueOf(ROOMAMOUNT4_DAY3.getText());
  1945.             String Price2_DAY3 = String.valueOf(ROOMAMOUNT5_DAY3.getText());
  1946.             String Price3_DAY3 = String.valueOf(ROOMAMOUNT6_DAY3.getText());
  1947.             String Price4_DAY3 = String.valueOf(ROOMAMOUNT7_DAY3.getText());
  1948.             RoomNumberSearchA = String.valueOf(RoomNum.getText());
  1949.  
  1950.             try {
  1951.                             Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); // load database driver class
  1952.                             connection = DriverManager.getConnection("jdbc:odbc:HotelManagementDB"); // Connect to database
  1953.                             statement = connection.createStatement(); // Create Statement to query database
  1954.                             resultset = statement.executeQuery("SELECT GuestID FROM BookingInfo WHERE RoomNumber = '"+ RoomNumberSearchA +"'");
  1955.                             resultset.next();
  1956.                             int GuestID = (Integer)resultset.getObject(1);
  1957.                             // creating a statement and different int variables
  1958.                             int serv_1, serv_2, serv_3; // TO CHECK FOR PROPER INSERTION
  1959.  
  1960.                     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 + "');");
  1961.                     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 + "');");
  1962.                     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 + "');");
  1963.                     System.out.println("Charges applied");
  1964.                 }
  1965.  
  1966.             catch (SQLException sqlException )
  1967.             {
  1968.                   JOptionPane.showMessageDialog( null, sqlException.getMessage(), "Database Error", JOptionPane.ERROR_MESSAGE );
  1969.                   System.exit (1);
  1970.             }
  1971.             // detect problems loading database driver
  1972.             catch (ClassNotFoundException classNotFound)
  1973.             {
  1974.                    JOptionPane.showMessageDialog(null, classNotFound.getMessage(), "Driver Not Found", JOptionPane.ERROR_MESSAGE );
  1975.                    System.exit(1);
  1976.             }
  1977.         }
  1978.  
  1979.   public int print(Graphics g, PageFormat pf, int page) throws
  1980.                                                                PrinterException {
  1981.  
  1982.     if (page > 0) {
  1983.                      return NO_SUCH_PAGE;
  1984.                   }
  1985.  
  1986.         Graphics2D g2d = (Graphics2D)g;
  1987.        g2d.translate(pf.getImageableX(), pf.getImageableY());
  1988.  
  1989.          //this.printAll(g);
  1990.  
  1991.          return PAGE_EXISTS;
  1992.     }
  1993. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement