<style>
    @font-face {
        font-family: 'Droid Arabic Kufi';
        font-style: normal;
        font-weight: 700;
        src: url(../_assets/custom/fonts/DroidKufi-Regular.eot);
        src: url(../_assets/custom/fonts/DroidKufi-Regular.eot?#iefix) format('embedded-opentype'),
            url(../_assets/custom/fonts/DroidKufi-Regular.woff2) format('woff2'),
            url(../_assets/custom/fonts/DroidKufi-Regular.woff) format('woff'),
            url(../_assets/custom/fonts/DroidKufi-Regular.ttf) format('truetype');
    }

    @font-face {
        font-family:"GE Dinar One Medium";
        src:url("../_assets/custom/fonts/GE_Dinar_One_Medium.eot?") format("eot"),
            url("../_assets/custom/fonts/GE_Dinar_One_Medium.woff") format("woff"),
            url("../_assets/custom/fonts/GE_Dinar_One_Medium.ttf") format("truetype"),
            url("../_assets/custom/fonts/GE_Dinar_One_Medium.svg#GEDinarOne-Medium") format("svg");
        font-weight:normal;
        font-style:normal;
    }

    /*@font-face {
        font-family: 'Swissra-Bold';
        font-weight: 700;
        src: url(../_assets/custom/fonts/SwissraBold.woff) format('woff')
    }*/


    html,body,div,p,ul,li,sapn{
        margin:0px;
        padding:0px;
    }
    .zprint_aw{
        width: 100%;
        height: auto;
        direction: rtl;
        font-size: 14px;
       // margin:0px;
        padding:0px;
        font-weight: 700;
    }
    .zname_aw{
        width:100%;
        margin:0px auto;
        height:30px;
    }

    .zdetlz_aw{
        width:100%;
        margin:0px auto;
        //    height:300px;
        margin-top: 0.5cm;
    }
    .aw_bottom_p {
        margin: 0px;
        padding: 0px;
        width: 100%;
        position: absolute;
        bottom: 0px;
    }

    .right{
        float:right;
    }
    .left{
        float:left;
    }
    .arab{
        font-family:"Swissra-Bold";
        font-size: 16px;
    }
    .txtr{
        text-align:right;
    }
    .txtl{
        text-align:left;
    }
    .txtc{
        text-align:center;
    }
    .clr{
        clear:both;
    }
    .cntr{
        margin:0px auto;
    }
    .rtl{
        direction:rtl;
    }
    .ltr{
        direction:ltr;
    }

    .cenet{
        float: right;
        margin-right: 21%;
        border: 1px solid;
        padding: 3px 6px;
    }
    .space{
        width: 110px;
        display: inline-block;
    }
    .onyio{
        margin-top: 7px;
        display: block;
    }

    li{
        list-style: initial;
    }
    .pnumz{
        position: absolute;
       //  top: 0;
        right: 50%;
        border: 1px solid #000;
        padding: 0px 20px;

        border-radius: 25px;
    }




    @page {
        padding-right: 0px !important;
        padding-left: 0px !important;
        margin-right: 0px !important;
        margin-left: 0px !important;
        width: 176mm !important;
    }
</style>




<style>
    @page {ldelim}
    size: auto;
    margin-top: {$ProgramesettingData->pres_above}cm;
    margin-bottom: {$ProgramesettingData->pres_buttom}cm;
    {rdelim}

    .arbfnt {ldelim}
    font-size: {$ProgramesettingData->fontsizear}px !important;
    {rdelim}

    .enfnt {ldelim}
    font-size: {$ProgramesettingData->fontsizeen}px !important;
    {rdelim}
</style>

<style>
    @media screen {
        div.divFooter {
            display: none;
        }
    }

    @media print {
        div.divFooter {
		   //  height: 100px;
            position: fixed;
            bottom: 0;
        }

		
		   div.divHeader {
             margin-bottom: 5px;
    }
</style>


<div  id="content">
<div   class="zprint_aw print-page" style="background: #f1f3fa url({$path}/_assets/custom/images/semad.jpg) no-repeat center    center   !important; 
              page-break-after: always;  background-blend-mode: lighten; background-attachment:fixed; 
            background-size: 100% !important; min-height: 950px; margin: 0px auto;position: inherit;padding: 0px 50px;padding-right: 20px !important; 
      padding-left: 20px !important; margin-right: 0px !important; margin-left: 0px !important;" >

   <div class="col-md-12" id="patHeadTb">
      <hr style="border: 1px solid black;     margin: 5px 0; ">

      <table style="margin: 5px auto;"  cellpadding="2" class="noborder rtl wds99">
         <tr>
            <td class="txtr bold wds15"> اسم الحالة  </td>
            <td class="txtr  wds40"> {$title} /  {$name}   </td>
            <td class="txtr bold wds15"> رقم الحالة  </td>
            <td class="txtr  wds30">{$statusNo}</td>
         </tr>
         <tr>
            <td class="txtr bold">التاريخ</td>
            <td class="arab"> {$date} </td>
            <td class="txtr bold"> تاريخ الطباعة    </td>
            <td class="arab"> {$printDate} </td>
         </tr>
         <tr>
            <td class="txtr bold"> اسم المستخدم  </td>
            <td>{$userName} </td>
            <td class="txtr bold"> النوع </td>
            <td>{$presType} </td>
         </tr>
      </table>

      <hr style="border: 1px solid black;  margin: 5px 0;">

   </div>



   <div style="clear: both"></div>
   <div class="zdetlz_aw" id="drugsContainer">
      <div  class="cntr {if $ProgramesettingData->alignttt == 0 }txtc{else if $ProgramesettingData->alignttt == -1}txtl{else if $ProgramesettingData->alignttt == 1}txtr{/if}" >
          {foreach $drugs as $drug}
            {if $drug->drugid  != ''}
            <div  class=" drugContainer {if $ProgramesettingData->alignttt == 0 }txtc{else if $ProgramesettingData->alignttt == -1}txtl{else if $ProgramesettingData->alignttt == 1}txtr{/if}"  style="margin-bottom:5px;direction:ltr;">
               <div class="cntr {if $ProgramesettingData->alignttt == 0 }txtc{else if $ProgramesettingData->alignttt == -1}txtl{else if $ProgramesettingData->alignttt == 1}txtr{/if}">
                    <span class="enfnt">{$drug->drugname} </span>
                    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                    <span class="enfnt"> {$drug->drugtype} </span> 
                    <span class="enfnt fright"> {if $ProgramesettingData->drug_quantity eq 1 && $drug->quantity != ''} ( {$drug->quantity} )   {/if}   </span>
                </div>
                <span class="txtc arab arbfnt onyio">   {$drug->drugdos} </span>
            </div>
             
            {/if}
            {/foreach}
        </div>

       <table id="drSig" style="margin: 5px auto;"  cellpadding="2" class="noborder rtl wds99">
          <tr>
             <td>
                <h4>
                   <span style="float: left;    margin-left: 41%;font-weight: bold;">توقيع الطبيب </span>
                </h4>
             </td>
             <td class="wds50"></td>
          </tr>

          <tr>
             <td>
                <h4>
                   <span style="float: left;    margin-left: 41%;font-weight: bold;">  {$doctorName}</span>
                </h4>
             </td>
             <td class="wds50"></td>
          </tr>
       </table>

    </div>
</div>

</div>

{literal}

<script type="text/javascript" >
 var path = $('#path').val();
  var content = document.getElementById('content');
   var pageHeight = 970; // pixels, approximately A4 @ 96dpi
   var newHeight = $('#patHeadTb').height() ; 
   
   var sepDiv = ' <div class="zprint_aw print-page" style="background: #f1f3fa url('+path+'/_assets/custom/images/semad.jpg) no-repeat center    center   !important; '
             + ' page-break-after: always;  background-blend-mode: lighten; background-attachment:fixed; '
            + ' background-size: 100% !important; min-height: 950px; margin: 0px auto;position: inherit;padding: 0px 50px;padding-right: 20px !important; '
      + ' padding-left: 20px !important; margin-right: 0px !important; margin-left: 0px !important;"  > ' ;
   

if(content.scrollHeight > pageHeight ){
   var tempDiv = sepDiv ;
    tempDiv +=  $('#patHeadTb').html()  ;
              $('.drugContainer').each(function () {   
                 newHeight = newHeight + $(this).height() ; 
                  console.log(newHeight +' - ');
                  if (newHeight > pageHeight) {
                     tempDiv  += '  </div>  ' ;
                     tempDiv += sepDiv  ;
                     tempDiv +=  $('#patHeadTb').html()  ;
                     newHeight = $('#patHeadTb').height() ; 
                     tempDiv +=  $(this).html()  ;
                  }else{
                     tempDiv +=  $(this).html()  ;
                  }
               });
              
               newHeight = newHeight + $('#drSig').height() ;
                    if (newHeight > pageHeight) {
                     tempDiv  += '   </div>  ' ;
                     tempDiv +=  sepDiv ;
                     tempDiv +=  $('#patHeadTb').html()  ;
                     tempDiv +=  $('#drSig').html()  ;
                     newHeight = $('#patHeadTb').height() ; 
                  }else{
                     tempDiv +=  $('#drSig').html()  ;
                  }
               
                tempDiv += '   </div> ' ;
             console.log(tempDiv);
                          $('#content').html('');
                        $('#content').html(tempDiv);
}


</script>
{/literal}



