							<div class="row-fluid">
                                <div class="span12">
                                    
                                    <table id="table" class="table table-striped table-bordered table-hover">
                                        <caption>Registros: <?php echo count($query); ?></caption>
                                        <thead>
                                            <tr>
                                                <th>ID</th>
                                                <th>Serie</th>
                                                <th>Folio</th>
                                                <th>Referencia</th>
                                                <th>Status</th>
                                                <th>Folio fiscal</th>
                                                <th>Fecha</th>
                                                <th>RFC</th>
                                                <th>Razon social</th>
                                                <th>Piezas</th>
                                                <th>IVA</th>
                                                <th>Total</th>
                                                <th>XML</th>
                                                <th>PDF</th>
                                                <th>Addenda</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php 

                                            $piezas = 0;
                                            $iva = 0;
                                            $total = 0;

                                            foreach($query as $row){

                                                $link = null;

                                                if($row->estatus == 1 && $row->addenda == 0)
                                                {
                                                    $link = anchor('facturacion/controlado_addenda/'.$row->f_id, 'Agrega');
                                                }

                                                if($row->estatus == 0)
                                                {
                                                    $color = ROJO_PASTEL;
                                                }else
                                                {
                                                    $color = null;
                                                }

                                            ?>
                                            <tr style="background-color: <?php echo $color; ?>;">
                                                <td><?php echo $row->f_id; ?></td>
                                                <td><?php echo $row->serie; ?></td>
                                                <td><?php echo $row->folio; ?></td>
                                                <td><?php echo $row->ref; ?></td>
                                                <td style="text-align: center;"><?php echo $row->estatus; ?></td>
                                                <td><?php echo $row->uuid; ?></td>
                                                <td><?php echo $row->created_at; ?></td>
                                                <td><?php echo $row->rec_rfc; ?></td>
                                                <td><?php echo $row->rec_razon; ?></td>
                                                <td style="text-align: right;"><?php echo number_format($row->piezas, 0); ?></td>
                                                <td style="text-align: right;"><?php echo number_format($row->iva_total, 2); ?></td>
                                                <td style="text-align: right;"><?php echo number_format($row->subtotal, 2); ?></td>
                                                <td><?php echo anchor('facturacion/descargaXMLByID/' . $row->f_id, 'XML'); ?></td>
                                                <td><?php echo anchor('facturacion/descargaPDFByID/' . $row->f_id, 'PDF'); ?></td>
                                                <td><?php echo $link; ?></td>
                                            </tr>
                                            <?php 

                                            $piezas = $piezas + $row->piezas;
                                            $iva = $iva + $row->iva_total;
                                            $total = $total + $row->subtotal;

                                            } 


                                            ?>
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                                <td colspan="9" style="text-align: right;">Totales: </td>
                                                <td style="text-align: right;"><?php echo number_format($piezas, 0); ?></td>
                                                <td style="text-align: right;"><?php echo number_format($iva, 2); ?></td>
                                                <td style="text-align: right;"><?php echo number_format($total, 2); ?></td>
                                                <td></td>
                                            </tr>
                                        </tfoot>
                                    </table>
                            
                                </div>
                            </div>
