<audio id="neworder" src="/ui/sounds/neworder.mp3" preload="auto"></audio>
<input tabindex="3" type="hidden" name="auto_fullscreen" value="{{@base_settings.auto_fullscreen}}">
<check if="{{(int)@base_settings['product_menu']==0}}">
<div id="products_list"></div>
</check>
<table width="100%" id="sales_table">
  <tr>
    <td valign="top" id="left_td">
      <div id="receipts_buttons" href="{{@PATH}}{{@correct_return || @correct_sales?'?receipt_id='.@GET.receipt_id.'&fpd='.@GET.fpd:''}}">
        <div class="reload">
          <div id="buttons_lines_div" class="hide">

            <form name="receipts_change_count_form_for_line" action="/receipts/change_count" method="POST">
              <input type="hidden" name="line_id" value="">
              <b>Кол-во</b>:
              <input type="text" name="count" inputmode="numeric" min="0" step="0.001" class="line_count" autocomplete="off" placeholder="Кол-во" value="" min="0">
              <input type="submit" value="Готово">
              <div class="virtual_keyboard virtual_keyboard_line_count virtual_keyboard_hide">
                <input tabindex="3" type="button" class="virtual_key" value="7" for="line_count_for_line">
                <input tabindex="3" type="button" class="virtual_key" value="8" for="line_count_for_line">
                <input tabindex="3" type="button" class="virtual_key" value="9" for="line_count_for_line">
                <br>
                <input tabindex="3" type="button" class="virtual_key" value="4" for="line_count_for_line">
                <input tabindex="3" type="button" class="virtual_key" value="5" for="line_count_for_line">
                <input tabindex="3" type="button" class="virtual_key" value="6" for="line_count_for_line">
                <br>
                <input tabindex="3" type="button" class="virtual_key" value="1" for="line_count_for_line">
                <input tabindex="3" type="button" class="virtual_key" value="2" for="line_count_for_line">
                <input tabindex="3" type="button" class="virtual_key" value="3" for="line_count_for_line">
                <br>
                <input tabindex="3" type="button" class="virtual_key" value="0" for="line_count_for_line">
                <input tabindex="3" type="button" class="virtual_key" value="." for="line_count_for_line">
                <input tabindex="3" type="button" class="virtual_key" value="-" for="line_count_for_line">
                <br>
                <button type="button" class="virtual_key_bks discount_big_button" for='line_count_for_line'>
                  <i class="fas fa-long-arrow-alt-left"></i>
                </button>
                <input type="button" class="virtual_key_ok" value="OK">
              </div>
            </form>

            <check if="{{(!@base_settings['autonomous'] || @base_settings['cafe_mode']>0) && @receipttype!=@receipt_print && @receipttype!=@receipt_writeoff}}">
            <button class="show_window line_control line_control_modifiers" href="/receipts/modifiers?line_id={{@s}}" title="Модификаторы для товара">
              <i class="fas fa-gift"></i>
              {{@base_settings['cafe_mode']>0?'Модификаторы':'Соп-щие товары'}}
            </button>
            </check>
            <check if="{{@base_settings['cafe_mode']==0 && !@base_settings['autonomous'] && in_array('products/currentstock', @authorization_user.module) && @receipttype!=@receipt_print}}">
            <button class="show_window line_control line_control_currentstock" href="/products/currentstock?line_id={{@s}}" title="Узнать остатки на складе">
              <i class="fas fa-tasks"></i>
              Наличие
            </button>
            </check>
            <check if="{{!@base_settings['autonomous'] && in_array('products/compound', @authorization_user.module) && @receipttype!=@receipt_print}}">
            <button class="show_window line_control line_control_compound" href="/products/compound?line_id={{@s}}" title="Узнать состав и КБЖУ">
              <i class="fas fa-burger"></i>
              Состав
            </button>
            </check>
            <button class="send_ajax line_control" href="/receipts/add_line?line_id={{@s}}" title="Добавить еще">
              <i class="fas fa-plus"></i>
              Добавить еще
            </button>
            <check if="{{in_array('receipts/change_price', @authorization_user.module)}}">
            <button class="show_window line_control line_control_change" href="/receipts/change_price?line_id={{@s}}" title="Изменить стоимость позиции">
              <i class="fas fa-pen"></i>
              Изменить
            </button>
              <check if="{{@scales_settings['active']==1}}">
            <button class="send_ajax line_control line_control_change" href="/scales/weight?line_id={{@s}}" title="Узнать вес">
              <i class="fas fa-weight-hanging"></i>
              Вес
            </button>
              </check>
            </check>
            <check if="{{@base_settings['cafe_mode']==1}}">
            <button class="send_ajax line_control line_control_delete" href="/receipts/order_line_complite?line_id={{@s}}" title="Отметить позицию как выданную">
              <i class="fas fa-cookie-bite"></i>
              Выдано/Невыдано
            </button>
            </check>
            <check if="{{in_array('receipts/delete_line', @authorization_user.module) || @receipttype==@receipt_print}}">
            <button class="send_ajax line_control line_control_delete" href="/receipts/delete_line?line_id={{@s}}" title="Удалить позицию из чека">
              <i class="fas fa-trash"></i>
              Удалить
            </button>
            </check>
          </div>

        <check if="{{in_array('receipts/certificates', @authorization_user.module) && !@base_settings['autonomous'] && @receipttype!=@receipt_print && @receipttype!=@receipt_writeoff}}">
        <button type="button" class="certificate_button show_window" href="/receipts/certificates">
          <i class="fas fa-certificate"></i>
          {{isset(@receipt['certificates']) && is_array(@receipt['certificates']) && count(@receipt['certificates'])>0?'x'.count(@receipt['certificates']):''}}
          <br>
          <span class="small">Сертификаты</span>
        </button>
        </check>
        <check if="{{in_array('partners/search', @authorization_user.module) && !@base_settings['autonomous'] && @receipttype!=@receipt_print && @receipttype!=@receipt_writeoff}}">
        <button type="button" class="show_window partner_search_button {{@receipt['partner']['name']?'hide':''}}" href="/partners/search">
          <i class="fas fa-user"></i>
          <br>
          <span class="small">Клиент</span>
        </button>
        </check>
        <check if="{{@receipt['partner']['name']}}">
          <check if="{{in_array('receipts/remove_partner', @authorization_user.module)}}">
        <button type="button" class="send_ajax partner_button" href="/messages/continue?uri={{urlencode("/receipts/remove_partner")}}" title="Убрать клиента">
          <i class="fas fa-times"></i>
          <br>
          <div class="small">{{@receipt['partner']['name']}}</div>
        </button>
          </check>
          <check if="{{@receipt['partner']['loyalty_type']==2 && @receipt['partner']['bonus_type']>0 && @receipttype!=@receipt_return}}">
        <button type="button" class="send_ajax partner_button" href="/messages/continue?uri={{urlencode("/receipts/bonus_pay")}}" title="Списать баллы">
          <i class="fas fa-coins"></i>
          <br>
          <div class="small">
            <check if="{{@receipt['bonus_pay']>0}}">
              <true>
            Отменить оплату баллами
              </true>
              <false>
            Списать баллы<br>
            <span class="max_bonus_pay_txt">{{@receipt['max_bonus_pay']}}</span> из <span class="partner_all_bonus_txt">{{number_format(@receipt['partner']['bonus'], 0)}}</span>
              </false>
            </check>
          </div>
        </button>
          </check>
        </check>
        <input tabindex="3" type="text" inputmode="numeric" step="0.01" name="discount" class="discount_input {{!in_array('receipts/discount', @authorization_user.module) && (!in_array('receipts/select_discount', @authorization_user.module) || (in_array('receipts/select_discount', @authorization_user.module) && !@discounts))?'discount_no_input':''}} {{@receipt['partner_id']>0 && @receipt['partner']['loyalty_type']==2?'hide':''}}" autocomplete="off" value="{{@receipt['discount']?@receipt['discount']:0}}">
        <div class="virtual_keyboard virtual_keyboard_discount_input virtual_keyboard_discount_input_cafe virtual_keyboard_hide">
        <check if="{{in_array('receipts/discount', @authorization_user.module)}}">
          <true>
          <input tabindex="3" type="button" class="virtual_key" value="7" for="discount_input">
          <input tabindex="3" type="button" class="virtual_key" value="8" for="discount_input">
          <input tabindex="3" type="button" class="virtual_key" value="9" for="discount_input">
          <br>
          <input tabindex="3" type="button" class="virtual_key" value="4" for="discount_input">
          <input tabindex="3" type="button" class="virtual_key" value="5" for="discount_input">
          <input tabindex="3" type="button" class="virtual_key" value="6" for="discount_input">
          <br>
          <input tabindex="3" type="button" class="virtual_key" value="1" for="discount_input">
          <input tabindex="3" type="button" class="virtual_key" value="2" for="discount_input">
          <input tabindex="3" type="button" class="virtual_key" value="3" for="discount_input">
          <br>
          <input tabindex="3" type="button" class="virtual_key" value="0" for="discount_input">
          <input tabindex="3" type="button" class="virtual_key" value="." for="discount_input">
          <input tabindex="3" type="button" class="virtual_key" value="-" for="discount_input">
          <br>
          <button type="button" class="virtual_key_bks discount_big_button" for='discount_input'>
            <i class="fas fa-long-arrow-alt-left"></i>
          </button>
          <input type="button" class="virtual_key_ok" value="OK">
          </true>
          <false>
          <input tabindex="3" type="button" class="select_discount" value="0%" data-discount="0" for="discount_input">
          {~@n=2~}
            <repeat group="{{@discounts}}" value="{{@d}}">
            <input tabindex="3" type="button" class="select_discount" value="{{round(@d['value'], 2)}}%" data-discount="{{round(@d['value'], 2)}}">
              {{@n>=3 && @n%3==0?'<br>':''}}
              {~@n++~}
            </repeat>
          </false>
        </check>
        </div>

        <check if="{{(int)@base_settings['spill']>0 && (int)@base_settings['check_mark']>0 && in_array('taps/list', @authorization_user.module) && @receipttype!=@receipt_print && @receipttype!=@receipt_writeoff}}">
        <button class="show_window" href="/taps/list">
          <i class="fas fa-taps"></i>
          <br>
          <span class="small">Краны</span>
        </button>
        </check>

        <check if="{{@base_settings['cafe_mode'] && in_array('receipts/chpok', @authorization_user.module) && @receipttype!=@receipt_print && @receipttype!=@receipt_writeoff && (int)@base_settings['egais_chpok_mode']>0}}">
        <button class="show_window" href="/receipts/chpok">
          <i class="fas fa-wine-bottle"></i>
          <br>
          <span class="small">Вскрыть</span>
        </button>
        </check>

        <check if="{{in_array('receipts/online_order', @authorization_user.module) && !@base_settings['autonomous'] && @receipttype!=@receipt_print && @receipttype!=@receipt_writeoff}}">
        <button name="online_order" class="show_window" href="/receipts/online_order">
          <i class="fas fa-cart-arrow-down"></i>
          <span class="small neworders_count hide">(<b>0</b>)</span>
          <br>
          <span class="small">Заказы</span>
        </button>
        </check>

        <check if="{{in_array('receipts/delete_line', @authorization_user.module) || @receipttype==@receipt_print}}">
        <button type="button" class="show_window" href="/messages/continue?uri={{urlencode("/receipts/delete_line?line_id=all")}}" title="Очистить чек">
          <i class="fas fa-receipt"></i>
          <br>
          <span class="small">Очистить чек</span>
        </button>
        </check>
        <check if="{{@base_settings['cafe_mode']==1 && @receipttype!=@receipt_print && @receipttype!=@receipt_writeoff}}">
        <button type="button" class="show_window" href="/receipts/turn?receipt_id={{@receipt['id']}}" title="Очереди">
          <i class="fas fa-list-ol"></i>
          <br>
          <span class="small">Очереди</span>
        </button>
        </check>
      </div>
      </div>
    </td>
    <td valign="top" id="middle_td{{(int)@base_settings['product_menu']>1?'_with_product_menu':''}}">
      <include href="receiptlines.htm" />
    </td>
    <check if="{{(int)@base_settings['product_menu']>0}}">
    <td valign="top" id="product_list_td{{(int)@base_settings['product_menu']>1?'_big':''}}">
      <div id="products_list_column">
        <div id="products_list" class="show_products_list {{@base_settings.show_product_img==2?'title_under_img':''}}">
          <include href="products_list.htm" />
        </div>
      </div>
    </td>
    </check>
    <td valign="top" id="right_td{{(int)@base_settings['product_menu']>1?'_with_product_menu':''}}">
      <form name="product_search_form" id="product_search_form" method="GET" action="/products/search_barcodes" no_loading_txt="1">
        <input tabindex="3" type="hidden" name="type" value="{{@receipttype}}">
        <input tabindex="0" type="text" name="product_search" class="product_search virtual_key_key" autocomplete="off" placeholder="Штрих-Код/Название" />
        <input tabindex="1" type="text" inputmode="numeric" step="0.001" name="coeff" class="coeff" autocomplete="off" placeholder="Кол-во">
        <button type="button" class="submit">
          <i class="fas fa-search"></i>
          <br>
          <span class="small">Поиск</span>
        </button>
        <check if="{{(int)@base_settings['product_menu']==2 && (int)@base_settings['virtual_keyboard']==1}}">
        <div class="virtual_keyboard virtual_keyboard_hide keyboard_menu_with_product" id="keyboard_menu_with_product">
          <input tabindex="3" type="button" class="virtual_key" value="7" for="coeff">
          <input tabindex="3" type="button" class="virtual_key" value="8" for="coeff">
          <input tabindex="3" type="button" class="virtual_key" value="9" for="coeff">
          <br>
          <input tabindex="3" type="button" class="virtual_key" value="4" for="coeff">
          <input tabindex="3" type="button" class="virtual_key" value="5" for="coeff">
          <input tabindex="3" type="button" class="virtual_key" value="6" for="coeff">
          <br>
          <input tabindex="3" type="button" class="virtual_key" value="1" for="coeff">
          <input tabindex="3" type="button" class="virtual_key" value="2" for="coeff">
          <input tabindex="3" type="button" class="virtual_key" value="3" for="coeff">
          <br>
          <input tabindex="3" type="button" class="virtual_key virtual_null" value="0" for="coeff">
          <input tabindex="3" type="button" class="virtual_key virtual_point" value="." for="coeff">
          <button type="button" class="virtual_key_bks" for="coeff">
            <i class="fas fa-long-arrow-alt-left"></i>
          </button>
          <input type="button" class="virtual_key_ok" value="OK">
        </div>
        </check>

        <div class="virtual_keyboard virtual_keyboard_hide virtual_keyboard_product_search full_keyboard">
          {~@keys='1234567890-+|QWERTYUIOP_|ASDFGHJKL@|ZXCVBNM'~}
          <div class="eng">
          <loop from="{{@i=0}}" to="{{@i<mb_strlen(@keys)}}" step="{{@i++}}">
            <check if="{{@keys[@i]=='|'}}">
              <true>
            <br>
              </true>
              <false>
            <input tabindex="3" type="button" class="virtual_key" value="{{@keys[@i]}}" for="product_search">
              </false>
            </check>
          </loop>
            <button type="button" class="virtual_key_bks" for='product_search'>
              <i class="fas fa-long-arrow-alt-left"></i>
            </button>
            <input tabindex="3" type="button" class="virtual_key_delete" for='product_search' value="CE">
            <br>
            <input tabindex="3" type="button" class="virtual_key_ru" value="RU">
            <input tabindex="3" type="button" class="virtual_key virtual_key_space" for='product_search' value=" ">
            <input tabindex="3" type="button" class="virtual_key" for='product_search' value=",">
            <input tabindex="3" type="button" class="virtual_key" for='product_search' value=".">
            <input tabindex="3" type="button" class="virtual_key virtual_key_ok" value="OK">
          </div>
          {~@keys='1234567890-+|ЙЦУКЕНГШЩЗХЪ|ФЫВАПРОЛДЖЭ_|ЯЧСМИТЬБЮ@'~}
          <div class="ru">
          <loop from="{{@i=0}}" to="{{@i<mb_strlen(@keys)}}" step="{{@i++}}">
            {~@a=mb_substr(@keys, @i, 1)~}
            <check if="{{@a=='|'}}">
              <true>
            <br>
              </true>
              <false>
            <input tabindex="3" type="button" class="virtual_key" value="{{@a}}" for="product_search">
              </false>
            </check>
          </loop>
            <button type="button" class="virtual_key_bks" for='product_search'>
              <i class="fas fa-long-arrow-alt-left"></i>
            </button>
            <input tabindex="3" type="button" class="virtual_key_delete" for='product_search' value="CE">
            <br>
            <input tabindex="3" type="button" class="virtual_key_eng" value="ENG">
            <input tabindex="3" type="button" class="virtual_key virtual_key_space" for='product_search' value=" ">
            <input tabindex="3" type="button" class="virtual_key" for='product_search' value=",">
            <input tabindex="3" type="button" class="virtual_key" for='product_search' value=".">
            <input tabindex="3" type="button" class="virtual_key virtual_key_ok" value="OK">
          </div>
        </div>
        <div class="virtual_keyboard virtual_keyboard_for_sales">
          <input tabindex="3" type="button" class="virtual_key" value='7' for='product_search'>
          <input tabindex="3" type="button" class="virtual_key" value='8' for='product_search'>
          <input tabindex="3" type="button" class="virtual_key" value='9' for='product_search'>
          <input tabindex="3" type="button" class="virtual_key_minus" value="-">
          <input tabindex="3" type="button" class="virtual_key_plus" value='+'>
          <br>
          <input tabindex="3" type="button" class="virtual_key" value='4' for='product_search'>
          <input tabindex="3" type="button" class="virtual_key" value='5' for='product_search'>
          <input tabindex="3" type="button" class="virtual_key" value='6' for='product_search'>
          <br>
          <input tabindex="3" type="button" class="virtual_key" value='1' for='product_search'>
          <input tabindex="3" type="button" class="virtual_key" value='2' for='product_search'>
          <input tabindex="3" type="button" class="virtual_key" value='3' for='product_search'>
          <br>
          <input tabindex="3" type="button" class="virtual_key virtual_key_delete" for='product_search' value="CE">
          <input tabindex="3" type="button" class="virtual_key virtual_null" value='0' for='product_search'>
          <button type="button" class="virtual_key_bks" for='product_search'>
            <i class="fas fa-long-arrow-alt-left"></i>
          </button>
          <input tabindex="3" type="button" class="virtual_key virtual_point" value='.' for='product_search'>
          <br>
          <check if="{{@receipttype==@receipt_print}}">
            <true>
          <div class="button_total" href="/receipts/pricetags">
            <button tabindex="3" type="button" class="reload virtual_key_total show_window" href="/receipts/printpricetags?linesset_id={{@GET.linesset_id}}">
              Печать
            </button>
          </div>
            </true>
            <false>
          <div class="button_total" href="/">
            <button tabindex="3" type="button" class="reload virtual_key_total show_window" href="/receipts/pay?type={{@receipttype}}&fpd={{@GET.fpd}}&correct2={{@correct2??0}}">
              Итог:
              <span class="receipt_sum">{{number_format(@total_sum, 2, '.', '')}}</span>
            </button>
          </div>
            </false>
          </check>
        </div>
      </form>
      <div class="clear"></div>
      <div id="other_prints" align="justify">
      <check if="{{@base_settings['cafe_mode']==1 && @receipttype!=@receipt_print}}">
        <true>
          <check if="{{@pre_sets['active']==1 && in_array('receipts/print', @authorization_user.module)}}">
      <button type="button" tabindex="3" class="show_window big_button" href="/receipts/print?id=open&device=pre&print=1&turn=all">
        <i class="fas fa-receipt"></i>
        <br>
        <div class="small">Печать пречека</div>
      </button>
          </check>
          <check if="{{@kitchen_sets['active']==1 || (int)@base_settings['orders_device']==0}}">
      <button type="button" tabindex="3" class="show_window big_button" href="/receipts/print_turn?id=open&device=kitchen">
        <i class="fas fa-utensils"></i>
        <br>
        <div class="small">{{(int)@base_settings['orders_device']==1?'Печать':'Отправить'}} на кухню</div>
      </button>
          </check>
          <check if="{{@bar_sets['active']==1 || (int)@base_settings['orders_device']==0}}">
      <button type="button" tabindex="3" class="show_window big_button" href="/receipts/print_turn?id=open&device=bar">
        <i class="fas fa-glass-martini-alt"></i>
        <br>
        <div class="small">{{(int)@base_settings['orders_device']==1?'Печать':'Отправить'}} на бар</div>
      </button>
          </check>
        </true>
        <false>
          <check if="{{in_array('products/fast_products', @authorization_user.module)}}">
      <button tabindex="3" type="button" name="fast_product" class="big_button show_window" style="width: {{!@base_settings['autonomous'] && in_array('products/currentstock', @authorization_user.module)?'calc(50% - 1px)':'100%'}} !important;" href="/products/fast_products" title="Быстрые товары">
        <i class="fas fa-shopping-bag"></i>
        <br>
        <span class="small">Быстрые товары</span>
      </button>
          </check>
          <check if="{{!@base_settings['autonomous'] && in_array('products/currentstock', @authorization_user.module)}}">
      <button tabindex="3" type="button" name="currentstock" class="big_button show_window right" style="width: {{in_array('products/fast_products', @authorization_user.module)?'calc(50% - 1px)':'100%'}} !important;" href="/products/currentstock" title="Узнать остатки">
        <i class="fas fa-file"></i>
        <br>
        <span class="small">Узнать остатки</span>
      </button>
          </check>
        </false>
      </check>
      </div>
    </td>
  </tr>
