<?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/Purchase_invoice_segments.xsl" xml:base="../../"/>
	<xsl:import href="includes/Sync.xsl" xml:base="../../"/>
	<!--Sync-->
	
	
	<!-- 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="'4906'"/>
	
	
	<xsl:output indent="yes" method="xml" encoding="UTF-8"/>
	<!--****************************************************************************************************-->
	<!-- Root -->
	<!--****************************************************************************************************-->
	<xsl:template match="/">
			<xsl:apply-templates select="VDA4906"/>
	</xsl:template>
	
	<!---->
	<!--****************************************************************************************************-->
	<!-- VDA4906 -->
	<!--****************************************************************************************************-->
	<xsl:template match="VDA4906">
			<xsl:call-template name="SyncHICOMPurchaseInvoices"/>
	</xsl:template>
	<!---->
	<!--****************************************************************************************************-->
	<!-- Segment SG811 -->
	<!--****************************************************************************************************-->

	<xsl:template match="SG811">
		<xsl:element name="DataArea">
		
				<xsl:call-template name="Sync">
					
					</xsl:call-template>		
		
				<xsl:element name="HICOMPurchaseInvoices">
					<xsl:call-template name="HICOMPurchaseInvoices">
						<xsl:with-param name="transactionDate" select="concat('20',S811/V81DUD)"/>
						<xsl:with-param name="batchReference" select="S811/V81DUN"/>
						<xsl:with-param name="buyFromBusinessPartner" select="S811/V81DLI"/>
					</xsl:call-template>		
					
					<xsl:variable name="packingSlip" select="SG812/SG813/S813/V83DID"/>
					
					<xsl:for-each select="SG812/S812">
						<xsl:element name="PurchaseInvoiceHeader">
							<xsl:call-template name="PurchaseInvoiceHeader">
										<xsl:with-param name="packingSlip" select="$packingSlip"/>
										<xsl:with-param name="businessPartnerInvoiceNumber" select="V82DRN"/>
										<xsl:with-param name="documentDate" select="concat('20',V82DRD)"/>
										<xsl:with-param name="grossAmount" select="V82DRE"/>
										<xsl:with-param name="taxAmount" select="V82DS1"/>
							</xsl:call-template>	
						</xsl:element>		
					</xsl:for-each>
					
				</xsl:element>
		</xsl:element>
		
	</xsl:template>
	
	<xsl:template match="*"/>
	
	
</xsl:stylesheet>
