neue archiv suche
This commit is contained in:
parent
303ef23928
commit
bb22c71a7a
4 changed files with 305 additions and 22 deletions
|
|
@ -24,15 +24,22 @@
|
|||
package com.alexanderlogistics;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.enterprise.context.ConversationScoped;
|
||||
import javax.enterprise.event.Observes;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.imixs.marty.team.TeamController;
|
||||
import org.imixs.workflow.ItemCollection;
|
||||
import org.imixs.workflow.office.views.SearchController;
|
||||
import org.imixs.workflow.office.views.SearchEvent;
|
||||
|
||||
/**
|
||||
|
|
@ -49,20 +56,19 @@ public class CustomSearchController implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static Logger logger = Logger.getLogger(CustomSearchController.class.getName());
|
||||
|
||||
@Inject
|
||||
SearchController searchController;
|
||||
|
||||
@Inject
|
||||
TeamController teamController;
|
||||
|
||||
/**
|
||||
* Erweitere Query
|
||||
*
|
||||
* _amount_brutto_from, _amount_brutto_to
|
||||
* Diese Suche schränkt immer auf Archive und Rechnugnscontrolling ein!!
|
||||
*
|
||||
* @param searchEvent
|
||||
*
|
||||
**/
|
||||
|
||||
/*
|
||||
* Aktuell ist es nicht möglich nach Long oder Double zu suchen. Hierzu muss die
|
||||
* LuceneUpdate Funktion in Imixs-Workflow verändert werden
|
||||
*/
|
||||
|
||||
public void onSearchEvent(@Observes SearchEvent searchEvent) {
|
||||
|
||||
String query = searchEvent.getQuery();
|
||||
|
|
@ -76,48 +82,58 @@ public class CustomSearchController implements Serializable {
|
|||
|
||||
String invoiceNumber = searchEvent.getSearchFilter().getItemValueString("invoice.number");
|
||||
|
||||
query += " (type:\"workitemarchive\") ";
|
||||
// process ref= Rechnugnscontorling Prozess
|
||||
ItemCollection process = teamController.getProcessByName("Rechnungscontrolling");
|
||||
if (process == null) {
|
||||
process = teamController.getProcessByName("Invoice Controlling");
|
||||
}
|
||||
if (process != null) {
|
||||
query += " AND ($uniqueidref:\"" + process.getUniqueID() + "\") ";
|
||||
}
|
||||
|
||||
// invoice.total
|
||||
if (invoiceTotal != 0) {
|
||||
// format form and to with at least one digit
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.00");
|
||||
query += " (invoice.total:" + decimalFormat.format(invoiceTotal) + ")";
|
||||
query += " AND (invoice.total:" + decimalFormat.format(invoiceTotal) + ")";
|
||||
|
||||
}
|
||||
|
||||
// invoice.date
|
||||
if (invoiceDate != null) {
|
||||
query += " (invoice.date:" + CustomSearchController.getRangeDay(invoiceDate) + ")";
|
||||
query += " AND (invoice.date:" + CustomSearchController.getRangeDay(invoiceDate) + ")";
|
||||
|
||||
}
|
||||
|
||||
// invoice.duedate
|
||||
if (dueDate != null) {
|
||||
query += " (invoice.duedate:" + CustomSearchController.getRangeDay(dueDate) + ")";
|
||||
query += " AND (invoice.duedate:" + CustomSearchController.getRangeDay(dueDate) + ")";
|
||||
|
||||
}
|
||||
|
||||
// invoice.closingdate
|
||||
if (closingDate != null) {
|
||||
query += " ($lasteventdate:" + CustomSearchController.getRangeMonth(closingDate) + ")";
|
||||
query += " AND ($lasteventdate:" + CustomSearchController.getRangeMonth(closingDate) + ")";
|
||||
}
|
||||
|
||||
if (invoiceNumber != null && !invoiceNumber.isEmpty()) {
|
||||
query += " (invoice.number:" + invoiceNumber + ")";
|
||||
query += " AND (invoice.number:" + invoiceNumber + ")";
|
||||
}
|
||||
|
||||
// Rechnungsart
|
||||
if (invoiceType != null && !"0".equals(invoiceType)) {
|
||||
if ("1".equals(invoiceType)) {
|
||||
query += " ($workflowgroup:\"Rechnungseingang\" AND NOT payment.type:credit)";
|
||||
query += " AND ($workflowgroup:\"Rechnungseingang\" AND NOT payment.type:credit)";
|
||||
}
|
||||
if ("2".equals(invoiceType)) {
|
||||
query += " ($workflowgroup:Sachrechnung)";
|
||||
query += " AND ($workflowgroup:Sachrechnung)";
|
||||
}
|
||||
if ("3".equals(invoiceType)) {
|
||||
query += " (($workflowgroup:Rechnungseingang) AND (payment.type:credit))";
|
||||
query += " AND (($workflowgroup:Rechnungseingang) AND (payment.type:credit))";
|
||||
}
|
||||
if ("4".equals(invoiceType)) {
|
||||
query += " ($workflowgroup:\"Gutschrift Abgleich\")";
|
||||
query += " AND ($workflowgroup:\"Gutschrift Abgleich\")";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -125,26 +141,57 @@ public class CustomSearchController implements Serializable {
|
|||
if (cdtrNumber != null && !cdtrNumber.isEmpty()) {
|
||||
cdtrNumber = cdtrNumber.trim().toUpperCase();
|
||||
if (!cdtrNumber.startsWith("K") && !cdtrNumber.startsWith("D")) {
|
||||
query += " (cdtr.number:K" + cdtrNumber + " OR dbtr.number:" + cdtrNumber + ")";
|
||||
query += " AND (cdtr.number:K" + cdtrNumber + " OR dbtr.number:" + cdtrNumber + ")";
|
||||
} else {
|
||||
if (cdtrNumber.startsWith("K")) {
|
||||
// suche nach Kreditor (Eingangsrechnung)
|
||||
query += " (cdtr.number:" + cdtrNumber + ")";
|
||||
query += " AND (cdtr.number:" + cdtrNumber + ")";
|
||||
} else {
|
||||
// suche nach Debitor (Ausgangsrechnung)
|
||||
if (cdtrNumber.startsWith("D")) {
|
||||
cdtrNumber = cdtrNumber.substring(1);
|
||||
}
|
||||
query += " (dbtr.number:" + cdtrNumber + ")";
|
||||
query += " AND (dbtr.number:" + cdtrNumber + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.info(query);
|
||||
// Udpate query
|
||||
searchEvent.setQuery(query);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sonder AGL Lösung um im Archiv zu bleiben.
|
||||
*
|
||||
*/
|
||||
public String refreshAGLArchive() {
|
||||
String phrase = searchController.getSearchFilter().getItemValueString("phrase");
|
||||
|
||||
searchController.getSearchFilter().setItemValue("Type", "workitemarchive");
|
||||
try {
|
||||
phrase = URLEncoder.encode(phrase, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.severe("unable to encode search phrase!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
String action = "/pages/workitems/agl_archive.xhtml?faces-redirect=true&phrase=" + phrase;
|
||||
searchController.setPageIndex(0);
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method reset the search filter and the search pageIndex and creates a
|
||||
* new bookmarkable search link to the worklist including the current search
|
||||
* phrase.
|
||||
*
|
||||
*/
|
||||
public String resetSearch() {
|
||||
searchController.reset();
|
||||
return refreshAGLArchive();
|
||||
}
|
||||
|
||||
private static String getRangeDay(Date dueDate) {
|
||||
// Setze die Uhrzeit auf Mitternacht (00:00)
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,149 @@
|
|||
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||
template="/layout/template.xhtml">
|
||||
|
||||
|
||||
<h:head>
|
||||
<!-- init search controller -->
|
||||
<f:metadata>
|
||||
<f:viewAction action="#{searchController.init()}" />
|
||||
</f:metadata>
|
||||
</h:head>
|
||||
|
||||
|
||||
<ui:define name="scripts">
|
||||
<script type="text/javascript"
|
||||
src="#{facesContext.externalContext.requestContextPath}/js/imixs-office.worklist.js?build=#{app.application_build_timestamp}"></script>
|
||||
<script type="text/javascript"
|
||||
src="#{facesContext.externalContext.requestContextPath}/js/imixs-office.worklist.custom.js?build=#{app.application_build_timestamp}"></script>
|
||||
</ui:define>
|
||||
|
||||
|
||||
|
||||
<ui:define name="content">
|
||||
<f:view>
|
||||
<h:form>
|
||||
<ui:param name="searchresult" value="#{viewHandler.getData(searchController)}"></ui:param>
|
||||
<ui:param name="searchresultCount" value="#{searchController.getCount()}"></ui:param>
|
||||
<h:panelGroup styleClass="imixs-view imixs-search" layout="block" id="serach_view">
|
||||
|
||||
|
||||
<div class="imixs-header">
|
||||
<h1 id="worklist-title">
|
||||
Rechnungscontrolling - Archiv
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="imixs-body">
|
||||
<!-- *** Header **** -->
|
||||
<ui:fragment rendered="#{empty searchController.defaultQuery}">
|
||||
<div class="imixs-header" style="">
|
||||
<!-- *** Header **** -->
|
||||
<ui:include src="/pages/workitems/agl_archive_filter.xhtml" />
|
||||
</div>
|
||||
</ui:fragment>
|
||||
|
||||
|
||||
<div class="imixs-view-submit-panel">
|
||||
<!-- Search Button and Search Order -->
|
||||
|
||||
|
||||
<h:commandButton value="#{message.search}"
|
||||
action="#{customSearchController.refreshAGLArchive()}">
|
||||
<f:ajax render="@form" execute="@form" onevent="updateSearchForm" />
|
||||
</h:commandButton>
|
||||
<h:commandButton value="#{message.reset}" action="#{customSearchController.resetSearch()}">
|
||||
<f:ajax render="@form" execute="@form" onevent="updateSearchForm" />
|
||||
</h:commandButton>
|
||||
|
||||
<!-- Sort Order -->
|
||||
<div style="float: right; padding: 0 10px;"
|
||||
class="pull-right ui-button ui-widget ui-state-default ui-corner-all">
|
||||
<h:outputText title="#{message['worklist.sortorder_help']}"
|
||||
value="#{message['worklist.sortorder']}: " />
|
||||
<h:selectOneMenu style="background:#fff;"
|
||||
value="#{searchController.searchFilter.item['sortorder']}">
|
||||
<f:selectItem itemValue="" itemLabel="#{message['worklist.sortorder_relevance']}" />
|
||||
<f:selectItem itemValue="1" itemLabel="#{message['worklist.sortorder_newest']}" />
|
||||
<f:selectItem itemValue="2" itemLabel="#{message['worklist.sortorder_oldest']}" />
|
||||
<f:ajax event="change" render="@form"
|
||||
listener="#{customSearchController.refreshSearch}"
|
||||
onevent="imixsOfficeMain.layoutAjaxEvent" />
|
||||
</h:selectOneMenu>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<ui:param name="noresult"
|
||||
value="#{(empty searchresult) and (empty searchController.searchFilter.item['phrase'])}">
|
||||
</ui:param>
|
||||
|
||||
<ui:fragment rendered="#{!noresult}">
|
||||
<h:panelGroup layout="block" id="worklist-body">
|
||||
|
||||
|
||||
<div class="search-result-summary">#{message.total_result} #{searchresultCount}
|
||||
#{message.serach_hits}</div>
|
||||
|
||||
<!-- display search result -->
|
||||
<ui:repeat var="workitem" value="#{searchresult}">
|
||||
<ui:include src="worklist_viewentry.xhtml">
|
||||
<ui:param name="workitem" value="#{workitem}" />
|
||||
</ui:include>
|
||||
</ui:repeat>
|
||||
|
||||
|
||||
<!-- display empty search result -->
|
||||
<h:panelGroup
|
||||
rendered="#{(empty searchresult) and (empty facesContext.maximumSeverity)}">
|
||||
<h2>#{message.empty_worklist}</h2>
|
||||
</h:panelGroup>
|
||||
|
||||
|
||||
<!-- display parsing error -->
|
||||
<h:panelGroup rendered="#{! empty facesContext.maximumSeverity}" styleClass="ui-widget">
|
||||
<div class="ui-state-error"
|
||||
style="padding: .7em; margin-bottom: .7em; border: none;">
|
||||
<h3>
|
||||
<span class="typcn typcn-warning-outline"></span>
|
||||
#{message.search_error_title}
|
||||
</h3>
|
||||
<p>
|
||||
<h:messages globalOnly="true" />
|
||||
</p>
|
||||
</div>
|
||||
</h:panelGroup>
|
||||
</h:panelGroup>
|
||||
|
||||
|
||||
<div class="imixs-footer">
|
||||
<h:commandButton actionListener="#{viewHandler.back(searchController)}"
|
||||
disabled="#{searchController.pageIndex==0}" value="#{message.prev}">
|
||||
<f:ajax render="serach_view"
|
||||
onevent="function(data) { imixsOfficeMain.layoutAjaxEvent(data, '#{component.parent.parent.clientId}') }" />
|
||||
</h:commandButton>
|
||||
<h:commandButton actionListener="#{viewHandler.forward(searchController)}"
|
||||
disabled="#{searchController.endOfList}" value="#{message.next}">
|
||||
|
||||
<f:ajax render="serach_view"
|
||||
onevent="function(data) { imixsOfficeMain.layoutAjaxEvent(data, '#{component.parent.parent.clientId}') }" />
|
||||
|
||||
</h:commandButton>
|
||||
</div>
|
||||
|
||||
</ui:fragment>
|
||||
|
||||
</div>
|
||||
</h:panelGroup>
|
||||
|
||||
</h:form>
|
||||
</f:view>
|
||||
|
||||
|
||||
|
||||
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:a="http://xmlns.jcp.org/jsf/passthrough"
|
||||
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty" xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs">
|
||||
|
||||
<!-- *** Krieger Custom Search form *** -->
|
||||
<hr style="border-width:5px" />
|
||||
<div class="imixs-form-section-3">
|
||||
<dl>
|
||||
<dt>#{custom.invoiceamount}:</dt>
|
||||
<dd>
|
||||
<h:inputText style="width:12em;" value="#{searchController.searchFilter.item['invoice.total']}">
|
||||
<f:convertNumber minFractionDigits="2" locale="de" />
|
||||
</h:inputText>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>#{custom.invoicedate}:</dt>
|
||||
<dd>
|
||||
<h:inputText styleClass="imixs-date" value="#{searchController.searchFilter.item['invoice.date']}">
|
||||
<f:convertDateTime pattern="#{message.datePatternShort}" timeZone="#{message.timeZone}" />
|
||||
</h:inputText>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>#{custom.invoiceduedate}:</dt>
|
||||
<dd>
|
||||
<h:inputText styleClass="imixs-date" value="#{searchController.searchFilter.item['invoice.duedate']}">
|
||||
<f:convertDateTime pattern="#{message.datePatternShort}" timeZone="#{message.timeZone}" />
|
||||
</h:inputText>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>#{custom.closingdate}:</dt>
|
||||
<dd>
|
||||
<h:inputText styleClass="imixs-date"
|
||||
value="#{searchController.searchFilter.item['invoice.closingdate']}">
|
||||
<f:convertDateTime pattern="#{message.datePatternShort}" timeZone="#{message.timeZone}" />
|
||||
</h:inputText>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dt>#{custom.creditor_number}:</dt>
|
||||
<dd>
|
||||
<h:inputText value="#{searchController.searchFilter.item['cdtr.number']}">
|
||||
|
||||
</h:inputText>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dt>#{custom.invoicenumber}:</dt>
|
||||
<dd>
|
||||
<h:inputText value="#{searchController.searchFilter.item['invoice.number']}">
|
||||
|
||||
</h:inputText>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
<div class="imixs-form-section">
|
||||
|
||||
<dl>
|
||||
<dt>Rechnungsart:</dt>
|
||||
<dd>
|
||||
|
||||
<h:selectOneRadio value="#{searchController.searchFilter.item['invoice.type']}">
|
||||
<f:selectItem itemLabel="Alle" itemValue="0" />
|
||||
<f:selectItem itemLabel="Cargo Rechnung" itemValue="1" />
|
||||
<f:selectItem itemLabel="Sachrechnung" itemValue="2" />
|
||||
<f:selectItem itemLabel="Gutschrift" itemValue="3" />
|
||||
<f:selectItem itemLabel="Gutschrift Abgleich" itemValue="4" />
|
||||
</h:selectOneRadio>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<hr style="border-width:5px" />
|
||||
</ui:composition>
|
||||
Loading…
Reference in a new issue