<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"> 
<style type="text/css">
    .ValSpan{
        opacity:0;
    }
    .inv-info{
        font-size: 15px;
        font-weight: bold;
    }
    .border-div{
        border: 2px solid #000;
        border-style: dotted;
        padding: 10px;
        border-right:0;
        border-left:0;
        border-top:0;
    }

    .border-tr{
        border: 2px solid #000;
        border-style: dotted;
        padding: 12px;
        border-bottom:0;
        border-left:0;
        border-top:0;
    }
    .border-td{
        border: 2px solid #000;
        border-style: dotted;
        padding: 10px;
        border-bottom:0;
        border-top:0;
    }
    .border-table{
        border: 2px solid #000;
        border-style: dotted;
        border-right:0;
        border-left:0;
        margin-top:15px;
    }
    .table tbody tr td{
        /*line-height:12px;*/
    }
    .table thead tr th{
        background: #ddd;
    }

    h5{
        font-size:17px !important;
    }
    .phone-l{
        margin-left:1px !important;
    }
    .font-type-1{
        font-size:medium !important;
    }
    .font-type{
        font-size:large !important;
    }
    h5{
        line-height: 15px !important;
    }
    h4{
        line-height: 18px !important;
    }
    @media print {
        .table thead tr th{
            background: #ddd;
        }

        h5{
            font-size:14px !important;
        }
        img{
            max-width: 50% !important;
        }

        .table tbody tr td{
            /*line-height:20px;*/
            font-size:1em !important;
        }
        .phone-l{
            margin-left:1px !important;
        }.font-type-1{
            font-size:medium !important;
        }
        .font-type{
            font-size:large !important;
        }
        .mytitle{
            font-size:2.5em !important;
        }


        .footer{
            bottom:-90px;
            position:fixed;
        }	
    }

</style>
<!--< script src="< ?php echo VIEWS; ?>files/towords.js"></script>-->
<script>
    // to check if this invoice is for customer or vendor by using URL
    var IsVendor = location.pathname.toString().match(/\/vendor/i) != null;
    // to remove many digits after the period
    $(function () {
        $(".ValSpan").each(function () {
            $(this).html(AddCommas(public_round_number(parseFloat($.trim($(this).text()))))).animate({opacity: 1})
        })
    })
</script>


