<?php /* Smarty version Smarty-3.1.11, created on 2023-10-18 04:52:01
         compiled from "../views/default/buyreportview/show.html" */ ?>
<?php /*%%SmartyHeaderCode:1555812606652f3a411ab997-84271170%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '108908dc1be1525a453601be7300f911f117f270' => 
    array (
      0 => '../views/default/buyreportview/show.html',
      1 => 1695642328,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1555812606652f3a411ab997-84271170',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'youtubes' => 0,
    'suppliers' => 0,
    'data' => 0,
    'supplierid' => 0,
    'debt' => 0,
    'clients' => 0,
    'clientid' => 0,
    'message' => 0,
    'allDataArr' => 0,
    'totalOfTotals' => 0,
    'currency' => 0,
    'loadUserGroupData' => 0,
    'dataArr' => 0,
    'noOfBills' => 0,
    'sell_quantity' => 0,
    'total' => 0,
    'allCatArr' => 0,
    'price' => 0,
    'amount' => 0,
    'price_ret' => 0,
    'amount_ret' => 0,
    'total_net_quantity' => 0,
    'total_net_price' => 0,
    'total_real_cost' => 0,
    'i' => 0,
    'productTotalArr' => 0,
    'totalStoreQuantity' => 0,
    'totalStoreQuantityPrice' => 0,
    'payed' => 0,
    'buyBillNo' => 0,
    'unitTotal' => 0,
    'key' => 0,
    'value' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_652f3a4141ab68_55772223',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_652f3a4141ab68_55772223')) {function content_652f3a4141ab68_55772223($_smarty_tpl) {?><style>
    .myresult {
        -webkit-print-color-adjust: exact;
    }

    .nodata {
        background-color: #72B4EC;
        color: white;
        border-radius: 13px;
        margin: 14px;
        font-size: 24px;
        text-align: center;
        padding: 5px;
    }

    .productborder {
        border-top: 4px solid #ddd !important;
    }

    .solidgraytop {
        border-top-style: solid;
        border-top-color: #ddd;
    }

    .solidgrayleft {
        border-left: solid;
        border-left-width: 3px;
        border-color: #ddd;
    }

    .solidgrayright {
        border-right-style: solid;
        border-right-color: #ddd;
    }

    .solidgraybottom {
        border-top-style: solid;
        border-top-color: #ddd;
    }

    .hidetop {
        border-top: hidden !important;
    }

    .mytotal {
        background-color: #ddd;
        font-weight: bold;
    }

    .product-image-overlay {
        /*        position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.9);
                z-index: 9999;
                display: none;*/

        position: fixed;
        top: 15%;
        left: 40%;
        /* text-align: center; */
        width: 30%;
        height: 50%;
        background: rgba(4, 0, 0, 0.38);
        z-index: 9999;
        border-radius: 45px;
        display: none;
    }

    .product-image-overlay .product-image-overlay-close {
        display: block;
        position: absolute;
        top: 20px;
        left: 20px;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 1px solid #eee;
        line-height: 35px;
        font-size: 20px;
        color: #eee;
        text-align: center;
        cursor: pointer;
    }

    .product-image-overlay img {
        width: auto;
        max-width: 80%;
        position: absolute;
        top: 50%;
        left: 50%;
        -webkit-transform: translate(-50%, -50%);
        -moz-transform: translate(-50%, -50%);
        -o-transform: translate(-50%, -50%);
        transform: translate(-50%, -50%);
    }
</style>

<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">التقارير</a></li>
            <li class="active">تقرير مشتريات مورد</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">تقرير مشتريات مورد
                <a href="<?php echo $_smarty_tpl->tpl_vars['youtubes']->value[143]->url;?>
" target="_blank" class="hidden-print"><img
                        src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube"
                        style="width: 2%;"></a>
            </div>
            <div class="panel-body">
                <form class="form-inline hidden-print" action="buyreport.php" method="post">

                    <div class="form-group">
                        <label class="sr-only">المورد</label>
                        <select class="select2" name="supplierid" id="supplierid">
                            <option value="-1">اختر مورد</option>
                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['suppliers']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->supplierid;?>
