<?php
$Language = Session::getUserPreferences();
if ($Language == 'ar') {
    ?>
    <link href="<?php echo SITE_LINK; ?>Views/files/styles.rtl.css" rel="stylesheet">
<?php } else {
    ?>
    <link href="<?php echo SITE_LINK; ?>Views/files/styles.css" rel="stylesheet"> 
<?php } ?>
<script src="<?php echo SITE_LINK; ?>Views/files/scripts.js"></script>
<script src="<?php echo SITE_LINK; ?>Views/files/towords.js"></script>

<script src="<?php echo THEME_PATH; ?>plugins/jQuery-Scanner-Detection-master/jquery.scannerdetection.js"></script>
<script src="<?php echo THEME_PATH; ?>plugins/jQuery-Scanner-Detection-master/jquery.scannerdetection.compatibility.js"></script>

<style type="text/css">
    .cat{
        margin-top: -24px;
        background: #3B4752;
        width: 172px;
        margin-left: -15px;
        padding: 1px;
    }
    .cat > h4{
        color:#fff;
        text-align:center;
    }
    ul.Categories > li {
        width: 33.33%;
    }
    .invoiceLOGO {
        width: 100px; 
        height: 50px;
    }
    #POSInvoiceDateContainer{
        width: 261px;
        text-align: left;
    }
    #InvoiceIDTag,#POSInvoiceDateContainer{
        margin-left:30px;
        margin-top: 10px;
    }
    #InvoiceCurrentDay{
        float: right;
        display: inline-block;
        margin-right: 21px;
        margin-top: 0;
    }
    .hideme,.header {
        display: none;
    }

    .catli{
        border: 1px solid #3b4752;
        background-color: #4c0870; 
        padding: 10px;
        text-align: center;
        width: 169px;

        margin-left: -53px;
    }
    .catli > a{
        color:#fff;
    }
</style>
<section class="content " id="MainContainer" style="margin-top:-50px">
    <div class="mailbox row">
        <div class="col-xs-12 Boxed m-b-5 m-l-10" style="width: 98.7%;" >
            <div class="box box-solid">
                <div class="box-body">
                    <div class="row is-flex">
                        <div class="col-md-2" id="CustomerInfo">





                            <div id="CustomerSearch">
                                <input type="text" placeholder="<?php print CommonLanguage::getMessage('customer_name'); ?>" class="form-control borderStyle" />

                            </div>
                        </div>
                        <div class="col-md-1">
                            <button class="profile-dropdown-toggle openFrame"  data-src="Inventory/CustomerList?is_pop=1" type="button"  aria-haspopup="true" aria-expanded="true">

                                <span class="fa fa-plus-circle fa-2x m-t-5 " style="color:#8a7dbe;cursor:pointer"></span>


                            </button>
                        </div>

                        <div class="col-md-4"  id="CurCustomerInfo" CurCustomerID="0">
                        </div>
                        <!--
                                                <div class="col-md-1"  id="History">
                                                    <button class="profile-dropdown-toggle openFrame" data-src="< ?php echo ('Inventory/HistoryReportForCustomer?is_pop=1' );?>" id="History" type="button">
                                                        <span class="thumbnail-wrapper d32 circular inline m-t-5 " >
                                                            <i class="fa fa-eye fa-2x"></i> 
                        
                        
                        
                                                        </span>
                                                    </button>
                        
                                                </div>
                        -->
                        <div class="col-md-1">
                            <button class="profile-dropdown-toggle" id="refresh" type="button">
                                <span class="thumbnail-wrapper d32 circular inline m-t-5">
                                    <i class="fa fa-refresh fa-2x"></i>
                                </span>
                            </button>
                        </div>


                        <!--
<div class="col-md-1">
<div class="dropdown pull-right ">
<button class="profile-dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="thumbnail-wrapper d32 circular inline m-t-5">
<i class="fa fa-gear fa-2x"></i>
</span>
</button>
<ul class="dropdown-menu profile-dropdown posDrop" role="menu">
<li id="addDeposite" data-type="1"><a href="javascript:void(0);"><?php print CommonLanguage::getMessage('add_deposite') ?></a>
</li>
<li id="addWitdrawal" data-type="2"><a href="javascript:void(0);"><?php print CommonLanguage::getMessage('add_withdrawal') ?></a>
</li>
<li id="DefineTags"><a href="javascript:void(0);" data-toggle="modal" data-target="#DefineTagsModal"> < ?php print CommonLanguage::getMessage('tags') ?></a>
</li>
<li id="addPayment" data-type="3"><a href="javascript:void(0);" > <?php print CommonLanguage::getMessage('add_payment') ?></a>
</li>
<li id="view_customer_list" data-type="3"><a href="javascript:void(0);" > <?php print CommonLanguage::getMessage('customer_list') ?></a>
</li>
<li >

