/
home
/
sjslayjy
/
public_html
/
mosaram
/
resources
/
views
/
dashboard
/
test
/
Upload File
HOME
<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css"> <title>Hello, world!</title> </head> <body> <button id="btnExport" onclick="fnExcelReport();"> EXPORT </button> <table class="table table-striped" id="headerTable"> <tr> <th>Sr. N</th> <th>Dealer Id</th> <th>Dealer Name</th> <th>Product Brand Id</th> <th>Product Brand Name</th> <th>Product Id</th> <th>Product Name</th> <th>Quantity</th> <th>Inv Quantity</th> </tr> @php $i = 1; @endphp @foreach($temp as $dealer_id=>$value) @foreach($value as $product_brand_id =>$product) @foreach($product as $product_id=>$balance) <tr> <td>{{$i++}}</td> <td>{{$dealer_id}}</td> <td>{{getModelById('Dealer', $dealer_id)->name}}</td> <td>{{$product_brand_id}}</td> <td>{{getModelById('ProductCompany', $product_brand_id)->name}}</td> <td>{{$product_id}}</td> <td>{{getModelById('Product', $product_id)->name}}</td> <td>{{$balance[0]}}</td> <td>{{$balance[1]}}</td> </tr> @endforeach @endforeach @endforeach </table> <script> function fnExcelReport() { var tab_text="<table border='2px'><tr bgcolor='#87AFC6'>"; var textRange; var j=0; tab = document.getElementById('headerTable'); // id of table for(j = 0 ; j < tab.rows.length ; j++) { tab_text=tab_text+tab.rows[j].innerHTML+"</tr>"; //tab_text=tab_text+"</tr>"; } tab_text=tab_text+"</table>"; tab_text= tab_text.replace(/<A[^>]*>|<\/A>/g, "");//remove if u want links in your table tab_text= tab_text.replace(/<img[^>]*>/gi,""); // remove if u want images in your table tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, ""); // reomves input params var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer { txtArea1.document.open("txt/html","replace"); txtArea1.document.write(tab_text); txtArea1.document.close(); txtArea1.focus(); sa=txtArea1.document.execCommand("SaveAs",true,"Say Thanks to Sumit.xls"); } else //other browser not tested on IE 11 sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text)); return (sa); } </script> </body> </html> <!-- SELECT dealer_id, product_brand_id, product_id, sum(quantity) FROM `inventories` WHERE dealer_id is not null GROUP by dealer_id , product_brand_id, product_id ORDER by dealer_id , product_brand_id -->