Comunidad de diseño web y desarrollo en internet online

Imprimir grilla con x registros

Citar            
MensajeEscrito el 13 Jul 2012 05:58 pm
Genero el pdf de lo mas bien, pero si son muchos registros se sale de la hoja.
Le puse un "break", para que parara justo hasta donde caen registros en la hoja, en este caso 40.

Ahí después con addPage, genero otra hoja y le agrego lo demás.

El problema es que debe ser dinámico, ya que pueden ser mil registros, al intentar imprimir algo asi, me quedara la %&$%$.

Estoy Usando AlivePDF para imprimir.
-Flex4 (flash builder 4)
-amfPHP
-mysql

Alguien tiene una idea de como hacerlo?

O como dejar algún tipo de formato de hoja, para que al generar la segunda con addPage, no se cree en blanco.

Por thor_mx

10 de clabLevel



 

chrome
Citar            
MensajeEscrito el 13 Jul 2012 06:00 pm
protected function btn_clickHandler(event:MouseEvent):void
{
pdfListadoVentas = new PDF(Orientation.PORTRAIT, Unit.POINT, Size.LETTER );
//pdfListadoVentas.setDisplayMode(Display.FULL_PAGE,Layout.SINGLE_PAGE);

pdfListadoVentas.addPage();

//Borde
pdfListadoVentas.lineStyle ( new RGBColor ( 0x0000CD ), .5, 0, 1, CapsStyle.SQUARE, JointStyle.BEVEL );
pdfListadoVentas.drawRect(new Rectangle ( 20, 20, 570, 750 ));

pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 20);
pdfListadoVentas.addText("Listado de Ventas",225,50);

//Linea1
pdfListadoVentas.drawRect(new Rectangle ( 20, 60, 570, 1 ));

// Boletas fecha
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 12);
pdfListadoVentas.addText("BOLETAS",30,75);

//Desde
pdfListadoVentas.addText("Desde: ",200,75);
//Hasta
pdfListadoVentas.addText("Hasta: ",380,75);

//Linea2
pdfListadoVentas.drawRect(new Rectangle ( 20, 80, 570, 1 ));

// Header Text
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 15);
pdfListadoVentas.addText("Fecha",60,100);
pdfListadoVentas.addText("Nº Boleta",130,100);
pdfListadoVentas.addText("Clientes",225,100);
pdfListadoVentas.addText("Rut",360,100);
pdfListadoVentas.addText("Contrato",430,100);
pdfListadoVentas.addText("Total",500,100);

//Linea3
pdfListadoVentas.drawRect(new Rectangle ( 20, 725, 570, 1 ));

// Total
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 14);
pdfListadoVentas.addText("CANTIDAD DE BOLETAS: ",30,750);
pdfListadoVentas.addText("TOTAL BOLETAS: ",380,750);

pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 10);

//Que array tomar, segun RadioButtons

if(rbHoy.selected == true){
for(var i:int=0; i<reporteHoy.length; i++)
{
//Array
pdfListadoVentas.addText(this.reporteHoy[i].fechaEmision, 60, 130+(i*15));
pdfListadoVentas.addText(this.reporteHoy[i].numBoleta, 150, 130+(i*15));
pdfListadoVentas.addText(this.reporteHoy[i].nombre, 210, 130+(i*15));
pdfListadoVentas.addText(this.reporteHoy[i].rut, 360, 130+(i*15));
pdfListadoVentas.addText(this.reporteHoy[i].numContrato, 450, 130+(i*15));
pdfListadoVentas.addText(this.reporteHoy[i].abono, 500, 130+(i*15));
}
pdfListadoVentas.save(Method.REMOTE, "http://localhost/amfphp/services/sevelec/create.php", Download.INLINE, "listadoVentas.pdf");
}
else if(rbOtraFechas.selected == true){
for(var i:int=0; i<reporteOtraFecha.length; i++)
{
//Array
pdfListadoVentas.addText(this.reporteOtraFecha[i].fechaEmision, 60, 130+(i*15));
pdfListadoVentas.addText(this.reporteOtraFecha[i].numBoleta, 150, 130+(i*15));
pdfListadoVentas.addText(this.reporteOtraFecha[i].nombre, 210, 130+(i*15));
pdfListadoVentas.addText(this.reporteOtraFecha[i].rut, 360, 130+(i*15));
pdfListadoVentas.addText(this.reporteOtraFecha[i].numContrato, 450, 130+(i*15));
pdfListadoVentas.addText(this.reporteOtraFecha[i].abono, 500, 130+(i*15));
if(i == 39){
var i2:int = 40;
pdfListadoVentas.addPage();

//Borde
pdfListadoVentas.lineStyle ( new RGBColor ( 0x0000CD ), .5, 0, 1, CapsStyle.SQUARE, JointStyle.BEVEL );
pdfListadoVentas.drawRect(new Rectangle ( 20, 20, 570, 750 ));

pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 20);
pdfListadoVentas.addText("Listado de Ventas",225,50);

//Linea1
pdfListadoVentas.drawRect(new Rectangle ( 20, 60, 570, 1 ));

// Boletas fecha
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 12);
pdfListadoVentas.addText("BOLETAS",30,75);

//Desde
pdfListadoVentas.addText("Desde: ",200,75);
//Hasta
pdfListadoVentas.addText("Hasta: ",380,75);

//Linea2
pdfListadoVentas.drawRect(new Rectangle ( 20, 80, 570, 1 ));

// Header Text
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 15);
pdfListadoVentas.addText("Fecha",60,100);
pdfListadoVentas.addText("Nº Boleta",130,100);
pdfListadoVentas.addText("Clientes",225,100);
pdfListadoVentas.addText("Rut",360,100);
pdfListadoVentas.addText("Contrato",430,100);
pdfListadoVentas.addText("Total",500,100);

