Restaurant Billing System



The project is “Restaurant Billing System” software for monitoring and controlling the transactions in a Restaurant. Restaurant Billing System is a windows application designed to help users maintain & organize Restaurant.The system processes transactions and stores the resulting data. Reports will be generated from these data which help the manager to make appropriate business decisions for the restaurant.


This is designed especially for a restaurant which wants to attend to their customers in a very well manner. This system has the capability to take the orders from the customers. First login to the system then use the feature of Restaurant Billing Project to take the orders from the customers and store the transaction details.


Login

Home Page
Main.fxml
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>


<AnchorPane prefHeight="500.0" prefWidth="650.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/11.0.1" fx:controller="application.MainController">
   <children>
      <Button layoutX="266.0" layoutY="307.0" mnemonicParsing="false" onAction="#login" prefHeight="33.0" prefWidth="79.0" text="login" />
      <TextField fx:id="userName" layoutX="231.0" layoutY="187.0" prefHeight="33.0" prefWidth="149.0" promptText="userName" />
      <PasswordField fx:id="password" layoutX="231.0" layoutY="238.0" prefHeight="33.0" prefWidth="149.0" promptText="password" />
      <Label layoutX="37.0" layoutY="41.0" prefHeight="41.0" prefWidth="303.0" text="Welcome in Restaurant Billing System" textFill="#1b6ff5">
         <font>
            <Font size="18.0" />
         </font>
      </Label>
      <Button layoutX="527.0" layoutY="45.0" mnemonicParsing="false" onAction="#exit" prefHeight="33.0" prefWidth="79.0" text="Exit" textFill="RED" />
      <Label fx:id="errorMessage" layoutX="231.0" layoutY="282.0" prefHeight="17.0" prefWidth="149.0" textFill="#da0909" />
   </children>
</AnchorPane>

MainController.java
package application;

import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

public class MainController {
	
		@FXML
		private TextField userName;
		
		@FXML
		private TextField password;
		
		@FXML
		private Label errorMessage;
		
		public void login(ActionEvent event) throws Exception{
			if(userName.getText().equals("user") && password.getText().equals("123456")){
				errorMessage.setText(null);
				Stage primaryStage= new Stage();
				Parent root =FXMLLoader.load(getClass().getResource("/application/Home.fxml"));

				scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
				primaryStage.setScene(scene);
				primaryStage.show();
				
			}else{
				errorMessage.setText("userName and password is wrong");
			}
		}
		
		public void exit(ActionEvent event){
			Platform.exit();
			System.exit(0);
		}
		
		
}


Home.fxml
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.text.Font?>

<AnchorPane nodeOrientation="LEFT_TO_RIGHT" prefHeight="600.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.HomeController">
   <children>
      <BorderPane prefHeight="88.0" prefWidth="682.0">
         <top>
            <Label prefHeight="43.0" prefWidth="682.0" text="  Welcome in Restaurent Management System" BorderPane.alignment="CENTER">
               <font>
                  <Font size="20.0" />
               </font>
            </Label>
         </top>
         <center>
            <MenuBar nodeOrientation="LEFT_TO_RIGHT" prefHeight="46.0" prefWidth="672.0" BorderPane.alignment="CENTER">
              <menus>
                <Menu mnemonicParsing="false" text="Home" />
                <Menu mnemonicParsing="false" text="Edit">
                  <items>
                    <MenuItem mnemonicParsing="false" text="Delete" />
                  </items>
                </Menu>
                <Menu mnemonicParsing="false" text="Close">
                  <items>
                    <MenuItem mnemonicParsing="false" text="About" />
                  </items>
                </Menu>
              </menus>
               <BorderPane.margin>
                  <Insets />
               </BorderPane.margin>
               <cursor>
                  <Cursor fx:constant="TEXT" />
               </cursor>
            </MenuBar>
         </center>
      </BorderPane>
      <BorderPane layoutX="-1.0" layoutY="88.0" prefHeight="44.0" prefWidth="682.0">
         <top>
            <Label prefHeight="42.0" prefWidth="97.0" text="Order" BorderPane.alignment="CENTER_LEFT">
               <BorderPane.margin>
                  <Insets />
               </BorderPane.margin>
               <padding>
                  <Insets left="20.0" />
               </padding>
               <font>
                  <Font size="20.0" />
               </font>
            </Label>
         </top>
      </BorderPane>
      <Label layoutX="15.0" layoutY="142.0" prefHeight="36.0" prefWidth="77.0" text="Table No." />
      <Label layoutX="14.0" layoutY="184.0" prefHeight="36.0" prefWidth="51.0" text="Date" />
      <Label layoutX="14.0" layoutY="220.0" prefHeight="36.0" prefWidth="51.0" text="Time" />
      <Label layoutX="355.0" layoutY="145.0" prefHeight="36.0" prefWidth="61.0" text="Order Id" />
      <Label layoutX="355.0" layoutY="185.0" prefHeight="36.0" prefWidth="61.0" text="Total" />
      <TableView fx:id="table" layoutX="14.0" layoutY="267.0" prefHeight="200.0" prefWidth="360.0">
        <columns>
          <TableColumn fx:id="itemName" prefWidth="183.0" text="Item" />
          <TableColumn fx:id="quantity1" prefWidth="87.0" text="Quantity" />
            <TableColumn fx:id="price" prefWidth="89.0" text="Total" />
        </columns>
      </TableView>
      <Label layoutX="403.0" layoutY="275.0" prefHeight="36.0" prefWidth="61.0" text="Add Item" />
      <Label layoutX="403.0" layoutY="357.0" prefHeight="36.0" prefWidth="61.0" text="Quantity" />
      <Button layoutX="459.0" layoutY="420.0" mnemonicParsing="false" onAction="#add" prefHeight="36.0" prefWidth="121.0" text="Add" />
      <Button layoutX="78.0" layoutY="510.0" mnemonicParsing="false" onAction="#remove" prefHeight="36.0" prefWidth="129.0" text="Remove Item" />
      <Button layoutX="377.0" layoutY="509.0" mnemonicParsing="false" prefHeight="36.0" prefWidth="121.0" text="View Details" />
      <Label fx:id="tabelNo" layoutX="156.0" layoutY="145.0" prefHeight="36.0" prefWidth="77.0" />
      <Label fx:id="orderId" layoutX="471.0" layoutY="145.0" prefHeight="36.0" prefWidth="77.0" />
      <Label fx:id="date" layoutX="156.0" layoutY="185.0" prefHeight="36.0" prefWidth="77.0" />
      <Label fx:id="time" layoutX="156.0" layoutY="220.0" prefHeight="36.0" prefWidth="77.0" />
      <Label fx:id="total" layoutX="471.0" layoutY="193.0" prefHeight="36.0" prefWidth="77.0" />
      <ComboBox fx:id="comboBox" layoutX="498.0" layoutY="282.0" prefHeight="36.0" prefWidth="150.0" promptText="selectName" />
      <ComboBox fx:id="quantity" layoutX="498.0" layoutY="357.0" prefHeight="36.0" prefWidth="150.0" promptText="selectQuantity" />
   </children>
