35require_once DOL_DOCUMENT_ROOT.
'/core/class/commondocgenerator.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/commonnumrefgenerator.class.php';
58 public $verticalLinesSpacesCoordinates = [];
71 $type =
'accountancy';
74 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
105 $pdf->setPage($page);
106 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
108 $pdf->line($this->marge_gauche, $y, $this->page_largeur - $this->marge_droite, $y);
109 $pdf->SetLineStyle(array(
'dash' => 0));
126 abstract protected function addTotalLine(TCPDF $pdf, &$curY, &$nexY, $default_font_size,
string $label, $tab_top_newpage, $debit, $credit,
bool $uppercase =
true);
141 protected function addTitleLine(TCPDF $pdf, &$curY, &$nexY, $default_font_size,
string $columnKey,
string $label, $tab_top_newpage,
bool $uppercase =
true)
144 $pageposbefore = $pdf->getPage();
145 $pdf->SetFont(
'',
'B', $default_font_size);
146 $pdf->startTransaction();
149 $label = mb_strtoupper($label);
153 $pageposafter = $pdf->getPage();
154 if ($pageposafter > $pageposbefore) {
155 $pdf->rollbackTransaction(
true);
157 $pdf->AddPage(
'',
'',
true);
158 $pdf->setPage($pageposafter);
159 $curY = $tab_top_newpage + $this->tabTitleHeight;
163 $nexY = $pdf->GetY();
165 $this->verticalLinesSpacesCoordinates[$pdf->getPage()][] = [
'start' => $curY,
'end' => $nexY];
182 $colDef = $this->cols[$colKey];
183 $xStart = isset($colDef[
'xStartPos']) ? $colDef[
'xStartPos'] : $this->marge_gauche;
185 $titleWidth = $this->page_largeur - $this->marge_droite - $xStart;
189 $curentCellPaddinds = $pdf->getCellPaddings();
191 $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);
194 $pdf->writeHTMLCell($titleWidth, 2, $xStart, $curY, $columnText, 0, 1,
false,
true, $colDef[
'content'][
'align']);
198 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
211 public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
213 global $hookmanager, $conf;
215 foreach ($this->cols as $colKey => $colDef) {
219 'outputlangs' => $outputlangs,
220 'tab_top' => $tab_top,
221 'tab_height' => $tab_height,
222 'hidetop' => $hidetop
225 $reshook = $hookmanager->executeHooks(
'pdfTabTitles', $parameters, $this);
228 } elseif (empty($reshook)) {
234 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
237 if (!empty($colDef[
'border-left']) && isset($colDef[
'xStartPos'])) {
239 if (!empty($this->verticalLinesSpacesCoordinates[$pdf->getPage()])) {
240 $coordinates = $this->verticalLinesSpacesCoordinates[$pdf->getPage()];
241 array_unshift($coordinates, [
'start' =>
null,
'end' => $tab_top]);
242 $coordinates[] = [
'start' => $tab_top + $tab_height,
'end' =>
null];
244 foreach ($coordinates as $key => $yCoordinates) {
245 if (!isset($coordinates[$key-1][
'end'])) {
248 $pdf->line($colDef[
'xStartPos'], $coordinates[$key-1][
'end'], $colDef[
'xStartPos'], $yCoordinates[
'start']);
251 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
255 if (empty($hidetop)) {
257 $curentCellPaddinds = $pdf->getCellPaddings();
260 global $outputlangsbis;
261 if (is_object($outputlangsbis)) {
263 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], 0.5);
266 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], $colDef[
'title'][
'padding'][0], $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
268 if (isset($colDef[
'title'][
'align'])) {
269 $align = $colDef[
'title'][
'align'];
273 $pdf->SetXY($colDef[
'xStartPos'], $tab_top);
274 $textWidth = $colDef[
'width'];
275 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $align);
278 if (is_object($outputlangsbis) && trim($colDef[
'title'][
'label'])) {
279 $pdf->setCellPaddings($colDef[
'title'][
'padding'][3], 0, $colDef[
'title'][
'padding'][1], $colDef[
'title'][
'padding'][2]);
280 $pdf->SetXY($colDef[
'xStartPos'], $pdf->GetY());
281 $textbis = $outputlangsbis->transnoentities($colDef[
'title'][
'textkey']);
282 $pdf->MultiCell($textWidth, 2, $textbis,
'', $align);
285 $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
288 $pdf->setCellPaddings($curentCellPaddinds[
'L'], $curentCellPaddinds[
'T'], $curentCellPaddinds[
'R'], $curentCellPaddinds[
'B']);
293 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.