</li>
</ul>
</div>
</div>
                        -->




                    </div>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="box box-solid">
                <div class="box-body">
                    <div class="row">
                        <div class="RightBox col-md-4 col-sm-5">
                            <div class="LeftTableContainer">
                                <div class="table-responsive Boxed">
                                    <table class="table table-hover" cellpadding="0" cellspacing="0" id="OrderTable">
                                        <thead>
                                            <tr>
                                                <th style="width: 10px">
                                                    #
                                                    <div>#</div>
                                                </th>
                                                <th>
                                                    <?php print CommonLanguage::getMessage('Name'); ?>
                                                    <div><?php print CommonLanguage::getMessage('Name'); ?></div>
                                                </th>
                                                <th>
                                                    <?php print CommonLanguage::getMessage('Quantity'); ?>
                                                    <div><?php print CommonLanguage::getMessage('Quantity'); ?></div>
                                                </th>
                                                <!--
<th style="width: 20px">
< ?php print CommonLanguage::getMessage('UOM'); ?>
<div>< ?php print CommonLanguage::getMessage('UOM'); ?></div>
</th>
                                                -->
                                                <th>
                                                    <?php print CommonLanguage::getMessage('Price'); ?>
                                                    <div><?php print CommonLanguage::getMessage('Price'); ?></div>
                                                </th>
                                                <th>
                                                    <?php print CommonLanguage::getMessage('discount'); ?>
                                                    <div><?php print CommonLanguage::getMessage('discount'); ?></div>
                                                </th>
                                                <th>
                                                    <?php print CommonLanguage::getMessage('total'); ?>
                                                    <div><?php print CommonLanguage::getMessage('total'); ?></div>
                                                </th>

                                                <th>
                                                    <div></div>
                                                </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div id="TotalDiv" class="" style="height:0px">
                                <table class="table" cellpadding="0" cellspacing="0" id="TotalTable">
                                    <tr>
                                        <td style="width: 65%;"><span class="TotalSpanInTable"><?php print CommonLanguage::getMessage('subtotal'); ?> </span></td>
                                        <td class="SubtotalVal">0</td>
                                    </tr>
                                    <tr>
                                        <td><span class="TotalSpanInTable"><?php print CommonLanguage::getMessage('discount'); ?> <span class="discount">0 %</span> </span></td>
                                        <td class="DiscountVal">0</td>
                                    </tr>
                                    <tr>
                                        <td><span class="TotalSpanInTable"><?php print CommonLanguage::getMessage('vat'); ?></span></td>
                                        <td class="TVAVal">0 %</td>
                                    </tr>
                                    <tr class="">
                                        <td><span class="TotalSpanInTable TotalItem"><?php print CommonLanguage::getMessage('total'); ?></span></td>
                                        <td class="TotalVal">0</td>
                                    </tr>
                                    <tr class="TotalValue1">
                                        <td style="border-top: 0"><span class="TotalSpanInTable"></span></td>
                                        <td class="SecondCurrencyVal" style="border: 0;padding-top: 0;">0</td>
                                    </tr>
                                </table>
                            </div>
                            <div id="BottomDivContainer" class="row m-t-5" style="margin-top:140px" >
                                <div class="col-md-8" >
                                    <textarea id="Note" name="Note" class="form-control TextAreaNote" placeholder="<?php print CommonLanguage::getMessage('enter_note'); ?>" style="height:156px"></textarea>

                                </div>
                                <div class="col-md-3" >
                                    <button id="Generate_Report"  type="button" class="btn bg-master" data-toggle="dropdown" aria-expanded="false" style="color:#fff">
                                        <?php print CommonLanguage::getMessage('generate_invoice'); ?></button>

                                </div>
                                <!--                                <div class="col-md-6" id="CustomerInfo">
