Configure auto Print or manual Print
This commit is contained in:
@ -340,6 +340,9 @@ public class MainWindowController {
|
||||
@FXML
|
||||
private CheckBox switchSeparate;
|
||||
|
||||
@FXML
|
||||
private CheckBox switchAutoPrint;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private Main main;
|
||||
|
||||
@ -510,6 +513,7 @@ public class MainWindowController {
|
||||
xmlc.setHeader(tftheader.getText());
|
||||
xmlc.setFooter(tftfooter.getText());
|
||||
xmlc.setCategorySplitted(switchSeparate.isSelected());
|
||||
xmlc.setAutoPrintBill(switchAutoPrint.isSelected());
|
||||
|
||||
try {
|
||||
xmlc.saveSettings();
|
||||
@ -519,6 +523,7 @@ public class MainWindowController {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
fillPrinterSettings();
|
||||
updatePrintButtonLabel();
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -597,7 +602,10 @@ public class MainWindowController {
|
||||
currentJob.createPosNameDBString(), currentJob.createPosValueDBString(),
|
||||
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();
|
||||
|
||||
@ -862,6 +870,19 @@ public class MainWindowController {
|
||||
|
||||
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() {
|
||||
|
||||
@ -24,6 +24,8 @@ public class XMLController {
|
||||
|
||||
private boolean categorySplitted;
|
||||
|
||||
private boolean autoPrintBill;
|
||||
|
||||
private String filePath = null;
|
||||
|
||||
private Properties props = null;
|
||||
@ -52,6 +54,15 @@ public class XMLController {
|
||||
categorySplitted = "false";
|
||||
}
|
||||
|
||||
String autoPrintBill = null;
|
||||
|
||||
if (this.autoPrintBill) {
|
||||
autoPrintBill = "true";
|
||||
}
|
||||
else {
|
||||
autoPrintBill = "false";
|
||||
}
|
||||
|
||||
try {
|
||||
props.setProperty("databasename", this.databaseName);
|
||||
props.setProperty("printername", this.printername);
|
||||
@ -61,6 +72,7 @@ public class XMLController {
|
||||
props.setProperty("header", this.header);
|
||||
props.setProperty("footer", this.footer);
|
||||
props.setProperty("categorySplitted", categorySplitted);
|
||||
props.setProperty("autoPrintBill", autoPrintBill);
|
||||
|
||||
outputStream = new FileOutputStream(filePath);
|
||||
props.storeToXML(outputStream, "jFxKasse settings");
|
||||
@ -114,6 +126,18 @@ public class XMLController {
|
||||
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();
|
||||
return true;
|
||||
}
|
||||
@ -133,6 +157,8 @@ public class XMLController {
|
||||
|
||||
this.categorySplitted = false;
|
||||
|
||||
this.autoPrintBill = false;
|
||||
|
||||
this.header = "XYZ GmbH";
|
||||
this.footer = "Vielen Dank für den Einkauf";
|
||||
}
|
||||
@ -201,4 +227,12 @@ public class XMLController {
|
||||
this.categorySplitted = categorySplitted;
|
||||
}
|
||||
|
||||
public boolean getAutoPrintBill() {
|
||||
return autoPrintBill;
|
||||
}
|
||||
|
||||
public void setAutoPrintBill(boolean autoPrintBill) {
|
||||
this.autoPrintBill = autoPrintBill;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -155,6 +155,11 @@
|
||||
<Font name="Cantarell Regular" size="18.0"/>
|
||||
</font>
|
||||
</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:">
|
||||
<font>
|
||||
<Font name="Cantarell Regular" size="18.0"/>
|
||||
|
||||
Reference in New Issue
Block a user