Ver Mensaje Individual
  #3 (permalink)  
Antiguo 23/11/2010, 09:50
Avatar de Oviedo
Oviedo
 
Fecha de Ingreso: abril-2007
Ubicación: Venezuela
Mensajes: 128
Antigüedad: 17 años
Puntos: 0
Busqueda Respuesta: Estilo a cadena en php

Te comprendo amigo es que solo es un selct que hago en php y concateno todos los campos y lo muestro...osea sin html, porque intente con tabla y no me sirve..este es el script:

<?
header('Content-type: application/msword');
header('Content-Disposition: inline; filename=Reporte_Asignacion_diario'.date("d/m/Y").'.xls');
/*
header('Content-type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=Reporte_Asignacion'.date("d/m/Y").'.xls');
*/?>
<?php
/* CON ESTE SELECT BUSCA EN SIASODIAM*/
//----------------------------------------------------------
include("../../../../conex/conectar.php");
conectar();
//----------------------------------------------------------

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
#columna{
overflow: auto;
width: 940px;
height: 800px; /*establece la altura máxima, lo que no entre quedará por debajo y saldra la barra de scroll*/
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style>
.fc_main { background: #DDDDDD; border: 1px solid #000000; font-family: Verdana; font-size: 10px; }
.fc_date { border: 1px solid #D9D9D9; cursor:pointer; font-size: 10px; text-align: center;}
.fc_dateHover, TD.fc_date:hover { cursor:pointer; border-top: 1px solid #FFFFFF; border-left: 1px solid #FFFFFF; border-right: 1px solid #999999; border-bottom: 1px solid #999999; background: #E7E7E7; font-size: 10px; text-align: center; }
.fc_wk {font-family: Verdana; font-size: 10px; text-align: center;}
.fc_wknd { color: #FF0000; font-weight: bold; font-size: 10px; text-align: center;}
.fc_head { background: #000066; color: #FFFFFF; font-weight:bold; text-align: left; font-size: 11px; }
a:link {
color: #0000FF;
}
a:visited {
color: #0000FF;
}
a:hover {
color: #0000FF;
}
a:active {
color: #0000FF;
}
.Estilo10 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; }
.Estilo17 {font-size: 9px; }
.Estilo18 {font-size: 10px; font-weight: bold; }
.Estilo20 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FF0000; }
</style>
<title>ASODIAM</title>
</head>
<body>
<table width="580" height="43" border="0" cellpadding="0">
<tr>
<td width="179" height="18"><div align="center" class="Estilo17"><span class="Estilo20">ASODIAM</span></div></td>
<td width="598"><div align="center" class="Estilo17"><span class="Estilo10">RELACION DE MEDICOS (DETALLADO)</span></div></td>
<td width="211"><span class="Estilo17"><strong><?php echo date("d/m/Y")." ".date("h:s:a");?></strong></span></td>
</tr>
<tr>
<td height="19"><div align="center"><span class="Estilo17"></span></div></td>
<td><div align="center" class="Estilo17"><span class="Estilo10">PERIODO:</span>20/11/2010</div></td>
<td><span class="Estilo17"></span></td>
</tr>
</table>
<div align="center">
<p>
<?php
//echo "---".$equipo."--".$medico."--".$fd."--".$fh;
$dia = time()-(1*24*60*60);
$plun = date('d-m-Y', $dia);
$plum = date('d-m-Y');
$sql="
SELECT DISTINCT
TBL_Estudios.nro_op, TBL_Estudios.unidad, TBL_Estudios.numero, TBL_Estudios.fecha, TBL_Estudios.hora, TBL_Estudios.cedula,
TBL_Estudios.nombre, TBL_Estudios.apellido, TBL_Estudios.codigo_estudio, TBL_Estudios.estudio, TBL_Estudios.equipo, TBL_Estudios.tarifa,
TBL_Estudios.precio, TBL_Estudios.descuento, TBL_Estudios.si_listo, TBL_Estudios.medico, TBL_Estudios.tecnico, TBL_Equipos.nombre AS Expr2,
TBL_Medicos.nombre AS Expr1, TBL_Tecnicos.nombre AS Expr3, TBL_Honorarios.tipo, TBL_Honorarios.medtec, TBL_Honorarios.monto1,
TBL_Honorarios.monto2, TBL_Honorarios.monto3, TBL_Honorarios.monto4
FROM TBL_Estudios INNER JOIN
TBL_Equipos ON TBL_Estudios.equipo = TBL_Equipos.codigo INNER JOIN
TBL_Honorarios ON TBL_Estudios.codigo_estudio = TBL_Honorarios.codigo AND TBL_Estudios.tecnico = TBL_Honorarios.medtec INNER JOIN
TBL_Medicos ON TBL_Estudios.medico = TBL_Medicos.codigo INNER JOIN
TBL_Tecnicos ON TBL_Honorarios.medtec = TBL_Tecnicos.codigo WHERE (TBL_Honorarios.tipo = 'T')";

if (($equipo=="")and($tecnico=="")and($fd=="")and($fh =="")) {
$sql .= "and (fecha >='$plun') AND (fecha <='$plum') ORDER BY TBL_Estudios.fecha ";
}
//*********************************************CON FECHA********************************************* ****

if (($equipo=="")and($tecnico=="")and($fd!="")and($fh !="")) {
$sql .= "and (fecha >='$fd') AND (fecha <='$fh') ORDER BY TBL_Estudios.fecha";
}
if (($equipo!="")and($tecnico=="")and($fd!="")and($fh !="")) {
$sql .= "and ( TBL_Estudios.equipo='$equipo') AND (fecha >='$fd') AND (fecha <='$fh')ORDER BY TBL_Estudios.fecha";
}
if (($equipo=="")and($tecnico!="")and($fd!="")and($fh !="")) {
$sql .= "and ( TBL_Honorarios.medtec='$tecnico') AND (TBL_Estudios.tecnico = '$tecnico') AND (fecha >='$fd') AND (fecha <='$fh') ORDER BY TBL_Estudios.fecha ";
}

//************************************************** ********************************************
if (($equipo!="")and($tecnico!="")and($fd!="")and($fh !="")) {
$sql .= "and ( TBL_Honorarios.medtec='$tecnico') AND (TBL_Estudios.tecnico = '$tecnico') and ( TBL_Estudios.equipo='$equipo') AND (fecha >='$fd') AND (fecha <='$fh') ORDER BY TBL_Estudios.fecha";
}
//****************************************SIN FECHAS******************************************** **********

if (($equipo!="")and($tecnico=="")and($fd=="")and($fh =="")) {
$sql .= "and ( TBL_Estudios.equipo='$equipo') ORDER BY TBL_Estudios.fecha ";
}

if (($equipo=="")and($tecnico!="")and($fd=="")and($fh =="")) {
$sql .= "and ( TBL_Honorarios.medtec='$tecnico') AND (TBL_Estudios.tecnico = '$tecnico') ORDER BY TBL_Estudios.fecha ";
}

//--------------------------------------------------
if (($equipo!="")and($tecnico!="")and($fd=="")and($fh =="")) {
$sql .= "and ( TBL_Estudios.equipo='$equipo') and ( TBL_Honorarios.medtec='$tecnico') AND (TBL_Estudios.tecnico = '$tecnico')ORDER BY TBL_Estudios.fecha ";
}

//--------------------------------------------------


//die($sql);
$resultado=mssql_query($sql);
$cantidad=mssql_num_rows($resultado);
$fecha=""; //VARIABLE RECOMENDADA ANTES DEL BUCLE
$primeratabla=1;
?>
<!-----------------------------TABLA-------------------------------------------->
</p>
<form action="" method="post" name="frm" >
<table align="left" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>


<?php
while ($registro= mssql_fetch_array ($resultado)) {
if ($fecha!=$registro["17"]) {
$fecha=$registro["17"];
$tec=$registro["19"];
if ($primeratabla) {
echo "<font size='1'><strong>"."TOTAL:"." "."CANT.:"."(".($total+1).")"."-->"."MONTO:"."Bsf.:".$fin."</strong><br></font>";
echo '<div align="left">'."<hr>".'</div>';
echo '<font size="1"><span class="Estilo20">'."TÉCNICO:".'</span>' .$tec."--".$fecha.'</font>';
echo '<div align="left">'."<hr>".'</div>';

}
$total=0;
$fin=0;
$nro_fila=0;
?>

<?php
} // Fin MOSTRAR CABECERA
$total= $nro_fila;

$fech=substr($registro["3"],0,10);
//**********************OJO ESTA ES LA CADENA QUE QUIERO ORDENAR********************************
//************************************************** *****************************************
echo '<div align="left" ><font size="1">'.$fech." ".$registro["2"]." ".$registro["5"]." ".$registro["8"]." ".$registro["9"]; ?><? if (($registro["11"]=='A') or ($registro["11"]=='C')){ $calculo=$registro["22"]; echo "--Bsf."." ".$calculo; }else{$calculo=$registro["23"]; echo "--Bsf."." ".$calculo;} echo '</font></div>'; ?>

<?php
$fin+=$calculo;
$fin2+=$calculo;
$nro_fila++;
} // fin del while

mssql_free_result ($resultado);//Liberar Memorias
echo "<font size='1'>"."<strong>"."TOTAL:"." "."CANT.:"."(".($total+1).")"."-->"."MONTO:"."Bsf.:".$fin."</strong><br><br>"."</font>";
echo '<div align="left">'."<hr>".'</div>';
echo "<font size='2'>".'<span class="Estilo20">'."TOTAL TÉCNICO:".'</span>'.'<strong>'.$tec."--"."(".$cantidad.")"."-->"."MONTO:"."Bsf.:".$fin2."</strong><br><br>"."</font>";
echo '<div align="left">'."<hr>"."<br>".'</div>';
?></table>
</form>
<table width="200" border="1" align="right" cellpadding="0">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>