</AnchorPane>

HomeController
package application;																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																															

import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.ResourceBundle;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;

public class HomeController implements Initializable {
	@FXML
	public ComboBox<String> comboBox;
	public ComboBox<String> quantity;
	
	ObservableList<String> list=FXCollections.observableArrayList("paneer","paratha","veg chaumine");
	
	ObservableList<String> quantityList=FXCollections.observableArrayList("1","2","3","4","5","6","7");
	
	
	@FXML
	private Label tabelNo;
	@FXML
	private Label orderId;
	@FXML
	private Label date;
	@FXML
	private Label time;
	@FXML
	private Label total;
	
	TableView<FileData> record=new TableView<FileData>();
	
						@FXML
						private TableView<FileData> table;
	
						@FXML
						private TableColumn<FileData, String> itemName;
						@FXML
						private TableColumn<FileData, Integer> quantity1;
						@FXML
						private TableColumn<FileData, Integer> price;
	@Override
	public void initialize(URL location, ResourceBundle resources) {
		comboBox.setItems(list);
		quantity.setItems(quantityList);
		LocalDate localDate=LocalDate.now();
		String cdate=DateTimeFormatter.ofPattern("yyy/MM/dd").format(localDate)+"";
		System.out.println(cdate);																																													
		total.setText(Integer.toString(10));
		time.setText(java.time.LocalTime.now()+"");
		DateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm:ss");
		Date dateobj = new Date();
		System.out.println(df.format(dateobj));
		date.setText(dateobj+"");
		tabelNo.setText(1+"");
		orderId.setText(10+"");	
}
	public void add(ActionEvent event){
		int quantity_no=Integer.parseInt(quantity.getValue());
		String item=comboBox.getValue();
		itemName.setCellValueFactory(new PropertyValueFactory<FileData, String>("itemName"));
		quantity1.setCellValueFactory(new PropertyValueFactory<FileData, Integer>("quantity"));
		price.setCellValueFactory(new PropertyValueFactory<FileData, Integer>("price"));
		ObservableList<FileData> data = FXCollections.observableArrayList(
		         new FileData(item,quantity_no,120*quantity_no)
		);
		
			table.getItems().addAll(data);
		int sum=0;
		for(FileData record:table.getItems()){
			sum=sum+record.getPrice();
		}
		total.setText(sum+"");
	}
	public void remove(ActionEvent event){
		FileData data=table.getSelectionModel().getSelectedItem();
		table.getItems().remove(data);
		
		int sum=0;
		for(FileData record:table.getItems()){
			sum=sum+record.getPrice();
		}
		total.setText(sum+"");
	}
}

FileData.java


FileData.java

package application;

import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;

	public class FileData {
		private SimpleStringProperty itemName;
		private SimpleIntegerProperty quantity;
		private SimpleIntegerProperty price;
		
		public FileData() {
			super();
		}
		public FileData(String itemName, int quantity, int price) {
			super();
			this.itemName = new SimpleStringProperty(itemName);
			this.quantity = new SimpleIntegerProperty(quantity);
			this.price = new SimpleIntegerProperty(price);
		}
		
		public String getItemName() {
			return itemName.get();
		}
		
		public int getQuantity() {
			return quantity.get();
		}
		
		public int getPrice() {																				
			return price.get();
		}																								
	}

Main.java
package application;
	
import javafx.application.Application;

import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.scene.Parent;
import javafx.scene.Scene;


public class Main extends Application {
	@Override
	public void start(Stage primaryStage) {
		try {
			Parent root =FXMLLoader.load(getClass().getResource("/application/Main.fxml"));
			scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
			primaryStage.setScene(scene);
			primaryStage.show();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		launch(args);
	}
}



Contact Us

Tel: (+91) 0120  4118730  

Time :   10 : 00  AM -  08 : 00 PM IST 

Registered address: G-69, Sector 63, 

 Noida - 201301, India

We Provide Services Across The different countries

USA    Australia   Canada   UK    UAE    Singapore   New Zealand    Malasia   India   Ireland   Germany

Terms and Conditions        Privacy Policy    Pricing Policy       Refund Policy         COPYRIGHT © 2021

Sofstack Technology Solutions Pvt. Ltd.

  • CodersArts | Linkedin
  • Instagram