<?php /* Smarty version Smarty-3.1.11, created on 2026-05-17 04:37:25
         compiled from "..\views\default\buyAndReturnBillview\show.html" */ ?>
<?php /*%%SmartyHeaderCode:233996a0929e570d5b0-34432739%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '1ca8e64238c43b1f5c9785d241d5b8731baa9413' => 
    array (
      0 => '..\\views\\default\\buyAndReturnBillview\\show.html',
      1 => 1752437506,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '233996a0929e570d5b0-34432739',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'message' => 0,
    'youtubes' => 0,
    'Programsettingdata' => 0,
    'suppliersData' => 0,
    'supplier' => 0,
    'billSerials' => 0,
    'serial' => 0,
    'buybillid' => 0,
    'totalBills' => 0,
    'usergroup' => 0,
    'buyBillData' => 0,
    'data' => 0,
    'i' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_6a0929e6050748_67014406',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_6a0929e6050748_67014406')) {function content_6a0929e6050748_67014406($_smarty_tpl) {?><div class="container">
    <ol class="breadcrumb">
        <li><a href="#">إدارة الفواتير</a></li>
        <li><a href="#">فاتورة المشتريات والمردودات</a></li>
        <li class="active">عرض الفواتير</li>
    </ol>
    <div class="row">
        <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[35]->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;?>
">
                <form class="form-inline hidden-print" action="buyAndReturnBillController.php?do=show" method="post">
                    <div class="form-group">
                        <label class="sr-only">إسم المورد</label>
                        <!--                        <select id="supplier" name="supplier" data-placeholder="اختر المورد" class="select2 wdt100" onChange="this.form.submit();">
                                                    <option value="-1"></option>



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

                                                    <option value="<?php echo $_smarty_tpl->tpl_vars['supplier']->value->supplierid;?>
"><?php echo $_smarty_tpl->tpl_vars['supplier']->value->suppliername;?>
</option>

                                                    <?php } ?>



                                                </select>-->
                        <input type="hidden" name="supplier" id="supplier" class="select2Supp" onChange="this.form.submit();"/>
                        <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['Programsettingdata']->value->billid;?>
<?php $_tmp1=ob_get_clean();?><?php if ($_tmp1==1){?>  style="display:none" <?php }?>>
                        <label class="sr-only">رقم الفاتورة</label>
                        <select data-placeholder="اختر رقم الفاتورة" class="select2 wdt100" name="serial"  onChange="this.form.submit();">
                            <option value="-1"></option>



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



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

                            <?php } ?>



                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only">الرقم تسلسل الفاتورة</label>
                        <select data-placeholder="اختر الرقم المتسلسل" class="select2 wdt100" name="buybillid"  onChange="this.form.submit();">
                            <option value="-1"></option>



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





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



                            <?php } ?>



                        </select>
                    </div>
                    <br/>
                    <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="from" >
                    </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="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 noprint">بحث</button>
                </form>
            </div>
            <hr/>
            <div class="col-lg-offset-8 col-lg-4 ">
                <div class="well well-sm">
                    <h4 class="text-center">إجمالي المشتريات:  <?php echo $_smarty_tpl->tpl_vars['totalBills']->value;?>
</h4>
                </div>
            </div>
            <div class="clearfix"></div>
            
            <form id="form1" name="form1" method="post" action="buyAndReturnBillController.php?do=delete"onsubmit="if (Spry.Widget.Form.validate(this)) {
                        return countChoosenProducts('buyAndReturnBillController');
                    } else {
                        return false;
                    }" enctype="multipart/form-data">
                
                <!-- Table -->
                <table class="table table-black">
                    <thead>
                        <tr>
                            <th class="hidden-print">
                                <label>
                                    <input type="checkbox" name="checkAll" id="checkAll"/>
                                </label>
                            </th>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientserial==1){?><th>رقم تسلسل الفاتورة</th><?php }?>
                            <th>اسم المورد</th>
                            <th <?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 }?>>رقم الفاتورة</th>
                            <th>إجمالي الفاتورة</th>
                            <th>التاريخ</th>
                            <th>المستخدم</th>
                            <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->allowEditDelInBuyBills==0){?><th>التعديل</th><?php }?>
                            <th class="hidden-print">تفاصيل الفاتورة</th>
                            <th class="hidden-print">تكويد المنتجات</th>
                            <!--        <th class="hidden-print">تكويد المنتجات</th>
                            -->
                            <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->allowEditDelInBuyBills==0){?><th class="hidden-print">حذف</th><?php }?>
                        </tr>
                    </thead>
                    <tbody>

                        <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['buyBillData']->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;
?>
                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->conditions;?>
<?php $_tmp3=ob_get_clean();?><?php if ($_tmp3==1){?>
                        <tr class="danger"> <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->conditions;?>
<?php $_tmp4=ob_get_clean();?><?php if ($_tmp4==0){?>
                        <tr> <?php }}?>
                            <td class="hidden-print">
                                <label>
                                    <input type="checkbox" name="choosedItem[]" id="checked<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" class="choosenItem" value="<?php echo $_smarty_tpl->tpl_vars['data']->value->buybillid;?>
" />
                                </label>
                            </td>
                            <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientserial==1){?><td><?php echo $_smarty_tpl->tpl_vars['data']->value->buybillid;?>
</td><?php }?>
                            <td> <?php echo $_smarty_tpl->tpl_vars['data']->value->suppliername;?>
 </td>
                            <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->billid;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp5==1){?>  style="display:none" <?php }?>><?php echo $_smarty_tpl->tpl_vars['data']->value->buybillSerial;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->buybillaftertotalbill;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->buybilldate;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->username;?>
<?php if ($_smarty_tpl->tpl_vars['data']->value->delbyusername){?><br/><span style="color: red"><?php echo $_smarty_tpl->tpl_vars['data']->value->delbyusername;?>
</span><?php }?></td>
                            <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->allowEditDelInBuyBills==0){?><td  class="hidden-print">
                                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->conditions;?>
<?php $_tmp6=ob_get_clean();?><?php if ($_tmp6==0){?>
                                <a href="buyBillController.php?do=editbuyandreturnbill&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->buybillid;?>
" type="button" class="btn btn-default btn-lg notesicon"></a>
                                <?php }else{ ?>
                                تم حذف الفاتوره
                                <?php }?>
                            </td><?php }?>
                            <td  class="hidden-print"><a href="buyAndReturnBillController.php?do=details&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->buybillid;?>
" type="button" class="btn btn-default btn-lg notesicon"></a></td>
                            <td  class="hidden-print"><a href="buyAndReturnBillController.php?do=addserial&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->buybillid;?>
&type=3" type="button" class="btn btn-default btn-lg editicon"></a></td>

                            <!--       <td  class="hidden-print"><a href="productsParcodeController.php?id=<?php echo $_smarty_tpl->tpl_vars['data']->value->buybillid;?>
&type=3" type="button" class="btn btn-default btn-lg editicon"></a></td>
                            -->
                            <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->allowEditDelInBuyBills==0){?><td  class="hidden-print"> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->conditions;?>
<?php $_tmp7=ob_get_clean();?><?php if ($_tmp7==0){?> <a href="buyAndReturnBillController.php?do=delete&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->buybillid;?>
" type="button" class="btn btn-default btn-lg deleteicon"> </a> <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['data']->value->conditions;?>
<?php $_tmp8=ob_get_clean();?><?php if ($_tmp8==1){?> تم حذف الفاتورة</td><?php }}?>
                            <?php }?> </tr>
                        <?php } ?>
                    </tbody>

                </table>
                <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="spryselect2">
                                        <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>

                            <!-----------  start noElementsError alert ------------->
                            <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>
                            <!----------  end noElementsError alert -------------->

                            <div class="clearfix"></div>
                        </div>
                    </div>
                    <div class="col-lg-offset-8 col-lg-4 ">
                        <div class="well well-sm">
                            <h4 class="text-center">إجمالي المشتريات:  <?php echo $_smarty_tpl->tpl_vars['totalBills']->value;?>
</h4>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </form>
            <div class="clearfix"></div>
            <hr />
            <div  class="hidden-print">
                <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">طباعة</button>
                        </div>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>

<script type="text/javascript">
    var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {invalidValue: "-1", isRequired: false});
    $(function () {
        $(".select2Supp").select2({
            placeholder: "المورد",
            minimumInputLength: document.getElementById("searchvalue").value,
            //inimumInputLength: 0,
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "supplierAjaxController.php?do=select2supplier",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        term: term, //search term
                        page_limit: 7, // page size
                        withAddOption: 0,
                        withNakdi: 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
        $('#supplier').select2('data', {id: $('#oldsupplierid').val(), text: $('#oldsuppliername').val()});
    });
</script>
<?php }} ?>