diff --git a/README.md b/README.md
index 188c26d..852c67e 100644
--- a/README.md
+++ b/README.md
@@ -5,18 +5,23 @@ This is a bar system designed for venues where you know your customers. It has t
- Drastically reduce the amount of money your customers owe you
- Automate the administrative tasks of running a bar as much as possible
-# User friendly
+## User friendly
Click on your name, click on the products you want to order, press "Confirm" and you're all set. It can't get much more user friendly than this.
-# Reduces the amount your customers owe you
+## Reduces the amount your customers owe you
In most systems, people start with 0 debt to the bar, and with every drink, this increases. Then after a while, people pay their debt and they have 0 again. This means that in any point in time, the bar is owed quite a bit of money.
In StamPOS, this works differently: people are expected to have credit with the bar. When they run out, they will be blocked, they can only order during the same weekend, but that's it. They could just pay their bill, but that means they can only order for 1 weekend again. It's handier for your customers to wire more money than they actually owe, so they can order for more than just 1 weekend.
In the off chance a customer hasn't paid, but bar personell still wants to allow ordering for him/her, there's an unblock functionality.
-# Automate administrative tasks
+## Automates administrative tasks
The following is automated:
- Sending an e-mail to all applicable users with their balance with the bar
- Determine which users have paid and which amount (using an export of internet banking)
- Sending a weekly e-mail to the owner of the bar with a backup of the database and a list of all users and their balance
+
+# Installing
+- Download and install Tomcat 8. For most convenience, set the port number to 80
+- Download [the latest version of StamPOS](https://github.com/cristan/stampos/releases/latest), rename it to ROOT.war and deploy it to Tomcat. You can do this by placing it in /webapps in the Tomcat installation directory, or by using the built-in manager.
+- Go to [localhost](http://localhost) to see your installation :)
\ No newline at end of file
diff --git a/application.properties b/application.properties
index a28280b..e44b407 100644
--- a/application.properties
+++ b/application.properties
@@ -3,4 +3,4 @@
app.grails.version=2.5.5
app.name=StamPOS
app.servlet.version=3.0
-app.version=2.8.1
+app.version=2.9.0
diff --git a/grails-app/controllers/stampos/KlantinfoController.groovy b/grails-app/controllers/stampos/KlantinfoController.groovy
index 6c77862..416eb41 100644
--- a/grails-app/controllers/stampos/KlantinfoController.groovy
+++ b/grails-app/controllers/stampos/KlantinfoController.groovy
@@ -9,8 +9,6 @@ import grails.converters.JSON
class KlantinfoController {
private static final maxItems = 15;
- static DateFormat bestellingFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm")
- static DateFormat betalingFormat = new SimpleDateFormat("dd-MM-yyyy")
def testDataService
def klantInfoService
diff --git a/grails-app/controllers/stampos/WeeklyController.groovy b/grails-app/controllers/stampos/WeeklyController.groovy
new file mode 100644
index 0000000..a2b0c11
--- /dev/null
+++ b/grails-app/controllers/stampos/WeeklyController.groovy
@@ -0,0 +1,49 @@
+package stampos
+
+import java.text.DateFormat
+import java.text.SimpleDateFormat
+
+class WeeklyController {
+
+ static DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy")
+
+ def index() {
+ Date today = new Date().clearTime()
+ Date endDate = params.endDate ? new Date(params.endDate as long) : today
+ Date beginDate = params.beginDate ? new Date(params.beginDate as long) : endDate - 7
+
+ def ordered = BestelRegel.executeQuery("select br.productPrijs.product.naam, sum(br.aantal), sum(br.aantal * br.productPrijs.prijs) from BestelRegel br where br.bestelling.datum > :dateFrom and br.bestelling.datum < :dateTo group by br.productPrijs.product.naam",
+ [dateFrom: beginDate, dateTo: endDate])
+ boolean nothingOrdered = ordered.isEmpty()
+ int totalAmount = 0
+ BigDecimal totalRevenue = 0
+ for(o in ordered) {
+ totalAmount += o[1]
+ totalRevenue += o[2]
+ }
+
+ def paid = Betaling.findAllByDatumGreaterThanAndDatumLessThan(beginDate, endDate)
+
+ def nothingPaid = paid.isEmpty()
+ BigDecimal totalPaid = 0
+ for(p in paid) {
+ totalPaid += p.bedrag
+ }
+
+ return [
+ nothingOrdered: nothingOrdered,
+ ordered: ordered,
+ totalAmount: totalAmount,
+ totalRevenue: totalRevenue,
+ nothingPaid: nothingPaid,
+ totalPaid: totalPaid,
+ paid: paid,
+ beginDateFormatted: dateFormat.format(beginDate),
+ endDateFormatted: dateFormat.format(endDate),
+ previousBeginDate: (beginDate - 7).getTime(),
+ previousEndDate: (endDate - 7).getTime(),
+ nextBeginDate: (beginDate + 7).getTime(),
+ nextEndDate: (endDate + 7).getTime(),
+ shouldShowLinkToNextWeek: endDate < today]
+ }
+}
diff --git a/grails-app/i18n/messages_nl.properties b/grails-app/i18n/messages_nl.properties
index 0729118..8d6334c 100644
--- a/grails-app/i18n/messages_nl.properties
+++ b/grails-app/i18n/messages_nl.properties
@@ -55,10 +55,10 @@ typeMismatch.java.math.BigDecimal=Attribuut {0} is geen geldig nummer
typeMismatch.java.math.BigInteger=Attribuut {0} is geen geldig nummer
-mail.insufficientfunds.title=Je rekening moet betaald worden
+mail.insufficientfunds.defaulttitle=Je rekening moet betaald worden
mail.insufficientfunds.message=Hallo {0},\n\nJe hebt een rekening van {1} euro. Maak daarom minimaal dit bedrag over op rekening van {2} op naam van {3}.
-mail.sufficientfunds.title=Je tegoed is %s
+mail.sufficientfunds.defaulttitle=Je tegoed is %s
mail.sufficientfunds.message=Hallo {0},\n\nJe hebt een tegoed van {1} euro. Als je je tegoed wilt aanvullen kan dit door middel van geld over te maken op rekening {2} op naam van {3}.
mail.funds.footer=\n\nMet vriendelijke groeten,\n\n\nHet barteam\n\nJe bestellingen en betalingen
diff --git a/grails-app/services/stampos/SettingsService.groovy b/grails-app/services/stampos/SettingsService.groovy
index cc1c280..3e09518 100644
--- a/grails-app/services/stampos/SettingsService.groovy
+++ b/grails-app/services/stampos/SettingsService.groovy
@@ -322,7 +322,7 @@ class SettingsService {
def getSufficientFundsTitleValue()
{
- def defaultMessage = messageSource.getMessage('mail.sufficientfunds.title', null, Locale.default)
+ def defaultMessage = messageSource.getMessage('mail.sufficientfunds.defaulttitle', null, Locale.default)
return getSetting(S_SUFFICIENT_FUNDS_TITLE, defaultMessage)
}
@@ -338,7 +338,7 @@ class SettingsService {
def getInsufficientFundsTitleValue()
{
- def defaultMessage = messageSource.getMessage('mail.insufficientfunds.title', null, Locale.default)
+ def defaultMessage = messageSource.getMessage('mail.insufficientfunds.defaulttitle', null, Locale.default)
return getSetting(S_INSUFFICIENT_FUNDS_TITLE, defaultMessage)
}
diff --git a/grails-app/views/beheer/index.gsp b/grails-app/views/beheer/index.gsp
index c6e9d81..d1eaa82 100644
--- a/grails-app/views/beheer/index.gsp
+++ b/grails-app/views/beheer/index.gsp
@@ -120,9 +120,9 @@
Bestellingen en betalingen van klanten
Deblokkeer klanten
+
Registreer inkopen
Tel de inhoud van de bar
-
Rendement van de bar (schatting nav inkopen)
Rendement van de bar (nav telling)
diff --git a/grails-app/views/beheer/klantoverzicht.gsp b/grails-app/views/beheer/klantoverzicht.gsp
index 646eb73..01182d0 100644
--- a/grails-app/views/beheer/klantoverzicht.gsp
+++ b/grails-app/views/beheer/klantoverzicht.gsp
@@ -6,6 +6,7 @@
Bestellingen en betalingen van alle klanten
+ Bestellingen en betalingen per week
Bestellingen en betalingen van klanten
diff --git a/grails-app/views/rendement/_rendement.gsp b/grails-app/views/rendement/_rendement.gsp
index f52728c..cd03445 100644
--- a/grails-app/views/rendement/_rendement.gsp
+++ b/grails-app/views/rendement/_rendement.gsp
@@ -13,7 +13,7 @@
${r.product.naam} |
${r.aantalIngekocht} |
${r.aantalBesteld} |
- ${r.percentage} |
+ ${raw(r.percentage)} |
@@ -21,6 +21,6 @@
Totaal |
${it.totaalIngekocht} |
${it.totaalBesteld} |
- ${it.totalPercentage} |
+ ${raw(it.totalPercentage)} |
\ No newline at end of file
diff --git a/grails-app/views/weekly/index.gsp b/grails-app/views/weekly/index.gsp
new file mode 100644
index 0000000..6481e79
--- /dev/null
+++ b/grails-app/views/weekly/index.gsp
@@ -0,0 +1,90 @@
+<%@page import="stampos.NumberUtils"%>
+
+
+
+
+
+ Besteld en betaald
+
+
+
+ Vorige week
+
+ ${beginDateFormatted} - ${endDateFormatted}
+
+ Volgende week
+
+
+ Besteld
+
+
+ Er is niets besteld in deze periode
+
+
+
+
+ Product |
+ Besteld |
+ Omzet |
+
+
+
+
+ ${o[0]} |
+ ${o[1]} |
+ ${NumberUtils.formatMoney(o[2])} |
+
+
+
+
+ Totaal |
+ ${totalAmount} |
+ ${NumberUtils.formatMoney(totalRevenue)} |
+
+
+
+
+ Betaald
+
+
+ Er zijn been betalingen in deze periode
+
+
+
+
+ Naam |
+ Betaald |
+
+
+
+
+ ${p.klant.naam} |
+ ${NumberUtils.formatMoney(p.bedrag)} |
+
+
+
+
+ Totaal |
+ ${NumberUtils.formatMoney(totalPaid)} |
+
+
+
+
+
\ No newline at end of file
diff --git a/test/unit/stampos/SettingsServiceSpec.groovy b/test/unit/stampos/SettingsServiceSpec.groovy
index 3bfd4d0..5f00d09 100644
--- a/test/unit/stampos/SettingsServiceSpec.groovy
+++ b/test/unit/stampos/SettingsServiceSpec.groovy
@@ -30,7 +30,7 @@ class SettingsServiceSpec extends Specification {
void "test title sufficient funds default"() {
given:
when:
- messageSource.addMessage("mail.sufficientfunds.title", Locale.default, "Your credit: %s")
+ messageSource.addMessage("mail.sufficientfunds.defaulttitle", Locale.default, "Your credit: %s")
then:
assertEquals("Your credit: \u20AC2,20", service.getSufficientFundsTitle(2.2))
}
@@ -38,7 +38,7 @@ class SettingsServiceSpec extends Specification {
void "test title sufficient funds set"() {
given:
when:
- messageSource.addMessage("mail.sufficientfunds.title", Locale.default, "Your credit: %s")
+ messageSource.addMessage("mail.sufficientfunds.defaulttitle", Locale.default, "Your credit: %s")
service.setSufficientFundsTitle("Due: %s")
then:
@@ -48,7 +48,7 @@ class SettingsServiceSpec extends Specification {
void "test title insufficient funds default"() {
given:
when:
- messageSource.addMessage("mail.insufficientfunds.title", Locale.default, "Your debit: %s")
+ messageSource.addMessage("mail.insufficientfunds.defaulttitle", Locale.default, "Your debit: %s")
then:
assertEquals("Your debit: \u20AC2,20", service.getInsufficientFundsTitle(2.2))
}
@@ -56,7 +56,7 @@ class SettingsServiceSpec extends Specification {
void "test title insufficient funds set"() {
given:
when:
- messageSource.addMessage("mail.insufficientfunds.title", Locale.default, "Your debit: %s")
+ messageSource.addMessage("mail.insufficientfunds.defaulttitle", Locale.default, "Your debit: %s")
service.setInsufficientFundsTitle("To pay: %s")
then:
diff --git a/test/unit/stampos/WeeklyControllerSpec.groovy b/test/unit/stampos/WeeklyControllerSpec.groovy
new file mode 100644
index 0000000..0d567f7
--- /dev/null
+++ b/test/unit/stampos/WeeklyControllerSpec.groovy
@@ -0,0 +1,20 @@
+package stampos
+
+import grails.test.mixin.TestFor
+import spock.lang.Specification
+
+/**
+ * See the API for {@link grails.test.mixin.web.ControllerUnitTestMixin} for usage instructions
+ */
+@TestFor(WeeklyController)
+class WeeklyControllerSpec extends Specification {
+
+ def setup() {
+ }
+
+ def cleanup() {
+ }
+
+ void "test something"() {
+ }
+}