Opliste als maske ergänzt und controller bereitgestellt
This commit is contained in:
parent
a6be684b43
commit
c4cfcfb7f8
4 changed files with 103 additions and 73 deletions
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import javax.enterprise.context.ConversationScoped;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
|
|
@ -37,28 +38,47 @@ public class OPListController implements Serializable {
|
|||
@Inject
|
||||
protected DocumentService documentService;
|
||||
|
||||
|
||||
public List<ItemCollection> getInvoices(String dbtrNumber) {
|
||||
List<ItemCollection> result=new ArrayList<ItemCollection>();
|
||||
|
||||
List<ItemCollection> result = new ArrayList<ItemCollection>();
|
||||
logger.info("....getInvoices for " + dbtrNumber);
|
||||
if (dbtrNumber == null || dbtrNumber.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
// Aus der dbtrNummer muss das führendde D entfernt werden
|
||||
// wir speichern dieses zwar im Zahlungseingangs Workflow, aber eine Ausganksrechnung kennt das nicht
|
||||
// wir speichern dieses zwar im Zahlungseingangs Workflow, aber eine
|
||||
// Ausganksrechnung kennt das nicht
|
||||
// Das ganze ist ein übles Relikt aus Cargosoft und kann nicht vermieden werden
|
||||
if (dbtrNumber.startsWith("D")) {
|
||||
dbtrNumber=dbtrNumber.substring(1);
|
||||
dbtrNumber = dbtrNumber.substring(1);
|
||||
}
|
||||
String query = "(type:workitem OR type:workitemarchive) AND ($modelversion:rechnungsausgang-*) AND (dbtr.number:" + dbtrNumber+")";
|
||||
String query = "(type:workitem OR type:workitemarchive) AND ($modelversion:rechnungsausgang-*) AND (dbtr.number:"
|
||||
+ dbtrNumber + ")";
|
||||
|
||||
try {
|
||||
result= documentService.find(query, 999, 0, "$created", false);
|
||||
result = documentService.find(query, 999, 0, "$created", false);
|
||||
} catch (QueryException e) {
|
||||
logger.severe("Failed to get op liste:" + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* THis Method is called by cargosft-debitor-serach.xhtml after the user has selected
|
||||
* a new debitor.
|
||||
* The meothod updates the dbtr.number of the current workitem.
|
||||
* The form will rerender the opList seciton
|
||||
*/
|
||||
public void loadOPList() {
|
||||
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
String dbtrNumber = fc.getExternalContext().getRequestParameterMap().get("dbtrNumber");
|
||||
logger.info(".........dbtrNumber = "+dbtrNumber);
|
||||
|
||||
workflowController.getWorkitem().setItemValue("dbtr.number", dbtrNumber);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method computes the sum for a given item in a list of workitems. The
|
||||
* result is rounded to 2 digits.
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
-->
|
||||
<h:commandScript name="cargosoftSearch" action="#{cargosoftController.searchDebitor()}"
|
||||
render="autocomplete-resultlist-cargosoft" onevent="autocompleteShowResult" />
|
||||
|
||||
|
||||
<h:commandScript name="loadOPList" action="#{opListController.loadOPList()}"
|
||||
render="#{opListContainer.clientId}" onevent="ajaxUpdateInvoiceSelection" />
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
|
||||
|
|
@ -41,7 +41,6 @@
|
|||
var dbtrName="#{workflowController.workitem.item['dbtr.name']}";
|
||||
// append span with dbtr.name....
|
||||
creditorField.after( "<span id='dbtr-name-id' class='small'>" + dbtrName + "</p>" );
|
||||
//var inputElement=$("input[data-item='dbtr.number']");
|
||||
});
|
||||
|
||||
// Hier bekommen wir die JSON Struktur mit allen daten.
|
||||
|
|
@ -62,24 +61,11 @@
|
|||
if (inputElementDbtrName) {
|
||||
inputElementDbtrName.val(dbtrData.name);
|
||||
}
|
||||
var inputElementZahlungsziel=$("input[data-item='dbtr.creditperiod']");
|
||||
|
||||
var inputElementZahlungszielDbtr=$("input[id$='dbtr_creditperiod']");
|
||||
var inputElementInvoiceDate=$("input[id$='date_invoice']");
|
||||
var inputElementIban=$("input[data-item='dbtr.iban']");
|
||||
var inputElementBic=$("input[data-item='dbtr.bic']");
|
||||
if (inputElementZahlungszielDbtr && dbtrData.creditperiod!='') {
|
||||
inputElementZahlungszielDbtr.val(dbtrData.creditperiod);
|
||||
}
|
||||
// nur wenn ein Rechnugnsdatum eingegeben wurde
|
||||
if (inputElementInvoiceDate && inputElementInvoiceDate.val()!='' && inputElementZahlungsziel && dbtrData.creditperiod!='') {
|
||||
inputElementZahlungsziel.val(dbtrData.creditperiod);
|
||||
inputElementZahlungsziel.change();
|
||||
//$('.alexander-logistic-date').focus().select();
|
||||
$("input[data-item='invoice.number']").focus().select();
|
||||
|
||||
}
|
||||
|
||||
// finally we do a trick and trigger the commandScript loadOPList which
|
||||
// refreshes the op section
|
||||
loadOPList({ dbtrNumber: dbtrData.no });
|
||||
}
|
||||
|
||||
/*]]>*/
|
||||
|
|
|
|||
|
|
@ -9,17 +9,16 @@
|
|||
|
||||
<!-- Shows the op liste fo rthe current dbtr.number -->
|
||||
|
||||
<h:panelGroup styleClass="imixs-form-section" id="zahlungsavis-table" binding="#{zahlungsavislistContainer}">
|
||||
<h:panelGroup styleClass="imixs-form-section" id="oplist-table" binding="#{opListContainer}">
|
||||
|
||||
<h3>Invoices</h3>
|
||||
<h3>Offene Posten</h3>
|
||||
|
||||
<table class="" style="width:100%">
|
||||
<tr>
|
||||
<th style="text-align: left;">#{message['form.invoicenumber']}</th>
|
||||
<th style="text-align: left;">#{message['form.date']}</th>
|
||||
<th style="text-align: left;">#{message['form.deadline']}</th>
|
||||
<th style="text-align: right;">Debit</th>
|
||||
<th style="text-align: right;">Credit</th>
|
||||
<th style="text-align: right;">S/H</th>
|
||||
<th style=""></th>
|
||||
<th style="width:40px;"></th>
|
||||
</tr>
|
||||
|
|
@ -45,38 +44,22 @@
|
|||
timeZone="#{message.timeZone}" />
|
||||
</h:outputText>
|
||||
</td>
|
||||
<!-- debit -->
|
||||
<ui:fragment rendered="#{invoice.item['payment.type'] eq 'credit'}">
|
||||
|
||||
<td style="text-align: right;"><h:outputText
|
||||
value="#{invoice.item['invoice.total']}">
|
||||
<f:convertNumber minFractionDigits="2" locale="de" />
|
||||
</h:outputText></td>
|
||||
<td />
|
||||
</ui:fragment>
|
||||
|
||||
<!-- credit -->
|
||||
<ui:fragment rendered="#{invoice.item['payment.type'] ne 'credit'}">
|
||||
<td />
|
||||
<td style="text-align: right;"><h:outputText
|
||||
value="#{invoice.item['invoice.total']}">
|
||||
<f:convertNumber minFractionDigits="2" locale="de" />
|
||||
</h:outputText></td>
|
||||
</ui:fragment>
|
||||
|
||||
|
||||
<!-- CheckBox -->
|
||||
<td><input type="checkbox" class="selection_checkbox"
|
||||
id="#{invoice.uniqueID}" /></td>
|
||||
|
||||
<td><h:commandLink
|
||||
actionListener="#{zahlungsavisController.removeInvoice(id)}">
|
||||
<span class="typcn typcn-trash imixs-state-info"></span>
|
||||
<f:ajax render="#{zahlungsavislistContainer.clientId}" />
|
||||
</h:commandLink>
|
||||
</td>
|
||||
</tr>
|
||||
</ui:repeat>
|
||||
|
||||
<tr style="border-top: 1px solid #ccc;">
|
||||
<td />
|
||||
<td />
|
||||
<td />
|
||||
<td />
|
||||
<td><strong>Summary</strong></td>
|
||||
|
|
@ -90,30 +73,71 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<h:inputTextarea converter="org.imixs.VectorConverter"
|
||||
<!-- dieses feld speichert die selection der rechnungen -->
|
||||
<h:inputTextarea converter="org.imixs.VectorConverter" class="invoice_selection_list"
|
||||
style="display:none;"
|
||||
value="#{workitem.itemList['$workitemref']}">
|
||||
</h:inputTextarea>
|
||||
|
||||
|
||||
|
||||
|
||||
</h:panelGroup>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
$(document).ready(
|
||||
function() {
|
||||
// update the checkboxes of the stored invoice uniqueIDs
|
||||
updateInvoiceSelection();
|
||||
});
|
||||
|
||||
|
||||
// This method refreshs the layout
|
||||
function updateItems(data) {
|
||||
// This method refreshs the layout of the invoice checkboxes
|
||||
function updateInvoiceSelection() {
|
||||
selection = $('.invoice_selection_list').val();
|
||||
const selectionArr = selection.split("\n");
|
||||
for (const invoiceID of selectionArr) {
|
||||
if (invoiceID && invoiceID!="") {
|
||||
$("#"+invoiceID).prop('checked', true);//=true;
|
||||
}
|
||||
}
|
||||
|
||||
// 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("\n");
|
||||
// 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('\n'));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Hilfsmethode die nur fur Ajax Events in JSF render verwendet wird
|
||||
*/
|
||||
function ajaxUpdateInvoiceSelection(data) {
|
||||
if (data.status === 'success') {
|
||||
$('form').imixsLayout();
|
||||
updateInvoiceSelection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*]]>*/
|
||||
</script>
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ result.isValid=true;
|
|||
<bpmn2:task id="Task_2" imixs:processid="1900" name="Gebucht">
|
||||
<bpmn2:extensionElements>
|
||||
<imixs:item name="txtworkflowsummary" type="xs:string">
|
||||
<imixs:value><![CDATA[<itemvalue>cdtr.name.cargosoft</itemvalue> <itemvalue format="EEEE, d. MMMM yyyy" locale="de_DE">$modified</itemvalue> (<itemvalue>cdtr.number</itemvalue>)]]></imixs:value>
|
||||
<imixs:value><![CDATA[<itemvalue format="dd. MM.yyyy">$created</itemvalue> - <itemvalue>payment.total</itemvalue> <itemvalue>payment.currency</itemvalue> (<itemvalue>dbtr.number</itemvalue> - <itemvalue>dbtr.name</itemvalue>)]]></imixs:value>
|
||||
</imixs:item>
|
||||
<imixs:item name="keyupdateacl" type="xs:boolean">
|
||||
<imixs:value>true</imixs:value>
|
||||
|
|
@ -185,10 +185,10 @@ result.isValid=true;
|
|||
<bpmn2:task id="Task_1" imixs:processid="1000" name="Erfassung">
|
||||
<bpmn2:extensionElements>
|
||||
<imixs:item name="txtworkflowsummary" type="xs:string">
|
||||
<imixs:value><![CDATA[<itemvalue>cdtr.name.cargosoft</itemvalue> <itemvalue format="EEEE, d. MMMM yyyy" locale="de_DE">$modified</itemvalue> (<itemvalue>cdtr.number</itemvalue>)]]></imixs:value>
|
||||
<imixs:value><![CDATA[<itemvalue format="dd. MM.yyyy">$created</itemvalue> - <itemvalue>payment.total</itemvalue> <itemvalue>payment.currency</itemvalue> (<itemvalue>dbtr.number</itemvalue> - <itemvalue>dbtr.name</itemvalue>)]]></imixs:value>
|
||||
</imixs:item>
|
||||
<imixs:item name="txteditorid" type="xs:string">
|
||||
<imixs:value><![CDATA[alexander/form_basic#opliste]]></imixs:value>
|
||||
<imixs:value><![CDATA[alexander/form_basic#alexander/sub_opliste]]></imixs:value>
|
||||
</imixs:item>
|
||||
<imixs:item name="txtimageurl" type="xs:string">
|
||||
<imixs:value><![CDATA[typcn-database||||typcn-arrow-forward]]></imixs:value>
|
||||
|
|
@ -223,7 +223,7 @@ result.isValid=true;
|
|||
<bpmn2:task id="Task_6" imixs:processid="1800" name="Storniert">
|
||||
<bpmn2:extensionElements>
|
||||
<imixs:item name="txtworkflowsummary" type="xs:string">
|
||||
<imixs:value><![CDATA[<itemvalue>cdtr.name.cargosoft</itemvalue> <itemvalue format="EEEE, d. MMMM yyyy" locale="de_DE">$modified</itemvalue> (<itemvalue>cdtr.number</itemvalue>)]]></imixs:value>
|
||||
<imixs:value><![CDATA[<itemvalue format="dd. MM.yyyy">$created</itemvalue> - <itemvalue>payment.total</itemvalue> <itemvalue>payment.currency</itemvalue> (<itemvalue>dbtr.number</itemvalue> - <itemvalue>dbtr.name</itemvalue>)]]></imixs:value>
|
||||
</imixs:item>
|
||||
<imixs:item name="keyupdateacl" type="xs:boolean">
|
||||
<imixs:value>true</imixs:value>
|
||||
|
|
@ -483,7 +483,7 @@ result.isValid=true;
|
|||
<bpmn2:documentation id="Documentation_17"><![CDATA[<?xml version="1.0"?>
|
||||
<imixs-form>
|
||||
<imixs-form-section columns="2" label="Zahlungsdaten">
|
||||
<item name="name" type="text" required="true" label="Text:" />
|
||||
<item name="name" type="text" required="true" label="Referenz:" />
|
||||
<item name="dbtr.number" type="text" required="true" label="Debitor:" />
|
||||
<item name="payment.total" type="currency" required="true" label="Zahlbetrag:" />
|
||||
<item name="payment.currency" type="selectOneMenu" required="true" options="EUR;CHF;SEK;RUB;NOK;GBP;USD;CAD" label="Währung:" />
|
||||
|
|
@ -568,13 +568,13 @@ result.isValid=true;
|
|||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="BPMNShape_IntermediateCatchEvent_6" bpmnElement="IntermediateCatchEvent_6">
|
||||
<dc:Bounds height="36.0" width="36.0" x="939.0" y="162.0"/>
|
||||
<bpmndi:BPMNLabel id="BPMNLabel_10">
|
||||
<bpmndi:BPMNLabel id="BPMNLabel_10" labelStyle="BPMNLabelStyle_1">
|
||||
<dc:Bounds height="14.0" width="56.0" x="929.0" y="198.0"/>
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="BPMNShape_IntermediateCatchEvent_3" bpmnElement="IntermediateCatchEvent_3">
|
||||
<dc:Bounds height="36.0" width="36.0" x="327.0" y="392.0"/>
|
||||
<bpmndi:BPMNLabel id="BPMNLabel_21">
|
||||
<bpmndi:BPMNLabel id="BPMNLabel_21" labelStyle="BPMNLabelStyle_1">
|
||||
<dc:Bounds height="14.0" width="56.0" x="317.0" y="428.0"/>
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
|
|
|
|||
Loading…
Reference in a new issue