<!-- body content  -->
<style>
    body {
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    }
    div.section{
        border: 1px solid black;
        padding: 5px;
        margin-bottom: 15px ;
    }
    span.title{
        font-size: 20px;
        font-weight: bold;
        padding-bottom: 10px;
        display: inline-block;
    }
    .p-label{
        font-weight: bold;
    }
    .p-logo{
        text-align: center;
    }
    @media print {
        div.page { page-break-after: always; }
    }
</style>

<?php foreach ($prescriptions as $provider):?>
<div class="page">
    <?php if(is_file($GLOBALS['fileroot'] . "/interface/pic/" . $GLOBALS['oer_config']['prescriptions']['logo_pic'])) ?>
    <div class="p-logo">
        <img width='68px' src=<?php echo $GLOBALS['rootdir'] . '/pic/' . $GLOBALS['oer_config']['prescriptions']['logo_pic']; ?> />
    </div>
    <?php ?>
    <h2><?php echo xlt('Medical prescription');?></h2>
    <div dir="<?php echo text($langDir); ?>"  class="section">
        <span class="title"><?php echo xlt('Patient details');?></span>
        <table width="100%" style="font-size: 15px">
            <tr>
                <td colspan="2" width="60%"><span class="p-label"><?php echo xlt('Name') . ': ' ?></span><?php echo text($patient->get_name_display())?></td>
            </tr>
            <tr>
                <td width="29%"><span class="p-label"><?php echo xlt('Birth Date') . ': '  ?></span><?php echo  text($patient->date_of_birth)?></td>
                <td width="42%"><span class="p-label"><?php echo xlt('Pubpid') . ': '  ?></span><?php echo text($patient->get_pubpid)?></td>
            </tr>
        </table>
    </div>

    <div dir="<?php echo text($langDir); ?>"  class="section">
        <span class="title"><?php echo xlt('Prescriptions');?></span>
        <table width="100%" style="font-size: 16px">
            <?php foreach ($provider as $k => $p):?>
            <tr>
                <td width="40%"><span class="p-label"><?php echo xlt('Drug name') . ': ' ?></span><?php echo text($p->get_drug())?></td>
                <td width="30%"><span class="p-label"><?php echo xlt('Drug units') . ': ' ?></span><?php echo text($p->get_size()) . ' ' . text($p->get_unit_display())?></td>
                <td width="30%"><span class="p-label"><?php echo xlt('Quantity') . ': ' ?></span><?php echo text($p->get_quantity())?></td>
            </tr>
            <tr>
                <td width="40%"><span class="p-label"><?php echo xlt('Directions') . ': ' ?></span><?php echo text($p->get_dosage()) . ' ' . text($p->form_array[$p->get_form()]) . ' ' . text($p->route_array[$p->get_route()]) . ' ' . text($p->interval_array[$p->get_interval()])?></td>
                <td colspan="2" width="60%"><span class="p-label"><?php echo xlt('Notes') . ': ' ?></span><?php echo text($p->get_note())?></td>
            </tr>
            <?php if($k+1 !== count($provider)): ?>
            <tr>
                <td colspan="3">
                    <hr />
                </td>
            </tr>
            <?php endif;?>
            <?php endforeach; ?>
        </table>
    </div>
    <div>
        <table dir="<?php echo text($langDir); ?>">
            <tr>
                <td><span class="p-label"><?php echo xlt('Date') . ': </span>' . oeFormatShortDate();?></td>
            </tr>
            <tr>
                <td><span class="p-label"><?php echo xlt('provider') . ': </span>' . text($provider[0]->provider->fname . ' ' . $provider[0]->provider->lname);?></td>
            </tr>
            <tr>
                <td><span class="p-label"><?php echo xlt('Signature') . ': </span>___________________';?></td>
            </tr>
        </table>
    </div>
</div>
<?php endforeach; ?>
<script>
    window.print();
    window.close();
</script>
