Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayush Jain authored and Ayush Jain committed Oct 14, 2016
1 parent 29ce4dc commit 4e8418e
Show file tree
Hide file tree
Showing 76 changed files with 6,379 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# invoice-fx
A JavaFX based invoicing applicationfor restaurants
# BillerFX

'''It is an invoicing application for restaurants and hotels developed in JavaFX.'''

* Maintains database in MySql hence multiple applications can be installed, sharing the information of clients and orders.
* Keeps track of the orders received from individual tables and generates a printable pdf invoice (automatically calculates the discounts and taxes) in the end.
* Manages a history of the visitors, their visit frequency, favourite table and items (based on order history). It also keeps track of the quantity of items sold (weekly/monthly) and specially for drinks it notifies how much volume of a particular drink is remaining.
* Supports emailing the invoice to the client so that papers are saved.
Binary file added lib/itext-pdfa-5.4.5.jar
Binary file not shown.
Binary file added lib/itext-xtra-5.4.5.jar
Binary file not shown.
Binary file added lib/itextpdf-5.4.5.jar
Binary file not shown.
Binary file added lib/mysql-connector-java-5.1.23-bin.jar
Binary file not shown.
Binary file added src/Data/1.png
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 src/Data/about.png
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 src/Data/back.png
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 src/Data/biller.png
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 src/Data/bottom-bar.png
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 src/Data/customer.png
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 src/Data/forward.png
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 src/Data/icon-overlay.png
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 src/Data/inventory.png
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 src/Data/invoice.png
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 src/Data/invoices.png
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 src/Data/mid-bar-left.png
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 src/Data/mid-bar-right.png
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 src/Data/mid-bar.png
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 src/Data/reload.png
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 src/Data/search-box.png
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 src/Data/search-clear-over.png
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 src/Data/search-clear.png
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 src/Data/search.png
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 src/Data/settings.png
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 src/Data/splash.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 src/Data/splash.png
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 src/Data/texture.png
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 src/Data/top-bar.png
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 src/Data/tree-background.png
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 src/Data/window-close-over.png
Binary file added src/Data/window-close.png
Binary file added src/Data/window-min-over.png
Binary file added src/Data/window-min.png
179 changes: 179 additions & 0 deletions src/billerfx/BillerFX.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package billerfx;

import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URL;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.prefs.Preferences;
import javafx.animation.FadeTransition;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.util.Duration;

