Finished the current Order Table and the DB saving
This commit is contained in:
		| @ -24,9 +24,6 @@ public class Job | |||||||
| 		this.jobnumber = pJobnumber; | 		this.jobnumber = pJobnumber; | ||||||
| 		this.jobtime = pTime; | 		this.jobtime = pTime; | ||||||
|  |  | ||||||
| 		System.out |  | ||||||
| 				.println("Neuer Job: " + this.jobnumber + " Time: " + this.jobtime); |  | ||||||
|  |  | ||||||
| 		positionenQuantity = new ArrayList<Integer>(); | 		positionenQuantity = new ArrayList<Integer>(); | ||||||
| 		positionenName = new ArrayList<String>(); | 		positionenName = new ArrayList<String>(); | ||||||
| 		positionenValue = new ArrayList<Float>(); | 		positionenValue = new ArrayList<Float>(); | ||||||
| @ -49,6 +46,8 @@ public class Job | |||||||
| 	public float getJobValue() | 	public float getJobValue() | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
|  | 		calcJobValue(); | ||||||
|  |  | ||||||
| 		return this.jobvalue; | 		return this.jobvalue; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @ -120,6 +119,8 @@ public class Job | |||||||
| 	private void calcJobValue() | 	private void calcJobValue() | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
|  | 		jobvalue = 0; | ||||||
|  |  | ||||||
| 		for (int i = 0; i < positionenValue.size(); i++) { | 		for (int i = 0; i < positionenValue.size(); i++) { | ||||||
|  |  | ||||||
| 			jobvalue = jobvalue | 			jobvalue = jobvalue | ||||||
| @ -131,42 +132,77 @@ public class Job | |||||||
|  |  | ||||||
| 	public String createPosQuantityDBString() | 	public String createPosQuantityDBString() | ||||||
| 	{ | 	{ | ||||||
| 		String tmp = ""; | 		String tmp = String.valueOf(positionenQuantity.get(0)); | ||||||
| 		for (int i = 0; i < positionenName.size(); i++) { | 		for (int i = 1; i < positionenName.size(); i++) { | ||||||
|  |  | ||||||
| 			tmp = tmp + ";" + positionenQuantity.get(i); | 			tmp = tmp + ";" + positionenQuantity.get(i); | ||||||
| 		} | 		} | ||||||
| 		return tmp; | 		return tmp; | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| 	public String createPosNameDBString() | 	public String createPosNameDBString() | ||||||
| 	{ | 	{ | ||||||
| 		String tmp = ""; | 		String tmp = positionenName.get(0); | ||||||
| 		for (int i = 0; i < positionenName.size(); i++) { | 		for (int i = 1; i < positionenName.size(); i++) { | ||||||
|  |  | ||||||
| 			tmp = tmp + ";" + positionenName.get(i); | 			tmp = tmp + ";" + positionenName.get(i); | ||||||
| 		} | 		} | ||||||
| 		return tmp; | 		return tmp; | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| 	public String createPosValueDBString() | 	public String createPosValueDBString() | ||||||
| 	{ | 	{ | ||||||
| 		String tmp = ""; | 		String tmp = String.valueOf(positionenValue.get(0)); | ||||||
| 		for (int i = 0; i < positionenName.size(); i++) { | 		for (int i = 1; i < positionenName.size(); i++) { | ||||||
|  |  | ||||||
| 			tmp = tmp + ";" + positionenValue.get(i); | 			tmp = tmp + ";" + positionenValue.get(i); | ||||||
| 		} | 		} | ||||||
| 		return tmp; | 		return tmp; | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| 	public String createPosCatDBString() | 	public String createPosCatDBString() | ||||||
| 	{ | 	{ | ||||||
| 		String tmp = ""; | 		String tmp = positionenCat.get(0); | ||||||
| 		for (int i = 0; i < positionenName.size(); i++) { | 		for (int i = 1; i < positionenName.size(); i++) { | ||||||
|  |  | ||||||
| 			tmp = tmp + ";" + positionenCat.get(i); | 			tmp = tmp + ";" + positionenCat.get(i); | ||||||
| 		} | 		} | ||||||
| 		return tmp; | 		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; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -108,7 +108,7 @@ | |||||||
| 						</AnchorPane> | 						</AnchorPane> | ||||||
| 					</content> | 					</content> | ||||||
| 				</Tab> | 				</Tab> | ||||||
| 				<Tab text="Positionen bearbeiten"> | 				<Tab fx:id="tapPosEdit" text="Positionen bearbeiten"> | ||||||
| 					<content> | 					<content> | ||||||
| 						<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0"> | 						<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0"> | ||||||
| 							<children> | 							<children> | ||||||
| @ -153,7 +153,7 @@ | |||||||
| 														<Font name="Cantarell Regular" size="18.0" /> | 														<Font name="Cantarell Regular" size="18.0" /> | ||||||
| 													</font> | 													</font> | ||||||
| 												</Label> | 												</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> | ||||||
| 														<Font name="Cantarell Regular" size="13.0" /> | 														<Font name="Cantarell Regular" size="13.0" /> | ||||||
| 													</font> | 													</font> | ||||||
| @ -186,6 +186,9 @@ | |||||||
| 						<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="850.0" prefWidth="1536.0"> | 						<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="850.0" prefWidth="1536.0"> | ||||||
| 							<children> | 							<children> | ||||||
| 								<TreeTableView fx:id="jobsTreeTable" layoutX="11.0" layoutY="10.0" prefHeight="541.0" prefWidth="1346.0"> | 								<TreeTableView fx:id="jobsTreeTable" layoutX="11.0" layoutY="10.0" prefHeight="541.0" prefWidth="1346.0"> | ||||||
|  | 									<placeholder> | ||||||
|  | 										<Label text="" /> | ||||||
|  | 									</placeholder> | ||||||
| 									<columns> | 									<columns> | ||||||
| 										<TreeTableColumn fx:id="columnJobValue" editable="false" prefWidth="90.6666259765625" resizable="false" text="Betrag" /> | 										<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="columnState" editable="false" prefWidth="91.0" resizable="false" text="Zustand" /> | ||||||
| @ -241,10 +244,16 @@ | |||||||
| 						<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="850.0" prefWidth="1536.0"> | 						<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="850.0" prefWidth="1536.0"> | ||||||
| 							<children> | 							<children> | ||||||
| 								<TreeTableView fx:id="tableCurrentOrder" layoutX="15.0" layoutY="85.0" prefHeight="379.0" prefWidth="382.0"> | 								<TreeTableView fx:id="tableCurrentOrder" layoutX="15.0" layoutY="85.0" prefHeight="379.0" prefWidth="382.0"> | ||||||
|  | 									<placeholder> | ||||||
|  | 										<Label text="" /> | ||||||
|  | 									</placeholder> | ||||||
| 									<columns> | 									<columns> | ||||||
| 										<TreeTableColumn fx:id="columnPosition" editable="false" prefWidth="282.3333740234375" resizable="false" sortable="false" text="Position" /> | 										<TreeTableColumn fx:id="columnPosition" editable="false" prefWidth="320.0" resizable="false" sortable="false" text="Position" /> | ||||||
| 										<TreeTableColumn fx:id="columnQuantity" editable="false" prefWidth="81.66668701171875" resizable="false" sortable="false" text="Anzahl" /> | 										<TreeTableColumn fx:id="columnQuantity" editable="false" prefWidth="60.0" resizable="false" sortable="false" text="Anzahl" /> | ||||||
| 									</columns> | 									</columns> | ||||||
|  | 									<columnResizePolicy> | ||||||
|  | 										<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> | ||||||
|  | 									</columnResizePolicy> | ||||||
| 								</TreeTableView> | 								</TreeTableView> | ||||||
| 								<GridPane gridLinesVisible="true" layoutX="430.0" layoutY="15.0" prefHeight="670.0" prefWidth="920.0"> | 								<GridPane gridLinesVisible="true" layoutX="430.0" layoutY="15.0" prefHeight="670.0" prefWidth="920.0"> | ||||||
| 									<columnConstraints> | 									<columnConstraints> | ||||||
| @ -401,7 +410,7 @@ | |||||||
| 								</Button> | 								</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="505.0" prefHeight="15.0" prefWidth="386.0" text="0,00 €" textAlignment="CENTER"> | ||||||
| 									<font> | 									<font> | ||||||
| 										<Font name="Open Sans" size="70.0" /> | 										<Font name="Cantarell Regular" size="70.0" /> | ||||||
| 									</font> | 									</font> | ||||||
| 								</Label> | 								</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"> | 								<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"> | ||||||
|  | |||||||
| @ -32,6 +32,7 @@ import javafx.collections.FXCollections; | |||||||
| import javafx.collections.ObservableList; | import javafx.collections.ObservableList; | ||||||
| import javafx.event.ActionEvent; | import javafx.event.ActionEvent; | ||||||
| import javafx.scene.control.Label; | import javafx.scene.control.Label; | ||||||
|  | import javafx.scene.control.Tab; | ||||||
| import javafx.scene.layout.AnchorPane; | import javafx.scene.layout.AnchorPane; | ||||||
| import javafx.scene.layout.GridPane; | import javafx.scene.layout.GridPane; | ||||||
| import javafx.util.Pair; | import javafx.util.Pair; | ||||||
| @ -48,6 +49,9 @@ public class MainWindowController | |||||||
|  |  | ||||||
| 	@FXML | 	@FXML | ||||||
| 	private AnchorPane paneDB; | 	private AnchorPane paneDB; | ||||||
|  | 	 | ||||||
|  |    @FXML | ||||||
|  |    private Tab tapPosEdit; | ||||||
|  |  | ||||||
| 	@FXML | 	@FXML | ||||||
| 	private TreeTableView<tableDataCurrentOrder> tableCurrentOrder; | 	private TreeTableView<tableDataCurrentOrder> tableCurrentOrder; | ||||||
| @ -325,6 +329,8 @@ public class MainWindowController | |||||||
|  |  | ||||||
| 	private Job currentJob = null; | 	private Job currentJob = null; | ||||||
|  |  | ||||||
|  | 	String currentOrderPosName; | ||||||
|  |  | ||||||
| 	@FXML | 	@FXML | ||||||
| 	TreeItem<tableDataCurrentOrder> rootCurrentJob = new TreeItem<>( | 	TreeItem<tableDataCurrentOrder> rootCurrentJob = new TreeItem<>( | ||||||
| 			new tableDataCurrentOrder("0", 0)); | 			new tableDataCurrentOrder("0", 0)); | ||||||
| @ -401,14 +407,13 @@ public class MainWindowController | |||||||
| 		fillCategory(); | 		fillCategory(); | ||||||
| 		initUI(); // Starting the UI elements | 		initUI(); // Starting the UI elements | ||||||
| 		getSelectedCat(); | 		getSelectedCat(); | ||||||
|  | 		createNewJob(); | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	@FXML | 	@FXML | ||||||
| 	public void btnSaveEntryAction(ActionEvent event) | 	public void btnSaveEntryAction(ActionEvent event) | ||||||
| 	{ | 	{ | ||||||
| 		System.out.println("Speichere Eintrag!"); |  | ||||||
|  |  | ||||||
| 		dbc.setName_Positionen(idPositionen, tftNewPosition.getText()); | 		dbc.setName_Positionen(idPositionen, tftNewPosition.getText()); | ||||||
| 		dbc.setValue_Positionen(idPositionen, tftNewValue.getText()); | 		dbc.setValue_Positionen(idPositionen, tftNewValue.getText()); | ||||||
| 		dbc.setColor_Positionen(idPositionen, getColorCodes(selectedColorName)); | 		dbc.setColor_Positionen(idPositionen, getColorCodes(selectedColorName)); | ||||||
| @ -447,7 +452,7 @@ public class MainWindowController | |||||||
| 	@FXML | 	@FXML | ||||||
| 	public void btnCancelJobAction(ActionEvent event) | 	public void btnCancelJobAction(ActionEvent event) | ||||||
| 	{ | 	{ | ||||||
| 		System.out.println("Button!"); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	@FXML | 	@FXML | ||||||
| @ -468,8 +473,6 @@ public class MainWindowController | |||||||
| 	@FXML | 	@FXML | ||||||
| 	public void btnSaveCatAction(ActionEvent event) | 	public void btnSaveCatAction(ActionEvent event) | ||||||
| 	{ | 	{ | ||||||
| 		System.out.println("Cat´s speichern"); |  | ||||||
|  |  | ||||||
| 		dbc.setName_Category(1, tftKat01.getText()); | 		dbc.setName_Category(1, tftKat01.getText()); | ||||||
| 		dbc.setName_Category(2, tftKat02.getText()); | 		dbc.setName_Category(2, tftKat02.getText()); | ||||||
| 		dbc.setName_Category(3, tftKat03.getText()); | 		dbc.setName_Category(3, tftKat03.getText()); | ||||||
| @ -485,23 +488,43 @@ public class MainWindowController | |||||||
| 	@FXML | 	@FXML | ||||||
| 	public void btnDeleteSelectedPositionAction(ActionEvent event) | 	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 | 	@FXML | ||||||
| 	public void btnPrintBillAction(ActionEvent event) | 	public void btnPrintBillAction(ActionEvent event) | ||||||
| 	{ | 	{ | ||||||
| 		// System.out.println("Button!"); | 		//currentJob.printJobOnConsole(); | ||||||
|  |  | ||||||
| 		currentJob.printJobOnConsole(); |  | ||||||
|  |  | ||||||
| 		currentJob = null; |  | ||||||
|  |  | ||||||
| 		createNewJob(); |  | ||||||
|  |  | ||||||
| 		btnPrintBill.setDisable(true); | 		btnPrintBill.setDisable(true); | ||||||
|  | 		tapPosEdit.setDisable(false); | ||||||
|  | 		btnDeleteSelectedPosition.setDisable(true); | ||||||
| 		isPrintBtnDisabled = true; | 		isPrintBtnDisabled = true; | ||||||
|  |  | ||||||
|  | 		setJobPrizeLabel(0); | ||||||
|  |  | ||||||
| 		rootCurrentJob.getChildren().remove(0, | 		rootCurrentJob.getChildren().remove(0, | ||||||
| 				rootCurrentJob.getChildren().size()); | 				rootCurrentJob.getChildren().size()); | ||||||
|  |  | ||||||
| @ -512,6 +535,10 @@ public class MainWindowController | |||||||
| 				currentJob.createPosCatDBString(), "verbucht", | 				currentJob.createPosCatDBString(), "verbucht", | ||||||
| 				String.valueOf(currentJob.getJobValue())); | 				String.valueOf(currentJob.getJobValue())); | ||||||
|  |  | ||||||
|  | 		currentJob = null; | ||||||
|  |  | ||||||
|  | 		createNewJob(); | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	@FXML | 	@FXML | ||||||
| @ -693,15 +720,12 @@ public class MainWindowController | |||||||
| 		tftNewDBName.setText(getDatabaseName()); | 		tftNewDBName.setText(getDatabaseName()); | ||||||
| 		tftKat05.setDisable(true); | 		tftKat05.setDisable(true); | ||||||
| 		btnPrintBill.setDisable(true); | 		btnPrintBill.setDisable(true); | ||||||
|  | 		btnDeleteSelectedPosition.setDisable(true); | ||||||
| 		isPrintBtnDisabled = true; | 		isPrintBtnDisabled = true; | ||||||
| 		initPositionen(); | 		initPositionen(); | ||||||
| 		initCurrentOrderTreeTableView(); | 		initCurrentOrderTreeTableView(); | ||||||
| 	 |  | ||||||
| 		 |  | ||||||
| 		 | 		 | ||||||
|  |  | ||||||
| 		 |  | ||||||
| 		 |  | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @ -738,7 +762,6 @@ public class MainWindowController | |||||||
| 						selectedCatName = catChoise.getItems().get((int) new_value) | 						selectedCatName = catChoise.getItems().get((int) new_value) | ||||||
| 								.toString(); | 								.toString(); | ||||||
|  |  | ||||||
| 						// System.out.println("Ausgewählte Cat: " + selectedCatName); |  | ||||||
| 					} | 					} | ||||||
| 				}); | 				}); | ||||||
|  |  | ||||||
| @ -778,8 +801,6 @@ public class MainWindowController | |||||||
| 					{ | 					{ | ||||||
| 						selectedColorName = colorChoise.getItems() | 						selectedColorName = colorChoise.getItems() | ||||||
| 								.get((int) new_value).toString(); | 								.get((int) new_value).toString(); | ||||||
| 						// System.out.println("Ausgewählte Farbe: " + |  | ||||||
| 						// selectedColorName); |  | ||||||
| 					} | 					} | ||||||
| 				}); | 				}); | ||||||
|  |  | ||||||
| @ -808,13 +829,8 @@ public class MainWindowController | |||||||
| 						int selected = entryTreeTable.getSelectionModel() | 						int selected = entryTreeTable.getSelectionModel() | ||||||
| 								.getSelectedIndex(); // get selected item | 								.getSelectedIndex(); // get selected item | ||||||
|  |  | ||||||
| 						idPositionen = columnPosnumber.getCellData(selected); // Ausgewählte | 						idPositionen = columnPosnumber.getCellData(selected); | ||||||
| 																								// Spalte | 						try {  | ||||||
|  |  | ||||||
| 						System.out.println( |  | ||||||
| 								"Positionen - Ausgewaehlte Spalte: " + idPositionen); |  | ||||||
|  |  | ||||||
| 						try { // Setzt den Inhalt in die Textfelder |  | ||||||
|  |  | ||||||
| 							tftNewPosition | 							tftNewPosition | ||||||
| 									.setText(dbc.getName_Positionen(idPositionen)); | 									.setText(dbc.getName_Positionen(idPositionen)); | ||||||
| @ -1023,16 +1039,19 @@ public class MainWindowController | |||||||
| 	{ | 	{ | ||||||
| 		btnCalcStats.setDisable(pState); | 		btnCalcStats.setDisable(pState); | ||||||
| 		btnClearEntry.setDisable(pState); | 		btnClearEntry.setDisable(pState); | ||||||
| 		btnDeleteSelectedPosition.setDisable(pState); |  | ||||||
|  |  | ||||||
| 		if ((!isPrintBtnDisabled) && (!pState)) { | 		if ((!isPrintBtnDisabled) && (!pState)) { | ||||||
| 			// print was not disabled and will be enabled again | 			// print was not disabled and will be enabled again | ||||||
| 			btnPrintBill.setDisable(pState); | 			btnPrintBill.setDisable(pState); | ||||||
|  | 			btnDeleteSelectedPosition.setDisable(pState); | ||||||
|  | 	 | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (pState) { | 		if (pState) { | ||||||
| 			// disable allways | 			// disable allways | ||||||
| 			btnPrintBill.setDisable(pState); | 			btnPrintBill.setDisable(pState); | ||||||
|  | 			btnDeleteSelectedPosition.setDisable(pState); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		btnReprintJob.setDisable(pState); | 		btnReprintJob.setDisable(pState); | ||||||
| @ -1152,14 +1171,13 @@ public class MainWindowController | |||||||
| 	private void handelGridButtons(int pID) | 	private void handelGridButtons(int pID) | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
| 		System.out.println("Button: " + pID); |  | ||||||
|  |  | ||||||
| 		currentJob.addPosition(dbc.getName_Positionen(pID), | 		currentJob.addPosition(dbc.getName_Positionen(pID), | ||||||
| 				Float.parseFloat(dbc.getValue_Positionen(pID)), | 				Float.parseFloat(dbc.getValue_Positionen(pID)), | ||||||
| 				dbc.getCategoryNameFromPositionen(pID)); | 				dbc.getCategoryNameFromPositionen(pID)); | ||||||
|  |  | ||||||
| 		btnPrintBill.setDisable(false); | 		btnPrintBill.setDisable(false); | ||||||
| 		isPrintBtnDisabled = false; | 		isPrintBtnDisabled = false; | ||||||
|  | 		tapPosEdit.setDisable(true); | ||||||
|  |  | ||||||
| 		rootCurrentJob.getChildren().remove(0, | 		rootCurrentJob.getChildren().remove(0, | ||||||
| 				rootCurrentJob.getChildren().size()); | 				rootCurrentJob.getChildren().size()); | ||||||
| @ -1169,13 +1187,17 @@ public class MainWindowController | |||||||
| 					currentJob.getCurrentJobPositionen().get(i))); | 					currentJob.getCurrentJobPositionen().get(i))); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		setJobPrizeLabel(currentJob.getJobValue()); | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	private void initCurrentOrderTreeTableView() | 	private void initCurrentOrderTreeTableView() | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
| 		columnQuantity.setStyle("-fx-alignment: CENTER;"); | 		columnQuantity | ||||||
| 		columnPosition.setStyle("-fx-alignment: CENTER;"); | 				.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||||
|  | 		columnPosition | ||||||
|  | 				.setStyle("-fx-alignment: CENTER; -fx-font: 17px Cantarell;"); | ||||||
|  |  | ||||||
| 		tableCurrentOrder.setRoot(rootCurrentJob); | 		tableCurrentOrder.setRoot(rootCurrentJob); | ||||||
| 		tableCurrentOrder.setShowRoot(false); | 		tableCurrentOrder.setShowRoot(false); | ||||||
| @ -1197,31 +1219,9 @@ public class MainWindowController | |||||||
| 						int selected = tableCurrentOrder.getSelectionModel() | 						int selected = tableCurrentOrder.getSelectionModel() | ||||||
| 								.getSelectedIndex(); // get selected item | 								.getSelectedIndex(); // get selected item | ||||||
|  |  | ||||||
| 						// String currentOrderPosNamr = | 						if (columnPosition.getCellData(selected) != null) { | ||||||
| 						// columnPosition.getCellData(selected); // Ausgewählte | 							currentOrderPosName = columnPosition.getCellData(selected); // Ausgewählte | ||||||
| 						// Spalte | 							btnDeleteSelectedPosition.setDisable(false); | ||||||
|  |  | ||||||
| 						System.out.println( |  | ||||||
| 								"CurrentOrder - Ausgewaehlte Spalte: " + selected); |  | ||||||
|  |  | ||||||
| 						try { // Setzt den Inhalt in die Textfelder |  | ||||||
|  |  | ||||||
| 							/* |  | ||||||
| 							 *  |  | ||||||
| 							 * tftNewPosition |  | ||||||
| 							 * .setText(dbc.getName_Positionen(idPositionen)); |  | ||||||
| 							 * tftNewValue.setText(dbc.getValue_Positionen(idPositionen |  | ||||||
| 							 * )); colorChoise.getSelectionModel().select( |  | ||||||
| 							 * getColorID(dbc.getColor_Positionen(idPositionen))); |  | ||||||
| 							 *  |  | ||||||
| 							 * catChoise.getSelectionModel().select( |  | ||||||
| 							 * dbc.getCategoryNameFromPositionen(idPositionen)); |  | ||||||
| 							 *  |  | ||||||
| 							 */ |  | ||||||
|  |  | ||||||
| 						} catch (Exception e) { |  | ||||||
| 							// TODO Auto-generated catch block |  | ||||||
| 							e.printStackTrace(); |  | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 				}); | 				}); | ||||||
| @ -1236,9 +1236,21 @@ public class MainWindowController | |||||||
| 				+ String.valueOf(dbc.getLatestJobNumber_Job() + 1)); | 				+ String.valueOf(dbc.getLatestJobNumber_Job() + 1)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	private void setJobPrizeLabel(float pPrize) | ||||||
|  | 	{ | ||||||
|  |  | ||||||
|  | 		// String str = String.valueOf(pPrize); | ||||||
|  |  | ||||||
|  | 		String str = String.format("%.02f", pPrize); | ||||||
|  |  | ||||||
|  | 		str.replace('.', ','); | ||||||
|  |  | ||||||
|  | 		labelAllPrize.setText(str + "€"); | ||||||
|  |  | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	public void updateTimeLabel() | 	public void updateTimeLabel() | ||||||
| 	{ | 	{ | ||||||
| 		// System.out.println(getSystemTime()); |  | ||||||
| 		labelTime.setText("Uhrzeit: " + getSystemTime()); | 		labelTime.setText("Uhrzeit: " + getSystemTime()); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user