diff --git a/src/Util/Autofill.php b/src/Util/Autofill.php index 9f88ecf6e..92d9f8c88 100755 --- a/src/Util/Autofill.php +++ b/src/Util/Autofill.php @@ -41,8 +41,7 @@ class Autofill public function setRows($rows, $additional = null, $first_page = null) { $this->max_rows = $rows; - - $this->max_additional = $additional ?: $this->max_rows; + $this->max_additional = isset($additional) ? $additional: $this->max_rows; $this->max_rows_first_page = $first_page ?? $this->max_rows_first_page; } @@ -88,12 +87,12 @@ class Autofill if ($page > 1) { $rows = $this->space - $this->max_rows_first_page * ($page - 1); } else { - $rows = floor($this->space); + $rows = ceil($this->space); } - $number = $this->max_additional - $rows; + $number = $this->max_rows - $rows; - return $number > 0 ? $number : 0; + return $number; } public function generate() diff --git a/templates/ddt/body.php b/templates/ddt/body.php index 0b5a7e102..52866682f 100755 --- a/templates/ddt/body.php +++ b/templates/ddt/body.php @@ -23,11 +23,8 @@ $prezzi_ivati = setting('Utilizza prezzi di vendita comprensivi di IVA'); // Creazione righe fantasma $autofill = new Util\Autofill($options['pricing'] ? 6 : 3); -$rows_per_page = $rows_per_page ?: 18; -if (!empty($options['last-page-footer'])) { - $rows_per_page += 10; -} -$autofill->setRows($rows_per_page); +$rows_per_page = $options['pricing'] ? 21 : 20; +$autofill->setRows($rows_per_page, 0, $options['pricing'] ? 21 : 20); // Intestazione tabella per righe echo " diff --git a/templates/preventivi/body.php b/templates/preventivi/body.php index 93c00fbfc..8ae2a6f49 100755 --- a/templates/preventivi/body.php +++ b/templates/preventivi/body.php @@ -65,7 +65,7 @@ if ($has_image) { // Creazione righe fantasma $autofill = new Util\Autofill($columns); -$autofill->setRows(20, 10); +$autofill->setRows(26, 0); echo '