" <?php if ($_smarty_tpl->tpl_vars['data']->value->supplierid==$_smarty_tpl->tpl_vars['supplierid']->value){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->suppliername;?>
</option>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="form-group" <?php if (empty($_smarty_tpl->tpl_vars['debt']->value)){?>style="display: none" <?php }?> id="supDebt">
                        <label class="sr-only">الدين</label>
                        <input type="text" class="form-control" style="width: 83%" disabled id="suppliercurrentDebt"
                            value="<?php echo $_smarty_tpl->tpl_vars['debt']->value;?>
">
                    </div>
                    <div style="clear: both"></div>

                    <div class="form-group">
                        <label class="sr-only">العميل</label>
                        <select class="select2" name="clientid" id="clientid">
                            <option value="-1">اختر عميل</option>
                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['clients']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->clientid;?>
" <?php if ($_smarty_tpl->tpl_vars['data']->value->clientid==$_smarty_tpl->tpl_vars['clientid']->value){?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->clientname;?>
</option>
                            <?php } ?>
                        </select>
                    </div>
                    <div style="clear: both"></div>

                    <div class="form-group">
                        <label class="sr-only">من التاريخ</label>
                        <input type="text" class="form-control awdatepicker" autocomplete="off"
                            data-date-format="yyyy-mm-dd" name="datefrom">
                    </div>
                    <div class="form-group">
                        <label class="sr-only">إلى التاريخ</label>
                        <input type="text" class="form-control awdatepicker" autocomplete="off"
                            data-date-format="yyyy-mm-dd" name="dateto">
                    </div>
                    <div style="clear: both"></div>
                    <div class="form-group">
                        <label class="sr-only">ترتيب الاجمالى</label>
                        <div>
                            <div class="radio-inline">
                                <label>
                                    <input name="order" type="radio" checked="checked" value="no">بلا ترتيب
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="order" type="radio" value="asc">تصاعدى
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input name="order" type="radio" value="desc">تنازلى
                                </label>
                            </div>
                        </div>
                    </div>
                    <div style="clear: both"></div>
                    <br />
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>

            </div>
            <hr />
            <div class="panel panel-default panel-m">
                <!-- Default panel contents -->
                <div class="panel-heading"><?php echo $_smarty_tpl->tpl_vars['message']->value;?>
