EVOLUTION-NINJA
Edit File: labour_user_epiduralLA_v.php
<?php echo view('includes/labour-user-reports-header'); ?> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css"> <div class="col-sm-9"> <div class="reports-right pt-4"> <input id="save-pdf" type="button" value="Save as PDF" /> <div id="chart_div"></div> <div class="col-sm-9" id="reports-pdf"> <h3 class="mt-2 mb-3 pt-2 txt-center"><u>Labour Reports</u></h3> <h3 class="mt-4 pt-2">LA Utilisation - Epidural Space LA </h3> <br/> <div class="row"> <div class="col-sm-6"> <div class="report-detail-tag"> <h4 class="mb-4">Report Details</h4> <h5>From Date : <span id="from_date"><?php echo date( 'd-m-Y', strtotime(session()->get('l_from_date')) ); ?></span></h5> <h5>To Date : <span id="to_date"><?php echo date( 'd-m-Y', strtotime(session()->get('l_to_date')) ); ?></span></h5> <h5>Reported by :<span id="reported_by"><?php $name = session()->get('l_name'); if ( substr($name, 0, 3) === 'Dr. ' || substr($name, 0, 3) === 'Dr ' ) { echo session()->get('l_name'); } else { echo 'Dr. ' . session()->get('name'); } ?></span></h5> </div> </div> <div class="col-sm-6"></div> </div> <div class="row" id="demo-table"> <div class="col-sm-7"> <div class="table-responsive"> <?php if($total_n == 0){ ?> <h4>No Data Found</h4> <?php die(); } ?> <h5 class="mt-4"><strong>Plain Local Anasthesia Solution (Without Adrenaline)</strong></h5> <!-- <h4>Total cases with data = <?php echo $total_n; ?></h4> --> <?php if ($total_n == 0) { return; } ?> <h4>Total cases with data = <?php echo $total_n; ?></h4> <table class="table table-bordered" id="mytable"> <thead> <tr> <th>Plain Local Anasthesia Solution</th> <th>n</th> <th>Percentage</th> </tr> </thead> <tbody> <?php foreach ($products as $row) { ?> <tr> <td id="report-td-bg"><p> <?php echo $row['day']; ?></p> </td> <td><p> <?php echo $row['sell']; ?></p> </td> <td><p> <?php if ($total_n != 0) { $number = ($row['sell'] / $total_n) * 100; echo number_format((float) $number, 1, '.', '') . '%'; } else { echo '0%'; } ?> </p></td> </tr> <?php } ?> </tbody> </table> </div> </div> <div class="col-sm-5"> <div id="GoogleLineChart" style="height: 400px; width: 100%"></div> </div> </div> <!-- <div class="row"> <div class="col-sm-5"> <div id="GoogleBarChart" style="height: 400px; width: 100%"></div> </div> </div> --> <br/> </div> <div class="col-sm-9"> <div class="row" id="demo-table"> <h5 class="mt-4"><strong>Local Anasthesia Solution with Adrenaline</strong></h5> <!-- <h5>Local Anasthesia Solution with Adrenaline</h5> --> <div class="col-sm-7"> <div class="table-responsive"> <h4>Total cases with data = <?php echo $total_n1; ?></h4> <?php if ($total_n1 == 0) { return; } ?> <table class="table table-bordered" id="mytable"> <thead> <tr> <th>Local Anasthesia Solution with Adrenaline</th> <th>n</th> <th>Percentage</th> </tr> </thead> <tbody> <?php foreach ($products1 as $row) { ?> <tr> <td id="report-td-bg"><p> <?php echo $row['day']; ?></p> </td> <td><p> <?php echo $row['sell']; ?></p> </td> <td><p> <?php if($total_n1 == 0){ echo '0%'; } else{ $number = (($row['sell'] / $total_n1) * 100); echo number_format((float) $number, 1, '.', '') . '%'; } ?> </p></td> </tr> <?php } ?> </tbody> </table> </div> </div> <!-- <div class="col-sm-4"></div> --> <div class="col-sm-5"> <div id="GoogleLineChart1" style="height: 400px; width: 100%"></div> </div> <!-- <div class="col-sm-5"> <div id="GoogleBarChart1" style="height: 400px; width: 100%"></div> </div> --> <br/> </div> </div> </div> <div class="col-sm-9"> <div class="reports-right pt-4"> <div id="chart_div"></div> <br/> <div class="row" id="demo-table"> <div class="col-sm-5"> <div class="table-responsive"> <h4>Total Combo = <?php echo $total_combo; ?></h4> <table class="table table-bordered" id="mytable"> <thead> <tr> <th>characteristics</th> <th>n</th> <th>Percentage</th> </tr> </thead> <tbody> <?php foreach($products_combo as $row){ ?> <tr> <td id="report-td-bg"><p> <?php echo $row['day']; ?></p> </td> <td><p> <?php echo $row['sell']; ?></p> </td> <td><p> <?php if($total_n1 == 0){ echo '0%'; } else{ $number = (($row['sell']/$total_combo)*100); echo number_format((float)$number, 1, '.', '')."%"; } ?> </p></td> </tr> <?php } ?> </tbody> </table> <br/> </div> </div> </div> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.min.js"></script> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script> <script> google.load('visualization', '1.0', {'packages':['corechart']}); google.charts.load('current', {'packages':['corechart', 'bar','table']}); google.charts.setOnLoadCallback(drawChart); // Line Chart function drawChart() { var data1 = google.visualization.arrayToDataTable([ ['Characteristics', 'Stats'], <?php echo "['Total number of cases recorded with minimum data set','N’'],"; echo "['Total number of cases with complete entry','Nc'],"; ?> ]); var data = google.visualization.arrayToDataTable([ ['Characteristics', 'Count'], <?php foreach ($products as $row) { echo "['" . $row['day'] . "'," . $row['sell'] . '],'; } ?> ]); var options = { title: 'Epidural LA Classification', curveType: 'function', legend: { position: 'top' } }; var pie_chart = new google.visualization.ColumnChart(document.getElementById('GoogleLineChart')); pie_chart.draw(data, options); var column_chart = new google.visualization.ColumnChart(document.getElementById('GoogleBarChart')); column_chart.draw(data, options); } </script> <script> google.load('visualization', '1.0', {'packages':['corechart']}); google.charts.load('current', {'packages':['corechart', 'bar','table']}); google.charts.setOnLoadCallback(drawChart); // Line Chart function drawChart() { var data11 = google.visualization.arrayToDataTable([ ['Epidural LA without adrenaline', 'Count'], <?php foreach ($products1 as $row) { echo "['" . $row['day'] . "'," . $row['sell'] . '],'; } ?> ]); var options = { title: 'Epidural LA without adrenaline Classification', curveType: 'function', legend: { position: 'top' } }; var pie_chart1 = new google.visualization.ColumnChart(document.getElementById('GoogleLineChart1')); pie_chart1.draw(data11, options); var column_chart1 = new google.visualization.ColumnChart(document.getElementById('GoogleBarChart1')); column_chart1.draw(data11, options); } var btnSave = document.getElementById('save-pdf'); btnSave.disabled = false; btnSave.addEventListener('click', function () { var doc = new jsPDF(); html2canvas($('#reports-pdf').get(0)).then(function(canvas) { // export pdf var pdfDoc = new jsPDF({ orientation: 'potrait', unit: 'px', format: [canvas.width, canvas.height] }); pdfDoc.addImage(canvas.toDataURL('image/png'), 0, 0); pdfDoc.save('epiduralLA.pdf'); }); //doc.addImage(pie_chart.getImageURI(),0,0); //doc.addImage(column_chart.getImageURI(),0,0); //doc.save('Surgical_location.pdf'); }, false); </script> <?php echo view('includes/labour-user-reports-footer'); ?>