<?php /* Smarty version Smarty-3.1.11, created on 2025-01-28 21:03:19
         compiled from "../views/default/clientPayedDeptview/show.html" */ ?>
<?php /*%%SmartyHeaderCode:956327602679929f79e2cb0-23537540%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '1f2ff477461576d90e3c54811929dc28d135fab1' => 
    array (
      0 => '../views/default/clientPayedDeptview/show.html',
      1 => 1700682772,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '956327602679929f79e2cb0-23537540',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'message' => 0,
    'youtubes' => 0,
    'todaydDateOnly' => 0,
    'client' => 0,
    'clientsData' => 0,
    'data' => 0,
    'allmydata' => 0,
    'myallmydata' => 0,
    'Programsettingdata' => 0,
    'allCostcenter' => 0,
    'myallCostcenter' => 0,
    'projectid' => 0,
    'currency' => 0,
    'i' => 0,
    'idsearch' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_679929f7aed004_78458769',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_679929f7aed004_78458769')) {function content_679929f7aed004_78458769($_smarty_tpl) {?><style>
    .nodata{
        background-color: #72B4EC;
        color: white;
        border-radius: 13px;
        margin: 14px;
        font-size: 24px;
        text-align: center;
        padding: 5px;
    }

</style>
<script>
    /* $(document).ready(function(e) {
     var id= document.getElementById("sellbillid").value;

     window.open("clientReportsController.php?do=showDetail2&id="+id);
     });*/
</script>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#"><?php echo @PAYED_DEPT_GENERAL_FEATURES;?>
</a></li>
            <li><a href="clientPayedDeptController.php?do=show"><?php echo @PAYED_DEPT_CLIENTS;?>
</a></li>
            <li class="active"><?php echo @PAYED_DEPT_RECEIPT_RECEIPT_CLIENT;?>
</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading" style="padding:5px 15px 15px">
                <h3 class="panel-title" style="display: inline-block;"> <?php echo @PAYED_DEPT_SHOW_RECEIPT_RECEIPT_CLIENT;?>
<br />
                    <?php if ($_smarty_tpl->tpl_vars['message']->value!=''){?>
                    <?php echo $_smarty_tpl->tpl_vars['message']->value;?>

                    <?php }?></h3>
                <a href="<?php echo $_smarty_tpl->tpl_vars['youtubes']->value[264]->url;?>
" target="_blank" class="hidden-print"><img src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube" style="width: 2%;"></a>
                <a href="clientPayedDeptController.php" class="hidden-print"><input type="button"  id="submit" style="margin-left: 12px" class="btn btn-primary pull-left " value="<?php echo @PAYED_DEPT_ADD_NEW;?>
"/></a>
            </div>
            <div class="panel-body">
                <form class="form-inline  hidden-print" action="clientPayedDeptController.php?do=show" method="post">
                    <input type="hidden" id="todaydDateOnly" value="<?php echo $_smarty_tpl->tpl_vars['todaydDateOnly']->value;?>
"/>
                    <div class="form-group">

                        <label class="sr-only"> <?php echo @PAYED_DEPT_CLIENT_NAME;?>
 </label>
                        <input type="hidden" name="clientid" id="clientid" class="select2Supp2 search_ajax select2-offscreen" tabindex="-1">
                        <input type="hidden" id="select2Supp2id" value="<?php echo $_smarty_tpl->tpl_vars['client']->value->clientid;?>
">
                        <input type="hidden" id="select2Supp2text" value="<?php echo $_smarty_tpl->tpl_vars['client']->value->clientname;?>
