File manager - Edit - /home/autoph/public_html/connectv1/import_log.php
Back
<?php include('cfg/db.php'); include('app/security/security.php'); if(!isset($_SESSION['user']['id'])){ header('location:signin.php'); } $filename_sd = $_GET['file']; // $check_page = new CheckPage(); // $check_page->start($db); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo $variable['site_name']; ?> | Import</title> <!-- Google Font: Source Sans Pro --> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback"> <!-- Font Awesome --> <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css"> <!-- Theme style --> <link rel="stylesheet" href="dist/css/adminlte.min.css"> <!-- overlayScrollbars --> <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css"> <!-- Select2 --> <link rel="stylesheet" href="plugins/select2/css/select2.min.css"> <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css"> <!-- DataTables --> <link rel="stylesheet" href="plugins/datatables-bs4/css/dataTables.bootstrap4.min.css"> <link rel="stylesheet" href="plugins/datatables-responsive/css/responsive.bootstrap4.min.css"> <link rel="stylesheet" href="plugins/datatables-buttons/css/buttons.bootstrap4.min.css"> <link href="plugins/bootstrap-table/css/bootstrap-table.min.css" rel="stylesheet"> <link href="dist/img/<?php echo $variable['logo']; ?>" rel="icon" /> <style> .form-group { margin-bottom: 0.5rem; } </style> </head> <body class="hold-transition sidebar-mini text-sm layout-fixed"> <div class="wrapper"> <!-- INCLUDE HEADER --> <?php include('include/header.php'); ?> <?php include('include/sidebar.php'); ?> <!-- /.navbar --> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <div class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> <h1 class="m-0">Import Data</h1> </div><!-- /.col --> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="home.php">Home</a></li> <li class="breadcrumb-item active">Import Data</li> </ol> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.container-fluid --> </div> <!-- /.content-header --> <!-- Main content --> <section class="content"> <div class="container-fluid"> <div class="row"> <!-- left column --> <div class="col-md"> <!-- general form elements --> <div class="card card-primary" id="my-card"> <div class="card-header"> <h3 class="card-title">Choose Spreadsheet File</h3> </div> <!-- /.card-header --> <div class="overlay" id="loader" style="display:none;"> <div class="fas fa-2x fa-sync-alt fa-spin "> </div> <strong><span class="ml-2" id="loading-message"> Importing, please wait...</span></strong> </div> <!-- form start <form method="post" id="import_excel_form" enctype="multipart/form-data"> --> <form id="upload_form" enctype="multipart/form-data" > <div class="card-body"> <div class="row "> <div class="col-sm-6"> <div class="form-group dropdown-input"> <label class="dropdown" hidden >DMS</label> <select name="dms-type" id="dms-type" class="form-control form-control-sm select2" style="width: 100%;"> <option disabled selected>Select DMS</option> <?php $dms = $db -> return_result("SELECT `id`, `name` FROM `source_dms` WHERE status=1 ORDER BY name ASC"); foreach($dms as $data){ echo "<option value='{$data['id']}'>".$data['name']."</option>"; } ?> </select> </div> </div> <div class="col-sm-6"> <div class="form-group dropdown-input"> <label class="dropdown" hidden >Database Type</label> <select name="db-type" id="db-type" class="form-control form-control-sm select2" style="width: 100%;"> <option disabled selected>Select Database Type</option> <?php $db_type = $db -> return_result("SELECT `id`, `name` FROM `source_dms_type` WHERE `status` = 1 ORDER BY name ASC"); foreach($db_type as $data){ echo "<option value='{$data['id']}'>".$data['name']."</option>"; } ?> </select> </div> </div> </div> <div class="row "> <div class="col-sm-6"> <div class="form-group dropdown-input "> <label class="dropdown" hidden >Company</label> <select name="company" id="company" class="form-control form-control-sm report-field select3" style="width: 100%;"> <option disabled selected>Select Company</option> <?php // $company = $db -> return_result("SELECT sc.id,sc.name FROM `source_company` sc // INNER JOIN source_company_dealer scd // ON sc.id = scd.company_id // WHERE type = 1 // AND sc.status = 1 // GROUP BY sc.id // ORDER BY sc.name ASC"); // foreach($company as $data){ // echo "<option value='{$data['id']}'>".$data['name']."</option>"; // } ?> </select> </div> </div> <div class="col-sm-6"> <div class="form-group dropdown-input " > <label class="dropdown" hidden >Dealer</label> <select name="dealer" id="dealer" class="form-control form-control-sm report-field select4" style="width: 100%;"> <option disabled selected>Select Dealer</option> </select> </select> </div> </div> </div> <!-- ./row --> <div class="row"> <div class="col-sm-11 text-left"> <div class="form-group"> <!-- <label for="import_excel">Choose Spreadsheet File</label> --> <div class="input-group"> <div class="custom-file"> <input type="file" class="custom-file-input" id="import_excel" name="import_excel" accept=".xls,.xlsx,.csv" /> <label id="import_excel_label" class="custom-file-label" for="import_excel">Choose file</label> </div> </div> </div> </div> <!-- style="position:relative; z-index:9999" --> <div class="col-sm-1 text-right"> <div id="submit-div" > <button type="submit" name="submit" id="submit" class="btn btn-primary">Import</button> </div> </div> </div> <div class="alert " role="alert" id="error-alert" style="display:;"> <span id="error-icon" class="icon fas"> </span> <span id="alert-message"> Please Select File.</span></a> </div> </div> <!-- /.card-body --> <div class="container-fluid " id="summary-report" style="display:;"> <div class="card mr-4 ml-4 card-primary"> <div class="card-header"> <div> <h3 class="card-title">Importing Summary</h3> </div> <div class=" text-right" hidden > <span id="save-report" style="cursor:pointer; font-weight:bold" ><a id="report-link">SAVE</a></span> </div> </div> <!-- /.card-header --> <div class="card-body p-1"> <table data-show-export="true" class="table table-striped table-sm " id="summaryTable"> <thead> <tr> <th></th> <th class="text-center" style="width: 150px"></th> </tr> </thead> <tbody> </tbody> </table> </div> <!-- /.card-body --> </div> </div> <div class="card mt-4 mr-4 ml-4 card-danger" id="invalid-report" style="display:;"> <div class="card-header"> <h3 class="card-title">Issues</h3> </div> <!-- /.card-header --> <div class="card-body p-1"> <table id="example2" class="table table-bordered table-hover"> <thead> <tr> <th></th> <th></th> <th></th> </tr> </thead> <tbody> </tbody> </table> </div> <!-- /.card-body --> </div> </form> </div> <!-- /.card --> </div><!-- /.col-md --> </div> <!-- row --> <!-- /.control-sidebar --> </div><!-- container fluid --> <!-- ./wrapper --> </section><!-- content --> </div><!-- content wrapper --> <!-- INSERT FOOTER --> <?php include('include/footer.php'); ?> <!-- Control Sidebar --> <aside class="control-sidebar control-sidebar-dark"> <!-- Control sidebar content goes here --> </aside> </div><!-- wrapper --> <div id="copyDiv"></div> <!-- jQuery --> <script src="plugins/jquery/jquery.min.js"></script> <!-- Bootstrap 4 --> <script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script> <!-- bs-custom-file-input --> <script src="plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script> <!-- AdminLTE App --> <script src="dist/js/adminlte.min.js"></script> <!-- AdminLTE for demo purposes --> <script src="dist/js/demo.js"></script> <!-- Select2 --> <script src="plugins/select2/js/select2.full.min.js"></script> <!-- DataTables & Plugins --> <script src="plugins/datatables/jquery.dataTables.min.js"></script> <script src="plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script> <script src="plugins/datatables-responsive/js/dataTables.responsive.min.js"></script> <script src="plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script> <script src="plugins/datatables-buttons/js/dataTables.buttons.min.js"></script> <script src="plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script> <script src="plugins/jszip/jszip.min.js"></script> <script src="plugins/pdfmake/pdfmake.min.js"></script> <script src="plugins/pdfmake/vfs_fonts.js"></script> <script src="plugins/datatables-buttons/js/buttons.html5.min.js"></script> <script src="plugins/datatables-buttons/js/buttons.print.min.js"></script> <script src="plugins/datatables-buttons/js/buttons.colVis.min.js"></script> <script src="plugins/bootstrap-table/js/tableExport.min.js"></script> <script src="plugins/bootstrap-table/js/bootstrap-table.min.js"></script> <script src="plugins/bootstrap-table/js/bootstrap-table-en-US.js"></script> <script src="plugins/bootstrap-table/js/bootstrap-table-export.min.js"></script> <!-- html2canvas --> <!-- <script src="dist/js/html2canvas.js"></script> --> <!-- <script src="node_modules/html2canvas/dist/html2canvas.js"></script> --> <!-- <script src="node_modules/xlsx/dist/xlsx.core.min.js"></script> <script src="node_modules/file-saverjs/FileSaver.js"></script> <script src="node_modules/tableexport/dist/js/tableexport.js"></script> --> <!-- <script src="dist/js/jquery.table2excel.js"></script> --> <!-- <script src="https://cdn.jsdelivr.net/gh/linways/table-to-excel@v1.0.4/dist/tableToExcel.js"></script> --> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/TableExport/5.2.0/js/tableexport.min.js" integrity="sha512-XmZS54be9JGMZjf+zk61JZaLZyjTRgs41JLSmx5QlIP5F+sSGIyzD2eJyxD4K6kGGr7AsVhaitzZ2WTfzpsQzg==" crossorigin="anonymous"></script> --> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js" integrity="sha512-csNcFYJniKjJxRWRV1R7fvnXrycHP6qDR21mgz1ZP55xY5d+aHLfo9/FcGDQLfn2IfngbAHd8LdfsagcCqgTcQ==" crossorigin="anonymous"></script> --> <!-- Navigation Highlight --> <script src="dist/js/main.js"></script> <script> $(function () { bsCustomFileInput.init(); }); </script> <script> $(function () { $("#example1").DataTable({ "responsive": true, "lengthChange": false, "autoWidth": false, "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"] }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)'); // $('#example2').DataTable({ // "paging": true, // "lengthChange": false, // "searching": false, // "ordering": true, // "info": true, // "autoWidth": false, // "responsive": true, // "lengthMenu": [ // [5, 50, 100, -1], // [5, 50, 100, "All"] // ], "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"] // }).buttons().container().appendTo('#example2_wrapper .col-md-6:eq(0)'); }); </script> <script> $("#upload_form").submit(function(event){ event.preventDefault(); remove_alert_bg(); var dms_type = $("#dms-type").val(); var db_type = $("#db-type").val(); var company_id = $("#company").val(); var dealer_id = $("#dealer").val(); // if(company_id == null || dealer_id == null || dms_type == null || db_type == null ){ // $('#error-icon').addClass("fa-ban"); // $('#error-alert').addClass("alert-danger"); // if(dms_type == null){ // $('#alert-message').text('Select DMS Type'); // } else if(db_type == null){ // $('#alert-message').text('Select Database Type'); // }else if(company_id == null){ // $('#alert-message').text('Select Company'); // }else if(dealer_id == null){ // $('#alert-message').text('Select Dealer'); // } // $('#error-alert').fadeIn(); // setTimeout(function () { $('#error-alert').fadeOut()}, 3000); // return; // } $('#error-icon').addClass("fa-info"); $('#error-alert').addClass("alert-info"); $('#summary-report').fadeOut(); $('#invalid-report').fadeOut(); $('#error-alert').fadeIn(); $('#alert-message').text(" Importing please wait..."); var name = '<?php echo $filename_sd; ?>' $.ajax({ url: "app/upload/logs/"+name, /*data: $('#upload_form').serialize()*/ data:new FormData(this), type: "POST", dataType: 'json', contentType:false, cache:false, processData:false, beforeSend:function(){ $('#loader').fadeIn(); $('#submit').attr('disabled', true); }, success: function (result) { console.log(result.status + " " + result.message); if (result.status!=1) { remove_alert_bg(); $('#error-icon').addClass("fa-ban"); $('#error-alert').addClass("alert-danger"); $('#alert-message').text(result.message); //setTimeout(function () { $('#error-alert').fadeOut()}, 3000); }else{ $('#error-alert').fadeOut(); // remove_alert_bg(); // $('#error-icon').addClass("fa-check"); // $('#error-alert').addClass("alert-success"); // $('#alert-message').text(result.message); var summary_table = $('#summaryTable').DataTable(); summary_table.destroy(); var issue_table = $('#example2').DataTable(); issue_table.destroy(); $('#summaryTable > tbody').html(''); $('#summaryTable').find('tbody').append(" <tr> <td>Company</td> <td class='text-center'><h5><span class='badge bg-primary' id='summary-company'></span></h5></td> </tr> <tr> <td>Dealer</td> <td class='text-center'><h5><span class='badge bg-primary' id='summary-dealer'></span></h5></td> </tr> <tr> <td>Source DMS</td> <td class='text-center'><h5><span class='badge ' id='summary-dms'></span></h5></td> </tr> <tr> <td>Database Type</td> <td class='text-center'><h5><span class='badge ' id='summary-db'></span></h5></td> </tr>"); if(result.selected_dms_name == 'Unknown'){ $('#summary-dms').removeClass("bg-primary"); $('#summary-dms').addClass("bg-danger"); }else{ $('#summary-dms').removeClass("bg-danger"); $('#summary-dms').addClass("bg-primary"); } if(result.selected_dms_type == 'Unknown'){ $('#summary-db').removeClass("bg-primary"); $('#summary-db').addClass("bg-danger"); }else{ $('#summary-db').removeClass("bg-danger"); $('#summary-db').addClass("bg-primary"); } $('#summary-report').fadeIn(); $('#summary-company').text(company.options[company.selectedIndex].text); $('#summary-dealer').text(dealer.options[dealer.selectedIndex].text); $('#summary-dms').text(result.selected_dms_name); $('#summary-db').text(result.selected_dms_type); // $('#summary-valid').text(result.valid_data); // $('#summary-invalid').text(result.invalid_data); $('#summaryTable').find('tbody').append(result.data_count_list); initSummaryTable(); if(result.invalid_data_list != '' || result.show_error > 0){ $('#invalid-report').fadeIn(); var columns = [ { data: 'id', title: 'Data' }, { data: 'type', title: 'Type' }, { data: 'problem', title: 'Problem' } ]; var table = $('#example2').DataTable({ initComplete : function() { // $('#invalid-report .buttons-csv').click() }, // data:information, data:result.invalid_data_list, columns:columns, columnDefs: [ { type: 'natural-nohtml', targets: 0 } ], "paging": true, "lengthChange": false, "searching": false, // "destroy": true, "ordering": true, "info": true, "autoWidth": false, "responsive": true, "lengthMenu": [ [5, 50, 100, -1], [5, 50, 100, "All"] ], "buttons": [ {extend: 'csv', text : 'CSV', filename: function(){ var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, ''); return filename+'_issues'; }} , {extend: 'excel', text : 'Excel', filename: function(){ var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, ''); return filename+'_issues'; }} , {extend: 'pdf', text : 'PDF', filename: function(){ var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, ''); return filename+'_issues'; }} , "print", ] }).buttons().container().appendTo('#example2_wrapper .col-md-6:eq(0)'); } } // $('#import_excel').val('') // $("#import_excel_label").text("Choose file"); $('#submit').attr('disabled', false); $('#loader').fadeOut(); }, error: handleError }); }); (function() { /* * Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license * Author: Jim Palmer (based on chunking idea from Dave Koelle) * Contributors: Mike Grier (mgrier.com), Clint Priest, Kyle Adams, guillermo * See: http://js-naturalsort.googlecode.com/svn/trunk/naturalSort.js */ function naturalSort (a, b, html) { var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?%?$|^0x[0-9a-f]+$|[0-9]+)/gi, sre = /(^[ ]*|[ ]*$)/g, dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, hre = /^0x[0-9a-f]+$/i, ore = /^0/, htmre = /(<([^>]+)>)/ig, // convert all to strings and trim() x = a.toString().replace(sre, '') || '', y = b.toString().replace(sre, '') || ''; // remove html from strings if desired if (!html) { x = x.replace(htmre, ''); y = y.replace(htmre, ''); } // chunk/tokenize var xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'), yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'), // numeric, hex or date detection xD = parseInt(x.match(hre), 10) || (xN.length !== 1 && x.match(dre) && Date.parse(x)), yD = parseInt(y.match(hre), 10) || xD && y.match(dre) && Date.parse(y) || null; // first try and sort Hex codes or Dates if (yD) { if ( xD < yD ) { return -1; } else if ( xD > yD ) { return 1; } } // natural sorting through split numeric strings and default strings for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) { // find floats not starting with '0', string or 0 if not defined (Clint Priest) var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc], 10) || xN[cLoc] || 0; var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc], 10) || yN[cLoc] || 0; // handle numeric vs string comparison - number < string - (Kyle Adams) if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { return (isNaN(oFxNcL)) ? 1 : -1; } // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2' else if (typeof oFxNcL !== typeof oFyNcL) { oFxNcL += ''; oFyNcL += ''; } if (oFxNcL < oFyNcL) { return -1; } if (oFxNcL > oFyNcL) { return 1; } } return 0; } jQuery.extend( jQuery.fn.dataTableExt.oSort, { "natural-asc": function ( a, b ) { return naturalSort(a,b,true); }, "natural-desc": function ( a, b ) { return naturalSort(a,b,true) * -1; }, "natural-nohtml-asc": function( a, b ) { return naturalSort(a,b,false); }, "natural-nohtml-desc": function( a, b ) { return naturalSort(a,b,false) * -1; }, "natural-ci-asc": function( a, b ) { a = a.toString().toLowerCase(); b = b.toString().toLowerCase(); return naturalSort(a,b,true); }, "natural-ci-desc": function( a, b ) { a = a.toString().toLowerCase(); b = b.toString().toLowerCase(); return naturalSort(a,b,true) * -1; } } ); }()); function handleError(xhr, status, error){ //Handle failure here $('#loader').fadeOut(); remove_alert_bg(); $('#error-icon').addClass("fa-ban"); $('#error-alert').addClass("alert-danger"); $('#alert-message').text("Invalid Spreadsheet file. Contact your system administrator."); $('#submit').attr('disabled', false); // $('#import_excel').val('') // $("#import_excel_label").text("Choose file"); } function remove_alert_bg(){ $('#error-alert').removeClass("alert-success"); $('#error-alert').removeClass("alert-danger"); $('#error-alert').removeClass("alert-info"); $('#error-icon').removeClass("fa-check"); $('#error-icon').removeClass("fa-info"); $('#error-icon').removeClass("fa-ban"); } function initSummaryTable(){ var columns = [ { data: '1', title: '' }, { data: '2', title: '' } ]; var table = $('#summaryTable').DataTable({ initComplete : function() { // $('#summaryTable_wrapper .buttons-csv').click() }, columns:columns, "paging": false, "lengthChange": false, "searching": false, "ordering": false, // "destroy": true, "info": false, "autoWidth": false, "responsive": true, "lengthMenu": [ [5, 50, 100, -1], [5, 50, 100, "All"] ], "buttons": [ {extend: 'csv', text : 'CSV', filename: function(){ var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, ''); return filename+'_summary'; }} , {extend: 'excel', text : 'Excel', filename: function(){ var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, ''); return filename+'_summary'; }} , {extend: 'pdf', text : 'PDF', filename: function(){ var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, ''); return filename+'_summary'; }} , "print", ] }).buttons().container().appendTo('#summaryTable_wrapper .col-md-6:eq(0)'); } </script> <script> // $(document).ready(function() { // var company_id = $("#company").val(); // $.ajax({ // url:"app/misc/get_dealer.php", // method:"POST", // data: { // company_id: company_id,type:1 // }, // cache:false, // beforeSend:function(){ // $('#dealer').attr('disabled', true); // }, // success:function(data) // { // $("#dealer").html('<option disabled selected>Select Dealer</option>'+data); // $('#dealer').attr('disabled', false); // } // }) // }); </script> <script> // $(document).ready(function(){ // $('#company').on('change', function(event){ // event.preventDefault(); // var company_id = this.value; // $.ajax({ // url:"app/misc/get_dealer.php", // method:"POST", // data: { // company_id: company_id,type:1 // }, // cache:false, // beforeSend:function(){ // $('#dealer').attr('disabled', true); // }, // success:function(data) // { // $("#dealer").html('<option disabled selected>Select Dealer</option>'+data); // $('#dealer').attr('disabled', false); // } // }) // }); // }); </script> <!-- Page specific script --> <script> $(function () { $('.select3').select2({ "language": { "noResults": function() { return 'Enter company name or code'; } }, escapeMarkup: function (markup) { return markup; }, placeholder: 'Search company name or code', ajax: { url: 'app/misc/get_company.php', dataType: 'json', delay: 250, data: function (data) { return { searchTerm: data.term, // search term type:1 }; }, processResults: function (response) { return { results:response }; }, cache: true } }); }) $('#company').on('select2:select', function (e) { var company_id = $("#company").val(); // var dealer_id = $("#dealer").val(); // alert(company_id) $('.select4').select2({ "language": { "noResults": function() { return 'Enter dealer name or code'; } }, escapeMarkup: function (markup) { return markup; }, placeholder: 'Search dealer name or code', ajax: { url: 'app/misc/get_dealer_customer.php', dataType: 'json', delay: 250, data: function (data) { return { searchTerm: data.term, // search term type:1, import:1, company_id:company_id }; }, processResults: function (response) { return { results:response }; }, cache: true } }); $("#dealer").html('<option disabled selected>Select Dealer</option>'); }); </script> <script> // function initTableSumary() { // var $table = $('#summaryTable') // $table.bootstrapTable('destroy').bootstrapTable({ // }) // } // $(function() { // // initTableSumary() // }) const capture = () => { $('.buttons-csv').click() // var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, '')+'_summary'; // $("#summaryTable").tableExport({ // headers: true, // (Boolean), display table headers (th or td elements) in the <thead>, (default: true) // footers: true, // (Boolean), display table footers (th or td elements) in the <tfoot>, (default: false) // formats: ["xlsx"], // (String[]), filetype(s) for the export, (default: ['xlsx', 'csv', 'txt']) // filename: filename, // (id, String), filename for the downloaded file, (default: 'id') // bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true) // exportButtons: true, // (Boolean), automatically generate the built-in export buttons for each of the specified formats (default: true) // position: "bottom", // (top, bottom), position of the caption element relative to table, (default: 'bottom') // ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file(s) (default: null) // ignoreCols: null, // (Number, Number[]), column indices to exclude from the exported file(s) (default: null) // trimWhitespace: true, // (Boolean), remove all leading/trailing newlines, spaces, and tabs from cell text in the exported file(s) (default: false) // RTL: false, // (Boolean), set direction of the worksheet to right-to-left (default: false) // sheetname: "Summary" // (id, String), sheet name for the exported spreadsheet, (default: 'id') // }); // let table = document.getElementsByTagName("table"); // TableToExcel.convert(table[0], { // html code may contain multiple tables so here we are refering to 1st table tag // name: `export.xlsx`, // fileName you could use any name // sheet: { // name: 'Sheet 1' // sheetName // } // }); // var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, '')+'_summary'; // filename = filename.replace(/\./g,'_'); // // alert(filename);return; // $("#summaryTable").table2excel({ // name:"Summary", // filename:filename,//do not include extension // fileext:".xls" // file extension // }); // var convertMeToImg = $('#summary-report')[0]; // html2canvas(convertMeToImg).then(function(canvas) { // $('#copyDiv').append(canvas); // }); // const body = document.querySelector('body'); // body.id = 'capture'; // html2canvas(document.querySelector("#capture")).then(canvas => { // document.body.appendChild(canvas); // }).then(() => { // var canvas = document.querySelector('canvas'); // canvas.style.display = 'none'; // var image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); // var a = document.createElement("a"); // var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, '')+'_summary.png'; // a.setAttribute('download', filename); // a.setAttribute('href', image); // a.click(); // }); }; const btn = document.getElementById('save-report'); btn.addEventListener('click', capture) // function saveImg(){ // window.scrollTo(0, 0); // // Convert the div to image (canvas) // html2canvas(document.getElementById("summary-report")).then(function (canvas) { // // Get the image data as JPEG and 0.9 quality (0.0 - 1.0) // // console.log(canvas.toDataURL("image/jpeg", 0.9)); // var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, '')+'_summary.png'; // var link = document.getElementById('report-link'); // link.setAttribute('download', filename); // link.setAttribute('href', canvas.toDataURL("image/png").replace("image/png", "image/octet-stream")); // link.click(); // }); // } </script> </body> </html>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings