Compare commits
15 Commits
Kaeseschor
...
master
Author | SHA1 | Date |
---|---|---|
|
c4297a4be2 | 4 years ago |
|
fd52d3df6d | 4 years ago |
|
c320ef615d | 4 years ago |
|
2a20ea7bdb | 4 years ago |
|
a56ad43852 | 4 years ago |
|
188214dfbe | 4 years ago |
|
cdbe2cccc0 | 4 years ago |
|
5152846478 | 4 years ago |
|
f5c5d546c5 | 4 years ago |
|
5c9d54dabf | 4 years ago |
|
96d5968fef | 4 years ago |
|
88b39820ca | 4 years ago |
|
25bedae873 | 4 years ago |
|
1ec02d74a3 | 4 years ago |
|
783d9f9bc0 | 4 years ago |
20 changed files with 709 additions and 149 deletions
@ -1,2 +1,38 @@
|
||||
# jFxKasse |
||||
easy payment system for small to middel sized events with a sales slip printer |
||||
|
||||
Simples Kassensystem für kleine bis mittlere Veranstaltungen mit Bon-Drucker |
||||
|
||||
## Video Tutorials (German | Deutsch) |
||||
[YouTube Video: jFxKasse - Kassensystem - Kurzanleitung](https://www.youtube.com/watch?v=DV9DDESw40I) |
||||
|
||||
[YouTube Video: jFxKasse - Kassensystem - Installieren](https://www.youtube.com/watch?v=IY1bqRjwh0Q) |
||||
|
||||
## Screenshots |
||||
|
||||
### Main View | Hauptansicht |
||||
 |
||||
|
||||
### Jobs | Auftäge |
||||
 |
||||
|
||||
### Positions | Positionen |
||||
 |
||||
|
||||
### Settings | Einstellungen |
||||
 |
||||
|
||||
|
||||
## Requirements | Anforderungen |
||||
|
||||
### Software |
||||
|
||||
* Java JRE 11 |
||||
* Display/Bildschirm > 1366px X 768px |
||||
* Windoofs, Mac, GNU/Linux (openSuse tested) |
||||
|
||||
### Hardware |
||||
|
||||
I used this printer: [Epson TM T20II](https://www.epson.de/products/sd/pos-printer/epson-tm-t20ii) |
||||
|
||||
Other sales slip printer are possible. |
After Width: | Height: | Size: 123 KiB |
After Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 83 KiB |
@ -0,0 +1,227 @@
|
||||
package com.jFxKasse.controller; |
||||
|
||||
import javafx.event.EventHandler; |
||||
import javafx.scene.Scene; |
||||
import javafx.scene.input.KeyCode; |
||||
import javafx.scene.input.KeyEvent; |
||||
|
||||
public class KeyController |
||||
{ |
||||
private MainWindowController mwc; |
||||
|
||||
public KeyController(Scene scene, MainWindowController mwc) |
||||
{ |
||||
this.mwc = mwc; |
||||
|
||||
scene.setOnKeyPressed(new EventHandler<KeyEvent>() { |
||||
@Override |
||||
public void handle(KeyEvent keyEvent) |
||||
{ |
||||
switch (mwc.getActiveTab()) { |
||||
case 0: |
||||
handleTabNewJob(keyEvent); |
||||
break; |
||||
|
||||
case 1: |
||||
handleTabJobs(keyEvent); |
||||
break; |
||||
|
||||
case 2: |
||||
handleTabPosEdit(keyEvent); |
||||
break; |
||||
|
||||
case 3: |
||||
handleTabSettings(keyEvent); |
||||
break; |
||||
default: |
||||
|
||||
} |
||||
|
||||
} |
||||
}); |
||||
|
||||
} |
||||
|
||||
private void handleTabNewJob(KeyEvent key) |
||||
{ |
||||
if ((key.getCode() == KeyCode.ENTER) |
||||
&& (!mwc.btnPrintBill.isDisabled())) { |
||||
mwc.btnPrintBillAction(null); |
||||
} |
||||
|
||||
if ((key.getCode() == KeyCode.ESCAPE) && (!mwc.btnLock.isDisabled())) { |
||||
mwc.btnLockAction(null); |
||||
} |
||||
|
||||
if ((key.getCode() == KeyCode.DELETE) |
||||
&& (!mwc.btnDeleteSelectedPosition.isDisabled())) { |
||||
mwc.btnDeleteSelectedPositionAction(null); |
||||
} |
||||
|
||||
handelGridButtons(key); |
||||
|
||||
} |
||||
|
||||
private void handleTabJobs(KeyEvent key) |
||||
{ |
||||
if ((key.getCode() == KeyCode.ENTER) |
||||
&& (!mwc.btnReprintJob.isDisabled())) { |
||||
mwc.btnReprintJobAction(null); |
||||
} |
||||
|
||||
if ((key.getCode() == KeyCode.DELETE) |
||||
&& (!mwc.btnCancelJob.isDisabled())) { |
||||
mwc.btnCancelJobAction(null); |
||||
} |
||||
|
||||
if ((key.getCode() == KeyCode.S) && (!mwc.btnCalcStats.isDisabled())) { |
||||
mwc.btnCalcStatsAction(null); |
||||
} |
||||
} |
||||
|
||||
private void handleTabPosEdit(KeyEvent key) |
||||
{ |
||||
if ((key.getCode() == KeyCode.ENTER) |
||||
&& (!mwc.btnSaveEntry.isDisabled())) { |
||||
mwc.btnSaveEntryAction(null); |
||||
} |
||||
|
||||
if ((key.getCode() == KeyCode.DELETE) |
||||
&& (!mwc.btnClearEntry.isDisabled())) { |
||||
mwc.btnClearEntryAction(null); |
||||
} |
||||
} |
||||
|
||||
private void handleTabSettings(KeyEvent key) |
||||
{ |
||||
if ((key.getCode() == KeyCode.ENTER) |
||||
&& (!mwc.btnSavePrinter.isDisabled())) { |
||||
mwc.btnSavePrinterAction(null); |
||||
} |
||||
|
||||
if ((key.getCode() == KeyCode.ENTER) && (!mwc.btnSaveCat.isDisabled())) { |
||||
mwc.btnSaveCatAction(null); |
||||
} |
||||
|
||||
if ((key.getCode() == KeyCode.ENTER) |
||||
&& (!mwc.btnCreateNewDatabase.isDisabled())) { |
||||
try { |
||||
mwc.btnCreateNewDatabaseAction(null); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void handelGridButtons(KeyEvent key) |
||||
{ |
||||
|
||||
switch (key.getCode()) { |
||||
case Q: |
||||
mwc.gridButton01Action(null); |
||||
break; |
||||
|
||||
case W: |
||||
mwc.gridButton02Action(null); |
||||
break; |
||||
|
||||
case E: |
||||
mwc.gridButton03Action(null); |
||||
break; |
||||
|
||||
case R: |
||||
mwc.gridButton04Action(null); |
||||
break; |
||||
|
||||
case T: |
||||
mwc.gridButton05Action(null); |
||||
break; |
||||
|
||||
case Z: |
||||
mwc.gridButton06Action(null); |
||||
break; |
||||
|
||||
case U: |
||||
mwc.gridButton07Action(null); |
||||
break; |
||||
|
||||
case I: |
||||
mwc.gridButton08Action(null); |
||||
break; |
||||
|
||||
case O: |
||||
mwc.gridButton09Action(null); |
||||
break; |
||||
|
||||
case P: |
||||
mwc.gridButton10Action(null); |
||||
break; |
||||
|
||||
case A: |
||||
mwc.gridButton11Action(null); |
||||
break; |
||||
|
||||
case S: |
||||
mwc.gridButton12Action(null); |
||||
break; |
||||
|
||||
case D: |
||||
mwc.gridButton13Action(null); |
||||
break; |
||||
|
||||
case F: |
||||
mwc.gridButton14Action(null); |
||||
break; |
||||
|
||||
case G: |
||||
mwc.gridButton15Action(null); |
||||
break; |
||||
|
||||
case H: |
||||
mwc.gridButton16Action(null); |
||||
break; |
||||
|
||||
case J: |
||||
mwc.gridButton17Action(null); |
||||
break; |
||||
|
||||
case K: |
||||
mwc.gridButton18Action(null); |
||||
break; |
||||
|
||||
case L: |
||||
mwc.gridButton19Action(null); |
||||
break; |
||||
|
||||
case Y: |
||||
mwc.gridButton20Action(null); |
||||
break; |
||||
|
||||
case X: |
||||
mwc.gridButton21Action(null); |
||||
break; |
||||
|
||||
case C: |
||||
mwc.gridButton22Action(null); |
||||
break; |
||||
|
||||
case V: |
||||
mwc.gridButton23Action(null); |
||||
break; |
||||
|
||||
case B: |
||||
mwc.gridButton24Action(null); |
||||
break; |
||||
|
||||
case N: |
||||
mwc.gridButton25Action(null); |
||||
break; |
||||
|
||||
default: |
||||
break; |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.jFxKasse.datatypes; |
||||
|
||||
public class Category |
||||
{ |
||||
private String categoryName; |
||||
|
||||
private String positionsString = "\n"; |
||||
|
||||
public Category(String categoryName) |
||||
{ |
||||
this.categoryName = categoryName; |
||||
} |
||||
|
||||
public String getCategoryName() |
||||
{ |
||||
return categoryName; |
||||
} |
||||
|
||||
public void addPosition(int quantity, String name, String value, |
||||
PrintData pd) |
||||
{ |
||||
for (int i = 0; i < quantity; i++) { |
||||
positionsString = positionsString |
||||
+ pd.setRight(pd.breakLines(name), value + " €") + "\n"; |
||||
} |
||||
} |
||||
|
||||
public String getPositionsString() |
||||
{ |
||||
return positionsString; |
||||
} |
||||
} |
@ -0,0 +1,169 @@
|
||||
package com.jFxKasse.datatypes; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
public class PrintDataSplitted extends PrintData |
||||
{ |
||||
private ArrayList<String> printString = new ArrayList<String>(); |
||||
|
||||
private ArrayList<Category> categories = new ArrayList<Category>(); |
||||
|
||||
private int categoryCount = 0; |
||||
|
||||
/** |
||||
* Constructor with all data that is not in the DB |
||||
* @param lineBreak |
||||
* @param headerSpace |
||||
* @param footerSpace |
||||
* @param timeAndDatePrint |
||||
* @param header |
||||
* @param footer |
||||
*/ |
||||
public PrintDataSplitted(int lineBreak, int headerSpace, int footerSpace, |
||||
String timeAndDatePrint, String header, String footer) |
||||
{ |
||||
super(lineBreak, headerSpace, footerSpace, timeAndDatePrint, header, |
||||
footer); |
||||
} |
||||
|
||||
/** |
||||
* Generates the String |
||||
* @return the final Array with the Print Strings |
||||
*/ |
||||
public ArrayList<String> getPrintStrings() |
||||
{ |
||||
generatePrintString(); |
||||
return printString; |
||||
} |
||||
|
||||
@Override |
||||
protected void generatePrintString() |
||||
{ |
||||
|
||||
String firstBill; |
||||
|
||||
/* Header */ |
||||
String header = "-"; |
||||
for (int i = 1; i < headerSpace; i++) { |
||||
header = header + "\n"; |
||||
} |
||||
|
||||
// This is the final header
|
||||
header = header + setCenter(this.header); |
||||
|
||||
/* Info */ |
||||
|
||||
String info = setRight("Bestellung: ", timeAndDateOrder) + "\n" |
||||
+ setRight("Druck: ", timeAndDatePrint) + "\n" |
||||
+ setRight("Bestellnummer: ", jobID); |
||||
|
||||
/* Splitted Bills */ |
||||
|
||||
/* Price */ |
||||
|
||||
String price = setRight("Gesamt: ", (jobValue + " €")); |
||||
|
||||
/* Footer */ |
||||
|
||||
String footer = setCenter(this.footer); |
||||
|
||||
for (int i = 1; i < footerSpace; i++) { |
||||
footer = footer + "\n"; |
||||
} |
||||
footer = footer + "_"; |
||||
|
||||
/* Build first Print String */ |
||||
|
||||
firstBill = header + "\n" + getSeparator() + "\n" + info + "\n" |
||||
+ getSeparator() + "\n" + setCenter("Bon wurde aufgeteilt") + "\n" |
||||
+ getSeparator() + "\n" + price + "\n" + getSeparator() + "\n" |
||||
+ footer; |
||||
|
||||
printString.add(firstBill); |
||||
|
||||
/* first bill ends here */ |
||||
|
||||
/* Categories in extra bills */ |
||||
|
||||
String positions = null; |
||||
|
||||
int posCount = positionsQuantity.length() |
||||
- positionsQuantity.replace(";", "").length() + 1; |
||||
|
||||
String[] positionQuantity = positionsQuantity.split(";"); |
||||
String[] positionName = positionsName.split(";"); |
||||
String[] positionValue = positionsValue.split(";"); |
||||
String[] positionCategory = positionsCategory.split(";"); |
||||
|
||||
for (int i = 0; i < posCount; i++) { // All different posNames
|
||||
int quantity = Integer.parseInt(positionQuantity[i]); |
||||
insertToCategory(quantity, positionName[i], positionValue[i], |
||||
positionCategory[i]); |
||||
} |
||||
|
||||
// loops through all categories
|
||||
for (int i = 0; i < categories.size(); i++) { |
||||
|
||||
String thisBill; |
||||
|
||||
/* Header */ |
||||
header = " "; |
||||
for (int o = 1; o < headerSpace; o++) { |
||||
header = header + "\n"; |
||||
} |
||||
|
||||
// This is the final header
|
||||
header = header + setCenter(this.header); |
||||
|
||||
/* Info */ |
||||
|
||||
info = setRight("Bestellung: ", timeAndDateOrder) + "\n" |
||||
+ setRight("Druck: ", timeAndDatePrint) + "\n" |
||||
+ setRight("Bestellnummer: ", jobID); |
||||
|
||||
/* Positions */ |
||||
|
||||
positions = categories.get(i).getPositionsString(); |
||||
|
||||
/* Footer */ |
||||
|
||||
footer = "\n"; |
||||
|
||||
for (int o = 2; o < footerSpace; o++) { |
||||
footer = footer + "\n"; |
||||
} |
||||
footer = footer + "_"; |
||||
|
||||
thisBill = header + "\n" + getSeparator() + "\n" + info + "\n" |
||||
+ getSeparator() + "\n" |
||||
+ setCenter(categories.get(i).getCategoryName()) + "\n" |
||||
+ getSeparator() + positions + "\n" + getSeparator() + "\n" |
||||
+ footer; |
||||
|
||||
printString.add(thisBill); |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
private void insertToCategory(int quantity, String name, String value, |
||||
String category) |
||||
{ |
||||
boolean createNewCategorie = true; |
||||
for (int i = 0; i < categoryCount; i++) { |
||||
if (category.equals(categories.get(i).getCategoryName())) { |
||||
categories.get(i).addPosition(quantity, name, value, this); |
||||
createNewCategorie = false; |
||||
} |
||||
} |
||||
|
||||
if (createNewCategorie) { |
||||
// position has a new category
|
||||
categories.add(new Category(category)); |
||||
categories.get(categoryCount).addPosition(quantity, name, value, this); |
||||
categoryCount++; |
||||
} |
||||
|
||||
} |
||||
|
||||
} |