KOKINIO - MANAGER
Edit File: metricaReciclable.blade.php
<style> table{ font-size: 10px; width: 100%; } thead, tbody, tr, td, th { display: block; } tr:after { content: ' '; display: block; visibility: hidden; clear: both; } thead th { height: 100%; font-size: 12px; /*text-align: left;*/ } tbody { height: 600px; overflow-y: auto; } thead { /* fallback */ } tbody td, thead th { width: 4.5%; float: left; } </style> <div class="block-title"> <h2><strong>Manifiesto Reciclable ({{ (isset($year))? $year : date('Y') }})</strong> </h2> <div class="block-options pull-right"> <button onclick="Metrica.print(this)" id="filter" class="btn btn-default btn-xs btn-filter"><span class="glyphicon glyphicon-filter"></span> Print</button> <button onclick="Metrica.tableFilter(this)" id="filter" class="btn btn-default btn-xs btn-filter"><span class="glyphicon glyphicon-filter"></span> Filter</button> </div> </div> <div class="row"> <div class="filterable"> <table class="table table-borderless table-striped table-vcenter table-responsive"> <thead> <tr class="filters"> <th class="text-left" style="width: 200px;font-size:12px"><input type="text" class="form-control text-center" placeholder="Cliente" disabled></th> <th class="text-left" style="width: 200px;font-size:12px"><input type="text" class="form-control text-center" placeholder="Semadet" disabled></th> <th class="text-right" style="font-size:12px">1</th> <th class="text-right" style="font-size:12px">2</th> <th class="text-right" style="font-size:12px">3</th> <th class="text-right" style="font-size:12px">4</th> <th class="text-right" style="font-size:12px">5</th> <th class="text-right" style="font-size:12px">6</th> <th class="text-right" style="font-size:12px">7</th> <th class="text-right" style="font-size:12px">8</th> <th class="text-right" style="font-size:12px">9</th> <th class="text-right" style="font-size:12px">10</th> <th class="text-right" style="font-size:12px">11</th> <th class="text-right" style="font-size:12px">12</th> <th class="text-right" style="font-size:12px">Total General</th> </tr> </thead> <tbody> @if(isset($reciclable)) <?php $mes_1 = 0; $mes_2 = 0; $mes_3 = 0; $mes_4 = 0; $mes_5 = 0; $mes_6 = 0; $mes_7 = 0; $mes_8 = 0; $mes_9 = 0; $mes_10 = 0; $mes_11 = 0; $mes_12 = 0; $peso_kg = 0; ?> @foreach($reciclable as $key => $value) @if($reciclable[($key > 0)? ($key - 1) : 0]->cliente != $value->cliente) <tr class="info"> <td class="text-left" style="width: 200px;padding:0px"> </td> <td class="text-left" style="width: 200px;padding:0px">Total</td> <td class="text-right" style="padding:0px">{{ ($mes_1 != 0 )? number_format($mes_1,2) :0}}</td> <td class="text-right" style="padding:0px">{{ ($mes_2 != 0 )? number_format($mes_2,2) :0}}</td> <td class="text-right" style="padding:0px">{{ ($mes_3 != 0 )? number_format($mes_3,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_4 != 0 )? number_format($mes_4,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_5 != 0 )? number_format($mes_5,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_6 != 0 )? number_format($mes_6,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_7 != 0 )? number_format($mes_7,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_8 != 0 )? number_format($mes_8,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_9 != 0 )? number_format($mes_9,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_10 != 0 )? number_format($mes_10,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_11 != 0 )? number_format($mes_11,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_12 != 0 )? number_format($mes_12,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ number_format($peso_kg,2) }}</td> </tr> <?php $mes_1 = 0; $mes_2 = 0; $mes_3 = 0; $mes_4 = 0; $mes_5 = 0; $mes_6 = 0; $mes_7 = 0; $mes_8 = 0; $mes_9 = 0; $mes_10 = 0; $mes_11 = 0; $mes_12 = 0; $peso_kg = 0; ?> @endif <tr> <td class="text-left" style="width: 200px;padding:0px">{{ $value->cliente }}</td> <td class="text-left" style="width: 200px;padding:0px">{{ $value->clasificacion }}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_1 != 0 )? number_format($value->mes_1,2) :0}}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_2 != 0 )? number_format($value->mes_2,2) :0}}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_3 != 0 )? number_format($value->mes_3,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_4 != 0 )? number_format($value->mes_4,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_5 != 0 )? number_format($value->mes_5,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_6 != 0 )? number_format($value->mes_6,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_7 != 0 )? number_format($value->mes_7,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_8 != 0 )? number_format($value->mes_8,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_9 != 0 )? number_format($value->mes_9,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_10 != 0 )? number_format($value->mes_10,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_11 != 0 )? number_format($value->mes_11,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($value->mes_12 != 0 )? number_format($value->mes_12,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ number_format($value->peso_kg,2) }}</td> </tr> <?php $mes_1 += $value->mes_1; $mes_2 += $value->mes_2; $mes_3 += $value->mes_3; $mes_4 += $value->mes_4; $mes_5 += $value->mes_5; $mes_6 += $value->mes_6; $mes_7 += $value->mes_7; $mes_8 += $value->mes_8; $mes_9 += $value->mes_9; $mes_10 += $value->mes_10; $mes_11 += $value->mes_11; $mes_12 += $value->mes_12; $peso_kg += $value->peso_kg; ?> @endforeach <tr class="info"> <td class="text-left" style="width: 200px;padding:0px"> </td> <td class="text-left" style="width: 200px;padding:0px">Total</td> <td class="text-right" style="padding:0px">{{ ($mes_1 != 0 )? number_format($mes_1,2) :0}}</td> <td class="text-right" style="padding:0px">{{ ($mes_2 != 0 )? number_format($mes_2,2) :0}}</td> <td class="text-right" style="padding:0px">{{ ($mes_3 != 0 )? number_format($mes_3,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_4 != 0 )? number_format($mes_4,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_5 != 0 )? number_format($mes_5,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_6 != 0 )? number_format($mes_6,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_7 != 0 )? number_format($mes_7,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_8 != 0 )? number_format($mes_8,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_9 != 0 )? number_format($mes_9,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_10 != 0 )? number_format($mes_10,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_11 != 0 )? number_format($mes_11,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ ($mes_12 != 0 )? number_format($mes_12,2) :0 }}</td> <td class="text-right" style="padding:0px">{{ number_format($peso_kg,2) }}</td> </tr> <tr class="info" style="font-weight:bold"> <td class="text-center" style="padding:0px;width: 200px;height:30px;background-color:#5ca5ff;"> </td> <td class="text-center" colspan="3" style="width: 200px;padding:0px;height:30px;background-color:#5ca5ff;">Total por mes</td> @foreach($meses as $mes) <td class="text-right" style="padding:0px;height:30px;background-color:#5ca5ff;">{{ number_format($mes[0],2) }}</td> @endforeach <td class="text-right" style="padding:0px;height:30px;background-color:#5ca5ff;">{{ number_format($total,2) }}</td> </tr> @else <tr><td colspan="14">No hay información disponible</td></tr> @endif </tbody> </div> </div> <script type="text/javascript"> $('.filterable .filters input').keyup(function(e){ /* Ignore tab key */ var code = e.keyCode || e.which; if (code == '9') return; /* Useful DOM data and selectors */ var $input = $(this), inputContent = $input.val().toLowerCase(), $panel = $input.parents('.filterable'), column = $panel.find('.filters th').index($input.parents('th')), $table = $panel.find('.table'), $rows = $table.find('tbody tr'); /* Dirtiest filter function ever ;) */ var $filteredRows = $rows.filter(function(){ var value = $(this).find('td').eq(column).text().toLowerCase(); return value.indexOf(inputContent) === -1; }); /* Clean previous no-result if exist */ $table.find('tbody .no-result').remove(); /* Show all rows, hide filtered ones (never do that outside of a demo ! xD) */ $rows.show(); $filteredRows.hide(); /* Prepend no-result row if all rows are filtered */ if ($filteredRows.length === $rows.length) { $table.find('tbody').prepend($('<tr class="no-result text-center"><td colspan="'+ $table.find('.filters th').length +'">No result found</td></tr>')); } }); </script>