This commit is contained in:
Ralph Soika 2021-02-04 18:03:16 +01:00
parent dd279377de
commit 40f7fae8f7
4 changed files with 218 additions and 15 deletions

View file

@ -114,7 +114,8 @@
<td /> <td />
<td /> <td />
<td /> <td />
<td /> <td data-id="orderlist_summary_net"
style="text-align: right; padding-right: 10px; font-wight: normal;"></td>
<td data-id="orderlist_summary" <td data-id="orderlist_summary"
style="text-align: right; padding-right: 10px; font-wight: bold;"></td> style="text-align: right; padding-right: 10px; font-wight: bold;"></td>
<td /> <td />
@ -122,7 +123,15 @@
</table> </table>
<!-- total summary --> <!-- total summary -->
<h:inputHidden value="#{workitem.item['order.total']}" <h:inputHidden value="#{workitem.item['order.total']}"
a:data-id="orderitems_capacity"> a:data-id="orderitems_total">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:inputHidden>
<h:inputHidden value="#{workitem.item['order.total.netto']}"
a:data-id="orderitems_total_netto">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:inputHidden>
<h:inputHidden value="#{workitem.item['order.total.tax']}"
a:data-id="orderitems_total_tax">
<f:convertNumber minFractionDigits="2" locale="de" /> <f:convertNumber minFractionDigits="2" locale="de" />
</h:inputHidden> </h:inputHidden>
@ -164,7 +173,7 @@
//Rechnet die Preise zusammen //Rechnet die Preise zusammen
function calculateSummary() { function calculateSummary() {
var price = 0, amount = 0, sum = 0, total = 0, brutto = 0; var price = 0, amount = 0, sum = 0, total = 0, brutto = 0, netto = 0;
var summaryItems = $("[data-id='orderitem_amount']"); var summaryItems = $("[data-id='orderitem_amount']");
$(summaryItems).each(function(index, value) { $(summaryItems).each(function(index, value) {
var tableRow = $(this).closest('tr'); var tableRow = $(this).closest('tr');
@ -182,23 +191,30 @@
// is tax a number? // is tax a number?
if (!isNaN(inputtax.val())) { if (!isNaN(inputtax.val())) {
tax=convertToNumber(inputtax.val()); tax=convertToNumber(inputtax.val());
console.log('tax=' +tax); //console.log('tax=' +tax);
brutto=amount + amount*(tax/100); brutto=amount + amount*(tax/100);
console.log('brutto=' +brutto); //console.log('brutto=' +brutto);
} else { } else {
brutto=amount; brutto=amount;
} }
// round // round brutto
brutto = Math.round(brutto * 100) / 100; brutto = Math.round(brutto * 100) / 100;
total = total + brutto; total = total + brutto;
// round total
total = Math.round(total * 100) / 100;
netto = netto + amount;
// round net
netto = Math.round(netto * 100) / 100;
// update netto column // update netto column
$("[data-id='orderitem_amount']",tableRow).val(convertToCurrency(amount)); $("[data-id='orderitem_amount']",tableRow).val(convertToCurrency(amount));
// update burtto column // update brutto column
brutto=convertToCurrency(brutto); brutto=convertToCurrency(brutto);
$("[data-id='orderitem_total']",tableRow).val(brutto); // hidden field $("[data-id='orderitem_total']",tableRow).val(brutto); // hidden field
// update display column // update display column
$("[data-id='orderitem_summary']", tableRow).empty(); $("[data-id='orderitem_summary']", tableRow).empty();
$("[data-id='orderitem_summary']", tableRow).append(brutto); $("[data-id='orderitem_summary']", tableRow).append(brutto);
@ -209,11 +225,25 @@
} }
}); });
// update total _capacity // compute total tax
var total_tax=total-netto;
total_tax = Math.round(total_tax * 100) / 100;
// update total netto and tax
netto=convertToCurrency(netto);
total = convertToCurrency(total); total = convertToCurrency(total);
$("[data-id='orderitems_capacity']").val(total); total_tax = convertToCurrency(total_tax);
$("[data-id='orderitems_total']").val(total);
$("[data-id='orderitems_total_netto']").val(netto);
$("[data-id='orderitems_total_tax']").val(total_tax);
// update display...
$("[data-id='orderlist_summary']", ".imixs-orderitems").empty(); $("[data-id='orderlist_summary']", ".imixs-orderitems").empty();
$("[data-id='orderlist_summary']", ".imixs-orderitems").append(total); $("[data-id='orderlist_summary']", ".imixs-orderitems").append(total);
$("[data-id='orderlist_summary_net']", ".imixs-orderitems").empty();
$("[data-id='orderlist_summary_net']", ".imixs-orderitems").append(netto);
} }

View file

