<table style="width: 100%;" border="0" cellpadding="0" cellspacing="0"  >
    <tr>
        <td><img src="<?="http://".$_SERVER['HTTP_HOST']."/".$o_GSS_CompaniaBN->getLogoFile()?>"  height="100" width="100" ></td>
        <td>&nbsp;</td>
        <td>ANALISIS DE PRECIOS UNITARIOS</td>
        <td >PRODUCCION: <?=str_pad( $o_PRD_OrdenCabBN->getIdOrdenCab(), 10, "0", STR_PAD_LEFT )?></td>
        <td>Fecha: <?=date( "Y-m-d" )?></td>
    </tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
</table>

<br>

<table style="width: 100%;" border="0" cellpadding="3" cellspacing="0" >
    <tr>
        <td style="width: 5%; background-color: #EEEEEE; border-bottom: 1px solid ; border-left: 1px solid; border-top: 1px solid; border-color: #B9B5B5;
                border-top-left-radius: 5px; border-bottom-left-radius: 5px;
                " align="center">
            <b>ITEM</b>
        </td>
        <td style="width: 20%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;"><b>DESCRIPCION</b></td>
        <td style="width: 25%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>FOTO REFERENCIAL</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>UNIDAD</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-right: 1px solid; border-color: #B9B5B5; 
                   border-bottom-right-radius: 5px; border-top-right-radius: 5px;" align="center">
            <b>CANTIDAD</b>
        </td>
    </tr>
    <?php
    $o_PRD_OrdenDetFN = new PRD_OrdenDetFN();
    $o_PRD_OrdenDetFN->setItemTipo( "PF" );
    $o_PRD_OrdenDetFN->setIdOrdenCab( $s_IdOrdenCab );
    $a_PRD_OrdenDet = $o_PRD_OrdenDetFN->select();
    $f_CostoUnitarioPF = 0;
    $f_CostoTotalPF    = 0;
    ?>
    <?php foreach ( $a_PRD_OrdenDet as $i_Key => $o_PRD_OrdenDetBN ){ ?>
        <?php
        $s_Background = $i_Key%2==0 ? "" : "background-color: #F0F0F0;";
        $f_CostoUnitarioPF = $o_PRD_OrdenDetBN->getPrecioCostoUnit();
        $f_CostoTotalPF    = $o_PRD_OrdenDetBN->getPrecioCostoTotal();
        ?>
        <tr>
            <td style="" align="center"><?=$o_PRD_OrdenDetBN->getIdItem()?></td>
            <td style="" align=""><?=$o_PRD_OrdenDetBN->getDescripcionItem()?></td>
            <td style="" align="center"><img src="<?="http://".$_SERVER['HTTP_HOST']."/".$o_PRD_OrdenDetBN->getObjectItem()->getUbicacionURL()?>" height="100" width="100" ></td>
            <td style="" align="center"><?=$o_PRD_OrdenDetBN->getObjectUnidad()->getDescripcionCorta()?></td>
            <td style="" align="center"><?=$o_PRD_OrdenDetBN->getCantidadPedida() ?></td>
        </tr>
    <?php } ?>
        <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
        <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
</table>

<br>

<table style="width: 100%;" border="0" cellpadding="1" cellspacing="0">
    <tr>
        <td style="width: 20%; font-weight: bold;" align="left">
            <div style="border-top-right-radius: 5px; border-top-left-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border: 1px solid #B9B5B5;
                border: 1px solid #B9B5B5; padding: 5px; ">
                &nbsp;&nbsp;&nbsp;&nbsp;I. MANO DE OBRA
            </div>
        </td> 
        <td>&nbsp;</td>
    </tr>
