<?php
//echo"<pre>";
//die(print_r($data));
$date_lang = CommonLanguage::getMessage('Date', 'ar');
$time_lang = CommonLanguage::getMessage('time', 'ar');
$inv_lang = CommonLanguage::getMessage('return_nb', 'ar');
$client_lang = CommonLanguage::getMessage('customer_name', 'ar');
$order_lang = CommonLanguage::getMessage('order', 'ar');
$address_lang = CommonLanguage::getMessage('address', 'ar');
$phone_lang = CommonLanguage::getMessage('Phone', 'ar');
$currenttime = date('y-m-d h:i:s a');
?>
<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;}
    table.first,table.secondTbl {color: #000;font-family: aealarabiya; font-size: 12px;}
    th,td{
        font-size:12px;text-align: center;}
    .second{display:none;}</style>
<body style="direction:rtl;" onload="window.print()">
    <div id="myDivToPrint">
        <div style="text-align: center;" id="headerDiv">
            <h3><?php echo $data['Org'][0]['Organization_Name'] ?></h3>
            <span><?php echo $data['Org'][0]['Org_Address'] ?> </span>
            <br><span><?php echo $data['Org'][0]['Organization_Phone'] ?></span>
            <br><span><?php echo $time_lang . ': ' . $currenttime ?></span>
            <br><span><?php echo $inv_lang . ' ' . $data['main_invoice']['Return_Invoice_ID'] ?></span>
            <?php if ($data['main_invoice']['Name'] != "") { ?>
            <br><span><?php echo $client_lang . ': ' . $data['main_invoice']['Name'] ?></span>
<!--
            <br><span>< ?php echo $phone_lang . ': ' . $data['main_invoice']['customer_phone'] ?></span>
            <br><span>< ?php echo $address_lang . ': ' . $data['main_invoice']['customer_address'] ?></span>
-->
        </div>
        <?php } ?>
        <hr>
        <table class="first "  cellspacing='10' style="width:100%;">
            <thead>
                <tr>
                    <th  style="width:65%"><?php echo CommonLanguage::getMessage('Name', 'ar') ?></th>
                    <th  style="width:15%"><?php echo CommonLanguage::getMessage('qty', 'ar') ?></th>
                    <th style="width:10%" ><?php echo CommonLanguage::getMessage('price', 'ar') ?></th>
                    <th  style="width:10%"><?php echo CommonLanguage::getMessage('total', 'ar') ?></th>
                </tr>
            </thead>
            <tbody>
                <?php
    foreach ($data['return_details'] as $row) {
        $name = $row['Return_Product_Quantity'];
        if ($row['UOM_Name'] != '-') {
            $name .= " {$row['UOM_Name']}";
        }
                ?>
                <tr>
                    <td  ><?php echo $row['Bar_Code'].'<br>'.$row['Product_Name'] ?></td>
                    <td ><?php echo $name ?></td>
                    <td ><?php echo CommonFunctions::public_round_number($row['unit_price']) ?></td>
                    <td ><?php echo CommonFunctions::public_round_number($row['Return_Product_Total']) ?></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('subtotal', 'ar') ?> </td>
                    <td>< ?php echo number_Xformat($data['main_invoice']['Invoice_Sub_Total']) ?> L.L </td>
                </tr>
-->
<!--
                <tr>
                    <td>< ?php echo CommonLanguage::getMessage('round', 'ar') ?></td>
                    <td>< ?php echo round($data['main_invoice']['Invoice_Net_Total'] -  $data['main_invoice']['Invoice_Sub_Total']+ round($data['main_invoice']['Discount_Value'], 2),2) ?>  L.L</td>
                </tr>
-->
                <tr>
                    <td style="font-size:18px;font-weight: bold;"><?php echo CommonLanguage::getMessage('total', 'ar') ?> </td>
                    <td style="font-size:18px;font-weight: bold;"><?php echo $data['main_invoice']['Total']; ?></td>
                </tr>
            </tbody>
        </table>
        <hr>
        <?php if ($data['main_invoice']['Note'] != "") { ?>
        <p style="font-size:12pt;border:1px solid #000;"><?php echo $data['main_invoice']['Note'] ?></p>
        <?php } ?>
        <span class="third" ><?php echo CommonLanguage::getMessage('thank_msg', 'ar') ?></span><br>
        <span class="third" >Served by:&nbsp <?php echo smc_session()['user_details']['User_Name'] ?></span>
    </div>
</body>
