<link href="<?php echo THEME_PATH; ?>css/style.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo THEME_PATH; ?>css/style-responsive.css" rel="stylesheet">
<link href="<?php echo THEME_PATH; ?>/css/bootstrap.rtl.css" rel="stylesheet">
<link href="<?php echo THEME_PATH; ?>/css/style.rtl.css" rel="stylesheet">
<link href="<?php echo THEME_PATH; ?>/plugins/bootstrap-datepicker/css/datepicker3.rtl.css" rel="stylesheet">
<style>
    #headerDiv span {font-size:12px;}
    #headerDiv h3{
        margin-bottom: 0px;
    }
    table.first,table.secondTbl {color: #000;font-family: aealarabiya; font-size: 12px;}
    th,td{
        font-size:15px;text-align: center;}
    .second{display:none;}
    body{
        margin:0;
    }</style>
<body style="" onload="window.print()">
    <div id="myDivToPrint">
        <div style="text-align: center;" id="headerDiv">
            <h3><?php echo smc_session()['org_detail']['Organization_Name'];?></h3>
            <span><?php echo smc_session()['org_detail']['Org_Address'];?></span><br/>
            <span><?php echo smc_session()['org_detail']['Organization_Phone'];?></span>
            <br/><span>VAT #: <?php echo smc_session()['org_detail']['Organization_Commercial_Registry'] ?></span><br/>
            <span><?php echo CommonLanguage::getMessage('range_date') . ': '.$data_filter['fromToDate']; ?></span>
            <?php if(!empty($data_filter['users'])){?>
            <br><span><?php echo  CommonLanguage::getMessage('users')  . ': '.$data_filter['users']; ?></span>
            <?php } if($data_filter['return'] == 1){?>
            <br><span><?php echo  CommonLanguage::getMessage('return'); ?></span>
            <?php }?>
            <hr>
            <table class="first "  cellspacing='' style="width:100%;">
                <thead>
                    <tr>
                        <th><?php print CommonLanguage::getMessage('Name') ?></th>
                        <th><?php print CommonLanguage::getMessage('Quantity') ?></th>
                        <th><?php print CommonLanguage::getMessage('Price') ?></th>
                    </tr>
                </thead>
                <tbody>
                    <?php
    foreach ($data as $row) {
                    ?>
                    <tr>
                        <td ><?php echo $row['brand_name'] ?></td>
                        <td ><?php echo $row['total_qty'].' '.$row['UOM_Name']; ?></td>
                        <td ><?php echo $row['Currency_Symbol'].' '.CommonFunctions::formatNumber($row['total_price']); ?></td>
                    </tr>
                    <?php } ?>
                </tbody>
            </table>
            <hr>
            <table class="secondTbl">
                <thead>
                    <tr class="second">
                        <th ></th>
                        <th ></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><?php echo CommonLanguage::getMessage('Quantity') ?> </td>
                        <td><?php echo $total_quantity;?></td>
                    </tr>
                    <tr>
                        <td><?php echo CommonLanguage::getMessage('total') ?> </td>
                        <td><?php echo $totals.' '.smc_session()['local_currency_symbol'];?></td>
                    </tr>
                </tbody>
            </table>
            <hr>
        </div>
    </div>
    <script>
        function PrintElem(elem)
        {
            var mywindow = window.open('', 'PRINT', 'height=600,width=800');
            mywindow.document.write('<html><head><style>#headerDiv span {font-size:12px;} table.first,table.secondTbl {color: #000;font-family: aealarabiya; font-size: 12px;}th,td{' +
                                    'font-size:12px;}' +
                                    '.second{display:none;}</style>');
            mywindow.document.write('</head><body style="direction:rtl;">');
            mywindow.document.write(elem.html());
            mywindow.document.write('</body></html>');
            mywindow.document.close(); // necessary for IE >= 10
            mywindow.focus(); // necessary for IE >= 10*/
            mywindow.print();
            mywindow.close();
            return true;
        }
    </script>
</body>
