<style type="text/css">
fieldset 
{
    border: 1px solid #ddd !important;
    margin: 0;
    xmin-width: 0;
    padding: 10px;       
    position: relative;
    border-radius:4px;
    background-color:#f5f5f5;
    padding-left:10px!important;
}   

legend
{
    font-size:14px;
    font-weight:bold;
    margin-bottom: 0px;
    width: 35%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 5px 5px 10px;
    background-color: #ffffff;
}
</style>

<div class="card">
    <div class="card-body p-2 m-2">
        <div class="form-row mx-0">
            <div class="col-md-6 mb-1">
                <label class="col-form-label" for="Codigo">Fecha</label>
                <!--<input type="text" class="form-control" name="Codigo" id="Codigo" readonly="" placeholder="" value="<?=$s_FechaDesde?>">-->
                <!--<h5 class="card-title"><?=$s_FechaDesde?></h5>-->
                <div class="card"><div class="card-body" style="padding: 0.4rem;"><h5 class="card-text"><?=$s_FechaDesde?> | <?=$s_FechaHasta?></h5></div></div>
            </div>
            <div class="col-md-6 mb-1">
                <label class="col-form-label" for="CodigoInterno">Hora Requerimiento</label>
                <div class="card"><div class="card-body" style="padding: 0.4rem;"><h5 class="card-text"><?=$s_HoraReq?></h5></div></div>
                <!--<input type="text" class="form-control" name="CodigoInterno" id="CodigoInterno" placeholder="" value="" readonly>-->
            </div>
        </div>
        <div class="form-row mx-0">
            <div class="col-md-6 mb-1">
                <label class="col-form-label" for="Codigo">Usuario</label>
                <div class="card"><div class="card-body" style="padding: 0.4rem;"><?=$s_Nombreusuario?></div></div>
            </div>
            <div class="col-md-6 mb-1">
                <label class="col-form-label" for="CodigoInterno">Vendedor</label>
                <div class="card"><div class="card-body" style="padding: 0.4rem;"><?=$s_IdVendedor?></div></div>
            </div>
        </div>
        <div class="form-row mx-0">
            <div class="col-md-6 mb-1">
                <label class="col-form-label" for="Codigo">Almacen</label>
                <div class="card"><div class="card-body" style="padding: 0.4rem;"><?=$NombreAlmacen?></div></div>
            </div>
            <div class="col-md-6 mb-1">
                &nbsp;
            </div>
        </div>
    </div>
</div>

<br>

<fieldset class="">
    <legend class="w-auto">Resumen de Caja</legend>
    <div class="table-responsive">
        <table class="table  table-bordered table-hover">
            <thead class="table-primary">
                <tr>
                    <th scope="col" style="text-align: center;">Medio de Pago</th>
                    <th scope="col" style="text-align: center;">Moneda</th>
                    <th scope="col" style="text-align: center;">Comprobantes</th>
                    <th scope="col" style="text-align: center;">Monto</th>
                </tr>
            </thead>
            <tbody>
                <?php $f_TotalTrx   = 0; ?>
                <?php $f_TotalMonto = 0; ?>
                <?php foreach ( $a_ResumnenCaja as $i_Key => $a_Values ) { ?>
                <tr>
                    <td class="text-nowrap"><?=$a_Values['TipoPagoNombre']?></td>
                    <td align="center"><?=$a_Values['MonedaDes']?></td>
                    <td align="center"><?=$a_Values['CantTrx']?></td>
                    <td align="center"><?=number_format( $a_Values['MontoAplicado'], 2 )?></td>
                </tr>
                    <?php $f_TotalTrx = $f_TotalTrx + $a_Values['CantTrx']; ?>
                    <?php $f_TotalMonto = $f_TotalMonto + $a_Values['MontoAplicado']; ?>
                <?php } ?>
                <tr class="table-danger">
                    <td class="font-weight-bold text-right">TOTALES</td>
                    <td>&nbsp;</td>
                    <td class="font-weight-bold text-center"><?=$f_TotalTrx?></td>
                    <td class="font-weight-bold text-center"><?=number_format( $f_TotalMonto, 2 )?></td>
                </tr>
            </tbody>
        </table>
    </div>
