KOKINIO - MANAGER
Edit File: 2d69a301722b154e975c5a28d53a3f56
<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%; /*text-align: left;*/ } tbody { height: 600px; overflow-y: auto; } thead { /* fallback */ } tbody td, thead th { width: 9.5%; float: left; } </style> <div class="block"> <div class="block-title"> <h2><strong>Utilidad (<?php echo e((isset($month))? Helper::month($month) : Helper::month(date('m'))); ?> - <?php echo e((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="font-size:12px"><input type="text" class="form-control text-center" placeholder="Mes" disabled></th> <th class="text-left" style="font-size:12px"><input type="text" class="form-control text-left" placeholder="Material" disabled></th> <th class="text-left" style="width:200px;font-size:12px"><input type="text" class="form-control text-left" placeholder="Cliente" disabled></th> <th class="text-right" style="font-size:12px"><input type="text" class="form-control text-right" placeholder="Kilos" disabled></th> <th class="text-right" style="font-size:12px"><input type="text" class="form-control text-right" placeholder="Precio Chofer" disabled></th> <th class="text-right" style="font-size:12px"><input type="text" class="form-control text-right" placeholder="Precio Cliente" disabled></th> <th class="text-right" style="font-size:12px"><input type="text" class="form-control text-right" placeholder="Cantidad Chofer" disabled></th> <th class="text-right" style="font-size:12px"><input type="text" class="form-control text-right" placeholder="Cantidad Cliente" disabled></th> <th class="text-right" style="font-size:12px"><input type="text" class="form-control text-right" placeholder="Utilidad" disabled></th> </tr> </thead> <tbody> <?php if(isset($utilidad)): ?> <?php $kilos = 0; $costo_cliente = 0;$costo_chofer = 0; $total_chofer = 0; $total_cliente = 0; $utilidad_ = 0; $kilos_t = 0; $costo_chofer_t = 0; $costo_cliente_t = 0; $total_chofer_t = 0; $total_cliente_t = 0; $utilidad_t = 0; ?> <?php foreach($utilidad as $key => $value): ?> <?php if($utilidad[($key > 0)? ($key - 1) : 0]->reciclable != $value->reciclable): ?> <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;width:200px">Total</td> <td class="text-right" style="padding:0px"><?php echo e(number_format($kilos, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($costo_chofer, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($costo_cliente, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($total_chofer, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($total_cliente, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($utilidad_, 2)); ?></td> </tr> <?php $kilos = 0; $costo_cliente = 0;$costo_chofer = 0; $total_chofer = 0; $total_cliente = 0; $utilidad_ = 0; ?> <?php endif; ?> <tr> <td class="text-center" style="padding:0px"><?php echo e($value->mes); ?></td> <td class="text-left" style="padding:0px"><?php echo e($value->reciclable); ?></td> <td class="text-left" style="padding:0px;width:200px"><?php echo e($value->nombre_comercial); ?></td> <td class="text-right" style="padding:0px"><?php echo e(number_format($value->peso_reciclable,2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($value->costo_pago,2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($value->costo_cliente,2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($value->peso_reciclable * $value->costo_pago, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($value->peso_reciclable * $value->costo_cliente, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format(($value->peso_reciclable * $value->costo_pago) - ($value->peso_reciclable * $value->costo_cliente), 2)); ?></td> </tr> <?php $kilos += $value->peso_reciclable; $costo_chofer += $value->costo_pago; $costo_cliente += $value->costo_cliente; $total_chofer += $value->peso_reciclable * $value->costo_pago; $total_cliente += $value->peso_reciclable * $value->costo_cliente; $utilidad_ += ($value->peso_reciclable * $value->costo_pago) - ($value->peso_reciclable * $value->costo_cliente); $kilos_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; $utilidad_t += ($value->peso_reciclable * $value->costo_pago)-($value->peso_reciclable * $value->costo_cliente); ?> <?php 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;width:200px">Total</td> <td class="text-right" style="padding:0px"><?php echo e(number_format($kilos, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($costo_chofer, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($costo_cliente, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($total_chofer, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($total_cliente, 2)); ?></td> <td class="text-right" style="padding:0px">$<?php echo e(number_format($utilidad_, 2)); ?></td> </tr> <tr style="font-weight:bold;"> <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;width:200px;background-color:#5ca5ff;">Total</td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;">$<?php echo number_format($kilos_t, 2); ?></td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;">$<?php echo number_format($costo_chofer_t, 2); ?></td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;">$<?php echo number_format($costo_cliente_t, 2); ?></td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;">$<?php echo number_format($total_chofer_t, 2); ?></td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;">$<?php echo number_format($total_cliente_t, 2); ?></td> <td class="text-right" style="padding:0px;background-color:#5ca5ff;">$<?php echo number_format($utilidad_t, 2); ?></td> </tr> <?php $kilos = 0; $costo_cliente = 0;$costo_chofer = 0; $total_chofer = 0; $total_cliente = 0; $utilidad_ = 0; ?> <?php else: ?> <tr><td colspan="10" style="padding:0px">No hay información disponible</td></tr> <?php 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>