</table>
<table style="width: 100%;" border="0" cellpadding="3" cellspacing="0" >
    <tr>
        <td style="width: 5%; background-color: #EEEEEE; border-bottom: 1px solid ; border-left: 1px solid; border-top: 1px solid; border-color: #B9B5B5;
                border-top-left-radius: 5px; border-bottom-left-radius: 5px;
                " align="center">
            <b>ITEM</b>
        </td>
        <td style="width: 35%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;"><b>DESCRIPCION</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>UNIDAD</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>CANTIDAD</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="right"><b>VALOR UNI</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-right: 1px solid; border-color: #B9B5B5; 
                   border-bottom-right-radius: 5px; border-top-right-radius: 5px;" align="right">
            <b>VALOR TOT</b>
        </td>
    </tr>
    <?php
    $o_PRD_OrdenDetFN = new PRD_OrdenDetFN();
    $o_PRD_OrdenDetFN->addCondition( PRD_OrdenDetFN::ItemTipo, "IN", "('PM')", false );
    $o_PRD_OrdenDetFN->setIdOrdenCab( $s_IdOrdenCab );
    $a_PRD_OrdenDet = $o_PRD_OrdenDetFN->select();
    $f_SumaTotalPR = 0;
    ?>
    <?php foreach ( $a_PRD_OrdenDet as $i_Key => $o_PRD_OrdenDetBN ){ ?>
        <?php
        $s_Background = $i_Key%2==0 ? "" : "background-color: #F0F0F0;";
        $f_SumaTotalPR = $f_SumaTotalPR + $o_PRD_OrdenDetBN->getPrecioCostoTotal();
        ?>
        <tr>
            <td style="" align="center"><?=$o_PRD_OrdenDetBN->getIdItem()?></td>
            <td style="" align=""><?=$o_PRD_OrdenDetBN->getDescripcionItem()?></td>
            <td style="" align="center">UNIDAD</td>
            <td style="" align="center"><?=$o_PRD_OrdenDetBN->getCantidadPedida() ?></td>
            <td style="" align="right"><?=number_format( $o_PRD_OrdenDetBN->getPrecioCostoUnit(), 2 ) ?></td>
            <td style="" align="right"><?=number_format( $o_PRD_OrdenDetBN->getPrecioCostoTotal(), 2 ) ?></td>
        </tr>
    <?php } ?>
    <tr>
        <td style="" colspan="3">&nbsp;</td>
        <td style="" align="right" colspan="2"><b>SUB TOTAL</b>&nbsp;&nbsp;</td>
        <td style="border-top: 1px solid #B9B5B5;" align="right"><b><?=number_format( ( $f_SumaTotalPR ), 2 )?></b></td>
    </tr>
</table>

<br>

<table style="width: 100%;" border="0" cellpadding="1" cellspacing="0">
    <tr>
        <td style="width: 20%; font-weight: bold;" align="left">
            <div style="border-top-right-radius: 5px; border-top-left-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border: 1px solid #B9B5B5;
                border: 1px solid #B9B5B5; padding: 5px; ">
                &nbsp;&nbsp;&nbsp;&nbsp;II. MATERIALES
            </div>
        </td> 
        <td>&nbsp;</td>
    </tr>
</table>
<table style="width: 100%;" border="0" cellpadding="3" cellspacing="0" >
    <tr>
        <td style="width: 5%; background-color: #EEEEEE; border-bottom: 1px solid ; border-left: 1px solid; border-top: 1px solid; border-color: #B9B5B5;
                border-top-left-radius: 5px; border-bottom-left-radius: 5px;
                " align="center">
            <b>ITEM</b>
        </td>
        <td style="width: 35%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;"><b>DESCRIPCION</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>UNIDAD</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>CANTIDAD</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="right"><b>VALOR UNI</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-right: 1px solid; border-color: #B9B5B5; 
                   border-bottom-right-radius: 5px; border-top-right-radius: 5px;" align="right">
            <b>VALOR TOT</b>
        </td>
    </tr>
    <?php
    $o_PRD_OrdenDetFN = new PRD_OrdenDetFN();
    $o_PRD_OrdenDetFN->addCondition( PRD_OrdenDetFN::ItemTipo, "IN", "('PR','PE')", false );
    $o_PRD_OrdenDetFN->setIdOrdenCab( $s_IdOrdenCab );
    $a_PRD_OrdenDet = $o_PRD_OrdenDetFN->select();
    $f_SumaTotalPR = 0;
    ?>
    <?php foreach ( $a_PRD_OrdenDet as $i_Key => $o_PRD_OrdenDetBN ){ ?>
        <?php
        $s_Background = $i_Key%2==0 ? "" : "background-color: #F0F0F0;";
        $f_SumaTotalPR = $f_SumaTotalPR + $o_PRD_OrdenDetBN->getPrecioCostoTotal();
        ?>
        <tr>
            <td style="" align="center"><?=$o_PRD_OrdenDetBN->getIdItem()?></td>
            <td style="" align=""><?=$o_PRD_OrdenDetBN->getDescripcionItem()?></td>
            <td style="" align="center"><?=$o_PRD_OrdenDetBN->getObjectUnidad()->getDescripcionCorta()?></td>
            <td style="" align="center"><?=$o_PRD_OrdenDetBN->getCantidadPedida() ?></td>
            <td style="" align="right"><?=number_format( $o_PRD_OrdenDetBN->getPrecioCostoUnit(), 2 ) ?></td>
            <td style="" align="right"><?=number_format( $o_PRD_OrdenDetBN->getPrecioCostoTotal(), 2 ) ?></td>
        </tr>
    <?php } ?>
    <tr>
        <td style="" colspan="3">&nbsp;</td>
        <td style="" align="right" colspan="2"><b>SUB TOTAL</b>&nbsp;&nbsp;</td>
        <td style="border-top: 1px solid #B9B5B5;" align="right"><b><?=number_format( ( $f_SumaTotalPR ), 2 )?></b></td>
    </tr>
</table>
        
<br>

