Merge branch 'master' of ssh://git@git.imixs.com/git/office-alexander-logistics
This commit is contained in:
commit
41c6405b6d
3 changed files with 211 additions and 37 deletions
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.alexanderlogistics;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.enterprise.context.ConversationScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.imixs.workflow.ItemCollection;
|
||||||
|
import org.imixs.workflow.engine.DocumentService;
|
||||||
|
import org.imixs.workflow.exceptions.QueryException;
|
||||||
|
import org.imixs.workflow.faces.util.LoginController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The InvoiceDispatchController loads open workitems for the current user
|
||||||
|
*
|
||||||
|
* @author rsoika
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named
|
||||||
|
@ConversationScoped
|
||||||
|
public class InvoiceDispatchController implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static Logger logger = Logger.getLogger(InvoiceDispatchController.class.getName());
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected DocumentService documentService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected LoginController loginController;
|
||||||
|
|
||||||
|
private List<ItemCollection> invoices = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method searches the invoices.
|
||||||
|
* <ui:param name="query" value="(type:workitem) AND
|
||||||
|
* ($modelversion:rechnungseingang-de*) AND ($taskid:5100) AND
|
||||||
|
* ($owner:#{user})"></ui:param> <ui:param name="invoiceList" value=
|
||||||
|
* "#{workflowController.documentService.find(query,30,0)}"></ui:param>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void searchInvoices() {
|
||||||
|
long l=System.currentTimeMillis();
|
||||||
|
String owner = loginController.getUserPrincipal();
|
||||||
|
String query = "(type:workitem) AND ($modelversion:rechnungseingang-de*) AND ($taskid:5100) AND ($owner:"
|
||||||
|
+ owner + ")";
|
||||||
|
|
||||||
|
try {
|
||||||
|
invoices = documentService.findStubs(query, 30, 0, "$created", false);
|
||||||
|
logger.info("found " + invoices.size() + " invoices for StapelVerarbeitung in " + (System.currentTimeMillis()-l) + "ms");
|
||||||
|
} catch (QueryException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemCollection> getInvoices() {
|
||||||
|
if (invoices == null) {
|
||||||
|
searchInvoices();
|
||||||
|
}
|
||||||
|
return invoices;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method reset the search and input state.
|
||||||
|
*/
|
||||||
|
public void reset() {
|
||||||
|
invoices = new ArrayList<ItemCollection>();
|
||||||
|
logger.fine("reset");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -9,11 +9,8 @@
|
||||||
<!-- zeigt alle rechnungen an die von einem Abteilungsleiter verteilt werden können -->
|
<!-- zeigt alle rechnungen an die von einem Abteilungsleiter verteilt werden können -->
|
||||||
|
|
||||||
|
|
||||||
<ui:param name="user" value="#{loginController.userPrincipal}"></ui:param>
|
|
||||||
<ui:param name="query"
|
|
||||||
value="(type:workitem) AND ($modelversion:rechnungseingang-de*) AND ($taskid:5100) AND ($owner:#{user})"></ui:param>
|
|
||||||
<ui:param name="invoiceList"
|
<ui:param name="invoiceList"
|
||||||
value="#{workflowController.documentService.find(query,30,0)}"></ui:param>
|
value="#{invoiceDispatchController.invoices}"></ui:param>
|
||||||
|
|
||||||
|
|
||||||
<ui:fragment rendered="#{empty invoiceList}">
|
<ui:fragment rendered="#{empty invoiceList}">
|
||||||
|
|
@ -30,48 +27,18 @@
|
||||||
|
|
||||||
<div class="imixs-form-section">
|
<div class="imixs-form-section">
|
||||||
|
|
||||||
<table class="">
|
<table class="" style="font-size: 0.9rem;line-height: 2.1em;">
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th style="">Bereich</th>
|
|
||||||
<th style="">#{message['form.company']}</th>
|
|
||||||
<th style="">#{message['form.invoicenumber']}</th>
|
|
||||||
<th style="">#{message['form.date']}</th>
|
|
||||||
<th style="">Fälligkeit</th>
|
|
||||||
<th style="">#{message['form.amount']}</th>
|
|
||||||
<th style=""></th>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
<c:forEach items="#{invoiceList}" var="invoice">
|
<c:forEach items="#{invoiceList}" var="invoice">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<td><input type="checkbox" class="selection_checkbox"
|
<td><input type="checkbox" class="selection_checkbox"
|
||||||
id="#{invoice.uniqueID}" /></td>
|
id="#{invoice.uniqueID}" /></td>
|
||||||
|
|
||||||
<td>#{invoice.item['space.name']}</td>
|
|
||||||
<td><h:link outcome="/pages/workitems/workitem">
|
<td><h:link outcome="/pages/workitems/workitem">
|
||||||
#{invoice.item['cdtr.name']}
|
#{invoice.item['$workflowsummary']}
|
||||||
<f:param name="id" value="#{invoice.item['$uniqueid']}" />
|
<f:param name="id" value="#{invoice.item['$uniqueid']}" />
|
||||||
</h:link></td>
|
</h:link></td>
|
||||||
|
|
||||||
|
|
||||||
<td>#{invoice.item['invoice.number']}</td>
|
|
||||||
<td><h:outputText value="#{invoice.item['invoice.date']}">
|
|
||||||
<f:convertDateTime pattern="#{message.datePatternShort}"
|
|
||||||
timeZone="#{message.timeZone}" />
|
|
||||||
</h:outputText></td>
|
|
||||||
<td><h:outputText value="#{invoice.item['invoice.duedate']}">
|
|
||||||
<f:convertDateTime pattern="#{message.datePatternShort}"
|
|
||||||
timeZone="#{message.timeZone}" />
|
|
||||||
</h:outputText></td>
|
|
||||||
|
|
||||||
<td style="text-align: right;"><h:outputText
|
|
||||||
value="#{invoice.item['invoice.total']}">
|
|
||||||
<f:convertNumber minFractionDigits="2" locale="de" />
|
|
||||||
</h:outputText></td>
|
|
||||||
|
|
||||||
<td>#{invoice.item['invoice.currency']}</td>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||||
|
xmlns:f="http://java.sun.com/jsf/core"
|
||||||
|
xmlns:c="http://java.sun.com/jsp/jstl/core"
|
||||||
|
xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:i="http://java.sun.com/jsf/composite/imixs"
|
||||||
|
xmlns:marty="http://java.sun.com/jsf/composite/marty">
|
||||||
|
|
||||||
|
<!-- zeigt alle rechnungen an die von einem Abteilungsleiter verteilt werden können -->
|
||||||
|
|
||||||
|
|
||||||
|
<ui:param name="user" value="#{loginController.userPrincipal}"></ui:param>
|
||||||
|
<ui:param name="query"
|
||||||
|
value="(type:workitem) AND ($modelversion:rechnungseingang-de*) AND ($taskid:5100) AND ($owner:#{user})"></ui:param>
|
||||||
|
<ui:param name="invoiceList"
|
||||||
|
value="#{workflowController.documentService.find(query,30,0)}"></ui:param>
|
||||||
|
|
||||||
|
|
||||||
|
<ui:fragment rendered="#{empty invoiceList}">
|
||||||
|
|
||||||
|
<div class="ui-state-highlight ui-corner-all"
|
||||||
|
style="margin-bottom: 10px; padding: .5em;">
|
||||||
|
<p>Es liegen derzeit keine Rechnungen zur Prüfung für Sie vor.</p>
|
||||||
|
</div>
|
||||||
|
</ui:fragment>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<ui:fragment rendered="#{!empty invoiceList}">
|
||||||
|
|
||||||
|
<div class="imixs-form-section">
|
||||||
|
|
||||||
|
<table class="">
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th style="">Bereich</th>
|
||||||
|
<th style="">#{message['form.company']}</th>
|
||||||
|
<th style="">#{message['form.invoicenumber']}</th>
|
||||||
|
<th style="">#{message['form.date']}</th>
|
||||||
|
<th style="">Fälligkeit</th>
|
||||||
|
<th style="">#{message['form.amount']}</th>
|
||||||
|
<th style=""></th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<c:forEach items="#{invoiceList}" var="invoice">
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<td><input type="checkbox" class="selection_checkbox"
|
||||||
|
id="#{invoice.uniqueID}" /></td>
|
||||||
|
|
||||||
|
<td>#{invoice.item['space.name']}</td>
|
||||||
|
<td><h:link outcome="/pages/workitems/workitem">
|
||||||
|
#{invoice.item['cdtr.name']}
|
||||||
|
<f:param name="id" value="#{invoice.item['$uniqueid']}" />
|
||||||
|
</h:link></td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>#{invoice.item['invoice.number']}</td>
|
||||||
|
<td><h:outputText value="#{invoice.item['invoice.date']}">
|
||||||
|
<f:convertDateTime pattern="#{message.datePatternShort}"
|
||||||
|
timeZone="#{message.timeZone}" />
|
||||||
|
</h:outputText></td>
|
||||||
|
<td><h:outputText value="#{invoice.item['invoice.duedate']}">
|
||||||
|
<f:convertDateTime pattern="#{message.datePatternShort}"
|
||||||
|
timeZone="#{message.timeZone}" />
|
||||||
|
</h:outputText></td>
|
||||||
|
|
||||||
|
<td style="text-align: right;"><h:outputText
|
||||||
|
value="#{invoice.item['invoice.total']}">
|
||||||
|
<f:convertNumber minFractionDigits="2" locale="de" />
|
||||||
|
</h:outputText></td>
|
||||||
|
|
||||||
|
<td>#{invoice.item['invoice.currency']}</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
|
||||||
|
|
||||||
|
<h:inputText style="display:none;" class="invoice_selection_list"
|
||||||
|
value="#{workitem.item['invoice.selection']}" />
|
||||||
|
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</ui:fragment>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*<![CDATA[*/
|
||||||
|
|
||||||
|
// collect all selected ids form the checkboxes in the first column
|
||||||
|
$(document).ready(
|
||||||
|
function() {
|
||||||
|
|
||||||
|
// clear last selection...
|
||||||
|
selection = $('.invoice_selection_list').val('');
|
||||||
|
|
||||||
|
// on change handler....
|
||||||
|
$('input[type="checkbox"].selection_checkbox').change(
|
||||||
|
function() {
|
||||||
|
var id = $(this).attr('id');
|
||||||
|
var check = $(this).prop('checked');
|
||||||
|
//console.log("Change: " + id + " to " + check);
|
||||||
|
|
||||||
|
// get selection
|
||||||
|
var selection = $('.invoice_selection_list')
|
||||||
|
.val();
|
||||||
|
const selectionArr = selection.split(",");
|
||||||
|
// selected
|
||||||
|
if (check) {
|
||||||
|
selectionArr.push(id);
|
||||||
|
}
|
||||||
|
// unselected
|
||||||
|
if (!check) {
|
||||||
|
var i = selectionArr.indexOf(id);
|
||||||
|
selectionArr.splice(i, i);
|
||||||
|
}
|
||||||
|
//console.log("new selection=" + selectionArr.join(','));
|
||||||
|
selection = $('.invoice_selection_list').val(
|
||||||
|
selectionArr.join(','));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/*]]>*/
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
|
||||||
Loading…
Reference in a new issue