Commit ca8bb0dd by Tuomas Riihimäki

foooood

1 parent 543f6031
...@@ -160,7 +160,7 @@ public class Bill extends GenericEntity { ...@@ -160,7 +160,7 @@ public class Bill extends GenericEntity {
} }
return total; return total;
} }
public BigDecimal getTotalPrice() { public BigDecimal getTotalPrice() {
return this.totalPrice(); return this.totalPrice();
} }
...@@ -419,7 +419,7 @@ public class Bill extends GenericEntity { ...@@ -419,7 +419,7 @@ public class Bill extends GenericEntity {
boolean ret = false; boolean ret = false;
for (BillLine bl : billLines) for (BillLine bl : billLines)
{ {
if (bl.getFoodwave() != null && (bl.getFoodwave().getClosed() || bl.getFoodwave().getTime().after(Calendar.getInstance()))) if (bl.getFoodwave() != null && (bl.getFoodwave().getClosed() || bl.getFoodwave().getTime().before(Calendar.getInstance())))
{ {
ret = true; ret = true;
break; break;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata> <f:metadata>
<f:viewParam name="foodwaveid" value="#{foodWaveView.foodWaveId}" /> <f:viewParam name="foodwaveid" value="#{foodWaveView.foodWaveId}" />
<f:event type="preRenderView" listener="#{foodWaveView.initFoodWaveOrderList}" /> <f:event type="preRenderView" listener="#{foodWaveView.initFoodWaveOrderList}" />
<!-- <f:event type="preRenderView" listener="#{foodWaveView.initFoodwaveAccountEventList}" /> --> <!-- <f:event type="preRenderView" listener="#{foodWaveView.initFoodwaveAccountEventList}" /> -->
</f:metadata> </f:metadata>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</p:column> </p:column>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel id="name" value="#{i18n['billLine.eventuser']}" /> <h:outputLabel value="#{i18n['billLine.eventuser']}" />
</f:facet> </f:facet>
<h:link outcome="/useradmin/edit" value="#{bill_line.bill.user.wholeName}"> <h:link outcome="/useradmin/edit" value="#{bill_line.bill.user.wholeName}">
<f:param name="userid" value="#{bill_line.bill.user.id}" /> <f:param name="userid" value="#{bill_line.bill.user.id}" />
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</p:column> </p:column>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel id="name" value="#{i18n['billLine.nick']}" /> <h:outputLabel value="#{i18n['billLine.nick']}" />
</f:facet> </f:facet>
<h:link outcome="/useradmin/edit" value="#{bill_line.bill.user.nick}"> <h:link outcome="/useradmin/edit" value="#{bill_line.bill.user.nick}">
<f:param name="userid" value="#{bill_line.bill.user.id}" /> <f:param name="userid" value="#{bill_line.bill.user.id}" />
...@@ -79,20 +79,21 @@ ...@@ -79,20 +79,21 @@
</p:column> --> </p:column> -->
</p:dataTable> </p:dataTable>
<br /> </h:form>
<br /> <br />
<br />
<h1>
<h:outputLabel value="#{i18n['foodwave.orders']}" />
</h1>
<h1>
<h:outputLabel value="#{i18n['foodwave.orders']}" />
</h1>
<h:form>
<p:dataTable styleClass="bordertable" value="#{foodWaveView.accountEventLines}" var="acc_lines"> <p:dataTable styleClass="bordertable" value="#{foodWaveView.accountEventLines}" var="acc_lines">
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="#{i18n['foodWave.accountevents']}" /> <h:outputLabel value="#{i18n['foodWave.accountevents']}" />
</f:facet> </f:facet>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_lines.time']}" /> <h:outputLabel value="${i18n['acc_lines.time']}" />
</f:facet> </f:facet>
<h:outputText value="#{acc_line.eventTime.getTime()}"> <h:outputText value="#{acc_line.eventTime.getTime()}">
<f:convertDateTime pattern="hh:mm d/M/yy" /> <f:convertDateTime pattern="hh:mm d/M/yy" />
...@@ -100,19 +101,19 @@ ...@@ -100,19 +101,19 @@
</p:column> </p:column>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_line.quantity']}" /> <h:outputLabel value="${i18n['acc_line.quantity']}" />
</f:facet> </f:facet>
<h:outputText value="#{acc_line.quantity}" /> <h:outputText value="#{acc_line.quantity}" />
</p:column> </p:column>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_line.product']}" /> <h:outputLabel value="${i18n['acc_line.product']}" />
</f:facet> </f:facet>
<h:outputText value="#{acc_line.product.name}" /> <h:outputText value="#{acc_line.product.name}" />
</p:column> </p:column>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_line.eventuser']}" /> <h:outputLabel value="${i18n['acc_line.eventuser']}" />
</f:facet> </f:facet>
<h:link outcome="/useradmin/edit" value="#{acc_line.user.wholeName}"> <h:link outcome="/useradmin/edit" value="#{acc_line.user.wholeName}">
<f:param name="userid" value="#{acc_line.user.id}" /> <f:param name="userid" value="#{acc_line.user.id}" />
...@@ -120,7 +121,7 @@ ...@@ -120,7 +121,7 @@
</p:column> </p:column>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel id="name" value="${i18n['acc_line.nick']}" /> <h:outputLabel value="${i18n['acc_line.nick']}" />
</f:facet> </f:facet>
<h:link outcome="/useradmin/edit" value="#{acc_line.user.nick}"> <h:link outcome="/useradmin/edit" value="#{acc_line.user.nick}">
<f:param name="userid" value="#{acc_line.user.id}" /> <f:param name="userid" value="#{acc_line.user.id}" />
...@@ -128,7 +129,7 @@ ...@@ -128,7 +129,7 @@
</p:column> </p:column>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel id="name" value="${i18n['accountEvent.delivered']}" /> <h:outputLabel value="${i18n['accountEvent.delivered']}" />
</f:facet> </f:facet>
<h:outputText rendered="#{acc_line.delivered}" value="#{i18n['accountEvent.delivered']}" /> <h:outputText rendered="#{acc_line.delivered}" value="#{i18n['accountEvent.delivered']}" />
<h:commandButton rendered="#{not acc_line.delivered}" value="#{i18n['accountEvent.deliver']}" action="#{foodWaveView.deliverAccountEvent}" /> <h:commandButton rendered="#{not acc_line.delivered}" value="#{i18n['accountEvent.deliver']}" action="#{foodWaveView.deliverAccountEvent}" />
......
...@@ -47,7 +47,7 @@ public class FoodWaveView extends GenericCDIView { ...@@ -47,7 +47,7 @@ public class FoodWaveView extends GenericCDIView {
private ProductBeanLocal productbeanlocal; private ProductBeanLocal productbeanlocal;
@EJB @EJB
private BillBeanLocal billbean; private BillBeanLocal billbean;
@EJB @EJB
private AccountEventBeanLocal accountEventBean; private AccountEventBeanLocal accountEventBean;
...@@ -174,22 +174,24 @@ public class FoodWaveView extends GenericCDIView { ...@@ -174,22 +174,24 @@ public class FoodWaveView extends GenericCDIView {
if (permbean.hasPermission(BillPermission.WRITE_ALL) && getBillLines().isRowAvailable()) { if (permbean.hasPermission(BillPermission.WRITE_ALL) && getBillLines().isRowAvailable()) {
Bill b = getBillLines().getRowData().getBill(); Bill b = getBillLines().getRowData().getBill();
b = getBillbean().markPaid(b, Calendar.getInstance()); b = getBillbean().markPaid(b, Calendar.getInstance());
foodWaveId = selectedFoodWave.getId();
selectedFoodWave = null;
initFoodWaveOrderList();
} }
return null; return null;
} }
public String deliverAccountEvent() { public String deliverAccountEvent() {
if (getAccountEventLines().isRowAvailable()) { if (getAccountEventLines().isRowAvailable()) {
AccountEvent e = getAccountEventLines().getRowData(); AccountEvent e = getAccountEventLines().getRowData();
e.setDelivered(Calendar.getInstance()); e.setDelivered(Calendar.getInstance());
e = accountEventBean.merge(e); e = accountEventBean.merge(e);
} }
return null; return null;
} }
public void initFoodWaveOrderList() { public void initFoodWaveOrderList() {
if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES) && selectedFoodWave == null) { if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES) && selectedFoodWave == null) {
...@@ -207,8 +209,7 @@ public class FoodWaveView extends GenericCDIView { ...@@ -207,8 +209,7 @@ public class FoodWaveView extends GenericCDIView {
} }
setBillLines(new ListDataModel<BillLine>(tmpLines)); setBillLines(new ListDataModel<BillLine>(tmpLines));
setAccountEventLines(new ListDataModel<AccountEvent>(selectedFoodWave.getAccountEvents())); setAccountEventLines(new ListDataModel<AccountEvent>(selectedFoodWave.getAccountEvents()));
super.beginConversation(); super.beginConversation();
...@@ -295,6 +296,7 @@ public class FoodWaveView extends GenericCDIView { ...@@ -295,6 +296,7 @@ public class FoodWaveView extends GenericCDIView {
public void setAccountEventLines(ListDataModel<AccountEvent> accountEventLines) { public void setAccountEventLines(ListDataModel<AccountEvent> accountEventLines) {
this.accountEventLines = accountEventLines; this.accountEventLines = accountEventLines;
} }
/* /*
* public List<BillLine> getUnpaidBills() { return unpaidBills; } * public List<BillLine> getUnpaidBills() { return unpaidBills; }
* *
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!