Skip to content

Commit

Permalink
XSL Update (Issue #170)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoika committed Feb 10, 2025
1 parent 618f31f commit a5a6fa2
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ private void appendInvoice(ItemCollection invoice) throws PluginException {
// set consultant ID
datevExport.setItemValue(DatevService.ITEM_DATEV_CONSULTANT_ID,
datevConfig.getItemValue(DatevService.ITEM_DATEV_CONSULTANT_ID));
datevExport.setItemValue(DatevService.ITEM_DATEV_FISCAL_START,
datevConfig.getItemValue(DatevService.ITEM_DATEV_FISCAL_START));

datevExport.setItemValue(DatevService.ITEM_DATEV_BOOKING_PERIOD, keyPeriode);
datevExport.setItemValue("name", key);
Expand Down
252 changes: 252 additions & 0 deletions imixs-adapters-datev/src/main/webapp/booking_account.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
<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"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions">

<h:panelGroup layout="block" styleClass="imixs-form-section" style="position: relative;"
id="bookinglist" binding="#{orderlistContainer}">

<c:if test="#{!readonly}">
<h:commandScript name="sachkontoSearch" action="#{datevSearchController.searchSachkonto()}"
render="autocomplete-resultlist-datev-sachkonto" onevent="autocompleteShowResult" />
<table class="imixsdatatable imixs-bookingitems">
<tr>
<th style="width: 300px;">Buchungskonto</th>
<!--
<th style="width: 100px;">Kostenstelle I.</th>
<th style="width: 100px;">Kostenstelle II.</th>
-->
<th style="width: 170px;">BU Schlüssel</th>
<th style="min-width: 120px;">Betrag</th>
<th style="width: 10px;">
<!-- delete -->
</th>
</tr>
<ui:repeat var="bookingItem"
value="#{childItemController.childItems}">
<tr>
<td class="konto-input">
<!-- Input Field -->
<h:panelGroup id="konto_input_box"
layout="block" class="marty-userinput-inputbox"
style="height:inherit;">
<h:inputText style="width:100%;" id="konto-input-id"
value="#{bookingItem.item['datev.konto']}" pt:data-item="datev.sachkonto" />
<h:inputHidden value="#{bookingItem.item['datev.kontobeschriftung']}" pt:data-item="datev.kontobeschriftung" />
<br />
<span id='sachkontodtr-name-id' class='small'>#{bookingItem.item['datev.kontobeschriftung']}</span>
</h:panelGroup>

</td>

<!-- Kostenstelle
<td><h:selectOneMenu style="width:100%;"
value="#{bookingItem.item['datev.kostenstelle1']}">
<f:selectItem itemLabel="" itemValue="" />
<f:selectItems value="#{datevDataController.costcentre1}"></f:selectItems>
</h:selectOneMenu></td>
<td><h:selectOneMenu style="width:100%;"
value="#{bookingItem.item['datev.kostenstelle2']}">
<f:selectItem itemLabel="" itemValue="" />
<f:selectItems value="#{datevDataController.costcentre2}"></f:selectItems>
</h:selectOneMenu></td>
-->


<td><h:selectOneMenu style="width:100%;"
value="#{bookingItem.item['datev.buschluessel']}">
<f:selectItems
value="#{datevController.buSchluesel}"></f:selectItems>
<f:selectItem itemLabel="" itemValue=""></f:selectItem>
</h:selectOneMenu></td>

<td style="text-align: right;"><h:inputText
value="#{bookingItem.item['datev.betrag']}" id="bookingitem_amount"
style="text-align: right;width: 100%;border: inherit;"
onchange="calculateSummary()">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:inputText></td>

<td><h:commandLink
actionListener="#{childItemController.remove(bookingItem.item['numpos'])}">
<span class="typcn typcn-trash imixs-state-info"></span>
<f:ajax render="#{orderlistContainer.clientId}" execute="#{orderlistContainer.clientId}"
onevent="initDatevTable" />
</h:commandLink></td>

</tr>

</ui:repeat>

<!-- summary -->
<tr>
<td />

<td class="orderlist-sum"
style="text-align: right; font-weight: bold;">Summe:</td>
<td class="orderlist-sum orderlist_summary"
style="text-align: right; font-weight: bold;"></td>
<td />
</tr>
</table>

<!-- total summary -->
<h:inputHidden value="#{workitem.item['_capacity']}"
id="bookingitems_capacity" />
<h:inputHidden value="#{workitem.item['_capacity_dsp']}"
id="bookingitems_capacity_dsp" />

<h:commandButton value="#{message.add}" id="addposbutton_id"
actionListener="#{childItemController.add}">
<f:ajax render="#{orderlistContainer.clientId}" execute="#{orderlistContainer.clientId}"
onevent="initDatevTable" />
</h:commandButton>

<!-- datev creditor suggest list -->
<h:panelGroup id="autocomplete-resultlist-datev-sachkonto" layout="block" class="autocomplete-resultlist autocomplete-resultlist-sachkonto">
<ui:repeat var="suggest" value="#{datevSearchController.searchResult}">
<div class="autocomplete-resultlist-element" onclick="autocompleteSelectElement('#{suggest.data}')">
<a href="#" style="color: #777;">
<h:outputText value="#{suggest.display}" escape="false" />
</a>
</div>
</ui:repeat>
</h:panelGroup>


<script type="text/javascript">
/*<![CDATA[*/

// display summary
$(document).ready(
function() {
calculateSummary();
initDatevTable();
});

// Hier bekommen wir die JSON Struktur mit allen Daten.
// diese Daten werden auf die einzelnen Felder verteilt.
function selectSachkontoCallback(selection,inputElementKonto) {
const sachkontoData = JSON.parse(selection);
inputElementKonto.val(sachkontoData.konto);
// finde das nächste hidden Feld...
var inputElementBeschriftung=$(inputElementKonto).siblings( "input" );
inputElementBeschriftung.val(sachkontoData.name);
// remove old cdtr.name
$(inputElementKonto).siblings( "span" ).remove();
// append span with cdtr.name....
inputElementKonto.after("<span id='sachkonto-name-id' class='small'>" + sachkontoData.name + "</span>");
}


/* initialisiert die suchfunktion in der Tabelle */
function initDatevTable(data) {
if (!data || data.status === 'success') {
// add autocomplete feature ..
var sachkontoInput = $("input[data-item='datev.sachkonto']");
$(sachkontoInput).each(function () {
$(this).addClass("imixs-ml");
autocompleteInitInput(this, sachkontoSearch, 'autocomplete-resultlist-datev-sachkonto', selectSachkontoCallback);
});
$('[id$=bookinglist]').imixsLayout();
}
}


//Rechnet die Preise zusammen
function calculateSummary() {
var price = 0, amount = 0, sum = 0, total = 0;
var summaryItems = $("[id$=bookingitem_amount]");
$(summaryItems).each(function(index, value) {

var amount = convertToNumber($(this).val());
if (!isNaN(amount)) {
amount = amount * 1; // convert to number
total = total + amount;
total = Math.round(total * 100) / 100;
}
});

// update total _capacity
// update orderlist_summary
$("[id$=bookingitems_capacity]").val(total);
$("[id$=bookingitems_capacity_dsp]").val(convertToCurrency(total));
$(".orderlist_summary", ".imixs-bookingitems").empty();
$(".orderlist_summary", ".imixs-bookingitems").append(
convertToCurrency(total));

}

/* format 1.000,00 to 1000.00 */
function convertToNumber(currency) {
currency = currency.replace(/\./g, '');
currency = currency.replace(/\,/g, '.');
return currency;
}
/* format 1000 into 1.000,00 */
function convertToCurrency(number) {
var splitNum;
//number = Math.abs(number);
number = number.toFixed(2);
splitNum = number.split('.');
splitNum[0] = splitNum[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
return splitNum.join(",");
}


/*]]>*/
</script>

</c:if>

<c:if test="#{readonly}">

<table class="imixsdatatable imixs-bookingitems">
<tr>
<th style="width: 300px;">Buchungskonto</th>
<!--
<th style="width: 100px;">Kostenstelle I.</th>
<th style="width: 100px;">Kostenstelle II.</th>
-->
<th style="width: 170px;">BU Schlüssel</th>
<th style="width: 50px;">Betrag</th>
</tr>

<ui:repeat var="bookingItem"
value="#{childItemController.childItems}">
<tr>
<td class="konto-input"><h:outputText
value="#{bookingItem.item['datev.sachkonto']}"></h:outputText>
<h:outputText
value=" #{bookingItem.item['datev.kontobeschriftung']}"></h:outputText>
</td>

<!-- Kostenstelle
<td><h:outputText value="#{bookingItem.item['datev.kostenstelle1']}"></h:outputText>
</td>
<td><h:outputText value="#{bookingItem.item['date.kostenstell2']}"></h:outputText>
</td>
-->
<td><h:outputText value="#{bookingItem.item['datev.buschluessel']}"></h:outputText>
</td>
<td style="text-align: right;"><h:outputText
value="#{bookingItem.item['datev.betrag']}"></h:outputText></td>
</tr>
</ui:repeat>
<!-- summary -->
<tr>

<td />
<td class="orderlist-sum"
style="text-align: right; font-weight: bold;">Summe:</td>
<td class="orderlist-sum orderlist_summary"
style="text-align: right; font-weight: bold;">#{workitem.item['_capacity_dsp']}</td>
</tr>
</table>
</c:if>
</h:panelGroup>

</ui:composition>
30 changes: 9 additions & 21 deletions imixs-adapters-datev/src/reports/datev_csv_invoices.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
select="format-dateTime($date, '[Y0001][M01][D01][H01][m01][s01][f001]')"></xsl:value-of>
<xsl:text>;;"RE";"ImixsWorkflow";"";</xsl:text>
<xsl:value-of
select="item[@name='_datev_consultant_id']/value" /><xsl:text>;</xsl:text>
select="item[@name='datev.consultant.id']/value" /><xsl:text>;</xsl:text>
<xsl:value-of
select="item[@name='_datev_client_id']/value" /><xsl:text>;</xsl:text>
select="item[@name='datev.client.id']/value" /><xsl:text>;</xsl:text>
<xsl:value-of
select="format-dateTime($fiscalstart, '[Y0001][M01][D01]')"></xsl:value-of><xsl:text>;</xsl:text>
<!-- Sachkontennumernlaenge mandantenabhaengig - defautl = 6 -->
Expand Down Expand Up @@ -121,24 +121,18 @@

<xsl:variable
name="gegenkonto" select="item[@name='cdtr.number']/value" />
<!-- <xsl:variable name="subject" select="item[@name='_subject']/value"/> -->
<xsl:variable
name="subject" select="substring(item[@name='invlice.description']/value,1,59)" />
name="subject" select="substring(item[@name='$workflowsummary']/value,1,59)" />
<xsl:variable
name="invoicenumber" select="item[@name='invoice.number']/value" />
<!-- Geaendert 14.4.2020 - kostenstelle-1 nun auf child ebene
<xsl:variable name="costcentre1" select="item[@name='_costcentre1']/value"/>
-->
<xsl:variable
name="uniqueid" select="item[@name='$uniqueid']/value" />
<xsl:for-each
select="item[@name='_childitems']/value">

<xsl:variable name="betrag"
select="replace(./item[@name='invoice.total']/value, '\.', ',')" />
select="replace(./item[@name='datev.betrag']/value, '\.', ',')" />
<xsl:variable
name="abs_betrag" select="replace($betrag, '-', '')" />

<xsl:value-of
select="$abs_betrag" /><xsl:text>;</xsl:text>
<!-- S / H -->
Expand All @@ -151,11 +145,11 @@
</xsl:if>
<xsl:text>;;;;</xsl:text>
<xsl:value-of
select="./item[@name='_konto']/value" /><xsl:text>;</xsl:text>
select="./item[@name='datev.konto']/value" /><xsl:text>;</xsl:text>
<xsl:value-of
select="$gegenkonto" /><xsl:text>;</xsl:text>
<xsl:value-of
select="./item[@name='_tax']/value" /><xsl:text>;</xsl:text>
select="./item[@name='datev.buschluessel']/value" /><xsl:text>;</xsl:text>
<xsl:value-of
select="format-dateTime($date, '[D01][M01]')" /><xsl:text>;</xsl:text>
<xsl:value-of
Expand All @@ -167,20 +161,14 @@

<!-- Beleglink -->
<xsl:text>BEDI "</xsl:text><xsl:value-of
select="$uniqueid" /><xsl:text>";</xsl:text>

select="$uniqueid" /><xsl:text>";</xsl:text>
<xsl:text>;;;;;;;;;;;;;;;;</xsl:text>

<!-- Geaendert 14.4.2020 - kostenstelle-1 nun auf child ebene
<xsl:value-of select="$costcentre1" /><xsl:text>;</xsl:text>
-->
<xsl:value-of
select="./item[@name='_costcentre1']/value" /><xsl:text>;</xsl:text>
select="./item[@name='datev.kostenstelle1']/value" /><xsl:text>;</xsl:text>
<xsl:value-of
select="./item[@name='_costcentre2']/value" /><xsl:text>;</xsl:text>
select="./item[@name='datev.kostenstelle2']/value" /><xsl:text>;</xsl:text>
<xsl:text>;;;;;;;;;;;;;;</xsl:text>
<xsl:text>&#xa;</xsl:text>

</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

0 comments on commit a5a6fa2

Please sign in to comment.