<?xml version="1.0" encoding="UTF-8"?>
<!--
@author Last Changed:$Author: Kalyan G $
@version $Revision: 1 $
@date $Date: 2011-10-27 $
-->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schema.infor.com/InforOAGIS/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.infor.com/InforOAGIS/2 ../InforOAGIS/BODs/Developer/LoadInventoryConsumption.xsd" xmlns:ext="com.infor.tfs.mappings.extensions.XsltExt" xmlns:tfs="http://www.infor.com/tfs" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java">
	<!-- import -->
	<xsl:import href="includes/AdvanceShipNotice_2_4_0_segments.xsl" xml:base="../../"/>
	<!-- Global Parameter -->
	<!-- Tenant -->
	<xsl:param name="Tenant"/>
	<!-- AccountingEntity-->
	<xsl:param name="AE"/>
	<!-- location -->
	<xsl:param name="locationId"/>
	<!--Transmissionreference number -->
	<xsl:param name="TransmissionReferenceNumber"/>
	<!-- Additional Sender ID-->
	<xsl:param name="AdditionalSenderID"/>
	<!-- Additional Receiver ID-->
	<xsl:param name="AdditionalReceiverID"/>
	<!-- Message Sequence Number-->
	<xsl:param name="MessageSequenceNumber"/>
	<!---->
	<xsl:variable name="messageType" select="'4913'"/>
	<xsl:variable name="buyer" select="/VDA4913/SG711/S711/V71DKD"/>
	<xsl:variable name="supplier" select="/VDA4913/SG711/S711/V71DLI"/>
	<xsl:variable name="shipTo" select="/VDA4913/SG711/SG712/SG713/S713/V73DAS"/>
	<xsl:variable name="plant" select="/VDA4913/SG711/SG712/SG713/S713/V73DWK"/>
	<!---->
	<xsl:output indent="yes" method="xml" encoding="UTF-8"/>
	<!--****************************************************************************************************-->
	<!-- Root -->
	<!--****************************************************************************************************-->
	<xsl:template match="/">
		<xsl:apply-templates select="VDA4913"/>
	</xsl:template>
	<!---->
	<!--****************************************************************************************************-->
	<!-- VDA4913 -->
	<!--****************************************************************************************************-->
	<xsl:template match="VDA4913">
		<xsl:call-template name="LoadAdvanceShipNotice"/>
	</xsl:template>
	<!---->
	<!--****************************************************************************************************-->
	<!-- Segment 711 -->
	<!--****************************************************************************************************-->
	<xsl:template match="SG711">
		<xsl:element name="DataArea">
			<!---->
			<!-- Load -->
			<xsl:call-template name="Load">
				<xsl:with-param name="accountingEntityID" select="$AE"/>
				<xsl:with-param name="locationID" select="$locationId"/>
			</xsl:call-template>
			<!---->
			<!-- AdvanceShipNotice -->
			<xsl:element name="AdvanceShipNotice">
				<!---->
				<xsl:value-of select="ext:reset('linenumber')"/>
				<xsl:variable name="docDate" select="S711/V71DUD"/>
				<xsl:variable name="docTime" select="'000000'"/>
				<xsl:variable name="storage" select="SG712/SG713/S713/V73DAS"/>
				<!-- AdvanceShipNoticeHeader -->				
				<xsl:call-template name="AdvanceShipNoticeHeader">
					<xsl:with-param name="documentID" select="SG712/S712/V72SNR"/>
					<xsl:with-param name="agencyRole" select="'Supplier'"/>
					<xsl:with-param name="variationID" select="S711/V71DUN"/>
					<xsl:with-param name="documentDate" select="concat('20',$docDate)"/>
					<xsl:with-param name="documentTime" select="$docTime"/>
					<xsl:with-param name="status" select="'Open'"/>
					<xsl:with-param name="warehouseLocation" select="concat('W_',$buyer)"/>
					<xsl:with-param name="shipFromPartyID" select="$supplier"/>
					<!--<xsl:with-param name="shipFromPartyAE" select="$supplier"/>-->
					<xsl:with-param name="carrier" select="SG712/S712/V72FRF"/>
					<xsl:with-param name="scheduledDeliveryDate" select="concat('20',SG712/S712/V72EDA)"/>
					<xsl:with-param name="scheduledDeliveryTime" select="concat(SG712/S712/V72FFZ,'00')"/>
					<xsl:with-param name="grossWeightMeasure" select="SG712/S712/V72SGB"/>
					<xsl:with-param name="grossWeightMeasureUnitCode" select="'KG'"/>
					<xsl:with-param name="keyToMeansOfTransport" select="SG712/S712/V72TSL"/>
					<xsl:with-param name="meansOfTransportNumber" select="SG712/S712/V72TNR"/>
					<xsl:with-param name="unloadingPoint" select="SG712/SG713/S713/V73DAS"/>
					<xsl:with-param name="documentReferenceID" select="SG712/SG713/S713/V73LSN"/>
					<xsl:with-param name="actualShipDate" select="concat('20',SG712/SG713/S713/V73LSD)"/>
					<xsl:with-param name="actualShipTime" select="'000000'"/>
				</xsl:call-template>
				<xsl:apply-templates select="*"/>
			</xsl:element>
		</xsl:element>
	</xsl:template>
	<xsl:template match="SG712">
		<xsl:apply-templates select="*"/>
	</xsl:template>
	<xsl:template match="SG713">
		<xsl:for-each select="SG714">
			<xsl:call-template name="AdvanceShipNoticeLine">
				<xsl:with-param name="itemID" select="tfs:trimLeft(S714/V74SNB)"/>
				<xsl:with-param name="shippedQuantity" select="format-number(S714/V74MG1 div 1000,'##########.000')"/>
				<xsl:with-param name="shippedQuantityUnitCode" select="S714/V74ME1"/>
				<xsl:with-param name="note" select="S716/V76TX1"/>
				<xsl:with-param name="kennNumber" select="S718/V78PN1"/>
				<xsl:with-param name="DeliveryNoteItemNumber" select="S714/V74PNL"/>				
			</xsl:call-template>
		</xsl:for-each>
	</xsl:template>
	<xsl:template match="*"/>
</xsl:stylesheet>