</fieldset>
<br>
<fieldset class="">
    <legend class="w-auto">Productos</legend>
    <div class="table-responsive">
        <table class="table  table-bordered table-hover">
            <thead class="table-primary">
                <tr>
                    <th scope="col" class="text-center">Codigo</th>
                    <th scope="col" class="text-left">Descripcion</th>
                    <th scope="col" class="text-left">Linea</th>
                    <th scope="col" class="text-center">Cantidad</th>
                    <th scope="col" class="text-center">Valor Venta</th>
                </tr>
            </thead>
            <tbody>
                <?php $f_TotalCant  = 0; ?>
                <?php $f_TotalMonto = 0; ?>
                <?php foreach ( $a_DataProductos as $i_Key => $a_Values ) { ?>
                <tr>
                    <td class="text-center"><?=$a_Values['IdItem']?></td>
                    <td class="text-left"><?=$a_Values['DescripcionCompleta']?></td>
                    <td class="text-left"><?=$a_Values['Descripcion']?></td>
                    <td class="text-center"><?=$a_Values['SumCantidad']?></td>
                    <td class="text-center"><?=number_format( $a_Values['SumMontoFinal'], 2 )?></td>
                </tr>
                    <?php $f_TotalCant = $f_TotalCant + $a_Values['SumCantidad']; ?>
                    <?php $f_TotalMonto = $f_TotalMonto + $a_Values['SumMontoFinal']; ?>
                <?php } ?>
                <tr class="table-danger">
                    <td class="font-weight-bold text-right">TOTALES</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td class="font-weight-bold text-center"><?=$f_TotalCant?></td>
                    <td class="font-weight-bold text-center"><?=number_format( $f_TotalMonto, 2 )?></td>
                </tr>
            </tbody>
        </table>
    </div>
</fieldset>
<br>
<!--
<fieldset class="">
    <legend class="w-auto">Productos - Promociones, Pack</legend>
    <div class="table-responsive">
        <table class="table  table-bordered table-hover">
            <thead class="table-primary">
                <tr>
                    <th scope="col" class="text-center">Codigo</th>
                    <th scope="col" class="text-left">Descripcion</th>
                    <th scope="col" class="text-left">Linea</th>
                    <th scope="col" class="text-center">Cantidad</th>
                    <th scope="col" class="text-center">Valor Venta</th>
                </tr>
            </thead>
            <tbody>
                <?php $f_TotalCant  = 0; ?>
                <?php $f_TotalMonto = 0; ?>
                <?php foreach ( $a_DataProductos2 as $i_Key => $a_Values ) { ?>
                <tr>
                    <td class="text-center"><?=$a_Values['IdItem']?></td>
                    <td class="text-left"><?=$a_Values['DescripcionCompleta']?></td>
                    <td class="text-left"><?=$a_Values['Descripcion']?></td>
                    <td class="text-center"><?=$a_Values['SumCantidad']?></td>
                    <td class="text-center"><?=number_format( $a_Values['SumMontoFinal'], 2 )?></td>
                </tr>
                    <?php $f_TotalCant = $f_TotalCant + $a_Values['SumCantidad']; ?>
                    <?php $f_TotalMonto = $f_TotalMonto + $a_Values['SumMontoFinal']; ?>
                <?php } ?>
                <tr class="table-danger">
                    <td class="font-weight-bold text-right">TOTALES</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td class="font-weight-bold text-center"><?=$f_TotalCant?></td>
                    <td class="font-weight-bold text-center"><?=number_format( $f_TotalMonto, 2 )?></td>
                </tr>
            </tbody>
        </table>
    </div>
