<section class="content-header">
    <h1><i class='fa-fw fa fa-file-text-o'></i> <?php echo $_translator->_getTranslation('Lista de mermas');?></small></h1>
    <ol class="breadcrumb">
        <li><a href="<?php echo ROOT_HOST?>/Controller/Home.php"><i class="fa fa-dashboard"></i><?php echo $_translator->_getTranslation('Inicio')?></a></li>
        <li class="active"><?php echo $_translator->_getTranslation('Lista de mermas');?></li>
    </ol>
</section>
<section class="content">
<div class="box">
    <div class="box-header with-border">
        <h3 class="box-title"></h3>
        <div class="box-tools pull-right">
           <a href="Waste.php" class="btn btn-default"><i class='fa fa-plus'></i> <?php echo $_translator->_getTranslation('Agregar merma')?></a>
           <span class="btn btn-default _advancedSearch"><i class='fa fa-search-plus'></i> <?php echo $_translator->_getTranslation('Busqueda avanzada')?></span>
        </div><!-- /.box-tools -->
    </div><!-- /.box-header -->
    <div class="box-body">
    <div class='flashmessenger'><?php $flashmessenger->showMessage();?></div>
    <div class="clear"></div>
                <div class='table-responsive'>
                <div class="clear"></div>
                <table id="tblWaste" class="table table-striped table-hover table-condensed">
                    <thead>
                    <th class="col-md-1 text-center"><?php echo $_translator->_getTranslation('Merma #');?></th>
                    <th class="text-center"><?php echo $_translator->_getTranslation('Sucursal');?></th>
                    <th class="text-center"><?php echo $_translator->_getTranslation('Creado por');?></th>
                    <th class="text-center"><?php echo $_translator->_getTranslation('Fecha');?></th>
                    <th class="text-center"><?php echo $_translator->_getTranslation('Cantidad');?></th>
                    <th class="text-center"><?php echo $_translator->_getTranslation('Total costo');?></th>
                    <th class="text-center"><?php echo $_translator->_getTranslation('Total venta');?></th>
                    <th class="text-center"><?php echo $_translator->_getTranslation('Notas');?></th>
                    <th class="col-md-2 text-center"><?php echo $_translator->_getTranslation('Status');?></th> 
                    <th class="col-lg-1 text-center">Accion</th>
                    </thead>
                    <tbody>
                    <?php 
                        if($_listWastes){
                            foreach($_listWastes as $waste){?>
                                <tr>
                                    <td class="text-center"><?php echo $waste['waste_num']?></td>
                                    <td class="text-center"><?php echo $waste['store_name']?></td>
                                    <td class="text-center"><?php echo $waste['user_name']?></td>

                                    <td class="text-center"><?php echo $waste['formated_date']?></td>   
                                    <td class="text-center"><?php echo $waste['total_quantity']?></td>
                                    <td class="text-center"><?php echo number_format($waste['total_cost'],2)?></td>
                                    <td class="text-center"><?php echo number_format($waste['total_price'], 2) ?></td>
                                    <td class="text-center"><?php echo $waste['comments']?></td>
                                    <td class="text-center"><?php echo $waste['status_name']?></td>  
                                    <td class="text-center" style="white-space: nowrap">
                                        <a class="btn btn-md btn-default" href="Waste.php?action=edit&id=<?php echo $waste['id']?>" title='<?php echo $_translator->_getTranslation('Editar') ?>'><i class="fa fa-pencil"></i></a>                                        
                                        <a class="btn btn-default" href="#" onclick="javascript: void window.open('Waste.php?action=export&format=pdf&flag=waste&id=<?php echo $waste['id'];?>','','width=700,height=500,status=1,scrollbars=1,resizable=1')" title='<?php echo $_translator->_getTranslation('Imprimir') ?>'><i class="fa fa-print"></i></a>
                                        <a class="btn btn-md btn-danger" onclick="return deleteRegistry('<?php echo $_translator->_getTranslation('Esta seguro de cancelar este registro ?')?>','Waste.php?action=delete&id=<?php echo $waste['id']?>')" href="#" title='<?php echo $_translator->_getTranslation('Cancelar') ?>'><i class="fa fa-trash"></i></a>
                                    </td>
                                </tr><?php
                            }                   
                        }?>
                    </tbody>
                </table>
                </div>
  </div><!-- /.box-body -->
</div><!-- /.box -->
</section>
<?php include ROOT."/View/Modal/advancedSearch.php";?>
<script type="text/javascript" language="javascript">
    $('#tblWaste').DataTable( {paginate:false,filter:true,aaSorting:[]});
    $('#tblWaste')
            .removeClass( 'display' )
            .addClass('table table-striped table-bordered');
</script>