Tema: impresion
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/04/2009, 13:10
lutedi
 
Fecha de Ingreso: abril-2009
Mensajes: 6
Antigüedad: 15 años, 1 mes
Puntos: 0
Respuesta: impresion

<?
include("conection.php");
$nfact = $_POST['fact'];
?>
<br><p><br><p><br><p><br><p><br><p><br><p><br><p>< br><p><br><p>
<center><font size="6">Reporte de Facturas por Fecha</font></center>

<?
$link=Conectarse();
$sql = "select factu.id, paciente.ap, paciente.am, concepto.descri, concepto.monto, areas.descri, doctor.ap, doctor.am,

factu.cant, factu.num, factu.igv, factu.ruc, factu.fecha, factu.porcen, paciente.dire from factu inner join paciente on

paciente.idpac = factu.idpac inner join concepto on concepto.idconcep = factu.idconcep inner join areas on areas.idar =

factu.idar inner join doctor on doctor.iddoc = factu.iddoc where num = $nfact";
$result = mysql_query($sql, $link);
if ($row = mysql_fetch_array($result)){
mysql_field_seek($result,0);


$totall=mysql_num_rows ($result); // cuenta cuantas filas tiene la consulta


$fecha5= $row[12];
$fecha6= array(substr($fecha5,0,4),substr($fecha5,5,2),subs tr($fecha5,8,2));
$fecha6=implode("-",array_reverse($fecha6));

//echo $row[1]," ", $row[2],"<br>", $row[6]," ", $row[7],"<br>", $row[9],"<br>", $row[10],"<br>", $row[11],"<br> ", $fecha6;
//$xigv = $row[10];
echo "<table width=800 border=1>";
echo "<tr>";
echo "<td><font size=4>$row[1] $row[2]</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td><font size=4>$row[14]</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td><font size=4>$row[11]</font></td>";
echo "<td>&nbsp;</td>";
echo "<td align = right><font size=4>$fecha6</font></td>";
echo "</tr>";
echo "</table>";


while ($field = mysql_fetch_field($result)){
} do {

$cuen = $row[4] * $row[8];

?>
<table width=1000 height=0 border=1>
<tr>
<td width=115><font size=5><? echo $row[8]; ?></font></td>
<td width=660><font size=5><? echo $row[3]; ?></font></td>
<td width=130><font size=5><? echo $row[4]; ?></font></td>
<td ><font size=5><? echo $cuen; ?></font></td>
</tr>
</table>


<?
} while ($row = mysql_fetch_array($result));
} else {

echo "No se encontraron resultados!";
}
?>

<?php

$query = mysql_query("SELECT SUM(factu.cant * concepto.monto) FROM factu, concepto where (factu.idconcep = concepto.idconcep)

and factu.num = $nfact");
$resultado = mysql_result($query, 0);


//Ahora tienes el resultado de la suma en $resultado
$tt="Total S/. ";
//echo $tt;
//echo $resultado;
$xigv = $resultado * 0.19;
$xtotal = $resultado + ($resultado * 0.19);
?>
<br><p><br><p><br><p>
<table width="1000" border="1">
<tr>
<td align=right><font size="5"><? echo $resultado; ?></font></td>
</tr>

<tr>
<td align=right><font size="5"><? echo $xigv; ?></font></td>
</tr>

<tr>
<td align=right><font size="5"><? echo $xtotal; ?></font></td>
</tr>
</table>

<center><a href="reportenumfact.php">Volver</a><br>
<a href="menu.php">Inicio</a></center>