KOKINIO - MANAGER
Edit File: metricaCobro.blade.php
<style> table{ font-size: 10px; } #tbl-costo table{ width: 100%; } #tbl-costo thead, #tbl-costo tbody, #tbl-costo tr, #tbl-costo td, #tbl-costo th { display: block; } #tbl-costo tr:after { content: ' '; display: block; visibility: hidden; clear: both; } #tbl-costo thead th { height: 100%; /*text-align: left;*/ } #tbl-costo tbody { height: 400px; overflow-y: auto; } #tbl-costo thead { /* fallback */ } #tbl-costo tbody td, #tbl-costo thead th { width: 10%; float: left; } </style> <div class="block"> <div class="block-title"> <h2><strong>Cobro Chofer ({{ (isset($month))? Helper::month($month) : Helper::month(date('m')) }} - {{ (isset($year))? $year : date('Y') }})</strong> </h2> <div class="block-options pull-right"> <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="filterable2"> <table class="table table-borderless table-striped table-vcenter table-responsive"> <thead> <tr class="filters2"> <th class="text-center">Mes</th> <th class="text-left">Chofer</th> <th class="text-left">Cliente</th> <th class="text-right">Kilos</th> <th class="text-right">Total Chofer</th> <th class="text-right"></th> </tr> </thead> <tbody> @if(isset($cobroTotal)) <?php $costo_cho = 0; $costo_chof = 0; $kilos_mat = 0; $costo_cho_t = 0; $costo_chof_t = 0; $kilos_mat_t = 0; ?> @foreach($cobroTotal as $key => $value) @if($cobroTotal[($key > 0)? ($key - 1) : 0]->username != $value->username) <tr class="info" style="font-weight:bold"> <td class="text-center" style="padding:0px"> </td> <td class="text-center" style="padding:0px"> </td> <td class="text-center" style="padding:0px">Total</td> <td class="text-right" style="padding:0px">{{ number_format($kilos_mat, 2) }}</td> <td class="text-right" style="padding:0px">{{ number_format($costo_chof, 2) }}</td> <td class="text-right" style="padding:0px">{{-- number_format($costo_cho, 2) --}}</td> </tr> <?php $costo_chof = 0; $costo_cli = 0; $kilos_mat = 0; ?> @endif <tr> <td class="text-center" style="padding:0px">{{ $value->mes }}</td> <td class="text-left" style="padding:0px">{{ $value->username }}</td> <td class="text-left" style="padding:0px">{{ $value->nombre_comercial }}</td> <td class="text-right" style="padding:0px">{{ number_format($value->peso_reciclable, 2) }}</td> <td class="text-right" style="padding:0px">{{ number_format($value->total_chofer, 2) }}</td> <td class="text-right" style="padding:0px">{{-- number_format($value->costo_pago, 2) --}}</td> </tr> <?php $kilos_mat += $value->peso_reciclable; $costo_cho += $value->costo_pago; $costo_chof += $value->total_chofer; $kilos_mat_t += $value->peso_reciclable; $costo_cho_t += $value->costo_pago; $costo_chof_t += $value->total_chofer; ?> @endforeach <tr class="info" style="font-weight:bold"> <td class="text-center" style="padding:0px"> </td> <td class="text-center" style="padding:0px"> </td> <td class="text-center" style="padding:0px">Total</td> <td class="text-right" style="padding:0px">{{ number_format($kilos_mat, 2) }}</td> <td class="text-right" style="padding:0px">{{ number_format($costo_chof, 2) }}</td> <td class="text-right" style="padding:0px">{{-- number_format($costo_cho, 2) --}}</td> </tr> <tr style="font-weight:bold;background-color:#5ca5ff;"> <td class="text-center" style="padding:0px;background-color:#5ca5ff;"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff;"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff;">Total General</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;">{{ number_format($kilos_mat_t, 2) }}</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;">{{ number_format($costo_chof_t, 2) }}</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;">{{-- number_format($costo_cho_t, 2) --}}</td> </tr> <?php $costo_chof = 0; $costo_cli = 0; $kilos_mat = 0; ?> @endif </tbody> </table> </div> </div> </div> <div class="block"> <div class="block-title"> <h2><strong>Cobro Chofer ({{ (isset($month))? Helper::month($month) : Helper::month(date('m')) }} - {{ (isset($year))? $year : date('Y') }})</strong> </h2> <div class="block-options pull-right"> <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 id="tbl-costo" class="table table-borderless table-striped table-vcenter table-responsive"> <thead> <tr class="filters"> <th class="text-center" style="width:50px"><input type="text" class="form-control text-center" placeholder="Mes" disabled></th> <th class="text-left"><input type="text" class="form-control text-left" placeholder="Fecha" disabled></th> <th class="text-left" style="width: 60px"><input type="text" class="form-control text-left" placeholder="Chofer" disabled></th> <th class="text-left" style="width: 150px"><input type="text" class="form-control text-left" placeholder="Cliente" disabled></th> <th class="text-left"><input type="text" class="form-control text-left" placeholder="Orden" disabled></th> <th class="text-left"><input type="text" class="form-control text-left" placeholder="Material" disabled></th> <th class="text-right"><input type="text" class="form-control text-right" placeholder="Kilos" disabled></th> <th class="text-right" style="font-size:13px;width: 60px;">Precio Chofer</th> <th class="text-right" style="font-size:13px;width: 60px;">Precio Cliente</th> <th class="text-right" style="font-size:13px;width: 60px;">Cantidad Chofer</th> <th class="text-right" style="font-size:13px;width: 60px;">Cantidad Cliente</th> </tr> </thead> <tbody> @if(isset($cobro)) <?php $reciclables = 0; $costo_chofer = 0; $costo_cliente = 0; $total_chofer = 0; $total_cliente = 0; $reciclables_t = 0; $costo_chofer_t = 0; $costo_cliente_t = 0; $total_chofer_t = 0; $total_cliente_t = 0; $reciclables_st = 0; $costo_chofer_st = 0; $costo_cliente_st = 0; $total_chofer_st = 0; $total_cliente_st = 0; ?> @foreach($cobro as $key => $value) @if($cobro[($key > 0)? ($key - 1) : 0]->nombre_comercial != $value->nombre_comercial || $cobro[($key > 0)? ($key - 1) : 0]->username != $value->username) <tr class="info" style="font-weight:bold"> <td class="text-center" style="padding:0px;width:50px"> </td> <td class="text-center" style="padding:0px"> </td> <td class="text-center" style="padding:0px;width: 60px;"> </td> <td class="text-center" style="padding:0px;width: 150px;"> </td> <td class="text-center" style="padding:0px"> </td> <td class="text-center" style="padding:0px">Total</td> <td class="text-right" style="padding:0px;width: 60px;">{{ number_format($reciclables, 2) }}</td> <td class="text-right" style="padding:0px;width: 60px;">{{ number_format($costo_chofer, 2) }}</td> <td class="text-right" style="padding:0px;width: 60px;">{{ number_format($costo_cliente, 2) }}</td> <td class="text-right" style="padding:0px;width: 60px;">{{ number_format($total_chofer, 2) }}</td> <td class="text-right" style="padding:0px;width: 60px;">{{ number_format($total_cliente, 2) }}</td> </tr> <?php $reciclables = 0; $costo_chofer = 0; $costo_cliente = 0; $total_chofer = 0; $total_cliente = 0; ?> @endif @if($cobro[($key > 0)? ($key - 1) : 0]->username != $value->username) <tr style="font-weight:bold;background-color:#5ca5ff"> <td class="text-center" style="padding:0px;background-color:#5ca5ff;width:50px"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff;width: 60px;"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff;width: 150px;"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff">Total</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;width: 60px;">{!! number_format($reciclables_st, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;width: 60px;">{!! number_format($costo_chofer_st, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;width: 60px;">{!! number_format($costo_cliente_st, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;width: 60px;">{!! number_format($total_chofer_st, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;width: 60px;">{!! number_format($total_cliente_st, 2) !!}</td> </tr> <?php $reciclables_st = 0; $costo_chofer_st = 0; $costo_cliente_st = 0; $total_chofer_st = 0; $total_cliente_st = 0; ?> @endif <?php $costo_chofer += $value->costo_pago; $costo_cliente += $value->costo_cliente; $reciclables += $value->peso_reciclable; $total_chofer += $value->peso_reciclable * $value->costo_pago; $total_cliente += $value->peso_reciclable * $value->costo_cliente; $reciclables_t += $value->peso_reciclable; $costo_chofer_t += $value->costo_pago; $costo_cliente_t += $value->costo_cliente; $total_chofer_t += $value->peso_reciclable * $value->costo_pago; $total_cliente_t += $value->peso_reciclable * $value->costo_cliente; $reciclables_st += $value->peso_reciclable; $costo_chofer_st += $value->costo_pago; $costo_cliente_st += $value->costo_cliente; $total_chofer_st += $value->peso_reciclable * $value->costo_pago; $total_cliente_st += $value->peso_reciclable * $value->costo_cliente; ?> <tr> <td class="text-center" style="padding:0px;width:50px">{{ $value->mes }}</td> <td class="text-center" style="padding:0px">{{ $value->fecha }}</td> <td class="text-left" style="padding:0px;width: 60px;">{{ $value->username }}</td> <td class="text-left" style="padding:0px;width: 150px;">{{ $value->nombre_comercial }}</td> <td class="text-left" style="padding:0px">{{ $value->orden_no }}</td> <td class="text-left" style="padding:0px">{{ $value->reciclable }}</td> <td class="text-right" style="padding:0px;width: 60px;">{{ number_format($value->peso_reciclable, 2) }}</td> <td class="text-right" style="padding:0px;width: 60px;">{{ number_format($value->costo_pago, 2) }}</td> <td class="text-right" style="padding:0px;width: 60px;">{{ number_format($value->costo_cliente, 2) }}</td> <td class="text-right" style="padding:0px;width: 60px;">{!! number_format($value->peso_reciclable * $value->costo_pago, 2) !!}</td> <td class="text-right" style="padding:0px;width: 60px;">{!! number_format($value->peso_reciclable * $value->costo_cliente, 2) !!}</td> </tr> @endforeach <tr class="info" style="font-weight:bold"> <td class="text-center" style="padding:0px;width:50px"> </td> <td class="text-center" style="padding:0px"> </td> <td class="text-center" style="padding:0px;width: 60px;"> </td> <td class="text-center" style="padding:0px;width: 150px;"> </td> <td class="text-center" style="padding:0px"> </td> <td class="text-center" style="padding:0px">Total</td> <td class="text-right" style="padding:0px;width: 60px;">{!! number_format($reciclables, 2) !!}</td> <td class="text-right" style="padding:0px;width: 60px;">{!! number_format($costo_chofer, 2) !!}</td> <td class="text-right" style="padding:0px;width: 60px;">{!! number_format($costo_cliente, 2) !!}</td> <td class="text-right" style="padding:0px;width: 60px;">{!! number_format($total_chofer, 2) !!}</td> <td class="text-right" style="padding:0px;width: 60px;">{!! number_format($total_cliente, 2) !!}</td> </tr> <?php $reciclables = 0; $costo_chofer = 0; $costo_cliente = 0; $total_chofer = 0; $total_cliente = 0; ?> <tr style="font-weight:bold;background-color:#5ca5ff"> <td class="text-center" style="padding:0px;background-color:#5ca5ff;width:50px"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff;width: 60px;"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff;width: 150px;"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff"> </td> <td class="text-center" style="padding:0px;background-color:#5ca5ff">Total</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;width: 60px;">{!! number_format($reciclables_st, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;width: 60px;">{!! number_format($costo_chofer_st, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;width: 60px;">{!! number_format($costo_cliente_st, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;width: 60px;">{!! number_format($total_chofer_st, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;width: 60px;">{!! number_format($total_cliente_st, 2) !!}</td> </tr> <?php $reciclables_st = 0; $costo_chofer_st = 0; $costo_cliente_st = 0; $total_chofer_st = 0; $total_cliente_st = 0; ?> <tr style="font-weight:bold;background-color:#2b83ef"> <td class="text-center" style="padding:0px;background-color:#2b83ef;width:50px"> </td> <td class="text-center" style="padding:0px;background-color:#2b83ef"> </td> <td class="text-center" style="padding:0px;background-color:#2b83ef;width: 60px;"> </td> <td class="text-center" style="padding:0px;background-color:#2b83ef;width: 150px;"> </td> <td class="text-center" style="padding:0px;background-color:#2b83ef"> </td> <td class="text-center" style="padding:0px;background-color:#2b83ef">Total General:</td> <td class="text-right" style="padding:0px;background-color:#2b83ef;width: 60px;">{!! number_format($reciclables_t, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#2b83ef;width: 60px;">{!! number_format($costo_chofer_t, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#2b83ef;width: 60px;">{!! number_format($costo_cliente_t, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#2b83ef;width: 60px;">{!! number_format($total_chofer_t, 2) !!}</td> <td class="text-right" style="padding:0px;background-color:#2b83ef;width: 60px;">{!! number_format($total_cliente_t, 2) !!}</td> </tr> @else <tr><td colspan="10" style="padding:0px">No hay información disponible</td></tr> @endif </tbody> </div> </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>