zahlungsziel verwaltung und übernahme bei Bearbeitung

This commit is contained in:
Ralph Soika 2022-02-21 16:37:52 +01:00
parent b39b2cc928
commit c54513edf2
7 changed files with 176 additions and 34 deletions

View file

@ -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>

View file

@ -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:
@ -70,7 +74,6 @@ public class CargosoftController implements Serializable {
logger.fine("search prase '" + phrase + "'");
// String input =workflowController.getWorkitem().getItemValueString(itemName);
if (phrase == null || phrase.length() < 2) {
return;
@ -78,7 +81,8 @@ public class CargosoftController implements Serializable {
// 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);
@ -92,22 +96,18 @@ public class CargosoftController implements Serializable {
// 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"));
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());
}
}
}

View file

@ -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>

View file

@ -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>

View file

@ -51,12 +51,25 @@
// 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();
}
}
/*]]>*/

View file

@ -3,12 +3,13 @@
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[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">

View file

@ -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>