@@ -611,34 +611,44 @@ function composeTable() {
611
611
$ fromItem =intval ($ a [0 ]);
612
612
$ toItem =intval ($ a [1 ]);
613
613
}
614
- // Datos
615
- $ numentries =count ($ this ->orden );
616
- $ orden =1 ;
617
- $ rowcount =0 ;
618
- $ printed =1 ;
614
+ // OrdenSalida::getData() nos da _todos_ los perros de una manga que cumplen con el modo de recorrido dado
615
+ // como aquí fromItem y toItem se refieren al puesto en que aparecen en la consola, sera preciso hacer
616
+ // una criba inicial, excluyendo a los que no coincidan con las categorias pedidas (validCats)
617
+ $ items =array ();
619
618
foreach ($ this ->orden as $ row ) {
620
- // elimina todos los perros que no entran en las categorias a imprimir
621
- if (!category_match ($ row ['Categoria ' ],$ this ->heights ,$ this ->validcats )) continue ;
622
- if (($ orden <$ fromItem ) || ($ orden >$ toItem ) ) { $ orden ++; continue ; } // not in range; skip
623
- // in team best min/max, there can be more dogs than max, so if dog is marked as "Not Presented" skip
624
- if (intval ($ row ['NoPresentado ' ])===1 ) { $ orden ++; continue ; } ;
625
- // if number of entries is lower than rows per page, print every entries in just one page
626
- $ page =true ; // check for need to page categories
627
- if ($ numentries <= $ this ->numrows ) $ page =false ; // every dogs fits in one sheet
628
- if ( isMangaPreAgility ($ this ->manga ->Tipo )) $ page =false ; // pre-agility rounds does not page heights
629
- // if ($this->validcats=="XLMST") $page=false; // any height is allowed: do not page
619
+ // pending: trying to optimize when "validcats" matches "recorrido"
620
+ if (category_match ($ row ['Categoria ' ],$ this ->heights ,$ this ->validcats )) array_push ($ items ,$ row );
621
+ }
622
+ // ahora que hemos filtrado, vamos a imprimir solo los que esten entre fromItem y toItem
623
+ $ orden =0 ; // numero de orden en la consola
624
+ $ rowcount =0 ; // numero de columna en la hoja (5,10,15)
625
+ $ printed =1 ; // numero de orden que aparecera en el listado
626
+ for ($ orden =0 ;$ orden <count ($ items );$ orden ++) {
627
+ if ($ orden +1 <$ fromItem ) continue ;
628
+ if ($ orden +1 >$ toItem ) continue ;
629
+ // also skip items marked as "No Presentado"
630
+ $ row =$ items [$ orden ];
631
+ if (intval ($ row ['NoPresentado ' ])===1 ) continue ;
632
+
633
+ // ok. tenemos elemento a imprimir. Vamos a ver si hay que hacer salto de pagina
634
+ $ page =true ;
635
+ // si el numero de entradas cabe en una paquina omitimos saltos de pagina
636
+ if (count ($ items ) <= $ this ->numrows ) $ page =false ;
637
+ // en pre-agility tambien saltan todos juntos, y omitimos salto de pagina en el listado
638
+ if ( isMangaPreAgility ($ this ->manga ->Tipo )) $ page =false ;
639
+ // en caso de que se permita salto de pagina, comprobamos si hay cambio de categoria
640
+ // y en caso afirmativo, reseteamos el contador de fila y actualizamos ultima categoria activa
630
641
if ( $ page ) {
631
642
// if change in categoria, reset orden counter and force page change
632
643
$ ccats =compatible_categories ($ this ->heights ,$ this ->categoria );
633
644
if (!category_match ($ row ['Categoria ' ],$ this ->heights ,$ ccats )) {
634
645
$ rowcount =0 ;
635
- $ orden =1 ;
636
646
$ this ->categoria = $ row ['Categoria ' ];
637
647
}
638
648
}
639
-
649
+ // ahora vemos si hay que cambiar de pagina
640
650
// REMINDER: $this->cell( width, height, data, borders, where, align, fill)
641
- if ( ($ rowcount % $ this ->numrows ) == 0 ) { // assume $numrows entries per page
651
+ if ( ($ rowcount % $ this ->numrows ) == 0 ) { // assume $numrows entries per page
642
652
$ this ->AddPage ();
643
653
if ($ this ->numrows !=1 ) {
644
654
// indicamos nombre del operador que rellena la hoja
@@ -649,14 +659,14 @@ function composeTable() {
649
659
$ this ->Ln (15 );
650
660
}
651
661
}
662
+ // y finalmente imprimimos la celda en cuestion
652
663
switch ($ this ->numrows ) {
653
664
case 1 : $ this ->writeTableCell_1 ($ row ,$ printed );break ;
654
665
case 5 : $ this ->writeTableCell_5 ($ row ,$ printed );break ;
655
- case 10 : $ this ->writeTableCell_10 ($ row ,$ printed );break ;
656
- case 15 : $ this ->writeTableCell_15 ($ row ,$ printed );break ;
666
+ case 10 : $ this ->writeTableCell_10 ($ row ,$ printed );break ;
667
+ case 15 : $ this ->writeTableCell_15 ($ row ,$ printed );break ;
657
668
}
658
669
$ rowcount ++;
659
- $ orden ++;
660
670
$ printed ++;
661
671
}
662
672
// Línea de cierre
0 commit comments