<?php /* Smarty version Smarty-3.1.11, created on 2024-03-25 02:11:09
         compiled from "../views/default/sellbillview/showoffers.html" */ ?>
<?php /*%%SmartyHeaderCode:14505016146600c11d88f0c4-52584857%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'd0c1013d39f57fe3c26883123a30c80be5308422' => 
    array (
      0 => '../views/default/sellbillview/showoffers.html',
      1 => 1693253996,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '14505016146600c11d88f0c4-52584857',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'message' => 0,
    'youtubes' => 0,
    'Programsettingdata' => 0,
    'outputString' => 0,
    'Usergroupdata' => 0,
    'clientData' => 0,
    'client' => 0,
    'billsettingsData' => 0,
    'sellerData' => 0,
    'mysellerData' => 0,
    'usergroup' => 0,
    'sellbillData' => 0,
    'piecesCount' => 0,
    'sellbill' => 0,
    'payedTotal' => 0,
    'remainTotal' => 0,
    'i' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_6600c11d9bebd6_94218334',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_6600c11d9bebd6_94218334')) {function content_6600c11d9bebd6_94218334($_smarty_tpl) {?>
<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">فواتير معلقه <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[44]->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>
                <input type="hidden" name="withNakdi" id="withNakdi" value="<?php echo $_smarty_tpl->tpl_vars['Usergroupdata']->value->showClientAndSupplierOne;?>
"/>
                <form class="form-inline hidden-print" action="sellbillController.php?do=showoffers" 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"<?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>
                        <input type="text" class="form-control search_bill" placeholder="رقم العرض" name="sellbillserial" id="sellbillserial">
                    </div>
                    <div class="form-group">
                        <label class="sr-only">الرقم تسلسل العرض</label>
                        <input type="text" class="form-control search_bill" placeholder="رقم تسلسل العرض" name="sellbillid" id="sellbillid">
                    </div>
                    <br/>

                    <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 search_bill" size="16" type="text" value="" name="from" id="from" 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 search_bill" size="16" type="text" value="" name="to" id="to" 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 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>

                    <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 class="clearfix"></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  id="tableWrap">
                <div class="clearfix"></div>
                <div class="message-table"> <?php echo $_smarty_tpl->tpl_vars['message']->value;?>
</div>
                


                <form>
                    
                    <table class="table table-black dataTableClass" id="excelTable">
                        <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 class="hidden-print">تفاصيل العرض</th>
                                <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->allowEditDelInBills==0){?>
                                <th class="hidden-print">تعديل العرض</th>
                                <th class="hidden-print">تعديل و حفظ كفاتورة</th>
                                <th class="hidden-print">حفظ كفاتورة</th>
                                <th class="hidden-print">حذف</th>
                                <?php }?>
                            </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['sellbill'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['sellbill']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['sellbillData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['sellbill']->key => $_smarty_tpl->tpl_vars['sellbill']->value){
$_smarty_tpl->tpl_vars['sellbill']->_loop = true;
?>
                            <?php $_smarty_tpl->tpl_vars['piecesCount'] = new Smarty_variable($_smarty_tpl->tpl_vars['piecesCount']->value+$_smarty_tpl->tpl_vars['sellbill']->value->sellQuantity, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['payedTotal'] = new Smarty_variable($_smarty_tpl->tpl_vars['payedTotal']->value+$_smarty_tpl->tpl_vars['sellbill']->value->sellbilltotalpayed, null, 0);?>
                            <?php $_smarty_tpl->tpl_vars['remainTotal'] = new Smarty_variable($_smarty_tpl->tpl_vars['remainTotal']->value+$_smarty_tpl->tpl_vars['sellbill']->value->sellbillfinalbill, null, 0);?>

                            <?php if (isset($_smarty_tpl->tpl_vars['sellbill']->value->newSellbillidAfterEdit)&&$_smarty_tpl->tpl_vars['sellbill']->value->newSellbillidAfterEdit>0){?> <!--this bill is deleted for editing-->
                            <tr class="danger">
                                <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->conditions;?>
<?php $_tmp5=ob_get_clean();?><?php if ($_tmp5!=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['sellbill']->value->sellbillid;?>
" />
                                </td>
                                <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->clientserial==1){?><td><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->sellbillid;?>
</td><?php }?>
                                <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['Programsettingdata']->value->billid;?>
<?php $_tmp6=ob_get_clean();?><?php if ($_tmp6==0){?>  <td ><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->sellbillserial;?>
</td><?php }?>
                                <td><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->sellbillaftertotalbill;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->sellbilldate;?>
</td>
                                <td> <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->clientname;?>
<?php $_tmp7=ob_get_clean();?><?php if ($_tmp7==''){?>
                                    نقدى
                                    <?php }else{ ?>
                                    <?php echo $_smarty_tpl->tpl_vars['sellbill']->value->clientname;?>

                                    <?php }?> </td>
                                <td <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['billsettingsData']->value[3]->billsettingsvalue;?>
<?php $_tmp8=ob_get_clean();?><?php if ($_tmp8==0){?> style="display:block" <?php }else{ ?> style="display:none" <?php }?>><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->employeename;?>
</td>
                                <td><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->useremployeename;?>
<?php if ($_smarty_tpl->tpl_vars['sellbill']->value->delbyusername){?><br/><span style="color: red"><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->delbyusername;?>
</span><?php }?></td>
                                <td class="hidden-print"> <a href="sellbillController.php?do=showDetail&sellbillid=<?php echo $_smarty_tpl->tpl_vars['sellbill']->value->sellbillid;?>
&ordertype=1" type="button" class="btn btn-default btn-lg editicon"></a> </td>
                                <?php if ($_smarty_tpl->tpl_vars['usergroup']->value->allowEditDelInBills==0){?>
                                <td class="hidden-print">
                                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->conditions;?>
<?php $_tmp9=ob_get_clean();?><?php if ($_tmp9==0){?>
                                    <a href="sellbillController.php?do=editsellBill&sellbillid=<?php echo $_smarty_tpl->tpl_vars['sellbill']->value->sellbillid;?>
&ordertype=1" type="button" class="btn btn-default btn-lg editicon"></a>
                                    <?php }?>
                                </td>
                                <td class="hidden-print">
                                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->conditions;?>
<?php $_tmp10=ob_get_clean();?><?php if ($_tmp10==0&&$_smarty_tpl->tpl_vars['sellbill']->value->orderSavedBillId==0){?>
                                    <a href="sellbillController.php?do=addsellBill&billnameid=3&offerId=<?php echo $_smarty_tpl->tpl_vars['sellbill']->value->sellbillid;?>
&ordertype=0" type="button" class="btn btn-default btn-lg editicon"></a>
                                    <?php }?>
                                </td>
                                <td class="hidden-print">
                                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->conditions;?>
<?php $_tmp11=ob_get_clean();?><?php if ($_tmp11==0&&$_smarty_tpl->tpl_vars['sellbill']->value->orderSavedBillId==0){?>
                                    <a href="sellbillController.php?do=saveOfferAsBill&offerId=<?php echo $_smarty_tpl->tpl_vars['sellbill']->value->sellbillid;?>
" type="button" class="btn btn-default btn-lg editicon" onclick="$(this).hide()"></a>
                                    <?php }?>
                                </td>
                                <td class="hidden-print">
                                    <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['sellbill']->value->conditions;?>
<?php $_tmp12=ob_get_clean();?><?php if ($_tmp12==0&&$_smarty_tpl->tpl_vars['sellbill']->value->orderSavedBillId==0){?>
                                    <a href="sellbillController.php?do=delete&sellbillid=<?php echo $_smarty_tpl->tpl_vars['sellbill']->value->sellbillid;?>
&ordertype=1" type="button" class="btn btn-default btn-lg removeicon"></a> <?php }else{ ?>
                                    <?php }?> </td>
                                <?php }?>
                            </tr>

                            <?php } ?>

                        </tbody>

                    </table>
            </div>

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

            </form>

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

<script type="text/javascript">
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {isRequired: false, invalidValue: "-1"});
    //
    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();
    }
    //
    $('#excuteOperationBtn').live('click', function (e) {
        e.preventDefault();
        e.stopPropagation();
        //    $('#excuteOperationForm').
        if ($('#operation').val() == "2") {
            var ids = '';
            $(".choosenItem:checked").each(function () {
                ids += $(this).val() + ',';
            });
            if (ids != "") {
                window.open('sellbillprintController.php?do=showDetail2Bulk&id=' + ids);
            } else {
                $("#noElementsError").css("display", "block");
                setTimeout(function () {
                    $("#noElementsError").css("display", "none");
                }, 4000);
            }
        } else {
            return true;
        }
    });

    $(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: 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: $('#oldsupplierid').val(), text: $('#oldsuppliername').val()});
    });
</script>
<?php }} ?>