Hello Kool Report team, I created a report with PDF export using CloudExport. This report has two grouping level. 1) Activite 2) Article - this grouping has a calculation of Count ... When PDF exporting I want a break page on Activite group change. But I Have pagebreak on the two levels 1 and 2. Is it a way to not page break on Article group change ?
use \koolreport\widgets\google;
use \koolreport\widgets\koolphp\Table;
$avertissement = "ATTENTION : Ne pas remplacer un colis par un autre sans vérifer sa disponibilité !";
?>
<?php
// pour trouver la référence de la promesse et la mettre dans $reference
try
{
// On se connecte à MySQL
$mysqlClient = new PDO('mysql:host=185.224.137.3;dbname=u521225422_phamm;charset=utf8','u521225422_admin','NewTech63');
//exemple :'mysql:host=localhost;dbname=my_recipes;charset=utf8', 'root', 'root');
}
catch(Exception $e)
{
// En cas d'erreur, on affiche un message et on arrête tout
die('Erreur : '.$e->getMessage());
}
// Si tout va bien, on peut continuer
// On récupère tout le contenu de la table
$sqlQuery = "SELECT
promesses.reference
FROM
promesses
WHERE promesses.active='OUI'";
$recipesStatement = $mysqlClient->prepare($sqlQuery);
$recipesStatement->execute();
$recipes = $recipesStatement->fetchAll();
// On affiche chaque reference une à une
foreach ($recipes as $recipe) {
?>
<p><?php $ref = $recipe['reference']; //on a récupéré la référence de la promesse unique dans $ref
$ref= $ref.". ";?></p>
<?php
}
?>
<html>
<style>
.title {
text-align: center;
border: 3px solid green;
}
</style>
<body style="margin-top:2cm;margin-right:1cm;margin-bottom:2cm;margin-left:1cm;width:95%">
<link rel="stylesheet" href="../../../assets/bs3/bootstrap.min.css" />
<link rel="stylesheet" href="../../../assets/bs3/bootstrap-theme.min.css" />
<div class="title">
<h1>Colis à sortir</h1>
</h1>
<?php
echo '<img src="logoPHAMM.png" border="0" />' . "\n";
?>
</h1>
<br>
<br>
<h1><?php echo $ref; ?></h1>
</div>
<DIV STYLE="page-break-before:always"></DIV>
<div class="page-break"></div>
<style>
@media print {
#Colis_A_Sortir .break-row td {
padding: 0 !important;
}
* {
-webkit-print-color-adjust: exact !important;
}
}
</style>
<html>
<head>
<title>Colis à sortir</title>
</head>
<body style='margin: 0.2in'>
<link rel="stylesheet" href="../../../assets/bs3/bootstrap.min.css" />
<link rel="stylesheet" href="../../../assets/bs3/bootstrap-theme.min.css" />
<header>
<div style="font-size:10px !important; color:green; padding-left:10px; width:530px;">
<span style='text-align:center ;'>
<img src='logo.png' height='20px' style='position:relative; top:2px'/>
</span>
<span style='position: relative; top: 10px; float: right'>
<i>
<?php
echo $ref." ".date('d/m/Y');
?>
</i>
</span>
</div>
</header>
<footer>
<div style="font-size:10px !important; color:green; padding-left:10px; width:530px;">
<span style='position: relative; top: 10px; float: right'>
<i>Page: {pageNumber} / {totalPages} </i>
</span>
<span></span>
<img src='logo.png' height='20px' style='position:relative; top:5px'/>
<span style='color:red;text-align:center;'/>
<?php echo $avertissement;?>
</span>
</div>
</footer>
<?php
Table::create(array(
"dataStore" => $this->dataStore('promesse_active'),
"cssClass"=>array(
"table"=>"table-bordered table-striped table-hover"
),
"name"=>"Colis_A_Sortir",
"grouping"=>array(
"activite",
"article"=>array(
"calculate"=>array(
"{countColis}"=>array("count","numero")
),
"top"=>"<td><b>{countColis} Colis {article}</b></td>",
),
),
"sorting"=>array(
"activite"=>"asc",
"article"=>"asc",
"numero"=>"asc"
),
"columns" =>
array(
"numero"=>array(
"type"=>"string"
),
"comment"=>array(
"type"=>"string"
)
),
));
?>
<table id='tempTable' style='display:none'>
<tr class='break-row'>
<td colspan='999'>
<div></div>
<div class='break-before'></div>
</td>
</tr>
</table>
<script>
KoolReport.load.onDone(function() {
var breakRow = document.querySelector('#tempTable tr');
var tbody = document.querySelector('#Colis_A_Sortir tbody');
var rows = document.querySelectorAll('#Colis_A_Sortir tr.row-group');
for (var i=1; i<rows.length; i+=1) {
tbody.insertBefore(breakRow.cloneNode(true), rows[i]);
}
});
</script>
</body>
</html>
Thank you for help !
François