Configure auto Print or manual Print

This commit is contained in:
2026-03-01 18:52:19 +01:00
parent f3e0da2689
commit c241964a8b
3 changed files with 61 additions and 1 deletions

View File

@ -340,6 +340,9 @@ public class MainWindowController {
@FXML @FXML
private CheckBox switchSeparate; private CheckBox switchSeparate;
@FXML
private CheckBox switchAutoPrint;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private Main main; private Main main;
@ -510,6 +513,7 @@ public class MainWindowController {
xmlc.setHeader(tftheader.getText()); xmlc.setHeader(tftheader.getText());
xmlc.setFooter(tftfooter.getText()); xmlc.setFooter(tftfooter.getText());
xmlc.setCategorySplitted(switchSeparate.isSelected()); xmlc.setCategorySplitted(switchSeparate.isSelected());
xmlc.setAutoPrintBill(switchAutoPrint.isSelected());
try { try {
xmlc.saveSettings(); xmlc.saveSettings();
@ -519,6 +523,7 @@ public class MainWindowController {
// e.printStackTrace(); // e.printStackTrace();
} }
fillPrinterSettings(); fillPrinterSettings();
updatePrintButtonLabel();
} }
@FXML @FXML
@ -597,7 +602,10 @@ public class MainWindowController {
currentJob.createPosNameDBString(), currentJob.createPosValueDBString(), currentJob.createPosNameDBString(), currentJob.createPosValueDBString(),
currentJob.createPosCatDBString(), "verbucht", String.valueOf(currentJob.getJobValue())); currentJob.createPosCatDBString(), "verbucht", String.valueOf(currentJob.getJobValue()));
pj.printJob(currentJob.getJobnumber(), xmlc, dbc, pc); // Print immediately if autoPrintBill is enabled
if (xmlc.getAutoPrintBill()) {
pj.printJob(currentJob.getJobnumber(), xmlc, dbc, pc);
}
fillTableJobs(); fillTableJobs();
@ -862,6 +870,19 @@ public class MainWindowController {
switchSeparate.setSelected(xmlc.getCategorySplitted()); switchSeparate.setSelected(xmlc.getCategorySplitted());
switchAutoPrint.setSelected(xmlc.getAutoPrintBill());
updatePrintButtonLabel();
}
private void updatePrintButtonLabel() {
if (xmlc.getAutoPrintBill()) {
btnPrintBill.setText("Drucken");
}
else {
btnPrintBill.setText("Bestellen");
}
} }
public void fillCategory() { public void fillCategory() {

View File

@ -24,6 +24,8 @@ public class XMLController {
private boolean categorySplitted; private boolean categorySplitted;
private boolean autoPrintBill;
private String filePath = null; private String filePath = null;
private Properties props = null; private Properties props = null;
@ -52,6 +54,15 @@ public class XMLController {
categorySplitted = "false"; categorySplitted = "false";
} }
String autoPrintBill = null;
if (this.autoPrintBill) {
autoPrintBill = "true";
}
else {
autoPrintBill = "false";
}
try { try {
props.setProperty("databasename", this.databaseName); props.setProperty("databasename", this.databaseName);
props.setProperty("printername", this.printername); props.setProperty("printername", this.printername);
@ -61,6 +72,7 @@ public class XMLController {
props.setProperty("header", this.header); props.setProperty("header", this.header);
props.setProperty("footer", this.footer); props.setProperty("footer", this.footer);
props.setProperty("categorySplitted", categorySplitted); props.setProperty("categorySplitted", categorySplitted);
props.setProperty("autoPrintBill", autoPrintBill);
outputStream = new FileOutputStream(filePath); outputStream = new FileOutputStream(filePath);
props.storeToXML(outputStream, "jFxKasse settings"); props.storeToXML(outputStream, "jFxKasse settings");
@ -114,6 +126,18 @@ public class XMLController {
this.categorySplitted = false; this.categorySplitted = false;
} }
try {
if (props.getProperty("autoPrintBill").equals("true")) {
this.autoPrintBill = true;
}
else {
this.autoPrintBill = false;
}
}
catch (Exception e) {
this.autoPrintBill = false;
}
inputStream.close(); inputStream.close();
return true; return true;
} }
@ -133,6 +157,8 @@ public class XMLController {
this.categorySplitted = false; this.categorySplitted = false;
this.autoPrintBill = false;
this.header = "XYZ GmbH"; this.header = "XYZ GmbH";
this.footer = "Vielen Dank für den Einkauf"; this.footer = "Vielen Dank für den Einkauf";
} }
@ -201,4 +227,12 @@ public class XMLController {
this.categorySplitted = categorySplitted; this.categorySplitted = categorySplitted;
} }
public boolean getAutoPrintBill() {
return autoPrintBill;
}
public void setAutoPrintBill(boolean autoPrintBill) {
this.autoPrintBill = autoPrintBill;
}
} }

View File

@ -155,6 +155,11 @@
<Font name="Cantarell Regular" size="18.0"/> <Font name="Cantarell Regular" size="18.0"/>
</font> </font>
</CheckBox> </CheckBox>
<CheckBox fx:id="switchAutoPrint" layoutX="270.0" layoutY="200.0" text="Bon direkt drucken">
<font>
<Font name="Cantarell Regular" size="18.0"/>
</font>
</CheckBox>
<Label alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="450.0" layoutY="10.0" prefHeight="34.0" prefWidth="107.0" text="Drucker:"> <Label alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="450.0" layoutY="10.0" prefHeight="34.0" prefWidth="107.0" text="Drucker:">
<font> <font>
<Font name="Cantarell Regular" size="18.0"/> <Font name="Cantarell Regular" size="18.0"/>