<div class='row'>
        <?php $filters = $_reporte->getOptions();?>
        <table class="w-100">
            <tr>
                <td><strong><?php echo $_translator->_getTranslation('Sucursal');?></strong></td>
                <td><?php echo $filters['store_name'] ?></td>
                <td></td>
                <td class="text-right"><span class="_report btn btn-primary btn-sm" data-reportname="transactions" data-toggle='modal' data-target='#modalFiltroReportes'><i class="fa fa-pencil"></i></span></td>
            </tr>
            <tr>
                <td><strong><?php echo $_translator->_getTranslation('Fecha inicio');?></strong></td>
                <td><?php echo $filters['fechaInicio'] ?></td>
                <td><strong><?php echo $_translator->_getTranslation('Fecha fin');?></strong></td>
                <td class="text-right"><?php echo $filters['fechaFin'] ?></td>
            </tr>
        </table>
        <hr/>
        <?php $result = $_reporte->getReporte(); ?> 
        <table class="w-100">
            <tbody class="summary_sales"><?php
            $options = $_reporte->getOptions();
            if($options['status']==='null' || $options['status'] === '2'){?>
            <tr>
                <td>
                    <span class="content pull-left">                        
                        <h4 class="m-a-0 p-a-0"><strong>$<?php echo number_format($result['ventasPagadasMonto'],2) ?></strong></h4>
                        <?php echo $_translator->_getTranslation('Total de ventas');?>
                    </span>
                </td>
                <td>
                    <span class="content pull-left">    
                         <h4 class="m-a-0 p-a-0"><strong><?php echo number_format($result['ventasPagadas'],2) ?></strong></h4>
                        <?php echo $_translator->_getTranslation('Cantidad de ventas');?>                        
                    </span>
                </td>
            </tr><?php
            }
            
            if($options['status']==='null' || $options['status'] === '3'){?>            
            <tr>
                <td>
                    <span class="content-danger pull-left">                        
                        <h4 class="m-a-0 p-a-0"><strong>$<?php echo number_format($result['ventasCanceladasMonto'],2) ?></strong></h4>
                        <?php echo $_translator->_getTranslation('Total de ventas canceladas');?>
                    </span>
                </td>
                </td>
                <td>
                    <span class="content-danger pull-left"> 
                        <h4 class="m-a-0 p-a-0"><strong>$<?php echo number_format($result['ventasCanceladas'],2) ?></strong></h4>
                        <?php echo $_translator->_getTranslation('Cantidad de ventas canceladas');?>                        
                    </span>
                </td>
            </tr><?php
            } ?>            
            </tbody>
        </table>
        <table class="table">
            <thead>
                <tr>
                    <th><?php echo $_translator->_getTranslation('Descripcion') ?></th>
                    <th class="text-center"><?php echo $_translator->_getTranslation('Metodo de pago') ?></th>
                    <th></th>
                </tr>
            </thead>
           <tbody class="payment_method">
            <?php 
            if($result['data']){
                foreach($result['data'] as $row){?>
                    <tr>
                        <td>
                        <span class="content pull-left"><strong>$<?php echo number_format($row['total_venta'],2) ?></strong></span><br/>
                        <span><?php echo $_translator->_getTranslation('Venta').':'. $row['num_venta'] ?></span><br/>
                        <span><?php echo date('m/d/y g:i a',strtotime($row['creado_fecha'])) ?></span><br/>
                        <span><?php echo $row['statusName'];?></span><br/>
                        </td>
                        <td class="text-center">
                            <br/>
                            <?php echo $row['formaPagoConcat'] ?>
                        </td>
                        <td>
                        <br/> 
                        <div class='dropup' style="float:right;margin-left: 5px;">
                            <i class="fa fa-ellipsis-v btn btn-default" style="border:0px" id="moreOptions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"></i>
                            <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="moreOptions">
                                 <?php 
                                 if($row['formaPago'] === '5' || $row['formaPago'] === '6'){?>
                                    <li><a class="_getCardOperation" style="cursor: pointer" data-sale="<?php echo $row['id'] ?>" data-toggle="modal" data-target="#modalCardOperations"><i class="fa fa-refresh"></i> <?php echo $_translator->_getTranslation('Reembolsar')?></a></li>
                                 <?php } ?>
                                <li><a href="#" class="deleteVenta" data-idventa='<?php echo $row['id']?>'><i class="fa fa-trash"></i> <?php echo $_translator->_getTranslation('Cancelar')?></a></li>
                            </ul>
                        </div>
                        </td>
                    </tr><?php                    
                }
            }?>            
            </tbody>
        </table>        
</div>
<?php
    include ROOT."/View/Modal/operacionesTarjeta.php";
    include ROOT."/View/Modal/operacionesTarjetaDetalles.php";
    include ROOT."/View/Modal/refund.php";
 ?>
<style>
</style>
<script>
    $('._getCardOperation').on('click',function(){
        getCardOperationBySale($(this).data('sale'));
    });
    
     $('a.deleteVenta').on('click',function(){  
            var idventa = $(this).data('idventa');
            
            $.confirm({
            theme: 'material',
            columnClass: 'col-md-6 col-md-offset-3',
            icon: 'fa fa-trash',
            title: 'Cancelar venta',
            content: 'Desea cancelar esta venta ?',
            buttons:{                
                cancel: {
                    text:'No',
                    btnClass: 'btn-default col-md-4 pull-right',
                    action: function(){
                       $(this).remove();
                    }
                },
                confirm: {
                    text: 'Si ',
                    btnClass: 'btn-primary col-md-4 pull-right',
                    action: function(){
                        cancelVenta(idventa);
                    }
                }
            }
        });
        });
</script>