<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
encoding="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml" />

<!-- БанковскийСчет -->

<xsl:template match="/">
    <xsl:apply-templates select="print_version"/>
</xsl:template>

<!-- Выводим данные -->
<xsl:template match="print_version">

<style type="text/css">
	body
	{
		font-family: 'Arial';
		font-size: 10pt;
		padding-left: 2cm;
		padding-top: 2cm;
	}
	
	.td_main
	{
		border-top: black 1px solid; border-left: black 1px solid;
	}
	
	.td_header
	{
		border-left: black 1px solid; border-left: black 1px solid;
		border-top: black 1px solid; border-left: black 1px solid;
		border-bottom: black 1px solid; border-left: black 1px solid;
		text-align: center;
	}
	
	.td_main_2
	{
		border-left: black 1px solid; border-left: black 1px solid;
		border-bottom: black 1px solid; border-left: black 1px solid;
	}
	
	table
	{
		
	}
</style>
	<b>Поставщик:</b>&#xa0;<xsl:value-of select="shop_company/name"/>
	<br /><b>ИНН/КПП:</b>&#xa0;<xsl:value-of select="shop_company/inn"/>&#xa0;/&#xa0;<xsl:value-of select="/print_version/shop_company/kpp"/>
	<br /><b>ОГРН:</b>&#xa0;<xsl:value-of select="shop_company/ogrn"/>
	<br /><b>Адрес:</b>&#xa0;<xsl:value-of select="order_list/site_users_postcode"/>,
	<xsl:value-of select="order_list/site_users_country"/>,
	<xsl:value-of select="order_list/site_users_city"/>,
	<xsl:value-of select="order_list/site_users_address"/>
	<br /><b>Телефон:</b>&#xa0;<xsl:value-of select="shop_company/phone"/>
	<br /><b>Факс:</b>&#xa0;<xsl:value-of select="shop_company/fax"/>
	<br /><b>E-mail:</b>&#xa0;<xsl:value-of select="shop_company/email"/>
	<br /><b>Сайт:</b>&#xa0;<xsl:value-of select="shop_company/site"/>
	<p>
	<table cellpadding="2px" cellspacing="0" width="600px">
		<tr>
			<td colspan="4" align="center"><b>Образец заполнения платежного поручения</b></td>
		</tr>	
		<tr>
			<td class="td_main">ИНН&#xa0;<xsl:value-of select="shop_company/inn"/></td>
			<td class="td_main">КПП&#xa0;<xsl:value-of select="shop_company/kpp"/></td>
			<td class="td_main" style="border-right: black 1px solid;" rowspan="2" colspan="2"></td>
		</tr>
		<tr>
			<td class="td_main" colspan="2"><b>Получатель</b></td>
		</tr>
		<tr>
			<td class="td_main" colspan="2"><xsl:value-of select="shop_company/name"/></td>
			<td class="td_main"><b>Сч. №</b></td>
			<td class="td_main" style="border-right: black 1px solid;" width="200px"><xsl:value-of select="shop_company/account"/></td>
		</tr>
		<tr>
			<td class="td_main" colspan="2"><b>Банк получателя</b></td>
			<td class="td_main"><b>БИК</b></td>
			<td class="td_main" style="border-right: black 1px solid;"><xsl:value-of select="shop_company/bik"/></td>
		</tr>
		<tr>
			<td class="td_main" style="border-bottom: black 1px solid;" colspan="2"><xsl:value-of select="shop_company/bank_name"/> <xsl:value-of select="shop_company/bank_address"/></td>
			<td class="td_main" style="border-bottom: black 1px solid;"><b>Кор/Сч. №</b></td>
			<td class="td_main" style="border-bottom: black 1px solid; border-right: black 1px solid"><xsl:value-of select="/print_version/shop_company/corr_account"/></td>
		</tr>
	</table>
	</p>
	<p>
	<table width="600px">
		<tr>
			<td colspan="2" align="center"><b>Счет №<xsl:value-of select="order_list/order_id"/> от <xsl:value-of select="order_list/date" /> г.</b></td>
		</tr>
		<tr>
			<td align="right">Покупатель:</td>
			<td><b><xsl:value-of select="order_list/site_users_company"/></b></td>
		</tr>
		<tr>
			<td align="right">Адрес:</td>
			<td>
				<!-- Адрес -->
				<xsl:value-of select="order_list/site_users_postcode"/>,
				<xsl:value-of select="order_list/site_users_country"/>,
				<xsl:value-of select="order_list/site_users_city"/>,
				<xsl:value-of select="order_list/site_users_address"/>
			</td>
		</tr>
		<tr>
			<td align="right">Тел./факс:</td>
			<td><xsl:value-of select="order_list/site_users_phone"/>
			<xsl:if test="order_list/site_users_fax/node() and order_list/site_users_fax != order_list/site_users_phone"> / <xsl:value-of select="order_list/site_users_fax"/>
			</xsl:if>
			</td>
		</tr>
	</table>
	</p>
	<p>
	<table width="600px" cellpadding="2px" cellspacing="0">
		<tr>
			<td class="td_header">№</td>
			<td class="td_header">Наименование</td>
			<td class="td_header">Кол-во</td>
			<td class="td_header">Ед. изм.</td>
			<td class="td_header">Цена, руб.</td>
			<td class="td_header">Ставка НДС</td>
			<td class="td_header">НДС, руб.</td>
			<td class="td_header" style="border-right: black 1px solid; border-left: black 1px solid;">Сумма, руб.</td>
		</tr>
		<!-- Элементы заказа -->
		<xsl:apply-templates select="order_list/order_items/items_order"/>
		<!-- Всего НДС -->
		<tr>
			<td align="right" colspan="6" style="border-bottom: black 1px solid;"><b>НДС:</b></td>
			<td align="right" colspan="2" style="border-bottom: black 1px solid;">
				<xsl:if test="order_list/order_items/tax_sum != 0">
					<xsl:value-of select="format-number(order_list/order_items/tax_sum, '#.00')"/>р.
				</xsl:if>
			</td>
		</tr>
		<!-- Итого -->
		<tr>
			<td align="right" colspan="6"><b>Всего к оплате:</b></td>
			<td align="right" colspan="2">
				<b><xsl:value-of select="format-number(order_list/sum, '#.00')"/>р.</b>
			</td>
		</tr>
	</table>
	</p>
	<br /><br /><br />
	<table cellpadding="2px" cellspacing="0">
		<tr>
			<td height="50">Директор</td>
			<td>__________________</td>
			<td><xsl:value-of select="shop_company/fio"/></td>
		</tr>
		<tr>
			<td height="50">Главный бухгалтер</td>
			<td>__________________</td>
			<td><xsl:value-of select="shop_company/accountant_fio"/></td>
		</tr>
		<tr>
			<td height="50"></td>
			<td valign="top" align="center"><b>М.П.</b></td>
			<td></td>
		</tr>
		<tr>
		<td colspan="3"><font size="1">Счет действителен в течение 5 банковских дней</font>
		</td>
		</tr>
	</table>
