Compare commits
	
		
			8 Commits
		
	
	
		
			a24023ac66
			...
			testing
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8650177d86 | |||
| 2a59156b0b | |||
| 786586c382 | |||
| 1c640de416 | |||
| 5f1b0d9ae1 | |||
| 105c168157 | |||
| 606b879fb9 | |||
| 748f08abfd | 
| @ -76,7 +76,41 @@ class DBController | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// table Position section | ||||
| 	public String getCategoryNameFromPositionen(int pID) | ||||
| 	{ | ||||
| 		// System.out.println("getCategoryName: " + pID); | ||||
|  | ||||
| 		int catInPos = 0; | ||||
|  | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery("SELECT posid, cat FROM positionen " | ||||
| 					+ "WHERE posid = " + pID + ";"); | ||||
| 			catInPos = rs.getInt("cat"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 		if (catInPos == 6) { | ||||
| 			return "Standard"; | ||||
| 		} | ||||
|  | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery("SELECT catid, catname FROM category " | ||||
| 					+ "WHERE catid = " + catInPos + ";"); | ||||
| 			return rs.getString("catname"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "keine Kategorie"; | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	// table Position section // | ||||
| 	public void createTablePositionen() | ||||
| 	{ // create table position | ||||
| 		System.out.println("Erstelle Tabelle Positionen"); | ||||
| @ -92,79 +126,11 @@ class DBController | ||||
|  | ||||
| 		// create 25 demo/default data entries | ||||
| 		for (int i = 0; i < 25; i++) { | ||||
| 			fillPositionen_Positionen(i + 1, "Noch frei", (float) 0.00, | ||||
| 					((int) (i / 5)) + 1, "#ad0000"); | ||||
| 			fillPositionen_Positionen(i + 1, "Noch frei", (float) 0.00, 6, | ||||
| 					"#ad0000"); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public void createTableCategory() | ||||
| 	{ // create table position | ||||
| 		System.out.println("Erstelle Tabelle Kategorie"); | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			stmt.executeUpdate("DROP TABLE IF EXISTS category;"); | ||||
| 			stmt.executeUpdate("CREATE TABLE category (catid, catname);"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
|  | ||||
| 		for (int i = 1; i < 6; i++) { | ||||
| 			fillCategory_Category(i, "Cat: " + (i)); | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public String getCategoryNameFromPositionen(int pID) | ||||
| 	{ | ||||
| 		//System.out.println("getCategoryName: " + pID); | ||||
|  | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT posid, cat, catid, catname FROM positionen, category " | ||||
| 							+ "WHERE posid = " + pID + " AND cat = catid;"); | ||||
| 			return rs.getString("catname"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "Error 404"; | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public void setName_Category(int pID, String pName) | ||||
| 	{ // Setzte den Namen | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			stmt.executeUpdate("UPDATE category SET catname = '" + pName | ||||
| 					+ "'WHERE catid =" + pID + ";"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public void fillCategory_Category(int pID, String pName) | ||||
| 	{ | ||||
|  | ||||
| 		System.out.println("Erstelle neuen Kategorie Eintrag"); | ||||
| 		try { | ||||
| 			PreparedStatement ps = connection | ||||
| 					.prepareStatement("INSERT INTO category VALUES (?, ?);"); | ||||
| 			ps.setInt(1, pID); // primary | ||||
| 			ps.setString(2, pName); | ||||
| 			ps.addBatch(); | ||||
| 			connection.setAutoCommit(false); | ||||
| 			ps.executeBatch(); // SQL execution | ||||
| 			connection.setAutoCommit(true); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public void fillPositionen_Positionen(int pID, String pName, float pValue, | ||||
| 			int pCat, String pColor) | ||||
| 	{ // create new data in table | ||||
| @ -202,21 +168,6 @@ class DBController | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public String getName_Category(int pID) | ||||
| 	{ // Gibt das Datum zurück | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT catid, catname FROM category WHERE catid = " + pID | ||||
| 							+ ";"); | ||||
| 			return rs.getString("catname"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "Error 404"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public String getValue_Positionen(int pID) | ||||
| 	{ // Gibt das Konto zurück | ||||
| 		try { | ||||
| @ -291,7 +242,7 @@ class DBController | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			stmt.executeUpdate("UPDATE positionen SET cat = '" + pCat | ||||
| 					+ "'WHERE catid =" + pID + ";"); | ||||
| 					+ "'WHERE posid =" + pID + ";"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| @ -354,7 +305,75 @@ class DBController | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// table Jobs section | ||||
| 	// table Category section // | ||||
| 	public void createTableCategory() | ||||
| 	{ // create table position | ||||
| 		System.out.println("Erstelle Tabelle Kategorie"); | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			stmt.executeUpdate("DROP TABLE IF EXISTS category;"); | ||||
| 			stmt.executeUpdate("CREATE TABLE category (catid, catname);"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
|  | ||||
| 		fillCategory_Category(1, "Essen"); | ||||
| 		fillCategory_Category(2, "alkoholische Getränke"); | ||||
| 		fillCategory_Category(3, "alkoholfreie Getränke"); | ||||
| 		fillCategory_Category(4, "Kuchen"); | ||||
| 		fillCategory_Category(5, "Standard"); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public void setName_Category(int pID, String pName) | ||||
| 	{ // Setzte den Namen | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			stmt.executeUpdate("UPDATE category SET catname = '" + pName | ||||
| 					+ "'WHERE catid =" + pID + ";"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public void fillCategory_Category(int pID, String pName) | ||||
| 	{ | ||||
|  | ||||
| 		System.out.println("Erstelle neuen Kategorie Eintrag"); | ||||
| 		try { | ||||
| 			PreparedStatement ps = connection | ||||
| 					.prepareStatement("INSERT INTO category VALUES (?, ?);"); | ||||
| 			ps.setInt(1, pID); // primary | ||||
| 			ps.setString(2, pName); | ||||
| 			ps.addBatch(); | ||||
| 			connection.setAutoCommit(false); | ||||
| 			ps.executeBatch(); // SQL execution | ||||
| 			connection.setAutoCommit(true); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public String getName_Category(int pID) | ||||
| 	{ // Gibt das Datum zurück | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT catid, catname FROM category WHERE catid = " + pID | ||||
| 							+ ";"); | ||||
| 			return rs.getString("catname"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "Error 404"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// table Jobs section // | ||||
| 	public void erstelleTabelleJobs() | ||||
| 	{ // Erstelle Tabelle mit Reihen | ||||
| 		System.out.println("Erstelle Tabelle Jobs"); | ||||
| @ -362,11 +381,217 @@ class DBController | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			stmt.executeUpdate("DROP TABLE IF EXISTS jobs;"); | ||||
| 			stmt.executeUpdate( | ||||
| 					"CREATE TABLE jobs (id, time, positionen, state, value);"); | ||||
| 					"CREATE TABLE jobs (jobid, time, positionen_quantity, positionen_name, positionen_value, positionen_cat, state, jobvalue);"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public int getLatestJobNumber_Job() | ||||
| 	{ | ||||
|  | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT jobid from jobs ORDER BY jobid DESC LIMIT 1;"); | ||||
| 			return rs.getInt("jobid"); | ||||
| 		} catch (SQLException e) { | ||||
| 			// System.err.println("Couldn't handle DB-Query"); | ||||
| 			// e.printStackTrace(); | ||||
|  | ||||
| 		} | ||||
| 		return 0; | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public String getTime_Job(int pID) | ||||
| 	{ // Gibt den Nutzernamen zurück | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT jobid, time FROM jobs WHERE jobid = " + pID + ";"); | ||||
| 			return rs.getString("time"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "404"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public String getQuantity_Job(int pID) | ||||
| 	{ // Gibt den Nutzernamen zurück | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT jobid, positionen_quantity FROM jobs WHERE jobid = " | ||||
| 							+ pID + ";"); | ||||
| 			return rs.getString("positionen_quantity"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "404"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public String getName_Job(int pID) | ||||
| 	{ // Gibt den Nutzernamen zurück | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT jobid, positionen_name FROM jobs WHERE jobid = " + pID | ||||
| 							+ ";"); | ||||
| 			return rs.getString("positionen_name"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "404"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public String getValue_Job(int pID) | ||||
| 	{ // Gibt den Nutzernamen zurück | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT jobid, positionen_value FROM jobs WHERE jobid = " + pID | ||||
| 							+ ";"); | ||||
| 			return rs.getString("positionen_value"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "404"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public String getCategory_Job(int pID) | ||||
| 	{ // Gibt den Nutzernamen zurück | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT jobid, positionen_cat FROM jobs WHERE jobid = " + pID | ||||
| 							+ ";"); | ||||
| 			return rs.getString("positionen_cat"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "404"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public String getState_Job(int pID) | ||||
| 	{ // Gibt den Nutzernamen zurück | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT jobid, state FROM jobs WHERE jobid = " + pID + ";"); | ||||
| 			return rs.getString("state"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "404"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public String getJobValue_Job(int pID) | ||||
| 	{ // Gibt den Nutzernamen zurück | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT jobid, jobvalue FROM jobs WHERE jobid = " + pID + ";"); | ||||
| 			return rs.getString("jobvalue"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "404"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public String getAllJobValue_Job() | ||||
| 	{ // Gibt den Nutzernamen zurück | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT state, jobvalue, SUM(jobvalue) AS ALLVALUE FROM jobs WHERE state = " | ||||
| 							+ '"' + "verbucht" + '"' + ";"); | ||||
| 			return rs.getString("ALLVALUE"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 			return "0"; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public void setStatus_Jobs(int pID, String pStatus) | ||||
| 	{ // Setzt das Konto | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			stmt.executeUpdate("UPDATE jobs SET state = '" + pStatus | ||||
| 					+ "'WHERE jobid =" + pID + ";"); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public ArrayList<tableDataJob> loadTableJobs_Job() | ||||
| 	{ // Gibt den Nutzernamen zurück | ||||
|  | ||||
| 		ArrayList<tableDataJob> tmp = new ArrayList<tableDataJob>(); | ||||
| 		try { | ||||
| 			Statement stmt = connection.createStatement(); | ||||
| 			ResultSet rs = stmt.executeQuery( | ||||
| 					"SELECT jobid, time, positionen_quantity, positionen_name, positionen_value, positionen_cat, state, jobvalue FROM jobs;"); | ||||
| 			while (rs.next()) { | ||||
| 				try { | ||||
|  | ||||
| 					// return rs.getString("jobvalue"); | ||||
|  | ||||
| 					String tablePosition = rs.getString("positionen_name"); | ||||
|  | ||||
| 					tableDataJob data = new tableDataJob(rs.getInt("jobid"), | ||||
| 							rs.getString("time"), tablePosition, rs.getString("state"), | ||||
| 							rs.getString("jobvalue")); | ||||
|  | ||||
| 					tmp.add(data); | ||||
| 				} catch (SQLException e) { | ||||
| 					System.err.println("Couldn't handle DB-Query"); | ||||
| 					e.printStackTrace(); | ||||
| 				} | ||||
| 			} | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 		return tmp; | ||||
| 	} | ||||
|  | ||||
| 	public void fillJobs_Jobs(int pID, String pTime, String pPositionen_quantity, | ||||
| 			String pPositionen_name, String pPositionen_value, | ||||
| 			String pPositionen_cat, String pState, String pJobvalue) | ||||
| 	{ | ||||
|  | ||||
| 		System.out.println("Create new Job Entry"); | ||||
| 		try { | ||||
| 			PreparedStatement ps = connection.prepareStatement( | ||||
| 					"INSERT INTO jobs VALUES (?, ?, ?, ?, ?, ?, ?, ?);"); | ||||
| 			ps.setInt(1, pID); // primary | ||||
| 			ps.setString(2, pTime); | ||||
| 			ps.setString(3, pPositionen_quantity); | ||||
| 			ps.setString(4, pPositionen_name); | ||||
| 			ps.setString(5, pPositionen_value); | ||||
| 			ps.setString(6, pPositionen_cat); | ||||
| 			ps.setString(7, pState); | ||||
| 			ps.setString(8, pJobvalue); | ||||
| 			ps.addBatch(); | ||||
| 			connection.setAutoCommit(false); | ||||
| 			ps.executeBatch(); // SQL execution | ||||
| 			connection.setAutoCommit(true); | ||||
| 		} catch (SQLException e) { | ||||
| 			System.err.println("Couldn't handle DB-Query"); | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| } | ||||
|  | ||||
							
								
								
									
										208
									
								
								src/application/Job.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										208
									
								
								src/application/Job.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,208 @@ | ||||
| package application; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
|  | ||||
| public class Job | ||||
| { | ||||
|  | ||||
| 	private int jobnumber; | ||||
|  | ||||
| 	private float jobvalue; | ||||
|  | ||||
| 	private String jobtime; | ||||
|  | ||||
| 	private ArrayList<Integer> positionenQuantity; | ||||
|  | ||||
| 	private ArrayList<String> positionenName; | ||||
|  | ||||
| 	private ArrayList<Float> positionenValue; | ||||
|  | ||||
| 	private ArrayList<String> positionenCat; | ||||
|  | ||||
| 	public Job(int pJobnumber, String pTime) | ||||
| 	{ | ||||
| 		this.jobnumber = pJobnumber; | ||||
| 		this.jobtime = pTime; | ||||
|  | ||||
| 		positionenQuantity = new ArrayList<Integer>(); | ||||
| 		positionenName = new ArrayList<String>(); | ||||
| 		positionenValue = new ArrayList<Float>(); | ||||
| 		positionenCat = new ArrayList<String>(); | ||||
|  | ||||
| 		// System.out.println("Größe: " + positionenName.size()); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public int getJobnumber() | ||||
| 	{ | ||||
| 		return this.jobnumber; | ||||
| 	} | ||||
|  | ||||
| 	public String getJobtime() | ||||
| 	{ | ||||
| 		return this.jobtime; | ||||
| 	} | ||||
|  | ||||
| 	public float getJobValue() | ||||
| 	{ | ||||
|  | ||||
| 		calcJobValue(); | ||||
|  | ||||
| 		return this.jobvalue; | ||||
| 	} | ||||
|  | ||||
| 	public void addPosition(String pPositionenName, float pPositionenValue, | ||||
| 			String pPositionenCat) | ||||
| 	{ | ||||
| 		// System.out.println("addName"); | ||||
|  | ||||
| 		for (int i = 0; i < positionenName.size(); i++) { | ||||
| 			if (positionenName.get(i).equals(pPositionenName)) { | ||||
| 				// Item is already in list, increase quantity | ||||
| 				positionenQuantity.set(i, positionenQuantity.get(i) + 1); | ||||
| 				// System.out.println("Item exists, increasing quantity"); | ||||
| 				return; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		positionenName.add(pPositionenName); | ||||
| 		positionenValue.add(pPositionenValue); | ||||
| 		positionenCat.add(pPositionenCat); | ||||
| 		positionenQuantity.add(1); | ||||
|  | ||||
| 		calcJobValue(); | ||||
| 	} | ||||
|  | ||||
| 	public void printJobOnConsole() | ||||
| 	{ | ||||
|  | ||||
| 		System.out.println("---------------------------------------------"); | ||||
| 		System.out.println("JobNummer: " + jobnumber); | ||||
| 		System.out.println("---------------------------------------------"); | ||||
|  | ||||
| 		// System.out.println("Größe: " + positionenName.size()); | ||||
|  | ||||
| 		for (int i = 0; i < positionenName.size(); i++) { | ||||
|  | ||||
| 			System.out.println( | ||||
| 					positionenQuantity.get(i) + " " + positionenName.get(i) + " " | ||||
| 							+ positionenValue.get(i) + " " + positionenCat.get(i)); | ||||
| 			/* | ||||
| 			 * System.out.println("i is: " + i); | ||||
| 			 * System.out.println(positionenName.get(i)); | ||||
| 			 * System.out.println(positionenQuantity.get(i)); | ||||
| 			 */ | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 		System.out.println("---------------------------------------------"); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public ArrayList<tableDataCurrentOrder> getCurrentJobPositionen() | ||||
| 	{ | ||||
|  | ||||
| 		ArrayList<tableDataCurrentOrder> jobitems = new ArrayList<tableDataCurrentOrder>(); | ||||
|  | ||||
| 		for (int i = 0; i < positionenName.size(); i++) { | ||||
|  | ||||
| 			tableDataCurrentOrder tmp = new tableDataCurrentOrder( | ||||
| 					positionenName.get(i), positionenQuantity.get(i)); | ||||
|  | ||||
| 			jobitems.add(tmp); | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 		return jobitems; | ||||
| 	} | ||||
|  | ||||
| 	private void calcJobValue() | ||||
| 	{ | ||||
|  | ||||
| 		jobvalue = 0; | ||||
|  | ||||
| 		for (int i = 0; i < positionenValue.size(); i++) { | ||||
|  | ||||
| 			jobvalue = jobvalue | ||||
| 					+ (positionenQuantity.get(i) * positionenValue.get(i)); | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public String createPosQuantityDBString() | ||||
| 	{ | ||||
| 		String tmp = String.valueOf(positionenQuantity.get(0)); | ||||
| 		for (int i = 1; i < positionenName.size(); i++) { | ||||
|  | ||||
| 			tmp = tmp + ";" + positionenQuantity.get(i); | ||||
| 		} | ||||
| 		return tmp; | ||||
| 	} | ||||
|  | ||||
| 	public String createPosNameDBString() | ||||
| 	{ | ||||
| 		String tmp = positionenName.get(0); | ||||
| 		for (int i = 1; i < positionenName.size(); i++) { | ||||
|  | ||||
| 			tmp = tmp + ";" + positionenName.get(i); | ||||
| 		} | ||||
| 		return tmp; | ||||
| 	} | ||||
|  | ||||
| 	public String createPosValueDBString() | ||||
| 	{ | ||||
| 		String tmp = String.valueOf(positionenValue.get(0)); | ||||
| 		for (int i = 1; i < positionenName.size(); i++) { | ||||
|  | ||||
| 			tmp = tmp + ";" + positionenValue.get(i); | ||||
| 		} | ||||
| 		return tmp; | ||||
| 	} | ||||
|  | ||||
| 	public String createPosCatDBString() | ||||
| 	{ | ||||
| 		String tmp = positionenCat.get(0); | ||||
| 		for (int i = 1; i < positionenName.size(); i++) { | ||||
|  | ||||
| 			tmp = tmp + ";" + positionenCat.get(i); | ||||
| 		} | ||||
| 		return tmp; | ||||
| 	} | ||||
|  | ||||
| 	public void deletePosName(String pPosName) | ||||
| 	{ | ||||
|  | ||||
| 		for (int i = 0; i < positionenName.size(); i++) { | ||||
|  | ||||
| 			if (positionenName.get(i).equals(pPosName)) { | ||||
|  | ||||
| 				if (positionenQuantity.get(i) > 1) { | ||||
| 					positionenQuantity.set(i, positionenQuantity.get(i) - 1); | ||||
| 				} else { | ||||
|  | ||||
| 					positionenQuantity.remove(i); | ||||
| 					positionenName.remove(i); | ||||
| 					positionenValue.remove(i); | ||||
| 					positionenCat.remove(i); | ||||
|  | ||||
| 				} | ||||
|  | ||||
| 			} | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public boolean existsPosName(String pPosName) | ||||
| 	{ | ||||
| 		for (int i = 0; i < positionenName.size(); i++) { | ||||
| 			if (positionenName.get(i).equals(pPosName)) { | ||||
| 				return true; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		return false; | ||||
| 	} | ||||
|  | ||||
| } | ||||
| @ -77,12 +77,15 @@ public class Main extends Application | ||||
| 			dbc.connectDatabase(); // estabishing DB conection | ||||
| 			mwc.fillTablePositionen(); // fill TreeTable 'Positionen' | ||||
| 			mwc.fillCategory(); | ||||
| 			mwc.fillTableJobs(); | ||||
| 			mwc.loadGridButtons(); | ||||
| 			mwc.getSelectedCat(); //Load DB entries in Chois Box | ||||
| 			mwc.createNewJob(); | ||||
| 		} else { | ||||
| 			// config.xml NOT found, first start of app | ||||
| 			System.out.println("keine XML gefunden!"); | ||||
| 			mwc.blockUI(true); // disable UI elements that need DB | ||||
| 			mwc.blockUnlock(); | ||||
| 			File dir = new File(System.getProperty("user.home") + "/bin/jFxKasse"); | ||||
| 			dir.mkdir(); // Create new Subfolder | ||||
| 		} | ||||
|  | ||||
| @ -108,17 +108,20 @@ | ||||
| 						</AnchorPane> | ||||
| 					</content> | ||||
| 				</Tab> | ||||
| 				<Tab text="Positionen bearbeiten"> | ||||
| 				<Tab fx:id="tapPosEdit" text="Positionen bearbeiten"> | ||||
| 					<content> | ||||
| 						<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0"> | ||||
| 							<children> | ||||
| 								<TreeTableView fx:id="entryTreeTable" layoutX="11.0" layoutY="10.0" prefHeight="502.0" prefWidth="1346.0"> | ||||
| 								<placeholder> | ||||
| 										<Label text="" /> | ||||
| 									</placeholder> | ||||
| 									<columns> | ||||
|                               <TreeTableColumn fx:id="columnColor" editable="false" maxWidth="237.3333740234375" minWidth="164.0" prefWidth="164.0" resizable="false" sortable="false" text="Farbe" /> | ||||
|                               <TreeTableColumn fx:id="columnCat" editable="false" maxWidth="800.0" minWidth="176.33331298828125" prefWidth="370.0" resizable="false" sortable="false" text="Kategorie" /> | ||||
|                               <TreeTableColumn fx:id="columnPrize" editable="false" maxWidth="693.3333129882812" minWidth="44.33331298828125" prefWidth="126.66668701171875" resizable="false" sortable="false" text="Preis" /> | ||||
|                               <TreeTableColumn fx:id="columnPositionsEdit" editable="false" maxWidth="1581.6666870117188" minWidth="38.0" prefWidth="543.3333129882812" resizable="false" sortable="false" text="Positionen" /> | ||||
|                               <TreeTableColumn fx:id="columnPosnumber" editable="false" maxWidth="1218.0" minWidth="60.666748046875" prefWidth="148.6666259765625" resizable="false" sortable="false" text="Nummer" /> | ||||
| 										<TreeTableColumn fx:id="columnColor" editable="false" maxWidth="428.0" minWidth="119.333251953125" prefWidth="119.333251953125" resizable="false" sortable="false" text="Farbe" /> | ||||
| 										<TreeTableColumn fx:id="columnCat" editable="false" maxWidth="800.0" minWidth="94.0" prefWidth="300.0" resizable="false" sortable="false" text="Kategorie" /> | ||||
| 										<TreeTableColumn fx:id="columnPrize" editable="false" maxWidth="693.3333129882812" minWidth="44.33331298828125" prefWidth="140.33331298828125" resizable="false" sortable="false" text="Preis" /> | ||||
| 										<TreeTableColumn fx:id="columnPositionsEdit" editable="false" maxWidth="1581.6666870117188" minWidth="38.0" prefWidth="596.333251953125" resizable="false" sortable="false" text="Positionen" /> | ||||
| 										<TreeTableColumn fx:id="columnPosnumber" editable="false" maxWidth="1218.0" minWidth="59.0" prefWidth="181.6666259765625" resizable="false" sortable="false" text="Nummer" /> | ||||
| 									</columns> | ||||
| 									<columnResizePolicy> | ||||
| 										<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> | ||||
| @ -134,11 +137,11 @@ | ||||
| 										<Font name="Cantarell Regular" size="17.0" /> | ||||
| 									</font> | ||||
| 								</Button> | ||||
|                         <TitledPane alignment="CENTER" animated="false" collapsible="false" contentDisplay="CENTER" layoutX="792.0" layoutY="525.0" prefHeight="163.0" prefWidth="565.0" text="Eintrag editieren"> | ||||
| 								<TitledPane fx:id="titledPaneEntry" alignment="CENTER" animated="false" collapsible="false" contentDisplay="CENTER" layoutX="792.0" layoutY="525.0" prefHeight="163.0" prefWidth="565.0" text="Eintrag editieren"> | ||||
| 									<content> | ||||
| 										<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0"> | ||||
| 											<children> | ||||
|                                     <Label fx:id="lableNewPosition" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="10.0" prefHeight="34.0" prefWidth="105.0" text="Position:"> | ||||
| 												<Label fx:id="labelNewPosition" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="10.0" prefHeight="34.0" prefWidth="105.0" text="Position:"> | ||||
| 													<font> | ||||
| 														<Font name="Cantarell Regular" size="18.0" /> | ||||
| 													</font> | ||||
| @ -146,23 +149,25 @@ | ||||
| 												<JFXTextField fx:id="tftNewPosition" alignment="CENTER" layoutX="160.0" layoutY="10.0" prefHeight="25.0" prefWidth="279.0"> | ||||
| 													<font> | ||||
| 														<Font name="Cantarell Regular" size="13.0" /> | ||||
|                                        </font></JFXTextField> | ||||
| 													</font> | ||||
| 												</JFXTextField> | ||||
| 												<Label fx:id="labelNewValue" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="442.0" layoutY="50.0" prefHeight="34.0" prefWidth="118.0" text="Preis in Euro:"> | ||||
| 													<font> | ||||
| 														<Font name="Cantarell Regular" size="18.0" /> | ||||
| 													</font> | ||||
| 												</Label> | ||||
|                                     <JFXTextField fx:id="tftNewValue" alignment="CENTER" layoutX="380.0" layoutY="50.0" prefHeight="25.0" prefWidth="58.0"> | ||||
| 												<JFXTextField fx:id="tftNewValue" alignment="CENTER" labelFloat="true" layoutX="380.0" layoutY="50.0" prefHeight="25.0" prefWidth="58.0"> | ||||
| 													<font> | ||||
| 														<Font name="Cantarell Regular" size="13.0" /> | ||||
|                                        </font></JFXTextField> | ||||
|                                     <Label fx:id="lableNewColor" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Farbe:"> | ||||
| 													</font> | ||||
| 												</JFXTextField> | ||||
| 												<Label fx:id="labelNewColor" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="455.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Farbe:"> | ||||
| 													<font> | ||||
| 														<Font name="Cantarell Regular" size="18.0" /> | ||||
| 													</font> | ||||
| 												</Label> | ||||
| 												<ChoiceBox fx:id="colorChoise" layoutX="346.0" layoutY="90.0" prefHeight="25.0" prefWidth="96.0" /> | ||||
|                                     <Label fx:id="lableSelectCat" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="204.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Kategorie:"> | ||||
| 												<Label fx:id="labelSelectCat" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="204.0" layoutY="90.0" prefHeight="34.0" prefWidth="105.0" text="Kategorie:"> | ||||
| 													<font> | ||||
| 														<Font name="Cantarell Regular" size="18.0" /> | ||||
| 													</font> | ||||
| @ -175,7 +180,8 @@ | ||||
| 										<Font name="Cantarell Regular" size="13.0" /> | ||||
| 									</font> | ||||
| 								</TitledPane> | ||||
|                      </children></AnchorPane> | ||||
| 							</children> | ||||
| 						</AnchorPane> | ||||
| 					</content> | ||||
| 				</Tab> | ||||
| 				<Tab text="Aufträge"> | ||||
| @ -183,12 +189,15 @@ | ||||
| 						<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="850.0" prefWidth="1536.0"> | ||||
| 							<children> | ||||
| 								<TreeTableView fx:id="jobsTreeTable" layoutX="11.0" layoutY="10.0" prefHeight="541.0" prefWidth="1346.0"> | ||||
| 								<placeholder> | ||||
| 										<Label text="" /> | ||||
| 									</placeholder> | ||||
| 									<columns> | ||||
| 										<TreeTableColumn fx:id="columnJobValue" editable="false" prefWidth="90.6666259765625" resizable="false" text="Betrag" /> | ||||
| 										<TreeTableColumn fx:id="columnState" editable="false" prefWidth="91.0" resizable="false" text="Zustand" /> | ||||
| 										<TreeTableColumn fx:id="columnPositions" editable="false" prefWidth="981.333251953125" resizable="false" sortable="false" text="Positionen" /> | ||||
| 										<TreeTableColumn fx:id="columnTime" editable="false" prefWidth="99.666748046875" resizable="false" text="Zeit" /> | ||||
| 										<TreeTableColumn fx:id="columnJobNumber" editable="false" maxWidth="3000.0" prefWidth="83.6666259765625" resizable="false" text="Nummer" /> | ||||
| 										<TreeTableColumn fx:id="columnJobValue" editable="false" prefWidth="111.0" resizable="false" text="Betrag" /> | ||||
| 										<TreeTableColumn fx:id="columnState" editable="false" prefWidth="101.0" resizable="false" text="Zustand" /> | ||||
| 										<TreeTableColumn fx:id="columnPositions" editable="false" prefWidth="861.0" resizable="false" sortable="false" text="Positionen" /> | ||||
| 										<TreeTableColumn fx:id="columnTime" editable="false" prefWidth="159.0" resizable="false" text="Zeit" /> | ||||
| 										<TreeTableColumn fx:id="columnJobNumber" editable="false" maxWidth="3000.0" prefWidth="110.666748046875" resizable="false" text="Nummer" /> | ||||
| 									</columns> | ||||
| 								</TreeTableView> | ||||
| 								<Button fx:id="btnReprintJob" layoutX="378.0" layoutY="603.0" mnemonicParsing="false" onAction="#btnReprintJobAction" text="Ausgewählter Auftrag drucken"> | ||||
| @ -196,21 +205,21 @@ | ||||
| 										<Font name="Cantarell Regular" size="17.0" /> | ||||
| 									</font> | ||||
| 								</Button> | ||||
| 								<TitledPane fx:id="titlePaneStats" alignment="CENTER" collapsible="false" contentDisplay="CENTER" layoutX="992.0" layoutY="561.0" prefHeight="118.0" prefWidth="365.0" text="Statistik - 30.03.2018 15:15 Uhr"> | ||||
| 								<TitledPane fx:id="titlePaneStats" alignment="CENTER" collapsible="false" contentDisplay="CENTER" layoutX="957.0" layoutY="561.0" prefHeight="118.0" prefWidth="400.0" text="Statistik - 30.03.2018 15:15 Uhr"> | ||||
| 									<content> | ||||
| 										<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="59.0" prefWidth="483.0"> | ||||
| 										<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="92.0" prefWidth="414.0"> | ||||
| 											<children> | ||||
| 												<Label fx:id="lableJobCount" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="17.0" layoutY="2.0" prefHeight="34.0" prefWidth="340.0" text="Anzahl Aufträge: 2781"> | ||||
| 												<Label fx:id="labelJobCount" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="41.0" layoutY="2.0" prefHeight="34.0" prefWidth="340.0" text="Anzahl Aufträge: 2781"> | ||||
| 													<font> | ||||
| 														<Font name="Cantarell Regular" size="18.0" /> | ||||
| 													</font> | ||||
| 												</Label> | ||||
| 												<Label fx:id="labelAvgJob" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="17.0" layoutY="30.0" prefHeight="34.0" prefWidth="340.0" text="Durchschnittlicher Auftragswert: 12,90€"> | ||||
| 												<Label fx:id="labelAvgJob" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="41.0" layoutY="30.0" prefHeight="34.0" prefWidth="340.0" text="Durchschnittlicher Auftragswert: 12,90€"> | ||||
| 													<font> | ||||
| 														<Font name="Cantarell Regular" size="18.0" /> | ||||
| 													</font> | ||||
| 												</Label> | ||||
| 												<Label fx:id="lableAllValue" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="17.0" layoutY="60.0" prefHeight="34.0" prefWidth="340.0" text="Gesamt: 1088,48€"> | ||||
| 												<Label fx:id="labelAllValue" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="41.0" layoutY="60.0" prefHeight="34.0" prefWidth="340.0" text="Gesamt: 1088,48€"> | ||||
| 													<font> | ||||
| 														<Font name="Cantarell Regular" size="18.0" /> | ||||
| 													</font> | ||||
| @ -238,10 +247,16 @@ | ||||
| 						<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="850.0" prefWidth="1536.0"> | ||||
| 							<children> | ||||
| 								<TreeTableView fx:id="tableCurrentOrder" layoutX="15.0" layoutY="85.0" prefHeight="379.0" prefWidth="382.0"> | ||||
| 									<placeholder> | ||||
| 										<Label text="" /> | ||||
| 									</placeholder> | ||||
| 									<columns> | ||||
| 										<TreeTableColumn fx:id="columnPosition" editable="false" prefWidth="304.3333740234375" resizable="false" sortable="false" text="Position" /> | ||||
| 										<TreeTableColumn fx:id="columnQuantity" editable="false" prefWidth="80.6666259765625" resizable="false" sortable="false" text="Anzahl" /> | ||||
| 										<TreeTableColumn fx:id="columnPosition" editable="false" prefWidth="320.0" resizable="false" sortable="false" text="Position" /> | ||||
| 										<TreeTableColumn fx:id="columnQuantity" editable="false" prefWidth="60.0" resizable="false" sortable="false" text="Anzahl" /> | ||||
| 									</columns> | ||||
| 									<columnResizePolicy> | ||||
| 										<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> | ||||
| 									</columnResizePolicy> | ||||
| 								</TreeTableView> | ||||
| 								<GridPane gridLinesVisible="true" layoutX="430.0" layoutY="15.0" prefHeight="670.0" prefWidth="920.0"> | ||||
| 									<columnConstraints> | ||||
| @ -386,7 +401,7 @@ | ||||
| 										</JFXButton> | ||||
| 									</children> | ||||
| 								</GridPane> | ||||
| 								<Button fx:id="btnPrintBill" contentDisplay="CENTER" defaultButton="true" graphicTextGap="1.0" layoutX="75.0" layoutY="599.0" maxHeight="88.0" minHeight="75.0" mnemonicParsing="false" onAction="#btnPrintBillAction" prefHeight="88.0" prefWidth="258.0" text="Drucken" wrapText="true"> | ||||
| 								<Button fx:id="btnPrintBill" contentDisplay="CENTER" defaultButton="true" graphicTextGap="1.0" layoutX="75.0" layoutY="599.0" maxHeight="88.0" minHeight="75.0" mnemonicParsing="false" onAction="#btnPrintBillAction" prefHeight="88.0" prefWidth="258.0" text="Drucken" textAlignment="CENTER" wrapText="true"> | ||||
| 									<font> | ||||
| 										<Font name="Cantarell Bold" size="48.0" /> | ||||
| 									</font> | ||||
| @ -396,9 +411,9 @@ | ||||
| 										<Font name="Cantarell Regular" size="20.0" /> | ||||
| 									</font> | ||||
| 								</Button> | ||||
| 								<Label fx:id="labelAllPrize" alignment="CENTER" contentDisplay="CENTER" layoutX="10.0" layoutY="505.0" prefHeight="15.0" prefWidth="386.0" text="0,00 €" textAlignment="CENTER"> | ||||
| 								<Label fx:id="labelAllPrize" alignment="CENTER" contentDisplay="CENTER" layoutX="10.0" layoutY="511.0" prefHeight="15.0" prefWidth="386.0" text="0,00 €" textAlignment="CENTER"> | ||||
| 									<font> | ||||
| 										<Font name="Open Sans" size="70.0" /> | ||||
| 										<Font name="Cantarell Regular" size="70.0" /> | ||||
| 									</font> | ||||
| 								</Label> | ||||
| 								<Label fx:id="labelJobCounter" alignment="TOP_RIGHT" contentDisplay="CENTER" layoutX="5.0" layoutY="45.0" prefHeight="34.0" prefWidth="392.0" text="Auftragsnummer: 0" textAlignment="CENTER"> | ||||
|  | ||||
| @ -24,6 +24,8 @@ import java.text.SimpleDateFormat; | ||||
| import java.util.Date; | ||||
| import java.util.Properties; | ||||
|  | ||||
|  | ||||
|  | ||||
| import com.jfoenix.controls.JFXTextField; | ||||
|  | ||||
| import javafx.beans.value.ChangeListener; | ||||
| @ -32,10 +34,12 @@ import javafx.collections.FXCollections; | ||||
| import javafx.collections.ObservableList; | ||||
| import javafx.event.ActionEvent; | ||||
| import javafx.scene.control.Label; | ||||
| import javafx.scene.control.Tab; | ||||
| import javafx.scene.layout.AnchorPane; | ||||
| import javafx.scene.layout.GridPane; | ||||
| import javafx.util.Pair; | ||||
|  | ||||
|  | ||||
| public class MainWindowController | ||||
| { | ||||
|  | ||||
| @ -50,38 +54,41 @@ public class MainWindowController | ||||
| 	private AnchorPane paneDB; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableView<tableData> tableCurrentOrder; | ||||
| 	private Tab tapPosEdit; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableColumn<tableData, String> columnQuantity; | ||||
| 	private TreeTableView<tableDataCurrentOrder> tableCurrentOrder; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableColumn<tableData, String> columnPosition; | ||||
| 	private TreeTableColumn<tableDataCurrentOrder, Integer> columnQuantity; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableColumn<tableData, Integer> idSpalte01 = new TreeTableColumn<>( | ||||
| 	private TreeTableColumn<tableDataCurrentOrder, String> columnPosition; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableColumn<tableDataCurrentOrder, Integer> idSpalte01 = new TreeTableColumn<>( | ||||
| 			"tableCurrentOrder"); | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableView<tableData> jobsTreeTable; | ||||
| 	private TreeTableView<tableDataJob> jobsTreeTable; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableColumn<tableData, String> columnJobValue; | ||||
| 	private TreeTableColumn<tableDataJob, String> columnJobValue; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableColumn<tableData, String> columnState; | ||||
| 	private TreeTableColumn<tableDataJob, String> columnState; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableColumn<tableData, String> columnPositions; | ||||
| 	private TreeTableColumn<tableDataJob, String> columnPositions; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableColumn<tableData, String> columnTime; | ||||
| 	private TreeTableColumn<tableDataJob, String> columnTime; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableColumn<tableData, String> columnJobNumber; | ||||
| 	private TreeTableColumn<tableDataJob, Integer> columnJobNumber; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TreeTableColumn<tableData, Integer> idSpalte02 = new TreeTableColumn<>( | ||||
| 	private TreeTableColumn<tableDataJob, Integer> idSpalte02 = new TreeTableColumn<>( | ||||
| 			"jobsTreeTable"); | ||||
|  | ||||
| 	@FXML | ||||
| @ -259,25 +266,25 @@ public class MainWindowController | ||||
| 	private Label labelTime; | ||||
|  | ||||
| 	@FXML | ||||
| 	private Label lableJobCount; | ||||
| 	private Label labelJobCount; | ||||
|  | ||||
| 	@FXML | ||||
| 	private Label labelAvgJob; | ||||
|  | ||||
| 	@FXML | ||||
| 	private Label lableAllValue; | ||||
| 	private Label labelAllValue; | ||||
|  | ||||
| 	@FXML | ||||
| 	private Label lableSelectCat; | ||||
| 	private Label labelSelectCat; | ||||
|  | ||||
| 	@FXML | ||||
| 	private Label lableNewPosition; | ||||
| 	private Label labelNewPosition; | ||||
|  | ||||
| 	@FXML | ||||
| 	private Label labelNewValue; | ||||
|  | ||||
| 	@FXML | ||||
| 	private Label lableNewColor; | ||||
| 	private Label labelNewColor; | ||||
|  | ||||
| 	@FXML | ||||
| 	private Label labelDBStatus; | ||||
| @ -291,6 +298,9 @@ public class MainWindowController | ||||
| 	@FXML | ||||
| 	private TitledPane titlePaneCat; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TitledPane titledPaneEntry; | ||||
|  | ||||
| 	@FXML | ||||
| 	private TextField tftNewPosition; | ||||
|  | ||||
| @ -318,12 +328,21 @@ public class MainWindowController | ||||
|  | ||||
| 	private boolean lockState = false; | ||||
|  | ||||
| 	@FXML | ||||
| 	TreeItem<tableData> rootCurrentJob = new TreeItem<>( | ||||
| 			new tableData(0, "0", "0")); | ||||
| 	private boolean isPrintBtnDisabled = true; | ||||
|  | ||||
| 	private Job currentJob = null; | ||||
|  | ||||
| 	private String currentOrderPosName; | ||||
|  | ||||
| 	private int selectedJobId; | ||||
|  | ||||
| 	@FXML | ||||
| 	TreeItem<tableData> rootJobs = new TreeItem<>(new tableData(0, "0", "0")); | ||||
| 	TreeItem<tableDataCurrentOrder> rootCurrentJob = new TreeItem<>( | ||||
| 			new tableDataCurrentOrder("0", 0)); | ||||
|  | ||||
| 	@FXML | ||||
| 	TreeItem<tableDataJob> rootJobs = new TreeItem<>( | ||||
| 			new tableDataJob(0, "0", "0", "0", "0")); | ||||
|  | ||||
| 	@FXML | ||||
| 	TreeItem<tableDataPositionen> rootPositionen = new TreeItem<>( | ||||
| @ -339,7 +358,7 @@ public class MainWindowController | ||||
| 		Dialog<Pair<String, String>> dialog = new Dialog<>(); | ||||
| 		dialog.setTitle("Über jFxKasse"); | ||||
| 		dialog.setHeaderText( | ||||
| 				"Informationen und Lizenzen - Version 0.9.3 - Techdemo"); | ||||
| 				"Informationen und Lizenzen - Version 0.1 - Without Printer"); | ||||
|  | ||||
| 		dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK); | ||||
|  | ||||
| @ -350,7 +369,7 @@ public class MainWindowController | ||||
|  | ||||
| 		grid.add(new Label( | ||||
| 				"Einfaches Kassensystem für kleine bis mittel große Veranstaltungen mit Bon-Drucker\n" | ||||
| 						+ "\nUnter Lizenz GPL-3.0 abrufbar auf https://github.com/Windoofs/jFxKasse\n" | ||||
| 						+ "\nUnter Lizenz GPL-3.0 abrufbar auf https://git.mosad.xyz/localhorst/jFxKasse\n" | ||||
| 						+ "\nDatenbank: sqlite.org - Public Domain" | ||||
| 						+ " \nUI Design01: eclipse.org/efxclipse/install.html - Eclipse Public License 1.0" | ||||
| 						+ " \nUI Design02: http://www.jfoenix.com/ -  Apache License 2.0" | ||||
| @ -375,6 +394,13 @@ public class MainWindowController | ||||
| 	@FXML | ||||
| 	public void btnCreateNewDatabaseAction(ActionEvent event) throws Exception | ||||
| 	{ | ||||
| 		 | ||||
| 		if(!(tftNewDBName.getText().equals(""))) { | ||||
| 			 | ||||
| 		 | ||||
| 			 | ||||
| 		 | ||||
| 		 | ||||
| 		setDatabaseName(tftNewDBName.getText()); | ||||
| 		dbc.dbname = getDatabaseName(); | ||||
| 		dbc.connectDatabase(); // establish DB connection | ||||
| @ -392,19 +418,22 @@ public class MainWindowController | ||||
| 		fillTablePositionen(); // fill TreeTable 'Positionen' | ||||
| 		fillCategory(); | ||||
| 		initUI(); // Starting the UI elements | ||||
| 		getSelectedCat(); | ||||
| 		createNewJob(); | ||||
|  | ||||
| 		btnLock.setDisable(false); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void btnSaveEntryAction(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Speichere Eintrag!"); | ||||
|  | ||||
| 		dbc.setName_Positionen(idPositionen, tftNewPosition.getText()); | ||||
| 		dbc.setValue_Positionen(idPositionen, tftNewValue.getText()); | ||||
| 		dbc.setColor_Positionen(idPositionen, getColorCodes(selectedColorName)); | ||||
|  | ||||
| 		System.out.println("refill pos"); | ||||
| 		dbc.setCat_Positionen(idPositionen, getSelectedCat()); | ||||
|  | ||||
| 		fillTablePositionen(); // fill TreeTable 'Positionen' | ||||
| 		loadGridButtons(); | ||||
|  | ||||
| @ -417,6 +446,7 @@ public class MainWindowController | ||||
| 		dbc.setName_Positionen(idPositionen, "Noch frei"); | ||||
| 		dbc.setValue_Positionen(idPositionen, "0.00"); | ||||
| 		dbc.setColor_Positionen(idPositionen, "#FAF0E6"); | ||||
| 		dbc.setCat_Positionen(idPositionen, 6); | ||||
|  | ||||
| 		fillTablePositionen(); // fill TreeTable 'Positionen' | ||||
| 	} | ||||
| @ -424,7 +454,27 @@ public class MainWindowController | ||||
| 	@FXML | ||||
| 	public void btnCalcStatsAction(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		 | ||||
| 		System.out.println(dbc.getAllJobValue_Job()); | ||||
| 		 | ||||
| 		if(dbc.getAllJobValue_Job() != null) { | ||||
| 			 | ||||
| 		 | ||||
| 			 | ||||
| 			float allValue = Float.valueOf(dbc.getAllJobValue_Job()); | ||||
|  | ||||
| 			float avgJobValue = ((float) allValue / dbc.getLatestJobNumber_Job()); | ||||
|  | ||||
| 			setJobStatLabel(dbc.getLatestJobNumber_Job(), avgJobValue, allValue); | ||||
| 		}else { | ||||
| 			setJobStatLabel(dbc.getLatestJobNumber_Job(), 0, 0); | ||||
| 		} | ||||
|  | ||||
| 		 | ||||
| 		 | ||||
| 		 | ||||
| 		titlePaneStats.setVisible(true); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| @ -436,7 +486,8 @@ public class MainWindowController | ||||
| 	@FXML | ||||
| 	public void btnCancelJobAction(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		dbc.setStatus_Jobs(selectedJobId + 1, "storniert"); | ||||
| 		fillTableJobs(); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| @ -457,8 +508,6 @@ public class MainWindowController | ||||
| 	@FXML | ||||
| 	public void btnSaveCatAction(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Cat´s speichern"); | ||||
|  | ||||
| 		dbc.setName_Category(1, tftKat01.getText()); | ||||
| 		dbc.setName_Category(2, tftKat02.getText()); | ||||
| 		dbc.setName_Category(3, tftKat03.getText()); | ||||
| @ -474,164 +523,210 @@ public class MainWindowController | ||||
| 	@FXML | ||||
| 	public void btnDeleteSelectedPositionAction(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		currentJob.deletePosName(currentOrderPosName); | ||||
| 		rootCurrentJob.getChildren().remove(0, | ||||
| 				rootCurrentJob.getChildren().size()); | ||||
|  | ||||
| 		for (int i = 0; i < currentJob.getCurrentJobPositionen().size(); i++) { | ||||
| 			rootCurrentJob.getChildren().add(new TreeItem<tableDataCurrentOrder>( | ||||
| 					currentJob.getCurrentJobPositionen().get(i))); | ||||
|  | ||||
| 		} | ||||
| 		setJobPrizeLabel(currentJob.getJobValue()); | ||||
| 		// currentJob.printJobOnConsole(); | ||||
|  | ||||
| 		if (rootCurrentJob.getChildren().size() == 0) { | ||||
| 			btnPrintBill.setDisable(true); | ||||
| 			isPrintBtnDisabled = true; | ||||
| 			tapPosEdit.setDisable(false); | ||||
| 			btnDeleteSelectedPosition.setDisable(true); | ||||
| 		} | ||||
|  | ||||
| 		if (!currentJob.existsPosName(currentOrderPosName)) { | ||||
| 			btnDeleteSelectedPosition.setDisable(true); | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void btnPrintBillAction(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		// currentJob.printJobOnConsole(); | ||||
|  | ||||
| 		btnPrintBill.setDisable(true); | ||||
| 		tapPosEdit.setDisable(false); | ||||
| 		btnDeleteSelectedPosition.setDisable(true); | ||||
| 		isPrintBtnDisabled = true; | ||||
|  | ||||
| 		setJobPrizeLabel(0); | ||||
|  | ||||
| 		rootCurrentJob.getChildren().remove(0, | ||||
| 				rootCurrentJob.getChildren().size()); | ||||
|  | ||||
| 		dbc.fillJobs_Jobs(currentJob.getJobnumber(), currentJob.getJobtime(), | ||||
| 				currentJob.createPosQuantityDBString(), | ||||
| 				currentJob.createPosNameDBString(), | ||||
| 				currentJob.createPosValueDBString(), | ||||
| 				currentJob.createPosCatDBString(), "verbucht", | ||||
| 				String.valueOf(currentJob.getJobValue())); | ||||
|  | ||||
| 		fillTableJobs(); | ||||
|  | ||||
| 		currentJob = null; | ||||
|  | ||||
| 		createNewJob(); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton01Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Test Button!"); | ||||
| 		handelGridButtons(1); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton02Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(2); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton03Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(3); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton04Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(4); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton05Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(5); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton06Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(6); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton07Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(7); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton08Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(8); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton09Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(9); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton10Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(10); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton11Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(11); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton12Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(12); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton13Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(13); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton14Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(14); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton15Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(15); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton16Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(16); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton17Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(17); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton18Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(18); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton19Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(19); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton20Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(20); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton21Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(21); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton22Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(22); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton23Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(23); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton24Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(24); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void gridButton25Action(ActionEvent event) | ||||
| 	{ | ||||
| 		System.out.println("Button!"); | ||||
| 		handelGridButtons(25); | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| @ -642,28 +737,50 @@ public class MainWindowController | ||||
| 				rootPositionen.getChildren().size()); | ||||
|  | ||||
| 		for (int i = 0; i < dbc.ladeTabellePositionen().size(); i++) { | ||||
| 			 | ||||
| 			 | ||||
| 			float fValue = Float.valueOf(dbc.ladeTabellePositionen().get(i).getValue()); | ||||
| 			 | ||||
| 			String strValue = String.format("%.02f", fValue); | ||||
|  | ||||
| 			strValue.replace('.', ','); | ||||
| 			 | ||||
| 			 | ||||
| 			 | ||||
| 			tableDataPositionen helpTableData = new tableDataPositionen( | ||||
| 					dbc.ladeTabellePositionen().get(i).getID(), | ||||
| 					dbc.ladeTabellePositionen().get(i).getName(), | ||||
| 					dbc.ladeTabellePositionen().get(i).getValue() + " €", | ||||
| 					 | ||||
| 					// dbc.ladeTabellePositionen().get(i).getCat(), | ||||
| 					// dbc.getCategoryName(dbc.ladeTabellePositionen().get(i).getCat())) | ||||
| 					(strValue + "€") | ||||
| 					 | ||||
| 				, | ||||
| 					 | ||||
| 					 | ||||
| 					 | ||||
| 					 | ||||
| 					 | ||||
| 					dbc.getCategoryNameFromPositionen(i + 1), | ||||
|  | ||||
| 					getColorNames(dbc.ladeTabellePositionen().get(i).getColor())); | ||||
|  | ||||
| 			rootPositionen.getChildren() | ||||
| 					.add(new TreeItem<tableDataPositionen>(helpTableData)); | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public void initUI() | ||||
| 	{ | ||||
| 		System.out.println("initUI"); | ||||
| 		for (int i = 0; i < 25; i++) { | ||||
| 			getButtonByID(i).setVisible(false); | ||||
| 		} | ||||
| 		tftNewDBName.setText(getDatabaseName()); | ||||
| 		tftKat05.setDisable(true); | ||||
| 		titlePaneStats.setVisible(false); | ||||
| 		btnPrintBill.setDisable(true); | ||||
| 		btnDeleteSelectedPosition.setDisable(true); | ||||
| 		isPrintBtnDisabled = true; | ||||
| 		initPositionen(); | ||||
| 		initCurrentOrderTreeTableView(); | ||||
| 		initJobTreeTableView(); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| @ -672,10 +789,22 @@ public class MainWindowController | ||||
|  | ||||
| 		ObservableList<String> cats = FXCollections.observableArrayList(); | ||||
|  | ||||
| 		cats.add(dbc.getName_Category(1)); | ||||
| 		cats.add(dbc.getName_Category(2)); | ||||
| 		cats.add(dbc.getName_Category(3)); | ||||
| 		cats.add(dbc.getName_Category(4)); | ||||
| 		for (int i = 1; i < 5; i++) { | ||||
|  | ||||
| 			if (dbc.getName_Category(i).equals("Standard")) { | ||||
|  | ||||
| 			} else { | ||||
| 				cats.add(dbc.getName_Category(i)); | ||||
| 			} | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 		/* | ||||
| 		 * cats.add(dbc.getName_Category(1)); | ||||
| 		 *  | ||||
| 		 * cats.add(dbc.getName_Category(2)); cats.add(dbc.getName_Category(3)); | ||||
| 		 * cats.add(dbc.getName_Category(4)); | ||||
| 		 */ | ||||
| 		cats.add(dbc.getName_Category(5)); | ||||
|  | ||||
| 		catChoise.setItems(cats); | ||||
| @ -688,17 +817,17 @@ public class MainWindowController | ||||
| 						selectedCatName = catChoise.getItems().get((int) new_value) | ||||
| 								.toString(); | ||||
|  | ||||
| 						System.out.println("Ausgewählte Cat: " + selectedCatName); | ||||
| 					} | ||||
| 				}); | ||||
|  | ||||
| 		for (int i = 1; i < 5; i++) { | ||||
| 			if (selectedCatName == dbc.getName_Category(i)) { | ||||
| 		for (int i = 1; i < 6; i++) { | ||||
|  | ||||
| 			if (dbc.getName_Category(i).equals(selectedCatName)) { | ||||
| 				return i; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		return -1; | ||||
| 		return 5; | ||||
| 	} | ||||
|  | ||||
| 	public void fillCategory() | ||||
| @ -716,6 +845,13 @@ public class MainWindowController | ||||
| 		entryTreeTable.setShowRoot(false); | ||||
| 		entryTreeTable.setEditable(false); | ||||
| 		 | ||||
| 		columnPosnumber.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
| 		columnPositionsEdit.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
| 		columnPrize.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
| 		columnCat.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
| 		columnColor.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
| 		 | ||||
|  | ||||
| 		ObservableList<String> color = FXCollections.observableArrayList("Rot", | ||||
| 				"Orange", "Braun", "Weiß", "Gelb", "Gr\u00fcn", "Blau", "Indigo"); | ||||
| 		colorChoise.setItems(color); | ||||
| @ -727,7 +863,6 @@ public class MainWindowController | ||||
| 					{ | ||||
| 						selectedColorName = colorChoise.getItems() | ||||
| 								.get((int) new_value).toString(); | ||||
| 						System.out.println("Ausgewählte Farbe: " + selectedColorName); | ||||
| 					} | ||||
| 				}); | ||||
|  | ||||
| @ -756,13 +891,8 @@ public class MainWindowController | ||||
| 						int selected = entryTreeTable.getSelectionModel() | ||||
| 								.getSelectedIndex(); // get selected item | ||||
|  | ||||
| 						idPositionen = columnPosnumber.getCellData(selected); // Ausgewählte | ||||
| 																								// Spalte | ||||
|  | ||||
| 						System.out.println( | ||||
| 								"Positionen - Ausgewaehlte Spalte: " + idPositionen); | ||||
|  | ||||
| 						try { // Setzt den Inhalt in die Textfelder | ||||
| 						idPositionen = columnPosnumber.getCellData(selected); | ||||
| 						try { | ||||
|  | ||||
| 							tftNewPosition | ||||
| 									.setText(dbc.getName_Positionen(idPositionen)); | ||||
| @ -770,6 +900,9 @@ public class MainWindowController | ||||
| 							colorChoise.getSelectionModel().select( | ||||
| 									getColorID(dbc.getColor_Positionen(idPositionen))); | ||||
|  | ||||
| 							catChoise.getSelectionModel().select( | ||||
| 									dbc.getCategoryNameFromPositionen(idPositionen)); | ||||
|  | ||||
| 						} catch (Exception e) { | ||||
| 							// TODO Auto-generated catch block | ||||
| 							e.printStackTrace(); | ||||
| @ -777,11 +910,7 @@ public class MainWindowController | ||||
| 					} | ||||
| 				}); | ||||
|  | ||||
| 		columnPosnumber.setStyle("-fx-alignment: CENTER;"); | ||||
| 		columnPositionsEdit.setStyle("-fx-alignment: CENTER;"); | ||||
| 		columnPrize.setStyle("-fx-alignment: CENTER;"); | ||||
| 		columnCat.setStyle("-fx-alignment: CENTER;"); | ||||
| 		columnColor.setStyle("-fx-alignment: CENTER;"); | ||||
|  | ||||
|  | ||||
| 		tftNewValue.textProperty().addListener(new ChangeListener<String>() { | ||||
| 			@Override | ||||
| @ -820,8 +949,16 @@ public class MainWindowController | ||||
| 	{ | ||||
| 		DateFormat dateFormat = new SimpleDateFormat("HH:mm"); | ||||
| 		Date date = new Date(); | ||||
| 		String heutigesDatum = dateFormat.format(date); | ||||
| 		return heutigesDatum; | ||||
| 		String time = dateFormat.format(date); | ||||
| 		return time; | ||||
| 	} | ||||
|  | ||||
| 	public String getSystemDate() | ||||
| 	{ | ||||
| 		DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); | ||||
| 		Date date = new Date(); | ||||
| 		String dateStr = dateFormat.format(date); | ||||
| 		return dateStr; | ||||
| 	} | ||||
|  | ||||
| 	public void saveSettings(String databasename) throws Exception | ||||
| @ -960,8 +1097,20 @@ public class MainWindowController | ||||
| 	{ | ||||
| 		btnCalcStats.setDisable(pState); | ||||
| 		btnClearEntry.setDisable(pState); | ||||
| 		btnDeleteSelectedPosition.setDisable(pState); | ||||
|  | ||||
| 		if ((!isPrintBtnDisabled) && (!pState)) { | ||||
| 			// print was not disabled and will be enabled again | ||||
| 			btnPrintBill.setDisable(pState); | ||||
| 			btnDeleteSelectedPosition.setDisable(pState); | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 		if (pState) { | ||||
| 			// disable allways | ||||
| 			btnPrintBill.setDisable(pState); | ||||
| 			btnDeleteSelectedPosition.setDisable(pState); | ||||
| 		} | ||||
|  | ||||
| 		btnReprintJob.setDisable(pState); | ||||
| 		btnSaveEntry.setDisable(pState); | ||||
| 		btnCancelJob.setDisable(pState); | ||||
| @ -982,8 +1131,11 @@ public class MainWindowController | ||||
| 		labelAllPrize.setVisible(!pState); | ||||
| 		labelJobCounter.setVisible(!pState); | ||||
|  | ||||
| 		if(pState) { | ||||
| 			titlePaneStats.setVisible(!pState); | ||||
| 		} | ||||
| 		 | ||||
| 		titledPaneEntry.setDisable(pState); | ||||
| 		titlePaneCat.setDisable(pState); | ||||
|  | ||||
| 	} | ||||
| @ -1018,6 +1170,7 @@ public class MainWindowController | ||||
|  | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	public Button getButtonByID(int pID) | ||||
| 	{ | ||||
| 		switch (pID) { | ||||
| @ -1076,10 +1229,223 @@ public class MainWindowController | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	public void updateTimeLabel() | ||||
|  | ||||
| 	private void handelGridButtons(int pID) | ||||
| 	{ | ||||
| 		// System.out.println(getSystemTime()); | ||||
| 		labelTime.setText("Uhrzeit: " + getSystemTime()); | ||||
|  | ||||
| 		currentJob.addPosition(dbc.getName_Positionen(pID), | ||||
| 				Float.parseFloat(dbc.getValue_Positionen(pID)), | ||||
| 				dbc.getCategoryNameFromPositionen(pID)); | ||||
|  | ||||
| 		btnPrintBill.setDisable(false); | ||||
| 		isPrintBtnDisabled = false; | ||||
| 		tapPosEdit.setDisable(true); | ||||
|  | ||||
| 		rootCurrentJob.getChildren().remove(0, | ||||
| 				rootCurrentJob.getChildren().size()); | ||||
|  | ||||
| 		for (int i = 0; i < currentJob.getCurrentJobPositionen().size(); i++) { | ||||
| 			rootCurrentJob.getChildren().add(new TreeItem<tableDataCurrentOrder>( | ||||
| 					currentJob.getCurrentJobPositionen().get(i))); | ||||
| 		} | ||||
|  | ||||
| 		setJobPrizeLabel(currentJob.getJobValue()); | ||||
|  | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	private void initCurrentOrderTreeTableView() | ||||
| 	{ | ||||
|  | ||||
| 		columnQuantity | ||||
| 				.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
| 		columnPosition | ||||
| 				.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
|  | ||||
| 		tableCurrentOrder.setRoot(rootCurrentJob); | ||||
| 		tableCurrentOrder.setShowRoot(false); | ||||
| 		tableCurrentOrder.setEditable(false); | ||||
|  | ||||
| 		columnQuantity.setCellValueFactory(cellData -> cellData.getValue() | ||||
| 				.getValue().quantityProperty().asObject()); | ||||
|  | ||||
| 		columnPosition.setCellValueFactory( | ||||
| 				cellData -> cellData.getValue().getValue().positionProperty()); | ||||
|  | ||||
| 		tableCurrentOrder.getSelectionModel().selectedItemProperty() | ||||
| 				.addListener(new ChangeListener<Object>() { | ||||
| 					@Override | ||||
| 					public void changed(ObservableValue<?> observable, Object oldVal, | ||||
| 							Object newVal) | ||||
| 					{ | ||||
| 						// last = selected; //for auto-play | ||||
| 						int selected = tableCurrentOrder.getSelectionModel() | ||||
| 								.getSelectedIndex(); // get selected item | ||||
|  | ||||
| 						if (columnPosition.getCellData(selected) != null) { | ||||
| 							currentOrderPosName = columnPosition.getCellData(selected); // Ausgewählte | ||||
| 							btnDeleteSelectedPosition.setDisable(false); | ||||
| 						} | ||||
| 					} | ||||
| 				}); | ||||
|  | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	private void initJobTreeTableView() | ||||
| 	{ | ||||
|  | ||||
| 		columnJobNumber | ||||
| 				.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
|  | ||||
| 		columnTime.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
|  | ||||
| 		columnPositions | ||||
| 				.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
|  | ||||
| 		columnState.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
|  | ||||
| 		columnJobValue | ||||
| 				.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||
|  | ||||
| 		jobsTreeTable.setRoot(rootJobs); | ||||
| 		jobsTreeTable.setShowRoot(false); | ||||
| 		jobsTreeTable.setEditable(false); | ||||
|  | ||||
| 		columnJobNumber.setCellValueFactory(cellData -> cellData.getValue() | ||||
| 				.getValue().numberProperty().asObject()); | ||||
|  | ||||
| 		columnTime.setCellValueFactory( | ||||
| 				cellData -> cellData.getValue().getValue().timeProperty()); | ||||
|  | ||||
| 		columnPositions.setCellValueFactory( | ||||
| 				cellData -> cellData.getValue().getValue().positionProperty()); | ||||
|  | ||||
| 		columnState.setCellValueFactory( | ||||
| 				cellData -> cellData.getValue().getValue().statusProperty()); | ||||
|  | ||||
| 		columnJobValue.setCellValueFactory( | ||||
| 				cellData -> cellData.getValue().getValue().valueProperty()); | ||||
|  | ||||
| 		jobsTreeTable.getSelectionModel().selectedItemProperty() | ||||
| 				.addListener(new ChangeListener<Object>() { | ||||
| 					@Override | ||||
| 					public void changed(ObservableValue<?> observable, Object oldVal, | ||||
| 							Object newVal) | ||||
| 					{ | ||||
| 						selectedJobId = jobsTreeTable.getSelectionModel() | ||||
| 								.getSelectedIndex(); // get selected item | ||||
| 	 | ||||
| 						if(dbc.getState_Job(selectedJobId+1).equals("storniert")) { | ||||
| 							btnCancelJob.setDisable(true); | ||||
| 						}else { | ||||
| 							btnCancelJob.setDisable(false); | ||||
| 						} | ||||
| 						 | ||||
| 						 | ||||
| 					} | ||||
| 				}); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	@FXML | ||||
| 	public void fillTableJobs() | ||||
| 	{ // loads the table in the TreeTableView | ||||
| 		rootJobs.getChildren().remove(0, rootJobs.getChildren().size()); | ||||
|  | ||||
| 		for (int i = 0; i < dbc.loadTableJobs_Job().size(); i++) { | ||||
|  | ||||
| 			float fValue = Float | ||||
| 					.valueOf(dbc.loadTableJobs_Job().get(i).getValue()); | ||||
|  | ||||
| 			String strValue = String.format("%.02f", fValue); | ||||
|  | ||||
| 			strValue.replace('.', ','); | ||||
|  | ||||
| 			strValue = (strValue + "€"); | ||||
|  | ||||
| 			String strJobDescription = createJobDescription( | ||||
| 					dbc.loadTableJobs_Job().get(i).getPosition(), | ||||
| 					dbc.getQuantity_Job(dbc.loadTableJobs_Job().get(i).getNumber())); | ||||
|  | ||||
| 			tableDataJob tmp = new tableDataJob( | ||||
| 					dbc.loadTableJobs_Job().get(i).getNumber(), | ||||
| 					dbc.loadTableJobs_Job().get(i).getTime(), strJobDescription, | ||||
| 					dbc.loadTableJobs_Job().get(i).getStatus(), strValue); | ||||
|  | ||||
| 			rootJobs.getChildren().add(new TreeItem<tableDataJob>(tmp)); | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public void createNewJob() | ||||
| 	{ | ||||
| 		currentJob = new Job(dbc.getLatestJobNumber_Job() + 1, | ||||
| 				getSystemTime() + " " + getSystemDate()); | ||||
| 		labelJobCounter.setText("Auftragsnummer: " | ||||
| 				+ String.valueOf(dbc.getLatestJobNumber_Job() + 1)); | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	private static String createJobDescription(String pNames, String pQuantities) | ||||
| 	{ | ||||
| 		String line = pQuantities; | ||||
| 		int size = line.length() - line.replace(";", "").length() + 1; | ||||
|  | ||||
| 		String[] namesArray = new String[size]; | ||||
| 		String[] quantitiesArray = new String[size]; | ||||
|  | ||||
| 		namesArray = pNames.split(";"); | ||||
| 		quantitiesArray = pQuantities.split(";"); | ||||
|  | ||||
| 		String tmp = quantitiesArray[0] + "x " + namesArray[0]; | ||||
|  | ||||
| 		for (int i = 1; i < namesArray.length; i++) { | ||||
| 			tmp = tmp + ", " + quantitiesArray[i] + "x " + namesArray[i]; | ||||
| 		} | ||||
| 		return tmp; | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	private void setJobPrizeLabel(float pPrize) | ||||
| 	{ | ||||
| 		String str = String.format("%.02f", pPrize); | ||||
|  | ||||
| 		str.replace('.', ','); | ||||
|  | ||||
| 		labelAllPrize.setText(str + "€"); | ||||
| 	} | ||||
|  | ||||
| 	private void setJobStatLabel(int pCounter, float pAvgValue, float pAllValue) | ||||
| 	{ | ||||
| 		labelJobCount.setText("Anzahl Aufträge: " + pCounter); | ||||
|  | ||||
| 		String str = String.format("%.02f", pAvgValue); | ||||
|  | ||||
| 		str.replace('.', ','); | ||||
|  | ||||
| 		labelAvgJob.setText("Durchschnittlicher Auftragswert: " + str + "€"); | ||||
|  | ||||
| 		str = String.format("%.02f", pAllValue); | ||||
|  | ||||
| 		str.replace('.', ','); | ||||
|  | ||||
| 		labelAllValue.setText("Gesamt: " + str + "€"); | ||||
| 		 | ||||
| 		titlePaneStats.setText("Statistik - " + getSystemTime() + " " + getSystemDate()); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public void updateTimeLabel() | ||||
| 	{ | ||||
| 		labelTime.setText("Uhrzeit: " + getSystemTime()); | ||||
|  | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	public void blockUnlock() | ||||
| 	{ | ||||
| 		btnLock.setDisable(true); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -1,68 +0,0 @@ | ||||
| package application; | ||||
|  | ||||
| import javafx.beans.property.IntegerProperty; | ||||
| import javafx.beans.property.SimpleIntegerProperty; | ||||
| import javafx.beans.property.SimpleStringProperty; | ||||
| import javafx.beans.property.StringProperty; | ||||
|  | ||||
| public class tableData | ||||
| { // Datenobjekt mit der ID, Datum und Konto | ||||
|  | ||||
| 	private final IntegerProperty id = new SimpleIntegerProperty(); | ||||
|  | ||||
| 	private final StringProperty datum = new SimpleStringProperty(); | ||||
|  | ||||
| 	private final StringProperty konto = new SimpleStringProperty(); | ||||
|  | ||||
| 	public tableData(final int id, final String datum, final String konto) | ||||
| 	{ | ||||
| 		this.id.set(id); | ||||
| 		this.datum.set(datum); | ||||
| 		this.konto.set(konto); | ||||
| 	} | ||||
|  | ||||
| 	public IntegerProperty idProperty() | ||||
| 	{ | ||||
| 		return id; | ||||
| 	} | ||||
|  | ||||
| 	public StringProperty datumProperty() | ||||
| 	{ | ||||
| 		return datum; | ||||
| 	} | ||||
|  | ||||
| 	public StringProperty kontoProperty() | ||||
| 	{ | ||||
| 		return konto; | ||||
| 	} | ||||
|  | ||||
| 	public int getID() | ||||
| 	{ | ||||
| 		return idProperty().get(); | ||||
| 	} | ||||
|  | ||||
| 	public String getDatum() | ||||
| 	{ | ||||
| 		return datumProperty().get(); | ||||
| 	} | ||||
|  | ||||
| 	public String getKonto() | ||||
| 	{ | ||||
| 		return kontoProperty().get(); | ||||
| 	} | ||||
|  | ||||
| 	public final void setID(int id) | ||||
| 	{ | ||||
| 		idProperty().set(id); | ||||
| 	} | ||||
|  | ||||
| 	public final void setdatum(String datum) | ||||
| 	{ | ||||
| 		datumProperty().set(datum); | ||||
| 	} | ||||
|  | ||||
| 	public final void setkonto(String konto) | ||||
| 	{ | ||||
| 		kontoProperty().set(konto); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										51
									
								
								src/application/tableDataCurrentOrder.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								src/application/tableDataCurrentOrder.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,51 @@ | ||||
| package application; | ||||
|  | ||||
| import javafx.beans.property.IntegerProperty; | ||||
| import javafx.beans.property.SimpleIntegerProperty; | ||||
| import javafx.beans.property.SimpleStringProperty; | ||||
| import javafx.beans.property.StringProperty; | ||||
|  | ||||
| public class tableDataCurrentOrder | ||||
| {  | ||||
|  | ||||
| 	private final StringProperty position = new SimpleStringProperty(); | ||||
|  | ||||
| 	private final IntegerProperty quantity = new SimpleIntegerProperty(); | ||||
|  | ||||
| 	public tableDataCurrentOrder(final String pPosition, final Integer pQuantity) | ||||
| 	{ | ||||
| 		this.position.set(pPosition); | ||||
| 		this.quantity.set(pQuantity); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public StringProperty positionProperty() | ||||
| 	{ | ||||
| 		return position; | ||||
| 	} | ||||
|  | ||||
| 	public IntegerProperty quantityProperty() | ||||
| 	{ | ||||
| 		return quantity; | ||||
| 	} | ||||
|  | ||||
| 	public String getPosition() | ||||
| 	{ | ||||
| 		return positionProperty().get(); | ||||
| 	} | ||||
|  | ||||
| 	public Integer getQuantity() | ||||
| 	{ | ||||
| 		return quantityProperty().get(); | ||||
| 	} | ||||
|  | ||||
| 	public final void setPosition(String pPosition) | ||||
| 	{ | ||||
| 		positionProperty().set(pPosition); | ||||
| 	} | ||||
|  | ||||
| 	public final void setQuantity(int pQuantity) | ||||
| 	{ | ||||
| 		quantityProperty().set(pQuantity); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										107
									
								
								src/application/tableDataJob.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								src/application/tableDataJob.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,107 @@ | ||||
| package application; | ||||
|  | ||||
| import javafx.beans.property.IntegerProperty; | ||||
| import javafx.beans.property.SimpleIntegerProperty; | ||||
| import javafx.beans.property.SimpleStringProperty; | ||||
| import javafx.beans.property.StringProperty; | ||||
|  | ||||
| public class tableDataJob | ||||
| { | ||||
|  | ||||
| 	private final IntegerProperty number = new SimpleIntegerProperty(); | ||||
|  | ||||
| 	private final StringProperty time = new SimpleStringProperty(); | ||||
|  | ||||
| 	private final StringProperty positionen = new SimpleStringProperty(); | ||||
|  | ||||
| 	private final StringProperty status = new SimpleStringProperty(); | ||||
|  | ||||
| 	private final StringProperty value = new SimpleStringProperty(); | ||||
|  | ||||
| 	public tableDataJob(final Integer pNumber, final String pTime, | ||||
| 			final String pPositionen, final String pStatus, final String pValue) | ||||
| 	{ | ||||
| 		this.number.set(pNumber); | ||||
| 		this.time.set(pTime); | ||||
| 		this.positionen.set(pPositionen); | ||||
| 		this.status.set(pStatus); | ||||
| 		this.value.set(pValue); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public IntegerProperty numberProperty() | ||||
| 	{ | ||||
| 		return number; | ||||
| 	} | ||||
|  | ||||
| 	public StringProperty timeProperty() | ||||
| 	{ | ||||
| 		return time; | ||||
| 	} | ||||
|  | ||||
| 	public StringProperty positionProperty() | ||||
| 	{ | ||||
| 		return positionen; | ||||
| 	} | ||||
|  | ||||
| 	public StringProperty statusProperty() | ||||
| 	{ | ||||
| 		return status; | ||||
| 	} | ||||
|  | ||||
| 	public StringProperty valueProperty() | ||||
| 	{ | ||||
| 		return value; | ||||
| 	} | ||||
|  | ||||
| 	public Integer getNumber() | ||||
| 	{ | ||||
| 		return numberProperty().get(); | ||||
| 	} | ||||
|  | ||||
| 	public String getTime() | ||||
| 	{ | ||||
| 		return timeProperty().get(); | ||||
| 	} | ||||
|  | ||||
| 	public String getPosition() | ||||
| 	{ | ||||
| 		return positionProperty().get(); | ||||
| 	} | ||||
|  | ||||
| 	public String getStatus() | ||||
| 	{ | ||||
| 		return statusProperty().get(); | ||||
| 	} | ||||
|  | ||||
| 	public String getValue() | ||||
| 	{ | ||||
| 		return valueProperty().get(); | ||||
| 	} | ||||
|  | ||||
| 	public final void setNumber(int pNumber) | ||||
| 	{ | ||||
| 		numberProperty().set(pNumber); | ||||
| 	} | ||||
|  | ||||
| 	public final void setTime(String pTime) | ||||
| 	{ | ||||
| 		timeProperty().set(pTime); | ||||
| 	} | ||||
|  | ||||
| 	public final void setPosition(String pPosition) | ||||
| 	{ | ||||
| 		positionProperty().set(pPosition); | ||||
| 	} | ||||
|  | ||||
| 	public final void setStatus(String pStatus) | ||||
| 	{ | ||||
| 		statusProperty().set(pStatus); | ||||
| 	} | ||||
|  | ||||
| 	public final void setValue(String pValue) | ||||
| 	{ | ||||
| 		valueProperty().set(pValue); | ||||
| 	} | ||||
|  | ||||
| } | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 577 B | 
		Reference in New Issue
	
	Block a user