<?php /* Smarty version Smarty-3.1.11, created on 2024-11-07 11:11:54
         compiled from "..\views\default\returnsellbillview\show.html" */ ?>
<?php /*%%SmartyHeaderCode:4965672c764aea5a47-10498821%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '560d2dfe5b991183d2c3c9a48e1dd9a65e6bb91a' => 
    array (
      0 => '..\\views\\default\\returnsellbillview\\show.html',
      1 => 1701074585,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '4965672c764aea5a47-10498821',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'message' => 0,
    'youtubes' => 0,
    'Programsettingdata' => 0,
    'outputString' => 0,
    'clientData' => 0,
    'client' => 0,
    'billsettingsData' => 0,
    'sellerData' => 0,
    'mysellerData' => 0,
    'sellerinsertData' => 0,
    'mysellerinsertData' => 0,
    'returnsellbillSerialData' => 0,
    'returnsellbillSerial' => 0,
    'stores' => 0,
    'data' => 0,
    'saves' => 0,
    'totalBills' => 0,
    'usergroup' => 0,
    'returnsellbillData' => 0,
    'returnsellbill' => 0,
    'piecesCount' => 0,
    'payedTotal' => 0,
    'remainTotal' => 0,
    'i' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_672c764b29b331_48836695',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_672c764b29b331_48836695')) {function content_672c764b29b331_48836695($_smarty_tpl) {?><div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">ادارة الفواتير</a></li>
            <li><a href="returnsellbillController.php?do=show">فواتير مردودات المبيعات</a></li>
            <li class="active">عرض فواتير مردودات المبيعات</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">عرض فواتير مردودات المبيعات <br />
                <?php if ($_smarty_tpl->tpl_vars['message']->value!=''){?>
                <?php echo $_smarty_tpl->tpl_vars['message']->value;?>

                <?php }?>
                <a href="<?php echo $_smarty_tpl->tpl_vars['youtubes']->value[38]->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">
                <input type="hidden" id="searchvalue" value="<?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->searchvalue;?>
">
                <div id="outputString" class="alert alert-block alert-success fade in hidden-print"
                    style="display:none">
                    <button type="button" class="close pull-left" data-dismiss="alert"
                        aria-hidden="true">&times;</button>
                    <p id="outputStringValue"><?php echo $_smarty_tpl->tpl_vars['outputString']->value;?>
</p>
                    <div class="clearfix"></div>
                </div>
                <form class="form-inline hidden-print" action="returnsellbillController.php?do=show" method="post">
                    <div class="form-group">
                        <label class="sr-only">العميل</label>
                        <!--                        <select class="select2 wdt100 search_bill"  name="clientid" id="clientid" >
                                                    <option value="-1">اختر عميل</option>



                                                    <?php  $_smarty_tpl->tpl_vars['client'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['client']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['clientData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['client']->key => $_smarty_tpl->tpl_vars['client']->value){
$_smarty_tpl->tpl_vars['client']->_loop = true;
?>



                                                    <option value="<?php echo $_smarty_tpl->tpl_vars['client']->value->clientid;?>
"><?php echo $_smarty_tpl->tpl_vars['client']->value->clientname;?>
</option>


                                                    <?php } ?>



                                                </select>-->
                        <input type="hidden" name="clientid" id="clientid" class="select2Supp search_bill" />
                        <input type="hidden" name="oldsupplierid" id="oldsupplierid" value="" />
                        <input type="hidden" name="oldsuppliername" id="oldsuppliername" value="" />
                    </div>

                    <div class="form-group <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[3]->billsettingsvalue;?>
<?php $_tmp1=ob_get_clean();?><?php if ($_tmp1==0){?>  <?php }else{ ?> hidden <?php }?>">
                        <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>
                        <select class="select2 wdt100 search_bill" 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>



                            <?php  $_smarty_tpl->tpl_vars['mysellerData'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mysellerData']->_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['mysellerData']->key => $_smarty_tpl->tpl_vars['mysellerData']->value){
$_smarty_tpl->tpl_vars['mysellerData']->_loop = true;
?>



                            <option value="<?php echo $_smarty_tpl->tpl_vars['mysellerData']->value->userid;?>
"><?php echo $_smarty_tpl->tpl_vars['mysellerData']->value->employeename;?>
</option>


                            <?php } ?>



                        </select>
                    </div>


                    <div class="form-group">
                        <label class="sr-only">اسم المستخدم</label>
                        <select class="select2 wdt100 search_bill" name="selleruserid" id="selleruserid">
                            <option value="-1">اختر المستخدم</option>



                            <?php  $_smarty_tpl->tpl_vars['mysellerinsertData'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['mysellerinsertData']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['sellerinsertData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['mysellerinsertData']->key => $_smarty_tpl->tpl_vars['mysellerinsertData']->value){
$_smarty_tpl->tpl_vars['mysellerinsertData']->_loop = true;
?>



                            <option value="<?php echo $_smarty_tpl->tpl_vars['mysellerinsertData']->value->userid;?>
"><?php echo $_smarty_tpl->tpl_vars['mysellerinsertData']->value->employeename;?>
</option>


                            <?php } ?>



                        </select>
                    </div>



                    <div class="form-group">
                        <label class="sr-only">رقم تسلسل الفاتورة</label>
                        <input type="text" class="form-control search_bill" placeholder="رقم المتسلسل"
                            name="returnsellbillid" id="returnsellbillid">
                    </div>

                    <div class="form-group" <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->billid;?>
<?php $_tmp2=ob_get_clean();?><?php if ($_tmp2==1){?> style="display:none" <?php }?>>
                        <label class="sr-only">رقم الفاتورة</label>
                        <select data-placeholder="اختر رقم الفاتورة" class="select2 wdt100 search_bill"
                            name="sellbillserial" id="sellbillserial">
                            <option value="-1">اختر رقم الفاتورة</option>



                            <?php  $_smarty_tpl->tpl_vars['returnsellbillSerial'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['returnsellbillSerial']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['returnsellbillSerialData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['returnsellbillSerial']->key => $_smarty_tpl->tpl_vars['returnsellbillSerial']->value){
$_smarty_tpl->tpl_vars['returnsellbillSerial']->_loop = true;
?>



                            <option value="<?php echo $_smarty_tpl->tpl_vars['returnsellbillSerial']->value->returnsellbillserial;?>
">
                                <?php echo $_smarty_tpl->tpl_vars['returnsellbillSerial']->value->returnsellbillserial;?>
</option>

                            <?php } ?>



                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only">Serial</label>
                        <input type="text" class="form-control" name="proSellTrackingSerial" id="proSellTrackingSerial"
                            value="">
                    </div>

                    <br />
                    <div class="form-group">
                        <label class="sr-only">المخزن</label>
                        <select class="select2 wdt100 search_bill" name="storeid" id="storeid">
                            <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['stores']->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->storeId;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->storeName;?>
</option>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only">الخزنة</label>
                        <select class="select2 wdt100 search_bill" name="saveid" id="saveid">
                            <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['saves']->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->saveid;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
</option>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only">نوع السعر</label>
                        <select class="select2 search_bill wdt100" name="pricetype" id="pricetype">
                            <option value="-1"></option>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceall==1){?>
                            <option value="0">جملة</option>
                            <?php }?>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpriceunit==1){?>
                            <option value="1">تجزئة</option>
                            <?php }?>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showpricehalf==1){?>
                            <option value="2">نصف جملة</option>
                            <?php }?>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice4==1){?>
                            <option value="4">سعر4</option>
                            <?php }?>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice5==1){?>
                            <option value="5">سعر5</option>
                            <?php }?>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice6==1){?>
                            <option value="6">سعر6</option>
                            <?php }?>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice7==1){?>
                            <option value="7">سعر7</option>
                            <?php }?>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->showprice8==1){?>
                            <option value="8">سعر8</option>
                            <?php }?>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only">من التاريخ</label>
                        <input type="text" class="form-control awdatepicker search_bill" autocomplete="off"
                            data-date-format="yyyy-mm-dd" name="from" id="from">
                    </div>
                    <div class="form-group">
                        <label class="sr-only">إلى التاريخ</label>
                        <input type="text" class="form-control awdatepicker search_bill" autocomplete="off"
                            data-date-format="yyyy-mm-dd" name="to" id="to">
                    </div>
                    <div class="form-group">
                        <label class="sr-only">اخفاء المحذوف
                            <input type="checkbox" class="search_bill" name="hideDel" id="hideDel" value="1"></label>
                    </div>
                    <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>
            <hr />
            <div class="col-lg-offset-8 col-lg-4 ">
                <div class="well well-sm">
                    <h4 class="text-center">إجمالي المردودات: <span id="totalBills2"><?php echo $_smarty_tpl->tpl_vars['totalBills']->value;?>
</span></h4>
                </div>
            </div>
            <div class="clearfix"></div>
            
            <form method="post" action="returnsellbillController.php?do=executeOperation" onsubmit="if (Spry.Widget.Form.validate(this)) {
                        return countChoosenProducts('returnsellbillController');
                    } else {
                        return false;
                    }">
                
                <table class="table table-black dataTableClass">
                    <thead>
                        <tr>
                            <th class="hidden-print">
                                <input type="checkbox" name="checkAll" id="checkAll" />
                            </th>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientserial==1){?><th>رقم تسلسل الفاتورة</th><?php }?>
                            <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->billid;?>
<?php $_tmp3=ob_get_clean();?><?php if ($_tmp3!=1){?> <th>الرقم الفاتورة</th><?php }?>
                            <th>اجمالى الفاتورة</th>
                            <th>تاريخ الفاتورة</th>
                            <th>العميل</th>
                            <th <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[3]->billsettingsvalue;?>
<?php $_tmp4=ob_get_clean();?><?php if ($_tmp4==0){?> style="display:block" <?php }else{ ?>
                                style="display:none" <?php }?>><?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 }?></th>
                            <th>اسم المستخدم</th>
                            <th>المخزن</th>
                            <th>الخزنة</th>
                            <th class="hidden-print">تفاصيل الفاتورة</th>
                            <th class="hidden-print">طباعه الباركود </th>
                            <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->allowEditDelInBills==0){?><th class="hidden-print">تعديل الفاتوره</th>
                            <th class="hidden-print">حذف</th><?php }?>
                            <th class="hidden-print">قيد اليومية</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $_smarty_tpl->tpl_vars['piecesCount'] = new Smarty_variable(0, null, 0);?>
                        <?php $_smarty_tpl->tpl_vars['payedTotal'] = new Smarty_variable(0, null, 0);?>
                        <?php $_smarty_tpl->tpl_vars['remainTotal'] = new Smarty_variable(0, null, 0);?>
                        <?php  $_smarty_tpl->tpl_vars['returnsellbill'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['returnsellbill']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['returnsellbillData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['returnsellbill']->key => $_smarty_tpl->tpl_vars['returnsellbill']->value){
$_smarty_tpl->tpl_vars['returnsellbill']->_loop = true;
?>

                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->conditions;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp5==0){?>
                        <?php $_smarty_tpl->tpl_vars['piecesCount'] = new Smarty_variable($_smarty_tpl->tpl_vars['piecesCount']->value+$_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellQuantity, null, 0);?>
                        <?php $_smarty_tpl->tpl_vars['payedTotal'] = new Smarty_variable($_smarty_tpl->tpl_vars['payedTotal']->value+$_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbilltotalpayed, null, 0);?>
                        <?php $_smarty_tpl->tpl_vars['remainTotal'] = new Smarty_variable($_smarty_tpl->tpl_vars['remainTotal']->value+$_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbillfinalbill, null, 0);?>
                        <?php }?>

                        <!--                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->conditions;?>
<?php $_tmp6=ob_get_clean();?><?php if ($_tmp6>0){?>
                                                <tr class="danger">
                                                    <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->deletedsellid;?>
<?php $_tmp7=ob_get_clean();?><?php if ($_tmp7==0){?>

                                                <tr>
                                                    <?php }}?>-->

                        <?php if (isset($_smarty_tpl->tpl_vars['returnsellbill']->value->newSellbillidAfterEdit)&&$_smarty_tpl->tpl_vars['returnsellbill']->value->newSellbillidAfterEdit>0){?> <!--this bill is deleted for editing-->
                        <tr class="danger">
                            <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->conditions;?>
<?php $_tmp8=ob_get_clean();?><?php if ($_tmp8!=0){?>
                        <tr class="dark">
                            <?php }else{ ?>
                        <tr>
                            <?php }}?>

                            <td class="hidden-print">
                                <input type="checkbox" name="choosedItem[]" id="checked<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" class="choosenItem"
                                    value="<?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbillid;?>
" />
                            </td>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientserial==1){?><td><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbillid;?>
</td><?php }?>
                            <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->billid;?>
<?php $_tmp9=ob_get_clean();?><?php if ($_tmp9!=1){?> <td><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbillserial;?>
</td>
                            <?php }?>
                            <td><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbillaftertotalbill;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbilldate;?>
</td>
                            <td> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->clientname;?>
<?php $_tmp10=ob_get_clean();?><?php if ($_tmp10==''){?>
                                نقدى
                                <?php }else{ ?>
                                <?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->clientname;?>

                                <?php }?> </td>
                            <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[3]->billsettingsvalue;?>
<?php $_tmp11=ob_get_clean();?><?php if ($_tmp11==0){?> style="display:block" <?php }else{ ?>
                                style="display:none" <?php }?>><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->employeename;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->useremployeename;?>
<?php if ($_smarty_tpl->tpl_vars['returnsellbill']->value->delbyusername){?><br /><span
                                    style="color: red"><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->delbyusername;?>
</span><?php }?></td>
                            <td><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->storeName;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->savename;?>
</td>
                            <td class="hidden-print"> <a
                                    href="returnsellbillController.php?do=showDetail&returnsellbillid=<?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbillid;?>
"
                                    type="button" class="btn btn-default btn-lg editicon"></a> </td>
                            <td class="hidden-print"><a
                                    href="productController.php?do=showbarcoderetsellbill&returnsellbillid=<?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbillid;?>
"
                                    target="_new" type="button" class="btn btn-default btn-lg editicon printparcode">
                                </a></td><!--&type=2-->

                            <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->allowEditDelInBills==0){?><td class="hidden-print"><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->conditions;?>
<?php $_tmp12=ob_get_clean();?><?php if ($_tmp12==0){?> <a
                                    href="sellbillController.php?do=editreturnsellBill&returnsellbillid=<?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbillid;?>
"
                                    type="button" class="btn btn-default btn-lg editicon"></a>
                                <?php }else{ ?>


                                <?php if (isset($_smarty_tpl->tpl_vars['returnsellbill']->value->newSellbillidAfterEdit)&&$_smarty_tpl->tpl_vars['returnsellbill']->value->newSellbillidAfterEdit>0){?> <!--this bill is deleted for editing-->
                                حذف للتعديل
                                <?php }else{ ?>
                                تم حذف الفاتورة
                                <?php }?>


                                <?php }?> </td>


                            <td class="hidden-print">
                                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->conditions;?>
<?php $_tmp13=ob_get_clean();?><?php if ($_tmp13==0){?>
                                <a href="#" type="button" class="btn btn-default btn-lg removeicon conformdel1"
                                    data-position="returnsellbillController.php?do=delete&returnsellbillid=<?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->returnsellbillid;?>
&action=<?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->dailyentryid;?>
"></a>
                                <?php }else{ ?>

                                <?php if (isset($_smarty_tpl->tpl_vars['returnsellbill']->value->newSellbillidAfterEdit)&&$_smarty_tpl->tpl_vars['returnsellbill']->value->newSellbillidAfterEdit>0){?> <!--this bill is deleted for editing-->
                                حذف للتعديل
                                <?php }else{ ?>
                                تم حذف الفاتورة
                                <?php }?>


                                <?php }?>

                            </td><?php }?>
                            <td class="hidden-print">
                                <a href="dailyentry.php?id=<?php echo $_smarty_tpl->tpl_vars['returnsellbill']->value->dailyentryid;?>
" target="_blank"
                                    type="button" class="btn btn-default btn-lg editicon"></a>
                            </td>
                        </tr>
                        <?php } ?>

                    </tbody>

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

                <!-- Modal -->
                <div class="hidden-print">
                    <div class="modal fade " id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                        aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close pull-left" data-dismiss="modal"
                                        aria-hidden="true">&times;</button>
                                    <div class="modal-title">تأكيد حذف الفاتوره</div>
                                </div>
                                <div class="modal-body"> هل تريد حذف هذه الفاتوره؟ </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">لا</button>
                                    <button type="button" class="btn btn-primary savemodel1">نعم</button>
                                </div>
                            </div>
                            <!-- /.modal-content -->
                        </div>
                        <!-- /.modal-dialog -->
                    </div>
                </div>
                <!-- /.modal -->

                <hr />
                <div class="hidden-print">
                    <div class="col-lg-12">
                        <div class="well well-sm">
                            <div class="form-group">
                                <div class="col-lg-4">
                                    <label for="operation"></label>
                                    <span id="spryselect1">
                                        <select name="operation" id="operation" data-placeholder="اختر العملية"
                                            class="select2 wdt100">
                                            <option value="-1">اختر عملية</option>
                                            <option value="1">حذف</option>
                                        </select>
                                        <span class="selectInvalidMsg">*</span></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-lg-4">
                                    <input name="" class="noprint btn btn-primary" type="submit" value="تنفيذ" />
                                </div>
                            </div>
                            <div class="clearfix"></div>
                            <div id="noElementsError" class="alert alert-danger fade in" style="display:none;">
                                <button type="button" class="close pull-left" data-dismiss="alert"
                                    aria-hidden="true">×</button>
                                <p>يجب اختيار العناصر أولاً</p>
                                <div class="clearfix"></div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                    <div class="col-lg-4 "><!-- col-lg-offset-8 -->
                        <div class="well well-sm">
                            <h4 class="text-center">عدد القطع: <span id="piecesCount"><?php echo $_smarty_tpl->tpl_vars['piecesCount']->value;?>
</span></h4>
                        </div>
                    </div>
                    <div class="col-lg-4 "><!-- col-lg-offset-8 -->
                        <div class="well well-sm">
                            <h4 class="text-center">إجمالي المردودات <span id="totalBills"><?php echo $_smarty_tpl->tpl_vars['totalBills']->value;?>
</span></h4>
                        </div>
                    </div>
                    <div class="col-lg-4 "><!-- col-lg-offset-8 -->
                        <div class="well well-sm">
                            <h4 class="text-center">اجمالى المدفوع: <span id="payedTotal"><?php echo $_smarty_tpl->tpl_vars['payedTotal']->value;?>
</span></h4>
                        </div>
                    </div>
                    <div class="col-lg-4 "><!-- col-lg-offset-8 -->
                        <div class="well well-sm">
                            <h4 class="text-center">اجمالى المؤجل : <span id="remainTotal"><?php echo $_smarty_tpl->tpl_vars['remainTotal']->value;?>
</span></h4>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </form>
        </div>
    </div>
</div>

<script type="text/javascript">
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", { isRequired: false, invalidValue: "-1" });
    $('.printparcode').mousedown(function (e) {
        e.preventDefault();
        var href = $(this).attr('href') + '&parcodeTypeToPrint=' + localStorage.getItem("parcodeTypeToPrint");
        window.open(href)
    });

    $('.conformdel1').click(function (e) {

        e.preventDefault();

        var elemposition = $(this).data('position');

        $("#myModal1").find(".savemodel1").attr('data-position', elemposition);
        $('#myModal1').modal('show');
    });
    $('.savemodel1').on('click', function () {

        $('#myModal1').modal('hide');
        var pos = $(this).attr('data-position');

        window.location.href = pos;
    });


    $(function () {
        $(".select2Supp").select2({
            placeholder: "العميل",
            minimumInputLength: document.getElementById("searchvalue").value,
            inimumInputLength: 0,
            multiple: false,
            quietMillis: 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: 0,
                        //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: $('#oldsupplierid').val(), text: $('#oldsuppliername').val() });
    });
</script>
<?php }} ?>