</fieldset>
<br>
<fieldset class="">
    <legend class="w-auto">Servicios - Habitaciones</legend>
    <div class="table-responsive">
        <table class="table  table-bordered table-hover">
            <thead class="table-primary">
                <tr>
                    <th scope="col" class="text-center">Codigo</th>
                    <th scope="col" class="text-left">Descripcion</th>
                    <th scope="col" class="text-left">Linea</th>
                    <th scope="col" class="text-center">Cantidad</th>
                    <th scope="col" class="text-center">Valor Venta</th>
                    <th scope="col" class="text-center">Fecha Hora Salida</th>
                </tr>
            </thead>
            <tbody>
                <?php $f_TotalCant  = 0; ?>
                <?php $f_TotalMonto = 0; ?>
                <?php foreach ( $a_DataHabitaciones as $i_Key => $a_Values ) { ?>
                    <?php
                    /*$s_NombreUbicacion = "";
                    $o_SRV_UbicacionClienteHFN = new SRV_UbicacionClienteHFN();
                    $o_SRV_UbicacionClienteHFN->setNumeroDocumentoRef( $a_Values['NumeroDocumento'] );
                    $a_SRV_UbicacionClienteH = $o_SRV_UbicacionClienteHFN->select();
                    if( $a_SRV_UbicacionClienteH )
                    {
                        $s_NombreUbicacion = $a_SRV_UbicacionClienteH[0]->getObjectUbicacion()->getNombre();
                    }*/
                    ?>
                <tr>
                    <td class="text-center"><?=$a_Values['IdItem']?></td>
                    <td class="text-left"><?=$a_Values['DescripcionItemUbicacion']?></td>
                    <td class="text-left"><?=$a_Values['Descripcion']?></td>
                    <td class="text-center"><?=$a_Values['SumCantidad']?></td>
                    <td class="text-center"><?=number_format( $a_Values['SumMontoFinal'], 2 )?></td>
                    <td class="text-center"><?=$a_Values['FechaHoraSalidaReal']?></td>
                </tr>
                    <?php $f_TotalCant = $f_TotalCant + $a_Values['SumCantidad']; ?>
                    <?php $f_TotalMonto = $f_TotalMonto + $a_Values['SumMontoFinal']; ?>
                <?php } ?>
                <tr class="table-danger">
                    <td class="font-weight-bold text-right">TOTALES</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td class="font-weight-bold text-center"><?=$f_TotalCant?></td>
                    <td class="font-weight-bold text-center"><?=number_format( $f_TotalMonto, 2 )?></td>
                    <td>&nbsp;</td>
                </tr>
            </tbody>
        </table>
    </div>
</fieldset>
<br>
<fieldset class="">
    <legend class="w-auto">Servicios - Sauna</legend>
    <div class="table-responsive">
        <table class="table  table-bordered table-hover">
            <thead class="table-primary">
                <tr>
                    <th scope="col" class="text-center">Codigo</th>
                    <th scope="col" class="text-left">Descripcion</th>
                    <th scope="col" class="text-left">Linea</th>
                    <th scope="col" class="text-center">Cantidad</th>
                    <th scope="col" class="text-center">Valor Venta</th>
                </tr>
            </thead>
            <tbody>
                <?php $f_TotalCant  = 0; ?>
                <?php $f_TotalMonto = 0; ?>
                <?php foreach ( $a_DataSauna as $i_Key => $a_Values ) { ?>
                    <?php
                    /*$s_NombreUbicacion = "";
                    $o_SRV_UbicacionClienteHFN = new SRV_UbicacionClienteHFN();
                    $o_SRV_UbicacionClienteHFN->setNumeroDocumentoRef( $a_Values['NumeroDocumento'] );
                    $a_SRV_UbicacionClienteH = $o_SRV_UbicacionClienteHFN->select();
                    if( $a_SRV_UbicacionClienteH )
                    {
                        $s_NombreUbicacion = $a_SRV_UbicacionClienteH[0]->getObjectUbicacion()->getNombre();
                    }*/
                    ?>
                <tr>
                    <td class="text-center"><?=$a_Values['IdItem']?></td>
                    <td class="text-left"><?=$a_Values['DescripcionItemUbicacion']?></td>
                    <td class="text-left"><?=$a_Values['Descripcion']?></td>
                    <td class="text-center"><?=$a_Values['SumCantidad']?></td>
                    <td class="text-center"><?=number_format( $a_Values['SumMontoFinal'], 2 )?></td>
                </tr>
                    <?php $f_TotalCant = $f_TotalCant + $a_Values['SumCantidad']; ?>
                    <?php $f_TotalMonto = $f_TotalMonto + $a_Values['SumMontoFinal']; ?>
                <?php } ?>
                <tr class="table-danger">
                    <td class="font-weight-bold text-right">TOTALES</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td class="font-weight-bold text-center"><?=$f_TotalCant?></td>
                    <td class="font-weight-bold text-center"><?=number_format( $f_TotalMonto, 2 )?></td>
                </tr>
            </tbody>
        </table>
    </div>
