diff --git a/office-alexander-logistics-app/pom.xml b/office-alexander-logistics-app/pom.xml index ee03740..0b0cb51 100644 --- a/office-alexander-logistics-app/pom.xml +++ b/office-alexander-logistics-app/pom.xml @@ -6,7 +6,7 @@ office-alexander-logistics com.alexander-logistics - 1.2.16 + 1.2.17 office-alexander-logistics-app war diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CustomSearchController.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CustomSearchController.java new file mode 100644 index 0000000..f624499 --- /dev/null +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CustomSearchController.java @@ -0,0 +1,173 @@ +/******************************************************************************* + * Imixs Workflow Technology + * Copyright (C) 2003, 2008 Imixs Software Solutions GmbH, + * http://www.imixs.com + * + * This program 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 2 + * of the License, or (at your option) any later version. + * + * This program 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 can receive a copy of the GNU General Public + * License at http://www.gnu.org/licenses/gpl.html + * + * Contributors: + * Imixs Software Solutions GmbH - initial API and implementation + * Ralph Soika + * + *******************************************************************************/ +package com.alexanderlogistics; + +import java.io.Serializable; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +import javax.enterprise.context.ConversationScoped; +import javax.enterprise.event.Observes; +import javax.inject.Named; + +import org.imixs.workflow.office.views.SearchEvent; + +/** + * Der CustomSearchController reagiert auf SeachEvents und erweitert das Search + * Query um Rechnungbetrag von-bis. + * + * @author rsoika + * @version 1.0 + */ + +@Named +@ConversationScoped +public class CustomSearchController implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Erweitere Query + * + * _amount_brutto_from, _amount_brutto_to + * + * @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(); + float invoiceTotal = searchEvent.getSearchFilter().getItemValueFloat("invoice.total"); + Date invoiceDate = searchEvent.getSearchFilter().getItemValueDate("invoice.date"); + Date dueDate = searchEvent.getSearchFilter().getItemValueDate("invoice.duedate"); + Date closingDate = searchEvent.getSearchFilter().getItemValueDate("invoice.closingdate"); + + String cdtrNumber = searchEvent.getSearchFilter().getItemValueString("cdtr.number"); + + // 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) + ")"; + + } + + // invoice.date + if (invoiceDate != null) { + query += " (invoice.date:" + CustomSearchController.getRangeDay(invoiceDate) + ")"; + + } + + // invoice.duedate + if (dueDate != null) { + query += " (invoice.duedate:" + CustomSearchController.getRangeDay(dueDate) + ")"; + + } + + // invoice.closingdate + if (closingDate != null) { + query += " ($lasteventdate:" + CustomSearchController.getRangeMonth(closingDate) + ")"; + + } + + // dbtr.number + if (cdtrNumber != null && !cdtrNumber.isEmpty()) { + cdtrNumber = cdtrNumber.trim(); + if (!cdtrNumber.startsWith("K")) { + cdtrNumber = "K" + cdtrNumber; + } + query += " (cdtr.number:" + cdtrNumber + ")"; + } + + // Udpate query + searchEvent.setQuery(query); + + } + + private static String getRangeDay(Date dueDate) { + // Setze die Uhrzeit auf Mitternacht (00:00) + Calendar startCalendar = Calendar.getInstance(); + startCalendar.setTime(dueDate); + startCalendar.set(Calendar.HOUR_OF_DAY, 0); + startCalendar.set(Calendar.MINUTE, 0); + startCalendar.set(Calendar.SECOND, 0); + startCalendar.set(Calendar.MILLISECOND, 0); + + Date startDate = startCalendar.getTime(); + + // Setze die Uhrzeit auf 23:59:59.999 + Calendar endCalendar = Calendar.getInstance(); + endCalendar.setTime(dueDate); + endCalendar.set(Calendar.HOUR_OF_DAY, 23); + endCalendar.set(Calendar.MINUTE, 59); + endCalendar.set(Calendar.SECOND, 59); + endCalendar.set(Calendar.MILLISECOND, 999); + + Date endDate = endCalendar.getTime(); + SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmm"); + String dateRange = "[" + dateformat.format(startDate) + " TO " + + dateformat.format(endDate) + "]"; + + return dateRange; + } + + private static String getRangeMonth(Date dueDate) { + // Setze die Uhrzeit auf Mitternacht (00:00) + Calendar startCalendar = Calendar.getInstance(); + startCalendar.setTime(dueDate); + startCalendar.set(Calendar.HOUR_OF_DAY, 0); + startCalendar.set(Calendar.MINUTE, 0); + startCalendar.set(Calendar.SECOND, 0); + startCalendar.set(Calendar.MILLISECOND, 0); + startCalendar.set(Calendar.DAY_OF_MONTH, 1); + + Date startDate = startCalendar.getTime(); + + // Setze die Uhrzeit auf 23:59:59.999 + Calendar endCalendar = Calendar.getInstance(); + endCalendar.setTime(dueDate); + endCalendar.set(Calendar.HOUR_OF_DAY, 23); + endCalendar.set(Calendar.MINUTE, 59); + endCalendar.set(Calendar.SECOND, 59); + endCalendar.set(Calendar.MILLISECOND, 999); + endCalendar.set(Calendar.DAY_OF_MONTH, 1); + endCalendar.add(Calendar.MONTH, 1); + endCalendar.add(Calendar.DAY_OF_MONTH, -1); + + Date endDate = endCalendar.getTime(); + SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmm"); + String dateRange = "[" + dateformat.format(startDate) + " TO " + + dateformat.format(endDate) + "]"; + + return dateRange; + } +} diff --git a/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties b/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties index d73ebff..379399b 100644 --- a/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties +++ b/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties @@ -27,10 +27,13 @@ pos.net=Netto pos.gross=Brutto creditor_name=Kreditor +creditor_number=Kreditornummer invoicenumber=Rechnungsnummer invoicedate=Rechnungsdatum invoiceduedate=Fälligkeit +invoiceamount=Rechnungsbetrag amount=Betrag +closingdate=Abschlussdatum (nur Monat) ERROR_CDTR_INVALID=Die Kreditorennummer ist nicht gültig ERROR_BOOKING_PERIOD=Eingabefehler - Bitte geben Sie eine gültige Buchungsperiode ein! Prüfen Sie auch die Spalte BP in der Positionstabelle. diff --git a/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties b/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties index ea86451..e480a17 100644 --- a/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties +++ b/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties @@ -27,10 +27,14 @@ pos.net=Net pos.gross=Gross creditor_name=Creditor +creditor_number=Creditor No. invoicenumber=Invoice No. invoicedate=Invoice Date invoiceduedate=Due Date +invoiceamount=Invoice amount amount=Amount +closingdate=Closing date (Month only) + ERROR_CDTR_INVALID=The creditor number is not valid ERROR_BOOKING_PERIOD=Input error - Please enter a valid booking period! Also check the BP column in the position table. diff --git a/office-alexander-logistics-app/src/main/resources/imixs.properties b/office-alexander-logistics-app/src/main/resources/imixs.properties index 7c019ec..e7e37bc 100644 --- a/office-alexander-logistics-app/src/main/resources/imixs.properties +++ b/office-alexander-logistics-app/src/main/resources/imixs.properties @@ -4,7 +4,7 @@ lucence.indexDir=${imixs-office.IndexDir} index.fields=txtsearchstring,txtSubject,txtname,txtEmail,txtUserName,namCreator,txtworkflowgroup,txtworkflowstatus,txtWorkflowAbstract,txtWorkflowSummary,txtworkflowhistory,txtspacename,txtprocessname,_subject,_description,_name,_projectnumber,_projectname,_ordernumber,_contractnumber,datDueDate,txtcommentlog,htmldescription,htmldocumentation,dms,dms_names,invoice.number.stripped,_childitems,$file.names,_VENDOR_NAME,dbtr.number,cdtr.number index.fields.analyze=txtUsername -index.fields.noanalyze=type,$UniqueIDRef,$created,$modified,$ModelVersion,$participants,namCreator,$ProcessID,datDate,txtWorkflowGroup,txtemail, datdate, datfrom, datto, numsequencenumber,dms_count,invoice.number,invoice.number.stripped,invoice.date,invoice.duedate,taxonomy.verteilung.stop,taxonomy.sachpruefung.stop,taxonomy.verteilung.start,taxonomy.sachpruefung.start,taxonomy.buchhaltung.start,taxonomy.buchhaltung.stop,dbtr.number,cdtr.number,payment.date +index.fields.noanalyze=type,$UniqueIDRef,$created,$modified,$ModelVersion,$participants,namCreator,$ProcessID,datDate,txtWorkflowGroup,txtemail, datdate, datfrom, datto, numsequencenumber,dms_count,invoice.number,invoice.number.stripped,invoice.date,invoice.duedate,taxonomy.verteilung.stop,taxonomy.sachpruefung.stop,taxonomy.verteilung.start,taxonomy.sachpruefung.start,taxonomy.buchhaltung.start,taxonomy.buchhaltung.stop,dbtr.number,cdtr.number,payment.date,invoice.total,$lasteventdate index.fields.store=process.name,txtProcessName,txtWorkflowImageURL,payment.date,invoice.number,invoice.date,invoice.duedate index.fields.category=space.name,space.ref,taxonomy.verteilung.stop.by,taxonomy.sachpruefung.stop.by,taxonomy.buchhaltung.stop.by office.search.noanalyze=invoice.number,invoice.number.stripped diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/worklist_search_custom.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/worklist_search_custom.xhtml new file mode 100644 index 0000000..612016f --- /dev/null +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/worklist_search_custom.xhtml @@ -0,0 +1,57 @@ + + + +
+
+
#{custom.invoiceamount}:
+
+ + + + +
+
+
+
#{custom.invoicedate}:
+
+ + + +
+
+
+
#{custom.invoiceduedate}:
+
+ + + +
+
+ + +
+
#{custom.closingdate}:
+
+ + + +
+
+ +
+
#{custom.creditor_number}:
+
+ + + +
+
+ + + +
+
\ No newline at end of file diff --git a/pom.xml b/pom.xml index f402373..5ce210e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.alexander-logistics office-alexander-logistics - 1.2.16 + 1.2.17 pom Imixs Office Workflow - Custom Build