CommonSubtotal
trait CommonSubtotal (View source)
Trait CommonSubtotal
Add subtotals lines
Properties
| static int | $PRODUCT_TYPE | ||
| static string[] | $TITLE_OPTIONS | ||
| static string[] | $SUBTOTAL_OPTIONS | ||
| static string[] | $ALLOWED_TYPES |
Methods
Adds a subtotals line to a document.
Deletes a subtotal or a title line from a document.
Updates a subtotal line of a document.
Updates a block of lines of a document.
Return the total_ht of lines that are above the current line (excluded) and that are not a subtotal line until a title line of the same level is found
Return the multicurrency_total_ht of lines that are above the current line (excluded) and that are not a subtotal line until a title line of the same level is found
Retrieve the background color associated with a specific subtotal level.
Retrieve current object possible titles to choose from
Retrieve the current object possible levels (defined in admin page)
Returns an array with the IDs of the line that we don't need to show to avoid empty blocks
Details
int
addSubtotalLine(Translate $langs, string $desc, int $depth, array<string, string>|string $options = array(), int $parent_line = 0)
Adds a subtotals line to a document.
This function inserts a subtotal line based on the given parameters.
int
deleteSubtotalLine(Translate $langs, int $id, bool $correspondingstline = false, User $user = null)
Deletes a subtotal or a title line from a document.
If the corresponding subtotal line exists and second parameter true, it will also be deleted.
int
updateSubtotalLine(Translate $langs, int $lineid, string $desc, int $depth, array<string, string>|string $options)
Updates a subtotal line of a document.
This function updates a subtotals line based on its id and the given parameters. Updating a title line updates the corresponding subtotal line except options.
int
updateSubtotalLineBlockLines(Translate $langs, int $linerang, string $mode, int $value)
Updates a block of lines of a document.
string
getSubtotalLineAmount(object $line)
Return the total_ht of lines that are above the current line (excluded) and that are not a subtotal line until a title line of the same level is found
string
getSubtotalLineMulticurrencyAmount(object $line)
Return the multicurrency_total_ht of lines that are above the current line (excluded) and that are not a subtotal line until a title line of the same level is found
string|null
getSubtotalColors(int|float $level)
Retrieve the background color associated with a specific subtotal level.
array<string, string>
getPossibleTitles()
Retrieve current object possible titles to choose from
array<int, string>
getPossibleLevels(Translate $langs)
Retrieve the current object possible levels (defined in admin page)
int[]
getDisabledShippmentSubtotalLines()
Returns an array with the IDs of the line that we don't need to show to avoid empty blocks