<div style="padding:8px; padding-left:1px;">
<div class="row Boxed">
<div class="col-xs-6 col-md-8">
<div class="row">
<div>
<div id="CustomerSearch">
<input type="text" placeholder="< ?php print CommonLanguage::getMessage('customer_name'); ?>" class="form-control" />
<i class="fa fa-search"></i>
</div>
</div>
<div style="text-align:left;padding:0 4px;" id="CurCustomerInfo" CurCustomerID="0">
</div>
</div>
</div>
<div class="col-xs-6 col-md-4" id="CustomerPhotoHandler">
<img src="img/avatar5.png" originalsrc="img/avatar5.png" class="img-circle" id="CustomerPhoto">
</div>
</div>
</div>
</div>-->
                                <!--                                <div class="BottomBox col-xs-6 col-md-6 pers">
<div class="row">
<div class="col-xs-12">



</div>
</div>-->
                                <!--<div class="row">-->
                                <!--<div class="col-xs-12 clearfix">-->
                                <!--<textarea id="Note" name="Note" class="form-control TextAreaNote" placeholder="<?php print CommonLanguage::getMessage('enter_note'); ?>" style="height:156px"></textarea>-->
                                <!--</div>-->
                                <!--<a href="#" id="InvoiceButton" class="BigButton "><span><table class="CenterText" cellpadding="0" cellspacing="0"><tr><td>< ?php print CommonLanguage::getMessage('create_invoice') ?></td></tr></table></span></a>-->

                                <!--</div>-->
                            </div>
                        </div>
                        <div class="col-md-8 col-sm-7 LeftBox" style="text-align:right;">
                            <ul class="nav nav-tabs">
                                <li role="presentation" class="active"><a data-toggle="tab" href="#Tab_1"><?php print CommonLanguage::getMessage('Action'); ?></a></li>
                                <li role="presentation"><a data-toggle="tab" href="#Tab_2"><?php print CommonLanguage::getMessage('offers'); ?></a></li>
                            </ul>
                            <div class="col-md-3 Boxed tab-content text-left" style="height:740px">
                                <div class="cat">
                                    <h4>Category</h4>

                                </div> 
                                <ul id="MainCat" style="list-style:none;margin-top:35px">

                                    <?php foreach ($categories as $categorie): ?>
                                        <div class="catli">
                                            <a href="#" data-id="<?php echo $categorie[0] ?>" data-name="<?php echo $categorie[1] ?>" class="">
                                                <li><?php echo $categorie[1] ?></li>
                                            </a>
                                        </div>
                                    <?php endforeach; ?>

                                </ul>

                            </div>

                            <div id="RightBoxContents" class="Boxed tab-content">

                                <div class="tab-pane fade in active" id="Tab_1">
                                    <div id="CategoriesSearch">
                                        <input type="text" placeholder="<?php print CommonLanguage::getMessage('search') ?>" id="product_search" class="form-control" />
                                        <i class="fa fa-search"></i>
                                    </div>
                                    <ul id="CurCategory_Crumbs"></ul>
                                    <div class="row" id="CurAvailableItemsContainer">
                                        <ul id="CurAvailableItems" class="Categories"></ul>
                                    </div>
                                    <ol id="PageIndicatorHandler" class="carousel-indicators"></ol>
                                </div>

                            </div>


                        </div>
                    </div>










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


