Skip to content

Commit

Permalink
Merge pull request #346 from Ankit-3130/main
Browse files Browse the repository at this point in the history
billing-system
  • Loading branch information
kishanrajput23 authored Oct 19, 2023
2 parents fcc614c + 28ee9a7 commit e918b31
Show file tree
Hide file tree
Showing 46 changed files with 2,368 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Billing-system/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="img"/>
<classpathentry kind="src" path="res"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions Billing-system/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>RestaurantBillingSystem</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
26 changes: 26 additions & 0 deletions Billing-system/bin/billingsystem/Login.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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 id="pane" prefHeight="400" prefWidth="600" stylesheets="@login.css" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="billingsystem.MainController">
<children>
<Button fx:id="login" layoutX="254.0" layoutY="296.0" mnemonicParsing="false" onAction="#handleLogin" prefHeight="24.0" prefWidth="93.0" text="Login">
<font>
<Font name="System Bold" size="12.0" />
</font></Button>
<TextField fx:id="user" layoutX="226.0" layoutY="166.0" onAction="#handleLogin" />
<PasswordField fx:id="pwdFld" layoutX="226.0" layoutY="216.0" onAction="#handleLogin" />
<Label layoutX="226.0" layoutY="141.0" prefHeight="25.0" prefWidth="149.0" text="Username" textFill="IVORY" />
<Label layoutX="226.0" layoutY="191.0" prefHeight="25.0" prefWidth="149.0" text="Password" textFill="IVORY" />
<Label alignment="CENTER" layoutX="151.0" layoutY="52.0" prefHeight="54.0" prefWidth="299.0" text="Restaurant Billing System" textFill="IVORY">
<font>
<Font name="System Bold" size="20.0" />
</font>
</Label>
</children>
</AnchorPane>
Binary file added Billing-system/bin/billingsystem/Main.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Billing-system/bin/billingsystem/Order.class
Binary file not shown.
Binary file added Billing-system/bin/billingsystem/Table.class
Binary file not shown.
Binary file added Billing-system/bin/billingsystem/User.class
Binary file not shown.
3 changes: 3 additions & 0 deletions Billing-system/bin/billingsystem/login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pane {
-fx-background-image:url('login.jpg');
}
Binary file added Billing-system/bin/billingsystem/login.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Billing-system/bin/login.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Billing-system/bin/main.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Billing-system/bin/main_area.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Billing-system/bin/systemstyle/Format.class
Binary file not shown.
Binary file added Billing-system/img/login.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Billing-system/img/main.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Billing-system/img/main_area.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions Billing-system/src/billingsystem/Login.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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 id="pane" prefHeight="400" prefWidth="600" stylesheets="@login.css" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="billingsystem.MainController">
<children>
<Button fx:id="login" layoutX="254.0" layoutY="296.0" mnemonicParsing="false" onAction="#handleLogin" prefHeight="24.0" prefWidth="93.0" text="Login">
<font>
<Font name="System Bold" size="12.0" />
</font></Button>
<TextField fx:id="user" layoutX="226.0" layoutY="166.0" onAction="#handleLogin" />
<PasswordField fx:id="pwdFld" layoutX="226.0" layoutY="216.0" onAction="#handleLogin" />
<Label layoutX="226.0" layoutY="141.0" prefHeight="25.0" prefWidth="149.0" text="Username" textFill="IVORY" />
<Label layoutX="226.0" layoutY="191.0" prefHeight="25.0" prefWidth="149.0" text="Password" textFill="IVORY" />
<Label alignment="CENTER" layoutX="151.0" layoutY="52.0" prefHeight="54.0" prefWidth="299.0" text="Restaurant Billing System" textFill="IVORY">
<font>
<Font name="System Bold" size="20.0" />
</font>
</Label>
</children>
</AnchorPane>
118 changes: 118 additions & 0 deletions Billing-system/src/billingsystem/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
package billingsystem;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

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

/**
*
* @author Jason Li
* @version 1.0
* @since 19.12.2016
*
*
* The Class Main.
*/
public class Main extends Application {

/** The Constant logger. */
private static final Logger logger = Logger.getLogger(Main.class.getName());

/** The fh log. */
private static FileHandler fhLog;

/** The user path. */
private String userPath = "res/users.ser";

/** The log path. */
private String logPath = "res/activity.log";

/** The root admin. */
private final String rootAdmin = "admin";

/** The users list. */
private ArrayList<User> usersList = null;

/** The jarpath. */
private String jarpath;

/* (non-Javadoc)
* @see javafx.application.Application#start(javafx.stage.Stage)
*/
@Override
public void start(Stage primaryStage) {

try {
fhLog = new FileHandler(logPath, true);
logger.addHandler(fhLog);
SimpleFormatter formatter = new SimpleFormatter();
fhLog.setFormatter(formatter);
} catch (SecurityException e) {
logger.log(Level.SEVERE, "" + e);
} catch (IOException e) {
logger.log(Level.WARNING,
"Logger could not be set up to log to activity log. Logs will only be displayed in the console. \n"
+ e);
}
try {
try {
FileInputStream fileIn = new FileInputStream(userPath);
ObjectInputStream in = new ObjectInputStream(fileIn);
usersList = (ArrayList<User>) in.readObject();
in.close();
fileIn.close();
} catch (IOException i) {
logger.log(Level.INFO, "Root admin account 'admin' created on first time login.");
// Create admin account if not existent
User admin = new User(rootAdmin, "", true);
usersList = new ArrayList<User>();
usersList.add(admin);
try {
// Create user list with initial admin account
FileOutputStream fileOut = new FileOutputStream(userPath);
ObjectOutputStream out = new ObjectOutputStream(fileOut);
out.writeObject(usersList);
out.close();
fileOut.close();
} catch (IOException i2) {
logger.log(Level.WARNING, "" + i2);
}
}

// Create Login Screen
Parent root = FXMLLoader.load(getClass().getResource("/billingsystem/Login.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("login.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.setResizable(false);
primaryStage.show();
fhLog.close();

} catch (Exception e) {
logger.log(Level.SEVERE,
"Login Screen file has been deleted or is corrupted. Please restore 'Login.fxml' links. \n" + e);
}
}

/**
* The main method.
*
* @param args the arguments
*/
public static void main(String[] args) {
launch(args);
}
}
Loading

0 comments on commit e918b31

Please sign in to comment.