34require_once DOL_DOCUMENT_ROOT.
'/core/class/commondocgenerator.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/commonnumrefgenerator.class.php';
57 public $verticalLinesSpacesCoordinates = [];
70 $type =
'accountancy';
73 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
104 $pdf->setPage($page);
105 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
107 $pdf->line($this->marge_gauche, $y, $this->page_largeur - $this->marge_droite, $y);
108 $pdf->SetLineStyle(array(
'dash' => 0));
125 abstract protected function addTotalLine(TCPDF $pdf, &$curY, &$nexY, $default_font_size,
string $label, $tab_top_newpage, $debit, $credit,
bool $uppercase =
true);
140 protected function addTitleLine(TCPDF $pdf, &$curY, &$nexY, $default_font_size,
string $columnKey,
string $label, $tab_top_newpage,
bool $uppercase =
true)
143 $pageposbefore = $pdf->getPage();
144 $pdf->SetFont(
'',
'B', $default_font_size);
145 $pdf->startTransaction();
148 $label = mb_strtoupper($label);
152 $pageposafter = $pdf->getPage();
153 if ($pageposafter > $pageposbefore) {
154 $pdf->rollbackTransaction(
true);
156 $pdf->AddPage(
'',
'',
true);
157 $pdf->setPage($pageposafter);
158 $curY = $tab_top_newpage + $this->tabTitleHeight;
162 $nexY = $pdf->GetY();
164 $this->verticalLinesSpacesCoordinates[$pdf->getPage()][] = [
'start' => $curY,
'end' => $nexY];
182 $colDef = $this->cols[$colKey];
184 $curentCellPaddinds = $pdf->getCellPaddings();
186 $pdf->setCellPaddings(isset($colDef[
'content'][
'padding'][3]) ? $colDef[
'content'][
'padding'][3] : 0, isset($colDef[
'content'][
'padding'][0]) ? $colDef[
'content'][
'padding'][0] : 0, isset($colDef[
'content'][
'padding'][1]) ? $colDef[
'content'][
'padding'][1] : 0, isset($colDef[
'content'][
'padding'][2]) ? $colDef[
'content'][
'padding'][2] : 0);
187 $pdf->writeHTMLCell($this->page_largeur - $this->marge_droite, 2, isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : 0, $curY, $columnText, 0, 1,
false,
true, $colDef[
'content'][
'align']);
191 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
204 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
206 global $hookmanager, $conf;
208 foreach ($this->cols as $colKey => $colDef) {
212 'outputlangs' => $outputlangs,
213 'tab_top' => $tab_top,
214 'tab_height' => $tab_height,
215 'hidetop' => $hidetop
218 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
221 } elseif (empty($reshook)) {
227 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
230 if (!empty($colDef[
'border-left']) && isset($colDef[
'xStartPos'])) {
232 if (!empty($this->verticalLinesSpacesCoordinates[$pdf->getPage()])) {
233 $coordinates = $this->verticalLinesSpacesCoordinates[$pdf->getPage()];
234 array_unshift($coordinates, [
'start' =>
null,
'end' => $tab_top]);
235 $coordinates[] = [
'start' => $tab_top + $tab_height,
'end' =>
null];
237 foreach ($coordinates as $key => $yCoordinates) {
238 if (!isset($coordinates[$key-1][
'end'])) {
241 $pdf->line($colDef[
'xStartPos'], $coordinates[$key-1][
'end'], $colDef[
'xStartPos'], $yCoordinates[
'start']);
244 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
248 if (empty($hidetop)) {
250 $curentCellPaddinds = $pdf->getCellPaddings();
253 global $outputlangsbis;
254 if (is_object($outputlangsbis)) {
256 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
259 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
261 if (isset($colDef[
'title'][
'align'])) {
262 $align = $colDef[
'title'][
'align'];
266 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
267 $textWidth = $colDef[
'width'];
268 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $align);
271 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
272 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
273 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
274 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
275 $pdf->MultiCell($textWidth, 2, $textbis,
'', $align);
278 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
281 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
286 return $this->tabTitleHeight;
if(! $sortfield) if(! $sortorder) $object
Class to manage Ledger (General Ledger and Subledger)
Parent class for documents (PDF, ODT, ...) generators.
getColumnStatus($colKey)
get column status from column key
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
setAfterColsLinePositionsData(string $colId, float $y, int $pageNumb)
Used for to set afterColsLinePositions var in a pdf draw line loop.
Parent class for number ref generators.
Parent class to manage numbering of Sale Orders.
getNextValue(BookKeeping $object)
Return next free value.
getExample()
Return an example of numbering.
Parent class of accountancy models.
addTitleLine(TCPDF $pdf, &$curY, &$nexY, $default_font_size, string $columnKey, string $label, $tab_top_newpage, bool $uppercase=true)
Add the total accountancy group line to pdf.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
addDashLine(TCPDF $pdf, int $page, $y)
Add dash line.
write_file(BookKeeping $object, Translate $outputlangs, string $srctemplatepath='', bool $directDownload=true)
Function to build pdf onto disk.
printTitleContent($pdf, $curY, $colKey, $columnText)
Print a title using the colKey start position, and the end of table as end position.
addTotalLine(TCPDF $pdf, &$curY, &$nexY, $default_font_size, string $label, $tab_top_newpage, $debit, $credit, bool $uppercase=true)
Add a total line to pdf.
pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
Print standard column content.
Class to manage translations.
getListOfModels($db, $type, $maxfilenamelength=0, $showempty=0)
Return list of activated modules usable for document generation.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.