<div class="modal fade no-print" id="EditDiscount" data-max="100" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
    <div class="modal-dialog modal-sm" style="width:300px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title"><?php print CommonLanguage::getMessage('discount'); ?></h4>
            </div>
            <div class="modal-body">

                <div class="row">
                    <div class="col-xs-4 modal-field-caption"><?php print CommonLanguage::getMessage('discount'); ?>:</div>
                    <div class="col-xs-8">
                        <div class="input-group InputSpinner" style="width:100%">
                            <input type="text" id="DiscountInput" class="form-control" value="0" onblur="InputMustBeAtleastN(this, 0)" />
                            <div class="input-group-btn-vertical">
                                <button class="btn btn-default more"><i class="fa fa-caret-up"></i></button>
                                <button class="btn btn-default"><i class="fa fa-caret-down"></i></button>
                            </div>
                        </div>

                        <!--<input id="DiscountInput" class="form-control" type="text" required/>-->
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><?php print CommonLanguage::getMessage('Close'); ?></button>
                <button type="button" class="btn btn-primary"><?php print CommonLanguage::getMessage('Save'); ?></button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade " id="InvoiceModal" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header ">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <div id="InvoiceCurrentDay" ><?php print CommonLanguage::getMessage('Date'); ?>: <?php echo ($date . ' - ' . date("h:i:sa")); ?></div>
                <div class="row">
                    <div class="col-xs-12 no-print">
                        <img src="<?= upload_url;?>org_logo/invoice_logo.jpg" width="100px" height="50px" />
                    </div>
                </div>
            </div>
            <div class="modal-body">
                <div class="row invoice-info">
                    <h3 style="text-align:left;margin-left:150px" class="no-print"><strong><?php print CommonLanguage::getMessage('sales_invoice'); ?></strong></h3>
                    <div class="col-md-12 col-xs-12 col-sm-12 invoice-col" >
                        <!--< ?php print CommonLanguage::getMessage('From'); ?>--> 

                        <div class="col-xs-12" style="text-align:center">
                            <span  class="bold" ><?php echo $ListOrg[0]["Organization_Name"] ?></span>
                            <br>
                            <span  style="text-align:center"><?php echo $ListOrg[0]["Name"] . ' - ' . $ListOrg[0]["Country_Name"] ?></span>
                        </div>
                        <br>
                        <br>
                        <div class="col-xs-12" style="text-align:center">
                            <b id="InvoiceIDTag"><?php print CommonLanguage::getMessage('invoice_nb'); ?></b>
                            <br>
                            <b id="InvoiceIDBonTag" ><?php print CommonLanguage::getMessage('bon_nb'); ?></b>


                            <br>
                            <span class="<?php echo $ListOrg[0]["Organization_Phone"] == '' ? "no-print" : "" ?>">   <?php print CommonLanguage::getMessage('Phone'); ?>: <span><?php echo $ListOrg[0]["Organization_Phone"] ?></span>
                            </span> 
                        </div>


                    </div>
                    <div class="col-md-4 col-xs-4 col-sm-4 invoice-col InvoiceTo no-print">
                        <?php print CommonLanguage::getMessage('To'); ?>
                        <address class="ToPerson">
                        </address>
                    </div>
                    <div class="col-md-2 col-xs-2 col-sm-2 invoice-col ">

                        <div id="POSInvoiceDateContainer" class="form-group form-group-default input-group no-print">
                            <label><?php print CommonLanguage::getMessage('duedate'); ?></label>
                            <input id="POSInvoiceDate" name="PurchaseInvoiceDate" class="form-control pull-left" value="<?php echo ($date); ?>" />
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div> 
                        <div class="Account_Code no-print" style="margin-left:30px;width:73%">
                            <select  name="Account_Code" id="Account_Code"  class="full-width Account_Code " data-init-plugin="select2">
                                <option value="0"><?php print CommonLanguage::getMessage('choose_account'); ?></option> 

                                <?php foreach ($salesAcc as $sal): ?>
                                    <option value="<?php echo $sal['Account_Code']; ?>"><?php echo $sal['Account_Name'] . ' - ' . $sal['Account_Code']; ?></option>
                                <?php endforeach; ?>

                            </select>
                            <!--                                        <input type = "text" id="Account_Code" class="form-control" placeholder="Account Code">-->
                        </div>
                    </div>
                </div>
                <hr>
                <div class="row">
                    <div class="col-xs-12 containerprinttable">
                        <table class="table table-bordered table-striped" id="InvoiceMiddleTable">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th class="no-print"><?php print CommonLanguage::getMessage('Product'); ?> #</th>
                                    <th><?php print CommonLanguage::getMessage('Name'); ?></th>
                                    <th><?php print CommonLanguage::getMessage('Quantity'); ?></th>
                                    <th><?php print CommonLanguage::getMessage('unit_price'); ?></th>
                                    <th class="no-print"><?php print CommonLanguage::getMessage('discount'); ?></th>
                                    <th ><?php print CommonLanguage::getMessage('price'); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="row no-print" id="InvoiceBottom" style="display:none">
                    <div class="col-xs-6" id="InvoiceTotalInNumbers">
                        <div id="InvoiceBottomPriceInWords">

                        </div>
                        <div id="InvoicePaymentSetup" class="no-print">
                            <h4><?php print CommonLanguage::getMessage('payment'); ?></h4>

                            <div class="Body">
                                <div class="">
                                    <ul class="nav nav-tabs">
                                        <li class="active"><a data-toggle="tab" href="#SetPaidFormTab_1"><i class="fa fa-money"></i>&nbsp;&nbsp;<?php print CommonLanguage::getMessage('cash'); ?></a></li>
                                        <li><a data-toggle="tab" href="#SetPaidFormTab_2"><i class="fa fa-file-text-o"></i>&nbsp;&nbsp;<?php print CommonLanguage::getMessage('check'); ?></a></li>
                                        <li><a data-toggle="tab" href="#SetPaidFormTab_3"><i class="fa fa-cc-visa"></i>&nbsp;&nbsp;<?php print CommonLanguage::getMessage('credit_card'); ?></a></li>
                                    </ul>
                                    <div class="tab-content" style="padding:0;overflow:visible">
                                        <div id="SetPaidFormTab_1" class="tab-pane fade in active">
                                            <table class="table" cellpadding="0" cellspacing="0">
                                                <tbody>
                                                    <tr>
                                                        <td style="width: 65%;"><span class="SpanInTableInPayment"><?php print CommonLanguage::getMessage('amount'); ?></span></td>
                                                        <td>
                                                            <div class="input-group InputSpinner" style="width:120px">
                                                                <input type="text" class="form-control" value="0" onblur="InputMustBeAtleastN(this, 0);" />
                                                                <div class="input-group-btn-vertical">
                                                                    <button class="btn btn-default more"><i class="fa fa-caret-up"></i></button>
                                                                    <button class="btn btn-default"><i class="fa fa-caret-down"></i></button>
                                                                </div>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><span class="SpanInTableInPayment"><?php print CommonLanguage::getMessage('Type'); ?></span></td>
                                                        <td style="text-align:center">
                                                            <div class="input-group-btn DropDownForForms Closable">
                                                                <button type="button" class="btn btn-default btn-block dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                                                                    <span><?php print CommonLanguage::getMessage('select'); ?></span>
                                                                    <input type="hidden" value="" class="form-control" required onkeyup="return false" onkeydown="return false"/>
                                                                </button>
                                                                <ul class="dropdown-menu">
                                                                    <?php for ($x = 0; $x < count($Cashes); $x++) { ?>
                                                                        <li value="<?php echo $Cashes[$x]["Payment_Type_ID"]; ?>"><a><?php echo $Cashes[$x]["Payment_Type_Name"]; ?></a></li>
                                                                    <?php } ?>
                                                                </ul>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div id="SetPaidFormTab_2" class="tab-pane fade in">
                                            <table class="table" cellpadding="0" cellspacing="0">
                                                <tbody>
                                                    <tr>
                                                        <td style="width: 65%;"><span class="SpanInTableInPayment"><?php print CommonLanguage::getMessage('amount'); ?></span></td>
                                                        <td>
                                                            <div class="input-group InputSpinner" style="width:120px">
                                                                <input type="text" class="form-control" value="0" onblur="InputMustBeAtleastN(this, 0);" />
                                                                <div class="input-group-btn-vertical">
                                                                    <button class="btn btn-default more"><i class="fa fa-caret-up"></i></button>
                                                                    <button class="btn btn-default"><i class="fa fa-caret-down"></i></button>
                                                                </div>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><span class="SpanInTableInPayment"><?php print CommonLanguage::getMessage('Type'); ?></span></td>
                                                        <td style="text-align:center">
                                                            <div class="input-group-btn DropDownForForms Closable">
                                                                <button type="button" class="btn btn-default btn-block dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                                                                    <span><?php print CommonLanguage::getMessage('select'); ?></span>
                                                                    <input type="hidden" value="" class="form-control" required onkeyup="return false" onkeydown="return false"/>
                                                                </button>
                                                                <ul class="dropdown-menu">
                                                                    <?php for ($x = 0; $x < count($Checks); $x++) { ?>
                                                                        <li value="<?php echo $Checks[$x]["Payment_Type_ID"]; ?>"><a><?php echo $Checks[$x]["Payment_Type_Name"]; ?></a></li>
                                                                    <?php } ?>
                                                                </ul>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><span class="SpanInTableInPayment"><?php print CommonLanguage::getMessage('check'); ?> #</span></td>
                                                        <td style="text-align:center"><input type="text" class="form-control CheckNumValue" /></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div id="SetPaidFormTab_3" class="tab-pane fade in">
                                            <table class="table" cellpadding="0" cellspacing="0">
                                                <tbody>
                                                    <tr>
                                                        <td style="width: 65%;"><span class="SpanInTableInPayment"><?php print CommonLanguage::getMessage('amount'); ?></span></td>
                                                        <td>
                                                            <div class="input-group InputSpinner" style="width:120px">
                                                                <input type="text" class="form-control" value="0" onblur="InputMustBeAtleastN(this, 0);" />
                                                                <div class="input-group-btn-vertical">
                                                                    <button class="btn btn-default more"><i class="fa fa-caret-up"></i></button>
                                                                    <button class="btn btn-default"><i class="fa fa-caret-down"></i></button>
                                                                </div>
                                                            </div>
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td><span class="SpanInTableInPayment"><?php print CommonLanguage::getMessage('Type'); ?></span></td>
                                                        <td style="text-align:center">

                                                            <div class="input-group-btn DropDownForForms Closable">
                                                                <button type="button" class="btn btn-default btn-block dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                                                                    <span><?php print CommonLanguage::getMessage('select'); ?></span>
                                                                    <input type="hidden" value="" class="form-control" required onkeyup="return false" onkeydown="return false"/>
                                                                </button>
                                                                <ul class="dropdown-menu">
                                                                    <?php for ($x = 0; $x < count($CreditCards); $x++) { ?>
                                                                        <li value="<?php echo $CreditCards[$x]["Payment_Type_ID"]; ?>"><a><?php echo $CreditCards[$x]["Payment_Type_Name"]; ?></a></li>
                                                                    <?php } ?>
                                                                </ul>
                                                            </div>
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td><span class="SpanInTableInPayment"><?php print CommonLanguage::getMessage('approval_code'); ?></span></td>
                                                        <td style="text-align:center"><input type="text" class="form-control CardApproval" /></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>

                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="table-responsive" id="InvoiceTableBottom">

                        </div>
                    </div>
                </div>
                <div class="row no-print" id="InvoiceFooter">
                    <hr>
                </div>		
            </div>
            <div class="modal-footer no-print" style="text-align:left;">

                <button id ="printBtn" class="btn btn-default" disabled onclick="PrintThisModal('#InvoiceModal');"><i class="fa fa-print"></i> <?php print CommonLanguage::getMessage('print'); ?></button>
                <button type="button" class="btn btn-primary pull-right" id="SubmitPaymentInvoice"><?php print CommonLanguage::getMessage('Save'); ?></button>
                <button type="button" class="btn btn-default pull-right" data-dismiss="modal"><?php print CommonLanguage::getMessage('Close'); ?></button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade bs-example-modal-md " id="addCustomerModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:50%">
        <div class="modal-content">
            <div class="modal-header clearfix text-left">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="pg-close fa-22"></i></span></button>
                <h4 class="modal-title"><?php print CommonLanguage::getMessage('new_customer') ?></h4>
                <div id="addCustomerAlert"></div>
            </div>
            <div class="modal-body">
                <form id="AddCustomerForm">
                    <div class="row">

                        <div class=" col-md-12 m-t-10 " >
                            <div class="col-md-6">
                                <label class="labelText"><?php print CommonLanguage::getMessage('Name'); ?></label>


                                <input type="text" placeholder="<?php print CommonLanguage::getMessage('Name'); ?>" id="Customer_Name" name="customer_name" class="form-control " required>

                            </div>

                            <div class="col-md-6">
                                <label class="labelText"><?php print CommonLanguage::getMessage('Phone'); ?></label>


                                <input type="text" placeholder="<?php print CommonLanguage::getMessage('Phone'); ?>" id="Customer_Phone" name="customer_phone" class="form-control " required>

                            </div>
                        </div>
                        <div class=" col-md-12 m-t-10" >

                            <label class="labelText"><?php print CommonLanguage::getMessage('address'); ?></label>


                            <textarea  placeholder="<?php print CommonLanguage::getMessage('address'); ?>" id="Customer_Address" name="customer_address" class="form-control " required style="resize:none"></textarea>


                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><?php print CommonLanguage::getMessage('Close') ?></button>
                <button type="button" class="btn bg-info white" id="addCust" style="width:auto"><?php print CommonLanguage::getMessage('Save') ?></button>
            </div>
        </div>
    </div>