/**
*
* @author Ayush Jain
*/
public class BillerFX extends Application {

static Preferences prefs;
static Stage primaryStage;
static Scene scene[];
final static DecimalFormat df = new DecimalFormat("#.##");
final static Map<Integer,ObservableList> map = new HashMap<Integer,ObservableList>();

@Override
public void start(final Stage primaryStage) {
BillerFX.primaryStage = primaryStage;
/*Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Hello World!");
}
});*/
final ImageView imv = new ImageView();
URL url=ClassLoader.getSystemResource("Data/splash.png");
Image image1 = new Image(url.toString());
imv.setImage(image1);

StackPane root1 = new StackPane();
root1.getChildren().add(imv);

Scene scene1 = new Scene(root1, image1.getWidth(), image1.getHeight(), Color.TRANSPARENT);

primaryStage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setScene(scene1);
primaryStage.centerOnScreen();
primaryStage.show();
FadeTransition ft = new FadeTransition(Duration.millis(700), imv);
ft.setFromValue(0.0);
ft.setToValue(1.0);
ft.play();
new Thread(){
@Override
public void run(){
try{
Thread.sleep(5000);
}catch(InterruptedException n){}

prefs = Preferences.userNodeForPackage(billerfx.BillerFX.class);
final int fst = Integer.parseInt(prefs.get("fstart","1"));
initialise();

String jk = prefs.get("dbno", "0");
int r = 0,ans = 0;
if(jk.equals("0"))
{
r = (int)(Math.random()*9000 + 1000);
ans = r+1;
while(ans%7!=0)
ans++;
}
final int y = r, z = ans;

Platform.runLater(new Runnable() {
@Override
public void run() {
initialiseScenes();
if(y != 0)
{
String kk = Dialogs.showInputDialog(primaryStage, "Enter Passphrase For Key : "+y);
try{
if(Integer.parseInt(kk) == -108)
{
prefs.put("dbno","1");
}
else if(Integer.parseInt(kk) != z)
{
System.exit(0);
}
}catch(Exception mmm){System.exit(0);}
}
//Dialogs.showErrorDialog(primaryStage, "Could not connect to the database !", "Error", "Connection Error");
primaryStage.hide();
if(fst == 0)
{
primaryStage.setScene(BillerFX.scene[6]);
primaryStage.show();
}
else
{
prefs.put("fstart","0");
primaryStage.setScene(BillerFX.scene[8]);
primaryStage.show();
}
}
});
}
}.start();
}

void initialise()
{
Database.DB_URL = prefs.get("dburl", "jdbc:mysql://localhost/billierfx");
Database.USER = prefs.get("user", "root");
Database.PASS = prefs.get("pass", "");
}

void initialiseScenes()
{
try {
scene = new Scene[9];
//scene[0] = new Scene((Parent) FXMLLoader.load(getClass().getResource("FXMLAdd.fxml")));
//scene[1] = new Scene((Parent) FXMLLoader.load(getClass().getResource("FXMLAddItem.fxml")));
//scene[2] = new Scene((Parent) FXMLLoader.load(getClass().getResource("FXMLBill.fxml")));
scene[3] = new Scene((Parent) FXMLLoader.load(getClass().getResource("FXMLCustomer.fxml")));
scene[4] = new Scene((Parent) FXMLLoader.load(getClass().getResource("FXMLInventory.fxml")));
scene[5] = new Scene((Parent) FXMLLoader.load(getClass().getResource("FXMLInfo.fxml")));
scene[6] = new Scene((Parent) FXMLLoader.load(getClass().getResource("FXMLInvoice.fxml")));
scene[7] = new Scene((Parent) FXMLLoader.load(getClass().getResource("FXMLInvoices.fxml")));
scene[8] = new Scene((Parent) FXMLLoader.load(getClass().getResource("FXMLSettings.fxml")));
} catch (IOException ex) {
ex.printStackTrace();
System.exit(0);
}
}

/**
* The main() method is ignored in correctly deployed JavaFX application.
* main() serves only as fallback in case the application can not be
* launched through deployment artifacts, e.g., in IDEs with limited FX
* support. NetBeans ignores main().
*
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}

public static double round(double value, int places) {
if (places < 0) throw new IllegalArgumentException();

BigDecimal bd = new BigDecimal(value);
bd = bd.setScale(places, RoundingMode.HALF_UP);
return bd.doubleValue();
}

}
55 changes: 55 additions & 0 deletions src/billerfx/Customer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package billerfx;

import javafx.beans.property.SimpleStringProperty;

/**
*
* @author Ayush Jain
*/
public class Customer {
private final SimpleStringProperty id;
private final SimpleStringProperty name;
private final SimpleStringProperty phone;
private final SimpleStringProperty email;
private final SimpleStringProperty address;
private final SimpleStringProperty visited;

Customer(String id, String name, String phone, String email, String address, String visited) {
this.id = new SimpleStringProperty(id);
this.name = new SimpleStringProperty(name);
this.phone = new SimpleStringProperty(phone);
this.email = new SimpleStringProperty(email);
this.address = new SimpleStringProperty(address);
this.visited = new SimpleStringProperty(visited);
}

public String getId() {
return id.get();
}

public String getName() {
return name.get();
}

public String getPhone() {
return phone.get();
}

public String getEmail() {
return email.get();
}

public String getAddress() {
return address.get();
}

public String getVisited() {
return visited.get();
}
}
Loading

0 comments on commit 4e8418e

Please sign in to comment.