">
                        <!--                        <select class="select2 wdt100 search_ajax" name="clientid" id="clientid" >
                                                    <option value="-1">اختر عميل </option>
                                                    <option value="-2"> كل العملاء</option>
                                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['clientsData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>



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


                                                    <?php } ?>


                                                </select>-->
                    </div>
                    <div class="form-group">
                        <label class="sr-only"><?php echo @PAYED_DEPT_RECEIPT;?>
 </label>
                        <input type="hidden" name="clientdebtchangemodelid" id="clientdebtchangemodelid" class="select2Recits search_ajax select2-offscreen" tabindex="-1">
                        <!--                        <select name="clientdebtchangemodelid" id="clientdebtchangemodelid"  class="select2 wdt100 search_ajax" >

                                                    <option value="-1">اختر الايصال</option>
                                                    <?php  $_smarty_tpl->tpl_vars['myallmydata'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['myallmydata']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allmydata']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['myallmydata']->key => $_smarty_tpl->tpl_vars['myallmydata']->value){
$_smarty_tpl->tpl_vars['myallmydata']->_loop = true;
?>
                                                    <option value="<?php echo $_smarty_tpl->tpl_vars['myallmydata']->value->clientdebtchangemodelid;?>
"><?php echo $_smarty_tpl->tpl_vars['myallmydata']->value->clientdebtchangemodelid;?>
</option>
                                                    <?php } ?>
                                                </select>-->
                    </div>
                    <div class="form-group">
                        <label class="sr-only">الرقم التسلسلى </label>
                        <input type="hidden" name="paySerialNo" id="paySerialNo" class="search_ajax select2-offscreen" tabindex="-1">
                    </div>
                    <div class="form-group">
                        <label class="sr-only"><?php echo @PAYED_DEPT_CLEAR;?>
 </label>
                        <input type="checkbox" class="search_ajax" name="bure" id="bure" value="1" />
                    </div>
                    <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->costcenter==0){?> <?php }else{ ?> style="display:none" <?php }?>  >
                        <label class="sr-only"><?php echo @PAYED_DEPT_COST_CENTER;?>
</label>
                        <select class="select2 wdt100" name="costcenterid" id="costcenterid" >
                            <option value="-1" ><?php echo @PAYED_DEPT_SELECT_COST_CENTER;?>
</option>
                            <?php  $_smarty_tpl->tpl_vars['myallCostcenter'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['myallCostcenter']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allCostcenter']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['myallCostcenter']->key => $_smarty_tpl->tpl_vars['myallCostcenter']->value){
$_smarty_tpl->tpl_vars['myallCostcenter']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->id;?>
" <?php if ($_smarty_tpl->tpl_vars['myallCostcenter']->value->id==$_smarty_tpl->tpl_vars['projectid']->value){?>selected=""<?php }?>><?php echo $_smarty_tpl->tpl_vars['myallCostcenter']->value->name;?>
</option>
                            <?php } ?>
                        </select>
                    </div>
                    <br />
                    <div class="form-group">
                        <label class="sr-only"><?php echo @PAYED_DEPT_FROM_DATE;?>
</label>
                        <input type="text" class="form-control awdatepicker search_ajax" autocomplete="off"   data-date-format="yyyy-mm-dd" name="from" id="from">
                    </div>
                    <div class="form-group">
                        <label class="sr-only"><?php echo @PAYED_DEPT_TO_DATE;?>
</label>
                        <input type="text" class="form-control awdatepicker search_ajax" autocomplete="off"   data-date-format="yyyy-mm-dd" name="to" id="to">
                    </div>

                    <br />
                    <div class="clearfix"></div>
                    <!-- <button type="submit" class="btn btn-primary">بحث</button>-->
                    <button type="button" class="btn btn-primary" id="todayPayments"><?php echo @PAYED_DEPT_SEARCH_TOADY;?>
</button>
                    <button type="button" class="btn btn-primary" id="refreshResultsBtn"><?php echo @PAYED_DEPT_SEARCH_UPDATE;?>
</button>
            </div>
            <!---->
            <div class="col-lg-offset-8 col-lg-4">
                <div class="well well-sm hidden-print">
                    <h4 class="text-center"><?php echo @PAYED_DEPT_TOTAL_VALUE_RECEIPTS;?>
 <br/>
                        <span class="sumRecit"></span>  <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4>
                </div>
            </div>
            <div class="clearfix"></div>
            <hr/>

            <table class="table table-black " id="receipts"><!-- dataTableClass -->
                <thead>
                    <tr>
                        <th>#</th>
                        <th><?php echo @PAYED_DEPT_RECEIPT_NUMBER;?>
</th>
                        <th>الرقم التسلسلى</th>
                        <th><?php echo @PAYED_DEPT_CLIENT_NAME;?>
</th>
                        <th><?php echo @PAYED_DEPT_DATE;?>
</th>
                        <th> <?php echo @PAYED_DEPT_DEBT_BEFORE;?>
</th>
                        <th><?php echo @PAYED_DEPT_AMOUNT;?>
</th>
                        <th> <?php echo @PAYED_DEPT_DEBT_AFTER;?>
</th>
                        <th><?php echo @PAYED_DEPT_USER_NAME;?>
 </th>
                        <th><?php echo @PAYED_DEPT_SAVE;?>