</div>
                <div class="panel-body">
                    <?php if (count($_smarty_tpl->tpl_vars['allDataArr']->value)>0){?>
                    <!--                    <div class="col-lg-offset-8 col-lg-4">
                                            <div class="well well-sm">
                                                <h4 class="text-center">اجمالى المشتريات <?php echo $_smarty_tpl->tpl_vars['totalOfTotals']->value;?>
 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4>
                                            </div>
                                        </div>-->
                    <style>
                        @media print {
                            @page {
                                size: landscape;
                                margin: 0;
                            }

                            .willprint,
                            .willprint td,
                            .willprint th {
                                font-family: arial;
                                font-size: 14px;
                                border-collapse: collapse;
                                border: 1px solid #333 !important;
                            }

                            /* .willprint th{
                                background: #aaa !important;
                            } */
                            .willprint tr:even-child td {
                                background: #333 !important;
                                color: #fff !important;
                            }
                        }
                    </style>
                    <table class="table willprint table-black dataTableClass" style="width: 100%">
                        <thead>
                            <tr>
                                <th>اسم المنتج</th>
                                <th>الصورة</th>
                                <th>الوحدة</th>
                                <th>عدد الفواتير</th>
                                <th>عدد المشتربات</th>
                                <th>اجمالى المشتريات</th>
                                <th>اجمالى المشتريات شامل ق.م</th>
                                <th>اجمالى ق.م</th>
                                <th>عدد المردودات</th>
                                <th>اجمالى المردودات</th>
                                <th>اجمالى المردودات شامل ق.م</th>
                                <th>اجمالى ق.م مردودات</th>
                                <th>صافى المشتريات</th>
                                <th>متوسط السعر</th>
                                <th>الكمية فى المخازن</th>
                                <th>سعر المخزن باخر سعر شراء</th>
                                <?php if ($_smarty_tpl->tpl_vars['loadUserGroupData']->value->netprofit!=1){?>
                                <th>عدد صافي المبيعات </th>
                                <th>قيمة صافي المبيعات </th>
                                <th>تكلفة المبيعات </th>
                                <?php }?>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['noOfBills'] = new Smarty_variable(0, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['sell_quantity'] = new Smarty_variable(0, null, 0);?>
                            <?php  $_smarty_tpl->tpl_vars['dataArr'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['dataArr']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allDataArr']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['dataArr']->key => $_smarty_tpl->tpl_vars['dataArr']->value){
$_smarty_tpl->tpl_vars['dataArr']->_loop = true;
?>
                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['dataArr']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                            <tr>

                                <?php $_smarty_tpl->tpl_vars['noOfBills'] = new Smarty_variable($_smarty_tpl->tpl_vars['noOfBills']->value+$_smarty_tpl->tpl_vars['data']->value->noOfBills, null, 0);?>
                                <?php $_smarty_tpl->tpl_vars['sell_quantity'] = new Smarty_variable($_smarty_tpl->tpl_vars['sell_quantity']->value+($_smarty_tpl->tpl_vars['data']->value->amount-$_smarty_tpl->tpl_vars['data']->value->amount_ret)-$_smarty_tpl->tpl_vars['data']->value->productQuantity, null, 0);?>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->productName;?>
</td>
                                <td><img src="../views/default/images/product_image/<?php echo $_smarty_tpl->tpl_vars['data']->value->logo;?>
" class="moImg" alt=""
                                        width="50" height="30" /></td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->unitName;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->noOfBills;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->amount;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->price;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->priceWithTax;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->priceWithTax-$_smarty_tpl->tpl_vars['data']->value->price;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->amount_ret;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->price_ret;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->priceWithTax_ret;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->priceWithTax_ret-$_smarty_tpl->tpl_vars['data']->value->price_ret;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->amount-$_smarty_tpl->tpl_vars['data']->value->amount_ret;?>
</td>
                                <td>
                                    <?php ob_start();?><?php echo ($_smarty_tpl->tpl_vars['data']->value->price-$_smarty_tpl->tpl_vars['data']->value->price_ret)/($_smarty_tpl->tpl_vars['data']->value->amount-$_smarty_tpl->tpl_vars['data']->value->amount_ret);?>
<?php $_tmp1=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['total'] = new Smarty_variable($_tmp1, null, 0);?>
                                    <?php echo sprintf("%.2f",$_smarty_tpl->tpl_vars['total']->value);?>

                                </td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->productQuantity;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->storeQuantityPrice;?>
</td>
                                <!-- <td><?php echo ($_smarty_tpl->tpl_vars['data']->value->amount-$_smarty_tpl->tpl_vars['data']->value->amount_ret)-$_smarty_tpl->tpl_vars['data']->value->productQuantity;?>
</td> -->
                                <?php if ($_smarty_tpl->tpl_vars['loadUserGroupData']->value->netprofit!=1){?>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->netQuantity;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->netPrice;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->realCost;?>
</td>
                                <?php }?>
                            </tr>
                            <?php } ?>
                            <?php } ?>

                        </tbody>

                    </table>
                    <div class="row"></div>
                    <hr />
                    <div class="row"></div>
                    <h3> اجمالى التصنيفات</h3>
                    <table class="table willprint table-black dataTableClass" style="width: 100%">
                        <thead>
                            <tr>
                                <th>اسم التصنيف</th>
                                <th>الوحدة</th>
                                <th>عدد المشتربات</th>
                                <th>اجمالى المشتريات</th>
                                <th>اجمالى المشتريات شامل ق.م</th>
                                <th>عدد المردودات</th>
                                <th>اجمالى المردودات</th>
                                <th>اجمالى المردودات شامل ق.م</th>
                                <th>صافى المشتريات</th>
                                <th>متوسط السعر</th>
                                <th>الكمية فى المخازن</th>
                                <th>سعر المخزن باخر سعر شراء</th>
                                <?php if ($_smarty_tpl->tpl_vars['loadUserGroupData']->value->netprofit!=1){?>
                                <th>عدد صافي المبيعات </th>
                                <th>قيمة صافي المبيعات </th>
                                <th>تكلفة المبيعات </th>
                                <?php }?>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['price'] = new Smarty_variable(0, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['amount'] = new Smarty_variable(0, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['price_ret'] = new Smarty_variable(0, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['amount_ret'] = new Smarty_variable(0, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['total_net_quantity'] = new Smarty_variable(0, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['total_net_price'] = new Smarty_variable(0, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['total_real_cost'] = new Smarty_variable(0, null, 0);?>
                            <?php  $_smarty_tpl->tpl_vars['dataArr'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['dataArr']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allCatArr']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['dataArr']->key => $_smarty_tpl->tpl_vars['dataArr']->value){
$_smarty_tpl->tpl_vars['dataArr']->_loop = true;
?>
                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['dataArr']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                            <tr>
                                <?php $_smarty_tpl->tpl_vars['price'] = new Smarty_variable($_smarty_tpl->tpl_vars['price']->value+$_smarty_tpl->tpl_vars['data']->value->price, null, 0);?>
                                <?php $_smarty_tpl->tpl_vars['amount'] = new Smarty_variable($_smarty_tpl->tpl_vars['amount']->value+$_smarty_tpl->tpl_vars['data']->value->amount, null, 0);?>
                                <?php $_smarty_tpl->tpl_vars['price_ret'] = new Smarty_variable($_smarty_tpl->tpl_vars['price_ret']->value+$_smarty_tpl->tpl_vars['data']->value->price_ret, null, 0);?>
                                <?php $_smarty_tpl->tpl_vars['amount_ret'] = new Smarty_variable($_smarty_tpl->tpl_vars['amount_ret']->value+$_smarty_tpl->tpl_vars['data']->value->amount_ret, null, 0);?>
                                <?php $_smarty_tpl->tpl_vars['total_net_quantity'] = new Smarty_variable($_smarty_tpl->tpl_vars['total_net_quantity']->value+$_smarty_tpl->tpl_vars['data']->value->netQuantity, null, 0);?>
                                <?php $_smarty_tpl->tpl_vars['total_net_price'] = new Smarty_variable($_smarty_tpl->tpl_vars['total_net_price']->value+$_smarty_tpl->tpl_vars['data']->value->netPrice, null, 0);?>
                                <?php $_smarty_tpl->tpl_vars['total_real_cost'] = new Smarty_variable($_smarty_tpl->tpl_vars['total_real_cost']->value+$_smarty_tpl->tpl_vars['data']->value->realCost, null, 0);?>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->catName;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->unitName;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->amount;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->price;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->priceWithTax;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->amount_ret;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->price_ret;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->priceWithTax_ret;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->amount-$_smarty_tpl->tpl_vars['data']->value->amount_ret;?>
</td>
                                <td>
                                    <?php ob_start();?><?php echo ($_smarty_tpl->tpl_vars['data']->value->price-$_smarty_tpl->tpl_vars['data']->value->price_ret)/($_smarty_tpl->tpl_vars['data']->value->amount-$_smarty_tpl->tpl_vars['data']->value->amount_ret);?>
<?php $_tmp2=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['total'] = new Smarty_variable($_tmp2, null, 0);?>
                                    <?php echo sprintf("%.2f",$_smarty_tpl->tpl_vars['total']->value);?>

                                </td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->storeQuantity;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->storeQuantityPrice;?>
</td>
                                <!-- <td><?php echo ($_smarty_tpl->tpl_vars['data']->value->amount-$_smarty_tpl->tpl_vars['data']->value->amount_ret)-$_smarty_tpl->tpl_vars['data']->value->storeQuantity;?>
</td> -->
                                <?php if ($_smarty_tpl->tpl_vars['loadUserGroupData']->value->netprofit!=1){?>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->netQuantity;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->netPrice;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->realCost;?>
</td>
                                <?php }?>
                            </tr>
                            <?php } ?>
                            <?php } ?>

                        </tbody>

                    </table>

                    <!--                    <table class="table willprint table-black" style="width: 100%">
                                            <thead>
                                                <tr class="solidgraytop solidgrayleft solidgrayright mytotal">
                                                    <th>#</th>
                                                    <th class="solidgrayright">اسم المنتج</th>
                                                    <th class="solidgrayright">العدد</th>
                                                    <th>الوحدة</th>
                                                    <th>السعر من الفاتورة</th>
                                                    <th class="solidgrayright">الاجمالى</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                                                <?php  $_smarty_tpl->tpl_vars['dataArr'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['dataArr']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allDataArr']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['dataArr']->key => $_smarty_tpl->tpl_vars['dataArr']->value){
$_smarty_tpl->tpl_vars['dataArr']->_loop = true;
?>
                                                <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['dataArr']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                                <tr <?php if ($_smarty_tpl->tpl_vars['data']->value->productName!=''){?> class="productborder" <?php }?>>
                                                    <td class="solidgrayright <?php if ($_smarty_tpl->tpl_vars['data']->value->productName==''){?> hidetop <?php }?>">
                                                        <?php if ($_smarty_tpl->tpl_vars['data']->value->productName!=''){?><?php echo $_smarty_tpl->tpl_vars['i']->value;?>
 <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable($_smarty_tpl->tpl_vars['i']->value+1, null, 0);?> <?php }?>
                                                    </td>
                                                    <td  class="solidgrayright <?php if ($_smarty_tpl->tpl_vars['data']->value->productName==''){?> hidetop <?php }?>"><?php echo $_smarty_tpl->tpl_vars['data']->value->productName;?>
</td>
                                                    <td class="solidgrayright"><?php echo $_smarty_tpl->tpl_vars['data']->value->amount;?>
</td>
                                                    <td><?php echo $_smarty_tpl->tpl_vars['data']->value->unitName;?>
</td>
                                                    <td class="solidgrayleft"><?php echo $_smarty_tpl->tpl_vars['data']->value->price;?>
</td>
                                                    <td class="solidgrayleft <?php if ($_smarty_tpl->tpl_vars['data']->value->productName==''){?>hidetop<?php }?>">
                                                        <?php if ($_smarty_tpl->tpl_vars['data']->value->productId!=''){?>
                                                        <?php echo $_smarty_tpl->tpl_vars['productTotalArr']->value[$_smarty_tpl->tpl_vars['data']->value->productId];?>

                                                        <?php }?>
                                                    </td>
                                                </tr>
                                                <?php } ?>
                                                <?php } ?>
                                                <tr class="mytotal">
                                                    <td class="solidgrayright"></td>
                                                    <td class="solidgrayright"></td>
                                                    <td></td>
                                                    <td></td>
                                                    <td></td>
                                                    <td class="solidgrayleft" style="text-align:center;"></td>

                                                </tr>
                                            </tbody>

                                        </table>-->

                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">عدد المشتريات <?php echo $_smarty_tpl->tpl_vars['amount']->value;?>
</h4>
                        </div>
                    </div>
                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">اجمالى المشتريات <?php echo $_smarty_tpl->tpl_vars['price']->value;?>
 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4>
                        </div>
                    </div>
                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">عدد المردودات <?php echo $_smarty_tpl->tpl_vars['amount_ret']->value;?>
</h4>
                        </div>
                    </div>
                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">اجمالى المردودات <?php echo $_smarty_tpl->tpl_vars['price_ret']->value;?>
 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4>
                        </div>
                    </div>
                    <!-- <div class="clearfix"></div>
                    <br/> -->
                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">اجمالى الكمية <?php echo $_smarty_tpl->tpl_vars['totalStoreQuantity']->value;?>
</h4>
                        </div>
                    </div>
                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">اجمالى السعر <?php echo $_smarty_tpl->tpl_vars['totalStoreQuantityPrice']->value;?>
 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4>
                        </div>
                    </div>

                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">دين المورد <?php echo $_smarty_tpl->tpl_vars['debt']->value;?>
 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4>
                        </div>
                    </div>
                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">اجمالى الدفعات <?php echo $_smarty_tpl->tpl_vars['payed']->value;?>
 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4>
                        </div>
                    </div>
                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <!-- <h4 class="text-center">اجمالى عدد الفواتير <?php echo $_smarty_tpl->tpl_vars['noOfBills']->value;?>
</h4> -->
                            <h4 class="text-center">اجمالى عدد الفواتير <?php echo $_smarty_tpl->tpl_vars['buyBillNo']->value;?>
</h4>
                        </div>
                    </div>
                    <?php if ($_smarty_tpl->tpl_vars['loadUserGroupData']->value->netprofit!=1){?>
                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">اجمالى عدد صافي المبيعات <?php echo $_smarty_tpl->tpl_vars['total_net_quantity']->value;?>
</h4>
                        </div>
                    </div>
                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">اجمالى قيمة صافي المبيعات <?php echo $_smarty_tpl->tpl_vars['total_net_price']->value;?>
</h4>
                        </div>
                    </div>
                    <div class="col-lg-3">
                        <div class="well well-sm well-2sm">
                            <h4 class="text-center">اجمالى تكلفة المبيعات <?php echo $_smarty_tpl->tpl_vars['total_real_cost']->value;?>
</h4>
                        </div>
                    </div>
                    <?php }?>
                    <!--                    <table class="table table-black" style="width: 50%;margin-left:25%;margin-right:25%;;text-align: center;">
                                            <thead style="font-weight: bold">
                                                <tr>
                                                    <th colspan="2">اجمالى الوحدات</th>
                                                </tr>
                                                <tr>
                                                    <th>الوحدة </th>
                                                    <th> العدد</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php  $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['value']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['unitTotal']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value){
$_smarty_tpl->tpl_vars['value']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['value']->key;
?>
                                                <tr>
                                                    <td><?php echo $_smarty_tpl->tpl_vars['key']->value;?>
 </td>
                                                    <td> <?php echo $_smarty_tpl->tpl_vars['value']->value;?>
</td>
                                                </tr>
                                                <?php } ?>
                                            </tbody>
                                        </table>-->

                    <div class="clearfix"></div>
                    <div class="noprint">
                        <div class="col-lg-12">
                            <div class="form-group">
                                <div class="col-lg-4">
                                    <button type="button" onclick="print_Custom('mycustomheader');"
                                        class="btn btn-success pull-right hidden-print">طباعة</button>
                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <?php }else{ ?>
                    <div class="nodata">عفوا لا توجد نتائج</div>
                    <?php }?>

                    <div class="clearfix"></div>
                </div>
            </div>
        </div>

        
        <script>
            $('#supplierid').live('change', function () {
                var supplierid = $(this).val();
                $.ajax({
                    type: 'GET',
                    url: 'getSupplierDept.php?do=getsuppliercurrentDebt&supplierid=' + supplierid,
                    success: function (data) {
                        $('#supDebt').show();
                        $("#suppliercurrentDebt").val(data);
                    }
                });
            })
            $('body').on('click', '.moImg', function () {

                $('body').append('<div class="product-image-overlay"><span class="product-image-overlay-close">x</span><img src="" /></div>');
                var productImage = $('img');
                var productOverlay = $('.product-image-overlay');
                var productOverlayImage = $('.product-image-overlay img');
                productImage.click(function () {
                    var productImageSource = $(this).attr('src');
                    productOverlayImage.attr('src', productImageSource);
                    productOverlay.fadeIn(100);
                    $('body').css('overflow', 'hidden');
                    $('.product-image-overlay-close').click(function () {
                        productOverlay.fadeOut(100);
                        $('body').css('overflow', 'auto');
                    });
                });
            });

        </script>
        <?php }} ?>