
    <!-- latest jquery-->
    <script src="<?php echo SITEURL;?>assets/js/jquery-3.2.1.min.js"></script>

    <!-- Bootstrap js-->
    <script src="<?php echo SITEURL;?>assets/js/bootstrap/popper.min.js"></script>
    <script src="<?php echo SITEURL;?>assets/js/bootstrap/bootstrap.js"></script>

    <!-- Counter js-->
    <script src="<?php echo SITEURL;?>assets/js/counter/jquery.waypoints.min.js"></script>
    <script src="<?php echo SITEURL;?>assets/js/counter/jquery.counterup.min.js"></script>
    <!-- <script src="<?php echo SITEURL;?>assets/js/counter/counter-custom.js"></script> -->

    <!-- owlcarousel js-->
    <script src="<?php echo SITEURL;?>assets/js/owlcarousel/owl.carousel.js"></script>

    <!-- prism js -->
    <script src="<?php echo SITEURL;?>assets/js/prism/prism.min.js"></script>

    <!-- clipboard js -->
    <script src="<?php echo SITEURL;?>assets/js/clipboard/clipboard.min.js"></script>

    <!-- custom card js  -->
    <script src="<?php echo SITEURL;?>assets/js/custom-card/custom-card.js"></script>

    <!--Height Equal Js-->
    <script src="<?php echo SITEURL;?>assets/js/height-equal.js"></script>

    <!-- Sidebar jquery-->
    <script src="<?php echo SITEURL;?>assets/js/sidebar-menu.js"></script>
    <script src="<?php echo SITEURL;?>assets/js/compact-small-button.js"></script>

    <!-- Theme js-->
    <script src="<?php echo SITEURL;?>assets/js/script.js"></script>

    <!-- tour js -->
    <script src="<?php echo SITEURL;?>assets/js/tour/intro.js"></script>
    <script src="<?php echo SITEURL;?>assets/js/tour/intro-init.js"></script>

    <!-- Chartist  -->
    <script src="<?php echo SITEURL;?>assets/js/chartis/chartist.js"></script>

    <!--Sparkline  Chart JS-->
    <script src="<?php echo SITEURL;?>assets/js/sparkline/sparkline.js"></script>

    <!--Dashboard business js-->
    <!-- <script  src="<?php echo SITEURL;?>assets/js/dashboard-business.js"></script> -->
    <script src="<?php echo SITEURL;?>assets/js/date-picker/datepicker.js"></script>
    <script src="<?php echo SITEURL;?>assets/js/date-picker/datepicker.en.js"></script>

    <script src="<?php echo SITEURL;?>assets/js/bootbox.min.js"></script>

    <!-- bootstrap notify js -->
    <script src="<?php echo SITEURL;?>assets/js/notify/bootstrap-notify.min.js"></script>

    <!-- Select2 js -->
    <script type="text/javascript" src="<?php echo SITEURL;?>assets/js/select2/select2.full.min.js"></script>

<!-- <script  src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script  src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script> -->
    <script  src="<?php echo SITEURL;?>assets/js/datatables/jquery.dataTables.min.js"></script>
    <script  src="<?php echo SITEURL;?>assets/js/datatables/datatable.custom.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.1/js/buttons.flash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.1/js/buttons.print.min.js"></script>

    <script>
        var table;
$(document).ready(function (data) {
    table=$('#invoice').dataTable( {
                     "dom": 'Bfrtip',
                     "pagelength":100,
                     "lengthMenu": [[50, 200, 500, 1000, -1], [50, 200, 500, 1000, "All"]] ,
       "buttons": [
            {
                extend: 'print',
                title:'',
                customize: function ( win ) {
                    $(win.document.body)
                        .css( 'font-size', '10pt' )
                        .css('margin','0px')
               
                    $(win.document.body).find( 'thead' )
                        .prepend(
                            '<th colspan=10><img src="<?php echo SITEURL;?>/assets/images/print-header-report.png" style="width:110%;" /></th>'
                        )
                        
                        .addClass( 'compact' )
                        .css( 'font-size', 'inherit' );
                
                }
            }
        ],
      
  "sAjaxDataProp":"",
             "stateSave": false,
/*    

  "processing": true,
        "serverSide": true, */   
          "paging":   false,
        
                    "ajax": "addDealers.php?viewaging2=1",
         "columns": [
           { "data": "Id" },
           { "data": "CustomerName" },
           { "data": "OpeningBalance" },
           { "data": "Due" },
           { "data": "Received" },
           { "data": "0-30" },
           { "data": "30-60" },
           { "data": "60-90" },
           { "data": "Balance" }

        ]
//b60days
        

    } );
          $("#searchForm input").keyup( function () {
            var index = $(this).attr('index');
            table.fnFilter(this.value, index);
        });


    /* dataTable.fnSetColumnVis(0,false);
     dataTable.fnSetColumnVis(3,false);
     dataTable.fnSetColumnVis(9,false);

            { "data": "LedgerID" },
           { "data": "EndDate" },
           { "data": "TotalDue" },
           { "data": "TotalReceived" },
           { "data": "Due" },
           { "data": "Received" },
           { "data": "OpeningBalance" },
           { "data": "Balance" },
           { "data": "90-Plus" },
           { "data": "60-90" },
           { "data": "30-60" },
           { "data": "0-30" },
           { "data": "d-90-Plus1" },
           { "data": "d-60-901" },
           { "data": "d-30-601" },
           { "data": "d-0-301" },
           { "data": "CustomerName" },
           { "data": "Address1" },
           { "data": "Address2" },
           { "data": "Address3" },
           { "data": "NameAndAddress" },
*/


   /*  $('#example').DataTable( {
"bProcessing": true,
"sAjaxDataProp":"",
"bServerSide": true,
        "ajax": 'addDealers.php?view=dealers',
        "columns": [
            { "data": "COAName" },
            { "data": "Attr4" },
            { "data": "Attr10" },
            { "data": "Attr11" },
            { "data": "Attr15" }
        ]
    } );*/


} );
$(document).on("click",".edit1",function(){
    //alert('call');
//table.ajax.reload();
var data=$(this).parent().parent().parent().find("td").eq(0).html();
//alert('called edit'+data);
data='id='+data;
$.ajax({
            type:'GET',
            url:'ajaxdata.php',
            data:data,
            success: function(data)
            {
            //alert(data);
            var myObj = JSON.parse(data);
    $("#dealer").val(myObj[0].COAID);
    $("#visitdate").val(myObj[0].visitdate);
          //  alert(myObj[0].newappoint);
    if(myObj[0].newappoint==1)
    {
        $("#appointarrange1").attr("checked",true);
            }
            else
            {
         $("#appointarrange0").attr("checked",true);      
            }
    
    $("#appointdate").val(myObj[0].appointdate);
    $("#additional_info").val(myObj[0].additional_info);
    $("#contactperson1").val(myObj[0].contact_person);
    $("#contactTypeId").val(myObj[0].contactTypeId);
    $("#TypeContactId").val(myObj[0].TypeContactId);
    $("#customerCategoryId").val(myObj[0].customerCategoryId);
    $("#discuss").val(myObj[0].discuss);
    $("#feedback").val(myObj[0].feedback);
    $("#notes").val(myObj[0].notes);
    $("#managernotes").val(myObj[0].managernotes);
$("#visitid").val(myObj[0].id);
$("#submit").html("update");
$("#submit").attr('name',"update");
$("#basic-tab").click();
}
});

});
$(document).on("click","#supplier-tabs",function(){
    //alert('call');
//table.ajax.reload();
});


    </script>