</table>


<check if="{{@base_settings['cafe_mode']==1}}">
<script type="text/javascript" src="/ui/scripts/rooms.js?v={{@site_version}}"></script>
</check>
<check if="{{@base_settings['ticket_description'] || @receipt['type']==@receipt_print || @receipt['type']==@receipt_writeoff}}">
<div class="virtual_keyboard virtual_keyboard_hide virtual_keyboard_ticket_description full_keyboard">
  {~@keys='1234567890-+|QWERTYUIOP_|ASDFGHJKL@|ZXCVBNM'~}
  <div class="eng">
    <loop from="{{@i=0}}" to="{{@i<mb_strlen(@keys)}}" step="{{@i++}}">
      <check if="{{@keys[@i]=='|'}}">
        <true>
    <br>
        </true>
      <false>
    <input tabindex="3" type="button" class="virtual_key" value="{{@keys[@i]}}" for="ticket_description">
      </false>
      </check>
    </loop>
    <button type="button" class="virtual_key_bks" for='ticket_description'>
      <i class="fas fa-long-arrow-alt-left"></i>
    </button>
    <input tabindex="3" type="button" class="virtual_key_delete" for='ticket_description' value="CE">
    <br>
    <input tabindex="3" type="button" class="virtual_key_ru" value="RU">
    <input tabindex="3" type="button" class="virtual_key virtual_key_space" for='ticket_description' value=" ">
    <input tabindex="3" type="button" class="virtual_key" for='ticket_description' value=",">
    <input tabindex="3" type="button" class="virtual_key" for='ticket_description' value=".">
    <input tabindex="3" type="button" class="virtual_key virtual_key_ok" value="OK">
  </div>
  {~@keys='1234567890-+|ЙЦУКЕНГШЩЗХЪ|ФЫВАПРОЛДЖЭ_|ЯЧСМИТЬБЮ@'~}
  <div class="ru">
    <loop from="{{@i=0}}" to="{{@i<mb_strlen(@keys)}}" step="{{@i++}}">
      {~@a=mb_substr(@keys, @i, 1)~}
      <check if="{{@a=='|'}}">
        <true>
    <br>
        </true>
        <false>
    <input tabindex="3" type="button" class="virtual_key" value="{{@a}}" for="ticket_description">
        </false>
      </check>
    </loop>
    <button type="button" class="virtual_key_bks" for='ticket_description'>
      <i class="fas fa-long-arrow-alt-left"></i>
    </button>
    <input tabindex="3" type="button" class="virtual_key_delete" for='ticket_description' value="CE">
    <br>
    <input tabindex="3" type="button" class="virtual_key_eng" value="ENG">
    <input tabindex="3" type="button" class="virtual_key virtual_key_space" for='ticket_description' value=" ">
    <input tabindex="3" type="button" class="virtual_key" for='ticket_description' value=",">
    <input tabindex="3" type="button" class="virtual_key" for='ticket_description' value=".">
    <input tabindex="3" type="button" class="virtual_key virtual_key_ok" value="OK">
  </div>
</div>
</check>
<check if="{{@receipttype==@receipt_print}}">
<script type="text/javascript">
$('#ticket_description').trigger('change');
</script>
</check>