Ver Mensaje Individual
  #3 (permalink)  
Antiguo 19/05/2009, 07:36
alcisma
 
Fecha de Ingreso: marzo-2009
Mensajes: 26
Antigüedad: 15 años
Puntos: 0
Respuesta: problema con sintaxis

gracias, espera y te paso el codigo

<?php
include ("conectarse.php");
include ("seguridad.php");
$color="#E4E4E4";

if ($feci2 != "")
{
$f1 = explode ("/", $feci2);
$d1 = $f1[0]; $m1 = $f1[1]; $a1 = $f1[2];
$fecha1 = date("j F, Y", mktime(0,0,0,$m1,$d1,$a1));
$fechai = date("d-m-Y", mktime(0,0,0,$m1,$d1,$a1));
}

if ($fecf2 != "")
{
$f2 = explode ("/", $fecf2);
$d2 = $f2[0]; $m2 = $f2[1]; $a2 = $f2[2];
$fecha2 = date("j F, Y", mktime(0,0,0,$m2,$d2,$a2));
$fechaf = date("d-m-Y", mktime(0,0,0,$m2,$d2,$a2));
}
echo'
<head><title>LISTADO DE VENTAS DIARIAS</title></head>
<center><h4>REPUBLICA DE COLOMBIA</h4></center>
<center><h4>DEPARTAMENTO DEL MAGDALENA</h4></center>
<center><h4>CENTRAL DE TRANSPORTE DE SANTA MARTA LTDA</h4></center>
<center><h4>LISTADO DE VENTAS DIARIAS </h4></center>
<center><h4> FECHA <td><input type="text" readonly value="'.$fechai.'"> </td> </h4></center>
<script language="JavaScript" src="funciones.js"></script>
<link REL=stylesheet HREF=tstyles.css TYPE=text/css>
<table align=center width=695 style="font-size:12px">
<tr width=700 align=center>
<td width=180><b>NOMBRE</td>
<td width=80><b>VLR DESTINO</td>
<td width=80><b>VLR TRANSITO</td>
<td width=80><b>VLR ALCOHOL (80%)</td>
<td width=80><b>VLR ALCOHOL (20%)</td>
<td width=100><b>TOTAL </td>
</tr>
';
$bd=conectarse();
$nuevo=mysql_query("select * from asig_turnos_tra ",$bd);
while($reg9=mysql_fetch_array($nuevo))
{
$fecha = $reg9["fecha"];
list($dia,$mes,$anyo) = explode("-",$fecha);

$fecha_finis = $reg9["fecha_end"];
list($dia_1,$mes_1,$anyo_1) = explode("-",$fecha_finis);
if (($dia == $d1) && ($mes == $m1) && ($dia_1 <= $d2) && ($mes_1 == $m2) )
{
$dato_ope = $reg9["identificacion"];
$consecutivo_turno = $reg9["consecutivo"];
echo $consecutivo_turno;
$usu_bd=mysql_query("select * from ingreso_turno where (consecutivo='$consecutivo_turno') ",$bd);
while($reg_usu_bd=mysql_fetch_array($usu_bd))
{
$total_tvd+=$reg_usu_bd["TVD"];
$total_tvt+=$reg_usu_bd["TVT"];
$total_tvp+=$reg_usu_bd["TVP"];
$total_tvp_2+=$reg_usu_bd["TVP_2"];
$total_total+=$reg_usu_bd["TOTAL_SU"];
echo'
<tr class=select style="font-size:12px" bgcolor="'.$color.'">
<td>
&nbsp;&nbsp;&nbsp;&nbsp;
'.$reg_usu_bd["empresa"].'
</td>
<td>
&nbsp;&nbsp;&nbsp;
'.number_format($reg_usu_bd["TVD"]).'
</td>
<td>
&nbsp;&nbsp;&nbsp;
'.number_format($reg_usu_bd["TVT"]).'
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;
'.number_format($reg_usu_bd["TVP"]).'
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;
'.number_format($reg_usu_bd["TVP_2"]).'
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;
'.number_format($reg_usu_bd["TOTAL_SU"]).'
</td>
</tr>

';
// }
//}
if ($color=="#E4E4E4")
{
$color="#DEE7EB";
}else{
$color="#E4E4E4";
}
}
}
}

mysql_free_result($usu_bd);
mysql_close($bd);
echo'
<tr align=center bgcolor="'.$color.'">
<td>
<b>TOTAL<b>
</td>
<td>
<b>'.number_format($total_tvd).'<b>
</td>
<td>
<b>'.number_format($total_tvt).'<b>
</td>
<td>
<b>'.number_format($total_tvp).'<b>
</td>
<td>
<b>'.number_format($total_tvp_2).'<b>
</td>
<td>
<b>'.number_format($total_total).'<b>
</td>
</tr>

<tr>
<td width=100% colspan=4>
<table width=100%>
<tr><td width=85%>&nbsp;</td>
<td width=15% align=center>
<a class="ico" title="Imprimir lista" href="" onClick="return printPage2()"><img src="img2/ico_imprimir.png" width="18" height="18" border=0><br>Imprimir</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<META http-equiv=Refresh content="300; URL=login.php">
';
?>

lo que pasa es que los turnos empiezan desde las 6 am de un dia y terminan a las 6 am del otro. y cuando imprimo el diario me sale todas las veces que compra el cliente, es decir, si el cliente compro hoy y mañana antes de las 6 am me sale como si fueran las dos compras no como si fuera una sola, no me une las compras que realizan los clientes en dos dias.

gracias por tu ayuda.