EVOLUTION-NINJA
Edit File: obstetric_severity_rating_experience.php
<?php echo view('includes/obstetric-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><br /> <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-2 pt-2">Feedback - Severity Rating of Experience</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('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-10"> <!-- --> <div class="table-responsive" id="demo-table"> <?php if ($total == 0) { ?> <h4>No Data Found</h4> <?php die(); } ?> <h4>Total cases with data = <?php echo $total;?></h4> <table class="table table-bordered"> <thead> <tr> <th>Experience (n)</th> <th>NO</th> <th>MILD</th> <th>MODERATE</th> <th>SEVERE</th> </tr> </thead> <tbody> <?php foreach($products as $row){ ?> <tr> <td id="report-td-bg"><p> <?php echo $row['name']; ?></p> </td> <td><p> <?php echo $row['No_count'] . " (" . number_format((float) (($row['No_count'] / $total) * 100), 1, '.', '') . "%)" ; ?></p> </td> <td><p> <?php echo $row['mild_count']. " (" . number_format((float) (($row['mild_count'] / $total) * 100), 1, '.', '') . "%)"; ?></p> </td> <td><p> <?php echo $row['moderate_count']. " (" . number_format((float) (($row['moderate_count'] / $total) * 100), 1, '.', '') . "%)"; ?></p> </td> <td><p> <?php echo $row['severe_count']. " (" . number_format((float) (($row['severe_count'] / $total) * 100), 1, '.', '') . "%)"; ?></p> </td> </tr> <?php } ?> </tbody> </table> </div> </div> <div class="col-sm-2"></div> </div> <div class="row"> <div class="col-sm-6"> <div id="drowsiness_GoogleLineChart" style="height: 400px; width: 100%"></div> </div> <!-- <div class="col-sm-6"> <div id="pain_at_surgery_GoogleLineChart" style="height: 400px; width: 100%"></div> </div> </div> --> <div class="row"> <div class="col-sm-6"> <div id="thirst_GoogleLineChart" style="height: 400px; width: 100%"></div> </div> <!-- <div class="col-sm-6"> <div id="hoarseness_GoogleLineChart" style="height: 400px; width: 100%"></div> </div> </div> <div class="row"> <div class="col-sm-6"> <div id="sore_throat_GoogleLineChart" style="height: 400px; width: 100%"></div> </div> --> <div class="col-sm-6"> <div id="nausea_vomiting_GoogleLineChart" style="height: 400px; width: 100%"></div> </div> </div> <div class="row"> <div class="col-sm-6"> <div id="feeling_cold_GoogleLineChart" style="height: 400px; width: 100%"></div> </div> <div class="col-sm-6"> <div id="confusion_disorientation_GoogleLineChart" style="height: 400px; width: 100%"></div> </div> </div> <div class="row"> <div class="col-sm-6"> <div id="backpain_GoogleLineChart" style="height: 400px; width: 100%"></div> </div> <div class="col-sm-6"> <div id="shivering_GoogleLineChart" style="height: 400px; width: 100%"></div> </div> </div> <!-- <div class="col-sm-2"></div> --> </div><!--row---> <br/> <!--------------------------------------------------------------------> <!--------------------------------------------------------------------> <!--------------------------------------------------------------------> </div> </div> </div> </div> </section> <!---------------- Menu Drodown ---------------------> <script type = "text/javascript"> </script> <script type="text/javascript"> jQuery(document).ready(function($) { $('.mobimenu li.dropdown').hover(function() { $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500); }, function() { $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(500); }); }); </script> <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() { //////////////////////////////index 0////////////////////// var data1 = google.visualization.arrayToDataTable([ ['ASA', 'Count'], <?php echo "['No',".$products[0]['No_count']."],"; echo "['Mild',".$products[0]['mild_count']."],"; echo "['Moderate',".$products[0]['moderate_count']."],"; echo "['Severe',".$products[0]['severe_count']."],"; ?> ]); var options1 = { title: 'Drowsiness', curveType: 'function', legend: { position: 'top' } }; //////////////////////////////index 1////////////////////// // var data2 = google.visualization.arrayToDataTable([ // ['ASA', 'Count'], // <?php // echo "['No',".$products[1]['No_count']."],"; // echo "['Mild',".$products[1]['mild_count']."],"; // echo "['Moderate',".$products[1]['moderate_count']."],"; // echo "['Severe',".$products[1]['severe_count']."],"; // ?> // ]); // var options2 = { // title: 'Pain at the Site of Surgery', // curveType: 'function', // legend: { // position: 'top' // } // }; //////////////////////////////index 2////////////////////// var data3 = google.visualization.arrayToDataTable([ ['ASA', 'Count'], <?php echo "['No',".$products[1]['No_count']."],"; echo "['Mild',".$products[1]['mild_count']."],"; echo "['Moderate',".$products[1]['moderate_count']."],"; echo "['Severe',".$products[1]['severe_count']."],"; ?> ]); var options3 = { title: 'Thirst', curveType: 'function', legend: { position: 'top' } }; //////////////////////////////index 3////////////////////// // var data4 = google.visualization.arrayToDataTable([ // ['ASA', 'Count'], // <?php // echo "['No',".$products[3]['No_count']."],"; // echo "['Mild',".$products[3]['mild_count']."],"; // echo "['Moderate',".$products[3]['moderate_count']."],"; // echo "['Severe',".$products[3]['severe_count']."],"; // ?> // ]); // var options4 = { // title: 'Hoarseness', // curveType: 'function', // legend: { // position: 'top' // } // }; //////////////////////////////index 4////////////////////// // var data5 = google.visualization.arrayToDataTable([ // ['ASA', 'Count'], // <?php // echo "['No',".$products[4]['No_count']."],"; // echo "['Mild',".$products[4]['mild_count']."],"; // echo "['Moderate',".$products[4]['moderate_count']."],"; // echo "['Severe',".$products[4]['severe_count']."],"; // ?> // ]); // var options5 = { // title: 'Sore Throat', // curveType: 'function', // legend: { // position: 'top' // } // }; //////////////////////////////index 5////////////////////// var data6 = google.visualization.arrayToDataTable([ ['ASA', 'Count'], <?php echo "['No',".$products[2]['No_count']."],"; echo "['Mild',".$products[2]['mild_count']."],"; echo "['Moderate',".$products[2]['moderate_count']."],"; echo "['Severe',".$products[2]['severe_count']."],"; ?> ]); var options6 = { title: 'Nausea Vomiting', curveType: 'function', legend: { position: 'top' } }; //////////////////////////////index 6////////////////////// var data7 = google.visualization.arrayToDataTable([ ['ASA', 'Count'], <?php echo "['No',".$products[3]['No_count']."],"; echo "['Mild',".$products[3]['mild_count']."],"; echo "['Moderate',".$products[3]['moderate_count']."],"; echo "['Severe',".$products[3]['severe_count']."],"; ?> ]); var options7 = { title: 'Feeling Cold', curveType: 'function', legend: { position: 'top' } }; //////////////////////////////index 7////////////////////// var data8 = google.visualization.arrayToDataTable([ ['ASA', 'Count'], <?php echo "['No',".$products[4]['No_count']."],"; echo "['Mild',".$products[4]['mild_count']."],"; echo "['Moderate',".$products[4]['moderate_count']."],"; echo "['Severe',".$products[4]['severe_count']."],"; ?> ]); var options8 = { title: 'Confusion Disorientation', curveType: 'function', legend: { position: 'top' } }; //////////////////////////////index 8////////////////////// var data9 = google.visualization.arrayToDataTable([ ['ASA', 'Count'], <?php echo "['No',".$products[5]['No_count']."],"; echo "['Mild',".$products[5]['mild_count']."],"; echo "['Moderate',".$products[5]['moderate_count']."],"; echo "['Severe',".$products[5]['severe_count']."],"; ?> ]); var options9 = { title: 'Backpain', curveType: 'function', legend: { position: 'top' } }; //////////////////////////////index 9////////////////////// var data10 = google.visualization.arrayToDataTable([ ['ASA', 'Count'], <?php echo "['No',".$products[6]['No_count']."],"; echo "['Mild',".$products[6]['mild_count']."],"; echo "['Moderate',".$products[6]['moderate_count']."],"; echo "['Severe',".$products[6]['severe_count']."],"; ?> ]); var options10 = { title: 'Shivering', curveType: 'function', legend: { position: 'top' } }; var pie_chart1 = new google.visualization.PieChart(document.getElementById('drowsiness_GoogleLineChart')); pie_chart1.draw(data1, options1); // var pie_chart2 = new google.visualization.PieChart(document.getElementById('pain_at_surgery_GoogleLineChart')); // pie_chart2.draw(data2, options2); var pie_chart3 = new google.visualization.PieChart(document.getElementById('thirst_GoogleLineChart')); pie_chart3.draw(data3, options3); // var pie_chart4 = new google.visualization.PieChart(document.getElementById('hoarseness_GoogleLineChart')); // pie_chart4.draw(data4, options4); // var pie_chart5 = new google.visualization.PieChart(document.getElementById('sore_throat_GoogleLineChart')); // pie_chart5.draw(data5, options5); var pie_chart6 = new google.visualization.PieChart(document.getElementById('nausea_vomiting_GoogleLineChart')); pie_chart6.draw(data6, options6); var pie_chart7 = new google.visualization.PieChart(document.getElementById('feeling_cold_GoogleLineChart')); pie_chart7.draw(data7, options7); var pie_chart8 = new google.visualization.PieChart(document.getElementById('confusion_disorientation_GoogleLineChart')); pie_chart8.draw(data8, options8); var pie_chart9 = new google.visualization.PieChart(document.getElementById('backpain_GoogleLineChart')); pie_chart9.draw(data9, options9); var pie_chart10 = new google.visualization.PieChart(document.getElementById('shivering_GoogleLineChart')); pie_chart10.draw(data10, options10); var btnSave = document.getElementById('save-pdf'); 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('SeverityRatingExperience.pdf'); }); //doc.addImage(pie_chart.getImageURI(),0,0); //doc.addImage(column_chart.getImageURI(),0,0); //doc.save('anatomical.pdf'); }, false); } </script> <!---------------- Menu Drodown ---------------------> <?php echo view('includes/obstetric-reports-footer'); ?>