VERSION 17.200.001

---------------------


<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">

    <xsl:output method="xml" encoding="utf-8" media-type="text/plain" omit-xml-declaration="yes" indent="yes" />


    <xsl:template match="Document">


        <SalesOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

            <OrderType>

                <value>

                    <xsl:value-of select="'SO'"/>

                </value>

            </OrderType>

            <Status>

                <value>Open</value>

            </Status>

            <CustomerID>

                <value>

                    <xsl:value-of select="CustomerCardInfo/AccountingID" />

                </value>

            </CustomerID>

            <CustomerOrder>

                <value>

                    <xsl:value-of select="OrderNumber" />

                </value>

            </CustomerOrder>

            <Date>

                <value>

                    <xsl:call-template name="display-date">

                        <xsl:with-param name="value" select="OrderDate"/>

                    </xsl:call-template>

                </value>

            </Date>

            <Description>

                <value>

                    <xsl:value-of select="Comment" />

                </value>

            </Description>

            <RequestedOn>

                <value>

                    <xsl:call-template name="display-date">

                        <xsl:with-param name="value" select="OrderDate"/>

                    </xsl:call-template>

                </value>

            </RequestedOn>

            <PreferredWarehouseID>

                <value>

                    <xsl:value-of select="Warehouse/Code" />

                </value>

            </PreferredWarehouseID>

            <DestinationWarehouseID>

                <value>

                    <xsl:value-of select="Warehouse/Code" />

                </value>

            </DestinationWarehouseID>

            <ShipToContactOverride>

                <value>true</value>

            </ShipToContactOverride>

            <ShipToAddressOverride>

                <value>true</value>

            </ShipToAddressOverride>

            <BillingAddressOverride>

                <value>false</value>

            </BillingAddressOverride>

            <BillingContactOverride>

                <value>false</value>

            </BillingContactOverride>

            <FinancialSettings>                

                <Branch>

                    <value>

                        <xsl:value-of select="'SHURTAPE'" />

                    </value>

                </Branch>

            </FinancialSettings>

            <ShipToContact>

                <id>00000000-0000-0000-0000-000000000000</id>

                <rowNumber>0</rowNumber>

                <Email>

                    <value>

                        <xsl:value-of select="Parties/PartyIdentifier[Type='SHIPTO']/EmailAddress" />

                    </value>

                </Email>

                <Fax>

                    <value>

                        <xsl:value-of select="Parties/PartyIdentifier[Type='SHIPTO']/Fax" />

                    </value>

                </Fax>

                <DisplayName>

                    <value>

                        <xsl:value-of select="Parties/PartyIdentifier[Type='SHIPTO']/Name" />

                    </value>

                </DisplayName>

                <Position>

                    <value>

                        <xsl:value-of select="' '" />

                    </value>

                </Position>

                <Phone1>

                    <value>

                        <xsl:value-of select="Parties/PartyIdentifier[Type='SHIPTO']/Phone" />

                    </value>

                </Phone1>

            </ShipToContact>

            <ShipToAddress>

                <id>00000000-0000-0000-0000-000000000000</id>

                <rowNumber>0</rowNumber>

                <AddressLine1>

                    <value>

                        <xsl:value-of select="Parties/PartyIdentifier[Type='SHIPTO']/Street1" />

                    </value>

                </AddressLine1>

                <AddressLine2>

                    <value>

                        <xsl:value-of select="Parties/PartyIdentifier[Type='SHIPTO']/Street2" />

                    </value>

                </AddressLine2>

                <City>

                    <value>

                        <xsl:value-of select="Parties/PartyIdentifier[Type='SHIPTO']/Suburb" />

                    </value>

                </City>

                <Country>

                    <value>

                        <xsl:value-of select="Parties/PartyIdentifier[Type='SHIPTO']/Country" />

                    </value>

                </Country>

                <PostalCode>

                    <value>

                        <xsl:value-of select="Parties/PartyIdentifier[Type='SHIPTO']/PostCode" />

                    </value>

                </PostalCode>

                <State>

                    <value>

                        <xsl:value-of select="Parties/PartyIdentifier[Type='SHIPTO']/State" />

                    </value>

                </State>

            </ShipToAddress>

            <Details>

                <xsl:for-each select="Lines/Line[Quantity!=0]">

                    <SalesOrderDetail>

                        <InventoryID>

                            <value>

                                <xsl:value-of select="MatchedItemCode" />

                            </value>

                        </InventoryID>

                        <LineNbr>

                            <value>

                                <xsl:value-of select="position()" />

                            </value>

                        </LineNbr>

                        <Quantity>

                            <value>

                                <xsl:value-of select="QuantityAccepted" />

                            </value>

                        </Quantity>

                        <LineDescription>

                            <value>

                                <xsl:value-of select="ItemDescription" />

                            </value>

                        </LineDescription>

                        <UnitPrice>

                            <value>

                                <xsl:value-of select="format-number(ActualUnitPriceExTaxIncAllowances,'0.00##')" />

                            </value>

                        </UnitPrice>

                        <!--<Branch>

                            <value>

                                <xsl:value-of select="'SHURTAPE'" />

                            </value>

                        </Branch>-->

                    </SalesOrderDetail>

                </xsl:for-each>

            </Details>

        </SalesOrder>



    </xsl:template>



    <xsl:template name="quotedstring">

        <xsl:param name="value"/>

        <xsl:value-of select="'&quot;'"/>

        <xsl:value-of select="translate($value,'&quot;','')"/>

        <xsl:value-of select="'&quot;'"/>



    </xsl:template>



 <xsl:template name="display-date">

    <xsl:param name="value"/>


    <xsl:choose>

      <xsl:when test="substring($value,5,1)='-' or substring($value,5,1)='/' ">

        <xsl:value-of select="concat(substring($value,1,4),'-',substring($value,6,2),'-',substring($value,9,2),'T00:00:00')"/>

      </xsl:when>

      <xsl:otherwise>

        <xsl:value-of select="concat(substring($value,7,4),'-',substring($value,4,2),'-',substring($value,1,2),'T00:00:00')"/>

      </xsl:otherwise>

    </xsl:choose>

  </xsl:template>


</xsl:stylesheet>