{~@price=@line.price+(@line.price*(@line.vat/100))*max(0, @line.vat_type)~}
{~if(@price==0 && @GET.price>0) @price=@GET.price~}
{~@price=round(@price, 2)~}
{~@product_price=@line.product_price+(@line.product_price*(@line.vat/100))*max(0, @line.vat_type)~}
{~@product_price=round(@product_price, 2)~}
{~@price0=@line.price0+(@line.price0*(@line.vat/100))*max(0, @line.vat_type)~}
{~@price0=round(@price0, 2)~}
{~@buy_price=@line.buy_price+(@line.buy_price*(@line.vat/100))*max(0, @line.vat_type)~}
{~@buy_price=round(@buy_price, 2)~}
<h1>{{@page_data.title}}<br>{{@line.product_title?'"'.@line.product_title.'"':''}}</h1>
<p align="center">
	<small>Цена по справочнику - {{number_format(@product_price, 2, '.', '')}}{{@line.unit_short_title!=''?'/'.@line.unit_short_title:''}}</small>
	<check if="{{@buy_price>0 && in_array('products/show_buy_price', @authorization_user.module)}}">
	|
	<small>Закупочная цена - {{number_format(@buy_price, 2, '.', '')}}</small>
	</check>
	|
	<small>Максимальная скидка - {{@line.max_discount?@line.max_discount:@line.max_discount=100}}%</small>
	|
	{~@min_price=@product_price-(@product_price/100*@line.max_discount)~}
	<small>Минимальная цена - {{number_format(max(@min_price, @line.smp), 2, '.', '')}}</small>
</p>
<p class="false {{in_array('receipts/ignore_max_discount', @authorization_user.module) && @price<@min_price?'':'hide'}}" id="alert_max_discount">Значение цены ниже минимальной</p>
<form name="receipts_change_price_form" action="/receipts/change_price" method="POST">
	<input type="hidden" name="line_id" value="{{@GET.line_id}}">
	<input type="hidden" name="price0" value="{{number_format(@price0, 2, '.', '')}}">
	<input type="hidden" name="count" value="{{@line.count}}">
		<div class="inline">
			<input type="hidden" name="price_db" value="{{number_format(@product_price, 2, '.', '')}}">
			<input type="text" name="price" inputmode="numeric" min="0" step="0.01" class="line_price" autocomplete="off" placeholder="Цена" value="{{number_format(@price, 2, '.', '')}}" min="{{in_array('receipts/ignore_max_discount', @authorization_user.module)?0:@min_price}}">
			<input type="text" min="0" step="0.01" data-max="{{@line.max_discount}}" max="{{in_array('receipts/ignore_max_discount', @authorization_user.module)?100:@line.max_discount}}" name="discount_line" class="discount_line" placeholder="Скидка на товар %" value="{{@line.line_discount>0?@line.line_discount:''}}" autocomplete="off">
			<check if="{{in_array('receipts/bonus_writeoff', @authorization_user.module) && @receipt['partner_id']>0 && @receipt['partner']['bonus']>0}}">
			<br>
			<input type="text" min="0" step="1" data-max="{{floor(@price/100*@line.max_discount)}}" max="{{in_array('receipts/ignore_max_discount', @authorization_user.module)?min(@price0, max(@receipt['partner']['bonus'], @line.writeoff_bonus)):min(floor(@price/100*@line.max_discount), @receipt['partner']['bonus'])}}" name="writeoff_bonus" class="writeoff_bonus" placeholder="Списать баллы" value="{{@line.writeoff_bonus>0?@line.writeoff_bonus:''}}" autocomplete="off" inputmode="numeric">
			<input type="hidden" name="receipt_id" value="{{@receipt['id']}}">
			<input type="hidden" name="partner_id" value="{{@receipt['partner_id']}}">
			<input type="hidden" name="writeoff_bonus0" value="{{@line.writeoff_bonus}}">
			</check>
			<div class="virtual_keyboard">
				
				<input type="button" class="virtual_key" value='7' for='line_price'>
				<input type="button" class="virtual_key" value='8' for='line_price'>
				<input type="button" class="virtual_key" value='9' for='line_price'>
				<input type="submit" value="Готово" {{!in_array('receipts/ignore_max_discount', @authorization_user.module) && @price<@min_price?'disabled="disabled"':''}}>
				<br>
				<input type="button" class="virtual_key" value='4' for='line_price'>
				<input type="button" class="virtual_key" value='5' for='line_price'>
				<input type="button" class="virtual_key" value='6' for='line_price'>
				<br>
				<input type="button" class="virtual_key" value='1' for='line_price'>
				<input type="button" class="virtual_key" value='2' for='line_price'>
				<input type="button" class="virtual_key" value='3' for='line_price'>
				<br>
				<input type="button" class="virtual_key" value='0' for='line_price'>
				<input type="button" class="virtual_key" value='.' for='line_price'>
				<input type="button" class="virtual_key" value='-' for='line_price'>
				<button type="button" class="virtual_key_bks" for='line_price'>
					<i class="fas fa-long-arrow-alt-left"></i>
				</button>
			</div>
	</div>
</form>
<script type="text/javascript">
$('input[name="price"]').focus();
$('input[name="price"]').select();
</script>