//Linea3
pdfListadoVentas.drawRect(new Rectangle ( 20, 725, 570, 1 ));

// Total
pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 14);
pdfListadoVentas.addText("CANTIDAD DE BOLETAS: ",30,750);
pdfListadoVentas.addText("TOTAL BOLETAS: ",380,750);

pdfListadoVentas.setFont(new CoreFont ( FontFamily.HELVETICA ), 10);
/*
for(i2; i2<reporteOtraFecha.length; i2++)
{
//Array
pdfListadoVentas.addText(this.reporteHoy[i2].fechaEmision, 60, 130+(i2*15));
pdfListadoVentas.addText(this.reporteHoy[i2].numBoleta, 150, 130+(i2*15));
pdfListadoVentas.addText(this.reporteHoy[i2].nombre, 210, 130+(i2*15));
pdfListadoVentas.addText(this.reporteHoy[i2].rut, 360, 130+(i2*15));
pdfListadoVentas.addText(this.reporteHoy[i2].numContrato, 450, 130+(i2*15));
pdfListadoVentas.addText(this.reporteHoy[i2].abono, 500, 130+(i2*15));
}
//break;*/
}
}
pdfListadoVentas.save(Method.REMOTE, "http://localhost/amfphp/services/sevelec/create.php", Download.INLINE, "listadoVentas.pdf");

}


Como se puede ver, cuando el array llega a 39, genero la otra pagina, y la idea es seguir insertando los demas registros en la otra pagina.

Por thor_mx

10 de clabLevel



 

chrome
Citar            
MensajeEscrito el 13 Jul 2012 06:53 pm
Lo solucione temporalmete, pero todo estipulado, si en el for mi variable que recorre el array es igual a 40, que me genere otra hoja y siga insertando, si es igual a 80, lo mismo denuevo. El problema es que generare mucho codigo, por que tengo que dejarlo minimo para que sea capaz de imprimir hasta 10mil registros.

Mas ratito pienso como hacerlo dinamico.

Por thor_mx

10 de clabLevel



 

chrome
Citar            
MensajeEscrito el 13 Jul 2012 10:33 pm
Lo termine, quedo de lujo =), puedo imprimir los registros que quiera y me va generando las demás hojas solo :P

Por thor_mx

10 de clabLevel



 

chrome
Citar            
MensajeEscrito el 13 Jul 2012 10:55 pm
Ahi esta el video para que vean como quedo =)

Por thor_mx

10 de clabLevel



 

chrome
Citar            
MensajeEscrito el 14 Jul 2012 12:28 am
Ahora estoy parado con calcular los totales de boletas por hoja, y los totales de el dinero x hoja.

Lo tengo por mientras, en la ultima pagina, el total de todo.
Pero seria bueno tener ese total final, mas los totales por hoja.

Me resulta para la primera hoja, para las demas no se me ocurre como todavia, por los for e if's que tengo, no me dejo de las formas que intente hasta el momento T_T
** Mañana sigo

Por thor_mx

10 de clabLevel



 

chrome

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.