$tt=($myrow17a['importe']+$myrow17a['gastos'])-$t;
$tare= (float) noRound($myrow17a['notaCredito']+($importe[0]+$myrow17a['gastos']+($iva[0]+$ivaGasto-($tivaOferta[0]+$tivaDescuento[0]+$myrow17a['ivaDescuentoPP'])))-($oferta[0]+$descuento[0]+$myrow17a['descuentoPP']),2);
 
$c= (float) ($myrow17a['importe']-$tare);
if(($c>=-0.96 and $c<=0.03 )or ($c>0 and $c<=0.30)){
    $subt=($myrow17a['importe']-$tare);
    $total=$myrow17a['importe'];
}else{
    $total=(float) $tare;
}

echo '$'.noRound($total,2);

//echo '$'.number_format($subTotalCaptura,2);    

?>        
</th>
</tr>


</table>

</div>
 
<br /><br />
<div id="cont3">
<table class="table-forma">
$stringData = $cadena3;
//fwrite($fh, pack("CCC",0xef,0xbb,0xbf));
fwrite($fh, $stringData);
if ($totalR > 1) {
    $stringData = $cadena4;
    //fwrite($fh, pack("CCC",0xef,0xbb,0xbf));
    fwrite($fh, $stringData);
}
fclose($fh);
?>


<?php 
if ($totalR > 0) {
    echo '<script>';
    echo 'window.alert("ARCHIVO GENERADO CORRECTAMENTE! TICKET: ' . $_GET['ticket'] . ', RFC: ' . $r . ', IMPORTE: ' . (double) number_format(noRound($mT[0] + $iva[0], 2), 2) . ' ");';
    echo 'window.close();';
    echo '</script>';
} else {
    echo '<script>';
    echo 'window.alert("HAY UN PROBLEMA!");';
    echo 'window.close();';
    echo '</script>';
}
function writeUTF8File($filename, $content)
{
    $f = fopen($filename, "w");
    # Now UTF-8 - Add byte order mark
    fwrite($f, pack("CCC", 0xef, 0xbb, 0xbf));
    fwrite($f, $content);
    fclose($f);
    
    <div align="center">
      <label>
      <input name="update" type="submit" id="update" value="Actualizar Datos" />
      
      <br />
      <?php 

      //echo '<br>';
      //echo '<span >Total Factura: '.'$'.number_format($totalInvoice,2).'</span>';
      //echo '<br>';
      //echo '<span >Total Captura: '.'$'.number_format($totalCapturado,2).'</span>';
      //echo '<br>';
      //echo '<span >Diferencia: '.'$'.number_format($totalInvoice-$totalCapturado,2).'</span>';
      $total= noRound($myrow17a['importe'],2)-noRound($tare+$subt+$myrow17a['notaCredito'],2);
      
      //echo $myrow17a['importe'].' =>  '.($tare+$subt+$myrow17a['notaCredito']);
      
	  if( $total==0){ ?>
	  <br>
      <input name="send" type="submit" src="../imagenes/btns/sendsolicitud.png" id="send" value="Enviar Solicitud" onClick="if(confirm('&iquest;Est&aacute;s seguro que deseas enviar la solicitud?') == false){return false;}"  <?php if($total>1 ){ echo 'disabled=""';}?>/>
       </br>
       <?php } ?>
	  </label>
      <label>
    
      </label>
    </div>
        
        
<tr>
<th>Redondeo/Diferencia</th>
<td>
<?php 


$total=$myrow17a['importe']-$tare;

if(($total>=-0.90 and $total<0 )or ($total>0 and $total<=0.1)){
    $total=(int) $total;
}else{
    $total=(float) $total;
}


echo '$'.noRound( $total);
?>        
</td>
</tr>

</table> 
       
        <br></br>        


    
    <div align="center">
      <label>
      <input name="update" type="submit" id="update" value="Actualizar Datos" />
      
      <br />
$total=$subTotal-$subTotalCaptura;
     $total=$subTotalCaptura-$total;    
     }else{
   $total=$subTotalCaptura-$subTotal;
     $total=$subTotalCaptura-$total;
     }//es menor la cantidad
     }*/


$diferencia=($myrow17a['importe']+$myrow17a['iva'])-($subTotalCaptura-$rounding);
if($diferencia<=0 and $diferencia>=-0.90){
    $rounding=noRound($total*-1,2);
    echo '$'.number_format($subTotalCaptura-$rounding,2);  
    $t=$subTotalCaptura-$rounding;
}elseif($diferencia>=0 and $diferencia<=0.10){
    $rounding=noRound($total*1,2);
    echo '$'.number_format($subTotalCaptura+$rounding,2);   
    $t=$subTotalCaptura+$rounding;
}


$tt=($myrow17a['importe']+$myrow17a['iva']+$myrow17a['gastos'])-$t;
$tt=number_format($tt,2);

?>        
</td>
</tr>


</table>
        ?>


<?php 
        echo '$' . noRound($myrow['acumulado'], 2);
        //echo 'ss'.$cargos-$abonos;
        ?>

</td>
    
       <td ><?php 
        echo '$' . noRound($noAplicados - $aplicados, 2);
        ?>
</td>
       <td ><?php 
        echo '$' . noRound($cargos - $abonos, 2);
        ?>
</td>
      <td >
<a  href="javascript:ventanaSecundaria2('../cargos/detallesClientes.php?nombre=<?php 
        echo $myrowps['nomCliente'];
        ?>
&numCliente=<?php 
        echo $_GET['seguro'];
        ?>
&seguro=<?php 
        echo $_GET['seguro'];
        ?>
&nombreCliente=<?php 
        echo $myrow['nomCliente'];
        ?>