diff --git a/appimage/create_appimage.sh b/appimage/create_appimage.sh index 6512c13..71e44c2 100755 --- a/appimage/create_appimage.sh +++ b/appimage/create_appimage.sh @@ -11,7 +11,7 @@ read doinstall if [[ "${doinstall}" == *"y"* ]] then - sudo apt-get install libibatis-java libcommons-io-java libcommons-compress-java libhsqldb-java libgettext-commons-java libcommons-httpclient-java libjson-java libmail-java libcommons-csv-java + sudo apt-get install libibatis-java libcommons-io-java libcommons-compress-java libhsqldb-java libgettext-commons-java libcommons-httpclient-java libjson-java libmail-java libcommons-csv-java libfreemarker-java liblog4j1.2-java sudo apt-get install libswt-gtk-3-java libswt-webkit-gtk-3-jni libswt-cairo-gtk-3-jni sudo apt-get install ant default-jdk fi @@ -25,7 +25,7 @@ cp appimage/AppRun infinitypfm.AppDir/; chmod a+x infinitypfm.AppDir/AppRun; cp infinitypfm-ui/infinitypfm.desktop infinitypfm.AppDir/; cp infinitypfm-ui/infinitypfm.xpm infinitypfm.AppDir/; -cp *.jar infinitypfm.AppDir/usr/lib/; +cp target/*.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/swt.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/ibatis.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/commons-io.jar infinitypfm.AppDir/usr/lib/; @@ -50,8 +50,10 @@ cp -L /usr/lib/jni/libswt-pi-gtk-3836.so infinitypfm.AppDir/usr/lib/; cp -L /usr/lib/jni/libswt-webkit-gtk-3836.so infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/mailapi.jar infinitypfm.AppDir/usr/lib/; cp -L /usr/share/java/commons-csv.jar infinitypfm.AppDir/usr/lib/; +cp -L /usr/share/java/freemarker.jar infinitypfm.AppDir/usr/lib/; +cp -L /usr/share/java/log4j-1.2.jar infinitypfm.AppDir/usr/lib/; cp -L -R /usr/lib/jvm/java-1.8.0-openjdk-amd64 infinitypfm.AppDir/usr/lib/; #cp infinitypfm.run infinitypfm.AppDir/usr/bin/infinitypfm -appimagetool-x86_64.AppImage infinitypfm.AppDir infinitypfm-"$response".AppImage generate +~/bin/appimagetool-x86_64.AppImage infinitypfm.AppDir infinitypfm-"$response".AppImage generate diff --git a/archive/create_archive.sh b/archive/create_archive.sh index 75a0c60..75b8724 100755 --- a/archive/create_archive.sh +++ b/archive/create_archive.sh @@ -19,7 +19,7 @@ rm infinitypfm-$response.zip if [[ "${doinstall}" == *"y"* ]] then - sudo apt install libibatis-java libcommons-io-java libcommons-compress-java libhsqldb-java libgettext-commons-java libcommons-httpclient-java libjson-java libmail-java libcommons-csv-java + sudo apt install libibatis-java libcommons-io-java libcommons-compress-java libhsqldb-java libgettext-commons-java libcommons-httpclient-java libjson-java libmail-java libcommons-csv-java libfreemarker-java liblog4j1.2-java sudo apt install libswt-gtk-3-java libswt-webkit-gtk-3-jni libswt-cairo-gtk-3-jni sudo apt install ant default-jdk fi @@ -34,7 +34,7 @@ cp archive/infinitypfm.sh infinitypfm.archive/bin; chmod a+x infinitypfm.archive/bin; #cp infinitypfm-ui/infinitypfm.desktop infinitypfm.archive/; #cp infinitypfm-ui/infinitypfm.xpm infinitypfm.archive/; -cp *.jar infinitypfm.archive/lib/; +cp target/*.jar infinitypfm.archive/lib/; cp -L /usr/share/java/swt.jar infinitypfm.archive/lib/; cp -L $WIN_SWT_LOCAL/swt.jar infinitypfm.archive/lib/swt_win.jar; cp -L /usr/share/java/ibatis.jar infinitypfm.archive/lib/; @@ -60,6 +60,8 @@ cp -L /usr/lib/jni/libswt-pi-gtk-3836.so infinitypfm.archive/lib/; cp -L /usr/lib/jni/libswt-webkit-gtk-3836.so infinitypfm.archive/lib/; cp -L /usr/share/java/mailapi.jar infinitypfm.archive/lib/; cp -L /usr/share/java/commons-csv.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/freemarker.jar infinitypfm.archive/lib/; +cp -L /usr/share/java/log4j-1.2.jar infinitypfm.archive/lib/; #cp -L -R /usr/lib/jvm/java-1.8.0-openjdk-amd64 infinitypfm.archive/lib/; #cp infinitypfm.run infinitypfm.archive/usr/bin/infinitypfm diff --git a/build.xml b/build.xml index 2e51408..d06dde4 100644 --- a/build.xml +++ b/build.xml @@ -10,6 +10,7 @@ + @@ -18,11 +19,16 @@ + - + + + + + diff --git a/infinitypfm-btc/build.xml b/infinitypfm-btc/build.xml index acd6762..b014c2f 100644 --- a/infinitypfm-btc/build.xml +++ b/infinitypfm-btc/build.xml @@ -4,7 +4,7 @@ - + diff --git a/infinitypfm-common/build.xml b/infinitypfm-common/build.xml index 4f65af7..9b248ff 100644 --- a/infinitypfm-common/build.xml +++ b/infinitypfm-common/build.xml @@ -5,7 +5,7 @@ - + diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangLoader.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangLoader.java index 28d3fd9..58d4416 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangLoader.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/conf/LangLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -268,7 +268,7 @@ public LangLoader(){ hmPhrases.put("222", i18n.tr("Start Date")); hmPhrases.put("223", i18n.tr("End Date")); hmPhrases.put("224", i18n.tr("Currencies")); - hmPhrases.put("225", i18n.tr("Currency Precision")); + hmPhrases.put("225", i18n.tr("Precision")); hmPhrases.put("226", i18n.tr("Method Name")); hmPhrases.put("227", i18n.tr("Service URL")); hmPhrases.put("228", i18n.tr("Search Path")); @@ -295,7 +295,7 @@ public LangLoader(){ hmPhrases.put("249", i18n.tr("Open reports externally in web browser.")); hmPhrases.put("250", i18n.tr("General")); hmPhrases.put("251", i18n.tr("Open console on start.")); - hmPhrases.put("251", i18n.tr("Invalid Credentials")); + //hmPhrases.put("251", i18n.tr("Invalid Credentials")); hmPhrases.put("252", i18n.tr("Mail")); hmPhrases.put("253", i18n.tr("CSV")); hmPhrases.put("254", i18n.tr("Import Name")); @@ -306,6 +306,19 @@ public LangLoader(){ hmPhrases.put("259", i18n.tr("None")); hmPhrases.put("260", i18n.tr("Date Format")); hmPhrases.put("261", i18n.tr("Continue")); + hmPhrases.put("262", i18n.tr("Income Total")); + hmPhrases.put("263", i18n.tr("Expense Total")); + hmPhrases.put("264", i18n.tr("Liability Total")); + hmPhrases.put("265", i18n.tr("Year-Month")); + hmPhrases.put("266", i18n.tr("Account Balance")); + hmPhrases.put("267", i18n.tr("Expense Balance")); + hmPhrases.put("268", i18n.tr("Budget Balance")); + hmPhrases.put("269", i18n.tr("Budget Name")); + hmPhrases.put("270", i18n.tr("Income Balance")); + hmPhrases.put("271", i18n.tr("Liability Balance")); + hmPhrases.put("272", i18n.tr("Account Type")); + hmPhrases.put("273", i18n.tr("Account History All Time")); + hmPhrases.put("274", i18n.tr("Apache FreeMarker (https://freemarker.apache.org/) ")); } diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java index 204e3eb..fd6d5a7 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/BudgetBalance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -20,6 +20,7 @@ import java.io.Serializable; + /** * POJO for storing budget totals. * @@ -38,11 +39,16 @@ public class BudgetBalance implements Serializable, IReportable { int budgetId = -1; String budgetName = null; String actName = null; + DataFormatUtil _formatter; public int getYr() { return yr; } + public String getYrString() { + return Integer.toString(yr); + } + public void setYr(int yr) { this.yr = yr; } @@ -59,6 +65,10 @@ public long getBudgetBalance() { return budgetBalance; } + public String getBudgetBalanceFmt() { + return _formatter.getAmountFormatted(budgetBalance, "###0.00"); + } + public void setBudgetBalance(long budgetBalance) { this.budgetBalance = budgetBalance; } @@ -67,6 +77,10 @@ public long getExpenseBalance() { return expenseBalance; } + public String getExpenseBalanceFmt() { + return _formatter.getAmountFormatted(expenseBalance, "###0.00"); + } + public void setExpenseBalance(long expenseBalance) { this.expenseBalance = expenseBalance; } @@ -125,4 +139,9 @@ public String toReportRow() { return sb.toString(); } + @Override + public void setFormatter(DataFormatUtil formatter) { + _formatter = formatter; + } + } diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/IReportable.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/IReportable.java index bdac081..f7a4f20 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/IReportable.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/IReportable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -22,5 +22,6 @@ public interface IReportable { public String getHeaderRow(); public String toReportRow(); + public void setFormatter(DataFormatUtil _formatter); } diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalance.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalance.java index 8fcf702..cd46352 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalance.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -20,19 +20,8 @@ import java.io.Serializable; - -/** - * @author wayne - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -//@JsonIgnoreProperties(ignoreUnknown = true) public class MonthlyBalance implements Serializable, IReportable { - /** - * - */ private static final long serialVersionUID = 1L; int actId=0; int yr = 0; @@ -41,7 +30,11 @@ public class MonthlyBalance implements Serializable, IReportable { String actTypeName = ""; String actName = ""; String isoCode = ""; + DataFormatUtil _formatter; + public MonthlyBalance() { + super(); + } public String getActTypeName() { return actTypeName; @@ -60,19 +53,25 @@ public void setActName(String actName) { } /** - * + * @return Returns the actBalance. */ - public MonthlyBalance() { - super(); - // TODO Auto-generated constructor stub + public long getActBalance() { + if (actTypeName.equalsIgnoreCase("income")) + return -actBalance; + else return actBalance; } - + /** * @return Returns the actBalance. */ - public long getActBalance() { - return actBalance; + public String getActBalanceFmt() { + + if (_formatter != null) + return _formatter.getAmountFormatted(actBalance, "###0.00"); + else + return Long.toString(actBalance); } + /** * @param actBalance The actBalance to set. */ @@ -109,6 +108,11 @@ public void setMth(int mth) { public int getYr() { return yr; } + + public String getYrString() { + return Integer.toString(yr); + } + /** * @param yr The yr to set. */ @@ -123,6 +127,11 @@ public String getIsoCode() { public void setIsoCode(String isoCode) { this.isoCode = isoCode; } + + @Override + public void setFormatter(DataFormatUtil _formatter) { + this._formatter = _formatter; + } @Override public String getHeaderRow() { @@ -147,4 +156,5 @@ public String toReportRow() { sb.append(yr).append("-").append(mth); return sb.toString(); } + } diff --git a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalanceByType.java b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalanceByType.java index 21560af..0c075a5 100644 --- a/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalanceByType.java +++ b/infinitypfm-common/src/main/java/org/infinitypfm/core/data/MonthlyBalanceByType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -24,12 +24,13 @@ public class MonthlyBalanceByType implements Serializable, IReportable{ private static final long serialVersionUID = 1919973868244212053L; - int yr = 0; - int mth = 0; - long incomeBalance = 0; - long expenseBalance = 0; - long liabilityBalance = 0; - long bankBalance = 0; + private int yr = 0; + private int mth = 0; + private long incomeBalance = 0; + private long expenseBalance = 0; + private long liabilityBalance = 0; + private long bankBalance = 0; + private DataFormatUtil _formatter; @Override public String getHeaderRow() { @@ -58,6 +59,10 @@ public int getYr() { return yr; } + public String getYrString() { + return Integer.toString(yr); + } + public void setYr(int yr) { this.yr = yr; } @@ -74,6 +79,10 @@ public long getIncomeBalance() { return incomeBalance; } + public String getIncomeBalanceFmt() { + return _formatter.getAmountFormatted(-incomeBalance, "##0.00"); + } + public void setIncomeBalance(long incomeBalance) { this.incomeBalance = incomeBalance; } @@ -81,6 +90,10 @@ public void setIncomeBalance(long incomeBalance) { public long getExpenseBalance() { return expenseBalance; } + + public String getExpenseBalanceFmt() { + return _formatter.getAmountFormatted(expenseBalance, "##0.00"); + } public void setExpenseBalance(long expenseBalance) { this.expenseBalance = expenseBalance; @@ -90,6 +103,18 @@ public long getLiabilityBalance() { return liabilityBalance; } + public String getLiabilityBalanceFmt() { + return _formatter.getAmountFormatted(liabilityBalance, "##0.00"); + } + + public String getLiabilityPlusExpenseBalanceFmt() { + return _formatter.getAmountFormatted(liabilityBalance+expenseBalance, "##0.00"); + } + + public long getLiabilityPlusExpenseBalance() { + return liabilityBalance+expenseBalance; + } + public void setLiabilityBalance(long liabilityBalance) { this.liabilityBalance = liabilityBalance; } @@ -101,7 +126,9 @@ public long getBankBalance() { public void setBankBalance(long bankBalance) { this.bankBalance = bankBalance; } - - + @Override + public void setFormatter(DataFormatUtil formatter) { + _formatter = formatter; + } } diff --git a/infinitypfm-ui/build.xml b/infinitypfm-ui/build.xml index 454eac3..6d80f7b 100644 --- a/infinitypfm-ui/build.xml +++ b/infinitypfm-ui/build.xml @@ -3,8 +3,8 @@ - - + + @@ -25,6 +25,7 @@ + @@ -32,6 +33,12 @@ + + + + + + diff --git a/infinitypfm-ui/src/main/java/barChartBase.js b/infinitypfm-ui/src/main/java/barChartBase.js index a117ff5..a2aacbd 100644 --- a/infinitypfm-ui/src/main/java/barChartBase.js +++ b/infinitypfm-ui/src/main/java/barChartBase.js @@ -22,12 +22,13 @@ Raphael.fn.barChart = function(posX, posY, w, h, values, labels, title, guidelin pathSeg = ""; chart = this.set(); - var txtTitle = paper.text(80, 15, title).attr( { - fill : "rgb(27,95,138)", - "font-family" : 'Fontin-Sans, Arial', - "font-size" : "18px" - }); - + if (title != undefined) { + var txtTitle = paper.text(80, 15, title).attr( { + fill : "rgb(27,95,138)", + "font-family" : 'Fontin-Sans, Arial', + "font-size" : "18px" + }); + } paper.rect(chartX, posY, 0.5, chartH); paper.rect(chartX, chartY, chartW, 0.5); diff --git a/infinitypfm-ui/src/main/java/barchart1.js b/infinitypfm-ui/src/main/java/barchart1.js index 16e8b0d..bb3d505 100644 --- a/infinitypfm-ui/src/main/java/barchart1.js +++ b/infinitypfm-ui/src/main/java/barchart1.js @@ -39,7 +39,7 @@ var chart1Title = $("#chart1Title").val(); - raphael("holder1", 650, 400).barChart(100,100,550,250,values1, labels1, chart1Title, guideLineLbl, guideLineVals); + raphael("holder1", 650, 350).barChart(100,50,550,250,values1, labels1, chart1Title, guideLineLbl, guideLineVals); }); diff --git a/infinitypfm-ui/src/main/java/linechart1.js b/infinitypfm-ui/src/main/java/linechart1.js index ff287c6..5987860 100644 --- a/infinitypfm-ui/src/main/java/linechart1.js +++ b/infinitypfm-ui/src/main/java/linechart1.js @@ -35,7 +35,7 @@ var chart1Title = $("#chart1Title").val(); - raphael("holder1", 650, 400).lineChart(100,100,550,250,values1, values2, labels, chart1Title); + raphael("holder1", 650, 400).lineChart(100,75,550,250,values1, values2, labels, chart1Title); }); diff --git a/infinitypfm-ui/src/main/java/linechartBase.js b/infinitypfm-ui/src/main/java/linechartBase.js index 20eff87..b9e9b0d 100644 --- a/infinitypfm-ui/src/main/java/linechartBase.js +++ b/infinitypfm-ui/src/main/java/linechartBase.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -26,11 +26,13 @@ Raphael.fn.lineChart = function(posX, posY, w, h, values1, values2, labels, titl var seriesColor1 = "rgb(83, 156, 255)"; var seriesColor2 = "rgb(253, 118, 143)"; - var txtTitle = paper.text(80, 15, title).attr( { - fill : "rgb(27,95,138)", - "font-family" : 'Fontin-Sans, Arial', - "font-size" : "18px" - }); + if (title != undefined) { + var txtTitle = paper.text(80, 15, title).attr( { + fill : "rgb(27,95,138)", + "font-family" : 'Fontin-Sans, Arial', + "font-size" : "18px" + }); + } paper.rect(chartX, posY, 0.5, chartH); paper.rect(chartX, chartY, chartW, 0.5); diff --git a/infinitypfm-ui/src/main/java/linechartBaseSingle.js b/infinitypfm-ui/src/main/java/linechartBaseSingle.js new file mode 100644 index 0000000..abd6f35 --- /dev/null +++ b/infinitypfm-ui/src/main/java/linechartBaseSingle.js @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2005-2020 Wayne Gray All rights reserved + * + * This file is part of Infinity PFM. + * + * Infinity PFM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Infinity PFM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Infinity PFM. If not, see . +*/ +Raphael.fn.lineChart = function(posX, posY, w, h, values1, labels, title) { + + var paper = this, chartH = h, chartW = w, chartX = posX, chartY = posY + h, + pathSeg1 = "", pathSeg2 = ""; + + chart = this.set(); + + var seriesColor1 = "rgb(83, 156, 255)"; + + + if (title != undefined) { + var txtTitle = paper.text(80, 15, title).attr( { + fill : "rgb(27,95,138)", + "font-family" : 'Fontin-Sans, Arial', + "font-size" : "18px" + }); + } + paper.rect(chartX, posY, 0.5, chartH); + paper.rect(chartX, chartY, chartW, 0.5); + + var pointGap = chartW / values1.length; + var x, y; + var start = .05, bcolor, color; + + var scaleMax = 0; + for ( var j = 0; j < values1.length; j++) { + if (values1[j] > scaleMax) { + scaleMax = values1[j]; + } + + } + + var scaleMaxOrig = scaleMax; + var scaleInc = scaleMax / 10; + scaleInc = Math.round(scaleInc / 100) * 100; + scaleMax = scaleInc * 10; + + if (scaleMax == 0) { + if (scaleMaxOrig < 100) { + scaleMax = 100; + } else { + scaleMax = 500; + } + } + + process = function(i) { + var x = chartX + (i * (pointGap)); + var point1H = (values1[i] * chartH) / scaleMax; + + var y1 = chartY - point1H; + + var x1 = x + (pointGap / 2); + + if (i==0) { + pathSeg1 += "M," + Math.round(x1) + "," + y1 + } else if (i==1) { + + pathSeg1 += " L," + Math.round(x1) + "," + y1 + + } else { + pathSeg1 += "," + Math.round(x1) + "," + y1 + } + + var pointMarker1 = paper.circle(x1, y1, 5).attr( { + fill : seriesColor1, + stroke: seriesColor1 + }); + + var txt1 = paper.text(x1, y1 - 15, values1[i]); + txt1.attr("opacity", 0).attr( { + stroke : "none", + opacity : 0, + "font-family" : 'Fontin-Sans, Arial', + "font-size" : "12px" + }); + + + pointMarker1.mouseover(function(event) { + + pointMarker1.animate( { + scale : [ 1.01, 1.01, x1, y1 ] + }, 2000, "elastic"); + txt1.animate( { + opacity : 1 + }, 2000, "elastic"); + }).mouseout(function(event) { + pointMarker1.animate( { + scale : [ 1, 1, x1, y1 ] + }, 2000, "elastic"); + txt1.animate( { + opacity : 0 + }, 2000); + }); + + + var t = paper.text(x + (pointGap / 2), chartY + 20, labels[i]); + t.rotate(55); + + }; + + for ( var i = 0; i < labels.length; i++) { + + process(i); + } + + var seriesLine1 = paper.path(pathSeg1).attr({stroke: seriesColor1, "stroke-width": 4, "stroke-linejoin": "round"}); + + animateElement(seriesLine1); + + var scaleInc = scaleMax / 10; + var scaleVal; + + for ( var k = 1; k < 10; k++) { + scaleVal = ((k * scaleInc) * chartH) / scaleMax; + y = chartY - scaleVal; + var scaleLabelMax = paper + .text(chartX - 15, y, Math.round(k * scaleInc)); + paper.rect(chartX - 5, y, 10, 1); + + } + + return chart; +}; + +function animateElement (e) { + + e.mouseover(function(event) { + + e.animate( { + scale : [ 1.01, 1.01, x, y ] + }, 500, "elastic"); + + }).mouseout(function(event) { + e.animate( { + scale : [ 1, 1, x, y ] + }, 500, "elastic"); + + }); + +} diff --git a/infinitypfm-ui/src/main/java/linechartSingle1.js b/infinitypfm-ui/src/main/java/linechartSingle1.js new file mode 100644 index 0000000..5fcfa79 --- /dev/null +++ b/infinitypfm-ui/src/main/java/linechartSingle1.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * + * This file is part of Infinity PFM. + * + * Infinity PFM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Infinity PFM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Infinity PFM. If not, see . +*/ +(function (raphael) { + $(function () { + + var values1 = [], + labels = []; + + guideLineLbl = $("#chart1").attr("guideLineLbl"); + + $("#chart1 tr").each(function () { + values1.push(parseInt($("td.barVal1", this).text(), 10)); + labels.push($("th", this).text()); + + }); + $("#chart1").hide(); + + var chart1Title = $("#chart1Title").val(); + + raphael("holder1", 650, 400).lineChart(75,50,550,250,values1, labels, chart1Title); + + + }); +})(Raphael.ninja()); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/action/MainAction.java b/infinitypfm-ui/src/main/java/org/infinitypfm/action/MainAction.java index bff3b56..ca98cab 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/action/MainAction.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/action/MainAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -183,6 +183,13 @@ public void ProcessMenuItem(int item) { InfinityPfm.LogMessage(e.getMessage(), true); } break; + case MM.MENU_REPORTS_ACCOUNT_HISTORY_ALL_TIME: + try { + this.RunReport(MM.MENU_REPORTS_ACCOUNT_HISTORY_ALL_TIME); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage(), true); + } + break; case MM.MENU_REPORTS_BUDGET_PERFORMANCE: try { this.RunReport(MM.MENU_REPORTS_BUDGET_PERFORMANCE); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/client/InfinityPfm.java b/infinitypfm-ui/src/main/java/org/infinitypfm/client/InfinityPfm.java index 298b96f..fc15221 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/client/InfinityPfm.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/client/InfinityPfm.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -25,6 +25,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; +import java.nio.charset.Charset; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; @@ -35,6 +36,11 @@ import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.io.IOUtils; +import org.apache.log4j.ConsoleAppender; +import org.apache.log4j.FileAppender; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.PatternLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.infinitypfm.conf.MM; @@ -52,10 +58,15 @@ import com.ibatis.common.resources.Resources; import com.ibatis.sqlmap.client.SqlMapClientBuilder; +import freemarker.template.Configuration; +import freemarker.template.TemplateExceptionHandler; + public class InfinityPfm { private static final String CONFIG_ERROR_ENG = "Error setting up home directory for: "; - private static File homeDirectory = new File(System.getProperty("user.home") + "/.infinitypfm"); + private static File homeDirectory = new File(System.getProperty("user.home") + File.separator + ".infinitypfm"); + final static Logger LOG = Logger.getLogger(InfinityPfm.class); + public static void main(String[] args) { Display display = new Display(); @@ -72,6 +83,9 @@ public static void main(String[] args) { return; } + //configure logging + configureLogging(); + //load language getLanguage(); @@ -82,6 +96,13 @@ public static void main(String[] args) { e1.printStackTrace(); System.exit(0); } + + try { + loadReportTemplates(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(0); + } /* Sleak Startup code * @@ -167,13 +188,10 @@ private static void getLanguage(){ } catch(Exception e){ - System.err.println("Error Loading Language File"); e.printStackTrace(); } - - } private static void initConfig() throws ConfigurationException{ @@ -181,35 +199,55 @@ private static void initConfig() throws ConfigurationException{ boolean canContinue = true; //Check if folder is set up - if (!homeDirectory.exists()){ - canContinue = homeDirectory.mkdir(); - } + if (!homeDirectory.exists()) canContinue = homeDirectory.mkdir(); - if (!canContinue) { + if (!canContinue) throw new ConfigurationException(CONFIG_ERROR_ENG + homeDirectory.getPath()); - } - File dataDirectory = new File(homeDirectory.getPath() + "/data"); + File dataDirectory = new File(homeDirectory.getPath() + File.separator + "data"); - if (!dataDirectory.exists()){ - canContinue = dataDirectory.mkdir(); - } + if (!dataDirectory.exists()) canContinue = dataDirectory.mkdir(); - if (!canContinue) { + if (!canContinue) throw new ConfigurationException(CONFIG_ERROR_ENG + homeDirectory.getPath()); - } - File pluginDirectory = new File(homeDirectory.getPath()+ "/plugins"); + File pluginDirectory = new File(homeDirectory.getPath()+ File.separator + "plugins"); - if (!pluginDirectory.exists()){ - canContinue = pluginDirectory.mkdir(); - } + if (!pluginDirectory.exists()) canContinue = pluginDirectory.mkdir(); - if (!canContinue) { + if (!canContinue) throw new ConfigurationException(CONFIG_ERROR_ENG + homeDirectory.getPath()); - } + + extractFile(MM.PROPS_FILE, "", homeDirectory.getPath()); + + /*TODO: may not need this - String sPropsFile = homeDirectory.getPath() + "/" + MM.PROPS_FILE; + File templateDirectory = new File(homeDirectory.getPath() + File.separator + "templates"); + + if (!templateDirectory.exists()) canContinue = templateDirectory.mkdir(); + + if (!canContinue) + throw new ConfigurationException(CONFIG_ERROR_ENG + homeDirectory.getPath()); + + extractFile(MM.PROPS_FILE, "", homeDirectory.getPath()); + extractFile(MM.PIE_CHART_BASE, "", homeDirectory.getPath() + File.separator + "templates"); + extractFile(MM.PIE_CHART_1, "", homeDirectory.getPath() + File.separator + "templates"); + extractFile(MM.PIE_CHART_2, "", homeDirectory.getPath() + File.separator + "templates"); + extractFile(MM.BAR_CHART_BASE, "", homeDirectory.getPath() + File.separator + "templates"); + extractFile(MM.BAR_CHART_1, "", homeDirectory.getPath() + File.separator + "templates"); + extractFile(MM.LINE_CHART_1, "", homeDirectory.getPath() + File.separator + "templates"); + extractFile(MM.LINE_CHART_BASE, "", homeDirectory.getPath() + File.separator + "templates"); + extractFile(MM.JS_LIB, "", homeDirectory.getPath() + File.separator + "templates"); + extractFile(MM.GRAPH_LIB, "", homeDirectory.getPath() + File.separator + "templates"); + extractFile(MM.RPT_ACCOUNT_HISTORY, "org/infinitypfm/reporting/", homeDirectory.getPath() + File.separator + "templates"); + */ + } + + private static void extractFile(String file, String packagePath, String outFolder) { + + String sPropsFile = outFolder + + File.separator + + file; //check if database exists File propsFile = new File (sPropsFile); @@ -220,11 +258,11 @@ private static void initConfig() throws ConfigurationException{ OutputStream out = null; try { - in = Resources.getResourceAsStream (MM.PROPS_FILE); + in = Resources.getResourceAsStream (packagePath + file); out=new FileOutputStream(sPropsFile); - @SuppressWarnings("rawtypes") - List lines = IOUtils.readLines(in); + List lines = IOUtils.readLines(in, Charset.defaultCharset()); + ArrayList outLines = new ArrayList(); String line = null; @@ -233,25 +271,20 @@ private static void initConfig() throws ConfigurationException{ line = (String)lines.get(i); line = line.replace("{HOME}", homeDirectory.getPath()); - outLines.add(line); - } - IOUtils.writeLines(outLines, null, out); - + IOUtils.writeLines(outLines, null, out, Charset.defaultCharset()); } catch (IOException e){ - System.err.println("Error Creating " + MM.PROPS_FILE); + System.err.println("Error Creating " + file); e.printStackTrace(); } finally { try {out.close();} catch (Exception e) {System.err.println(e.getMessage());} try {in.close();} catch (Exception e) {System.err.println(e.getMessage());} - } } - } private static void loadDatabase() throws ConfigurationException{ @@ -259,7 +292,7 @@ private static void loadDatabase() throws ConfigurationException{ Reader reader = null; try { - String propsFile = homeDirectory.getPath() + "/" + MM.PROPS_FILE; + String propsFile = homeDirectory.getPath() + File.separator + MM.PROPS_FILE; PropertiesConfiguration propsConfig = new PropertiesConfiguration(propsFile); Properties props = propsConfig.getProperties("db.source"); @@ -301,6 +334,18 @@ private static void loadDatabase() throws ConfigurationException{ } } + private static void loadReportTemplates() throws IOException { + + File templateDir = new File(homeDirectory.getPath() + File.separator + "templates"); + + // Create a freemarker configuration instance + MM.templateConfig = new Configuration(Configuration.VERSION_2_3_23); + MM.templateConfig.setClassLoaderForTemplateLoading(ClassLoader.getSystemClassLoader(), "org/infinitypfm/reporting"); + MM.templateConfig.setDefaultEncoding("UTF-8"); + MM.templateConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + MM.templateConfig.setLogTemplateExceptions(false); + } + private static void removeOldFiles() { FileHandler fileUtil = new FileHandler(); @@ -314,12 +359,9 @@ private static void removeOldFiles() { } public static void LogMessage(String sMsg){ - if (qzMain.getMsgMain()==null){ - return; - } - + LOG.info(sMsg); + if (qzMain.getMsgMain()==null) return; qzMain.getMsgMain().AppendMsg(sMsg); - } public static void LogMessage(String sMsg, boolean promptUser){ @@ -332,8 +374,43 @@ public static void LogMessage(String sMsg, boolean promptUser){ sMsg); show.Open(); } + } + + private static void configureLogging() { + + String logFile = null; + try { + logFile = homeDirectory.getCanonicalPath() + File.separator + "infinitypfm.log"; + } catch (IOException e) { + e.printStackTrace(); + } + + if (logFile == null) return; + + File logFileObj = new File(logFile); + if (logFileObj.exists()) + logFileObj.delete(); + if (logFile != null) { + ConsoleAppender console = new ConsoleAppender(); //create appender + //configure the appender + String PATTERN = "%d [%p|%c|%C{1}] %m%n"; + console.setLayout(new PatternLayout(PATTERN)); + console.setThreshold(Level.FATAL); + console.activateOptions(); + Logger.getRootLogger().addAppender(console); + + FileAppender fa = new FileAppender(); + fa.setName("FileLogger"); + fa.setFile(logFile); + fa.setLayout(new PatternLayout("%d %-5p [%c{1}] %m%n")); + fa.setThreshold(Level.INFO); + fa.setAppend(true); + fa.activateOptions(); + + Logger.getRootLogger().addAppender(fa); + } } public static MainFrame qzMain; diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/conf/MM.java b/infinitypfm-ui/src/main/java/org/infinitypfm/conf/MM.java index e8d8ef9..21c0517 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/conf/MM.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/conf/MM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2019 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -27,16 +27,18 @@ import com.ibatis.sqlmap.client.SqlMapClient; +import freemarker.template.Configuration; + public class MM { /* * Program Constants */ public static final String APPTITLE = "Infinity PFM"; - public static final String APPVERSION = "0.8.0"; // <-- Used during database creation only + public static final String APPVERSION = "0.8.5"; // <-- Used during database creation only public static final String APPLINK = "https://www.infinitypfm.org"; public static final String APPLICENCE = "GNU General Public License v3"; - public static final String APPCOPYRIGHT = "(c) 2005-2017 by Wayne Gray"; + public static final String APPCOPYRIGHT = "(c) 2005-2020 by Wayne Gray"; public static final String APPPATH = System.getProperty("INFINITYPFM_HOME") + File.separator; public static final String ENVAPPHOME = "INFINITYPFM_HOME"; public static final int ROW_BACKGROUND = SWT.COLOR_LIST_BACKGROUND; @@ -46,11 +48,14 @@ public class MM { public static final String IMG_ADD = "list-add.png"; public static final String IMG_ARROW_DOWN = "go-down.png"; public static final String IMG_ARROW_UP = "go-up.png"; + public static final String IMG_ARROW_RIGHT = "arrowr_32x32.png"; + public static final String IMG_BSV = "bsv.png"; public static final String IMG_CALCULATOR = "accessories-calculator.png"; public static final String IMG_CALENDAR = "x-office-calendar.png"; public static final String IMG_CANCEL = "edit-undo.png"; public static final String IMG_CHART = "chart2_32x32.png"; public static final String IMG_CLEAR = "edit-clear.png"; + public static final String IMG_CLIPBOARD = "clipboard_32x32.png"; public static final String IMG_CLOCK = "appointment-soon.png"; public static final String IMG_CLOSE_SMALL = "fileclose.png"; public static final String IMG_CLOSE = "window-close.png"; @@ -74,8 +79,9 @@ public class MM { public static final String IMG_QUE = "circle.gif"; public static final String IMG_QUEZEN_BANNER = "infinitylogo2.jpg"; public static final String IMG_QUEZEN_BANNER_SMALL = "infinitylogo1_small.jpg"; - public static final String IMG_QUEZEN_ICON = "eye.gif"; + public static final String IMG_LOGO_ICON = "infinityLogo_128x128.png"; public static final String IMG_REFRESH = "reload.png"; + public static final String IMG_REFRESH2 = "refresh.png"; public static final String IMG_REMOVEQUEUE = "remove.png"; public static final String IMG_SAVE = "document-save.png"; public static final String IMG_SELECTALL = "ok.png"; @@ -83,7 +89,14 @@ public class MM { public static final String IMG_TESTMSG = "mail_forward.png"; public static final String IMG_TREELEAF = "tree_leaf_32x32.png"; public static final String IMG_DOLLAR = "coins_32x32.png"; - + public static final String IMG_BSV_LOGO = "bai-icon-small.png"; + public static final String IMG_TEST_QR = "qrTstImg.png"; + public static final String IMG_WALLET = "accessories-dictionary.png"; + public static final String IMG_KEY = "dialog-password.png"; + public static final String IMG_FOLDER_DOWNLOAD = "folder-download.png"; + public static final String IMG_MESSAGE_DEFAULT = "hwinfo.png"; + + public static final String ACT_TYPE_BANK = "Bank"; public static final String ACT_TYPE_EXPENSE = "Expense"; public static final String ACT_TYPE_LIABILITY = "Liability"; public static final String ACT_TYPE_INCOME = "Income"; @@ -161,9 +174,10 @@ public class MM { public static final int MENU_REPORTS_MONTHLY_BALANCE = 100; public static final int MENU_REPORTS_PRIOR_MONTHLY_BALANCE = 101; public static final int MENU_REPORTS_ACCOUNT_HISTORY = 102; - public static final int MENU_REPORTS_BUDGET_PERFORMANCE = 103; - public static final int MENU_REPORTS_BUDGET_PERFORMANCE_ACT = 104; - public static final int MENU_REPORTS_INCOME_VS_EXPENSE = 105; + public static final int MENU_REPORTS_ACCOUNT_HISTORY_ALL_TIME = 103; + public static final int MENU_REPORTS_BUDGET_PERFORMANCE = 104; + public static final int MENU_REPORTS_BUDGET_PERFORMANCE_ACT = 105; + public static final int MENU_REPORTS_INCOME_VS_EXPENSE = 106; public static final int MENU_BUDGET_SAVE = 120; @@ -211,6 +225,22 @@ public class MM { public static String importFile = null; public static String csvConfig = null; + // Report Settings + public static Configuration templateConfig = null; + public static final String PIE_CHART_BASE = "piechartBase.js"; + public static final String PIE_CHART_1 ="piechart1.js"; + public static final String PIE_CHART_2 ="piechart2.js"; + public static final String BAR_CHART_BASE = "barChartBase.js"; + public static final String BAR_CHART_1 = "barchart1.js"; + public static final String LINE_CHART_1 = "linechart1.js"; + public static final String LINE_CHART_BASE = "linechartBase.js"; + public static final String JS_LIB = "jquery.js"; + public static final String GRAPH_LIB = "raphael-min.js"; + public static final String RPT_ACCOUNT_HISTORY = "AccountHistory.ftl"; + public static final String RPT_MONTHLY_BALANCES = "MonthlyBalances.ftl"; + public static final String RPT_BUDGET_PERFORMANCE = "BudgetPerformance.ftl"; + public static final String RPT_INCOME_VS_EXPENSE = "IncomveVsExpense.ftl"; + public static Options options = null; } diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/data/InfinityUpdates.java b/infinitypfm-ui/src/main/java/org/infinitypfm/data/InfinityUpdates.java index 078dc0b..427a4f8 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/data/InfinityUpdates.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/data/InfinityUpdates.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -161,6 +161,8 @@ public void ProcessUpdates() throws SQLException { ApplyVersion078(); } else if (sVersion.equalsIgnoreCase("0.7.7")) { ApplyVersion078(); + } else if (sVersion.equalsIgnoreCase("0.7.8")) { + ApplyVersion085(); } } @@ -306,5 +308,9 @@ private void ApplyVersion078() throws SQLException { MM.sqlMap.update("bumpVersion", "0.7.8"); } - + private void ApplyVersion085() throws SQLException { + + MM.sqlMap.update("bumpVersion", "0.8.5"); + } + } diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/data/ReportData.java b/infinitypfm-ui/src/main/java/org/infinitypfm/data/ReportData.java index fc68bf1..0d8b036 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/data/ReportData.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/data/ReportData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2013 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -18,32 +18,58 @@ */ package org.infinitypfm.data; +import java.io.IOException; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; import org.infinitypfm.client.InfinityPfm; import org.infinitypfm.conf.MM; import org.infinitypfm.core.data.BudgetBalance; import org.infinitypfm.core.data.BudgetDetail; import org.infinitypfm.core.data.DataFormatUtil; +import org.infinitypfm.core.data.IReportable; import org.infinitypfm.core.data.MonthlyBalance; import org.infinitypfm.core.data.ParamDateRange; +import org.infinitypfm.reporting.BaseReport; +import org.infinitypfm.reporting.ScriptLoader; import org.infinitypfm.ui.view.dialogs.AccountSelectorDialog; import org.infinitypfm.ui.view.dialogs.BudgetSelector; import org.infinitypfm.ui.view.dialogs.MonthYearDialog; +/** + * + * This class gathers up all the data needed for + * a report. + * + * User will be prompted for input if required. + * + */ public class ReportData { private DataFormatUtil dateUtil; @SuppressWarnings("rawtypes") private List reportData; + @SuppressWarnings("rawtypes") + private List reportDataIncome; + @SuppressWarnings("rawtypes") + private List reportDataExpense; private String incomeTotal; private String expenseTotal; private String liabilityTotal; private String title; private String budget; private String account; + private String _template; + + /********************/ + /* Script Libraries */ + private ScriptLoader _scriptLoader = null; + /********************/ + private Boolean userCancelled = false; public ReportData(int reportType) { @@ -63,6 +89,10 @@ public ReportData(int reportType) { reportParam.setYr(dateUtil.getYear()); setReportData("getReportMonthlyBalances", reportParam); + populateIncomeAndExpenseLists(); + + _template = MM.RPT_MONTHLY_BALANCES; + break; case MM.LAST_MONTH: @@ -72,8 +102,13 @@ public ReportData(int reportType) { + dateUtil.getMonthName(0) + " " + dateUtil.getYear(); reportParam.setMth(dateUtil.getMonth()); reportParam.setYr(dateUtil.getYear()); + setReportData("getReportMonthlyBalances", reportParam); - + + populateIncomeAndExpenseLists(); + + _template = MM.RPT_MONTHLY_BALANCES; + break; case MM.MENU_REPORTS_ACCOUNT_HISTORY: @@ -89,9 +124,27 @@ public ReportData(int reportType) { monthlyBalance.setMth(dateUtil.getMonth()); monthlyBalance.setYr(dateUtil.getYear() - 1); setReportData("getReportAccountHistory", monthlyBalance); + _template = MM.RPT_ACCOUNT_HISTORY; } + break; + case MM.MENU_REPORTS_ACCOUNT_HISTORY_ALL_TIME: + dateUtil.setDate(new Date()); + title = MM.PHRASES.getPhrase("273"); + monthlyBalance = new MonthlyBalance(); + + account = promptForAccount(true); //Include income accounts + + if (account != null) { + + monthlyBalance.setActName(account); + monthlyBalance.setMth(dateUtil.getMonth()); + monthlyBalance.setYr(dateUtil.getYear() - 50); + setReportData("getReportAccountHistory", monthlyBalance); + _template = MM.RPT_ACCOUNT_HISTORY; + + } break; case MM.MENU_REPORTS_BUDGET_PERFORMANCE: @@ -109,6 +162,8 @@ public ReportData(int reportType) { args.setActTypeName(MM.ACT_TYPE_EXPENSE); setReportData("getBudgetVsExpenseByMonth", args); + _template = MM.RPT_BUDGET_PERFORMANCE; + } break; @@ -131,6 +186,7 @@ public ReportData(int reportType) { args.setActTypeName(MM.ACT_TYPE_EXPENSE); setReportData("getBudgetVsExpenseByMonthAndAccount", args); + _template = MM.RPT_BUDGET_PERFORMANCE; } break; @@ -142,8 +198,9 @@ public ReportData(int reportType) { reportParam.setYr(dateUtil.getYear()); setReportData("getIncomeVsExpense", reportParam); + _template = MM.RPT_INCOME_VS_EXPENSE; + break; - } } @@ -152,22 +209,39 @@ public List getReportData() { return reportData; } - public String getIncomeTotal() { - return incomeTotal; + public String getIncomeTotal() { + return formatLongString(incomeTotal); } + public long getIncomeTotalRaw() { + + return -Long.parseLong(incomeTotal); + } + public String getExpenseTotal() { - return expenseTotal; + return formatLongString(expenseTotal); + } + + public long getExpenseTotalRaw() { + return Long.parseLong(expenseTotal); } public String getLiabilityTotal() { - return liabilityTotal; + return formatLongString(liabilityTotal); } + public long getLiabilityTotalRaw() { + return Long.parseLong(liabilityTotal); + } + public String getTitle() { return title; } + public String getAccount() { + return account; + } + public Boolean getUserCanceled() { return userCancelled; } @@ -175,6 +249,24 @@ public Boolean getUserCanceled() { public void setUserCanceled(Boolean userCanceled) { this.userCancelled = userCanceled; } + + public String getTemplate() { + return _template; + } + + public void setTemplate(String template) { + this._template = template; + } + + @SuppressWarnings("rawtypes") + public List getReportDataIncome() { + return reportDataIncome; + } + + @SuppressWarnings("rawtypes") + public List getReportDataExpense() { + return reportDataExpense; + } private void initTotals() { @@ -213,6 +305,12 @@ private void setReportData(String reportName, Object args) { reportData = MM.sqlMap.queryForList(reportName, args); + for (Object row : reportData) { + if (row != null) + ((IReportable) row).setFormatter(dateUtil); + } + + } catch (SQLException e) { InfinityPfm.LogMessage(e.getMessage()); } @@ -243,4 +341,222 @@ private String promptForAccount(boolean inludeIncome) { } + public String getRaphael() { + try { + return _scriptLoader.getGraphLib(true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public String getJslib() { + try { + return _scriptLoader.getJsLib(true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public String getBarChartBase() { + try { + return _scriptLoader.getScript(BaseReport.BAR_CHART_BASE, true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public String getLineChartBase() { + try { + return _scriptLoader.getScript(BaseReport.LINE_CHART_BASE, true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public String getLineChartBaseSingle() { + try { + return _scriptLoader.getScript(BaseReport.LINE_CHART_BASE_SINGLE, true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public String getPieChartBase() { + try { + return _scriptLoader.getScript(BaseReport.PIE_CHART_BASE, true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public String getBarChartOne() { + try { + return _scriptLoader.getScript(BaseReport.BAR_CHART_1, true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public String getLineChartOne() { + try { + return _scriptLoader.getScript(BaseReport.LINE_CHART_1, true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public String getLineChartSingleOne() { + try { + return _scriptLoader.getScript(BaseReport.LINE_CHART_SINGLE_1, true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public String getPieChartOne() { + try { + return _scriptLoader.getScript(BaseReport.PIE_CHART_1, true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public String getPieChartTwo() { + try { + return _scriptLoader.getScript(BaseReport.PIE_CHART_2, true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + public ScriptLoader get_scriptLoader() { + return _scriptLoader; + } + + public void set_scriptLoader(ScriptLoader _scriptLoader) { + this._scriptLoader = _scriptLoader; + } + + public String getStyles() { + try { + return _scriptLoader.getScript(BaseReport.REPORT_CSS, true); + } catch (IOException e) { + InfinityPfm.LogMessage(e.getMessage()); + } + return null; + } + + + +/** + * From: https://stackoverflow.com/questions/3548733/how-do-i-convert-from-list-to-listt-in-java-using-generics + * + * @param + * @param + * @param from + * @param to + * @param listClass + * @return + */ + private > C typesafeAdd(Iterable from, C to, Class listClass) { + for (Object item: from) { + to.add(listClass.cast(item)); + } + return to; + } + + /** + * This method creates separate lists for income and account data and + * stores them in reportDataIncome and reportDataExpense + */ + private void populateIncomeAndExpenseLists() { + + ListlistMB = new ArrayList(); + listMB = typesafeAdd(this.reportData, listMB, MonthlyBalance.class); + + reportDataIncome = listMB.stream().filter(mb -> mb.getActTypeName().equalsIgnoreCase("income")) + .collect(Collectors.toList()); + + reportDataExpense = listMB.stream().filter(mb -> mb.getActTypeName().equalsIgnoreCase("expense")) + .collect(Collectors.toList()); + + } + + /** + * Takes a currency value represented as long and returns formatted number. + * If formatter class is null then original value is returned. + * @param value + * @return + */ + private String formatLongString(String value) { + + if (dateUtil != null && value != null) + return dateUtil.getAmountFormatted(Long.parseLong(value)*-1); + else + return value; + } + + + /* Header translations */ + + public String getWordIncome() { + return MM.PHRASES.getPhrase("118"); + } + + public String getWordIncomeTotal() { + return MM.PHRASES.getPhrase("262"); + } + + public String getWordExpenses() { + return MM.PHRASES.getPhrase("94"); + } + + public String getWordExpenseTotal() { + return MM.PHRASES.getPhrase("263"); + } + + public String getWordLiabilityTotal() { + return MM.PHRASES.getPhrase("264"); + } + + public String getWordYearMonth() { + return MM.PHRASES.getPhrase("265"); + } + + public String getWordAccountBalance() { + return MM.PHRASES.getPhrase("266"); + } + public String getWordExpenseBalance() { + return MM.PHRASES.getPhrase("267"); + } + public String getWordBudgetBalance() { + return MM.PHRASES.getPhrase("268"); + } + public String getWordBudgetName() { + return MM.PHRASES.getPhrase("269"); + } + public String getWordIncomeBalance() { + return MM.PHRASES.getPhrase("270"); + } + public String getWordLiabilityBalance() { + return MM.PHRASES.getPhrase("271"); + } + public String getWordAccountType() { + return MM.PHRASES.getPhrase("272"); + } + public String getWordAccountName() { + return MM.PHRASES.getPhrase("93"); + } } + diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/ImageMap.java b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/ImageMap.java index cbf3c5d..dcb4d58 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/ImageMap.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/ImageMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * Copyright (c) 2005-2019 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -19,6 +19,10 @@ package org.infinitypfm.graphics; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; @@ -48,7 +52,28 @@ public Image getImage(String sName) throws SWTException { return new Image(shMain.getDisplay(), item); } + + /** + * Get image from file system + * + * @param file + * @return + * @throws FileNotFoundException + */ + public Image getTransparentImage(File file) throws FileNotFoundException { + InputStream stream = new FileInputStream(file); + ImageData item = new ImageData(stream); + int whitePixel = item.palette.getPixel(new RGB(255, 255, 255)); + item.transparentPixel = whitePixel; + return new Image(shMain.getDisplay(), item); + } + /** + * Get image from classpath + * + * @param sName + * @return + */ public Image getTransparentImage(String sName) { ImageData item = getImageData(sName); int whitePixel = item.palette.getPixel(new RGB(255, 255, 255)); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/bsv.png b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/bsv.png new file mode 100644 index 0000000..378765a Binary files /dev/null and b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/bsv.png differ diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/infinityLogo_128x128.png b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/infinityLogo_128x128.png new file mode 100644 index 0000000..59827c6 Binary files /dev/null and b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/infinityLogo_128x128.png differ diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/infinityLogo_48x48.png b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/infinityLogo_48x48.png new file mode 100644 index 0000000..374197e Binary files /dev/null and b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/infinityLogo_48x48.png differ diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/qrTstImg.png b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/qrTstImg.png new file mode 100644 index 0000000..3ede901 Binary files /dev/null and b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/qrTstImg.png differ diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/refresh.png b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/refresh.png new file mode 100644 index 0000000..49185d5 Binary files /dev/null and b/infinitypfm-ui/src/main/java/org/infinitypfm/graphics/refresh.png differ diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/AccountHistory.ftl b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/AccountHistory.ftl new file mode 100644 index 0000000..d5d2e64 --- /dev/null +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/AccountHistory.ftl @@ -0,0 +1,55 @@ + + + +

${title}

+ + + + + + + + + + + + +

${account}

+ + + <#list reportData as row> + + + + + +
${row.yrString}-${row.mth}${row.actBalanceFmt}
+ + +
+ + + + + + <#list reportData as row> + + + + + + +
${wordYearMonth}${wordAccountBalance} (${reportData[0].isoCode})
${row.yrString}-${row.mth}${row.actBalanceFmt}
+
+ + \ No newline at end of file diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/AccountHistory.java b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/AccountHistory.java index 2ef437a..186b45a 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/AccountHistory.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/AccountHistory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -90,7 +90,7 @@ public File execute(ReportData reportData) { this.endTableData(); - this.Close(); + this.Close(true); } catch (IOException ioe) { } return this.getOutFile(); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BaseReport.java b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BaseReport.java index 48b40dd..972d6aa 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BaseReport.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BaseReport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -37,7 +37,6 @@ public abstract class BaseReport { public static final String CHART_TYPE_LINE = "line"; private File outFile = null; - //private FileWriter fileWriter = null; private BufferedWriter out = null; private static final String FILE_HEADER_START = ""; private static final String FILE_HEADER_END = ""; @@ -45,40 +44,39 @@ public abstract class BaseReport { private static final String TABLE_HEADER_END = ""; private static final String FILE_FOOTER = ""; - private static final String PIE_CHART_BASE = "piechartBase.js"; - private static final String PIE_CHART_1 ="piechart1.js"; - private static final String PIE_CHART_2 ="piechart2.js"; - private static final String BAR_CHART_BASE = "barChartBase.js"; - private static final String BAR_CHART_1 = "barchart1.js"; - private static final String LINE_CHART_1 = "linechart1.js"; - private static final String LINE_CHART_BASE = "linechartBase.js"; - + public static final String PIE_CHART_BASE = "piechartBase.js"; + public static final String PIE_CHART_1 ="piechart1.js"; + public static final String PIE_CHART_2 ="piechart2.js"; + public static final String BAR_CHART_BASE = "barChartBase.js"; + public static final String BAR_CHART_1 = "barchart1.js"; + public static final String LINE_CHART_1 = "linechart1.js"; + public static final String LINE_CHART_SINGLE_1 = "linechartSingle1.js"; + public static final String LINE_CHART_BASE = "linechartBase.js"; + public static final String LINE_CHART_BASE_SINGLE = "linechartBaseSingle.js"; + public static final String REPORT_CSS = "reports.css"; private ScriptLoader scriptLoader = null; protected HashMap reportParams = null; protected HashMap rowColors = null; protected DataFormatUtil formatter = null; - - public BaseReport() throws IOException { - -// try { - - formatter = new DataFormatUtil(MM.options.getCurrencyPrecision()); - outFile = File.createTempFile("infinitypfm", ".html"); - out = new BufferedWriter(new FileWriter(outFile)); - scriptLoader = new ScriptLoader(); - reportParams = new HashMap(); - -// MM.LogMessage(outFile.getPath()); -// } catch (IOException e) { -// MM.LogMessage(e.getMessage()); -// } - + public BaseReport() throws IOException { + formatter = new DataFormatUtil(MM.options.getCurrencyPrecision()); + outFile = File.createTempFile("infinitypfm", ".html"); + out = new BufferedWriter(new FileWriter(outFile)); + scriptLoader = new ScriptLoader(); + reportParams = new HashMap(); } - + public abstract File execute(ReportData reportData); + /** + * Write needed chart libraries to file. + * + * @param numCharts count of charts in report + * @param chartType type of charts in the report + * @throws IOException + */ public void addDocHeader(int numCharts, String chartType) throws IOException{ out.write(FILE_HEADER_START); if (numCharts > 0){ @@ -86,23 +84,32 @@ public void addDocHeader(int numCharts, String chartType) throws IOException{ out.write(scriptLoader.getJsLib()); if (chartType.equalsIgnoreCase(CHART_TYPE_PIE)){ - out.write(scriptLoader.getScript(PIE_CHART_BASE)); + out.write(scriptLoader.getScript(PIE_CHART_BASE, false)); if (numCharts == 2) { - out.write(scriptLoader.getScript(PIE_CHART_2)); + out.write(scriptLoader.getScript(PIE_CHART_2, false)); } else { - out.write(scriptLoader.getScript(PIE_CHART_1)); + out.write(scriptLoader.getScript(PIE_CHART_1, false)); } } else if (chartType.equalsIgnoreCase(CHART_TYPE_BAR)){ - out.write(scriptLoader.getScript(BAR_CHART_BASE)); - out.write(scriptLoader.getScript(BAR_CHART_1)); + out.write(scriptLoader.getScript(BAR_CHART_BASE, false)); + out.write(scriptLoader.getScript(BAR_CHART_1, false)); } else if (chartType.equalsIgnoreCase(CHART_TYPE_LINE)){ - out.write(scriptLoader.getScript(LINE_CHART_BASE)); - out.write(scriptLoader.getScript(LINE_CHART_1)); + out.write(scriptLoader.getScript(LINE_CHART_BASE, false)); + out.write(scriptLoader.getScript(LINE_CHART_1, false)); } } out.write(FILE_HEADER_END); } + /** + * Add necessary script libraries to the report object + * + * @param data + */ + public void addDocHeader(ReportData data) { + data.set_scriptLoader(scriptLoader); + } + public void addChartTestData() throws IOException{ out.write(scriptLoader.getFileAsString("testTable.html")); } @@ -206,12 +213,14 @@ public void addTotal(int val) throws IOException{ out.write("" + val + ""); } - public void Close() throws IOException { - out.write(FILE_FOOTER); + public void Close(boolean writeFooter) throws IOException { + + if (writeFooter) { + out.write(FILE_FOOTER); + } try {out.close();} catch (Exception e1){} - //MM.LogMessage("file close"); } - + public File getOutFile() { return outFile; } @@ -227,5 +236,13 @@ public void addParam(String name, String val){ reportParams.put(name, val); } - + + /** + * Used for template results + * @return BufferedWriter to results file + */ + public BufferedWriter getOutBuffer() { + return out; + } + } diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BudgetPerformance.ftl b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BudgetPerformance.ftl new file mode 100644 index 0000000..e8c930b --- /dev/null +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BudgetPerformance.ftl @@ -0,0 +1,62 @@ + + + +

${title}

+ + + + + + + + + + + + +

Using Budget: ${reportData[0].budgetName}

+ + + + <#list reportData as row> + + + + + + +
${row.yrString}-${row.mth}${row.expenseBalanceFmt!0}${row.budgetBalanceFmt!0}
+ + + +
+ + + + + + + + <#list reportData as row> + + + + + + + + +
${wordYearMonth}${wordExpenseBalance}${wordBudgetBalance}${wordBudgetName}
${row.yrString}-${row.mth}${row.expenseBalanceFmt!0}${row.budgetBalanceFmt!0}${row.budgetName}
+
+ + \ No newline at end of file diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BudgetPerformance.java b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BudgetPerformance.java index f256f9e..8d2b32e 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BudgetPerformance.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/BudgetPerformance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -91,7 +91,7 @@ public File execute(ReportData reportData) { this.endTableData(); - this.Close(); + this.Close(true); } catch (IOException ioe) { } return this.getOutFile(); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ChartRow.java b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ChartRow.java new file mode 100644 index 0000000..18e4048 --- /dev/null +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ChartRow.java @@ -0,0 +1,19 @@ +package org.infinitypfm.reporting; + +public class ChartRow { + + private String xlabel; + private String xval; + public String getXlabel() { + return xlabel; + } + public void setXlabel(String xlabel) { + this.xlabel = xlabel; + } + public String getXval() { + return xval; + } + public void setXval(String xval) { + this.xval = xval; + } +} diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/GridReport.java b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/GridReport.java index 28afac6..8aa2f93 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/GridReport.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/GridReport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -121,7 +121,7 @@ public File execute(ReportData reportData) { this.endTableData(); - this.Close(); + this.Close(true); } catch (IOException ioe){} return this.getOutFile(); } diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/IncomeVsExpense.java b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/IncomeVsExpense.java index d8178bf..b770f5a 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/IncomeVsExpense.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/IncomeVsExpense.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -81,7 +81,7 @@ public File execute(ReportData reportData) { this.endTableData(); - this.Close(); + this.Close(true); } catch (IOException ioe) { diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/IncomveVsExpense.ftl b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/IncomveVsExpense.ftl new file mode 100644 index 0000000..8a8f348 --- /dev/null +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/IncomveVsExpense.ftl @@ -0,0 +1,68 @@ + + + +

${title}

+ + + + + + + + + + + + +

+ + + + <#list reportData as row> + + + + + + +
${row.yrString}-${row.mth}${row.incomeBalanceFmt!0} + <#if row.liabilityPlusExpenseBalance lt 0> + 0 + <#else> + ${row.liabilityPlusExpenseBalanceFmt!0} + +
+ + + +
+ + + + + + + + <#list reportData as row> + + + + + + + + +
${wordYearMonth}${wordIncomeBalance}${wordLiabilityBalance}${wordExpenseBalance}
${row.yrString}-${row.mth}${row.incomeBalanceFmt!0}${row.liabilityBalanceFmt!0}${row.expenseBalanceFmt!0}
+
+ + \ No newline at end of file diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/MonthlyBalances.ftl b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/MonthlyBalances.ftl new file mode 100644 index 0000000..6d059dc --- /dev/null +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/MonthlyBalances.ftl @@ -0,0 +1,97 @@ + + + +

${title}

+ + + + + + + + + + + + +
+ ${wordIncomeTotal}: + ${incomeTotal!"0"} +
+ +
+ ${wordExpenseTotal}: + ${expenseTotal!"0"} +
+
+ ${wordLiabilityTotal}: + ${liabilityTotal!"0"} +
+ +
+ + <#list reportDataIncome as row> + + + + + + +
${row.actName} + <#if ((row.actBalance / incomeTotalRaw)*100) gte 99 > + 99 + <#elseif ((row.actBalance / incomeTotalRaw)*100) lt 1 > + 1 + <#else> + ${(row.actBalance / incomeTotalRaw)*100} + +
+ + + + <#list reportDataExpense as row> + + + + + + +
${row.actName}${(row.actBalance / expenseTotalRaw)*100}
+ + + + + + +
+
+ + + + + + + + <#list reportData as row> + + + + + + + + +
${wordYearMonth}${wordAccountType}${wordAccountName}${wordAccountBalance} (${reportData[0].isoCode})
${row.yrString}-${row.mth}${row.actTypeName}${row.actName}${row.actBalanceFmt}
+
+ + \ No newline at end of file diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ReportFactory.java b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ReportFactory.java index d8f3112..e066980 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ReportFactory.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ReportFactory.java @@ -31,36 +31,19 @@ public static BaseReport getReport(int reportType) { try { + //TODO: Can remove this case statement. + switch (reportType) { - case MM.THIS_MONTH: - - report = new GridReport(); - - break; + case MM.THIS_MONTH: case MM.LAST_MONTH: - - report = new GridReport(); - - break; case MM.MENU_REPORTS_ACCOUNT_HISTORY: - - report = new AccountHistory(); - - break; + case MM.MENU_REPORTS_ACCOUNT_HISTORY_ALL_TIME: case MM.MENU_REPORTS_BUDGET_PERFORMANCE: - - report = new BudgetPerformance(); - - break; case MM.MENU_REPORTS_BUDGET_PERFORMANCE_ACT: - - report = new BudgetPerformance(); - - break; case MM.MENU_REPORTS_INCOME_VS_EXPENSE: - report = new IncomeVsExpense(); + report = new TemplateReport(); break; } diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ReportRow.java b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ReportRow.java new file mode 100644 index 0000000..49163c3 --- /dev/null +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ReportRow.java @@ -0,0 +1,145 @@ +package org.infinitypfm.reporting; + +public class ReportRow { + + private String val1; + private String val2; + private String val3; + private String val4; + private String val5; + private String val6; + private String val7; + private String val8; + private String val9; + private String val10; + private String val11; + private String val12; + private String val13; + private String val14; + private String val15; + private String val16; + private String val17; + private String val18; + private String val19; + private String val20; + public String getVal1() { + return val1; + } + public void setVal1(String val1) { + this.val1 = val1; + } + public String getVal2() { + return val2; + } + public void setVal2(String val2) { + this.val2 = val2; + } + public String getVal3() { + return val3; + } + public void setVal3(String val3) { + this.val3 = val3; + } + public String getVal4() { + return val4; + } + public void setVal4(String val4) { + this.val4 = val4; + } + public String getVal5() { + return val5; + } + public void setVal5(String val5) { + this.val5 = val5; + } + public String getVal6() { + return val6; + } + public void setVal6(String val6) { + this.val6 = val6; + } + public String getVal7() { + return val7; + } + public void setVal7(String val7) { + this.val7 = val7; + } + public String getVal8() { + return val8; + } + public void setVal8(String val8) { + this.val8 = val8; + } + public String getVal9() { + return val9; + } + public void setVal9(String val9) { + this.val9 = val9; + } + public String getVal10() { + return val10; + } + public void setVal10(String val10) { + this.val10 = val10; + } + public String getVal11() { + return val11; + } + public void setVal11(String val11) { + this.val11 = val11; + } + public String getVal12() { + return val12; + } + public void setVal12(String val12) { + this.val12 = val12; + } + public String getVal13() { + return val13; + } + public void setVal13(String val13) { + this.val13 = val13; + } + public String getVal14() { + return val14; + } + public void setVal14(String val14) { + this.val14 = val14; + } + public String getVal15() { + return val15; + } + public void setVal15(String val15) { + this.val15 = val15; + } + public String getVal16() { + return val16; + } + public void setVal16(String val16) { + this.val16 = val16; + } + public String getVal17() { + return val17; + } + public void setVal17(String val17) { + this.val17 = val17; + } + public String getVal18() { + return val18; + } + public void setVal18(String val18) { + this.val18 = val18; + } + public String getVal19() { + return val19; + } + public void setVal19(String val19) { + this.val19 = val19; + } + public String getVal20() { + return val20; + } + public void setVal20(String val20) { + this.val20 = val20; + } +} diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ScriptLoader.java b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ScriptLoader.java index 30fa6d3..6b8b057 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ScriptLoader.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/ScriptLoader.java @@ -28,18 +28,38 @@ public class ScriptLoader { private String GRAPH_LIB = "raphael-min.js"; public String getGraphLib() throws IOException { - return getScript(GRAPH_LIB); + return this.getGraphLib(false); + } + + public String getGraphLib(boolean noWrap) throws IOException { + return getScript(GRAPH_LIB, noWrap); } public String getJsLib() throws IOException{ - return getScript(JS_LIB); + return getJsLib(false); + } + + public String getJsLib(boolean noWrap) throws IOException{ + return getScript(JS_LIB, noWrap); } - public String getScript(String fileName) throws IOException { + /** + * Reads a script file from disk and returns as a string. + * Pass false if script tag wrappers aren't needed. + * @param fileName name of the file to load + * @param noWrap flag to trigger script wrappers + * @return string of file contents + * @throws IOException + */ + public String getScript(String fileName, boolean noWrap) throws IOException { - return "\n\n"; + if (noWrap) { + return readFileAsString("" + fileName); + } else { + return "\n\n"; + } } diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/TemplateReport.java b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/TemplateReport.java new file mode 100644 index 0000000..f01a758 --- /dev/null +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/reporting/TemplateReport.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2005-2020 Wayne Gray All rights reserved + * + * This file is part of Infinity PFM. + * + * Infinity PFM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Infinity PFM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Infinity PFM. If not, see . + */ +package org.infinitypfm.reporting; + +import java.io.File; +import java.io.IOException; + +import org.infinitypfm.client.InfinityPfm; +import org.infinitypfm.conf.MM; +import org.infinitypfm.data.ReportData; + +import freemarker.template.Template; + +public class TemplateReport extends BaseReport { + + public TemplateReport() throws IOException { + super(); + } + + @Override + public File execute(ReportData reportData) { + + try { + + Template temp = MM.templateConfig.getTemplate(reportData.getTemplate()); + this.addDocHeader(reportData); + temp.process(reportData, this.getOutBuffer()); + + } catch (Exception e) { + InfinityPfm.LogMessage(e.getMessage(), true); + } finally { + try { + this.Close(false);} catch (IOException e) {} + } + + return this.getOutFile(); + } +} diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/MainFrame.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/MainFrame.java index 733d861..2708a6a 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/MainFrame.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/MainFrame.java @@ -68,7 +68,7 @@ public void LoadUI(boolean bUseIcons) { InfinityPfm.shMain.setText(MM.APPTITLE + " - " + MM.PHRASES.getPhrase("63")); InfinityPfm.shMain.setImage(InfinityPfm.imMain - .getImage(MM.IMG_QUEZEN_ICON)); + .getImage(MM.IMG_LOGO_ICON)); /* * Load Status Box diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/AboutDialog.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/AboutDialog.java index 87b9a47..c43a489 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/AboutDialog.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/AboutDialog.java @@ -58,6 +58,7 @@ public class AboutDialog extends BaseDialog { private Label lblUsedBy2 = null; private Label lblUsedBy3 = null; private Label lblUsedBy4 = null; + private Label lblUsedBy5 = null; private Label lblCopyRight = null; private Label lblLic = null; private Image banner = null; @@ -96,6 +97,7 @@ protected void LoadUI(Shell sh) { lblUsedBy2 = new Label(grpBotBorder, SWT.NONE); lblUsedBy3 = new Label(grpBotBorder, SWT.NONE); lblUsedBy4 = new Label(grpBotBorder, SWT.NONE); + lblUsedBy5 = new Label(grpBotBorder, SWT.NONE); lblCopyRight = new Label(grpBotBorder, SWT.NONE); lblLic = new Label(grpBotBorder, SWT.NONE); @@ -112,6 +114,7 @@ protected void LoadUI(Shell sh) { lblUsedBy2.setText(MM.PHRASES.getPhrase("74")); lblUsedBy3.setText(MM.PHRASES.getPhrase("124")); lblUsedBy4.setText(MM.PHRASES.getPhrase("248")); + lblUsedBy5.setText(MM.PHRASES.getPhrase("274")); lblCopyRight.setText(MM.APPCOPYRIGHT); lblCopyRight.setAlignment(SWT.CENTER); lblLic.setText(MM.APPLICENCE); @@ -189,6 +192,11 @@ protected void LoadLayout() { lblusedby4data.left = new FormAttachment(0, 20); lblUsedBy4.setLayoutData(lblusedby4data); + FormData lblusedby5data = new FormData(); + lblusedby5data.top = new FormAttachment(lblUsedBy4, 3); + lblusedby5data.left = new FormAttachment(0, 20); + lblUsedBy5.setLayoutData(lblusedby5data); + FormData lbllicdata = new FormData(); lbllicdata.top = new FormAttachment(70, 10); lbllicdata.left = new FormAttachment(0, 0); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/DateDialog.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/DateDialog.java index 3b6b7d4..98af95a 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/DateDialog.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/DateDialog.java @@ -74,7 +74,7 @@ protected void LoadLayout() { FormData okdata = new FormData(); okdata.top = new FormAttachment(100, -40); - okdata.left = new FormAttachment(100,-50); + okdata.left = new FormAttachment(100,-70); okdata.right = new FormAttachment(100, -20); ok.setLayoutData(okdata); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/InfoDialog.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/InfoDialog.java index 59c7202..67692c4 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/InfoDialog.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/InfoDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2013 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -32,7 +32,7 @@ import org.infinitypfm.conf.MM; /** - * @author wggray + * @author wgray */ public class InfoDialog extends BaseDialog { @@ -53,7 +53,7 @@ public int Open() { super.Open(); shell.setText(sDTitle); - shell.setSize(400, 200); + shell.setSize(400, 175); this.CenterWindow(); shell.open(); Display display = parent.getDisplay(); @@ -100,30 +100,29 @@ protected void LoadUI(Shell sh) { protected void LoadLayout() { FormData lblinfodata = new FormData(); - lblinfodata.top = new FormAttachment(30, 0); + lblinfodata.top = new FormAttachment(15, 0); lblinfodata.left = new FormAttachment(10, 0); lblinfodata.right = new FormAttachment(90, 0); - lblinfodata.bottom = new FormAttachment(40, 0); lblInfo.setLayoutData(lblinfodata); + FormData txtinfodata = new FormData(); + txtinfodata.top = new FormAttachment(lblInfo, 10); + txtinfodata.left = new FormAttachment(10, 0); + txtinfodata.right = new FormAttachment(90, 0); + txtInfo.setLayoutData(txtinfodata); + FormData cmdonedata = new FormData(); - cmdonedata.top = new FormAttachment(80, 0); - cmdonedata.left = new FormAttachment(30, 0); + cmdonedata.top = new FormAttachment(65, 0); + cmdonedata.left = new FormAttachment(25, 0); cmdonedata.right = new FormAttachment(50, 0); cmdOne.setLayoutData(cmdonedata); FormData cmdtwodata = new FormData(); - cmdtwodata.top = new FormAttachment(80, 0); + cmdtwodata.top = new FormAttachment(65, 0); cmdtwodata.left = new FormAttachment(cmdOne, 10); cmdtwodata.right = new FormAttachment(70, 10); cmdTwo.setLayoutData(cmdtwodata); - FormData txtinfodata = new FormData(); - txtinfodata.top = new FormAttachment(lblInfo, 30); - txtinfodata.left = new FormAttachment(10, 0); - txtinfodata.right = new FormAttachment(80, 0); - txtInfo.setLayoutData(txtinfodata); - } /* diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/MessageDialog.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/MessageDialog.java index ebae935..ba153c6 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/MessageDialog.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/MessageDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2019 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -21,14 +21,19 @@ import org.eclipse.swt.SWT; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; +import org.infinitypfm.client.InfinityPfm; import org.infinitypfm.conf.MM; public class MessageDialog extends BaseDialog { @@ -39,6 +44,10 @@ public class MessageDialog extends BaseDialog { private int iReturn = MM.CANCEL; private int width = 400; private int height = 175; + private Image imgContext = null; + private Canvas cvContext = null; + private String sImage = null; + //private Color color = null; /* * Widgets @@ -62,6 +71,13 @@ public int Open() { return iReturn; } + + public int Open (int w, int h, String image) { + width = w; + height = h; + sImage = image; + return iReturn; + } public MessageDialog(int iType, String sTitle, String sMsg) { super(); @@ -76,6 +92,10 @@ public void setDimensions(int w, int h){ height = h; } + public void setImage(String image) { + sImage = image; + } + protected void LoadUI(Shell sh) { lblMsg = new Label(sh, SWT.WRAP); lblMsg.setText(sDMsg); @@ -92,24 +112,47 @@ protected void LoadUI(Shell sh) { cmdOne.setVisible(false); cmdTwo.setText(MM.PHRASES.getPhrase("5")); cmdThree.setVisible(false); + + if (sImage == null) + imgContext = InfinityPfm.imMain.getTransparentImage(MM.IMG_MESSAGE_DEFAULT); + } else { cmdOne.setVisible(true); cmdTwo.setText(MM.PHRASES.getPhrase("13")); cmdThree.setVisible(true); + + if (sImage == null) + imgContext = InfinityPfm.imMain.getTransparentImage(MM.IMG_HELP); } + + if (sImage != null) + imgContext = InfinityPfm.imMain.getTransparentImage(sImage); + + cvContext = new Canvas(sh, SWT.NONE); + //color = new Color(InfinityPfm.shMain.getDisplay(), 255,255,255); + //cvContext.setBackground(color); + cvContext.addPaintListener(logo_OnPaint); } protected void LoadLayout() { + + FormData cvcontextdata = new FormData(); + cvcontextdata.top = new FormAttachment(25, 0); + cvcontextdata.left = new FormAttachment(10, 0); + cvcontextdata.right = new FormAttachment(10,20); + cvcontextdata.bottom = new FormAttachment(25,30); + cvContext.setLayoutData(cvcontextdata); + FormData lblmsgdata = new FormData(); lblmsgdata.top = new FormAttachment(25,0); - lblmsgdata.left = new FormAttachment(10,0); + lblmsgdata.left = new FormAttachment(cvContext,5); lblmsgdata.right = new FormAttachment(90,0); lblmsgdata.bottom = new FormAttachment(100,-50); lblMsg.setLayoutData(lblmsgdata); - + FormData cmdonedata = new FormData(); - cmdonedata.top = new FormAttachment(100, -40); + cmdonedata.top = new FormAttachment(100, -45); cmdonedata.left = new FormAttachment(20,0); cmdonedata.right = new FormAttachment(40,0); cmdOne.setLayoutData(cmdonedata); @@ -117,17 +160,17 @@ protected void LoadLayout() { if (iDType == MM.DIALOG_QUESTION){ FormData cmdtwodata = new FormData(); - cmdtwodata.top = new FormAttachment(100, -40); + cmdtwodata.top = new FormAttachment(100, -45); cmdtwodata.left = new FormAttachment(cmdOne, 10); cmdtwodata.right = new FormAttachment(60,10); cmdTwo.setLayoutData(cmdtwodata); FormData cmdthreedata = new FormData(); - cmdthreedata.top = new FormAttachment(100, -40); + cmdthreedata.top = new FormAttachment(100, -45); cmdthreedata.left = new FormAttachment(cmdTwo, 10); cmdthreedata.right = new FormAttachment(80,10); cmdThree.setLayoutData(cmdthreedata); - + } else { FormData cmdtwodata = new FormData(); @@ -142,6 +185,7 @@ protected void LoadLayout() { cmdthreedata.right = new FormAttachment(70,10); cmdThree.setLayoutData(cmdthreedata); } + } /* @@ -167,6 +211,10 @@ public void widgetSelected(SelectionEvent e){ shell.dispose(); } }; - - + + PaintListener logo_OnPaint = new PaintListener() { + public void paintControl(PaintEvent e) { + e.gc.drawImage(imgContext,0,0); + } + }; } diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/MonthYearDialog.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/MonthYearDialog.java index 14d1865..49f1b86 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/MonthYearDialog.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/MonthYearDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -95,12 +95,12 @@ protected void LoadUI(Shell sh) { protected void LoadLayout() { FormData lblmonthdata = new FormData(); - lblmonthdata.top = new FormAttachment(0, 40); + lblmonthdata.top = new FormAttachment(0, 35); lblmonthdata.left = new FormAttachment(20, 0); lblMonth.setLayoutData(lblmonthdata); FormData cmbmonthdata = new FormData(); - cmbmonthdata.top = new FormAttachment(0, 40); + cmbmonthdata.top = new FormAttachment(0, 35); cmbmonthdata.left = new FormAttachment(lblMonth, 30); cmbMonth.setLayoutData(cmbmonthdata); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/NewAccountDialog.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/NewAccountDialog.java index a22492b..3389455 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/NewAccountDialog.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/NewAccountDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -167,18 +167,18 @@ protected void LoadLayout() { txtActName.setLayoutData(txtactnamedata); FormData lblactiddata = new FormData(); - lblactiddata.top = new FormAttachment(lblActName, 10); + lblactiddata.top = new FormAttachment(lblActName, 25); lblactiddata.left = new FormAttachment(0, 40); lblActId.setLayoutData(lblactiddata); FormData txtactiddata = new FormData(); - txtactiddata.top = new FormAttachment(lblActName, 10); + txtactiddata.top = new FormAttachment(lblActName, 25); txtactiddata.left = new FormAttachment(lblActName, 80); txtactiddata.right = new FormAttachment(100, -120); txtActId.setLayoutData(txtactiddata); FormData lblacttypedata = new FormData(); - lblacttypedata.top = new FormAttachment(lblActId, 30); + lblacttypedata.top = new FormAttachment(lblActId, 35); lblacttypedata.left = new FormAttachment(0, 40); lblActType.setLayoutData(lblacttypedata); @@ -188,36 +188,36 @@ protected void LoadLayout() { cmbActType.setLayoutData(txtacttypedata); FormData lblbeginbalancedata = new FormData(); - lblbeginbalancedata.top = new FormAttachment(lblActType, 20); + lblbeginbalancedata.top = new FormAttachment(lblActType, 25); lblbeginbalancedata.left = new FormAttachment(0, 40); lblBeginBalance.setLayoutData(lblbeginbalancedata); FormData txtbeginbalancedata = new FormData(); - txtbeginbalancedata.top = new FormAttachment(lblActType, 20); + txtbeginbalancedata.top = new FormAttachment(lblActType, 25); txtbeginbalancedata.left = new FormAttachment(lblActName, 80); txtbeginbalancedata.right = new FormAttachment(100, -200); txtBeginBalance.setLayoutData(txtbeginbalancedata); FormData lblcurrencydata = new FormData(); - lblcurrencydata.top = new FormAttachment(lblBeginBalance, 20); + lblcurrencydata.top = new FormAttachment(lblBeginBalance, 25); lblcurrencydata.left = new FormAttachment(0, 40); // lblcurrencydata.right = new FormAttachment(100, -200); lblCurrency.setLayoutData(lblcurrencydata); FormData cmbcurrencydata = new FormData(); - cmbcurrencydata.top = new FormAttachment(lblBeginBalance, 20); + cmbcurrencydata.top = new FormAttachment(lblBeginBalance, 25); cmbcurrencydata.left = new FormAttachment(lblActName, 80); cmbcurrencydata.right = new FormAttachment(100, -260); cmbCurrency.setLayoutData(cmbcurrencydata); FormData cmdsavedata = new FormData(); - cmdsavedata.top = new FormAttachment(cmbCurrency, 30); + cmdsavedata.top = new FormAttachment(cmbCurrency, 20); cmdsavedata.left = new FormAttachment(0, 95); cmdsavedata.right = new FormAttachment(100, -255); cmdSave.setLayoutData(cmdsavedata); FormData cmdcanceldata = new FormData(); - cmdcanceldata.top = new FormAttachment(cmbCurrency, 30); + cmdcanceldata.top = new FormAttachment(cmbCurrency, 20); cmdcanceldata.left = new FormAttachment(cmdSave, 5); cmdcanceldata.right = new FormAttachment(100, -115); cmdCancel.setLayoutData(cmdcanceldata); @@ -229,7 +229,7 @@ public int Open() { super.Open(); shell.setText(MM.PHRASES.getPhrase("82") + " " + MM.APPTITLE); - shell.setSize(500, 300); + shell.setSize(500, 350); this.CenterWindow(); shell.open(); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/PasswordDialog.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/PasswordDialog.java index d0485b3..c502bd7 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/PasswordDialog.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/PasswordDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2019 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -45,19 +45,27 @@ public class PasswordDialog extends BaseDialog { private String user = null; private String password = null; + private boolean bDisplayUser = true; + + public PasswordDialog() {} + + public PasswordDialog(boolean passwordOnly) { + bDisplayUser = passwordOnly; + } @Override protected void LoadUI(Shell sh) { - lblUser = new Label(sh, SWT.WRAP); - lblUser.setText(MM.PHRASES.getPhrase("80")); + if (bDisplayUser) { + lblUser = new Label(sh, SWT.WRAP); + lblUser.setText(MM.PHRASES.getPhrase("80")); + txtUser = new Text(sh, SWT.BORDER); + txtUser.setFocus(); + } lblPwd = new Label(sh, SWT.WRAP); lblPwd.setText(MM.PHRASES.getPhrase("81")); - txtUser = new Text(sh, SWT.BORDER); - txtUser.setFocus(); - txtPwd = new Text(sh, SWT.BORDER); txtPwd.setEchoChar('*'); @@ -69,7 +77,6 @@ protected void LoadUI(Shell sh) { cmdOk.addSelectionListener(cmdOk_OnClick); cmdOk.setText(MM.PHRASES.getPhrase("5")); - this.CenterWindow(); } @@ -77,33 +84,41 @@ protected void LoadUI(Shell sh) { @Override protected void LoadLayout() { - FormData lbluserdata = new FormData(); - lbluserdata.top = new FormAttachment(30,0); - lbluserdata.left = new FormAttachment(10,0); - //lbluserdata.right = new FormAttachment(90,0); - //lbluserdata.bottom = new FormAttachment(40,0); - lblUser.setLayoutData(lbluserdata); + if (bDisplayUser) { + FormData lbluserdata = new FormData(); + lbluserdata.top = new FormAttachment(20,0); + lbluserdata.left = new FormAttachment(10,0); + lblUser.setLayoutData(lbluserdata); + + FormData txtuserdata = new FormData(); + txtuserdata.top = new FormAttachment(30,0); + txtuserdata.left = new FormAttachment(lblUser,20); + txtuserdata.right = new FormAttachment(90,0); + txtUser.setLayoutData(txtuserdata); + } - FormData txtuserdata = new FormData(); - txtuserdata.top = new FormAttachment(30,0); - txtuserdata.left = new FormAttachment(lblUser,20); - txtuserdata.right = new FormAttachment(90,0); - //txtuserdata.bottom = new FormAttachment(40,0); - txtUser.setLayoutData(txtuserdata); + FormData lblpwddata = new FormData(); + if (bDisplayUser) { + lblpwddata.top = new FormAttachment(txtUser,10); + lblpwddata.left = new FormAttachment(10,0); + } else { + lblpwddata.top = new FormAttachment(20,10); + lblpwddata.left = new FormAttachment(10,0); + } - FormData lblpwddata = new FormData(); - lblpwddata.top = new FormAttachment(txtUser,10); - lblpwddata.left = new FormAttachment(10,0); - //lblpwddata.right = new FormAttachment(90,0); - //lblpwddata.bottom = new FormAttachment(40,0); lblPwd.setLayoutData(lblpwddata); FormData txtpwddata = new FormData(); - txtpwddata.top = new FormAttachment(txtUser,0); - txtpwddata.left = new FormAttachment(lblUser,20); + + if (bDisplayUser) { + txtpwddata.top = new FormAttachment(txtUser,0); + txtpwddata.left = new FormAttachment(lblUser,20); + } else { + txtpwddata.top = new FormAttachment(20,0); + txtpwddata.left = new FormAttachment(lblPwd,5); + } txtpwddata.right = new FormAttachment(90,0); - //txtpwddata.bottom = new FormAttachment(40,0); txtPwd.setLayoutData(txtpwddata); FormData cmdokdata = new FormData(); @@ -152,7 +167,9 @@ public void widgetSelected(SelectionEvent e){ SelectionAdapter cmdOk_OnClick = new SelectionAdapter() { public void widgetSelected(SelectionEvent e){ - user = txtUser.getText(); + if (bDisplayUser) + user = txtUser.getText(); + password = txtPwd.getText(); shell.dispose(); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/TransactionDialog.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/TransactionDialog.java index 06ba5b3..eee25bc 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/TransactionDialog.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/dialogs/TransactionDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2013 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -238,7 +238,7 @@ protected void LoadUI(Shell sh) { protected void LoadLayout() { FormData lblaccountdata = new FormData(); - lblaccountdata.top = new FormAttachment(0, 20); + lblaccountdata.top = new FormAttachment(0, 15); lblaccountdata.left = new FormAttachment(0, 20); lblAccount.setLayoutData(lblaccountdata); @@ -254,38 +254,38 @@ protected void LoadLayout() { txtMemo.setLayoutData(txtmemotdata); FormData lblamountdata = new FormData(); - lblamountdata.top = new FormAttachment(lblMemo, 15); + lblamountdata.top = new FormAttachment(lblMemo, 25); lblamountdata.left = new FormAttachment(0, 30); lblAmount.setLayoutData(lblamountdata); FormData txtamountdata = new FormData(); - txtamountdata.top = new FormAttachment(lblMemo, 15); + txtamountdata.top = new FormAttachment(lblMemo, 25); txtamountdata.left = new FormAttachment(lblMemo, 90); txtamountdata.right = new FormAttachment(100, -150); txtAmount.setLayoutData(txtamountdata); FormData lbldatedata = new FormData(); - lbldatedata.top = new FormAttachment(lblAmount, 15); + lbldatedata.top = new FormAttachment(lblAmount, 25); lbldatedata.left = new FormAttachment(0, 30); lblDate.setLayoutData(lbldatedata); FormData cmbdatedata = new FormData(); - cmbdatedata.top = new FormAttachment(lblAmount, 15); + cmbdatedata.top = new FormAttachment(lblAmount, 25); cmbdatedata.left = new FormAttachment(lblMemo, 90); cmbdatedata.right = new FormAttachment(100, -200); txtDate.setLayoutData(cmbdatedata); FormData cmddatepickerdata = new FormData(); - cmddatepickerdata.top = new FormAttachment(lblAmount, 13); + cmddatepickerdata.top = new FormAttachment(lblAmount, 23); cmddatepickerdata.left = new FormAttachment(txtDate, 0); //cmddatepickerdata.right = new FormAttachment(100, -100); cmdDatePicker.setLayoutData(cmddatepickerdata); FormData cmpoffsetdata = new FormData(); - cmpoffsetdata.top = new FormAttachment(lblDate, 15); + cmpoffsetdata.top = new FormAttachment(lblDate, 40); cmpoffsetdata.left = new FormAttachment(0, 30); cmpoffsetdata.right = new FormAttachment(100, -20); - cmpoffsetdata.bottom = new FormAttachment(100, -60); + cmpoffsetdata.bottom = new FormAttachment(100, -50); cmpOffset.setLayoutData(cmpoffsetdata); FormData lbloffsetdata = new FormData(); @@ -300,57 +300,59 @@ protected void LoadLayout() { cmbOffset.setLayoutData(cmboffsetdata); FormData lbloffsetamountdata = new FormData(); - lbloffsetamountdata.top = new FormAttachment(lblOffset, 10); + lbloffsetamountdata.top = new FormAttachment(lblOffset, 25); lbloffsetamountdata.left = new FormAttachment(0, 10); lblOffsetAmount.setLayoutData(lbloffsetamountdata); FormData txtoffsetdata = new FormData(); - txtoffsetdata.top = new FormAttachment(lblOffset, 10); + txtoffsetdata.top = new FormAttachment(lblOffset, 25); txtoffsetdata.left = new FormAttachment(lblOffset, 10); txtoffsetdata.right = new FormAttachment(100, -200); txtOffset.setLayoutData(txtoffsetdata); FormData lblexratedata = new FormData(); - lblexratedata.top = new FormAttachment(lblOffsetAmount, 10); + lblexratedata.top = new FormAttachment(lblOffsetAmount, 25); lblexratedata.left = new FormAttachment(0, 10); lblExRate.setLayoutData(lblexratedata); FormData txtexratedata = new FormData(); - txtexratedata.top = new FormAttachment(lblOffsetAmount, 10); + txtexratedata.top = new FormAttachment(lblOffsetAmount, 25); txtexratedata.left = new FormAttachment(lblOffset, 10); txtexratedata.right = new FormAttachment(100, -300); txtExRate.setLayoutData(txtexratedata); FormData cmdaddoffsetdata = new FormData(); - cmdaddoffsetdata.top = new FormAttachment(lblOffsetAmount, 10); + cmdaddoffsetdata.top = new FormAttachment(lblOffsetAmount, 25); cmdaddoffsetdata.left = new FormAttachment(txtExRate, 5); cmdAddOffset.setLayoutData(cmdaddoffsetdata); FormData cmdclearoffsetdata = new FormData(); - cmdclearoffsetdata.top = new FormAttachment(lblOffsetAmount, 10); + cmdclearoffsetdata.top = new FormAttachment(lblOffsetAmount, 25); cmdclearoffsetdata.left = new FormAttachment(cmdAddOffset, 5); cmdClearOffset.setLayoutData(cmdclearoffsetdata); FormData cmddeleteoffsetlinedata = new FormData(); - cmddeleteoffsetlinedata.top = new FormAttachment(lblOffsetAmount, 10); + cmddeleteoffsetlinedata.top = new FormAttachment(lblOffsetAmount, 25); cmddeleteoffsetlinedata.left = new FormAttachment(cmdClearOffset, 5); cmdDeleteOffsetLine.setLayoutData(cmddeleteoffsetlinedata); FormData tbloffsetsdata = new FormData(); - tbloffsetsdata.top = new FormAttachment(lblExRate, 20); + tbloffsetsdata.top = new FormAttachment(lblExRate, 35); tbloffsetsdata.left = new FormAttachment(0, 10); tbloffsetsdata.right = new FormAttachment(100, -10); tbloffsetsdata.bottom = new FormAttachment(100, -10); tblOffsets.setLayoutData(tbloffsetsdata); FormData cmdcommitdata = new FormData(); - cmdcommitdata.bottom = new FormAttachment(100, -10); - cmdcommitdata.left = new FormAttachment(40, 0); + cmdcommitdata.bottom = new FormAttachment(100, -5); + cmdcommitdata.left = new FormAttachment(20, 0); + cmdcommitdata.right = new FormAttachment(30, 125); cmdCommit.setLayoutData(cmdcommitdata); FormData cmdclosedata = new FormData(); - cmdclosedata.bottom = new FormAttachment(100, -10); - cmdclosedata.left = new FormAttachment(cmdCommit, 10); + cmdclosedata.bottom = new FormAttachment(100, -5); + cmdclosedata.left = new FormAttachment(cmdCommit, 5); + cmdclosedata.right = new FormAttachment(cmdCommit, 375); cmdClose.setLayoutData(cmdclosedata); } @@ -377,7 +379,7 @@ public int Open() { shell.setText(MM.PHRASES.getPhrase("79") + " " + MM.APPTITLE); - shell.setSize(650, 435); + shell.setSize(650, 575); this.CenterWindow(); shell.open(); @@ -405,10 +407,10 @@ private boolean OffsetValidate() { if (txtOffset.getText().length()>0) { - float amount = new Float(txtOffset.getText().replaceAll("\\,", "")); + float amount = Float.parseFloat(txtOffset.getText().replaceAll("\\,", "")); if (amount != 0){ if (cmbOffset.getText().length() > 0) { - amount = new Float(txtExRate.getText()); + amount = Float.parseFloat(txtExRate.getText()); if (txtExRate.getText().length() > 0){ if (amount != 0){ result = true; diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/menus/MainMenu.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/menus/MainMenu.java index 551ad46..1511af4 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/menus/MainMenu.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/menus/MainMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -97,9 +97,6 @@ public MainMenu(Shell shMain) { ' '); mi = addSelection(mnuImport, SWT.PUSH, MM.MENU_FILE_IMPORT_BTC, MM.PHRASES.getPhrase("217"), ' '); - -// mi = addSelection(mnuImport, SWT.PUSH, MM.MENU_FILE_IMPORT_MAIL, -// MM.PHRASES.getPhrase("252"), ' '); mi = addSelection(mnuImport, SWT.PUSH, MM.MENU_FILE_IMPORT_CSV, MM.PHRASES.getPhrase("253"), ' '); @@ -178,6 +175,10 @@ public MainMenu(Shell shMain) { MM.MENU_REPORTS_ACCOUNT_HISTORY, MM.PHRASES.getPhrase("136"), ' '); + mi = addSelection(mnuReports, SWT.PUSH, + MM.MENU_REPORTS_ACCOUNT_HISTORY_ALL_TIME, MM.PHRASES.getPhrase("273"), + ' '); + mi = addSelection(mnuReports, SWT.PUSH, MM.MENU_REPORTS_BUDGET_PERFORMANCE, MM.PHRASES.getPhrase("164"), ' '); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/BudgetView.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/BudgetView.java index 8685c06..818f2fe 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/BudgetView.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/BudgetView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2018 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -56,10 +56,7 @@ import org.infinitypfm.ui.view.toolbars.BudgetToolbar; /** - * @author Wayne Gray - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * View to show budget performance */ public class BudgetView extends BaseView { @@ -103,7 +100,6 @@ public BudgetView(Composite arg0, int arg1) { } - protected void LoadUI() { this.setLayout(new FormLayout()); @@ -203,18 +199,19 @@ protected void LoadLayout() { cmbMonth.setLayoutData(cmbmonthdata); FormData lblestimatedata = new FormData(); - lblestimatedata.top = new FormAttachment(lblBudget, 10); + lblestimatedata.top = new FormAttachment(lblBudget, 0); lblestimatedata.left = new FormAttachment(cmbMonth, 25); lblEstimate.setLayoutData(lblestimatedata); FormData txtestimatedata = new FormData(); - txtestimatedata.top = new FormAttachment(lblBudget, 30); + txtestimatedata.top = new FormAttachment(lblBudget, 25); + txtestimatedata.bottom = new FormAttachment(lblBudget, 70); txtestimatedata.left = new FormAttachment(cmbMonth, 25); txtEstimate.setLayoutData(txtestimatedata); FormData cmdestimatedata = new FormData(); - cmdestimatedata.top = new FormAttachment(lblBudget, 28); - // cmdestimatedata.bottom = new FormAttachment(txtEstimate, 65); + cmdestimatedata.top = new FormAttachment(lblBudget, 25); + cmdestimatedata.bottom = new FormAttachment(lblBudget, 70); cmdestimatedata.left = new FormAttachment(txtEstimate, 0); cmdEstimate.setLayoutData(cmdestimatedata); @@ -369,6 +366,9 @@ private void LoadBudgetData(int month) { currentMonth = now.get(Calendar.MONTH) + 1; Color cRed = display.getSystemColor(SWT.COLOR_RED); + Color cBlack = display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND); + + tblTrans.clearAll(); for (int i = 0; i < detailList.size(); i++) { @@ -433,6 +433,7 @@ private void LoadBudgetData(int month) { if (detail.getAmount() < monthlyBalance.getActBalance()) ti.setForeground(cRed); + else ti.setForeground(cBlack); detail.setActBalance(monthlyBalance.getActBalance()); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/CurrencyView.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/CurrencyView.java index 2b218f8..e4536fe 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/CurrencyView.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/CurrencyView.java @@ -132,17 +132,17 @@ protected void LoadLayout() { tbMain.setLayoutDat(tbmaindata); FormData cmdaddmethoddata = new FormData(); - cmdaddmethoddata.top = new FormAttachment(100, -50); + cmdaddmethoddata.top = new FormAttachment(100, -40); cmdaddmethoddata.left = new FormAttachment(5, 0); cmdAddMethod.setLayoutData(cmdaddmethoddata); FormData cmdremovemethoddata = new FormData(); - cmdremovemethoddata.top = new FormAttachment(100, -50); + cmdremovemethoddata.top = new FormAttachment(100, -40); cmdremovemethoddata.left = new FormAttachment(cmdAddMethod, 10); cmdRemoveMethod.setLayoutData(cmdremovemethoddata); FormData cmdrefreshdata = new FormData(); - cmdrefreshdata.top = new FormAttachment(100, -50); + cmdrefreshdata.top = new FormAttachment(100, -40); cmdrefreshdata.left = new FormAttachment(cmdRemoveMethod, 10); cmdRefresh.setLayoutData(cmdrefreshdata); @@ -150,66 +150,66 @@ protected void LoadLayout() { cmpheaderdata.top = new FormAttachment(0, 10); cmpheaderdata.left = new FormAttachment(0, 10); cmpheaderdata.right = new FormAttachment(100, -10); - cmpheaderdata.bottom = new FormAttachment(0, 200); + cmpheaderdata.bottom = new FormAttachment(0, 250); cmpHeader.setLayoutData(cmpheaderdata); FormData lblmethodheaderdata = new FormData(); - lblmethodheaderdata.top = new FormAttachment(5, 0); + lblmethodheaderdata.top = new FormAttachment(5, 5); lblmethodheaderdata.left = new FormAttachment(5, 0); lblMethodHeader.setLayoutData(lblmethodheaderdata); FormData lblmethoddata = new FormData(); - lblmethoddata.top = new FormAttachment(lblMethodHeader, 5); + lblmethoddata.top = new FormAttachment(lblMethodHeader, 20); lblmethoddata.left = new FormAttachment(5, 0); lblMethod.setLayoutData(lblmethoddata); FormData txtmethoddata = new FormData(); - txtmethoddata.top = new FormAttachment(lblMethodHeader, 5); + txtmethoddata.top = new FormAttachment(lblMethodHeader, 20); txtmethoddata.left = new FormAttachment(lblMethod, 20); txtmethoddata.right = new FormAttachment(lblMethod, 400); txtMethod.setLayoutData(txtmethoddata); FormData lblcurrenciesdata = new FormData(); - lblcurrenciesdata.top = new FormAttachment(lblMethodHeader, 5); + lblcurrenciesdata.top = new FormAttachment(lblMethodHeader, 25); lblcurrenciesdata.left = new FormAttachment(txtMethod, 5); lblCurrencies.setLayoutData(lblcurrenciesdata); FormData cmbcurrenciesdata = new FormData(); - cmbcurrenciesdata.top = new FormAttachment(lblMethodHeader, 5); + cmbcurrenciesdata.top = new FormAttachment(lblMethodHeader, 25); cmbcurrenciesdata.left = new FormAttachment(lblCurrencies, 5); cmbCurrencies.setLayoutData(cmbcurrenciesdata); FormData lblurldata = new FormData(); - lblurldata.top = new FormAttachment(cmbCurrencies, 5); + lblurldata.top = new FormAttachment(cmbCurrencies, 17); lblurldata.left = new FormAttachment(5, 0); lblUrl.setLayoutData(lblurldata); FormData txturldata = new FormData(); - txturldata.top = new FormAttachment(cmbCurrencies, 5); + txturldata.top = new FormAttachment(cmbCurrencies, 17); txturldata.left = new FormAttachment(lblMethod, 20); txturldata.right = new FormAttachment(lblMethod, 700); txtUrl.setLayoutData(txturldata); FormData lblpathdata = new FormData(); - lblpathdata.top = new FormAttachment(txtUrl, 5); + lblpathdata.top = new FormAttachment(txtUrl, 10); lblpathdata.left = new FormAttachment(5, 0); lblPath.setLayoutData(lblpathdata); FormData txtpathdata = new FormData(); - txtpathdata.top = new FormAttachment(txtUrl, 5); + txtpathdata.top = new FormAttachment(txtUrl, 7); txtpathdata.left = new FormAttachment(lblMethod, 20); txtpathdata.right = new FormAttachment(lblMethod, 700); txtPath.setLayoutData(txtpathdata); FormData tblcurrenciesdata = new FormData(); - tblcurrenciesdata.top = new FormAttachment(cmpHeader, 10); + tblcurrenciesdata.top = new FormAttachment(cmpHeader, 7); tblcurrenciesdata.right = new FormAttachment(100, -20); tblcurrenciesdata.left = new FormAttachment(0, 20); tblcurrenciesdata.bottom = new FormAttachment(100, -20); tblCurrencies.setLayoutData(tblcurrenciesdata); FormData cmdloadmethoddata = new FormData(); - cmdloadmethoddata.top = new FormAttachment(3, 0); + cmdloadmethoddata.top = new FormAttachment(3, 7); cmdloadmethoddata.left = new FormAttachment(lblMethodHeader, 20); cmdLoadMethod.setLayoutData(cmdloadmethoddata); @@ -315,7 +315,6 @@ private void LoadData() { @Override public void Refresh() { - // TODO Auto-generated method stub super.Refresh(); } @@ -555,9 +554,7 @@ public void widgetSelected(SelectionEvent event) { } catch (SQLException e) { InfinityPfm.LogMessage(e.toString()); } - } - } }; diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/RecurrenceView.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/RecurrenceView.java index 6a57e04..fe5db85 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/RecurrenceView.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/RecurrenceView.java @@ -201,42 +201,44 @@ protected void LoadLayout() { cmpHeader.setLayoutData(cmpheaderdata); FormData cmdadddata = new FormData(); - cmdadddata.top = new FormAttachment(50, 0); - cmdadddata.left = new FormAttachment(10, 0); - cmdadddata.right = new FormAttachment(10, 50); + cmdadddata.top = new FormAttachment(45, 0); + cmdadddata.left = new FormAttachment(3, 0); + cmdadddata.right = new FormAttachment(10, 30); cmdAdd.setLayoutData(cmdadddata); FormData lblnamedata = new FormData(); - lblnamedata.top = new FormAttachment(30, 0); - lblnamedata.left = new FormAttachment(20, 0); + lblnamedata.top = new FormAttachment(25, 0); + lblnamedata.left = new FormAttachment(15, 0); lblName.setLayoutData(lblnamedata); FormData txtnamedata = new FormData(); - txtnamedata.top = new FormAttachment(30, 0); - txtnamedata.left = new FormAttachment(lblName, 60); - txtnamedata.right = new FormAttachment(lblName, 200); + txtnamedata.top = new FormAttachment(25, 0); + txtnamedata.bottom = new FormAttachment(40, 0); + txtnamedata.left = new FormAttachment(lblName, 55); + txtnamedata.right = new FormAttachment(lblName, 300); txtName.setLayoutData(txtnamedata); FormData lblfrequencydata = new FormData(); lblfrequencydata.top = new FormAttachment(lblName, 20); - lblfrequencydata.left = new FormAttachment(20, 0); + lblfrequencydata.left = new FormAttachment(15, 0); lblFrequency.setLayoutData(lblfrequencydata); FormData cmbfrequencydata = new FormData(); - cmbfrequencydata.top = new FormAttachment(lblName, 20); - cmbfrequencydata.left = new FormAttachment(lblName, 60); + cmbfrequencydata.top = new FormAttachment(lblName, 15); + cmbfrequencydata.left = new FormAttachment(lblName, 55); cmbfrequencydata.right = new FormAttachment(lblName, 200); cmbFrequency.setLayoutData(cmbfrequencydata); FormData lblstartdatedata = new FormData(); - lblstartdatedata.top = new FormAttachment(lblFrequency, 20); - lblstartdatedata.left = new FormAttachment(20, 0); + lblstartdatedata.top = new FormAttachment(lblFrequency, 25); + lblstartdatedata.left = new FormAttachment(15, 0); lblStartDate.setLayoutData(lblstartdatedata); FormData txtstartdatedata = new FormData(); txtstartdatedata.top = new FormAttachment(lblFrequency, 20); - txtstartdatedata.left = new FormAttachment(lblName, 60); - txtstartdatedata.right = new FormAttachment(lblName, 200); + txtstartdatedata.bottom = new FormAttachment(lblFrequency, 70); + txtstartdatedata.left = new FormAttachment(lblName, 55); + txtstartdatedata.right = new FormAttachment(lblName, 250); txtStartDate.setLayoutData(txtstartdatedata); FormData cmdstartdatepickerdata = new FormData(); @@ -245,14 +247,14 @@ protected void LoadLayout() { cmdStartDatePicker.setLayoutData(cmdstartdatepickerdata); FormData lblaccountdata = new FormData(); - lblaccountdata.top = new FormAttachment(30, 0); + lblaccountdata.top = new FormAttachment(25, 0); lblaccountdata.left = new FormAttachment(55, 0); lblAccount.setLayoutData(lblaccountdata); FormData cmbaccountdata = new FormData(); - cmbaccountdata.top = new FormAttachment(30, 0); + cmbaccountdata.top = new FormAttachment(25, 0); cmbaccountdata.left = new FormAttachment(lblAccount, 50); - cmbaccountdata.right = new FormAttachment(lblAccount, 300); + //cmbaccountdata.right = new FormAttachment(lblAccount, 300); cmbAccount.setLayoutData(cmbaccountdata); FormData lbloffsetdata = new FormData(); @@ -263,7 +265,7 @@ protected void LoadLayout() { FormData cmboffsetdata = new FormData(); cmboffsetdata.top = new FormAttachment(lblAccount, 20); cmboffsetdata.left = new FormAttachment(lblAccount, 50); - cmboffsetdata.right = new FormAttachment(lblAccount, 300); + //cmboffsetdata.right = new FormAttachment(lblAccount, 300); cmbOffset.setLayoutData(cmboffsetdata); FormData lblamountdata = new FormData(); @@ -273,7 +275,9 @@ protected void LoadLayout() { FormData txtamountdata = new FormData(); txtamountdata.top = new FormAttachment(lblOffset, 20); + txtamountdata.bottom = new FormAttachment(lblOffset, 65); txtamountdata.left = new FormAttachment(lblAccount, 50); + txtamountdata.right = new FormAttachment(lblAccount, 300); txtAmount.setLayoutData(txtamountdata); FormData lblsaveddata = new FormData(); diff --git a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/RegisterView.java b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/RegisterView.java index 84766e2..f90bdf5 100644 --- a/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/RegisterView.java +++ b/infinitypfm-ui/src/main/java/org/infinitypfm/ui/view/views/RegisterView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2017 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -137,13 +137,13 @@ protected void LoadLayout() { lblStartDate.setLayoutData(lblstartdatedata); FormData txtstartdatedata = new FormData(); - txtstartdatedata.top = new FormAttachment(lblStartDate, -23); + txtstartdatedata.top = new FormAttachment(lblStartDate, -33); txtstartdatedata.left = new FormAttachment(lblStartDate, 5); txtstartdatedata.right = new FormAttachment(lblStartDate, 160); txtStartDate.setLayoutData(txtstartdatedata); FormData cmdstartdatedata = new FormData(); - cmdstartdatedata.top = new FormAttachment(lblStartDate, -27); + cmdstartdatedata.top = new FormAttachment(lblStartDate, -37); cmdstartdatedata.left = new FormAttachment(txtStartDate, 2); cmdStartDate.setLayoutData(cmdstartdatedata); @@ -153,13 +153,13 @@ protected void LoadLayout() { lblEndDate.setLayoutData(lblenddatedata); FormData txtenddatedata = new FormData(); - txtenddatedata.top = new FormAttachment(lblEndDate, -23); + txtenddatedata.top = new FormAttachment(lblEndDate, -33); txtenddatedata.left = new FormAttachment(lblEndDate, 5); txtenddatedata.right = new FormAttachment(lblEndDate, 150); txtEndDate.setLayoutData(txtenddatedata); FormData cmdenddatedata = new FormData(); - cmdenddatedata.top = new FormAttachment(lblEndDate, -27); + cmdenddatedata.top = new FormAttachment(lblEndDate, -37); cmdenddatedata.left = new FormAttachment(txtEndDate, 2); cmdEndDate.setLayoutData(cmdenddatedata); diff --git a/infinitypfm-ui/src/main/java/piechartBase.js b/infinitypfm-ui/src/main/java/piechartBase.js index 16b8b6c..6733881 100644 --- a/infinitypfm-ui/src/main/java/piechartBase.js +++ b/infinitypfm-ui/src/main/java/piechartBase.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2011 Wayne Gray All rights reserved + * Copyright (c) 2005-2020 Wayne Gray All rights reserved * * This file is part of Infinity PFM. * @@ -31,6 +31,9 @@ Raphael.fn.pieChart = function (cx, cy, r, values, labels, stroke, title) { return paper.path(["M", cx, cy, "L", x1, y1, "A", r, r, 0, +(endAngle - startAngle > 180), 0, x2, y2, "z"]).attr(params); } + + var cBlack = "hsb(0, 0, 0)"; + var angle = 0, total = 0, start = .05, @@ -43,7 +46,7 @@ Raphael.fn.pieChart = function (cx, cy, r, values, labels, stroke, title) { delta = 30, bcolor = "hsb(" + start + ", 1, 1)", p = sector(cx, cy, r, angle, angle + angleplus, {gradient: "90-" + bcolor + "-" + color, stroke: stroke, "stroke-width": 3}), - txt = paper.text(cx + (r + delta + 20) * Math.cos(-popangle * rad), cy + (r + delta + 10) * Math.sin(-popangle * rad), labels[j] + ' ' + value + '%').attr({fill: bcolor, stroke: "none", opacity: 0, "font-family": 'Fontin-Sans, Arial', "font-size": "12px"}); + txt = paper.text(cx + (r + delta + 20) * Math.cos(-popangle * rad), cy + (r + delta + 10) * Math.sin(-popangle * rad), labels[j] + ' ' + value + '%').attr({fill: cBlack, stroke: "none", opacity: 0, "font-family": 'Fontin-Sans, Arial', "font-size": "12px"}); p.mouseover(function () { p.animate({scale: [1.1, 1.1, cx, cy]}, ms, "elastic"); txt.animate({opacity: 1}, ms, "elastic"); diff --git a/infinitypfm-ui/src/main/java/reports.css b/infinitypfm-ui/src/main/java/reports.css new file mode 100644 index 0000000..9b23bf6 --- /dev/null +++ b/infinitypfm-ui/src/main/java/reports.css @@ -0,0 +1,45 @@ +h1,h3 { + color:#2f7991; +} + +table { + width:100%; + font-size:12px; + border-collapse: collapse; + border-bottom: 1px solid #ddd; + text-align: left; + padding: 15px; +} + +tr:hover {background-color: #f5f5f5;} + +th { + background-color:#004f78; + color: white; +} + +th,td { + border-bottom: 1px solid #ddd; +} + +.totals, .totals-dat { + font-size:16px; + display: inline-block; +} + +.totals { + color:#2f7991; + width: 150px; +} + +.totals-dat { + margin-left; 20px; +} + +.chartArea { + margin: 25px; +} + +.tblWrapper { + overflow-x:auto; +} diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index ad45da7..ba7cc0b 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -23,6 +23,7 @@ parts: - libjson-java - libswt-webkit-gtk-3-jni - libswt-cairo-gtk-3-jni + - libfreemarker-java wrapper: plugin: make source: .