Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/04/2014, 22:03
Avatar de asus090102
asus090102
 
Fecha de Ingreso: mayo-2012
Ubicación: Ensenada- Buenos Aires
Mensajes: 67
Antigüedad: 12 años
Puntos: 1
imprimir directamente

Holas, espero anden bien, les quiero realizar la siguiente consulta: Hoy en día tengo funcionando un sistema que hace que los datos ingresados en la hoya 1 los lleva por post a la hoja 2 y los guarda en una tabla. Una vez guardados los lleva a la hoja 3 donde pregunta si se quiere imprimir ese registro, de ser así genera un pdf con el formato que yo deseo. Y despues tengo que elegir imprimir, luego que impresora y recién ahí me sale la impresión.
Lo que quisiera es que cuando se presione el submit de la primera página lo imprima directamente a travez de mi pdf, y que una vez impreso lo elimine.
Les paso el código que tengo y quisiera cambiar.

HOJA DE INGRESO DE DATOS

Código PHP:
<?php
include("seguridad.php");
include (
"conexion.php");
$fechaedate("Y/m/d");
$rst_estado=  mysql_query("SELECT * FROM estado ORDER BY id_estado;"$conexion);
$sql=mysql_query("select MAX(id_denuncia) from denuncia"$conexion);
while(
$sql_max mysql_fetch_row($sql))
    {
$max=$sql_max[0];
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ALTA</title>
<style type="text/css">
form { margin-left: 140px;  text-align: center; padding: 10px; opacity: 0.8; background: #33CC33; width: 365px; } 
label { font-size: 18px; text-align: center; font-family: Arial, Helvetica, sans-serif; color: #FFF; display: block; } 
.campo { width: 254px; height: 30px; margin-bottom: 20px; border: 1px Solid #84AA00; background: #84AA00; background-image: url(f1.jpg); background-repeat: no-repeat; padding: 2px; color: #669966; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } 
#boton_enviar {  text-align: center;  background: #aaCCaa; width: 20%; margin: 30 auto ;height: 27px;  border: 1px ; } 
</style>
</head>
<BODY STYLE="background: url(img/escudo.jpg) no-repeat scroll center;">
<form action="denuncia_alta_guar.php" method="post">
<input OnFocus="this.blur()" type="hidden"  name="usuario" value="<? echo $_SESSION["usuarioactual"];?>" />
<label><h3>ALTA DE DENUNCIA:</h3></label>
<br><table><tr><td><label for="fechae">FECHA:</label><input type="text" OnFocus="this.blur()"  name="fechae" value="<?php echo $fechae;?>" /></td><td>
<label for="ingreso">INGRESO:</label><input OnFocus="this.blur()" name="id_denuncia" value="<?php echo $max+1;?>"/></td></tr><tr><td>
<label for="expediente">DENUNCIA:</label><input type="text" name="denuncia" align="center"/></td><td>
<label for="propietario">PROPIETARIO:</label><input type="text" name="propietario" align="center"/></td></tr><tr><td>
<label for="profesional">PROFESIONAL:</label><input type="text" name="profesional" align="center"/></td><td>
<label for="detalle">DETALLE:</label><input type="text" name="detalle" align="center"/>
</td></tr><tr><td><label for="telefono">TELEFONO:</label><input type="text" name="telefono" align="center"/></td><td>
<label for="nomenclatura">NOMENCLATURA:</label><input type="text" name="nomenclatura" align="center"/></td></tr><tr><td>
<label for="expediente">EXPEDIENTE:</label><input type="text" name="expediente" align="center"/></td><td>
<label for="estado">ESTADO:</label><select style="width:170" name="estado">
<option selected="" value="estado" >INGRESAR</option>
<?php
while ($fila_estado=mysql_fetch_array($rst_estado))
{
echo 
"<option value='".$fila_estado["estado"]."' > ".$fila_estado["estado"]."</option>";
}
mysql_close($conexion);
?>
</select></td></tr></table>
<table><input type="submit" id="boton_enviar" name="enviar" value="Enviar" />
</table></form></body></html>
HOJA EN QUE SE GUARDAN Y ENVIA A IMPRIMIR

Código PHP:
<?php
include("seguridad.php");
include (
"conexion.php");
$fechae $_POST['fechae'];
$expediente $_POST['expediente'];
$propietario $_POST['propietario'];
$profesional $_POST['profesional'];
$nomenclatura $_POST['nomenclatura'];
$usuario $_POST['usuario'];
$detalle $_POST['detalle'];
$denuncia $_POST['denuncia'];
$estado $_POST['estado'];
$telefono $_POST['telefono'];
$sql "INSERT INTO denuncia (fechae,expediente,propietario,profesional,nomenclatura,usuario,denuncia,detalle,estado,telefono) VALUES 
('$fechae','$expediente','$propietario','$profesional','$nomenclatura','$usuario','$denuncia','$detalle','$estado','$telefono')"
;
mysql_query($sql);
mysql_query("SET NAMES 'utf8'"); 
mysql_close($conexion);
header("location:conf_print_den.php");
?>
HOJA EN QUE SE CONSULTA SI SE QUIERE IMPRIMIR
Código PHP:
<?php
include("seguridad.php");
include (
"conexion.php");
$rst_ordenes=  mysql_query("SELECT * FROM denuncia WHERE id_denuncia=".$_REQUEST['id_denuncia'].";",$conexion);
$fila_ordenmysql_fetch_array($rst_ordenes);
$sql=mysql_query("select MAX(id_denuncia) from denuncia"$conexion);
while(
$sql_max mysql_fetch_row($sql)) 
    {
$max=$sql_max[0];

?>
<html><body>
<form action="imprimir_denuncia.php?id_denuncia=<?php echo $_REQUEST["id_denuncia"?>" method="post"> 
<table style="width: 100; text-align: center; margin-left: 205; margin-right: auto; height: 100px;" border="1" cellpadding="0" cellspacing="0">
<th align="center" style="width: 100%" class="style5">SE VA A IMPRIMIR</th><tr><td align="center" width="200">
LA DENUNCIA N°:</br></tr><tr><td><span align="center" >
 <input text-align="center" type="text" name="id_denuncia" maxlength="20" value="<?php echo $max;?>"/>   
 </span></td>
<tr><td align="center"><input value="OK" type="submit"></td></tr></table></body></html>
PDF GENERADO PARA LUEGO IMPRIMIR

Código PHP:
<?php
require_once('class.ezpdf.php');
$pdf =& new Cezpdf('a4');
$pdf->selectFont('fonts/courier.afm');
$pdf->ezSetCmMargins(0,0,1,1);
$pdf->ezText('',12);
include (
"conexion.php");
$rst_ordenes "SELECT * FROM denuncia WHERE id_denuncia=".$_REQUEST["id_denuncia"].";";
$fila_orden mysql_query($rst_ordenes,$conexion) or die(mysql_error());
$totEmp mysql_num_rows($fila_orden);
while(
$datatmp mysql_fetch_assoc($fila_orden)) {
$data[] = array_merge($datatmp);
}
    
$titles1= array ('id_denuncia'=>'<b>NUMERO DE INGRESO:</b>');
    
$titles4 = array('denuncia'=>'<b>DENUNCIA:</b>',' '=>'                                  ','propietario'=>'<b>PROPIETARIO:</b>','profesional'=>'<b>PROFESIONAL:</b>');
    
$titles5 = array('detalle'=>'<b>DETALLE:</b>','telefono'=>'<b>TELEFONO:</b>');
    
$titles6 = array('nomenclatura'=>'<b>NOMENCLATURA:</b>');
    
$titles7 = array('expediente'=>'<b>EXPEDIENTE:</b>');
    
$titles8 = array('  ');
$options = array(
                
'shadeCol'=>array(0,0,0),
                
'xOrientation'=>'center',
                
'width'=>530
                 
);
$txttit1 "<b>OBRAS</b>";
$txttit "<b>FORMULARIO</b>";
$txttitdire "<b>C";
$txttittel "Tel.: ";
$pdf->ezText("\n"10);
$pdf->ezText($txttit120,$options);
$pdf->ezText($txttit10,$options);
$pdf->ezText($txttitdire10,$options);
$pdf->ezText($txttittel10,$options);
$pdf->ezText("\n"10);
$pdf->ezTable($data$titles1,''$options);
$pdf->ezText("\n"4);
$pdf->ezTable($data$titles4,''$options);
$pdf->ezText("\n"4);
$pdf->ezTable($data$titles5,''$options);
$pdf->ezText("\n"4);
$pdf->ezTable($data$titles7,''$options);
$pdf->ezText("\n"18);
$pdf->ezText("Recibida por: .................................................         Firma: ....................................................................."12);
$pdf->ezText("\n"4);
$pdf->ezText("<b>Fecha:</b> ".date("d/m/Y"), 10);
$pdf->ezText("\n"20);
$txttit1 "<b>OBRAS</b>";
$txttit "<b>FORMULARIO</b>";
$txttitdire "<b>C";
$txttittel "Tel.: ";
$pdf->ezText("\n"10);
$pdf->ezText($txttit120,$options);
$pdf->ezText($txttit10,$options);
$pdf->ezText($txttitdire10,$options);
$pdf->ezText($txttittel10,$options);
$pdf->ezText("\n"10);
$pdf->ezTable($data$titles,''$options);
$pdf->ezText("\n"4);
$pdf->ezTable($data$titles4,''$options);
$pdf->ezText("\n"4);
$pdf->ezTable($data$titles5,''$options);
$pdf->ezText("\n"4);
$pdf->ezTable($data$titles7,''$options);
$pdf->ezText("\n"18);
$pdf->ezText("Denunciada por: .................................................         Firma: ....................................................................."12);
$pdf->ezText("\n"4);
$pdf->ezText("<b>Fecha:</b> ".date("d/m/Y"), 10);
$pdf->ezStream();
?>
Perdón por la desproligidad en el código. Agradezco su ayuda. Abrazo.