@ -50,10 +50,6 @@
<td style="text-align: right;"><h:outputText <td style="text-align: right;"><h:outputText
value="#{orderitem.item['total']}" /></td> value="#{orderitem.item['total']}" /></td>
</tr> </tr>
</ui:repeat> </ui:repeat>
@ -63,8 +59,11 @@
<td /> <td />
<td /> <td />
<td /> <td />
<td />
<td style="text-align: right;">Summe:</td> <td style="text-align: right;">Summe:</td>
<td class="orderlist_summary" style="text-align: right;"><h:outputText
value="#{workitem.item['order.total.net']}">
</h:outputText></td>
<td class="orderlist_summary" style="text-align: right;"><h:outputText <td class="orderlist_summary" style="text-align: right;"><h:outputText
value="#{workitem.item['order.total']}"> value="#{workitem.item['order.total']}">
</h:outputText></td> </h:outputText></td>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:strip-space elements="*" />
<xsl:output method="xml" indent="yes" encoding="UTF-8"
standalone="yes" />
<xsl:template match="/">
<xsl:variable name="date"
select="/data/document/item[@name='$modified']/value" />
<Invoices version="2020.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Message>
<SenderID>Imixs-Office-Workflow</SenderID>
<ReceiverID>Cargosoft</ReceiverID>
<MessageID><xsl:value-of select="/data/document/item[@name='$uniqueid']/value" /></MessageID>
<MessageDate>
<DateTime><xsl:value-of select="$date" /></DateTime>
</MessageDate>
</Message>
<xsl:apply-templates
select="/data/document[normalize-space(item[@name = '$workflowgroup']/value) = 'Cargosoft-Export']" />
</Invoices>
</xsl:template>
<!-- This template builds invoice info -->
<xsl:template
match="/data/document[normalize-space(item[@name = '$workflowgroup']/value) = 'Cargosoft-Export']">
<xsl:variable name="date" select="item[@name='$modified']/value"/>
<xsl:variable name="currency" select="item[@name='invoice.currency']/value"/>
<Invoice>
<InvoiceHeader>
<Client>
<Codes>
<!-- Als Typ muss „cs“ übermittelt werden und im Code wird
dann der Cargosoft Mandant erwartet. -->
<Code Type="cs">001</Code>
</Codes>
</Client>
<!-- Hier muss eine eindeutige Belegnummer für jeden einzelnen
Beleg übermittelt werden. Es muss sich um eine Nummer
handeln, die pro Beleg hochgezählt wird und darf sich nicht
überschneiden mit dem CargoSoft Belegnummernkreis.
Daher den Nummernkreis vorher mit CargoSoft absprechen. -->
<InvoiceNumber><xsl:value-of select="item[@name='numsequencenumber']/value" /></InvoiceNumber>
<InvoiceType>
<Codes>
<Code Type="cs">INVOICE</Code>
</Codes>
</InvoiceType>
<InvoiceCurrency>
<Codes>
<Code Type="cs"><xsl:value-of select="$currency" /></Code>
</Codes>
</InvoiceCurrency>
<InvoiceAmount>
<NetAmount>
<Amount>
<Currency>
<Codes>
<Code Type="cs"><xsl:value-of select="$currency" /></Code>
</Codes>
</Currency>
<Value><xsl:value-of select="item[@name='order.total.net']/value" /></Value>
<ExchangeRate><xsl:value-of select="item[@name='invoice.exchangerate']/value" /></ExchangeRate>
</Amount>
</NetAmount>
<VATAmount>
<Amount>
<Currency>
<Codes>
<Code Type="cs"><xsl:value-of select="$currency" /></Code>
</Codes>
</Currency>
<Value><xsl:value-of select="item[@name='order.total.tax']/value" /></Value>
<ExchangeRate><xsl:value-of select="item[@name='invoice.exchangerate']/value" /></ExchangeRate>
</Amount>
</VATAmount>
<VATInformation>
<VATAmount>
<Amount isDomesticCurrency="true">
<Currency>
<Codes>
<Code Type="cs"><xsl:value-of select="$currency" /></Code>
</Codes>
</Currency>
<Value>0</Value>
</Amount>
</VATAmount>
</VATInformation>
</InvoiceAmount>
<CollectionInvoice>false</CollectionInvoice>
<xsl:if test="string-length(item[@name='invoice.period']/value) > 0">
<BookingPeriod><xsl:value-of select="item[@name='invoice.period']/value" /></BookingPeriod>
</xsl:if>
<Booked>false</Booked>
<InvoiceDate><xsl:value-of select="item[@name='invoice.date']/value" /></InvoiceDate>
<InvoiceAddress type="CN">
<Codes>
<Code Type="cs"><xsl:value-of select="item[@name='cdtr.number']/value" /></Code>
</Codes>
</InvoiceAddress>
<References>
<Reference type="cs"><xsl:value-of select="item[@name='invoice.number']/value" /></Reference>
</References>
<!-- Attachements -->
<xsl:if test="item[@name='$file.count']/value > 0">
<Attachments>
<xsl:for-each
select="item[@name='$file']/value/item">
<Attachment>
<xsl:attribute name="id"><xsl:value-of select="./value/item[@name='md5checksum']/value" /></xsl:attribute>
<xsl:attribute name="version">1</xsl:attribute>
<Filename><xsl:value-of select="./@name" /></Filename>
<Description>Imixs-Office-Workflow</Description>
<Content><xsl:value-of select="./value[2]" /></Content>
</Attachment>
</xsl:for-each>
</Attachments>
</xsl:if>
</InvoiceHeader>
<InvoiceRows>
<xsl:for-each
select="item[@name='_childitems']/value">
<InvoiceRow>
<Row><xsl:value-of select="./item[@name='numpos']/value" /></Row>
<FileNumber><xsl:value-of select="./item[@name='name']/value" /></FileNumber>
<InvoiceAmount>
<NetAmount>
<Amount>
<Currency>
<Codes>
<Code Type="cs"><xsl:value-of select="$currency" /></Code>
</Codes>
</Currency>
<Value><xsl:value-of select="./item[@name='amount']/value" /></Value>
</Amount>
</NetAmount>
<VATInformation>
<VAT>
<Codes>
<Code Type="cs"><xsl:value-of select="./item[@name='tax']/value" /></Code>
</Codes>
</VAT>
</VATInformation>
</InvoiceAmount>
<ActivityType>
<Codes>
<Code Type="cs"><xsl:value-of select="./item[@name='category']/value" /></Code>
</Codes>
</ActivityType>
</InvoiceRow>
</xsl:for-each>
</InvoiceRows>
</Invoice>
</xsl:template>
</xsl:stylesheet>