diff --git a/build/BudgetMaster.exe b/build/BudgetMaster.exe index fb7db919eb7a0748bb8e951a1f063a0cce2e6635..12e350ea3f7f3ae44248587d295ba3436175db09 100644 Binary files a/build/BudgetMaster.exe and b/build/BudgetMaster.exe differ diff --git a/build/BudgetMasterClient.jar b/build/BudgetMasterClient.jar index f389bc9c30fed034c82c2fab6bf1ec7f3be75758..0aab6a2d7bb684ca672674cafc7c5effc3480c06 100644 Binary files a/build/BudgetMasterClient.jar and b/build/BudgetMasterClient.jar differ diff --git a/build/BudgetMasterServer.jar b/build/BudgetMasterServer.jar index 73ae6603501f348f03888b3a177074cbbaace775..0c26a7ec50ad0a4f977d30c450f14c3670d662e5 100644 Binary files a/build/BudgetMasterServer.jar and b/build/BudgetMasterServer.jar differ diff --git a/src/de/deadlocker8/budgetmaster/logic/charts/CategoriesChart.java b/src/de/deadlocker8/budgetmaster/logic/charts/CategoriesChart.java index 54a0395707ce4380038d2dc3c0976c561e3ae2cf..cfa703a4f42eacf09512d4c2105032e5f1df27c1 100644 --- a/src/de/deadlocker8/budgetmaster/logic/charts/CategoriesChart.java +++ b/src/de/deadlocker8/budgetmaster/logic/charts/CategoriesChart.java @@ -33,8 +33,9 @@ public class CategoriesChart extends VBox implements ChartExportable private String currency; private double totalIncomes; private double totalPayments; - private LegendType legendType; - + private LegendType legendType; + private final double CHART_HEIGHT = 200; + private final double FULL_LEGEND_ITEM_HEIGHT = 40; public CategoriesChart(String titleIncomes, String titlePayments, ArrayList<CategoryInOutSum> categoryInOutSums, String currency, LegendType legendType) { @@ -302,8 +303,22 @@ public class CategoriesChart extends VBox implements ChartExportable @Override public WritableImage export(int width, int height) { - VBox root = prepareExportChart(); - + VBox root = new VBox(); + + root.setStyle("-fx-background-color: transparent;"); + root.setPadding(new Insets(25)); + root.setSpacing(10); + + root.getChildren().add(generate(titleIncomes, true)); + root.getChildren().add(generate(titlePayments, false)); + + Region spacer = new Region(); + spacer.setMinHeight(25); + root.getChildren().add(spacer); + VBox.setVgrow(spacer, Priority.ALWAYS); + + root.getChildren().add(generateFullLegend()); + Stage newStage = new Stage(); newStage.initModality(Modality.NONE); newStage.setScene(new Scene(root, width, height)); @@ -326,6 +341,6 @@ public class CategoriesChart extends VBox implements ChartExportable @Override public double getSuggestedHeight() { - return prepareExportChart().getHeight() + 50; + return CHART_HEIGHT + categoryInOutSums.size() * FULL_LEGEND_ITEM_HEIGHT + 50; } } \ No newline at end of file diff --git a/src/de/deadlocker8/budgetmaster/logic/report/ColumnType.java b/src/de/deadlocker8/budgetmaster/logic/report/ColumnType.java index 9229d6f51fc3612ba28b8638fb02454c5408a25e..ae75218090dacfe9d623340e2ba297033eed5bcd 100644 --- a/src/de/deadlocker8/budgetmaster/logic/report/ColumnType.java +++ b/src/de/deadlocker8/budgetmaster/logic/report/ColumnType.java @@ -5,24 +5,31 @@ import tools.Localization; public enum ColumnType { - POSITION(Strings.REPORT_POSITION), - DATE(Strings.REPORT_DATE), - REPEATING(Strings.REPORT_REPEATING), - CATEGORY(Strings.REPORT_CATEGORY), - NAME(Strings.REPORT_NAME), - DESCRIPTION(Strings.REPORT_DESCRIPTION), - RATING(Strings.REPORT_RATING), - AMOUNT(Strings.REPORT_AMOUNT); + POSITION(Strings.REPORT_POSITION, 1), + DATE(Strings.REPORT_DATE, 2), + REPEATING(Strings.REPORT_REPEATING, 1), + CATEGORY(Strings.REPORT_CATEGORY, 3), + NAME(Strings.REPORT_NAME, 3), + DESCRIPTION(Strings.REPORT_DESCRIPTION, 3), + RATING((Strings.REPORT_RATING, 1), + AMOUNT(Strings.REPORT_AMOUNT, 2); private String name; + private float proportion; - private ColumnType(String name) + private ColumnType(String name, float proportion) { this.name = name; + this.proportion = proportion; } public String getName() { return Localization.getString(name); } + + public float getProportion() + { + return proportion; + } } \ No newline at end of file diff --git a/src/de/deadlocker8/budgetmaster/logic/report/ReportGenerator.java b/src/de/deadlocker8/budgetmaster/logic/report/ReportGenerator.java index 58de7364c582bc4a19256feb393a7d23b5fb17fc..a3bf8ba21242f0c8d10e3959518dc61fa43c73d6 100644 --- a/src/de/deadlocker8/budgetmaster/logic/report/ReportGenerator.java +++ b/src/de/deadlocker8/budgetmaster/logic/report/ReportGenerator.java @@ -24,6 +24,7 @@ import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; +import de.deadlocker8.budgetmaster.logic.Budget; import de.deadlocker8.budgetmaster.logic.CategoryBudget; import de.deadlocker8.budgetmaster.logic.utils.Helpers; import de.deadlocker8.budgetmaster.logic.utils.Strings; @@ -34,33 +35,35 @@ public class ReportGenerator private ArrayList<ReportItem> reportItems; private ArrayList<CategoryBudget> categoryBudgets; private ColumnOrder columnOrder; + private boolean includeBudget; private boolean splitTable; private boolean includeCategoryBudgets; private File savePath; private String currency; private DateTime date; + private Budget budget; - public ReportGenerator(ArrayList<ReportItem> reportItems, ArrayList<CategoryBudget> categoryBudgets, ColumnOrder columnOrder, boolean splitTable, boolean includeCategoryBudgets, File savePath, String currency, DateTime date) + public ReportGenerator(ArrayList<ReportItem> reportItems, ArrayList<CategoryBudget> categoryBudgets, ColumnOrder columnOrder, boolean includeBudget, boolean splitTable, boolean includeCategoryBudgets, File savePath, String currency, DateTime date, Budget budget) { this.reportItems = reportItems; this.categoryBudgets = categoryBudgets; this.columnOrder = columnOrder; + this.includeBudget = includeBudget; this.splitTable = splitTable; this.includeCategoryBudgets = includeCategoryBudgets; this.savePath = savePath; this.currency = currency; this.date = date; + this.budget = budget; } private Chapter generateHeader() { - Font chapterFont = new Font(FontFamily.HELVETICA, 16, Font.BOLDITALIC); - Font paragraphFont = new Font(FontFamily.HELVETICA, 12, Font.NORMAL); + Font chapterFont = new Font(FontFamily.HELVETICA, 16, Font.BOLDITALIC); Chunk chunk = new Chunk(Localization.getString(Strings.REPORT_HEADLINE, date.toString("MMMM yyyy")), chapterFont); Chapter chapter = new Chapter(new Paragraph(chunk), 1); chapter.setNumberDepth(0); chapter.add(Chunk.NEWLINE); - chapter.add(new Paragraph(Localization.getString(Strings.REPORT_HEADLINE_PAYMENTS_OVERVIEW), paragraphFont)); return chapter; } @@ -72,7 +75,13 @@ public class ReportGenerator if(numberOfColumns > 0) { - PdfPTable table = new PdfPTable(numberOfColumns); + float[] proportions = new float[numberOfColumns]; + for(int i = 0; i < columnOrder.getColumns().size(); i++) + { + proportions[i] = columnOrder.getColumns().get(i).getProportion(); + } + + PdfPTable table = new PdfPTable(proportions); table.setWidthPercentage(tableWidth); Font font = new Font(FontFamily.HELVETICA, 8, Font.NORMAL, GrayColor.BLACK); @@ -149,15 +158,34 @@ public class ReportGenerator writer.setPageEvent(new HeaderFooterPageEvent()); document.open(); document.setMargins(50, 45, 50, 70); + Font headerFont = new Font(FontFamily.HELVETICA, 14, Font.BOLD); + Font smallHeaderFont = new Font(FontFamily.HELVETICA, 12, Font.BOLD); Font paragraphFont = new Font(FontFamily.HELVETICA, 12, Font.NORMAL); document.add(generateHeader()); document.add(Chunk.NEWLINE); + + if(includeBudget) + { + Font fontGreen = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, new BaseColor(36, 122, 45)); + Font fontRed = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, BaseColor.RED); + Font fontBlack = new Font(FontFamily.HELVETICA, 12, Font.BOLD); + document.add(new Paragraph("Budget", headerFont)); + document.add(Chunk.NEWLINE); + document.add(new Paragraph("Einnahmen: " + Helpers.getCurrencyString(budget.getIncomeSum(), currency), fontGreen)); + document.add(new Paragraph("Ausgaben: " + Helpers.getCurrencyString(budget.getPaymentSum(), currency), fontRed)); + document.add(new Paragraph("Restbudget: " + Helpers.getCurrencyString(budget.getIncomeSum()-budget.getPaymentSum(), currency), fontBlack)); + document.add(Chunk.NEWLINE); + } + + document.add(new Paragraph(Localization.getString(Strings.REPORT_HEADLINE_PAYMENTS_OVERVIEW), headerFont)); + document.add(Chunk.NEWLINE); if(splitTable) { - document.add(new Paragraph(Localization.getString(Strings.TITLE_INCOMES), paragraphFont)); + document.add(new Paragraph(Localization.getString(Strings.TITLE_INCOMES), smallHeaderFont)); document.add(Chunk.NEWLINE); + PdfPTable table = generateTable(100, AmountType.INCOME); if(table != null) { @@ -165,8 +193,9 @@ public class ReportGenerator } document.add(Chunk.NEWLINE); - document.add(new Paragraph(Localization.getString(Strings.TITLE_PAYMENTS), paragraphFont)); + document.add(new Paragraph(Localization.getString(Strings.TITLE_PAYMENTS), smallHeaderFont)); document.add(Chunk.NEWLINE); + table = generateTable(100, AmountType.PAYMENT); if(table != null) { @@ -185,8 +214,9 @@ public class ReportGenerator if(includeCategoryBudgets) { document.add(Chunk.NEWLINE); - document.add(new Paragraph(Localization.getString(Strings.TITLE_CATEGORY_BUDGETS), paragraphFont)); + document.add(new Paragraph(Localization.getString(Strings.TITLE_CATEGORY_BUDGETS), headerFont)); document.add(Chunk.NEWLINE); + PdfPTable table = generateCategoryBudgets(); if(table != null) { diff --git a/src/de/deadlocker8/budgetmaster/main/_de.properties b/src/de/deadlocker8/budgetmaster/main/_de.properties index 86ba0e9cc0ff970709ca07b5b70d5a2313f9f2d2..060e0c53bdc3304d23d11305df51ad24654b908a 100644 --- a/src/de/deadlocker8/budgetmaster/main/_de.properties +++ b/src/de/deadlocker8/budgetmaster/main/_de.properties @@ -1,8 +1,8 @@ # DEFAULT app.name=BudgetMaster -version.code=4 -version.name=1.3.0 -version.date=10.08.17 +version.code=5 +version.name=1.3.1 +version.date=12.08.17 author=Robert Goldmann folder=Deadlocker/BudgetMaster @@ -43,7 +43,7 @@ report.repeating=Wiederholend report.category=Kategorie report.name=Name report.description=Notiz -report.rating=Bewertung +report.rating=+/- report.amount=Betrag report.headline=Monatsbericht - {0} report.headline.payments.overview=Buchungs�bersicht diff --git a/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java b/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java index ffd4724cc4bcd4ab63db6c9b40ffcf2a68a682f0..b0453fa6aad4f699669a2cbbec7adaa9bd8fdd8c 100644 --- a/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java +++ b/src/de/deadlocker8/budgetmaster/ui/controller/ReportController.java @@ -11,6 +11,7 @@ import java.util.Optional; import org.joda.time.DateTime; +import de.deadlocker8.budgetmaster.logic.Budget; import de.deadlocker8.budgetmaster.logic.FilterSettings; import de.deadlocker8.budgetmaster.logic.Payment; import de.deadlocker8.budgetmaster.logic.RepeatingPaymentEntry; @@ -64,6 +65,7 @@ public class ReportController implements Refreshable @FXML private AnchorPane anchorPaneMain; @FXML private Label labelPayments; @FXML private Label labelFilterActive; + @FXML private CheckBox checkBoxIncludeBudget; @FXML private CheckBox checkBoxSplitTable; @FXML private CheckBox checkBoxIncludeCategoryBudgets; @FXML private Button buttonFilter; @@ -89,6 +91,7 @@ public class ReportController implements Refreshable labelFilterActive.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT)); buttonFilter.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); buttonGenerate.setStyle("-fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_BUTTON_BLUE) + "; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); + checkBoxIncludeBudget.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT) + "; -fx-font-size: 14;"); checkBoxSplitTable.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT) + "; -fx-font-size: 14;"); checkBoxIncludeCategoryBudgets.setStyle("-fx-text-fill: " + ConvertTo.toRGBHexWithoutOpacity(Colors.TEXT) + "; -fx-font-size: 14;"); @@ -533,14 +536,19 @@ public class ReportController implements Refreshable if(file != null) { reportPath = file; + + Budget budget = new Budget(controller.getPaymentHandler().getPayments()); + ReportGenerator reportGenerator = new ReportGenerator(new ArrayList<ReportItem>(tableView.getItems()), controller.getCategoryBudgets(), columnOrder, + checkBoxIncludeBudget.isSelected(), checkBoxSplitTable.isSelected(), checkBoxIncludeCategoryBudgets.isSelected(), file, controller.getSettings().getCurrency(), - controller.getCurrentDate()); + controller.getCurrentDate(), + budget); Stage modalStage = Helpers.showModal("Vorgang läuft", "Der Monatsbericht wird erstellt, bitte warten...", controller.getStage(), controller.getIcon()); diff --git a/src/de/deadlocker8/budgetmaster/ui/fxml/ReportTab.fxml b/src/de/deadlocker8/budgetmaster/ui/fxml/ReportTab.fxml index ab291d65658415d00f20767d52e55fdb8d82a51b..35239f67f597ccd7771823c28e4fed449228c04d 100644 --- a/src/de/deadlocker8/budgetmaster/ui/fxml/ReportTab.fxml +++ b/src/de/deadlocker8/budgetmaster/ui/fxml/ReportTab.fxml @@ -39,6 +39,7 @@ <children> <VBox spacing="10.0"> <children> + <CheckBox fx:id="checkBoxIncludeBudget" mnemonicParsing="false" text="Budgetkalkulation hinzufügen" /> <CheckBox fx:id="checkBoxSplitTable" mnemonicParsing="false" text="Einnahmen und Ausgaben als getrennte Tabellen" /> <CheckBox fx:id="checkBoxIncludeCategoryBudgets" mnemonicParsing="false" text="Verbrauch nach Kategorien hinzufügen" /> </children> diff --git a/src/de/deadlocker8/budgetmasterserver/main/_de.properties b/src/de/deadlocker8/budgetmasterserver/main/_de.properties index 713a76327463db483cc54898db38106a16685244..cc0a0ccf45be1d7000a5eb8be6afcf220a9ae49c 100644 --- a/src/de/deadlocker8/budgetmasterserver/main/_de.properties +++ b/src/de/deadlocker8/budgetmasterserver/main/_de.properties @@ -1,5 +1,5 @@ app.name=BudgetMasterServer -version.code=4 -version.name=1.3.0 -version.date=10.08.17 +version.code=5 +version.name=1.3.1 +version.date=12.08.17 author=Robert Goldmann \ No newline at end of file