</fieldset>
<br>
<fieldset class="">
    <legend class="w-auto">Servicios - Tiempos Extras</legend>
    <div class="table-responsive">
        <table class="table  table-bordered table-hover">
            <thead class="table-primary">
                <tr>
                    <th scope="col" class="text-center">Codigo</th>
                    <th scope="col" class="text-left">Descripcion</th>
                    <th scope="col" class="text-left">Linea</th>
                    <th scope="col" class="text-center">Cantidad</th>
                    <th scope="col" class="text-center">Valor Venta</th>
                </tr>
            </thead>
            <tbody>
                <?php $f_TotalCant  = 0; ?>
                <?php $f_TotalMonto = 0; ?>
                <?php foreach ( $a_DataTiempoExtra as $i_Key => $a_Values ) { ?>
                    <?php
                    $s_NombreUbicacion = "";
                    if( $a_Values['IdItem'] == "04872" )
                    {
                        //$b_noedit_pr = false;
                        $o_SRV_UbicacionClienteDetFN = new SRV_UbicacionClienteDetFN();
                        $o_SRV_UbicacionClienteDetFN->setNumeroDocumento( $a_Values['NumeroDocumento'] );
                        $a_SRV_UbicacionClienteDet = $o_SRV_UbicacionClienteDetFN->select();
                        if( $a_SRV_UbicacionClienteDet )
                        {
                            $b_CrtlUbicacion   = true;
                            $s_NombreUbicacion = "HABITACION ".$a_SRV_UbicacionClienteDet[0]->getObjectUbicacion()->getNombre();
                            //$s_CodigoItemUbica = $a_SRV_UbicacionClienteDet[0]->getIdItemTarifa();
                            $s_HoraInicioUbica = "";
                        }
                    }
                    ?>
                <tr>
                    <td class="text-center"><?=$a_Values['IdItem']?></td>
                    <td class="text-left">
                        <?=$s_NombreUbicacion?> - <?=$a_Values['DescripcionCompleta']?>
                    </td>
                    <td class="text-left"><?=$a_Values['Descripcion']?></td>
                    <td class="text-center"><?=$a_Values['SumCantidad']?></td>
                    <td class="text-center"><?=number_format( $a_Values['SumMontoFinal'], 2 )?></td>
                </tr>
                    <?php $f_TotalCant = $f_TotalCant + $a_Values['SumCantidad']; ?>
                    <?php $f_TotalMonto = $f_TotalMonto + $a_Values['SumMontoFinal']; ?>
                <?php } ?>
                <tr class="table-danger">
                    <td class="font-weight-bold text-right">TOTALES</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td class="font-weight-bold text-center"><?=$f_TotalCant?></td>
                    <td class="font-weight-bold text-center"><?=number_format( $f_TotalMonto, 2 )?></td>
                </tr>
            </tbody>
        </table>
    </div>
</fieldset>
<br>
-->
<fieldset class="">
    <legend class="w-auto">Facturas / Boletas Anuladas</legend>
    <div class="table-responsive">
        <table class="table  table-bordered table-hover">
            <thead class="table-primary">
                <tr>
                    <th scope="col" class="text-center">Fecha</th>
                    <th scope="col" class="text-center">Hora</th>
                    <th scope="col" class="text-left">Numero Documento</th>
                    <th scope="col" class="text-center">Descripcion</th>
                    <th scope="col" class="text-center">Cantidad</th>
                    <th scope="col" class="text-center">Precio Unit</th>
                    <th scope="col" class="text-center">Venta</th>
                    <th scope="col" class="text-center">Total</th>
                    <th scope="col" class="text-center">Motivo</th>
                </tr>
            </thead>
            <tbody>
                <?php $f_TotalCant  = 0; ?>
                <?php $f_TotalMonto = 0; ?>
                <?php foreach ( $a_VTA_Documento as $i_Key => $o_VTA_DocumentoBN ) { ?>
                <tr>
                    <td class="text-center"><?=substr( $o_VTA_DocumentoBN->getFechaDocumento(), 0, 10 )?></td>
                    <td class="text-center"><?=substr( $o_VTA_DocumentoBN->getFechaDocumento(), 11, 5 )?></td>
                    <td class="text-left"><?=$o_VTA_DocumentoBN->getDocumentoTipoSerieNumero()?></td>
                    <td class="text-center"></td>
                    <td class="text-center"></td>
                    <td class="text-center"></td>
                    <td class="text-center"></td>
                    <td class="text-center"><?=$o_VTA_DocumentoBN->getMontoTotal()?></td>
                    <td class="text-center"><?=$o_VTA_DocumentoBN->getAnulacionComentario()?></td>
                </tr>
                    <?php $f_TotalCant  = $f_TotalCant + $a_Values['SumCantidad']; ?>
                    <?php $f_TotalMonto = $f_TotalMonto + $o_VTA_DocumentoBN->getMontoTotal(); ?>
                <?php } ?>
                <tr class="table-danger">
                    <td class="font-weight-bold text-right">TOTALES</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td class="font-weight-bold text-center"><?=$f_TotalCant?></td>
                    <td class="font-weight-bold text-center"><?=number_format( $f_TotalMonto, 2 )?></td>
                    <td>&nbsp;</td>
                </tr>
            </tbody>
        </table>
    </div>
</fieldset>