</th>
                        <th>النوع</th>
                        <th class="hidden-print"> <?php echo @PAYED_DEPT_EDIT;?>
</th>
                        <th class="hidden-print"> <?php echo @PAYED_DEPT_DELETE;?>
</th>
                        <!--<th class="hidden-print">طباعه </th>-->
                        <th class="hidden-print"><?php echo @PAYED_DEPT_PRINT_RECEIPT;?>
 </th>
                        <th class="hidden-print">قيد اليومية</th>
                    </tr>
                </thead>
                <tbody>
                    
                    
                    <!--                    <tr>
                                            <td><?php echo $_smarty_tpl->tpl_vars['i']->value;?>
</td><?php echo $_smarty_tpl->tpl_vars['data']->value->clientdebtchangeid;?>

                                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->clientdebtchangemodelid;?>
</td>
                                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->clientname;?>
</td>
                                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->clientdebtchangedate;?>
</td>
                                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->clientdebtchangebefore;?>
</td>
                                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->clientdebtchangeamount;?>
</td>
                                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->clientdebtchangeafter;?>
</td>
                                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->employeename;?>
</td>
                                            <td><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
</td>
                                            <th class="hidden-print">
                                                <?php if (($_smarty_tpl->tpl_vars['data']->value->del==0)){?>
                                                <a data-go="clientPayedDeptController.php?do=remove&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->clientdebtchangemodelid;?>
&action=<?php echo $_smarty_tpl->tpl_vars['data']->value->dailyentryid;?>
" class="removethis"><input  type="button"  class="btn btn-danger pull-right" value="حذف" /> </a>
                                                <?php }else{ ?>
                                                محذوف
                                                <?php }?>
                                            </th>
                                            <th class="hidden-print"><a target="_blank" href="clientPayedDeptController.php?do=editprint&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->clientdebtchangeid;?>
" ><input  type="button"  class="btn btn-success pull-right" value="طباعه" /> </a></th>
                                            <th class="hidden-print"><a target="_blank" href="clientPayedDeptController.php?do=editprint2&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->clientdebtchangeid;?>
" ><input  type="button"  class="btn btn-success pull-right" value="طباعه" /> </a></th>
                                        </tr>-->
                    
                    

                </tbody>

            </table>
            <div class="col-lg-offset-8 col-lg-4">
                <div class="well well-sm">
                    <h4 class="text-center"><?php echo @PAYED_DEPT_TOTAL_VALUE_RECEIPTS;?>
 <br/>
                        <span class="sumRecit"></span>  <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4>
                </div>
            </div>
            <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="form-group">
                        <div class="col-lg-4">
                            <button type="button" onclick="print_Custom('mycustomheader');" class="btn btn-success pull-right"><?php echo @PAYED_DEPT_PRINT;?>
</button>
                        </div>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="clearfix"></div>
            <!--            
                        <div class="nodata">عفوا لا توجد نتائج</div>
                        -->
        </div>

    </div>
</div>
<input type="hidden" id="idsearch" value="<?php echo $_smarty_tpl->tpl_vars['idsearch']->value;?>
" >

