pdf_octopus
class pdf_octopus extends ModelePDFFactures (View source)
Class to manage PDF invoice template octopus
Properties
| string | $name | ||
| string | $version | Dolibarr version of the loaded document |
|
| string | $error | from CommonDocGenerator | |
| string[] | $errors | from CommonDocGenerator | |
| string[] | $warnings | from CommonDocGenerator | |
| DoliDB | $db | ||
| ExtraFields | $extrafieldsCache | from CommonDocGenerator | |
| int | $update_main_doc_field | ||
| string | $scandir | from CommonDocGenerator | |
| string | $description | ||
| array{0: float, 1: float} | $format | from CommonDocGenerator | |
| string | $type | ||
| float | $page_hauteur | from CommonDocGenerator | |
| float | $page_largeur | from CommonDocGenerator | |
| float | $marge_gauche | from CommonDocGenerator | |
| float | $marge_droite | from CommonDocGenerator | |
| float | $marge_haute | from CommonDocGenerator | |
| float | $marge_basse | from CommonDocGenerator | |
| int | $corner_radius | from CommonDocGenerator | |
| int<0, 1> | $option_logo | from CommonDocGenerator | |
| int<0, 1> | $option_tva | from CommonDocGenerator | |
| int<0, 1> | $option_multilang | from CommonDocGenerator | |
| int<0, 1> | $option_freetext | from CommonDocGenerator | |
| int<0, 1> | $option_draft_watermark | from CommonDocGenerator | |
| string | $watermark | from CommonDocGenerator | |
| int<0, 1> | $option_modereg | from CommonDocGenerator | |
| int<0, 1> | $option_condreg | from CommonDocGenerator | |
| int<0, 1> | $option_escompte | from CommonDocGenerator | |
| int<0, 1> | $option_credit_note | from CommonDocGenerator | |
| array<string, float> | $tva | from ModelePDFFactures | |
| array<string, array{amount: float}> | $tva_array | from ModelePDFFactures | |
| array<int, array<string, float>> | $localtax1 | Local tax rates Array[tax_type][tax_rate] |
from ModelePDFFactures |
| array<int, array<string, float>> | $localtax2 | Local tax rates Array[tax_type][tax_rate] |
from ModelePDFFactures |
| int | $tabTitleHeight | ||
| array{align?: "R"|"C"|"L", padding?: array<float|int>} | $defaultTitlesFieldsStyle | from CommonDocGenerator | |
| array{align?: "R"|"C"|"L", padding?: array<float|int>} | $defaultContentsFieldsStyle | from CommonDocGenerator | |
| Societe | $emetteur | from CommonDocGenerator | |
| array{0: int, 1: int} | $phpmin | from CommonDocGenerator | |
| array<string, array{rank: int, width: float|false, status: bool|int<0, 1>, border-left?: bool, title: array{textkey: string, label?: string, align?: string, padding?: array{0: float, 1: float, 2: float, 3: float}}, content?: array{align?: string, padding?: array{0: float, 1: float, 2: float, 3: float}}}> | $cols | ||
| array<string, array{page: int, y: float|int}> | $afterColsLinePositions | from CommonDocGenerator | |
| array{fullpath: string} | $result | from CommonDocGenerator | |
| float | $posxlabel | from CommonDocGenerator | |
| float | $posxup | from ModelePDFFactures | |
| float | $posxref | from CommonDocGenerator | |
| float | $posxpicture | from ModelePDFFactures | |
| float | $posxdesc | from ModelePDFFactures | |
| float | $posxqty | from ModelePDFFactures | |
| float | $posxpuht | from CommonDocGenerator | |
| float | $posxtva | from ModelePDFFactures | |
| float|int | $posxtotalht | from CommonDocGenerator | |
| float | $postotalht | from ModelePDFFactures | |
| float | $posxunit | from ModelePDFFactures | |
| float | $posxdiscount | from ModelePDFFactures | |
| float | $posxworkload | from CommonDocGenerator | |
| float | $posxtimespent | from CommonDocGenerator | |
| float | $posxprogress | from CommonDocGenerator | |
| bool | $atleastonephoto | from CommonDocGenerator | |
| int<0, 1> | $atleastoneratenotnull | from ModelePDFFactures | |
| int<0, 1> | $atleastonediscount | from ModelePDFFactures | |
| int | $heightforinfotot | ||
| int | $heightforfreetext | ||
| float | $heightforfooter | ||
| float | $tab_top | ||
| int|float | $tab_top_newpage | ||
| bool | $situationinvoice | ||
| int | $categoryOfOperation | ||
| Facture, date_derniere_situation?: int, cumul_anterieur: array<"HT"|"HTnet"|"retenue_garantie"|"total_a_payer"|"travaux_sup"|"TTC"|"TVA"|Facture, date_derniere_situation: int}, nouveau_cumul: array<int|string, mixed|float|int>} | $TDataSituation | Situation invoices |
|
| int | $posx_cumul_anterieur | ||
| int | $posx_new_cumul | ||
| int | $posx_current | ||
| int | $is_rg | ||
| int | $tplidx |
Methods
Constructor
Define array with couple substitution key => substitution value
Define array with couple substitution key => substitution value
Define array with couple substitution key => substitution value
Define array with couple substitution key => substitution value For example {company_name}, {company_name_alias}
Define array with couple substitution key => substitution value
Define array with couple substitution key => substitution value
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
Define array with couple substitution key => substitution value
Fill array with couple extrafield key => extrafield value Note that vars into substitutions array are formatted.
Rect pdf
Print a rounded rectangle on the PDF
Get position in PDF after col display
Used for reset afterColsLinePositions var in start of a new pdf draw line loop
Used for to set afterColsLinePositions var in a pdf draw line loop
uasort callback function to Sort columns fields
Prepare Array Column Field
get column content width from column key
get column content X (abscissa) left position from column key
get column position rank from column key
print standard column content
print description column content
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note block
display extrafields columns content
Print standard column content
Define Array Column Field for extrafields
Define Array Column Field
Return list of active generation modules
Function to build pdf onto disk
Get the height for bottom-page QR invoice in mm, depending on the page number.
Add SwissQR invoice at bottom of page 1
Show miscellaneous information (payment mode, payment term, ...)
Show total to pay
Show table for lines
Show table for lines
Calculates the sum of two arrays, key by key, taking into account nested arrays
Get info line of the last situation
Print a rounded rectangle on the PDF
Get data about invoice
Show last page with a resume of all invoices, proposals and orders
Details
__construct($db)
Constructor
@param DoliDB $db Database handler
array<string, float|string>
get_substitutionarray_user(User $user, Translate $outputlangs)
Define array with couple substitution key => substitution value
array<string, float|string>
getSubstitutionarrayMember(Adherent $member, Translate $outputlangs)
Define array with couple substitution key => substitution value
array<string, mixed>
get_substitutionarray_mysoc(Societe $mysoc, Translate $outputlangs)
Define array with couple substitution key => substitution value
array<string, mixed>
get_substitutionarray_thirdparty(Societe $object, Translate $outputlangs, string $array_key = 'company')
Define array with couple substitution key => substitution value For example {company_name}, {company_name_alias}
array<string, mixed>
get_substitutionarray_contact(Contact $object, Translate $outputlangs, string $array_key = 'object')
Define array with couple substitution key => substitution value
array<string, mixed>
get_substitutionarray_other(Translate $outputlangs)
Define array with couple substitution key => substitution value
array<string, mixed>
get_substitutionarray_object(CommonObject $object, Translate $outputlangs, string $array_key = 'object')
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
get_substitutionarray_lines(CommonObjectLine $line, Translate $outputlangs, $linenumber = 0)
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
array<string, mixed>
get_substitutionarray_shipment(Expedition $object, Translate $outputlangs, string $array_key = 'object')
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
array<string, mixed>
get_substitutionarray_each_var_object(CommonObject|float|int|string>|CommonObject $object, Translate $outputlangs, bool|int $recursive = 1)
Define array with couple substitution key => substitution value
array<string, float|string>
fill_substitutionarray_with_extrafields(CommonObject $object, array<string, float|string> $array_to_fill, $extrafields, $array_key, $outputlangs)
Fill array with couple extrafield key => extrafield value Note that vars into substitutions array are formatted.
void
printRect(TCPDI|TCPDF $pdf, float $x, float $y, float $l, float $h, int<-1, 1> $hidetop = 0, int<0, 1> $hidebottom = 0)
Rect pdf
void
printRoundedRect(TCPDF $pdf, float $x, float $y, float $w, float $h, float $r, int<-1, 1> $hidetop = 0, int $hidebottom = 0, string $style = 'D')
Print a rounded rectangle on the PDF
false|array{page: int, y: float|int, col: string}
getMaxAfterColsLinePositionsData()
Get position in PDF after col display
void
resetAfterColsLinePositionsData(float $y, int $pageNumb)
Used for reset afterColsLinePositions var in start of a new pdf draw line loop
void
setAfterColsLinePositionsData(string $colId, float $y, int $pageNumb)
Used for to set afterColsLinePositions var in a pdf draw line loop
columnSort($a, array{rank?: int} $b)
uasort callback function to Sort columns fields
@param array{rank?:int} $a PDF lines array fields configs
prepareArrayColumnField($object, Translate $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
Prepare Array Column Field
@param CommonObject $object common object
float
getColumnContentWidth($colKey)
get column content width from column key
@param string $colKey the column key
float
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
@param string $colKey the column key
int
getColumnRank($colKey)
get column position rank from column key
@param string $colKey the column key
insertNewColumnDef($newColKey, array{rank?: int} $defArray, $targetCol = '', $insertAfterTarget = false)
get column position rank from column key
@param string $newColKey the new column key
printStdColumnContent(TCPDI|TCPDF $pdf, $curY, $colKey, $columnText = '')
print standard column content
printColDescContent(TCPDI|TCPDF $pdf, $curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
print description column content
getExtrafieldContent($object, string $extrafieldKey, $outputlangs = null)
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note block
@param CommonObject $object Common object
getExtrafieldsInHtml($object, Translate $outputlangs, $params = array())
display extrafields columns content
@param CommonObject|CommonObjectLine $object line of common object
bool
getColumnStatus($colKey)
get column status from column key
@param string $colKey the column key
float
pdfTabTitles(TCPDI|TCPDF $pdf, float $tab_top, float $tab_height, Translate $outputlangs, int $hidetop = 0)
Print standard column content
defineColumnExtrafield($object, Translate $outputlangs, $hidedetails = 0)
Define Array Column Field for extrafields
@param CommonObject $object common object det
defineColumnField($object, Translate $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
Define Array Column Field
@param CommonObject $object common object
static
liste_modeles($db, int<0, max> $maxfilenamelength = 0)
Return list of active generation modules
@param DoliDB $db Database handler
write_file($object, Translate $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
Function to build pdf onto disk
@param Facture $object Object to generate
protected int
getHeightForQRInvoice(int $pagenbr, Facture $object, Translate $langs)
Get the height for bottom-page QR invoice in mm, depending on the page number.
bool
addBottomQRInvoice(TCPDF $pdf, Facture $object, Translate $langs)
Add SwissQR invoice at bottom of page 1
drawPaymentsTable($pdf, Facture $object, $posy, $outputlangs)
Show payments table
@param TCPDI|TCPDF $pdf Object PDF
protected
drawInfoTable($pdf, Facture $object, $posy, $outputlangs, $outputlangsbis)
Show miscellaneous information (payment mode, payment term, ...)
@param TCPDI|TCPDF $pdf Object PDF
protected float
drawTotalTable($pdf, Facture $object, float $deja_regle, float $posy, Translate $outputlangs, $outputlangsbis)
Show total to pay
@param TCPDI|TCPDF $pdf Object PDF
protected
_tableau($pdf, float $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '', $outputlangsbis = null)
Show table for lines
@param TCPDI|TCPDF $pdf Object PDF
protected
_pagehead($pdf, Facture $object, $showaddress, $outputlangs, $outputlangsbis = null)
Show top header of page. This include the logo, ref and address blocks
@param TCPDI|TCPDF $pdf Object PDF
protected
_pagefoot($pdf, Facture $object, $outputlangs, $hidefreetext = 0, $heightforqrinvoice = 0)
Show footer of page. Need this->emetteur object
@param TCPDI|TCPDF $pdf Object PDF
tableFirstPage($pdf, float $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
Show table for lines
@param TCPDI|TCPDF $pdf Object PDF
Facture, date_derniere_situation?: int, cumul_anterieur: array<"HT"|"HTnet"|"retenue_garantie"|"total_a_payer"|"travaux_sup"|"TTC"|"TVA"|Facture, date_derniere_situation: int}, nouveau_cumul: array<int|string, mixed|float|int>}
getDataSituation(Facture $object)
Recovers data from situation invoices
NOTE : Main work: lines on the status invoice that were already present on the previous invoice Additional work: lines on the status invoice that have been added to the previous invoice Example : S1 with l1 (tp), l2 (tp) S2 with l1 (tp), l2 (tp), l3 (ts) S3 with l1 (tp), l2 (tp), l3 (tp), l4 (ts)
array<int|string, int|float|mixed[]>
sumSituation(array<int|string, int|float|mixed[]> $a, array<int|string, int|float|mixed[]> $b)
Calculates the sum of two arrays, key by key, taking into account nested arrays
bool
displayRetainedWarranty(Facture $object)
Display retained Warranty
void|array{progress_prec: float, total_ht_without_progress: float, total_ht: float}
getInfosLineLastSituation(Facture $object, FactureLigne $current_line)
Get info line of the last situation
void
printRoundedRectBtp(TCPDF $pdf, float $x, float $y, float $w, float $h, float $r, int<-1, 1> $hidetop = 0, int<0, 1> $hidebottom = 0, string $style = 'D')
Print a rounded rectangle on the PDF
Facture, date_derniere_situation: int}
btpGetInvoiceAmounts(int $id, bool $forceReadFromDB = false)
Get data about invoice