</div>




<select required name="UOM_Select" id="UOM_Select" class="full-width UOM_Select hidden " data-init-plugin="select2">
    <?php foreach ($all_uom as $uom): ?>
        <option value="<?php echo $uom['UOM_ID']; ?>"><?php echo $uom['UOM_Name']; ?></option>
    <?php endforeach; ?>
</select>







<!--	Delivery Note Modal -->
<!--
<div class="modal fade no-print" id="DeliveryNoteModal" tabindex="-1" role="dialog" aria-labelledby="smallModal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<div id="InvoiceCurrentDay">Date: < ?php echo ($date); ?></div>
<div class="row">
<div class="col-xs-12">
<img src="<?= upload_url;?>org_logo/invoice_logo.jpg" width="100px" height="50px" />
</div>
</div>
</div>
<div class="modal-body">
<div class="row invoice-info">
<h3 style="text-align:center"><strong>Delivery Note</strong></h3>
<div class="col-sm-4 invoice-col">
From
<address>
<strong>Plastrue Co.</strong><br>
Saida<br>
Lebanon<br>
Phone: (+961) 7 728 430<br>
Email: info@plastrue.com
</address>
</div>
<div class="col-sm-4 invoice-col">
To
<address class="ToPerson">
</address>
</div>
<div class="col-sm-4 invoice-col">