<div class="wrapper">
    <div class="panel invoice">
        <div class="panel-body">

            <div class="row ">
                <div class="col-xs-4  m-b-10">
                    <h4 ><?php echo $org_details[0]["Organization_Legal_Name"] ?></h4>
                    <h4 class="phone-l"><?php echo $org_details[0]["Organization_Phone"] ?></h4>

                    <h5> <?php echo $org_details[0]["Name"] . '-' . $org_details[0]['Organization_Province'] ?></h5>
                    <h4 class="phone-l"><?php echo CommonLanguage::getMessage('reg_nb') ?>&nbsp;<?php echo $org_details[0]["Organization_Commercial_Registry"] ?></h4>
                    <h4 class="phone-l"><?php echo CommonLanguage::getMessage('Email') ?>:&nbsp;<?php echo $org_details[0]["Organization_Email"] ?></h4>
                </div>
                <div class="col-xs-4 text-center">
                    <img src="<?= upload_url;?>org_logo/invoice_logo.jpg" alt="" style="max-width:150px"/>

                </div>
                <div class="col-xs-4  m-b-10">
                    <h4 class="text-right"><?php echo $org_details[0]["Organization_Name"] ?></h4>
                    <h4 class="text-right"><?php echo $org_details[0]["Organization_Phone"] ?></h4>
                    <h5 class="text-right"><?php echo CommonLanguage::getMessage($org_details[0]["Name"], 'ar') . ' - ' . $org_details[0]["Organization_Street"] ?></h5>
                    <h4 class="text-right"> <?php echo CommonLanguage::getMessage('reg_nb', 'ar') ?>&nbsp;<?php echo $org_details[0]["Organization_Commercial_Registry"] ?></h4>
                </div>
            </div>
            <div class="col-xs-8 col-md-8 pull-right">
                <div class="row">
                    <div class="col-xs-5">
                        <h1 class="text-center mytitle"><?php echo CommonLanguage::getMessage('expenditure') ?></h1>
                    </div>

                </div>
            </div>
            <div class="col-xs-12 col-md-12 border-div">
                <div class="row">
                    <div class="col-xs-6 font-type ">
                        <?php print CommonLanguage::getMessage('Name'); ?>: <?php echo $data['Person']["Name"]; ?>
                        <br/><?php print CommonLanguage::getMessage('address'); ?>: <?php echo $data['Person']["Country_Name"] . '-' . $data['Person']["Address"]; ?>
                        <br/><?php print CommonLanguage::getMessage('Phone'); ?>: <?php echo $data['Person']["Phone"]; ?>



                    </div>

                    <div class="col-xs-6 font-type">
                        <div> <?php echo CommonLanguage::getMessage('invoice'); ?> #&nbsp;<?php echo $data['Main']["expense_nb"]; ?></div>
                        <div ><?php echo CommonLanguage::getMessage('supplier_invoice_nb'); ?> 	:&nbsp;<?php echo $data['Main']["supplier_inv_id"]; ?></div>
                        <div><?php print CommonLanguage::getMessage('Date'); ?> :&nbsp;<?php echo $data['Main']["Expense_Date"]; ?></div>
                        <div><?php print CommonLanguage::getMessage('due_date'); ?>:&nbsp;<?php echo $data['Main']["Expense_DueDate"]; ?></div>
                        <div class="print_delv"><?php print CommonLanguage::getMessage('Currency'); ?> :&nbsp;<?php echo $data['Main']["Currency_Name"]; ?></div>
                    </div>

                </div>


                <table class="table  border-table">
                    <thead>
                        <tr class="border-div">
                            <th class="border-td text-center">No.</th>
                            <th  class="border-tr text-center"><?php print CommonLanguage::getMessage('Name'); ?></th>
                            <th class="border-tr text-center"><?php print CommonLanguage::getMessage('qty'); ?></th>
                            <th class="border-tr text-center" ><?php print CommonLanguage::getMessage('Description'); ?></th>
                            <th class="border-tr print_delv text-center"><?php print CommonLanguage::getMessage('price'); ?></th>
                            <th class="border-tr print_delv text-center" ><?php print CommonLanguage::getMessage('vat'); ?></th>
                            <th class="border-tr print_delv text-center"><?php print CommonLanguage::getMessage('total'); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        for ($i = 0; $i < count($data['details']); $i++) {
                            $item = $data['details'][$i];
                            ?>
                            <tr>
                                <td class=" border-td text-center"><?php echo $i + 1; ?></td>
                                <td  class="border-tr text-center"><?php echo $item["Account_Name"]; ?></td>
                                <td  class="border-tr text-center"><?php echo $item["quantity"]; ?></td>
                                <td  class="border-tr text-center"><?php echo $item["description"]; ?></td>
                                <td class="border-tr print_delv text-center"><span class='CurrencyIndicator'></span>&nbsp;<span class=""><?php echo Forms::DecimalNumber($item["unit_price"]); ?></span></td>
                                <td class="border-tr print_delv text-center"><span class='CurrencyIndicator'></span>&nbsp;<span class=""><?php echo Forms::DecimalNumber($item["vat_amount"]); ?></span></td>
                                <td class="border-tr print_delv text-center"><span class='CurrencyIndicator'></span>&nbsp;<span class=""><?php echo Forms::DecimalNumber($item["net_total"] + $item["vat_amount"]); ?></span> </td>
                            </tr>
                        <?php } ?>
                    </tbody>
                </table>

                <div class="row">

                    <div class="col-xs-3 ">


                    </div>
                    <div class="col-xs-4 font-type  pull-right print_delv">
                        <div class="col-xs-6"><span><?php echo CommonLanguage::getMessage('subtotal') ?></span>:&nbsp;</div><?php echo Forms::DecimalNumber($data['Main']["Expense_Total_Price"]); ?><br/>
                        <div class="col-xs-6"><span><?php echo CommonLanguage::getMessage('vat') . '(' . smc_session()['vat_percent'] . '%)' ?></span>:&nbsp;</div><?php echo Forms::DecimalNumber($data['Main']["Expense_VAT"]); ?><br/>
                        <div class="col-xs-6 "><span><strong><?php echo CommonLanguage::getMessage('grand_total') ?></span>:</strong>&nbsp;</div><strong><?php echo Forms::DecimalNumber($data['Main']["Expense_Total_Price"] + $data['Main']["Expense_VAT"]); ?></strong>
                    </div>

                </div>


            </div>
            <br>


            <div class="row no-print">
                <div class="col-md-12">
                    <div class="pull-right">
                        <a id="invoice_print_btn" class="btn btn-danger" onclick="javascript:$('.print_delv').removeClass('no-print');javascript:window.print();"><i class="fa fa-print"></i> <?php print CommonLanguage::getMessage('print'); ?></a>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