<table style="width: 100%;" border="0" cellpadding="1" cellspacing="0">
    <tr>
        <td style="width: 20%; font-weight: bold;" align="left">
            <div style="border-top-right-radius: 5px; border-top-left-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border: 1px solid #B9B5B5;
                border: 1px solid #B9B5B5; padding: 5px; ">
                &nbsp;&nbsp;&nbsp;&nbsp;III. SERVICIO EXTERNO
            </div>
        </td> 
        <td>&nbsp;</td>
    </tr>
</table>
<table style="width: 100%;" border="0" cellpadding="3" cellspacing="0" >
    <tr>
        <td style="width: 5%; background-color: #EEEEEE; border-bottom: 1px solid ; border-left: 1px solid; border-top: 1px solid; border-color: #B9B5B5;
                border-top-left-radius: 5px; border-bottom-left-radius: 5px;
                " align="center">
            <b>ITEM</b>
        </td>
        <td style="width: 35%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;"><b>DESCRIPCION</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>UNIDAD</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>CANTIDAD</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="right"><b>VALOR UNI</b></td>
        <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-right: 1px solid; border-color: #B9B5B5; 
                   border-bottom-right-radius: 5px; border-top-right-radius: 5px;" align="right">
            <b>VALOR TOT</b>
        </td>
    </tr>
    <?php
    $o_PRD_OrdenDetFN = new PRD_OrdenDetFN();
    $o_PRD_OrdenDetFN->addCondition( PRD_OrdenDetFN::ItemTipo, "IN", "('PS')", false );
    $o_PRD_OrdenDetFN->setIdOrdenCab( $s_IdOrdenCab );
    $a_PRD_OrdenDet = $o_PRD_OrdenDetFN->select();
    $f_SumaTotalPR = 0;
    ?>
    <?php foreach ( $a_PRD_OrdenDet as $i_Key => $o_PRD_OrdenDetBN ){ ?>
        <?php
        $s_Background = $i_Key%2==0 ? "" : "background-color: #F0F0F0;";
        $f_SumaTotalPR = $f_SumaTotalPR + $o_PRD_OrdenDetBN->getPrecioCostoTotal();
        ?>
        <tr>
            <td style="" align="center"><?=$i_Key+1?></td>
            <td style="" align=""><?=$o_PRD_OrdenDetBN->getDescripcionItem()?></td>
            <td style="" align="center">UNIDAD</td>
            <td style="" align="center"><?=$o_PRD_OrdenDetBN->getCantidadPedida() ?></td>
            <td style="" align="right"><?=number_format( $o_PRD_OrdenDetBN->getPrecioCostoUnit(), 2 ) ?></td>
            <td style="" align="right"><?=number_format( $o_PRD_OrdenDetBN->getPrecioCostoTotal(), 2 ) ?></td>
        </tr>
    <?php } ?>
    <tr>
        <td style="" colspan="3">&nbsp;</td>
        <td style="" align="right" colspan="2"><b>SUB TOTAL</b>&nbsp;&nbsp;</td>
        <td style="border-top: 1px solid #B9B5B5;" align="right"><b><?=number_format( ( $f_SumaTotalPR ), 2 )?></b></td>
    </tr>
</table>

<BR>

<table style="width: 100%;" border="0" cellpadding="3" cellspacing="0" >
    <tr>
        <td style="width: 5%;" align="center">
            &nbsp;
        </td>
        <td style="width: 35%; ">&nbsp;</td>
        <td style="width: 10%; " align="center"><b>&nbsp;</b></td>
        <td style="width: 10%; " align="center"><b>&nbsp;</b></td>
        <td style="width: 10%; " align="right"><b>TOTAL</b></td>
        <td style="width: 10%; " align="right">
            <b> <?=number_format( $f_CostoTotalPF, 2 )?> </b>
        </td>
    </tr>
</table>

<br>

<table style="width: 100%;" border="0" cellpadding="3" cellspacing="0" >
    <tr>
        <td style="" align="right" colspan="5"><b>Costo Unitario sin IGV</b></td>
        <td style="width: 10%; " align="right">
            <b> <?=number_format( $f_CostoUnitarioPF, 2 )?> </b>
        </td>
    </tr>
</table>

<br>

<table style="width: 100%;" border="0" cellpadding="3" cellspacing="0" >
    <tr>
        <td style="" align="right" colspan="5"><b>Costo Unitario incluido IGV</b></td>
        <td style="width: 10%; " align="right">
            <b> <?=number_format( $f_CostoUnitarioPF * 1.18, 2 )?> </b>
        </td>
    </tr>
</table>

<br>

<table style="width: 100%;" border="0" cellpadding="0" cellspacing="0"  >
    <tr>
        <td colspan="6">NOTA: No se esta considerando mantenimiento de las maquinas utilizadas, debido a que se esta verificando y se esta recolectando informacion para el repectivo analisis</td>
    </tr>
</table>