<b id="DeliveryNoteIDTag">Invoice #</b><br>
<div id="POSInvoiceDateContainer" class="form-group form-group-default input-group">
<label>Delivery Date</label>
<input id="POSInvoiceDate" name="PurchaseInvoiceDate" class="form-control" value="< ?php echo ($date); ?>" />
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div> 
</div>
</div>
<div class="row">
<div class="col-xs-12 table-responsive">
<table class="table table-striped" id="DeliveryNoteMiddleTable">
<thead>
<tr>
<th>#</th>
<th>Product #</th>
<th>Name</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="row" id="InvoiceFooter">
<hr>Bargout Str. - Sabbagh bldg. - Saida - Lebanon. +961 7 728 430 - info@plastrue.com - www.plastrue.com. CR:2749495
</div>		
</div>
<div class="modal-footer" style="text-align:left;">
<button class="btn btn-default" onclick="PrintThisModal('#InvoiceModal');"><i class="fa fa-print"></i> Print</button>
<button type="button" class="btn btn-primary pull-right" id="SubmitPaymentInvoice">Submit</button>
<button type="button" class="btn btn-default pull-right" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>


-->







<script>
    var CompanyLang = <?php echo json_encode(CommonLanguage::getMessage('company')); ?>,
            AddressLang = <?php echo json_encode(CommonLanguage::getMessage('address')); ?>,
            PhoneLang = <?php echo json_encode(CommonLanguage::getMessage('Phone')); ?>,
            NameLang = <?php echo json_encode(CommonLanguage::getMessage('Name')); ?>,
            DiscountLang = <?php echo json_encode(CommonLanguage::getMessage('discount')); ?>,
            BalanceLang = <?php echo json_encode(CommonLanguage::getMessage('balance')); ?>,
            ShippingLang = <?php echo json_encode(CommonLanguage::getMessage('shipping')); ?>,
            SubmittingLang = <?php echo json_encode(CommonLanguage::getMessage('submitting')); ?>,
            TotalLang = <?php echo json_encode(CommonLanguage::getMessage('total')); ?>,
            Invoice = <?php echo json_encode(CommonLanguage::getMessage('invoice')); ?>,
            Customer = <?php echo json_encode(CommonLanguage::getMessage('customer')); ?>,
            LastPurLang = <?php echo json_encode(CommonLanguage::getMessage('last_purchase')); ?>;
    $("body").addClass("NoAutoScroll")

    var logged_id = 1,
            CurrentInvoiceID = <?php echo $NewInvoice_ID; ?>,
            BonInvoiceID = <?php echo $LastInvoiceNumberID; ?>,
            SessionLoggedID = <?php echo Session::getUserID(); ?>,
            Categories = <?php echo json_encode($categories); ?>,
            PrimaryCurrency = <?php echo json_encode($PrimaryCurrency); ?>,
            SecondCurrency = <?php echo json_encode($SecondCurrency ? $SecondCurrency : $PrimaryCurrency); ?>,
            CurrencyRate = <?php echo json_encode($Extable); ?>,
            Note = <?php echo json_encode(CommonLanguage::getMessage('note')); ?>;




    $(function () {





        $('#refresh').on('click', function () {
            location.reload();
        })
    })
















</script>