</xsl:template>

<!-- Выводим элементы заказа -->
<xsl:template match="order_list/order_items/items_order">
	<tr>
		<td class="td_main_2"><xsl:value-of select="position()"/></td>
		<td class="td_main_2"><xsl:value-of select="order_items_name"/></td>
		<td class="td_main_2"><xsl:value-of select="order_items_quantity"/></td>
		<td class="td_main_2"><xsl:value-of select="item/mesure"/></td>
		<td class="td_main_2" align="right"><xsl:value-of select="format-number(order_items_price, '#.00')"/></td>
		<td class="td_main_2" align="center">
			<xsl:choose>
				<xsl:when test="order_items_tax_rate != 0">
					<xsl:value-of select="order_items_tax_rate"/>%
				</xsl:when>
				<xsl:otherwise>нет</xsl:otherwise>
			</xsl:choose>
		</td>
		<td class="td_main_2" align="right">
			<xsl:if test="order_items_quantity * order_items_price div 100 * order_items_tax_rate != 0">
				<xsl:value-of select="format-number(order_items_quantity * order_items_price div 100 * order_items_tax_rate, '###.00')"/>
			</xsl:if>
		</td>
		<td class="td_main_2" align="right" style="border-right: black 1px solid;">
			<xsl:if test="order_items_price * order_items_quantity != 0">
				<xsl:value-of select="format-number(order_items_price * order_items_quantity, '#.00')"/>
			</xsl:if>
		</td>
	</tr>
</xsl:template>

</xsl:stylesheet>