<?php /* Smarty version Smarty-3.1.11, created on 2025-01-28 21:00:18
         compiled from "../views/default/salesreportview/show.html" */ ?>
<?php /*%%SmartyHeaderCode:159018599267992942126244-28289885%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '3ae21498da9600b8f234f132c357231136adf725' => 
    array (
      0 => '../views/default/salesreportview/show.html',
      1 => 1697931846,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '159018599267992942126244-28289885',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'youtubes' => 0,
    'Programsetting' => 0,
    'types' => 0,
    'data' => 0,
    'allGovernment' => 0,
    'government' => 0,
    'searchinonestore' => 0,
    'storeid' => 0,
    'storedef' => 0,
    'storeData' => 0,
    'store' => 0,
    'user' => 0,
    'branchData' => 0,
    'branch' => 0,
    'Programsettingdata' => 0,
    'sellerData' => 0,
    'userData' => 0,
    'catDataReport' => 0,
    'programsettingsdata' => 0,
    'message' => 0,
    'resultsCount' => 0,
    'loadData' => 0,
    'totalsObj' => 0,
    'currency' => 0,
    'total_sell_without_discount' => 0,
    'allDataArr' => 0,
    'i' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_679929422d96f5_73771889',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_679929422d96f5_73771889')) {function content_679929422d96f5_73771889($_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;
    }
    table.dataTable tfoot th, table.dataTable tfoot td {
        padding: 10px 18px 6px 18px;
        border-top: 1px solid #111;
        text-align: center;
    }
</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[132]->url;?>
" target="_blank" class="hidden-print"><img src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube" style="width: 2%;"></a>
            </div>
            <?php if ($_smarty_tpl->tpl_vars['Programsetting']->value->valueadded==0){?>
            <div class="panel-heading">تقرير مبيعات </div>
            <?php }else{ ?>
            <div class="panel-heading">تقرير مبيعات    غير شاملة القيمة المضافه</div>
            <?php }?>
            <div class="panel-body">
                <input type="hidden" id="searchvalue" value="<?php echo $_smarty_tpl->tpl_vars['Programsetting']->value->searchvalue;?>
">
                <form class="form-inline hidden-print" action="salesreport.php" method="post">
                    <div class="form-group">
                        <label class="sr-only">بحث بـ</label>
                        <div  class="input-group">
                            <label>  <input value="dateOnly" name="search" id="searchdateOnly" type="radio" checked onclick='localStorage.setItem("search", "dateOnly");
                                    window.location.reload();'>
                                تاريخ</label>
                            <label>
                                <input value="dateTime" name="search" id="searchdateTime" type="radio" onclick='localStorage.setItem("search", "dateTime");
                                        window.location.reload();'>
                                تاريخ ووقت</label>
                        </div>
                    </div>
                    <div id="dateTimeDiv">
                        <div class="form-group">
                            <label class="sr-only">من التاريخ</label>
                            <div  class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                <input class="form-control" size="16" type="text" value="" name="datefrom" id="datefrom" readonly="" >
                                <span class="input-group-addon " style="width: 0%;"><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                <span class="input-group-addon"  style="width: 0%;"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="sr-only">إلى التاريخ</label>
                            <div  class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                <input class="form-control" size="16" type="text" value="" name="dateto" id="dateto" readonly="" >
                                <span class="input-group-addon " style="width: 0%;"><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                <span class="input-group-addon" style="width: 0%;"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                            </div>
                        </div>
                    </div>

                    <div id="dateOnlyDiv">
                        <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>

                    <div class="clearfix"></div>
                    <div class="form-group col-lg-5">
                        <div class="col-md-2">
                            <label class="sr-only">العميل</label>
                        </div>
                        <input type="hidden" name="clientId" id="clientId" class="select2Supp"/>
                    </div>
                    <div class="form-group col-lg-2">
                        <label class="sr-only">نوع الفاتورة</label>
                        <div class="input-group">
                            <label>  <input value="1" name="obgyBillType" id="obgyBillType" type="radio">
                                مباشر</label>
                            <label>
                                <input value="2" name="obgyBillType" id="obgyBillType" type="radio">
                                مستهلك</label>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only"> شامل الخدمات</label>
                        </div>
                        <div class="radio-inline">
                            <input value="1" name="servicesAreIncluded"  type="checkbox" checked="checked"  />
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">نوع العميل</label>
                        </div>
                        <select class="select2 wdt300"  name="typeId" id="typeId" >
                            <option value="-1">اختر نوع العميل</option>
                            <option value="0">كل انواع العملاء</option>
                            <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['types']->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->typeId;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->typeName;?>
</option>
                            <?php } ?>
                        </select>
                    </div>


                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">المحافظه</label>
                        </div>
                        <select class="select2 wdt300"  name="governmentid" id="governmentid" >
                            <option value="-1">اختر </option>
                            <?php  $_smarty_tpl->tpl_vars['government'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['government']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allGovernment']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['government']->key => $_smarty_tpl->tpl_vars['government']->value){
$_smarty_tpl->tpl_vars['government']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['government']->value->governmetid;?>
"><?php echo $_smarty_tpl->tpl_vars['government']->value->governmentname;?>
</option>
                            <?php } ?>
                        </select>
                    </div>

                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">المناطق</label>
                        </div>
                        <input type="hidden" name="clientareaid" id="getclientareaonly" class="getclientareaonly"/>
                    </div>

                    <!--    <div class="form-group">
                          <div class="col-md-4">
                              <label class="sr-only">التعليق</label>
                          </div>
                          <input type="text" name="comment" id="comment" class="form-control"/>
                      </div> -->

                    <?php if ($_smarty_tpl->tpl_vars['searchinonestore']->value!=0){?>
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">المخزن</label>
                        </div>
                        <input type="hidden" name="storeId" id="storeId"  value="<?php echo $_smarty_tpl->tpl_vars['storeid']->value;?>
"  >
                        <?php echo $_smarty_tpl->tpl_vars['storedef']->value->storeName;?>

                    </div>
                    <?php }else{ ?>
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">المخزن</label>
                        </div>
                        <select class="select2 wdt300"  name="storeId" id="storeId" >
                            <option value="-1">اختر مخزن</option>
                            <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['store']->key => $_smarty_tpl->tpl_vars['store']->value){
$_smarty_tpl->tpl_vars['store']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
"><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</option>
                            <?php } ?>
                        </select>
                    </div>
                    <?php }?>





                   <!--  <?php if ($_smarty_tpl->tpl_vars['user']->value->userstoreid==0){?>
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">المخزن</label>
                        </div>
                        <select class="select2 wdt300"  name="storeId" id="storeId" >
                            <option value="-1">اختر مخزن</option>
                            <option value="0">كل المخازن</option>
                            <?php  $_smarty_tpl->tpl_vars['store'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['store']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['storeData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['store']->key => $_smarty_tpl->tpl_vars['store']->value){
$_smarty_tpl->tpl_vars['store']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['store']->value->storeId;?>
"><?php echo $_smarty_tpl->tpl_vars['store']->value->storeName;?>
</option>
                            <?php } ?>
                        </select>
                    </div>
                    <?php }?> -->
                    <?php if ($_smarty_tpl->tpl_vars['user']->value->branchId==0){?>
                    <div class="form-group">
                        <div class="col-md-2">

                            <label class="sr-only">الفرع</label>
                        </div>
                        <select class="select2 wdt300"  name="branchId" id="branchId" >
                            <option value="-1">اختر الفرع</option>
                            <option value="0">كل الفروع</option>
                            <?php  $_smarty_tpl->tpl_vars['branch'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['branch']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['branchData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['branch']->key => $_smarty_tpl->tpl_vars['branch']->value){
$_smarty_tpl->tpl_vars['branch']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['branch']->value->branchId;?>
"><?php echo $_smarty_tpl->tpl_vars['branch']->value->branchName;?>
</option>
                            <?php } ?>
                        </select>
                    </div>
                    <?php }?>
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">نوع السعر</label>
                        </div>
                        <select class="select2 wdt300" name="pricetype" id="pricetype">
                            <option value="-1">اختر نوع السعر</option>
                            <option value="0">جملة</option>
                            <option value="1">تجزئة</option>
                            <option value="2">نصف جملة</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <div class="col-md-2">

                            <label class="sr-only"><?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==0){?> بائع <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==1){?>مندوب <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==2){?>طبيب <?php }?></label>
                        </div>
                        <select class="select2 wdt300"  name="sellerid" id="sellerid" >
                            <option value="-1">اختر <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==0){?> بائع <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==1){?>مندوب <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==2){?>طبيب <?php }?></option>
                            <option value="0">كل <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==0){?> البائعين <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==1){?>المندوبين <?php }elseif($_smarty_tpl->tpl_vars['Programsettingdata']->value->delegate_seller==2){?>الاطباء <?php }?></option>
                            <?php  $_smarty_tpl->tpl_vars['user'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['user']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['sellerData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['user']->key => $_smarty_tpl->tpl_vars['user']->value){
$_smarty_tpl->tpl_vars['user']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['user']->value->userid;?>
"><?php echo $_smarty_tpl->tpl_vars['user']->value->employeename;?>
</option>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="form-group">
                        <div class="col-md-2">

                            <label class="sr-only">المستخدم</label>
                        </div>
                        <select class="select2 wdt300"  name="userid" id="userid" >
                            <option value="-1">اختر المستخدم</option>
                            <option value="0">كل المستخدمين</option>
                            <?php  $_smarty_tpl->tpl_vars['user'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['user']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['userData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['user']->key => $_smarty_tpl->tpl_vars['user']->value){
$_smarty_tpl->tpl_vars['user']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['user']->value->userid;?>
"><?php echo $_smarty_tpl->tpl_vars['user']->value->employeename;?>
</option>
                            <?php } ?>
                        </select>
                    </div>

                    <div class="form-group">
                        <div class="col-md-2">

                            <label class="sr-only">تصنيف المنتج</label>
                        </div>
                        <select class="select2 wdt300 productCat" data-level="0"  name="productCatId0" id="productCatId0" >
                            <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['catDataReport']->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->productCatId;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->productCatName;?>
</option>
                            <?php } ?>
                        </select>
                        <input type="hidden" id="level" name="level" value="0">
                    </div>

                    <div class="form-group">
                        <div id="manyParents">

                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">نوع السعر</label>
                        </div>
                        <select class="select2 wdt300" name="chosenProductPrice" id="chosenProductPrice">
                            <option value="-1">اختر الربح ب</option>
                            <option value="0" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsetting']->value->Profitevaluation;?>
<?php $_tmp1=ob_get_clean();?><?php if ($_tmp1=="first"){?>  selected <?php }?>>سعر الشراء</option>
                            <option value="1" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsetting']->value->Profitevaluation;?>
<?php $_tmp2=ob_get_clean();?><?php if ($_tmp2=="mean"){?>  selected <?php }?>>متوسط سعر الشراء</option>
                            <option value="2" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsetting']->value->Profitevaluation;?>
<?php $_tmp3=ob_get_clean();?><?php if ($_tmp3=="last"){?>  selected <?php }?>>اخر سعر شراء</option>
                            <option value="3" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsetting']->value->Profitevaluation;?>
<?php $_tmp4=ob_get_clean();?><?php if ($_tmp4=="last_discount"){?>  selected <?php }?>>اخر سعر شراء بعد الخصم</option>
                            <option value="4" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsetting']->value->Profitevaluation;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp5=="mean_discount"){?>  selected <?php }?>>متوسط سعر الشراء بعد الخصم</option>
                            <option value="5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsetting']->value->Profitevaluation;?>
<?php $_tmp6=ob_get_clean();?><?php if ($_tmp6=="generalPrice"){?>  selected <?php }?>>المتوسط العام</option>
                            <option value="6" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsetting']->value->Profitevaluation;?>
<?php $_tmp7=ob_get_clean();?><?php if ($_tmp7=="tax"){?>  selected <?php }?>>اخر سعر شراء شامل القيمة المضافة</option>
                            <option value="7" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsetting']->value->Profitevaluation;?>
<?php $_tmp8=ob_get_clean();?><?php if ($_tmp8=="mean_tax"){?>  selected <?php }?>>متوسط سعر الشراء شامل القيمة المضافة</option>
                        </select>
                    </div>

                    <!--<div class="form-group" style="padding-top:10px">-->
                    <!--<div class="col-md-2">-->
                    <!--<label class="sr-only">الربح ب</label>-->
                    <!--</div>-->
                    <!--<div class="radio-inline">-->
                    <!--<label>-->
                    <!--<input value="0" name="chosenProductPrice"  type="radio" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['programsettingsdata']->value->Profitevaluation;?>
<?php $_tmp9=ob_get_clean();?><?php if ($_tmp9=="first"){?>  checked <?php }?>  />-->
                    <!--سعر الشراء   </label>-->
                    <!--</div>-->
                    <!--<div class="radio-inline">-->
                    <!--<label>-->
                    <!--<input value="1" name="chosenProductPrice"   type="radio"   <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['programsettingsdata']->value->Profitevaluation;?>
<?php $_tmp10=ob_get_clean();?><?php if ($_tmp10=="mean"){?>  checked <?php }?> />-->
                    <!--متوسط سعر الشراء  </label>-->
                    <!--</div>-->
                    <!--<div class="radio-inline">-->
                    <!--<label>-->
                    <!--<input value="2" name="chosenProductPrice"   type="radio" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['programsettingsdata']->value->Profitevaluation;?>
<?php $_tmp11=ob_get_clean();?><?php if ($_tmp11=="last"){?>  checked <?php }?>   />-->
                    <!--اخر سعر شراء   </label>-->
                    <!--</div>-->
                    <!--<div class="radio-inline">-->
                    <!--<label>-->
                    <!--<input type="radio" name="chosenProductPrice"  value="3" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['programsettingsdata']->value->Profitevaluation;?>
<?php $_tmp12=ob_get_clean();?><?php if ($_tmp12=="last_discount"){?>  checked <?php }?>>-->
                    <!--اخر سعر شراء بعد الخصم </label>-->
                    <!--</div>-->
                    <!--<div class="radio-inline">-->
                    <!--<label>-->
                    <!--<input type="radio" name="buyPriceType"  value="4" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['programsettingsdata']->value->Profitevaluation;?>
<?php $_tmp13=ob_get_clean();?><?php if ($_tmp13=="mean_discount"){?>  checked <?php }?>>-->
                    <!--متوسط سعر الشراء بعد الخصم</label>-->
                    <!--</div>-->
                    <!--<div class="radio-inline">-->
                    <!--<label>-->
                    <!--<input type="radio" name="buyPriceType"  value="5" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['programsettingsdata']->value->Profitevaluation;?>
<?php $_tmp14=ob_get_clean();?><?php if ($_tmp14=="generalPrice"){?>  checked <?php }?>>-->
                    <!--المتوسط العام</label>-->
                    <!--</div>-->

                    <!--</div>-->
                    <div class="form-group" style="padding-top:10px;padding-right:30px;">
                        <div class="col-md-2">
                            <label class="sr-only">نوع البحث</label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input value="0" name="searchtype"  type="radio" checked="checked"  />
                                منتج نهائى   </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input value="1" name="searchtype"   type="radio"    />
                                اخر تصنيف   </label>
                        </div>

                    </div>




                    <div style="clear: both"></div>
                    <br />
                    <button type="submit" class="btn btn-primary">بحث</button>
                    <input type="hidden" name="getTodayBills" id="getTodayBills" value="0">
                    <button type="submit" class="btn btn-primary" onclick="$('#getTodayBills').val(1);">نتائج اليوم</button>
                </form>

            </div>
            <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 ($_smarty_tpl->tpl_vars['resultsCount']->value>0){?>
                    <hr/>
                    <?php if ($_smarty_tpl->tpl_vars['loadData']->value->netprofit!=1){?>
                    <div class="col-lg-offset-8 col-lg-4">
                        <div class="well well-sm hidden-print" >
                            <h4 class="text-center">صافى الربح <?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->netProfit;?>
 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4>
                        </div>
                    </div>
                    <?php }?>
                    <!--<div class=" col-lg-offset-8 col-lg-4 ">-->
                    <!--<div class="well well-sm">-->
                    <!--<h4 class="text-center">اجمالى المبيعات بدون خصومات  <?php echo $_smarty_tpl->tpl_vars['total_sell_without_discount']->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="dataTableClass willprint table-black" style="width: 100%">
                    <thead>
                        <tr>
                            <th rowspan="2">#</th>
                            <th rowspan="2">اسم المنتج</th>
                            <th colspan="2">المبيعات </th>
                            <th colspan="2">المرتجعات</th>
                            <th colspan="2">صافى المبيعات</th>
                            <?php if ($_smarty_tpl->tpl_vars['loadData']->value->netprofit!=1){?>
                            <th rowspan="2">تكلفة المبيعات</th>
                            <th rowspan="2">صافى الربح</th>
                            <?php }?>
                            <th rowspan="2">الكمية الحالية</th>
                            <th rowspan="2">الخصومات</th>
                            <th rowspan="2">المبيعات بدون خصومات</th>

                        </tr>
                        <tr>
                            <th>عدد </th>
                            <th>قيمة </th>
                            <th>عدد </th>
                            <th>قيمة </th>
                            <th>عدد </th>
                            <th>قيمة </th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);?>
                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_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['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                        <tr>
                            <td><?php echo $_smarty_tpl->tpl_vars['i']->value;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->productName;?>
/ <?php echo $_smarty_tpl->tpl_vars['data']->value->productCatName;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->soldNo;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->soldVal;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->returnNo;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->returnVal;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->netNo;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->netVal;?>
</td>
                            <?php if ($_smarty_tpl->tpl_vars['loadData']->value->netprofit!=1){?>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->realCost;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->netProfit;?>
</td>
                            <?php }?>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->currentQuantity;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->discount;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->sellbilltotalprice;?>
</td>
                        </tr>
                        <?php $_smarty_tpl->tpl_vars['i'] = new Smarty_variable($_smarty_tpl->tpl_vars['i']->value+1, null, 0);?>
                        <?php } ?>
                    </tbody>
                    <tfoot>
                        <tr style="background-color: #ededed !important">
                            <td><span style="display: none">z</span></td>
                            <th style="text-align: center;">الاجمالى</th>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->soldNo;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->soldVal;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->returnNo;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->returnVal;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->netNo;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->netVal;?>
</td>
                            <?php if ($_smarty_tpl->tpl_vars['loadData']->value->netprofit!=1){?>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->realCost;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->netProfit;?>
</td>
                            <?php }?>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->currentQuantity;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->discount;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->sellbilltotalprice;?>
</td>
                        </tr>
                    </tfoot>
                </table>
                <?php if ($_smarty_tpl->tpl_vars['loadData']->value->netprofit!=1){?>
                <div class="col-lg-offset-8 col-lg-4">
                    <div class="well well-sm">
                        <h4 class="text-center">صافى الربح <?php echo $_smarty_tpl->tpl_vars['totalsObj']->value->netProfit;?>
 <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4>
                    </div>
                </div>
                <?php }?>

                <div class="clearfix"></div>
                <hr />
                <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>
        var search = localStorage.getItem("search");
        if (search == "dateTime") {
            $('#searchdateTime').attr('checked', 'checked');
            $('#searchdateOnly').removeAttr('checked');
            //
            $('#dateTimeDiv').show();
            $('#dateOnlyDiv').remove();
        } else {
            $('#searchdateOnly').attr('checked', 'checked');
            $('#searchdateTime').removeAttr('checked');
            //
            $('#dateOnlyDiv').show();
            $('#dateTimeDiv').remove();
        }


        $(function () {
            var formatResult = function (data) {
                return  data.text;
            }

            $('#getclientareaonly').select2({
                placeholder: "اختر الشركة  - المنطقة",
                width: '100%',
                ajax: {
                    url: 'clientControllerAjax.php?do=getclientareaonly',
                    dataType: 'json',
                    type: "POST",
                    data: function (term) {
                        var governmentid = $('#governmentid').val();
                        if (governmentid < 1) {
                            alert('يجب اختيار المحافظه اولا');
                        }
                        return {
                            searchTerms: term,
                            governmentid: $('#governmentid').val()
                        };
                    },
                    results: function (data) {
                        return {
                            results: data,
                        };
                    }
                },
                formatResult: formatResult,
            });

            $(".select2Supp").select2({
                placeholder: "العميل",
                minimumInputLength: document.getElementById("searchvalue").value,
                inimumInputLength: 0,
                multiple: false,
                quietMillis: 100,
                allowClear: true,
                width: '100%',
                ajax: {
                    url: "clientControllerAjax.php?do=select2ClientsAjax",
                    dataType: 'json',
                    data: function (term, page) {
                        return {
                            term: term, //search term
                            page_limit: 7, // page size
                            withAddOption: 0,
                            withNakdi: function () {
                                return (Number($('#withNakdi').val()) == 1) ? 0 : 1;
                            },
                            //jsonRowRet: 1,
                        };
                    },
                    results: function (data) {
                        return {results: data};
                    }
                },
                formatResult: function (data) {
                    if (Number(data.id) == -2) {
                        return  '<span class="newoption">' + data.text + '</span >';
                    } else {
                        return  '<span>' + data.text + '</span >';
                    }
                },
                initSelection: function (element, callback) {
                    var item = element.val().split(':');
                    //  var data = {id: item[0], text: item[1]};
                    var data = {id: item[0], text: item[1], productquantity: item[2], price: item[3]};
                    callback(data);
                },
                //dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
            })
            //this is needed for ajax =>to obtain id from it  and use in ajax
            $('#clientId').select2('data', {id: '', text: ''});
        });
    </script>
    <?php }} ?>