POS print format unable to set jinja variables

HI,
I am creating a pos print format

so i wrote a following code in my custom print format

{%- if number <= 0 -%}
    {% set number = 10 %}
{% endif %}```

i am getting follwing error on console of browser

var _p=[],print=function(){_p.push.apply(_p,arguments)};with(obj){
_p.push(' POS @media screen { .print-format-gutter { background-color: #ddd; padding: 15px 0px; } .print-format { background-color: white; box-shadow: 0px 0px 9px rgba(0,0,0,0.5); max-width: 8.3in; min-height: 11.69in; padding: 0.75in; margin: auto; } .print-format.landscape { max-width: 11.69in; padding: 0.2in; } .page-break { padding: 30px 0px; border-bottom: 1px dashed #888; } .page-break:first-child { padding-top: 0px; } .page-break:last-child { border-bottom: 0px; } /* mozilla hack for images in table / body:last-child .print-format td img { width: 100% !important; } @media(max-width: 767px) { .print-format { padding: 0.2in; } } } @media print { .print-format p { margin-left: 1px; margin-right: 1px; } } .data-field { margin-top: 5px; margin-bottom: 5px; } .data-field .value { word-wrap: break-word; } .important .value { font-size: 120%; font-weight: bold; } .important label { line-height: 1.8; margin: 0px; } .table { margin: 20px 0px; } .square-image { width: 100%; height: 0; padding: 50% 0; background-size: contain; /background-size: cover;/ background-repeat: no-repeat !important; background-position: center center; border-radius: 4px; } .print-item-image { object-fit: contain; } .pdf-variables, .pdf-variable, .visible-pdf { display: none !important; } .print-format { font-size: 9pt; font-family: “Helvetica Neue”, Helvetica, Arial, “Open Sans”, sans-serif; -webkit-print-color-adjust:exact; } .page-break { page-break-after: always; } .print-heading { border-bottom: 1px solid #aaa; margin-bottom: 10px; } .print-heading h2 { margin: 0px; } .print-heading h4 { margin-top: 5px; } table.no-border, table.no-border td { border: 0px; } .print-format label { / wkhtmltopdf breaks label into multiple lines when it is inline-block / display: block; } .print-format img { max-width: 100%; } .print-format table td > .primary:first-child { font-weight: bold; } .print-format td, .print-format th { vertical-align: top !important; padding: 6px !important; } .print-format p { margin: 3px 0px 3px; } table td div { / needed to avoid partial cutting of text between page break in wkhtmltopdf / page-break-inside: avoid !important; } / hack for webkit specific browser / @media (-webkit-min-device-pixel-ratio:0) { thead, tfoot { display: table-row-group; } } [document-status] { margin-bottom: 5mm; }.print-heading { text-align: right; text-transform: uppercase; color: #666; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid #d1d8dd; } .print-heading h2 { font-size: 24px; } .print-format th { background-color: #eee !important; border-bottom: 0px !important; } / modern format: don't remove this line /

Page of

/ media=“print” type=“text/css”> / html { height: 100%; box-sizing: border-box; } body { position: relative; margin: 0; min-height: 100%; } table.table-container { width: 100%; height:16cm; } table,tr { line-height:15px; overflow: hidden; } table, td { border-collapse: collapse; } th, td { padding: 3px; / text-align: left; / border-left: 1px solid #000; } tr.noborder th { border-top: 0px; } th.noleftborder { border-left: 0 !important; } .footer { position: absolute; right: 0; / bottom: 0; / left: 0; padding: 2rem 1rem; text-align: center; / border-bottom: 1px solid #000; / } .signature { float: right; display: inline-block; margin-right:10px; } .receiver { float: left; display: inline-block; } .table-container th { text-align: center; } .text-content { text-align: right; padding-top: 6px; } .text-content span { font-size: 10px; } table { border-collapse: separate; border-spacing: 0; } table tr th:last-child, table tr td:last-child { border-right: 1px solid #000; } table tr th, table tr td { background-color:transparent; border-bottom: 1px solid #000; } table tr th:first-child, table tr td:first-child { border-left: 1px solid #000; } table tr th { border-top: 1px solid #000; } / top-left border-radius / table tr:first-child th:first-child { border-top-left-radius: 10px; } / top-right border-radius / table tr:first-child th:last-child { border-top-right-radius: 10px; } / bottom-left border-radius / table tr:last-child td:first-child { border-bottom-left-radius: 10px; } / bottom-right border-radius / table tr:last-child td:last-child { border-bottom-right-radius: 10px; } td.noleftborder { border-left: 0; } th.nobottomborder { border-bottom: 0; } th.desc { padding-top: 0; padding-bottom: 25px; } / table tr:last-child{height:auto;} / / table tr:last-child{max-height:15cm;} / / table tr { min-height: 15px; height:15px;} */ ‘);
set number = frappe.db.get_value(“Print Settings”, None, “no_of_row_per_page”) | int
_p.push(’ ');

  • if number <= 0 -
    _p.push(’ ‘);
    set number = 10
    _p.push(’ ‘);
    };
    _p.push(’
    No: ‘, offline_pos_name ,’
    ‘, __(“Date:”),’ ‘,dateutil.global_date_format(posting_date),’ ‘, __(“التاريخ”),’
    ‘, __(“Mr./M/s:”) ,’ ‘, customer ,’
    ‘, __("الفاضل/ الفاضلة ") ,’
    ‘, __(“L.P.O.No:”) ,’ ‘,“” ,’
    ‘, __(“Date:”) ,’ ‘, dateutil.global_date_format(posting_date) ,’
    ‘, __(“D.O.No:”) ,’ ‘,“”,’
    ‘, __(“Date:”) ,’ ‘, dateutil.global_date_format(posting_date) ,’
    ‘);
    for (var PFC=0, qMi=items.length; PFC<qMi; PFC++) { var item = items[PFC]; item._index = PFC;
    _p.push(’ ‘);
    };
    _p.push(’
    ‘, __(“الرقم”) ,’ ‘, __(“Qty”) ,’ ‘, __(“U.Price”) ,’ ‘, __(“سعر الوحدة”) ,’ ‘, __(“Amount”) ,’ ‘, __(“المبلغ”) ,’
    ‘, __(“S.No.”) ,’ ‘, __(“Description”) ,’ ‘, __(“التفاصيل”) ,’ ‘, __(“العدد”) ,’ ‘, __("ريال عماني ") ,’
    ‘, __(“R.O.”) ,’
    ‘, __(“بيسة”) ,’
    ‘, __(“Bzs.”),’
    ‘, __("ريال عماني ") ,’
    ‘, __(“R.O.”) ,’
    ‘, __(“بيسة”) ,’
    ‘, __(“Bzs.”) ,’
    ‘);
    if (item.idx ) {
    _p.push(’ ‘, item.idx,’ ‘);
    } else {
    _p.push(’   ‘);
    };
    _p.push(’
    ‘);
    if (item.item_name ) {
    _p.push(’ ‘, item.item_name ,’ ‘);
    };
    _p.push(’
    ‘);
    if (item.qty ) {
    _p.push(’ ‘,item.qty ,’ ‘);
    };
    _p.push(’
    ‘);
    if (item.rate_integer_part ) {
    _p.push(’ ‘, item.rate_integer_part ,’ ‘);
    };
    _p.push(’
    ‘);
    if (item.rate_fractional_part ) {
    _p.push(’‘, item.rate_fractional_part ,’‘);
    };
    _p.push(’
    ‘);
    if (item.amount_integer_part ) {
    _p.push(’ ‘, item.amount_integer_part ,’‘);
    };
    _p.push(’
    ‘);
    if (item.amount_fractional_part ) {
    _p.push(’ ‘, item.amount_fractional_part ,’ ‘);
    };
    _p.push(’
    ‘, __(“Total R.O:”) ,’ ‘, total_in_words,’ ‘, __(“المجموع الريال العماني”) ,’ ‘, total_integer_part ,’ ‘, total_fractional_part ,’
    ‘, __(“For”) ,’ ‘, __(“Majan Telecommunication & Information Technology LLC”) ,’
    ‘, __(“Receiver’s Sign: …توقيع المستلم”) ,’
    ‘, __(“Signature: …التوقيع”) ,’

    C.R.No.1284805,   P.O.Box: 463,  P.C:121,   Al-Seeb, Way No:4803,   Bldg. No:209, Al-Azaiba,  Sultanate of Oman,  Tel:  +968 24820911

    ‘, __(“E-mail:sales@majantel.com - www.majantel.on”) ,’

‘);}return _p.join(’');
desk.min.js?ver=1525935573.0:2512 Uncaught TypeError: frappe.template.compile(…) is not a function
at Object.frappe.render (desk.min.js?ver=1525935573.0:2512)
at HTMLButtonElement. (:2137:23)
at HTMLButtonElement. (desk.min.js?ver=1525935573.0:3031)
at HTMLButtonElement.dispatch (jquery.min.js:3)
at HTMLButtonElement.$event.dispatch (report.min.js?ver=1525935573.0:2958)
at HTMLButtonElement.r.handle (jquery.min.js:3)

If your Print Format Type is Js you will have to change it to Server

@netchampfaris I have tried it but it does’t worked

i am trying to generate print format for POS invoice not other sales invoice