<script>
    $(function () {
        var receipts = $('#receipts');
        var otablereceipts = receipts.DataTable({
            "processing": true,
            "stateSave": true,
            "serverSide": true,
            "ajax": {url: 'clientPayedDeptController.php?do=showallajax', type: 'POST',
                "data": {
                    "from": function () {
                        return $('#from').val()
                    },
                    "to": function () {
                        return $('#to').val()
                    },
                    "clientdebtchangemodelid": function () {
                        return $('#clientdebtchangemodelid').val()
                    },
                    "paySerialNo": function () {
                        return $('#paySerialNo').val()
                    },
                    "clientid": function () {
                        return $('#clientid').val()
                    },
                    "costcenterid": function () {
                        return $('#costcenterid').val()
                    },
                    "bure": function () {
                        if ($('#bure').is(':checked')) {
                            return 1;
                        } else {
                            return 0;
                        }

                    },
//                    "searchDate": function () {
//                        return localStorage.getItem("search")
//                    },
                    // etc..
                }}, //  server side processing
            "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
                if (aData[0].includes("danger")) {//not deleted
                    $('td', nRow).css('background-color', '#F2DEDE');
                } else if (aData[0].includes("dark")) {
                    $('td', nRow).css('background-color', '#9E9E9E');
                } else {
                    //$('td', nRow).css('background-color', 'white');
                }
            },
            dom: 'Bfrtip',
            buttons: [//'csv', 'pdf'
                {
                    extend: "print",
                    className: "btn dark btn-outline",
                    text: "طباعه<i class='fa fa-print'></i>",
                    exportOptions: {
                        //columns: '.show-print'
                        columns: ':visible'
                    },
                    customize: function (win) {
                        $(win.document.body).find('table')
                                //.addClass('compact')
                                .css('direction', 'rtl');
                    }
                }, {
                    extend: "copy",
                    className: "btn red btn-outline",
                    text: "نسخ",
                    exportOptions: {
                        //columns: '.show-print'
                        columns: ':visible'
                    }
                }, {
                    extend: "excel",
                    className: "btn yellow btn-outline ",
                    text: "اكسل",
                    exportOptions: {
                        //columns: '.show-print'
                        columns: ':visible'
                    }
                }, {
                    extend: "colvis",
                    className: "btn dark btn-outline",
                    text: "المكونات"
                }
            ], "bStateSave": true,
            "language": {
                "aria": {
                    "sortAscending": ": Used to order Ascending",
                    "sortDescending": ": Used to order Descending"
                },
                "emptyTable": "لا يوجد بيانات",
                "info": "عرض من  _START_ إلى  _END_  - عدد فواتير البحث _TOTAL_",
                "infoEmpty": "لا يوجد بيانات",
                "infoFiltered": "(تنقيه  من عدد فواتير كلى _MAX_)",
                "lengthMenu": " _MENU_ عنصر",
                "search": "البحث:",
                "zeroRecords": "لا يوجد بيانات تشابه البحث"
            },
            responsive: !0,
            "columnDefs": [
                {"className": "hidden-print", "targets": [9, 10]}

                //            {// set default column settings //                "orderable": false,
                //                "searchable": false,
                //                "targets": [lstone],
                //                "className": 'hide-print'
                //            },
                //            {// set default column settings
                //                "orderable": false,
                //                "searchable": false,
                //                "targets": [belastone],
                //                "className": 'hide-print'
                //            },
                //            {// set default column settings
                //                "orderable": false,
                //                "searchable": false, //                "targets": [thrdone],
                //                "className": 'hide-print'
                //            },
//                {targets: '_all', "className": 'show-print'}
            ],
            order: [
                [0, "asc"]
            ],
            paging: true,
            lengthMenu: [
                [5, 10, 15, 20, 50, -1],
                [5, 10, 15, 20, 50, "All"]
            ],
            pageLength: 10,
            dom: "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>"
        });
        $('body').on('change', '.search_ajax', function () {
            otablereceipts.ajax.reload();
            //otablesell.draw();//both work fine
        });
        $('body').on('click', '#refreshResultsBtn', function () {
            $('.search_ajax:first').trigger('change');
        });
        $('body').on('click', '#todayPayments', function () {
            $('#from').val($('#todaydDateOnly').val());
            $('#to').val($('#todaydDateOnly').val());
            $('.search_ajax:first').trigger('change');
        });
        //when draw is comlete cal total of column using datatable api sum func
        otablereceipts.on('draw', function (e, ajaxdata) {
            //var sum = otablesell.column(3).data().sum();
            $('.sumRecit').html(ajaxdata.json.totals.totalRecitsAll);
        });




        //search with clientdebtchangemodelid get
        $('#clientdebtchangemodelid').select2('data', {id: $('#idsearch').val(), text: $('#idsearch').val()});
        $('#refreshResultsBtn').click();
    });
    $(".removethis").live("click", function () {
        $(".removethis").unbind("click");
        window.location.href = $(this).attr('data-go');
        $('.removethis').removeAttr('data-go');
    });
    $('.delPayment').live('click', function () {
        var btn = $(this);
        if (!btn.hasClass('processing...')) {
            btn.addClass('processing...');


            var id = btn.data('id');
            var type = btn.data('type');
            type = type.split('-');
            if (type[0].trim() == "خزنة")
                type = "save";
            else if (type[0].trim() == "بنك")
                type = "bank";

            $.post('sellbillAjaxController.php?do=delMakeSellBillPayment', {clientdebtchangeId: id, paytype: type}, function (data) {
                btn.removeClass('processing...');
                if (Number(data) == 1) {
                    //btn.parent().parent().remove();
                    window.location.reload();
                } else {
                    alert('عفوا حدث خطأ.حاول مرة اخرى')
                }
            });
        }
    });
</script>

<?php }} ?>