<?php /* Smarty version Smarty-3.1.11, created on 2025-01-28 21:05:55
         compiled from "../views/default/supplierReportsview/show.html" */ ?>
<?php /*%%SmartyHeaderCode:45551560967992a93242186-19564288%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'e2ef53305d186e5c4b386eea1012e2b14872cad3' => 
    array (
      0 => '../views/default/supplierReportsview/show.html',
      1 => 1699953262,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '45551560967992a93242186-19564288',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'message' => 0,
    'youtubes' => 0,
    'todaydDateOnly' => 0,
    'supplierData' => 0,
    'supplier' => 0,
    'saveData' => 0,
    'save' => 0,
    'Programsettingdata' => 0,
    'allCostcenter' => 0,
    'myallCostcenter' => 0,
    'projectid' => 0,
    'sum' => 0,
    'currency' => 0,
    'data' => 0,
    'i' => 0,
    'idsearch' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_67992a9330ca09_69901554',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_67992a9330ca09_69901554')) {function content_67992a9330ca09_69901554($_smarty_tpl) {?>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">خصائص عامة</a></li>
            <li><a href="#">الموردين</a></li>
            <li class="active">تقرير دفعات</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">تقرير دفعات
                <?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[123]->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">
                <form class="form-inline  hidden-print" action="supplierReportsController.php" method="post">
                    <input type="hidden" id="todaydDateOnly" value="<?php echo $_smarty_tpl->tpl_vars['todaydDateOnly']->value;?>
"/>
                    <div class="form-group">
                        <label class="sr-only">اختر مورد</label>
                        <select data-placeholder="اختر مورد" class="select2 wdt300 search_ajax" name="supplierId" id="supplierId">
                            <option value="-1"> اختر مورد</option>
                            <option value="-2"> كل الموردين</option>
                            <?php  $_smarty_tpl->tpl_vars['supplier'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['supplier']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['supplierData']->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>
                    </div>

                    <div class="form-group">
                        <label class="sr-only">اختر خزنة</label>
                        <select data-placeholder="اختر خزنة" class="select2 wdt300 search_ajax" name="saveId" id="saveId">
                            <option value="-1"> اختر خزنة</option>
                            <?php  $_smarty_tpl->tpl_vars['save'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['save']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['saveData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['save']->key => $_smarty_tpl->tpl_vars['save']->value){
$_smarty_tpl->tpl_vars['save']->_loop = true;
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['save']->value->saveid;?>
"><?php echo $_smarty_tpl->tpl_vars['save']->value->savename;?>
</option>
                            <?php } ?>
                        </select>
                    </div>


                   

                   
                     <div class="form-group" <?php if ($_smarty_tpl->tpl_vars['Programsettingdata']->value->costcenter!=0&&$_smarty_tpl->tpl_vars['Programsettingdata']->value->realestatedev!=0){?> style="display:none" <?php }?>>
                        <label class="sr-only">مركز التكلفه</label>
                        <select class="select2 wdt100" name="Costcenterid" id="Costcenterid" >
                            <option value="-1" >اختر مركز التكلفه</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">من التاريخ</label>
                        <input type="text" class="form-control awdatepicker search_ajax" autocomplete="off"   data-date-format="yyyy-mm-dd"  name="from" id="datepicker_from" >
                    </div>
                    <div class="form-group">
                        <label class="sr-only">إلى التاريخ</label>
                        <input type="text" class="form-control awdatepicker search_ajax" autocomplete="off"   data-date-format="yyyy-mm-dd"  name="to" id="datepicker_to" ><!--  onChange="getResult();"-->
                    </div>

                    <button type="button" class="btn btn-primary  hidden-print"  id="todayPayments">دفعات اليوم</button>
                    <button type="button" class="btn btn-primary  hidden-print"  id="refreshResultsBtn">بحث / تحديث النتائج</button>
                </form>
            </div>
            <div>
                <!-- Nav tabs -->
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#cashTab" data-toggle="tab">النقدى</a></li>
                    <li><a href="#chequesTab" data-toggle="tab">المسحوبات</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="cashTab"><!-- start the 1st tab -->
                        <div class="col-lg-offset-8 col-lg-4">
                            <div class="well well-sm"><h4 class="text-center">الإجمالي:  <span class="sumRecit"><?php echo $_smarty_tpl->tpl_vars['sum']->value;?>
</span> <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4></div>
                        </div>
                        <hr/>
                        <div id="resultDiv"><!------ Start result --------->

                            <hr/>

                            <table class="table table-black" id="receipts">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>رقم الايصال</th>
                                        <th>اسم المورد</th>
                                        <th>التاريخ</th>
                                        <th>الدين قبل </th>
                                        <th>المبلغ</th>
                                        <th>الدين بعد </th>
                                        <th style="width:30%; max-width: 30%;"> التعليق </th>
                                        <th>اسم المستخدم</th>
                                        <th>اسم الخزنة</th>
                                        <th class="hidden-print">تعديل</th>
                                        <th class="hidden-print">حذف</th>
                                        <th class="hidden-print">طباعه  </th>
                                        <th class="hidden-print">قيد اليومية</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    
                                    
                                    <!--

                                                            <?php if ($_smarty_tpl->tpl_vars['data']->value->del==1){?>
                                                            <tr class="danger">
                                                                <?php }else{ ?>
                                                            <tr class="gradeA">
                                                                <?php }?>
                                                                <td><?php echo $_smarty_tpl->tpl_vars['data']->iteration;?>
</td>
                                                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->supplierdebtchangeid;?>
</td>
                                                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->suppliername;?>
</td>
                                                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->supplierdebtchangedate;?>
</td>
                                                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->supplierdebtchangebefore;?>
</td>
                                                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->supplierdebtchangeamount;?>
</td>
                                                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->supplierdebtchangeafter;?>
</td>
                                                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->comment;?>
</td>
                                                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->username;?>
</td>
                                                                <td><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
</td>
                                                                <td class="hidden-print">
                                                                    <?php if ($_smarty_tpl->tpl_vars['data']->value->del==1){?>
                                                                    لقد تم حذفه
                                                                    <?php }else{ ?>

                                                                    <a href="#" ><input id="delbtn<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" data-action="supplierReportsController.php?do=remove&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->supplierdebtchangeid;?>
&dailyentry=<?php echo $_smarty_tpl->tpl_vars['data']->value->dailyentryid;?>
" type="button"  class="btn btn-danger pull-right" value="حذف" /> </a>
                                                                    <?php }?>
                                                                </td>
                                                                <th  class="hidden-print"><a target="_blank" href="supplierReportsController.php?do=editprint&id=<?php echo $_smarty_tpl->tpl_vars['data']->value->supplierdebtchangeid;?>
" ><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">الإجمالي:  <span class="sumRecit"><?php echo $_smarty_tpl->tpl_vars['sum']->value;?>
</span> <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4></div>
                            </div>
                        </div> <!------ End result --------->
                    </div>

                    <div class="tab-pane" id="chequesTab"><!-- start the 2nd tab -->

                        <div class="col-lg-offset-8 col-lg-4">
                            <div class="well well-sm"><h4 class="text-center">الإجمالي:  <span class="sumRecit_cheques"><?php echo $_smarty_tpl->tpl_vars['sum']->value;?>
</span> <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4></div>
                        </div>
                        <hr>
                        <table class="table table-black" id="receipts_cheques">
                            <thead>
                                <tr>
                                    <th>رقم الشيك</th>
                                    <th>اسم البنك</th>
                                    <th>اسم الحساب</th>
                                    <th>اسم المورد</th>
                                    <th>المبلغ المدفوع</th>
                                    <th class="hidden-print">الحذف</th>
                                    <th class="hidden-print">التعديل</th>
                                    <th class="hidden-print">طباعه</th>
                                </tr>
                            </thead>
                            <tbody>



                            </tbody>

                        </table>
                        <div class="col-lg-offset-8 col-lg-4">
                            <div class="well well-sm"><h4 class="text-center">الإجمالي:  <span class="sumRecit_cheques"><?php echo $_smarty_tpl->tpl_vars['sum']->value;?>
</span> <?php echo $_smarty_tpl->tpl_vars['currency']->value;?>
</h4></div>
                        </div>
                    </div>
                </div>


            </div>

            <!-- Modal -->
            <div class="modal fade hidden-print" id="myModal155" 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 savemodel2" data-dismiss="modal" aria-hidden="true">&times;</button>
                        </div>
                        <div class="modal-body">
                            <span class="modal-title">

                                هل تريد حذف هذا العنصر؟
                            </span>

                            <form id="supDel" action="" method="post" class="form-horizontal">
                            </form>
                            <input type="hidden" name="currentItr" id="currentItr" value="0"/>
                        </div>
                        <div class="modal-footer">
                            <button type="button" id="ddbtn" class="btn btn-default" >حذف </button>

                            <button type="button" class="btn btn-default" data-dismiss="modal">اغلاق </button>
                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </div>

            <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>
<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: 'supplierReportsController.php?do=showallajax', type: 'POST',
                "data": {
                    "from": function () {
                        return $('#datepicker_from').val()
                    },
                    "to": function () {
                        return $('#datepicker_to').val()
                    },
                    "saveId": function () {
                        return $('#saveId').val()
                    },
                    "supplierId": function () {
                        return $('#supplierId').val()
                    },
                    "debtchangeid": function () {
                        return $('#idsearch').val()//$('#supplierId').val()
                    },
                    "Costcenterid": function () {
                        return $('#Costcenterid').val()
                    },
//                    "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": [//            {// 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>>"
        });
        var receipts_cheques = $('#receipts_cheques');
        var otablereceipts_cheques = receipts_cheques.DataTable({
            "processing": true,
            "stateSave": true,
            "serverSide": true,
            "ajax": {url: 'supplierReportsController.php?do=showallajaxCheques', type: 'POST',
                "data": {
                    "from": function () {
                        return $('#datepicker_from').val()
                    },
                    "to": function () {
                        return $('#datepicker_to').val()
                    },
                    "supplierId": function () {
                        return $('#supplierId').val()
                    },
                    "Costcenterid": function () {
                        return $('#Costcenterid').val()
                    },
//                    "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": [//            {// 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();
            otablereceipts_cheques.ajax.reload();
            //otablesell.draw();//both work fine
        });
        $('body').on('click', '#refreshResultsBtn', function () {
            $('.search_ajax:first').trigger('change');
        });
        $('body').on('click', '#todayPayments', function () {
            $('#datepicker_from').val($('#todaydDateOnly').val());
            $('#datepicker_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);
        });
        otablereceipts_cheques.on('draw', function (e, ajaxdata) {
            //var sum = otablesell.column(3).data().sum();
            $('.sumRecit_cheques').html(ajaxdata.json.totals.totalRecitsAll);
        });



        //search with debtchangeid get
//        $('#debtchangeid').select2('data', {id: $('#idsearch').val(), text: $('#idsearch').val()});
//        $('#refreshResultsBtn').click();
    });
</script>
<?php }} ?>