zahlungsziel verwaltung und übernahme bei Bearbeitung
This commit is contained in:
parent
b39b2cc928
commit
c54513edf2
7 changed files with 176 additions and 34 deletions
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>office-alexander-logistics</artifactId>
|
||||
<groupId>com.alexander-logistics</groupId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.2.3</version>
|
||||
</parent>
|
||||
<artifactId>office-alexander-logistics-app</artifactId>
|
||||
<packaging>war</packaging>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ import org.imixs.workflow.engine.DocumentService;
|
|||
import org.imixs.workflow.exceptions.QueryException;
|
||||
|
||||
/**
|
||||
* The CargosoftController CDI Bean provides Front-End methods for the cargosoft kreditore objects.
|
||||
* The CargosoftController CDI Bean provides Front-End methods for the cargosoft
|
||||
* kreditore objects.
|
||||
* <p>
|
||||
* The method search provides a suggest list searching a phrase within the
|
||||
* cargosoft creditor list (type=cargosoftkreditor).
|
||||
|
|
@ -30,23 +31,26 @@ public class CargosoftController implements Serializable {
|
|||
private static final long serialVersionUID = 1L;
|
||||
private static Logger logger = Logger.getLogger(CargosoftController.class.getName());
|
||||
|
||||
|
||||
public static final String TYPE_CARGOSOFTKREDITOR = "cargosoftkreditor";
|
||||
|
||||
@Inject
|
||||
protected DocumentService documentService;
|
||||
|
||||
|
||||
private List<String> searchResult = null;
|
||||
|
||||
private ItemCollection kreditor = null; // used for zahlungsziel (kreidtor.xhtml)
|
||||
|
||||
/**
|
||||
* This method searches a text phrase within the list of cargosoft kreditor objects (type=cargosoftkreditor).
|
||||
* This method searches a text phrase within the list of cargosoft kreditor
|
||||
* objects (type=cargosoftkreditor).
|
||||
* <p>
|
||||
* JSF Integration:
|
||||
*
|
||||
* {@code
|
||||
*
|
||||
* <h:commandScript name="imixsOfficeWorkflow.mlSearch" action=
|
||||
* "#{cargosoftController.search()}" rendered="#{cargosoftController!=null}" render=
|
||||
* "cargosoft-results" /> }
|
||||
* "#{cargosoftController.search()}" rendered="#{cargosoftController!=null}"
|
||||
* render= "cargosoft-results" /> }
|
||||
*
|
||||
* <p>
|
||||
* JavaScript Example:
|
||||
|
|
@ -64,50 +68,46 @@ public class CargosoftController implements Serializable {
|
|||
// get the param from faces context....
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
String phrase = fc.getExternalContext().getRequestParameterMap().get("phrase");
|
||||
if (phrase==null) {
|
||||
if (phrase == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
logger.fine("search prase '" + phrase + "'");
|
||||
|
||||
|
||||
// String input =workflowController.getWorkitem().getItemValueString(itemName);
|
||||
if (phrase == null || phrase.length() < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
// die cargosoft Kreditornummer beginnt seltsamerweise mit einem K
|
||||
// die cargosoft Kreditornummer beginnt seltsamerweise mit einem K
|
||||
// und die Debitoren mit einem D.....
|
||||
String query="(type:cargosoftkreditor) AND ( (name:K" + phrase + "*) OR (name:D" + phrase + "*) OR ("+phrase.toLowerCase() + "*) )";
|
||||
|
||||
String query = "(type:" + TYPE_CARGOSOFTKREDITOR + ") AND ( (name:K" + phrase + "*) OR (name:D" + phrase
|
||||
+ "*) OR (" + phrase.toLowerCase() + "*) )";
|
||||
|
||||
try {
|
||||
List<ItemCollection> result = documentService.find(query, 20, 0);
|
||||
logger.info("found " + result.size() + " creditors...");
|
||||
if (result!=null) {
|
||||
for (ItemCollection cdtr: result) {
|
||||
|
||||
String cdtrNo=cdtr.getItemValueString("_VENDOR_NUM");
|
||||
if (result != null) {
|
||||
for (ItemCollection cdtr : result) {
|
||||
|
||||
String cdtrNo = cdtr.getItemValueString("_VENDOR_NUM");
|
||||
// Aenderugn 22. Jun wir geben das K/D direkt witer
|
||||
// if (cdtrNo.startsWith("K")) {
|
||||
// wir entfernen das führende K
|
||||
// cdtrNo=cdtrNo.substring(1);
|
||||
// }
|
||||
searchResult.add(cdtrNo + " - "+cdtr.getItemValueString("_VENDOR_Name"));
|
||||
//logger.finest("...add: " + cdtr.getItemValueString("_VENDOR_NUM") + " - "+cdtr.getItemValueString("_VENDOR_Name"));
|
||||
// if (cdtrNo.startsWith("K")) {
|
||||
// wir entfernen das führende K
|
||||
// cdtrNo=cdtrNo.substring(1);
|
||||
// }
|
||||
searchResult.add(cdtrNo + " - " + cdtr.getItemValueString("_VENDOR_Name") + " - "
|
||||
+ cdtr.getItemValueString("cdtr.creditperiod"));
|
||||
// logger.finest("...add: " + cdtr.getItemValueString("_VENDOR_NUM") + " -
|
||||
// "+cdtr.getItemValueString("_VENDOR_Name"));
|
||||
}
|
||||
}
|
||||
} catch (QueryException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public List<String> getSearchResult() {
|
||||
return searchResult;
|
||||
}
|
||||
|
|
@ -120,4 +120,38 @@ public class CargosoftController implements Serializable {
|
|||
logger.fine("reset");
|
||||
}
|
||||
|
||||
public ItemCollection getKreditor() {
|
||||
if (kreditor == null) {
|
||||
kreditor = new ItemCollection();
|
||||
}
|
||||
return kreditor;
|
||||
}
|
||||
|
||||
public void setKreditor(ItemCollection kreditor) {
|
||||
this.kreditor = kreditor;
|
||||
}
|
||||
|
||||
public void updateZahlungsziel() {
|
||||
|
||||
String cdtrNumber = kreditor.getItemValueString("cdtr.number");
|
||||
String period = kreditor.getItemValueString("cdtr.creditperiod");
|
||||
logger.info("Zahlungsziel = " + cdtrNumber + " / " + period);
|
||||
|
||||
// search workitem
|
||||
String query = "(type:" + TYPE_CARGOSOFTKREDITOR + ") AND (name:" + cdtrNumber + ")";
|
||||
|
||||
List<ItemCollection> result;
|
||||
try {
|
||||
result = documentService.find(query, 1, 0);
|
||||
if (result.size() == 1) {
|
||||
ItemCollection cargoCreditor = result.get(0);
|
||||
cargoCreditor.setItemValue("cdtr.creditperiod", Integer.parseInt(period));
|
||||
documentService.save(cargoCreditor);
|
||||
}
|
||||
} catch (QueryException | NumberFormatException e) {
|
||||
logger.severe("Unable to find cargosoft kreditor "+e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
<li><h:link outcome="/pages/admin/document_import">Dokument Import</h:link></li>
|
||||
<li><h:link outcome="/pages/admin/sepa_config">SEPA</h:link></li>
|
||||
<li><h:link outcome="/pages/admin/analyse_invoicing">Analyse Rechnungseingang</h:link></li>
|
||||
<li><h:link outcome="/pages/admin/kreditor">Kreditoren Zahlungsziele</h:link></li>
|
||||
</ul>
|
||||
</f:subview>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
<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:pt="http://xmlns.jcp.org/jsf/passthrough"
|
||||
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"
|
||||
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs"
|
||||
template="/layout/template.xhtml">
|
||||
|
||||
|
||||
|
||||
|
||||
<ui:define name="content">
|
||||
|
||||
|
||||
<f:view>
|
||||
<h:form id="zahlungsziel_form_id">
|
||||
<!-- Cargosoft Creditor Search integration -->
|
||||
<ui:include
|
||||
src="/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml">
|
||||
<ui:param name="workitem" value="#{cargosoftController.kreditor}" />
|
||||
</ui:include>
|
||||
<div class="imixs-form">
|
||||
<div class="imixs-header">
|
||||
<h1>
|
||||
<h:outputText value="Kreditoren Zahlungsziele " />
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ########## Error ########## -->
|
||||
<ui:include src="/pages/error_message.xhtml" />
|
||||
|
||||
<div class="imixs-body">
|
||||
|
||||
<div class="imixs-form-panel">
|
||||
<div class="imixs-form-section-2">
|
||||
|
||||
<dl>
|
||||
<dt>Kreditor:</dt>
|
||||
|
||||
<dd>
|
||||
<h:inputText
|
||||
value="#{cargosoftController.kreditor.item['cdtr.number']}"
|
||||
pt:data-item="cdtr.number" />
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
|
||||
<h:panelGroup layout="block" styleClass="imixs-form-section"
|
||||
id="contentIputID">
|
||||
<dl>
|
||||
<dt>Zahlungsziel:</dt>
|
||||
<dd><h:inputText style="width:5em;"
|
||||
value="#{cargosoftController.kreditor.item['cdtr.creditperiod']}"
|
||||
pt:data-item="cdtr.creditperiod"
|
||||
/> Tage</dd>
|
||||
</dl>
|
||||
|
||||
</h:panelGroup>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="imixs-footer">
|
||||
<h:commandButton
|
||||
action="/pages/admin/kreditor.xhtml?faces-redirect=true"
|
||||
actionListener="#{cargosoftController.updateZahlungsziel()}"
|
||||
value="#{message.save}" />
|
||||
|
||||
<h:commandButton value="#{message.close}" immediate="true"
|
||||
action="/pages/notes.xhtml?faces-redirect=true"
|
||||
actionListener="#{documentController.close()}" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</h:form>
|
||||
|
||||
|
||||
|
||||
|
||||
</f:view>
|
||||
</ui:define>
|
||||
|
||||
|
||||
|
||||
</ui:composition>
|
||||
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
-->
|
||||
<h:commandScript name="cargosoftSearch" action="#{cargosoftController.searchCreditor()}"
|
||||
render="autocomplete-resultlist-cargosoft" onevent="autocompleteShowResult" />
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
|
|
@ -51,13 +51,26 @@
|
|||
// extract the number between start and ' - '
|
||||
var cdtrNo=selection.substring(0,selection.indexOf(' - '));
|
||||
var cdtrName=selection.substring(selection.indexOf(' - ')+3);
|
||||
|
||||
var inputElement=$("input[data-item='cdtr.number']");
|
||||
inputElement.val(cdtrNo);
|
||||
// remove old cdtr.name
|
||||
$('#cdtr-name-id').remove();
|
||||
// append span with cdtr.name....
|
||||
inputElement.after( "<span id='cdtr-name-id' class='small'>" + cdtrName + "</p>" );
|
||||
}
|
||||
|
||||
|
||||
// zahlungsziel
|
||||
var cdtrPaymentPeriod=selection.substring(selection.lastIndexOf(' - ')+3);
|
||||
var inputElementZahlungsziel=$("input[data-item='cdtr.creditperiod']");
|
||||
if (inputElementZahlungsziel && cdtrPaymentPeriod!='') {
|
||||
inputElementZahlungsziel.val(cdtrPaymentPeriod);
|
||||
inputElementZahlungsziel.change();
|
||||
$('.alexander-logistic-date').focus().select();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*]]>*/
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@
|
|||
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
|
||||
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty">
|
||||
|
||||
|
||||
<ui:fragment rendered="#{!readonly}" >
|
||||
<ui:param name="namesub" value="#{name}_days"></ui:param>
|
||||
<h:inputText value="#{workitem.item[namesub]}" style="width:2em;" class="alexander-logistic-date-days" />
|
||||
<h:inputText value="#{workitem.item[name]}"
|
||||
<h:inputText value="#{workitem.item[namesub]}" style="width:2em;" class="alexander-logistic-date-days" pt:data-item="cdtr.creditperiod" />
|
||||
<h:inputText value="#{workitem.item[name]}"
|
||||
onchange="validateBuchungsDatum(this,true);" id="date_invoice"
|
||||
required="false" styleClass="alexander-logistic-date">
|
||||
<f:convertDateTime pattern="#{message.datePatternShort}"
|
||||
|
|
|
|||
2
pom.xml
2
pom.xml
|
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.alexander-logistics</groupId>
|
||||
<artifactId>office-alexander-logistics</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.2.3</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Imixs Office Workflow - Custom Build</name>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue